@vvedantb/ui 0.56.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -1
- package/dist/shell/src/AppShell.js +156 -125
- package/dist/shell/src/ButtonTrack.js +57 -0
- package/dist/shell/src/SidePanelTabs.js +595 -0
- package/dist/shell/src/SidebarPanel.js +20 -15
- package/dist/shell/src/SidebarRail.js +43 -19
- package/dist/shell/src/index.js +4 -1
- package/dist/shell/src/shell-panel-motion.js +62 -0
- package/dist/shell/src/shell-variant.js +8 -0
- package/dist/src/client.js +6 -1
- package/dist/src/index.js +6 -1
- package/dist/src/motion/dock-motion.js +209 -0
- package/dist/tokens/src/css/motion.css +7 -1
- package/dist/tokens/src/css/tabs.css +4 -0
- package/package.json +1 -1
- package/shell/src/AppShell.tsx +20 -15
- package/shell/src/ButtonTrack.tsx +26 -0
- package/shell/src/SidePanelTabs.tsx +380 -0
- package/shell/src/SidebarPanel.tsx +3 -0
- package/shell/src/SidebarRail.tsx +16 -3
- package/shell/src/index.ts +18 -2
- package/shell/src/shell-panel-motion.ts +64 -0
- package/shell/src/shell-variant.ts +20 -1
- package/src/client.ts +30 -1
- package/src/index.ts +30 -1
- package/src/motion/dock-motion.ts +188 -0
- package/tokens/src/css/motion.css +7 -1
- package/tokens/src/css/tabs.css +4 -0
package/README.md
CHANGED
|
@@ -1239,7 +1239,30 @@ Single-plan callers need no change. To move to the multi-plan layout, replace
|
|
|
1239
1239
|
- `signOut={{ onSignOut, description? }}`: a separator and a danger "Sign out" item, last. It opens `SignOutDialog`; Alt-click skips the dialog and `ConfirmSkipHint` shows while Alt is held. The menu owns the dialog state. If `onSignOut` rejects, the dialog buttons enable again.
|
|
1240
1240
|
- `itemIconSize`: `size` of those two items' icons. Default: the icon's own size.
|
|
1241
1241
|
|
|
1242
|
-
`RailCollapseTile({ collapsed, onToggle })`: the rail tile that shows or hides the sidebar panel ("Show sidebar" with the expand icon, or "Hide sidebar").
|
|
1242
|
+
`RailCollapseTile({ collapsed, onToggle })`: the rail tile that shows or hides the sidebar panel ("Show sidebar" with the expand icon, or "Hide sidebar"). In `AppShell variant="rail"` it runs the dock motion (below).
|
|
1243
|
+
|
|
1244
|
+
Rail-variant pieces (all work without the rail variant too, except the first):
|
|
1245
|
+
|
|
1246
|
+
- **Dock motion of the sidebar panel.** In `variant="rail"` the panel shrinks into the `RailCollapseTile` on hide and grows back out on show, and the main content slides with the sidebar width. `panelMotion="none"` on `AppShell` turns it off (a rail-only input: a type error on `"floating"`). For a toggle of your own (a hotkey, a context setter) call `toggleShellPanel(collapsed, toggle)`, or `popOutShellPanel(hide)` and `popInShellPanelNextFrame()`. For a tile of your own, spread `shellDockTileProps` on it.
|
|
1247
|
+
- **`dockPopIn`, `dockNudge`, `dockPopOut`, `slideWith`, `slideNextResize`** (`DockEdge`, `DOCK_MOTION_EVENT`, `DockMotionEvent`, `dockMotionOff`): the same motion for any panel that docks into a tile. All of it stops with `MotionProvider reducedMotion` and `PageMotionProvider disabled`: a show is instant and a hide runs at once.
|
|
1248
|
+
- **`ButtonTrack`** (`buttonTrackClass`): a trough for a group of flat buttons, for page header actions (`direction="row"`, default) or tools under a side rail (`direction="column"`). It renders nothing visible when empty.
|
|
1249
|
+
- **`SidePanelTabs`**: tabs on a rail beside a content card, for a side panel. `SidePanelTabs.Frame({ collapsed, rail })` holds a `SidePanelTabs.Rail` with a `SidePanelTabs.List({ value, onValueChange })` of `SidePanelTabs.Tab({ value, label, icon, activeIcon, layout, count, indicator, onReselect })`. From `md` up the rail is on the right edge and an arrow on the card points at the active tab; below `md` the tabs are a strip on top. `collapsed` hides the card and leaves the rail (`SIDE_PANEL_RAIL_WIDTH_PX`, 44; `SIDE_PANEL_RAIL_LABELLED_WIDTH_PX`, 76). Close it with `popOutSidePanel(root, collapse)`. It does not depend on the `AppShell` variant. The rail is on the right only.
|
|
1250
|
+
|
|
1251
|
+
```tsx
|
|
1252
|
+
<SidePanelTabs.Frame
|
|
1253
|
+
collapsed={collapsed}
|
|
1254
|
+
rail={
|
|
1255
|
+
<SidePanelTabs.Rail>
|
|
1256
|
+
<SidePanelTabs.List value={tab} onValueChange={setTab} aria-label="Panel">
|
|
1257
|
+
<SidePanelTabs.Tab value="files" label="Files" icon={<IconFiles />} count={3} onReselect={toggleCard} />
|
|
1258
|
+
<SidePanelTabs.Tab value="notes" label="Notes" icon={<IconNote />} />
|
|
1259
|
+
</SidePanelTabs.List>
|
|
1260
|
+
</SidePanelTabs.Rail>
|
|
1261
|
+
}
|
|
1262
|
+
>
|
|
1263
|
+
{tab === "files" ? <Files /> : <Notes />}
|
|
1264
|
+
</SidePanelTabs.Frame>
|
|
1265
|
+
```
|
|
1243
1266
|
|
|
1244
1267
|
## Animated nav icons (0.11.0)
|
|
1245
1268
|
|
|
@@ -2,7 +2,7 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
import { cn } from "../../src/utils/cn.js";
|
|
4
4
|
import { SidebarResizeProvider, useSidebarResizeContext, useSidebarResizeState } from "./SidebarResize.js";
|
|
5
|
-
import { AppShellVariantContext, useAppShellVariant } from "./shell-variant.js";
|
|
5
|
+
import { AppShellPanelDockContext, AppShellVariantContext, useAppShellVariant } from "./shell-variant.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* `variant` picks the layout: `"floating"` (default) or `"rail"`. Both take
|
|
@@ -17,8 +17,9 @@ const AppShellContext = /*#__PURE__*/createContext({
|
|
|
17
17
|
});
|
|
18
18
|
/** Frame `<div>`: sets the `--app-shell-*` variables and owns the resize state. `style` merges over the variables. */
|
|
19
19
|
function Root(t0) {
|
|
20
|
-
const $ = _c(
|
|
20
|
+
const $ = _c(44);
|
|
21
21
|
let className;
|
|
22
|
+
let panelMotion;
|
|
22
23
|
let props;
|
|
23
24
|
let resizable;
|
|
24
25
|
let style;
|
|
@@ -39,34 +40,37 @@ function Root(t0) {
|
|
|
39
40
|
mobileHeaderHeight: t5,
|
|
40
41
|
mainId: t6,
|
|
41
42
|
variant: t7,
|
|
43
|
+
panelMotion,
|
|
42
44
|
className,
|
|
43
45
|
style,
|
|
44
46
|
...props
|
|
45
47
|
} = t0);
|
|
46
48
|
$[0] = t0;
|
|
47
49
|
$[1] = className;
|
|
48
|
-
$[2] =
|
|
49
|
-
$[3] =
|
|
50
|
-
$[4] =
|
|
51
|
-
$[5] =
|
|
52
|
-
$[6] =
|
|
53
|
-
$[7] =
|
|
54
|
-
$[8] =
|
|
55
|
-
$[9] =
|
|
56
|
-
$[10] =
|
|
57
|
-
$[11] =
|
|
50
|
+
$[2] = panelMotion;
|
|
51
|
+
$[3] = props;
|
|
52
|
+
$[4] = resizable;
|
|
53
|
+
$[5] = style;
|
|
54
|
+
$[6] = t1;
|
|
55
|
+
$[7] = t2;
|
|
56
|
+
$[8] = t3;
|
|
57
|
+
$[9] = t4;
|
|
58
|
+
$[10] = t5;
|
|
59
|
+
$[11] = t6;
|
|
60
|
+
$[12] = t7;
|
|
58
61
|
} else {
|
|
59
62
|
className = $[1];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
panelMotion = $[2];
|
|
64
|
+
props = $[3];
|
|
65
|
+
resizable = $[4];
|
|
66
|
+
style = $[5];
|
|
67
|
+
t1 = $[6];
|
|
68
|
+
t2 = $[7];
|
|
69
|
+
t3 = $[8];
|
|
70
|
+
t4 = $[9];
|
|
71
|
+
t5 = $[10];
|
|
72
|
+
t6 = $[11];
|
|
73
|
+
t7 = $[12];
|
|
70
74
|
}
|
|
71
75
|
const panelHidden = t1 === undefined ? false : t1;
|
|
72
76
|
const railWidth = t2 === undefined ? "3.5rem" : t2;
|
|
@@ -78,110 +82,123 @@ function Root(t0) {
|
|
|
78
82
|
const resize = useSidebarResizeState(resizable);
|
|
79
83
|
const t8 = resize ? `calc(${railWidth} + ${resize.width}px)` : sidebarWidth;
|
|
80
84
|
let t9;
|
|
81
|
-
if ($[
|
|
85
|
+
if ($[13] !== mobileHeaderHeight || $[14] !== railWidth || $[15] !== t8) {
|
|
82
86
|
t9 = {
|
|
83
87
|
"--app-shell-rail-width": railWidth,
|
|
84
88
|
"--app-shell-sidebar-width": t8,
|
|
85
89
|
"--app-shell-mobile-header-height": mobileHeaderHeight
|
|
86
90
|
};
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
+
$[13] = mobileHeaderHeight;
|
|
92
|
+
$[14] = railWidth;
|
|
93
|
+
$[15] = t8;
|
|
94
|
+
$[16] = t9;
|
|
91
95
|
} else {
|
|
92
|
-
t9 = $[
|
|
96
|
+
t9 = $[16];
|
|
93
97
|
}
|
|
94
98
|
const vars = t9;
|
|
95
99
|
let t10;
|
|
96
|
-
if ($[
|
|
100
|
+
if ($[17] !== mainId || $[18] !== panelHidden || $[19] !== scroll) {
|
|
97
101
|
t10 = {
|
|
98
102
|
mainId,
|
|
99
103
|
panelHidden,
|
|
100
104
|
scroll
|
|
101
105
|
};
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
+
$[17] = mainId;
|
|
107
|
+
$[18] = panelHidden;
|
|
108
|
+
$[19] = scroll;
|
|
109
|
+
$[20] = t10;
|
|
106
110
|
} else {
|
|
107
|
-
t10 = $[
|
|
111
|
+
t10 = $[20];
|
|
108
112
|
}
|
|
109
|
-
const t11 = variant === "rail"
|
|
110
|
-
const t12 =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
$[21] =
|
|
113
|
+
const t11 = variant === "rail" && panelMotion !== "none";
|
|
114
|
+
const t12 = variant === "rail" ? "rail" : undefined;
|
|
115
|
+
const t13 = scroll === "document" ? "relative min-h-dvh bg-background" : "relative h-dvh overflow-hidden bg-background";
|
|
116
|
+
let t14;
|
|
117
|
+
if ($[21] !== className || $[22] !== t13) {
|
|
118
|
+
t14 = cn(t13, className);
|
|
119
|
+
$[21] = className;
|
|
116
120
|
$[22] = t13;
|
|
121
|
+
$[23] = t14;
|
|
117
122
|
} else {
|
|
118
|
-
|
|
123
|
+
t14 = $[23];
|
|
119
124
|
}
|
|
120
|
-
let
|
|
121
|
-
if ($[
|
|
122
|
-
|
|
125
|
+
let t15;
|
|
126
|
+
if ($[24] !== style || $[25] !== vars) {
|
|
127
|
+
t15 = {
|
|
123
128
|
...vars,
|
|
124
129
|
...style
|
|
125
130
|
};
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
131
|
+
$[24] = style;
|
|
132
|
+
$[25] = vars;
|
|
133
|
+
$[26] = t15;
|
|
129
134
|
} else {
|
|
130
|
-
|
|
135
|
+
t15 = $[26];
|
|
131
136
|
}
|
|
132
|
-
let
|
|
133
|
-
if ($[
|
|
134
|
-
|
|
137
|
+
let t16;
|
|
138
|
+
if ($[27] !== props || $[28] !== t12 || $[29] !== t14 || $[30] !== t15) {
|
|
139
|
+
t16 = /*#__PURE__*/_jsx("div", {
|
|
135
140
|
...props,
|
|
136
|
-
"data-shell-variant":
|
|
137
|
-
className:
|
|
138
|
-
style:
|
|
141
|
+
"data-shell-variant": t12,
|
|
142
|
+
className: t14,
|
|
143
|
+
style: t15
|
|
139
144
|
});
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[28] = t13;
|
|
145
|
+
$[27] = props;
|
|
146
|
+
$[28] = t12;
|
|
143
147
|
$[29] = t14;
|
|
144
148
|
$[30] = t15;
|
|
149
|
+
$[31] = t16;
|
|
145
150
|
} else {
|
|
146
|
-
|
|
151
|
+
t16 = $[31];
|
|
147
152
|
}
|
|
148
|
-
let
|
|
149
|
-
if ($[
|
|
150
|
-
|
|
153
|
+
let t17;
|
|
154
|
+
if ($[32] !== resize || $[33] !== t16) {
|
|
155
|
+
t17 = /*#__PURE__*/_jsx(SidebarResizeProvider, {
|
|
151
156
|
value: resize,
|
|
152
|
-
children:
|
|
157
|
+
children: t16
|
|
153
158
|
});
|
|
154
|
-
$[
|
|
155
|
-
$[32] = t15;
|
|
159
|
+
$[32] = resize;
|
|
156
160
|
$[33] = t16;
|
|
161
|
+
$[34] = t17;
|
|
157
162
|
} else {
|
|
158
|
-
|
|
163
|
+
t17 = $[34];
|
|
159
164
|
}
|
|
160
|
-
let
|
|
161
|
-
if ($[
|
|
162
|
-
|
|
163
|
-
value:
|
|
164
|
-
children:
|
|
165
|
+
let t18;
|
|
166
|
+
if ($[35] !== t11 || $[36] !== t17) {
|
|
167
|
+
t18 = /*#__PURE__*/_jsx(AppShellPanelDockContext, {
|
|
168
|
+
value: t11,
|
|
169
|
+
children: t17
|
|
165
170
|
});
|
|
166
|
-
$[
|
|
167
|
-
$[35] = variant;
|
|
171
|
+
$[35] = t11;
|
|
168
172
|
$[36] = t17;
|
|
173
|
+
$[37] = t18;
|
|
169
174
|
} else {
|
|
170
|
-
|
|
175
|
+
t18 = $[37];
|
|
171
176
|
}
|
|
172
|
-
let
|
|
173
|
-
if ($[
|
|
174
|
-
|
|
177
|
+
let t19;
|
|
178
|
+
if ($[38] !== t18 || $[39] !== variant) {
|
|
179
|
+
t19 = /*#__PURE__*/_jsx(AppShellVariantContext, {
|
|
180
|
+
value: variant,
|
|
181
|
+
children: t18
|
|
182
|
+
});
|
|
183
|
+
$[38] = t18;
|
|
184
|
+
$[39] = variant;
|
|
185
|
+
$[40] = t19;
|
|
186
|
+
} else {
|
|
187
|
+
t19 = $[40];
|
|
188
|
+
}
|
|
189
|
+
let t20;
|
|
190
|
+
if ($[41] !== t10 || $[42] !== t19) {
|
|
191
|
+
t20 = /*#__PURE__*/_jsx(AppShellContext.Provider, {
|
|
175
192
|
value: t10,
|
|
176
|
-
children:
|
|
193
|
+
children: t19
|
|
177
194
|
});
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
195
|
+
$[41] = t10;
|
|
196
|
+
$[42] = t19;
|
|
197
|
+
$[43] = t20;
|
|
181
198
|
} else {
|
|
182
|
-
|
|
199
|
+
t20 = $[43];
|
|
183
200
|
}
|
|
184
|
-
return
|
|
201
|
+
return t20;
|
|
185
202
|
}
|
|
186
203
|
/** Visually hidden link to `<main>`, shown on focus. */
|
|
187
204
|
function SkipLink(t0) {
|
|
@@ -354,7 +371,7 @@ function Content(t0) {
|
|
|
354
371
|
* `.Main` and `.Content`.
|
|
355
372
|
*/
|
|
356
373
|
function LegacyAppShell(t0) {
|
|
357
|
-
const $ = _c(
|
|
374
|
+
const $ = _c(26);
|
|
358
375
|
const {
|
|
359
376
|
sidebar,
|
|
360
377
|
children,
|
|
@@ -367,6 +384,7 @@ function LegacyAppShell(t0) {
|
|
|
367
384
|
skipLinkLabel,
|
|
368
385
|
mainId: t2,
|
|
369
386
|
variant: t3,
|
|
387
|
+
panelMotion,
|
|
370
388
|
className,
|
|
371
389
|
mainClassName,
|
|
372
390
|
contentClassName
|
|
@@ -375,46 +393,59 @@ function LegacyAppShell(t0) {
|
|
|
375
393
|
const mainId = t2 === undefined ? "main-content" : t2;
|
|
376
394
|
const variant = t3 === undefined ? "floating" : t3;
|
|
377
395
|
let t4;
|
|
378
|
-
if ($[0] !==
|
|
379
|
-
t4 =
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
$[0] =
|
|
384
|
-
$[1] =
|
|
396
|
+
if ($[0] !== panelMotion || $[1] !== variant) {
|
|
397
|
+
t4 = variant === "rail" ? {
|
|
398
|
+
variant: "rail",
|
|
399
|
+
panelMotion
|
|
400
|
+
} : {};
|
|
401
|
+
$[0] = panelMotion;
|
|
402
|
+
$[1] = variant;
|
|
385
403
|
$[2] = t4;
|
|
386
404
|
} else {
|
|
387
405
|
t4 = $[2];
|
|
388
406
|
}
|
|
407
|
+
const layout = t4;
|
|
389
408
|
let t5;
|
|
390
|
-
if ($[3] !==
|
|
391
|
-
t5 = /*#__PURE__*/_jsx(
|
|
392
|
-
|
|
393
|
-
|
|
409
|
+
if ($[3] !== mainId || $[4] !== skipLinkLabel) {
|
|
410
|
+
t5 = /*#__PURE__*/_jsx(SkipLink, {
|
|
411
|
+
label: skipLinkLabel,
|
|
412
|
+
targetId: mainId
|
|
394
413
|
});
|
|
395
|
-
$[3] =
|
|
396
|
-
$[4] =
|
|
414
|
+
$[3] = mainId;
|
|
415
|
+
$[4] = skipLinkLabel;
|
|
397
416
|
$[5] = t5;
|
|
398
417
|
} else {
|
|
399
418
|
t5 = $[5];
|
|
400
419
|
}
|
|
401
420
|
let t6;
|
|
402
|
-
if ($[6] !==
|
|
403
|
-
t6 = /*#__PURE__*/_jsx(
|
|
421
|
+
if ($[6] !== children || $[7] !== contentClassName) {
|
|
422
|
+
t6 = /*#__PURE__*/_jsx(Content, {
|
|
423
|
+
className: contentClassName,
|
|
424
|
+
children: children
|
|
425
|
+
});
|
|
426
|
+
$[6] = children;
|
|
427
|
+
$[7] = contentClassName;
|
|
428
|
+
$[8] = t6;
|
|
429
|
+
} else {
|
|
430
|
+
t6 = $[8];
|
|
431
|
+
}
|
|
432
|
+
let t7;
|
|
433
|
+
if ($[9] !== mainClassName || $[10] !== mainId || $[11] !== t6) {
|
|
434
|
+
t7 = /*#__PURE__*/_jsx(Main, {
|
|
404
435
|
id: mainId,
|
|
405
436
|
className: mainClassName,
|
|
406
|
-
children:
|
|
437
|
+
children: t6
|
|
407
438
|
});
|
|
408
|
-
$[
|
|
409
|
-
$[
|
|
410
|
-
$[
|
|
411
|
-
$[
|
|
439
|
+
$[9] = mainClassName;
|
|
440
|
+
$[10] = mainId;
|
|
441
|
+
$[11] = t6;
|
|
442
|
+
$[12] = t7;
|
|
412
443
|
} else {
|
|
413
|
-
|
|
444
|
+
t7 = $[12];
|
|
414
445
|
}
|
|
415
|
-
let
|
|
416
|
-
if ($[
|
|
417
|
-
|
|
446
|
+
let t8;
|
|
447
|
+
if ($[13] !== className || $[14] !== layout || $[15] !== mainId || $[16] !== mobileHeaderHeight || $[17] !== panelHidden || $[18] !== railWidth || $[19] !== resizable || $[20] !== scroll || $[21] !== sidebar || $[22] !== sidebarWidth || $[23] !== t5 || $[24] !== t7) {
|
|
448
|
+
t8 = /*#__PURE__*/_jsxs(Root, {
|
|
418
449
|
panelHidden: panelHidden,
|
|
419
450
|
railWidth: railWidth,
|
|
420
451
|
sidebarWidth: sidebarWidth,
|
|
@@ -422,27 +453,27 @@ function LegacyAppShell(t0) {
|
|
|
422
453
|
scroll: scroll,
|
|
423
454
|
mobileHeaderHeight: mobileHeaderHeight,
|
|
424
455
|
mainId: mainId,
|
|
425
|
-
|
|
456
|
+
...layout,
|
|
426
457
|
className: className,
|
|
427
|
-
children: [
|
|
458
|
+
children: [t5, sidebar, t7]
|
|
428
459
|
});
|
|
429
|
-
$[
|
|
430
|
-
$[
|
|
431
|
-
$[
|
|
432
|
-
$[
|
|
433
|
-
$[
|
|
434
|
-
$[
|
|
435
|
-
$[
|
|
436
|
-
$[
|
|
437
|
-
$[
|
|
438
|
-
$[
|
|
439
|
-
$[
|
|
440
|
-
$[
|
|
441
|
-
$[
|
|
460
|
+
$[13] = className;
|
|
461
|
+
$[14] = layout;
|
|
462
|
+
$[15] = mainId;
|
|
463
|
+
$[16] = mobileHeaderHeight;
|
|
464
|
+
$[17] = panelHidden;
|
|
465
|
+
$[18] = railWidth;
|
|
466
|
+
$[19] = resizable;
|
|
467
|
+
$[20] = scroll;
|
|
468
|
+
$[21] = sidebar;
|
|
469
|
+
$[22] = sidebarWidth;
|
|
470
|
+
$[23] = t5;
|
|
471
|
+
$[24] = t7;
|
|
472
|
+
$[25] = t8;
|
|
442
473
|
} else {
|
|
443
|
-
|
|
474
|
+
t8 = $[25];
|
|
444
475
|
}
|
|
445
|
-
return
|
|
476
|
+
return t8;
|
|
446
477
|
}
|
|
447
478
|
LegacyAppShell.displayName = "AppShell";
|
|
448
479
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { cn } from "../../src/utils/cn.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The trough of a `ButtonTrack`: the `Sidebar.RailGroup` tone as a row.
|
|
6
|
+
* Buttons on it are flat (the trough is their surface) and hover at half the
|
|
7
|
+
* pill tone. Empty, it takes no space.
|
|
8
|
+
*/
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
export const buttonTrackClass = "flex shrink-0 items-center gap-0.5 rounded-xl bg-default p-0.5 empty:hidden [&_button]:bg-transparent [&_button:not([data-active]):not(:disabled):hover]:bg-segment/50";
|
|
11
|
+
/** A group of icon buttons on one trough, for example the actions of a page header. */
|
|
12
|
+
export function ButtonTrack(t0) {
|
|
13
|
+
const $ = _c(10);
|
|
14
|
+
let className;
|
|
15
|
+
let props;
|
|
16
|
+
let t1;
|
|
17
|
+
if ($[0] !== t0) {
|
|
18
|
+
({
|
|
19
|
+
direction: t1,
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
} = t0);
|
|
23
|
+
$[0] = t0;
|
|
24
|
+
$[1] = className;
|
|
25
|
+
$[2] = props;
|
|
26
|
+
$[3] = t1;
|
|
27
|
+
} else {
|
|
28
|
+
className = $[1];
|
|
29
|
+
props = $[2];
|
|
30
|
+
t1 = $[3];
|
|
31
|
+
}
|
|
32
|
+
const direction = t1 === undefined ? "row" : t1;
|
|
33
|
+
const t2 = direction === "column" ? "gap-1 md:flex-col" : "flex-wrap justify-end";
|
|
34
|
+
let t3;
|
|
35
|
+
if ($[4] !== className || $[5] !== t2) {
|
|
36
|
+
t3 = cn(buttonTrackClass, t2, className);
|
|
37
|
+
$[4] = className;
|
|
38
|
+
$[5] = t2;
|
|
39
|
+
$[6] = t3;
|
|
40
|
+
} else {
|
|
41
|
+
t3 = $[6];
|
|
42
|
+
}
|
|
43
|
+
let t4;
|
|
44
|
+
if ($[7] !== props || $[8] !== t3) {
|
|
45
|
+
t4 = /*#__PURE__*/_jsx("div", {
|
|
46
|
+
role: "group",
|
|
47
|
+
...props,
|
|
48
|
+
className: t3
|
|
49
|
+
});
|
|
50
|
+
$[7] = props;
|
|
51
|
+
$[8] = t3;
|
|
52
|
+
$[9] = t4;
|
|
53
|
+
} else {
|
|
54
|
+
t4 = $[9];
|
|
55
|
+
}
|
|
56
|
+
return t4;
|
|
57
|
+
}
|