@estiva-app/ui 0.102.1 → 0.103.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.
Files changed (53) hide show
  1. package/dist/CommentBox.d.ts +16 -0
  2. package/dist/CommentBox.d.ts.map +1 -1
  3. package/dist/ConfirmDialog.d.ts +6 -1
  4. package/dist/ConfirmDialog.d.ts.map +1 -1
  5. package/dist/ConversationCard.d.ts +2 -0
  6. package/dist/ConversationCard.d.ts.map +1 -1
  7. package/dist/LinkChip.d.ts.map +1 -1
  8. package/dist/LinkRow.d.ts +13 -3
  9. package/dist/LinkRow.d.ts.map +1 -1
  10. package/dist/QuotedLine.d.ts +1 -1
  11. package/dist/QuotedLine.d.ts.map +1 -1
  12. package/dist/SectionHeader.d.ts.map +1 -1
  13. package/dist/editor.d.ts +1 -1
  14. package/dist/editor.d.ts.map +1 -1
  15. package/dist/editor.js +14 -6
  16. package/dist/editor.js.map +3 -3
  17. package/dist/index.js +32 -22
  18. package/dist/index.js.map +2 -2
  19. package/dist/linked.d.ts +3 -1
  20. package/dist/linked.d.ts.map +1 -1
  21. package/dist/linkedFrom.d.ts +1 -0
  22. package/dist/linkedFrom.d.ts.map +1 -1
  23. package/package.json +1 -1
  24. package/registry.json +33 -3
  25. package/src/CommentBox.mdx +1 -0
  26. package/src/CommentBox.stories.tsx +17 -1
  27. package/src/CommentBox.test.tsx +24 -0
  28. package/src/CommentBox.tsx +29 -1
  29. package/src/ConfirmDialog.mdx +2 -0
  30. package/src/ConfirmDialog.stories.tsx +6 -0
  31. package/src/ConfirmDialog.test.tsx +12 -1
  32. package/src/ConfirmDialog.tsx +8 -1
  33. package/src/ConversationCard.mdx +2 -0
  34. package/src/ConversationCard.stories.tsx +6 -0
  35. package/src/ConversationCard.test.tsx +50 -0
  36. package/src/ConversationCard.tsx +13 -7
  37. package/src/LinkCard.stories.tsx +6 -0
  38. package/src/LinkCard.tsx +1 -1
  39. package/src/LinkChip.test.tsx +13 -2
  40. package/src/LinkChip.tsx +4 -3
  41. package/src/LinkRow.test.tsx +13 -0
  42. package/src/LinkRow.tsx +16 -7
  43. package/src/NavTree.stories.tsx +1 -1
  44. package/src/QuotedLine.mdx +2 -1
  45. package/src/QuotedLine.test.tsx +9 -0
  46. package/src/QuotedLine.tsx +4 -2
  47. package/src/SectionHeader.mdx +1 -0
  48. package/src/SectionHeader.test.tsx +7 -0
  49. package/src/SectionHeader.tsx +4 -1
  50. package/src/editor.ts +1 -0
  51. package/src/linked.ts +3 -1
  52. package/src/linkedFrom.test.tsx +15 -3
  53. package/src/linkedFrom.ts +5 -3
