@dxos/react-ui-stack 0.8.4-main.f9ba587 → 0.8.4-main.fd6878d

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