@dxos/react-ui-stack 0.8.4-main.67995b8 → 0.8.4-main.a4bbb77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-P3TQV4BA.mjs → chunk-K76XHALI.mjs} +399 -177
- package/dist/lib/browser/chunk-K76XHALI.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/playwright/index.mjs +23 -6
- package/dist/lib/browser/playwright/index.mjs.map +2 -2
- package/dist/lib/browser/testing/index.mjs +3 -3
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-3WVEPAJ4.mjs → chunk-2UOARV5Q.mjs} +399 -177
- package/dist/lib/node-esm/chunk-2UOARV5Q.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +5 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/playwright/index.mjs +23 -6
- package/dist/lib/node-esm/playwright/index.mjs.map +2 -2
- package/dist/lib/node-esm/testing/index.mjs +3 -3
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/components/Image/Image.d.ts +11 -0
- package/dist/types/src/components/Image/Image.d.ts.map +1 -0
- package/dist/types/src/components/Image/Image.stories.d.ts +30 -0
- package/dist/types/src/components/Image/Image.stories.d.ts.map +1 -0
- package/dist/types/src/components/Image/index.d.ts +2 -0
- package/dist/types/src/components/Image/index.d.ts.map +1 -0
- package/dist/types/src/components/Stack/Stack.d.ts +10 -2
- package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
- package/dist/types/src/components/Stack/Stack.stories.d.ts +12 -3
- package/dist/types/src/components/Stack/Stack.stories.d.ts.map +1 -1
- package/dist/types/src/components/StackContext.d.ts +2 -1
- package/dist/types/src/components/StackContext.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItem.d.ts +4 -4
- package/dist/types/src/components/StackItem/StackItem.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItem.stories.d.ts +13 -5
- package/dist/types/src/components/StackItem/StackItem.stories.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemContent.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts +1 -1
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/Card.d.ts +3 -5
- package/dist/types/src/exemplars/Card/Card.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/Card.stories.d.ts +12 -4
- package/dist/types/src/exemplars/Card/Card.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/fragments.d.ts +3 -2
- package/dist/types/src/exemplars/Card/fragments.d.ts.map +1 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts +3 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +1 -1
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts +9 -3
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useStackDropForElements.d.ts +1 -1
- package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
- package/dist/types/src/testing/CardContainer.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -27
- package/src/components/Image/Image.stories.tsx +56 -0
- package/src/components/Image/Image.tsx +137 -0
- package/src/components/Image/index.ts +5 -0
- package/src/components/Stack/Stack.stories.tsx +8 -9
- package/src/components/Stack/Stack.tsx +215 -18
- package/src/components/StackContext.tsx +2 -1
- package/src/components/StackItem/StackItem.stories.tsx +15 -13
- package/src/components/StackItem/StackItem.tsx +26 -18
- package/src/components/StackItem/StackItemContent.tsx +1 -0
- package/src/components/StackItem/StackItemHeading.tsx +3 -3
- package/src/components/StackItem/StackItemResizeHandle.tsx +2 -1
- package/src/components/StackItem/StackItemSigil.tsx +2 -1
- package/src/components/index.ts +1 -0
- package/src/exemplars/Card/Card.stories.tsx +29 -43
- package/src/exemplars/Card/Card.tsx +11 -11
- package/src/exemplars/Card/fragments.ts +3 -2
- package/src/exemplars/CardStack/CardStack.stories.tsx +11 -10
- package/src/exemplars/CardStack/CardStack.tsx +12 -9
- package/src/hooks/useStackDropForElements.ts +1 -1
- package/src/testing/CardContainer.tsx +9 -6
- package/dist/lib/browser/chunk-P3TQV4BA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3WVEPAJ4.mjs.map +0 -7
|
@@ -1,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,7 +432,7 @@ 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";
|
|
@@ -228,18 +440,18 @@ import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/el
|
|
|
228
440
|
import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
229
441
|
import { useFocusableGroup as useFocusableGroup2 } 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
|
|
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";
|
|
241
453
|
var StackItemContent = /* @__PURE__ */ forwardRef2(({ children, toolbar, statusbar, layoutManaged, classNames, size = "intrinsic", ...props }, forwardedRef) => {
|
|
242
|
-
var _effect =
|
|
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", 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,35 @@ var StackItemDragHandle = ({ asChild, children }) => {
|
|
|
290
502
|
};
|
|
291
503
|
|
|
292
504
|
// src/components/StackItem/StackItemHeading.tsx
|
|
293
|
-
import { useSignals as
|
|
505
|
+
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
294
506
|
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
295
507
|
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
296
|
-
import
|
|
508
|
+
import React5, { forwardRef as forwardRef3 } from "react";
|
|
297
509
|
import { useAttention } from "@dxos/react-ui-attention";
|
|
298
|
-
import { mx as
|
|
510
|
+
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
299
511
|
var StackItemHeading = ({ children, classNames, asChild, separateOnScroll, ...props }) => {
|
|
300
|
-
var _effect =
|
|
512
|
+
var _effect = _useSignals5();
|
|
301
513
|
try {
|
|
302
514
|
const { orientation } = useStack();
|
|
303
515
|
const focusableGroupAttrs = useFocusableGroup({
|
|
304
516
|
tabBehavior: "limited"
|
|
305
517
|
});
|
|
306
518
|
const Root = asChild ? Slot2 : "div";
|
|
307
|
-
return /* @__PURE__ */
|
|
519
|
+
return /* @__PURE__ */ React5.createElement(Root, {
|
|
308
520
|
role: "heading",
|
|
309
521
|
...props,
|
|
310
522
|
tabIndex: 0,
|
|
311
523
|
...focusableGroupAttrs,
|
|
312
|
-
className:
|
|
524
|
+
className: mx4("flex items-center dx-focus-ring-inset-over-all relative !border-is-0 bg-headerSurface", separateOnScroll ? 'border-transparent [[data-scroll-separator="true"]_&]:border-subduedSeparator' : "border-subduedSeparator", orientation === "horizontal" ? "bs-[--rail-size]" : "is-[--rail-size] flex-col", orientation === "horizontal" ? "border-be" : "border-ie", classNames)
|
|
313
525
|
}, children);
|
|
314
526
|
} finally {
|
|
315
527
|
_effect.f();
|
|
316
528
|
}
|
|
317
529
|
};
|
|
318
530
|
var StackItemHeadingStickyContent = ({ children }) => {
|
|
319
|
-
var _effect =
|
|
531
|
+
var _effect = _useSignals5();
|
|
320
532
|
try {
|
|
321
|
-
return /* @__PURE__ */
|
|
533
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
322
534
|
role: "none",
|
|
323
535
|
className: "sticky block-start-0 bg-[--sticky-bg] p-1 is-full"
|
|
324
536
|
}, children);
|
|
@@ -327,13 +539,13 @@ var StackItemHeadingStickyContent = ({ children }) => {
|
|
|
327
539
|
}
|
|
328
540
|
};
|
|
329
541
|
var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related, classNames, ...props }, forwardedRef) => {
|
|
330
|
-
var _effect =
|
|
542
|
+
var _effect = _useSignals5();
|
|
331
543
|
try {
|
|
332
544
|
const { hasAttention, isAncestor, isRelated } = useAttention(attendableId);
|
|
333
|
-
return /* @__PURE__ */
|
|
545
|
+
return /* @__PURE__ */ React5.createElement("h1", {
|
|
334
546
|
...props,
|
|
335
547
|
"data-attention": (related && isRelated || hasAttention || isAncestor).toString(),
|
|
336
|
-
className:
|
|
548
|
+
className: mx4("pli-1 min-is-0 is-0 grow truncate font-medium text-baseText data-[attention=true]:text-accentText self-center", classNames),
|
|
337
549
|
ref: forwardedRef
|
|
338
550
|
});
|
|
339
551
|
} finally {
|
|
@@ -342,17 +554,17 @@ var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related
|
|
|
342
554
|
});
|
|
343
555
|
|
|
344
556
|
// src/components/StackItem/StackItemResizeHandle.tsx
|
|
345
|
-
import { useSignals as
|
|
346
|
-
import
|
|
557
|
+
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
558
|
+
import React6 from "react";
|
|
347
559
|
import { ResizeHandle } from "@dxos/react-ui-dnd";
|
|
348
560
|
var MIN_WIDTH = 20;
|
|
349
561
|
var MIN_HEIGHT = 3;
|
|
350
562
|
var StackItemResizeHandle = () => {
|
|
351
|
-
var _effect =
|
|
563
|
+
var _effect = _useSignals6();
|
|
352
564
|
try {
|
|
353
565
|
const { orientation } = useStack();
|
|
354
566
|
const { setSize, size } = useStackItem();
|
|
355
|
-
return /* @__PURE__ */
|
|
567
|
+
return /* @__PURE__ */ React6.createElement(ResizeHandle, {
|
|
356
568
|
side: orientation === "horizontal" ? "inline-end" : "block-end",
|
|
357
569
|
fallbackSize: DEFAULT_EXTRINSIC_SIZE,
|
|
358
570
|
minSize: orientation === "horizontal" ? MIN_WIDTH : MIN_HEIGHT,
|
|
@@ -365,28 +577,28 @@ var StackItemResizeHandle = () => {
|
|
|
365
577
|
};
|
|
366
578
|
|
|
367
579
|
// src/components/StackItem/StackItemSigil.tsx
|
|
368
|
-
import { useSignals as
|
|
369
|
-
import
|
|
580
|
+
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
581
|
+
import React8, { Fragment, forwardRef as forwardRef4, useState as useState4 } from "react";
|
|
370
582
|
import { keySymbols } from "@dxos/keyboard";
|
|
371
583
|
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
372
584
|
import { useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
373
|
-
import { descriptionText, mx as
|
|
585
|
+
import { descriptionText, mx as mx5 } from "@dxos/react-ui-theme";
|
|
374
586
|
import { getHostPlatform } from "@dxos/util";
|
|
375
587
|
|
|
376
588
|
// src/components/StackItem/MenuSignifier.tsx
|
|
377
|
-
import { useSignals as
|
|
378
|
-
import
|
|
589
|
+
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
590
|
+
import React7 from "react";
|
|
379
591
|
var MenuSignifierHorizontal = () => {
|
|
380
|
-
var _effect =
|
|
592
|
+
var _effect = _useSignals7();
|
|
381
593
|
try {
|
|
382
|
-
return /* @__PURE__ */
|
|
594
|
+
return /* @__PURE__ */ React7.createElement("svg", {
|
|
383
595
|
className: "absolute block-end-[7px]",
|
|
384
596
|
width: 20,
|
|
385
597
|
height: 2,
|
|
386
598
|
viewBox: "0 0 20 2",
|
|
387
599
|
stroke: "currentColor",
|
|
388
600
|
opacity: 0.5
|
|
389
|
-
}, /* @__PURE__ */
|
|
601
|
+
}, /* @__PURE__ */ React7.createElement("line", {
|
|
390
602
|
x1: 0.5,
|
|
391
603
|
y1: 0.75,
|
|
392
604
|
x2: 19,
|
|
@@ -403,11 +615,11 @@ var MenuSignifierHorizontal = () => {
|
|
|
403
615
|
|
|
404
616
|
// src/components/StackItem/StackItemSigil.tsx
|
|
405
617
|
var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNames, related, isMenu = true, children, ...props }, forwardedRef) => {
|
|
406
|
-
var _effect =
|
|
618
|
+
var _effect = _useSignals8();
|
|
407
619
|
try {
|
|
408
620
|
const { hasAttention, isAncestor, isRelated } = useAttention2(attendableId);
|
|
409
621
|
const variant = related && isRelated || hasAttention || isAncestor ? "primary" : "ghost";
|
|
410
|
-
return /* @__PURE__ */
|
|
622
|
+
return /* @__PURE__ */ React8.createElement(Button, {
|
|
411
623
|
...props,
|
|
412
624
|
variant,
|
|
413
625
|
classNames: [
|
|
@@ -415,50 +627,50 @@ var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNam
|
|
|
415
627
|
classNames
|
|
416
628
|
],
|
|
417
629
|
ref: forwardedRef
|
|
418
|
-
}, isMenu && /* @__PURE__ */
|
|
630
|
+
}, isMenu && /* @__PURE__ */ React8.createElement(MenuSignifierHorizontal, null), children);
|
|
419
631
|
} finally {
|
|
420
632
|
_effect.f();
|
|
421
633
|
}
|
|
422
634
|
});
|
|
423
635
|
var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
424
|
-
var _effect =
|
|
636
|
+
var _effect = _useSignals8();
|
|
425
637
|
try {
|
|
426
638
|
const { t } = useTranslation(translationKey);
|
|
427
|
-
const [optionsMenuOpen, setOptionsMenuOpen] =
|
|
639
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = useState4(false);
|
|
428
640
|
const hasActions = actionGroups && actionGroups.length > 0;
|
|
429
|
-
const button = /* @__PURE__ */
|
|
641
|
+
const button = /* @__PURE__ */ React8.createElement(StackItemSigilButton, {
|
|
430
642
|
attendableId,
|
|
431
643
|
related,
|
|
432
644
|
isMenu: hasActions,
|
|
433
645
|
// TODO(wittjosiah): Better disabling of interactive styles when no action are available.
|
|
434
646
|
// Remove underscore icon when no actions are available?
|
|
435
647
|
classNames: !hasActions && "cursor-default"
|
|
436
|
-
}, /* @__PURE__ */
|
|
648
|
+
}, /* @__PURE__ */ React8.createElement("span", {
|
|
437
649
|
className: "sr-only"
|
|
438
|
-
}, triggerLabel), /* @__PURE__ */
|
|
650
|
+
}, triggerLabel), /* @__PURE__ */ React8.createElement(Icon, {
|
|
439
651
|
icon,
|
|
440
652
|
size: 5
|
|
441
653
|
}));
|
|
442
654
|
if (!hasActions) {
|
|
443
655
|
return button;
|
|
444
656
|
}
|
|
445
|
-
return /* @__PURE__ */
|
|
657
|
+
return /* @__PURE__ */ React8.createElement(DropdownMenu.Root, {
|
|
446
658
|
open: optionsMenuOpen,
|
|
447
659
|
onOpenChange: setOptionsMenuOpen
|
|
448
|
-
}, /* @__PURE__ */
|
|
660
|
+
}, /* @__PURE__ */ React8.createElement(DropdownMenu.Trigger, {
|
|
449
661
|
asChild: true,
|
|
450
662
|
ref: forwardedRef
|
|
451
|
-
}, button), /* @__PURE__ */
|
|
663
|
+
}, button), /* @__PURE__ */ React8.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React8.createElement(DropdownMenu.Content, {
|
|
452
664
|
classNames: "z-[31]"
|
|
453
|
-
}, /* @__PURE__ */
|
|
454
|
-
const separator = index > 0 ? /* @__PURE__ */
|
|
455
|
-
return /* @__PURE__ */
|
|
665
|
+
}, /* @__PURE__ */ React8.createElement(DropdownMenu.Viewport, null, actionGroups?.map((actions, index) => {
|
|
666
|
+
const separator = index > 0 ? /* @__PURE__ */ React8.createElement(DropdownMenu.Separator, null) : null;
|
|
667
|
+
return /* @__PURE__ */ React8.createElement(Fragment, {
|
|
456
668
|
key: index
|
|
457
669
|
}, separator, actions.map((action) => {
|
|
458
670
|
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[getHostPlatform()];
|
|
459
671
|
const menuItemType = action.properties.menuItemType;
|
|
460
672
|
const Root = menuItemType === "toggle" ? DropdownMenu.CheckboxItem : DropdownMenu.Item;
|
|
461
|
-
return /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ React8.createElement(Root, {
|
|
462
674
|
key: action.id,
|
|
463
675
|
onClick: (event) => {
|
|
464
676
|
if (action.properties.disabled) {
|
|
@@ -474,21 +686,21 @@ var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAct
|
|
|
474
686
|
...action.properties?.testId && {
|
|
475
687
|
"data-testid": action.properties.testId
|
|
476
688
|
}
|
|
477
|
-
}, /* @__PURE__ */
|
|
689
|
+
}, /* @__PURE__ */ React8.createElement(Icon, {
|
|
478
690
|
icon: action.properties.icon ?? "ph--placeholder--regular",
|
|
479
691
|
size: 4
|
|
480
|
-
}), /* @__PURE__ */
|
|
692
|
+
}), /* @__PURE__ */ React8.createElement("span", {
|
|
481
693
|
className: "grow truncate"
|
|
482
|
-
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */
|
|
694
|
+
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */ React8.createElement(DropdownMenu.ItemIndicator, {
|
|
483
695
|
asChild: true
|
|
484
|
-
}, /* @__PURE__ */
|
|
696
|
+
}, /* @__PURE__ */ React8.createElement(Icon, {
|
|
485
697
|
icon: "ph--check--regular",
|
|
486
698
|
size: 4
|
|
487
|
-
})), shortcut && /* @__PURE__ */
|
|
488
|
-
className:
|
|
699
|
+
})), shortcut && /* @__PURE__ */ React8.createElement("span", {
|
|
700
|
+
className: mx5("shrink-0", descriptionText)
|
|
489
701
|
}, keySymbols(shortcut).join("")));
|
|
490
702
|
}));
|
|
491
|
-
}), children), /* @__PURE__ */
|
|
703
|
+
}), children), /* @__PURE__ */ React8.createElement(DropdownMenu.Arrow, null))));
|
|
492
704
|
} finally {
|
|
493
705
|
_effect.f();
|
|
494
706
|
}
|
|
@@ -499,15 +711,15 @@ var DEFAULT_HORIZONTAL_SIZE = 48;
|
|
|
499
711
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
500
712
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
501
713
|
var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, size: propsSize, onSizeChange, role, order, prevSiblingId, nextSiblingId, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
502
|
-
var _effect =
|
|
714
|
+
var _effect = _useSignals9();
|
|
503
715
|
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] =
|
|
716
|
+
const [itemElement, itemRef] = useState5(null);
|
|
717
|
+
const [selfDragHandleElement, selfDragHandleRef] = useState5(null);
|
|
718
|
+
const [closestEdge, setEdge] = useState5(null);
|
|
719
|
+
const [sourceId, setSourceId] = useState5(null);
|
|
720
|
+
const [dragState, setDragState] = useState5(idle);
|
|
721
|
+
const { orientation, rail, onRearrange, size: stackSize, stackId } = useStack();
|
|
722
|
+
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = useState5(propsSize);
|
|
511
723
|
const Root = role ?? "div";
|
|
512
724
|
const composedItemRef = composeRefs2(itemRef, forwardedRef);
|
|
513
725
|
const setSize = useCallback2((nextSize, commit) => {
|
|
@@ -654,24 +866,25 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
|
|
|
654
866
|
setDragState,
|
|
655
867
|
role
|
|
656
868
|
]);
|
|
657
|
-
return /* @__PURE__ */
|
|
869
|
+
return /* @__PURE__ */ React9.createElement(StackItemContext.Provider, {
|
|
658
870
|
value: stackItemContextValue
|
|
659
|
-
}, /* @__PURE__ */
|
|
871
|
+
}, /* @__PURE__ */ React9.createElement(Root, {
|
|
660
872
|
...props,
|
|
661
873
|
tabIndex: 0,
|
|
662
874
|
...focusableGroupAttrs,
|
|
663
|
-
className:
|
|
664
|
-
"data-dx-stack-item":
|
|
875
|
+
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),
|
|
876
|
+
"data-dx-stack-item": stackId,
|
|
877
|
+
"data-dx-item-id": item.id,
|
|
665
878
|
...resizeAttributes,
|
|
666
879
|
style: {
|
|
667
|
-
...sizeStyle(size, orientation),
|
|
880
|
+
...stackSize !== "split" && sizeStyle(size, orientation),
|
|
668
881
|
...Number.isFinite(order) && {
|
|
669
882
|
[orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
|
|
670
883
|
},
|
|
671
884
|
...style
|
|
672
885
|
},
|
|
673
886
|
ref: composedItemRef
|
|
674
|
-
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */
|
|
887
|
+
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */ React9.createElement(ListItem2.DropIndicator, {
|
|
675
888
|
lineInset: 8,
|
|
676
889
|
terminalInset: -8,
|
|
677
890
|
edge: closestEdge
|
|
@@ -702,6 +915,7 @@ var StackItem = {
|
|
|
702
915
|
// src/exemplars/Card/fragments.ts
|
|
703
916
|
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
917
|
var cardSpacing = "pli-cardSpacingInline mlb-cardSpacingBlock";
|
|
918
|
+
var cardNoSpacing = "pli-0 mlb-0";
|
|
705
919
|
var labelSpacing = "mbs-inputSpacingBlock mbe-labelSpacingBlock";
|
|
706
920
|
var cardDialogContent = "p-0 bs-content min-bs-[8rem] max-bs-full md:max-is-[32rem] overflow-hidden";
|
|
707
921
|
var cardDialogHeader = "pli-cardSpacingInline mbs-cardSpacingBlock flex justify-between";
|
|
@@ -709,18 +923,18 @@ var cardDialogOverflow = "overflow-y-auto min-bs-0 flex-1";
|
|
|
709
923
|
var cardDialogPaddedOverflow = `${cardDialogOverflow} plb-cardSpacingBlock`;
|
|
710
924
|
var cardDialogSearchListRoot = "pli-cardSpacingInline pbs-cardSpacingBlock [&>input]:mbe-0 min-bs-0 flex-1 flex flex-col";
|
|
711
925
|
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";
|
|
926
|
+
var cardHeading = "text-lg font-medium line-clamp-2 grow";
|
|
927
|
+
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
928
|
|
|
715
929
|
// src/exemplars/Card/Card.tsx
|
|
716
|
-
import { useSignals as
|
|
930
|
+
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
717
931
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
718
932
|
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
719
|
-
import
|
|
933
|
+
import React10, { forwardRef as forwardRef6 } from "react";
|
|
720
934
|
import { Icon as Icon2, IconButton, Toolbar, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
721
|
-
import { hoverableControls, mx as
|
|
935
|
+
import { hoverableControls, mx as mx7 } from "@dxos/react-ui-theme";
|
|
722
936
|
var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "group", ...props }, forwardedRef) => {
|
|
723
|
-
var _effect =
|
|
937
|
+
var _effect = _useSignals10();
|
|
724
938
|
try {
|
|
725
939
|
const Root = asChild ? Slot3 : "div";
|
|
726
940
|
const rootProps = asChild ? {
|
|
@@ -729,10 +943,10 @@ var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChil
|
|
|
729
943
|
classNames
|
|
730
944
|
]
|
|
731
945
|
} : {
|
|
732
|
-
className:
|
|
946
|
+
className: mx7(cardRoot, classNames),
|
|
733
947
|
role
|
|
734
948
|
};
|
|
735
|
-
return /* @__PURE__ */
|
|
949
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
736
950
|
...props,
|
|
737
951
|
...rootProps,
|
|
738
952
|
ref: forwardedRef
|
|
@@ -742,23 +956,23 @@ var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChil
|
|
|
742
956
|
}
|
|
743
957
|
});
|
|
744
958
|
var CardSurfaceRoot = ({ role = "never", children, classNames }) => {
|
|
745
|
-
var _effect =
|
|
959
|
+
var _effect = _useSignals10();
|
|
746
960
|
try {
|
|
747
961
|
if ([
|
|
748
962
|
"card--popover",
|
|
749
963
|
"card--intrinsic",
|
|
750
964
|
"card--extrinsic"
|
|
751
965
|
].includes(role)) {
|
|
752
|
-
return /* @__PURE__ */
|
|
753
|
-
className:
|
|
966
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
967
|
+
className: mx7(role === "card--popover" ? "popover-card-width" : [
|
|
754
968
|
"card--intrinsic",
|
|
755
969
|
"card--extrinsic"
|
|
756
970
|
].includes(role) ? "contents" : "", classNames)
|
|
757
971
|
}, children);
|
|
758
972
|
} else {
|
|
759
|
-
return /* @__PURE__ */
|
|
973
|
+
return /* @__PURE__ */ React10.createElement(CardStaticRoot, {
|
|
760
974
|
classNames: [
|
|
761
|
-
role === "card--transclusion" && "mlb-
|
|
975
|
+
role === "card--transclusion" && "mlb-1",
|
|
762
976
|
role === "card--transclusion" && hoverableControls,
|
|
763
977
|
classNames
|
|
764
978
|
]
|
|
@@ -769,7 +983,7 @@ var CardSurfaceRoot = ({ role = "never", children, classNames }) => {
|
|
|
769
983
|
}
|
|
770
984
|
};
|
|
771
985
|
var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
772
|
-
var _effect =
|
|
986
|
+
var _effect = _useSignals10();
|
|
773
987
|
try {
|
|
774
988
|
const Root = asChild ? Slot3 : "div";
|
|
775
989
|
const rootProps = asChild ? {
|
|
@@ -779,10 +993,10 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
779
993
|
classNames
|
|
780
994
|
]
|
|
781
995
|
} : {
|
|
782
|
-
className:
|
|
996
|
+
className: mx7(cardHeading, cardText, classNames),
|
|
783
997
|
role
|
|
784
998
|
};
|
|
785
|
-
return /* @__PURE__ */
|
|
999
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
786
1000
|
...props,
|
|
787
1001
|
...rootProps,
|
|
788
1002
|
ref: forwardedRef
|
|
@@ -792,9 +1006,9 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
792
1006
|
}
|
|
793
1007
|
});
|
|
794
1008
|
var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props }, forwardedRef) => {
|
|
795
|
-
var _effect =
|
|
1009
|
+
var _effect = _useSignals10();
|
|
796
1010
|
try {
|
|
797
|
-
return /* @__PURE__ */
|
|
1011
|
+
return /* @__PURE__ */ React10.createElement(Toolbar.Root, {
|
|
798
1012
|
...props,
|
|
799
1013
|
classNames: [
|
|
800
1014
|
"bg-transparent density-coarse",
|
|
@@ -809,11 +1023,11 @@ var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props
|
|
|
809
1023
|
var CardToolbarIconButton = Toolbar.IconButton;
|
|
810
1024
|
var CardToolbarSeparator = Toolbar.Separator;
|
|
811
1025
|
var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef) => {
|
|
812
|
-
var _effect =
|
|
1026
|
+
var _effect = _useSignals10();
|
|
813
1027
|
try {
|
|
814
1028
|
const { t } = useTranslation2(translationKey);
|
|
815
1029
|
const Root = toolbarItem ? Toolbar.IconButton : IconButton;
|
|
816
|
-
return /* @__PURE__ */
|
|
1030
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
817
1031
|
iconOnly: true,
|
|
818
1032
|
icon: "ph--dots-six-vertical--regular",
|
|
819
1033
|
variant: "ghost",
|
|
@@ -828,22 +1042,25 @@ var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef)
|
|
|
828
1042
|
var CardDragPreview = StackItem.DragPreview;
|
|
829
1043
|
var CardMenu = Primitive.div;
|
|
830
1044
|
var CardPoster = (props) => {
|
|
831
|
-
var _effect =
|
|
1045
|
+
var _effect = _useSignals10();
|
|
832
1046
|
try {
|
|
833
1047
|
const aspect = props.aspect === "auto" ? "aspect-auto" : "aspect-video";
|
|
834
1048
|
if (props.image) {
|
|
835
|
-
return /* @__PURE__ */
|
|
836
|
-
|
|
1049
|
+
return /* @__PURE__ */ React10.createElement(Image, {
|
|
1050
|
+
classNames: [
|
|
1051
|
+
`dx-card__poster is-full __bs-auto`,
|
|
1052
|
+
aspect
|
|
1053
|
+
],
|
|
837
1054
|
src: props.image,
|
|
838
1055
|
alt: props.alt
|
|
839
1056
|
});
|
|
840
1057
|
}
|
|
841
1058
|
if (props.icon) {
|
|
842
|
-
return /* @__PURE__ */
|
|
1059
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
843
1060
|
role: "image",
|
|
844
|
-
className: `dx-card__poster grid
|
|
1061
|
+
className: mx7(`dx-card__poster grid place-items-center bg-inputSurface text-subdued`, aspect),
|
|
845
1062
|
"aria-label": props.alt
|
|
846
|
-
}, /* @__PURE__ */
|
|
1063
|
+
}, /* @__PURE__ */ React10.createElement(Icon2, {
|
|
847
1064
|
icon: props.icon,
|
|
848
1065
|
size: 10
|
|
849
1066
|
}));
|
|
@@ -853,7 +1070,7 @@ var CardPoster = (props) => {
|
|
|
853
1070
|
}
|
|
854
1071
|
};
|
|
855
1072
|
var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
856
|
-
var _effect =
|
|
1073
|
+
var _effect = _useSignals10();
|
|
857
1074
|
try {
|
|
858
1075
|
const Root = asChild ? Slot3 : "div";
|
|
859
1076
|
const rootProps = asChild ? {
|
|
@@ -862,10 +1079,10 @@ var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, r
|
|
|
862
1079
|
classNames
|
|
863
1080
|
]
|
|
864
1081
|
} : {
|
|
865
|
-
className:
|
|
1082
|
+
className: mx7(cardChrome, classNames),
|
|
866
1083
|
role
|
|
867
1084
|
};
|
|
868
|
-
return /* @__PURE__ */
|
|
1085
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
869
1086
|
...props,
|
|
870
1087
|
...rootProps,
|
|
871
1088
|
ref: forwardedRef
|
|
@@ -875,19 +1092,19 @@ var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, r
|
|
|
875
1092
|
}
|
|
876
1093
|
});
|
|
877
1094
|
var CardText = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
878
|
-
var _effect =
|
|
1095
|
+
var _effect = _useSignals10();
|
|
879
1096
|
try {
|
|
880
|
-
const Root = asChild ? Slot3 : "
|
|
1097
|
+
const Root = asChild ? Slot3 : "div";
|
|
881
1098
|
const rootProps = asChild ? {
|
|
882
1099
|
classNames: [
|
|
883
1100
|
cardText,
|
|
884
1101
|
classNames
|
|
885
1102
|
]
|
|
886
1103
|
} : {
|
|
887
|
-
className:
|
|
1104
|
+
className: mx7(cardText, classNames),
|
|
888
1105
|
role
|
|
889
1106
|
};
|
|
890
|
-
return /* @__PURE__ */
|
|
1107
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
891
1108
|
...props,
|
|
892
1109
|
...rootProps,
|
|
893
1110
|
ref: forwardedRef
|
|
@@ -912,13 +1129,13 @@ var Card = {
|
|
|
912
1129
|
};
|
|
913
1130
|
|
|
914
1131
|
// src/exemplars/Card/CardDragPreview.tsx
|
|
915
|
-
import { useSignals as
|
|
916
|
-
import
|
|
917
|
-
import { mx as
|
|
1132
|
+
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
1133
|
+
import React11 from "react";
|
|
1134
|
+
import { mx as mx8 } from "@dxos/react-ui-theme";
|
|
918
1135
|
var CardDragPreviewRoot = ({ children }) => {
|
|
919
|
-
var _effect =
|
|
1136
|
+
var _effect = _useSignals11();
|
|
920
1137
|
try {
|
|
921
|
-
return /* @__PURE__ */
|
|
1138
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
922
1139
|
className: "p-2"
|
|
923
1140
|
}, children);
|
|
924
1141
|
} finally {
|
|
@@ -926,10 +1143,10 @@ var CardDragPreviewRoot = ({ children }) => {
|
|
|
926
1143
|
}
|
|
927
1144
|
};
|
|
928
1145
|
var CardDragPreviewContent = ({ children }) => {
|
|
929
|
-
var _effect =
|
|
1146
|
+
var _effect = _useSignals11();
|
|
930
1147
|
try {
|
|
931
|
-
return /* @__PURE__ */
|
|
932
|
-
className:
|
|
1148
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1149
|
+
className: mx8(cardRoot, "ring-focusLine ring-neutralFocusIndicator")
|
|
933
1150
|
}, children);
|
|
934
1151
|
} finally {
|
|
935
1152
|
_effect.f();
|
|
@@ -941,14 +1158,14 @@ var CardDragPreview2 = {
|
|
|
941
1158
|
};
|
|
942
1159
|
|
|
943
1160
|
// src/exemplars/CardStack/CardStack.tsx
|
|
944
|
-
import { useSignals as
|
|
1161
|
+
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
945
1162
|
import { Slot as Slot4 } from "@radix-ui/react-slot";
|
|
946
|
-
import
|
|
947
|
-
import { mx as
|
|
1163
|
+
import React12, { forwardRef as forwardRef7 } from "react";
|
|
1164
|
+
import { mx as mx9 } from "@dxos/react-ui-theme";
|
|
948
1165
|
var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
949
|
-
var _effect =
|
|
1166
|
+
var _effect = _useSignals12();
|
|
950
1167
|
try {
|
|
951
|
-
return /* @__PURE__ */
|
|
1168
|
+
return /* @__PURE__ */ React12.createElement(Stack, {
|
|
952
1169
|
orientation: "vertical",
|
|
953
1170
|
size: "contain",
|
|
954
1171
|
rail: false,
|
|
@@ -973,7 +1190,7 @@ var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsC
|
|
|
973
1190
|
var CardStackDragHandle = Card.DragHandle;
|
|
974
1191
|
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
975
1192
|
var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
976
|
-
var _effect =
|
|
1193
|
+
var _effect = _useSignals12();
|
|
977
1194
|
try {
|
|
978
1195
|
const Root = asChild ? Slot4 : "div";
|
|
979
1196
|
const rootProps = asChild ? {
|
|
@@ -982,10 +1199,10 @@ var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
982
1199
|
classNames
|
|
983
1200
|
]
|
|
984
1201
|
} : {
|
|
985
|
-
className:
|
|
1202
|
+
className: mx9(cardStackHeading, classNames),
|
|
986
1203
|
role
|
|
987
1204
|
};
|
|
988
|
-
return /* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
989
1206
|
...props,
|
|
990
1207
|
...rootProps,
|
|
991
1208
|
ref: forwardedRef
|
|
@@ -996,7 +1213,7 @@ var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
996
1213
|
});
|
|
997
1214
|
var cardStackFooter = 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
998
1215
|
var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
999
|
-
var _effect =
|
|
1216
|
+
var _effect = _useSignals12();
|
|
1000
1217
|
try {
|
|
1001
1218
|
const Root = asChild ? Slot4 : "div";
|
|
1002
1219
|
const rootProps = asChild ? {
|
|
@@ -1005,10 +1222,10 @@ var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChi
|
|
|
1005
1222
|
classNames
|
|
1006
1223
|
]
|
|
1007
1224
|
} : {
|
|
1008
|
-
className:
|
|
1225
|
+
className: mx9(cardStackFooter, classNames),
|
|
1009
1226
|
role
|
|
1010
1227
|
};
|
|
1011
|
-
return /* @__PURE__ */
|
|
1228
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1012
1229
|
...props,
|
|
1013
1230
|
...rootProps,
|
|
1014
1231
|
ref: forwardedRef
|
|
@@ -1017,24 +1234,27 @@ var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChi
|
|
|
1017
1234
|
_effect.f();
|
|
1018
1235
|
}
|
|
1019
1236
|
});
|
|
1020
|
-
var cardStackContent =
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
];
|
|
1024
|
-
var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1025
|
-
var _effect = _useSignals11();
|
|
1237
|
+
var cardStackContent = "shrink min-bs-0 bg-baseSurface border border-separator rounded-md grid dx-focus-ring-group-x-indicator kanban-drop";
|
|
1238
|
+
var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", footer = true, ...props }, forwardedRef) => {
|
|
1239
|
+
var _effect = _useSignals12();
|
|
1026
1240
|
try {
|
|
1027
1241
|
const Root = asChild ? Slot4 : "div";
|
|
1242
|
+
const baseClassNames = footer ? [
|
|
1243
|
+
cardStackContent,
|
|
1244
|
+
railGridHorizontalContainFitContent
|
|
1245
|
+
] : [
|
|
1246
|
+
cardStackContent
|
|
1247
|
+
];
|
|
1028
1248
|
const rootProps = asChild ? {
|
|
1029
1249
|
classNames: [
|
|
1030
|
-
...
|
|
1250
|
+
...baseClassNames,
|
|
1031
1251
|
classNames
|
|
1032
1252
|
]
|
|
1033
1253
|
} : {
|
|
1034
|
-
className:
|
|
1254
|
+
className: mx9(...baseClassNames, classNames),
|
|
1035
1255
|
role
|
|
1036
1256
|
};
|
|
1037
|
-
return /* @__PURE__ */
|
|
1257
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1038
1258
|
...props,
|
|
1039
1259
|
...rootProps,
|
|
1040
1260
|
"data-scroll-separator": "false",
|
|
@@ -1046,7 +1266,7 @@ var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
1046
1266
|
});
|
|
1047
1267
|
var cardStackRoot = "flex flex-col pli-2 plb-2";
|
|
1048
1268
|
var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1049
|
-
var _effect =
|
|
1269
|
+
var _effect = _useSignals12();
|
|
1050
1270
|
try {
|
|
1051
1271
|
const Root = asChild ? Slot4 : "div";
|
|
1052
1272
|
const rootProps = asChild ? {
|
|
@@ -1055,10 +1275,10 @@ var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1055
1275
|
classNames
|
|
1056
1276
|
]
|
|
1057
1277
|
} : {
|
|
1058
|
-
className:
|
|
1278
|
+
className: mx9(cardStackRoot, classNames),
|
|
1059
1279
|
role
|
|
1060
1280
|
};
|
|
1061
|
-
return /* @__PURE__ */
|
|
1281
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1062
1282
|
...props,
|
|
1063
1283
|
...rootProps,
|
|
1064
1284
|
ref: forwardedRef
|
|
@@ -1069,7 +1289,7 @@ var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1069
1289
|
});
|
|
1070
1290
|
var cardStackItem = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
1071
1291
|
var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1072
|
-
var _effect =
|
|
1292
|
+
var _effect = _useSignals12();
|
|
1073
1293
|
try {
|
|
1074
1294
|
const Root = asChild ? Slot4 : "div";
|
|
1075
1295
|
const rootProps = asChild ? {
|
|
@@ -1078,10 +1298,10 @@ var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1078
1298
|
classNames
|
|
1079
1299
|
]
|
|
1080
1300
|
} : {
|
|
1081
|
-
className:
|
|
1301
|
+
className: mx9(cardStackItem, classNames),
|
|
1082
1302
|
role
|
|
1083
1303
|
};
|
|
1084
|
-
return /* @__PURE__ */
|
|
1304
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1085
1305
|
...props,
|
|
1086
1306
|
...rootProps,
|
|
1087
1307
|
ref: forwardedRef
|
|
@@ -1101,16 +1321,16 @@ var CardStack = {
|
|
|
1101
1321
|
};
|
|
1102
1322
|
|
|
1103
1323
|
// src/exemplars/CardStack/CardStackDragPreview.tsx
|
|
1104
|
-
import { useSignals as
|
|
1105
|
-
import
|
|
1324
|
+
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1325
|
+
import React13 from "react";
|
|
1106
1326
|
import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
1107
|
-
import { mx as
|
|
1327
|
+
import { mx as mx10 } from "@dxos/react-ui-theme";
|
|
1108
1328
|
var CardStackDragPreviewRoot = ({ children }) => {
|
|
1109
|
-
var _effect =
|
|
1329
|
+
var _effect = _useSignals13();
|
|
1110
1330
|
try {
|
|
1111
|
-
return /* @__PURE__ */
|
|
1331
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1112
1332
|
className: "p-2"
|
|
1113
|
-
}, /* @__PURE__ */
|
|
1333
|
+
}, /* @__PURE__ */ React13.createElement("div", {
|
|
1114
1334
|
className: "rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col"
|
|
1115
1335
|
}, children));
|
|
1116
1336
|
} finally {
|
|
@@ -1118,12 +1338,12 @@ var CardStackDragPreviewRoot = ({ children }) => {
|
|
|
1118
1338
|
}
|
|
1119
1339
|
};
|
|
1120
1340
|
var CardStackDragPreviewHeading = ({ children }) => {
|
|
1121
|
-
var _effect =
|
|
1341
|
+
var _effect = _useSignals13();
|
|
1122
1342
|
try {
|
|
1123
1343
|
const { t } = useTranslation3(translationKey);
|
|
1124
|
-
return /* @__PURE__ */
|
|
1344
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1125
1345
|
className: "flex items-center p-2"
|
|
1126
|
-
}, /* @__PURE__ */
|
|
1346
|
+
}, /* @__PURE__ */ React13.createElement(IconButton2, {
|
|
1127
1347
|
iconOnly: true,
|
|
1128
1348
|
icon: "ph--dots-six-vertical--regular",
|
|
1129
1349
|
variant: "ghost",
|
|
@@ -1135,19 +1355,19 @@ var CardStackDragPreviewHeading = ({ children }) => {
|
|
|
1135
1355
|
}
|
|
1136
1356
|
};
|
|
1137
1357
|
var CardStackDragPreviewContent = ({ children, itemsCount = 0 }) => {
|
|
1138
|
-
var _effect =
|
|
1358
|
+
var _effect = _useSignals13();
|
|
1139
1359
|
try {
|
|
1140
|
-
return /* @__PURE__ */
|
|
1141
|
-
className:
|
|
1360
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1361
|
+
className: mx10("overflow-y-auto flex-1 pli-2 flex flex-col gap-2", "plb-1", itemsCount > 0 ? "plb-2" : "plb-1")
|
|
1142
1362
|
}, children);
|
|
1143
1363
|
} finally {
|
|
1144
1364
|
_effect.f();
|
|
1145
1365
|
}
|
|
1146
1366
|
};
|
|
1147
1367
|
var CardStackDragPreviewFooter = ({ children }) => {
|
|
1148
|
-
var _effect =
|
|
1368
|
+
var _effect = _useSignals13();
|
|
1149
1369
|
try {
|
|
1150
|
-
return /* @__PURE__ */
|
|
1370
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1151
1371
|
className: "p-2 border-t border-separator"
|
|
1152
1372
|
}, children);
|
|
1153
1373
|
} finally {
|
|
@@ -1162,6 +1382,7 @@ var CardStackDragPreview = {
|
|
|
1162
1382
|
};
|
|
1163
1383
|
|
|
1164
1384
|
export {
|
|
1385
|
+
Image,
|
|
1165
1386
|
StackContext,
|
|
1166
1387
|
railGridHorizontal,
|
|
1167
1388
|
railGridVertical,
|
|
@@ -1178,6 +1399,7 @@ export {
|
|
|
1178
1399
|
StackItem,
|
|
1179
1400
|
cardRoot,
|
|
1180
1401
|
cardSpacing,
|
|
1402
|
+
cardNoSpacing,
|
|
1181
1403
|
labelSpacing,
|
|
1182
1404
|
cardDialogContent,
|
|
1183
1405
|
cardDialogHeader,
|
|
@@ -1197,4 +1419,4 @@ export {
|
|
|
1197
1419
|
CardStack,
|
|
1198
1420
|
CardStackDragPreview
|
|
1199
1421
|
};
|
|
1200
|
-
//# sourceMappingURL=chunk-
|
|
1422
|
+
//# sourceMappingURL=chunk-2UOARV5Q.mjs.map
|