@estiva-app/ui 0.111.0 → 0.113.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/dist/NavItem.d.ts +8 -1
- package/dist/NavItem.d.ts.map +1 -1
- package/dist/TopBar.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +146 -131
- package/dist/index.js.map +4 -4
- package/dist/shortcuts.d.ts +9 -0
- package/dist/shortcuts.d.ts.map +1 -1
- package/package.json +1 -1
- package/registry.json +27 -2
- package/src/Kbd.mdx +5 -0
- package/src/NavItem.mdx +8 -0
- package/src/NavItem.stories.tsx +15 -0
- package/src/NavItem.test.tsx +37 -0
- package/src/NavItem.tsx +22 -5
- package/src/TopBar.tsx +5 -20
- package/src/index.ts +1 -1
- package/src/registry/registry.test.ts +4 -3
- package/src/shortcuts.test.ts +99 -0
- package/src/shortcuts.ts +40 -0
- package/stories/Choosing.mdx +1 -1
package/dist/index.js
CHANGED
|
@@ -458,10 +458,11 @@ function Sidebar({ "aria-label": ariaLabel = "Workspace", children, className })
|
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
// src/TopBar.tsx
|
|
461
|
-
import
|
|
461
|
+
import "react";
|
|
462
462
|
import { Button as BaseButton2 } from "@base-ui/react/button";
|
|
463
463
|
|
|
464
464
|
// src/shortcuts.ts
|
|
465
|
+
import { useEffect, useRef } from "react";
|
|
465
466
|
function isApplePlatform() {
|
|
466
467
|
if (typeof navigator === "undefined") return false;
|
|
467
468
|
return /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent || "");
|
|
@@ -473,27 +474,37 @@ function shortcutLabel(keys, apple = isApplePlatform()) {
|
|
|
473
474
|
return part;
|
|
474
475
|
}).join("+");
|
|
475
476
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
477
|
+
function matchesShortcut(event, keys) {
|
|
478
|
+
const at = keys.lastIndexOf("-", keys.length - 2);
|
|
479
|
+
const key = keys.slice(at + 1);
|
|
480
|
+
const mods = new Set(at < 0 ? [] : keys.slice(0, at).split("-"));
|
|
481
|
+
if (mods.has("Mod") ? !(event.metaKey || event.ctrlKey) : event.metaKey || event.ctrlKey) return false;
|
|
482
|
+
if (mods.has("Shift") !== event.shiftKey || mods.has("Alt") !== event.altKey) return false;
|
|
483
|
+
return event.key.toLowerCase() === key.toLowerCase();
|
|
484
|
+
}
|
|
485
|
+
function useShortcut(keys, onPress, enabled = true) {
|
|
486
|
+
const pressRef = useRef(onPress);
|
|
482
487
|
useEffect(() => {
|
|
483
|
-
|
|
488
|
+
pressRef.current = onPress;
|
|
484
489
|
});
|
|
485
|
-
const searches = onSearch !== void 0;
|
|
486
490
|
useEffect(() => {
|
|
487
|
-
if (!
|
|
491
|
+
if (!enabled) return;
|
|
488
492
|
const onKey = (event) => {
|
|
489
|
-
if (
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}
|
|
493
|
+
if (event.repeat || event.defaultPrevented || event.isComposing || !matchesShortcut(event, keys)) return;
|
|
494
|
+
event.preventDefault();
|
|
495
|
+
pressRef.current();
|
|
493
496
|
};
|
|
494
497
|
window.addEventListener("keydown", onKey);
|
|
495
498
|
return () => window.removeEventListener("keydown", onKey);
|
|
496
|
-
}, [
|
|
499
|
+
}, [keys, enabled]);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// src/TopBar.tsx
|
|
503
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
504
|
+
function TopBar({ variant = "solid", menu, logo, search, onSearch, searchPlaceholder = "Search\u2026", right, className }) {
|
|
505
|
+
const floating = variant === "floating";
|
|
506
|
+
useShortcut("Mod-K", () => onSearch?.(), onSearch !== void 0);
|
|
507
|
+
useShortcut("Mod-Shift-K", () => onSearch?.(), onSearch !== void 0);
|
|
497
508
|
const centre = search ?? (onSearch && /* @__PURE__ */ jsxs4(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: [
|
|
498
509
|
/* @__PURE__ */ jsx9("span", { className: "min-w-0 flex-1 truncate text-left text-input-value text-text-muted", children: searchPlaceholder }),
|
|
499
510
|
/* @__PURE__ */ jsx9(Kbd, { children: shortcutLabel("Mod-K") })
|
|
@@ -4149,14 +4160,53 @@ function CollapsibleSection({ title, defaultOpen = true, open: openProp, onOpenC
|
|
|
4149
4160
|
] });
|
|
4150
4161
|
}
|
|
4151
4162
|
|
|
4163
|
+
// src/PreviewCard.tsx
|
|
4164
|
+
import { PreviewCard as BasePreviewCard } from "@base-ui/react/preview-card";
|
|
4165
|
+
import { jsx as jsx56, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
4166
|
+
var GAP5 = 12;
|
|
4167
|
+
var VIEWPORT_PAD5 = 8;
|
|
4168
|
+
var OPEN_DELAY2 = 350;
|
|
4169
|
+
var CLOSE_DELAY = 200;
|
|
4170
|
+
function PreviewCard({ content, children, side = "right", delay = OPEN_DELAY2, closeDelay = CLOSE_DELAY, className, contentClassName, wrapperClassName }) {
|
|
4171
|
+
return /* @__PURE__ */ jsxs41(BasePreviewCard.Root, { children: [
|
|
4172
|
+
/* @__PURE__ */ jsx56(
|
|
4173
|
+
BasePreviewCard.Trigger,
|
|
4174
|
+
{
|
|
4175
|
+
delay,
|
|
4176
|
+
closeDelay,
|
|
4177
|
+
render: /* @__PURE__ */ jsx56("span", { className: cn("inline-flex", wrapperClassName) }),
|
|
4178
|
+
children
|
|
4179
|
+
}
|
|
4180
|
+
),
|
|
4181
|
+
/* @__PURE__ */ jsx56(BasePreviewCard.Portal, { children: /* @__PURE__ */ jsx56(
|
|
4182
|
+
BasePreviewCard.Positioner,
|
|
4183
|
+
{
|
|
4184
|
+
side,
|
|
4185
|
+
align: "start",
|
|
4186
|
+
sideOffset: GAP5,
|
|
4187
|
+
collisionPadding: VIEWPORT_PAD5,
|
|
4188
|
+
className: "z-50 data-[anchor-hidden]:hidden",
|
|
4189
|
+
children: /* @__PURE__ */ jsx56(
|
|
4190
|
+
BasePreviewCard.Popup,
|
|
4191
|
+
{
|
|
4192
|
+
className: cn("w-[360px] p-0 outline-none", className),
|
|
4193
|
+
render: /* @__PURE__ */ jsx56(MenuPanel, {}),
|
|
4194
|
+
children: /* @__PURE__ */ jsx56(ScrollArea, { viewportClassName: "max-h-[min(300px,var(--available-height))]", contentClassName: cn("flex flex-col gap-3 p-3", contentClassName), children: content })
|
|
4195
|
+
}
|
|
4196
|
+
)
|
|
4197
|
+
}
|
|
4198
|
+
) })
|
|
4199
|
+
] });
|
|
4200
|
+
}
|
|
4201
|
+
|
|
4152
4202
|
// src/UnreadDot.tsx
|
|
4153
|
-
import { jsx as
|
|
4203
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
4154
4204
|
function UnreadDot({ className }) {
|
|
4155
|
-
return /* @__PURE__ */
|
|
4205
|
+
return /* @__PURE__ */ jsx57("div", { className: cn("flex h-6 w-6 shrink-0 items-center justify-center", className), "data-unread": true, children: /* @__PURE__ */ jsx57("div", { className: "h-1.5 w-1.5 rounded-full bg-accent-primary" }) });
|
|
4156
4206
|
}
|
|
4157
4207
|
|
|
4158
4208
|
// src/NavItem.tsx
|
|
4159
|
-
import { jsx as
|
|
4209
|
+
import { jsx as jsx58, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4160
4210
|
function NavItem({
|
|
4161
4211
|
label,
|
|
4162
4212
|
href,
|
|
@@ -4171,6 +4221,7 @@ function NavItem({
|
|
|
4171
4221
|
tooltip,
|
|
4172
4222
|
unread = false,
|
|
4173
4223
|
urgent = false,
|
|
4224
|
+
preview,
|
|
4174
4225
|
children,
|
|
4175
4226
|
defaultOpen = true,
|
|
4176
4227
|
open: openProp,
|
|
@@ -4193,9 +4244,9 @@ function NavItem({
|
|
|
4193
4244
|
useOpenFor(hasRows ? openFor : void 0, open, setOpen);
|
|
4194
4245
|
const buttons = (menu != null ? 1 : 0) + (action ? 1 : 0);
|
|
4195
4246
|
const besides = buttons > 0 || hasRows;
|
|
4196
|
-
const mark = unread ? urgent ? /* @__PURE__ */
|
|
4247
|
+
const mark = unread ? urgent ? /* @__PURE__ */ jsx58(UrgentMark, {}) : /* @__PURE__ */ jsx58(UnreadDot, {}) : null;
|
|
4197
4248
|
const stepsAside = buttons > 0 && "transition-opacity group-hover/nav:opacity-0 group-has-[:focus-visible]/nav:opacity-0 group-has-[[data-nav-menu]_[aria-expanded=true]]/nav:opacity-0 [@media(hover:none)]:opacity-0";
|
|
4198
|
-
const row = /* @__PURE__ */
|
|
4249
|
+
const row = /* @__PURE__ */ jsxs42(
|
|
4199
4250
|
"a",
|
|
4200
4251
|
{
|
|
4201
4252
|
href,
|
|
@@ -4217,7 +4268,7 @@ function NavItem({
|
|
|
4217
4268
|
...props,
|
|
4218
4269
|
onClick: inApp,
|
|
4219
4270
|
children: [
|
|
4220
|
-
(icon || hasRows) && /* @__PURE__ */
|
|
4271
|
+
(icon || hasRows) && /* @__PURE__ */ jsx58(
|
|
4221
4272
|
"span",
|
|
4222
4273
|
{
|
|
4223
4274
|
className: cn(
|
|
@@ -4228,17 +4279,18 @@ function NavItem({
|
|
|
4228
4279
|
children: icon
|
|
4229
4280
|
}
|
|
4230
4281
|
),
|
|
4231
|
-
tooltip?.trim() ? (
|
|
4282
|
+
tooltip?.trim() && preview == null ? (
|
|
4232
4283
|
// On the label alone, not the row: the ⋮ and the action keep their
|
|
4233
|
-
// own tooltips, and the two never stand up at once.
|
|
4234
|
-
|
|
4235
|
-
|
|
4284
|
+
// own tooltips, and the two never stand up at once. A row with a
|
|
4285
|
+
// preview card says more there, so the label has no tooltip beside it.
|
|
4286
|
+
/* @__PURE__ */ jsx58(WithTooltip, { label: tooltip, inline: true, wrapperClassName: "flex min-w-0 flex-1", children: /* @__PURE__ */ jsx58("span", { className: cn("flex-1 truncate", unread && "font-medium"), children: label }) })
|
|
4287
|
+
) : /* @__PURE__ */ jsx58("span", { className: cn("flex-1 truncate", unread && "font-medium"), children: label }),
|
|
4236
4288
|
hint != null && // Takes room only while it shows, so the label gives way to it.
|
|
4237
|
-
/* @__PURE__ */
|
|
4289
|
+
/* @__PURE__ */ jsx58("span", { className: "hidden shrink-0 items-center group-hover/nav:flex group-has-[:focus-visible]/nav:flex", children: hint }),
|
|
4238
4290
|
buttons > 1 && // Two buttons: the second one's room (24px and the 4px between them, the
|
|
4239
4291
|
// row's 8px gap making up the rest), kept only while they show.
|
|
4240
|
-
/* @__PURE__ */
|
|
4241
|
-
count ? /* @__PURE__ */
|
|
4292
|
+
/* @__PURE__ */ jsx58("span", { "aria-hidden": "true", className: "hidden w-5 shrink-0 group-hover/nav:block group-has-[:focus-visible]/nav:block group-has-[[data-nav-menu]_[aria-expanded=true]]/nav:block [@media(hover:none)]:block" }),
|
|
4293
|
+
count ? /* @__PURE__ */ jsx58(WithTooltip, { label: countLabel ?? `${count} open`, children: /* @__PURE__ */ jsx58(
|
|
4242
4294
|
"span",
|
|
4243
4295
|
{
|
|
4244
4296
|
className: cn(
|
|
@@ -4254,7 +4306,7 @@ function NavItem({
|
|
|
4254
4306
|
// `-mr-1`: the 24px slot's dot then sits on the axis of a count and
|
|
4255
4307
|
// of the ⋮ (8px from the edge to the 16px box), one column with a
|
|
4256
4308
|
// folder heading's dot and ⋮ (Katerina, 5 October).
|
|
4257
|
-
/* @__PURE__ */
|
|
4309
|
+
/* @__PURE__ */ jsx58("span", { className: cn("-mr-1 flex shrink-0", stepsAside), children: mark })
|
|
4258
4310
|
) : buttons > 0 && !count ? (
|
|
4259
4311
|
// Nothing at the right, but a menu: no room is kept at rest, so the
|
|
4260
4312
|
// label has the row's whole width; while the ⋮ shows, its 24px slot
|
|
@@ -4262,18 +4314,19 @@ function NavItem({
|
|
|
4262
4314
|
// `-mr-1`: the ⋮ sits at `right-1`, 4px into the row's padding, so the
|
|
4263
4315
|
// slot does too — at the padding's edge it kept 4px the ⋮ never
|
|
4264
4316
|
// covers, and the label stopped 12px short of the button, not 8.
|
|
4265
|
-
/* @__PURE__ */
|
|
4317
|
+
/* @__PURE__ */ jsx58("span", { "aria-hidden": "true", className: "-mr-1 hidden w-6 shrink-0 group-hover/nav:block group-has-[:focus-visible]/nav:block group-has-[[data-nav-menu]_[aria-expanded=true]]/nav:block [@media(hover:none)]:block" })
|
|
4266
4318
|
) : null
|
|
4267
4319
|
]
|
|
4268
4320
|
}
|
|
4269
4321
|
);
|
|
4270
|
-
|
|
4322
|
+
const card = (trigger) => preview == null ? trigger : /* @__PURE__ */ jsx58(PreviewCard, { content: preview, contentClassName: "gap-0.5 p-1", wrapperClassName: "block w-full shrink-0", children: trigger });
|
|
4323
|
+
if (!besides && hint == null) return card(row);
|
|
4271
4324
|
const name = menuLabel ?? `More options for ${label}`;
|
|
4272
|
-
const line = /* @__PURE__ */
|
|
4325
|
+
const line = /* @__PURE__ */ jsxs42("div", { className: "group/nav relative shrink-0", children: [
|
|
4273
4326
|
row,
|
|
4274
4327
|
hasRows && // `left-1`: the 24px button's 16px arrow then sits where the icon
|
|
4275
4328
|
// sits (the row's px-2), so the icon turns into the arrow in place.
|
|
4276
|
-
/* @__PURE__ */
|
|
4329
|
+
/* @__PURE__ */ jsx58("div", { className: "absolute inset-y-0 left-1 flex items-center opacity-0 transition-opacity group-hover/nav:opacity-100 group-has-[:focus-visible]/nav:opacity-100", children: /* @__PURE__ */ jsx58(
|
|
4277
4330
|
IconButton,
|
|
4278
4331
|
{
|
|
4279
4332
|
tooltip: open ? "Collapse" : "Expand",
|
|
@@ -4281,7 +4334,7 @@ function NavItem({
|
|
|
4281
4334
|
"aria-expanded": open,
|
|
4282
4335
|
"aria-controls": panelId,
|
|
4283
4336
|
onClick: () => setOpen(!open),
|
|
4284
|
-
children: /* @__PURE__ */
|
|
4337
|
+
children: /* @__PURE__ */ jsx58(IconChevronRight3, { size: 16, stroke: 1.5, className: cn("transition-transform duration-150", open && "rotate-90") })
|
|
4285
4338
|
}
|
|
4286
4339
|
) }),
|
|
4287
4340
|
buttons > 0 && // `right-1`: the 24px button's 16px icon ends 8px from the row's
|
|
@@ -4292,28 +4345,28 @@ function NavItem({
|
|
|
4292
4345
|
// right of the slot's centre.
|
|
4293
4346
|
// On a screen with no hover it always shows: nothing there can point
|
|
4294
4347
|
// at the row, and the menu has no other way in.
|
|
4295
|
-
/* @__PURE__ */
|
|
4296
|
-
action && /* @__PURE__ */
|
|
4297
|
-
menu != null && /* @__PURE__ */
|
|
4348
|
+
/* @__PURE__ */ jsxs42("div", { "data-nav-menu": true, className: cn("absolute inset-y-0 right-1 flex items-center gap-1", "opacity-0 transition-opacity group-hover/nav:opacity-100 group-has-[:focus-visible]/nav:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100"), children: [
|
|
4349
|
+
action && /* @__PURE__ */ jsx58(IconButton, { tooltip: action.tooltip, "aria-label": `${action.tooltip}: ${label}`, onClick: action.onClick, children: action.icon }),
|
|
4350
|
+
menu != null && /* @__PURE__ */ jsx58(
|
|
4298
4351
|
Menu,
|
|
4299
4352
|
{
|
|
4300
4353
|
align: "right",
|
|
4301
|
-
trigger: /* @__PURE__ */
|
|
4354
|
+
trigger: /* @__PURE__ */ jsx58(IconButton, { tooltip: "More options", "aria-label": name, children: /* @__PURE__ */ jsx58(IconDotsVertical2, { size: 16, stroke: 1.5 }) }),
|
|
4302
4355
|
children: menu
|
|
4303
4356
|
}
|
|
4304
4357
|
)
|
|
4305
4358
|
] })
|
|
4306
4359
|
] });
|
|
4307
|
-
if (!hasRows) return line;
|
|
4308
|
-
return /* @__PURE__ */
|
|
4309
|
-
line,
|
|
4310
|
-
/* @__PURE__ */
|
|
4360
|
+
if (!hasRows) return card(line);
|
|
4361
|
+
return /* @__PURE__ */ jsxs42(Collapsible2.Root, { open, onOpenChange: setOpen, className: "flex shrink-0 flex-col", children: [
|
|
4362
|
+
card(line),
|
|
4363
|
+
/* @__PURE__ */ jsx58(
|
|
4311
4364
|
Collapsible2.Panel,
|
|
4312
4365
|
{
|
|
4313
4366
|
id: panelId,
|
|
4314
4367
|
hiddenUntilFound: true,
|
|
4315
4368
|
className: COLLAPSIBLE_PANEL_CLASSES,
|
|
4316
|
-
children: /* @__PURE__ */
|
|
4369
|
+
children: /* @__PURE__ */ jsx58("div", { className: "flex flex-col gap-0.5 pt-0.5 pl-6", children })
|
|
4317
4370
|
}
|
|
4318
4371
|
)
|
|
4319
4372
|
] });
|
|
@@ -4321,7 +4374,7 @@ function NavItem({
|
|
|
4321
4374
|
|
|
4322
4375
|
// src/NavTree.tsx
|
|
4323
4376
|
import { createContext as createContext8, useContext as useContext8, useEffect as useEffect9, useRef as useRef15, useState as useState17 } from "react";
|
|
4324
|
-
import { jsx as
|
|
4377
|
+
import { jsx as jsx59, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4325
4378
|
var NAV_TREE_INTENT_MS = 150;
|
|
4326
4379
|
var NAV_TREE_REVEAL_MS = 200;
|
|
4327
4380
|
var NAV_TREE_PENDING_MS = 2e3;
|
|
@@ -4358,7 +4411,7 @@ function scrollToRow(row) {
|
|
|
4358
4411
|
else if (at.bottom > view.bottom) box.scrollTop += Math.min(at.bottom - view.bottom, at.top - view.top);
|
|
4359
4412
|
}
|
|
4360
4413
|
function Line({ message }) {
|
|
4361
|
-
return /* @__PURE__ */
|
|
4414
|
+
return /* @__PURE__ */ jsx59(EmptyState, { scope: "rows", message });
|
|
4362
4415
|
}
|
|
4363
4416
|
var groupLinked = createContext8(void 0);
|
|
4364
4417
|
function groupBox(box, id) {
|
|
@@ -4366,8 +4419,8 @@ function groupBox(box, id) {
|
|
|
4366
4419
|
return group && group.getBoundingClientRect().height > 0 ? group : void 0;
|
|
4367
4420
|
}
|
|
4368
4421
|
function Row({ node, selected, onSelect, opening }) {
|
|
4369
|
-
const under = node.childrenMessage !== void 0 ? /* @__PURE__ */
|
|
4370
|
-
return /* @__PURE__ */
|
|
4422
|
+
const under = node.childrenMessage !== void 0 ? /* @__PURE__ */ jsx59(Line, { message: node.childrenMessage }) : node.children?.length ? node.children.map((child) => /* @__PURE__ */ jsx59(Row, { node: child, selected, onSelect, opening }, child.id)) : node.children === null || node.hasChildren && node.children === void 0 ? /* @__PURE__ */ jsx59(SkeletonList, { rows: 2 }) : void 0;
|
|
4423
|
+
return /* @__PURE__ */ jsx59(
|
|
4371
4424
|
NavItem,
|
|
4372
4425
|
{
|
|
4373
4426
|
href: node.href,
|
|
@@ -4390,7 +4443,7 @@ function Row({ node, selected, onSelect, opening }) {
|
|
|
4390
4443
|
);
|
|
4391
4444
|
}
|
|
4392
4445
|
function Group({ group, selected, onSelect, opening, storageKey }) {
|
|
4393
|
-
return /* @__PURE__ */
|
|
4446
|
+
return /* @__PURE__ */ jsx59(
|
|
4394
4447
|
NavTreeSection,
|
|
4395
4448
|
{
|
|
4396
4449
|
id: group.id,
|
|
@@ -4407,7 +4460,7 @@ function Group({ group, selected, onSelect, opening, storageKey }) {
|
|
|
4407
4460
|
storageKey: storageKey ? `${storageKey}.${group.id}` : void 0,
|
|
4408
4461
|
openFor: opening?.group === group.id ? opening.item : void 0,
|
|
4409
4462
|
onIntent: group.onIntent,
|
|
4410
|
-
children: group.nodes?.map((node) => /* @__PURE__ */
|
|
4463
|
+
children: group.nodes?.map((node) => /* @__PURE__ */ jsx59(Row, { node, selected, onSelect, opening }, node.id))
|
|
4411
4464
|
}
|
|
4412
4465
|
);
|
|
4413
4466
|
}
|
|
@@ -4424,7 +4477,7 @@ function NavTreeSection({ id, title, message, loading = false, pending = false,
|
|
|
4424
4477
|
const intent = onIntent;
|
|
4425
4478
|
const linkedTo = useContext8(groupLinked);
|
|
4426
4479
|
const linked = id !== void 0 && linkedTo === id ? id : void 0;
|
|
4427
|
-
return /* @__PURE__ */
|
|
4480
|
+
return /* @__PURE__ */ jsx59(
|
|
4428
4481
|
"div",
|
|
4429
4482
|
{
|
|
4430
4483
|
className: "shrink-0 [&+&]:mt-1",
|
|
@@ -4435,7 +4488,7 @@ function NavTreeSection({ id, title, message, loading = false, pending = false,
|
|
|
4435
4488
|
} : void 0,
|
|
4436
4489
|
onPointerLeave: intent ? () => clearTimeout(timer.current) : void 0,
|
|
4437
4490
|
onFocus: intent,
|
|
4438
|
-
children: /* @__PURE__ */
|
|
4491
|
+
children: /* @__PURE__ */ jsx59(sectionLinked.Provider, { value: linked, children: /* @__PURE__ */ jsx59(
|
|
4439
4492
|
CollapsibleSection,
|
|
4440
4493
|
{
|
|
4441
4494
|
title,
|
|
@@ -4452,7 +4505,7 @@ function NavTreeSection({ id, title, message, loading = false, pending = false,
|
|
|
4452
4505
|
icon,
|
|
4453
4506
|
className: "shrink-0",
|
|
4454
4507
|
contentClassName: "gap-0.5",
|
|
4455
|
-
children: /* @__PURE__ */
|
|
4508
|
+
children: /* @__PURE__ */ jsx59(sectionLinked.Provider, { value: void 0, children: message !== void 0 ? /* @__PURE__ */ jsx59(Line, { message }) : loading || slow ? /* @__PURE__ */ jsx59(SkeletonList, { rows: 3 }) : children })
|
|
4456
4509
|
}
|
|
4457
4510
|
) })
|
|
4458
4511
|
}
|
|
@@ -4490,12 +4543,12 @@ function NavTree({ title, titleActions, groups, children, selected, selectedPare
|
|
|
4490
4543
|
});
|
|
4491
4544
|
return (
|
|
4492
4545
|
// `contents`: a box to find the current row in, that lays nothing out — the groups stay the column's own.
|
|
4493
|
-
/* @__PURE__ */
|
|
4494
|
-
title && /* @__PURE__ */
|
|
4495
|
-
groups === void 0 ? children : groups === null ? /* @__PURE__ */
|
|
4546
|
+
/* @__PURE__ */ jsx59("div", { ref: box, className: "contents", children: /* @__PURE__ */ jsxs43(groupLinked.Provider, { value: selectedGroup, children: [
|
|
4547
|
+
title && /* @__PURE__ */ jsx59(SectionHeader, { title, look: "quiet", showActions: "always", actions: titleActions, className: "mt-4 shrink-0" }),
|
|
4548
|
+
groups === void 0 ? children : groups === null ? /* @__PURE__ */ jsx59(SkeletonList, { rows: 5 }) : groups.length === 0 ? (
|
|
4496
4549
|
// No words, no line: an app that says nothing when it has no groups.
|
|
4497
|
-
emptyMessage ? /* @__PURE__ */
|
|
4498
|
-
) : groups.map((group) => /* @__PURE__ */
|
|
4550
|
+
emptyMessage ? /* @__PURE__ */ jsx59(Line, { message: emptyMessage }) : null
|
|
4551
|
+
) : groups.map((group) => /* @__PURE__ */ jsx59(Group, { group, selected, onSelect, opening, storageKey }, group.id))
|
|
4499
4552
|
] }) })
|
|
4500
4553
|
);
|
|
4501
4554
|
}
|
|
@@ -4503,16 +4556,16 @@ function NavTree({ title, titleActions, groups, children, selected, selectedPare
|
|
|
4503
4556
|
// src/Popover.tsx
|
|
4504
4557
|
import { useMemo as useMemo4 } from "react";
|
|
4505
4558
|
import { Popover as BasePopover } from "@base-ui/react/popover";
|
|
4506
|
-
import { jsx as
|
|
4507
|
-
var
|
|
4508
|
-
var
|
|
4559
|
+
import { jsx as jsx60, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
4560
|
+
var GAP6 = 4;
|
|
4561
|
+
var VIEWPORT_PAD6 = 8;
|
|
4509
4562
|
function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpenChange, finalFocus, actionsRef, ariaLabel, children, className, contentClassName, maxHeight }) {
|
|
4510
4563
|
const anchorTarget = useMemo4(() => {
|
|
4511
4564
|
if (!anchor) return void 0;
|
|
4512
4565
|
if (anchor instanceof Element || "getBoundingClientRect" in anchor) return anchor;
|
|
4513
4566
|
return { getBoundingClientRect: () => anchor };
|
|
4514
4567
|
}, [anchor]);
|
|
4515
|
-
return /* @__PURE__ */
|
|
4568
|
+
return /* @__PURE__ */ jsxs44(
|
|
4516
4569
|
BasePopover.Root,
|
|
4517
4570
|
{
|
|
4518
4571
|
open,
|
|
@@ -4520,30 +4573,30 @@ function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpe
|
|
|
4520
4573
|
actionsRef,
|
|
4521
4574
|
modal: false,
|
|
4522
4575
|
children: [
|
|
4523
|
-
trigger && /* @__PURE__ */
|
|
4524
|
-
/* @__PURE__ */
|
|
4576
|
+
trigger && /* @__PURE__ */ jsx60(BasePopover.Trigger, { render: trigger, disabled: triggerDisabled(trigger) }),
|
|
4577
|
+
/* @__PURE__ */ jsx60(BasePopover.Portal, { children: /* @__PURE__ */ jsx60(
|
|
4525
4578
|
BasePopover.Positioner,
|
|
4526
4579
|
{
|
|
4527
4580
|
anchor: anchorTarget,
|
|
4528
4581
|
side,
|
|
4529
4582
|
align: align === "right" ? "end" : align === "center" ? "center" : "start",
|
|
4530
|
-
sideOffset:
|
|
4531
|
-
collisionPadding:
|
|
4583
|
+
sideOffset: GAP6,
|
|
4584
|
+
collisionPadding: VIEWPORT_PAD6,
|
|
4532
4585
|
className: "z-50 data-[anchor-hidden]:hidden",
|
|
4533
|
-
children: /* @__PURE__ */
|
|
4586
|
+
children: /* @__PURE__ */ jsx60(
|
|
4534
4587
|
BasePopover.Popup,
|
|
4535
4588
|
{
|
|
4536
4589
|
"aria-label": ariaLabel,
|
|
4537
4590
|
initialFocus: trigger ? void 0 : false,
|
|
4538
4591
|
finalFocus,
|
|
4539
4592
|
className: cn("min-w-[180px] outline-none p-0", className),
|
|
4540
|
-
render: /* @__PURE__ */
|
|
4541
|
-
children: /* @__PURE__ */
|
|
4593
|
+
render: /* @__PURE__ */ jsx60(MenuPanel, {}),
|
|
4594
|
+
children: /* @__PURE__ */ jsx60(
|
|
4542
4595
|
ScrollArea,
|
|
4543
4596
|
{
|
|
4544
4597
|
viewportClassName: maxHeight ?? "max-h-[var(--available-height)]",
|
|
4545
4598
|
contentClassName: cn("flex flex-col p-2", contentClassName),
|
|
4546
|
-
children: /* @__PURE__ */
|
|
4599
|
+
children: /* @__PURE__ */ jsx60(DividerInPanel.Provider, { value: true, children })
|
|
4547
4600
|
}
|
|
4548
4601
|
)
|
|
4549
4602
|
}
|
|
@@ -4557,7 +4610,7 @@ function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpe
|
|
|
4557
4610
|
|
|
4558
4611
|
// src/SuggestionMenu.tsx
|
|
4559
4612
|
import { useCallback as useCallback5, useEffect as useEffect10, useId as useId5, useImperativeHandle, useMemo as useMemo5, useRef as useRef16, useState as useState18 } from "react";
|
|
4560
|
-
import { jsx as
|
|
4613
|
+
import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4561
4614
|
function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sections, itemKey, row, onSelect, handle }) {
|
|
4562
4615
|
const last = useRef16(null);
|
|
4563
4616
|
const anchor = useMemo5(() => {
|
|
@@ -4633,7 +4686,7 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
4633
4686
|
const { label, description, aside, leading, shortcut, hint, size } = row(item);
|
|
4634
4687
|
return (
|
|
4635
4688
|
// A row of a list the editor drives from its caret: focus stays in the text, so the row is no Tab stop.
|
|
4636
|
-
/* @__PURE__ */
|
|
4689
|
+
/* @__PURE__ */ jsx61(
|
|
4637
4690
|
MenuItem,
|
|
4638
4691
|
{
|
|
4639
4692
|
role: "option",
|
|
@@ -4661,9 +4714,9 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
4661
4714
|
};
|
|
4662
4715
|
return (
|
|
4663
4716
|
// finalFocus={false}: focus never left the text, and a list that closes because focus moved elsewhere must not pull it back (71a4577b).
|
|
4664
|
-
/* @__PURE__ */
|
|
4665
|
-
i > 0 && /* @__PURE__ */
|
|
4666
|
-
section.label ? /* @__PURE__ */
|
|
4717
|
+
/* @__PURE__ */ jsx61(Popover, { anchor, open: rect !== null, side: "top", align: "left", className: width, maxHeight, ariaLabel, finalFocus: false, children: /* @__PURE__ */ jsx61("div", { ref: keepFocus, id: listboxId, role: "listbox", "aria-label": ariaLabel, className: "flex flex-col gap-0.5", children: shown2.map((section, i) => /* @__PURE__ */ jsxs45("div", { className: "contents", children: [
|
|
4718
|
+
i > 0 && /* @__PURE__ */ jsx61(MenuSeparator, {}),
|
|
4719
|
+
section.label ? /* @__PURE__ */ jsx61("div", { role: "group", "aria-label": section.label, children: /* @__PURE__ */ jsx61(MenuSection, { label: section.label, className: section.className, children: section.items.map(drawRow) }) }) : section.items.map(drawRow)
|
|
4667
4720
|
] }, section.label ?? i)) }) })
|
|
4668
4721
|
);
|
|
4669
4722
|
}
|
|
@@ -4671,7 +4724,7 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
4671
4724
|
// src/ShowMore.tsx
|
|
4672
4725
|
import { useLayoutEffect as useLayoutEffect5, useRef as useRef17, useState as useState19 } from "react";
|
|
4673
4726
|
import { IconChevronDown as IconChevronDown4, IconChevronUp } from "@tabler/icons-react";
|
|
4674
|
-
import { jsx as
|
|
4727
|
+
import { jsx as jsx62, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4675
4728
|
var FADE = "linear-gradient(to top, transparent, black 40px)";
|
|
4676
4729
|
function ShowMore({ children, maxHeight = 96, contentClassName, className }) {
|
|
4677
4730
|
const box = useRef17(null);
|
|
@@ -4688,19 +4741,19 @@ function ShowMore({ children, maxHeight = 96, contentClassName, className }) {
|
|
|
4688
4741
|
return () => observer.disconnect();
|
|
4689
4742
|
}, [maxHeight]);
|
|
4690
4743
|
const cut = overflows && !open;
|
|
4691
|
-
return /* @__PURE__ */
|
|
4692
|
-
/* @__PURE__ */
|
|
4693
|
-
overflows && /* @__PURE__ */
|
|
4744
|
+
return /* @__PURE__ */ jsxs46("div", { className: cn("flex flex-col items-start", className), children: [
|
|
4745
|
+
/* @__PURE__ */ jsx62("div", { ref: box, className: cn("relative w-full", cut && "overflow-hidden", contentClassName), style: cut ? { maxHeight, maskImage: FADE, WebkitMaskImage: FADE } : void 0, onFocus: cut ? () => setOpen(true) : void 0, children }),
|
|
4746
|
+
overflows && /* @__PURE__ */ jsx62(Toggle, { open, onToggle: () => setOpen((o) => !o), className: "mt-1" })
|
|
4694
4747
|
] });
|
|
4695
4748
|
}
|
|
4696
4749
|
function Toggle({ open, onToggle, className }) {
|
|
4697
4750
|
const Icon = open ? IconChevronUp : IconChevronDown4;
|
|
4698
|
-
return /* @__PURE__ */
|
|
4751
|
+
return /* @__PURE__ */ jsx62(
|
|
4699
4752
|
Button,
|
|
4700
4753
|
{
|
|
4701
4754
|
variant: "outlined",
|
|
4702
4755
|
size: "small",
|
|
4703
|
-
leadingIcon: /* @__PURE__ */
|
|
4756
|
+
leadingIcon: /* @__PURE__ */ jsx62(Icon, { stroke: 1.5, className: "size-3.5" }),
|
|
4704
4757
|
className,
|
|
4705
4758
|
"aria-expanded": open,
|
|
4706
4759
|
onClick: onToggle,
|
|
@@ -4711,9 +4764,9 @@ function Toggle({ open, onToggle, className }) {
|
|
|
4711
4764
|
|
|
4712
4765
|
// src/Toolbar.tsx
|
|
4713
4766
|
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
4714
|
-
import { jsx as
|
|
4767
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
4715
4768
|
function Toolbar({ "aria-label": ariaLabel, orientation = "horizontal", loopFocus = true, surface = true, children, className }) {
|
|
4716
|
-
const strip = /* @__PURE__ */
|
|
4769
|
+
const strip = /* @__PURE__ */ jsx63(
|
|
4717
4770
|
BaseToolbar.Root,
|
|
4718
4771
|
{
|
|
4719
4772
|
"aria-label": ariaLabel,
|
|
@@ -4724,27 +4777,27 @@ function Toolbar({ "aria-label": ariaLabel, orientation = "horizontal", loopFocu
|
|
|
4724
4777
|
}
|
|
4725
4778
|
);
|
|
4726
4779
|
if (!surface) return strip;
|
|
4727
|
-
return /* @__PURE__ */
|
|
4780
|
+
return /* @__PURE__ */ jsx63(MenuPanel, { className: "w-fit p-1", children: strip });
|
|
4728
4781
|
}
|
|
4729
4782
|
function ToolbarButton({ ref, disabled, disabledReason, ...props }) {
|
|
4730
|
-
return /* @__PURE__ */
|
|
4783
|
+
return /* @__PURE__ */ jsx63(
|
|
4731
4784
|
BaseToolbar.Button,
|
|
4732
4785
|
{
|
|
4733
4786
|
ref,
|
|
4734
4787
|
disabled: disabled || !!disabledReason,
|
|
4735
4788
|
focusableWhenDisabled: true,
|
|
4736
|
-
render: /* @__PURE__ */
|
|
4789
|
+
render: /* @__PURE__ */ jsx63(IconButton, { disabled, disabledReason, ...props })
|
|
4737
4790
|
}
|
|
4738
4791
|
);
|
|
4739
4792
|
}
|
|
4740
4793
|
function ToolbarLink({ ref, href, ...props }) {
|
|
4741
|
-
return /* @__PURE__ */
|
|
4794
|
+
return /* @__PURE__ */ jsx63(BaseToolbar.Link, { ref, render: /* @__PURE__ */ jsx63(IconButton, { href, ...props }) });
|
|
4742
4795
|
}
|
|
4743
4796
|
function ToolbarInput({ size, ...props }) {
|
|
4744
|
-
return /* @__PURE__ */
|
|
4797
|
+
return /* @__PURE__ */ jsx63(BaseToolbar.Input, { render: /* @__PURE__ */ jsx63(TextInput, { size }), ...props });
|
|
4745
4798
|
}
|
|
4746
4799
|
function ToolbarSeparator({ className }) {
|
|
4747
|
-
return /* @__PURE__ */
|
|
4800
|
+
return /* @__PURE__ */ jsx63(
|
|
4748
4801
|
BaseToolbar.Separator,
|
|
4749
4802
|
{
|
|
4750
4803
|
orientation: "vertical",
|
|
@@ -4754,9 +4807,9 @@ function ToolbarSeparator({ className }) {
|
|
|
4754
4807
|
}
|
|
4755
4808
|
|
|
4756
4809
|
// src/ReactionPicker.tsx
|
|
4757
|
-
import { jsx as
|
|
4810
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
4758
4811
|
function ReactionPicker({ options, onSelect, "aria-label": ariaLabel = "Reactions", surface = true, className }) {
|
|
4759
|
-
return /* @__PURE__ */
|
|
4812
|
+
return /* @__PURE__ */ jsx64(Toolbar, { "aria-label": ariaLabel, surface, className: cn("gap-0.5", className), children: options.map((option) => (
|
|
4760
4813
|
/*
|
|
4761
4814
|
A `ToolbarButton`, not a button in a tooltip wrapper. The wrapper
|
|
4762
4815
|
would become the toolbar's item and the button inside it would never
|
|
@@ -4766,59 +4819,20 @@ function ReactionPicker({ options, onSelect, "aria-label": ariaLabel = "Reaction
|
|
|
4766
4819
|
The tooltip names it for a pointer, `aria-label` for everything else,
|
|
4767
4820
|
and both say the meaning rather than the glyph.
|
|
4768
4821
|
*/
|
|
4769
|
-
/* @__PURE__ */
|
|
4822
|
+
/* @__PURE__ */ jsx64(
|
|
4770
4823
|
ToolbarButton,
|
|
4771
4824
|
{
|
|
4772
4825
|
"aria-label": option.label,
|
|
4773
4826
|
tooltip: option.label,
|
|
4774
4827
|
onClick: () => onSelect(option.emoji),
|
|
4775
4828
|
className: "size-7",
|
|
4776
|
-
children: /* @__PURE__ */
|
|
4829
|
+
children: /* @__PURE__ */ jsx64("span", { "aria-hidden": "true", className: "text-h3 leading-none", children: option.emoji })
|
|
4777
4830
|
},
|
|
4778
4831
|
option.emoji
|
|
4779
4832
|
)
|
|
4780
4833
|
)) });
|
|
4781
4834
|
}
|
|
4782
4835
|
|
|
4783
|
-
// src/PreviewCard.tsx
|
|
4784
|
-
import { PreviewCard as BasePreviewCard } from "@base-ui/react/preview-card";
|
|
4785
|
-
import { jsx as jsx64, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4786
|
-
var GAP6 = 12;
|
|
4787
|
-
var VIEWPORT_PAD6 = 8;
|
|
4788
|
-
var OPEN_DELAY2 = 350;
|
|
4789
|
-
var CLOSE_DELAY = 200;
|
|
4790
|
-
function PreviewCard({ content, children, side = "right", delay = OPEN_DELAY2, closeDelay = CLOSE_DELAY, className, contentClassName, wrapperClassName }) {
|
|
4791
|
-
return /* @__PURE__ */ jsxs46(BasePreviewCard.Root, { children: [
|
|
4792
|
-
/* @__PURE__ */ jsx64(
|
|
4793
|
-
BasePreviewCard.Trigger,
|
|
4794
|
-
{
|
|
4795
|
-
delay,
|
|
4796
|
-
closeDelay,
|
|
4797
|
-
render: /* @__PURE__ */ jsx64("span", { className: cn("inline-flex", wrapperClassName) }),
|
|
4798
|
-
children
|
|
4799
|
-
}
|
|
4800
|
-
),
|
|
4801
|
-
/* @__PURE__ */ jsx64(BasePreviewCard.Portal, { children: /* @__PURE__ */ jsx64(
|
|
4802
|
-
BasePreviewCard.Positioner,
|
|
4803
|
-
{
|
|
4804
|
-
side,
|
|
4805
|
-
align: "start",
|
|
4806
|
-
sideOffset: GAP6,
|
|
4807
|
-
collisionPadding: VIEWPORT_PAD6,
|
|
4808
|
-
className: "z-50 data-[anchor-hidden]:hidden",
|
|
4809
|
-
children: /* @__PURE__ */ jsx64(
|
|
4810
|
-
BasePreviewCard.Popup,
|
|
4811
|
-
{
|
|
4812
|
-
className: cn("w-[360px] p-0 outline-none", className),
|
|
4813
|
-
render: /* @__PURE__ */ jsx64(MenuPanel, {}),
|
|
4814
|
-
children: /* @__PURE__ */ jsx64(ScrollArea, { viewportClassName: "max-h-[min(300px,var(--available-height))]", contentClassName: cn("flex flex-col gap-3 p-3", contentClassName), children: content })
|
|
4815
|
-
}
|
|
4816
|
-
)
|
|
4817
|
-
}
|
|
4818
|
-
) })
|
|
4819
|
-
] });
|
|
4820
|
-
}
|
|
4821
|
-
|
|
4822
4836
|
// src/linked.ts
|
|
4823
4837
|
import { createContext as createContext9 } from "react";
|
|
4824
4838
|
var inTheBox = createContext9(false);
|
|
@@ -7711,6 +7725,7 @@ export {
|
|
|
7711
7725
|
useLeftAt,
|
|
7712
7726
|
useRememberedOpen,
|
|
7713
7727
|
useSeenOnScreen,
|
|
7728
|
+
useShortcut,
|
|
7714
7729
|
useSidebarFold,
|
|
7715
7730
|
useToast,
|
|
7716
7731
|
whoReacted
|