@dxos/react-ui-stack 0.7.5-main.ff8607b → 0.7.5-staging.2ff1350
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,13 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// packages/ui/react-ui-stack/src/components/Stack.tsx
|
|
4
|
-
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
5
|
-
import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
6
|
-
import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
|
7
|
-
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
8
4
|
import { useArrowNavigationGroup } from "@fluentui/react-tabster";
|
|
9
5
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
10
|
-
import React, { Children, forwardRef,
|
|
6
|
+
import React, { Children, forwardRef, useState as useState2, useMemo } from "react";
|
|
11
7
|
import { ListItem } from "@dxos/react-ui";
|
|
12
8
|
import { mx } from "@dxos/react-ui-theme";
|
|
13
9
|
|
|
@@ -28,38 +24,28 @@ var StackItemContext = /* @__PURE__ */ createContext({
|
|
|
28
24
|
});
|
|
29
25
|
var useStackItem = () => useContext(StackItemContext);
|
|
30
26
|
|
|
31
|
-
// packages/ui/react-ui-stack/src/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
var
|
|
38
|
-
const [stackElement, stackRef] = useState(null);
|
|
39
|
-
const composedItemRef = composeRefs(stackRef, forwardedRef);
|
|
27
|
+
// packages/ui/react-ui-stack/src/hooks/useStackDropForElements.ts
|
|
28
|
+
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
29
|
+
import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
30
|
+
import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
|
31
|
+
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
32
|
+
import { useLayoutEffect, useState } from "react";
|
|
33
|
+
var useStackDropForElements = ({ element, selfDroppable, orientation, id, onRearrange }) => {
|
|
40
34
|
const [dropping, setDropping] = useState(false);
|
|
41
|
-
const arrowNavigationGroup = useArrowNavigationGroup({
|
|
42
|
-
axis: orientation
|
|
43
|
-
});
|
|
44
|
-
const styles = {
|
|
45
|
-
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: `repeat(${itemsCount}, min-content)`,
|
|
46
|
-
...style
|
|
47
|
-
};
|
|
48
|
-
const selfDroppable = !!(itemsCount < 1 && onRearrange && props.id);
|
|
49
35
|
useLayoutEffect(() => {
|
|
50
|
-
if (!
|
|
36
|
+
if (!element || !selfDroppable) {
|
|
51
37
|
return;
|
|
52
38
|
}
|
|
53
39
|
const acceptSourceType = orientation === "horizontal" ? "column" : "card";
|
|
54
40
|
return combine(dropTargetForElements({
|
|
55
|
-
element
|
|
56
|
-
getData: ({ input, element }) => {
|
|
41
|
+
element,
|
|
42
|
+
getData: ({ input, element: element2 }) => {
|
|
57
43
|
return attachClosestEdge({
|
|
58
|
-
id
|
|
44
|
+
id,
|
|
59
45
|
type: orientation === "horizontal" ? "card" : "column"
|
|
60
46
|
}, {
|
|
61
47
|
input,
|
|
62
|
-
element,
|
|
48
|
+
element: element2,
|
|
63
49
|
allowedEdges: [
|
|
64
50
|
orientation === "horizontal" ? "left" : "top"
|
|
65
51
|
]
|
|
@@ -75,21 +61,70 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
75
61
|
setDropping(true);
|
|
76
62
|
}
|
|
77
63
|
},
|
|
78
|
-
onDragLeave: () =>
|
|
64
|
+
onDragLeave: () => {
|
|
65
|
+
return setDropping(false);
|
|
66
|
+
},
|
|
79
67
|
onDrop: ({ self, source }) => {
|
|
80
68
|
setDropping(false);
|
|
81
|
-
if (source.data.type === acceptSourceType && selfDroppable) {
|
|
69
|
+
if (source.data.type === acceptSourceType && selfDroppable && onRearrange) {
|
|
82
70
|
onRearrange(source.data, self.data, extractClosestEdge(self.data));
|
|
83
71
|
}
|
|
84
72
|
}
|
|
85
73
|
}), autoScrollForElements({
|
|
86
|
-
element
|
|
74
|
+
element,
|
|
87
75
|
getAllowedAxis: () => orientation
|
|
88
76
|
}));
|
|
89
77
|
}, [
|
|
90
|
-
|
|
78
|
+
element,
|
|
79
|
+
selfDroppable,
|
|
80
|
+
orientation,
|
|
81
|
+
id,
|
|
82
|
+
onRearrange
|
|
83
|
+
]);
|
|
84
|
+
return {
|
|
85
|
+
dropping
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// packages/ui/react-ui-stack/src/components/Stack.tsx
|
|
90
|
+
var railGridHorizontal = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
|
|
91
|
+
var railGridVertical = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
|
|
92
|
+
var railGridHorizontalContainFitContent = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_fit-content(calc(100%-var(--rail-size)*2+2px))_[content-end]]";
|
|
93
|
+
var railGridVerticalContainFitContent = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_fit-content(calc(100%-var(--rail-size)*2+2px))_[content-end]]";
|
|
94
|
+
var autoScrollRootAttributes = {
|
|
95
|
+
"data-drag-autoscroll": "idle"
|
|
96
|
+
};
|
|
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 arrowNavigationGroup = 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,
|
|
91
111
|
selfDroppable,
|
|
92
|
-
orientation
|
|
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
|
|
93
128
|
]);
|
|
94
129
|
return /* @__PURE__ */ React.createElement(StackContext.Provider, {
|
|
95
130
|
value: {
|
|
@@ -101,7 +136,7 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
101
136
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
102
137
|
...props,
|
|
103
138
|
...arrowNavigationGroup,
|
|
104
|
-
className: mx("grid relative",
|
|
139
|
+
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),
|
|
105
140
|
"data-rail": rail,
|
|
106
141
|
"aria-orientation": orientation,
|
|
107
142
|
style: styles,
|
|
@@ -116,15 +151,16 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
116
151
|
|
|
117
152
|
// packages/ui/react-ui-stack/src/components/StackItem.tsx
|
|
118
153
|
import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
119
|
-
import { draggable
|
|
154
|
+
import { draggable, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
120
155
|
import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
|
|
121
156
|
import { scrollJustEnoughIntoView } from "@atlaskit/pragmatic-drag-and-drop/element/scroll-just-enough-into-view";
|
|
122
157
|
import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
123
158
|
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
124
159
|
import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
|
|
125
|
-
import React8, { forwardRef as forwardRef5, useLayoutEffect as
|
|
160
|
+
import React8, { forwardRef as forwardRef5, useLayoutEffect as useLayoutEffect2, useState as useState4, useCallback } from "react";
|
|
126
161
|
import { ListItem as ListItem2 } from "@dxos/react-ui";
|
|
127
|
-
import {
|
|
162
|
+
import { resizeAttributes, sizeStyle } from "@dxos/react-ui-dnd";
|
|
163
|
+
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
128
164
|
|
|
129
165
|
// packages/ui/react-ui-stack/src/components/StackItemContent.tsx
|
|
130
166
|
import React2, { forwardRef as forwardRef2 } from "react";
|
|
@@ -191,94 +227,28 @@ var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related
|
|
|
191
227
|
});
|
|
192
228
|
|
|
193
229
|
// packages/ui/react-ui-stack/src/components/StackItemResizeHandle.tsx
|
|
194
|
-
import
|
|
195
|
-
import {
|
|
196
|
-
import { preventUnhandled } from "@atlaskit/pragmatic-drag-and-drop/prevent-unhandled";
|
|
197
|
-
import React5, { useLayoutEffect as useLayoutEffect2, useRef } from "react";
|
|
198
|
-
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
199
|
-
var REM = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
230
|
+
import React5 from "react";
|
|
231
|
+
import { ResizeHandle } from "@dxos/react-ui-dnd";
|
|
200
232
|
var MIN_WIDTH = 20;
|
|
201
233
|
var MIN_HEIGHT = 3;
|
|
202
|
-
var measureStackItem = (element) => {
|
|
203
|
-
const stackItemElement = element.closest("[data-dx-stack-item]");
|
|
204
|
-
return stackItemElement?.getBoundingClientRect() ?? {
|
|
205
|
-
width: DEFAULT_EXTRINSIC_SIZE,
|
|
206
|
-
height: DEFAULT_EXTRINSIC_SIZE
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
var getNextSize = (startSize, location, client) => {
|
|
210
|
-
return Math.max(client === "clientX" ? MIN_WIDTH : MIN_HEIGHT, startSize + (location.current.input[client] - location.initial.input[client]) / REM);
|
|
211
|
-
};
|
|
212
234
|
var StackItemResizeHandle = () => {
|
|
213
235
|
const { orientation } = useStack();
|
|
214
236
|
const { setSize, size } = useStackItem();
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
draggable({
|
|
223
|
-
element: buttonRef.current,
|
|
224
|
-
onGenerateDragPreview: ({ nativeSetDragImage }) => {
|
|
225
|
-
disableNativeDragPreview({
|
|
226
|
-
nativeSetDragImage
|
|
227
|
-
});
|
|
228
|
-
preventUnhandled.start();
|
|
229
|
-
},
|
|
230
|
-
onDragStart: () => {
|
|
231
|
-
dragStartSize.current = dragStartSize.current === "min-content" ? measureStackItem(buttonRef.current)[orientation === "horizontal" ? "width" : "height"] / REM : dragStartSize.current;
|
|
232
|
-
},
|
|
233
|
-
onDrag: ({ location }) => {
|
|
234
|
-
if (typeof dragStartSize.current !== "number") {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
setSize(getNextSize(dragStartSize.current, location, client));
|
|
238
|
-
},
|
|
239
|
-
onDrop: ({ location }) => {
|
|
240
|
-
if (typeof dragStartSize.current !== "number") {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
const nextSize = getNextSize(dragStartSize.current, location, client);
|
|
244
|
-
setSize(nextSize, true);
|
|
245
|
-
dragStartSize.current = nextSize;
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}, []);
|
|
249
|
-
return /* @__PURE__ */ React5.createElement("button", {
|
|
250
|
-
ref: buttonRef,
|
|
251
|
-
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")
|
|
252
|
-
}, /* @__PURE__ */ React5.createElement("div", {
|
|
253
|
-
role: "none",
|
|
254
|
-
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")
|
|
255
|
-
}, /* @__PURE__ */ React5.createElement(DragHandleSignifier, {
|
|
256
|
-
orientation
|
|
257
|
-
})));
|
|
258
|
-
};
|
|
259
|
-
var DragHandleSignifier = ({ orientation }) => {
|
|
260
|
-
return /* @__PURE__ */ React5.createElement("svg", {
|
|
261
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
262
|
-
viewBox: "0 0 256 256",
|
|
263
|
-
fill: "currentColor",
|
|
264
|
-
className: mx4("shrink-0 bs-[1em] is-[1em] text-unAccent", orientation === "vertical" && "rotate-90")
|
|
265
|
-
}, /* @__PURE__ */ React5.createElement("path", {
|
|
266
|
-
d: "M256,64c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
267
|
-
}), /* @__PURE__ */ React5.createElement("path", {
|
|
268
|
-
d: "M256,120c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
269
|
-
}), /* @__PURE__ */ React5.createElement("path", {
|
|
270
|
-
d: "M256,176c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
271
|
-
}), /* @__PURE__ */ React5.createElement("path", {
|
|
272
|
-
d: "M256,232c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
273
|
-
}));
|
|
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
|
+
});
|
|
274
244
|
};
|
|
275
245
|
|
|
276
246
|
// packages/ui/react-ui-stack/src/components/StackItemSigil.tsx
|
|
277
|
-
import React7, { Fragment, forwardRef as forwardRef4, useRef
|
|
247
|
+
import React7, { Fragment, forwardRef as forwardRef4, useRef, useState as useState3 } from "react";
|
|
278
248
|
import { keySymbols } from "@dxos/keyboard";
|
|
279
249
|
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
280
250
|
import { useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
281
|
-
import { descriptionText, mx as
|
|
251
|
+
import { descriptionText, mx as mx4 } from "@dxos/react-ui-theme";
|
|
282
252
|
import { getHostPlatform } from "@dxos/util";
|
|
283
253
|
|
|
284
254
|
// packages/ui/react-ui-stack/src/components/MenuSignifier.tsx
|
|
@@ -335,8 +305,8 @@ var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNam
|
|
|
335
305
|
});
|
|
336
306
|
var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
337
307
|
const { t } = useTranslation(translationKey);
|
|
338
|
-
const suppressNextTooltip =
|
|
339
|
-
const [optionsMenuOpen, setOptionsMenuOpen] =
|
|
308
|
+
const suppressNextTooltip = useRef(false);
|
|
309
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = useState3(false);
|
|
340
310
|
const hasActions = actionGroups && actionGroups.length > 0;
|
|
341
311
|
const button = /* @__PURE__ */ React7.createElement(StackItemSigilButton, {
|
|
342
312
|
attendableId,
|
|
@@ -402,7 +372,7 @@ var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAct
|
|
|
402
372
|
icon: "ph--check--regular",
|
|
403
373
|
size: 4
|
|
404
374
|
})), shortcut && /* @__PURE__ */ React7.createElement("span", {
|
|
405
|
-
className:
|
|
375
|
+
className: mx4("shrink-0", descriptionText)
|
|
406
376
|
}, keySymbols(shortcut).join("")));
|
|
407
377
|
}));
|
|
408
378
|
}), children), /* @__PURE__ */ React7.createElement(DropdownMenu.Arrow, null))));
|
|
@@ -413,11 +383,11 @@ var DEFAULT_HORIZONTAL_SIZE = 44;
|
|
|
413
383
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
414
384
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
415
385
|
var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, size: propsSize, onSizeChange, role, order, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
416
|
-
const [itemElement, itemRef] =
|
|
417
|
-
const [selfDragHandleElement, selfDragHandleRef] =
|
|
418
|
-
const [closestEdge, setEdge] =
|
|
386
|
+
const [itemElement, itemRef] = useState4(null);
|
|
387
|
+
const [selfDragHandleElement, selfDragHandleRef] = useState4(null);
|
|
388
|
+
const [closestEdge, setEdge] = useState4(null);
|
|
419
389
|
const { orientation, rail, onRearrange } = useStack();
|
|
420
|
-
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] =
|
|
390
|
+
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = useState4(propsSize);
|
|
421
391
|
const Root = role ?? "div";
|
|
422
392
|
const composedItemRef = composeRefs2(itemRef, forwardedRef);
|
|
423
393
|
const setSize = useCallback((nextSize, commit) => {
|
|
@@ -429,11 +399,11 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
|
|
|
429
399
|
onSizeChange
|
|
430
400
|
]);
|
|
431
401
|
const type = orientation === "horizontal" ? "column" : "card";
|
|
432
|
-
|
|
402
|
+
useLayoutEffect2(() => {
|
|
433
403
|
if (!itemElement || !onRearrange || disableRearrange) {
|
|
434
404
|
return;
|
|
435
405
|
}
|
|
436
|
-
return combine2(
|
|
406
|
+
return combine2(draggable({
|
|
437
407
|
element: itemElement,
|
|
438
408
|
...selfDragHandleElement && {
|
|
439
409
|
dragHandle: selfDragHandleElement
|
|
@@ -518,12 +488,11 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
|
|
|
518
488
|
...props,
|
|
519
489
|
tabIndex: 0,
|
|
520
490
|
...focusGroupAttrs,
|
|
521
|
-
className:
|
|
491
|
+
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),
|
|
522
492
|
"data-dx-stack-item": true,
|
|
493
|
+
...resizeAttributes,
|
|
523
494
|
style: {
|
|
524
|
-
...size
|
|
525
|
-
[orientation === "horizontal" ? "inlineSize" : "blockSize"]: `${size}rem`
|
|
526
|
-
},
|
|
495
|
+
...sizeStyle(size, orientation),
|
|
527
496
|
...Number.isFinite(order) && {
|
|
528
497
|
[orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
|
|
529
498
|
},
|
|
@@ -623,7 +592,9 @@ export {
|
|
|
623
592
|
StackItemContext,
|
|
624
593
|
autoScrollRootAttributes,
|
|
625
594
|
railGridHorizontal,
|
|
595
|
+
railGridHorizontalContainFitContent,
|
|
626
596
|
railGridVertical,
|
|
597
|
+
railGridVerticalContainFitContent,
|
|
627
598
|
translations_default as translations,
|
|
628
599
|
useStack,
|
|
629
600
|
useStackItem
|