@dxos/react-ui-stack 0.8.4-main.2e9d522 → 0.8.4-main.3c1ae3b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-P3TQV4BA.mjs → chunk-6YJ6CHWV.mjs} +523 -238
- package/dist/lib/browser/chunk-6YJ6CHWV.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +9 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/playwright/index.mjs +4 -0
- package/dist/lib/browser/playwright/index.mjs.map +2 -2
- package/dist/lib/browser/testing/index.mjs +3 -3
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-3WVEPAJ4.mjs → chunk-KCFYDRBZ.mjs} +523 -238
- package/dist/lib/node-esm/chunk-KCFYDRBZ.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/playwright/index.mjs +4 -0
- package/dist/lib/node-esm/playwright/index.mjs.map +2 -2
- package/dist/lib/node-esm/testing/index.mjs +3 -3
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/components/Image/Image.d.ts +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 +15 -7
- package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
- package/dist/types/src/components/Stack/Stack.stories.d.ts +12 -3
- package/dist/types/src/components/Stack/Stack.stories.d.ts.map +1 -1
- package/dist/types/src/components/StackContext.d.ts +2 -1
- package/dist/types/src/components/StackContext.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItem.d.ts +7 -6
- 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 +1 -1
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/Card.d.ts +27 -14
- 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 +5 -3
- 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 +3 -3
- package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
- package/dist/types/src/testing/CardContainer.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -27
- package/src/components/Image/Image.stories.tsx +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 +8 -9
- package/src/components/Stack/Stack.tsx +223 -25
- package/src/components/StackContext.tsx +2 -1
- package/src/components/StackItem/StackItem.stories.tsx +16 -14
- package/src/components/StackItem/StackItem.tsx +26 -18
- package/src/components/StackItem/StackItemContent.tsx +20 -8
- package/src/components/StackItem/StackItemHeading.tsx +4 -8
- package/src/components/StackItem/StackItemResizeHandle.tsx +2 -1
- package/src/components/StackItem/StackItemSigil.tsx +2 -1
- package/src/components/index.ts +1 -0
- package/src/exemplars/Card/Card.stories.tsx +29 -43
- package/src/exemplars/Card/Card.tsx +80 -54
- package/src/exemplars/Card/fragments.ts +3 -2
- package/src/exemplars/CardStack/CardStack.stories.tsx +12 -11
- package/src/exemplars/CardStack/CardStack.tsx +96 -51
- package/src/hooks/useStackDropForElements.ts +43 -36
- package/src/testing/CardContainer.tsx +9 -6
- package/dist/lib/browser/chunk-P3TQV4BA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3WVEPAJ4.mjs.map +0 -7
|
@@ -1,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,35 +1008,41 @@ 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 = /* @__PURE__ */ forwardRef6(({ id, role = "never", children, classNames }, forwardedRef) => {
|
|
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
|
-
].includes(role) ? "contents" : "", classNames)
|
|
1026
|
+
].includes(role) ? "contents" : "", classNames),
|
|
1027
|
+
ref: forwardedRef
|
|
755
1028
|
}, children);
|
|
756
1029
|
} else {
|
|
757
|
-
return /* @__PURE__ */
|
|
1030
|
+
return /* @__PURE__ */ React10.createElement(CardStaticRoot, {
|
|
1031
|
+
id,
|
|
758
1032
|
classNames: [
|
|
759
|
-
role === "card--transclusion" && "mlb-
|
|
1033
|
+
role === "card--transclusion" && "mlb-1",
|
|
760
1034
|
role === "card--transclusion" && hoverableControls,
|
|
761
1035
|
classNames
|
|
762
|
-
]
|
|
1036
|
+
],
|
|
1037
|
+
ref: forwardedRef
|
|
763
1038
|
}, children);
|
|
764
1039
|
}
|
|
765
1040
|
} finally {
|
|
766
1041
|
_effect.f();
|
|
767
1042
|
}
|
|
768
|
-
};
|
|
1043
|
+
});
|
|
769
1044
|
var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
770
|
-
var _effect =
|
|
1045
|
+
var _effect = _useSignals10();
|
|
771
1046
|
try {
|
|
772
1047
|
const Root = asChild ? Slot3 : "div";
|
|
773
1048
|
const rootProps = asChild ? {
|
|
@@ -777,10 +1052,10 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
777
1052
|
classNames
|
|
778
1053
|
]
|
|
779
1054
|
} : {
|
|
780
|
-
className:
|
|
1055
|
+
className: mx7(cardHeading, cardText, classNames),
|
|
781
1056
|
role
|
|
782
1057
|
};
|
|
783
|
-
return /* @__PURE__ */
|
|
1058
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
784
1059
|
...props,
|
|
785
1060
|
...rootProps,
|
|
786
1061
|
ref: forwardedRef
|
|
@@ -790,9 +1065,9 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
790
1065
|
}
|
|
791
1066
|
});
|
|
792
1067
|
var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props }, forwardedRef) => {
|
|
793
|
-
var _effect =
|
|
1068
|
+
var _effect = _useSignals10();
|
|
794
1069
|
try {
|
|
795
|
-
return /* @__PURE__ */
|
|
1070
|
+
return /* @__PURE__ */ React10.createElement(Toolbar.Root, {
|
|
796
1071
|
...props,
|
|
797
1072
|
classNames: [
|
|
798
1073
|
"bg-transparent density-coarse",
|
|
@@ -807,11 +1082,11 @@ var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props
|
|
|
807
1082
|
var CardToolbarIconButton = Toolbar.IconButton;
|
|
808
1083
|
var CardToolbarSeparator = Toolbar.Separator;
|
|
809
1084
|
var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef) => {
|
|
810
|
-
var _effect =
|
|
1085
|
+
var _effect = _useSignals10();
|
|
811
1086
|
try {
|
|
812
1087
|
const { t } = useTranslation2(translationKey);
|
|
813
1088
|
const Root = toolbarItem ? Toolbar.IconButton : IconButton;
|
|
814
|
-
return /* @__PURE__ */
|
|
1089
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
815
1090
|
iconOnly: true,
|
|
816
1091
|
icon: "ph--dots-six-vertical--regular",
|
|
817
1092
|
variant: "ghost",
|
|
@@ -826,22 +1101,26 @@ var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef)
|
|
|
826
1101
|
var CardDragPreview = StackItem.DragPreview;
|
|
827
1102
|
var CardMenu = Primitive.div;
|
|
828
1103
|
var CardPoster = (props) => {
|
|
829
|
-
var _effect =
|
|
1104
|
+
var _effect = _useSignals10();
|
|
830
1105
|
try {
|
|
831
1106
|
const aspect = props.aspect === "auto" ? "aspect-auto" : "aspect-video";
|
|
832
1107
|
if (props.image) {
|
|
833
|
-
return /* @__PURE__ */
|
|
834
|
-
|
|
1108
|
+
return /* @__PURE__ */ React10.createElement(Image, {
|
|
1109
|
+
classNames: [
|
|
1110
|
+
`dx-card__poster is-full`,
|
|
1111
|
+
aspect,
|
|
1112
|
+
props.classNames
|
|
1113
|
+
],
|
|
835
1114
|
src: props.image,
|
|
836
1115
|
alt: props.alt
|
|
837
1116
|
});
|
|
838
1117
|
}
|
|
839
1118
|
if (props.icon) {
|
|
840
|
-
return /* @__PURE__ */
|
|
1119
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
841
1120
|
role: "image",
|
|
842
|
-
className: `dx-card__poster grid
|
|
1121
|
+
className: mx7(`dx-card__poster grid place-items-center bg-inputSurface text-subdued`, aspect, props.classNames),
|
|
843
1122
|
"aria-label": props.alt
|
|
844
|
-
}, /* @__PURE__ */
|
|
1123
|
+
}, /* @__PURE__ */ React10.createElement(Icon2, {
|
|
845
1124
|
icon: props.icon,
|
|
846
1125
|
size: 10
|
|
847
1126
|
}));
|
|
@@ -851,7 +1130,7 @@ var CardPoster = (props) => {
|
|
|
851
1130
|
}
|
|
852
1131
|
};
|
|
853
1132
|
var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
854
|
-
var _effect =
|
|
1133
|
+
var _effect = _useSignals10();
|
|
855
1134
|
try {
|
|
856
1135
|
const Root = asChild ? Slot3 : "div";
|
|
857
1136
|
const rootProps = asChild ? {
|
|
@@ -860,10 +1139,10 @@ var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, r
|
|
|
860
1139
|
classNames
|
|
861
1140
|
]
|
|
862
1141
|
} : {
|
|
863
|
-
className:
|
|
1142
|
+
className: mx7(cardChrome, classNames),
|
|
864
1143
|
role
|
|
865
1144
|
};
|
|
866
|
-
return /* @__PURE__ */
|
|
1145
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
867
1146
|
...props,
|
|
868
1147
|
...rootProps,
|
|
869
1148
|
ref: forwardedRef
|
|
@@ -873,19 +1152,19 @@ var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, r
|
|
|
873
1152
|
}
|
|
874
1153
|
});
|
|
875
1154
|
var CardText = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
876
|
-
var _effect =
|
|
1155
|
+
var _effect = _useSignals10();
|
|
877
1156
|
try {
|
|
878
|
-
const Root = asChild ? Slot3 : "
|
|
1157
|
+
const Root = asChild ? Slot3 : "div";
|
|
879
1158
|
const rootProps = asChild ? {
|
|
880
1159
|
classNames: [
|
|
881
1160
|
cardText,
|
|
882
1161
|
classNames
|
|
883
1162
|
]
|
|
884
1163
|
} : {
|
|
885
|
-
className:
|
|
1164
|
+
className: mx7(cardText, classNames),
|
|
886
1165
|
role
|
|
887
1166
|
};
|
|
888
|
-
return /* @__PURE__ */
|
|
1167
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
889
1168
|
...props,
|
|
890
1169
|
...rootProps,
|
|
891
1170
|
ref: forwardedRef
|
|
@@ -910,13 +1189,13 @@ var Card = {
|
|
|
910
1189
|
};
|
|
911
1190
|
|
|
912
1191
|
// src/exemplars/Card/CardDragPreview.tsx
|
|
913
|
-
import { useSignals as
|
|
914
|
-
import
|
|
915
|
-
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";
|
|
916
1195
|
var CardDragPreviewRoot = ({ children }) => {
|
|
917
|
-
var _effect =
|
|
1196
|
+
var _effect = _useSignals11();
|
|
918
1197
|
try {
|
|
919
|
-
return /* @__PURE__ */
|
|
1198
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
920
1199
|
className: "p-2"
|
|
921
1200
|
}, children);
|
|
922
1201
|
} finally {
|
|
@@ -924,10 +1203,10 @@ var CardDragPreviewRoot = ({ children }) => {
|
|
|
924
1203
|
}
|
|
925
1204
|
};
|
|
926
1205
|
var CardDragPreviewContent = ({ children }) => {
|
|
927
|
-
var _effect =
|
|
1206
|
+
var _effect = _useSignals11();
|
|
928
1207
|
try {
|
|
929
|
-
return /* @__PURE__ */
|
|
930
|
-
className:
|
|
1208
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1209
|
+
className: mx8(cardRoot, "ring-focusLine ring-neutralFocusIndicator")
|
|
931
1210
|
}, children);
|
|
932
1211
|
} finally {
|
|
933
1212
|
_effect.f();
|
|
@@ -939,51 +1218,25 @@ var CardDragPreview2 = {
|
|
|
939
1218
|
};
|
|
940
1219
|
|
|
941
1220
|
// src/exemplars/CardStack/CardStack.tsx
|
|
942
|
-
import { useSignals as
|
|
1221
|
+
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
943
1222
|
import { Slot as Slot4 } from "@radix-ui/react-slot";
|
|
944
|
-
import
|
|
945
|
-
import { mx as
|
|
946
|
-
var
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
return /* @__PURE__ */ React11.createElement(Stack, {
|
|
950
|
-
orientation: "vertical",
|
|
951
|
-
size: "contain",
|
|
952
|
-
rail: false,
|
|
953
|
-
classNames: (
|
|
954
|
-
/* NOTE(thure): Do not let this element have zero intrinsic size, otherwise the drop indicator will not display. See #9035. */
|
|
955
|
-
[
|
|
956
|
-
"plb-1",
|
|
957
|
-
itemsCount > 0 && "plb-2",
|
|
958
|
-
classNames
|
|
959
|
-
]
|
|
960
|
-
),
|
|
961
|
-
itemsCount,
|
|
962
|
-
separatorOnScroll: 9,
|
|
963
|
-
"data-density": "fine",
|
|
964
|
-
...props,
|
|
965
|
-
ref: forwardedRef
|
|
966
|
-
}, children);
|
|
967
|
-
} finally {
|
|
968
|
-
_effect.f();
|
|
969
|
-
}
|
|
970
|
-
});
|
|
971
|
-
var CardStackDragHandle = Card.DragHandle;
|
|
972
|
-
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
973
|
-
var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
974
|
-
var _effect = _useSignals11();
|
|
1223
|
+
import React12, { forwardRef as forwardRef7 } from "react";
|
|
1224
|
+
import { mx as mx9 } from "@dxos/react-ui-theme";
|
|
1225
|
+
var cardStackRoot = "flex flex-col";
|
|
1226
|
+
var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1227
|
+
var _effect = _useSignals12();
|
|
975
1228
|
try {
|
|
976
1229
|
const Root = asChild ? Slot4 : "div";
|
|
977
1230
|
const rootProps = asChild ? {
|
|
978
1231
|
classNames: [
|
|
979
|
-
|
|
1232
|
+
cardStackRoot,
|
|
980
1233
|
classNames
|
|
981
1234
|
]
|
|
982
1235
|
} : {
|
|
983
|
-
className:
|
|
1236
|
+
className: mx9(cardStackRoot, classNames),
|
|
984
1237
|
role
|
|
985
1238
|
};
|
|
986
|
-
return /* @__PURE__ */
|
|
1239
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
987
1240
|
...props,
|
|
988
1241
|
...rootProps,
|
|
989
1242
|
ref: forwardedRef
|
|
@@ -992,71 +1245,98 @@ var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
992
1245
|
_effect.f();
|
|
993
1246
|
}
|
|
994
1247
|
});
|
|
995
|
-
var
|
|
996
|
-
var
|
|
997
|
-
var _effect =
|
|
1248
|
+
var cardStackContent = "shrink min-bs-0 grid dx-focus-ring-group-x-indicator bg-baseSurface";
|
|
1249
|
+
var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", footer, ...props }, forwardedRef) => {
|
|
1250
|
+
var _effect = _useSignals12();
|
|
998
1251
|
try {
|
|
999
1252
|
const Root = asChild ? Slot4 : "div";
|
|
1253
|
+
const baseClassNames = footer ? [
|
|
1254
|
+
cardStackContent,
|
|
1255
|
+
railGridHorizontalContainFitContent
|
|
1256
|
+
] : [
|
|
1257
|
+
cardStackContent
|
|
1258
|
+
];
|
|
1000
1259
|
const rootProps = asChild ? {
|
|
1001
1260
|
classNames: [
|
|
1002
|
-
|
|
1261
|
+
...baseClassNames,
|
|
1003
1262
|
classNames
|
|
1004
1263
|
]
|
|
1005
1264
|
} : {
|
|
1006
|
-
className:
|
|
1265
|
+
className: mx9(...baseClassNames, classNames),
|
|
1007
1266
|
role
|
|
1008
1267
|
};
|
|
1009
|
-
return /* @__PURE__ */
|
|
1268
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1010
1269
|
...props,
|
|
1011
1270
|
...rootProps,
|
|
1271
|
+
"data-scroll-separator": "false",
|
|
1012
1272
|
ref: forwardedRef
|
|
1013
1273
|
}, children);
|
|
1014
1274
|
} finally {
|
|
1015
1275
|
_effect.f();
|
|
1016
1276
|
}
|
|
1017
1277
|
});
|
|
1018
|
-
var
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1278
|
+
var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
1279
|
+
var _effect = _useSignals12();
|
|
1280
|
+
try {
|
|
1281
|
+
return /* @__PURE__ */ React12.createElement(Stack, {
|
|
1282
|
+
orientation: "vertical",
|
|
1283
|
+
size: "contain",
|
|
1284
|
+
rail: false,
|
|
1285
|
+
classNames: (
|
|
1286
|
+
/* NOTE(thure): Do not let this element have zero intrinsic size, otherwise the drop indicator will not display. See #9035. */
|
|
1287
|
+
[
|
|
1288
|
+
"plb-2",
|
|
1289
|
+
classNames
|
|
1290
|
+
]
|
|
1291
|
+
),
|
|
1292
|
+
itemsCount,
|
|
1293
|
+
separatorOnScroll: 9,
|
|
1294
|
+
"data-density": "fine",
|
|
1295
|
+
...props,
|
|
1296
|
+
ref: forwardedRef
|
|
1297
|
+
}, children);
|
|
1298
|
+
} finally {
|
|
1299
|
+
_effect.f();
|
|
1300
|
+
}
|
|
1301
|
+
});
|
|
1302
|
+
var cardStackItem = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
1303
|
+
var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1304
|
+
var _effect = _useSignals12();
|
|
1024
1305
|
try {
|
|
1025
1306
|
const Root = asChild ? Slot4 : "div";
|
|
1026
1307
|
const rootProps = asChild ? {
|
|
1027
1308
|
classNames: [
|
|
1028
|
-
|
|
1309
|
+
cardStackItem,
|
|
1029
1310
|
classNames
|
|
1030
1311
|
]
|
|
1031
1312
|
} : {
|
|
1032
|
-
className:
|
|
1313
|
+
className: mx9(cardStackItem, classNames),
|
|
1033
1314
|
role
|
|
1034
1315
|
};
|
|
1035
|
-
return /* @__PURE__ */
|
|
1316
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1036
1317
|
...props,
|
|
1037
1318
|
...rootProps,
|
|
1038
|
-
"data-scroll-separator": "false",
|
|
1039
1319
|
ref: forwardedRef
|
|
1040
1320
|
}, children);
|
|
1041
1321
|
} finally {
|
|
1042
1322
|
_effect.f();
|
|
1043
1323
|
}
|
|
1044
1324
|
});
|
|
1045
|
-
var
|
|
1046
|
-
var
|
|
1047
|
-
var _effect =
|
|
1325
|
+
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
1326
|
+
var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
1327
|
+
var _effect = _useSignals12();
|
|
1048
1328
|
try {
|
|
1049
1329
|
const Root = asChild ? Slot4 : "div";
|
|
1050
1330
|
const rootProps = asChild ? {
|
|
1051
1331
|
classNames: [
|
|
1052
|
-
|
|
1332
|
+
cardStackHeading,
|
|
1053
1333
|
classNames
|
|
1054
1334
|
]
|
|
1055
1335
|
} : {
|
|
1056
|
-
className:
|
|
1336
|
+
className: mx9(cardStackHeading, 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
|
|
@@ -1065,21 +1345,21 @@ var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1065
1345
|
_effect.f();
|
|
1066
1346
|
}
|
|
1067
1347
|
});
|
|
1068
|
-
var
|
|
1069
|
-
var
|
|
1070
|
-
var _effect =
|
|
1348
|
+
var cardStackFooter = 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
1349
|
+
var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1350
|
+
var _effect = _useSignals12();
|
|
1071
1351
|
try {
|
|
1072
1352
|
const Root = asChild ? Slot4 : "div";
|
|
1073
1353
|
const rootProps = asChild ? {
|
|
1074
1354
|
classNames: [
|
|
1075
|
-
|
|
1355
|
+
cardStackFooter,
|
|
1076
1356
|
classNames
|
|
1077
1357
|
]
|
|
1078
1358
|
} : {
|
|
1079
|
-
className:
|
|
1359
|
+
className: mx9(cardStackFooter, 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
|
|
@@ -1088,6 +1368,7 @@ var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1088
1368
|
_effect.f();
|
|
1089
1369
|
}
|
|
1090
1370
|
});
|
|
1371
|
+
var CardStackDragHandle = Card.DragHandle;
|
|
1091
1372
|
var CardStack = {
|
|
1092
1373
|
Root: CardStackRoot,
|
|
1093
1374
|
Content: CardStackContent,
|
|
@@ -1099,16 +1380,16 @@ var CardStack = {
|
|
|
1099
1380
|
};
|
|
1100
1381
|
|
|
1101
1382
|
// src/exemplars/CardStack/CardStackDragPreview.tsx
|
|
1102
|
-
import { useSignals as
|
|
1103
|
-
import
|
|
1383
|
+
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1384
|
+
import React13 from "react";
|
|
1104
1385
|
import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
1105
|
-
import { mx as
|
|
1386
|
+
import { mx as mx10 } from "@dxos/react-ui-theme";
|
|
1106
1387
|
var CardStackDragPreviewRoot = ({ children }) => {
|
|
1107
|
-
var _effect =
|
|
1388
|
+
var _effect = _useSignals13();
|
|
1108
1389
|
try {
|
|
1109
|
-
return /* @__PURE__ */
|
|
1390
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1110
1391
|
className: "p-2"
|
|
1111
|
-
}, /* @__PURE__ */
|
|
1392
|
+
}, /* @__PURE__ */ React13.createElement("div", {
|
|
1112
1393
|
className: "rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col"
|
|
1113
1394
|
}, children));
|
|
1114
1395
|
} finally {
|
|
@@ -1116,12 +1397,12 @@ var CardStackDragPreviewRoot = ({ children }) => {
|
|
|
1116
1397
|
}
|
|
1117
1398
|
};
|
|
1118
1399
|
var CardStackDragPreviewHeading = ({ children }) => {
|
|
1119
|
-
var _effect =
|
|
1400
|
+
var _effect = _useSignals13();
|
|
1120
1401
|
try {
|
|
1121
1402
|
const { t } = useTranslation3(translationKey);
|
|
1122
|
-
return /* @__PURE__ */
|
|
1403
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1123
1404
|
className: "flex items-center p-2"
|
|
1124
|
-
}, /* @__PURE__ */
|
|
1405
|
+
}, /* @__PURE__ */ React13.createElement(IconButton2, {
|
|
1125
1406
|
iconOnly: true,
|
|
1126
1407
|
icon: "ph--dots-six-vertical--regular",
|
|
1127
1408
|
variant: "ghost",
|
|
@@ -1133,19 +1414,19 @@ var CardStackDragPreviewHeading = ({ children }) => {
|
|
|
1133
1414
|
}
|
|
1134
1415
|
};
|
|
1135
1416
|
var CardStackDragPreviewContent = ({ children, itemsCount = 0 }) => {
|
|
1136
|
-
var _effect =
|
|
1417
|
+
var _effect = _useSignals13();
|
|
1137
1418
|
try {
|
|
1138
|
-
return /* @__PURE__ */
|
|
1139
|
-
className:
|
|
1419
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1420
|
+
className: mx10("overflow-y-auto flex-1 pli-2 flex flex-col gap-2", "plb-1", itemsCount > 0 ? "plb-2" : "plb-1")
|
|
1140
1421
|
}, children);
|
|
1141
1422
|
} finally {
|
|
1142
1423
|
_effect.f();
|
|
1143
1424
|
}
|
|
1144
1425
|
};
|
|
1145
1426
|
var CardStackDragPreviewFooter = ({ children }) => {
|
|
1146
|
-
var _effect =
|
|
1427
|
+
var _effect = _useSignals13();
|
|
1147
1428
|
try {
|
|
1148
|
-
return /* @__PURE__ */
|
|
1429
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1149
1430
|
className: "p-2 border-t border-separator"
|
|
1150
1431
|
}, children);
|
|
1151
1432
|
} finally {
|
|
@@ -1160,6 +1441,7 @@ var CardStackDragPreview = {
|
|
|
1160
1441
|
};
|
|
1161
1442
|
|
|
1162
1443
|
export {
|
|
1444
|
+
Image,
|
|
1163
1445
|
StackContext,
|
|
1164
1446
|
railGridHorizontal,
|
|
1165
1447
|
railGridVertical,
|
|
@@ -1176,6 +1458,7 @@ export {
|
|
|
1176
1458
|
StackItem,
|
|
1177
1459
|
cardRoot,
|
|
1178
1460
|
cardSpacing,
|
|
1461
|
+
cardNoSpacing,
|
|
1179
1462
|
labelSpacing,
|
|
1180
1463
|
cardDialogContent,
|
|
1181
1464
|
cardDialogHeader,
|
|
@@ -1185,14 +1468,16 @@ export {
|
|
|
1185
1468
|
cardText,
|
|
1186
1469
|
cardHeading,
|
|
1187
1470
|
cardChrome,
|
|
1471
|
+
cardDefaultInlineSize,
|
|
1472
|
+
cardStackDefaultInlineSizeRem,
|
|
1188
1473
|
Card,
|
|
1189
1474
|
CardDragPreview2 as CardDragPreview,
|
|
1190
|
-
cardStackHeading,
|
|
1191
|
-
cardStackFooter,
|
|
1192
|
-
cardStackContent,
|
|
1193
1475
|
cardStackRoot,
|
|
1476
|
+
cardStackContent,
|
|
1194
1477
|
cardStackItem,
|
|
1478
|
+
cardStackHeading,
|
|
1479
|
+
cardStackFooter,
|
|
1195
1480
|
CardStack,
|
|
1196
1481
|
CardStackDragPreview
|
|
1197
1482
|
};
|
|
1198
|
-
//# sourceMappingURL=chunk-
|
|
1483
|
+
//# sourceMappingURL=chunk-6YJ6CHWV.mjs.map
|