@dxos/react-ui-stack 0.6.14-staging.e15392e → 0.7.0
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 +494 -335
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +3 -6
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +478 -326
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +3 -6
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +494 -335
- 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 +3 -6
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/components/LayoutControls.d.ts +19 -0
- package/dist/types/src/components/LayoutControls.d.ts.map +1 -0
- package/dist/types/src/components/MenuSignifier.d.ts +4 -0
- package/dist/types/src/components/MenuSignifier.d.ts.map +1 -0
- package/dist/types/src/components/Stack.d.ts +12 -12
- package/dist/types/src/components/Stack.d.ts.map +1 -1
- package/dist/types/src/components/Stack.stories.d.ts +6 -83
- package/dist/types/src/components/Stack.stories.d.ts.map +1 -1
- package/dist/types/src/components/StackContext.d.ts +19 -0
- package/dist/types/src/components/StackContext.d.ts.map +1 -0
- package/dist/types/src/components/StackItem.d.ts +41 -0
- package/dist/types/src/components/StackItem.d.ts.map +1 -0
- package/dist/types/src/components/StackItemContent.d.ts +9 -0
- package/dist/types/src/components/StackItemContent.d.ts.map +1 -0
- package/dist/types/src/components/StackItemHeading.d.ts +8 -0
- package/dist/types/src/components/StackItemHeading.d.ts.map +1 -0
- package/dist/types/src/components/StackItemResizeHandle.d.ts +3 -0
- package/dist/types/src/components/StackItemResizeHandle.d.ts.map +1 -0
- package/dist/types/src/components/StackItemSigil.d.ts +31 -0
- package/dist/types/src/components/StackItemSigil.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/testing/EditorContent.d.ts +2 -2
- package/dist/types/src/testing/EditorContent.d.ts.map +1 -1
- package/dist/types/src/testing/stack-manager.d.ts +0 -1
- package/dist/types/src/testing/stack-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +8 -8
- package/package.json +19 -20
- package/src/components/LayoutControls.tsx +131 -0
- package/src/components/MenuSignifier.tsx +33 -0
- package/src/components/Stack.stories.tsx +109 -182
- package/src/components/Stack.tsx +61 -156
- package/src/components/StackContext.tsx +38 -0
- package/src/components/StackItem.tsx +173 -0
- package/src/components/StackItemContent.tsx +49 -0
- package/src/components/StackItemHeading.tsx +55 -0
- package/src/components/StackItemResizeHandle.tsx +115 -0
- package/src/components/StackItemSigil.tsx +170 -0
- package/src/components/index.ts +3 -2
- package/src/playwright/smoke.spec.ts +3 -3
- package/src/testing/EditorContent.tsx +4 -4
- package/src/testing/stack-manager.ts +3 -7
- package/src/translations.ts +8 -8
- package/dist/types/src/components/CaretDownUp.d.ts +0 -4
- package/dist/types/src/components/CaretDownUp.d.ts.map +0 -1
- package/dist/types/src/components/ContentTypes.stories.d.ts +0 -96
- package/dist/types/src/components/ContentTypes.stories.d.ts.map +0 -1
- package/dist/types/src/components/Deck.stories.d.ts +0 -19
- package/dist/types/src/components/Deck.stories.d.ts.map +0 -1
- package/dist/types/src/components/Section.d.ts +0 -53
- package/dist/types/src/components/Section.d.ts.map +0 -1
- package/dist/types/src/components/Section.stories.d.ts +0 -36
- package/dist/types/src/components/Section.stories.d.ts.map +0 -1
- package/dist/types/src/components/style-fragments.d.ts +0 -2
- package/dist/types/src/components/style-fragments.d.ts.map +0 -1
- package/dist/types/src/next/Stack.d.ts +0 -9
- package/dist/types/src/next/Stack.d.ts.map +0 -1
- package/dist/types/src/next/Stack.stories.d.ts +0 -8
- package/dist/types/src/next/Stack.stories.d.ts.map +0 -1
- package/dist/types/src/next/StackItem.d.ts +0 -14
- package/dist/types/src/next/StackItem.d.ts.map +0 -1
- package/dist/types/src/next/index.d.ts +0 -2
- package/dist/types/src/next/index.d.ts.map +0 -1
- package/dist/types/src/testing/TableContent.d.ts +0 -20
- package/dist/types/src/testing/TableContent.d.ts.map +0 -1
- package/src/components/CaretDownUp.tsx +0 -31
- package/src/components/ContentTypes.stories.tsx +0 -104
- package/src/components/Deck.stories.tsx +0 -362
- package/src/components/Section.stories.tsx +0 -50
- package/src/components/Section.tsx +0 -378
- package/src/components/style-fragments.ts +0 -5
- package/src/next/Stack.stories.tsx +0 -148
- package/src/next/Stack.tsx +0 -30
- package/src/next/StackItem.tsx +0 -78
- package/src/next/index.ts +0 -5
- package/src/testing/TableContent.tsx +0 -119
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,374 +28,526 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
DEFAULT_EXTRINSIC_SIZE: () => DEFAULT_EXTRINSIC_SIZE,
|
|
32
|
+
DEFAULT_HORIZONTAL_SIZE: () => DEFAULT_HORIZONTAL_SIZE,
|
|
33
|
+
DEFAULT_VERTICAL_SIZE: () => DEFAULT_VERTICAL_SIZE,
|
|
34
|
+
LayoutControls: () => LayoutControls,
|
|
33
35
|
Stack: () => Stack,
|
|
34
|
-
|
|
36
|
+
StackContext: () => StackContext,
|
|
37
|
+
StackItem: () => StackItem,
|
|
38
|
+
railGridHorizontal: () => railGridHorizontal,
|
|
39
|
+
railGridVertical: () => railGridVertical,
|
|
35
40
|
translations: () => translations_default
|
|
36
41
|
});
|
|
37
42
|
module.exports = __toCommonJS(node_exports);
|
|
38
43
|
var import_react_tabster = require("@fluentui/react-tabster");
|
|
39
44
|
var import_react = __toESM(require("react"));
|
|
40
|
-
var import_react_resize_detector = require("react-resize-detector");
|
|
41
|
-
var import_react_ui = require("@dxos/react-ui");
|
|
42
|
-
var import_react_ui_mosaic = require("@dxos/react-ui-mosaic");
|
|
43
45
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
46
|
+
var import_react2 = require("react");
|
|
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_closest_edge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
|
|
50
|
+
var import_box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
|
|
44
51
|
var import_react_tabster2 = require("@fluentui/react-tabster");
|
|
45
|
-
var
|
|
46
|
-
var CollapsiblePrimitive = __toESM(require("@radix-ui/react-collapsible"));
|
|
52
|
+
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
47
53
|
var import_react3 = __toESM(require("react"));
|
|
48
|
-
var import_react_ui2 = require("@dxos/react-ui");
|
|
49
|
-
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
50
|
-
var import_react_ui_deck = require("@dxos/react-ui-deck");
|
|
51
|
-
var import_react_ui_mosaic2 = require("@dxos/react-ui-mosaic");
|
|
52
54
|
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
53
55
|
var import_react4 = __toESM(require("react"));
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
+
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
57
|
+
var import_react_tabster3 = require("@fluentui/react-tabster");
|
|
58
|
+
var import_react5 = __toESM(require("react"));
|
|
59
|
+
var import_react_ui_attention = require("@dxos/react-ui-attention");
|
|
60
|
+
var import_react_ui_theme4 = require("@dxos/react-ui-theme");
|
|
61
|
+
var import_adapter2 = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
62
|
+
var import_disable_native_drag_preview = require("@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview");
|
|
63
|
+
var import_prevent_unhandled = require("@atlaskit/pragmatic-drag-and-drop/prevent-unhandled");
|
|
64
|
+
var import_react6 = __toESM(require("react"));
|
|
65
|
+
var import_react_ui_theme5 = require("@dxos/react-ui-theme");
|
|
66
|
+
var import_react7 = __toESM(require("react"));
|
|
67
|
+
var import_keyboard = require("@dxos/keyboard");
|
|
68
|
+
var import_react_ui = require("@dxos/react-ui");
|
|
69
|
+
var import_react_ui_attention2 = require("@dxos/react-ui-attention");
|
|
70
|
+
var import_react_ui_theme6 = require("@dxos/react-ui-theme");
|
|
71
|
+
var import_util = require("@dxos/util");
|
|
72
|
+
var import_react8 = __toESM(require("react"));
|
|
73
|
+
var import_react9 = __toESM(require("react"));
|
|
74
|
+
var import_react_ui2 = require("@dxos/react-ui");
|
|
75
|
+
var StackContext = /* @__PURE__ */ (0, import_react2.createContext)({
|
|
76
|
+
orientation: "vertical",
|
|
77
|
+
rail: true,
|
|
78
|
+
size: "intrinsic",
|
|
79
|
+
separators: true
|
|
80
|
+
});
|
|
81
|
+
var useStack = () => (0, import_react2.useContext)(StackContext);
|
|
82
|
+
var StackItemContext = /* @__PURE__ */ (0, import_react2.createContext)({
|
|
83
|
+
selfDragHandleRef: () => {
|
|
84
|
+
},
|
|
85
|
+
size: "min-content",
|
|
86
|
+
setSize: () => {
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
var useStackItem = () => (0, import_react2.useContext)(StackItemContext);
|
|
90
|
+
var railGridHorizontal = "grid-rows-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
|
|
91
|
+
var railGridVertical = "grid-cols-[[rail-start]_var(--rail-size)_[content-start]_1fr_[content-end]]";
|
|
92
|
+
var Stack = /* @__PURE__ */ (0, import_react.forwardRef)(({ children, classNames, style, orientation = "vertical", rail = true, separators = true, size = "intrinsic", itemsCount = import_react.Children.count(children), ...props }, forwardedRef) => {
|
|
93
|
+
const arrowNavigationGroup = (0, import_react_tabster.useArrowNavigationGroup)({
|
|
94
|
+
axis: orientation
|
|
95
|
+
});
|
|
96
|
+
const styles = {
|
|
97
|
+
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: `repeat(${itemsCount}, min-content)`,
|
|
98
|
+
...style
|
|
99
|
+
};
|
|
100
|
+
return /* @__PURE__ */ import_react.default.createElement(StackContext.Provider, {
|
|
101
|
+
value: {
|
|
102
|
+
orientation,
|
|
103
|
+
rail,
|
|
104
|
+
size,
|
|
105
|
+
separators
|
|
106
|
+
}
|
|
107
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
108
|
+
...props,
|
|
109
|
+
...arrowNavigationGroup,
|
|
110
|
+
className: (0, import_react_ui_theme.mx)("grid relative", rail ? orientation === "horizontal" ? railGridHorizontal : railGridVertical : orientation === "horizontal" ? "grid-rows-1" : "grid-cols-1", size === "contain" && (orientation === "horizontal" ? "overflow-x-auto min-bs-0 bs-full max-bs-full" : "overflow-y-auto min-is-0 is-full max-is-full"), separators && (orientation === "horizontal" ? "divide-separator divide-x" : "divide-separator divide-y"), classNames),
|
|
111
|
+
"aria-orientation": orientation,
|
|
112
|
+
style: styles,
|
|
113
|
+
ref: forwardedRef
|
|
114
|
+
}, children));
|
|
115
|
+
});
|
|
116
|
+
var StackItemContent = ({ children, toolbar = true, statusbar, contentSize = "cover", classNames, ...props }) => {
|
|
117
|
+
const { size, separators } = useStack();
|
|
118
|
+
return /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
119
|
+
role: "none",
|
|
120
|
+
...props,
|
|
121
|
+
className: (0, import_react_ui_theme3.mx)("group grid grid-cols-[100%]", size === "contain" && "min-bs-0 overflow-hidden", separators && "divide-separator divide-y", classNames),
|
|
122
|
+
style: {
|
|
123
|
+
gridTemplateRows: [
|
|
124
|
+
...toolbar ? [
|
|
125
|
+
"var(--rail-action)"
|
|
126
|
+
] : [],
|
|
127
|
+
"1fr",
|
|
128
|
+
...statusbar ? [
|
|
129
|
+
"var(--statusbar-size)"
|
|
130
|
+
] : []
|
|
131
|
+
].join(" ")
|
|
132
|
+
}
|
|
133
|
+
}, children);
|
|
134
|
+
};
|
|
135
|
+
var StackItemHeading = ({ children, classNames, ...props }) => {
|
|
136
|
+
const { orientation } = useStack();
|
|
137
|
+
const { selfDragHandleRef } = useStackItem();
|
|
138
|
+
const focusableGroupAttrs = (0, import_react_tabster3.useFocusableGroup)({
|
|
139
|
+
tabBehavior: "limited"
|
|
140
|
+
});
|
|
141
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
142
|
+
role: "heading",
|
|
143
|
+
...props,
|
|
144
|
+
tabIndex: 0,
|
|
145
|
+
...focusableGroupAttrs,
|
|
146
|
+
className: (0, import_react_ui_theme4.mx)("flex items-center ch-focus-ring-inset-over-all relative !border-is-0", orientation === "horizontal" ? "bs-[--rail-size]" : "is-[--rail-size] flex-col", classNames),
|
|
147
|
+
ref: selfDragHandleRef
|
|
148
|
+
}, children);
|
|
149
|
+
};
|
|
150
|
+
var StackItemHeadingLabel = /* @__PURE__ */ (0, import_react5.forwardRef)(({ attendableId, related, classNames, ...props }, forwardedRef) => {
|
|
151
|
+
const { hasAttention, isAncestor, isRelated } = (0, import_react_ui_attention.useAttention)(attendableId);
|
|
152
|
+
return /* @__PURE__ */ import_react5.default.createElement("h1", {
|
|
153
|
+
...props,
|
|
154
|
+
"data-attention": (related && isRelated || hasAttention || isAncestor).toString(),
|
|
155
|
+
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", classNames),
|
|
156
|
+
ref: forwardedRef
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
var REM = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
160
|
+
var MIN_SIZE = 20;
|
|
161
|
+
var measureStackItem = (element) => {
|
|
162
|
+
const stackItemElement = element.closest("[data-dx-stack-item]");
|
|
163
|
+
return stackItemElement?.getBoundingClientRect() ?? {
|
|
164
|
+
width: DEFAULT_EXTRINSIC_SIZE,
|
|
165
|
+
height: DEFAULT_EXTRINSIC_SIZE
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
var getNextSize = (startSize, location, client) => {
|
|
169
|
+
return Math.max(MIN_SIZE, startSize + (location.current.input[client] - location.initial.input[client]) / REM);
|
|
170
|
+
};
|
|
171
|
+
var StackItemResizeHandle = () => {
|
|
172
|
+
const { orientation } = useStack();
|
|
173
|
+
const { setSize, size } = useStackItem();
|
|
174
|
+
const buttonRef = (0, import_react6.useRef)(null);
|
|
175
|
+
const dragStartSize = (0, import_react6.useRef)(size);
|
|
176
|
+
const client = orientation === "horizontal" ? "clientX" : "clientY";
|
|
177
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
178
|
+
if (!buttonRef.current || buttonRef.current.hasAttribute("draggable")) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
(0, import_adapter2.draggable)({
|
|
182
|
+
element: buttonRef.current,
|
|
183
|
+
onGenerateDragPreview: ({ nativeSetDragImage }) => {
|
|
184
|
+
(0, import_disable_native_drag_preview.disableNativeDragPreview)({
|
|
185
|
+
nativeSetDragImage
|
|
186
|
+
});
|
|
187
|
+
import_prevent_unhandled.preventUnhandled.start();
|
|
188
|
+
},
|
|
189
|
+
onDragStart: () => {
|
|
190
|
+
dragStartSize.current = dragStartSize.current === "min-content" ? measureStackItem(buttonRef.current)[orientation === "horizontal" ? "width" : "height"] / REM : dragStartSize.current;
|
|
191
|
+
},
|
|
192
|
+
onDrag: ({ location }) => {
|
|
193
|
+
if (typeof dragStartSize.current !== "number") {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
setSize(getNextSize(dragStartSize.current, location, client));
|
|
197
|
+
},
|
|
198
|
+
onDrop: ({ location }) => {
|
|
199
|
+
if (typeof dragStartSize.current !== "number") {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const nextSize = getNextSize(dragStartSize.current, location, client);
|
|
203
|
+
setSize(nextSize, true);
|
|
204
|
+
dragStartSize.current = nextSize;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}, []);
|
|
208
|
+
return /* @__PURE__ */ import_react6.default.createElement("button", {
|
|
209
|
+
ref: buttonRef,
|
|
210
|
+
className: (0, import_react_ui_theme5.mx)(orientation === "horizontal" ? "cursor-col-resize" : "cursor-row-resize", "group absolute is-3 bs-full inline-end-[-1px] !border-lb-0", "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:inset-block-0 before:inline-end-0 before:is-1 before:bg-accentFocusIndicator")
|
|
211
|
+
}, /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
212
|
+
role: "none",
|
|
213
|
+
className: "absolute block-start-0 inline-end-[1px] bs-[--rail-size] flex items-center group-hover:opacity-0 group-focus-visible:opacity-0 group-active:opacity-0"
|
|
214
|
+
}, /* @__PURE__ */ import_react6.default.createElement(DragHandleSignifier, null)));
|
|
215
|
+
};
|
|
216
|
+
var DragHandleSignifier = () => {
|
|
217
|
+
return /* @__PURE__ */ import_react6.default.createElement("svg", {
|
|
56
218
|
xmlns: "http://www.w3.org/2000/svg",
|
|
57
219
|
viewBox: "0 0 256 256",
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
strokeWidth: "16"
|
|
70
|
-
}), /* @__PURE__ */ import_react4.default.createElement("polyline", {
|
|
71
|
-
points: "80 32 128 80 176 32",
|
|
72
|
-
fill: "none",
|
|
73
|
-
stroke: "currentColor",
|
|
74
|
-
strokeLinecap: "round",
|
|
75
|
-
strokeLinejoin: "round",
|
|
76
|
-
strokeWidth: "16"
|
|
77
|
-
}), children);
|
|
220
|
+
fill: "currentColor",
|
|
221
|
+
className: "shrink-0 bs-[1em] is-[1em] text-unAccent"
|
|
222
|
+
}, /* @__PURE__ */ import_react6.default.createElement("path", {
|
|
223
|
+
d: "M256,64c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
224
|
+
}), /* @__PURE__ */ import_react6.default.createElement("path", {
|
|
225
|
+
d: "M256,120c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
226
|
+
}), /* @__PURE__ */ import_react6.default.createElement("path", {
|
|
227
|
+
d: "M256,176c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
228
|
+
}), /* @__PURE__ */ import_react6.default.createElement("path", {
|
|
229
|
+
d: "M256,232c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z"
|
|
230
|
+
}));
|
|
78
231
|
};
|
|
79
|
-
var
|
|
232
|
+
var MenuSignifierHorizontal = () => /* @__PURE__ */ import_react8.default.createElement("svg", {
|
|
233
|
+
className: "absolute block-end-[7px]",
|
|
234
|
+
width: 20,
|
|
235
|
+
height: 2,
|
|
236
|
+
viewBox: "0 0 20 2",
|
|
237
|
+
stroke: "currentColor",
|
|
238
|
+
opacity: 0.5
|
|
239
|
+
}, /* @__PURE__ */ import_react8.default.createElement("line", {
|
|
240
|
+
x1: 0.5,
|
|
241
|
+
y1: 0.75,
|
|
242
|
+
x2: 19,
|
|
243
|
+
y2: 0.75,
|
|
244
|
+
strokeWidth: 1.25,
|
|
245
|
+
strokeLinecap: "round",
|
|
246
|
+
strokeDasharray: "6 20",
|
|
247
|
+
strokeDashoffset: "-6.5"
|
|
248
|
+
}));
|
|
80
249
|
var translationKey = "stack";
|
|
81
250
|
var translations_default = [
|
|
82
251
|
{
|
|
83
252
|
"en-US": {
|
|
84
253
|
[translationKey]: {
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
254
|
+
"resize label": "Drag to resize",
|
|
255
|
+
"pin start label": "Pin to the left sidebar",
|
|
256
|
+
"pin end label": "Pin to the right sidebar",
|
|
257
|
+
"increment start label": "Move to the left",
|
|
258
|
+
"increment end label": "Move to the right",
|
|
259
|
+
"solo plank label": "Toggle solo mode",
|
|
260
|
+
"close label": "Close",
|
|
261
|
+
"minify label": "Minify"
|
|
93
262
|
}
|
|
94
263
|
}
|
|
95
264
|
}
|
|
96
265
|
];
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
groupper: {},
|
|
104
|
-
focusable: {},
|
|
105
|
-
mover: {
|
|
106
|
-
cyclic: true,
|
|
107
|
-
direction: 1,
|
|
108
|
-
memorizeCurrent: false
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
const sectionContentGroup = (0, import_react_tabster2.useFocusableGroup)({});
|
|
112
|
-
const attendableAttrs = (0, import_react_ui_attention.useAttendableAttributes)(id);
|
|
113
|
-
return /* @__PURE__ */ import_react3.default.createElement(CollapsiblePrimitive.Root, {
|
|
114
|
-
asChild: true,
|
|
115
|
-
open: !collapsed,
|
|
116
|
-
onOpenChange: (nextOpen) => onCollapseSection?.(id, !nextOpen)
|
|
117
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ListItem.Root, {
|
|
118
|
-
ref: forwardedRef,
|
|
119
|
-
id,
|
|
120
|
-
...attendableAttrs,
|
|
266
|
+
var StackItemSigilButton = /* @__PURE__ */ (0, import_react7.forwardRef)(({ attendableId, classNames, related, children, ...props }, forwardedRef) => {
|
|
267
|
+
const { hasAttention, isAncestor, isRelated } = (0, import_react_ui_attention2.useAttention)(attendableId);
|
|
268
|
+
const variant = related && isRelated || hasAttention || isAncestor ? "primary" : "ghost";
|
|
269
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react_ui.Button, {
|
|
270
|
+
...props,
|
|
271
|
+
variant,
|
|
121
272
|
classNames: [
|
|
122
|
-
"
|
|
123
|
-
|
|
273
|
+
"m-1 shrink-0 pli-0 min-bs-0 is-[--rail-action] bs-[--rail-action] relative",
|
|
274
|
+
classNames
|
|
124
275
|
],
|
|
125
|
-
|
|
126
|
-
}, /* @__PURE__ */
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
276
|
+
ref: forwardedRef
|
|
277
|
+
}, /* @__PURE__ */ import_react7.default.createElement(MenuSignifierHorizontal, null), children);
|
|
278
|
+
});
|
|
279
|
+
var StackItemSigil = /* @__PURE__ */ (0, import_react7.forwardRef)(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
280
|
+
const { t } = (0, import_react_ui.useTranslation)(translationKey);
|
|
281
|
+
const suppressNextTooltip = (0, import_react7.useRef)(false);
|
|
282
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = (0, import_react7.useState)(false);
|
|
283
|
+
const [triggerTooltipOpen, setTriggerTooltipOpen] = (0, import_react7.useState)(false);
|
|
284
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react_ui.Tooltip.Root, {
|
|
285
|
+
open: triggerTooltipOpen,
|
|
286
|
+
onOpenChange: (nextOpen) => {
|
|
287
|
+
if (suppressNextTooltip.current) {
|
|
288
|
+
setTriggerTooltipOpen(false);
|
|
289
|
+
suppressNextTooltip.current = false;
|
|
290
|
+
} else {
|
|
291
|
+
setTriggerTooltipOpen(nextOpen);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui.DropdownMenu.Root, {
|
|
142
295
|
open: optionsMenuOpen,
|
|
143
|
-
onOpenChange:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
...draggableProps
|
|
149
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Icon, {
|
|
150
|
-
icon,
|
|
151
|
-
size: 5,
|
|
152
|
-
classNames: "transition-opacity"
|
|
153
|
-
})), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Portal, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Content, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Viewport, null, collapsed ? /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Item, {
|
|
154
|
-
onClick: onNavigate,
|
|
155
|
-
"data-testid": "section.navigate-to"
|
|
156
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react2.ArrowSquareOut, {
|
|
157
|
-
className: (0, import_react_ui_theme2.mx)((0, import_react_ui_theme2.getSize)(5), "mr-2")
|
|
158
|
-
}), /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
159
|
-
className: "grow"
|
|
160
|
-
}, t("navigate to section label"))) : /* @__PURE__ */ import_react3.default.createElement(CollapsiblePrimitive.Trigger, {
|
|
161
|
-
asChild: true
|
|
162
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Item, null, /* @__PURE__ */ import_react3.default.createElement(CaretDownUp, {
|
|
163
|
-
className: (0, import_react_ui_theme2.mx)((0, import_react_ui_theme2.getSize)(5), "mr-2")
|
|
164
|
-
}), /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
165
|
-
className: "grow"
|
|
166
|
-
}, t("collapse label")))), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Item, {
|
|
167
|
-
onClick: onAddBefore,
|
|
168
|
-
"data-testid": "section.add-before"
|
|
169
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react2.ArrowLineUp, {
|
|
170
|
-
className: (0, import_react_ui_theme2.mx)((0, import_react_ui_theme2.getSize)(5), "mr-2")
|
|
171
|
-
}), /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
172
|
-
className: "grow"
|
|
173
|
-
}, t("add section before label"))), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Item, {
|
|
174
|
-
onClick: onAddAfter,
|
|
175
|
-
"data-testid": "section.add-after"
|
|
176
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react2.ArrowLineDown, {
|
|
177
|
-
className: (0, import_react_ui_theme2.mx)((0, import_react_ui_theme2.getSize)(5), "mr-2")
|
|
178
|
-
}), /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
179
|
-
className: "grow"
|
|
180
|
-
}, t("add section after label"))), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Item, {
|
|
181
|
-
onClick: () => onDelete?.(),
|
|
182
|
-
"data-testid": "section.remove"
|
|
183
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react2.Trash, {
|
|
184
|
-
className: (0, import_react_ui_theme2.mx)((0, import_react_ui_theme2.getSize)(5), "mr-2")
|
|
185
|
-
}), /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
186
|
-
className: "grow"
|
|
187
|
-
}, t("remove section label")))), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Arrow, null)))), collapsed ? /* @__PURE__ */ import_react3.default.createElement(CollapsiblePrimitive.Trigger, {
|
|
188
|
-
asChild: true
|
|
189
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Button, {
|
|
190
|
-
variant: "ghost",
|
|
191
|
-
classNames: sectionActionDimensions
|
|
192
|
-
}, /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
193
|
-
className: "sr-only"
|
|
194
|
-
}, t("expand label")), /* @__PURE__ */ import_react3.default.createElement(import_react2.CaretUpDown, {
|
|
195
|
-
className: (0, import_react_ui_theme2.getSize)(4)
|
|
196
|
-
}))) : /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Button, {
|
|
197
|
-
variant: "ghost",
|
|
198
|
-
classNames: sectionActionDimensions,
|
|
199
|
-
onClick: onNavigate,
|
|
200
|
-
"data-testid": "section.navigate-to"
|
|
201
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react2.ArrowSquareOut, {
|
|
202
|
-
className: (0, import_react_ui_theme2.mx)((0, import_react_ui_theme2.getSize)(4))
|
|
203
|
-
}), /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
204
|
-
className: "sr-only"
|
|
205
|
-
}, t("navigate to section label"))))), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ListItem.Heading, {
|
|
206
|
-
classNames: collapsed ? [
|
|
207
|
-
"grid grid-rows-subgrid grid-cols-subgrid items-center",
|
|
208
|
-
import_react_ui_theme2.focusRing
|
|
209
|
-
] : "sr-only",
|
|
210
|
-
...collapsed && {
|
|
211
|
-
...sectionContentGroup,
|
|
212
|
-
tabIndex: 0
|
|
296
|
+
onOpenChange: (nextOpen) => {
|
|
297
|
+
if (!nextOpen) {
|
|
298
|
+
suppressNextTooltip.current = true;
|
|
299
|
+
}
|
|
300
|
+
return setOptionsMenuOpen(nextOpen);
|
|
213
301
|
}
|
|
214
|
-
}, /* @__PURE__ */
|
|
215
|
-
className: "truncate"
|
|
216
|
-
}, title)), size === "intrinsic" ? /* @__PURE__ */ import_react3.default.createElement(CollapsiblePrimitive.Content, {
|
|
217
|
-
...!collapsed && {
|
|
218
|
-
...sectionContentGroup,
|
|
219
|
-
tabIndex: 0
|
|
220
|
-
},
|
|
221
|
-
// TODO(burdon): Add margin to fragment?
|
|
222
|
-
className: (0, import_react_ui_theme2.mx)(import_react_ui_theme2.focusRing, "m-[2px]")
|
|
223
|
-
}, children) : /* @__PURE__ */ import_react3.default.createElement(CollapsiblePrimitive.Content, {
|
|
302
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui.Tooltip.Trigger, {
|
|
224
303
|
asChild: true
|
|
225
|
-
}, /* @__PURE__ */
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ScrollArea.Viewport, null, children), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ScrollArea.Scrollbar, {
|
|
233
|
-
orientation: "horizontal",
|
|
234
|
-
variant: "coarse",
|
|
235
|
-
classNames: "hidden has-[div]:flex !inline-end-[max(.25rem,var(--radix-scroll-area-corner-width))]"
|
|
236
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ScrollArea.Thumb, null)), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ScrollArea.Scrollbar, {
|
|
237
|
-
orientation: "vertical",
|
|
238
|
-
variant: "coarse",
|
|
239
|
-
classNames: "hidden has-[div]:flex"
|
|
240
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ScrollArea.Thumb, null)), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ScrollArea.Corner, null)))), isResizable && !collapsed && /* @__PURE__ */ import_react3.default.createElement("button", {
|
|
241
|
-
className: resizeHandleStyles
|
|
242
|
-
}, /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
304
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui.DropdownMenu.Trigger, {
|
|
305
|
+
asChild: true,
|
|
306
|
+
ref: forwardedRef
|
|
307
|
+
}, /* @__PURE__ */ import_react7.default.createElement(StackItemSigilButton, {
|
|
308
|
+
attendableId,
|
|
309
|
+
related
|
|
310
|
+
}, /* @__PURE__ */ import_react7.default.createElement("span", {
|
|
243
311
|
className: "sr-only"
|
|
244
|
-
},
|
|
312
|
+
}, triggerLabel), /* @__PURE__ */ import_react7.default.createElement(import_react_ui.Icon, {
|
|
313
|
+
icon,
|
|
314
|
+
size: 5
|
|
315
|
+
})))), /* @__PURE__ */ import_react7.default.createElement(import_react_ui.DropdownMenu.Portal, null, /* @__PURE__ */ import_react7.default.createElement(import_react_ui.DropdownMenu.Content, {
|
|
316
|
+
classNames: "z-[31]"
|
|
317
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui.DropdownMenu.Viewport, null, actionGroups?.map((actions, index) => {
|
|
318
|
+
const separator = index > 0 ? /* @__PURE__ */ import_react7.default.createElement(import_react_ui.DropdownMenu.Separator, null) : null;
|
|
319
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react7.Fragment, {
|
|
320
|
+
key: index
|
|
321
|
+
}, separator, actions.map((action) => {
|
|
322
|
+
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[(0, import_util.getHostPlatform)()];
|
|
323
|
+
const menuItemType = action.properties.menuItemType;
|
|
324
|
+
const Root = menuItemType === "toggle" ? import_react_ui.DropdownMenu.CheckboxItem : import_react_ui.DropdownMenu.Item;
|
|
325
|
+
return /* @__PURE__ */ import_react7.default.createElement(Root, {
|
|
326
|
+
key: action.id,
|
|
327
|
+
onClick: (event) => {
|
|
328
|
+
if (action.properties.disabled) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
event.stopPropagation();
|
|
332
|
+
suppressNextTooltip.current = true;
|
|
333
|
+
setOptionsMenuOpen(false);
|
|
334
|
+
onAction?.(action);
|
|
335
|
+
},
|
|
336
|
+
classNames: "gap-2",
|
|
337
|
+
disabled: action.properties.disabled,
|
|
338
|
+
checked: menuItemType === "toggle" ? action.properties.isChecked : void 0,
|
|
339
|
+
...action.properties?.testId && {
|
|
340
|
+
"data-testid": action.properties.testId
|
|
341
|
+
}
|
|
342
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui.Icon, {
|
|
343
|
+
icon: action.properties.icon ?? "ph--placeholder--regular",
|
|
344
|
+
size: 4
|
|
345
|
+
}), /* @__PURE__ */ import_react7.default.createElement("span", {
|
|
346
|
+
className: "grow truncate"
|
|
347
|
+
}, (0, import_react_ui.toLocalizedString)(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */ import_react7.default.createElement(import_react_ui.DropdownMenu.ItemIndicator, {
|
|
348
|
+
asChild: true
|
|
349
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui.Icon, {
|
|
350
|
+
icon: "ph--check--regular",
|
|
351
|
+
size: 4
|
|
352
|
+
})), shortcut && /* @__PURE__ */ import_react7.default.createElement("span", {
|
|
353
|
+
className: (0, import_react_ui_theme6.mx)("shrink-0", import_react_ui_theme6.descriptionText)
|
|
354
|
+
}, (0, import_keyboard.keySymbols)(shortcut).join("")));
|
|
355
|
+
}));
|
|
356
|
+
}), children), /* @__PURE__ */ import_react7.default.createElement(import_react_ui.DropdownMenu.Arrow, null)))), /* @__PURE__ */ import_react7.default.createElement(import_react_ui.Tooltip.Portal, null, /* @__PURE__ */ import_react7.default.createElement(import_react_ui.Tooltip.Content, {
|
|
357
|
+
style: {
|
|
358
|
+
zIndex: 70
|
|
359
|
+
},
|
|
360
|
+
side: "bottom"
|
|
361
|
+
}, triggerLabel, /* @__PURE__ */ import_react7.default.createElement(import_react_ui.Tooltip.Arrow, null))));
|
|
245
362
|
});
|
|
246
|
-
var
|
|
247
|
-
var
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const isResizable = !!itemContext?.isResizable;
|
|
262
|
-
const { transform, onDeleteSection, onNavigateToSection, onAddSection, onCollapseSection, SectionContent } = itemContext;
|
|
263
|
-
const transformedItem = transform ? transform(
|
|
264
|
-
item,
|
|
265
|
-
// TODO(wittjosiah): `active` doesn't always seem to be accurate here.
|
|
266
|
-
activeItem?.item.id === item.id ? activeItem?.type : type
|
|
267
|
-
) : item;
|
|
268
|
-
const placeholder = transformedItem.metadata?.placeholder ?? [
|
|
269
|
-
"untitled section title",
|
|
270
|
-
{
|
|
271
|
-
ns: translationKey
|
|
363
|
+
var DEFAULT_HORIZONTAL_SIZE = 44;
|
|
364
|
+
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
365
|
+
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
366
|
+
var StackItemRoot = /* @__PURE__ */ (0, import_react3.forwardRef)(({ item, children, classNames, onRearrange, size: propsSize, onSizeChange, role, order, style, ...props }, forwardedRef) => {
|
|
367
|
+
const [itemElement, itemRef] = (0, import_react3.useState)(null);
|
|
368
|
+
const [selfDragHandleElement, selfDragHandleRef] = (0, import_react3.useState)(null);
|
|
369
|
+
const [closestEdge, setEdge] = (0, import_react3.useState)(null);
|
|
370
|
+
const { orientation, rail, separators } = useStack();
|
|
371
|
+
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = (0, import_react3.useState)(propsSize);
|
|
372
|
+
const Root = role ?? "div";
|
|
373
|
+
const composedItemRef = (0, import_react_compose_refs.composeRefs)(itemRef, forwardedRef);
|
|
374
|
+
const setSize = (0, import_react3.useCallback)((nextSize, commit) => {
|
|
375
|
+
setInternalSize(nextSize);
|
|
376
|
+
if (commit) {
|
|
377
|
+
onSizeChange?.(nextSize);
|
|
272
378
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
const section = /* @__PURE__ */ import_react3.default.createElement(Section, {
|
|
276
|
-
ref: forwardedRef,
|
|
277
|
-
title,
|
|
278
|
-
id: transformedItem.id,
|
|
279
|
-
size: transformedItem.view?.size,
|
|
280
|
-
icon: transformedItem.metadata?.icon,
|
|
281
|
-
collapsed: transformedItem.view?.collapsed,
|
|
282
|
-
separation,
|
|
283
|
-
active,
|
|
284
|
-
draggableProps,
|
|
285
|
-
draggableStyle,
|
|
286
|
-
onCollapseSection,
|
|
287
|
-
isResizable,
|
|
288
|
-
onDelete: () => onDeleteSection?.(path),
|
|
289
|
-
onNavigate: () => onNavigateToSection?.(transformedItem),
|
|
290
|
-
onAddAfter: () => onAddSection?.(path, "after"),
|
|
291
|
-
onAddBefore: () => onAddSection?.(path, "before")
|
|
292
|
-
}, SectionContent && /* @__PURE__ */ import_react3.default.createElement(SectionContent, {
|
|
293
|
-
data: transformedItem.object
|
|
294
|
-
}));
|
|
295
|
-
return active === "overlay" ? /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.List, null, section) : section;
|
|
296
|
-
});
|
|
297
|
-
var DEFAULT_TYPE = "stack-section";
|
|
298
|
-
var Stack = ({ id, type = DEFAULT_TYPE, SectionContent, items = [], separation = true, transform, onOver, onDrop, onAddSection, onDeleteSection, onNavigateToSection, onCollapseSection, ...props }) => {
|
|
299
|
-
const { ref: containerRef, width = 0 } = (0, import_react_resize_detector.useResizeDetector)({
|
|
300
|
-
refreshRate: 200
|
|
301
|
-
});
|
|
302
|
-
const { operation, overItem } = (0, import_react_ui_mosaic.useMosaic)();
|
|
303
|
-
const itemsWithPreview = (0, import_react_ui_mosaic.useItemsWithPreview)({
|
|
304
|
-
path: id,
|
|
305
|
-
items
|
|
306
|
-
});
|
|
307
|
-
const getOverlayStyle = (0, import_react.useCallback)(() => ({
|
|
308
|
-
width
|
|
309
|
-
}), [
|
|
310
|
-
width
|
|
379
|
+
}, [
|
|
380
|
+
onSizeChange
|
|
311
381
|
]);
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
382
|
+
const type = orientation === "horizontal" ? "column" : "card";
|
|
383
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
384
|
+
if (!itemElement || !onRearrange) {
|
|
385
|
+
return;
|
|
316
386
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
387
|
+
return (0, import_combine.combine)((0, import_adapter.draggable)({
|
|
388
|
+
element: itemElement,
|
|
389
|
+
...selfDragHandleElement && {
|
|
390
|
+
dragHandle: selfDragHandleElement
|
|
391
|
+
},
|
|
392
|
+
getInitialData: () => ({
|
|
393
|
+
id: item.id,
|
|
394
|
+
type
|
|
395
|
+
})
|
|
396
|
+
}), (0, import_adapter.dropTargetForElements)({
|
|
397
|
+
element: itemElement,
|
|
398
|
+
getData: ({ input, element }) => {
|
|
399
|
+
return (0, import_closest_edge.attachClosestEdge)({
|
|
400
|
+
id: item.id,
|
|
401
|
+
type
|
|
402
|
+
}, {
|
|
403
|
+
input,
|
|
404
|
+
element,
|
|
405
|
+
allowedEdges: orientation === "horizontal" ? [
|
|
406
|
+
"left",
|
|
407
|
+
"right"
|
|
408
|
+
] : [
|
|
409
|
+
"top",
|
|
410
|
+
"bottom"
|
|
411
|
+
]
|
|
412
|
+
});
|
|
413
|
+
},
|
|
414
|
+
onDragEnter: ({ self, source }) => {
|
|
415
|
+
if (source.data.type === self.data.type) {
|
|
416
|
+
setEdge((0, import_closest_edge.extractClosestEdge)(self.data));
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
onDrag: ({ self, source }) => {
|
|
420
|
+
if (source.data.type === self.data.type) {
|
|
421
|
+
setEdge((0, import_closest_edge.extractClosestEdge)(self.data));
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
onDragLeave: () => setEdge(null),
|
|
425
|
+
onDrop: ({ self, source }) => {
|
|
426
|
+
setEdge(null);
|
|
427
|
+
if (source.data.type === self.data.type) {
|
|
428
|
+
onRearrange(source.data, self.data, (0, import_closest_edge.extractClosestEdge)(self.data));
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}));
|
|
432
|
+
}, [
|
|
433
|
+
orientation,
|
|
434
|
+
item,
|
|
435
|
+
onRearrange,
|
|
436
|
+
selfDragHandleElement,
|
|
437
|
+
itemElement
|
|
320
438
|
]);
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
439
|
+
const focusGroupAttrs = (0, import_react_tabster2.useFocusableGroup)({
|
|
440
|
+
tabBehavior: "limited"
|
|
441
|
+
});
|
|
442
|
+
return /* @__PURE__ */ import_react3.default.createElement(StackItemContext.Provider, {
|
|
443
|
+
value: {
|
|
444
|
+
selfDragHandleRef,
|
|
445
|
+
size,
|
|
446
|
+
setSize
|
|
324
447
|
}
|
|
325
|
-
|
|
326
|
-
}, []);
|
|
327
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_mosaic.Mosaic.Container, {
|
|
328
|
-
id,
|
|
329
|
-
type,
|
|
330
|
-
Component: SectionTile,
|
|
331
|
-
getOverlayStyle,
|
|
332
|
-
getOverlayProps,
|
|
333
|
-
onOver,
|
|
334
|
-
onDrop,
|
|
335
|
-
modifier: stackModifier
|
|
336
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_react_ui_mosaic.Mosaic.DroppableTile, {
|
|
337
|
-
path: id,
|
|
338
|
-
type,
|
|
339
|
-
item: {
|
|
340
|
-
id,
|
|
341
|
-
items: itemsWithPreview
|
|
342
|
-
},
|
|
343
|
-
// TODO(wittjosiah): Should this actually be a context?
|
|
344
|
-
itemContext: {
|
|
345
|
-
separation,
|
|
346
|
-
transform,
|
|
347
|
-
onDeleteSection,
|
|
348
|
-
onNavigateToSection,
|
|
349
|
-
onAddSection,
|
|
350
|
-
onCollapseSection,
|
|
351
|
-
SectionContent
|
|
352
|
-
},
|
|
353
|
-
isOver: overItem && !!overItem.path && import_react_ui_mosaic.Path.hasRoot(overItem.path, id) && (operation === "copy" || operation === "transfer"),
|
|
354
|
-
Component: StackTile,
|
|
448
|
+
}, /* @__PURE__ */ import_react3.default.createElement(Root, {
|
|
355
449
|
...props,
|
|
356
|
-
|
|
357
|
-
|
|
450
|
+
tabIndex: 0,
|
|
451
|
+
...focusGroupAttrs,
|
|
452
|
+
className: (0, import_react_ui_theme2.mx)("group/stack-item grid relative ch-focus-ring-inset-over-all", size === "min-content" && (orientation === "horizontal" ? "is-min" : "bs-min"), orientation === "horizontal" ? "grid-rows-subgrid" : "grid-cols-subgrid", rail && (orientation === "horizontal" ? "row-span-2" : "col-span-2"), separators && (orientation === "horizontal" ? "divide-separator divide-y" : "divide-separator divide-x"), classNames),
|
|
453
|
+
"data-dx-stack-item": true,
|
|
454
|
+
style: {
|
|
455
|
+
...size !== "min-content" && {
|
|
456
|
+
[orientation === "horizontal" ? "inlineSize" : "blockSize"]: `${size}rem`
|
|
457
|
+
},
|
|
458
|
+
...Number.isFinite(order) && {
|
|
459
|
+
[orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
|
|
460
|
+
},
|
|
461
|
+
...style
|
|
462
|
+
},
|
|
463
|
+
ref: composedItemRef
|
|
464
|
+
}, children, closestEdge && /* @__PURE__ */ import_react3.default.createElement(import_box.DropIndicator, {
|
|
465
|
+
edge: closestEdge
|
|
466
|
+
})));
|
|
467
|
+
});
|
|
468
|
+
var StackItem = {
|
|
469
|
+
Root: StackItemRoot,
|
|
470
|
+
Content: StackItemContent,
|
|
471
|
+
Heading: StackItemHeading,
|
|
472
|
+
HeadingLabel: StackItemHeadingLabel,
|
|
473
|
+
ResizeHandle: StackItemResizeHandle,
|
|
474
|
+
Sigil: StackItemSigil,
|
|
475
|
+
SigilButton: StackItemSigilButton
|
|
358
476
|
};
|
|
359
|
-
var
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
});
|
|
365
|
-
const { activeItem } = (0, import_react_ui_mosaic.useMosaic)();
|
|
366
|
-
const _group = (0, import_react_tabster.useFocusableGroup)();
|
|
367
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react_ui.List, {
|
|
368
|
-
ref: forwardedRef,
|
|
369
|
-
classNames: [
|
|
370
|
-
"grid relative",
|
|
371
|
-
stackColumns,
|
|
372
|
-
isOver && import_react_ui_theme.dropRingInner,
|
|
373
|
-
classNames
|
|
374
|
-
],
|
|
375
|
-
...!activeItem && domAttributes,
|
|
477
|
+
var LayoutControl = ({ icon, label, ...props }) => {
|
|
478
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react_ui2.Tooltip.Root, null, /* @__PURE__ */ import_react9.default.createElement(import_react_ui2.Tooltip.Trigger, {
|
|
479
|
+
asChild: true
|
|
480
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui2.Button, {
|
|
481
|
+
variant: "ghost",
|
|
376
482
|
...props
|
|
377
|
-
},
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
483
|
+
}, /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
484
|
+
className: "sr-only"
|
|
485
|
+
}, label), /* @__PURE__ */ import_react9.default.createElement(import_react_ui2.Icon, {
|
|
486
|
+
icon
|
|
487
|
+
}))), /* @__PURE__ */ import_react9.default.createElement(import_react_ui2.Tooltip.Portal, null, /* @__PURE__ */ import_react9.default.createElement(import_react_ui2.Tooltip.Content, {
|
|
488
|
+
side: "bottom",
|
|
489
|
+
classNames: "z-[70]"
|
|
490
|
+
}, label)));
|
|
491
|
+
};
|
|
492
|
+
var LayoutControls = /* @__PURE__ */ (0, import_react9.forwardRef)(({ onClick, variant = "default", capabilities: can, isSolo, pin, close = false, children, ...props }, forwardedRef) => {
|
|
493
|
+
const { t } = (0, import_react_ui2.useTranslation)(translationKey);
|
|
494
|
+
const buttonClassNames = variant === "hide-disabled" ? "disabled:hidden !p-1" : "!p-1";
|
|
495
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react_ui2.ButtonGroup, {
|
|
496
|
+
...props,
|
|
497
|
+
ref: forwardedRef
|
|
498
|
+
}, pin && !isSolo && [
|
|
499
|
+
"both",
|
|
500
|
+
"start"
|
|
501
|
+
].includes(pin) && /* @__PURE__ */ import_react9.default.createElement(LayoutControl, {
|
|
502
|
+
label: t("pin start label"),
|
|
503
|
+
variant: "ghost",
|
|
504
|
+
classNames: buttonClassNames,
|
|
505
|
+
onClick: () => onClick?.("pin-start"),
|
|
506
|
+
icon: "ph--caret-line-left--regular"
|
|
507
|
+
}), can.solo && /* @__PURE__ */ import_react9.default.createElement(LayoutControl, {
|
|
508
|
+
label: t("solo layout label"),
|
|
509
|
+
classNames: buttonClassNames,
|
|
510
|
+
onClick: () => onClick?.("solo"),
|
|
511
|
+
icon: isSolo ? "ph--arrows-in--regular" : "ph--arrows-out--regular"
|
|
512
|
+
}), !isSolo && can.solo && /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, /* @__PURE__ */ import_react9.default.createElement(LayoutControl, {
|
|
513
|
+
label: t("increment start label"),
|
|
514
|
+
disabled: !can.incrementStart,
|
|
515
|
+
classNames: buttonClassNames,
|
|
516
|
+
onClick: () => onClick?.("increment-start"),
|
|
517
|
+
icon: "ph--caret-left--regular"
|
|
518
|
+
}), /* @__PURE__ */ import_react9.default.createElement(LayoutControl, {
|
|
519
|
+
label: t("increment end label"),
|
|
520
|
+
disabled: !can.incrementEnd,
|
|
521
|
+
classNames: buttonClassNames,
|
|
522
|
+
onClick: () => onClick?.("increment-end"),
|
|
523
|
+
icon: "ph--caret-right--regular"
|
|
524
|
+
})), pin && !isSolo && [
|
|
525
|
+
"both",
|
|
526
|
+
"end"
|
|
527
|
+
].includes(pin) && /* @__PURE__ */ import_react9.default.createElement(LayoutControl, {
|
|
528
|
+
label: t("pin end label"),
|
|
529
|
+
classNames: buttonClassNames,
|
|
530
|
+
onClick: () => onClick?.("pin-end"),
|
|
531
|
+
icon: "ph--caret-line-right--regular"
|
|
532
|
+
}), close && !isSolo && /* @__PURE__ */ import_react9.default.createElement(LayoutControl, {
|
|
533
|
+
label: t(`${typeof close === "string" ? "minify" : "close"} label`),
|
|
534
|
+
classNames: buttonClassNames,
|
|
535
|
+
onClick: () => onClick?.("close"),
|
|
536
|
+
"data-testid": "layoutHeading.close",
|
|
537
|
+
icon: close === "minify-start" ? "ph--caret-line-left--regular" : close === "minify-end" ? "ph--caret-line-right--regular" : "ph--minus--regular"
|
|
538
|
+
}), children);
|
|
392
539
|
});
|
|
393
540
|
// Annotate the CommonJS export names for ESM import in node:
|
|
394
541
|
0 && (module.exports = {
|
|
395
|
-
|
|
396
|
-
|
|
542
|
+
DEFAULT_EXTRINSIC_SIZE,
|
|
543
|
+
DEFAULT_HORIZONTAL_SIZE,
|
|
544
|
+
DEFAULT_VERTICAL_SIZE,
|
|
545
|
+
LayoutControls,
|
|
397
546
|
Stack,
|
|
398
|
-
|
|
547
|
+
StackContext,
|
|
548
|
+
StackItem,
|
|
549
|
+
railGridHorizontal,
|
|
550
|
+
railGridVertical,
|
|
399
551
|
translations
|
|
400
552
|
});
|
|
401
553
|
//# sourceMappingURL=index.cjs.map
|