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