@dxos/react-ui-stack 0.8.2-staging.7ac8446 → 0.8.3-main.672df60

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