@estiva-app/ui 0.113.0 → 0.115.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/FollowSwitch.d.ts +10 -5
- package/dist/FollowSwitch.d.ts.map +1 -1
- 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 +117 -86
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/registry.json +16 -4
- package/src/FollowSwitch.mdx +5 -0
- package/src/FollowSwitch.stories.tsx +2 -2
- package/src/FollowSwitch.test.tsx +20 -0
- package/src/FollowSwitch.tsx +37 -12
- 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/index.js
CHANGED
|
@@ -2130,13 +2130,23 @@ function LevelIcon({ level, people = false }) {
|
|
|
2130
2130
|
if (level === "important") return /* @__PURE__ */ jsx29(IconCircleDashed, { ...ICON, "aria-hidden": true });
|
|
2131
2131
|
return /* @__PURE__ */ jsx29(IconCircleDashedPlus, { ...ICON, "aria-hidden": true, className: "text-text-muted" });
|
|
2132
2132
|
}
|
|
2133
|
+
var LABEL = { important: "Important", all: "All" };
|
|
2133
2134
|
var WORDS = {
|
|
2134
|
-
|
|
2135
|
-
|
|
2135
|
+
files: {
|
|
2136
|
+
off: "Shows its own conversation. Nothing lights.",
|
|
2137
|
+
important: "Shows its own conversation. Lights for new conversations, replies in yours, and what names you on its files.",
|
|
2138
|
+
all: "Shows its files\u2019 threads too. Lights for all of it."
|
|
2139
|
+
},
|
|
2140
|
+
noFiles: {
|
|
2141
|
+
off: "Nothing lights.",
|
|
2142
|
+
important: "Lights for new conversations and replies in yours.",
|
|
2143
|
+
all: "Lights for every message."
|
|
2144
|
+
}
|
|
2136
2145
|
};
|
|
2137
|
-
function FollowSwitch({ level, label, onChoose, readOnlyReason, people = false,
|
|
2146
|
+
function FollowSwitch({ level, label, onChoose, readOnlyReason, people = false, files = true, backTo }) {
|
|
2138
2147
|
const [busy, setBusy] = useState6(false);
|
|
2139
|
-
const
|
|
2148
|
+
const words = WORDS[files ? "files" : "noFiles"];
|
|
2149
|
+
const now = level ? `You follow it at ${LABEL[level]}` : "Not following";
|
|
2140
2150
|
const button = /* @__PURE__ */ jsx29(IconButton, { "aria-label": `${now}: change how you follow ${label}`, tooltip: now, disabled: !onChoose || busy, disabledReason: onChoose ? void 0 : readOnlyReason, children: /* @__PURE__ */ jsx29(LevelIcon, { level, people }) });
|
|
2141
2151
|
if (!onChoose) return button;
|
|
2142
2152
|
const choose = async (choice) => {
|
|
@@ -2165,9 +2175,9 @@ function FollowSwitch({ level, label, onChoose, readOnlyReason, people = false,
|
|
|
2165
2175
|
};
|
|
2166
2176
|
return /* @__PURE__ */ jsxs21(Menu, { trigger: button, children: [
|
|
2167
2177
|
/* @__PURE__ */ jsxs21(MenuSection, { label: "How you follow it", children: [
|
|
2168
|
-
item("off", "Not following",
|
|
2169
|
-
item("important",
|
|
2170
|
-
item("all",
|
|
2178
|
+
item("off", "Not following", words.off, void 0),
|
|
2179
|
+
item("important", LABEL.important, words.important, "important"),
|
|
2180
|
+
item("all", LABEL.all, words.all, "all")
|
|
2171
2181
|
] }),
|
|
2172
2182
|
backTo && /* @__PURE__ */ jsx29(MenuSection, { label: `${backTo} gives you Important`, children: /* @__PURE__ */ jsx29(MenuItem, { label: `Back to ${backTo}\u2019s default`, description: level ? "Your choice no longer applies" : "Your choice no longer applies; only you see that you changed it", onClick: () => void choose("default") }) })
|
|
2173
2183
|
] });
|
|
@@ -3978,7 +3988,7 @@ function Breadcrumb({ items, className }) {
|
|
|
3978
3988
|
}
|
|
3979
3989
|
|
|
3980
3990
|
// src/NavItem.tsx
|
|
3981
|
-
import { useId as useId4, useState as
|
|
3991
|
+
import { useId as useId4, useState as useState17 } from "react";
|
|
3982
3992
|
import { Collapsible as Collapsible2 } from "@base-ui/react/collapsible";
|
|
3983
3993
|
import { IconChevronRight as IconChevronRight3, IconDotsVertical as IconDotsVertical2 } from "@tabler/icons-react";
|
|
3984
3994
|
|
|
@@ -4161,20 +4171,41 @@ function CollapsibleSection({ title, defaultOpen = true, open: openProp, onOpenC
|
|
|
4161
4171
|
}
|
|
4162
4172
|
|
|
4163
4173
|
// src/PreviewCard.tsx
|
|
4174
|
+
import { useRef as useRef15, useState as useState16 } from "react";
|
|
4164
4175
|
import { PreviewCard as BasePreviewCard } from "@base-ui/react/preview-card";
|
|
4165
4176
|
import { jsx as jsx56, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
4166
4177
|
var GAP5 = 12;
|
|
4167
4178
|
var VIEWPORT_PAD5 = 8;
|
|
4168
4179
|
var OPEN_DELAY2 = 350;
|
|
4169
4180
|
var CLOSE_DELAY = 200;
|
|
4170
|
-
function PreviewCard({ content, children, side = "right", delay = OPEN_DELAY2, closeDelay = CLOSE_DELAY, className, contentClassName, wrapperClassName }) {
|
|
4171
|
-
|
|
4181
|
+
function PreviewCard({ content, children, side = "right", delay = OPEN_DELAY2, closeDelay = CLOSE_DELAY, className, contentClassName, wrapperClassName, openOnTap = false }) {
|
|
4182
|
+
const [open, setOpen] = useState16(false);
|
|
4183
|
+
const press = useRef15(void 0);
|
|
4184
|
+
const lastPointer = useRef15(void 0);
|
|
4185
|
+
const onOpenChange = (next, details) => {
|
|
4186
|
+
if (openOnTap && next && details.reason === "trigger-focus" && lastPointer.current === "touch") return;
|
|
4187
|
+
setOpen(next);
|
|
4188
|
+
};
|
|
4189
|
+
const tapHandlers = openOnTap ? {
|
|
4190
|
+
onPointerDown: (event) => {
|
|
4191
|
+
press.current = { pointerType: event.pointerType, wasOpen: open };
|
|
4192
|
+
lastPointer.current = event.pointerType;
|
|
4193
|
+
},
|
|
4194
|
+
onClick: () => {
|
|
4195
|
+
const last = press.current;
|
|
4196
|
+
press.current = void 0;
|
|
4197
|
+
if (last?.pointerType === "mouse" || last?.pointerType === "pen") return;
|
|
4198
|
+
setOpen(!(last ? last.wasOpen : open));
|
|
4199
|
+
}
|
|
4200
|
+
} : {};
|
|
4201
|
+
return /* @__PURE__ */ jsxs41(BasePreviewCard.Root, { open, onOpenChange, children: [
|
|
4172
4202
|
/* @__PURE__ */ jsx56(
|
|
4173
4203
|
BasePreviewCard.Trigger,
|
|
4174
4204
|
{
|
|
4175
4205
|
delay,
|
|
4176
4206
|
closeDelay,
|
|
4177
4207
|
render: /* @__PURE__ */ jsx56("span", { className: cn("inline-flex", wrapperClassName) }),
|
|
4208
|
+
...tapHandlers,
|
|
4178
4209
|
children
|
|
4179
4210
|
}
|
|
4180
4211
|
),
|
|
@@ -4201,8 +4232,8 @@ function PreviewCard({ content, children, side = "right", delay = OPEN_DELAY2, c
|
|
|
4201
4232
|
|
|
4202
4233
|
// src/UnreadDot.tsx
|
|
4203
4234
|
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":
|
|
4235
|
+
function UnreadDot({ className, quiet = false }) {
|
|
4236
|
+
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
4237
|
}
|
|
4207
4238
|
|
|
4208
4239
|
// src/NavItem.tsx
|
|
@@ -4233,7 +4264,7 @@ function NavItem({
|
|
|
4233
4264
|
...props
|
|
4234
4265
|
}) {
|
|
4235
4266
|
const inApp = useInAppClick(href, onClick, onPlainClick);
|
|
4236
|
-
const [openState, setOpenState] =
|
|
4267
|
+
const [openState, setOpenState] = useState17(defaultOpen);
|
|
4237
4268
|
const panelId = useId4();
|
|
4238
4269
|
const hasRows = children != null && children !== false;
|
|
4239
4270
|
const open = openProp ?? openState;
|
|
@@ -4373,7 +4404,7 @@ function NavItem({
|
|
|
4373
4404
|
}
|
|
4374
4405
|
|
|
4375
4406
|
// src/NavTree.tsx
|
|
4376
|
-
import { createContext as createContext8, useContext as useContext8, useEffect as useEffect9, useRef as
|
|
4407
|
+
import { createContext as createContext8, useContext as useContext8, useEffect as useEffect9, useRef as useRef16, useState as useState18 } from "react";
|
|
4377
4408
|
import { jsx as jsx59, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4378
4409
|
var NAV_TREE_INTENT_MS = 150;
|
|
4379
4410
|
var NAV_TREE_REVEAL_MS = 200;
|
|
@@ -4465,9 +4496,9 @@ function Group({ group, selected, onSelect, opening, storageKey }) {
|
|
|
4465
4496
|
);
|
|
4466
4497
|
}
|
|
4467
4498
|
function NavTreeSection({ id, title, message, loading = false, pending = false, trailing, actions, menu, icon, defaultOpen = true, open, onOpenChange, storageKey, openFor, onIntent, children }) {
|
|
4468
|
-
const timer =
|
|
4499
|
+
const timer = useRef16(void 0);
|
|
4469
4500
|
useEffect9(() => () => clearTimeout(timer.current), []);
|
|
4470
|
-
const [slow, setSlow] =
|
|
4501
|
+
const [slow, setSlow] = useState18(false);
|
|
4471
4502
|
if (!pending && slow) setSlow(false);
|
|
4472
4503
|
useEffect9(() => {
|
|
4473
4504
|
if (!pending) return;
|
|
@@ -4513,10 +4544,10 @@ function NavTreeSection({ id, title, message, loading = false, pending = false,
|
|
|
4513
4544
|
}
|
|
4514
4545
|
function NavTree({ title, titleActions, groups, children, selected, selectedParent, selectedGroup, onSelect, emptyMessage = "", storageKey }) {
|
|
4515
4546
|
const opening = groups ? openingFor(groups, selected, selectedParent) : null;
|
|
4516
|
-
const box =
|
|
4517
|
-
const scrolled =
|
|
4518
|
-
const waiting =
|
|
4519
|
-
const latest =
|
|
4547
|
+
const box = useRef16(null);
|
|
4548
|
+
const scrolled = useRef16(void 0);
|
|
4549
|
+
const waiting = useRef16(void 0);
|
|
4550
|
+
const latest = useRef16(selected);
|
|
4520
4551
|
latest.current = selected;
|
|
4521
4552
|
useEffect9(() => {
|
|
4522
4553
|
if (selected === void 0 || scrolled.current === selected || waiting.current !== void 0) return;
|
|
@@ -4529,7 +4560,7 @@ function NavTree({ title, titleActions, groups, children, selected, selectedPare
|
|
|
4529
4560
|
}, NAV_TREE_REVEAL_MS);
|
|
4530
4561
|
});
|
|
4531
4562
|
useEffect9(() => () => clearTimeout(waiting.current), []);
|
|
4532
|
-
const groupScrolled =
|
|
4563
|
+
const groupScrolled = useRef16(void 0);
|
|
4533
4564
|
useEffect9(() => {
|
|
4534
4565
|
if (selectedGroup === void 0) {
|
|
4535
4566
|
groupScrolled.current = void 0;
|
|
@@ -4609,10 +4640,10 @@ function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpe
|
|
|
4609
4640
|
}
|
|
4610
4641
|
|
|
4611
4642
|
// src/SuggestionMenu.tsx
|
|
4612
|
-
import { useCallback as useCallback5, useEffect as useEffect10, useId as useId5, useImperativeHandle, useMemo as useMemo5, useRef as
|
|
4643
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useId as useId5, useImperativeHandle, useMemo as useMemo5, useRef as useRef17, useState as useState19 } from "react";
|
|
4613
4644
|
import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4614
4645
|
function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sections, itemKey, row, onSelect, handle }) {
|
|
4615
|
-
const last =
|
|
4646
|
+
const last = useRef17(null);
|
|
4616
4647
|
const anchor = useMemo5(() => {
|
|
4617
4648
|
if (typeof rect !== "function") return rect;
|
|
4618
4649
|
return {
|
|
@@ -4626,10 +4657,10 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
4626
4657
|
const shown2 = useMemo5(() => sections.filter((section) => section.items.length > 0), [sections]);
|
|
4627
4658
|
const items = useMemo5(() => shown2.flatMap((section) => section.items), [shown2]);
|
|
4628
4659
|
const keys = items.map(itemKey).join("\n");
|
|
4629
|
-
const [highlight, setHighlight] =
|
|
4660
|
+
const [highlight, setHighlight] = useState19(0);
|
|
4630
4661
|
const base = useId5();
|
|
4631
4662
|
const listboxId = `${base}-list`;
|
|
4632
|
-
const chosen =
|
|
4663
|
+
const chosen = useRef17(null);
|
|
4633
4664
|
useEffect10(() => void (chosen.current = highlight > 0 ? keys.split("\n")[highlight] ?? null : null), [highlight]);
|
|
4634
4665
|
useEffect10(() => {
|
|
4635
4666
|
const at = chosen.current ? keys.split("\n").indexOf(chosen.current) : -1;
|
|
@@ -4722,14 +4753,14 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
4722
4753
|
}
|
|
4723
4754
|
|
|
4724
4755
|
// src/ShowMore.tsx
|
|
4725
|
-
import { useLayoutEffect as useLayoutEffect5, useRef as
|
|
4756
|
+
import { useLayoutEffect as useLayoutEffect5, useRef as useRef18, useState as useState20 } from "react";
|
|
4726
4757
|
import { IconChevronDown as IconChevronDown4, IconChevronUp } from "@tabler/icons-react";
|
|
4727
4758
|
import { jsx as jsx62, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4728
4759
|
var FADE = "linear-gradient(to top, transparent, black 40px)";
|
|
4729
4760
|
function ShowMore({ children, maxHeight = 96, contentClassName, className }) {
|
|
4730
|
-
const box =
|
|
4731
|
-
const [open, setOpen] =
|
|
4732
|
-
const [overflows, setOverflows] =
|
|
4761
|
+
const box = useRef18(null);
|
|
4762
|
+
const [open, setOpen] = useState20(false);
|
|
4763
|
+
const [overflows, setOverflows] = useState20(false);
|
|
4733
4764
|
useLayoutEffect5(() => {
|
|
4734
4765
|
const el = box.current;
|
|
4735
4766
|
if (!el) return;
|
|
@@ -5605,7 +5636,7 @@ function LinkChip({ link, preview = true }) {
|
|
|
5605
5636
|
}
|
|
5606
5637
|
|
|
5607
5638
|
// src/AttachedCard.tsx
|
|
5608
|
-
import { createContext as createContext10, useContext as useContext12, useEffect as useEffect11, useRef as
|
|
5639
|
+
import { createContext as createContext10, useContext as useContext12, useEffect as useEffect11, useRef as useRef19 } from "react";
|
|
5609
5640
|
import { Fragment as Fragment19, jsx as jsx70, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
5610
5641
|
var Attached = createContext10(false);
|
|
5611
5642
|
function useRememberedHeight(link, remember, box) {
|
|
@@ -5638,7 +5669,7 @@ function useRememberedHeight(link, remember, box) {
|
|
|
5638
5669
|
return { kept, held: kept?.height ? { minHeight: kept.height } : void 0 };
|
|
5639
5670
|
}
|
|
5640
5671
|
function AttachedCard({ link, children, onRemove, remember }) {
|
|
5641
|
-
const box =
|
|
5672
|
+
const box = useRef19(null);
|
|
5642
5673
|
const { kept, held } = useRememberedHeight(link, remember, box);
|
|
5643
5674
|
const shown2 = link?.state === "loading" && !link.shape && kept ? { ...link, shape: kept } : link;
|
|
5644
5675
|
const card = shown2 ? /* @__PURE__ */ jsx70(LinkCard, { link: shown2 }) : children;
|
|
@@ -5831,12 +5862,12 @@ function Reaction({ emoji, count, pressed = false, className, ...props }) {
|
|
|
5831
5862
|
}
|
|
5832
5863
|
|
|
5833
5864
|
// src/ConversationActions.tsx
|
|
5834
|
-
import { useState as
|
|
5865
|
+
import { useState as useState21 } from "react";
|
|
5835
5866
|
import { IconCircleCheck as IconCircleCheck2, IconCircleDashed as IconCircleDashed4, IconMessage2 as IconMessage23, IconMoodPlus } from "@tabler/icons-react";
|
|
5836
5867
|
import { Fragment as Fragment20, jsx as jsx77, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
5837
5868
|
function ConversationActions({ options, onReact, onReply, resolved = false, onResolve, onReopen, onPickerOpenChange, more, className }) {
|
|
5838
|
-
const [picking, setPicking] =
|
|
5839
|
-
const [strip, setStrip] =
|
|
5869
|
+
const [picking, setPicking] = useState21(false);
|
|
5870
|
+
const [strip, setStrip] = useState21(null);
|
|
5840
5871
|
const setOpen = (open) => {
|
|
5841
5872
|
setPicking(open);
|
|
5842
5873
|
onPickerOpenChange?.(open);
|
|
@@ -5882,7 +5913,7 @@ function ConversationActions({ options, onReact, onReply, resolved = false, onRe
|
|
|
5882
5913
|
}
|
|
5883
5914
|
|
|
5884
5915
|
// src/ConversationCard.tsx
|
|
5885
|
-
import { useContext as useContext14, useLayoutEffect as useLayoutEffect7, useRef as
|
|
5916
|
+
import { useContext as useContext14, useLayoutEffect as useLayoutEffect7, useRef as useRef20, useState as useState26 } from "react";
|
|
5886
5917
|
import { IconArrowNarrowRight, IconCircleCheck as IconCircleCheck4, IconDotsVertical as IconDotsVertical5 } from "@tabler/icons-react";
|
|
5887
5918
|
|
|
5888
5919
|
// src/ConversationMenu.tsx
|
|
@@ -5918,7 +5949,7 @@ function ConversationMenu({ resolved = false, onResolve, onReopen, resolveHint,
|
|
|
5918
5949
|
}
|
|
5919
5950
|
|
|
5920
5951
|
// src/conversationScroll.ts
|
|
5921
|
-
import { createContext as createContext11, useEffect as useEffect12, useState as
|
|
5952
|
+
import { createContext as createContext11, useEffect as useEffect12, useState as useState22 } from "react";
|
|
5922
5953
|
var NEAR_BOTTOM_PX = 80;
|
|
5923
5954
|
function isNearBottom(el) {
|
|
5924
5955
|
return el.scrollHeight - el.scrollTop - el.clientHeight <= NEAR_BOTTOM_PX;
|
|
@@ -5935,7 +5966,7 @@ function anchorIn(el) {
|
|
|
5935
5966
|
}
|
|
5936
5967
|
var cardIn = (el, id) => el.querySelector(`[data-conversation-item="${CSS.escape(id)}"]`)?.firstElementChild ?? null;
|
|
5937
5968
|
function useSteadyScroll(scrollRef, atBottom, ready, key, enabled) {
|
|
5938
|
-
const [handle] =
|
|
5969
|
+
const [handle] = useState22(() => ({ rebase: () => {
|
|
5939
5970
|
} }));
|
|
5940
5971
|
useEffect12(() => {
|
|
5941
5972
|
const el = scrollRef.current;
|
|
@@ -5990,7 +6021,7 @@ function useSteadyScroll(scrollRef, atBottom, ready, key, enabled) {
|
|
|
5990
6021
|
}
|
|
5991
6022
|
var places = /* @__PURE__ */ new Map();
|
|
5992
6023
|
function useLeftAt(key) {
|
|
5993
|
-
const [taken, setTaken] =
|
|
6024
|
+
const [taken, setTaken] = useState22();
|
|
5994
6025
|
if (!key && taken) setTaken(void 0);
|
|
5995
6026
|
if (key && taken?.key !== key) {
|
|
5996
6027
|
const left = places.get(key);
|
|
@@ -6033,7 +6064,7 @@ function MetaText({ children, tone = "muted", size = "caption", className }) {
|
|
|
6033
6064
|
}
|
|
6034
6065
|
|
|
6035
6066
|
// src/ReactionRow.tsx
|
|
6036
|
-
import { useState as
|
|
6067
|
+
import { useState as useState23 } from "react";
|
|
6037
6068
|
import { IconMoodPlus as IconMoodPlus2 } from "@tabler/icons-react";
|
|
6038
6069
|
import { jsx as jsx81, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
6039
6070
|
var NAMED = 8;
|
|
@@ -6049,7 +6080,7 @@ function whoReacted(reaction, nameOf, options, viewer) {
|
|
|
6049
6080
|
return `${list.charAt(0).toUpperCase()}${list.slice(1)} reacted with ${meaningOf(options, reaction.emoji)}`;
|
|
6050
6081
|
}
|
|
6051
6082
|
function AddReactionButton({ options, onPick, className }) {
|
|
6052
|
-
const [picking, setPicking] =
|
|
6083
|
+
const [picking, setPicking] = useState23(false);
|
|
6053
6084
|
return /* @__PURE__ */ jsx81(
|
|
6054
6085
|
Popover,
|
|
6055
6086
|
{
|
|
@@ -6149,10 +6180,10 @@ function RepliesRow({ count, faces, last, isNew = false, newCount, urgent = fals
|
|
|
6149
6180
|
}
|
|
6150
6181
|
|
|
6151
6182
|
// src/ResolveDialog.tsx
|
|
6152
|
-
import { useState as
|
|
6183
|
+
import { useState as useState24 } from "react";
|
|
6153
6184
|
import { jsx as jsx83, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
6154
6185
|
function ResolveDialog({ onResolve, onCancel, refused }) {
|
|
6155
|
-
const [note, setNote] =
|
|
6186
|
+
const [note, setNote] = useState24("");
|
|
6156
6187
|
return (
|
|
6157
6188
|
// Outlined at rest and green on hover in Signal, the kit's `resolve` look.
|
|
6158
6189
|
/* @__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 +6194,7 @@ function ResolveDialog({ onResolve, onCancel, refused }) {
|
|
|
6163
6194
|
}
|
|
6164
6195
|
|
|
6165
6196
|
// src/threadCard.ts
|
|
6166
|
-
import { createContext as createContext12, useLayoutEffect as useLayoutEffect6, useState as
|
|
6197
|
+
import { createContext as createContext12, useLayoutEffect as useLayoutEffect6, useState as useState25 } from "react";
|
|
6167
6198
|
var InThreadCard = createContext12(false);
|
|
6168
6199
|
var InConversationItem = createContext12(null);
|
|
6169
6200
|
var caretOnOpen = createContext12(0);
|
|
@@ -6173,7 +6204,7 @@ var momentOf = (at) => at !== void 0 && Number.isFinite(at) ? at : void 0;
|
|
|
6173
6204
|
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
6205
|
var FACE_GAP = 4;
|
|
6175
6206
|
function useFaceLine(root, active, toDot = false) {
|
|
6176
|
-
const [line, setLine] =
|
|
6207
|
+
const [line, setLine] = useState25(null);
|
|
6177
6208
|
useLayoutEffect6(() => {
|
|
6178
6209
|
const el = root.current;
|
|
6179
6210
|
if (!active || !el) {
|
|
@@ -6233,7 +6264,7 @@ function When({ time, at: given, timeHref, timeLabel = "Link to this" }) {
|
|
|
6233
6264
|
}
|
|
6234
6265
|
var fadeBefore = (end) => `linear-gradient(to right, black ${end - 16}px, transparent ${end}px)`;
|
|
6235
6266
|
function useClearOfStrip(root, strip, shown2) {
|
|
6236
|
-
const [end, setEnd] =
|
|
6267
|
+
const [end, setEnd] = useState26();
|
|
6237
6268
|
useLayoutEffect7(() => {
|
|
6238
6269
|
const words = root.current?.querySelector("[data-head]");
|
|
6239
6270
|
if (!shown2 || !words || !strip.current) {
|
|
@@ -6289,8 +6320,8 @@ function Words({ children }) {
|
|
|
6289
6320
|
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
6321
|
}
|
|
6291
6322
|
function useReactionRefusal(reactions) {
|
|
6292
|
-
const [refused, setRefused] =
|
|
6293
|
-
const latest =
|
|
6323
|
+
const [refused, setRefused] = useState26();
|
|
6324
|
+
const latest = useRef20(0);
|
|
6294
6325
|
const toggle = reactions?.onToggle;
|
|
6295
6326
|
if (!reactions || !toggle) return { row: reactions, refused };
|
|
6296
6327
|
const onToggle = (emoji) => {
|
|
@@ -6340,7 +6371,7 @@ function stillHere(root) {
|
|
|
6340
6371
|
}
|
|
6341
6372
|
}
|
|
6342
6373
|
function DeleteQuestion({ noun, onDelete, refused, onClose, children }) {
|
|
6343
|
-
const [answered, setAnswered] =
|
|
6374
|
+
const [answered, setAnswered] = useState26(false);
|
|
6344
6375
|
return /* @__PURE__ */ jsx85(
|
|
6345
6376
|
ConfirmDialog,
|
|
6346
6377
|
{
|
|
@@ -6359,7 +6390,7 @@ function DeleteQuestion({ noun, onDelete, refused, onClose, children }) {
|
|
|
6359
6390
|
);
|
|
6360
6391
|
}
|
|
6361
6392
|
function ResolveQuestion({ onResolve, refused, onClose }) {
|
|
6362
|
-
const [answered, setAnswered] =
|
|
6393
|
+
const [answered, setAnswered] = useState26(false);
|
|
6363
6394
|
return /* @__PURE__ */ jsx85(
|
|
6364
6395
|
ResolveDialog,
|
|
6365
6396
|
{
|
|
@@ -6375,7 +6406,7 @@ function ResolveQuestion({ onResolve, refused, onClose }) {
|
|
|
6375
6406
|
);
|
|
6376
6407
|
}
|
|
6377
6408
|
function useEditing(editing, onEditingChange) {
|
|
6378
|
-
const [own, setOwn] =
|
|
6409
|
+
const [own, setOwn] = useState26(false);
|
|
6379
6410
|
const now = editing ?? own;
|
|
6380
6411
|
const set = (next) => {
|
|
6381
6412
|
if (editing === void 0) setOwn(next);
|
|
@@ -6389,23 +6420,23 @@ function ConversationCard(props) {
|
|
|
6389
6420
|
const readOnly = (props.readOnly ?? false) || deleted;
|
|
6390
6421
|
const inThreadCard = useContext14(InThreadCard);
|
|
6391
6422
|
const item = useContext14(InConversationItem);
|
|
6392
|
-
const [hovered, setHovered] =
|
|
6393
|
-
const [menuOpen, setMenuOpen] =
|
|
6394
|
-
const [picking, setPicking] =
|
|
6395
|
-
const [resolving, setResolving] =
|
|
6396
|
-
const [deleting, setDeleting] =
|
|
6423
|
+
const [hovered, setHovered] = useState26(false);
|
|
6424
|
+
const [menuOpen, setMenuOpen] = useState26(false);
|
|
6425
|
+
const [picking, setPicking] = useState26(false);
|
|
6426
|
+
const [resolving, setResolving] = useState26(false);
|
|
6427
|
+
const [deleting, setDeleting] = useState26(false);
|
|
6397
6428
|
const [editing, setEditing] = useEditing(props.editing, props.onEditingChange);
|
|
6398
6429
|
const isEditing = editing && !readOnly && !!editor;
|
|
6399
6430
|
const overlay = menuOpen || picking || resolving || deleting;
|
|
6400
6431
|
const resolves = resolved ? onReopen : onResolve;
|
|
6401
6432
|
const lined = inThreadCard;
|
|
6402
6433
|
const toDot = !lined && !!resolved?.note && !isEditing;
|
|
6403
|
-
const root =
|
|
6434
|
+
const root = useRef20(null);
|
|
6404
6435
|
const dotLine = useFaceLine(root, toDot, true);
|
|
6405
6436
|
const settle = () => requestAnimationFrame(() => setHovered(stillHere(root.current)));
|
|
6406
6437
|
const offersMenu = !!resolves || !!menu || !!menuAfter || own && (!!editor || !!onDelete);
|
|
6407
6438
|
const showStrip = hovered && !isEditing && !readOnly;
|
|
6408
|
-
const strip =
|
|
6439
|
+
const strip = useRef20(null);
|
|
6409
6440
|
const wordsEnd = useClearOfStrip(root, strip, showStrip);
|
|
6410
6441
|
const { row: reactionRow, refused: reactionRefused } = useReactionRefusal(reactions);
|
|
6411
6442
|
const react = reactionRow?.onToggle;
|
|
@@ -6530,16 +6561,16 @@ function ReplyCard(props) {
|
|
|
6530
6561
|
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
6562
|
const { row: reactions, refused: reactionRefused } = useReactionRefusal(props.reactions);
|
|
6532
6563
|
const readOnly = props.readOnly ?? false;
|
|
6533
|
-
const [hovered, setHovered] =
|
|
6534
|
-
const [menuOpen, setMenuOpen] =
|
|
6535
|
-
const [picking, setPicking] =
|
|
6536
|
-
const [deleting, setDeleting] =
|
|
6564
|
+
const [hovered, setHovered] = useState26(false);
|
|
6565
|
+
const [menuOpen, setMenuOpen] = useState26(false);
|
|
6566
|
+
const [picking, setPicking] = useState26(false);
|
|
6567
|
+
const [deleting, setDeleting] = useState26(false);
|
|
6537
6568
|
const [editing, setEditing] = useEditing(props.editing, props.onEditingChange);
|
|
6538
6569
|
const isEditing = editing && !readOnly && !!editor;
|
|
6539
6570
|
const offersMenu = !!menu || !!menuAfter || own && (!!editor || !!onDelete);
|
|
6540
6571
|
const showStrip = hovered && !isEditing && !readOnly && (offersMenu || !!reactions?.onToggle);
|
|
6541
|
-
const root =
|
|
6542
|
-
const strip =
|
|
6572
|
+
const root = useRef20(null);
|
|
6573
|
+
const strip = useRef20(null);
|
|
6543
6574
|
const wordsEnd = useClearOfStrip(root, strip, showStrip);
|
|
6544
6575
|
const settle = () => requestAnimationFrame(() => setHovered(stillHere(root.current)));
|
|
6545
6576
|
const drawn = useContext14(repliesDrawn);
|
|
@@ -6615,7 +6646,7 @@ function ReplyCard(props) {
|
|
|
6615
6646
|
}
|
|
6616
6647
|
|
|
6617
6648
|
// src/ConversationLayout.tsx
|
|
6618
|
-
import { Fragment as Fragment24, useCallback as useCallback6, useEffect as useEffect14, useLayoutEffect as useLayoutEffect8, useRef as
|
|
6649
|
+
import { Fragment as Fragment24, useCallback as useCallback6, useEffect as useEffect14, useLayoutEffect as useLayoutEffect8, useRef as useRef21, useState as useState28 } from "react";
|
|
6619
6650
|
|
|
6620
6651
|
// src/Panel.tsx
|
|
6621
6652
|
import { jsx as jsx86, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
@@ -6644,15 +6675,15 @@ function Panel(props) {
|
|
|
6644
6675
|
}
|
|
6645
6676
|
|
|
6646
6677
|
// src/seenOnScreen.ts
|
|
6647
|
-
import { useEffect as useEffect13, useMemo as useMemo6, useState as
|
|
6678
|
+
import { useEffect as useEffect13, useMemo as useMemo6, useState as useState27 } from "react";
|
|
6648
6679
|
var NONE = /* @__PURE__ */ new Set();
|
|
6649
6680
|
var DWELL_MS = 1500;
|
|
6650
6681
|
var TALL_ENOUGH_PX = 120;
|
|
6651
6682
|
var THRESHOLDS = Array.from({ length: 11 }, (_, i) => i / 10);
|
|
6652
6683
|
var watchers = /* @__PURE__ */ new WeakMap();
|
|
6653
6684
|
function useSeenOnScreen(key) {
|
|
6654
|
-
const [seen, setSeen] =
|
|
6655
|
-
const [watcher] =
|
|
6685
|
+
const [seen, setSeen] = useState27({ key: null, ids: NONE });
|
|
6686
|
+
const [watcher] = useState27(() => ({ roots: /* @__PURE__ */ new Map(), watch: { current: null } }));
|
|
6656
6687
|
useEffect13(() => {
|
|
6657
6688
|
if (!key) return;
|
|
6658
6689
|
const timers = /* @__PURE__ */ new Map();
|
|
@@ -6808,7 +6839,7 @@ function List({ items, open, under, above, loading, empty, change, caret }) {
|
|
|
6808
6839
|
] });
|
|
6809
6840
|
}
|
|
6810
6841
|
function UnderItem({ item, isOpen, state, caret }) {
|
|
6811
|
-
const root =
|
|
6842
|
+
const root = useRef21(null);
|
|
6812
6843
|
const line = useFaceLine(root, isOpen);
|
|
6813
6844
|
return /* @__PURE__ */ jsxs65(
|
|
6814
6845
|
Card,
|
|
@@ -6856,7 +6887,7 @@ function ConversationLayout({
|
|
|
6856
6887
|
className
|
|
6857
6888
|
}) {
|
|
6858
6889
|
const beside = threads === "beside";
|
|
6859
|
-
const body =
|
|
6890
|
+
const body = useRef21(null);
|
|
6860
6891
|
const setBody = useCallback6(
|
|
6861
6892
|
(el) => {
|
|
6862
6893
|
body.current = el;
|
|
@@ -6866,9 +6897,9 @@ function ConversationLayout({
|
|
|
6866
6897
|
[bodyRef]
|
|
6867
6898
|
);
|
|
6868
6899
|
useWatchSeen(seen, body, "data-conversation-item");
|
|
6869
|
-
const pressed =
|
|
6900
|
+
const pressed = useRef21(null);
|
|
6870
6901
|
const itemAt = (id) => body.current?.querySelector(`[data-conversation-item="${CSS.escape(id)}"]`) ?? null;
|
|
6871
|
-
const [caret, setCaret] =
|
|
6902
|
+
const [caret, setCaret] = useState28(0);
|
|
6872
6903
|
const change = onOpenChange ? (id, next, reply = false) => {
|
|
6873
6904
|
if (next !== void 0 && next === open) {
|
|
6874
6905
|
if (reply) setCaret((n) => n + 1);
|
|
@@ -6886,13 +6917,13 @@ function ConversationLayout({
|
|
|
6886
6917
|
const moved = item.getBoundingClientRect().top - at.top;
|
|
6887
6918
|
if (moved !== 0) body.current.scrollTop += moved;
|
|
6888
6919
|
}, [open]);
|
|
6889
|
-
const was =
|
|
6920
|
+
const was = useRef21(open);
|
|
6890
6921
|
useEffect14(() => {
|
|
6891
6922
|
if (open !== void 0 && open !== was.current) setCaret((n) => n + 1);
|
|
6892
6923
|
was.current = open;
|
|
6893
6924
|
}, [open]);
|
|
6894
|
-
const nearBottom =
|
|
6895
|
-
const placedFor =
|
|
6925
|
+
const nearBottom = useRef21(true);
|
|
6926
|
+
const placedFor = useRef21(null);
|
|
6896
6927
|
const placeKey = rememberAs ?? FRESH;
|
|
6897
6928
|
const scrolled = (event) => {
|
|
6898
6929
|
const el = body.current;
|
|
@@ -6938,7 +6969,7 @@ function ConversationLayout({
|
|
|
6938
6969
|
const el = body.current;
|
|
6939
6970
|
if (el) el.scrollTop = el.scrollHeight;
|
|
6940
6971
|
}, [beside, items.length, loading]);
|
|
6941
|
-
const [sends] =
|
|
6972
|
+
const [sends] = useState28(() => ({
|
|
6942
6973
|
sending: () => {
|
|
6943
6974
|
nearBottom.current = true;
|
|
6944
6975
|
},
|
|
@@ -7066,11 +7097,11 @@ function ReactionHorizon({ limit, omitted, cut = false, noun = "comments", keepR
|
|
|
7066
7097
|
}
|
|
7067
7098
|
|
|
7068
7099
|
// src/ArchiveDialog.tsx
|
|
7069
|
-
import { useState as
|
|
7100
|
+
import { useState as useState29 } from "react";
|
|
7070
7101
|
import { jsx as jsx92, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
7071
7102
|
var listOf = (parts) => parts.length <= 1 ? parts[0] ?? "" : `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}`;
|
|
7072
7103
|
function ArchiveDialog({ title, what, hides, staysVisible = [], apps, getBack, onClose, onArchive }) {
|
|
7073
|
-
const [resolution, setResolution] =
|
|
7104
|
+
const [resolution, setResolution] = useState29("");
|
|
7074
7105
|
const where = apps.length ? `, ${listOf(apps.map((app) => `in ${app}`))}` : "";
|
|
7075
7106
|
return /* @__PURE__ */ jsxs70(FormDialog, { title: `Archive \u201C${title}\u201D?`, submitLabel: `Archive ${what}`, ready: hides !== null, onSubmit: () => onArchive(resolution.trim()), onClose, children: [
|
|
7076
7107
|
/* @__PURE__ */ jsxs70("div", { className: "flex flex-col gap-2 text-body-2 text-text-primary", children: [
|
|
@@ -7091,11 +7122,11 @@ function ArchiveDialog({ title, what, hides, staysVisible = [], apps, getBack, o
|
|
|
7091
7122
|
}
|
|
7092
7123
|
|
|
7093
7124
|
// src/ArchivedNotice.tsx
|
|
7094
|
-
import { useState as
|
|
7125
|
+
import { useState as useState30 } from "react";
|
|
7095
7126
|
import { IconArchive } from "@tabler/icons-react";
|
|
7096
7127
|
import { jsx as jsx93, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
7097
7128
|
function ArchivedNotice({ by, when, resolution, withWhat, withTitle, onUnarchive, onOpenParent }) {
|
|
7098
|
-
const [unarchiving, setUnarchiving] =
|
|
7129
|
+
const [unarchiving, setUnarchiving] = useState30(false);
|
|
7099
7130
|
const parent = withWhat ?? (withTitle ? "parent" : void 0);
|
|
7100
7131
|
const named2 = withTitle ? ` \u201C${withTitle}\u201D` : "";
|
|
7101
7132
|
const line = parent ? `Archived with its ${parent}${named2} by ${by} \xB7 ${when}` : `Archived by ${by} \xB7 ${when}`;
|
|
@@ -7123,11 +7154,11 @@ function ArchivedNotice({ by, when, resolution, withWhat, withTitle, onUnarchive
|
|
|
7123
7154
|
}
|
|
7124
7155
|
|
|
7125
7156
|
// src/DeletedNotice.tsx
|
|
7126
|
-
import { useState as
|
|
7157
|
+
import { useState as useState31 } from "react";
|
|
7127
7158
|
import { IconTrash } from "@tabler/icons-react";
|
|
7128
7159
|
import { jsx as jsx94, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
7129
7160
|
function DeletedNotice({ by, when, onRestore }) {
|
|
7130
|
-
const [restoring, setRestoring] =
|
|
7161
|
+
const [restoring, setRestoring] = useState31(false);
|
|
7131
7162
|
return /* @__PURE__ */ jsxs72(Card, { fill: "inset", className: "flex items-start gap-3 px-4 py-3", children: [
|
|
7132
7163
|
/* @__PURE__ */ jsx94(IconTrash, { size: 16, stroke: 1.5, className: "mt-0.5 shrink-0 text-text-muted" }),
|
|
7133
7164
|
/* @__PURE__ */ jsx94("span", { className: "min-w-0 flex-1 text-body-2-strong text-text-primary", children: `Deleted by ${by} \xB7 ${when}` }),
|
|
@@ -7156,7 +7187,7 @@ function NoAccessNotice({ what }) {
|
|
|
7156
7187
|
}
|
|
7157
7188
|
|
|
7158
7189
|
// src/Thread.tsx
|
|
7159
|
-
import { Children, useCallback as useCallback7, useContext as useContext15, useLayoutEffect as useLayoutEffect9, useRef as
|
|
7190
|
+
import { Children, useCallback as useCallback7, useContext as useContext15, useLayoutEffect as useLayoutEffect9, useRef as useRef22, useState as useState32 } from "react";
|
|
7160
7191
|
import { IconX as IconX6 } from "@tabler/icons-react";
|
|
7161
7192
|
import { Fragment as Fragment27, jsx as jsx96, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
7162
7193
|
var always = () => true;
|
|
@@ -7183,7 +7214,7 @@ function Thread({
|
|
|
7183
7214
|
seen,
|
|
7184
7215
|
className
|
|
7185
7216
|
}) {
|
|
7186
|
-
const body =
|
|
7217
|
+
const body = useRef22(null);
|
|
7187
7218
|
const setBody = useCallback7(
|
|
7188
7219
|
(el) => {
|
|
7189
7220
|
body.current = el;
|
|
@@ -7192,10 +7223,10 @@ function Thread({
|
|
|
7192
7223
|
},
|
|
7193
7224
|
[bodyRef]
|
|
7194
7225
|
);
|
|
7195
|
-
const under =
|
|
7226
|
+
const under = useRef22(null);
|
|
7196
7227
|
useWatchSeen(seen, place === "under" ? under : body, "data-reply-id");
|
|
7197
|
-
const [drawn] =
|
|
7198
|
-
const last =
|
|
7228
|
+
const [drawn] = useState32(() => ({ added: 0 }));
|
|
7229
|
+
const last = useRef22(null);
|
|
7199
7230
|
const steady = useSteadyScroll(body, void 0, always, start?.id, place === "beside");
|
|
7200
7231
|
useLayoutEffect9(() => {
|
|
7201
7232
|
const el = body.current;
|