@dxos/react-ui-stack 0.7.5-main.9d2a38b → 0.7.5-main.b19bfc8

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 (46) hide show
  1. package/dist/lib/browser/index.mjs +159 -163
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +195 -198
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +159 -163
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/components/MenuSignifier.d.ts +2 -3
  11. package/dist/types/src/components/MenuSignifier.d.ts.map +1 -1
  12. package/dist/types/src/components/Stack.d.ts +6 -1
  13. package/dist/types/src/components/Stack.d.ts.map +1 -1
  14. package/dist/types/src/components/Stack.stories.d.ts +1 -2
  15. package/dist/types/src/components/Stack.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/StackContext.d.ts +2 -1
  17. package/dist/types/src/components/StackContext.d.ts.map +1 -1
  18. package/dist/types/src/components/StackItem.d.ts +7 -5
  19. package/dist/types/src/components/StackItem.d.ts.map +1 -1
  20. package/dist/types/src/components/StackItemContent.d.ts +1 -1
  21. package/dist/types/src/components/StackItemContent.d.ts.map +1 -1
  22. package/dist/types/src/components/StackItemDragHandle.d.ts +2 -2
  23. package/dist/types/src/components/StackItemDragHandle.d.ts.map +1 -1
  24. package/dist/types/src/components/StackItemHeading.d.ts +1 -1
  25. package/dist/types/src/components/StackItemHeading.d.ts.map +1 -1
  26. package/dist/types/src/components/StackItemResizeHandle.d.ts +1 -2
  27. package/dist/types/src/components/StackItemResizeHandle.d.ts.map +1 -1
  28. package/dist/types/src/components/StackItemSigil.d.ts.map +1 -1
  29. package/dist/types/src/hooks/index.d.ts +2 -0
  30. package/dist/types/src/hooks/index.d.ts.map +1 -0
  31. package/dist/types/src/hooks/useStackDropForElements.d.ts +15 -0
  32. package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -0
  33. package/package.json +29 -27
  34. package/src/components/Stack.stories.tsx +1 -1
  35. package/src/components/Stack.tsx +44 -57
  36. package/src/components/StackContext.tsx +3 -1
  37. package/src/components/StackItem.tsx +45 -14
  38. package/src/components/StackItemContent.tsx +2 -0
  39. package/src/components/StackItemHeading.tsx +1 -1
  40. package/src/components/StackItemResizeHandle.tsx +12 -98
  41. package/src/components/StackItemSigil.tsx +90 -103
  42. package/src/hooks/index.ts +5 -0
  43. package/src/hooks/useStackDropForElements.ts +73 -0
  44. package/dist/types/src/playwright/playwright.config.d.ts +0 -3
  45. package/dist/types/src/playwright/playwright.config.d.ts.map +0 -1
  46. /package/src/playwright/{playwright.config.ts → playwright.config.cts} +0 -0
@@ -1,9 +1,7 @@
1
1
  // packages/ui/react-ui-stack/src/components/Stack.tsx
2
- import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
3
- import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
4
2
  import { useArrowNavigationGroup } from "@fluentui/react-tabster";
5
3
  import { composeRefs } from "@radix-ui/react-compose-refs";
6
- import React, { Children, forwardRef, useLayoutEffect, useState } from "react";
4
+ import React, { Children, forwardRef, useState as useState2, useMemo } from "react";
7
5
  import { ListItem } from "@dxos/react-ui";
8
6
  import { mx } from "@dxos/react-ui-theme";
9
7
 
@@ -24,35 +22,28 @@ var StackItemContext = /* @__PURE__ */ createContext({
24
22
  });
25
23
  var useStackItem = () => useContext(StackItemContext);
26
24
 
