@estiva-app/ui 0.89.0 → 0.90.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppShell.d.ts +9 -1
- package/dist/AppShell.d.ts.map +1 -1
- package/dist/index.js +224 -207
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/registry.json +13 -1
- package/src/AppShell.mdx +6 -0
- package/src/AppShell.stories.tsx +25 -0
- package/src/AppShell.test.tsx +47 -0
- package/src/AppShell.tsx +32 -3
package/dist/AppShell.d.ts
CHANGED
|
@@ -40,7 +40,15 @@ export interface AppShellProps {
|
|
|
40
40
|
banner?: ReactNode;
|
|
41
41
|
/** The navigation: a `Sidebar` in the solid manner, a `Rail` in the floating one. */
|
|
42
42
|
nav: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the navigation is shown, in the solid and inset manners. With `onNavOpenChange`, the frame draws the
|
|
45
|
+
* fold as the top bar's menu button (unless `menu` is given) and, folded, leaves only the content's own margin
|
|
46
|
+
* (LED-3, Katerina, 28 October: the sidebar fold top left, on the top bar's menu button). Where it is kept is
|
|
47
|
+
* the caller's.
|
|
48
|
+
*/
|
|
49
|
+
navOpen?: boolean;
|
|
50
|
+
onNavOpenChange?: (open: boolean) => void;
|
|
43
51
|
children: ReactNode;
|
|
44
52
|
}
|
|
45
|
-
export declare function AppShell({ variant, menu, logo, search, onSearch, searchPlaceholder, identity, banner, nav, children }: AppShellProps): import("react").JSX.Element;
|
|
53
|
+
export declare function AppShell({ variant, menu, logo, search, onSearch, searchPlaceholder, identity, banner, nav, navOpen, onNavOpenChange, children }: AppShellProps): import("react").JSX.Element;
|
|
46
54
|
//# sourceMappingURL=AppShell.d.ts.map
|
package/dist/AppShell.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../src/AppShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../src/AppShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAStC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,CAAA;IACxC,uEAAuE;IACvE,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,oEAAoE;IACpE,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,gHAAgH;IAChH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,qEAAqE;IACrE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,qFAAqF;IACrF,GAAG,EAAE,SAAS,CAAA;IACd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACzC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,QAAQ,CAAC,EAAE,OAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,OAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,aAAa,+BAiG/K"}
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,9 @@ function useInAppClick(href, onClick) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
// src/AppShell.tsx
|
|
34
|
+
import { IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftExpand } from "@tabler/icons-react";
|
|
35
|
+
|
|
33
36
|
// src/cn.ts
|
|
34
37
|
import { clsx } from "clsx";
|
|
35
38
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
@@ -164,51 +167,7 @@ function Card({
|
|
|
164
167
|
);
|
|
165
168
|
}
|
|
166
169
|
|
|
167
|
-
// src/
|
|
168
|
-
import { ScrollArea as BaseScrollArea } from "@base-ui/react/scroll-area";
|
|
169
|
-
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
170
|
-
var BAR = "z-10 flex touch-none select-none rounded-full opacity-0 transition-opacity delay-300 data-[hovering]:opacity-100 data-[hovering]:delay-0 data-[scrolling]:opacity-100 data-[scrolling]:delay-0";
|
|
171
|
-
var THUMB = "rounded-full bg-border-strong";
|
|
172
|
-
function ScrollArea({ orientation = "vertical", className, viewportClassName, contentClassName, viewportRef, onScroll, children }) {
|
|
173
|
-
const vertical = orientation !== "horizontal";
|
|
174
|
-
const horizontal = orientation !== "vertical";
|
|
175
|
-
return /* @__PURE__ */ jsxs(BaseScrollArea.Root, { className: cn("relative min-h-0 min-w-0", className), children: [
|
|
176
|
-
/* @__PURE__ */ jsx4(
|
|
177
|
-
BaseScrollArea.Viewport,
|
|
178
|
-
{
|
|
179
|
-
ref: viewportRef,
|
|
180
|
-
onScroll,
|
|
181
|
-
className: cn(
|
|
182
|
-
"h-full w-full outline-none data-[has-overflow-x]:overscroll-x-contain data-[has-overflow-y]:overscroll-y-contain",
|
|
183
|
-
viewportClassName
|
|
184
|
-
),
|
|
185
|
-
children: /* @__PURE__ */ jsx4(BaseScrollArea.Content, { className: contentClassName, style: horizontal ? void 0 : { minWidth: 0 }, children })
|
|
186
|
-
}
|
|
187
|
-
),
|
|
188
|
-
vertical && /* @__PURE__ */ jsx4(BaseScrollArea.Scrollbar, { orientation: "vertical", className: cn(BAR, "w-1.5 justify-center py-0.5 pr-0.5 data-[has-overflow-y]:opacity-100"), children: /* @__PURE__ */ jsx4(BaseScrollArea.Thumb, { className: cn(THUMB, "w-full") }) }),
|
|
189
|
-
horizontal && /* @__PURE__ */ jsx4(BaseScrollArea.Scrollbar, { orientation: "horizontal", className: cn(BAR, "h-1.5 flex-col justify-center px-0.5 pb-0.5 data-[has-overflow-x]:opacity-100"), children: /* @__PURE__ */ jsx4(BaseScrollArea.Thumb, { className: cn(THUMB, "h-full") }) }),
|
|
190
|
-
vertical && horizontal && /* @__PURE__ */ jsx4(BaseScrollArea.Corner, {})
|
|
191
|
-
] });
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// src/Sidebar.tsx
|
|
195
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
196
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
197
|
-
var SidebarOnGround = createContext2(false);
|
|
198
|
-
function Sidebar({ "aria-label": ariaLabel = "Workspace", children, className }) {
|
|
199
|
-
const onGround = useContext2(SidebarOnGround);
|
|
200
|
-
return /* @__PURE__ */ jsx5(
|
|
201
|
-
"nav",
|
|
202
|
-
{
|
|
203
|
-
"aria-label": ariaLabel,
|
|
204
|
-
className: cn("flex w-60 shrink-0 flex-col", !onGround && "border-r border-border-default bg-bg-surface", className),
|
|
205
|
-
children: /* @__PURE__ */ jsx5(ScrollArea, { className: "min-h-0 flex-1", contentClassName: "flex flex-col gap-0.5 px-2.5 py-3", children })
|
|
206
|
-
}
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// src/TopBar.tsx
|
|
211
|
-
import { useEffect, useRef } from "react";
|
|
170
|
+
// src/IconButton.tsx
|
|
212
171
|
import { Button as BaseButton } from "@base-ui/react/button";
|
|
213
172
|
|
|
214
173
|
// src/looks.ts
|
|
@@ -232,10 +191,20 @@ var MUTED_CONTROL_CLASSES = "text-text-secondary hover:bg-bg-hover hover:text-te
|
|
|
232
191
|
var MENU_TRIGGER_CLASSES = "cursor-pointer rounded-md transition-colors hover:bg-bg-hover data-[popup-open]:bg-bg-hover";
|
|
233
192
|
var COLLAPSIBLE_PANEL_CLASSES = "h-[var(--collapsible-panel-height)] overflow-hidden transition-[height] duration-150 ease-out motion-reduce:transition-none data-[starting-style]:h-0 data-[ending-style]:h-0";
|
|
234
193
|
|
|
194
|
+
// src/formBusy.ts
|
|
195
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
196
|
+
var FormBusyContext = createContext2(false);
|
|
197
|
+
function useFormBusy() {
|
|
198
|
+
return useContext2(FormBusyContext);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// src/Tooltip.tsx
|
|
202
|
+
import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
|
|
203
|
+
|
|
235
204
|
// src/Kbd.tsx
|
|
236
|
-
import { jsx as
|
|
205
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
237
206
|
function Kbd({ children, className, tone = "default" }) {
|
|
238
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ jsx4(
|
|
239
208
|
"kbd",
|
|
240
209
|
{
|
|
241
210
|
className: cn(
|
|
@@ -253,6 +222,180 @@ function Kbd({ children, className, tone = "default" }) {
|
|
|
253
222
|
);
|
|
254
223
|
}
|
|
255
224
|
|
|
225
|
+
// src/Tooltip.tsx
|
|
226
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
227
|
+
var OPEN_DELAY = 300;
|
|
228
|
+
function TooltipProvider({ delay = OPEN_DELAY, closeDelay, timeout, children }) {
|
|
229
|
+
return /* @__PURE__ */ jsx5(BaseTooltip.Provider, { delay, closeDelay, timeout, children });
|
|
230
|
+
}
|
|
231
|
+
function Tooltip({ label, shortcut, className, ...props }) {
|
|
232
|
+
return /* @__PURE__ */ jsxs("div", { role: "tooltip", className: cn(FLOATING_SURFACE_CLASSES, "border-border-tooltip bg-bg-tooltip", "min-h-[30px] max-w-80 flex items-center justify-center gap-1.5 px-2 py-1", className), ...props, children: [
|
|
233
|
+
/* @__PURE__ */ jsx5("span", { className: "min-w-0 text-caption text-text-tooltip break-words", children: label }),
|
|
234
|
+
shortcut && /* @__PURE__ */ jsx5(Kbd, { tone: "tooltip", children: shortcut })
|
|
235
|
+
] });
|
|
236
|
+
}
|
|
237
|
+
var GAP = 6;
|
|
238
|
+
var VIEWPORT_PAD = 8;
|
|
239
|
+
function TooltipSurface({ label, shortcut, placement }) {
|
|
240
|
+
return /* @__PURE__ */ jsx5(BaseTooltip.Portal, { children: /* @__PURE__ */ jsx5(
|
|
241
|
+
BaseTooltip.Positioner,
|
|
242
|
+
{
|
|
243
|
+
side: placement,
|
|
244
|
+
align: "center",
|
|
245
|
+
sideOffset: GAP,
|
|
246
|
+
collisionPadding: VIEWPORT_PAD,
|
|
247
|
+
positionMethod: "fixed",
|
|
248
|
+
className: "pointer-events-none z-[9999]",
|
|
249
|
+
children: /* @__PURE__ */ jsx5(
|
|
250
|
+
BaseTooltip.Popup,
|
|
251
|
+
{
|
|
252
|
+
render: /* @__PURE__ */ jsx5(Tooltip, { label, shortcut }),
|
|
253
|
+
className: cn(
|
|
254
|
+
"transition-[opacity,transform] duration-[120ms] ease-out motion-reduce:transition-none",
|
|
255
|
+
"data-[ending-style]:duration-[80ms] data-[instant]:duration-0",
|
|
256
|
+
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
257
|
+
"data-[side=top]:data-[starting-style]:translate-y-[4px] data-[side=top]:data-[ending-style]:translate-y-[4px]",
|
|
258
|
+
"data-[side=bottom]:data-[starting-style]:-translate-y-[4px] data-[side=bottom]:data-[ending-style]:-translate-y-[4px]"
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
) });
|
|
264
|
+
}
|
|
265
|
+
function WithTooltip({ label, shortcut, placement = "top", wrapperClassName, inline = false, children }) {
|
|
266
|
+
const Wrapper = inline ? "span" : "div";
|
|
267
|
+
return /* @__PURE__ */ jsxs(BaseTooltip.Root, { disableHoverablePopup: true, children: [
|
|
268
|
+
/* @__PURE__ */ jsx5(BaseTooltip.Trigger, { delay: OPEN_DELAY, render: /* @__PURE__ */ jsx5(Wrapper, { className: cn("inline-flex shrink-0", inline && "align-top", wrapperClassName) }), children }),
|
|
269
|
+
/* @__PURE__ */ jsx5(TooltipSurface, { label, shortcut, placement })
|
|
270
|
+
] });
|
|
271
|
+
}
|
|
272
|
+
function TooltipTrigger({ label, shortcut, placement = "top", children }) {
|
|
273
|
+
return /* @__PURE__ */ jsxs(BaseTooltip.Root, { disableHoverablePopup: true, children: [
|
|
274
|
+
/* @__PURE__ */ jsx5(BaseTooltip.Trigger, { delay: OPEN_DELAY, render: children }),
|
|
275
|
+
/* @__PURE__ */ jsx5(TooltipSurface, { label, shortcut, placement })
|
|
276
|
+
] });
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// src/IconButton.tsx
|
|
280
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
281
|
+
function IconButton({
|
|
282
|
+
variant = "muted",
|
|
283
|
+
pressed,
|
|
284
|
+
glow = false,
|
|
285
|
+
className,
|
|
286
|
+
children,
|
|
287
|
+
disabled,
|
|
288
|
+
disabledReason,
|
|
289
|
+
tooltip,
|
|
290
|
+
tooltipShortcut,
|
|
291
|
+
tooltipPlacement,
|
|
292
|
+
type = "button",
|
|
293
|
+
href,
|
|
294
|
+
...props
|
|
295
|
+
}) {
|
|
296
|
+
const formBusy = useFormBusy();
|
|
297
|
+
const anchor = props;
|
|
298
|
+
const inApp = useInAppClick(href, anchor.onClick);
|
|
299
|
+
const unusable = disabled || !!disabledReason || formBusy;
|
|
300
|
+
const look = (off) => cn(
|
|
301
|
+
// `shrink-0` stops a flex parent squashing the button; `self-center`
|
|
302
|
+
// stops one stretching it. Two different failures, and both have
|
|
303
|
+
// happened here: a row with no `items-*` drew this 24 wide and 228
|
|
304
|
+
// tall in Peek's TopicMoreMenu story (Katerina, 2026-09-11). A button
|
|
305
|
+
// is the size of its icon and its padding, whatever box it lands in.
|
|
306
|
+
//
|
|
307
|
+
// This is the one of the two that needs it: an IconButton states no
|
|
308
|
+
// height, so its cross size is `auto` and a stretching parent takes
|
|
309
|
+
// it. Measured in the same 260px row on 2026-09-12: 24px with this
|
|
310
|
+
// class, 226px without. `Button` states `h-8`/`h-6`, so it cannot be
|
|
311
|
+
// stretched and carries no `self-center` — see the note there.
|
|
312
|
+
"flex items-center justify-center p-1 rounded-lg transition-colors shrink-0 self-center cursor-pointer",
|
|
313
|
+
!off && variant === "primary" && "bg-accent-primary hover:bg-accent-hover text-text-inverse",
|
|
314
|
+
!off && (variant === "muted" || variant === "resolve") && MUTED_CONTROL_CLASSES,
|
|
315
|
+
!off && variant === "outlined" && "border border-border-default hover:bg-bg-hover text-text-secondary",
|
|
316
|
+
!off && variant === "current" && "hover:bg-bg-hover",
|
|
317
|
+
off && variant === "primary" && "bg-bg-disabled text-text-disabled",
|
|
318
|
+
off && (variant === "muted" || variant === "resolve") && "text-text-disabled",
|
|
319
|
+
off && variant === "outlined" && "border border-border-default text-text-disabled",
|
|
320
|
+
// Always, disabled too: the colour of where it sits, and Resolve's green.
|
|
321
|
+
variant === "current" && "text-current",
|
|
322
|
+
variant === "resolve" && "signal:hover:bg-success-muted signal:hover:text-success-default",
|
|
323
|
+
pressed && "bg-bg-active text-text-primary",
|
|
324
|
+
glow && "signal:shadow-glow-accent",
|
|
325
|
+
// `pointer-events-none` only where the button is truly out of reach:
|
|
326
|
+
// with a `disabledReason` the button IS the tooltip's trigger, and a
|
|
327
|
+
// trigger the pointer cannot land on never opens one. Base UI already
|
|
328
|
+
// swallows the click.
|
|
329
|
+
off && !disabledReason && "pointer-events-none",
|
|
330
|
+
off && "cursor-not-allowed",
|
|
331
|
+
className
|
|
332
|
+
);
|
|
333
|
+
const button = href && !unusable ? /* @__PURE__ */ jsx6("a", { href, className: look(false), ...anchor, onClick: inApp, children }) : /* @__PURE__ */ jsx6(
|
|
334
|
+
BaseButton,
|
|
335
|
+
{
|
|
336
|
+
type,
|
|
337
|
+
disabled: unusable,
|
|
338
|
+
focusableWhenDisabled: !!disabledReason,
|
|
339
|
+
className: (state) => look(state.disabled),
|
|
340
|
+
"aria-pressed": pressed,
|
|
341
|
+
...props,
|
|
342
|
+
children
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
const label = disabledReason ?? tooltip;
|
|
346
|
+
if (label) {
|
|
347
|
+
return /* @__PURE__ */ jsx6(TooltipTrigger, { label, shortcut: disabledReason ? void 0 : tooltipShortcut, placement: tooltipPlacement, children: button });
|
|
348
|
+
}
|
|
349
|
+
return button;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// src/ScrollArea.tsx
|
|
353
|
+
import { ScrollArea as BaseScrollArea } from "@base-ui/react/scroll-area";
|
|
354
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
355
|
+
var BAR = "z-10 flex touch-none select-none rounded-full opacity-0 transition-opacity delay-300 data-[hovering]:opacity-100 data-[hovering]:delay-0 data-[scrolling]:opacity-100 data-[scrolling]:delay-0";
|
|
356
|
+
var THUMB = "rounded-full bg-border-strong";
|
|
357
|
+
function ScrollArea({ orientation = "vertical", className, viewportClassName, contentClassName, viewportRef, onScroll, children }) {
|
|
358
|
+
const vertical = orientation !== "horizontal";
|
|
359
|
+
const horizontal = orientation !== "vertical";
|
|
360
|
+
return /* @__PURE__ */ jsxs2(BaseScrollArea.Root, { className: cn("relative min-h-0 min-w-0", className), children: [
|
|
361
|
+
/* @__PURE__ */ jsx7(
|
|
362
|
+
BaseScrollArea.Viewport,
|
|
363
|
+
{
|
|
364
|
+
ref: viewportRef,
|
|
365
|
+
onScroll,
|
|
366
|
+
className: cn(
|
|
367
|
+
"h-full w-full outline-none data-[has-overflow-x]:overscroll-x-contain data-[has-overflow-y]:overscroll-y-contain",
|
|
368
|
+
viewportClassName
|
|
369
|
+
),
|
|
370
|
+
children: /* @__PURE__ */ jsx7(BaseScrollArea.Content, { className: contentClassName, style: horizontal ? void 0 : { minWidth: 0 }, children })
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
vertical && /* @__PURE__ */ jsx7(BaseScrollArea.Scrollbar, { orientation: "vertical", className: cn(BAR, "w-1.5 justify-center py-0.5 pr-0.5 data-[has-overflow-y]:opacity-100"), children: /* @__PURE__ */ jsx7(BaseScrollArea.Thumb, { className: cn(THUMB, "w-full") }) }),
|
|
374
|
+
horizontal && /* @__PURE__ */ jsx7(BaseScrollArea.Scrollbar, { orientation: "horizontal", className: cn(BAR, "h-1.5 flex-col justify-center px-0.5 pb-0.5 data-[has-overflow-x]:opacity-100"), children: /* @__PURE__ */ jsx7(BaseScrollArea.Thumb, { className: cn(THUMB, "h-full") }) }),
|
|
375
|
+
vertical && horizontal && /* @__PURE__ */ jsx7(BaseScrollArea.Corner, {})
|
|
376
|
+
] });
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// src/Sidebar.tsx
|
|
380
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
381
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
382
|
+
var SidebarOnGround = createContext3(false);
|
|
383
|
+
function Sidebar({ "aria-label": ariaLabel = "Workspace", children, className }) {
|
|
384
|
+
const onGround = useContext3(SidebarOnGround);
|
|
385
|
+
return /* @__PURE__ */ jsx8(
|
|
386
|
+
"nav",
|
|
387
|
+
{
|
|
388
|
+
"aria-label": ariaLabel,
|
|
389
|
+
className: cn("flex w-60 shrink-0 flex-col", !onGround && "border-r border-border-default bg-bg-surface", className),
|
|
390
|
+
children: /* @__PURE__ */ jsx8(ScrollArea, { className: "min-h-0 flex-1", contentClassName: "flex flex-col gap-0.5 px-2.5 py-3", children })
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// src/TopBar.tsx
|
|
396
|
+
import { useEffect, useRef } from "react";
|
|
397
|
+
import { Button as BaseButton2 } from "@base-ui/react/button";
|
|
398
|
+
|
|
256
399
|
// src/shortcuts.ts
|
|
257
400
|
function isApplePlatform() {
|
|
258
401
|
if (typeof navigator === "undefined") return false;
|
|
@@ -267,7 +410,7 @@ function shortcutLabel(keys, apple = isApplePlatform()) {
|
|
|
267
410
|
}
|
|
268
411
|
|
|
269
412
|
// src/TopBar.tsx
|
|
270
|
-
import { jsx as
|
|
413
|
+
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
271
414
|
function TopBar({ variant = "solid", menu, logo, search, onSearch, searchPlaceholder = "Search\u2026", right, className }) {
|
|
272
415
|
const floating = variant === "floating";
|
|
273
416
|
const searchRef = useRef(onSearch);
|
|
@@ -286,11 +429,11 @@ function TopBar({ variant = "solid", menu, logo, search, onSearch, searchPlaceho
|
|
|
286
429
|
window.addEventListener("keydown", onKey);
|
|
287
430
|
return () => window.removeEventListener("keydown", onKey);
|
|
288
431
|
}, [searches]);
|
|
289
|
-
const centre = search ?? (onSearch && /* @__PURE__ */
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
432
|
+
const centre = search ?? (onSearch && /* @__PURE__ */ jsxs3(BaseButton2, { type: "button", onMouseDown: (event) => event.preventDefault(), onClick: onSearch, className: cn("flex w-[290px] cursor-pointer items-center gap-2 px-3 py-2", FIELD_SHELL_CLASSES), children: [
|
|
433
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 flex-1 truncate text-left text-input-value text-text-muted", children: searchPlaceholder }),
|
|
434
|
+
/* @__PURE__ */ jsx9(Kbd, { children: shortcutLabel("Mod-K") })
|
|
292
435
|
] }));
|
|
293
|
-
return /* @__PURE__ */
|
|
436
|
+
return /* @__PURE__ */ jsxs3(
|
|
294
437
|
"header",
|
|
295
438
|
{
|
|
296
439
|
className: cn(
|
|
@@ -299,32 +442,43 @@ function TopBar({ variant = "solid", menu, logo, search, onSearch, searchPlaceho
|
|
|
299
442
|
className
|
|
300
443
|
),
|
|
301
444
|
children: [
|
|
302
|
-
(menu || logo) && /* @__PURE__ */
|
|
445
|
+
(menu || logo) && /* @__PURE__ */ jsxs3("div", { className: cn("flex shrink-0 items-center gap-2", floating && "pointer-events-auto"), children: [
|
|
303
446
|
menu,
|
|
304
|
-
logo && /* @__PURE__ */
|
|
447
|
+
logo && /* @__PURE__ */ jsx9("div", { className: "flex items-center text-body-2-strong text-text-primary", children: logo })
|
|
305
448
|
] }),
|
|
306
|
-
/* @__PURE__ */
|
|
307
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ jsx9("div", { className: cn("flex min-w-0 flex-1 items-center justify-center", floating && "pointer-events-auto"), children: centre }),
|
|
450
|
+
/* @__PURE__ */ jsx9("div", { className: cn("flex shrink-0 items-center gap-[6px]", floating && "pointer-events-auto"), children: right })
|
|
308
451
|
]
|
|
309
452
|
}
|
|
310
453
|
);
|
|
311
454
|
}
|
|
312
455
|
|
|
313
456
|
// src/AppShell.tsx
|
|
314
|
-
import { Fragment, jsx as
|
|
315
|
-
function AppShell({ variant = "solid", menu, logo, search, onSearch, searchPlaceholder, identity, banner, nav, children }) {
|
|
316
|
-
const
|
|
457
|
+
import { Fragment, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
458
|
+
function AppShell({ variant = "solid", menu, logo, search, onSearch, searchPlaceholder, identity, banner, nav, navOpen = true, onNavOpenChange, children }) {
|
|
459
|
+
const fold = onNavOpenChange && variant !== "floating" && /* @__PURE__ */ jsx10(
|
|
460
|
+
IconButton,
|
|
461
|
+
{
|
|
462
|
+
tooltip: navOpen ? "Hide the sidebar" : "Show the sidebar",
|
|
463
|
+
tooltipPlacement: "bottom",
|
|
464
|
+
"aria-label": navOpen ? "Hide the sidebar" : "Show the sidebar",
|
|
465
|
+
"aria-expanded": navOpen,
|
|
466
|
+
onClick: () => onNavOpenChange(!navOpen),
|
|
467
|
+
children: navOpen ? /* @__PURE__ */ jsx10(IconLayoutSidebarLeftCollapse, { size: 16, stroke: 1.5 }) : /* @__PURE__ */ jsx10(IconLayoutSidebarLeftExpand, { size: 16, stroke: 1.5 })
|
|
468
|
+
}
|
|
469
|
+
);
|
|
470
|
+
const bar = /* @__PURE__ */ jsx10(TopBar, { variant, menu: menu ?? fold, logo, search, onSearch, searchPlaceholder, right: identity });
|
|
317
471
|
const inset = variant === "inset";
|
|
318
472
|
if (variant === "floating") {
|
|
319
473
|
return (
|
|
320
474
|
// `signal-canvas`: in the Signal theme, the preset draws the control-room dot
|
|
321
475
|
// grid behind everything in the frame (Peek's, moved here with the frame:
|
|
322
476
|
// UIG-14, Katerina, 19 September — the canvas is the theme's, not an app's).
|
|
323
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ jsxs4("div", { className: "signal-canvas relative h-full min-h-0 overflow-hidden bg-bg-base", children: [
|
|
324
478
|
bar,
|
|
325
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex h-full pb-4 pr-4 pt-[52px]", children: [
|
|
326
480
|
nav,
|
|
327
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ jsxs4(
|
|
328
482
|
"div",
|
|
329
483
|
{
|
|
330
484
|
className: cn(
|
|
@@ -333,7 +487,7 @@ function AppShell({ variant = "solid", menu, logo, search, onSearch, searchPlace
|
|
|
333
487
|
),
|
|
334
488
|
children: [
|
|
335
489
|
banner,
|
|
336
|
-
/* @__PURE__ */
|
|
490
|
+
/* @__PURE__ */ jsx10("main", { className: "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden", children })
|
|
337
491
|
]
|
|
338
492
|
}
|
|
339
493
|
)
|
|
@@ -341,9 +495,9 @@ function AppShell({ variant = "solid", menu, logo, search, onSearch, searchPlace
|
|
|
341
495
|
] })
|
|
342
496
|
);
|
|
343
497
|
}
|
|
344
|
-
const column = /* @__PURE__ */
|
|
498
|
+
const column = /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
345
499
|
banner,
|
|
346
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ jsx10(ScrollArea, { className: "min-h-0 flex-1", contentClassName: "flex min-h-full flex-col", children: /* @__PURE__ */ jsx10("main", { className: "flex min-w-0 flex-1 flex-col", children }) })
|
|
347
501
|
] });
|
|
348
502
|
return (
|
|
349
503
|
/* `relative overflow-hidden` is the seal the floating manner already has
|
|
@@ -355,11 +509,12 @@ function AppShell({ variant = "solid", menu, logo, search, onSearch, searchPlace
|
|
|
355
509
|
range — the whole page scrolls, navigation and top bar included.
|
|
356
510
|
`relative` claims such strays for the shell; `overflow-hidden` clips
|
|
357
511
|
them at its edge. Either alone seals nothing. */
|
|
358
|
-
/* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ jsxs4("div", { className: "relative flex h-full min-h-0 flex-col overflow-hidden bg-bg-base text-text-primary", children: [
|
|
359
513
|
bar,
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
|
|
514
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-h-0 flex-1", children: [
|
|
515
|
+
/* @__PURE__ */ jsx10("div", { className: navOpen ? "contents" : "hidden", hidden: !navOpen, children: /* @__PURE__ */ jsx10(SidebarOnGround.Provider, { value: inset, children: nav }) }),
|
|
516
|
+
!navOpen && inset && /* @__PURE__ */ jsx10("div", { className: "w-4 flex-none" }),
|
|
517
|
+
inset ? /* @__PURE__ */ jsx10(Card, { fill: "surface", clip: true, className: "mb-4 mr-4 flex min-h-0 min-w-0 flex-1 flex-col", children: column }) : /* @__PURE__ */ jsx10("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: column })
|
|
363
518
|
] })
|
|
364
519
|
] })
|
|
365
520
|
);
|
|
@@ -386,144 +541,6 @@ import {
|
|
|
386
541
|
IconX as IconX2
|
|
387
542
|
} from "@tabler/icons-react";
|
|
388
543
|
|
|
389
|
-
// src/IconButton.tsx
|
|
390
|
-
import { Button as BaseButton2 } from "@base-ui/react/button";
|
|
391
|
-
|
|
392
|
-
// src/formBusy.ts
|
|
393
|
-
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
394
|
-
var FormBusyContext = createContext3(false);
|
|
395
|
-
function useFormBusy() {
|
|
396
|
-
return useContext3(FormBusyContext);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
// src/Tooltip.tsx
|
|
400
|
-
import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
|
|
401
|
-
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
402
|
-
var OPEN_DELAY = 300;
|
|
403
|
-
function TooltipProvider({ delay = OPEN_DELAY, closeDelay, timeout, children }) {
|
|
404
|
-
return /* @__PURE__ */ jsx9(BaseTooltip.Provider, { delay, closeDelay, timeout, children });
|
|
405
|
-
}
|
|
406
|
-
function Tooltip({ label, shortcut, className, ...props }) {
|
|
407
|
-
return /* @__PURE__ */ jsxs4("div", { role: "tooltip", className: cn(FLOATING_SURFACE_CLASSES, "border-border-tooltip bg-bg-tooltip", "min-h-[30px] max-w-80 flex items-center justify-center gap-1.5 px-2 py-1", className), ...props, children: [
|
|
408
|
-
/* @__PURE__ */ jsx9("span", { className: "min-w-0 text-caption text-text-tooltip break-words", children: label }),
|
|
409
|
-
shortcut && /* @__PURE__ */ jsx9(Kbd, { tone: "tooltip", children: shortcut })
|
|
410
|
-
] });
|
|
411
|
-
}
|
|
412
|
-
var GAP = 6;
|
|
413
|
-
var VIEWPORT_PAD = 8;
|
|
414
|
-
function TooltipSurface({ label, shortcut, placement }) {
|
|
415
|
-
return /* @__PURE__ */ jsx9(BaseTooltip.Portal, { children: /* @__PURE__ */ jsx9(
|
|
416
|
-
BaseTooltip.Positioner,
|
|
417
|
-
{
|
|
418
|
-
side: placement,
|
|
419
|
-
align: "center",
|
|
420
|
-
sideOffset: GAP,
|
|
421
|
-
collisionPadding: VIEWPORT_PAD,
|
|
422
|
-
positionMethod: "fixed",
|
|
423
|
-
className: "pointer-events-none z-[9999]",
|
|
424
|
-
children: /* @__PURE__ */ jsx9(
|
|
425
|
-
BaseTooltip.Popup,
|
|
426
|
-
{
|
|
427
|
-
render: /* @__PURE__ */ jsx9(Tooltip, { label, shortcut }),
|
|
428
|
-
className: cn(
|
|
429
|
-
"transition-[opacity,transform] duration-[120ms] ease-out motion-reduce:transition-none",
|
|
430
|
-
"data-[ending-style]:duration-[80ms] data-[instant]:duration-0",
|
|
431
|
-
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
432
|
-
"data-[side=top]:data-[starting-style]:translate-y-[4px] data-[side=top]:data-[ending-style]:translate-y-[4px]",
|
|
433
|
-
"data-[side=bottom]:data-[starting-style]:-translate-y-[4px] data-[side=bottom]:data-[ending-style]:-translate-y-[4px]"
|
|
434
|
-
)
|
|
435
|
-
}
|
|
436
|
-
)
|
|
437
|
-
}
|
|
438
|
-
) });
|
|
439
|
-
}
|
|
440
|
-
function WithTooltip({ label, shortcut, placement = "top", wrapperClassName, inline = false, children }) {
|
|
441
|
-
const Wrapper = inline ? "span" : "div";
|
|
442
|
-
return /* @__PURE__ */ jsxs4(BaseTooltip.Root, { disableHoverablePopup: true, children: [
|
|
443
|
-
/* @__PURE__ */ jsx9(BaseTooltip.Trigger, { delay: OPEN_DELAY, render: /* @__PURE__ */ jsx9(Wrapper, { className: cn("inline-flex shrink-0", inline && "align-top", wrapperClassName) }), children }),
|
|
444
|
-
/* @__PURE__ */ jsx9(TooltipSurface, { label, shortcut, placement })
|
|
445
|
-
] });
|
|
446
|
-
}
|
|
447
|
-
function TooltipTrigger({ label, shortcut, placement = "top", children }) {
|
|
448
|
-
return /* @__PURE__ */ jsxs4(BaseTooltip.Root, { disableHoverablePopup: true, children: [
|
|
449
|
-
/* @__PURE__ */ jsx9(BaseTooltip.Trigger, { delay: OPEN_DELAY, render: children }),
|
|
450
|
-
/* @__PURE__ */ jsx9(TooltipSurface, { label, shortcut, placement })
|
|
451
|
-
] });
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// src/IconButton.tsx
|
|
455
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
456
|
-
function IconButton({
|
|
457
|
-
variant = "muted",
|
|
458
|
-
pressed,
|
|
459
|
-
glow = false,
|
|
460
|
-
className,
|
|
461
|
-
children,
|
|
462
|
-
disabled,
|
|
463
|
-
disabledReason,
|
|
464
|
-
tooltip,
|
|
465
|
-
tooltipShortcut,
|
|
466
|
-
tooltipPlacement,
|
|
467
|
-
type = "button",
|
|
468
|
-
href,
|
|
469
|
-
...props
|
|
470
|
-
}) {
|
|
471
|
-
const formBusy = useFormBusy();
|
|
472
|
-
const anchor = props;
|
|
473
|
-
const inApp = useInAppClick(href, anchor.onClick);
|
|
474
|
-
const unusable = disabled || !!disabledReason || formBusy;
|
|
475
|
-
const look = (off) => cn(
|
|
476
|
-
// `shrink-0` stops a flex parent squashing the button; `self-center`
|
|
477
|
-
// stops one stretching it. Two different failures, and both have
|
|
478
|
-
// happened here: a row with no `items-*` drew this 24 wide and 228
|
|
479
|
-
// tall in Peek's TopicMoreMenu story (Katerina, 2026-09-11). A button
|
|
480
|
-
// is the size of its icon and its padding, whatever box it lands in.
|
|
481
|
-
//
|
|
482
|
-
// This is the one of the two that needs it: an IconButton states no
|
|
483
|
-
// height, so its cross size is `auto` and a stretching parent takes
|
|
484
|
-
// it. Measured in the same 260px row on 2026-09-12: 24px with this
|
|
485
|
-
// class, 226px without. `Button` states `h-8`/`h-6`, so it cannot be
|
|
486
|
-
// stretched and carries no `self-center` — see the note there.
|
|
487
|
-
"flex items-center justify-center p-1 rounded-lg transition-colors shrink-0 self-center cursor-pointer",
|
|
488
|
-
!off && variant === "primary" && "bg-accent-primary hover:bg-accent-hover text-text-inverse",
|
|
489
|
-
!off && (variant === "muted" || variant === "resolve") && MUTED_CONTROL_CLASSES,
|
|
490
|
-
!off && variant === "outlined" && "border border-border-default hover:bg-bg-hover text-text-secondary",
|
|
491
|
-
!off && variant === "current" && "hover:bg-bg-hover",
|
|
492
|
-
off && variant === "primary" && "bg-bg-disabled text-text-disabled",
|
|
493
|
-
off && (variant === "muted" || variant === "resolve") && "text-text-disabled",
|
|
494
|
-
off && variant === "outlined" && "border border-border-default text-text-disabled",
|
|
495
|
-
// Always, disabled too: the colour of where it sits, and Resolve's green.
|
|
496
|
-
variant === "current" && "text-current",
|
|
497
|
-
variant === "resolve" && "signal:hover:bg-success-muted signal:hover:text-success-default",
|
|
498
|
-
pressed && "bg-bg-active text-text-primary",
|
|
499
|
-
glow && "signal:shadow-glow-accent",
|
|
500
|
-
// `pointer-events-none` only where the button is truly out of reach:
|
|
501
|
-
// with a `disabledReason` the button IS the tooltip's trigger, and a
|
|
502
|
-
// trigger the pointer cannot land on never opens one. Base UI already
|
|
503
|
-
// swallows the click.
|
|
504
|
-
off && !disabledReason && "pointer-events-none",
|
|
505
|
-
off && "cursor-not-allowed",
|
|
506
|
-
className
|
|
507
|
-
);
|
|
508
|
-
const button = href && !unusable ? /* @__PURE__ */ jsx10("a", { href, className: look(false), ...anchor, onClick: inApp, children }) : /* @__PURE__ */ jsx10(
|
|
509
|
-
BaseButton2,
|
|
510
|
-
{
|
|
511
|
-
type,
|
|
512
|
-
disabled: unusable,
|
|
513
|
-
focusableWhenDisabled: !!disabledReason,
|
|
514
|
-
className: (state) => look(state.disabled),
|
|
515
|
-
"aria-pressed": pressed,
|
|
516
|
-
...props,
|
|
517
|
-
children
|
|
518
|
-
}
|
|
519
|
-
);
|
|
520
|
-
const label = disabledReason ?? tooltip;
|
|
521
|
-
if (label) {
|
|
522
|
-
return /* @__PURE__ */ jsx10(TooltipTrigger, { label, shortcut: disabledReason ? void 0 : tooltipShortcut, placement: tooltipPlacement, children: button });
|
|
523
|
-
}
|
|
524
|
-
return button;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
544
|
// src/Lightbox.tsx
|
|
528
545
|
import { useRef as useRef2 } from "react";
|
|
529
546
|
import { Dialog } from "@base-ui/react/dialog";
|