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