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