@estiva-app/ui 0.112.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/index.js +119 -116
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/registry.json +7 -1
- 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/stories/Choosing.mdx +1 -1
package/dist/NavItem.d.ts
CHANGED
|
@@ -70,6 +70,13 @@ export interface NavItemProps extends Omit<ComponentPropsWithoutRef<'a'>, 'href'
|
|
|
70
70
|
unread?: boolean;
|
|
71
71
|
/** With `unread`: the warning badge in the dot's place. */
|
|
72
72
|
urgent?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* More about the row, in the package's `PreviewCard` while the row itself is pointed at — never the rows under it —
|
|
75
|
+
* such as a short list of what is new there. Unlike `tooltip`, it holds content the pointer can move into. The card
|
|
76
|
+
* opens on the whole row, the ⋮ included, so a dot the ⋮ steps aside for is not lost as the pointer arrives. With a
|
|
77
|
+
* preview the label draws no `tooltip`: one surface per hover. Absent, no card.
|
|
78
|
+
*/
|
|
79
|
+
preview?: ReactNode;
|
|
73
80
|
/** Rows under this one, folding under it: `NavItem`s. While the row is pointed at or focused, its icon becomes the arrow. */
|
|
74
81
|
children?: ReactNode;
|
|
75
82
|
/** With `children`: open unless told otherwise. */
|
|
@@ -92,5 +99,5 @@ export interface NavItemProps extends Omit<ComponentPropsWithoutRef<'a'>, 'href'
|
|
|
92
99
|
onPlainClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
93
100
|
className?: string;
|
|
94
101
|
}
|
|
95
|
-
export declare function NavItem({ label, href, count, countLabel, active, icon, menu, menuLabel, action, hint, tooltip, unread, urgent, children, defaultOpen, open: openProp, onOpenChange, openFor, onPlainClick, className, onClick, ...props }: NavItemProps): import("react").JSX.Element;
|
|
102
|
+
export declare function NavItem({ label, href, count, countLabel, active, icon, menu, menuLabel, action, hint, tooltip, unread, urgent, preview, children, defaultOpen, open: openProp, onOpenChange, openFor, onPlainClick, className, onClick, ...props }: NavItemProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
96
103
|
//# sourceMappingURL=NavItem.d.ts.map
|
package/dist/NavItem.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavItem.d.ts","sourceRoot":"","sources":["../src/NavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,wBAAwB,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"NavItem.d.ts","sourceRoot":"","sources":["../src/NavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,wBAAwB,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAWvG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAIpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5F,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,wBAAwB;IACxB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,4GAA4G;IAC5G,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oKAAoK;IACpK,MAAM,CAAC,EAAE,aAAa,GAAG;QAAE,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAA;IAChD,yGAAyG;IACzG,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,8IAA8I;IAC9I,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uJAAuJ;IACvJ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,6HAA6H;IAC7H,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,kDAAkD;IAClD,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,UAAU,EACV,MAAc,EACd,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,MAAM,EACN,IAAI,EACJ,OAAO,EACP,MAAc,EACd,MAAc,EACd,OAAO,EACP,QAAQ,EACR,WAAkB,EAClB,IAAI,EAAE,QAAQ,EACd,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,EAAE,YAAY,+TAyLd"}
|
package/dist/index.js
CHANGED
|
@@ -4160,14 +4160,53 @@ function CollapsibleSection({ title, defaultOpen = true, open: openProp, onOpenC
|
|
|
4160
4160
|
] });
|
|
4161
4161
|
}
|
|
4162
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
|
+
|
|
4163
4202
|
// src/UnreadDot.tsx
|
|
4164
|
-
import { jsx as
|
|
4203
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
4165
4204
|
function UnreadDot({ className }) {
|
|
4166
|
-
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" }) });
|
|
4167
4206
|
}
|
|
4168
4207
|
|
|
4169
4208
|
// src/NavItem.tsx
|
|
4170
|
-
import { jsx as
|
|
4209
|
+
import { jsx as jsx58, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4171
4210
|
function NavItem({
|
|
4172
4211
|
label,
|
|
4173
4212
|
href,
|
|
@@ -4182,6 +4221,7 @@ function NavItem({
|
|
|
4182
4221
|
tooltip,
|
|
4183
4222
|
unread = false,
|
|
4184
4223
|
urgent = false,
|
|
4224
|
+
preview,
|
|
4185
4225
|
children,
|
|
4186
4226
|
defaultOpen = true,
|
|
4187
4227
|
open: openProp,
|
|
@@ -4204,9 +4244,9 @@ function NavItem({
|
|
|
4204
4244
|
useOpenFor(hasRows ? openFor : void 0, open, setOpen);
|
|
4205
4245
|
const buttons = (menu != null ? 1 : 0) + (action ? 1 : 0);
|
|
4206
4246
|
const besides = buttons > 0 || hasRows;
|
|
4207
|
-
const mark = unread ? urgent ? /* @__PURE__ */
|
|
4247
|
+
const mark = unread ? urgent ? /* @__PURE__ */ jsx58(UrgentMark, {}) : /* @__PURE__ */ jsx58(UnreadDot, {}) : null;
|
|
4208
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";
|
|
4209
|
-
const row = /* @__PURE__ */
|
|
4249
|
+
const row = /* @__PURE__ */ jsxs42(
|
|
4210
4250
|
"a",
|
|
4211
4251
|
{
|
|
4212
4252
|
href,
|
|
@@ -4228,7 +4268,7 @@ function NavItem({
|
|
|
4228
4268
|
...props,
|
|
4229
4269
|
onClick: inApp,
|
|
4230
4270
|
children: [
|
|
4231
|
-
(icon || hasRows) && /* @__PURE__ */
|
|
4271
|
+
(icon || hasRows) && /* @__PURE__ */ jsx58(
|
|
4232
4272
|
"span",
|
|
4233
4273
|
{
|
|
4234
4274
|
className: cn(
|
|
@@ -4239,17 +4279,18 @@ function NavItem({
|
|
|
4239
4279
|
children: icon
|
|
4240
4280
|
}
|
|
4241
4281
|
),
|
|
4242
|
-
tooltip?.trim() ? (
|
|
4282
|
+
tooltip?.trim() && preview == null ? (
|
|
4243
4283
|
// On the label alone, not the row: the ⋮ and the action keep their
|
|
4244
|
-
// own tooltips, and the two never stand up at once.
|
|
4245
|
-
|
|
4246
|
-
|
|
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 }),
|
|
4247
4288
|
hint != null && // Takes room only while it shows, so the label gives way to it.
|
|
4248
|
-
/* @__PURE__ */
|
|
4289
|
+
/* @__PURE__ */ jsx58("span", { className: "hidden shrink-0 items-center group-hover/nav:flex group-has-[:focus-visible]/nav:flex", children: hint }),
|
|
4249
4290
|
buttons > 1 && // Two buttons: the second one's room (24px and the 4px between them, the
|
|
4250
4291
|
// row's 8px gap making up the rest), kept only while they show.
|
|
4251
|
-
/* @__PURE__ */
|
|
4252
|
-
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(
|
|
4253
4294
|
"span",
|
|
4254
4295
|
{
|
|
4255
4296
|
className: cn(
|
|
@@ -4265,7 +4306,7 @@ function NavItem({
|
|
|
4265
4306
|
// `-mr-1`: the 24px slot's dot then sits on the axis of a count and
|
|
4266
4307
|
// of the ⋮ (8px from the edge to the 16px box), one column with a
|
|
4267
4308
|
// folder heading's dot and ⋮ (Katerina, 5 October).
|
|
4268
|
-
/* @__PURE__ */
|
|
4309
|
+
/* @__PURE__ */ jsx58("span", { className: cn("-mr-1 flex shrink-0", stepsAside), children: mark })
|
|
4269
4310
|
) : buttons > 0 && !count ? (
|
|
4270
4311
|
// Nothing at the right, but a menu: no room is kept at rest, so the
|
|
4271
4312
|
// label has the row's whole width; while the ⋮ shows, its 24px slot
|
|
@@ -4273,18 +4314,19 @@ function NavItem({
|
|
|
4273
4314
|
// `-mr-1`: the ⋮ sits at `right-1`, 4px into the row's padding, so the
|
|
4274
4315
|
// slot does too — at the padding's edge it kept 4px the ⋮ never
|
|
4275
4316
|
// covers, and the label stopped 12px short of the button, not 8.
|
|
4276
|
-
/* @__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" })
|
|
4277
4318
|
) : null
|
|
4278
4319
|
]
|
|
4279
4320
|
}
|
|
4280
4321
|
);
|
|
4281
|
-
|
|
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);
|
|
4282
4324
|
const name = menuLabel ?? `More options for ${label}`;
|
|
4283
|
-
const line = /* @__PURE__ */
|
|
4325
|
+
const line = /* @__PURE__ */ jsxs42("div", { className: "group/nav relative shrink-0", children: [
|
|
4284
4326
|
row,
|
|
4285
4327
|
hasRows && // `left-1`: the 24px button's 16px arrow then sits where the icon
|
|
4286
4328
|
// sits (the row's px-2), so the icon turns into the arrow in place.
|
|
4287
|
-
/* @__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(
|
|
4288
4330
|
IconButton,
|
|
4289
4331
|
{
|
|
4290
4332
|
tooltip: open ? "Collapse" : "Expand",
|
|
@@ -4292,7 +4334,7 @@ function NavItem({
|
|
|
4292
4334
|
"aria-expanded": open,
|
|
4293
4335
|
"aria-controls": panelId,
|
|
4294
4336
|
onClick: () => setOpen(!open),
|
|
4295
|
-
children: /* @__PURE__ */
|
|
4337
|
+
children: /* @__PURE__ */ jsx58(IconChevronRight3, { size: 16, stroke: 1.5, className: cn("transition-transform duration-150", open && "rotate-90") })
|
|
4296
4338
|
}
|
|
4297
4339
|
) }),
|
|
4298
4340
|
buttons > 0 && // `right-1`: the 24px button's 16px icon ends 8px from the row's
|
|
@@ -4303,28 +4345,28 @@ function NavItem({
|
|
|
4303
4345
|
// right of the slot's centre.
|
|
4304
4346
|
// On a screen with no hover it always shows: nothing there can point
|
|
4305
4347
|
// at the row, and the menu has no other way in.
|
|
4306
|
-
/* @__PURE__ */
|
|
4307
|
-
action && /* @__PURE__ */
|
|
4308
|
-
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(
|
|
4309
4351
|
Menu,
|
|
4310
4352
|
{
|
|
4311
4353
|
align: "right",
|
|
4312
|
-
trigger: /* @__PURE__ */
|
|
4354
|
+
trigger: /* @__PURE__ */ jsx58(IconButton, { tooltip: "More options", "aria-label": name, children: /* @__PURE__ */ jsx58(IconDotsVertical2, { size: 16, stroke: 1.5 }) }),
|
|
4313
4355
|
children: menu
|
|
4314
4356
|
}
|
|
4315
4357
|
)
|
|
4316
4358
|
] })
|
|
4317
4359
|
] });
|
|
4318
|
-
if (!hasRows) return line;
|
|
4319
|
-
return /* @__PURE__ */
|
|
4320
|
-
line,
|
|
4321
|
-
/* @__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(
|
|
4322
4364
|
Collapsible2.Panel,
|
|
4323
4365
|
{
|
|
4324
4366
|
id: panelId,
|
|
4325
4367
|
hiddenUntilFound: true,
|
|
4326
4368
|
className: COLLAPSIBLE_PANEL_CLASSES,
|
|
4327
|
-
children: /* @__PURE__ */
|
|
4369
|
+
children: /* @__PURE__ */ jsx58("div", { className: "flex flex-col gap-0.5 pt-0.5 pl-6", children })
|
|
4328
4370
|
}
|
|
4329
4371
|
)
|
|
4330
4372
|
] });
|
|
@@ -4332,7 +4374,7 @@ function NavItem({
|
|
|
4332
4374
|
|
|
4333
4375
|
// src/NavTree.tsx
|
|
4334
4376
|
import { createContext as createContext8, useContext as useContext8, useEffect as useEffect9, useRef as useRef15, useState as useState17 } from "react";
|
|
4335
|
-
import { jsx as
|
|
4377
|
+
import { jsx as jsx59, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4336
4378
|
var NAV_TREE_INTENT_MS = 150;
|
|
4337
4379
|
var NAV_TREE_REVEAL_MS = 200;
|
|
4338
4380
|
var NAV_TREE_PENDING_MS = 2e3;
|
|
@@ -4369,7 +4411,7 @@ function scrollToRow(row) {
|
|
|
4369
4411
|
else if (at.bottom > view.bottom) box.scrollTop += Math.min(at.bottom - view.bottom, at.top - view.top);
|
|
4370
4412
|
}
|
|
4371
4413
|
function Line({ message }) {
|
|
4372
|
-
return /* @__PURE__ */
|
|
4414
|
+
return /* @__PURE__ */ jsx59(EmptyState, { scope: "rows", message });
|
|
4373
4415
|
}
|
|
4374
4416
|
var groupLinked = createContext8(void 0);
|
|
4375
4417
|
function groupBox(box, id) {
|
|
@@ -4377,8 +4419,8 @@ function groupBox(box, id) {
|
|
|
4377
4419
|
return group && group.getBoundingClientRect().height > 0 ? group : void 0;
|
|
4378
4420
|
}
|
|
4379
4421
|
function Row({ node, selected, onSelect, opening }) {
|
|
4380
|
-
const under = node.childrenMessage !== void 0 ? /* @__PURE__ */
|
|
4381
|
-
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(
|
|
4382
4424
|
NavItem,
|
|
4383
4425
|
{
|
|
4384
4426
|
href: node.href,
|
|
@@ -4401,7 +4443,7 @@ function Row({ node, selected, onSelect, opening }) {
|
|
|
4401
4443
|
);
|
|
4402
4444
|
}
|
|
4403
4445
|
function Group({ group, selected, onSelect, opening, storageKey }) {
|
|
4404
|
-
return /* @__PURE__ */
|
|
4446
|
+
return /* @__PURE__ */ jsx59(
|
|
4405
4447
|
NavTreeSection,
|
|
4406
4448
|
{
|
|
4407
4449
|
id: group.id,
|
|
@@ -4418,7 +4460,7 @@ function Group({ group, selected, onSelect, opening, storageKey }) {
|
|
|
4418
4460
|
storageKey: storageKey ? `${storageKey}.${group.id}` : void 0,
|
|
4419
4461
|
openFor: opening?.group === group.id ? opening.item : void 0,
|
|
4420
4462
|
onIntent: group.onIntent,
|
|
4421
|
-
children: group.nodes?.map((node) => /* @__PURE__ */
|
|
4463
|
+
children: group.nodes?.map((node) => /* @__PURE__ */ jsx59(Row, { node, selected, onSelect, opening }, node.id))
|
|
4422
4464
|
}
|
|
4423
4465
|
);
|
|
4424
4466
|
}
|
|
@@ -4435,7 +4477,7 @@ function NavTreeSection({ id, title, message, loading = false, pending = false,
|
|
|
4435
4477
|
const intent = onIntent;
|
|
4436
4478
|
const linkedTo = useContext8(groupLinked);
|
|
4437
4479
|
const linked = id !== void 0 && linkedTo === id ? id : void 0;
|
|
4438
|
-
return /* @__PURE__ */
|
|
4480
|
+
return /* @__PURE__ */ jsx59(
|
|
4439
4481
|
"div",
|
|
4440
4482
|
{
|
|
4441
4483
|
className: "shrink-0 [&+&]:mt-1",
|
|
@@ -4446,7 +4488,7 @@ function NavTreeSection({ id, title, message, loading = false, pending = false,
|
|
|
4446
4488
|
} : void 0,
|
|
4447
4489
|
onPointerLeave: intent ? () => clearTimeout(timer.current) : void 0,
|
|
4448
4490
|
onFocus: intent,
|
|
4449
|
-
children: /* @__PURE__ */
|
|
4491
|
+
children: /* @__PURE__ */ jsx59(sectionLinked.Provider, { value: linked, children: /* @__PURE__ */ jsx59(
|
|
4450
4492
|
CollapsibleSection,
|
|
4451
4493
|
{
|
|
4452
4494
|
title,
|
|
@@ -4463,7 +4505,7 @@ function NavTreeSection({ id, title, message, loading = false, pending = false,
|
|
|
4463
4505
|
icon,
|
|
4464
4506
|
className: "shrink-0",
|
|
4465
4507
|
contentClassName: "gap-0.5",
|
|
4466
|
-
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 })
|
|
4467
4509
|
}
|
|
4468
4510
|
) })
|
|
4469
4511
|
}
|
|
@@ -4501,12 +4543,12 @@ function NavTree({ title, titleActions, groups, children, selected, selectedPare
|
|
|
4501
4543
|
});
|
|
4502
4544
|
return (
|
|
4503
4545
|
// `contents`: a box to find the current row in, that lays nothing out — the groups stay the column's own.
|
|
4504
|
-
/* @__PURE__ */
|
|
4505
|
-
title && /* @__PURE__ */
|
|
4506
|
-
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 ? (
|
|
4507
4549
|
// No words, no line: an app that says nothing when it has no groups.
|
|
4508
|
-
emptyMessage ? /* @__PURE__ */
|
|
4509
|
-
) : 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))
|
|
4510
4552
|
] }) })
|
|
4511
4553
|
);
|
|
4512
4554
|
}
|
|
@@ -4514,16 +4556,16 @@ function NavTree({ title, titleActions, groups, children, selected, selectedPare
|
|
|
4514
4556
|
// src/Popover.tsx
|
|
4515
4557
|
import { useMemo as useMemo4 } from "react";
|
|
4516
4558
|
import { Popover as BasePopover } from "@base-ui/react/popover";
|
|
4517
|
-
import { jsx as
|
|
4518
|
-
var
|
|
4519
|
-
var
|
|
4559
|
+
import { jsx as jsx60, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
4560
|
+
var GAP6 = 4;
|
|
4561
|
+
var VIEWPORT_PAD6 = 8;
|
|
4520
4562
|
function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpenChange, finalFocus, actionsRef, ariaLabel, children, className, contentClassName, maxHeight }) {
|
|
4521
4563
|
const anchorTarget = useMemo4(() => {
|
|
4522
4564
|
if (!anchor) return void 0;
|
|
4523
4565
|
if (anchor instanceof Element || "getBoundingClientRect" in anchor) return anchor;
|
|
4524
4566
|
return { getBoundingClientRect: () => anchor };
|
|
4525
4567
|
}, [anchor]);
|
|
4526
|
-
return /* @__PURE__ */
|
|
4568
|
+
return /* @__PURE__ */ jsxs44(
|
|
4527
4569
|
BasePopover.Root,
|
|
4528
4570
|
{
|
|
4529
4571
|
open,
|
|
@@ -4531,30 +4573,30 @@ function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpe
|
|
|
4531
4573
|
actionsRef,
|
|
4532
4574
|
modal: false,
|
|
4533
4575
|
children: [
|
|
4534
|
-
trigger && /* @__PURE__ */
|
|
4535
|
-
/* @__PURE__ */
|
|
4576
|
+
trigger && /* @__PURE__ */ jsx60(BasePopover.Trigger, { render: trigger, disabled: triggerDisabled(trigger) }),
|
|
4577
|
+
/* @__PURE__ */ jsx60(BasePopover.Portal, { children: /* @__PURE__ */ jsx60(
|
|
4536
4578
|
BasePopover.Positioner,
|
|
4537
4579
|
{
|
|
4538
4580
|
anchor: anchorTarget,
|
|
4539
4581
|
side,
|
|
4540
4582
|
align: align === "right" ? "end" : align === "center" ? "center" : "start",
|
|
4541
|
-
sideOffset:
|
|
4542
|
-
collisionPadding:
|
|
4583
|
+
sideOffset: GAP6,
|
|
4584
|
+
collisionPadding: VIEWPORT_PAD6,
|
|
4543
4585
|
className: "z-50 data-[anchor-hidden]:hidden",
|
|
4544
|
-
children: /* @__PURE__ */
|
|
4586
|
+
children: /* @__PURE__ */ jsx60(
|
|
4545
4587
|
BasePopover.Popup,
|
|
4546
4588
|
{
|
|
4547
4589
|
"aria-label": ariaLabel,
|
|
4548
4590
|
initialFocus: trigger ? void 0 : false,
|
|
4549
4591
|
finalFocus,
|
|
4550
4592
|
className: cn("min-w-[180px] outline-none p-0", className),
|
|
4551
|
-
render: /* @__PURE__ */
|
|
4552
|
-
children: /* @__PURE__ */
|
|
4593
|
+
render: /* @__PURE__ */ jsx60(MenuPanel, {}),
|
|
4594
|
+
children: /* @__PURE__ */ jsx60(
|
|
4553
4595
|
ScrollArea,
|
|
4554
4596
|
{
|
|
4555
4597
|
viewportClassName: maxHeight ?? "max-h-[var(--available-height)]",
|
|
4556
4598
|
contentClassName: cn("flex flex-col p-2", contentClassName),
|
|
4557
|
-
children: /* @__PURE__ */
|
|
4599
|
+
children: /* @__PURE__ */ jsx60(DividerInPanel.Provider, { value: true, children })
|
|
4558
4600
|
}
|
|
4559
4601
|
)
|
|
4560
4602
|
}
|
|
@@ -4568,7 +4610,7 @@ function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpe
|
|
|
4568
4610
|
|
|
4569
4611
|
// src/SuggestionMenu.tsx
|
|
4570
4612
|
import { useCallback as useCallback5, useEffect as useEffect10, useId as useId5, useImperativeHandle, useMemo as useMemo5, useRef as useRef16, useState as useState18 } from "react";
|
|
4571
|
-
import { jsx as
|
|
4613
|
+
import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4572
4614
|
function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sections, itemKey, row, onSelect, handle }) {
|
|
4573
4615
|
const last = useRef16(null);
|
|
4574
4616
|
const anchor = useMemo5(() => {
|
|
@@ -4644,7 +4686,7 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
4644
4686
|
const { label, description, aside, leading, shortcut, hint, size } = row(item);
|
|
4645
4687
|
return (
|
|
4646
4688
|
// A row of a list the editor drives from its caret: focus stays in the text, so the row is no Tab stop.
|
|
4647
|
-
/* @__PURE__ */
|
|
4689
|
+
/* @__PURE__ */ jsx61(
|
|
4648
4690
|
MenuItem,
|
|
4649
4691
|
{
|
|
4650
4692
|
role: "option",
|
|
@@ -4672,9 +4714,9 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
4672
4714
|
};
|
|
4673
4715
|
return (
|
|
4674
4716
|
// finalFocus={false}: focus never left the text, and a list that closes because focus moved elsewhere must not pull it back (71a4577b).
|
|
4675
|
-
/* @__PURE__ */
|
|
4676
|
-
i > 0 && /* @__PURE__ */
|
|
4677
|
-
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)
|
|
4678
4720
|
] }, section.label ?? i)) }) })
|
|
4679
4721
|
);
|
|
4680
4722
|
}
|
|
@@ -4682,7 +4724,7 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
4682
4724
|
// src/ShowMore.tsx
|
|
4683
4725
|
import { useLayoutEffect as useLayoutEffect5, useRef as useRef17, useState as useState19 } from "react";
|
|
4684
4726
|
import { IconChevronDown as IconChevronDown4, IconChevronUp } from "@tabler/icons-react";
|
|
4685
|
-
import { jsx as
|
|
4727
|
+
import { jsx as jsx62, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4686
4728
|
var FADE = "linear-gradient(to top, transparent, black 40px)";
|
|
4687
4729
|
function ShowMore({ children, maxHeight = 96, contentClassName, className }) {
|
|
4688
4730
|
const box = useRef17(null);
|
|
@@ -4699,19 +4741,19 @@ function ShowMore({ children, maxHeight = 96, contentClassName, className }) {
|
|
|
4699
4741
|
return () => observer.disconnect();
|
|
4700
4742
|
}, [maxHeight]);
|
|
4701
4743
|
const cut = overflows && !open;
|
|
4702
|
-
return /* @__PURE__ */
|
|
4703
|
-
/* @__PURE__ */
|
|
4704
|
-
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" })
|
|
4705
4747
|
] });
|
|
4706
4748
|
}
|
|
4707
4749
|
function Toggle({ open, onToggle, className }) {
|
|
4708
4750
|
const Icon = open ? IconChevronUp : IconChevronDown4;
|
|
4709
|
-
return /* @__PURE__ */
|
|
4751
|
+
return /* @__PURE__ */ jsx62(
|
|
4710
4752
|
Button,
|
|
4711
4753
|
{
|
|
4712
4754
|
variant: "outlined",
|
|
4713
4755
|
size: "small",
|
|
4714
|
-
leadingIcon: /* @__PURE__ */
|
|
4756
|
+
leadingIcon: /* @__PURE__ */ jsx62(Icon, { stroke: 1.5, className: "size-3.5" }),
|
|
4715
4757
|
className,
|
|
4716
4758
|
"aria-expanded": open,
|
|
4717
4759
|
onClick: onToggle,
|
|
@@ -4722,9 +4764,9 @@ function Toggle({ open, onToggle, className }) {
|
|
|
4722
4764
|
|
|
4723
4765
|
// src/Toolbar.tsx
|
|
4724
4766
|
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
4725
|
-
import { jsx as
|
|
4767
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
4726
4768
|
function Toolbar({ "aria-label": ariaLabel, orientation = "horizontal", loopFocus = true, surface = true, children, className }) {
|
|
4727
|
-
const strip = /* @__PURE__ */
|
|
4769
|
+
const strip = /* @__PURE__ */ jsx63(
|
|
4728
4770
|
BaseToolbar.Root,
|
|
4729
4771
|
{
|
|
4730
4772
|
"aria-label": ariaLabel,
|
|
@@ -4735,27 +4777,27 @@ function Toolbar({ "aria-label": ariaLabel, orientation = "horizontal", loopFocu
|
|
|
4735
4777
|
}
|
|
4736
4778
|
);
|
|
4737
4779
|
if (!surface) return strip;
|
|
4738
|
-
return /* @__PURE__ */
|
|
4780
|
+
return /* @__PURE__ */ jsx63(MenuPanel, { className: "w-fit p-1", children: strip });
|
|
4739
4781
|
}
|
|
4740
4782
|
function ToolbarButton({ ref, disabled, disabledReason, ...props }) {
|
|
4741
|
-
return /* @__PURE__ */
|
|
4783
|
+
return /* @__PURE__ */ jsx63(
|
|
4742
4784
|
BaseToolbar.Button,
|
|
4743
4785
|
{
|
|
4744
4786
|
ref,
|
|
4745
4787
|
disabled: disabled || !!disabledReason,
|
|
4746
4788
|
focusableWhenDisabled: true,
|
|
4747
|
-
render: /* @__PURE__ */
|
|
4789
|
+
render: /* @__PURE__ */ jsx63(IconButton, { disabled, disabledReason, ...props })
|
|
4748
4790
|
}
|
|
4749
4791
|
);
|
|
4750
4792
|
}
|
|
4751
4793
|
function ToolbarLink({ ref, href, ...props }) {
|
|
4752
|
-
return /* @__PURE__ */
|
|
4794
|
+
return /* @__PURE__ */ jsx63(BaseToolbar.Link, { ref, render: /* @__PURE__ */ jsx63(IconButton, { href, ...props }) });
|
|
4753
4795
|
}
|
|
4754
4796
|
function ToolbarInput({ size, ...props }) {
|
|
4755
|
-
return /* @__PURE__ */
|
|
4797
|
+
return /* @__PURE__ */ jsx63(BaseToolbar.Input, { render: /* @__PURE__ */ jsx63(TextInput, { size }), ...props });
|
|
4756
4798
|
}
|
|
4757
4799
|
function ToolbarSeparator({ className }) {
|
|
4758
|
-
return /* @__PURE__ */
|
|
4800
|
+
return /* @__PURE__ */ jsx63(
|
|
4759
4801
|
BaseToolbar.Separator,
|
|
4760
4802
|
{
|
|
4761
4803
|
orientation: "vertical",
|
|
@@ -4765,9 +4807,9 @@ function ToolbarSeparator({ className }) {
|
|
|
4765
4807
|
}
|
|
4766
4808
|
|
|
4767
4809
|
// src/ReactionPicker.tsx
|
|
4768
|
-
import { jsx as
|
|
4810
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
4769
4811
|
function ReactionPicker({ options, onSelect, "aria-label": ariaLabel = "Reactions", surface = true, className }) {
|
|
4770
|
-
return /* @__PURE__ */
|
|
4812
|
+
return /* @__PURE__ */ jsx64(Toolbar, { "aria-label": ariaLabel, surface, className: cn("gap-0.5", className), children: options.map((option) => (
|
|
4771
4813
|
/*
|
|
4772
4814
|
A `ToolbarButton`, not a button in a tooltip wrapper. The wrapper
|
|
4773
4815
|
would become the toolbar's item and the button inside it would never
|
|
@@ -4777,59 +4819,20 @@ function ReactionPicker({ options, onSelect, "aria-label": ariaLabel = "Reaction
|
|
|
4777
4819
|
The tooltip names it for a pointer, `aria-label` for everything else,
|
|
4778
4820
|
and both say the meaning rather than the glyph.
|
|
4779
4821
|
*/
|
|
4780
|
-
/* @__PURE__ */
|
|
4822
|
+
/* @__PURE__ */ jsx64(
|
|
4781
4823
|
ToolbarButton,
|
|
4782
4824
|
{
|
|
4783
4825
|
"aria-label": option.label,
|
|
4784
4826
|
tooltip: option.label,
|
|
4785
4827
|
onClick: () => onSelect(option.emoji),
|
|
4786
4828
|
className: "size-7",
|
|
4787
|
-
children: /* @__PURE__ */
|
|
4829
|
+
children: /* @__PURE__ */ jsx64("span", { "aria-hidden": "true", className: "text-h3 leading-none", children: option.emoji })
|
|
4788
4830
|
},
|
|
4789
4831
|
option.emoji
|
|
4790
4832
|
)
|
|
4791
4833
|
)) });
|
|
4792
4834
|
}
|
|
4793
4835
|
|
|
4794
|
-
// src/PreviewCard.tsx
|
|
4795
|
-
import { PreviewCard as BasePreviewCard } from "@base-ui/react/preview-card";
|
|
4796
|
-
import { jsx as jsx64, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4797
|
-
var GAP6 = 12;
|
|
4798
|
-
var VIEWPORT_PAD6 = 8;
|
|
4799
|
-
var OPEN_DELAY2 = 350;
|
|
4800
|
-
var CLOSE_DELAY = 200;
|
|
4801
|
-
function PreviewCard({ content, children, side = "right", delay = OPEN_DELAY2, closeDelay = CLOSE_DELAY, className, contentClassName, wrapperClassName }) {
|
|
4802
|
-
return /* @__PURE__ */ jsxs46(BasePreviewCard.Root, { children: [
|
|
4803
|
-
/* @__PURE__ */ jsx64(
|
|
4804
|
-
BasePreviewCard.Trigger,
|
|
4805
|
-
{
|
|
4806
|
-
delay,
|
|
4807
|
-
closeDelay,
|
|
4808
|
-
render: /* @__PURE__ */ jsx64("span", { className: cn("inline-flex", wrapperClassName) }),
|
|
4809
|
-
children
|
|
4810
|
-
}
|
|
4811
|
-
),
|
|
4812
|
-
/* @__PURE__ */ jsx64(BasePreviewCard.Portal, { children: /* @__PURE__ */ jsx64(
|
|
4813
|
-
BasePreviewCard.Positioner,
|
|
4814
|
-
{
|
|
4815
|
-
side,
|
|
4816
|
-
align: "start",
|
|
4817
|
-
sideOffset: GAP6,
|
|
4818
|
-
collisionPadding: VIEWPORT_PAD6,
|
|
4819
|
-
className: "z-50 data-[anchor-hidden]:hidden",
|
|
4820
|
-
children: /* @__PURE__ */ jsx64(
|
|
4821
|
-
BasePreviewCard.Popup,
|
|
4822
|
-
{
|
|
4823
|
-
className: cn("w-[360px] p-0 outline-none", className),
|
|
4824
|
-
render: /* @__PURE__ */ jsx64(MenuPanel, {}),
|
|
4825
|
-
children: /* @__PURE__ */ jsx64(ScrollArea, { viewportClassName: "max-h-[min(300px,var(--available-height))]", contentClassName: cn("flex flex-col gap-3 p-3", contentClassName), children: content })
|
|
4826
|
-
}
|
|
4827
|
-
)
|
|
4828
|
-
}
|
|
4829
|
-
) })
|
|
4830
|
-
] });
|
|
4831
|
-
}
|
|
4832
|
-
|
|
4833
4836
|
// src/linked.ts
|
|
4834
4837
|
import { createContext as createContext9 } from "react";
|
|
4835
4838
|
var inTheBox = createContext9(false);
|