27
- // packages/ui/react-ui-stack/src/components/Stack.tsx
28
- var railGridHorizontal = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
29
- var railGridVertical = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
30
- var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientation = "vertical", rail = true, size = "intrinsic", onRearrange, itemsCount = Children.count(children), ...props }, forwardedRef) => {
31
- const [stackElement, stackRef] = useState(null);
32
- const composedItemRef = composeRefs(stackRef, forwardedRef);
25
+ // packages/ui/react-ui-stack/src/hooks/useStackDropForElements.ts
26
+ import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
27
+ import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
28
+ import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
29
+ import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
30
+ import { useLayoutEffect, useState } from "react";
31
+ var useStackDropForElements = ({ element, selfDroppable, orientation, id, onRearrange }) => {
33
32
  const [dropping, setDropping] = useState(false);
34
- const arrowNavigationGroup = useArrowNavigationGroup({
35
- axis: orientation
36
- });
37
- const styles = {
38
- [orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: `repeat(${itemsCount}, min-content)`,
39
- ...style
40
- };
41
- const selfDroppable = !!(itemsCount < 1 && onRearrange && props.id);
42
33
  useLayoutEffect(() => {
43
- if (!stackElement || !selfDroppable) {
34
+ if (!element || !selfDroppable) {
44
35
  return;
45
36
  }
46
37
  const acceptSourceType = orientation === "horizontal" ? "column" : "card";
47
- return dropTargetForElements({
48
- element: stackElement,
49
- getData: ({ input, element }) => {
38
+ return combine(dropTargetForElements({
39
+ element,
40
+ getData: ({ input, element: element2 }) => {
50
41
  return attachClosestEdge({
51
- id: props.id,
42
+ id,
52
43
  type: orientation === "horizontal" ? "card" : "column"
53
44
  }, {
54
45
  input,
55
- element,
46
+ element: element2,
56
47
  allowedEdges: [
57
48
  orientation === "horizontal" ? "left" : "top"
58
49
  ]
@@ -68,17 +59,70 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
68
59
  setDropping(true);
69
60
  }
70
61
  },
71
- onDragLeave: () => setDropping(false),
62
+ onDragLeave: () => {
63
+ return setDropping(false);
64
+ },
72
65
  onDrop: ({ self, source }) => {
73
66
  setDropping(false);
74
- if (source.data.type === acceptSourceType && selfDroppable) {
67
+ if (source.data.type === acceptSourceType && selfDroppable && onRearrange) {
75
68
  onRearrange(source.data, self.data, extractClosestEdge(self.data));
76
69
  }
77
70
  }
78
- });
71
+ }), autoScrollForElements({
72
+ element,
73
+ getAllowedAxis: () => orientation
74
+ }));
79
75
  }, [
80
- stackElement,
81
- selfDroppable
76
+ element,
77
+ selfDroppable,
78
+ orientation,
79
+ id,
80
+ onRearrange
81
+ ]);
82
+ return {
83
+ dropping
84
+ };
85
+ };
86
+
87
+ // packages/ui/react-ui-stack/src/components/Stack.tsx
88
+ var railGridHorizontal = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
89
+ var railGridVertical = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
90
+ var railGridHorizontalContainFitContent = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_fit-content(calc(100%-var(--rail-size)*2+2px))_[content-end]]";
91
+ var railGridVerticalContainFitContent = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_fit-content(calc(100%-var(--rail-size)*2+2px))_[content-end]]";
92
+ var autoScrollRootAttributes = {
93
+ "data-drag-autoscroll": "idle"
94
+ };
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 arrowNavigationGroup = 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
82
126
  ]);
83
127
  return /* @__PURE__ */ React.createElement(StackContext.Provider, {
84
128
  value: {
@@ -90,26 +134,31 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
90
134
  }, /* @__PURE__ */ React.createElement("div", {
91
135
  ...props,
92
136
  ...arrowNavigationGroup,
93
- className: mx("grid relative", rail ? orientation === "horizontal" ? railGridHorizontal : railGridVertical : orientation === "horizontal" ? "grid-rows-1" : "grid-cols-1", size === "contain" && (orientation === "horizontal" ? "overflow-x-auto min-bs-0 bs-full max-bs-full" : "overflow-y-auto min-is-0 is-full max-is-full"), classNames),
137
+ className: mx("grid relative", gridClasses, (size === "contain" || size === "contain-fit-content") && (orientation === "horizontal" ? "overflow-x-auto min-bs-0 bs-full max-bs-full" : "overflow-y-auto min-is-0 is-full max-is-full"), classNames),
138
+ "data-rail": rail,
94
139
  "aria-orientation": orientation,
95
140
  style: styles,
96
141
  ref: composedItemRef
97
142
  }, children, selfDroppable && dropping && /* @__PURE__ */ React.createElement(ListItem.DropIndicator, {
143
+ lineInset: 8,
144
+ terminalInset: -8,
145
+ gap: -8,
98
146
  edge: orientation === "horizontal" ? "left" : "top"
99
147
  })));
100
148
  });
101
149
 
102
150
  // packages/ui/react-ui-stack/src/components/StackItem.tsx
103
- import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
104
- import { draggable as draggable2, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
105
- import { disableNativeDragPreview as disableNativeDragPreview2 } from "@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview";
106
- import { preventUnhandled as preventUnhandled2 } from "@atlaskit/pragmatic-drag-and-drop/prevent-unhandled";
151
+ import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
152
+ import { draggable, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
153
+ 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";
107
155
  import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
108
156
  import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
109
157
  import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
110
- import React8, { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect3, useState as useState3, useCallback } from "react";
158
+ import React8, { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect2, useState as useState4, useCallback } from "react";
111
159
  import { ListItem as ListItem2 } from "@dxos/react-ui";
112
- import { mx as mx6 } from "@dxos/react-ui-theme";
160
+ import { resizeAttributes, sizeStyle } from "@dxos/react-ui-dnd";
161
+ import { mx as mx5 } from "@dxos/react-ui-theme";
113
162
 
114
163
  // packages/ui/react-ui-stack/src/components/StackItemContent.tsx
115
164
  import React2, { forwardRef as forwardRef2 } from "react";
@@ -162,7 +211,7 @@ var StackItemHeading = ({ children, classNames, ...props }) => {
162
211
  ...props,
163
212
  tabIndex: 0,
164
213
  ...focusableGroupAttrs,
165
- className: mx3("flex items-center ch-focus-ring-inset-over-all relative !border-is-0", orientation === "horizontal" ? "bs-[--rail-size]" : "is-[--rail-size] flex-col", classNames)
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)
166
215
  }, children);
167
216
  };
