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