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