168
217
  var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related, classNames, ...props }, forwardedRef) => {
@@ -176,91 +225,28 @@ var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related
176
225
  });
177
226
 
178
227
  // packages/ui/react-ui-stack/src/components/StackItemResizeHandle.tsx
179
- import { draggable } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
180
- import { disableNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview";
181
- import { preventUnhandled } from "@atlaskit/pragmatic-drag-and-drop/prevent-unhandled";
182
- import React5, { useLayoutEffect as useLayoutEffect2, useRef } from "react";
183
- import { mx as mx4 } from "@dxos/react-ui-theme";
184
- var REM = parseFloat(getComputedStyle(document.documentElement).fontSize);
185
- var MIN_SIZE = 20;
186
- var measureStackItem = (element) => {
187
- const stackItemElement = element.closest("[data-dx-stack-item]");
188
- return stackItemElement?.getBoundingClientRect() ?? {
189
- width: DEFAULT_EXTRINSIC_SIZE,
190
- height: DEFAULT_EXTRINSIC_SIZE
191
- };
192
- };
193
- var getNextSize = (startSize, location, client) => {
194
- return Math.max(MIN_SIZE, startSize + (location.current.input[client] - location.initial.input[client]) / REM);
195
- };
228
+ import React5 from "react";
229
+ import { ResizeHandle } from "@dxos/react-ui-dnd";
230
+ var MIN_WIDTH = 20;
231
+ var MIN_HEIGHT = 3;
196
232
  var StackItemResizeHandle = () => {
197
233
  const { orientation } = useStack();
198
234
  const { setSize, size } = useStackItem();
199
- const buttonRef = useRef(null);
200
- const dragStartSize = useRef(size);
201
- const client = orientation === "horizontal" ? "clientX" : "clientY";
202
- useLayoutEffect2(() => {
203
- if (!buttonRef.current || buttonRef.current.hasAttribute("draggable")) {
204
- return;
205
- }
206
- draggable({
207
- element: buttonRef.current,
208
- onGenerateDragPreview: ({ nativeSetDragImage }) => {
209
- disableNativeDragPreview({
210
- nativeSetDragImage
211
- });
212
- preventUnhandled.start();
213
- },
214
- onDragStart: () => {
215
- dragStartSize.current = dragStartSize.current === "min-content" ? measureStackItem(buttonRef.current)[orientation === "horizontal" ? "width" : "height"] / REM : dragStartSize.current;
216
- },
217
- onDrag: ({ location }) => {
218
- if (typeof dragStartSize.current !== "number") {
219
- return;
220
- }
221
- setSize(getNextSize(dragStartSize.current, location, client));
222
- },
223
- onDrop: ({ location }) => {
224
- if (typeof dragStartSize.current !== "number") {
225
- return;
226
- }
227
- const nextSize = getNextSize(dragStartSize.current, location, client);
228
- setSize(nextSize, true);
229
- dragStartSize.current = nextSize;
230
- }
231
- });
232
- }, []);
233
- return /* @__PURE__ */ React5.createElement("button", {
234
- ref: buttonRef,
235
- className: mx4(orientation === "horizontal" ? "cursor-col-resize" : "cursor-row-resize", "group absolute is-3 bs-full inline-end-[-1px] !border-lb-0", "before:transition-opacity before:duration-100 before:ease-in-out before:opacity-0 hover:before:opacity-100 focus-visible:before:opacity-100 active:before:opacity-100", "before:absolute before:block before:inset-block-0 before:inline-end-0 before:is-1 before:bg-accentFocusIndicator")
236
- }, /* @__PURE__ */ React5.createElement("div", {
237
- role: "none",
238
- className: "absolute block-start-0 inline-end-[1px] bs-[--rail-size] flex items-center group-hover:opacity-0 group-focus-visible:opacity-0 group-active:opacity-0"
239
- }, /* @__PURE__ */ React5.createElement(DragHandleSignifier, null)));
240
- };
241
- var DragHandleSignifier = () => {
242
- return /* @__PURE__ */ React5.createElement("svg", {
243
- xmlns: "http://www.w3.org/2000/svg",
244
- viewBox: "0 0 256 256",
245
- fill: "currentColor",
246
- className: "shrink-0 bs-[1em] is-[1em] text-unAccent"
247
- }, /* @__PURE__ */ React5.createElement("path", {
248
- d: "M256,64c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
249
- }), /* @__PURE__ */ React5.createElement("path", {
250
- d: "M256,120c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
251
- }), /* @__PURE__ */ React5.createElement("path", {
252
- d: "M256,176c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
253
- }), /* @__PURE__ */ React5.createElement("path", {
254
- d: "M256,232c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
255
- }));
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
+ });
256
242
  };
