@estiva-app/ui 0.113.0 → 0.114.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/PreviewCard.d.ts +9 -2
- package/dist/PreviewCard.d.ts.map +1 -1
- package/dist/UnreadDot.d.ts +7 -1
- package/dist/UnreadDot.d.ts.map +1 -1
- package/dist/index.js +100 -79
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/registry.json +13 -1
- package/src/PreviewCard.mdx +8 -0
- package/src/PreviewCard.stories.tsx +25 -0
- package/src/PreviewCard.test.tsx +72 -3
- package/src/PreviewCard.tsx +42 -3
- package/src/UnreadDot.mdx +1 -0
- package/src/UnreadDot.stories.tsx +3 -0
- package/src/UnreadDot.test.tsx +5 -0
- package/src/UnreadDot.tsx +8 -3
- package/stories/Choosing.mdx +2 -2
package/dist/PreviewCard.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* More of a thing, on hover — a card beside a row that is only a snippet.
|
|
4
4
|
* New at stage 4 (2026-09-07).
|
|
@@ -41,6 +41,13 @@ export interface PreviewCardProps {
|
|
|
41
41
|
contentClassName?: string;
|
|
42
42
|
/** Extra classes on the trigger wrapper — e.g. `block w-full` for a row. */
|
|
43
43
|
wrapperClassName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* A tap on the trigger opens the card, and a second tap closes it, for a
|
|
46
|
+
* touch screen, where nothing hovers (ACT-4: the dot beside a page's title).
|
|
47
|
+
* A mouse still opens it by resting. Off by default: a row's card stays
|
|
48
|
+
* hover-only, because a tap on a row opens the row.
|
|
49
|
+
*/
|
|
50
|
+
openOnTap?: boolean;
|
|
44
51
|
}
|
|
45
|
-
export declare function PreviewCard({ content, children, side, delay, closeDelay, className, contentClassName, wrapperClassName }: PreviewCardProps): import("react").JSX.Element;
|
|
52
|
+
export declare function PreviewCard({ content, children, side, delay, closeDelay, className, contentClassName, wrapperClassName, openOnTap }: PreviewCardProps): import("react").JSX.Element;
|
|
46
53
|
//# sourceMappingURL=PreviewCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewCard.d.ts","sourceRoot":"","sources":["../src/PreviewCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"PreviewCard.d.ts","sourceRoot":"","sources":["../src/PreviewCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAM3E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,OAAO,EAAE,SAAS,CAAA;IAClB,iDAAiD;IACjD,QAAQ,EAAE,SAAS,CAAA;IACnB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;IAC1C,mGAAmG;IACnG,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6FAA6F;IAC7F,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAmBD,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAc,EAAE,KAAkB,EAAE,UAAwB,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAiB,EAAE,EAAE,gBAAgB,+BAiElM"}
|
package/dist/UnreadDot.d.ts
CHANGED
|
@@ -5,8 +5,14 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Purely visual: the row that draws it says "unread" in its own accessible
|
|
7
7
|
* name, because a coloured disc reads as nothing to a screen reader.
|
|
8
|
+
*
|
|
9
|
+
* `quiet` draws the same 6px as a ring with nothing new: the dot beside a
|
|
10
|
+
* page's title, which is always there because it opens the page's list
|
|
11
|
+
* (ACT-4; the activity indicator prototype Miky approved, 10 November). A
|
|
12
|
+
* quiet dot is not marked `data-unread`.
|
|
8
13
|
*/
|
|
9
|
-
export declare function UnreadDot({ className }: {
|
|
14
|
+
export declare function UnreadDot({ className, quiet }: {
|
|
10
15
|
className?: string;
|
|
16
|
+
quiet?: boolean;
|
|
11
17
|
}): import("react").JSX.Element;
|
|
12
18
|
//# sourceMappingURL=UnreadDot.d.ts.map
|
package/dist/UnreadDot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnreadDot.d.ts","sourceRoot":"","sources":["../src/UnreadDot.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"UnreadDot.d.ts","sourceRoot":"","sources":["../src/UnreadDot.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,KAAa,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,+BAM9F"}
|
package/dist/index.js
CHANGED
|
@@ -3978,7 +3978,7 @@ function Breadcrumb({ items, className }) {
|
|
|
3978
3978
|
}
|
|
3979
3979
|
|
|
3980
3980
|
// src/NavItem.tsx
|
|
3981
|
-
import { useId as useId4, useState as
|
|
3981
|
+
import { useId as useId4, useState as useState17 } from "react";
|
|
3982
3982
|
import { Collapsible as Collapsible2 } from "@base-ui/react/collapsible";
|
|
3983
3983
|
import { IconChevronRight as IconChevronRight3, IconDotsVertical as IconDotsVertical2 } from "@tabler/icons-react";
|
|
3984
3984
|
|
|
@@ -4161,20 +4161,41 @@ function CollapsibleSection({ title, defaultOpen = true, open: openProp, onOpenC
|
|
|
4161
4161
|
}
|
|
4162
4162
|
|
|
4163
4163
|
// src/PreviewCard.tsx
|
|
4164
|
+
import { useRef as useRef15, useState as useState16 } from "react";
|
|
4164
4165
|
import { PreviewCard as BasePreviewCard } from "@base-ui/react/preview-card";
|
|
4165
4166
|
import { jsx as jsx56, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
4166
4167
|
var GAP5 = 12;
|
|
4167
4168
|
var VIEWPORT_PAD5 = 8;
|
|
4168
4169
|
var OPEN_DELAY2 = 350;
|
|
4169
4170
|
var CLOSE_DELAY = 200;
|
|
4170
|
-
function PreviewCard({ content, children, side = "right", delay = OPEN_DELAY2, closeDelay = CLOSE_DELAY, className, contentClassName, wrapperClassName }) {
|
|
4171
|
-
|
|
4171
|
+
function PreviewCard({ content, children, side = "right", delay = OPEN_DELAY2, closeDelay = CLOSE_DELAY, className, contentClassName, wrapperClassName, openOnTap = false }) {
|
|
4172
|
+
const [open, setOpen] = useState16(false);
|
|
4173
|
+
const press = useRef15(void 0);
|
|
4174
|
+
const lastPointer = useRef15(void 0);
|
|
4175
|
+
const onOpenChange = (next, details) => {
|
|
4176
|
+
if (openOnTap && next && details.reason === "trigger-focus" && lastPointer.current === "touch") return;
|
|
4177
|
+
setOpen(next);
|
|
4178
|
+
};
|
|
4179
|
+
const tapHandlers = openOnTap ? {
|
|
4180
|
+
onPointerDown: (event) => {
|
|
4181
|
+
press.current = { pointerType: event.pointerType, wasOpen: open };
|
|
4182
|
+
lastPointer.current = event.pointerType;
|
|
4183
|
+
},
|
|
4184
|
+
onClick: () => {
|
|
4185
|
+
const last = press.current;
|
|
4186
|
+
press.current = void 0;
|
|
4187
|
+
if (last?.pointerType === "mouse" || last?.pointerType === "pen") return;
|
|
4188
|
+
setOpen(!(last ? last.wasOpen : open));
|
|
4189
|
+
}
|
|
4190
|
+
} : {};
|
|
4191
|
+
return /* @__PURE__ */ jsxs41(BasePreviewCard.Root, { open, onOpenChange, children: [
|
|
4172
4192
|
/* @__PURE__ */ jsx56(
|
|
4173
4193
|
BasePreviewCard.Trigger,
|
|
4174
4194
|
{
|
|
4175
4195
|
delay,
|
|
4176
4196
|
closeDelay,
|
|
4177
4197
|
render: /* @__PURE__ */ jsx56("span", { className: cn("inline-flex", wrapperClassName) }),
|
|
4198
|
+
...tapHandlers,
|
|
4178
4199
|
children
|
|
4179
4200
|
}
|
|
4180
4201
|
),
|
|
@@ -4201,8 +4222,8 @@ function PreviewCard({ content, children, side = "right", delay = OPEN_DELAY2, c
|
|
|
4201
4222
|
|
|
4202
4223
|
// src/UnreadDot.tsx
|
|
4203
4224
|
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
4204
|
-
function UnreadDot({ className }) {
|
|
4205
|
-
return /* @__PURE__ */ jsx57("div", { className: cn("flex h-6 w-6 shrink-0 items-center justify-center", className), "data-unread":
|
|
4225
|
+
function UnreadDot({ className, quiet = false }) {
|
|
4226
|
+
return /* @__PURE__ */ jsx57("div", { className: cn("flex h-6 w-6 shrink-0 items-center justify-center", className), ...quiet ? {} : { "data-unread": "" }, children: /* @__PURE__ */ jsx57("div", { className: cn("h-1.5 w-1.5 rounded-full", quiet ? "border border-border-strong" : "bg-accent-primary") }) });
|
|
4206
4227
|
}
|
|
4207
4228
|
|
|
4208
4229
|
// src/NavItem.tsx
|
|
@@ -4233,7 +4254,7 @@ function NavItem({
|
|
|
4233
4254
|
...props
|
|
4234
4255
|
}) {
|
|
4235
4256
|
const inApp = useInAppClick(href, onClick, onPlainClick);
|
|
4236
|
-
const [openState, setOpenState] =
|
|
4257
|
+
const [openState, setOpenState] = useState17(defaultOpen);
|
|
4237
4258
|
const panelId = useId4();
|
|
4238
4259
|
const hasRows = children != null && children !== false;
|
|
4239
4260
|
const open = openProp ?? openState;
|
|
@@ -4373,7 +4394,7 @@ function NavItem({
|
|
|
4373
4394
|
}
|
|
4374
4395
|
|
|
4375
4396
|
// src/NavTree.tsx
|
|
4376
|
-
import { createContext as createContext8, useContext as useContext8, useEffect as useEffect9, useRef as
|
|
4397
|
+
import { createContext as createContext8, useContext as useContext8, useEffect as useEffect9, useRef as useRef16, useState as useState18 } from "react";
|
|
4377
4398
|
import { jsx as jsx59, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4378
4399
|
var NAV_TREE_INTENT_MS = 150;
|
|
4379
4400
|
var NAV_TREE_REVEAL_MS = 200;
|
|
@@ -4465,9 +4486,9 @@ function Group({ group, selected, onSelect, opening, storageKey }) {
|
|
|
4465
4486
|
);
|
|
4466
4487
|
}
|
|
4467
4488
|
function NavTreeSection({ id, title, message, loading = false, pending = false, trailing, actions, menu, icon, defaultOpen = true, open, onOpenChange, storageKey, openFor, onIntent, children }) {
|
|
4468
|
-
const timer =
|
|
4489
|
+
const timer = useRef16(void 0);
|
|
4469
4490
|
useEffect9(() => () => clearTimeout(timer.current), []);
|
|
4470
|
-
const [slow, setSlow] =
|
|
4491
|
+
const [slow, setSlow] = useState18(false);
|
|
4471
4492
|
if (!pending && slow) setSlow(false);
|
|
4472
4493
|
useEffect9(() => {
|
|
4473
4494
|
if (!pending) return;
|
|
@@ -4513,10 +4534,10 @@ function NavTreeSection({ id, title, message, loading = false, pending = false,
|
|
|
4513
4534
|
}
|
|
4514
4535
|
function NavTree({ title, titleActions, groups, children, selected, selectedParent, selectedGroup, onSelect, emptyMessage = "", storageKey }) {
|
|
4515
4536
|
const opening = groups ? openingFor(groups, selected, selectedParent) : null;
|
|
4516
|
-
const box =
|
|
4517
|
-
const scrolled =
|
|
4518
|
-
const waiting =
|
|
4519
|
-
const latest =
|
|
4537
|
+
const box = useRef16(null);
|
|
4538
|
+
const scrolled = useRef16(void 0);
|
|
4539
|
+
const waiting = useRef16(void 0);
|
|
4540
|
+
const latest = useRef16(selected);
|
|
4520
4541
|
latest.current = selected;
|
|
4521
4542
|
useEffect9(() => {
|
|
4522
4543
|
if (selected === void 0 || scrolled.current === selected || waiting.current !== void 0) return;
|
|
@@ -4529,7 +4550,7 @@ function NavTree({ title, titleActions, groups, children, selected, selectedPare
|
|
|
4529
4550
|
}, NAV_TREE_REVEAL_MS);
|
|
4530
4551
|
});
|
|
4531
4552
|
useEffect9(() => () => clearTimeout(waiting.current), []);
|
|
4532
|
-
const groupScrolled =
|
|
4553
|
+
const groupScrolled = useRef16(void 0);
|
|
4533
4554
|
useEffect9(() => {
|
|
4534
4555
|
if (selectedGroup === void 0) {
|
|
4535
4556
|
groupScrolled.current = void 0;
|
|
@@ -4609,10 +4630,10 @@ function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpe
|
|
|
4609
4630
|
}
|
|
4610
4631
|
|
|
4611
4632
|
// src/SuggestionMenu.tsx
|
|
4612
|
-
import { useCallback as useCallback5, useEffect as useEffect10, useId as useId5, useImperativeHandle, useMemo as useMemo5, useRef as
|
|
4633
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useId as useId5, useImperativeHandle, useMemo as useMemo5, useRef as useRef17, useState as useState19 } from "react";
|
|
4613
4634
|
import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4614
4635
|
function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sections, itemKey, row, onSelect, handle }) {
|
|
4615
|
-
const last =
|
|
4636
|
+
const last = useRef17(null);
|
|
4616
4637
|
const anchor = useMemo5(() => {
|
|
4617
4638
|
if (typeof rect !== "function") return rect;
|
|
4618
4639
|
return {
|
|
@@ -4626,10 +4647,10 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
4626
4647
|
const shown2 = useMemo5(() => sections.filter((section) => section.items.length > 0), [sections]);
|
|
4627
4648
|
const items = useMemo5(() => shown2.flatMap((section) => section.items), [shown2]);
|
|
4628
4649
|
const keys = items.map(itemKey).join("\n");
|
|
4629
|
-
const [highlight, setHighlight] =
|
|
4650
|
+
const [highlight, setHighlight] = useState19(0);
|
|
4630
4651
|
const base = useId5();
|
|
4631
4652
|
const listboxId = `${base}-list`;
|
|
4632
|
-
const chosen =
|
|
4653
|
+
const chosen = useRef17(null);
|
|
4633
4654
|
useEffect10(() => void (chosen.current = highlight > 0 ? keys.split("\n")[highlight] ?? null : null), [highlight]);
|
|
4634
4655
|
useEffect10(() => {
|
|
4635
4656
|
const at = chosen.current ? keys.split("\n").indexOf(chosen.current) : -1;
|
|
@@ -4722,14 +4743,14 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
4722
4743
|
}
|
|
4723
4744
|
|
|
4724
4745
|
// src/ShowMore.tsx
|
|
4725
|
-
import { useLayoutEffect as useLayoutEffect5, useRef as
|
|
4746
|
+
import { useLayoutEffect as useLayoutEffect5, useRef as useRef18, useState as useState20 } from "react";
|
|
4726
4747
|
import { IconChevronDown as IconChevronDown4, IconChevronUp } from "@tabler/icons-react";
|
|
4727
4748
|
import { jsx as jsx62, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4728
4749
|
var FADE = "linear-gradient(to top, transparent, black 40px)";
|
|
4729
4750
|
function ShowMore({ children, maxHeight = 96, contentClassName, className }) {
|
|
4730
|
-
const box =
|
|
4731
|
-
const [open, setOpen] =
|
|
4732
|
-
const [overflows, setOverflows] =
|
|
4751
|
+
const box = useRef18(null);
|
|
4752
|
+
const [open, setOpen] = useState20(false);
|
|
4753
|
+
const [overflows, setOverflows] = useState20(false);
|
|
4733
4754
|
useLayoutEffect5(() => {
|
|
4734
4755
|
const el = box.current;
|
|
4735
4756
|
if (!el) return;
|
|
@@ -5605,7 +5626,7 @@ function LinkChip({ link, preview = true }) {
|
|
|
5605
5626
|
}
|
|
5606
5627
|
|
|
5607
5628
|
// src/AttachedCard.tsx
|
|
5608
|
-
import { createContext as createContext10, useContext as useContext12, useEffect as useEffect11, useRef as
|
|
5629
|
+
import { createContext as createContext10, useContext as useContext12, useEffect as useEffect11, useRef as useRef19 } from "react";
|
|
5609
5630
|
import { Fragment as Fragment19, jsx as jsx70, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
5610
5631
|
var Attached = createContext10(false);
|
|
5611
5632
|
function useRememberedHeight(link, remember, box) {
|
|
@@ -5638,7 +5659,7 @@ function useRememberedHeight(link, remember, box) {
|
|
|
5638
5659
|
return { kept, held: kept?.height ? { minHeight: kept.height } : void 0 };
|
|
5639
5660
|
}
|
|
5640
5661
|
function AttachedCard({ link, children, onRemove, remember }) {
|
|
5641
|
-
const box =
|
|
5662
|
+
const box = useRef19(null);
|
|
5642
5663
|
const { kept, held } = useRememberedHeight(link, remember, box);
|
|
5643
5664
|
const shown2 = link?.state === "loading" && !link.shape && kept ? { ...link, shape: kept } : link;
|
|
5644
5665
|
const card = shown2 ? /* @__PURE__ */ jsx70(LinkCard, { link: shown2 }) : children;
|
|
@@ -5831,12 +5852,12 @@ function Reaction({ emoji, count, pressed = false, className, ...props }) {
|
|
|
5831
5852
|
}
|
|
5832
5853
|
|
|
5833
5854
|
// src/ConversationActions.tsx
|
|
5834
|
-
import { useState as
|
|
5855
|
+
import { useState as useState21 } from "react";
|
|
5835
5856
|
import { IconCircleCheck as IconCircleCheck2, IconCircleDashed as IconCircleDashed4, IconMessage2 as IconMessage23, IconMoodPlus } from "@tabler/icons-react";
|
|
5836
5857
|
import { Fragment as Fragment20, jsx as jsx77, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
5837
5858
|
function ConversationActions({ options, onReact, onReply, resolved = false, onResolve, onReopen, onPickerOpenChange, more, className }) {
|
|
5838
|
-
const [picking, setPicking] =
|
|
5839
|
-
const [strip, setStrip] =
|
|
5859
|
+
const [picking, setPicking] = useState21(false);
|
|
5860
|
+
const [strip, setStrip] = useState21(null);
|
|
5840
5861
|
const setOpen = (open) => {
|
|
5841
5862
|
setPicking(open);
|
|
5842
5863
|
onPickerOpenChange?.(open);
|
|
@@ -5882,7 +5903,7 @@ function ConversationActions({ options, onReact, onReply, resolved = false, onRe
|
|
|
5882
5903
|
}
|
|
5883
5904
|
|
|
5884
5905
|
// src/ConversationCard.tsx
|
|
5885
|
-
import { useContext as useContext14, useLayoutEffect as useLayoutEffect7, useRef as
|
|
5906
|
+
import { useContext as useContext14, useLayoutEffect as useLayoutEffect7, useRef as useRef20, useState as useState26 } from "react";
|
|
5886
5907
|
import { IconArrowNarrowRight, IconCircleCheck as IconCircleCheck4, IconDotsVertical as IconDotsVertical5 } from "@tabler/icons-react";
|
|
5887
5908
|
|
|
5888
5909
|
// src/ConversationMenu.tsx
|
|
@@ -5918,7 +5939,7 @@ function ConversationMenu({ resolved = false, onResolve, onReopen, resolveHint,
|
|
|
5918
5939
|
}
|
|
5919
5940
|
|
|
5920
5941
|
// src/conversationScroll.ts
|
|
5921
|
-
import { createContext as createContext11, useEffect as useEffect12, useState as
|
|
5942
|
+
import { createContext as createContext11, useEffect as useEffect12, useState as useState22 } from "react";
|
|
5922
5943
|
var NEAR_BOTTOM_PX = 80;
|
|
5923
5944
|
function isNearBottom(el) {
|
|
5924
5945
|
return el.scrollHeight - el.scrollTop - el.clientHeight <= NEAR_BOTTOM_PX;
|
|
@@ -5935,7 +5956,7 @@ function anchorIn(el) {
|
|
|
5935
5956
|
}
|
|
5936
5957
|
var cardIn = (el, id) => el.querySelector(`[data-conversation-item="${CSS.escape(id)}"]`)?.firstElementChild ?? null;
|
|
5937
5958
|
function useSteadyScroll(scrollRef, atBottom, ready, key, enabled) {
|
|
5938
|
-
const [handle] =
|
|
5959
|
+
const [handle] = useState22(() => ({ rebase: () => {
|
|
5939
5960
|
} }));
|
|
5940
5961
|
useEffect12(() => {
|
|
5941
5962
|
const el = scrollRef.current;
|
|
@@ -5990,7 +6011,7 @@ function useSteadyScroll(scrollRef, atBottom, ready, key, enabled) {
|
|
|
5990
6011
|
}
|
|
5991
6012
|
var places = /* @__PURE__ */ new Map();
|
|
5992
6013
|
function useLeftAt(key) {
|
|
5993
|
-
const [taken, setTaken] =
|
|
6014
|
+
const [taken, setTaken] = useState22();
|
|
5994
6015
|
if (!key && taken) setTaken(void 0);
|
|
5995
6016
|
if (key && taken?.key !== key) {
|
|
5996
6017
|
const left = places.get(key);
|
|
@@ -6033,7 +6054,7 @@ function MetaText({ children, tone = "muted", size = "caption", className }) {
|
|
|
6033
6054
|
}
|
|
6034
6055
|
|
|
6035
6056
|
// src/ReactionRow.tsx
|
|
6036
|
-
import { useState as
|
|
6057
|
+
import { useState as useState23 } from "react";
|
|
6037
6058
|
import { IconMoodPlus as IconMoodPlus2 } from "@tabler/icons-react";
|
|
6038
6059
|
import { jsx as jsx81, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
6039
6060
|
var NAMED = 8;
|
|
@@ -6049,7 +6070,7 @@ function whoReacted(reaction, nameOf, options, viewer) {
|
|
|
6049
6070
|
return `${list.charAt(0).toUpperCase()}${list.slice(1)} reacted with ${meaningOf(options, reaction.emoji)}`;
|
|
6050
6071
|
}
|
|
6051
6072
|
function AddReactionButton({ options, onPick, className }) {
|
|
6052
|
-
const [picking, setPicking] =
|
|
6073
|
+
const [picking, setPicking] = useState23(false);
|
|
6053
6074
|
return /* @__PURE__ */ jsx81(
|
|
6054
6075
|
Popover,
|
|
6055
6076
|
{
|
|
@@ -6149,10 +6170,10 @@ function RepliesRow({ count, faces, last, isNew = false, newCount, urgent = fals
|
|
|
6149
6170
|
}
|
|
6150
6171
|
|
|
6151
6172
|
// src/ResolveDialog.tsx
|
|
6152
|
-
import { useState as
|
|
6173
|
+
import { useState as useState24 } from "react";
|
|
6153
6174
|
import { jsx as jsx83, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
6154
6175
|
function ResolveDialog({ onResolve, onCancel, refused }) {
|
|
6155
|
-
const [note, setNote] =
|
|
6176
|
+
const [note, setNote] = useState24("");
|
|
6156
6177
|
return (
|
|
6157
6178
|
// Outlined at rest and green on hover in Signal, the kit's `resolve` look.
|
|
6158
6179
|
/* @__PURE__ */ jsx83(FormDialog, { title: "Resolve", submitLabel: "Resolve", submitVariant: "resolve", onSubmit: () => onResolve(note), onClose: onCancel, children: /* @__PURE__ */ jsxs61(Field, { label: "Resolution message (optional)", children: [
|
|
@@ -6163,7 +6184,7 @@ function ResolveDialog({ onResolve, onCancel, refused }) {
|
|
|
6163
6184
|
}
|
|
6164
6185
|
|
|
6165
6186
|
// src/threadCard.ts
|
|
6166
|
-
import { createContext as createContext12, useLayoutEffect as useLayoutEffect6, useState as
|
|
6187
|
+
import { createContext as createContext12, useLayoutEffect as useLayoutEffect6, useState as useState25 } from "react";
|
|
6167
6188
|
var InThreadCard = createContext12(false);
|
|
6168
6189
|
var InConversationItem = createContext12(null);
|
|
6169
6190
|
var caretOnOpen = createContext12(0);
|
|
@@ -6173,7 +6194,7 @@ var momentOf = (at) => at !== void 0 && Number.isFinite(at) ? at : void 0;
|
|
|
6173
6194
|
var SHOWN_CLASSES = "data-[shown]:animate-shown data-[shown]:rounded-lg motion-reduce:data-[shown]:animate-none motion-reduce:data-[shown]:bg-accent-wash";
|
|
6174
6195
|
var FACE_GAP = 4;
|
|
6175
6196
|
function useFaceLine(root, active, toDot = false) {
|
|
6176
|
-
const [line, setLine] =
|
|
6197
|
+
const [line, setLine] = useState25(null);
|
|
6177
6198
|
useLayoutEffect6(() => {
|
|
6178
6199
|
const el = root.current;
|
|
6179
6200
|
if (!active || !el) {
|
|
@@ -6233,7 +6254,7 @@ function When({ time, at: given, timeHref, timeLabel = "Link to this" }) {
|
|
|
6233
6254
|
}
|
|
6234
6255
|
var fadeBefore = (end) => `linear-gradient(to right, black ${end - 16}px, transparent ${end}px)`;
|
|
6235
6256
|
function useClearOfStrip(root, strip, shown2) {
|
|
6236
|
-
const [end, setEnd] =
|
|
6257
|
+
const [end, setEnd] = useState26();
|
|
6237
6258
|
useLayoutEffect7(() => {
|
|
6238
6259
|
const words = root.current?.querySelector("[data-head]");
|
|
6239
6260
|
if (!shown2 || !words || !strip.current) {
|
|
@@ -6289,8 +6310,8 @@ function Words({ children }) {
|
|
|
6289
6310
|
return /* @__PURE__ */ jsx85("div", { className: "relative w-full break-words pb-2 pl-8 pr-2 pt-1", children: /* @__PURE__ */ jsx85("div", { className: "flex flex-col gap-2 text-body-2 text-text-secondary", children }) });
|
|
6290
6311
|
}
|
|
6291
6312
|
function useReactionRefusal(reactions) {
|
|
6292
|
-
const [refused, setRefused] =
|
|
6293
|
-
const latest =
|
|
6313
|
+
const [refused, setRefused] = useState26();
|
|
6314
|
+
const latest = useRef20(0);
|
|
6294
6315
|
const toggle = reactions?.onToggle;
|
|
6295
6316
|
if (!reactions || !toggle) return { row: reactions, refused };
|
|
6296
6317
|
const onToggle = (emoji) => {
|
|
@@ -6340,7 +6361,7 @@ function stillHere(root) {
|
|
|
6340
6361
|
}
|
|
6341
6362
|
}
|
|
6342
6363
|
function DeleteQuestion({ noun, onDelete, refused, onClose, children }) {
|
|
6343
|
-
const [answered, setAnswered] =
|
|
6364
|
+
const [answered, setAnswered] = useState26(false);
|
|
6344
6365
|
return /* @__PURE__ */ jsx85(
|
|
6345
6366
|
ConfirmDialog,
|
|
6346
6367
|
{
|
|
@@ -6359,7 +6380,7 @@ function DeleteQuestion({ noun, onDelete, refused, onClose, children }) {
|
|
|
6359
6380
|
);
|
|
6360
6381
|
}
|
|
6361
6382
|
function ResolveQuestion({ onResolve, refused, onClose }) {
|
|
6362
|
-
const [answered, setAnswered] =
|
|
6383
|
+
const [answered, setAnswered] = useState26(false);
|
|
6363
6384
|
return /* @__PURE__ */ jsx85(
|
|
6364
6385
|
ResolveDialog,
|
|
6365
6386
|
{
|
|
@@ -6375,7 +6396,7 @@ function ResolveQuestion({ onResolve, refused, onClose }) {
|
|
|
6375
6396
|
);
|
|
6376
6397
|
}
|
|
6377
6398
|
function useEditing(editing, onEditingChange) {
|
|
6378
|
-
const [own, setOwn] =
|
|
6399
|
+
const [own, setOwn] = useState26(false);
|
|
6379
6400
|
const now = editing ?? own;
|
|
6380
6401
|
const set = (next) => {
|
|
6381
6402
|
if (editing === void 0) setOwn(next);
|
|
@@ -6389,23 +6410,23 @@ function ConversationCard(props) {
|
|
|
6389
6410
|
const readOnly = (props.readOnly ?? false) || deleted;
|
|
6390
6411
|
const inThreadCard = useContext14(InThreadCard);
|
|
6391
6412
|
const item = useContext14(InConversationItem);
|
|
6392
|
-
const [hovered, setHovered] =
|
|
6393
|
-
const [menuOpen, setMenuOpen] =
|
|
6394
|
-
const [picking, setPicking] =
|
|
6395
|
-
const [resolving, setResolving] =
|
|
6396
|
-
const [deleting, setDeleting] =
|
|
6413
|
+
const [hovered, setHovered] = useState26(false);
|
|
6414
|
+
const [menuOpen, setMenuOpen] = useState26(false);
|
|
6415
|
+
const [picking, setPicking] = useState26(false);
|
|
6416
|
+
const [resolving, setResolving] = useState26(false);
|
|
6417
|
+
const [deleting, setDeleting] = useState26(false);
|
|
6397
6418
|
const [editing, setEditing] = useEditing(props.editing, props.onEditingChange);
|
|
6398
6419
|
const isEditing = editing && !readOnly && !!editor;
|
|
6399
6420
|
const overlay = menuOpen || picking || resolving || deleting;
|
|
6400
6421
|
const resolves = resolved ? onReopen : onResolve;
|
|
6401
6422
|
const lined = inThreadCard;
|
|
6402
6423
|
const toDot = !lined && !!resolved?.note && !isEditing;
|
|
6403
|
-
const root =
|
|
6424
|
+
const root = useRef20(null);
|
|
6404
6425
|
const dotLine = useFaceLine(root, toDot, true);
|
|
6405
6426
|
const settle = () => requestAnimationFrame(() => setHovered(stillHere(root.current)));
|
|
6406
6427
|
const offersMenu = !!resolves || !!menu || !!menuAfter || own && (!!editor || !!onDelete);
|
|
6407
6428
|
const showStrip = hovered && !isEditing && !readOnly;
|
|
6408
|
-
const strip =
|
|
6429
|
+
const strip = useRef20(null);
|
|
6409
6430
|
const wordsEnd = useClearOfStrip(root, strip, showStrip);
|
|
6410
6431
|
const { row: reactionRow, refused: reactionRefused } = useReactionRefusal(reactions);
|
|
6411
6432
|
const react = reactionRow?.onToggle;
|
|
@@ -6530,16 +6551,16 @@ function ReplyCard(props) {
|
|
|
6530
6551
|
const { id, author, about, files, isNew = false, urgent = false, own = false, editor, onDelete, deleteNote, deleteRefused, menu, menuAfter, menuLabel, editLabel, deleteLabel, moreLabel = "More actions", noun = "reply", className, children } = props;
|
|
6531
6552
|
const { row: reactions, refused: reactionRefused } = useReactionRefusal(props.reactions);
|
|
6532
6553
|
const readOnly = props.readOnly ?? false;
|
|
6533
|
-
const [hovered, setHovered] =
|
|
6534
|
-
const [menuOpen, setMenuOpen] =
|
|
6535
|
-
const [picking, setPicking] =
|
|
6536
|
-
const [deleting, setDeleting] =
|
|
6554
|
+
const [hovered, setHovered] = useState26(false);
|
|
6555
|
+
const [menuOpen, setMenuOpen] = useState26(false);
|
|
6556
|
+
const [picking, setPicking] = useState26(false);
|
|
6557
|
+
const [deleting, setDeleting] = useState26(false);
|
|
6537
6558
|
const [editing, setEditing] = useEditing(props.editing, props.onEditingChange);
|
|
6538
6559
|
const isEditing = editing && !readOnly && !!editor;
|
|
6539
6560
|
const offersMenu = !!menu || !!menuAfter || own && (!!editor || !!onDelete);
|
|
6540
6561
|
const showStrip = hovered && !isEditing && !readOnly && (offersMenu || !!reactions?.onToggle);
|
|
6541
|
-
const root =
|
|
6542
|
-
const strip =
|
|
6562
|
+
const root = useRef20(null);
|
|
6563
|
+
const strip = useRef20(null);
|
|
6543
6564
|
const wordsEnd = useClearOfStrip(root, strip, showStrip);
|
|
6544
6565
|
const settle = () => requestAnimationFrame(() => setHovered(stillHere(root.current)));
|
|
6545
6566
|
const drawn = useContext14(repliesDrawn);
|
|
@@ -6615,7 +6636,7 @@ function ReplyCard(props) {
|
|
|
6615
6636
|
}
|
|
6616
6637
|
|
|
6617
6638
|
// src/ConversationLayout.tsx
|
|
6618
|
-
import { Fragment as Fragment24, useCallback as useCallback6, useEffect as useEffect14, useLayoutEffect as useLayoutEffect8, useRef as
|
|
6639
|
+
import { Fragment as Fragment24, useCallback as useCallback6, useEffect as useEffect14, useLayoutEffect as useLayoutEffect8, useRef as useRef21, useState as useState28 } from "react";
|
|
6619
6640
|
|
|
6620
6641
|
// src/Panel.tsx
|
|
6621
6642
|
import { jsx as jsx86, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
@@ -6644,15 +6665,15 @@ function Panel(props) {
|
|
|
6644
6665
|
}
|
|
6645
6666
|
|
|
6646
6667
|
// src/seenOnScreen.ts
|
|
6647
|
-
import { useEffect as useEffect13, useMemo as useMemo6, useState as
|
|
6668
|
+
import { useEffect as useEffect13, useMemo as useMemo6, useState as useState27 } from "react";
|
|
6648
6669
|
var NONE = /* @__PURE__ */ new Set();
|
|
6649
6670
|
var DWELL_MS = 1500;
|
|
6650
6671
|
var TALL_ENOUGH_PX = 120;
|
|
6651
6672
|
var THRESHOLDS = Array.from({ length: 11 }, (_, i) => i / 10);
|
|
6652
6673
|
var watchers = /* @__PURE__ */ new WeakMap();
|
|
6653
6674
|
function useSeenOnScreen(key) {
|
|
6654
|
-
const [seen, setSeen] =
|
|
6655
|
-
const [watcher] =
|
|
6675
|
+
const [seen, setSeen] = useState27({ key: null, ids: NONE });
|
|
6676
|
+
const [watcher] = useState27(() => ({ roots: /* @__PURE__ */ new Map(), watch: { current: null } }));
|
|
6656
6677
|
useEffect13(() => {
|
|
6657
6678
|
if (!key) return;
|
|
6658
6679
|
const timers = /* @__PURE__ */ new Map();
|
|
@@ -6808,7 +6829,7 @@ function List({ items, open, under, above, loading, empty, change, caret }) {
|
|
|
6808
6829
|
] });
|
|
6809
6830
|
}
|
|
6810
6831
|
function UnderItem({ item, isOpen, state, caret }) {
|
|
6811
|
-
const root =
|
|
6832
|
+
const root = useRef21(null);
|
|
6812
6833
|
const line = useFaceLine(root, isOpen);
|
|
6813
6834
|
return /* @__PURE__ */ jsxs65(
|
|
6814
6835
|
Card,
|
|
@@ -6856,7 +6877,7 @@ function ConversationLayout({
|
|
|
6856
6877
|
className
|
|
6857
6878
|
}) {
|
|
6858
6879
|
const beside = threads === "beside";
|
|
6859
|
-
const body =
|
|
6880
|
+
const body = useRef21(null);
|
|
6860
6881
|
const setBody = useCallback6(
|
|
6861
6882
|
(el) => {
|
|
6862
6883
|
body.current = el;
|
|
@@ -6866,9 +6887,9 @@ function ConversationLayout({
|
|
|
6866
6887
|
[bodyRef]
|
|
6867
6888
|
);
|
|
6868
6889
|
useWatchSeen(seen, body, "data-conversation-item");
|
|
6869
|
-
const pressed =
|
|
6890
|
+
const pressed = useRef21(null);
|
|
6870
6891
|
const itemAt = (id) => body.current?.querySelector(`[data-conversation-item="${CSS.escape(id)}"]`) ?? null;
|
|
6871
|
-
const [caret, setCaret] =
|
|
6892
|
+
const [caret, setCaret] = useState28(0);
|
|
6872
6893
|
const change = onOpenChange ? (id, next, reply = false) => {
|
|
6873
6894
|
if (next !== void 0 && next === open) {
|
|
6874
6895
|
if (reply) setCaret((n) => n + 1);
|
|
@@ -6886,13 +6907,13 @@ function ConversationLayout({
|
|
|
6886
6907
|
const moved = item.getBoundingClientRect().top - at.top;
|
|
6887
6908
|
if (moved !== 0) body.current.scrollTop += moved;
|
|
6888
6909
|
}, [open]);
|
|
6889
|
-
const was =
|
|
6910
|
+
const was = useRef21(open);
|
|
6890
6911
|
useEffect14(() => {
|
|
6891
6912
|
if (open !== void 0 && open !== was.current) setCaret((n) => n + 1);
|
|
6892
6913
|
was.current = open;
|
|
6893
6914
|
}, [open]);
|
|
6894
|
-
const nearBottom =
|
|
6895
|
-
const placedFor =
|
|
6915
|
+
const nearBottom = useRef21(true);
|
|
6916
|
+
const placedFor = useRef21(null);
|
|
6896
6917
|
const placeKey = rememberAs ?? FRESH;
|
|
6897
6918
|
const scrolled = (event) => {
|
|
6898
6919
|
const el = body.current;
|
|
@@ -6938,7 +6959,7 @@ function ConversationLayout({
|
|
|
6938
6959
|
const el = body.current;
|
|
6939
6960
|
if (el) el.scrollTop = el.scrollHeight;
|
|
6940
6961
|
}, [beside, items.length, loading]);
|
|
6941
|
-
const [sends] =
|
|
6962
|
+
const [sends] = useState28(() => ({
|
|
6942
6963
|
sending: () => {
|
|
6943
6964
|
nearBottom.current = true;
|
|
6944
6965
|
},
|
|
@@ -7066,11 +7087,11 @@ function ReactionHorizon({ limit, omitted, cut = false, noun = "comments", keepR
|
|
|
7066
7087
|
}
|
|
7067
7088
|
|
|
7068
7089
|
// src/ArchiveDialog.tsx
|
|
7069
|
-
import { useState as
|
|
7090
|
+
import { useState as useState29 } from "react";
|
|
7070
7091
|
import { jsx as jsx92, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
7071
7092
|
var listOf = (parts) => parts.length <= 1 ? parts[0] ?? "" : `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}`;
|
|
7072
7093
|
function ArchiveDialog({ title, what, hides, staysVisible = [], apps, getBack, onClose, onArchive }) {
|
|
7073
|
-
const [resolution, setResolution] =
|
|
7094
|
+
const [resolution, setResolution] = useState29("");
|
|
7074
7095
|
const where = apps.length ? `, ${listOf(apps.map((app) => `in ${app}`))}` : "";
|
|
7075
7096
|
return /* @__PURE__ */ jsxs70(FormDialog, { title: `Archive \u201C${title}\u201D?`, submitLabel: `Archive ${what}`, ready: hides !== null, onSubmit: () => onArchive(resolution.trim()), onClose, children: [
|
|
7076
7097
|
/* @__PURE__ */ jsxs70("div", { className: "flex flex-col gap-2 text-body-2 text-text-primary", children: [
|
|
@@ -7091,11 +7112,11 @@ function ArchiveDialog({ title, what, hides, staysVisible = [], apps, getBack, o
|
|
|
7091
7112
|
}
|
|
7092
7113
|
|
|
7093
7114
|
// src/ArchivedNotice.tsx
|
|
7094
|
-
import { useState as
|
|
7115
|
+
import { useState as useState30 } from "react";
|
|
7095
7116
|
import { IconArchive } from "@tabler/icons-react";
|
|
7096
7117
|
import { jsx as jsx93, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
7097
7118
|
function ArchivedNotice({ by, when, resolution, withWhat, withTitle, onUnarchive, onOpenParent }) {
|
|
7098
|
-
const [unarchiving, setUnarchiving] =
|
|
7119
|
+
const [unarchiving, setUnarchiving] = useState30(false);
|
|
7099
7120
|
const parent = withWhat ?? (withTitle ? "parent" : void 0);
|
|
7100
7121
|
const named2 = withTitle ? ` \u201C${withTitle}\u201D` : "";
|
|
7101
7122
|
const line = parent ? `Archived with its ${parent}${named2} by ${by} \xB7 ${when}` : `Archived by ${by} \xB7 ${when}`;
|
|
@@ -7123,11 +7144,11 @@ function ArchivedNotice({ by, when, resolution, withWhat, withTitle, onUnarchive
|
|
|
7123
7144
|
}
|
|
7124
7145
|
|
|
7125
7146
|
// src/DeletedNotice.tsx
|
|
7126
|
-
import { useState as
|
|
7147
|
+
import { useState as useState31 } from "react";
|
|
7127
7148
|
import { IconTrash } from "@tabler/icons-react";
|
|
7128
7149
|
import { jsx as jsx94, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
7129
7150
|
function DeletedNotice({ by, when, onRestore }) {
|
|
7130
|
-
const [restoring, setRestoring] =
|
|
7151
|
+
const [restoring, setRestoring] = useState31(false);
|
|
7131
7152
|
return /* @__PURE__ */ jsxs72(Card, { fill: "inset", className: "flex items-start gap-3 px-4 py-3", children: [
|
|
7132
7153
|
/* @__PURE__ */ jsx94(IconTrash, { size: 16, stroke: 1.5, className: "mt-0.5 shrink-0 text-text-muted" }),
|
|
7133
7154
|
/* @__PURE__ */ jsx94("span", { className: "min-w-0 flex-1 text-body-2-strong text-text-primary", children: `Deleted by ${by} \xB7 ${when}` }),
|
|
@@ -7156,7 +7177,7 @@ function NoAccessNotice({ what }) {
|
|
|
7156
7177
|
}
|
|
7157
7178
|
|
|
7158
7179
|
// src/Thread.tsx
|
|
7159
|
-
import { Children, useCallback as useCallback7, useContext as useContext15, useLayoutEffect as useLayoutEffect9, useRef as
|
|
7180
|
+
import { Children, useCallback as useCallback7, useContext as useContext15, useLayoutEffect as useLayoutEffect9, useRef as useRef22, useState as useState32 } from "react";
|
|
7160
7181
|
import { IconX as IconX6 } from "@tabler/icons-react";
|
|
7161
7182
|
import { Fragment as Fragment27, jsx as jsx96, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
7162
7183
|
var always = () => true;
|
|
@@ -7183,7 +7204,7 @@ function Thread({
|
|
|
7183
7204
|
seen,
|
|
7184
7205
|
className
|
|
7185
7206
|
}) {
|
|
7186
|
-
const body =
|
|
7207
|
+
const body = useRef22(null);
|
|
7187
7208
|
const setBody = useCallback7(
|
|
7188
7209
|
(el) => {
|
|
7189
7210
|
body.current = el;
|
|
@@ -7192,10 +7213,10 @@ function Thread({
|
|
|
7192
7213
|
},
|
|
7193
7214
|
[bodyRef]
|
|
7194
7215
|
);
|
|
7195
|
-
const under =
|
|
7216
|
+
const under = useRef22(null);
|
|
7196
7217
|
useWatchSeen(seen, place === "under" ? under : body, "data-reply-id");
|
|
7197
|
-
const [drawn] =
|
|
7198
|
-
const last =
|
|
7218
|
+
const [drawn] = useState32(() => ({ added: 0 }));
|
|
7219
|
+
const last = useRef22(null);
|
|
7199
7220
|
const steady = useSteadyScroll(body, void 0, always, start?.id, place === "beside");
|
|
7200
7221
|
useLayoutEffect9(() => {
|
|
7201
7222
|
const el = body.current;
|