@dxos/react-ui-stack 0.7.5-main.ff8607b → 0.7.5-staging.b81e783
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +97 -126
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +143 -172
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +97 -126
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/MenuSignifier.d.ts +2 -3
- package/dist/types/src/components/MenuSignifier.d.ts.map +1 -1
- package/dist/types/src/components/Stack.d.ts +3 -1
- package/dist/types/src/components/Stack.d.ts.map +1 -1
- package/dist/types/src/components/Stack.stories.d.ts +1 -2
- package/dist/types/src/components/Stack.stories.d.ts.map +1 -1
- package/dist/types/src/components/StackContext.d.ts +2 -1
- package/dist/types/src/components/StackContext.d.ts.map +1 -1
- package/dist/types/src/components/StackItem.d.ts +3 -3
- package/dist/types/src/components/StackItem.d.ts.map +1 -1
- package/dist/types/src/components/StackItemContent.d.ts.map +1 -1
- package/dist/types/src/components/StackItemDragHandle.d.ts +2 -2
- package/dist/types/src/components/StackItemDragHandle.d.ts.map +1 -1
- package/dist/types/src/components/StackItemHeading.d.ts +1 -1
- package/dist/types/src/components/StackItemHeading.d.ts.map +1 -1
- package/dist/types/src/components/StackItemResizeHandle.d.ts +1 -2
- package/dist/types/src/components/StackItemResizeHandle.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useStackDropForElements.d.ts +15 -0
- package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -0
- package/package.json +21 -20
- package/src/components/Stack.stories.tsx +1 -1
- package/src/components/Stack.tsx +33 -61
- package/src/components/StackContext.tsx +3 -1
- package/src/components/StackItem.tsx +3 -4
- package/src/components/StackItemContent.tsx +2 -0
- package/src/components/StackItemResizeHandle.tsx +10 -107
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useStackDropForElements.ts +73 -0
- package/dist/types/src/playwright/playwright.config.d.ts +0 -3
- package/dist/types/src/playwright/playwright.config.d.ts.map +0 -1
- /package/src/playwright/{playwright.config.ts → playwright.config.cts} +0 -0
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
// packages/ui/react-ui-stack/src/components/Stack.tsx
|
|
2
|
-
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
3
|
-
import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
4
|
-
import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
|
5
|
-
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
6
2
|
import { useArrowNavigationGroup } from "@fluentui/react-tabster";
|
|
7
3
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
8
|
-
import React, { Children, forwardRef,
|
|
4
|
+
import React, { Children, forwardRef, useState as useState2, useMemo } from "react";
|
|
9
5
|
import { ListItem } from "@dxos/react-ui";
|
|
10
6
|
import { mx } from "@dxos/react-ui-theme";
|
|
11
7
|
|
|
@@ -26,38 +22,28 @@ var StackItemContext = /* @__PURE__ */ createContext({
|
|
|
26
22
|
});
|
|
27
23
|
var useStackItem = () => useContext(StackItemContext);
|
|
28
24
|
|
|
29
|
-
// packages/ui/react-ui-stack/src/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
var
|
|
36
|
-
const [stackElement, stackRef] = useState(null);
|
|
37
|
-
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 }) => {
|
|
38
32
|
const [dropping, setDropping] = useState(false);
|
|
39
|
-
const arrowNavigationGroup = useArrowNavigationGroup({
|
|
40
|
-
axis: orientation
|
|
41
|
-
});
|
|
42
|
-
const styles = {
|
|
43
|
-
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: `repeat(${itemsCount}, min-content)`,
|
|
44
|
-
...style
|
|
45
|
-
};
|
|
46
|
-
const selfDroppable = !!(itemsCount < 1 && onRearrange && props.id);
|
|
47
33
|
useLayoutEffect(() => {
|
|
48
|
-
if (!
|
|
34
|
+
if (!element || !selfDroppable) {
|
|
49
35
|
return;
|
|
50
36
|
}
|
|
51
37
|
const acceptSourceType = orientation === "horizontal" ? "column" : "card";
|
|
52
38
|
return combine(dropTargetForElements({
|
|
53
|
-
element
|
|
54
|
-
getData: ({ input, element }) => {
|
|
39
|
+
element,
|
|
40
|
+
getData: ({ input, element: element2 }) => {
|
|
55
41
|
return attachClosestEdge({
|
|
56
|
-
id
|
|
42
|
+
id,
|
|
57
43
|
type: orientation === "horizontal" ? "card" : "column"
|
|
58
44
|
}, {
|
|
59
45
|
input,
|
|
60
|
-
element,
|
|
46
|
+
element: element2,
|
|
61
47
|
allowedEdges: [
|
|
62
48
|
orientation === "horizontal" ? "left" : "top"
|
|
63
49
|
]
|
|
@@ -73,21 +59,70 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
73
59
|
setDropping(true);
|
|
74
60
|
}
|
|
75
61
|
},
|
|
76
|
-
onDragLeave: () =>
|
|
62
|
+
onDragLeave: () => {
|
|
63
|
+
return setDropping(false);
|
|
64
|
+
},
|
|
77
65
|
onDrop: ({ self, source }) => {
|
|
78
66
|
setDropping(false);
|
|
79
|
-
if (source.data.type === acceptSourceType && selfDroppable) {
|
|
67
|
+
if (source.data.type === acceptSourceType && selfDroppable && onRearrange) {
|
|
80
68
|
onRearrange(source.data, self.data, extractClosestEdge(self.data));
|
|
81
69
|
}
|
|
82
70
|
}
|
|
83
71
|
}), autoScrollForElements({
|
|
84
|
-
element
|
|
72
|
+
element,
|
|
85
73
|
getAllowedAxis: () => orientation
|
|
86
74
|
}));
|
|
87
75
|
}, [
|
|
88
|
-
|
|
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,
|
|
89
109
|
selfDroppable,
|
|
90
|
-
orientation
|
|
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
|
|
91
126
|
]);
|
|
92
127
|
return /* @__PURE__ */ React.createElement(StackContext.Provider, {
|
|
93
128
|
value: {
|
|
@@ -99,7 +134,7 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
99
134
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
100
135
|
...props,
|
|
101
136
|
...arrowNavigationGroup,
|
|
102
|
-
className: mx("grid relative",
|
|
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),
|
|
103
138
|
"data-rail": rail,
|
|
104
139
|
"aria-orientation": orientation,
|
|
105
140
|
style: styles,
|
|
@@ -114,15 +149,16 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
114
149
|
|
|
115
150
|
// packages/ui/react-ui-stack/src/components/StackItem.tsx
|
|
116
151
|
import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
117
|
-
import { draggable
|
|
152
|
+
import { draggable, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
118
153
|
import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
|
|
119
154
|
import { scrollJustEnoughIntoView } from "@atlaskit/pragmatic-drag-and-drop/element/scroll-just-enough-into-view";
|
|
120
155
|
import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
121
156
|
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
122
157
|
import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
|
|
123
|
-
import React8, { forwardRef as forwardRef5, useLayoutEffect as
|
|
158
|
+
import React8, { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect2, useState as useState4, useCallback } from "react";
|
|
124
159
|
import { ListItem as ListItem2 } from "@dxos/react-ui";
|
|
125
|
-
import {
|
|
160
|
+
import { resizeAttributes, sizeStyle } from "@dxos/react-ui-dnd";
|
|
161
|
+
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
126
162
|
|
|
127
163
|
// packages/ui/react-ui-stack/src/components/StackItemContent.tsx
|
|
128
164
|
import React2, { forwardRef as forwardRef2 } from "react";
|
|
@@ -189,94 +225,28 @@ var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related
|
|
|
189
225
|
});
|
|
190
226
|
|
|
191
227
|
// packages/ui/react-ui-stack/src/components/StackItemResizeHandle.tsx
|
|
192
|
-
import
|
|
193
|
-
import {
|
|
194
|
-
import { preventUnhandled } from "@atlaskit/pragmatic-drag-and-drop/prevent-unhandled";
|
|
195
|
-
import React5, { useLayoutEffect as useLayoutEffect2, useRef } from "react";
|
|
196
|
-
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
197
|
-
var REM = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
228
|
+
import React5 from "react";
|
|
229
|
+
import { ResizeHandle } from "@dxos/react-ui-dnd";
|
|
198
230
|
var MIN_WIDTH = 20;
|
|
199
231
|
var MIN_HEIGHT = 3;
|
|
200
|
-
var measureStackItem = (element) => {
|
|
201
|
-
const stackItemElement = element.closest("[data-dx-stack-item]");
|
|
202
|
-
return stackItemElement?.getBoundingClientRect() ?? {
|
|
203
|
-
width: DEFAULT_EXTRINSIC_SIZE,
|
|
204
|
-
height: DEFAULT_EXTRINSIC_SIZE
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
var getNextSize = (startSize, location, client) => {
|
|
208
|
-
return Math.max(client === "clientX" ? MIN_WIDTH : MIN_HEIGHT, startSize + (location.current.input[client] - location.initial.input[client]) / REM);
|
|
209
|
-
};
|
|
210
232
|
var StackItemResizeHandle = () => {
|
|
211
233
|
const { orientation } = useStack();
|
|
212
234
|
const { setSize, size } = useStackItem();
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
draggable({
|
|
221
|
-
element: buttonRef.current,
|
|
222
|
-
onGenerateDragPreview: ({ nativeSetDragImage }) => {
|
|
223
|
-
disableNativeDragPreview({
|
|
224
|
-
nativeSetDragImage
|
|
225
|
-
});
|
|
226
|
-
preventUnhandled.start();
|
|
227
|
-
},
|
|
228
|
-
onDragStart: () => {
|
|
229
|
-
dragStartSize.current = dragStartSize.current === "min-content" ? measureStackItem(buttonRef.current)[orientation === "horizontal" ? "width" : "height"] / REM : dragStartSize.current;
|
|
230
|
-
},
|
|
231
|
-
onDrag: ({ location }) => {
|
|
232
|
-
if (typeof dragStartSize.current !== "number") {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
setSize(getNextSize(dragStartSize.current, location, client));
|
|
236
|
-
},
|
|
237
|
-
onDrop: ({ location }) => {
|
|
238
|
-
if (typeof dragStartSize.current !== "number") {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
const nextSize = getNextSize(dragStartSize.current, location, client);
|
|
242
|
-
setSize(nextSize, true);
|
|
243
|
-
dragStartSize.current = nextSize;
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}, []);
|
|
247
|
-
return /* @__PURE__ */ React5.createElement("button", {
|
|
248
|
-
ref: buttonRef,
|
|
249
|
-
className: mx4("group absolute", orientation === "horizontal" ? "cursor-col-resize is-3 bs-full inline-end-[-1px] !border-lb-0 before:inset-block-0 before:inline-end-0 before:is-1" : "cursor-row-resize bs-3 is-full block-end-[-1px] !border-li-0 before:inset-inline-0 before:block-end-0 before:bs-1", "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:bg-accentFocusIndicator")
|
|
250
|
-
}, /* @__PURE__ */ React5.createElement("div", {
|
|
251
|
-
role: "none",
|
|
252
|
-
className: mx4("absolute flex items-center group-hover:opacity-0 group-focus-visible:opacity-0 group-active:opacity-0", orientation === "horizontal" ? "block-start-0 inline-end-px bs-[--rail-size]" : "inline-start-0 block-end-px is-[--rail-size] flex justify-center")
|
|
253
|
-
}, /* @__PURE__ */ React5.createElement(DragHandleSignifier, {
|
|
254
|
-
orientation
|
|
255
|
-
})));
|
|
256
|
-
};
|
|
257
|
-
var DragHandleSignifier = ({ orientation }) => {
|
|
258
|
-
return /* @__PURE__ */ React5.createElement("svg", {
|
|
259
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
260
|
-
viewBox: "0 0 256 256",
|
|
261
|
-
fill: "currentColor",
|
|
262
|
-
className: mx4("shrink-0 bs-[1em] is-[1em] text-unAccent", orientation === "vertical" && "rotate-90")
|
|
263
|
-
}, /* @__PURE__ */ React5.createElement("path", {
|
|
264
|
-
d: "M256,64c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
265
|
-
}), /* @__PURE__ */ React5.createElement("path", {
|
|
266
|
-
d: "M256,120c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
267
|
-
}), /* @__PURE__ */ React5.createElement("path", {
|
|
268
|
-
d: "M256,176c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
269
|
-
}), /* @__PURE__ */ React5.createElement("path", {
|
|
270
|
-
d: "M256,232c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
271
|
-
}));
|
|
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
|
+
});
|
|
272
242
|
};
|
|
273
243
|
|
|
274
244
|
// packages/ui/react-ui-stack/src/components/StackItemSigil.tsx
|
|
275
|
-
import React7, { Fragment, forwardRef as forwardRef4, useRef
|
|
245
|
+
import React7, { Fragment, forwardRef as forwardRef4, useRef, useState as useState3 } from "react";
|
|
276
246
|
import { keySymbols } from "@dxos/keyboard";
|
|
277
247
|
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
278
248
|
import { useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
279
|
-
import { descriptionText, mx as
|
|
249
|
+
import { descriptionText, mx as mx4 } from "@dxos/react-ui-theme";
|
|
280
250
|
import { getHostPlatform } from "@dxos/util";
|
|
281
251
|
|
|
282
252
|
// packages/ui/react-ui-stack/src/components/MenuSignifier.tsx
|
|
@@ -333,8 +303,8 @@ var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNam
|
|
|
333
303
|
});
|
|
334
304
|
var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
335
305
|
const { t } = useTranslation(translationKey);
|
|
336
|
-
const suppressNextTooltip =
|
|
337
|
-
const [optionsMenuOpen, setOptionsMenuOpen] =
|
|
306
|
+
const suppressNextTooltip = useRef(false);
|
|
307
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = useState3(false);
|
|
338
308
|
const hasActions = actionGroups && actionGroups.length > 0;
|
|
339
309
|
const button = /* @__PURE__ */ React7.createElement(StackItemSigilButton, {
|
|
340
310
|
attendableId,
|
|
@@ -400,7 +370,7 @@ var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAct
|
|
|
400
370
|
icon: "ph--check--regular",
|
|
401
371
|
size: 4
|
|
402
372
|
})), shortcut && /* @__PURE__ */ React7.createElement("span", {
|
|
403
|
-
className:
|
|
373
|
+
className: mx4("shrink-0", descriptionText)
|
|
404
374
|
}, keySymbols(shortcut).join("")));
|
|
405
375
|
}));
|
|
406
376
|
}), children), /* @__PURE__ */ React7.createElement(DropdownMenu.Arrow, null))));
|
|
@@ -411,11 +381,11 @@ var DEFAULT_HORIZONTAL_SIZE = 44;
|
|
|
411
381
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
412
382
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
413
383
|
var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, size: propsSize, onSizeChange, role, order, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
414
|
-
const [itemElement, itemRef] =
|
|
415
|
-
const [selfDragHandleElement, selfDragHandleRef] =
|
|
416
|
-
const [closestEdge, setEdge] =
|
|
384
|
+
const [itemElement, itemRef] = useState4(null);
|
|
385
|
+
const [selfDragHandleElement, selfDragHandleRef] = useState4(null);
|
|
386
|
+
const [closestEdge, setEdge] = useState4(null);
|
|
417
387
|
const { orientation, rail, onRearrange } = useStack();
|
|
418
|
-
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] =
|
|
388
|
+
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = useState4(propsSize);
|
|
419
389
|
const Root = role ?? "div";
|
|
420
390
|
const composedItemRef = composeRefs2(itemRef, forwardedRef);
|
|
421
391
|
const setSize = useCallback((nextSize, commit) => {
|
|
@@ -427,11 +397,11 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
|
|
|
427
397
|
onSizeChange
|
|
428
398
|
]);
|
|
429
399
|
const type = orientation === "horizontal" ? "column" : "card";
|
|
430
|
-
|
|
400
|
+
useLayoutEffect2(() => {
|
|
431
401
|
if (!itemElement || !onRearrange || disableRearrange) {
|
|
432
402
|
return;
|
|
433
403
|
}
|
|
434
|
-
return combine2(
|
|
404
|
+
return combine2(draggable({
|
|
435
405
|
element: itemElement,
|
|
436
406
|
...selfDragHandleElement && {
|
|
437
407
|
dragHandle: selfDragHandleElement
|
|
@@ -516,12 +486,11 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
|
|
|
516
486
|
...props,
|
|
517
487
|
tabIndex: 0,
|
|
518
488
|
...focusGroupAttrs,
|
|
519
|
-
className:
|
|
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),
|
|
520
490
|
"data-dx-stack-item": true,
|
|
491
|
+
...resizeAttributes,
|
|
521
492
|
style: {
|
|
522
|
-
...size
|
|
523
|
-
[orientation === "horizontal" ? "inlineSize" : "blockSize"]: `${size}rem`
|
|
524
|
-
},
|
|
493
|
+
...sizeStyle(size, orientation),
|
|
525
494
|
...Number.isFinite(order) && {
|
|
526
495
|
[orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
|
|
527
496
|
},
|
|
@@ -621,7 +590,9 @@ export {
|
|
|
621
590
|
StackItemContext,
|
|
622
591
|
autoScrollRootAttributes,
|
|
623
592
|
railGridHorizontal,
|
|
593
|
+
railGridHorizontalContainFitContent,
|
|
624
594
|
railGridVertical,
|
|
595
|
+
railGridVerticalContainFitContent,
|
|
625
596
|
translations_default as translations,
|
|
626
597
|
useStack,
|
|
627
598
|
useStackItem
|