package/dist/index.js CHANGED
@@ -3446,7 +3446,7 @@ var Textarea = forwardRef3(function Textarea2({ className, ...props }, ref) {
3446
3446
  // src/ConfirmDialog.tsx
3447
3447
  import { useRef as useRef11, useState as useState10 } from "react";
3448
3448
  import { Fragment as Fragment13, jsx as jsx45, jsxs as jsxs33 } from "react/jsx-runtime";
3449
- function ConfirmDialog({ title, children, confirmLabel, destructive = false, onConfirm, onClose, alternative }) {
3449
+ function ConfirmDialog({ title, children, confirmLabel, destructive = false, onConfirm, onClose, alternative, refused }) {
3450
3450
  const [busy, setBusy] = useState10(false);
3451
3451
  const closed = useRef11(false);
3452
3452
  const close = () => {
@@ -3475,6 +3475,7 @@ function ConfirmDialog({ title, children, confirmLabel, destructive = false, onC
3475
3475
  ] }),
3476
3476
  children: /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-3 text-body-2 text-text-primary", children: [
3477
3477
  children,
3478
+ refused && /* @__PURE__ */ jsx45(FieldLine, { tone: "error", children: refused }),
3478
3479
  alternative && /* @__PURE__ */ jsxs33("div", { className: "flex flex-col items-start gap-2", children: [
3479
3480
  /* @__PURE__ */ jsx45("p", { children: alternative.sentence }),
3480
3481
  /* @__PURE__ */ jsx45(Button, { variant: "outlined", size: "small", onClick: alternative.onClick, disabled: busy, children: alternative.label })
@@ -3877,7 +3878,10 @@ function SectionHeader({ title, chevron = false, icon, isExpanded = true, onTogg
3877
3878
  look === "quiet" ? /* @__PURE__ */ jsx52("span", { className: "min-w-0 truncate text-caption text-text-muted", children: title }) : row ? (
3878
3879
  // A row's words: NavItem's size and colour, brightening under the pointer with the row.
3879
3880
  /* @__PURE__ */ jsx52("span", { className: "min-w-0 flex-1 truncate text-body-2", children: title })
3880
- ) : /* @__PURE__ */ jsx52(SectionLabel, { folds: chevron, children: title }),
3881
+ ) : (
3882
+ // One line, as the other looks and a NavItem's label: a Folder named by its id ran onto two (Katerina, 3 November).
3883
+ /* @__PURE__ */ jsx52(SectionLabel, { folds: chevron, truncate: true, children: title })
3884
+ ),
3881
3885
  count != null && /* @__PURE__ */ jsx52("span", { className: cn("ml-1 shrink-0", COUNT_TEXT_CLASSES), children: count })
3882
3886
  ] })
3883
3887
  }
@@ -4966,14 +4970,15 @@ function linkedFrom(object, options) {
4966
4970
  function linkStateFrom(object, unread, options) {
4967
4971
  if (object === void 0) return { state: "loading", kind: unread.kind };
4968
4972
  const written = unread.url ? { url: unread.url } : {};
4969
- if (object === null) return { state: "unavailable", kind: unread.kind, noun: unread.noun, ...unread.deleted ? { deleted: true } : {}, ...written };
4973
+ const why = unread.deleted ? { deleted: true } : unread.failed ? { failed: true } : {};
4974
+ if (object === null) return { state: "unavailable", kind: unread.kind, noun: unread.noun, ...why, ...written };
4970
4975
  if (object.unreachable) {
4971
4976
  const noun = nounOf(object);
4972
4977
  return {
4973
4978
  state: "unavailable",
4974
4979
  kind: linkedKindOfKind(object.kind),
4975
4980
  noun: noun || unread.noun,
4976
- // Its app's name, its type having none: "You can't open this Notes", not "this notes".
4981
+ // Its app's name, its type having none: "You can't open this file in Notes".
4977
4982
  ...noun && !object.noun ? { named: true } : {},
4978
4983
  ...written
4979
4984
  };
@@ -5125,9 +5130,12 @@ import { useContext as useContext11 } from "react";
5125
5130
  import { useContext as useContext10 } from "react";
5126
5131
  import { jsx as jsx64, jsxs as jsxs46 } from "react/jsx-runtime";
5127
5132
  var ROW_CLASSES2 = "flex items-center gap-3 p-1.5 pr-3";
5128
- function LinkUnavailable({ kind, noun, named: named2 = false, card = false, deleted = false }) {
5129
- const word = !named2 && /^[A-Z][a-z]*$/.test(noun) ? noun.toLowerCase() : noun;
5130
- return /* @__PURE__ */ jsx64(UnavailableRow, { kind, words: deleted ? `${noun} deleted` : `You can't open this ${word}`, card });
5133
+ function LinkUnavailable({ kind, noun, named: named2 = false, card = false, deleted = false, failed = false }) {
5134
+ return /* @__PURE__ */ jsx64(UnavailableRow, { kind, words: unavailableWords(noun, { named: named2, deleted, failed }), card });
5135
+ }
5136
+ function unavailableWords(noun, { named: named2 = false, deleted = false, failed = false } = {}) {
5137
+ const word = named2 ? `file in ${noun}` : /^[A-Z][a-z]*$/.test(noun) ? noun.toLowerCase() : noun;
5138
+ return deleted ? `${named2 ? `File in ${noun}` : noun} deleted` : failed ? `Couldn't load this ${word}` : `You can't open this ${word}`;
5131
5139
  }
5132
5140
  function UnavailableRow({ kind, words, href, card = false }) {
5133
5141
  const wide = useContext10(inTheBox);
@@ -5156,7 +5164,7 @@ function LinkRow({ link, preview = true }) {
5156
5164
  }
5157
5165
  if (link.state === "unavailable") {
5158
5166
  if (link.url) return /* @__PURE__ */ jsx64(WrittenUrl, { url: link.url, block: true });
5159
- return /* @__PURE__ */ jsx64(LinkUnavailable, { kind: link.kind, noun: link.noun, named: link.named, deleted: link.deleted });
5167
+ return /* @__PURE__ */ jsx64(LinkUnavailable, { kind: link.kind, noun: link.noun, named: link.named, deleted: link.deleted, failed: link.failed });
5160
5168
  }
5161
5169
  const { linked } = link;
5162
5170
  const status = chosenOf(linked.status);
@@ -5201,7 +5209,7 @@ function LinkCard({ link, readOnly = false, bare = false }) {
5201
5209
  if (link.state === "loading") return /* @__PURE__ */ jsx65(LinkCardLoading, { kind: link.kind, shape: link.shape });
5202
5210
  if (link.state === "unavailable") {
5203
5211
  if (link.url) return /* @__PURE__ */ jsx65(WrittenUrl, { url: link.url, block: true });
5204
- return /* @__PURE__ */ jsx65(LinkUnavailable, { kind: link.kind, noun: link.noun, named: link.named, deleted: link.deleted, card: true });
5212
+ return /* @__PURE__ */ jsx65(LinkUnavailable, { kind: link.kind, noun: link.noun, named: link.named, deleted: link.deleted, failed: link.failed, card: true });
5205
5213
  }
5206
5214
  const { linked } = link;
5207
5215
  const body = linked.kind === "message" && linked.author ? /* @__PURE__ */ jsx65(SaidBody, { linked }) : /* @__PURE__ */ jsx65(CardBody, { linked, readOnly: readOnly || boxed });
@@ -5347,11 +5355,10 @@ function LinkChip({ link, preview = true }) {
5347
5355
  }
5348
5356
  if (link.state === "unavailable") {
5349
5357
  if (link.url) return /* @__PURE__ */ jsx67(WrittenUrl, { url: link.url });
5350
- return /* @__PURE__ */ jsxs48(InlineChip, { tone: "muted", icon: /* @__PURE__ */ jsx67(LinkedIcon, { kind: link.kind, size: 14, tone: "inherit" }), children: [
5351
- link.noun,
5352
- " ",
5353
- link.deleted ? "deleted" : "not available"
5354
- ] });
5358
+ return (
5359
+ // A row's and a card's words, one wording everywhere (Katerina, 3 November).
5360
+ /* @__PURE__ */ jsx67(InlineChip, { tone: "muted", icon: /* @__PURE__ */ jsx67(LinkedIcon, { kind: link.kind, size: 14, tone: "inherit" }), children: unavailableWords(link.noun, { named: link.named, deleted: link.deleted, failed: link.failed }) })
5361
+ );
5355
5362
  }
5356
5363
  const { linked } = link;
5357
5364
  const status = chosenOf(linked.status);
@@ -6016,7 +6023,7 @@ function useEditing(editing, onEditingChange) {
6016
6023
  return [now, set];
6017
6024
  }
6018
6025
  function ConversationCard(props) {
6019
- const { author, about, files, reactions, reactionRefused, isNew = false, urgent = false, own = false, editor, deleted = false, replies, onReply, resolved, noun = "comment", onResolve, resolveHint, resolveRefused, onReopen, selected, onClick, onDelete, deleteNote, menu, menuAfter, menuLabel, editLabel, deleteLabel, moreLabel = "More actions", className, children } = props;
6026
+ const { author, about, files, reactions, reactionRefused, isNew = false, urgent = false, own = false, editor, deleted = false, replies, onReply, resolved, noun = "comment", onResolve, resolveHint, resolveRefused, onReopen, selected, onClick, onDelete, deleteNote, deleteRefused, menu, menuAfter, menuLabel, editLabel, deleteLabel, moreLabel = "More actions", className, children } = props;
6020
6027
  const readOnly = (props.readOnly ?? false) || deleted;
6021
6028
  const inThreadCard = useContext14(InThreadCard);
6022
6029
  const item = useContext14(InConversationItem);
@@ -6042,7 +6049,6 @@ function ConversationCard(props) {
6042
6049
  const marked = selected ?? (item && !item.under ? item.open : void 0);
6043
6050
  const under = !!item?.under;
6044
6051
  const repliesRow = replies && replies.count > 0 && /* @__PURE__ */ jsx81(RepliesRow, { ...replies, onOpen: replies.onOpen ?? (under ? item?.toggle : void 0), open: replies.open ?? (under && !!item?.open), urgent });
6045
- const aboutShown = !!about && !deleted;
6046
6052
  return /* @__PURE__ */ jsxs58(Fragment23, { children: [
6047
6053
  /* @__PURE__ */ jsxs58(
6048
6054
  Card,
@@ -6070,7 +6076,10 @@ function ConversationCard(props) {
6070
6076
  },
6071
6077
  children: [
6072
6078
  isEditing ? /* @__PURE__ */ jsx81(Editing, { author, children: editor(() => setEditing(false)) }) : /* @__PURE__ */ jsxs58("div", { "data-comment-body": true, className: "flex flex-col items-start px-2 pt-2", children: [
6073
- deleted ? /* @__PURE__ */ jsx81("p", { className: "w-full pb-2 pl-8 pr-2 text-caption italic text-text-muted", children: "This comment was deleted." }) : /* @__PURE__ */ jsxs58(Fragment23, { children: [
6079
+ deleted ? /* @__PURE__ */ jsxs58(Fragment23, { children: [
6080
+ !!about && /* @__PURE__ */ jsx81("div", { className: "relative w-full pl-8 pr-2", children: about }),
6081
+ /* @__PURE__ */ jsx81("p", { className: cn("w-full pb-2 pl-8 pr-2 text-caption italic text-text-muted", !!about && "pt-1"), children: "This comment was deleted." })
6082
+ ] }) : /* @__PURE__ */ jsxs58(Fragment23, { children: [
6074
6083
  /* @__PURE__ */ jsx81(
6075
6084
  Head,
6076
6085
  {
@@ -6085,7 +6094,7 @@ function ConversationCard(props) {
6085
6094
  meta: resolved && /* @__PURE__ */ jsx81(ResolvedCheck, { by: resolved.by, note: resolved.note, at: resolved.at })
6086
6095
  }
6087
6096
  ),
6088
- aboutShown && // Under the name, above the words (Katerina, 1 November).
6097
+ !!about && // Under the name, above the words (Katerina, 1 November).
6089
6098
  /* @__PURE__ */ jsx81("div", { className: "relative w-full pl-8 pr-2 pt-0.5", children: about }),
6090
6099
  /* @__PURE__ */ jsx81(Words, { children })
6091
6100
  ] }),
@@ -6138,7 +6147,7 @@ function ConversationCard(props) {
6138
6147
  ]
6139
6148
  }
6140
6149
  ),
6141
- deleting && onDelete && /* @__PURE__ */ jsx81(ConfirmDialog, { title: `Delete this ${noun}?`, confirmLabel: `Delete ${noun}`, destructive: true, onConfirm: onDelete, onClose: () => setDeleting(false), children: deleteNote !== void 0 ? typeof deleteNote === "string" ? /* @__PURE__ */ jsx81("p", { children: deleteNote }) : deleteNote : /* @__PURE__ */ jsxs58(Fragment23, { children: [
6150
+ deleting && onDelete && /* @__PURE__ */ jsx81(ConfirmDialog, { title: `Delete this ${noun}?`, confirmLabel: `Delete ${noun}`, destructive: true, onConfirm: onDelete, onClose: () => setDeleting(false), refused: deleteRefused, children: deleteNote !== void 0 ? typeof deleteNote === "string" ? /* @__PURE__ */ jsx81("p", { children: deleteNote }) : deleteNote : /* @__PURE__ */ jsxs58(Fragment23, { children: [
6142
6151
  /* @__PURE__ */ jsx81("p", { children: "It is deleted for everyone." }),
6143
6152
  replies && replies.count > 0 && /* @__PURE__ */ jsxs58("p", { children: [
6144
6153
  "Its ",
@@ -6161,7 +6170,7 @@ function ConversationCard(props) {
6161
6170
  ] });
6162
6171
  }
6163
6172
  function ReplyCard(props) {
6164
- const { id, author, about, files, reactions, reactionRefused, isNew = false, urgent = false, own = false, editor, onDelete, deleteNote, menu, menuAfter, menuLabel, editLabel, deleteLabel, moreLabel = "More actions", noun = "reply", className, children } = props;
6173
+ const { id, author, about, files, reactions, reactionRefused, isNew = false, urgent = false, own = false, editor, onDelete, deleteNote, deleteRefused, menu, menuAfter, menuLabel, editLabel, deleteLabel, moreLabel = "More actions", noun = "reply", className, children } = props;
6165
6174
  const readOnly = props.readOnly ?? false;
6166
6175
  const [hovered, setHovered] = useState23(false);
6167
6176
  const [menuOpen, setMenuOpen] = useState23(false);
@@ -6241,7 +6250,7 @@ function ReplyCard(props) {
6241
6250
  ]
6242
6251
  }
6243
6252
  ),
6244
- deleting && onDelete && /* @__PURE__ */ jsx81(ConfirmDialog, { title: `Delete this ${noun}?`, confirmLabel: `Delete ${noun}`, destructive: true, onConfirm: onDelete, onClose: () => setDeleting(false), children: deleteNote === void 0 ? /* @__PURE__ */ jsx81("p", { children: "It is deleted for everyone." }) : typeof deleteNote === "string" ? /* @__PURE__ */ jsx81("p", { children: deleteNote }) : deleteNote })
6253
+ deleting && onDelete && /* @__PURE__ */ jsx81(ConfirmDialog, { title: `Delete this ${noun}?`, confirmLabel: `Delete ${noun}`, destructive: true, onConfirm: onDelete, onClose: () => setDeleting(false), refused: deleteRefused, children: deleteNote === void 0 ? /* @__PURE__ */ jsx81("p", { children: "It is deleted for everyone." }) : typeof deleteNote === "string" ? /* @__PURE__ */ jsx81("p", { children: deleteNote }) : deleteNote })
6245
6254
  ] });
6246
6255
  }
6247
6256
 
@@ -6637,8 +6646,9 @@ import { jsx as jsx85, jsxs as jsxs62 } from "react/jsx-runtime";
6637
6646
  var SINCE = { reworded: "Changed since", gone: "Deleted from the page" };
6638
6647
  function QuotedLine({ words, state = "here", label }) {
6639
6648
  const shown2 = words ?? label ?? "";
6649
+ const inThePage = !!words && state === "here";
6640
6650
  return /* @__PURE__ */ jsxs62("div", { "data-quoted": words ? state : "part", className: "flex w-full min-w-0 flex-col gap-0.5", children: [
6641
- /* @__PURE__ */ jsx85(WithTooltip, { label: shown2, wrapperClassName: "flex min-w-0", children: /* @__PURE__ */ jsx85("p", { className: "line-clamp-2 text-caption text-text-secondary", children: /* @__PURE__ */ jsx85("mark", { className: cn("rounded-sm px-0.5 text-text-primary [box-decoration-break:clone]", state === "here" ? "bg-warning-muted" : "bg-bg-inset text-text-secondary", state === "gone" && "line-through"), children: shown2 }) }) }),
6651
+ /* @__PURE__ */ jsx85(WithTooltip, { label: shown2, wrapperClassName: "flex min-w-0", children: /* @__PURE__ */ jsx85("p", { className: "line-clamp-2 text-caption text-text-secondary", children: /* @__PURE__ */ jsx85("mark", { className: cn("rounded-sm px-0.5 text-text-primary [box-decoration-break:clone]", inThePage ? "bg-warning-muted" : "bg-bg-inset text-text-secondary", state === "gone" && "line-through"), children: shown2 }) }) }),
6642
6652
  state !== "here" && /* @__PURE__ */ jsx85("span", { className: "text-caption italic text-text-muted", children: SINCE[state] })
6643
6653
  ] });
6644
6654
  }