@adecore/ui 0.49.7 → 0.50.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.
@@ -1,15 +1,17 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import 'react';
2
+ import { useState } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { useRender } from '@base-ui/react/use-render';
5
- import { WorkspaceContext } from './context.js';
5
+ import { TopRowSlotContext, WorkspaceContext } from './context.js';
6
6
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
7
7
  const isPresent = node => node !== undefined && node !== null && node !== false;
8
+ /** The sidebar, the toolbar and the content on one raised sheet, with the side panel and the rail behind it. */
8
9
  export function Workspace(t0) {
9
- const $ = _c(66);
10
+ const $ = _c(77);
10
11
  let children;
11
12
  let className;
12
13
  let props;
14
+ let rail;
13
15
  let ref;
14
16
  let render;
15
17
  let sidePanel;
@@ -27,6 +29,7 @@ export function Workspace(t0) {
27
29
  toolbar,
28
30
  sidebar,
29
31
  sidePanel,
32
+ rail,
30
33
  sidebarWidth: t2,
31
34
  sidePanelWidth: t3,
32
35
  sidebarOpen,
@@ -42,79 +45,92 @@ export function Workspace(t0) {
42
45
  $[1] = children;
43
46
  $[2] = className;
44
47
  $[3] = props;
45
- $[4] = ref;
46
- $[5] = render;
47
- $[6] = sidePanel;
48
- $[7] = sidePanelOpen;
49
- $[8] = sidebar;
50
- $[9] = sidebarOpen;
51
- $[10] = style;
52
- $[11] = t1;
53
- $[12] = t2;
54
- $[13] = t3;
55
- $[14] = toolbar;
48
+ $[4] = rail;
49
+ $[5] = ref;
50
+ $[6] = render;
51
+ $[7] = sidePanel;
52
+ $[8] = sidePanelOpen;
53
+ $[9] = sidebar;
54
+ $[10] = sidebarOpen;
55
+ $[11] = style;
56
+ $[12] = t1;
57
+ $[13] = t2;
58
+ $[14] = t3;
59
+ $[15] = toolbar;
56
60
  } else {
57
61
  children = $[1];
58
62
  className = $[2];
59
63
  props = $[3];
60
- ref = $[4];
61
- render = $[5];
62
- sidePanel = $[6];
63
- sidePanelOpen = $[7];
64
- sidebar = $[8];
65
- sidebarOpen = $[9];
66
- style = $[10];
67
- t1 = $[11];
68
- t2 = $[12];
69
- t3 = $[13];
70
- toolbar = $[14];
64
+ rail = $[4];
65
+ ref = $[5];
66
+ render = $[6];
67
+ sidePanel = $[7];
68
+ sidePanelOpen = $[8];
69
+ sidebar = $[9];
70
+ sidebarOpen = $[10];
71
+ style = $[11];
72
+ t1 = $[12];
73
+ t2 = $[13];
74
+ t3 = $[14];
75
+ toolbar = $[15];
71
76
  }
72
77
  const layout = t1 === undefined ? "standard" : t1;
73
78
  const sidebarWidth = t2 === undefined ? 248 : t2;
74
79
  const sidePanelWidth = t3 === undefined ? 320 : t3;
75
80
  let t4;
76
- if ($[15] !== sidebar) {
81
+ if ($[16] !== sidebar) {
77
82
  t4 = isPresent(sidebar);
78
- $[15] = sidebar;
79
- $[16] = t4;
83
+ $[16] = sidebar;
84
+ $[17] = t4;
80
85
  } else {
81
- t4 = $[16];
86
+ t4 = $[17];
82
87
  }
83
88
  const hasSidebar = t4;
84
89
  let t5;
85
- if ($[17] !== sidePanel) {
90
+ if ($[18] !== sidePanel) {
86
91
  t5 = isPresent(sidePanel);
87
- $[17] = sidePanel;
88
- $[18] = t5;
92
+ $[18] = sidePanel;
93
+ $[19] = t5;
89
94
  } else {
90
- t5 = $[18];
95
+ t5 = $[19];
91
96
  }
92
97
  const hasPanel = t5;
93
- const leftOpen = hasSidebar && (sidebarOpen ?? true);
94
- const rightOpen = hasPanel && (sidePanelOpen ?? true);
95
98
  let t6;
96
- if ($[19] !== toolbar) {
97
- t6 = isPresent(toolbar);
98
- $[19] = toolbar;
99
- $[20] = t6;
99
+ if ($[20] !== rail) {
100
+ t6 = isPresent(rail);
101
+ $[20] = rail;
102
+ $[21] = t6;
100
103
  } else {
101
- t6 = $[20];
104
+ t6 = $[21];
102
105
  }
103
- const hasToolbar = t6;
106
+ const hasRail = t6;
107
+ const leftOpen = hasSidebar && (sidebarOpen ?? true);
108
+ const rightOpen = hasPanel && (sidePanelOpen ?? true);
104
109
  let t7;
105
- if ($[21] !== className) {
106
- t7 = clsx("ade-workspace", className);
107
- $[21] = className;
108
- $[22] = t7;
110
+ if ($[22] !== toolbar) {
111
+ t7 = isPresent(toolbar);
112
+ $[22] = toolbar;
113
+ $[23] = t7;
109
114
  } else {
110
- t7 = $[22];
115
+ t7 = $[23];
111
116
  }
112
- const t8 = hasToolbar || undefined;
113
- const t9 = leftOpen || undefined;
114
- const t10 = rightOpen || undefined;
115
- let t11;
116
- if ($[23] !== hasSidebar || $[24] !== sidebar || $[25] !== sidebarWidth) {
117
- t11 = hasSidebar && /*#__PURE__*/_jsx("aside", {
117
+ const hasToolbar = t7;
118
+ const [topRowSlot, setTopRowSlot] = useState(null);
119
+ let t8;
120
+ if ($[24] !== className) {
121
+ t8 = clsx("ade-workspace", className);
122
+ $[24] = className;
123
+ $[25] = t8;
124
+ } else {
125
+ t8 = $[25];
126
+ }
127
+ const t9 = hasToolbar || undefined;
128
+ const t10 = leftOpen || undefined;
129
+ const t11 = rightOpen || undefined;
130
+ const t12 = hasRail || undefined;
131
+ let t13;
132
+ if ($[26] !== hasSidebar || $[27] !== sidebar || $[28] !== sidebarWidth) {
133
+ t13 = hasSidebar && /*#__PURE__*/_jsx("aside", {
118
134
  className: "ade-workspace-sidebar",
119
135
  "data-auto": sidebarWidth === "auto" || undefined,
120
136
  style: {
@@ -122,51 +138,63 @@ export function Workspace(t0) {
122
138
  },
123
139
  children: sidebar
124
140
  });
125
- $[23] = hasSidebar;
126
- $[24] = sidebar;
127
- $[25] = sidebarWidth;
128
- $[26] = t11;
141
+ $[26] = hasSidebar;
142
+ $[27] = sidebar;
143
+ $[28] = sidebarWidth;
144
+ $[29] = t13;
129
145
  } else {
130
- t11 = $[26];
146
+ t13 = $[29];
131
147
  }
132
- let t12;
133
- if ($[27] !== hasToolbar || $[28] !== toolbar) {
134
- t12 = hasToolbar && /*#__PURE__*/_jsx("div", {
148
+ let t14;
149
+ if ($[30] !== hasToolbar || $[31] !== toolbar) {
150
+ t14 = hasToolbar && /*#__PURE__*/_jsx("div", {
135
151
  className: "ade-workspace-toolbar",
136
152
  children: toolbar
137
153
  });
138
- $[27] = hasToolbar;
139
- $[28] = toolbar;
140
- $[29] = t12;
154
+ $[30] = hasToolbar;
155
+ $[31] = toolbar;
156
+ $[32] = t14;
141
157
  } else {
142
- t12 = $[29];
158
+ t14 = $[32];
143
159
  }
144
- let t13;
145
- if ($[30] !== children) {
146
- t13 = /*#__PURE__*/_jsx("div", {
160
+ let t15;
161
+ if ($[33] !== children) {
162
+ t15 = /*#__PURE__*/_jsx("div", {
147
163
  className: "ade-workspace-content",
148
164
  children: children
149
165
  });
150
- $[30] = children;
151
- $[31] = t13;
166
+ $[33] = children;
167
+ $[34] = t15;
152
168
  } else {
153
- t13 = $[31];
169
+ t15 = $[34];
154
170
  }
155
- let t14;
156
- if ($[32] !== t12 || $[33] !== t13) {
157
- t14 = /*#__PURE__*/_jsxs("div", {
171
+ let t16;
172
+ if ($[35] !== t14 || $[36] !== t15) {
173
+ t16 = /*#__PURE__*/_jsxs("div", {
158
174
  className: "ade-workspace-center",
159
- children: [t12, t13]
175
+ children: [t14, t15]
160
176
  });
161
- $[32] = t12;
162
- $[33] = t13;
163
- $[34] = t14;
177
+ $[35] = t14;
178
+ $[36] = t15;
179
+ $[37] = t16;
164
180
  } else {
165
- t14 = $[34];
181
+ t16 = $[37];
166
182
  }
167
- let t15;
168
- if ($[35] !== hasPanel || $[36] !== sidePanel || $[37] !== sidePanelWidth) {
169
- t15 = hasPanel && /*#__PURE__*/_jsx("aside", {
183
+ let t17;
184
+ if ($[38] !== t13 || $[39] !== t16) {
185
+ t17 = /*#__PURE__*/_jsxs("div", {
186
+ className: "ade-workspace-sheet",
187
+ children: [t13, t16]
188
+ });
189
+ $[38] = t13;
190
+ $[39] = t16;
191
+ $[40] = t17;
192
+ } else {
193
+ t17 = $[40];
194
+ }
195
+ let t18;
196
+ if ($[41] !== hasPanel || $[42] !== sidePanel || $[43] !== sidePanelWidth) {
197
+ t18 = hasPanel && /*#__PURE__*/_jsx("aside", {
170
198
  className: "ade-workspace-side-panel",
171
199
  "data-auto": sidePanelWidth === "auto" || undefined,
172
200
  style: {
@@ -174,107 +202,131 @@ export function Workspace(t0) {
174
202
  },
175
203
  children: sidePanel
176
204
  });
177
- $[35] = hasPanel;
178
- $[36] = sidePanel;
179
- $[37] = sidePanelWidth;
180
- $[38] = t15;
205
+ $[41] = hasPanel;
206
+ $[42] = sidePanel;
207
+ $[43] = sidePanelWidth;
208
+ $[44] = t18;
181
209
  } else {
182
- t15 = $[38];
210
+ t18 = $[44];
183
211
  }
184
- let t16;
185
- if ($[39] !== t11 || $[40] !== t14 || $[41] !== t15) {
186
- t16 = /*#__PURE__*/_jsxs(_Fragment, {
187
- children: [t11, t14, t15]
212
+ const t19 = hasRail && rail;
213
+ let t20;
214
+ if ($[45] !== t17 || $[46] !== t18 || $[47] !== t19) {
215
+ t20 = /*#__PURE__*/_jsxs(_Fragment, {
216
+ children: [t17, t18, t19]
188
217
  });
189
- $[39] = t11;
190
- $[40] = t14;
191
- $[41] = t15;
192
- $[42] = t16;
218
+ $[45] = t17;
219
+ $[46] = t18;
220
+ $[47] = t19;
221
+ $[48] = t20;
193
222
  } else {
194
- t16 = $[42];
223
+ t20 = $[48];
195
224
  }
196
- let t17;
197
- if ($[43] !== layout || $[44] !== props || $[45] !== style || $[46] !== t10 || $[47] !== t16 || $[48] !== t7 || $[49] !== t8 || $[50] !== t9) {
198
- t17 = {
225
+ let t21;
226
+ if ($[49] !== layout || $[50] !== props || $[51] !== style || $[52] !== t10 || $[53] !== t11 || $[54] !== t12 || $[55] !== t20 || $[56] !== t8 || $[57] !== t9) {
227
+ t21 = {
199
228
  ...props,
200
- className: t7,
229
+ className: t8,
201
230
  style,
202
231
  "data-layout": layout,
203
- "data-toolbar": t8,
204
- "data-sidebar": t9,
205
- "data-side-panel": t10,
206
- children: t16
232
+ "data-toolbar": t9,
233
+ "data-sidebar": t10,
234
+ "data-side-panel": t11,
235
+ "data-rail": t12,
236
+ children: t20
207
237
  };
208
- $[43] = layout;
209
- $[44] = props;
210
- $[45] = style;
211
- $[46] = t10;
212
- $[47] = t16;
213
- $[48] = t7;
214
- $[49] = t8;
215
- $[50] = t9;
216
- $[51] = t17;
238
+ $[49] = layout;
239
+ $[50] = props;
240
+ $[51] = style;
241
+ $[52] = t10;
242
+ $[53] = t11;
243
+ $[54] = t12;
244
+ $[55] = t20;
245
+ $[56] = t8;
246
+ $[57] = t9;
247
+ $[58] = t21;
217
248
  } else {
218
- t17 = $[51];
249
+ t21 = $[58];
219
250
  }
220
- let t18;
221
- if ($[52] !== ref || $[53] !== render || $[54] !== t17) {
222
- t18 = {
251
+ let t22;
252
+ if ($[59] !== ref || $[60] !== render || $[61] !== t21) {
253
+ t22 = {
223
254
  render,
224
255
  ref,
225
256
  defaultTagName: "div",
226
- props: t17
257
+ props: t21
227
258
  };
228
- $[52] = ref;
229
- $[53] = render;
230
- $[54] = t17;
231
- $[55] = t18;
259
+ $[59] = ref;
260
+ $[60] = render;
261
+ $[61] = t21;
262
+ $[62] = t22;
232
263
  } else {
233
- t18 = $[55];
264
+ t22 = $[62];
234
265
  }
235
- const element = useRender(t18);
236
- const t19 = !hasToolbar;
237
- const t20 = !rightOpen;
238
- const t21 = !leftOpen;
239
- let t22;
240
- if ($[56] !== t19 || $[57] !== t20 || $[58] !== t21) {
241
- t22 = {
242
- top: t19,
243
- right: t20,
266
+ const element = useRender(t22);
267
+ const t23 = !hasToolbar;
268
+ const t24 = !leftOpen;
269
+ let t25;
270
+ if ($[63] !== t23 || $[64] !== t24) {
271
+ t25 = {
272
+ top: t23,
273
+ right: true,
244
274
  bottom: true,
245
- left: t21
275
+ left: t24
246
276
  };
247
- $[56] = t19;
248
- $[57] = t20;
249
- $[58] = t21;
250
- $[59] = t22;
277
+ $[63] = t23;
278
+ $[64] = t24;
279
+ $[65] = t25;
251
280
  } else {
252
- t22 = $[59];
281
+ t25 = $[65];
253
282
  }
254
- let t23;
255
- if ($[60] !== layout || $[61] !== t22) {
256
- t23 = {
283
+ let t26;
284
+ if ($[66] !== layout || $[67] !== t25) {
285
+ t26 = {
257
286
  layout,
258
- edges: t22
287
+ edges: t25
259
288
  };
260
- $[60] = layout;
261
- $[61] = t22;
262
- $[62] = t23;
289
+ $[66] = layout;
290
+ $[67] = t25;
291
+ $[68] = t26;
263
292
  } else {
264
- t23 = $[62];
293
+ t26 = $[68];
265
294
  }
266
- const context = t23;
267
- let t24;
268
- if ($[63] !== context || $[64] !== element) {
269
- t24 = /*#__PURE__*/_jsx(WorkspaceContext, {
270
- value: context,
295
+ const context = t26;
296
+ let t27;
297
+ if ($[69] !== topRowSlot) {
298
+ t27 = {
299
+ slot: topRowSlot,
300
+ register: setTopRowSlot
301
+ };
302
+ $[69] = topRowSlot;
303
+ $[70] = t27;
304
+ } else {
305
+ t27 = $[70];
306
+ }
307
+ let t28;
308
+ if ($[71] !== element || $[72] !== t27) {
309
+ t28 = /*#__PURE__*/_jsx(TopRowSlotContext, {
310
+ value: t27,
271
311
  children: element
272
312
  });
273
- $[63] = context;
274
- $[64] = element;
275
- $[65] = t24;
313
+ $[71] = element;
314
+ $[72] = t27;
315
+ $[73] = t28;
316
+ } else {
317
+ t28 = $[73];
318
+ }
319
+ let t29;
320
+ if ($[74] !== context || $[75] !== t28) {
321
+ t29 = /*#__PURE__*/_jsx(WorkspaceContext, {
322
+ value: context,
323
+ children: t28
324
+ });
325
+ $[74] = context;
326
+ $[75] = t28;
327
+ $[76] = t29;
276
328
  } else {
277
- t24 = $[65];
329
+ t29 = $[76];
278
330
  }
279
- return t24;
331
+ return t29;
280
332
  }
@@ -0,0 +1,13 @@
1
+ import { useRender } from '@base-ui/react/use-render';
2
+ export type WorkspaceRailProps = useRender.ComponentProps<'nav'>;
3
+ /**
4
+ * The column of buttons at the right edge of a `Workspace`, 48 pixels wide. Its first separator stands on
5
+ * the top row's bottom line when one 32 pixel button comes before it. It makes no stacking context, so a
6
+ * hover never covers the sheet's edge; a tooltip still rises above the sheet.
7
+ */
8
+ export declare function WorkspaceRail({ className, render, ref, ...props }: WorkspaceRailProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
9
+ export declare function WorkspaceRailSeparator({ className }: {
10
+ className?: string;
11
+ }): import("react").JSX.Element;
12
+ /** Pushes what follows to the bottom of the rail. */
13
+ export declare function WorkspaceRailSpacer(): import("react").JSX.Element;
@@ -0,0 +1,125 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import clsx from 'clsx';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { useRender } from '@base-ui/react/use-render';
5
+ /**
6
+ * The column of buttons at the right edge of a `Workspace`, 48 pixels wide. Its first separator stands on
7
+ * the top row's bottom line when one 32 pixel button comes before it. It makes no stacking context, so a
8
+ * hover never covers the sheet's edge; a tooltip still rises above the sheet.
9
+ */
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ export function WorkspaceRail(t0) {
12
+ const $ = _c(17);
13
+ let className;
14
+ let props;
15
+ let ref;
16
+ let render;
17
+ if ($[0] !== t0) {
18
+ ({
19
+ className,
20
+ render,
21
+ ref,
22
+ ...props
23
+ } = t0);
24
+ $[0] = t0;
25
+ $[1] = className;
26
+ $[2] = props;
27
+ $[3] = ref;
28
+ $[4] = render;
29
+ } else {
30
+ className = $[1];
31
+ props = $[2];
32
+ ref = $[3];
33
+ render = $[4];
34
+ }
35
+ const {
36
+ t
37
+ } = useTranslation("ui");
38
+ let t1;
39
+ if ($[5] !== t) {
40
+ t1 = t("workspace.tools");
41
+ $[5] = t;
42
+ $[6] = t1;
43
+ } else {
44
+ t1 = $[6];
45
+ }
46
+ let t2;
47
+ if ($[7] !== className) {
48
+ t2 = clsx("ade-workspace-rail", className);
49
+ $[7] = className;
50
+ $[8] = t2;
51
+ } else {
52
+ t2 = $[8];
53
+ }
54
+ let t3;
55
+ if ($[9] !== props || $[10] !== t1 || $[11] !== t2) {
56
+ t3 = {
57
+ "aria-label": t1,
58
+ ...props,
59
+ className: t2
60
+ };
61
+ $[9] = props;
62
+ $[10] = t1;
63
+ $[11] = t2;
64
+ $[12] = t3;
65
+ } else {
66
+ t3 = $[12];
67
+ }
68
+ let t4;
69
+ if ($[13] !== ref || $[14] !== render || $[15] !== t3) {
70
+ t4 = {
71
+ render,
72
+ ref,
73
+ defaultTagName: "nav",
74
+ props: t3
75
+ };
76
+ $[13] = ref;
77
+ $[14] = render;
78
+ $[15] = t3;
79
+ $[16] = t4;
80
+ } else {
81
+ t4 = $[16];
82
+ }
83
+ return useRender(t4);
84
+ }
85
+ export function WorkspaceRailSeparator(t0) {
86
+ const $ = _c(4);
87
+ const {
88
+ className
89
+ } = t0;
90
+ let t1;
91
+ if ($[0] !== className) {
92
+ t1 = clsx("ade-workspace-rail-separator", className);
93
+ $[0] = className;
94
+ $[1] = t1;
95
+ } else {
96
+ t1 = $[1];
97
+ }
98
+ let t2;
99
+ if ($[2] !== t1) {
100
+ t2 = /*#__PURE__*/_jsx("span", {
101
+ "aria-hidden": true,
102
+ className: t1
103
+ });
104
+ $[2] = t1;
105
+ $[3] = t2;
106
+ } else {
107
+ t2 = $[3];
108
+ }
109
+ return t2;
110
+ }
111
+ /** Pushes what follows to the bottom of the rail. */
112
+ export function WorkspaceRailSpacer() {
113
+ const $ = _c(1);
114
+ let t0;
115
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
116
+ t0 = /*#__PURE__*/_jsx("span", {
117
+ "aria-hidden": true,
118
+ className: "ade-workspace-rail-spacer"
119
+ });
120
+ $[0] = t0;
121
+ } else {
122
+ t0 = $[0];
123
+ }
124
+ return t0;
125
+ }
@@ -0,0 +1,15 @@
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ export interface WorkspaceTopRowProps extends Omit<ComponentProps<'header'>, 'children'> {
3
+ /** Before the project: room for a window's own controls, and a button that brings the sidebar back. */
4
+ leading?: ReactNode;
5
+ /** The project: a switcher, or a strip of project tabs. */
6
+ children: ReactNode;
7
+ /** Leaves out the slot a lone pane's bar goes into, as beside project tabs, which take the row. */
8
+ slotless?: boolean;
9
+ }
10
+ /**
11
+ * The 47 pixel band at the top of a `Workspace`'s sheet, as its `toolbar`: the project, and beside it the
12
+ * slot where the bar of a lone pane goes (`useTopRowSlot`, `PaneBar`'s `container`). The window drags by
13
+ * every part of it that is not a control.
14
+ */
15
+ export declare function WorkspaceTopRow({ leading, children, slotless, className, ...props }: WorkspaceTopRowProps): import("react").JSX.Element;