257
243
 
258
244
  // packages/ui/react-ui-stack/src/components/StackItemSigil.tsx
259
- import React7, { Fragment, forwardRef as forwardRef4, useRef as useRef2, useState as useState2 } from "react";
245
+ import React7, { Fragment, forwardRef as forwardRef4, useRef, useState as useState3 } from "react";
260
246
  import { keySymbols } from "@dxos/keyboard";
261
- import { Button, DropdownMenu, Icon, toLocalizedString, Tooltip, useTranslation } from "@dxos/react-ui";
247
+ import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
262
248
  import { useAttention as useAttention2 } from "@dxos/react-ui-attention";
263
- import { descriptionText, mx as mx5 } from "@dxos/react-ui-theme";
249
+ import { descriptionText, mx as mx4 } from "@dxos/react-ui-theme";
264
250
  import { getHostPlatform } from "@dxos/util";
265
251
 
266
252
  // packages/ui/react-ui-stack/src/components/MenuSignifier.tsx
@@ -309,7 +295,7 @@ var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNam
309
295
  ...props,
310
296
  variant,
311
297
  classNames: [
312
- "shrink-0 pli-0 min-bs-0 is-[--rail-action] bs-[--rail-action] relative",
298
+ "shrink-0 pli-0 min-bs-0 is-[--rail-action] bs-[--rail-action] relative app-no-drag",
313
299
  classNames
314
300
  ],
315
301
  ref: forwardedRef
@@ -317,20 +303,25 @@ var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNam
317
303
  });
318
304
  var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
319
305
  const { t } = useTranslation(translationKey);
