@dxos/react-ui-stack 0.8.4-main.b97322e → 0.8.4-main.c4373fc
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-SM27YTH3.mjs} +406 -186
- package/dist/lib/browser/chunk-SM27YTH3.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +9 -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-MMAOXKOM.mjs} +406 -186
- package/dist/lib/node-esm/chunk-MMAOXKOM.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +9 -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 +6 -5
- 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 +16 -8
- 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 +13 -6
- 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 +16 -14
- package/src/components/StackItem/StackItem.tsx +26 -18
- package/src/components/StackItem/StackItemContent.tsx +17 -5
- package/src/components/StackItem/StackItemHeading.tsx +4 -8
- 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 +30 -12
- 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,26 +430,26 @@ 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";
|
|
225
437
|
import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
|
|
226
438
|
import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
227
|
-
import { useFocusableGroup
|
|
439
|
+
import { useFocusableGroup } 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
|
|
239
|
-
var StackItemContent = /* @__PURE__ */ forwardRef2(({ children, toolbar, statusbar, layoutManaged, classNames, size = "intrinsic", ...props }, forwardedRef) => {
|
|
240
|
-
var _effect =
|
|
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";
|
|
451
|
+
var StackItemContent = /* @__PURE__ */ forwardRef2(({ children, toolbar, statusbar, layoutManaged, classNames, size = "intrinsic", scrollable, ...props }, forwardedRef) => {
|
|
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", scrollable ? "min-bs-0 overflow-y-auto scrollbar-thin contain-layout" : "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", 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,29 @@ var StackItemDragHandle = ({ asChild, children }) => {
|
|
|
288
500
|
};
|
|
289
501
|
|
|
290
502
|
// src/components/StackItem/StackItemHeading.tsx
|
|
291
|
-
import { useSignals as
|
|
292
|
-
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
503
|
+
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
293
504
|
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
294
|
-
import
|
|
505
|
+
import React5, { forwardRef as forwardRef3 } from "react";
|
|
295
506
|
import { useAttention } from "@dxos/react-ui-attention";
|
|
296
|
-
import { mx as
|
|
507
|
+
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
297
508
|
var StackItemHeading = ({ children, classNames, asChild, separateOnScroll, ...props }) => {
|
|
298
|
-
var _effect =
|
|
509
|
+
var _effect = _useSignals5();
|
|
299
510
|
try {
|
|
300
511
|
const { orientation } = useStack();
|
|
301
|
-
const focusableGroupAttrs = useFocusableGroup({
|
|
302
|
-
tabBehavior: "limited"
|
|
303
|
-
});
|
|
304
512
|
const Root = asChild ? Slot2 : "div";
|
|
305
|
-
return /* @__PURE__ */
|
|
513
|
+
return /* @__PURE__ */ React5.createElement(Root, {
|
|
306
514
|
role: "heading",
|
|
307
515
|
...props,
|
|
308
|
-
|
|
309
|
-
...focusableGroupAttrs,
|
|
310
|
-
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)
|
|
516
|
+
className: mx4("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)
|
|
311
517
|
}, children);
|
|
312
518
|
} finally {
|
|
313
519
|
_effect.f();
|
|
314
520
|
}
|
|
315
521
|
};
|
|
316
522
|
var StackItemHeadingStickyContent = ({ children }) => {
|
|
317
|
-
var _effect =
|
|
523
|
+
var _effect = _useSignals5();
|
|
318
524
|
try {
|
|
319
|
-
return /* @__PURE__ */
|
|
525
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
320
526
|
role: "none",
|
|
321
527
|
className: "sticky block-start-0 bg-[--sticky-bg] p-1 is-full"
|
|
322
528
|
}, children);
|
|
@@ -325,13 +531,13 @@ var StackItemHeadingStickyContent = ({ children }) => {
|
|
|
325
531
|
}
|
|
326
532
|
};
|
|
327
533
|
var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related, classNames, ...props }, forwardedRef) => {
|
|
328
|
-
var _effect =
|
|
534
|
+
var _effect = _useSignals5();
|
|
329
535
|
try {
|
|
330
536
|
const { hasAttention, isAncestor, isRelated } = useAttention(attendableId);
|
|
331
|
-
return /* @__PURE__ */
|
|
537
|
+
return /* @__PURE__ */ React5.createElement("h1", {
|
|
332
538
|
...props,
|
|
333
539
|
"data-attention": (related && isRelated || hasAttention || isAncestor).toString(),
|
|
334
|
-
className:
|
|
540
|
+
className: mx4("pli-1 min-is-0 is-0 grow truncate font-medium text-baseText data-[attention=true]:text-accentText self-center", classNames),
|
|
335
541
|
ref: forwardedRef
|
|
336
542
|
});
|
|
337
543
|
} finally {
|
|
@@ -340,17 +546,17 @@ var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related
|
|
|
340
546
|
});
|
|
341
547
|
|
|
342
548
|
// src/components/StackItem/StackItemResizeHandle.tsx
|
|
343
|
-
import { useSignals as
|
|
344
|
-
import
|
|
549
|
+
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
550
|
+
import React6 from "react";
|
|
345
551
|
import { ResizeHandle } from "@dxos/react-ui-dnd";
|
|
346
552
|
var MIN_WIDTH = 20;
|
|
347
553
|
var MIN_HEIGHT = 3;
|
|
348
554
|
var StackItemResizeHandle = () => {
|
|
349
|
-
var _effect =
|
|
555
|
+
var _effect = _useSignals6();
|
|
350
556
|
try {
|
|
351
557
|
const { orientation } = useStack();
|
|
352
558
|
const { setSize, size } = useStackItem();
|
|
353
|
-
return /* @__PURE__ */
|
|
559
|
+
return /* @__PURE__ */ React6.createElement(ResizeHandle, {
|
|
354
560
|
side: orientation === "horizontal" ? "inline-end" : "block-end",
|
|
355
561
|
fallbackSize: DEFAULT_EXTRINSIC_SIZE,
|
|
356
562
|
minSize: orientation === "horizontal" ? MIN_WIDTH : MIN_HEIGHT,
|
|
@@ -363,28 +569,28 @@ var StackItemResizeHandle = () => {
|
|
|
363
569
|
};
|
|
364
570
|
|
|
365
571
|
// src/components/StackItem/StackItemSigil.tsx
|
|
366
|
-
import { useSignals as
|
|
367
|
-
import
|
|
572
|
+
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
573
|
+
import React8, { Fragment, forwardRef as forwardRef4, useState as useState4 } from "react";
|
|
368
574
|
import { keySymbols } from "@dxos/keyboard";
|
|
369
575
|
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
370
576
|
import { useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
371
|
-
import { descriptionText, mx as
|
|
577
|
+
import { descriptionText, mx as mx5 } from "@dxos/react-ui-theme";
|
|
372
578
|
import { getHostPlatform } from "@dxos/util";
|
|
373
579
|
|
|
374
580
|
// src/components/StackItem/MenuSignifier.tsx
|
|
375
|
-
import { useSignals as
|
|
376
|
-
import
|
|
581
|
+
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
582
|
+
import React7 from "react";
|
|
377
583
|
var MenuSignifierHorizontal = () => {
|
|
378
|
-
var _effect =
|
|
584
|
+
var _effect = _useSignals7();
|
|
379
585
|
try {
|
|
380
|
-
return /* @__PURE__ */
|
|
586
|
+
return /* @__PURE__ */ React7.createElement("svg", {
|
|
381
587
|
className: "absolute block-end-[7px]",
|
|
382
588
|
width: 20,
|
|
383
589
|
height: 2,
|
|
384
590
|
viewBox: "0 0 20 2",
|
|
385
591
|
stroke: "currentColor",
|
|
386
592
|
opacity: 0.5
|
|
387
|
-
}, /* @__PURE__ */
|
|
593
|
+
}, /* @__PURE__ */ React7.createElement("line", {
|
|
388
594
|
x1: 0.5,
|
|
389
595
|
y1: 0.75,
|
|
390
596
|
x2: 19,
|
|
@@ -401,11 +607,11 @@ var MenuSignifierHorizontal = () => {
|
|
|
401
607
|
|
|
402
608
|
// src/components/StackItem/StackItemSigil.tsx
|
|
403
609
|
var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNames, related, isMenu = true, children, ...props }, forwardedRef) => {
|
|
404
|
-
var _effect =
|
|
610
|
+
var _effect = _useSignals8();
|
|
405
611
|
try {
|
|
406
612
|
const { hasAttention, isAncestor, isRelated } = useAttention2(attendableId);
|
|
407
613
|
const variant = related && isRelated || hasAttention || isAncestor ? "primary" : "ghost";
|
|
408
|
-
return /* @__PURE__ */
|
|
614
|
+
return /* @__PURE__ */ React8.createElement(Button, {
|
|
409
615
|
...props,
|
|
410
616
|
variant,
|
|
411
617
|
classNames: [
|
|
@@ -413,50 +619,50 @@ var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNam
|
|
|
413
619
|
classNames
|
|
414
620
|
],
|
|
415
621
|
ref: forwardedRef
|
|
416
|
-
}, isMenu && /* @__PURE__ */
|
|
622
|
+
}, isMenu && /* @__PURE__ */ React8.createElement(MenuSignifierHorizontal, null), children);
|
|
417
623
|
} finally {
|
|
418
624
|
_effect.f();
|
|
419
625
|
}
|
|
420
626
|
});
|
|
421
627
|
var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
422
|
-
var _effect =
|
|
628
|
+
var _effect = _useSignals8();
|
|
423
629
|
try {
|
|
424
630
|
const { t } = useTranslation(translationKey);
|
|
425
|
-
const [optionsMenuOpen, setOptionsMenuOpen] =
|
|
631
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = useState4(false);
|
|
426
632
|
const hasActions = actionGroups && actionGroups.length > 0;
|
|
427
|
-
const button = /* @__PURE__ */
|
|
633
|
+
const button = /* @__PURE__ */ React8.createElement(StackItemSigilButton, {
|
|
428
634
|
attendableId,
|
|
429
635
|
related,
|
|
430
636
|
isMenu: hasActions,
|
|
431
637
|
// TODO(wittjosiah): Better disabling of interactive styles when no action are available.
|
|
432
638
|
// Remove underscore icon when no actions are available?
|
|
433
639
|
classNames: !hasActions && "cursor-default"
|
|
434
|
-
}, /* @__PURE__ */
|
|
640
|
+
}, /* @__PURE__ */ React8.createElement("span", {
|
|
435
641
|
className: "sr-only"
|
|
436
|
-
}, triggerLabel), /* @__PURE__ */
|
|
642
|
+
}, triggerLabel), /* @__PURE__ */ React8.createElement(Icon, {
|
|
437
643
|
icon,
|
|
438
644
|
size: 5
|
|
439
645
|
}));
|
|
440
646
|
if (!hasActions) {
|
|
441
647
|
return button;
|
|
442
648
|
}
|
|
443
|
-
return /* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ React8.createElement(DropdownMenu.Root, {
|
|
444
650
|
open: optionsMenuOpen,
|
|
445
651
|
onOpenChange: setOptionsMenuOpen
|
|
446
|
-
}, /* @__PURE__ */
|
|
652
|
+
}, /* @__PURE__ */ React8.createElement(DropdownMenu.Trigger, {
|
|
447
653
|
asChild: true,
|
|
448
654
|
ref: forwardedRef
|
|
449
|
-
}, button), /* @__PURE__ */
|
|
655
|
+
}, button), /* @__PURE__ */ React8.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React8.createElement(DropdownMenu.Content, {
|
|
450
656
|
classNames: "z-[31]"
|
|
451
|
-
}, /* @__PURE__ */
|
|
452
|
-
const separator = index > 0 ? /* @__PURE__ */
|
|
453
|
-
return /* @__PURE__ */
|
|
657
|
+
}, /* @__PURE__ */ React8.createElement(DropdownMenu.Viewport, null, actionGroups?.map((actions, index) => {
|
|
658
|
+
const separator = index > 0 ? /* @__PURE__ */ React8.createElement(DropdownMenu.Separator, null) : null;
|
|
659
|
+
return /* @__PURE__ */ React8.createElement(Fragment, {
|
|
454
660
|
key: index
|
|
455
661
|
}, separator, actions.map((action) => {
|
|
456
662
|
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[getHostPlatform()];
|
|
457
663
|
const menuItemType = action.properties.menuItemType;
|
|
458
664
|
const Root = menuItemType === "toggle" ? DropdownMenu.CheckboxItem : DropdownMenu.Item;
|
|
459
|
-
return /* @__PURE__ */
|
|
665
|
+
return /* @__PURE__ */ React8.createElement(Root, {
|
|
460
666
|
key: action.id,
|
|
461
667
|
onClick: (event) => {
|
|
462
668
|
if (action.properties.disabled) {
|
|
@@ -472,21 +678,21 @@ var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAct
|
|
|
472
678
|
...action.properties?.testId && {
|
|
473
679
|
"data-testid": action.properties.testId
|
|
474
680
|
}
|
|
475
|
-
}, /* @__PURE__ */
|
|
681
|
+
}, /* @__PURE__ */ React8.createElement(Icon, {
|
|
476
682
|
icon: action.properties.icon ?? "ph--placeholder--regular",
|
|
477
683
|
size: 4
|
|
478
|
-
}), /* @__PURE__ */
|
|
684
|
+
}), /* @__PURE__ */ React8.createElement("span", {
|
|
479
685
|
className: "grow truncate"
|
|
480
|
-
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */
|
|
686
|
+
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */ React8.createElement(DropdownMenu.ItemIndicator, {
|
|
481
687
|
asChild: true
|
|
482
|
-
}, /* @__PURE__ */
|
|
688
|
+
}, /* @__PURE__ */ React8.createElement(Icon, {
|
|
483
689
|
icon: "ph--check--regular",
|
|
484
690
|
size: 4
|
|
485
|
-
})), shortcut && /* @__PURE__ */
|
|
486
|
-
className:
|
|
691
|
+
})), shortcut && /* @__PURE__ */ React8.createElement("span", {
|
|
692
|
+
className: mx5("shrink-0", descriptionText)
|
|
487
693
|
}, keySymbols(shortcut).join("")));
|
|
488
694
|
}));
|
|
489
|
-
}), children), /* @__PURE__ */
|
|
695
|
+
}), children), /* @__PURE__ */ React8.createElement(DropdownMenu.Arrow, null))));
|
|
490
696
|
} finally {
|
|
491
697
|
_effect.f();
|
|
492
698
|
}
|
|
@@ -497,15 +703,15 @@ var DEFAULT_HORIZONTAL_SIZE = 48;
|
|
|
497
703
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
498
704
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
499
705
|
var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, size: propsSize, onSizeChange, role, order, prevSiblingId, nextSiblingId, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
500
|
-
var _effect =
|
|
706
|
+
var _effect = _useSignals9();
|
|
501
707
|
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] =
|
|
708
|
+
const [itemElement, itemRef] = useState5(null);
|
|
709
|
+
const [selfDragHandleElement, selfDragHandleRef] = useState5(null);
|
|
710
|
+
const [closestEdge, setEdge] = useState5(null);
|
|
711
|
+
const [sourceId, setSourceId] = useState5(null);
|
|
712
|
+
const [dragState, setDragState] = useState5(idle);
|
|
713
|
+
const { orientation, rail, onRearrange, size: stackSize, stackId } = useStack();
|
|
714
|
+
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = useState5(propsSize);
|
|
509
715
|
const Root = role ?? "div";
|
|
510
716
|
const composedItemRef = composeRefs2(itemRef, forwardedRef);
|
|
511
717
|
const setSize = useCallback2((nextSize, commit) => {
|
|
@@ -617,7 +823,7 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
|
|
|
617
823
|
selfDragHandleElement,
|
|
618
824
|
itemElement
|
|
619
825
|
]);
|
|
620
|
-
const focusableGroupAttrs =
|
|
826
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
621
827
|
tabBehavior: "limited"
|
|
622
828
|
});
|
|
623
829
|
const shouldShowDropIndicator = () => {
|
|
@@ -652,24 +858,25 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
|
|
|
652
858
|
setDragState,
|
|
653
859
|
role
|
|
654
860
|
]);
|
|
655
|
-
return /* @__PURE__ */
|
|
861
|
+
return /* @__PURE__ */ React9.createElement(StackItemContext.Provider, {
|
|
656
862
|
value: stackItemContextValue
|
|
657
|
-
}, /* @__PURE__ */
|
|
863
|
+
}, /* @__PURE__ */ React9.createElement(Root, {
|
|
658
864
|
...props,
|
|
659
865
|
tabIndex: 0,
|
|
660
866
|
...focusableGroupAttrs,
|
|
661
|
-
className:
|
|
662
|
-
"data-dx-stack-item":
|
|
867
|
+
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),
|
|
868
|
+
"data-dx-stack-item": stackId,
|
|
869
|
+
"data-dx-item-id": item.id,
|
|
663
870
|
...resizeAttributes,
|
|
664
871
|
style: {
|
|
665
|
-
...sizeStyle(size, orientation),
|
|
872
|
+
...stackSize !== "split" && sizeStyle(size, orientation),
|
|
666
873
|
...Number.isFinite(order) && {
|
|
667
874
|
[orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
|
|
668
875
|
},
|
|
669
876
|
...style
|
|
670
877
|
},
|
|
671
878
|
ref: composedItemRef
|
|
672
|
-
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */
|
|
879
|
+
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */ React9.createElement(ListItem2.DropIndicator, {
|
|
673
880
|
lineInset: 8,
|
|
674
881
|
terminalInset: -8,
|
|
675
882
|
edge: closestEdge
|
|
@@ -700,6 +907,7 @@ var StackItem = {
|
|
|
700
907
|
// src/exemplars/Card/fragments.ts
|
|
701
908
|
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
909
|
var cardSpacing = "pli-cardSpacingInline mlb-cardSpacingBlock";
|
|
910
|
+
var cardNoSpacing = "pli-0 mlb-0";
|
|
703
911
|
var labelSpacing = "mbs-inputSpacingBlock mbe-labelSpacingBlock";
|
|
704
912
|
var cardDialogContent = "p-0 bs-content min-bs-[8rem] max-bs-full md:max-is-[32rem] overflow-hidden";
|
|
705
913
|
var cardDialogHeader = "pli-cardSpacingInline mbs-cardSpacingBlock flex justify-between";
|
|
@@ -707,18 +915,20 @@ var cardDialogOverflow = "overflow-y-auto min-bs-0 flex-1";
|
|
|
707
915
|
var cardDialogPaddedOverflow = `${cardDialogOverflow} plb-cardSpacingBlock`;
|
|
708
916
|
var cardDialogSearchListRoot = "pli-cardSpacingInline pbs-cardSpacingBlock [&>input]:mbe-0 min-bs-0 flex-1 flex flex-col";
|
|
709
917
|
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";
|
|
918
|
+
var cardHeading = "text-lg font-medium line-clamp-2 grow";
|
|
919
|
+
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
920
|
|
|
713
921
|
// src/exemplars/Card/Card.tsx
|
|
714
|
-
import { useSignals as
|
|
922
|
+
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
715
923
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
716
924
|
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
717
|
-
import
|
|
925
|
+
import React10, { forwardRef as forwardRef6 } from "react";
|
|
718
926
|
import { Icon as Icon2, IconButton, Toolbar, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
719
|
-
import { hoverableControls, mx as
|
|
927
|
+
import { hoverableControls, mx as mx7 } from "@dxos/react-ui-theme";
|
|
928
|
+
var cardDefaultInlineSize = 18;
|
|
929
|
+
var cardStackDefaultInlineSizeRem = cardDefaultInlineSize + 2.125;
|
|
720
930
|
var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "group", ...props }, forwardedRef) => {
|
|
721
|
-
var _effect =
|
|
931
|
+
var _effect = _useSignals10();
|
|
722
932
|
try {
|
|
723
933
|
const Root = asChild ? Slot3 : "div";
|
|
724
934
|
const rootProps = asChild ? {
|
|
@@ -727,10 +937,10 @@ var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChil
|
|
|
727
937
|
classNames
|
|
728
938
|
]
|
|
729
939
|
} : {
|
|
730
|
-
className:
|
|
940
|
+
className: mx7(cardRoot, classNames),
|
|
731
941
|
role
|
|
732
942
|
};
|
|
733
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
734
944
|
...props,
|
|
735
945
|
...rootProps,
|
|
736
946
|
ref: forwardedRef
|
|
@@ -740,23 +950,23 @@ var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChil
|
|
|
740
950
|
}
|
|
741
951
|
});
|
|
742
952
|
var CardSurfaceRoot = ({ role = "never", children, classNames }) => {
|
|
743
|
-
var _effect =
|
|
953
|
+
var _effect = _useSignals10();
|
|
744
954
|
try {
|
|
745
955
|
if ([
|
|
746
956
|
"card--popover",
|
|
747
957
|
"card--intrinsic",
|
|
748
958
|
"card--extrinsic"
|
|
749
959
|
].includes(role)) {
|
|
750
|
-
return /* @__PURE__ */
|
|
751
|
-
className:
|
|
960
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
961
|
+
className: mx7(role === "card--popover" ? "popover-card-width" : [
|
|
752
962
|
"card--intrinsic",
|
|
753
963
|
"card--extrinsic"
|
|
754
964
|
].includes(role) ? "contents" : "", classNames)
|
|
755
965
|
}, children);
|
|
756
966
|
} else {
|
|
757
|
-
return /* @__PURE__ */
|
|
967
|
+
return /* @__PURE__ */ React10.createElement(CardStaticRoot, {
|
|
758
968
|
classNames: [
|
|
759
|
-
role === "card--transclusion" && "mlb-
|
|
969
|
+
role === "card--transclusion" && "mlb-1",
|
|
760
970
|
role === "card--transclusion" && hoverableControls,
|
|
761
971
|
classNames
|
|
762
972
|
]
|
|
@@ -767,7 +977,7 @@ var CardSurfaceRoot = ({ role = "never", children, classNames }) => {
|
|
|
767
977
|
}
|
|
768
978
|
};
|
|
769
979
|
var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
770
|
-
var _effect =
|
|
980
|
+
var _effect = _useSignals10();
|
|
771
981
|
try {
|
|
772
982
|
const Root = asChild ? Slot3 : "div";
|
|
773
983
|
const rootProps = asChild ? {
|
|
@@ -777,10 +987,10 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
777
987
|
classNames
|
|
778
988
|
]
|
|
779
989
|
} : {
|
|
780
|
-
className:
|
|
990
|
+
className: mx7(cardHeading, cardText, classNames),
|
|
781
991
|
role
|
|
782
992
|
};
|
|
783
|
-
return /* @__PURE__ */
|
|
993
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
784
994
|
...props,
|
|
785
995
|
...rootProps,
|
|
786
996
|
ref: forwardedRef
|
|
@@ -790,9 +1000,9 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
790
1000
|
}
|
|
791
1001
|
});
|
|
792
1002
|
var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props }, forwardedRef) => {
|
|
793
|
-
var _effect =
|
|
1003
|
+
var _effect = _useSignals10();
|
|
794
1004
|
try {
|
|
795
|
-
return /* @__PURE__ */
|
|
1005
|
+
return /* @__PURE__ */ React10.createElement(Toolbar.Root, {
|
|
796
1006
|
...props,
|
|
797
1007
|
classNames: [
|
|
798
1008
|
"bg-transparent density-coarse",
|
|
@@ -807,11 +1017,11 @@ var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props
|
|
|
807
1017
|
var CardToolbarIconButton = Toolbar.IconButton;
|
|
808
1018
|
var CardToolbarSeparator = Toolbar.Separator;
|
|
809
1019
|
var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef) => {
|
|
810
|
-
var _effect =
|
|
1020
|
+
var _effect = _useSignals10();
|
|
811
1021
|
try {
|
|
812
1022
|
const { t } = useTranslation2(translationKey);
|
|
813
1023
|
const Root = toolbarItem ? Toolbar.IconButton : IconButton;
|
|
814
|
-
return /* @__PURE__ */
|
|
1024
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
815
1025
|
iconOnly: true,
|
|
816
1026
|
icon: "ph--dots-six-vertical--regular",
|
|
817
1027
|
variant: "ghost",
|
|
@@ -826,22 +1036,25 @@ var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef)
|
|
|
826
1036
|
var CardDragPreview = StackItem.DragPreview;
|
|
827
1037
|
var CardMenu = Primitive.div;
|
|
828
1038
|
var CardPoster = (props) => {
|
|
829
|
-
var _effect =
|
|
1039
|
+
var _effect = _useSignals10();
|
|
830
1040
|
try {
|
|
831
1041
|
const aspect = props.aspect === "auto" ? "aspect-auto" : "aspect-video";
|
|
832
1042
|
if (props.image) {
|
|
833
|
-
return /* @__PURE__ */
|
|
834
|
-
|
|
1043
|
+
return /* @__PURE__ */ React10.createElement(Image, {
|
|
1044
|
+
classNames: [
|
|
1045
|
+
`dx-card__poster is-full __bs-auto`,
|
|
1046
|
+
aspect
|
|
1047
|
+
],
|
|
835
1048
|
src: props.image,
|
|
836
1049
|
alt: props.alt
|
|
837
1050
|
});
|
|
838
1051
|
}
|
|
839
1052
|
if (props.icon) {
|
|
840
|
-
return /* @__PURE__ */
|
|
1053
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
841
1054
|
role: "image",
|
|
842
|
-
className: `dx-card__poster grid
|
|
1055
|
+
className: mx7(`dx-card__poster grid place-items-center bg-inputSurface text-subdued`, aspect),
|
|
843
1056
|
"aria-label": props.alt
|
|
844
|
-
}, /* @__PURE__ */
|
|
1057
|
+
}, /* @__PURE__ */ React10.createElement(Icon2, {
|
|
845
1058
|
icon: props.icon,
|
|
846
1059
|
size: 10
|
|
847
1060
|
}));
|
|
@@ -851,7 +1064,7 @@ var CardPoster = (props) => {
|
|
|
851
1064
|
}
|
|
852
1065
|
};
|
|
853
1066
|
var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
854
|
-
var _effect =
|
|
1067
|
+
var _effect = _useSignals10();
|
|
855
1068
|
try {
|
|
856
1069
|
const Root = asChild ? Slot3 : "div";
|
|
857
1070
|
const rootProps = asChild ? {
|
|
@@ -860,10 +1073,10 @@ var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, r
|
|
|
860
1073
|
classNames
|
|
861
1074
|
]
|
|
862
1075
|
} : {
|
|
863
|
-
className:
|
|
1076
|
+
className: mx7(cardChrome, classNames),
|
|
864
1077
|
role
|
|
865
1078
|
};
|
|
866
|
-
return /* @__PURE__ */
|
|
1079
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
867
1080
|
...props,
|
|
868
1081
|
...rootProps,
|
|
869
1082
|
ref: forwardedRef
|
|
@@ -873,19 +1086,19 @@ var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, r
|
|
|
873
1086
|
}
|
|
874
1087
|
});
|
|
875
1088
|
var CardText = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
876
|
-
var _effect =
|
|
1089
|
+
var _effect = _useSignals10();
|
|
877
1090
|
try {
|
|
878
|
-
const Root = asChild ? Slot3 : "
|
|
1091
|
+
const Root = asChild ? Slot3 : "div";
|
|
879
1092
|
const rootProps = asChild ? {
|
|
880
1093
|
classNames: [
|
|
881
1094
|
cardText,
|
|
882
1095
|
classNames
|
|
883
1096
|
]
|
|
884
1097
|
} : {
|
|
885
|
-
className:
|
|
1098
|
+
className: mx7(cardText, classNames),
|
|
886
1099
|
role
|
|
887
1100
|
};
|
|
888
|
-
return /* @__PURE__ */
|
|
1101
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
889
1102
|
...props,
|
|
890
1103
|
...rootProps,
|
|
891
1104
|
ref: forwardedRef
|
|
@@ -910,13 +1123,13 @@ var Card = {
|
|
|
910
1123
|
};
|
|
911
1124
|
|
|
912
1125
|
// src/exemplars/Card/CardDragPreview.tsx
|
|
913
|
-
import { useSignals as
|
|
914
|
-
import
|
|
915
|
-
import { mx as
|
|
1126
|
+
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
1127
|
+
import React11 from "react";
|
|
1128
|
+
import { mx as mx8 } from "@dxos/react-ui-theme";
|
|
916
1129
|
var CardDragPreviewRoot = ({ children }) => {
|
|
917
|
-
var _effect =
|
|
1130
|
+
var _effect = _useSignals11();
|
|
918
1131
|
try {
|
|
919
|
-
return /* @__PURE__ */
|
|
1132
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
920
1133
|
className: "p-2"
|
|
921
1134
|
}, children);
|
|
922
1135
|
} finally {
|
|
@@ -924,10 +1137,10 @@ var CardDragPreviewRoot = ({ children }) => {
|
|
|
924
1137
|
}
|
|
925
1138
|
};
|
|
926
1139
|
var CardDragPreviewContent = ({ children }) => {
|
|
927
|
-
var _effect =
|
|
1140
|
+
var _effect = _useSignals11();
|
|
928
1141
|
try {
|
|
929
|
-
return /* @__PURE__ */
|
|
930
|
-
className:
|
|
1142
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1143
|
+
className: mx8(cardRoot, "ring-focusLine ring-neutralFocusIndicator")
|
|
931
1144
|
}, children);
|
|
932
1145
|
} finally {
|
|
933
1146
|
_effect.f();
|
|
@@ -939,14 +1152,14 @@ var CardDragPreview2 = {
|
|
|
939
1152
|
};
|
|
940
1153
|
|
|
941
1154
|
// src/exemplars/CardStack/CardStack.tsx
|
|
942
|
-
import { useSignals as
|
|
1155
|
+
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
943
1156
|
import { Slot as Slot4 } from "@radix-ui/react-slot";
|
|
944
|
-
import
|
|
945
|
-
import { mx as
|
|
1157
|
+
import React12, { forwardRef as forwardRef7 } from "react";
|
|
1158
|
+
import { mx as mx9 } from "@dxos/react-ui-theme";
|
|
946
1159
|
var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
947
|
-
var _effect =
|
|
1160
|
+
var _effect = _useSignals12();
|
|
948
1161
|
try {
|
|
949
|
-
return /* @__PURE__ */
|
|
1162
|
+
return /* @__PURE__ */ React12.createElement(Stack, {
|
|
950
1163
|
orientation: "vertical",
|
|
951
1164
|
size: "contain",
|
|
952
1165
|
rail: false,
|
|
@@ -971,7 +1184,7 @@ var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsC
|
|
|
971
1184
|
var CardStackDragHandle = Card.DragHandle;
|
|
972
1185
|
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
973
1186
|
var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
974
|
-
var _effect =
|
|
1187
|
+
var _effect = _useSignals12();
|
|
975
1188
|
try {
|
|
976
1189
|
const Root = asChild ? Slot4 : "div";
|
|
977
1190
|
const rootProps = asChild ? {
|
|
@@ -980,10 +1193,10 @@ var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
980
1193
|
classNames
|
|
981
1194
|
]
|
|
982
1195
|
} : {
|
|
983
|
-
className:
|
|
1196
|
+
className: mx9(cardStackHeading, classNames),
|
|
984
1197
|
role
|
|
985
1198
|
};
|
|
986
|
-
return /* @__PURE__ */
|
|
1199
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
987
1200
|
...props,
|
|
988
1201
|
...rootProps,
|
|
989
1202
|
ref: forwardedRef
|
|
@@ -994,7 +1207,7 @@ var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
994
1207
|
});
|
|
995
1208
|
var cardStackFooter = 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
996
1209
|
var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
997
|
-
var _effect =
|
|
1210
|
+
var _effect = _useSignals12();
|
|
998
1211
|
try {
|
|
999
1212
|
const Root = asChild ? Slot4 : "div";
|
|
1000
1213
|
const rootProps = asChild ? {
|
|
@@ -1003,10 +1216,10 @@ var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChi
|
|
|
1003
1216
|
classNames
|
|
1004
1217
|
]
|
|
1005
1218
|
} : {
|
|
1006
|
-
className:
|
|
1219
|
+
className: mx9(cardStackFooter, classNames),
|
|
1007
1220
|
role
|
|
1008
1221
|
};
|
|
1009
|
-
return /* @__PURE__ */
|
|
1222
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1010
1223
|
...props,
|
|
1011
1224
|
...rootProps,
|
|
1012
1225
|
ref: forwardedRef
|
|
@@ -1015,24 +1228,27 @@ var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChi
|
|
|
1015
1228
|
_effect.f();
|
|
1016
1229
|
}
|
|
1017
1230
|
});
|
|
1018
|
-
var cardStackContent =
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
];
|
|
1022
|
-
var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1023
|
-
var _effect = _useSignals11();
|
|
1231
|
+
var cardStackContent = "shrink min-bs-0 bg-baseSurface border border-separator rounded-md grid dx-focus-ring-group-x-indicator kanban-drop";
|
|
1232
|
+
var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", footer = true, ...props }, forwardedRef) => {
|
|
1233
|
+
var _effect = _useSignals12();
|
|
1024
1234
|
try {
|
|
1025
1235
|
const Root = asChild ? Slot4 : "div";
|
|
1236
|
+
const baseClassNames = footer ? [
|
|
1237
|
+
cardStackContent,
|
|
1238
|
+
railGridHorizontalContainFitContent
|
|
1239
|
+
] : [
|
|
1240
|
+
cardStackContent
|
|
1241
|
+
];
|
|
1026
1242
|
const rootProps = asChild ? {
|
|
1027
1243
|
classNames: [
|
|
1028
|
-
...
|
|
1244
|
+
...baseClassNames,
|
|
1029
1245
|
classNames
|
|
1030
1246
|
]
|
|
1031
1247
|
} : {
|
|
1032
|
-
className:
|
|
1248
|
+
className: mx9(...baseClassNames, classNames),
|
|
1033
1249
|
role
|
|
1034
1250
|
};
|
|
1035
|
-
return /* @__PURE__ */
|
|
1251
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1036
1252
|
...props,
|
|
1037
1253
|
...rootProps,
|
|
1038
1254
|
"data-scroll-separator": "false",
|
|
@@ -1044,7 +1260,7 @@ var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
1044
1260
|
});
|
|
1045
1261
|
var cardStackRoot = "flex flex-col pli-2 plb-2";
|
|
1046
1262
|
var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1047
|
-
var _effect =
|
|
1263
|
+
var _effect = _useSignals12();
|
|
1048
1264
|
try {
|
|
1049
1265
|
const Root = asChild ? Slot4 : "div";
|
|
1050
1266
|
const rootProps = asChild ? {
|
|
@@ -1053,10 +1269,10 @@ var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1053
1269
|
classNames
|
|
1054
1270
|
]
|
|
1055
1271
|
} : {
|
|
1056
|
-
className:
|
|
1272
|
+
className: mx9(cardStackRoot, classNames),
|
|
1057
1273
|
role
|
|
1058
1274
|
};
|
|
1059
|
-
return /* @__PURE__ */
|
|
1275
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1060
1276
|
...props,
|
|
1061
1277
|
...rootProps,
|
|
1062
1278
|
ref: forwardedRef
|
|
@@ -1067,7 +1283,7 @@ var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1067
1283
|
});
|
|
1068
1284
|
var cardStackItem = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
1069
1285
|
var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1070
|
-
var _effect =
|
|
1286
|
+
var _effect = _useSignals12();
|
|
1071
1287
|
try {
|
|
1072
1288
|
const Root = asChild ? Slot4 : "div";
|
|
1073
1289
|
const rootProps = asChild ? {
|
|
@@ -1076,10 +1292,10 @@ var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1076
1292
|
classNames
|
|
1077
1293
|
]
|
|
1078
1294
|
} : {
|
|
1079
|
-
className:
|
|
1295
|
+
className: mx9(cardStackItem, classNames),
|
|
1080
1296
|
role
|
|
1081
1297
|
};
|
|
1082
|
-
return /* @__PURE__ */
|
|
1298
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1083
1299
|
...props,
|
|
1084
1300
|
...rootProps,
|
|
1085
1301
|
ref: forwardedRef
|
|
@@ -1099,16 +1315,16 @@ var CardStack = {
|
|
|
1099
1315
|
};
|
|
1100
1316
|
|
|
1101
1317
|
// src/exemplars/CardStack/CardStackDragPreview.tsx
|
|
1102
|
-
import { useSignals as
|
|
1103
|
-
import
|
|
1318
|
+
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1319
|
+
import React13 from "react";
|
|
1104
1320
|
import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
1105
|
-
import { mx as
|
|
1321
|
+
import { mx as mx10 } from "@dxos/react-ui-theme";
|
|
1106
1322
|
var CardStackDragPreviewRoot = ({ children }) => {
|
|
1107
|
-
var _effect =
|
|
1323
|
+
var _effect = _useSignals13();
|
|
1108
1324
|
try {
|
|
1109
|
-
return /* @__PURE__ */
|
|
1325
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1110
1326
|
className: "p-2"
|
|
1111
|
-
}, /* @__PURE__ */
|
|
1327
|
+
}, /* @__PURE__ */ React13.createElement("div", {
|
|
1112
1328
|
className: "rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col"
|
|
1113
1329
|
}, children));
|
|
1114
1330
|
} finally {
|
|
@@ -1116,12 +1332,12 @@ var CardStackDragPreviewRoot = ({ children }) => {
|
|
|
1116
1332
|
}
|
|
1117
1333
|
};
|
|
1118
1334
|
var CardStackDragPreviewHeading = ({ children }) => {
|
|
1119
|
-
var _effect =
|
|
1335
|
+
var _effect = _useSignals13();
|
|
1120
1336
|
try {
|
|
1121
1337
|
const { t } = useTranslation3(translationKey);
|
|
1122
|
-
return /* @__PURE__ */
|
|
1338
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1123
1339
|
className: "flex items-center p-2"
|
|
1124
|
-
}, /* @__PURE__ */
|
|
1340
|
+
}, /* @__PURE__ */ React13.createElement(IconButton2, {
|
|
1125
1341
|
iconOnly: true,
|
|
1126
1342
|
icon: "ph--dots-six-vertical--regular",
|
|
1127
1343
|
variant: "ghost",
|
|
@@ -1133,19 +1349,19 @@ var CardStackDragPreviewHeading = ({ children }) => {
|
|
|
1133
1349
|
}
|
|
1134
1350
|
};
|
|
1135
1351
|
var CardStackDragPreviewContent = ({ children, itemsCount = 0 }) => {
|
|
1136
|
-
var _effect =
|
|
1352
|
+
var _effect = _useSignals13();
|
|
1137
1353
|
try {
|
|
1138
|
-
return /* @__PURE__ */
|
|
1139
|
-
className:
|
|
1354
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1355
|
+
className: mx10("overflow-y-auto flex-1 pli-2 flex flex-col gap-2", "plb-1", itemsCount > 0 ? "plb-2" : "plb-1")
|
|
1140
1356
|
}, children);
|
|
1141
1357
|
} finally {
|
|
1142
1358
|
_effect.f();
|
|
1143
1359
|
}
|
|
1144
1360
|
};
|
|
1145
1361
|
var CardStackDragPreviewFooter = ({ children }) => {
|
|
1146
|
-
var _effect =
|
|
1362
|
+
var _effect = _useSignals13();
|
|
1147
1363
|
try {
|
|
1148
|
-
return /* @__PURE__ */
|
|
1364
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1149
1365
|
className: "p-2 border-t border-separator"
|
|
1150
1366
|
}, children);
|
|
1151
1367
|
} finally {
|
|
@@ -1160,6 +1376,7 @@ var CardStackDragPreview = {
|
|
|
1160
1376
|
};
|
|
1161
1377
|
|
|
1162
1378
|
export {
|
|
1379
|
+
Image,
|
|
1163
1380
|
StackContext,
|
|
1164
1381
|
railGridHorizontal,
|
|
1165
1382
|
railGridVertical,
|
|
@@ -1176,6 +1393,7 @@ export {
|
|
|
1176
1393
|
StackItem,
|
|
1177
1394
|
cardRoot,
|
|
1178
1395
|
cardSpacing,
|
|
1396
|
+
cardNoSpacing,
|
|
1179
1397
|
labelSpacing,
|
|
1180
1398
|
cardDialogContent,
|
|
1181
1399
|
cardDialogHeader,
|
|
@@ -1185,6 +1403,8 @@ export {
|
|
|
1185
1403
|
cardText,
|
|
1186
1404
|
cardHeading,
|
|
1187
1405
|
cardChrome,
|
|
1406
|
+
cardDefaultInlineSize,
|
|
1407
|
+
cardStackDefaultInlineSizeRem,
|
|
1188
1408
|
Card,
|
|
1189
1409
|
CardDragPreview2 as CardDragPreview,
|
|
1190
1410
|
cardStackHeading,
|
|
@@ -1195,4 +1415,4 @@ export {
|
|
|
1195
1415
|
CardStack,
|
|
1196
1416
|
CardStackDragPreview
|
|
1197
1417
|
};
|
|
1198
|
-
//# sourceMappingURL=chunk-
|
|
1418
|
+
//# sourceMappingURL=chunk-SM27YTH3.mjs.map
|