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