320
- const suppressNextTooltip = useRef2(false);
321
- const [optionsMenuOpen, setOptionsMenuOpen] = useState2(false);
322
- const [triggerTooltipOpen, setTriggerTooltipOpen] = useState2(false);
323
- return /* @__PURE__ */ React7.createElement(Tooltip.Root, {
324
- open: triggerTooltipOpen,
325
- onOpenChange: (nextOpen) => {
326
- if (suppressNextTooltip.current) {
327
- setTriggerTooltipOpen(false);
328
- suppressNextTooltip.current = false;
329
- } else {
330
- setTriggerTooltipOpen(nextOpen);
331
- }
332
- }
333
- }, /* @__PURE__ */ React7.createElement(DropdownMenu.Root, {
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
+ // TODO(wittjosiah): Better disabling of interactive styles when no action are available.
313
+ // Remove underscore icon when no actions are available?
314
+ classNames: !hasActions && "cursor-default"
315
+ }, /* @__PURE__ */ React7.createElement("span", {
316
+ className: "sr-only"
317
+ }, triggerLabel), /* @__PURE__ */ React7.createElement(Icon, {
318
+ icon,
319
+ size: 5
320
+ }));
321
+ if (!hasActions) {
322
+ return button;
323
+ }
324
+ return /* @__PURE__ */ React7.createElement(DropdownMenu.Root, {
334
325
  open: optionsMenuOpen,
335
326
  onOpenChange: (nextOpen) => {
336
327
  if (!nextOpen) {
@@ -338,20 +329,10 @@ var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAct
338
329
  }
339
330
  return setOptionsMenuOpen(nextOpen);
340
331
  }
341
- }, /* @__PURE__ */ React7.createElement(Tooltip.Trigger, {
342
- asChild: true
343
332
  }, /* @__PURE__ */ React7.createElement(DropdownMenu.Trigger, {
344
333
  asChild: true,
345
334
  ref: forwardedRef
346
- }, /* @__PURE__ */ React7.createElement(StackItemSigilButton, {
347
- attendableId,
348
- related
349
- }, /* @__PURE__ */ React7.createElement("span", {
350
- className: "sr-only"
351
- }, triggerLabel), /* @__PURE__ */ React7.createElement(Icon, {
352
- icon,
353
- size: 5
354
- })))), /* @__PURE__ */ React7.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React7.createElement(DropdownMenu.Content, {
335
+ }, button), /* @__PURE__ */ React7.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React7.createElement(DropdownMenu.Content, {
355
336
  classNames: "z-[31]"
356
337
  }, /* @__PURE__ */ React7.createElement(DropdownMenu.Viewport, null, actionGroups?.map((actions, index) => {
357
338
  const separator = index > 0 ? /* @__PURE__ */ React7.createElement(DropdownMenu.Separator, null) : null;
@@ -389,24 +370,22 @@ var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAct
389
370
  icon: "ph--check--regular",
390
371
  size: 4
391
372
  })), shortcut && /* @__PURE__ */ React7.createElement("span", {
392
- className: mx5("shrink-0", descriptionText)
373
+ className: mx4("shrink-0", descriptionText)
393
374
  }, keySymbols(shortcut).join("")));
394
375
  }));
395
- }), children), /* @__PURE__ */ React7.createElement(DropdownMenu.Arrow, null)))), /* @__PURE__ */ React7.createElement(Tooltip.Portal, null, /* @__PURE__ */ React7.createElement(Tooltip.Content, {
396
- side: "bottom"
397
- }, triggerLabel, /* @__PURE__ */ React7.createElement(Tooltip.Arrow, null))));
376
+ }), children), /* @__PURE__ */ React7.createElement(DropdownMenu.Arrow, null))));
398
377
  });
399
378
 
400
379
  // packages/ui/react-ui-stack/src/components/StackItem.tsx
401
380
  var DEFAULT_HORIZONTAL_SIZE = 44;
402
381
  var DEFAULT_VERTICAL_SIZE = "min-content";
403
382
  var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
