@estiva-app/ui 0.102.2 → 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 (43) 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 +6 -0
  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 +25 -17
  18. package/dist/index.js.map +2 -2
  19. package/package.json +1 -1
  20. package/registry.json +26 -2
  21. package/src/CommentBox.mdx +1 -0
  22. package/src/CommentBox.stories.tsx +17 -1
  23. package/src/CommentBox.test.tsx +24 -0
  24. package/src/CommentBox.tsx +29 -1
  25. package/src/ConfirmDialog.mdx +2 -0
  26. package/src/ConfirmDialog.stories.tsx +6 -0
  27. package/src/ConfirmDialog.test.tsx +12 -1
  28. package/src/ConfirmDialog.tsx +8 -1
  29. package/src/ConversationCard.mdx +2 -0
  30. package/src/ConversationCard.stories.tsx +6 -0
  31. package/src/ConversationCard.test.tsx +50 -0
  32. package/src/ConversationCard.tsx +13 -7
  33. package/src/LinkChip.test.tsx +13 -2
  34. package/src/LinkChip.tsx +4 -3
  35. package/src/LinkRow.tsx +6 -2
  36. package/src/NavTree.stories.tsx +1 -1
  37. package/src/QuotedLine.mdx +2 -1
  38. package/src/QuotedLine.test.tsx +9 -0
  39. package/src/QuotedLine.tsx +4 -2
  40. package/src/SectionHeader.mdx +1 -0
  41. package/src/SectionHeader.test.tsx +7 -0
  42. package/src/SectionHeader.tsx +4 -1
  43. package/src/editor.ts +1 -0
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
  }
@@ -5127,9 +5131,11 @@ import { useContext as useContext10 } from "react";
5127
5131
  import { jsx as jsx64, jsxs as jsxs46 } from "react/jsx-runtime";
5128
5132
  var ROW_CLASSES2 = "flex items-center gap-3 p-1.5 pr-3";
5129
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 } = {}) {
5130
5137
  const word = named2 ? `file in ${noun}` : /^[A-Z][a-z]*$/.test(noun) ? noun.toLowerCase() : noun;
5131
- const words = deleted ? `${named2 ? `File in ${noun}` : noun} deleted` : failed ? `Couldn't load this ${word}` : `You can't open this ${word}`;
5132
- return /* @__PURE__ */ jsx64(UnavailableRow, { kind, words, card });
5138
+ return deleted ? `${named2 ? `File in ${noun}` : noun} deleted` : failed ? `Couldn't load this ${word}` : `You can't open this ${word}`;
5133
5139
  }
5134
5140
  function UnavailableRow({ kind, words, href, card = false }) {
5135
5141
  const wide = useContext10(inTheBox);
@@ -5349,11 +5355,10 @@ function LinkChip({ link, preview = true }) {
5349
5355
  }
5350
5356
  if (link.state === "unavailable") {
5351
5357
  if (link.url) return /* @__PURE__ */ jsx67(WrittenUrl, { url: link.url });
5352
- return /* @__PURE__ */ jsxs48(InlineChip, { tone: "muted", icon: /* @__PURE__ */ jsx67(LinkedIcon, { kind: link.kind, size: 14, tone: "inherit" }), children: [
5353
- link.noun,
5354
- " ",
5355
- link.deleted ? "deleted" : "not available"
5356
- ] });
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
+ );
5357
5362
  }
5358
5363
  const { linked } = link;
5359
5364
  const status = chosenOf(linked.status);
@@ -6018,7 +6023,7 @@ function useEditing(editing, onEditingChange) {
6018
6023
  return [now, set];
6019
6024
  }
6020
6025
  function ConversationCard(props) {
6021
- 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;
6022
6027
  const readOnly = (props.readOnly ?? false) || deleted;
6023
6028
  const inThreadCard = useContext14(InThreadCard);
6024
6029
  const item = useContext14(InConversationItem);
@@ -6044,7 +6049,6 @@ function ConversationCard(props) {
6044
6049
  const marked = selected ?? (item && !item.under ? item.open : void 0);
6045
6050
  const under = !!item?.under;
6046
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 });
6047
- const aboutShown = !!about && !deleted;
6048
6052
  return /* @__PURE__ */ jsxs58(Fragment23, { children: [
6049
6053
  /* @__PURE__ */ jsxs58(
6050
6054
  Card,
@@ -6072,7 +6076,10 @@ function ConversationCard(props) {
6072
6076
  },
6073
6077
  children: [
6074
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: [
6075
- 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: [
6076
6083
  /* @__PURE__ */ jsx81(
6077
6084
  Head,
6078
6085
  {
@@ -6087,7 +6094,7 @@ function ConversationCard(props) {
6087
6094
  meta: resolved && /* @__PURE__ */ jsx81(ResolvedCheck, { by: resolved.by, note: resolved.note, at: resolved.at })
6088
6095
  }
6089
6096
  ),
6090
- aboutShown && // Under the name, above the words (Katerina, 1 November).
6097
+ !!about && // Under the name, above the words (Katerina, 1 November).
6091
6098
  /* @__PURE__ */ jsx81("div", { className: "relative w-full pl-8 pr-2 pt-0.5", children: about }),
6092
6099
  /* @__PURE__ */ jsx81(Words, { children })
6093
6100
  ] }),
@@ -6140,7 +6147,7 @@ function ConversationCard(props) {
6140
6147
  ]
6141
6148
  }
6142
6149
  ),
6143
- 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: [
6144
6151
  /* @__PURE__ */ jsx81("p", { children: "It is deleted for everyone." }),
6145
6152
  replies && replies.count > 0 && /* @__PURE__ */ jsxs58("p", { children: [
6146
6153
  "Its ",
@@ -6163,7 +6170,7 @@ function ConversationCard(props) {
6163
6170
  ] });
6164
6171
  }
6165
6172
  function ReplyCard(props) {
6166
- 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;
6167
6174
  const readOnly = props.readOnly ?? false;
6168
6175
  const [hovered, setHovered] = useState23(false);
6169
6176
  const [menuOpen, setMenuOpen] = useState23(false);
@@ -6243,7 +6250,7 @@ function ReplyCard(props) {
6243
6250
  ]
6244
6251
  }
6245
6252
  ),
6246
- 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 })
6247
6254
  ] });
6248
6255
  }
6249
6256
 
@@ -6639,8 +6646,9 @@ import { jsx as jsx85, jsxs as jsxs62 } from "react/jsx-runtime";
6639
6646
  var SINCE = { reworded: "Changed since", gone: "Deleted from the page" };
6640
6647
  function QuotedLine({ words, state = "here", label }) {
6641
6648
  const shown2 = words ?? label ?? "";
6649
+ const inThePage = !!words && state === "here";
6642
6650
  return /* @__PURE__ */ jsxs62("div", { "data-quoted": words ? state : "part", className: "flex w-full min-w-0 flex-col gap-0.5", children: [
6643
- /* @__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 }) }) }),
6644
6652
  state !== "here" && /* @__PURE__ */ jsx85("span", { className: "text-caption italic text-text-muted", children: SINCE[state] })
6645
6653
  ] });
6646
6654
  }