@dxos/react-ui-stack 0.8.2-main.f11618f → 0.8.2-staging.42af850
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 +484 -422
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +472 -411
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +484 -422
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/components/{Stack.d.ts → Stack/Stack.d.ts} +4 -1
- package/dist/types/src/components/Stack/Stack.d.ts.map +1 -0
- package/dist/types/src/components/Stack/Stack.stories.d.ts +9 -0
- package/dist/types/src/components/Stack/Stack.stories.d.ts.map +1 -0
- package/dist/types/src/components/Stack/index.d.ts +2 -0
- package/dist/types/src/components/Stack/index.d.ts.map +1 -0
- package/dist/types/src/components/StackContext.d.ts +14 -10
- package/dist/types/src/components/StackContext.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/MenuSignifier.d.ts.map +1 -0
- package/dist/types/src/components/{StackItem.d.ts → StackItem/StackItem.d.ts} +14 -5
- package/dist/types/src/components/StackItem/StackItem.d.ts.map +1 -0
- package/dist/types/src/components/StackItem/StackItem.stories.d.ts +8 -0
- package/dist/types/src/components/StackItem/StackItem.stories.d.ts.map +1 -0
- package/dist/types/src/components/StackItem/StackItemContent.d.ts.map +1 -0
- package/dist/types/src/components/StackItem/StackItemDragHandle.d.ts.map +1 -0
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -0
- package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts.map +1 -0
- package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -0
- package/dist/types/src/components/StackItem/index.d.ts +2 -0
- package/dist/types/src/components/StackItem/index.d.ts.map +1 -0
- package/dist/types/src/components/defs.d.ts +18 -0
- package/dist/types/src/components/defs.d.ts.map +1 -0
- package/dist/types/src/components/deprecated/LayoutControls.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useStackDropForElements.d.ts +3 -4
- package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
- package/dist/types/src/testing/stack-manager.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -20
- package/src/components/{Stack.stories.tsx → Stack/Stack.stories.tsx} +29 -17
- package/src/components/{Stack.tsx → Stack/Stack.tsx} +37 -5
- package/src/components/Stack/index.ts +5 -0
- package/src/components/StackContext.tsx +21 -13
- package/src/components/StackItem/StackItem.stories.tsx +49 -0
- package/src/components/{StackItem.tsx → StackItem/StackItem.tsx} +90 -11
- package/src/components/{StackItemContent.tsx → StackItem/StackItemContent.tsx} +1 -1
- package/src/components/{StackItemDragHandle.tsx → StackItem/StackItemDragHandle.tsx} +1 -1
- package/src/components/{StackItemHeading.tsx → StackItem/StackItemHeading.tsx} +3 -2
- package/src/components/{StackItemResizeHandle.tsx → StackItem/StackItemResizeHandle.tsx} +1 -1
- package/src/components/{StackItemSigil.tsx → StackItem/StackItemSigil.tsx} +3 -15
- package/src/components/StackItem/index.ts +5 -0
- package/src/components/defs.ts +26 -0
- package/src/components/{LayoutControls.tsx → deprecated/LayoutControls.tsx} +3 -23
- package/src/components/index.ts +2 -2
- package/src/hooks/useStackDropForElements.ts +3 -4
- package/src/testing/stack-manager.ts +6 -6
- package/dist/types/src/components/LayoutControls.d.ts.map +0 -1
- package/dist/types/src/components/MenuSignifier.d.ts.map +0 -1
- package/dist/types/src/components/Stack.d.ts.map +0 -1
- package/dist/types/src/components/Stack.stories.d.ts +0 -8
- package/dist/types/src/components/Stack.stories.d.ts.map +0 -1
- package/dist/types/src/components/StackItem.d.ts.map +0 -1
- package/dist/types/src/components/StackItemContent.d.ts.map +0 -1
- package/dist/types/src/components/StackItemDragHandle.d.ts.map +0 -1
- package/dist/types/src/components/StackItemHeading.d.ts.map +0 -1
- package/dist/types/src/components/StackItemResizeHandle.d.ts.map +0 -1
- package/dist/types/src/components/StackItemSigil.d.ts.map +0 -1
- /package/dist/types/src/components/{MenuSignifier.d.ts → StackItem/MenuSignifier.d.ts} +0 -0
- /package/dist/types/src/components/{StackItemContent.d.ts → StackItem/StackItemContent.d.ts} +0 -0
- /package/dist/types/src/components/{StackItemDragHandle.d.ts → StackItem/StackItemDragHandle.d.ts} +0 -0
- /package/dist/types/src/components/{StackItemHeading.d.ts → StackItem/StackItemHeading.d.ts} +0 -0
- /package/dist/types/src/components/{StackItemResizeHandle.d.ts → StackItem/StackItemResizeHandle.d.ts} +0 -0
- /package/dist/types/src/components/{StackItemSigil.d.ts → StackItem/StackItemSigil.d.ts} +0 -0
- /package/dist/types/src/components/{LayoutControls.d.ts → deprecated/LayoutControls.d.ts} +0 -0
- /package/src/components/{MenuSignifier.tsx → StackItem/MenuSignifier.tsx} +0 -0
package/dist/lib/node/index.cjs
CHANGED
|
@@ -31,79 +31,69 @@ __export(node_exports, {
|
|
|
31
31
|
DEFAULT_EXTRINSIC_SIZE: () => DEFAULT_EXTRINSIC_SIZE,
|
|
32
32
|
DEFAULT_HORIZONTAL_SIZE: () => DEFAULT_HORIZONTAL_SIZE,
|
|
33
33
|
DEFAULT_VERTICAL_SIZE: () => DEFAULT_VERTICAL_SIZE,
|
|
34
|
-
LayoutControls: () => LayoutControls,
|
|
35
34
|
Stack: () => Stack,
|
|
36
35
|
StackContext: () => StackContext,
|
|
37
36
|
StackItem: () => StackItem,
|
|
38
|
-
|
|
37
|
+
StackItemDragPreview: () => StackItemDragPreview,
|
|
39
38
|
autoScrollRootAttributes: () => autoScrollRootAttributes,
|
|
40
39
|
railGridHorizontal: () => railGridHorizontal,
|
|
41
40
|
railGridHorizontalContainFitContent: () => railGridHorizontalContainFitContent,
|
|
42
41
|
railGridVertical: () => railGridVertical,
|
|
43
42
|
railGridVerticalContainFitContent: () => railGridVerticalContainFitContent,
|
|
44
|
-
translations: () => translations_default
|
|
45
|
-
useStack: () => useStack,
|
|
46
|
-
useStackItem: () => useStackItem
|
|
43
|
+
translations: () => translations_default
|
|
47
44
|
});
|
|
48
45
|
module.exports = __toCommonJS(node_exports);
|
|
46
|
+
var import_tracking = require("@preact-signals/safe-react/tracking");
|
|
49
47
|
var import_react_tabster = require("@fluentui/react-tabster");
|
|
50
48
|
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
51
49
|
var import_react = __toESM(require("react"));
|
|
52
50
|
var import_react_ui = require("@dxos/react-ui");
|
|
53
51
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
54
|
-
var import_react2 = require("react");
|
|
55
52
|
var import_combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
|
|
56
53
|
var import_adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
57
54
|
var import_element = require("@atlaskit/pragmatic-drag-and-drop-auto-scroll/element");
|
|
58
55
|
var import_closest_edge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
|
|
56
|
+
var import_react2 = require("react");
|
|
59
57
|
var import_react3 = require("react");
|
|
58
|
+
var import_tracking2 = require("@preact-signals/safe-react/tracking");
|
|
60
59
|
var import_combine2 = require("@atlaskit/pragmatic-drag-and-drop/combine");
|
|
61
60
|
var import_adapter2 = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
62
61
|
var import_preserve_offset_on_source = require("@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source");
|
|
63
|
-
var
|
|
62
|
+
var import_set_custom_native_drag_preview = require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview");
|
|
64
63
|
var import_closest_edge2 = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
|
|
65
64
|
var import_react_tabster2 = require("@fluentui/react-tabster");
|
|
66
65
|
var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
|
|
67
66
|
var import_react4 = __toESM(require("react"));
|
|
67
|
+
var import_react_dom = require("react-dom");
|
|
68
68
|
var import_react_ui2 = require("@dxos/react-ui");
|
|
69
69
|
var import_react_ui_dnd = require("@dxos/react-ui-dnd");
|
|
70
70
|
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
71
|
+
var import_tracking3 = require("@preact-signals/safe-react/tracking");
|
|
71
72
|
var import_react5 = __toESM(require("react"));
|
|
72
73
|
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
74
|
+
var import_tracking4 = require("@preact-signals/safe-react/tracking");
|
|
73
75
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
74
76
|
var import_react6 = __toESM(require("react"));
|
|
77
|
+
var import_tracking5 = require("@preact-signals/safe-react/tracking");
|
|
75
78
|
var import_react_tabster3 = require("@fluentui/react-tabster");
|
|
76
79
|
var import_react7 = __toESM(require("react"));
|
|
77
80
|
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
78
81
|
var import_react_ui_theme4 = require("@dxos/react-ui-theme");
|
|
82
|
+
var import_tracking6 = require("@preact-signals/safe-react/tracking");
|
|
79
83
|
var import_react8 = __toESM(require("react"));
|
|
80
84
|
var import_react_ui_dnd2 = require("@dxos/react-ui-dnd");
|
|
85
|
+
var import_tracking7 = require("@preact-signals/safe-react/tracking");
|
|
81
86
|
var import_react9 = __toESM(require("react"));
|
|
82
87
|
var import_keyboard = require("@dxos/keyboard");
|
|
83
88
|
var import_react_ui3 = require("@dxos/react-ui");
|
|
84
89
|
var import_react_ui_attention2 = require("@dxos/react-ui-attention");
|
|
85
90
|
var import_react_ui_theme5 = require("@dxos/react-ui-theme");
|
|
86
91
|
var import_util = require("@dxos/util");
|
|
92
|
+
var import_tracking8 = require("@preact-signals/safe-react/tracking");
|
|
87
93
|
var import_react10 = __toESM(require("react"));
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
orientation: "vertical",
|
|
92
|
-
rail: true,
|
|
93
|
-
size: "intrinsic"
|
|
94
|
-
});
|
|
95
|
-
var useStack = () => (0, import_react2.useContext)(StackContext);
|
|
96
|
-
var StackItemContext = /* @__PURE__ */ (0, import_react2.createContext)({
|
|
97
|
-
selfDragHandleRef: () => {
|
|
98
|
-
},
|
|
99
|
-
size: "min-content",
|
|
100
|
-
setSize: () => {
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
var useStackItem = () => (0, import_react2.useContext)(StackItemContext);
|
|
104
|
-
var useStackDropForElements = ({ element, selfDroppable, orientation, id, onRearrange }) => {
|
|
105
|
-
const [dropping, setDropping] = (0, import_react3.useState)(false);
|
|
106
|
-
(0, import_react3.useLayoutEffect)(() => {
|
|
94
|
+
var useStackDropForElements = ({ id, element, selfDroppable, orientation, onRearrange }) => {
|
|
95
|
+
const [dropping, setDropping] = (0, import_react2.useState)(false);
|
|
96
|
+
(0, import_react2.useLayoutEffect)(() => {
|
|
107
97
|
if (!element || !selfDroppable) {
|
|
108
98
|
return;
|
|
109
99
|
}
|
|
@@ -156,6 +146,26 @@ var useStackDropForElements = ({ element, selfDroppable, orientation, id, onRear
|
|
|
156
146
|
dropping
|
|
157
147
|
};
|
|
158
148
|
};
|
|
149
|
+
var StackContext = /* @__PURE__ */ (0, import_react3.createContext)({
|
|
150
|
+
orientation: "vertical",
|
|
151
|
+
rail: true,
|
|
152
|
+
size: "intrinsic"
|
|
153
|
+
});
|
|
154
|
+
var useStack = () => (0, import_react3.useContext)(StackContext);
|
|
155
|
+
var idle = {
|
|
156
|
+
type: "idle"
|
|
157
|
+
};
|
|
158
|
+
var StackItemContext = /* @__PURE__ */ (0, import_react3.createContext)({
|
|
159
|
+
selfDragHandleRef: () => {
|
|
160
|
+
},
|
|
161
|
+
size: "min-content",
|
|
162
|
+
setSize: () => {
|
|
163
|
+
},
|
|
164
|
+
state: idle,
|
|
165
|
+
setState: () => {
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
var useStackItem = () => (0, import_react3.useContext)(StackItemContext);
|
|
159
169
|
var railGridHorizontal = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
|
|
160
170
|
var railGridVertical = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
|
|
161
171
|
var railGridHorizontalContainFitContent = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_fit-content(calc(100%-var(--rail-size)*2+2px))_[content-end]]";
|
|
@@ -163,141 +173,197 @@ var railGridVerticalContainFitContent = "grid-cols-[[rail-start]_var(--rail-size
|
|
|
163
173
|
var autoScrollRootAttributes = {
|
|
164
174
|
"data-drag-autoscroll": "idle"
|
|
165
175
|
};
|
|
166
|
-
var Stack = /* @__PURE__ */ (0, import_react.forwardRef)(({ children, classNames, style, orientation = "vertical", rail = true, size = "intrinsic", onRearrange, itemsCount = import_react.Children.count(children), ...props }, forwardedRef) => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
});
|
|
184
|
-
const gridClasses = (0, import_react.useMemo)(() => {
|
|
185
|
-
if (!rail) {
|
|
186
|
-
return orientation === "horizontal" ? "grid-rows-1 pli-1" : "grid-cols-1 plb-1";
|
|
187
|
-
}
|
|
188
|
-
if (orientation === "horizontal") {
|
|
189
|
-
return size === "contain-fit-content" ? railGridHorizontalContainFitContent : railGridHorizontal;
|
|
190
|
-
} else {
|
|
191
|
-
return size === "contain-fit-content" ? railGridVerticalContainFitContent : railGridVertical;
|
|
192
|
-
}
|
|
193
|
-
}, [
|
|
194
|
-
rail,
|
|
195
|
-
orientation,
|
|
196
|
-
size
|
|
197
|
-
]);
|
|
198
|
-
return /* @__PURE__ */ import_react.default.createElement(StackContext.Provider, {
|
|
199
|
-
value: {
|
|
176
|
+
var Stack = /* @__PURE__ */ (0, import_react.forwardRef)(({ children, classNames, style, orientation = "vertical", rail = true, size = "intrinsic", onRearrange, itemsCount = import_react.Children.count(children), getDropElement, separatorOnScroll, ...props }, forwardedRef) => {
|
|
177
|
+
var _effect = (0, import_tracking.useSignals)();
|
|
178
|
+
try {
|
|
179
|
+
const [stackElement, stackRef] = (0, import_react.useState)(null);
|
|
180
|
+
const composedItemRef = (0, import_react_compose_refs.composeRefs)(stackRef, forwardedRef);
|
|
181
|
+
const arrowNavigationAttrs = (0, import_react_tabster.useArrowNavigationGroup)({
|
|
182
|
+
axis: orientation
|
|
183
|
+
});
|
|
184
|
+
const styles = {
|
|
185
|
+
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: `repeat(${itemsCount}, min-content) [tabster-dummies] 0`,
|
|
186
|
+
...style
|
|
187
|
+
};
|
|
188
|
+
const selfDroppable = !!(itemsCount < 1 && onRearrange && props.id);
|
|
189
|
+
const { dropping } = useStackDropForElements({
|
|
190
|
+
id: props.id,
|
|
191
|
+
element: getDropElement && stackElement ? getDropElement(stackElement) : stackElement,
|
|
192
|
+
selfDroppable,
|
|
200
193
|
orientation,
|
|
201
|
-
rail,
|
|
202
|
-
size,
|
|
203
194
|
onRearrange
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
195
|
+
});
|
|
196
|
+
const handleScroll = (0, import_react.useCallback)(() => {
|
|
197
|
+
if (stackElement && Number.isFinite(separatorOnScroll)) {
|
|
198
|
+
const scrollPosition = orientation === "horizontal" ? stackElement.scrollLeft : stackElement.scrollTop;
|
|
199
|
+
const scrollSize = orientation === "horizontal" ? stackElement.scrollWidth : stackElement.scrollHeight;
|
|
200
|
+
const clientSize = orientation === "horizontal" ? stackElement.clientWidth : stackElement.clientHeight;
|
|
201
|
+
const separatorHost = stackElement.closest("[data-scroll-separator]");
|
|
202
|
+
if (separatorHost) {
|
|
203
|
+
separatorHost.setAttribute("data-scroll-separator", String(scrollPosition > separatorOnScroll));
|
|
204
|
+
separatorHost.setAttribute("data-scroll-separator-end", String(scrollSize - (scrollPosition + clientSize) > separatorOnScroll));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}, [
|
|
208
|
+
stackElement,
|
|
209
|
+
separatorOnScroll,
|
|
210
|
+
orientation
|
|
211
|
+
]);
|
|
212
|
+
const gridClasses = (0, import_react.useMemo)(() => {
|
|
213
|
+
if (!rail) {
|
|
214
|
+
return orientation === "horizontal" ? "grid-rows-1 pli-1" : "grid-cols-1 plb-1";
|
|
215
|
+
}
|
|
216
|
+
if (orientation === "horizontal") {
|
|
217
|
+
return size === "contain-fit-content" ? railGridHorizontalContainFitContent : railGridHorizontal;
|
|
218
|
+
} else {
|
|
219
|
+
return size === "contain-fit-content" ? railGridVerticalContainFitContent : railGridVertical;
|
|
220
|
+
}
|
|
221
|
+
}, [
|
|
222
|
+
rail,
|
|
223
|
+
orientation,
|
|
224
|
+
size
|
|
225
|
+
]);
|
|
226
|
+
return /* @__PURE__ */ import_react.default.createElement(StackContext.Provider, {
|
|
227
|
+
value: {
|
|
228
|
+
orientation,
|
|
229
|
+
rail,
|
|
230
|
+
size,
|
|
231
|
+
onRearrange
|
|
232
|
+
}
|
|
233
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
234
|
+
...props,
|
|
235
|
+
...arrowNavigationAttrs,
|
|
236
|
+
className: (0, import_react_ui_theme.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),
|
|
237
|
+
"data-rail": rail,
|
|
238
|
+
"aria-orientation": orientation,
|
|
239
|
+
style: styles,
|
|
240
|
+
ref: composedItemRef,
|
|
241
|
+
...Number.isFinite(separatorOnScroll) && {
|
|
242
|
+
onScroll: handleScroll
|
|
243
|
+
}
|
|
244
|
+
}, children, selfDroppable && dropping && /* @__PURE__ */ import_react.default.createElement(import_react_ui.ListItem.DropIndicator, {
|
|
245
|
+
lineInset: 8,
|
|
246
|
+
terminalInset: -8,
|
|
247
|
+
gap: -8,
|
|
248
|
+
edge: orientation === "horizontal" ? "left" : "top"
|
|
249
|
+
})));
|
|
250
|
+
} finally {
|
|
251
|
+
_effect.f();
|
|
252
|
+
}
|
|
219
253
|
});
|
|
220
254
|
var StackItemContent = /* @__PURE__ */ (0, import_react5.forwardRef)(({ children, toolbar, statusbar, classNames, size = "intrinsic", ...props }, forwardedRef) => {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
"
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
255
|
+
var _effect = (0, import_tracking3.useSignals)();
|
|
256
|
+
try {
|
|
257
|
+
const { size: stackItemSize } = useStack();
|
|
258
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
259
|
+
role: "none",
|
|
260
|
+
...props,
|
|
261
|
+
className: (0, import_react_ui_theme3.mx)("group grid grid-cols-[100%]", stackItemSize === "contain" && "min-bs-0 overflow-hidden", size === "video" ? "aspect-video" : size === "square" && "aspect-square", classNames),
|
|
262
|
+
style: {
|
|
263
|
+
gridTemplateRows: [
|
|
264
|
+
...toolbar ? [
|
|
265
|
+
"var(--rail-action)"
|
|
266
|
+
] : [],
|
|
267
|
+
"1fr",
|
|
268
|
+
...statusbar ? [
|
|
269
|
+
"var(--statusbar-size)"
|
|
270
|
+
] : []
|
|
271
|
+
].join(" ")
|
|
272
|
+
},
|
|
273
|
+
"data-popover-collision-boundary": true,
|
|
274
|
+
ref: forwardedRef
|
|
275
|
+
}, children);
|
|
276
|
+
} finally {
|
|
277
|
+
_effect.f();
|
|
278
|
+
}
|
|
240
279
|
});
|
|
241
280
|
var StackItemDragHandle = ({ asChild, children }) => {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
281
|
+
var _effect = (0, import_tracking4.useSignals)();
|
|
282
|
+
try {
|
|
283
|
+
const { selfDragHandleRef } = useStackItem();
|
|
284
|
+
const Root = asChild ? import_react_slot.Slot : "div";
|
|
285
|
+
return /* @__PURE__ */ import_react6.default.createElement(Root, {
|
|
286
|
+
ref: selfDragHandleRef,
|
|
287
|
+
role: "button"
|
|
288
|
+
}, children);
|
|
289
|
+
} finally {
|
|
290
|
+
_effect.f();
|
|
291
|
+
}
|
|
248
292
|
};
|
|
249
293
|
var StackItemHeading = ({ children, classNames, ...props }) => {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
294
|
+
var _effect = (0, import_tracking5.useSignals)();
|
|
295
|
+
try {
|
|
296
|
+
const { orientation } = useStack();
|
|
297
|
+
const focusableGroupAttrs = (0, import_react_tabster3.useFocusableGroup)({
|
|
298
|
+
tabBehavior: "limited"
|
|
299
|
+
});
|
|
300
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
301
|
+
role: "heading",
|
|
302
|
+
...props,
|
|
303
|
+
tabIndex: 0,
|
|
304
|
+
...focusableGroupAttrs,
|
|
305
|
+
className: (0, import_react_ui_theme4.mx)('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)
|
|
306
|
+
}, children);
|
|
307
|
+
} finally {
|
|
308
|
+
_effect.f();
|
|
309
|
+
}
|
|
261
310
|
};
|
|
262
311
|
var StackItemHeadingLabel = /* @__PURE__ */ (0, import_react7.forwardRef)(({ attendableId, related, classNames, ...props }, forwardedRef) => {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
312
|
+
var _effect = (0, import_tracking5.useSignals)();
|
|
313
|
+
try {
|
|
314
|
+
const { hasAttention, isAncestor, isRelated } = (0, import_react_ui_attention.useAttention)(attendableId);
|
|
315
|
+
return /* @__PURE__ */ import_react7.default.createElement("h1", {
|
|
316
|
+
...props,
|
|
317
|
+
"data-attention": (related && isRelated || hasAttention || isAncestor).toString(),
|
|
318
|
+
className: (0, import_react_ui_theme4.mx)("pli-1 min-is-0 is-0 grow truncate font-medium text-baseText data-[attention=true]:text-accentText self-center", classNames),
|
|
319
|
+
ref: forwardedRef
|
|
320
|
+
});
|
|
321
|
+
} finally {
|
|
322
|
+
_effect.f();
|
|
323
|
+
}
|
|
270
324
|
});
|
|
271
325
|
var MIN_WIDTH = 20;
|
|
272
326
|
var MIN_HEIGHT = 3;
|
|
273
327
|
var StackItemResizeHandle = () => {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
328
|
+
var _effect = (0, import_tracking6.useSignals)();
|
|
329
|
+
try {
|
|
330
|
+
const { orientation } = useStack();
|
|
331
|
+
const { setSize, size } = useStackItem();
|
|
332
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react_ui_dnd2.ResizeHandle, {
|
|
333
|
+
side: orientation === "horizontal" ? "inline-end" : "block-end",
|
|
334
|
+
fallbackSize: DEFAULT_EXTRINSIC_SIZE,
|
|
335
|
+
minSize: orientation === "horizontal" ? MIN_WIDTH : MIN_HEIGHT,
|
|
336
|
+
size,
|
|
337
|
+
onSizeChange: setSize
|
|
338
|
+
});
|
|
339
|
+
} finally {
|
|
340
|
+
_effect.f();
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
var MenuSignifierHorizontal = () => {
|
|
344
|
+
var _effect = (0, import_tracking8.useSignals)();
|
|
345
|
+
try {
|
|
346
|
+
return /* @__PURE__ */ import_react10.default.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__ */ import_react10.default.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
|
+
}
|
|
283
366
|
};
|
|
284
|
-
var MenuSignifierHorizontal = () => /* @__PURE__ */ import_react10.default.createElement("svg", {
|
|
285
|
-
className: "absolute block-end-[7px]",
|
|
286
|
-
width: 20,
|
|
287
|
-
height: 2,
|
|
288
|
-
viewBox: "0 0 20 2",
|
|
289
|
-
stroke: "currentColor",
|
|
290
|
-
opacity: 0.5
|
|
291
|
-
}, /* @__PURE__ */ import_react10.default.createElement("line", {
|
|
292
|
-
x1: 0.5,
|
|
293
|
-
y1: 0.75,
|
|
294
|
-
x2: 19,
|
|
295
|
-
y2: 0.75,
|
|
296
|
-
strokeWidth: 1.25,
|
|
297
|
-
strokeLinecap: "round",
|
|
298
|
-
strokeDasharray: "6 20",
|
|
299
|
-
strokeDashoffset: "-6.5"
|
|
300
|
-
}));
|
|
301
367
|
var translationKey = "stack";
|
|
302
368
|
var translations_default = [
|
|
303
369
|
{
|
|
@@ -315,219 +381,278 @@ var translations_default = [
|
|
|
315
381
|
}
|
|
316
382
|
];
|
|
317
383
|
var StackItemSigilButton = /* @__PURE__ */ (0, import_react9.forwardRef)(({ attendableId, classNames, related, isMenu = true, children, ...props }, forwardedRef) => {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
classNames
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
384
|
+
var _effect = (0, import_tracking7.useSignals)();
|
|
385
|
+
try {
|
|
386
|
+
const { hasAttention, isAncestor, isRelated } = (0, import_react_ui_attention2.useAttention)(attendableId);
|
|
387
|
+
const variant = related && isRelated || hasAttention || isAncestor ? "primary" : "ghost";
|
|
388
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Button, {
|
|
389
|
+
...props,
|
|
390
|
+
variant,
|
|
391
|
+
classNames: [
|
|
392
|
+
"shrink-0 pli-0 min-bs-0 is-[--rail-action] bs-[--rail-action] relative app-no-drag",
|
|
393
|
+
classNames
|
|
394
|
+
],
|
|
395
|
+
ref: forwardedRef
|
|
396
|
+
}, isMenu && /* @__PURE__ */ import_react9.default.createElement(MenuSignifierHorizontal, null), children);
|
|
397
|
+
} finally {
|
|
398
|
+
_effect.f();
|
|
399
|
+
}
|
|
329
400
|
});
|
|
330
401
|
var StackItemSigil = /* @__PURE__ */ (0, import_react9.forwardRef)(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
return /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Root, {
|
|
352
|
-
open: optionsMenuOpen,
|
|
353
|
-
onOpenChange: (nextOpen) => {
|
|
354
|
-
if (!nextOpen) {
|
|
355
|
-
suppressNextTooltip.current = true;
|
|
356
|
-
}
|
|
357
|
-
return setOptionsMenuOpen(nextOpen);
|
|
402
|
+
var _effect = (0, import_tracking7.useSignals)();
|
|
403
|
+
try {
|
|
404
|
+
const { t } = (0, import_react_ui3.useTranslation)(translationKey);
|
|
405
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = (0, import_react9.useState)(false);
|
|
406
|
+
const hasActions = actionGroups && actionGroups.length > 0;
|
|
407
|
+
const button = /* @__PURE__ */ import_react9.default.createElement(StackItemSigilButton, {
|
|
408
|
+
attendableId,
|
|
409
|
+
related,
|
|
410
|
+
isMenu: hasActions,
|
|
411
|
+
// TODO(wittjosiah): Better disabling of interactive styles when no action are available.
|
|
412
|
+
// Remove underscore icon when no actions are available?
|
|
413
|
+
classNames: !hasActions && "cursor-default"
|
|
414
|
+
}, /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
415
|
+
className: "sr-only"
|
|
416
|
+
}, triggerLabel), /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Icon, {
|
|
417
|
+
icon,
|
|
418
|
+
size: 5
|
|
419
|
+
}));
|
|
420
|
+
if (!hasActions) {
|
|
421
|
+
return button;
|
|
358
422
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
423
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Root, {
|
|
424
|
+
open: optionsMenuOpen,
|
|
425
|
+
onOpenChange: setOptionsMenuOpen
|
|
426
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Trigger, {
|
|
427
|
+
asChild: true,
|
|
428
|
+
ref: forwardedRef
|
|
429
|
+
}, button), /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Portal, null, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Content, {
|
|
430
|
+
classNames: "z-[31]"
|
|
431
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Viewport, null, actionGroups?.map((actions, index) => {
|
|
432
|
+
const separator = index > 0 ? /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Separator, null) : null;
|
|
433
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react9.Fragment, {
|
|
434
|
+
key: index
|
|
435
|
+
}, separator, actions.map((action) => {
|
|
436
|
+
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[(0, import_util.getHostPlatform)()];
|
|
437
|
+
const menuItemType = action.properties.menuItemType;
|
|
438
|
+
const Root = menuItemType === "toggle" ? import_react_ui3.DropdownMenu.CheckboxItem : import_react_ui3.DropdownMenu.Item;
|
|
439
|
+
return /* @__PURE__ */ import_react9.default.createElement(Root, {
|
|
440
|
+
key: action.id,
|
|
441
|
+
onClick: (event) => {
|
|
442
|
+
if (action.properties.disabled) {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
event.stopPropagation();
|
|
446
|
+
setOptionsMenuOpen(false);
|
|
447
|
+
onAction?.(action);
|
|
448
|
+
},
|
|
449
|
+
classNames: "gap-2",
|
|
450
|
+
disabled: action.properties.disabled,
|
|
451
|
+
checked: menuItemType === "toggle" ? action.properties.isChecked : void 0,
|
|
452
|
+
...action.properties?.testId && {
|
|
453
|
+
"data-testid": action.properties.testId
|
|
377
454
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Icon, {
|
|
397
|
-
icon: "ph--check--regular",
|
|
398
|
-
size: 4
|
|
399
|
-
})), shortcut && /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
400
|
-
className: (0, import_react_ui_theme5.mx)("shrink-0", import_react_ui_theme5.descriptionText)
|
|
401
|
-
}, (0, import_keyboard.keySymbols)(shortcut).join("")));
|
|
402
|
-
}));
|
|
403
|
-
}), children), /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Arrow, null))));
|
|
455
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Icon, {
|
|
456
|
+
icon: action.properties.icon ?? "ph--placeholder--regular",
|
|
457
|
+
size: 4
|
|
458
|
+
}), /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
459
|
+
className: "grow truncate"
|
|
460
|
+
}, (0, import_react_ui3.toLocalizedString)(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.ItemIndicator, {
|
|
461
|
+
asChild: true
|
|
462
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Icon, {
|
|
463
|
+
icon: "ph--check--regular",
|
|
464
|
+
size: 4
|
|
465
|
+
})), shortcut && /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
466
|
+
className: (0, import_react_ui_theme5.mx)("shrink-0", import_react_ui_theme5.descriptionText)
|
|
467
|
+
}, (0, import_keyboard.keySymbols)(shortcut).join("")));
|
|
468
|
+
}));
|
|
469
|
+
}), children), /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Arrow, null))));
|
|
470
|
+
} finally {
|
|
471
|
+
_effect.f();
|
|
472
|
+
}
|
|
404
473
|
});
|
|
405
474
|
var DEFAULT_HORIZONTAL_SIZE = 48;
|
|
406
475
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
407
476
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
408
|
-
var StackItemRoot = /* @__PURE__ */ (0, import_react4.forwardRef)(({ item, children, classNames, size: propsSize, onSizeChange, role, order, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
setInternalSize(
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
const type = orientation === "horizontal" ? "column" : "card";
|
|
425
|
-
(0, import_react4.useLayoutEffect)(() => {
|
|
426
|
-
if (!itemElement || !onRearrange || disableRearrange) {
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
return (0, import_combine2.combine)((0, import_adapter2.draggable)({
|
|
430
|
-
element: itemElement,
|
|
431
|
-
...selfDragHandleElement && {
|
|
432
|
-
dragHandle: selfDragHandleElement
|
|
433
|
-
},
|
|
434
|
-
getInitialData: () => ({
|
|
435
|
-
id: item.id,
|
|
436
|
-
type
|
|
437
|
-
}),
|
|
438
|
-
onGenerateDragPreview: ({ nativeSetDragImage, source, location }) => {
|
|
439
|
-
document.body.setAttribute("data-drag-preview", "true");
|
|
440
|
-
(0, import_scroll_just_enough_into_view.scrollJustEnoughIntoView)({
|
|
441
|
-
element: source.element
|
|
442
|
-
});
|
|
443
|
-
const { x, y } = (0, import_preserve_offset_on_source.preserveOffsetOnSource)({
|
|
444
|
-
element: source.element,
|
|
445
|
-
input: location.current.input
|
|
446
|
-
})({
|
|
447
|
-
container: source.element.offsetParent ?? document.body
|
|
448
|
-
});
|
|
449
|
-
nativeSetDragImage?.(source.element, x, y);
|
|
450
|
-
},
|
|
451
|
-
onDragStart: () => {
|
|
452
|
-
document.body.removeAttribute("data-drag-preview");
|
|
453
|
-
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "active");
|
|
454
|
-
},
|
|
455
|
-
onDrop: () => {
|
|
456
|
-
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "idle");
|
|
477
|
+
var StackItemRoot = /* @__PURE__ */ (0, import_react4.forwardRef)(({ item, children, classNames, size: propsSize, onSizeChange, role, order, prevSiblingId, nextSiblingId, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
478
|
+
var _effect = (0, import_tracking2.useSignals)();
|
|
479
|
+
try {
|
|
480
|
+
const [itemElement, itemRef] = (0, import_react4.useState)(null);
|
|
481
|
+
const [selfDragHandleElement, selfDragHandleRef] = (0, import_react4.useState)(null);
|
|
482
|
+
const [closestEdge, setEdge] = (0, import_react4.useState)(null);
|
|
483
|
+
const [sourceId, setSourceId] = (0, import_react4.useState)(null);
|
|
484
|
+
const [dragState, setDragState] = (0, import_react4.useState)(idle);
|
|
485
|
+
const { orientation, rail, onRearrange } = useStack();
|
|
486
|
+
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = (0, import_react4.useState)(propsSize);
|
|
487
|
+
const Root = role ?? "div";
|
|
488
|
+
const composedItemRef = (0, import_react_compose_refs2.composeRefs)(itemRef, forwardedRef);
|
|
489
|
+
const setSize = (0, import_react4.useCallback)((nextSize, commit) => {
|
|
490
|
+
setInternalSize(nextSize);
|
|
491
|
+
if (commit) {
|
|
492
|
+
onSizeChange?.(nextSize);
|
|
457
493
|
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
494
|
+
}, [
|
|
495
|
+
onSizeChange
|
|
496
|
+
]);
|
|
497
|
+
const type = orientation === "horizontal" ? "column" : "card";
|
|
498
|
+
(0, import_react4.useLayoutEffect)(() => {
|
|
499
|
+
if (!itemElement || !onRearrange || disableRearrange) {
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
return (0, import_combine2.combine)((0, import_adapter2.draggable)({
|
|
503
|
+
element: itemElement,
|
|
504
|
+
...selfDragHandleElement && {
|
|
505
|
+
dragHandle: selfDragHandleElement
|
|
506
|
+
},
|
|
507
|
+
getInitialData: () => ({
|
|
462
508
|
id: item.id,
|
|
463
509
|
type
|
|
464
|
-
},
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
510
|
+
}),
|
|
511
|
+
onGenerateDragPreview: ({ nativeSetDragImage, source, location }) => {
|
|
512
|
+
document.body.setAttribute("data-drag-preview", "true");
|
|
513
|
+
const offsetFn = (0, import_preserve_offset_on_source.preserveOffsetOnSource)({
|
|
514
|
+
element: source.element,
|
|
515
|
+
input: location.current.input
|
|
516
|
+
});
|
|
517
|
+
const rect = source.element.getBoundingClientRect();
|
|
518
|
+
(0, import_set_custom_native_drag_preview.setCustomNativeDragPreview)({
|
|
519
|
+
nativeSetDragImage,
|
|
520
|
+
getOffset: ({ container }) => {
|
|
521
|
+
return offsetFn({
|
|
522
|
+
container
|
|
523
|
+
});
|
|
524
|
+
},
|
|
525
|
+
render: ({ container }) => {
|
|
526
|
+
container.style.width = rect.width + "px";
|
|
527
|
+
setDragState({
|
|
528
|
+
type: "preview",
|
|
529
|
+
container,
|
|
530
|
+
item
|
|
531
|
+
});
|
|
532
|
+
return () => {
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
},
|
|
537
|
+
onDragStart: () => {
|
|
538
|
+
document.body.removeAttribute("data-drag-preview");
|
|
539
|
+
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "active");
|
|
540
|
+
setDragState({
|
|
541
|
+
type: "is-dragging",
|
|
542
|
+
item
|
|
543
|
+
});
|
|
544
|
+
},
|
|
545
|
+
onDrop: () => {
|
|
546
|
+
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "idle");
|
|
547
|
+
setDragState(idle);
|
|
484
548
|
}
|
|
485
|
-
},
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
549
|
+
}), (0, import_adapter2.dropTargetForElements)({
|
|
550
|
+
element: itemElement,
|
|
551
|
+
getData: ({ input, element }) => {
|
|
552
|
+
return (0, import_closest_edge2.attachClosestEdge)({
|
|
553
|
+
id: item.id,
|
|
554
|
+
type
|
|
555
|
+
}, {
|
|
556
|
+
input,
|
|
557
|
+
element,
|
|
558
|
+
allowedEdges: orientation === "horizontal" ? [
|
|
559
|
+
"left",
|
|
560
|
+
"right"
|
|
561
|
+
] : [
|
|
562
|
+
"top",
|
|
563
|
+
"bottom"
|
|
564
|
+
]
|
|
565
|
+
});
|
|
566
|
+
},
|
|
567
|
+
onDragEnter: ({ self, source }) => {
|
|
568
|
+
if (source.data.type === self.data.type) {
|
|
569
|
+
setEdge((0, import_closest_edge2.extractClosestEdge)(self.data));
|
|
570
|
+
setSourceId(source.data.id);
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
onDrag: ({ self, source }) => {
|
|
574
|
+
if (source.data.type === self.data.type) {
|
|
575
|
+
setEdge((0, import_closest_edge2.extractClosestEdge)(self.data));
|
|
576
|
+
setSourceId(source.data.id);
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
onDragLeave: () => {
|
|
580
|
+
setEdge(null);
|
|
581
|
+
setSourceId(null);
|
|
582
|
+
},
|
|
583
|
+
onDrop: ({ self, source }) => {
|
|
584
|
+
setEdge(null);
|
|
585
|
+
setSourceId(null);
|
|
586
|
+
if (source.data.type === self.data.type) {
|
|
587
|
+
onRearrange(source.data, self.data, (0, import_closest_edge2.extractClosestEdge)(self.data));
|
|
588
|
+
}
|
|
491
589
|
}
|
|
590
|
+
}));
|
|
591
|
+
}, [
|
|
592
|
+
orientation,
|
|
593
|
+
item,
|
|
594
|
+
onRearrange,
|
|
595
|
+
selfDragHandleElement,
|
|
596
|
+
itemElement
|
|
597
|
+
]);
|
|
598
|
+
const focusableGroupAttrs = (0, import_react_tabster2.useFocusableGroup)({
|
|
599
|
+
tabBehavior: "limited"
|
|
600
|
+
});
|
|
601
|
+
const shouldShowDropIndicator = () => {
|
|
602
|
+
if (!closestEdge || !sourceId) {
|
|
603
|
+
return false;
|
|
492
604
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
605
|
+
if (sourceId === item.id) {
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
const isTrailingEdgeOfPrevSibling = prevSiblingId !== void 0 && sourceId === prevSiblingId && (orientation === "horizontal" && closestEdge === "left" || orientation === "vertical" && closestEdge === "top");
|
|
609
|
+
if (isTrailingEdgeOfPrevSibling) {
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
const isLeadingEdgeOfNextSibling = nextSiblingId !== void 0 && sourceId === nextSiblingId && (orientation === "horizontal" && closestEdge === "right" || orientation === "vertical" && closestEdge === "bottom");
|
|
613
|
+
if (isLeadingEdgeOfNextSibling) {
|
|
614
|
+
return false;
|
|
615
|
+
}
|
|
616
|
+
return true;
|
|
617
|
+
};
|
|
618
|
+
return /* @__PURE__ */ import_react4.default.createElement(StackItemContext.Provider, {
|
|
619
|
+
value: {
|
|
620
|
+
selfDragHandleRef,
|
|
621
|
+
size,
|
|
622
|
+
setSize,
|
|
623
|
+
state: dragState,
|
|
624
|
+
setState: setDragState
|
|
625
|
+
}
|
|
626
|
+
}, /* @__PURE__ */ import_react4.default.createElement(Root, {
|
|
627
|
+
...props,
|
|
628
|
+
tabIndex: 0,
|
|
629
|
+
...focusableGroupAttrs,
|
|
630
|
+
className: (0, import_react_ui_theme2.mx)("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),
|
|
631
|
+
"data-dx-stack-item": true,
|
|
632
|
+
...import_react_ui_dnd.resizeAttributes,
|
|
633
|
+
style: {
|
|
634
|
+
...(0, import_react_ui_dnd.sizeStyle)(size, orientation),
|
|
635
|
+
...Number.isFinite(order) && {
|
|
636
|
+
[orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
|
|
637
|
+
},
|
|
638
|
+
...style
|
|
521
639
|
},
|
|
522
|
-
|
|
523
|
-
},
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
640
|
+
ref: composedItemRef
|
|
641
|
+
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.ListItem.DropIndicator, {
|
|
642
|
+
lineInset: 8,
|
|
643
|
+
terminalInset: -8,
|
|
644
|
+
edge: closestEdge
|
|
645
|
+
})));
|
|
646
|
+
} finally {
|
|
647
|
+
_effect.f();
|
|
648
|
+
}
|
|
530
649
|
});
|
|
650
|
+
var StackItemDragPreview = ({ children }) => {
|
|
651
|
+
const { state } = useStackItem();
|
|
652
|
+
return state?.type === "preview" ? /* @__PURE__ */ (0, import_react_dom.createPortal)(children({
|
|
653
|
+
item: state.item
|
|
654
|
+
}), state.container) : null;
|
|
655
|
+
};
|
|
531
656
|
var StackItem = {
|
|
532
657
|
Root: StackItemRoot,
|
|
533
658
|
Content: StackItemContent,
|
|
@@ -536,87 +661,23 @@ var StackItem = {
|
|
|
536
661
|
ResizeHandle: StackItemResizeHandle,
|
|
537
662
|
DragHandle: StackItemDragHandle,
|
|
538
663
|
Sigil: StackItemSigil,
|
|
539
|
-
SigilButton: StackItemSigilButton
|
|
540
|
-
|
|
541
|
-
var LayoutControl = ({ icon, label, ...props }) => {
|
|
542
|
-
return /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Tooltip.Root, null, /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Tooltip.Trigger, {
|
|
543
|
-
asChild: true
|
|
544
|
-
}, /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Button, {
|
|
545
|
-
variant: "ghost",
|
|
546
|
-
...props
|
|
547
|
-
}, /* @__PURE__ */ import_react11.default.createElement("span", {
|
|
548
|
-
className: "sr-only"
|
|
549
|
-
}, label), /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Icon, {
|
|
550
|
-
icon
|
|
551
|
-
}))), /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Tooltip.Portal, null, /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Tooltip.Content, {
|
|
552
|
-
side: "bottom"
|
|
553
|
-
}, label)));
|
|
664
|
+
SigilButton: StackItemSigilButton,
|
|
665
|
+
DragPreview: StackItemDragPreview
|
|
554
666
|
};
|
|
555
|
-
var LayoutControls = /* @__PURE__ */ (0, import_react11.forwardRef)(({ onClick, variant = "default", capabilities: can, isSolo, pin, close = false, children, ...props }, forwardedRef) => {
|
|
556
|
-
const { t } = (0, import_react_ui4.useTranslation)(translationKey);
|
|
557
|
-
const buttonClassNames = variant === "hide-disabled" ? "disabled:hidden !p-1" : "!p-1";
|
|
558
|
-
return /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.ButtonGroup, {
|
|
559
|
-
...props,
|
|
560
|
-
ref: forwardedRef
|
|
561
|
-
}, pin && !isSolo && [
|
|
562
|
-
"both",
|
|
563
|
-
"start"
|
|
564
|
-
].includes(pin) && /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
565
|
-
label: t("pin start label"),
|
|
566
|
-
variant: "ghost",
|
|
567
|
-
classNames: buttonClassNames,
|
|
568
|
-
onClick: () => onClick?.("pin-start"),
|
|
569
|
-
icon: "ph--caret-line-left--regular"
|
|
570
|
-
}), can.solo && /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
571
|
-
label: t("solo layout label"),
|
|
572
|
-
classNames: buttonClassNames,
|
|
573
|
-
onClick: () => onClick?.("solo"),
|
|
574
|
-
icon: isSolo ? "ph--arrows-in--regular" : "ph--arrows-out--regular"
|
|
575
|
-
}), !isSolo && can.solo && /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
576
|
-
label: t("increment start label"),
|
|
577
|
-
disabled: !can.incrementStart,
|
|
578
|
-
classNames: buttonClassNames,
|
|
579
|
-
onClick: () => onClick?.("increment-start"),
|
|
580
|
-
icon: "ph--caret-left--regular"
|
|
581
|
-
}), /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
582
|
-
label: t("increment end label"),
|
|
583
|
-
disabled: !can.incrementEnd,
|
|
584
|
-
classNames: buttonClassNames,
|
|
585
|
-
onClick: () => onClick?.("increment-end"),
|
|
586
|
-
icon: "ph--caret-right--regular"
|
|
587
|
-
})), pin && !isSolo && [
|
|
588
|
-
"both",
|
|
589
|
-
"end"
|
|
590
|
-
].includes(pin) && /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
591
|
-
label: t("pin end label"),
|
|
592
|
-
classNames: buttonClassNames,
|
|
593
|
-
onClick: () => onClick?.("pin-end"),
|
|
594
|
-
icon: "ph--caret-line-right--regular"
|
|
595
|
-
}), close && !isSolo && /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
596
|
-
label: t(`${typeof close === "string" ? "minify" : "close"} label`),
|
|
597
|
-
classNames: buttonClassNames,
|
|
598
|
-
onClick: () => onClick?.("close"),
|
|
599
|
-
"data-testid": "layoutHeading.close",
|
|
600
|
-
icon: close === "minify-start" ? "ph--caret-line-left--regular" : close === "minify-end" ? "ph--caret-line-right--regular" : "ph--x--regular"
|
|
601
|
-
}), children);
|
|
602
|
-
});
|
|
603
667
|
// Annotate the CommonJS export names for ESM import in node:
|
|
604
668
|
0 && (module.exports = {
|
|
605
669
|
DEFAULT_EXTRINSIC_SIZE,
|
|
606
670
|
DEFAULT_HORIZONTAL_SIZE,
|
|
607
671
|
DEFAULT_VERTICAL_SIZE,
|
|
608
|
-
LayoutControls,
|
|
609
672
|
Stack,
|
|
610
673
|
StackContext,
|
|
611
674
|
StackItem,
|
|
612
|
-
|
|
675
|
+
StackItemDragPreview,
|
|
613
676
|
autoScrollRootAttributes,
|
|
614
677
|
railGridHorizontal,
|
|
615
678
|
railGridHorizontalContainFitContent,
|
|
616
679
|
railGridVertical,
|
|
617
680
|
railGridVerticalContainFitContent,
|
|
618
|
-
translations
|
|
619
|
-
useStack,
|
|
620
|
-
useStackItem
|
|
681
|
+
translations
|
|
621
682
|
});
|
|
622
683
|
//# sourceMappingURL=index.cjs.map
|