404
- var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, size: propsSize, onSizeChange, role, order, style, ...props }, forwardedRef) => {
405
- const [itemElement, itemRef] = useState3(null);
406
- const [selfDragHandleElement, selfDragHandleRef] = useState3(null);
407
- const [closestEdge, setEdge] = useState3(null);
383
+ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, size: propsSize, onSizeChange, role, order, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
384
+ const [itemElement, itemRef] = useState4(null);
385
+ const [selfDragHandleElement, selfDragHandleRef] = useState4(null);
386
+ const [closestEdge, setEdge] = useState4(null);
408
387
  const { orientation, rail, onRearrange } = useStack();
409
- const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = useState3(propsSize);
388
+ const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = useState4(propsSize);
410
389
  const Root = role ?? "div";
411
390
  const composedItemRef = composeRefs2(itemRef, forwardedRef);
412
391
  const setSize = useCallback((nextSize, commit) => {
@@ -418,11 +397,11 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
418
397
  onSizeChange
419
398
  ]);
420
399
  const type = orientation === "horizontal" ? "column" : "card";
421
- useLayoutEffect3(() => {
422
- if (!itemElement || !onRearrange) {
400
+ useLayoutEffect2(() => {
401
+ if (!itemElement || !onRearrange || disableRearrange) {
423
402
  return;
424
403
  }
425
- return combine(draggable2({
404
+ return combine2(draggable({
426
405
  element: itemElement,
427
406
  ...selfDragHandleElement && {
428
407
  dragHandle: selfDragHandleElement
@@ -431,12 +410,25 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
431
410
  id: item.id,
432
411
  type
433
412
  }),
434
- // TODO(thure): tabster focus honeypots are causing the preview to render with the wrong dimensions; what do?
435
- onGenerateDragPreview: ({ nativeSetDragImage }) => {
436
- disableNativeDragPreview2({
437
- nativeSetDragImage
413
+ onGenerateDragPreview: ({ nativeSetDragImage, source, location }) => {
414
+ document.body.setAttribute("data-drag-preview", "true");
415
+ scrollJustEnoughIntoView({
416
+ element: source.element
438
417
  });
439
- preventUnhandled2.start();
418
+ const { x, y } = preserveOffsetOnSource({
419
+ element: source.element,
420
+ input: location.current.input
421
+ })({
422
+ container: source.element.offsetParent ?? document.body
423
+ });
424
+ nativeSetDragImage?.(source.element, x, y);
425
+ },
426
+ onDragStart: () => {
427
+ document.body.removeAttribute("data-drag-preview");
428
+ itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "active");
429
+ },
430
+ onDrop: () => {
431
+ itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "idle");
440
432
  }
441
433
  }), dropTargetForElements2({
442
434
  element: itemElement,
@@ -494,12 +486,11 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
494
486
  ...props,
495
487
  tabIndex: 0,
496
488
  ...focusGroupAttrs,
497
- className: mx6("group/stack-item grid relative ch-focus-ring-inset-over-all", size === "min-content" && (orientation === "horizontal" ? "is-min" : "bs-min"), orientation === "horizontal" ? "grid-rows-subgrid" : "grid-cols-subgrid", rail && (orientation === "horizontal" ? "row-span-2" : "col-span-2"), classNames),
489
+ 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),
498
490
  "data-dx-stack-item": true,
491
+ ...resizeAttributes,
499
492
  style: {
500
- ...size !== "min-content" && {
501
- [orientation === "horizontal" ? "inlineSize" : "blockSize"]: `${size}rem`
502
- },
493
+ ...sizeStyle(size, orientation),
503
494
  ...Number.isFinite(order) && {
504
495
  [orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
505
496
  },
@@ -507,6 +498,8 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
507
498
  },
508
499
  ref: composedItemRef
509
500
  }, children, closestEdge && /* @__PURE__ */ React8.createElement(ListItem2.DropIndicator, {
501
+ lineInset: 8,
502
+ terminalInset: -8,
510
503
  edge: closestEdge
511
504
  })));
512
505
  });
@@ -523,9 +516,9 @@ var StackItem = {
523
516
 
524
517
  // packages/ui/react-ui-stack/src/components/LayoutControls.tsx
525
518
  import React9, { forwardRef as forwardRef6 } from "react";
526
- import { Button as Button2, ButtonGroup, Icon as Icon2, Tooltip as Tooltip2, useTranslation as useTranslation2 } from "@dxos/react-ui";
519
+ import { Button as Button2, ButtonGroup, Icon as Icon2, Tooltip, useTranslation as useTranslation2 } from "@dxos/react-ui";
527
520
  var LayoutControl = ({ icon, label, ...props }) => {
528
- return /* @__PURE__ */ React9.createElement(Tooltip2.Root, null, /* @__PURE__ */ React9.createElement(Tooltip2.Trigger, {
521
+ return /* @__PURE__ */ React9.createElement(Tooltip.Root, null, /* @__PURE__ */ React9.createElement(Tooltip.Trigger, {
529
522
  asChild: true
530
523
  }, /* @__PURE__ */ React9.createElement(Button2, {
531
524
  variant: "ghost",
@@ -534,7 +527,7 @@ var LayoutControl = ({ icon, label, ...props }) => {
534
527
  className: "sr-only"
535
528
  }, label), /* @__PURE__ */ React9.createElement(Icon2, {
536
529
  icon
537
- }))), /* @__PURE__ */ React9.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React9.createElement(Tooltip2.Content, {
530
+ }))), /* @__PURE__ */ React9.createElement(Tooltip.Portal, null, /* @__PURE__ */ React9.createElement(Tooltip.Content, {
538
531
  side: "bottom"
539
532
  }, label)));
540
533
  };
@@ -595,8 +588,11 @@ export {
595
588
  StackContext,
596
589
  StackItem,
597
590
  StackItemContext,
591
+ autoScrollRootAttributes,
598
592
  railGridHorizontal,
593
+ railGridHorizontalContainFitContent,
599
594
  railGridVertical,
595
+ railGridVerticalContainFitContent,
600
596
  translations_default as translations,
601
597
  useStack,
602
598
  useStackItem