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