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