@dxos/react-ui-stack 0.8.4-main.84f28bd → 0.8.4-main.937b3ca
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/index.mjs +753 -1001
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{testing → playwright}/index.mjs +5 -1
- package/dist/lib/browser/{testing → playwright}/index.mjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +753 -1001
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{testing → playwright}/index.mjs +5 -1
- package/dist/lib/node-esm/{testing → playwright}/index.mjs.map +3 -3
- package/dist/types/src/{exemplars → components}/CardStack/CardStack.d.ts +20 -13
- package/dist/types/src/components/CardStack/CardStack.d.ts.map +1 -0
- package/dist/types/src/components/CardStack/CardStack.stories.d.ts +15 -0
- package/dist/types/src/components/CardStack/CardStack.stories.d.ts.map +1 -0
- package/dist/types/src/{exemplars → components}/CardStack/CardStackDragPreview.d.ts +1 -1
- package/dist/types/src/components/CardStack/CardStackDragPreview.d.ts.map +1 -0
- package/dist/types/src/components/CardStack/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 +9 -12
- 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 +4 -37
- 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 +2 -2
- package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/LayoutControls.d.ts +3 -0
- package/dist/types/src/components/deprecated/LayoutControls.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/{defs.d.ts → types.d.ts} +1 -1
- package/dist/types/src/components/types.d.ts.map +1 -0
- package/dist/types/src/hooks/useStackDropForElements.d.ts +9 -7
- package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playwright/index.d.ts.map +1 -0
- package/dist/types/src/playwright/stack-manager.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -39
- package/src/{exemplars → components}/CardStack/CardStack.stories.tsx +19 -18
- package/src/{exemplars → components}/CardStack/CardStack.tsx +114 -54
- package/src/{exemplars → components}/CardStack/CardStackDragPreview.tsx +3 -3
- package/src/components/Stack/Stack.stories.tsx +8 -9
- package/src/components/Stack/Stack.tsx +225 -26
- package/src/components/StackContext.tsx +2 -1
- package/src/components/StackItem/StackItem.stories.tsx +19 -15
- package/src/components/StackItem/StackItem.tsx +49 -29
- package/src/components/StackItem/StackItemContent.tsx +19 -40
- package/src/components/StackItem/StackItemHeading.tsx +5 -9
- package/src/components/StackItem/StackItemResizeHandle.tsx +2 -1
- package/src/components/StackItem/StackItemSigil.tsx +5 -4
- package/src/components/deprecated/LayoutControls.tsx +3 -0
- package/src/components/index.ts +2 -1
- package/src/hooks/useStackDropForElements.ts +59 -45
- package/src/index.ts +0 -3
- package/src/{testing → playwright}/index.ts +1 -1
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/smoke.spec.ts +1 -1
- package/src/translations.ts +1 -1
- package/dist/types/src/components/defs.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/Card.d.ts +0 -57
- package/dist/types/src/exemplars/Card/Card.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/Card.stories.d.ts +0 -13
- package/dist/types/src/exemplars/Card/Card.stories.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/CardDragPreview.d.ts +0 -6
- package/dist/types/src/exemplars/Card/CardDragPreview.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/fragments.d.ts +0 -12
- package/dist/types/src/exemplars/Card/fragments.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/index.d.ts +0 -4
- package/dist/types/src/exemplars/Card/index.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts +0 -9
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/CardStackDragPreview.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/index.d.ts.map +0 -1
- package/dist/types/src/exemplars/index.d.ts +0 -3
- package/dist/types/src/exemplars/index.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/stack-manager.d.ts.map +0 -1
- package/src/exemplars/Card/Card.stories.tsx +0 -78
- package/src/exemplars/Card/Card.tsx +0 -167
- package/src/exemplars/Card/CardDragPreview.tsx +0 -22
- package/src/exemplars/Card/fragments.ts +0 -23
- package/src/exemplars/Card/index.ts +0 -7
- package/src/exemplars/index.ts +0 -6
- /package/dist/types/src/{exemplars → components}/CardStack/index.d.ts +0 -0
- /package/dist/types/src/{testing → playwright}/index.d.ts +0 -0
- /package/dist/types/src/{testing → playwright}/stack-manager.d.ts +0 -0
- /package/src/{exemplars → components}/CardStack/index.ts +0 -0
- /package/src/components/{defs.ts → types.ts} +0 -0
- /package/src/{testing → playwright}/stack-manager.ts +0 -0
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
+
// src/components/CardStack/CardStack.tsx
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import React2, { forwardRef as forwardRef2 } from "react";
|
|
6
|
+
import { Card } from "@dxos/react-ui-mosaic";
|
|
7
|
+
import { cardDefaultInlineSize, mx as mx2 } from "@dxos/ui-theme";
|
|
8
|
+
|
|
3
9
|
// src/components/Stack/Stack.tsx
|
|
4
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
5
|
-
import { useArrowNavigationGroup } from "@fluentui/react-tabster";
|
|
6
10
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
7
|
-
import React, { Children, forwardRef,
|
|
8
|
-
import { ListItem } from "@dxos/react-ui";
|
|
9
|
-
import { mx } from "@dxos/
|
|
11
|
+
import React, { Children, forwardRef, useCallback, useEffect, useMemo, useState as useState2 } from "react";
|
|
12
|
+
import { ListItem, useId } from "@dxos/react-ui";
|
|
13
|
+
import { mx } from "@dxos/ui-theme";
|
|
10
14
|
|
|
11
15
|
// src/hooks/useStackDropForElements.ts
|
|
12
16
|
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
@@ -14,14 +18,16 @@ import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element
|
|
|
14
18
|
import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
|
15
19
|
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
16
20
|
import { useLayoutEffect, useState } from "react";
|
|
17
|
-
var
|
|
21
|
+
var noop = () => {
|
|
22
|
+
};
|
|
23
|
+
var useStackDropForElements = ({ id, element, scrollElement = element, orientation, selfDroppable, onRearrange }) => {
|
|
18
24
|
const [dropping, setDropping] = useState(false);
|
|
19
25
|
useLayoutEffect(() => {
|
|
20
|
-
if (!element
|
|
26
|
+
if (!element) {
|
|
21
27
|
return;
|
|
22
28
|
}
|
|
23
29
|
const acceptSourceType = orientation === "horizontal" ? "column" : "card";
|
|
24
|
-
return combine(dropTargetForElements({
|
|
30
|
+
return combine(selfDroppable ? dropTargetForElements({
|
|
25
31
|
element,
|
|
26
32
|
getData: ({ input, element: element2 }) => {
|
|
27
33
|
return attachClosestEdge({
|
|
@@ -54,16 +60,16 @@ var useStackDropForElements = ({ id, element, scrollElement = element, selfDropp
|
|
|
54
60
|
onRearrange(source.data, self.data, extractClosestEdge(self.data));
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
|
-
}), autoScrollForElements({
|
|
63
|
+
}) : noop, scrollElement ? autoScrollForElements({
|
|
58
64
|
element: scrollElement,
|
|
59
65
|
getAllowedAxis: () => orientation
|
|
60
|
-
}));
|
|
66
|
+
}) : noop);
|
|
61
67
|
}, [
|
|
68
|
+
id,
|
|
62
69
|
element,
|
|
63
70
|
scrollElement,
|
|
64
71
|
selfDroppable,
|
|
65
72
|
orientation,
|
|
66
|
-
id,
|
|
67
73
|
onRearrange
|
|
68
74
|
]);
|
|
69
75
|
return {
|
|
@@ -102,583 +108,801 @@ var railGridVerticalContainFitContent = "grid-cols-[[rail-start]_var(--rail-size
|
|
|
102
108
|
var autoScrollRootAttributes = {
|
|
103
109
|
"data-drag-autoscroll": "idle"
|
|
104
110
|
};
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
111
|
+
var PERPENDICULAR_FOCUS_THRESHHOLD = 128;
|
|
112
|
+
var scrollIntoViewAndFocus = (el, orientation) => {
|
|
113
|
+
el.scrollIntoView({
|
|
114
|
+
behavior: "instant",
|
|
115
|
+
[orientation === "vertical" ? "block" : "inline"]: "center"
|
|
116
|
+
});
|
|
117
|
+
return el.focus();
|
|
118
|
+
};
|
|
119
|
+
var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientation = "vertical", rail = true, size = "intrinsic", onRearrange, itemsCount = Children.count(children), getDropElement, separatorOnScroll, circularFocus, ...props }, forwardedRef) => {
|
|
120
|
+
const stackId = useId("stack", props.id);
|
|
121
|
+
const [stackElement, stackRef] = useState2(null);
|
|
122
|
+
const [lastFocusedItem, setLastFocusedItem] = useState2();
|
|
123
|
+
const composedItemRef = composeRefs(stackRef, forwardedRef);
|
|
124
|
+
const styles = {
|
|
125
|
+
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: size === "split" ? `repeat(${itemsCount}, 1fr)` : `repeat(${itemsCount}, min-content) [tabster-dummies] 0`,
|
|
126
|
+
...style
|
|
127
|
+
};
|
|
128
|
+
const selfDroppable = !!(itemsCount < 1 && onRearrange && props.id);
|
|
129
|
+
const { dropping } = useStackDropForElements({
|
|
130
|
+
id: props.id,
|
|
131
|
+
element: getDropElement && stackElement ? getDropElement(stackElement) : stackElement,
|
|
132
|
+
scrollElement: stackElement,
|
|
133
|
+
selfDroppable,
|
|
134
|
+
orientation,
|
|
135
|
+
onRearrange
|
|
136
|
+
});
|
|
137
|
+
const handleScroll = useCallback(() => {
|
|
138
|
+
if (stackElement && Number.isFinite(separatorOnScroll)) {
|
|
139
|
+
const scrollPosition = orientation === "horizontal" ? stackElement.scrollLeft : stackElement.scrollTop;
|
|
140
|
+
const scrollSize = orientation === "horizontal" ? stackElement.scrollWidth : stackElement.scrollHeight;
|
|
141
|
+
const clientSize = orientation === "horizontal" ? stackElement.clientWidth : stackElement.clientHeight;
|
|
142
|
+
const separatorHost = stackElement.closest("[data-scroll-separator]");
|
|
143
|
+
if (separatorHost) {
|
|
144
|
+
separatorHost.setAttribute("data-scroll-separator", String(scrollPosition > separatorOnScroll));
|
|
145
|
+
separatorHost.setAttribute("data-scroll-separator-end", String(scrollSize - (scrollPosition + clientSize) > separatorOnScroll));
|
|
136
146
|
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
147
|
+
}
|
|
148
|
+
}, [
|
|
149
|
+
stackElement,
|
|
150
|
+
separatorOnScroll,
|
|
151
|
+
orientation
|
|
152
|
+
]);
|
|
153
|
+
const handleBlur = useCallback((event) => {
|
|
154
|
+
if (event.target) {
|
|
155
|
+
const target = event.target;
|
|
156
|
+
const closestStackItem = target.closest(`[data-dx-item-id]`);
|
|
157
|
+
if (closestStackItem?.closest(`[data-dx-stack="${stackId}"]`)) {
|
|
158
|
+
setLastFocusedItem(closestStackItem?.getAttribute("data-dx-item-id") ?? void 0);
|
|
145
159
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
160
|
+
}
|
|
161
|
+
props.onBlur?.(event);
|
|
162
|
+
}, [
|
|
163
|
+
stackId,
|
|
164
|
+
props.onBlur
|
|
165
|
+
]);
|
|
166
|
+
const handleKeyDown = useCallback((event) => {
|
|
167
|
+
const target = event.target;
|
|
168
|
+
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)}"]`)) {
|
|
169
|
+
const closestOwnedItem = target.closest(`[data-dx-stack-item="${stackId}"]`);
|
|
170
|
+
const closestStack = target.closest("[data-dx-stack]");
|
|
171
|
+
const closestStackItems = Array.from(closestStack?.querySelectorAll(`[data-dx-stack-item="${stackId}"]`) ?? []);
|
|
172
|
+
const closestStackOrientation = closestStack?.getAttribute("aria-orientation");
|
|
173
|
+
const ancestorStack = closestStack?.parentElement?.closest("[data-dx-stack]");
|
|
174
|
+
if (closestOwnedItem && closestStack) {
|
|
175
|
+
const ancestorOrientation = ancestorStack?.getAttribute("aria-orientation");
|
|
176
|
+
const parallelDelta = (closestStackOrientation === "vertical" ? event.key === "ArrowUp" : event.key === "ArrowLeft") ? -1 : (closestStackOrientation === "vertical" ? event.key === "ArrowDown" : event.key === "ArrowRight") ? 1 : 0;
|
|
177
|
+
const perpendicularDelta = (closestStackOrientation === "vertical" ? event.key === "ArrowLeft" : event.key === "ArrowUp") ? -1 : (closestStackOrientation === "vertical" ? event.key === "ArrowRight" : event.key === "ArrowDown") ? 1 : 0;
|
|
178
|
+
if (parallelDelta !== 0) {
|
|
179
|
+
const currentIndex = closestStackItems.indexOf(closestOwnedItem);
|
|
180
|
+
const nextIndex = currentIndex + parallelDelta;
|
|
181
|
+
let adjacentItem;
|
|
182
|
+
if (circularFocus) {
|
|
183
|
+
adjacentItem = closestStackItems[(nextIndex + closestStackItems.length) % closestStackItems.length];
|
|
184
|
+
} else {
|
|
185
|
+
if (nextIndex >= 0 && nextIndex < closestStackItems.length) {
|
|
186
|
+
adjacentItem = closestStackItems[nextIndex];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (adjacentItem) {
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
scrollIntoViewAndFocus(adjacentItem, closestStackOrientation);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (perpendicularDelta !== 0) {
|
|
195
|
+
if (ancestorStack && ancestorOrientation !== closestStackOrientation) {
|
|
196
|
+
const siblingStacks = Array.from(ancestorStack.querySelectorAll(`[data-dx-stack-item="${ancestorStack.getAttribute("data-dx-stack")}"] [data-dx-stack]`));
|
|
197
|
+
const currentStackIndex = siblingStacks.indexOf(closestStack);
|
|
198
|
+
const nextStackIndex = currentStackIndex + perpendicularDelta;
|
|
199
|
+
let adjacentStack;
|
|
200
|
+
if (ancestorStack.getAttribute("data-dx-stack-circular-focus") === "true") {
|
|
201
|
+
adjacentStack = siblingStacks[(nextStackIndex + siblingStacks.length) % siblingStacks.length];
|
|
202
|
+
} else {
|
|
203
|
+
if (nextStackIndex >= 0 && nextStackIndex < siblingStacks.length) {
|
|
204
|
+
adjacentStack = siblingStacks[nextStackIndex];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const adjacentStackSelfItem = adjacentStack?.closest(`[data-dx-stack-item=${ancestorStack.getAttribute("data-dx-stack")}]`);
|
|
208
|
+
const adjacentStackItems = adjacentStack ? Array.from(adjacentStack.querySelectorAll(`[data-dx-stack-item="${adjacentStack.getAttribute("data-dx-stack")}"]`)) : [];
|
|
209
|
+
if (adjacentStack && adjacentStackItems.length > 0) {
|
|
210
|
+
let closestItem = adjacentStackItems[0];
|
|
211
|
+
const lastFocusedItem2 = adjacentStack.querySelector(`[data-dx-item-id="${adjacentStack.getAttribute("data-dx-last-focused-item") ?? "never"}"]`);
|
|
212
|
+
if (lastFocusedItem2) {
|
|
213
|
+
closestItem = lastFocusedItem2;
|
|
214
|
+
} else {
|
|
215
|
+
const ownedItemRect = closestOwnedItem.getBoundingClientRect();
|
|
216
|
+
const targetPosition = closestStackOrientation === "vertical" ? ownedItemRect.top : ownedItemRect.left;
|
|
217
|
+
let closestDistance = Infinity;
|
|
218
|
+
for (const item of adjacentStackItems) {
|
|
219
|
+
const itemRect = item.getBoundingClientRect();
|
|
220
|
+
const itemPosition = closestStackOrientation === "vertical" ? itemRect.top : itemRect.left;
|
|
221
|
+
const distance = Math.abs(itemPosition - targetPosition);
|
|
222
|
+
if (distance < closestDistance) {
|
|
223
|
+
closestDistance = distance;
|
|
224
|
+
closestItem = item;
|
|
225
|
+
}
|
|
226
|
+
if (closestDistance <= PERPENDICULAR_FOCUS_THRESHHOLD) {
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
scrollIntoViewAndFocus(closestItem, closestStackOrientation);
|
|
233
|
+
} else if (adjacentStackSelfItem) {
|
|
234
|
+
event.preventDefault();
|
|
235
|
+
scrollIntoViewAndFocus(adjacentStackSelfItem, ancestorOrientation);
|
|
236
|
+
}
|
|
237
|
+
} else if (closestOwnedItem) {
|
|
238
|
+
const closestOwnedItemStack = closestOwnedItem.querySelector("[data-dx-stack]");
|
|
239
|
+
const closestOwnedItemStackItems = closestOwnedItemStack ? Array.from(closestOwnedItemStack.querySelectorAll(`[data-dx-stack-item="${closestOwnedItemStack.getAttribute("data-dx-stack")}"]`)) : [];
|
|
240
|
+
if (closestOwnedItemStackItems.length > 0) {
|
|
241
|
+
event.preventDefault();
|
|
242
|
+
scrollIntoViewAndFocus(closestOwnedItemStackItems[[
|
|
243
|
+
"ArrowUp",
|
|
244
|
+
"ArrowLeft"
|
|
245
|
+
].includes(event.key) ? closestOwnedItemStackItems.length - 1 : 0], closestOwnedItemStack?.getAttribute("aria-orientation"));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
150
249
|
}
|
|
151
|
-
}
|
|
152
|
-
|
|
250
|
+
}
|
|
251
|
+
props.onKeyDown?.(event);
|
|
252
|
+
}, [
|
|
253
|
+
props.onKeyDown,
|
|
254
|
+
stackId,
|
|
255
|
+
circularFocus
|
|
256
|
+
]);
|
|
257
|
+
const gridClasses = useMemo(() => {
|
|
258
|
+
if (!rail) {
|
|
259
|
+
return orientation === "horizontal" ? "grid-rows-1 pli-[--stack-gap]" : "grid-cols-1 plb-[--stack-gap]";
|
|
260
|
+
}
|
|
261
|
+
if (orientation === "horizontal") {
|
|
262
|
+
return railGridHorizontal;
|
|
263
|
+
} else {
|
|
264
|
+
return railGridVertical;
|
|
265
|
+
}
|
|
266
|
+
}, [
|
|
267
|
+
rail,
|
|
268
|
+
orientation,
|
|
269
|
+
size
|
|
270
|
+
]);
|
|
271
|
+
useEffect(() => {
|
|
272
|
+
if (!(stackElement && Number.isFinite(separatorOnScroll))) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const observer = new MutationObserver(() => {
|
|
276
|
+
handleScroll();
|
|
277
|
+
});
|
|
278
|
+
observer.observe(stackElement, {
|
|
279
|
+
childList: true,
|
|
280
|
+
subtree: true
|
|
281
|
+
});
|
|
282
|
+
return () => {
|
|
283
|
+
observer.disconnect();
|
|
284
|
+
};
|
|
285
|
+
}, [
|
|
286
|
+
stackElement,
|
|
287
|
+
handleScroll
|
|
288
|
+
]);
|
|
289
|
+
return /* @__PURE__ */ React.createElement(StackContext.Provider, {
|
|
290
|
+
value: {
|
|
153
291
|
orientation,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
handleScroll
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
292
|
+
rail,
|
|
293
|
+
size,
|
|
294
|
+
onRearrange,
|
|
295
|
+
stackId
|
|
296
|
+
}
|
|
297
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
298
|
+
...props,
|
|
299
|
+
className: mx("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),
|
|
300
|
+
onKeyDown: handleKeyDown,
|
|
301
|
+
onBlur: handleBlur,
|
|
302
|
+
"data-dx-stack": stackId,
|
|
303
|
+
"data-dx-stack-circular-focus": circularFocus,
|
|
304
|
+
"data-dx-last-focused-item": lastFocusedItem,
|
|
305
|
+
"data-rail": rail,
|
|
306
|
+
"aria-orientation": orientation,
|
|
307
|
+
style: styles,
|
|
308
|
+
ref: composedItemRef,
|
|
309
|
+
...Number.isFinite(separatorOnScroll) && {
|
|
310
|
+
onScroll: handleScroll
|
|
311
|
+
}
|
|
312
|
+
}, children, selfDroppable && dropping && /* @__PURE__ */ React.createElement(ListItem.DropIndicator, {
|
|
313
|
+
lineInset: 8,
|
|
314
|
+
terminalInset: -8,
|
|
315
|
+
gap: -8,
|
|
316
|
+
edge: orientation === "horizontal" ? "left" : "top"
|
|
317
|
+
})));
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// src/components/CardStack/CardStack.tsx
|
|
321
|
+
var cardStackDefaultInlineSizeRem = cardDefaultInlineSize + 2.125;
|
|
322
|
+
var cardStackRoot = "flex flex-col";
|
|
323
|
+
var CardStackRoot = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
324
|
+
const Root = asChild ? Slot : "div";
|
|
325
|
+
const rootProps = asChild ? {
|
|
326
|
+
classNames: [
|
|
327
|
+
cardStackRoot,
|
|
328
|
+
classNames
|
|
329
|
+
]
|
|
330
|
+
} : {
|
|
331
|
+
className: mx2(cardStackRoot, classNames),
|
|
332
|
+
role
|
|
333
|
+
};
|
|
334
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
335
|
+
...props,
|
|
336
|
+
...rootProps,
|
|
337
|
+
ref: forwardedRef
|
|
338
|
+
}, children);
|
|
339
|
+
});
|
|
340
|
+
var cardStackContent = "shrink min-bs-0 grid dx-focus-ring-group-x-indicator bg-baseSurface";
|
|
341
|
+
var CardStackContent = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", footer, ...props }, forwardedRef) => {
|
|
342
|
+
const Root = asChild ? Slot : "div";
|
|
343
|
+
const baseClassNames = footer ? [
|
|
344
|
+
cardStackContent,
|
|
345
|
+
railGridHorizontalContainFitContent
|
|
346
|
+
] : [
|
|
347
|
+
cardStackContent
|
|
348
|
+
];
|
|
349
|
+
const rootProps = asChild ? {
|
|
350
|
+
classNames: [
|
|
351
|
+
...baseClassNames,
|
|
352
|
+
classNames
|
|
353
|
+
]
|
|
354
|
+
} : {
|
|
355
|
+
className: mx2(...baseClassNames, classNames),
|
|
356
|
+
role
|
|
357
|
+
};
|
|
358
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
359
|
+
...props,
|
|
360
|
+
...rootProps,
|
|
361
|
+
"data-scroll-separator": "false",
|
|
362
|
+
ref: forwardedRef
|
|
363
|
+
}, children);
|
|
364
|
+
});
|
|
365
|
+
var CardStackStack = /* @__PURE__ */ forwardRef2(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
366
|
+
return /* @__PURE__ */ React2.createElement(Stack, {
|
|
367
|
+
orientation: "vertical",
|
|
368
|
+
size: "contain",
|
|
369
|
+
rail: false,
|
|
370
|
+
classNames: (
|
|
371
|
+
/* NOTE(thure): Do not let this element have zero intrinsic size, otherwise the drop indicator will not display. See #9035. */
|
|
372
|
+
[
|
|
373
|
+
"plb-2",
|
|
374
|
+
classNames
|
|
375
|
+
]
|
|
376
|
+
),
|
|
377
|
+
itemsCount,
|
|
378
|
+
separatorOnScroll: 9,
|
|
379
|
+
"data-density": "fine",
|
|
380
|
+
...props,
|
|
381
|
+
ref: forwardedRef
|
|
382
|
+
}, children);
|
|
383
|
+
});
|
|
384
|
+
var cardStackItem = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
385
|
+
var CardStackItem = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
386
|
+
const Root = asChild ? Slot : "div";
|
|
387
|
+
const rootProps = asChild ? {
|
|
388
|
+
classNames: [
|
|
389
|
+
cardStackItem,
|
|
390
|
+
classNames
|
|
391
|
+
]
|
|
392
|
+
} : {
|
|
393
|
+
className: mx2(cardStackItem, classNames),
|
|
394
|
+
role
|
|
395
|
+
};
|
|
396
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
397
|
+
...props,
|
|
398
|
+
...rootProps,
|
|
399
|
+
ref: forwardedRef
|
|
400
|
+
}, children);
|
|
401
|
+
});
|
|
402
|
+
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
403
|
+
var CardStackHeading = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
404
|
+
const Root = asChild ? Slot : "div";
|
|
405
|
+
const rootProps = asChild ? {
|
|
406
|
+
classNames: [
|
|
407
|
+
cardStackHeading,
|
|
408
|
+
classNames
|
|
409
|
+
]
|
|
410
|
+
} : {
|
|
411
|
+
className: mx2(cardStackHeading, classNames),
|
|
412
|
+
role
|
|
413
|
+
};
|
|
414
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
415
|
+
...props,
|
|
416
|
+
...rootProps,
|
|
417
|
+
ref: forwardedRef
|
|
418
|
+
}, children);
|
|
419
|
+
});
|
|
420
|
+
var cardStackFooter = 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
421
|
+
var CardStackFooter = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
422
|
+
const Root = asChild ? Slot : "div";
|
|
423
|
+
const rootProps = asChild ? {
|
|
424
|
+
classNames: [
|
|
425
|
+
cardStackFooter,
|
|
426
|
+
classNames
|
|
427
|
+
]
|
|
428
|
+
} : {
|
|
429
|
+
className: mx2(cardStackFooter, classNames),
|
|
430
|
+
role
|
|
431
|
+
};
|
|
432
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
433
|
+
...props,
|
|
434
|
+
...rootProps,
|
|
435
|
+
ref: forwardedRef
|
|
436
|
+
}, children);
|
|
437
|
+
});
|
|
438
|
+
var CardStackDragHandle = Card.DragHandle;
|
|
439
|
+
var CardStack = {
|
|
440
|
+
Root: CardStackRoot,
|
|
441
|
+
Content: CardStackContent,
|
|
442
|
+
Stack: CardStackStack,
|
|
443
|
+
Heading: CardStackHeading,
|
|
444
|
+
Footer: CardStackFooter,
|
|
445
|
+
DragHandle: CardStackDragHandle,
|
|
446
|
+
Item: CardStackItem
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
// src/components/CardStack/CardStackDragPreview.tsx
|
|
450
|
+
import React3 from "react";
|
|
451
|
+
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
452
|
+
import { mx as mx3 } from "@dxos/ui-theme";
|
|
453
|
+
|
|
454
|
+
// src/translations.ts
|
|
455
|
+
var translationKey = "@dxos/react-ui-stack";
|
|
456
|
+
var translations = [
|
|
457
|
+
{
|
|
458
|
+
"en-US": {
|
|
459
|
+
[translationKey]: {
|
|
460
|
+
"resize label": "Drag to resize",
|
|
461
|
+
"drag handle label": "Drag to rearrange",
|
|
462
|
+
"pin start label": "Pin to the left sidebar",
|
|
463
|
+
"pin end label": "Pin to the right sidebar",
|
|
464
|
+
"increment start label": "Move to the left",
|
|
465
|
+
"increment end label": "Move to the right",
|
|
466
|
+
"close label": "Close",
|
|
467
|
+
"minify label": "Minify"
|
|
191
468
|
}
|
|
192
|
-
}
|
|
193
|
-
lineInset: 8,
|
|
194
|
-
terminalInset: -8,
|
|
195
|
-
gap: -8,
|
|
196
|
-
edge: orientation === "horizontal" ? "left" : "top"
|
|
197
|
-
})));
|
|
198
|
-
} finally {
|
|
199
|
-
_effect.f();
|
|
469
|
+
}
|
|
200
470
|
}
|
|
201
|
-
|
|
471
|
+
];
|
|
472
|
+
|
|
473
|
+
// src/components/CardStack/CardStackDragPreview.tsx
|
|
474
|
+
var CardStackDragPreviewRoot = ({ children }) => {
|
|
475
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
476
|
+
className: "p-2"
|
|
477
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
478
|
+
className: "rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col"
|
|
479
|
+
}, children));
|
|
480
|
+
};
|
|
481
|
+
var CardStackDragPreviewHeading = ({ children }) => {
|
|
482
|
+
const { t } = useTranslation(translationKey);
|
|
483
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
484
|
+
className: "flex items-center p-2"
|
|
485
|
+
}, /* @__PURE__ */ React3.createElement(IconButton, {
|
|
486
|
+
iconOnly: true,
|
|
487
|
+
icon: "ph--dots-six-vertical--regular",
|
|
488
|
+
variant: "ghost",
|
|
489
|
+
label: t("column drag handle label"),
|
|
490
|
+
classNames: "pli-2"
|
|
491
|
+
}), children);
|
|
492
|
+
};
|
|
493
|
+
var CardStackDragPreviewContent = ({ children, itemsCount = 0 }) => {
|
|
494
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
495
|
+
className: mx3("overflow-y-auto flex-1 pli-2 flex flex-col gap-2", "plb-1", itemsCount > 0 ? "plb-2" : "plb-1")
|
|
496
|
+
}, children);
|
|
497
|
+
};
|
|
498
|
+
var CardStackDragPreviewFooter = ({ children }) => {
|
|
499
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
500
|
+
className: "p-2 border-bs border-separator"
|
|
501
|
+
}, children);
|
|
502
|
+
};
|
|
503
|
+
var CardStackDragPreview = {
|
|
504
|
+
Root: CardStackDragPreviewRoot,
|
|
505
|
+
Heading: CardStackDragPreviewHeading,
|
|
506
|
+
Content: CardStackDragPreviewContent,
|
|
507
|
+
Footer: CardStackDragPreviewFooter
|
|
508
|
+
};
|
|
202
509
|
|
|
203
510
|
// src/components/StackItem/StackItem.tsx
|
|
204
|
-
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
205
511
|
import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
206
512
|
import { draggable, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
207
513
|
import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
|
|
208
514
|
import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
|
|
209
515
|
import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
210
|
-
import { useFocusableGroup
|
|
516
|
+
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
211
517
|
import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
|
|
212
|
-
import
|
|
518
|
+
import React10, { forwardRef as forwardRef6, useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useMemo as useMemo3, useState as useState4 } from "react";
|
|
213
519
|
import { createPortal } from "react-dom";
|
|
214
520
|
import { ListItem as ListItem2 } from "@dxos/react-ui";
|
|
215
521
|
import { resizeAttributes, sizeStyle } from "@dxos/react-ui-dnd";
|
|
216
|
-
import { mx as
|
|
522
|
+
import { mx as mx7 } from "@dxos/ui-theme";
|
|
217
523
|
|
|
218
524
|
// src/components/StackItem/StackItemContent.tsx
|
|
219
|
-
import {
|
|
220
|
-
import
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
style,
|
|
247
|
-
"data-popover-collision-boundary": true,
|
|
248
|
-
ref: forwardedRef
|
|
249
|
-
}, children);
|
|
250
|
-
} finally {
|
|
251
|
-
_effect.f();
|
|
252
|
-
}
|
|
525
|
+
import React4, { forwardRef as forwardRef3, useMemo as useMemo2 } from "react";
|
|
526
|
+
import { mx as mx4 } from "@dxos/ui-theme";
|
|
527
|
+
var StackItemContent = /* @__PURE__ */ forwardRef3(({ classNames, children, toolbar, statusbar, ...props }, forwardedRef) => {
|
|
528
|
+
const { size: stackItemSize } = useStack();
|
|
529
|
+
const { role } = useStackItem();
|
|
530
|
+
const style = useMemo2(() => ({
|
|
531
|
+
gridTemplateRows: [
|
|
532
|
+
...toolbar ? [
|
|
533
|
+
role === "section" ? "calc(var(--toolbar-size) - 1px)" : "var(--toolbar-size)"
|
|
534
|
+
] : [],
|
|
535
|
+
"1fr",
|
|
536
|
+
...statusbar ? [
|
|
537
|
+
"var(--statusbar-size)"
|
|
538
|
+
] : []
|
|
539
|
+
].join(" ")
|
|
540
|
+
}), [
|
|
541
|
+
toolbar,
|
|
542
|
+
statusbar
|
|
543
|
+
]);
|
|
544
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
545
|
+
...props,
|
|
546
|
+
role: "none",
|
|
547
|
+
style,
|
|
548
|
+
className: mx4("group grid grid-cols-[100%] density-coarse", stackItemSize === "contain" && "min-bs-0 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),
|
|
549
|
+
"data-popover-collision-boundary": true,
|
|
550
|
+
ref: forwardedRef
|
|
551
|
+
}, children);
|
|
253
552
|
});
|
|
553
|
+
StackItemContent.displayName = "StackItemContent";
|
|
254
554
|
|
|
255
555
|
// src/components/StackItem/StackItemDragHandle.tsx
|
|
256
|
-
import {
|
|
257
|
-
import
|
|
258
|
-
import React3 from "react";
|
|
556
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
557
|
+
import React5 from "react";
|
|
259
558
|
var StackItemDragHandle = ({ asChild, children }) => {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
role: "button"
|
|
267
|
-
}, children);
|
|
268
|
-
} finally {
|
|
269
|
-
_effect.f();
|
|
270
|
-
}
|
|
559
|
+
const { selfDragHandleRef } = useStackItem();
|
|
560
|
+
const Root = asChild ? Slot2 : "div";
|
|
561
|
+
return /* @__PURE__ */ React5.createElement(Root, {
|
|
562
|
+
ref: selfDragHandleRef,
|
|
563
|
+
role: "button"
|
|
564
|
+
}, children);
|
|
271
565
|
};
|
|
272
566
|
|
|
273
567
|
// src/components/StackItem/StackItemHeading.tsx
|
|
274
|
-
import {
|
|
275
|
-
import {
|
|
276
|
-
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
277
|
-
import React4, { forwardRef as forwardRef3 } from "react";
|
|
568
|
+
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
569
|
+
import React6, { forwardRef as forwardRef4 } from "react";
|
|
278
570
|
import { useAttention } from "@dxos/react-ui-attention";
|
|
279
|
-
import { mx as
|
|
571
|
+
import { mx as mx5 } from "@dxos/ui-theme";
|
|
280
572
|
var StackItemHeading = ({ children, classNames, asChild, separateOnScroll, ...props }) => {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
return /* @__PURE__ */ React4.createElement(Root, {
|
|
289
|
-
role: "heading",
|
|
290
|
-
...props,
|
|
291
|
-
tabIndex: 0,
|
|
292
|
-
...focusableGroupAttrs,
|
|
293
|
-
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)
|
|
294
|
-
}, children);
|
|
295
|
-
} finally {
|
|
296
|
-
_effect.f();
|
|
297
|
-
}
|
|
573
|
+
const { orientation } = useStack();
|
|
574
|
+
const Root = asChild ? Slot3 : "div";
|
|
575
|
+
return /* @__PURE__ */ React6.createElement(Root, {
|
|
576
|
+
role: "heading",
|
|
577
|
+
...props,
|
|
578
|
+
className: mx5("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)
|
|
579
|
+
}, children);
|
|
298
580
|
};
|
|
299
581
|
var StackItemHeadingStickyContent = ({ children }) => {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
className: "sticky block-start-0 bg-[--sticky-bg] p-1 is-full"
|
|
305
|
-
}, children);
|
|
306
|
-
} finally {
|
|
307
|
-
_effect.f();
|
|
308
|
-
}
|
|
582
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
583
|
+
role: "none",
|
|
584
|
+
className: "sticky block-start-0 bg-[--sticky-bg] p-1 is-full"
|
|
585
|
+
}, children);
|
|
309
586
|
};
|
|
310
|
-
var StackItemHeadingLabel = /* @__PURE__ */
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
ref: forwardedRef
|
|
319
|
-
});
|
|
320
|
-
} finally {
|
|
321
|
-
_effect.f();
|
|
322
|
-
}
|
|
587
|
+
var StackItemHeadingLabel = /* @__PURE__ */ forwardRef4(({ attendableId, related, classNames, ...props }, forwardedRef) => {
|
|
588
|
+
const { hasAttention, isAncestor, isRelated } = useAttention(attendableId);
|
|
589
|
+
return /* @__PURE__ */ React6.createElement("h1", {
|
|
590
|
+
...props,
|
|
591
|
+
"data-attention": (related && isRelated || hasAttention || isAncestor).toString(),
|
|
592
|
+
className: mx5("pli-1 min-is-0 is-0 grow truncate font-medium text-baseText data-[attention=true]:text-accentText self-center", classNames),
|
|
593
|
+
ref: forwardedRef
|
|
594
|
+
});
|
|
323
595
|
});
|
|
324
596
|
|
|
325
597
|
// src/components/StackItem/StackItemResizeHandle.tsx
|
|
326
|
-
import
|
|
327
|
-
import React5 from "react";
|
|
598
|
+
import React7 from "react";
|
|
328
599
|
import { ResizeHandle } from "@dxos/react-ui-dnd";
|
|
329
600
|
var MIN_WIDTH = 20;
|
|
330
601
|
var MIN_HEIGHT = 3;
|
|
331
602
|
var StackItemResizeHandle = () => {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
onSizeChange: setSize
|
|
342
|
-
});
|
|
343
|
-
} finally {
|
|
344
|
-
_effect.f();
|
|
345
|
-
}
|
|
603
|
+
const { orientation } = useStack();
|
|
604
|
+
const { setSize, size } = useStackItem();
|
|
605
|
+
return /* @__PURE__ */ React7.createElement(ResizeHandle, {
|
|
606
|
+
side: orientation === "horizontal" ? "inline-end" : "block-end",
|
|
607
|
+
fallbackSize: DEFAULT_EXTRINSIC_SIZE,
|
|
608
|
+
minSize: orientation === "horizontal" ? MIN_WIDTH : MIN_HEIGHT,
|
|
609
|
+
size,
|
|
610
|
+
onSizeChange: setSize
|
|
611
|
+
});
|
|
346
612
|
};
|
|
347
613
|
|
|
348
614
|
// src/components/StackItem/StackItemSigil.tsx
|
|
349
|
-
import {
|
|
350
|
-
import React7, { Fragment, forwardRef as forwardRef4, useState as useState3 } from "react";
|
|
615
|
+
import React9, { Fragment, forwardRef as forwardRef5, useState as useState3 } from "react";
|
|
351
616
|
import { keySymbols } from "@dxos/keyboard";
|
|
352
|
-
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
617
|
+
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
353
618
|
import { useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
354
|
-
import { descriptionText, mx as
|
|
619
|
+
import { descriptionText, mx as mx6 } from "@dxos/ui-theme";
|
|
355
620
|
import { getHostPlatform } from "@dxos/util";
|
|
356
621
|
|
|
357
622
|
// src/components/StackItem/MenuSignifier.tsx
|
|
358
|
-
import
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
strokeLinecap: "round",
|
|
377
|
-
strokeDasharray: "6 20",
|
|
378
|
-
strokeDashoffset: "-6.5"
|
|
379
|
-
}));
|
|
380
|
-
} finally {
|
|
381
|
-
_effect.f();
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
// src/translations.ts
|
|
386
|
-
var translationKey = "react-ui-stack";
|
|
387
|
-
var translations = [
|
|
388
|
-
{
|
|
389
|
-
"en-US": {
|
|
390
|
-
[translationKey]: {
|
|
391
|
-
"resize label": "Drag to resize",
|
|
392
|
-
"drag handle label": "Drag to rearrange",
|
|
393
|
-
"pin start label": "Pin to the left sidebar",
|
|
394
|
-
"pin end label": "Pin to the right sidebar",
|
|
395
|
-
"increment start label": "Move to the left",
|
|
396
|
-
"increment end label": "Move to the right",
|
|
397
|
-
"close label": "Close",
|
|
398
|
-
"minify label": "Minify"
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
];
|
|
623
|
+
import React8 from "react";
|
|
624
|
+
var MenuSignifierHorizontal = () => /* @__PURE__ */ React8.createElement("svg", {
|
|
625
|
+
className: "absolute block-end-[7px]",
|
|
626
|
+
width: 20,
|
|
627
|
+
height: 2,
|
|
628
|
+
viewBox: "0 0 20 2",
|
|
629
|
+
stroke: "currentColor",
|
|
630
|
+
opacity: 0.5
|
|
631
|
+
}, /* @__PURE__ */ React8.createElement("line", {
|
|
632
|
+
x1: 0.5,
|
|
633
|
+
y1: 0.75,
|
|
634
|
+
x2: 19,
|
|
635
|
+
y2: 0.75,
|
|
636
|
+
strokeWidth: 1.25,
|
|
637
|
+
strokeLinecap: "round",
|
|
638
|
+
strokeDasharray: "6 20",
|
|
639
|
+
strokeDashoffset: "-6.5"
|
|
640
|
+
}));
|
|
403
641
|
|
|
404
642
|
// src/components/StackItem/StackItemSigil.tsx
|
|
405
|
-
var StackItemSigilButton = /* @__PURE__ */
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
classNames
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
ref: forwardedRef
|
|
418
|
-
}, isMenu && /* @__PURE__ */ React7.createElement(MenuSignifierHorizontal, null), children);
|
|
419
|
-
} finally {
|
|
420
|
-
_effect.f();
|
|
421
|
-
}
|
|
643
|
+
var StackItemSigilButton = /* @__PURE__ */ forwardRef5(({ attendableId, classNames, related, isMenu = true, children, ...props }, forwardedRef) => {
|
|
644
|
+
const { hasAttention, isAncestor, isRelated } = useAttention2(attendableId);
|
|
645
|
+
const variant = related && isRelated || hasAttention || isAncestor ? "primary" : "ghost";
|
|
646
|
+
return /* @__PURE__ */ React9.createElement(Button, {
|
|
647
|
+
...props,
|
|
648
|
+
variant,
|
|
649
|
+
classNames: [
|
|
650
|
+
"shrink-0 pli-0 min-bs-0 is-[--rail-action] bs-[--rail-action] relative app-no-drag",
|
|
651
|
+
classNames
|
|
652
|
+
],
|
|
653
|
+
ref: forwardedRef
|
|
654
|
+
}, isMenu && /* @__PURE__ */ React9.createElement(MenuSignifierHorizontal, null), children);
|
|
422
655
|
});
|
|
423
|
-
var StackItemSigil = /* @__PURE__ */
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
if (action.properties.disabled) {
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
event.stopPropagation();
|
|
468
|
-
setOptionsMenuOpen(false);
|
|
469
|
-
onAction?.(action);
|
|
470
|
-
},
|
|
471
|
-
classNames: "gap-2",
|
|
472
|
-
disabled: action.properties.disabled,
|
|
473
|
-
checked: menuItemType === "toggle" ? action.properties.isChecked : void 0,
|
|
474
|
-
...action.properties?.testId && {
|
|
475
|
-
"data-testid": action.properties.testId
|
|
656
|
+
var StackItemSigil = /* @__PURE__ */ forwardRef5(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
657
|
+
const { t } = useTranslation2(translationKey);
|
|
658
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = useState3(false);
|
|
659
|
+
const hasActions = actionGroups && actionGroups.length > 0;
|
|
660
|
+
const button = /* @__PURE__ */ React9.createElement(StackItemSigilButton, {
|
|
661
|
+
attendableId,
|
|
662
|
+
related,
|
|
663
|
+
isMenu: hasActions,
|
|
664
|
+
// TODO(wittjosiah): Better disabling of interactive styles when no action are available.
|
|
665
|
+
// Remove underscore icon when no actions are available?
|
|
666
|
+
classNames: !hasActions && "cursor-default"
|
|
667
|
+
}, /* @__PURE__ */ React9.createElement("span", {
|
|
668
|
+
className: "sr-only"
|
|
669
|
+
}, triggerLabel), /* @__PURE__ */ React9.createElement(Icon, {
|
|
670
|
+
icon,
|
|
671
|
+
size: 5
|
|
672
|
+
}));
|
|
673
|
+
if (!hasActions) {
|
|
674
|
+
return button;
|
|
675
|
+
}
|
|
676
|
+
return /* @__PURE__ */ React9.createElement(DropdownMenu.Root, {
|
|
677
|
+
open: optionsMenuOpen,
|
|
678
|
+
onOpenChange: setOptionsMenuOpen
|
|
679
|
+
}, /* @__PURE__ */ React9.createElement(DropdownMenu.Trigger, {
|
|
680
|
+
asChild: true,
|
|
681
|
+
ref: forwardedRef
|
|
682
|
+
}, button), /* @__PURE__ */ React9.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React9.createElement(DropdownMenu.Content, {
|
|
683
|
+
classNames: "z-[31]"
|
|
684
|
+
}, /* @__PURE__ */ React9.createElement(DropdownMenu.Viewport, null, actionGroups?.map((actions, index) => {
|
|
685
|
+
const separator = index > 0 ? /* @__PURE__ */ React9.createElement(DropdownMenu.Separator, null) : null;
|
|
686
|
+
return /* @__PURE__ */ React9.createElement(Fragment, {
|
|
687
|
+
key: index
|
|
688
|
+
}, separator, actions.map((action) => {
|
|
689
|
+
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[getHostPlatform()];
|
|
690
|
+
const menuItemType = action.properties.menuItemType;
|
|
691
|
+
const Root = menuItemType === "toggle" ? DropdownMenu.CheckboxItem : DropdownMenu.Item;
|
|
692
|
+
return /* @__PURE__ */ React9.createElement(Root, {
|
|
693
|
+
key: action.id,
|
|
694
|
+
onClick: (event) => {
|
|
695
|
+
if (action.properties.disabled) {
|
|
696
|
+
return;
|
|
476
697
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
})
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
698
|
+
event.stopPropagation();
|
|
699
|
+
setOptionsMenuOpen(false);
|
|
700
|
+
onAction?.(action);
|
|
701
|
+
},
|
|
702
|
+
classNames: "gap-2",
|
|
703
|
+
disabled: action.properties.disabled,
|
|
704
|
+
checked: menuItemType === "toggle" ? action.properties.isChecked : void 0,
|
|
705
|
+
...action.properties?.testId && {
|
|
706
|
+
"data-testid": action.properties.testId
|
|
707
|
+
}
|
|
708
|
+
}, /* @__PURE__ */ React9.createElement(Icon, {
|
|
709
|
+
icon: action.properties.icon ?? "ph--placeholder--regular",
|
|
710
|
+
size: 4
|
|
711
|
+
}), /* @__PURE__ */ React9.createElement("span", {
|
|
712
|
+
className: "grow truncate"
|
|
713
|
+
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */ React9.createElement(DropdownMenu.ItemIndicator, {
|
|
714
|
+
asChild: true
|
|
715
|
+
}, /* @__PURE__ */ React9.createElement(Icon, {
|
|
716
|
+
icon: "ph--check--regular",
|
|
717
|
+
size: 4
|
|
718
|
+
})), shortcut && /* @__PURE__ */ React9.createElement("span", {
|
|
719
|
+
className: mx6("shrink-0", descriptionText)
|
|
720
|
+
}, keySymbols(shortcut).join("")));
|
|
721
|
+
}));
|
|
722
|
+
}), children), /* @__PURE__ */ React9.createElement(DropdownMenu.Arrow, null))));
|
|
495
723
|
});
|
|
496
724
|
|
|
497
725
|
// src/components/StackItem/StackItem.tsx
|
|
498
726
|
var DEFAULT_HORIZONTAL_SIZE = 48;
|
|
499
727
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
500
728
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
501
|
-
var StackItemRoot = /* @__PURE__ */
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
729
|
+
var StackItemRoot = /* @__PURE__ */ forwardRef6(({ item, children, classNames, size: propsSize, onSizeChange, role, order, prevSiblingId, nextSiblingId, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
730
|
+
const [itemElement, itemRef] = useState4(null);
|
|
731
|
+
const composedItemRef = composeRefs2(itemRef, forwardedRef);
|
|
732
|
+
const [selfDragHandleElement, selfDragHandleRef] = useState4(null);
|
|
733
|
+
const [closestEdge, setEdge] = useState4(null);
|
|
734
|
+
const [sourceId, setSourceId] = useState4(null);
|
|
735
|
+
const [dragState, setDragState] = useState4(idle);
|
|
736
|
+
const { orientation, rail, onRearrange, size: stackSize, stackId } = useStack();
|
|
737
|
+
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = useState4(propsSize);
|
|
738
|
+
const Root = role ?? "div";
|
|
739
|
+
const setSize = useCallback2((nextSize, commit) => {
|
|
740
|
+
setInternalSize(nextSize);
|
|
741
|
+
if (commit) {
|
|
742
|
+
onSizeChange?.(nextSize);
|
|
743
|
+
}
|
|
744
|
+
}, [
|
|
745
|
+
onSizeChange
|
|
746
|
+
]);
|
|
747
|
+
const type = orientation === "horizontal" ? "column" : "card";
|
|
748
|
+
useLayoutEffect2(() => {
|
|
749
|
+
if (!itemElement || !onRearrange || disableRearrange) {
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
return combine2(draggable({
|
|
753
|
+
element: itemElement,
|
|
754
|
+
...selfDragHandleElement && {
|
|
755
|
+
dragHandle: selfDragHandleElement
|
|
756
|
+
},
|
|
757
|
+
getInitialData: () => ({
|
|
758
|
+
id: item.id,
|
|
759
|
+
type
|
|
760
|
+
}),
|
|
761
|
+
onGenerateDragPreview: ({ nativeSetDragImage, source, location }) => {
|
|
762
|
+
document.body.setAttribute("data-drag-preview", "true");
|
|
763
|
+
const offsetFn = preserveOffsetOnSource({
|
|
764
|
+
element: source.element,
|
|
765
|
+
input: location.current.input
|
|
766
|
+
});
|
|
767
|
+
const rect = source.element.getBoundingClientRect();
|
|
768
|
+
setCustomNativeDragPreview({
|
|
769
|
+
nativeSetDragImage,
|
|
770
|
+
getOffset: ({ container }) => {
|
|
771
|
+
return offsetFn({
|
|
772
|
+
container
|
|
773
|
+
});
|
|
774
|
+
},
|
|
775
|
+
render: ({ container }) => {
|
|
776
|
+
container.style.width = rect.width + "px";
|
|
777
|
+
setDragState({
|
|
778
|
+
type: "preview",
|
|
779
|
+
container,
|
|
780
|
+
item
|
|
781
|
+
});
|
|
782
|
+
return () => {
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
},
|
|
787
|
+
onDragStart: () => {
|
|
788
|
+
document.body.removeAttribute("data-drag-preview");
|
|
789
|
+
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "active");
|
|
790
|
+
setDragState({
|
|
791
|
+
type: "is-dragging",
|
|
792
|
+
item
|
|
793
|
+
});
|
|
794
|
+
},
|
|
795
|
+
onDrop: () => {
|
|
796
|
+
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "idle");
|
|
797
|
+
setDragState(idle);
|
|
525
798
|
}
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
},
|
|
531
|
-
getInitialData: () => ({
|
|
799
|
+
}), dropTargetForElements2({
|
|
800
|
+
element: itemElement,
|
|
801
|
+
getData: ({ input, element }) => {
|
|
802
|
+
return attachClosestEdge2({
|
|
532
803
|
id: item.id,
|
|
533
804
|
type
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
container.style.width = rect.width + "px";
|
|
551
|
-
setDragState({
|
|
552
|
-
type: "preview",
|
|
553
|
-
container,
|
|
554
|
-
item
|
|
555
|
-
});
|
|
556
|
-
return () => {
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
},
|
|
561
|
-
onDragStart: () => {
|
|
562
|
-
document.body.removeAttribute("data-drag-preview");
|
|
563
|
-
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "active");
|
|
564
|
-
setDragState({
|
|
565
|
-
type: "is-dragging",
|
|
566
|
-
item
|
|
567
|
-
});
|
|
568
|
-
},
|
|
569
|
-
onDrop: () => {
|
|
570
|
-
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "idle");
|
|
571
|
-
setDragState(idle);
|
|
805
|
+
}, {
|
|
806
|
+
input,
|
|
807
|
+
element,
|
|
808
|
+
allowedEdges: orientation === "horizontal" ? [
|
|
809
|
+
"left",
|
|
810
|
+
"right"
|
|
811
|
+
] : [
|
|
812
|
+
"top",
|
|
813
|
+
"bottom"
|
|
814
|
+
]
|
|
815
|
+
});
|
|
816
|
+
},
|
|
817
|
+
onDragEnter: ({ self, source }) => {
|
|
818
|
+
if (source.data.type === self.data.type) {
|
|
819
|
+
setEdge(extractClosestEdge2(self.data));
|
|
820
|
+
setSourceId(source.data.id);
|
|
572
821
|
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
});
|
|
590
|
-
},
|
|
591
|
-
onDragEnter: ({ self, source }) => {
|
|
592
|
-
if (source.data.type === self.data.type) {
|
|
593
|
-
setEdge(extractClosestEdge2(self.data));
|
|
594
|
-
setSourceId(source.data.id);
|
|
595
|
-
}
|
|
596
|
-
},
|
|
597
|
-
onDrag: ({ self, source }) => {
|
|
598
|
-
if (source.data.type === self.data.type) {
|
|
599
|
-
setEdge(extractClosestEdge2(self.data));
|
|
600
|
-
setSourceId(source.data.id);
|
|
601
|
-
}
|
|
602
|
-
},
|
|
603
|
-
onDragLeave: () => {
|
|
604
|
-
setEdge(null);
|
|
605
|
-
setSourceId(null);
|
|
606
|
-
},
|
|
607
|
-
onDrop: ({ self, source }) => {
|
|
608
|
-
setEdge(null);
|
|
609
|
-
setSourceId(null);
|
|
610
|
-
if (source.data.type === self.data.type) {
|
|
611
|
-
onRearrange(source.data, self.data, extractClosestEdge2(self.data));
|
|
612
|
-
}
|
|
822
|
+
},
|
|
823
|
+
onDrag: ({ self, source }) => {
|
|
824
|
+
if (source.data.type === self.data.type) {
|
|
825
|
+
setEdge(extractClosestEdge2(self.data));
|
|
826
|
+
setSourceId(source.data.id);
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
onDragLeave: () => {
|
|
830
|
+
setEdge(null);
|
|
831
|
+
setSourceId(null);
|
|
832
|
+
},
|
|
833
|
+
onDrop: ({ self, source }) => {
|
|
834
|
+
setEdge(null);
|
|
835
|
+
setSourceId(null);
|
|
836
|
+
if (source.data.type === self.data.type) {
|
|
837
|
+
onRearrange(source.data, self.data, extractClosestEdge2(self.data));
|
|
613
838
|
}
|
|
614
|
-
}));
|
|
615
|
-
}, [
|
|
616
|
-
orientation,
|
|
617
|
-
item,
|
|
618
|
-
onRearrange,
|
|
619
|
-
selfDragHandleElement,
|
|
620
|
-
itemElement
|
|
621
|
-
]);
|
|
622
|
-
const focusableGroupAttrs = useFocusableGroup2({
|
|
623
|
-
tabBehavior: "limited"
|
|
624
|
-
});
|
|
625
|
-
const shouldShowDropIndicator = () => {
|
|
626
|
-
if (!closestEdge || !sourceId) {
|
|
627
|
-
return false;
|
|
628
|
-
}
|
|
629
|
-
if (sourceId === item.id) {
|
|
630
|
-
return false;
|
|
631
|
-
}
|
|
632
|
-
const isTrailingEdgeOfPrevSibling = prevSiblingId !== void 0 && sourceId === prevSiblingId && (orientation === "horizontal" && closestEdge === "left" || orientation === "vertical" && closestEdge === "top");
|
|
633
|
-
if (isTrailingEdgeOfPrevSibling) {
|
|
634
|
-
return false;
|
|
635
|
-
}
|
|
636
|
-
const isLeadingEdgeOfNextSibling = nextSiblingId !== void 0 && sourceId === nextSiblingId && (orientation === "horizontal" && closestEdge === "right" || orientation === "vertical" && closestEdge === "bottom");
|
|
637
|
-
if (isLeadingEdgeOfNextSibling) {
|
|
638
|
-
return false;
|
|
639
839
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
840
|
+
}));
|
|
841
|
+
}, [
|
|
842
|
+
orientation,
|
|
843
|
+
item,
|
|
844
|
+
onRearrange,
|
|
845
|
+
selfDragHandleElement,
|
|
846
|
+
itemElement
|
|
847
|
+
]);
|
|
848
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
849
|
+
tabBehavior: "limited"
|
|
850
|
+
});
|
|
851
|
+
const shouldShowDropIndicator = () => {
|
|
852
|
+
if (!closestEdge || !sourceId) {
|
|
853
|
+
return false;
|
|
854
|
+
}
|
|
855
|
+
if (sourceId === item.id) {
|
|
856
|
+
return false;
|
|
857
|
+
}
|
|
858
|
+
const isTrailingEdgeOfPrevSibling = prevSiblingId !== void 0 && sourceId === prevSiblingId && (orientation === "horizontal" && closestEdge === "left" || orientation === "vertical" && closestEdge === "top");
|
|
859
|
+
if (isTrailingEdgeOfPrevSibling) {
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
const isLeadingEdgeOfNextSibling = nextSiblingId !== void 0 && sourceId === nextSiblingId && (orientation === "horizontal" && closestEdge === "right" || orientation === "vertical" && closestEdge === "bottom");
|
|
863
|
+
if (isLeadingEdgeOfNextSibling) {
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
return true;
|
|
867
|
+
};
|
|
868
|
+
const stackItemContextValue = useMemo3(() => ({
|
|
869
|
+
selfDragHandleRef,
|
|
870
|
+
size,
|
|
871
|
+
setSize,
|
|
872
|
+
state: dragState,
|
|
873
|
+
setState: setDragState,
|
|
874
|
+
role
|
|
875
|
+
}), [
|
|
876
|
+
selfDragHandleRef,
|
|
877
|
+
size,
|
|
878
|
+
setSize,
|
|
879
|
+
dragState,
|
|
880
|
+
setDragState,
|
|
881
|
+
role
|
|
882
|
+
]);
|
|
883
|
+
return /* @__PURE__ */ React10.createElement(StackItemContext.Provider, {
|
|
884
|
+
value: stackItemContextValue
|
|
885
|
+
}, /* @__PURE__ */ React10.createElement(Root, {
|
|
886
|
+
...props,
|
|
887
|
+
tabIndex: 0,
|
|
888
|
+
...focusableGroupAttrs,
|
|
889
|
+
className: mx7("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),
|
|
890
|
+
"data-dx-stack-item": stackId,
|
|
891
|
+
"data-dx-item-id": item.id,
|
|
892
|
+
...resizeAttributes,
|
|
893
|
+
style: {
|
|
894
|
+
...stackSize !== "split" && sizeStyle(size, orientation),
|
|
895
|
+
...Number.isFinite(order) && {
|
|
896
|
+
[orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
|
|
672
897
|
},
|
|
673
|
-
|
|
674
|
-
},
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
}
|
|
898
|
+
...style
|
|
899
|
+
},
|
|
900
|
+
ref: composedItemRef
|
|
901
|
+
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */ React10.createElement(ListItem2.DropIndicator, {
|
|
902
|
+
lineInset: 8,
|
|
903
|
+
terminalInset: -8,
|
|
904
|
+
edge: closestEdge
|
|
905
|
+
})));
|
|
682
906
|
});
|
|
683
907
|
var StackItemDragPreview = ({ children }) => {
|
|
684
908
|
const { state } = useStackItem();
|
|
@@ -689,477 +913,16 @@ var StackItemDragPreview = ({ children }) => {
|
|
|
689
913
|
var StackItem = {
|
|
690
914
|
Root: StackItemRoot,
|
|
691
915
|
Content: StackItemContent,
|
|
916
|
+
DragHandle: StackItemDragHandle,
|
|
917
|
+
DragPreview: StackItemDragPreview,
|
|
692
918
|
Heading: StackItemHeading,
|
|
693
919
|
HeadingLabel: StackItemHeadingLabel,
|
|
694
920
|
HeadingStickyContent: StackItemHeadingStickyContent,
|
|
695
921
|
ResizeHandle: StackItemResizeHandle,
|
|
696
|
-
DragHandle: StackItemDragHandle,
|
|
697
922
|
Sigil: StackItemSigil,
|
|
698
|
-
SigilButton: StackItemSigilButton
|
|
699
|
-
DragPreview: StackItemDragPreview
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
// src/exemplars/Card/Card.tsx
|
|
703
|
-
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
704
|
-
import { Primitive } from "@radix-ui/react-primitive";
|
|
705
|
-
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
706
|
-
import React9, { forwardRef as forwardRef6 } from "react";
|
|
707
|
-
import { Icon as Icon2, IconButton, Toolbar, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
708
|
-
import { hoverableControls, mx as mx6 } from "@dxos/react-ui-theme";
|
|
709
|
-
|
|
710
|
-
// src/exemplars/Card/fragments.ts
|
|
711
|
-
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";
|
|
712
|
-
var cardSpacing = "pli-cardSpacingInline mlb-cardSpacingBlock";
|
|
713
|
-
var labelSpacing = "mbs-inputSpacingBlock mbe-labelSpacingBlock";
|
|
714
|
-
var cardDialogContent = "p-0 bs-content min-bs-[8rem] max-bs-full md:max-is-[32rem] overflow-hidden";
|
|
715
|
-
var cardDialogHeader = "pli-cardSpacingInline mbs-cardSpacingBlock flex justify-between";
|
|
716
|
-
var cardDialogOverflow = "overflow-y-auto min-bs-0 flex-1";
|
|
717
|
-
var cardDialogPaddedOverflow = `${cardDialogOverflow} plb-cardSpacingBlock`;
|
|
718
|
-
var cardDialogSearchListRoot = "pli-cardSpacingInline pbs-cardSpacingBlock [&>input]:mbe-0 min-bs-0 flex-1 flex flex-col";
|
|
719
|
-
var cardText = cardSpacing;
|
|
720
|
-
var cardHeading = "text-lg font-medium line-clamp-2";
|
|
721
|
-
var cardChrome = "pli-[--dx-cardSpacingChrome] mlb-[--dx-cardSpacingChrome] [&_.dx-button]:text-start [&_.dx-button]:is-full";
|
|
722
|
-
|
|
723
|
-
// src/exemplars/Card/Card.tsx
|
|
724
|
-
var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "group", ...props }, forwardedRef) => {
|
|
725
|
-
var _effect = _useSignals9();
|
|
726
|
-
try {
|
|
727
|
-
const Root = asChild ? Slot3 : "div";
|
|
728
|
-
const rootProps = asChild ? {
|
|
729
|
-
classNames: [
|
|
730
|
-
cardRoot,
|
|
731
|
-
classNames
|
|
732
|
-
]
|
|
733
|
-
} : {
|
|
734
|
-
className: mx6(cardRoot, classNames),
|
|
735
|
-
role
|
|
736
|
-
};
|
|
737
|
-
return /* @__PURE__ */ React9.createElement(Root, {
|
|
738
|
-
...props,
|
|
739
|
-
...rootProps,
|
|
740
|
-
ref: forwardedRef
|
|
741
|
-
}, children);
|
|
742
|
-
} finally {
|
|
743
|
-
_effect.f();
|
|
744
|
-
}
|
|
745
|
-
});
|
|
746
|
-
var CardSurfaceRoot = ({ role = "never", children }) => {
|
|
747
|
-
var _effect = _useSignals9();
|
|
748
|
-
try {
|
|
749
|
-
if ([
|
|
750
|
-
"popover",
|
|
751
|
-
"card--kanban"
|
|
752
|
-
].includes(role)) {
|
|
753
|
-
return /* @__PURE__ */ React9.createElement("div", {
|
|
754
|
-
className: role === "popover" ? "popover-card-width" : role === "card--kanban" ? "contents" : ""
|
|
755
|
-
}, children);
|
|
756
|
-
} else {
|
|
757
|
-
return /* @__PURE__ */ React9.createElement(CardStaticRoot, role === "card--document" && {
|
|
758
|
-
classNames: [
|
|
759
|
-
"mlb-[1em]",
|
|
760
|
-
hoverableControls
|
|
761
|
-
]
|
|
762
|
-
}, children);
|
|
763
|
-
}
|
|
764
|
-
} finally {
|
|
765
|
-
_effect.f();
|
|
766
|
-
}
|
|
767
|
-
};
|
|
768
|
-
var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
769
|
-
var _effect = _useSignals9();
|
|
770
|
-
try {
|
|
771
|
-
const Root = asChild ? Slot3 : "div";
|
|
772
|
-
const rootProps = asChild ? {
|
|
773
|
-
classNames: [
|
|
774
|
-
cardHeading,
|
|
775
|
-
cardText,
|
|
776
|
-
classNames
|
|
777
|
-
]
|
|
778
|
-
} : {
|
|
779
|
-
className: mx6(cardHeading, cardText, classNames),
|
|
780
|
-
role
|
|
781
|
-
};
|
|
782
|
-
return /* @__PURE__ */ React9.createElement(Root, {
|
|
783
|
-
...props,
|
|
784
|
-
...rootProps,
|
|
785
|
-
ref: forwardedRef
|
|
786
|
-
}, children);
|
|
787
|
-
} finally {
|
|
788
|
-
_effect.f();
|
|
789
|
-
}
|
|
790
|
-
});
|
|
791
|
-
var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props }, forwardedRef) => {
|
|
792
|
-
var _effect = _useSignals9();
|
|
793
|
-
try {
|
|
794
|
-
return /* @__PURE__ */ React9.createElement(Toolbar.Root, {
|
|
795
|
-
...props,
|
|
796
|
-
classNames: [
|
|
797
|
-
"bg-transparent density-coarse",
|
|
798
|
-
classNames
|
|
799
|
-
],
|
|
800
|
-
ref: forwardedRef
|
|
801
|
-
}, children);
|
|
802
|
-
} finally {
|
|
803
|
-
_effect.f();
|
|
804
|
-
}
|
|
805
|
-
});
|
|
806
|
-
var CardToolbarIconButton = Toolbar.IconButton;
|
|
807
|
-
var CardToolbarSeparator = Toolbar.Separator;
|
|
808
|
-
var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef) => {
|
|
809
|
-
var _effect = _useSignals9();
|
|
810
|
-
try {
|
|
811
|
-
const { t } = useTranslation2(translationKey);
|
|
812
|
-
const Root = toolbarItem ? Toolbar.IconButton : IconButton;
|
|
813
|
-
return /* @__PURE__ */ React9.createElement(Root, {
|
|
814
|
-
iconOnly: true,
|
|
815
|
-
icon: "ph--dots-six-vertical--regular",
|
|
816
|
-
variant: "ghost",
|
|
817
|
-
label: t("drag handle label"),
|
|
818
|
-
classNames: "pli-2",
|
|
819
|
-
ref: forwardedRef
|
|
820
|
-
});
|
|
821
|
-
} finally {
|
|
822
|
-
_effect.f();
|
|
823
|
-
}
|
|
824
|
-
});
|
|
825
|
-
var CardDragPreview = StackItem.DragPreview;
|
|
826
|
-
var CardMenu = Primitive.div;
|
|
827
|
-
var CardPoster = (props) => {
|
|
828
|
-
var _effect = _useSignals9();
|
|
829
|
-
try {
|
|
830
|
-
const aspect = props.aspect === "auto" ? "aspect-auto" : "aspect-video";
|
|
831
|
-
if (props.image) {
|
|
832
|
-
return /* @__PURE__ */ React9.createElement("img", {
|
|
833
|
-
className: `dx-card__poster ${aspect} object-cover is-full bs-auto`,
|
|
834
|
-
src: props.image,
|
|
835
|
-
alt: props.alt
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
if (props.icon) {
|
|
839
|
-
return /* @__PURE__ */ React9.createElement("div", {
|
|
840
|
-
role: "image",
|
|
841
|
-
className: `dx-card__poster grid ${aspect} place-items-center bg-inputSurface text-subdued`,
|
|
842
|
-
"aria-label": props.alt
|
|
843
|
-
}, /* @__PURE__ */ React9.createElement(Icon2, {
|
|
844
|
-
icon: props.icon,
|
|
845
|
-
size: 10
|
|
846
|
-
}));
|
|
847
|
-
}
|
|
848
|
-
} finally {
|
|
849
|
-
_effect.f();
|
|
850
|
-
}
|
|
851
|
-
};
|
|
852
|
-
var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
853
|
-
var _effect = _useSignals9();
|
|
854
|
-
try {
|
|
855
|
-
const Root = asChild ? Slot3 : "div";
|
|
856
|
-
const rootProps = asChild ? {
|
|
857
|
-
classNames: [
|
|
858
|
-
cardChrome,
|
|
859
|
-
classNames
|
|
860
|
-
]
|
|
861
|
-
} : {
|
|
862
|
-
className: mx6(cardChrome, classNames),
|
|
863
|
-
role
|
|
864
|
-
};
|
|
865
|
-
return /* @__PURE__ */ React9.createElement(Root, {
|
|
866
|
-
...props,
|
|
867
|
-
...rootProps,
|
|
868
|
-
ref: forwardedRef
|
|
869
|
-
}, children);
|
|
870
|
-
} finally {
|
|
871
|
-
_effect.f();
|
|
872
|
-
}
|
|
873
|
-
});
|
|
874
|
-
var CardText = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
875
|
-
var _effect = _useSignals9();
|
|
876
|
-
try {
|
|
877
|
-
const Root = asChild ? Slot3 : "p";
|
|
878
|
-
const rootProps = asChild ? {
|
|
879
|
-
classNames: [
|
|
880
|
-
cardText,
|
|
881
|
-
classNames
|
|
882
|
-
]
|
|
883
|
-
} : {
|
|
884
|
-
className: mx6(cardText, classNames),
|
|
885
|
-
role
|
|
886
|
-
};
|
|
887
|
-
return /* @__PURE__ */ React9.createElement(Root, {
|
|
888
|
-
...props,
|
|
889
|
-
...rootProps,
|
|
890
|
-
ref: forwardedRef
|
|
891
|
-
}, children);
|
|
892
|
-
} finally {
|
|
893
|
-
_effect.f();
|
|
894
|
-
}
|
|
895
|
-
});
|
|
896
|
-
var Card = {
|
|
897
|
-
StaticRoot: CardStaticRoot,
|
|
898
|
-
SurfaceRoot: CardSurfaceRoot,
|
|
899
|
-
Heading: CardHeading,
|
|
900
|
-
Toolbar: CardToolbar,
|
|
901
|
-
ToolbarIconButton: CardToolbarIconButton,
|
|
902
|
-
ToolbarSeparator: CardToolbarSeparator,
|
|
903
|
-
DragHandle: CardDragHandle,
|
|
904
|
-
DragPreview: CardDragPreview,
|
|
905
|
-
Menu: CardMenu,
|
|
906
|
-
Poster: CardPoster,
|
|
907
|
-
Chrome: CardChrome,
|
|
908
|
-
Text: CardText
|
|
909
|
-
};
|
|
910
|
-
|
|
911
|
-
// src/exemplars/Card/CardDragPreview.tsx
|
|
912
|
-
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
913
|
-
import React10 from "react";
|
|
914
|
-
import { mx as mx7 } from "@dxos/react-ui-theme";
|
|
915
|
-
var CardDragPreviewRoot = ({ children }) => {
|
|
916
|
-
var _effect = _useSignals10();
|
|
917
|
-
try {
|
|
918
|
-
return /* @__PURE__ */ React10.createElement("div", {
|
|
919
|
-
className: "p-2"
|
|
920
|
-
}, children);
|
|
921
|
-
} finally {
|
|
922
|
-
_effect.f();
|
|
923
|
-
}
|
|
924
|
-
};
|
|
925
|
-
var CardDragPreviewContent = ({ children }) => {
|
|
926
|
-
var _effect = _useSignals10();
|
|
927
|
-
try {
|
|
928
|
-
return /* @__PURE__ */ React10.createElement("div", {
|
|
929
|
-
className: mx7(cardRoot, "ring-focusLine ring-neutralFocusIndicator")
|
|
930
|
-
}, children);
|
|
931
|
-
} finally {
|
|
932
|
-
_effect.f();
|
|
933
|
-
}
|
|
934
|
-
};
|
|
935
|
-
var CardDragPreview2 = {
|
|
936
|
-
Root: CardDragPreviewRoot,
|
|
937
|
-
Content: CardDragPreviewContent
|
|
938
|
-
};
|
|
939
|
-
|
|
940
|
-
// src/exemplars/CardStack/CardStack.tsx
|
|
941
|
-
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
942
|
-
import { Slot as Slot4 } from "@radix-ui/react-slot";
|
|
943
|
-
import React11, { forwardRef as forwardRef7 } from "react";
|
|
944
|
-
import { mx as mx8 } from "@dxos/react-ui-theme";
|
|
945
|
-
var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
946
|
-
var _effect = _useSignals11();
|
|
947
|
-
try {
|
|
948
|
-
return /* @__PURE__ */ React11.createElement(Stack, {
|
|
949
|
-
orientation: "vertical",
|
|
950
|
-
size: "contain",
|
|
951
|
-
rail: false,
|
|
952
|
-
classNames: (
|
|
953
|
-
/* NOTE(thure): Do not let this element have zero intrinsic size, otherwise the drop indicator will not display. See #9035. */
|
|
954
|
-
[
|
|
955
|
-
"plb-1",
|
|
956
|
-
itemsCount > 0 && "plb-2",
|
|
957
|
-
classNames
|
|
958
|
-
]
|
|
959
|
-
),
|
|
960
|
-
itemsCount,
|
|
961
|
-
separatorOnScroll: 9,
|
|
962
|
-
"data-density": "fine",
|
|
963
|
-
...props,
|
|
964
|
-
ref: forwardedRef
|
|
965
|
-
}, children);
|
|
966
|
-
} finally {
|
|
967
|
-
_effect.f();
|
|
968
|
-
}
|
|
969
|
-
});
|
|
970
|
-
var CardStackDragHandle = Card.DragHandle;
|
|
971
|
-
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
972
|
-
var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
973
|
-
var _effect = _useSignals11();
|
|
974
|
-
try {
|
|
975
|
-
const Root = asChild ? Slot4 : "div";
|
|
976
|
-
const rootProps = asChild ? {
|
|
977
|
-
classNames: [
|
|
978
|
-
cardStackHeading,
|
|
979
|
-
classNames
|
|
980
|
-
]
|
|
981
|
-
} : {
|
|
982
|
-
className: mx8(cardStackHeading, classNames),
|
|
983
|
-
role
|
|
984
|
-
};
|
|
985
|
-
return /* @__PURE__ */ React11.createElement(Root, {
|
|
986
|
-
...props,
|
|
987
|
-
...rootProps,
|
|
988
|
-
ref: forwardedRef
|
|
989
|
-
}, children);
|
|
990
|
-
} finally {
|
|
991
|
-
_effect.f();
|
|
992
|
-
}
|
|
993
|
-
});
|
|
994
|
-
var cardStackFooter = 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
995
|
-
var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
996
|
-
var _effect = _useSignals11();
|
|
997
|
-
try {
|
|
998
|
-
const Root = asChild ? Slot4 : "div";
|
|
999
|
-
const rootProps = asChild ? {
|
|
1000
|
-
classNames: [
|
|
1001
|
-
cardStackFooter,
|
|
1002
|
-
classNames
|
|
1003
|
-
]
|
|
1004
|
-
} : {
|
|
1005
|
-
className: mx8(cardStackFooter, classNames),
|
|
1006
|
-
role
|
|
1007
|
-
};
|
|
1008
|
-
return /* @__PURE__ */ React11.createElement(Root, {
|
|
1009
|
-
...props,
|
|
1010
|
-
...rootProps,
|
|
1011
|
-
ref: forwardedRef
|
|
1012
|
-
}, children);
|
|
1013
|
-
} finally {
|
|
1014
|
-
_effect.f();
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
var cardStackContent = [
|
|
1018
|
-
"shrink min-bs-0 bg-baseSurface border border-separator rounded-md grid dx-focus-ring-group-x-indicator kanban-drop",
|
|
1019
|
-
railGridHorizontalContainFitContent
|
|
1020
|
-
];
|
|
1021
|
-
var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1022
|
-
var _effect = _useSignals11();
|
|
1023
|
-
try {
|
|
1024
|
-
const Root = asChild ? Slot4 : "div";
|
|
1025
|
-
const rootProps = asChild ? {
|
|
1026
|
-
classNames: [
|
|
1027
|
-
...cardStackContent,
|
|
1028
|
-
classNames
|
|
1029
|
-
]
|
|
1030
|
-
} : {
|
|
1031
|
-
className: mx8(...cardStackContent, classNames),
|
|
1032
|
-
role
|
|
1033
|
-
};
|
|
1034
|
-
return /* @__PURE__ */ React11.createElement(Root, {
|
|
1035
|
-
...props,
|
|
1036
|
-
...rootProps,
|
|
1037
|
-
"data-scroll-separator": "false",
|
|
1038
|
-
ref: forwardedRef
|
|
1039
|
-
}, children);
|
|
1040
|
-
} finally {
|
|
1041
|
-
_effect.f();
|
|
1042
|
-
}
|
|
1043
|
-
});
|
|
1044
|
-
var cardStackRoot = "flex flex-col pli-2 plb-2";
|
|
1045
|
-
var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1046
|
-
var _effect = _useSignals11();
|
|
1047
|
-
try {
|
|
1048
|
-
const Root = asChild ? Slot4 : "div";
|
|
1049
|
-
const rootProps = asChild ? {
|
|
1050
|
-
classNames: [
|
|
1051
|
-
cardStackRoot,
|
|
1052
|
-
classNames
|
|
1053
|
-
]
|
|
1054
|
-
} : {
|
|
1055
|
-
className: mx8(cardStackRoot, classNames),
|
|
1056
|
-
role
|
|
1057
|
-
};
|
|
1058
|
-
return /* @__PURE__ */ React11.createElement(Root, {
|
|
1059
|
-
...props,
|
|
1060
|
-
...rootProps,
|
|
1061
|
-
ref: forwardedRef
|
|
1062
|
-
}, children);
|
|
1063
|
-
} finally {
|
|
1064
|
-
_effect.f();
|
|
1065
|
-
}
|
|
1066
|
-
});
|
|
1067
|
-
var cardStackItem = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
1068
|
-
var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1069
|
-
var _effect = _useSignals11();
|
|
1070
|
-
try {
|
|
1071
|
-
const Root = asChild ? Slot4 : "div";
|
|
1072
|
-
const rootProps = asChild ? {
|
|
1073
|
-
classNames: [
|
|
1074
|
-
cardStackItem,
|
|
1075
|
-
classNames
|
|
1076
|
-
]
|
|
1077
|
-
} : {
|
|
1078
|
-
className: mx8(cardStackItem, classNames),
|
|
1079
|
-
role
|
|
1080
|
-
};
|
|
1081
|
-
return /* @__PURE__ */ React11.createElement(Root, {
|
|
1082
|
-
...props,
|
|
1083
|
-
...rootProps,
|
|
1084
|
-
ref: forwardedRef
|
|
1085
|
-
}, children);
|
|
1086
|
-
} finally {
|
|
1087
|
-
_effect.f();
|
|
1088
|
-
}
|
|
1089
|
-
});
|
|
1090
|
-
var CardStack = {
|
|
1091
|
-
Root: CardStackRoot,
|
|
1092
|
-
Content: CardStackContent,
|
|
1093
|
-
Stack: CardStackStack,
|
|
1094
|
-
Heading: CardStackHeading,
|
|
1095
|
-
Footer: CardStackFooter,
|
|
1096
|
-
DragHandle: CardStackDragHandle,
|
|
1097
|
-
Item: CardStackItem
|
|
1098
|
-
};
|
|
1099
|
-
|
|
1100
|
-
// src/exemplars/CardStack/CardStackDragPreview.tsx
|
|
1101
|
-
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
1102
|
-
import React12 from "react";
|
|
1103
|
-
import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
1104
|
-
import { mx as mx9 } from "@dxos/react-ui-theme";
|
|
1105
|
-
var CardStackDragPreviewRoot = ({ children }) => {
|
|
1106
|
-
var _effect = _useSignals12();
|
|
1107
|
-
try {
|
|
1108
|
-
return /* @__PURE__ */ React12.createElement("div", {
|
|
1109
|
-
className: "p-2"
|
|
1110
|
-
}, /* @__PURE__ */ React12.createElement("div", {
|
|
1111
|
-
className: "rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col"
|
|
1112
|
-
}, children));
|
|
1113
|
-
} finally {
|
|
1114
|
-
_effect.f();
|
|
1115
|
-
}
|
|
1116
|
-
};
|
|
1117
|
-
var CardStackDragPreviewHeading = ({ children }) => {
|
|
1118
|
-
var _effect = _useSignals12();
|
|
1119
|
-
try {
|
|
1120
|
-
const { t } = useTranslation3(translationKey);
|
|
1121
|
-
return /* @__PURE__ */ React12.createElement("div", {
|
|
1122
|
-
className: "flex items-center p-2"
|
|
1123
|
-
}, /* @__PURE__ */ React12.createElement(IconButton2, {
|
|
1124
|
-
iconOnly: true,
|
|
1125
|
-
icon: "ph--dots-six-vertical--regular",
|
|
1126
|
-
variant: "ghost",
|
|
1127
|
-
label: t("column drag handle label"),
|
|
1128
|
-
classNames: "pli-2"
|
|
1129
|
-
}), children);
|
|
1130
|
-
} finally {
|
|
1131
|
-
_effect.f();
|
|
1132
|
-
}
|
|
1133
|
-
};
|
|
1134
|
-
var CardStackDragPreviewContent = ({ children, itemsCount = 0 }) => {
|
|
1135
|
-
var _effect = _useSignals12();
|
|
1136
|
-
try {
|
|
1137
|
-
return /* @__PURE__ */ React12.createElement("div", {
|
|
1138
|
-
className: mx9("overflow-y-auto flex-1 pli-2 flex flex-col gap-2", "plb-1", itemsCount > 0 ? "plb-2" : "plb-1")
|
|
1139
|
-
}, children);
|
|
1140
|
-
} finally {
|
|
1141
|
-
_effect.f();
|
|
1142
|
-
}
|
|
1143
|
-
};
|
|
1144
|
-
var CardStackDragPreviewFooter = ({ children }) => {
|
|
1145
|
-
var _effect = _useSignals12();
|
|
1146
|
-
try {
|
|
1147
|
-
return /* @__PURE__ */ React12.createElement("div", {
|
|
1148
|
-
className: "p-2 border-t border-separator"
|
|
1149
|
-
}, children);
|
|
1150
|
-
} finally {
|
|
1151
|
-
_effect.f();
|
|
1152
|
-
}
|
|
1153
|
-
};
|
|
1154
|
-
var CardStackDragPreview = {
|
|
1155
|
-
Root: CardStackDragPreviewRoot,
|
|
1156
|
-
Heading: CardStackDragPreviewHeading,
|
|
1157
|
-
Content: CardStackDragPreviewContent,
|
|
1158
|
-
Footer: CardStackDragPreviewFooter
|
|
923
|
+
SigilButton: StackItemSigilButton
|
|
1159
924
|
};
|
|
1160
925
|
export {
|
|
1161
|
-
Card,
|
|
1162
|
-
CardDragPreview2 as CardDragPreview,
|
|
1163
926
|
CardStack,
|
|
1164
927
|
CardStackDragPreview,
|
|
1165
928
|
DEFAULT_EXTRINSIC_SIZE,
|
|
@@ -1168,24 +931,13 @@ export {
|
|
|
1168
931
|
Stack,
|
|
1169
932
|
StackContext,
|
|
1170
933
|
StackItem,
|
|
1171
|
-
StackItemDragPreview,
|
|
1172
934
|
autoScrollRootAttributes,
|
|
1173
|
-
cardChrome,
|
|
1174
|
-
cardDialogContent,
|
|
1175
|
-
cardDialogHeader,
|
|
1176
|
-
cardDialogOverflow,
|
|
1177
|
-
cardDialogPaddedOverflow,
|
|
1178
|
-
cardDialogSearchListRoot,
|
|
1179
|
-
cardHeading,
|
|
1180
|
-
cardRoot,
|
|
1181
|
-
cardSpacing,
|
|
1182
935
|
cardStackContent,
|
|
936
|
+
cardStackDefaultInlineSizeRem,
|
|
1183
937
|
cardStackFooter,
|
|
1184
938
|
cardStackHeading,
|
|
1185
939
|
cardStackItem,
|
|
1186
940
|
cardStackRoot,
|
|
1187
|
-
cardText,
|
|
1188
|
-
labelSpacing,
|
|
1189
941
|
railGridHorizontal,
|
|
1190
942
|
railGridHorizontalContainFitContent,
|
|
1191
943
|
railGridVertical,
|