@dxos/react-ui-stack 0.8.4-main.fd6878d → 0.8.4-main.fffef41
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-FV7KWSG5.mjs → chunk-3F2KBXLP.mjs} +479 -195
- package/dist/lib/browser/chunk-3F2KBXLP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +9 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node-esm/{chunk-ISLFXOAT.mjs → chunk-SYKFLQGK.mjs} +479 -195
- package/dist/lib/node-esm/chunk-SYKFLQGK.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +9 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/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 +12 -3
- 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 +13 -5
- 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 +22 -11
- package/dist/types/src/exemplars/Card/Card.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/Card.stories.d.ts +12 -4
- package/dist/types/src/exemplars/Card/Card.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/fragments.d.ts +3 -2
- package/dist/types/src/exemplars/Card/fragments.d.ts.map +1 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts +3 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +1 -1
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts +9 -3
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useStackDropForElements.d.ts +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 +4 -6
- package/src/components/Stack/Stack.tsx +218 -21
- package/src/components/StackContext.tsx +1 -0
- package/src/components/StackItem/StackItem.stories.tsx +15 -13
- 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 +29 -43
- package/src/exemplars/Card/Card.tsx +42 -19
- package/src/exemplars/Card/fragments.ts +3 -2
- package/src/exemplars/CardStack/CardStack.stories.tsx +8 -8
- package/src/exemplars/CardStack/CardStack.tsx +11 -8
- package/src/hooks/useStackDropForElements.ts +42 -35
- package/dist/lib/browser/chunk-FV7KWSG5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ISLFXOAT.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
|
|
@@ -700,6 +963,7 @@ var StackItem = {
|
|
|
700
963
|
// src/exemplars/Card/fragments.ts
|
|
701
964
|
var cardRoot = "rounded overflow-hidden bg-cardSurface border border-separator dark:border-subduedSeparator dx-focus-ring-group-y-indicator relative min-bs-[--rail-item] group/card";
|
|
702
965
|
var cardSpacing = "pli-cardSpacingInline mlb-cardSpacingBlock";
|
|
966
|
+
var cardNoSpacing = "pli-0 mlb-0";
|
|
703
967
|
var labelSpacing = "mbs-inputSpacingBlock mbe-labelSpacingBlock";
|
|
704
968
|
var cardDialogContent = "p-0 bs-content min-bs-[8rem] max-bs-full md:max-is-[32rem] overflow-hidden";
|
|
705
969
|
var cardDialogHeader = "pli-cardSpacingInline mbs-cardSpacingBlock flex justify-between";
|
|
@@ -707,18 +971,20 @@ var cardDialogOverflow = "overflow-y-auto min-bs-0 flex-1";
|
|
|
707
971
|
var cardDialogPaddedOverflow = `${cardDialogOverflow} plb-cardSpacingBlock`;
|
|
708
972
|
var cardDialogSearchListRoot = "pli-cardSpacingInline pbs-cardSpacingBlock [&>input]:mbe-0 min-bs-0 flex-1 flex flex-col";
|
|
709
973
|
var cardText = cardSpacing;
|
|
710
|
-
var cardHeading = "text-lg font-medium line-clamp-2";
|
|
711
|
-
var cardChrome = "pli-[--dx-cardSpacingChrome] mlb-[--dx-cardSpacingChrome] [&_.dx-button]:text-start [&_.dx-button]:is-full";
|
|
974
|
+
var cardHeading = "text-lg font-medium line-clamp-2 grow";
|
|
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))]";
|
|
712
976
|
|
|
713
977
|
// src/exemplars/Card/Card.tsx
|
|
714
|
-
import { useSignals as
|
|
978
|
+
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
715
979
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
716
980
|
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
717
|
-
import
|
|
981
|
+
import React10, { forwardRef as forwardRef6 } from "react";
|
|
718
982
|
import { Icon as Icon2, IconButton, Toolbar, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
719
|
-
import { hoverableControls, mx as
|
|
720
|
-
var
|
|
721
|
-
|
|
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();
|
|
722
988
|
try {
|
|
723
989
|
const Root = asChild ? Slot3 : "div";
|
|
724
990
|
const rootProps = asChild ? {
|
|
@@ -727,10 +993,13 @@ var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChil
|
|
|
727
993
|
classNames
|
|
728
994
|
]
|
|
729
995
|
} : {
|
|
730
|
-
className:
|
|
996
|
+
className: mx7(cardRoot, classNames),
|
|
731
997
|
role
|
|
732
998
|
};
|
|
733
|
-
return /* @__PURE__ */
|
|
999
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
1000
|
+
...id && {
|
|
1001
|
+
"data-object-id": id
|
|
1002
|
+
},
|
|
734
1003
|
...props,
|
|
735
1004
|
...rootProps,
|
|
736
1005
|
ref: forwardedRef
|
|
@@ -739,24 +1008,28 @@ var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChil
|
|
|
739
1008
|
_effect.f();
|
|
740
1009
|
}
|
|
741
1010
|
});
|
|
742
|
-
var CardSurfaceRoot = ({ role = "never", children, classNames }) => {
|
|
743
|
-
var _effect =
|
|
1011
|
+
var CardSurfaceRoot = ({ id, role = "never", children, classNames }) => {
|
|
1012
|
+
var _effect = _useSignals10();
|
|
744
1013
|
try {
|
|
745
1014
|
if ([
|
|
746
1015
|
"card--popover",
|
|
747
1016
|
"card--intrinsic",
|
|
748
1017
|
"card--extrinsic"
|
|
749
1018
|
].includes(role)) {
|
|
750
|
-
return /* @__PURE__ */
|
|
751
|
-
|
|
1019
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
1020
|
+
...id && {
|
|
1021
|
+
"data-object-id": id
|
|
1022
|
+
},
|
|
1023
|
+
className: mx7(role === "card--popover" ? "popover-card-width" : [
|
|
752
1024
|
"card--intrinsic",
|
|
753
1025
|
"card--extrinsic"
|
|
754
1026
|
].includes(role) ? "contents" : "", classNames)
|
|
755
1027
|
}, children);
|
|
756
1028
|
} else {
|
|
757
|
-
return /* @__PURE__ */
|
|
1029
|
+
return /* @__PURE__ */ React10.createElement(CardStaticRoot, {
|
|
1030
|
+
id,
|
|
758
1031
|
classNames: [
|
|
759
|
-
role === "card--transclusion" && "mlb-
|
|
1032
|
+
role === "card--transclusion" && "mlb-1",
|
|
760
1033
|
role === "card--transclusion" && hoverableControls,
|
|
761
1034
|
classNames
|
|
762
1035
|
]
|
|
@@ -767,7 +1040,7 @@ var CardSurfaceRoot = ({ role = "never", children, classNames }) => {
|
|
|
767
1040
|
}
|
|
768
1041
|
};
|
|
769
1042
|
var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
770
|
-
var _effect =
|
|
1043
|
+
var _effect = _useSignals10();
|
|
771
1044
|
try {
|
|
772
1045
|
const Root = asChild ? Slot3 : "div";
|
|
773
1046
|
const rootProps = asChild ? {
|
|
@@ -777,10 +1050,10 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
777
1050
|
classNames
|
|
778
1051
|
]
|
|
779
1052
|
} : {
|
|
780
|
-
className:
|
|
1053
|
+
className: mx7(cardHeading, cardText, classNames),
|
|
781
1054
|
role
|
|
782
1055
|
};
|
|
783
|
-
return /* @__PURE__ */
|
|
1056
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
784
1057
|
...props,
|
|
785
1058
|
...rootProps,
|
|
786
1059
|
ref: forwardedRef
|
|
@@ -790,9 +1063,9 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
790
1063
|
}
|
|
791
1064
|
});
|
|
792
1065
|
var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props }, forwardedRef) => {
|
|
793
|
-
var _effect =
|
|
1066
|
+
var _effect = _useSignals10();
|
|
794
1067
|
try {
|
|
795
|
-
return /* @__PURE__ */
|
|
1068
|
+
return /* @__PURE__ */ React10.createElement(Toolbar.Root, {
|
|
796
1069
|
...props,
|
|
797
1070
|
classNames: [
|
|
798
1071
|
"bg-transparent density-coarse",
|
|
@@ -807,11 +1080,11 @@ var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props
|
|
|
807
1080
|
var CardToolbarIconButton = Toolbar.IconButton;
|
|
808
1081
|
var CardToolbarSeparator = Toolbar.Separator;
|
|
809
1082
|
var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef) => {
|
|
810
|
-
var _effect =
|
|
1083
|
+
var _effect = _useSignals10();
|
|
811
1084
|
try {
|
|
812
1085
|
const { t } = useTranslation2(translationKey);
|
|
813
1086
|
const Root = toolbarItem ? Toolbar.IconButton : IconButton;
|
|
814
|
-
return /* @__PURE__ */
|
|
1087
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
815
1088
|
iconOnly: true,
|
|
816
1089
|
icon: "ph--dots-six-vertical--regular",
|
|
817
1090
|
variant: "ghost",
|
|
@@ -826,22 +1099,26 @@ var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef)
|
|
|
826
1099
|
var CardDragPreview = StackItem.DragPreview;
|
|
827
1100
|
var CardMenu = Primitive.div;
|
|
828
1101
|
var CardPoster = (props) => {
|
|
829
|
-
var _effect =
|
|
1102
|
+
var _effect = _useSignals10();
|
|
830
1103
|
try {
|
|
831
1104
|
const aspect = props.aspect === "auto" ? "aspect-auto" : "aspect-video";
|
|
832
1105
|
if (props.image) {
|
|
833
|
-
return /* @__PURE__ */
|
|
834
|
-
|
|
1106
|
+
return /* @__PURE__ */ React10.createElement(Image, {
|
|
1107
|
+
classNames: [
|
|
1108
|
+
`dx-card__poster is-full`,
|
|
1109
|
+
aspect,
|
|
1110
|
+
props.classNames
|
|
1111
|
+
],
|
|
835
1112
|
src: props.image,
|
|
836
1113
|
alt: props.alt
|
|
837
1114
|
});
|
|
838
1115
|
}
|
|
839
1116
|
if (props.icon) {
|
|
840
|
-
return /* @__PURE__ */
|
|
1117
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
841
1118
|
role: "image",
|
|
842
|
-
className: `dx-card__poster grid
|
|
1119
|
+
className: mx7(`dx-card__poster grid place-items-center bg-inputSurface text-subdued`, aspect, props.classNames),
|
|
843
1120
|
"aria-label": props.alt
|
|
844
|
-
}, /* @__PURE__ */
|
|
1121
|
+
}, /* @__PURE__ */ React10.createElement(Icon2, {
|
|
845
1122
|
icon: props.icon,
|
|
846
1123
|
size: 10
|
|
847
1124
|
}));
|
|
@@ -851,7 +1128,7 @@ var CardPoster = (props) => {
|
|
|
851
1128
|
}
|
|
852
1129
|
};
|
|
853
1130
|
var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
854
|
-
var _effect =
|
|
1131
|
+
var _effect = _useSignals10();
|
|
855
1132
|
try {
|
|
856
1133
|
const Root = asChild ? Slot3 : "div";
|
|
857
1134
|
const rootProps = asChild ? {
|
|
@@ -860,10 +1137,10 @@ var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, r
|
|
|
860
1137
|
classNames
|
|
861
1138
|
]
|
|
862
1139
|
} : {
|
|
863
|
-
className:
|
|
1140
|
+
className: mx7(cardChrome, classNames),
|
|
864
1141
|
role
|
|
865
1142
|
};
|
|
866
|
-
return /* @__PURE__ */
|
|
1143
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
867
1144
|
...props,
|
|
868
1145
|
...rootProps,
|
|
869
1146
|
ref: forwardedRef
|
|
@@ -873,19 +1150,19 @@ var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, r
|
|
|
873
1150
|
}
|
|
874
1151
|
});
|
|
875
1152
|
var CardText = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
876
|
-
var _effect =
|
|
1153
|
+
var _effect = _useSignals10();
|
|
877
1154
|
try {
|
|
878
|
-
const Root = asChild ? Slot3 : "
|
|
1155
|
+
const Root = asChild ? Slot3 : "div";
|
|
879
1156
|
const rootProps = asChild ? {
|
|
880
1157
|
classNames: [
|
|
881
1158
|
cardText,
|
|
882
1159
|
classNames
|
|
883
1160
|
]
|
|
884
1161
|
} : {
|
|
885
|
-
className:
|
|
1162
|
+
className: mx7(cardText, classNames),
|
|
886
1163
|
role
|
|
887
1164
|
};
|
|
888
|
-
return /* @__PURE__ */
|
|
1165
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
889
1166
|
...props,
|
|
890
1167
|
...rootProps,
|
|
891
1168
|
ref: forwardedRef
|
|
@@ -910,13 +1187,13 @@ var Card = {
|
|
|
910
1187
|
};
|
|
911
1188
|
|
|
912
1189
|
// src/exemplars/Card/CardDragPreview.tsx
|
|
913
|
-
import { useSignals as
|
|
914
|
-
import
|
|
915
|
-
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";
|
|
916
1193
|
var CardDragPreviewRoot = ({ children }) => {
|
|
917
|
-
var _effect =
|
|
1194
|
+
var _effect = _useSignals11();
|
|
918
1195
|
try {
|
|
919
|
-
return /* @__PURE__ */
|
|
1196
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
920
1197
|
className: "p-2"
|
|
921
1198
|
}, children);
|
|
922
1199
|
} finally {
|
|
@@ -924,10 +1201,10 @@ var CardDragPreviewRoot = ({ children }) => {
|
|
|
924
1201
|
}
|
|
925
1202
|
};
|
|
926
1203
|
var CardDragPreviewContent = ({ children }) => {
|
|
927
|
-
var _effect =
|
|
1204
|
+
var _effect = _useSignals11();
|
|
928
1205
|
try {
|
|
929
|
-
return /* @__PURE__ */
|
|
930
|
-
className:
|
|
1206
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1207
|
+
className: mx8(cardRoot, "ring-focusLine ring-neutralFocusIndicator")
|
|
931
1208
|
}, children);
|
|
932
1209
|
} finally {
|
|
933
1210
|
_effect.f();
|
|
@@ -939,14 +1216,14 @@ var CardDragPreview2 = {
|
|
|
939
1216
|
};
|
|
940
1217
|
|
|
941
1218
|
// src/exemplars/CardStack/CardStack.tsx
|
|
942
|
-
import { useSignals as
|
|
1219
|
+
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
943
1220
|
import { Slot as Slot4 } from "@radix-ui/react-slot";
|
|
944
|
-
import
|
|
945
|
-
import { mx as
|
|
1221
|
+
import React12, { forwardRef as forwardRef7 } from "react";
|
|
1222
|
+
import { mx as mx9 } from "@dxos/react-ui-theme";
|
|
946
1223
|
var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
947
|
-
var _effect =
|
|
1224
|
+
var _effect = _useSignals12();
|
|
948
1225
|
try {
|
|
949
|
-
return /* @__PURE__ */
|
|
1226
|
+
return /* @__PURE__ */ React12.createElement(Stack, {
|
|
950
1227
|
orientation: "vertical",
|
|
951
1228
|
size: "contain",
|
|
952
1229
|
rail: false,
|
|
@@ -971,7 +1248,7 @@ var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsC
|
|
|
971
1248
|
var CardStackDragHandle = Card.DragHandle;
|
|
972
1249
|
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
973
1250
|
var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
974
|
-
var _effect =
|
|
1251
|
+
var _effect = _useSignals12();
|
|
975
1252
|
try {
|
|
976
1253
|
const Root = asChild ? Slot4 : "div";
|
|
977
1254
|
const rootProps = asChild ? {
|
|
@@ -980,10 +1257,10 @@ var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
980
1257
|
classNames
|
|
981
1258
|
]
|
|
982
1259
|
} : {
|
|
983
|
-
className:
|
|
1260
|
+
className: mx9(cardStackHeading, classNames),
|
|
984
1261
|
role
|
|
985
1262
|
};
|
|
986
|
-
return /* @__PURE__ */
|
|
1263
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
987
1264
|
...props,
|
|
988
1265
|
...rootProps,
|
|
989
1266
|
ref: forwardedRef
|
|
@@ -994,7 +1271,7 @@ var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
994
1271
|
});
|
|
995
1272
|
var cardStackFooter = 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
996
1273
|
var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
997
|
-
var _effect =
|
|
1274
|
+
var _effect = _useSignals12();
|
|
998
1275
|
try {
|
|
999
1276
|
const Root = asChild ? Slot4 : "div";
|
|
1000
1277
|
const rootProps = asChild ? {
|
|
@@ -1003,10 +1280,10 @@ var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChi
|
|
|
1003
1280
|
classNames
|
|
1004
1281
|
]
|
|
1005
1282
|
} : {
|
|
1006
|
-
className:
|
|
1283
|
+
className: mx9(cardStackFooter, classNames),
|
|
1007
1284
|
role
|
|
1008
1285
|
};
|
|
1009
|
-
return /* @__PURE__ */
|
|
1286
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1010
1287
|
...props,
|
|
1011
1288
|
...rootProps,
|
|
1012
1289
|
ref: forwardedRef
|
|
@@ -1015,24 +1292,27 @@ var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChi
|
|
|
1015
1292
|
_effect.f();
|
|
1016
1293
|
}
|
|
1017
1294
|
});
|
|
1018
|
-
var cardStackContent =
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
];
|
|
1022
|
-
var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1023
|
-
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();
|
|
1024
1298
|
try {
|
|
1025
1299
|
const Root = asChild ? Slot4 : "div";
|
|
1300
|
+
const baseClassNames = footer ? [
|
|
1301
|
+
cardStackContent,
|
|
1302
|
+
railGridHorizontalContainFitContent
|
|
1303
|
+
] : [
|
|
1304
|
+
cardStackContent
|
|
1305
|
+
];
|
|
1026
1306
|
const rootProps = asChild ? {
|
|
1027
1307
|
classNames: [
|
|
1028
|
-
...
|
|
1308
|
+
...baseClassNames,
|
|
1029
1309
|
classNames
|
|
1030
1310
|
]
|
|
1031
1311
|
} : {
|
|
1032
|
-
className:
|
|
1312
|
+
className: mx9(...baseClassNames, classNames),
|
|
1033
1313
|
role
|
|
1034
1314
|
};
|
|
1035
|
-
return /* @__PURE__ */
|
|
1315
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1036
1316
|
...props,
|
|
1037
1317
|
...rootProps,
|
|
1038
1318
|
"data-scroll-separator": "false",
|
|
@@ -1044,7 +1324,7 @@ var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
1044
1324
|
});
|
|
1045
1325
|
var cardStackRoot = "flex flex-col pli-2 plb-2";
|
|
1046
1326
|
var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1047
|
-
var _effect =
|
|
1327
|
+
var _effect = _useSignals12();
|
|
1048
1328
|
try {
|
|
1049
1329
|
const Root = asChild ? Slot4 : "div";
|
|
1050
1330
|
const rootProps = asChild ? {
|
|
@@ -1053,10 +1333,10 @@ var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1053
1333
|
classNames
|
|
1054
1334
|
]
|
|
1055
1335
|
} : {
|
|
1056
|
-
className:
|
|
1336
|
+
className: mx9(cardStackRoot, classNames),
|
|
1057
1337
|
role
|
|
1058
1338
|
};
|
|
1059
|
-
return /* @__PURE__ */
|
|
1339
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1060
1340
|
...props,
|
|
1061
1341
|
...rootProps,
|
|
1062
1342
|
ref: forwardedRef
|
|
@@ -1067,7 +1347,7 @@ var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1067
1347
|
});
|
|
1068
1348
|
var cardStackItem = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
1069
1349
|
var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1070
|
-
var _effect =
|
|
1350
|
+
var _effect = _useSignals12();
|
|
1071
1351
|
try {
|
|
1072
1352
|
const Root = asChild ? Slot4 : "div";
|
|
1073
1353
|
const rootProps = asChild ? {
|
|
@@ -1076,10 +1356,10 @@ var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1076
1356
|
classNames
|
|
1077
1357
|
]
|
|
1078
1358
|
} : {
|
|
1079
|
-
className:
|
|
1359
|
+
className: mx9(cardStackItem, classNames),
|
|
1080
1360
|
role
|
|
1081
1361
|
};
|
|
1082
|
-
return /* @__PURE__ */
|
|
1362
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1083
1363
|
...props,
|
|
1084
1364
|
...rootProps,
|
|
1085
1365
|
ref: forwardedRef
|
|
@@ -1099,16 +1379,16 @@ var CardStack = {
|
|
|
1099
1379
|
};
|
|
1100
1380
|
|
|
1101
1381
|
// src/exemplars/CardStack/CardStackDragPreview.tsx
|
|
1102
|
-
import { useSignals as
|
|
1103
|
-
import
|
|
1382
|
+
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1383
|
+
import React13 from "react";
|
|
1104
1384
|
import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
1105
|
-
import { mx as
|
|
1385
|
+
import { mx as mx10 } from "@dxos/react-ui-theme";
|
|
1106
1386
|
var CardStackDragPreviewRoot = ({ children }) => {
|
|
1107
|
-
var _effect =
|
|
1387
|
+
var _effect = _useSignals13();
|
|
1108
1388
|
try {
|
|
1109
|
-
return /* @__PURE__ */
|
|
1389
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1110
1390
|
className: "p-2"
|
|
1111
|
-
}, /* @__PURE__ */
|
|
1391
|
+
}, /* @__PURE__ */ React13.createElement("div", {
|
|
1112
1392
|
className: "rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col"
|
|
1113
1393
|
}, children));
|
|
1114
1394
|
} finally {
|
|
@@ -1116,12 +1396,12 @@ var CardStackDragPreviewRoot = ({ children }) => {
|
|
|
1116
1396
|
}
|
|
1117
1397
|
};
|
|
1118
1398
|
var CardStackDragPreviewHeading = ({ children }) => {
|
|
1119
|
-
var _effect =
|
|
1399
|
+
var _effect = _useSignals13();
|
|
1120
1400
|
try {
|
|
1121
1401
|
const { t } = useTranslation3(translationKey);
|
|
1122
|
-
return /* @__PURE__ */
|
|
1402
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1123
1403
|
className: "flex items-center p-2"
|
|
1124
|
-
}, /* @__PURE__ */
|
|
1404
|
+
}, /* @__PURE__ */ React13.createElement(IconButton2, {
|
|
1125
1405
|
iconOnly: true,
|
|
1126
1406
|
icon: "ph--dots-six-vertical--regular",
|
|
1127
1407
|
variant: "ghost",
|
|
@@ -1133,19 +1413,19 @@ var CardStackDragPreviewHeading = ({ children }) => {
|
|
|
1133
1413
|
}
|
|
1134
1414
|
};
|
|
1135
1415
|
var CardStackDragPreviewContent = ({ children, itemsCount = 0 }) => {
|
|
1136
|
-
var _effect =
|
|
1416
|
+
var _effect = _useSignals13();
|
|
1137
1417
|
try {
|
|
1138
|
-
return /* @__PURE__ */
|
|
1139
|
-
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")
|
|
1140
1420
|
}, children);
|
|
1141
1421
|
} finally {
|
|
1142
1422
|
_effect.f();
|
|
1143
1423
|
}
|
|
1144
1424
|
};
|
|
1145
1425
|
var CardStackDragPreviewFooter = ({ children }) => {
|
|
1146
|
-
var _effect =
|
|
1426
|
+
var _effect = _useSignals13();
|
|
1147
1427
|
try {
|
|
1148
|
-
return /* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1149
1429
|
className: "p-2 border-t border-separator"
|
|
1150
1430
|
}, children);
|
|
1151
1431
|
} finally {
|
|
@@ -1160,6 +1440,7 @@ var CardStackDragPreview = {
|
|
|
1160
1440
|
};
|
|
1161
1441
|
|
|
1162
1442
|
export {
|
|
1443
|
+
Image,
|
|
1163
1444
|
StackContext,
|
|
1164
1445
|
railGridHorizontal,
|
|
1165
1446
|
railGridVertical,
|
|
@@ -1176,6 +1457,7 @@ export {
|
|
|
1176
1457
|
StackItem,
|
|
1177
1458
|
cardRoot,
|
|
1178
1459
|
cardSpacing,
|
|
1460
|
+
cardNoSpacing,
|
|
1179
1461
|
labelSpacing,
|
|
1180
1462
|
cardDialogContent,
|
|
1181
1463
|
cardDialogHeader,
|
|
@@ -1185,6 +1467,8 @@ export {
|
|
|
1185
1467
|
cardText,
|
|
1186
1468
|
cardHeading,
|
|
1187
1469
|
cardChrome,
|
|
1470
|
+
cardDefaultInlineSize,
|
|
1471
|
+
cardStackDefaultInlineSizeRem,
|
|
1188
1472
|
Card,
|
|
1189
1473
|
CardDragPreview2 as CardDragPreview,
|
|
1190
1474
|
cardStackHeading,
|
|
@@ -1195,4 +1479,4 @@ export {
|
|
|
1195
1479
|
CardStack,
|
|
1196
1480
|
CardStackDragPreview
|
|
1197
1481
|
};
|
|
1198
|
-
//# sourceMappingURL=chunk-
|
|
1482
|
+
//# sourceMappingURL=chunk-3F2KBXLP.mjs.map
|