@dxos/react-ui-stack 0.7.5-main.e9bb01b → 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 +115 -124
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +161 -169
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +115 -124
- 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 +6 -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 +4 -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 +22 -20
- package/src/components/Stack.stories.tsx +1 -1
- package/src/components/Stack.tsx +44 -57
- package/src/components/StackContext.tsx +3 -1
- package/src/components/StackItem.tsx +28 -7
- 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
package/dist/lib/node/index.cjs
CHANGED
|
@@ -36,15 +36,16 @@ __export(node_exports, {
|
|
|
36
36
|
StackContext: () => StackContext,
|
|
37
37
|
StackItem: () => StackItem,
|
|
38
38
|
StackItemContext: () => StackItemContext,
|
|
39
|
+
autoScrollRootAttributes: () => autoScrollRootAttributes,
|
|
39
40
|
railGridHorizontal: () => railGridHorizontal,
|
|
41
|
+
railGridHorizontalContainFitContent: () => railGridHorizontalContainFitContent,
|
|
40
42
|
railGridVertical: () => railGridVertical,
|
|
43
|
+
railGridVerticalContainFitContent: () => railGridVerticalContainFitContent,
|
|
41
44
|
translations: () => translations_default,
|
|
42
45
|
useStack: () => useStack,
|
|
43
46
|
useStackItem: () => useStackItem
|
|
44
47
|
});
|
|
45
48
|
module.exports = __toCommonJS(node_exports);
|
|
46
|
-
var import_adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
47
|
-
var import_closest_edge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
|
|
48
49
|
var import_react_tabster = require("@fluentui/react-tabster");
|
|
49
50
|
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
50
51
|
var import_react = __toESM(require("react"));
|
|
@@ -52,36 +53,39 @@ var import_react_ui = require("@dxos/react-ui");
|
|
|
52
53
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
53
54
|
var import_react2 = require("react");
|
|
54
55
|
var import_combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
|
|
56
|
+
var import_adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
57
|
+
var import_element = require("@atlaskit/pragmatic-drag-and-drop-auto-scroll/element");
|
|
58
|
+
var import_closest_edge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
|
|
59
|
+
var import_react3 = require("react");
|
|
60
|
+
var import_combine2 = require("@atlaskit/pragmatic-drag-and-drop/combine");
|
|
55
61
|
var import_adapter2 = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
56
62
|
var import_preserve_offset_on_source = require("@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source");
|
|
57
63
|
var import_scroll_just_enough_into_view = require("@atlaskit/pragmatic-drag-and-drop/element/scroll-just-enough-into-view");
|
|
58
64
|
var import_closest_edge2 = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
|
|
59
65
|
var import_react_tabster2 = require("@fluentui/react-tabster");
|
|
60
66
|
var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
|
|
61
|
-
var
|
|
67
|
+
var import_react4 = __toESM(require("react"));
|
|
62
68
|
var import_react_ui2 = require("@dxos/react-ui");
|
|
69
|
+
var import_react_ui_dnd = require("@dxos/react-ui-dnd");
|
|
63
70
|
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
64
|
-
var
|
|
71
|
+
var import_react5 = __toESM(require("react"));
|
|
65
72
|
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
66
73
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
67
|
-
var import_react5 = __toESM(require("react"));
|
|
68
|
-
var import_react_tabster3 = require("@fluentui/react-tabster");
|
|
69
74
|
var import_react6 = __toESM(require("react"));
|
|
75
|
+
var import_react_tabster3 = require("@fluentui/react-tabster");
|
|
76
|
+
var import_react7 = __toESM(require("react"));
|
|
70
77
|
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
71
78
|
var import_react_ui_theme4 = require("@dxos/react-ui-theme");
|
|
72
|
-
var import_adapter3 = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
73
|
-
var import_disable_native_drag_preview = require("@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview");
|
|
74
|
-
var import_prevent_unhandled = require("@atlaskit/pragmatic-drag-and-drop/prevent-unhandled");
|
|
75
|
-
var import_react7 = __toESM(require("react"));
|
|
76
|
-
var import_react_ui_theme5 = require("@dxos/react-ui-theme");
|
|
77
79
|
var import_react8 = __toESM(require("react"));
|
|
80
|
+
var import_react_ui_dnd2 = require("@dxos/react-ui-dnd");
|
|
81
|
+
var import_react9 = __toESM(require("react"));
|
|
78
82
|
var import_keyboard = require("@dxos/keyboard");
|
|
79
83
|
var import_react_ui3 = require("@dxos/react-ui");
|
|
80
84
|
var import_react_ui_attention2 = require("@dxos/react-ui-attention");
|
|
81
|
-
var
|
|
85
|
+
var import_react_ui_theme5 = require("@dxos/react-ui-theme");
|
|
82
86
|
var import_util = require("@dxos/util");
|
|
83
|
-
var import_react9 = __toESM(require("react"));
|
|
84
87
|
var import_react10 = __toESM(require("react"));
|
|
88
|
+
var import_react11 = __toESM(require("react"));
|
|
85
89
|
var import_react_ui4 = require("@dxos/react-ui");
|
|
86
90
|
var StackContext = /* @__PURE__ */ (0, import_react2.createContext)({
|
|
87
91
|
orientation: "vertical",
|
|
@@ -97,34 +101,22 @@ var StackItemContext = /* @__PURE__ */ (0, import_react2.createContext)({
|
|
|
97
101
|
}
|
|
98
102
|
});
|
|
99
103
|
var useStackItem = () => (0, import_react2.useContext)(StackItemContext);
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const composedItemRef = (0, import_react_compose_refs.composeRefs)(stackRef, forwardedRef);
|
|
105
|
-
const [dropping, setDropping] = (0, import_react.useState)(false);
|
|
106
|
-
const arrowNavigationGroup = (0, import_react_tabster.useArrowNavigationGroup)({
|
|
107
|
-
axis: orientation
|
|
108
|
-
});
|
|
109
|
-
const styles = {
|
|
110
|
-
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: `repeat(${itemsCount}, min-content)`,
|
|
111
|
-
...style
|
|
112
|
-
};
|
|
113
|
-
const selfDroppable = !!(itemsCount < 1 && onRearrange && props.id);
|
|
114
|
-
(0, import_react.useLayoutEffect)(() => {
|
|
115
|
-
if (!stackElement || !selfDroppable) {
|
|
104
|
+
var useStackDropForElements = ({ element, selfDroppable, orientation, id, onRearrange }) => {
|
|
105
|
+
const [dropping, setDropping] = (0, import_react3.useState)(false);
|
|
106
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
107
|
+
if (!element || !selfDroppable) {
|
|
116
108
|
return;
|
|
117
109
|
}
|
|
118
110
|
const acceptSourceType = orientation === "horizontal" ? "column" : "card";
|
|
119
|
-
return (0, import_adapter.dropTargetForElements)({
|
|
120
|
-
element
|
|
121
|
-
getData: ({ input, element }) => {
|
|
111
|
+
return (0, import_combine.combine)((0, import_adapter.dropTargetForElements)({
|
|
112
|
+
element,
|
|
113
|
+
getData: ({ input, element: element2 }) => {
|
|
122
114
|
return (0, import_closest_edge.attachClosestEdge)({
|
|
123
|
-
id
|
|
115
|
+
id,
|
|
124
116
|
type: orientation === "horizontal" ? "card" : "column"
|
|
125
117
|
}, {
|
|
126
118
|
input,
|
|
127
|
-
element,
|
|
119
|
+
element: element2,
|
|
128
120
|
allowedEdges: [
|
|
129
121
|
orientation === "horizontal" ? "left" : "top"
|
|
130
122
|
]
|
|
@@ -140,17 +132,68 @@ var Stack = /* @__PURE__ */ (0, import_react.forwardRef)(({ children, classNames
|
|
|
140
132
|
setDropping(true);
|
|
141
133
|
}
|
|
142
134
|
},
|
|
143
|
-
onDragLeave: () =>
|
|
135
|
+
onDragLeave: () => {
|
|
136
|
+
return setDropping(false);
|
|
137
|
+
},
|
|
144
138
|
onDrop: ({ self, source }) => {
|
|
145
139
|
setDropping(false);
|
|
146
|
-
if (source.data.type === acceptSourceType && selfDroppable) {
|
|
140
|
+
if (source.data.type === acceptSourceType && selfDroppable && onRearrange) {
|
|
147
141
|
onRearrange(source.data, self.data, (0, import_closest_edge.extractClosestEdge)(self.data));
|
|
148
142
|
}
|
|
149
143
|
}
|
|
150
|
-
})
|
|
144
|
+
}), (0, import_element.autoScrollForElements)({
|
|
145
|
+
element,
|
|
146
|
+
getAllowedAxis: () => orientation
|
|
147
|
+
}));
|
|
151
148
|
}, [
|
|
152
|
-
|
|
153
|
-
selfDroppable
|
|
149
|
+
element,
|
|
150
|
+
selfDroppable,
|
|
151
|
+
orientation,
|
|
152
|
+
id,
|
|
153
|
+
onRearrange
|
|
154
|
+
]);
|
|
155
|
+
return {
|
|
156
|
+
dropping
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
var railGridHorizontal = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
|
|
160
|
+
var railGridVertical = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
|
|
161
|
+
var railGridHorizontalContainFitContent = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_fit-content(calc(100%-var(--rail-size)*2+2px))_[content-end]]";
|
|
162
|
+
var railGridVerticalContainFitContent = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_fit-content(calc(100%-var(--rail-size)*2+2px))_[content-end]]";
|
|
163
|
+
var autoScrollRootAttributes = {
|
|
164
|
+
"data-drag-autoscroll": "idle"
|
|
165
|
+
};
|
|
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
|
+
const [stackElement, stackRef] = (0, import_react.useState)(null);
|
|
168
|
+
const composedItemRef = (0, import_react_compose_refs.composeRefs)(stackRef, forwardedRef);
|
|
169
|
+
const arrowNavigationGroup = (0, import_react_tabster.useArrowNavigationGroup)({
|
|
170
|
+
axis: orientation
|
|
171
|
+
});
|
|
172
|
+
const styles = {
|
|
173
|
+
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: `repeat(${itemsCount}, min-content) [tabster-dummies] 0`,
|
|
174
|
+
...style
|
|
175
|
+
};
|
|
176
|
+
const selfDroppable = !!(itemsCount < 1 && onRearrange && props.id);
|
|
177
|
+
const { dropping } = useStackDropForElements({
|
|
178
|
+
id: props.id,
|
|
179
|
+
element: stackElement,
|
|
180
|
+
selfDroppable,
|
|
181
|
+
orientation,
|
|
182
|
+
onRearrange
|
|
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
|
|
154
197
|
]);
|
|
155
198
|
return /* @__PURE__ */ import_react.default.createElement(StackContext.Provider, {
|
|
156
199
|
value: {
|
|
@@ -162,17 +205,21 @@ var Stack = /* @__PURE__ */ (0, import_react.forwardRef)(({ children, classNames
|
|
|
162
205
|
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
163
206
|
...props,
|
|
164
207
|
...arrowNavigationGroup,
|
|
165
|
-
className: (0, import_react_ui_theme.mx)("grid relative",
|
|
208
|
+
className: (0, import_react_ui_theme.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),
|
|
209
|
+
"data-rail": rail,
|
|
166
210
|
"aria-orientation": orientation,
|
|
167
211
|
style: styles,
|
|
168
212
|
ref: composedItemRef
|
|
169
213
|
}, children, selfDroppable && dropping && /* @__PURE__ */ import_react.default.createElement(import_react_ui.ListItem.DropIndicator, {
|
|
214
|
+
lineInset: 8,
|
|
215
|
+
terminalInset: -8,
|
|
216
|
+
gap: -8,
|
|
170
217
|
edge: orientation === "horizontal" ? "left" : "top"
|
|
171
218
|
})));
|
|
172
219
|
});
|
|
173
|
-
var StackItemContent = /* @__PURE__ */ (0,
|
|
220
|
+
var StackItemContent = /* @__PURE__ */ (0, import_react5.forwardRef)(({ children, toolbar, statusbar, classNames, size = "intrinsic", ...props }, forwardedRef) => {
|
|
174
221
|
const { size: stackItemSize } = useStack();
|
|
175
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
176
223
|
role: "none",
|
|
177
224
|
...props,
|
|
178
225
|
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),
|
|
@@ -193,7 +240,7 @@ var StackItemContent = /* @__PURE__ */ (0, import_react4.forwardRef)(({ children
|
|
|
193
240
|
var StackItemDragHandle = ({ asChild, children }) => {
|
|
194
241
|
const { selfDragHandleRef } = useStackItem();
|
|
195
242
|
const Root = asChild ? import_react_slot.Slot : "div";
|
|
196
|
-
return /* @__PURE__ */
|
|
243
|
+
return /* @__PURE__ */ import_react6.default.createElement(Root, {
|
|
197
244
|
ref: selfDragHandleRef,
|
|
198
245
|
role: "button"
|
|
199
246
|
}, children);
|
|
@@ -203,7 +250,7 @@ var StackItemHeading = ({ children, classNames, ...props }) => {
|
|
|
203
250
|
const focusableGroupAttrs = (0, import_react_tabster3.useFocusableGroup)({
|
|
204
251
|
tabBehavior: "limited"
|
|
205
252
|
});
|
|
206
|
-
return /* @__PURE__ */
|
|
253
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
207
254
|
role: "heading",
|
|
208
255
|
...props,
|
|
209
256
|
tabIndex: 0,
|
|
@@ -211,99 +258,36 @@ var StackItemHeading = ({ children, classNames, ...props }) => {
|
|
|
211
258
|
className: (0, import_react_ui_theme4.mx)("flex items-center dx-focus-ring-inset-over-all relative !border-is-0", orientation === "horizontal" ? "bs-[--rail-size]" : "is-[--rail-size] flex-col", classNames)
|
|
212
259
|
}, children);
|
|
213
260
|
};
|
|
214
|
-
var StackItemHeadingLabel = /* @__PURE__ */ (0,
|
|
261
|
+
var StackItemHeadingLabel = /* @__PURE__ */ (0, import_react7.forwardRef)(({ attendableId, related, classNames, ...props }, forwardedRef) => {
|
|
215
262
|
const { hasAttention, isAncestor, isRelated } = (0, import_react_ui_attention.useAttention)(attendableId);
|
|
216
|
-
return /* @__PURE__ */
|
|
263
|
+
return /* @__PURE__ */ import_react7.default.createElement("h1", {
|
|
217
264
|
...props,
|
|
218
265
|
"data-attention": (related && isRelated || hasAttention || isAncestor).toString(),
|
|
219
266
|
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),
|
|
220
267
|
ref: forwardedRef
|
|
221
268
|
});
|
|
222
269
|
});
|
|
223
|
-
var REM = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
224
270
|
var MIN_WIDTH = 20;
|
|
225
271
|
var MIN_HEIGHT = 3;
|
|
226
|
-
var measureStackItem = (element) => {
|
|
227
|
-
const stackItemElement = element.closest("[data-dx-stack-item]");
|
|
228
|
-
return stackItemElement?.getBoundingClientRect() ?? {
|
|
229
|
-
width: DEFAULT_EXTRINSIC_SIZE,
|
|
230
|
-
height: DEFAULT_EXTRINSIC_SIZE
|
|
231
|
-
};
|
|
232
|
-
};
|
|
233
|
-
var getNextSize = (startSize, location, client) => {
|
|
234
|
-
return Math.max(client === "clientX" ? MIN_WIDTH : MIN_HEIGHT, startSize + (location.current.input[client] - location.initial.input[client]) / REM);
|
|
235
|
-
};
|
|
236
272
|
var StackItemResizeHandle = () => {
|
|
237
273
|
const { orientation } = useStack();
|
|
238
274
|
const { setSize, size } = useStackItem();
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
(0, import_adapter3.draggable)({
|
|
247
|
-
element: buttonRef.current,
|
|
248
|
-
onGenerateDragPreview: ({ nativeSetDragImage }) => {
|
|
249
|
-
(0, import_disable_native_drag_preview.disableNativeDragPreview)({
|
|
250
|
-
nativeSetDragImage
|
|
251
|
-
});
|
|
252
|
-
import_prevent_unhandled.preventUnhandled.start();
|
|
253
|
-
},
|
|
254
|
-
onDragStart: () => {
|
|
255
|
-
dragStartSize.current = dragStartSize.current === "min-content" ? measureStackItem(buttonRef.current)[orientation === "horizontal" ? "width" : "height"] / REM : dragStartSize.current;
|
|
256
|
-
},
|
|
257
|
-
onDrag: ({ location }) => {
|
|
258
|
-
if (typeof dragStartSize.current !== "number") {
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
setSize(getNextSize(dragStartSize.current, location, client));
|
|
262
|
-
},
|
|
263
|
-
onDrop: ({ location }) => {
|
|
264
|
-
if (typeof dragStartSize.current !== "number") {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
const nextSize = getNextSize(dragStartSize.current, location, client);
|
|
268
|
-
setSize(nextSize, true);
|
|
269
|
-
dragStartSize.current = nextSize;
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
}, []);
|
|
273
|
-
return /* @__PURE__ */ import_react7.default.createElement("button", {
|
|
274
|
-
ref: buttonRef,
|
|
275
|
-
className: (0, import_react_ui_theme5.mx)("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")
|
|
276
|
-
}, /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
277
|
-
role: "none",
|
|
278
|
-
className: (0, import_react_ui_theme5.mx)("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")
|
|
279
|
-
}, /* @__PURE__ */ import_react7.default.createElement(DragHandleSignifier, {
|
|
280
|
-
orientation
|
|
281
|
-
})));
|
|
282
|
-
};
|
|
283
|
-
var DragHandleSignifier = ({ orientation }) => {
|
|
284
|
-
return /* @__PURE__ */ import_react7.default.createElement("svg", {
|
|
285
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
286
|
-
viewBox: "0 0 256 256",
|
|
287
|
-
fill: "currentColor",
|
|
288
|
-
className: (0, import_react_ui_theme5.mx)("shrink-0 bs-[1em] is-[1em] text-unAccent", orientation === "vertical" && "rotate-90")
|
|
289
|
-
}, /* @__PURE__ */ import_react7.default.createElement("path", {
|
|
290
|
-
d: "M256,64c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
291
|
-
}), /* @__PURE__ */ import_react7.default.createElement("path", {
|
|
292
|
-
d: "M256,120c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
293
|
-
}), /* @__PURE__ */ import_react7.default.createElement("path", {
|
|
294
|
-
d: "M256,176c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
295
|
-
}), /* @__PURE__ */ import_react7.default.createElement("path", {
|
|
296
|
-
d: "M256,232c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
297
|
-
}));
|
|
275
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react_ui_dnd2.ResizeHandle, {
|
|
276
|
+
side: orientation === "horizontal" ? "inline-end" : "block-end",
|
|
277
|
+
fallbackSize: DEFAULT_EXTRINSIC_SIZE,
|
|
278
|
+
minSize: orientation === "horizontal" ? MIN_WIDTH : MIN_HEIGHT,
|
|
279
|
+
size,
|
|
280
|
+
onSizeChange: setSize
|
|
281
|
+
});
|
|
298
282
|
};
|
|
299
|
-
var MenuSignifierHorizontal = () => /* @__PURE__ */
|
|
283
|
+
var MenuSignifierHorizontal = () => /* @__PURE__ */ import_react10.default.createElement("svg", {
|
|
300
284
|
className: "absolute block-end-[7px]",
|
|
301
285
|
width: 20,
|
|
302
286
|
height: 2,
|
|
303
287
|
viewBox: "0 0 20 2",
|
|
304
288
|
stroke: "currentColor",
|
|
305
289
|
opacity: 0.5
|
|
306
|
-
}, /* @__PURE__ */
|
|
290
|
+
}, /* @__PURE__ */ import_react10.default.createElement("line", {
|
|
307
291
|
x1: 0.5,
|
|
308
292
|
y1: 0.75,
|
|
309
293
|
x2: 19,
|
|
@@ -329,10 +313,10 @@ var translations_default = [
|
|
|
329
313
|
}
|
|
330
314
|
}
|
|
331
315
|
];
|
|
332
|
-
var StackItemSigilButton = /* @__PURE__ */ (0,
|
|
316
|
+
var StackItemSigilButton = /* @__PURE__ */ (0, import_react9.forwardRef)(({ attendableId, classNames, related, children, ...props }, forwardedRef) => {
|
|
333
317
|
const { hasAttention, isAncestor, isRelated } = (0, import_react_ui_attention2.useAttention)(attendableId);
|
|
334
318
|
const variant = related && isRelated || hasAttention || isAncestor ? "primary" : "ghost";
|
|
335
|
-
return /* @__PURE__ */
|
|
319
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Button, {
|
|
336
320
|
...props,
|
|
337
321
|
variant,
|
|
338
322
|
classNames: [
|
|
@@ -340,29 +324,29 @@ var StackItemSigilButton = /* @__PURE__ */ (0, import_react8.forwardRef)(({ atte
|
|
|
340
324
|
classNames
|
|
341
325
|
],
|
|
342
326
|
ref: forwardedRef
|
|
343
|
-
}, /* @__PURE__ */
|
|
327
|
+
}, /* @__PURE__ */ import_react9.default.createElement(MenuSignifierHorizontal, null), children);
|
|
344
328
|
});
|
|
345
|
-
var StackItemSigil = /* @__PURE__ */ (0,
|
|
329
|
+
var StackItemSigil = /* @__PURE__ */ (0, import_react9.forwardRef)(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
346
330
|
const { t } = (0, import_react_ui3.useTranslation)(translationKey);
|
|
347
|
-
const suppressNextTooltip = (0,
|
|
348
|
-
const [optionsMenuOpen, setOptionsMenuOpen] = (0,
|
|
331
|
+
const suppressNextTooltip = (0, import_react9.useRef)(false);
|
|
332
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = (0, import_react9.useState)(false);
|
|
349
333
|
const hasActions = actionGroups && actionGroups.length > 0;
|
|
350
|
-
const button = /* @__PURE__ */
|
|
334
|
+
const button = /* @__PURE__ */ import_react9.default.createElement(StackItemSigilButton, {
|
|
351
335
|
attendableId,
|
|
352
336
|
related,
|
|
353
337
|
// TODO(wittjosiah): Better disabling of interactive styles when no action are available.
|
|
354
338
|
// Remove underscore icon when no actions are available?
|
|
355
339
|
classNames: !hasActions && "cursor-default"
|
|
356
|
-
}, /* @__PURE__ */
|
|
340
|
+
}, /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
357
341
|
className: "sr-only"
|
|
358
|
-
}, triggerLabel), /* @__PURE__ */
|
|
342
|
+
}, triggerLabel), /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Icon, {
|
|
359
343
|
icon,
|
|
360
344
|
size: 5
|
|
361
345
|
}));
|
|
362
346
|
if (!hasActions) {
|
|
363
347
|
return button;
|
|
364
348
|
}
|
|
365
|
-
return /* @__PURE__ */
|
|
349
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Root, {
|
|
366
350
|
open: optionsMenuOpen,
|
|
367
351
|
onOpenChange: (nextOpen) => {
|
|
368
352
|
if (!nextOpen) {
|
|
@@ -370,20 +354,20 @@ var StackItemSigil = /* @__PURE__ */ (0, import_react8.forwardRef)(({ actions: a
|
|
|
370
354
|
}
|
|
371
355
|
return setOptionsMenuOpen(nextOpen);
|
|
372
356
|
}
|
|
373
|
-
}, /* @__PURE__ */
|
|
357
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Trigger, {
|
|
374
358
|
asChild: true,
|
|
375
359
|
ref: forwardedRef
|
|
376
|
-
}, button), /* @__PURE__ */
|
|
360
|
+
}, button), /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Portal, null, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Content, {
|
|
377
361
|
classNames: "z-[31]"
|
|
378
|
-
}, /* @__PURE__ */
|
|
379
|
-
const separator = index > 0 ? /* @__PURE__ */
|
|
380
|
-
return /* @__PURE__ */
|
|
362
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Viewport, null, actionGroups?.map((actions, index) => {
|
|
363
|
+
const separator = index > 0 ? /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Separator, null) : null;
|
|
364
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react9.Fragment, {
|
|
381
365
|
key: index
|
|
382
366
|
}, separator, actions.map((action) => {
|
|
383
367
|
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[(0, import_util.getHostPlatform)()];
|
|
384
368
|
const menuItemType = action.properties.menuItemType;
|
|
385
369
|
const Root = menuItemType === "toggle" ? import_react_ui3.DropdownMenu.CheckboxItem : import_react_ui3.DropdownMenu.Item;
|
|
386
|
-
return /* @__PURE__ */
|
|
370
|
+
return /* @__PURE__ */ import_react9.default.createElement(Root, {
|
|
387
371
|
key: action.id,
|
|
388
372
|
onClick: (event) => {
|
|
389
373
|
if (action.properties.disabled) {
|
|
@@ -400,34 +384,34 @@ var StackItemSigil = /* @__PURE__ */ (0, import_react8.forwardRef)(({ actions: a
|
|
|
400
384
|
...action.properties?.testId && {
|
|
401
385
|
"data-testid": action.properties.testId
|
|
402
386
|
}
|
|
403
|
-
}, /* @__PURE__ */
|
|
387
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Icon, {
|
|
404
388
|
icon: action.properties.icon ?? "ph--placeholder--regular",
|
|
405
389
|
size: 4
|
|
406
|
-
}), /* @__PURE__ */
|
|
390
|
+
}), /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
407
391
|
className: "grow truncate"
|
|
408
|
-
}, (0, import_react_ui3.toLocalizedString)(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */
|
|
392
|
+
}, (0, import_react_ui3.toLocalizedString)(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.ItemIndicator, {
|
|
409
393
|
asChild: true
|
|
410
|
-
}, /* @__PURE__ */
|
|
394
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Icon, {
|
|
411
395
|
icon: "ph--check--regular",
|
|
412
396
|
size: 4
|
|
413
|
-
})), shortcut && /* @__PURE__ */
|
|
414
|
-
className: (0,
|
|
397
|
+
})), shortcut && /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
398
|
+
className: (0, import_react_ui_theme5.mx)("shrink-0", import_react_ui_theme5.descriptionText)
|
|
415
399
|
}, (0, import_keyboard.keySymbols)(shortcut).join("")));
|
|
416
400
|
}));
|
|
417
|
-
}), children), /* @__PURE__ */
|
|
401
|
+
}), children), /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DropdownMenu.Arrow, null))));
|
|
418
402
|
});
|
|
419
403
|
var DEFAULT_HORIZONTAL_SIZE = 44;
|
|
420
404
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
421
405
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
422
|
-
var StackItemRoot = /* @__PURE__ */ (0,
|
|
423
|
-
const [itemElement, itemRef] = (0,
|
|
424
|
-
const [selfDragHandleElement, selfDragHandleRef] = (0,
|
|
425
|
-
const [closestEdge, setEdge] = (0,
|
|
406
|
+
var StackItemRoot = /* @__PURE__ */ (0, import_react4.forwardRef)(({ item, children, classNames, size: propsSize, onSizeChange, role, order, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
407
|
+
const [itemElement, itemRef] = (0, import_react4.useState)(null);
|
|
408
|
+
const [selfDragHandleElement, selfDragHandleRef] = (0, import_react4.useState)(null);
|
|
409
|
+
const [closestEdge, setEdge] = (0, import_react4.useState)(null);
|
|
426
410
|
const { orientation, rail, onRearrange } = useStack();
|
|
427
|
-
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = (0,
|
|
411
|
+
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = (0, import_react4.useState)(propsSize);
|
|
428
412
|
const Root = role ?? "div";
|
|
429
413
|
const composedItemRef = (0, import_react_compose_refs2.composeRefs)(itemRef, forwardedRef);
|
|
430
|
-
const setSize = (0,
|
|
414
|
+
const setSize = (0, import_react4.useCallback)((nextSize, commit) => {
|
|
431
415
|
setInternalSize(nextSize);
|
|
432
416
|
if (commit) {
|
|
433
417
|
onSizeChange?.(nextSize);
|
|
@@ -436,11 +420,11 @@ var StackItemRoot = /* @__PURE__ */ (0, import_react3.forwardRef)(({ item, child
|
|
|
436
420
|
onSizeChange
|
|
437
421
|
]);
|
|
438
422
|
const type = orientation === "horizontal" ? "column" : "card";
|
|
439
|
-
(0,
|
|
423
|
+
(0, import_react4.useLayoutEffect)(() => {
|
|
440
424
|
if (!itemElement || !onRearrange || disableRearrange) {
|
|
441
425
|
return;
|
|
442
426
|
}
|
|
443
|
-
return (0,
|
|
427
|
+
return (0, import_combine2.combine)((0, import_adapter2.draggable)({
|
|
444
428
|
element: itemElement,
|
|
445
429
|
...selfDragHandleElement && {
|
|
446
430
|
dragHandle: selfDragHandleElement
|
|
@@ -464,6 +448,10 @@ var StackItemRoot = /* @__PURE__ */ (0, import_react3.forwardRef)(({ item, child
|
|
|
464
448
|
},
|
|
465
449
|
onDragStart: () => {
|
|
466
450
|
document.body.removeAttribute("data-drag-preview");
|
|
451
|
+
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "active");
|
|
452
|
+
},
|
|
453
|
+
onDrop: () => {
|
|
454
|
+
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "idle");
|
|
467
455
|
}
|
|
468
456
|
}), (0, import_adapter2.dropTargetForElements)({
|
|
469
457
|
element: itemElement,
|
|
@@ -511,29 +499,30 @@ var StackItemRoot = /* @__PURE__ */ (0, import_react3.forwardRef)(({ item, child
|
|
|
511
499
|
const focusGroupAttrs = (0, import_react_tabster2.useFocusableGroup)({
|
|
512
500
|
tabBehavior: "limited"
|
|
513
501
|
});
|
|
514
|
-
return /* @__PURE__ */
|
|
502
|
+
return /* @__PURE__ */ import_react4.default.createElement(StackItemContext.Provider, {
|
|
515
503
|
value: {
|
|
516
504
|
selfDragHandleRef,
|
|
517
505
|
size,
|
|
518
506
|
setSize
|
|
519
507
|
}
|
|
520
|
-
}, /* @__PURE__ */
|
|
508
|
+
}, /* @__PURE__ */ import_react4.default.createElement(Root, {
|
|
521
509
|
...props,
|
|
522
510
|
tabIndex: 0,
|
|
523
511
|
...focusGroupAttrs,
|
|
524
|
-
className: (0, import_react_ui_theme2.mx)("group/stack-item grid relative dx-focus-ring-inset-over-all"
|
|
512
|
+
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),
|
|
525
513
|
"data-dx-stack-item": true,
|
|
514
|
+
...import_react_ui_dnd.resizeAttributes,
|
|
526
515
|
style: {
|
|
527
|
-
...size
|
|
528
|
-
[orientation === "horizontal" ? "inlineSize" : "blockSize"]: `${size}rem`
|
|
529
|
-
},
|
|
516
|
+
...(0, import_react_ui_dnd.sizeStyle)(size, orientation),
|
|
530
517
|
...Number.isFinite(order) && {
|
|
531
518
|
[orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
|
|
532
519
|
},
|
|
533
520
|
...style
|
|
534
521
|
},
|
|
535
522
|
ref: composedItemRef
|
|
536
|
-
}, children, closestEdge && /* @__PURE__ */
|
|
523
|
+
}, children, closestEdge && /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.ListItem.DropIndicator, {
|
|
524
|
+
lineInset: 8,
|
|
525
|
+
terminalInset: -8,
|
|
537
526
|
edge: closestEdge
|
|
538
527
|
})));
|
|
539
528
|
});
|
|
@@ -548,46 +537,46 @@ var StackItem = {
|
|
|
548
537
|
SigilButton: StackItemSigilButton
|
|
549
538
|
};
|
|
550
539
|
var LayoutControl = ({ icon, label, ...props }) => {
|
|
551
|
-
return /* @__PURE__ */
|
|
540
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Tooltip.Root, null, /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Tooltip.Trigger, {
|
|
552
541
|
asChild: true
|
|
553
|
-
}, /* @__PURE__ */
|
|
542
|
+
}, /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Button, {
|
|
554
543
|
variant: "ghost",
|
|
555
544
|
...props
|
|
556
|
-
}, /* @__PURE__ */
|
|
545
|
+
}, /* @__PURE__ */ import_react11.default.createElement("span", {
|
|
557
546
|
className: "sr-only"
|
|
558
|
-
}, label), /* @__PURE__ */
|
|
547
|
+
}, label), /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Icon, {
|
|
559
548
|
icon
|
|
560
|
-
}))), /* @__PURE__ */
|
|
549
|
+
}))), /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Tooltip.Portal, null, /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Tooltip.Content, {
|
|
561
550
|
side: "bottom"
|
|
562
551
|
}, label)));
|
|
563
552
|
};
|
|
564
|
-
var LayoutControls = /* @__PURE__ */ (0,
|
|
553
|
+
var LayoutControls = /* @__PURE__ */ (0, import_react11.forwardRef)(({ onClick, variant = "default", capabilities: can, isSolo, pin, close = false, children, ...props }, forwardedRef) => {
|
|
565
554
|
const { t } = (0, import_react_ui4.useTranslation)(translationKey);
|
|
566
555
|
const buttonClassNames = variant === "hide-disabled" ? "disabled:hidden !p-1" : "!p-1";
|
|
567
|
-
return /* @__PURE__ */
|
|
556
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.ButtonGroup, {
|
|
568
557
|
...props,
|
|
569
558
|
ref: forwardedRef
|
|
570
559
|
}, pin && !isSolo && [
|
|
571
560
|
"both",
|
|
572
561
|
"start"
|
|
573
|
-
].includes(pin) && /* @__PURE__ */
|
|
562
|
+
].includes(pin) && /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
574
563
|
label: t("pin start label"),
|
|
575
564
|
variant: "ghost",
|
|
576
565
|
classNames: buttonClassNames,
|
|
577
566
|
onClick: () => onClick?.("pin-start"),
|
|
578
567
|
icon: "ph--caret-line-left--regular"
|
|
579
|
-
}), can.solo && /* @__PURE__ */
|
|
568
|
+
}), can.solo && /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
580
569
|
label: t("solo layout label"),
|
|
581
570
|
classNames: buttonClassNames,
|
|
582
571
|
onClick: () => onClick?.("solo"),
|
|
583
572
|
icon: isSolo ? "ph--arrows-in--regular" : "ph--arrows-out--regular"
|
|
584
|
-
}), !isSolo && can.solo && /* @__PURE__ */
|
|
573
|
+
}), !isSolo && can.solo && /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
585
574
|
label: t("increment start label"),
|
|
586
575
|
disabled: !can.incrementStart,
|
|
587
576
|
classNames: buttonClassNames,
|
|
588
577
|
onClick: () => onClick?.("increment-start"),
|
|
589
578
|
icon: "ph--caret-left--regular"
|
|
590
|
-
}), /* @__PURE__ */
|
|
579
|
+
}), /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
591
580
|
label: t("increment end label"),
|
|
592
581
|
disabled: !can.incrementEnd,
|
|
593
582
|
classNames: buttonClassNames,
|
|
@@ -596,12 +585,12 @@ var LayoutControls = /* @__PURE__ */ (0, import_react10.forwardRef)(({ onClick,
|
|
|
596
585
|
})), pin && !isSolo && [
|
|
597
586
|
"both",
|
|
598
587
|
"end"
|
|
599
|
-
].includes(pin) && /* @__PURE__ */
|
|
588
|
+
].includes(pin) && /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
600
589
|
label: t("pin end label"),
|
|
601
590
|
classNames: buttonClassNames,
|
|
602
591
|
onClick: () => onClick?.("pin-end"),
|
|
603
592
|
icon: "ph--caret-line-right--regular"
|
|
604
|
-
}), close && !isSolo && /* @__PURE__ */
|
|
593
|
+
}), close && !isSolo && /* @__PURE__ */ import_react11.default.createElement(LayoutControl, {
|
|
605
594
|
label: t(`${typeof close === "string" ? "minify" : "close"} label`),
|
|
606
595
|
classNames: buttonClassNames,
|
|
607
596
|
onClick: () => onClick?.("close"),
|
|
@@ -619,8 +608,11 @@ var LayoutControls = /* @__PURE__ */ (0, import_react10.forwardRef)(({ onClick,
|
|
|
619
608
|
StackContext,
|
|
620
609
|
StackItem,
|
|
621
610
|
StackItemContext,
|
|
611
|
+
autoScrollRootAttributes,
|
|
622
612
|
railGridHorizontal,
|
|
613
|
+
railGridHorizontalContainFitContent,
|
|
623
614
|
railGridVertical,
|
|
615
|
+
railGridVerticalContainFitContent,
|
|
624
616
|
translations,
|
|
625
617
|
useStack,
|
|
626
618
|
useStackItem
|