@dxos/react-ui-stack 0.6.14-staging.e15392e → 0.7.1-staging.599df14

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