@instructure/platform-notebook 1.11.0 → 1.11.1
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/NoteCard.d.ts.map +1 -1
- package/dist/NoteChip.d.ts +3 -1
- package/dist/NoteChip.d.ts.map +1 -1
- package/dist/SingleNote.d.ts.map +1 -1
- package/dist/highlighter.d.ts +1 -0
- package/dist/highlighter.d.ts.map +1 -1
- package/dist/index.js +361 -341
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
1
|
+
import { jsx as i, jsxs as T, Fragment as Xe } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as Ve, useMemo as pe, useContext as Qe, useReducer as Ye, useRef as F, useEffect as q, useState as W, useCallback as K } from "react";
|
|
3
3
|
import { createPortal as pt } from "react-dom";
|
|
4
4
|
import { z as d } from "zod";
|
|
5
5
|
import yt from "diff-match-patch";
|
|
6
|
-
import { useQueryClient as
|
|
6
|
+
import { useQueryClient as ke, useMutation as Le, useQuery as Nt } from "@tanstack/react-query";
|
|
7
7
|
import { CloseButton as bt, Button as ne, IconButton as ge } from "@instructure/ui-buttons/v11_7";
|
|
8
|
-
import { Flex as
|
|
8
|
+
import { Flex as I } from "@instructure/ui-flex/v11_7";
|
|
9
9
|
import { Heading as ve } from "@instructure/ui-heading/v11_7";
|
|
10
10
|
import { Tray as Et } from "@instructure/ui-tray/v11_7";
|
|
11
11
|
import { View as V } from "@instructure/ui-view/v11_7";
|
|
12
|
-
import { IconQuestionLine as Ae, IconPinLine as De, IconWarningLine as
|
|
12
|
+
import { IconQuestionLine as Ae, IconPinLine as De, IconWarningLine as Tt, NotebookInstUIIcon as St, IconEditLine as Oe, IconTrashLine as Se, IconArrowStartLine as vt } from "@instructure/ui-icons";
|
|
13
13
|
import { Menu as fe } from "@instructure/ui-menu/v11_7";
|
|
14
|
-
import { TruncateText as
|
|
14
|
+
import { TruncateText as Te } from "@instructure/ui-truncate-text/v11_7";
|
|
15
15
|
import { SimpleSelect as He } from "@instructure/ui-simple-select/v11_7";
|
|
16
16
|
import { Text as Z } from "@instructure/ui-text/v11_7";
|
|
17
17
|
import { ScreenReaderContent as ye } from "@instructure/ui-a11y-content";
|
|
18
|
-
import { Dialog as
|
|
18
|
+
import { Dialog as Ct } from "@instructure/ui-dialog";
|
|
19
19
|
import { TextArea as Ze } from "@instructure/ui-text-area/v11_7";
|
|
20
20
|
import { Pill as $e } from "@instructure/ui-pill/v11_7";
|
|
21
|
-
import { Pagination as
|
|
21
|
+
import { Pagination as It } from "@instructure/ui-pagination/v11_7";
|
|
22
22
|
import { Spinner as xt } from "@instructure/ui-spinner/v11_7";
|
|
23
23
|
const Rt = d.object({
|
|
24
24
|
startContainer: d.string(),
|
|
25
25
|
endContainer: d.string(),
|
|
26
26
|
startOffset: d.number(),
|
|
27
27
|
endOffset: d.number()
|
|
28
|
-
}),
|
|
28
|
+
}), Ot = d.object({
|
|
29
29
|
start: d.number(),
|
|
30
30
|
end: d.number()
|
|
31
31
|
}), Pe = d.object({
|
|
32
32
|
selectedText: d.string(),
|
|
33
33
|
hasNoHighlightAnymore: d.boolean().optional(),
|
|
34
|
-
textPosition:
|
|
34
|
+
textPosition: Ot.nullable(),
|
|
35
35
|
range: Rt.nullable(),
|
|
36
36
|
pageLastModifiedAt: d.string()
|
|
37
37
|
});
|
|
@@ -40,10 +40,10 @@ const _e = d.enum([
|
|
|
40
40
|
"Important",
|
|
41
41
|
"Confusing"
|
|
42
42
|
/* CONFUSING */
|
|
43
|
-
]),
|
|
43
|
+
]), wt = d.object({
|
|
44
44
|
totalCount: d.number().nullish(),
|
|
45
45
|
totalNrOfPages: d.number().nullish()
|
|
46
|
-
}),
|
|
46
|
+
}), Ce = d.object({
|
|
47
47
|
id: d.string(),
|
|
48
48
|
rootAccountUuid: d.string(),
|
|
49
49
|
userId: d.string(),
|
|
@@ -59,15 +59,15 @@ const _e = d.enum([
|
|
|
59
59
|
highlightSourceUnavailable: d.boolean().optional(),
|
|
60
60
|
createdAt: d.string(),
|
|
61
61
|
updatedAt: d.string()
|
|
62
|
-
}),
|
|
62
|
+
}), kt = d.object({
|
|
63
63
|
cursor: d.string(),
|
|
64
|
-
node:
|
|
64
|
+
node: Ce
|
|
65
65
|
});
|
|
66
66
|
d.object({
|
|
67
67
|
notes: d.object({
|
|
68
|
-
edges: d.array(
|
|
69
|
-
nodes: d.array(
|
|
70
|
-
pageInfo:
|
|
68
|
+
edges: d.array(kt),
|
|
69
|
+
nodes: d.array(Ce),
|
|
70
|
+
pageInfo: wt
|
|
71
71
|
})
|
|
72
72
|
});
|
|
73
73
|
const Lt = d.object({
|
|
@@ -93,7 +93,7 @@ d.object({
|
|
|
93
93
|
highlightData: Pe
|
|
94
94
|
});
|
|
95
95
|
d.object({
|
|
96
|
-
createNote:
|
|
96
|
+
createNote: Ce
|
|
97
97
|
});
|
|
98
98
|
d.object({
|
|
99
99
|
id: d.string(),
|
|
@@ -102,7 +102,7 @@ d.object({
|
|
|
102
102
|
highlightData: Pe
|
|
103
103
|
});
|
|
104
104
|
d.object({
|
|
105
|
-
updateNote:
|
|
105
|
+
updateNote: Ce
|
|
106
106
|
});
|
|
107
107
|
d.object({
|
|
108
108
|
deleteNote: d.string()
|
|
@@ -244,11 +244,11 @@ const _t = (t) => {
|
|
|
244
244
|
o.shift();
|
|
245
245
|
for (const s of o) {
|
|
246
246
|
let l, a;
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
249
|
-
l = s.slice(0,
|
|
250
|
-
const
|
|
251
|
-
if (a = Number.parseInt(
|
|
247
|
+
const f = s.indexOf("[");
|
|
248
|
+
if (f !== -1) {
|
|
249
|
+
l = s.slice(0, f);
|
|
250
|
+
const m = s.slice(f + 1, s.indexOf("]"));
|
|
251
|
+
if (a = Number.parseInt(m, 10) - 1, a < 0)
|
|
252
252
|
return null;
|
|
253
253
|
} else
|
|
254
254
|
l = s, a = 0;
|
|
@@ -361,14 +361,14 @@ const et = (t) => {
|
|
|
361
361
|
if (!s)
|
|
362
362
|
return null;
|
|
363
363
|
if (e.length > 32) {
|
|
364
|
-
const l = e.slice(0, 32), a = e.slice(-32),
|
|
364
|
+
const l = e.slice(0, 32), a = e.slice(-32), f = o - n;
|
|
365
365
|
let u = r.match_main(s, l, n);
|
|
366
|
-
const
|
|
367
|
-
if (u === -1 ||
|
|
366
|
+
const m = r.match_main(s, a, o), c = m + a.length;
|
|
367
|
+
if (u === -1 || m === -1)
|
|
368
368
|
return null;
|
|
369
|
-
const
|
|
369
|
+
const y = c - u, N = Math.abs(y - f);
|
|
370
370
|
if ((u > c || N > 5) && (r.Match_Distance = e.length + 100, u = r.match_main(s, l, c), u !== -1 && u < c))
|
|
371
|
-
return Bt(t, u, c,
|
|
371
|
+
return Bt(t, u, c, f);
|
|
372
372
|
if (u < c && N <= 5)
|
|
373
373
|
return le.fromSelector(t, {
|
|
374
374
|
start: u,
|
|
@@ -397,7 +397,7 @@ const et = (t) => {
|
|
|
397
397
|
for (const s of e) {
|
|
398
398
|
const l = Ht(s, t);
|
|
399
399
|
if (l) {
|
|
400
|
-
const a = l.toRange(),
|
|
400
|
+
const a = l.toRange(), f = a && ce.fromRange(t, a), u = (a == null ? void 0 : a.toString().trim()) || s.highlightData.selectedText;
|
|
401
401
|
o.push({
|
|
402
402
|
id: s.id,
|
|
403
403
|
reaction: s.reaction,
|
|
@@ -406,7 +406,7 @@ const et = (t) => {
|
|
|
406
406
|
...s.highlightData,
|
|
407
407
|
selectedText: u,
|
|
408
408
|
hasNoHighlightAnymore: !1,
|
|
409
|
-
range: (
|
|
409
|
+
range: (f == null ? void 0 : f.toSelector()) ?? null,
|
|
410
410
|
textPosition: l.toSelector(),
|
|
411
411
|
pageLastModifiedAt: n
|
|
412
412
|
}
|
|
@@ -432,7 +432,7 @@ const et = (t) => {
|
|
|
432
432
|
}, Gt = (t) => {
|
|
433
433
|
const n = document.querySelector(
|
|
434
434
|
`[data-highlight-id="${CSS.escape(t)}"].highlight-content`
|
|
435
|
-
) ?? document.getElementById(
|
|
435
|
+
) ?? document.getElementById(Ie(t));
|
|
436
436
|
if (n) {
|
|
437
437
|
const o = n.getBoundingClientRect();
|
|
438
438
|
o.top >= 0 && o.bottom <= (window.innerHeight || document.documentElement.clientHeight) || n.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -441,41 +441,41 @@ const et = (t) => {
|
|
|
441
441
|
const e = t.getClientRects();
|
|
442
442
|
if (!e.length)
|
|
443
443
|
return null;
|
|
444
|
-
const n = e[0], o = e[e.length - 1], r = 4, s = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight,
|
|
445
|
-
const x =
|
|
446
|
-
return
|
|
447
|
-
}, u = (
|
|
448
|
-
const x =
|
|
449
|
-
return
|
|
444
|
+
const n = e[0], o = e[e.length - 1], r = 4, s = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight, f = (h) => {
|
|
445
|
+
const x = h + be;
|
|
446
|
+
return h >= s && x <= l - s;
|
|
447
|
+
}, u = (h) => {
|
|
448
|
+
const x = h + Ne;
|
|
449
|
+
return h >= s && x <= a - s;
|
|
450
450
|
};
|
|
451
|
-
let
|
|
451
|
+
let m;
|
|
452
452
|
const c = n.right - be;
|
|
453
|
-
if (
|
|
454
|
-
|
|
453
|
+
if (f(c))
|
|
454
|
+
m = c;
|
|
455
455
|
else {
|
|
456
|
-
const
|
|
457
|
-
if (
|
|
458
|
-
|
|
456
|
+
const h = n.left;
|
|
457
|
+
if (f(h))
|
|
458
|
+
m = h;
|
|
459
459
|
else {
|
|
460
|
-
const
|
|
461
|
-
|
|
460
|
+
const p = (n.left + n.right) / 2 - be / 2;
|
|
461
|
+
f(p) ? m = p : c < s ? m = s : m = l - be - s;
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
let
|
|
464
|
+
let y;
|
|
465
465
|
const N = o.bottom + r;
|
|
466
466
|
if (u(N))
|
|
467
|
-
|
|
467
|
+
y = N;
|
|
468
468
|
else {
|
|
469
|
-
const
|
|
470
|
-
u(
|
|
469
|
+
const h = n.top - Ne - r;
|
|
470
|
+
u(h) ? y = h : N + Ne > a - s ? y = a - Ne - s : y = s;
|
|
471
471
|
}
|
|
472
|
-
return { top:
|
|
472
|
+
return { top: y, left: m };
|
|
473
473
|
}, Wt = (t, e) => {
|
|
474
474
|
for (const n of e)
|
|
475
475
|
if (t.start < n.end && t.end > n.start)
|
|
476
476
|
return !0;
|
|
477
477
|
return !1;
|
|
478
|
-
}, Fe = (t) => `highlight-wrapper-${t}`,
|
|
478
|
+
}, Fe = (t) => `highlight-wrapper-${t}`, Ie = (t) => `${Fe(t)}-start`, nt = (t) => `${Fe(t)}-end`, he = (t) => `[data-highlight-id="${CSS.escape(t)}"]`, zt = "2px", qt = "3px", Kt = "1px", ot = "3px", Xt = "1px", rt = "Notebook note", Me = (t, e) => {
|
|
479
479
|
const n = Number.parseInt(t.slice(1, 3), 16), o = Number.parseInt(t.slice(3, 5), 16), r = Number.parseInt(t.slice(5, 7), 16);
|
|
480
480
|
return `rgba(${n}, ${o}, ${r}, ${e})`;
|
|
481
481
|
}, st = (t, e, n, o, r) => {
|
|
@@ -536,38 +536,38 @@ const et = (t) => {
|
|
|
536
536
|
}, Zt = (t, e, n) => {
|
|
537
537
|
if (t.collapsed) return;
|
|
538
538
|
const o = e.id ?? "", r = Fe(o);
|
|
539
|
-
if (document.getElementById(
|
|
539
|
+
if (document.getElementById(Ie(o))) {
|
|
540
540
|
Jt(e, n);
|
|
541
541
|
return;
|
|
542
542
|
}
|
|
543
|
-
const l = e.type === L.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId,
|
|
543
|
+
const l = e.type === L.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, f = a ? l : Me(l, 0.5), u = e.type === L.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, m = e.type === L.IMPORTANT ? "solid" : "dashed", c = document.createElement("span");
|
|
544
544
|
c.id = `${r}-start`, c.className = "highlight-marker-start", c.dataset.highlightId = o || "";
|
|
545
|
-
const
|
|
546
|
-
c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.setAttribute("aria-label",
|
|
545
|
+
const y = e.labelPrefix ?? rt;
|
|
546
|
+
c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.setAttribute("aria-label", y), c.setAttribute("aria-haspopup", "dialog"), c.setAttribute("aria-expanded", String(a && !!e.isTrayOpen)), a && c.setAttribute("aria-current", "true"), e.popupId && c.setAttribute("aria-controls", e.popupId), c.style.position = "relative", c.style.fontSize = "0", c.style.lineHeight = "0", c.style.width = "0", c.style.height = "0", c.style.margin = "0", c.style.padding = "0", c.style.border = "0", c.style.outline = "none";
|
|
547
547
|
const N = document.createElement("span");
|
|
548
548
|
N.id = nt(o), N.className = "highlight-marker-end", N.dataset.highlightId = o || "", qe(t, !1).insertNode(N), qe(t, !0).insertNode(c);
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
const z = Yt(
|
|
552
|
-
z.forEach((b,
|
|
549
|
+
const p = document.createRange();
|
|
550
|
+
p.setStartAfter(c), p.setEndBefore(N);
|
|
551
|
+
const z = Yt(p).filter((b) => b.textContent && b.textContent.length > 0);
|
|
552
|
+
z.forEach((b, S) => {
|
|
553
553
|
var j;
|
|
554
554
|
const P = b.parentElement;
|
|
555
555
|
if ((P == null ? void 0 : P.dataset.highlightId) === o) return;
|
|
556
|
-
const D =
|
|
556
|
+
const D = S === 0, G = S === z.length - 1, E = z.length === 1;
|
|
557
557
|
let w;
|
|
558
558
|
E ? w = "single" : D ? w = "first" : G ? w = "last" : w = "middle";
|
|
559
559
|
const v = document.createElement("span");
|
|
560
|
-
v.className = "highlight-content", v.dataset.highlightId = o || "", v.dataset.position = w, v.style.textDecorationLine = "underline", v.style.textDecorationThickness = n.borderWidthSmall, v.style.textUnderlineOffset = n.underlineOffset, v.style.cursor = "pointer", st(v, a,
|
|
560
|
+
v.className = "highlight-content", v.dataset.highlightId = o || "", v.dataset.position = w, v.style.textDecorationLine = "underline", v.style.textDecorationThickness = n.borderWidthSmall, v.style.textUnderlineOffset = n.underlineOffset, v.style.cursor = "pointer", st(v, a, f, u, m), v.addEventListener("click", (ee) => {
|
|
561
561
|
var Q;
|
|
562
562
|
ee.target.tagName !== "A" && ((Q = e.onClick) == null || Q.call(e));
|
|
563
563
|
}), (j = b.parentNode) == null || j.insertBefore(v, b), v.appendChild(b);
|
|
564
564
|
}), c.addEventListener("click", (b) => {
|
|
565
|
-
var
|
|
566
|
-
b.target.tagName !== "A" && ((
|
|
565
|
+
var S;
|
|
566
|
+
b.target.tagName !== "A" && ((S = e.onClick) == null || S.call(e));
|
|
567
567
|
}), c.addEventListener("keydown", (b) => {
|
|
568
|
-
var
|
|
568
|
+
var S;
|
|
569
569
|
if (b.key === "Enter" || b.key === " ")
|
|
570
|
-
b.preventDefault(), (
|
|
570
|
+
b.preventDefault(), (S = e.onClick) == null || S.call(e);
|
|
571
571
|
else if (b.key === "Tab" && !b.shiftKey) {
|
|
572
572
|
const P = document.querySelectorAll(he(o));
|
|
573
573
|
for (const D of P) {
|
|
@@ -581,14 +581,14 @@ const et = (t) => {
|
|
|
581
581
|
}), c.addEventListener("focus", () => {
|
|
582
582
|
document.querySelectorAll(
|
|
583
583
|
`.highlight-content${he(o)}`
|
|
584
|
-
).forEach((
|
|
585
|
-
|
|
584
|
+
).forEach((S) => {
|
|
585
|
+
S.style.boxShadow = `0 0 0 ${zt} ${n.colors.focusOutline}`, S.style.borderRadius = qt;
|
|
586
586
|
});
|
|
587
587
|
}), c.addEventListener("blur", () => {
|
|
588
588
|
document.querySelectorAll(
|
|
589
589
|
`.highlight-content${he(o)}`
|
|
590
|
-
).forEach((
|
|
591
|
-
|
|
590
|
+
).forEach((S) => {
|
|
591
|
+
S.style.boxShadow = "", S.style.borderRadius = S.dataset.selected ? ot : "";
|
|
592
592
|
});
|
|
593
593
|
});
|
|
594
594
|
};
|
|
@@ -599,13 +599,13 @@ function Jt(t, e) {
|
|
|
599
599
|
).forEach((u) => {
|
|
600
600
|
st(u, o, r, s, l);
|
|
601
601
|
});
|
|
602
|
-
const
|
|
603
|
-
|
|
602
|
+
const f = document.getElementById(
|
|
603
|
+
Ie(t.id ?? "")
|
|
604
604
|
);
|
|
605
|
-
|
|
605
|
+
f && (f.setAttribute("aria-label", t.labelPrefix ?? rt), f.setAttribute("aria-expanded", String(o && !!t.isTrayOpen)), o ? f.setAttribute("aria-current", "true") : f.removeAttribute("aria-current"));
|
|
606
606
|
}
|
|
607
607
|
const en = (t) => {
|
|
608
|
-
const e = t.id ?? "", n = document.getElementById(
|
|
608
|
+
const e = t.id ?? "", n = document.getElementById(Ie(e)), o = document.getElementById(nt(e));
|
|
609
609
|
document.querySelectorAll(
|
|
610
610
|
he(e)
|
|
611
611
|
).forEach((s) => {
|
|
@@ -619,7 +619,7 @@ const en = (t) => {
|
|
|
619
619
|
notes: (t) => ["notebook", "notes", t]
|
|
620
620
|
};
|
|
621
621
|
function tn(t) {
|
|
622
|
-
const e =
|
|
622
|
+
const e = ke();
|
|
623
623
|
return Le({
|
|
624
624
|
mutationFn: (n) => t.createNote(n),
|
|
625
625
|
onSuccess: () => {
|
|
@@ -628,7 +628,7 @@ function tn(t) {
|
|
|
628
628
|
});
|
|
629
629
|
}
|
|
630
630
|
function nn(t) {
|
|
631
|
-
const e =
|
|
631
|
+
const e = ke();
|
|
632
632
|
return Le({
|
|
633
633
|
mutationFn: (n) => t.deleteNote(n),
|
|
634
634
|
onSuccess: () => {
|
|
@@ -668,17 +668,17 @@ function lt({
|
|
|
668
668
|
});
|
|
669
669
|
}
|
|
670
670
|
function rn(t) {
|
|
671
|
-
const e =
|
|
671
|
+
const e = ke();
|
|
672
672
|
return Le({
|
|
673
673
|
mutationFn: ({ id: n, input: o }) => t.updateNote(n, o),
|
|
674
674
|
onMutate: async ({ id: n, input: o }) => {
|
|
675
675
|
await e.cancelQueries({ queryKey: me.all });
|
|
676
676
|
const s = e.getQueryCache().findAll({ queryKey: me.all }), l = /* @__PURE__ */ new Map();
|
|
677
677
|
for (const a of s) {
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
...
|
|
681
|
-
notes:
|
|
678
|
+
const f = a.state.data;
|
|
679
|
+
f && (l.set(a.queryKey, f), e.setQueryData(a.queryKey, {
|
|
680
|
+
...f,
|
|
681
|
+
notes: f.notes.map(
|
|
682
682
|
(u) => u.id === n ? { ...u, ...o, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } : u
|
|
683
683
|
)
|
|
684
684
|
}));
|
|
@@ -695,7 +695,7 @@ function rn(t) {
|
|
|
695
695
|
}
|
|
696
696
|
});
|
|
697
697
|
}
|
|
698
|
-
const sn = "Notebook", ln = "Notes", an = "Important", cn = "Unclear", dn = "Back", un = "Edit note", fn = "Save", mn = "Cancel", gn = "Delete note", hn = "Delete note confirmation", pn = "note", yn = "Add note (optional)", Nn = "Remove from Notebook", bn = "Add a note (optional)", En = "Mark important",
|
|
698
|
+
const sn = "Notebook", ln = "Notes", an = "Important", cn = "Unclear", dn = "Back", un = "Edit note", fn = "Save", mn = "Cancel", gn = "Delete note", hn = "Delete note confirmation", pn = "note", yn = "Add note (optional)", Nn = "Remove from Notebook", bn = "Add a note (optional)", En = "Mark important", Tn = "Mark unclear", Sn = "Saved to Notebook.", vn = "Note updated", Cn = "Note deleted", In = "Error saving to Notebook.", xn = "Error updating note", Rn = "Note deletion failed", On = "Loading notes", wn = "Failed to load notes", kn = "Start capturing your notes", Ln = "To use the Notebook feature, select text on a page to mark it as Important or Unclear, and add an optional note.", An = "Only you can see your Notebook. Instructors and classmates don't see your notes.", Dn = "Nothing here yet", Pn = "Adjust your filters or create a new note to get started.", _n = "You have no notes for the selected filter", Fn = "Filter", Mn = "Previous page", Bn = "Next page", Un = "All courses", Hn = "All notes", $n = "Close Notebook panel", Gn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", jn = "The content you highlighted is no longer available.", Wn = "This source is no longer available.", zn = "Notebook note", Be = {
|
|
699
699
|
notebook: sn,
|
|
700
700
|
notes: ln,
|
|
701
701
|
important: an,
|
|
@@ -711,16 +711,16 @@ const sn = "Notebook", ln = "Notes", an = "Important", cn = "Unclear", dn = "Bac
|
|
|
711
711
|
removeFromNotebook: Nn,
|
|
712
712
|
addNoteOptional: bn,
|
|
713
713
|
markImportant: En,
|
|
714
|
-
markUnclear:
|
|
715
|
-
savedToNotebook:
|
|
714
|
+
markUnclear: Tn,
|
|
715
|
+
savedToNotebook: Sn,
|
|
716
716
|
noteUpdated: vn,
|
|
717
|
-
noteDeleted:
|
|
718
|
-
errorSavingNote:
|
|
717
|
+
noteDeleted: Cn,
|
|
718
|
+
errorSavingNote: In,
|
|
719
719
|
errorUpdatingNote: xn,
|
|
720
720
|
noteDeletionFailed: Rn,
|
|
721
|
-
loadingNotes:
|
|
722
|
-
failedToLoadNotes:
|
|
723
|
-
emptyStateHeading:
|
|
721
|
+
loadingNotes: On,
|
|
722
|
+
failedToLoadNotes: wn,
|
|
723
|
+
emptyStateHeading: kn,
|
|
724
724
|
emptyStateDescription: Ln,
|
|
725
725
|
emptyStatePrecision: An,
|
|
726
726
|
nothingHereYet: Dn,
|
|
@@ -786,7 +786,7 @@ function Xn(t, e) {
|
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
788
|
const dt = Ve(null);
|
|
789
|
-
function
|
|
789
|
+
function Ro({
|
|
790
790
|
api: t,
|
|
791
791
|
currentUserId: e,
|
|
792
792
|
objectId: n,
|
|
@@ -795,11 +795,11 @@ function xo({
|
|
|
795
795
|
pageLastModifiedAt: s,
|
|
796
796
|
onOpen: l,
|
|
797
797
|
initialNoteId: a,
|
|
798
|
-
translations:
|
|
798
|
+
translations: f,
|
|
799
799
|
translate: u,
|
|
800
|
-
children:
|
|
800
|
+
children: m
|
|
801
801
|
}) {
|
|
802
|
-
const [c,
|
|
802
|
+
const [c, y] = Ye(Xn, Kn(a)), N = F(a != null), h = pe(
|
|
803
803
|
() => ({
|
|
804
804
|
api: t,
|
|
805
805
|
currentUserId: e,
|
|
@@ -808,19 +808,19 @@ function xo({
|
|
|
808
808
|
courseId: r,
|
|
809
809
|
pageLastModifiedAt: s,
|
|
810
810
|
...c,
|
|
811
|
-
selectNote: (x,
|
|
812
|
-
clearSelectedNote: () =>
|
|
813
|
-
setEditing: (x) =>
|
|
811
|
+
selectNote: (x, p = !1) => y({ type: "SELECT_NOTE", payload: { id: x, isEditing: p } }),
|
|
812
|
+
clearSelectedNote: () => y({ type: "CLEAR_SELECTED_NOTE" }),
|
|
813
|
+
setEditing: (x) => y({ type: "SET_EDITING", payload: x }),
|
|
814
814
|
openTray: () => {
|
|
815
|
-
N.current || (N.current = !0, l == null || l()),
|
|
815
|
+
N.current || (N.current = !0, l == null || l()), y({ type: "OPEN_TRAY" });
|
|
816
816
|
},
|
|
817
817
|
closeTray: () => {
|
|
818
|
-
N.current = !1,
|
|
818
|
+
N.current = !1, y({ type: "CLOSE_TRAY" });
|
|
819
819
|
}
|
|
820
820
|
}),
|
|
821
821
|
[t, e, n, o, r, s, l, c]
|
|
822
822
|
);
|
|
823
|
-
return /* @__PURE__ */ i(dt.Provider, { value:
|
|
823
|
+
return /* @__PURE__ */ i(dt.Provider, { value: h, children: /* @__PURE__ */ i(qn, { translations: f, translate: u, children: m }) });
|
|
824
824
|
}
|
|
825
825
|
function ut() {
|
|
826
826
|
const t = Qe(dt);
|
|
@@ -828,7 +828,7 @@ function ut() {
|
|
|
828
828
|
throw new Error("useNotebook must be used within a NotebookProvider");
|
|
829
829
|
return t;
|
|
830
830
|
}
|
|
831
|
-
const ft = "notebook-tray-content",
|
|
831
|
+
const ft = "notebook-tray-content", Oo = ({ children: t }) => {
|
|
832
832
|
const { isTrayOpen: e, closeTray: n } = ut(), { translations: o } = J();
|
|
833
833
|
return /* @__PURE__ */ i(
|
|
834
834
|
Et,
|
|
@@ -838,8 +838,8 @@ const ft = "notebook-tray-content", Ro = ({ children: t }) => {
|
|
|
838
838
|
onDismiss: n,
|
|
839
839
|
placement: "end",
|
|
840
840
|
size: "regular",
|
|
841
|
-
children: /* @__PURE__ */
|
|
842
|
-
/* @__PURE__ */ i(
|
|
841
|
+
children: /* @__PURE__ */ T(I, { direction: "column", height: "100vh", id: ft, children: [
|
|
842
|
+
/* @__PURE__ */ i(I.Item, { children: /* @__PURE__ */ i(V, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ T(I, { justifyItems: "space-between", alignItems: "center", children: [
|
|
843
843
|
/* @__PURE__ */ i(ve, { level: "h3", children: o.notebook }),
|
|
844
844
|
/* @__PURE__ */ i(
|
|
845
845
|
bt,
|
|
@@ -851,7 +851,7 @@ const ft = "notebook-tray-content", Ro = ({ children: t }) => {
|
|
|
851
851
|
}
|
|
852
852
|
)
|
|
853
853
|
] }) }) }),
|
|
854
|
-
/* @__PURE__ */ i(
|
|
854
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
|
|
855
855
|
] })
|
|
856
856
|
}
|
|
857
857
|
);
|
|
@@ -872,8 +872,8 @@ const ft = "notebook-tray-content", Ro = ({ children: t }) => {
|
|
|
872
872
|
borderColor: "secondary",
|
|
873
873
|
borderRadius: "medium",
|
|
874
874
|
shadow: "resting",
|
|
875
|
-
children: /* @__PURE__ */
|
|
876
|
-
/* @__PURE__ */
|
|
875
|
+
children: /* @__PURE__ */ T(fe, { children: [
|
|
876
|
+
/* @__PURE__ */ T(
|
|
877
877
|
fe.Item,
|
|
878
878
|
{
|
|
879
879
|
ref: r,
|
|
@@ -885,7 +885,7 @@ const ft = "notebook-tray-content", Ro = ({ children: t }) => {
|
|
|
885
885
|
]
|
|
886
886
|
}
|
|
887
887
|
),
|
|
888
|
-
/* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ T(
|
|
889
889
|
fe.Item,
|
|
890
890
|
{
|
|
891
891
|
ref: s,
|
|
@@ -912,26 +912,26 @@ function wo({
|
|
|
912
912
|
}) {
|
|
913
913
|
const {
|
|
914
914
|
api: a,
|
|
915
|
-
objectId:
|
|
915
|
+
objectId: f,
|
|
916
916
|
objectType: u,
|
|
917
|
-
courseId:
|
|
917
|
+
courseId: m,
|
|
918
918
|
pageLastModifiedAt: c,
|
|
919
|
-
selectedNoteId:
|
|
919
|
+
selectedNoteId: y,
|
|
920
920
|
isTrayOpen: N,
|
|
921
|
-
selectNote:
|
|
921
|
+
selectNote: h,
|
|
922
922
|
openTray: x
|
|
923
|
-
} = ut(), { translations:
|
|
923
|
+
} = ut(), { translations: p } = J(), { data: R } = lt({
|
|
924
924
|
api: a,
|
|
925
|
-
courseId:
|
|
926
|
-
learningObject: { type: u, id:
|
|
927
|
-
}), { mutate: z, isPending: b } = tn(a), { mutateAsync:
|
|
925
|
+
courseId: m,
|
|
926
|
+
learningObject: { type: u, id: f }
|
|
927
|
+
}), { mutate: z, isPending: b } = tn(a), { mutateAsync: S } = rn(a), { mutate: P } = nn(a), D = F([]), [G, E] = W([]), [w, v] = W(null), [j, ee] = W(""), [Q, ae] = W(null), de = F(null);
|
|
928
928
|
de.current = Q;
|
|
929
929
|
const te = F(!1), [re, se] = W(!1);
|
|
930
930
|
q(() => {
|
|
931
931
|
const M = t.current;
|
|
932
932
|
if (!M) return;
|
|
933
|
-
const
|
|
934
|
-
if (
|
|
933
|
+
const C = M.closest(".user_content") ?? M;
|
|
934
|
+
if (C.classList.contains("enhanced")) {
|
|
935
935
|
se(!0);
|
|
936
936
|
return;
|
|
937
937
|
}
|
|
@@ -942,112 +942,112 @@ function wo({
|
|
|
942
942
|
return;
|
|
943
943
|
}
|
|
944
944
|
});
|
|
945
|
-
return _.observe(
|
|
945
|
+
return _.observe(C, { attributes: !0, attributeFilter: ["class"] }), () => _.disconnect();
|
|
946
946
|
}, [t]);
|
|
947
947
|
const A = K(() => {
|
|
948
948
|
ae(null), v(null), ee("");
|
|
949
949
|
}, []);
|
|
950
950
|
q(() => {
|
|
951
951
|
if (!re || !t.current) return;
|
|
952
|
-
let
|
|
952
|
+
let C = null;
|
|
953
953
|
const _ = () => {
|
|
954
|
-
|
|
954
|
+
C && clearTimeout(C), C = setTimeout(() => {
|
|
955
955
|
var Ue;
|
|
956
|
-
const
|
|
957
|
-
if (!(
|
|
958
|
-
const g =
|
|
956
|
+
const O = window.getSelection(), U = t.current;
|
|
957
|
+
if (!(O != null && O.rangeCount) || !U) return;
|
|
958
|
+
const g = O.toString().trim();
|
|
959
959
|
if (g === "") return;
|
|
960
|
-
const $ =
|
|
960
|
+
const $ = O.getRangeAt(0);
|
|
961
961
|
if (!U.contains($.commonAncestorContainer)) return;
|
|
962
962
|
const ie = (Ue = le.fromRange(U, $)) == null ? void 0 : Ue.toSelector();
|
|
963
963
|
ie && !Wt(ie, G) && (v($.cloneRange()), ee(g), ae(jt($)));
|
|
964
964
|
}, n);
|
|
965
|
-
}, B = (
|
|
966
|
-
if (!(
|
|
965
|
+
}, B = (O) => {
|
|
966
|
+
if (!(O.target instanceof Node)) return;
|
|
967
967
|
const U = document.getElementById(xe);
|
|
968
|
-
U != null && U.contains(
|
|
968
|
+
U != null && U.contains(O.target) ? (O.preventDefault(), O.stopImmediatePropagation()) : A();
|
|
969
969
|
}, H = () => {
|
|
970
970
|
A();
|
|
971
|
-
},
|
|
972
|
-
|
|
971
|
+
}, k = (O) => {
|
|
972
|
+
O.key === "Escape" && de.current !== null && (A(), O.stopImmediatePropagation());
|
|
973
973
|
};
|
|
974
|
-
return document.addEventListener("selectionchange", _), document.addEventListener("mousedown", B), document.addEventListener("touchstart", B), document.addEventListener("keydown",
|
|
975
|
-
|
|
974
|
+
return document.addEventListener("selectionchange", _), document.addEventListener("mousedown", B), document.addEventListener("touchstart", B), document.addEventListener("keydown", k), window.addEventListener("scroll", H, !0), () => {
|
|
975
|
+
C && clearTimeout(C), document.removeEventListener("selectionchange", _), document.removeEventListener("mousedown", B), document.removeEventListener("touchstart", B), document.removeEventListener("keydown", k), window.removeEventListener("scroll", H, !0);
|
|
976
976
|
};
|
|
977
977
|
}, [re, G, n, t, A]);
|
|
978
978
|
const Y = K(
|
|
979
979
|
(M) => {
|
|
980
980
|
var U;
|
|
981
|
-
const
|
|
982
|
-
if (!
|
|
983
|
-
const { highlightData: _, reaction: B, id: H } = M, { range:
|
|
984
|
-
if (
|
|
985
|
-
const g = B[0] === L.IMPORTANT ?
|
|
981
|
+
const C = t.current;
|
|
982
|
+
if (!C || !M.highlightData) return null;
|
|
983
|
+
const { highlightData: _, reaction: B, id: H } = M, { range: k } = _, O = k && ((U = ce.fromSelector(C, k)) == null ? void 0 : U.toRange());
|
|
984
|
+
if (O) {
|
|
985
|
+
const g = B[0] === L.IMPORTANT ? p.important : p.unclear, $ = {
|
|
986
986
|
id: H,
|
|
987
|
-
selectedNoteId:
|
|
987
|
+
selectedNoteId: y,
|
|
988
988
|
type: B[0],
|
|
989
989
|
isTrayOpen: N,
|
|
990
|
-
labelPrefix: `${
|
|
990
|
+
labelPrefix: `${p.notebookNote} (${g})`,
|
|
991
991
|
popupId: ft,
|
|
992
992
|
onClick: () => {
|
|
993
|
-
|
|
993
|
+
h(H), x();
|
|
994
994
|
}
|
|
995
995
|
};
|
|
996
|
-
return Zt(
|
|
996
|
+
return Zt(O, $, e), _.textPosition;
|
|
997
997
|
}
|
|
998
998
|
return null;
|
|
999
999
|
},
|
|
1000
|
-
[t,
|
|
1000
|
+
[t, y, N, e, p, h, x]
|
|
1001
1001
|
);
|
|
1002
1002
|
q(() => {
|
|
1003
|
-
if (!re || !
|
|
1004
|
-
const M = t.current,
|
|
1005
|
-
if (
|
|
1003
|
+
if (!re || !R || !t.current) return;
|
|
1004
|
+
const M = t.current, C = R.notes, _ = /* @__PURE__ */ new Set(), B = [], H = [];
|
|
1005
|
+
if (C.length === 0) {
|
|
1006
1006
|
if (D.current.length > 0) {
|
|
1007
|
-
for (const
|
|
1008
|
-
ze(
|
|
1007
|
+
for (const k of D.current)
|
|
1008
|
+
ze(k, M);
|
|
1009
1009
|
D.current = [], E([]);
|
|
1010
1010
|
}
|
|
1011
1011
|
return;
|
|
1012
1012
|
}
|
|
1013
|
-
if (c &&
|
|
1014
|
-
const { notesForUpdate:
|
|
1013
|
+
if (c && C[0].highlightData.pageLastModifiedAt !== c) {
|
|
1014
|
+
const { notesForUpdate: k, noteIdsForDelete: O } = $t(
|
|
1015
1015
|
M,
|
|
1016
|
-
|
|
1016
|
+
C,
|
|
1017
1017
|
c
|
|
1018
1018
|
);
|
|
1019
|
+
for (const U of k)
|
|
1020
|
+
S({ id: U.id, input: U }).catch((g) => r == null ? void 0 : r(g));
|
|
1019
1021
|
for (const U of O)
|
|
1020
|
-
T({ id: U.id, input: U }).catch((g) => r == null ? void 0 : r(g));
|
|
1021
|
-
for (const U of R)
|
|
1022
1022
|
P(U, { onError: s });
|
|
1023
1023
|
} else {
|
|
1024
|
-
for (const
|
|
1025
|
-
const
|
|
1026
|
-
_.add(
|
|
1024
|
+
for (const k of C) {
|
|
1025
|
+
const O = Y(k);
|
|
1026
|
+
_.add(k.id), O && (B.push(k), H.push(O));
|
|
1027
1027
|
}
|
|
1028
|
-
for (const
|
|
1029
|
-
_.has(
|
|
1030
|
-
E(H), D.current = B,
|
|
1028
|
+
for (const k of D.current)
|
|
1029
|
+
_.has(k.id) || ze(k, M);
|
|
1030
|
+
E(H), D.current = B, y && Gt(y);
|
|
1031
1031
|
}
|
|
1032
1032
|
}, [
|
|
1033
1033
|
re,
|
|
1034
|
-
|
|
1034
|
+
R,
|
|
1035
1035
|
Y,
|
|
1036
1036
|
c,
|
|
1037
1037
|
t,
|
|
1038
|
-
|
|
1038
|
+
S,
|
|
1039
1039
|
P,
|
|
1040
|
-
|
|
1040
|
+
y
|
|
1041
1041
|
]);
|
|
1042
1042
|
const ue = (M) => {
|
|
1043
|
-
const
|
|
1044
|
-
if (!w || !
|
|
1043
|
+
const C = t.current;
|
|
1044
|
+
if (!w || !C || te.current) return;
|
|
1045
1045
|
te.current = !0;
|
|
1046
|
-
const _ = ce.fromRange(
|
|
1046
|
+
const _ = ce.fromRange(C, w), B = le.fromRange(C, w);
|
|
1047
1047
|
z(
|
|
1048
1048
|
{
|
|
1049
|
-
courseId:
|
|
1050
|
-
objectId:
|
|
1049
|
+
courseId: m,
|
|
1050
|
+
objectId: f,
|
|
1051
1051
|
objectType: u,
|
|
1052
1052
|
userText: "",
|
|
1053
1053
|
reaction: [M],
|
|
@@ -1060,9 +1060,9 @@ function wo({
|
|
|
1060
1060
|
},
|
|
1061
1061
|
{
|
|
1062
1062
|
onSuccess: (H) => {
|
|
1063
|
-
var
|
|
1064
|
-
const
|
|
1065
|
-
A(), (
|
|
1063
|
+
var O;
|
|
1064
|
+
const k = H.id;
|
|
1065
|
+
A(), (O = window.getSelection()) == null || O.removeAllRanges(), h(k), x(), l == null || l(H);
|
|
1066
1066
|
},
|
|
1067
1067
|
onError: o,
|
|
1068
1068
|
// Unlock on failure too, so the user can retry from the still-open menu
|
|
@@ -1086,8 +1086,8 @@ function wo({
|
|
|
1086
1086
|
whiteSpace: "nowrap"
|
|
1087
1087
|
},
|
|
1088
1088
|
onBlur: (M) => {
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1089
|
+
const C = document.getElementById(xe);
|
|
1090
|
+
C != null && C.contains(M.relatedTarget) || A();
|
|
1091
1091
|
},
|
|
1092
1092
|
children: /* @__PURE__ */ i(Vn, { onSelectReaction: ue, disabled: b })
|
|
1093
1093
|
}
|
|
@@ -1099,7 +1099,7 @@ const Qn = (t, e) => ({
|
|
|
1099
1099
|
backgroundColor: t === L.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
1100
1100
|
underlineColor: t === L.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
1101
1101
|
underlineStyle: t === L.IMPORTANT ? "solid" : "dashed"
|
|
1102
|
-
}),
|
|
1102
|
+
}), we = ({
|
|
1103
1103
|
children: t,
|
|
1104
1104
|
type: e = L.IMPORTANT,
|
|
1105
1105
|
isCardActive: n = !0,
|
|
@@ -1122,9 +1122,9 @@ function mt(t, e = "noHighlight") {
|
|
|
1122
1122
|
}
|
|
1123
1123
|
const gt = ({ reason: t } = {}) => {
|
|
1124
1124
|
const { translations: e } = J();
|
|
1125
|
-
return /* @__PURE__ */
|
|
1126
|
-
/* @__PURE__ */ i(
|
|
1127
|
-
/* @__PURE__ */ i(
|
|
1125
|
+
return /* @__PURE__ */ T(I, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1126
|
+
/* @__PURE__ */ i(I.Item, { as: "div", children: /* @__PURE__ */ i(Tt, { color: "error" }) }),
|
|
1127
|
+
/* @__PURE__ */ i(I.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ i(Te, { maxLines: 3, children: mt(e, t) }) })
|
|
1128
1128
|
] });
|
|
1129
1129
|
}, Yn = {
|
|
1130
1130
|
filter: null,
|
|
@@ -1169,37 +1169,37 @@ function ko({
|
|
|
1169
1169
|
focusNoteId: s
|
|
1170
1170
|
}) {
|
|
1171
1171
|
var se;
|
|
1172
|
-
const [l, a] = Ye(Zn, Yn), { filter:
|
|
1172
|
+
const [l, a] = Ye(Zn, Yn), { filter: f, courseFilter: u, currentPage: m, totalPages: c } = l;
|
|
1173
1173
|
q(() => {
|
|
1174
1174
|
a({ type: "SET_PAGE", payload: 1 });
|
|
1175
1175
|
}, [r]);
|
|
1176
|
-
const
|
|
1177
|
-
...
|
|
1178
|
-
...
|
|
1176
|
+
const y = n ? u : e, N = (m - 1) * r, h = !!o, x = {
|
|
1177
|
+
...y ? { courseId: y } : {},
|
|
1178
|
+
...f ? { reactions: [f] } : {},
|
|
1179
1179
|
...o ? { learningObject: o } : {}
|
|
1180
1180
|
}, {
|
|
1181
|
-
data:
|
|
1182
|
-
isLoading:
|
|
1181
|
+
data: p,
|
|
1182
|
+
isLoading: R,
|
|
1183
1183
|
isError: z
|
|
1184
1184
|
} = it({
|
|
1185
1185
|
api: t,
|
|
1186
1186
|
filter: x,
|
|
1187
1187
|
offset: N,
|
|
1188
1188
|
pageSize: r,
|
|
1189
|
-
enabled: !
|
|
1189
|
+
enabled: !h
|
|
1190
1190
|
}), {
|
|
1191
1191
|
data: b,
|
|
1192
|
-
isLoading:
|
|
1192
|
+
isLoading: S,
|
|
1193
1193
|
isError: P
|
|
1194
1194
|
} = lt({
|
|
1195
1195
|
api: t,
|
|
1196
|
-
courseId:
|
|
1196
|
+
courseId: y ?? void 0,
|
|
1197
1197
|
learningObject: o,
|
|
1198
|
-
enabled:
|
|
1198
|
+
enabled: h
|
|
1199
1199
|
}), D = pe(() => {
|
|
1200
1200
|
const A = (b == null ? void 0 : b.notes) ?? [];
|
|
1201
|
-
return
|
|
1202
|
-
}, [b,
|
|
1201
|
+
return f ? A.filter((Y) => Y.reaction.includes(f)) : A;
|
|
1202
|
+
}, [b, f]), G = F(null);
|
|
1203
1203
|
q(() => {
|
|
1204
1204
|
if (!s) {
|
|
1205
1205
|
G.current = null;
|
|
@@ -1210,9 +1210,9 @@ function ko({
|
|
|
1210
1210
|
if (A === -1) return;
|
|
1211
1211
|
G.current = s;
|
|
1212
1212
|
const Y = Math.floor(A / r) + 1;
|
|
1213
|
-
Y !==
|
|
1214
|
-
}, [s, D, r,
|
|
1215
|
-
const E =
|
|
1213
|
+
Y !== m && a({ type: "FOCUS_PAGE", payload: Y });
|
|
1214
|
+
}, [s, D, r, m]);
|
|
1215
|
+
const E = h ? D.slice(N, N + r) : (p == null ? void 0 : p.notes) ?? [], w = h ? S : R, v = h ? P : z, j = h ? Math.max(1, Math.ceil(D.length / r)) : ((se = p == null ? void 0 : p.pageInfo) == null ? void 0 : se.totalNrOfPages) ?? void 0, ee = h ? { totalCount: D.length, totalNrOfPages: j } : p == null ? void 0 : p.pageInfo;
|
|
1216
1216
|
q(() => {
|
|
1217
1217
|
a({ type: "SET_TOTAL_PAGES", payload: j });
|
|
1218
1218
|
}, [j]);
|
|
@@ -1238,9 +1238,9 @@ function ko({
|
|
|
1238
1238
|
pageInfo: ee,
|
|
1239
1239
|
isLoading: w,
|
|
1240
1240
|
isError: v,
|
|
1241
|
-
filter:
|
|
1241
|
+
filter: f,
|
|
1242
1242
|
courseFilter: u,
|
|
1243
|
-
currentPage:
|
|
1243
|
+
currentPage: m,
|
|
1244
1244
|
totalPages: c,
|
|
1245
1245
|
setFilter: te,
|
|
1246
1246
|
setCourseFilter: re,
|
|
@@ -1250,7 +1250,7 @@ function ko({
|
|
|
1250
1250
|
};
|
|
1251
1251
|
}
|
|
1252
1252
|
const Re = "all";
|
|
1253
|
-
function
|
|
1253
|
+
function Lo({ filter: t, setFilter: e }) {
|
|
1254
1254
|
const { translations: n } = J(), o = pe(
|
|
1255
1255
|
() => [
|
|
1256
1256
|
{ label: n.allNotes, value: Re },
|
|
@@ -1283,72 +1283,83 @@ function Oo({ filter: t, setFilter: e }) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
const Jn = ({ hasActiveFilter: t = !1 }) => {
|
|
1285
1285
|
const { translations: e } = J(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1286
|
-
return /* @__PURE__ */ i(V, { as: "div", textAlign: "center", children: /* @__PURE__ */
|
|
1287
|
-
!t && /* @__PURE__ */ i(
|
|
1286
|
+
return /* @__PURE__ */ i(V, { as: "div", textAlign: "center", children: /* @__PURE__ */ T(I, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1287
|
+
!t && /* @__PURE__ */ i(St, { size: "medium" }),
|
|
1288
1288
|
/* @__PURE__ */ i(ve, { level: "h3", children: n }),
|
|
1289
1289
|
/* @__PURE__ */ i(Z, { color: "secondary", children: o }),
|
|
1290
1290
|
!t && /* @__PURE__ */ i(Z, { color: "secondary", children: e.emptyStatePrecision })
|
|
1291
1291
|
] }) });
|
|
1292
|
-
}, eo = {
|
|
1292
|
+
}, eo = "#2871AF", to = (t) => ({
|
|
1293
1293
|
[L.IMPORTANT]: {
|
|
1294
1294
|
color: "success",
|
|
1295
|
+
themeOverride: {
|
|
1296
|
+
successTextColor: t,
|
|
1297
|
+
successBorderColor: t
|
|
1298
|
+
},
|
|
1295
1299
|
translationKey: "important",
|
|
1296
1300
|
icon: /* @__PURE__ */ i(De, { size: "x-small" })
|
|
1297
1301
|
},
|
|
1298
1302
|
[L.CONFUSING]: {
|
|
1299
1303
|
color: "error",
|
|
1304
|
+
themeOverride: void 0,
|
|
1300
1305
|
translationKey: "unclear",
|
|
1301
1306
|
icon: /* @__PURE__ */ i(Ae, { size: "x-small" })
|
|
1302
1307
|
}
|
|
1303
|
-
}, ht = ({
|
|
1304
|
-
|
|
1308
|
+
}), ht = ({
|
|
1309
|
+
type: t,
|
|
1310
|
+
onTypeChange: e,
|
|
1311
|
+
renderAsMenuTrigger: n = !1,
|
|
1312
|
+
theme: o
|
|
1313
|
+
}) => {
|
|
1314
|
+
const { translations: r } = J(), l = to((o == null ? void 0 : o.importantPill) ?? eo)[t], a = r[l.translationKey], [f, u] = W(!1), m = F(null), c = F(null), y = F(null), N = K(
|
|
1305
1315
|
(h) => {
|
|
1306
|
-
e == null || e(h),
|
|
1316
|
+
e == null || e(h), u(!1);
|
|
1307
1317
|
},
|
|
1308
1318
|
[e]
|
|
1309
1319
|
);
|
|
1310
1320
|
return q(() => {
|
|
1311
|
-
if (!
|
|
1321
|
+
if (!f) return;
|
|
1312
1322
|
const h = (p) => {
|
|
1313
1323
|
p.key === "Escape" && p.stopPropagation();
|
|
1314
|
-
},
|
|
1315
|
-
var
|
|
1316
|
-
p.key === "Escape" && (p.stopPropagation(),
|
|
1324
|
+
}, x = (p) => {
|
|
1325
|
+
var R;
|
|
1326
|
+
p.key === "Escape" && (p.stopPropagation(), u(!1), (R = y.current) == null || R.focus());
|
|
1317
1327
|
};
|
|
1318
|
-
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup",
|
|
1319
|
-
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup",
|
|
1328
|
+
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup", x, !0), () => {
|
|
1329
|
+
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup", x, !0);
|
|
1320
1330
|
};
|
|
1321
|
-
}, [
|
|
1331
|
+
}, [f]), n && e ? /* @__PURE__ */ T(
|
|
1322
1332
|
fe,
|
|
1323
1333
|
{
|
|
1324
1334
|
placement: "bottom start",
|
|
1325
|
-
show:
|
|
1326
|
-
onToggle: (h) =>
|
|
1335
|
+
show: f,
|
|
1336
|
+
onToggle: (h) => u(h),
|
|
1327
1337
|
shouldHideOnSelect: !0,
|
|
1328
1338
|
shouldFocusTriggerOnClose: !0,
|
|
1329
1339
|
trigger: /* @__PURE__ */ i(
|
|
1330
1340
|
$e,
|
|
1331
1341
|
{
|
|
1332
|
-
color:
|
|
1333
|
-
|
|
1342
|
+
color: l.color,
|
|
1343
|
+
themeOverride: l.themeOverride,
|
|
1344
|
+
renderIcon: l.icon,
|
|
1334
1345
|
elementRef: (h) => {
|
|
1335
|
-
|
|
1346
|
+
y.current = h;
|
|
1336
1347
|
},
|
|
1337
|
-
children:
|
|
1348
|
+
children: a
|
|
1338
1349
|
}
|
|
1339
1350
|
),
|
|
1340
1351
|
children: [
|
|
1341
|
-
/* @__PURE__ */
|
|
1352
|
+
/* @__PURE__ */ T(fe.Item, { ref: m, onClick: () => N(L.CONFUSING), children: [
|
|
1342
1353
|
/* @__PURE__ */ i(Ae, { size: "x-small" }),
|
|
1343
|
-
` ${
|
|
1354
|
+
` ${r.markUnclear}`
|
|
1344
1355
|
] }),
|
|
1345
|
-
/* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ T(fe.Item, { ref: c, onClick: () => N(L.IMPORTANT), children: [
|
|
1346
1357
|
/* @__PURE__ */ i(De, { size: "x-small" }),
|
|
1347
|
-
` ${
|
|
1358
|
+
` ${r.markImportant}`
|
|
1348
1359
|
] })
|
|
1349
1360
|
]
|
|
1350
1361
|
}
|
|
1351
|
-
) : /* @__PURE__ */ i(V, { display: "inline-flex", children: /* @__PURE__ */ i($e, { color:
|
|
1362
|
+
) : /* @__PURE__ */ i(V, { display: "inline-flex", children: /* @__PURE__ */ i($e, { color: l.color, themeOverride: l.themeOverride, renderIcon: l.icon, children: a }) });
|
|
1352
1363
|
};
|
|
1353
1364
|
function Ke(t, e) {
|
|
1354
1365
|
return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
|
|
@@ -1357,7 +1368,7 @@ function Ke(t, e) {
|
|
|
1357
1368
|
day: "numeric"
|
|
1358
1369
|
});
|
|
1359
1370
|
}
|
|
1360
|
-
const
|
|
1371
|
+
const no = ({
|
|
1361
1372
|
noteId: t,
|
|
1362
1373
|
date: e,
|
|
1363
1374
|
highlight: n,
|
|
@@ -1366,34 +1377,34 @@ const to = ({
|
|
|
1366
1377
|
type: s,
|
|
1367
1378
|
onClick: l,
|
|
1368
1379
|
onDelete: a,
|
|
1369
|
-
onSaveNote:
|
|
1380
|
+
onSaveNote: f,
|
|
1370
1381
|
onTypeChange: u,
|
|
1371
|
-
isActive:
|
|
1382
|
+
isActive: m,
|
|
1372
1383
|
isPanelView: c = !1,
|
|
1373
|
-
courseName:
|
|
1384
|
+
courseName: y,
|
|
1374
1385
|
locale: N,
|
|
1375
|
-
highlightTheme:
|
|
1386
|
+
highlightTheme: h,
|
|
1376
1387
|
renderLink: x,
|
|
1377
|
-
href:
|
|
1388
|
+
href: p
|
|
1378
1389
|
}) => {
|
|
1379
|
-
const { translations:
|
|
1390
|
+
const { translations: R } = J(), [z, b] = W(!1), [S, P] = W(!1), [D, G] = W(r || ""), [E, w] = W(!1), [v, j] = W(!1), [ee, Q] = W(!1), [ae, de] = W(!1), te = F(null), re = K((g) => {
|
|
1380
1391
|
te.current = g;
|
|
1381
|
-
}, []), se = F(null), A = F(null), Y = F(!1), ue = F(null), M = F(null),
|
|
1392
|
+
}, []), se = F(null), A = F(null), Y = F(!1), ue = F(null), M = F(null), C = F(!1);
|
|
1382
1393
|
q(() => {
|
|
1383
1394
|
var g, $;
|
|
1384
|
-
|
|
1385
|
-
}, [
|
|
1395
|
+
m ? ((g = te.current) == null || g.scrollIntoView({ behavior: "smooth", block: "nearest" }), ($ = te.current) == null || $.focus()) : w(!1);
|
|
1396
|
+
}, [m]), q(() => {
|
|
1386
1397
|
var g, $;
|
|
1387
|
-
|
|
1388
|
-
}, [
|
|
1389
|
-
if (!E &&
|
|
1390
|
-
|
|
1398
|
+
S ? (Y.current = !0, (g = se.current) == null || g.focus()) : Y.current && (Y.current = !1, ($ = A.current) == null || $.focus());
|
|
1399
|
+
}, [S]), q(() => {
|
|
1400
|
+
if (!E && C.current) {
|
|
1401
|
+
C.current = !1;
|
|
1391
1402
|
const g = ue.current;
|
|
1392
1403
|
g != null && g.isConnected && g.focus();
|
|
1393
1404
|
}
|
|
1394
1405
|
}, [E]);
|
|
1395
1406
|
const _ = K((g, $) => {
|
|
1396
|
-
|
|
1407
|
+
C.current = !$, w(!1);
|
|
1397
1408
|
}, []);
|
|
1398
1409
|
q(() => {
|
|
1399
1410
|
if (!E) return;
|
|
@@ -1406,13 +1417,13 @@ const to = ({
|
|
|
1406
1417
|
window.removeEventListener("keydown", g, !0), window.removeEventListener("keyup", $, !0);
|
|
1407
1418
|
};
|
|
1408
1419
|
}, [E, _]);
|
|
1409
|
-
const B = s === L.IMPORTANT ?
|
|
1420
|
+
const B = s === L.IMPORTANT ? R.important : R.unclear, H = (g) => {
|
|
1410
1421
|
g.key === "Enter" && (g.preventDefault(), l == null || l());
|
|
1411
|
-
},
|
|
1412
|
-
|
|
1413
|
-
n || mt(
|
|
1414
|
-
), r &&
|
|
1415
|
-
const
|
|
1422
|
+
}, k = [R.note, B];
|
|
1423
|
+
k.push(
|
|
1424
|
+
n || mt(R, o)
|
|
1425
|
+
), r && k.push(r), e && k.push(Ke(e, N)), y && k.push(y);
|
|
1426
|
+
const O = k.join(", "), U = /* @__PURE__ */ T(
|
|
1416
1427
|
V,
|
|
1417
1428
|
{
|
|
1418
1429
|
as: "div",
|
|
@@ -1421,17 +1432,17 @@ const to = ({
|
|
|
1421
1432
|
borderRadius: "medium",
|
|
1422
1433
|
padding: "small",
|
|
1423
1434
|
position: "relative",
|
|
1424
|
-
role:
|
|
1425
|
-
"aria-label":
|
|
1426
|
-
"aria-pressed":
|
|
1427
|
-
tabIndex:
|
|
1435
|
+
role: p ? void 0 : m || S ? "group" : "button",
|
|
1436
|
+
"aria-label": p ? void 0 : O,
|
|
1437
|
+
"aria-pressed": p || m || S ? void 0 : m,
|
|
1438
|
+
tabIndex: p || m ? -1 : 0,
|
|
1428
1439
|
"data-testid": `note-card-${t}`,
|
|
1429
1440
|
elementRef: re,
|
|
1430
|
-
onClick:
|
|
1441
|
+
onClick: m ? void 0 : l,
|
|
1431
1442
|
onMouseEnter: () => b(!0),
|
|
1432
1443
|
onMouseLeave: () => b(!1),
|
|
1433
|
-
onKeyDown:
|
|
1434
|
-
cursor:
|
|
1444
|
+
onKeyDown: m ? void 0 : H,
|
|
1445
|
+
cursor: S ? "default" : "pointer",
|
|
1435
1446
|
children: [
|
|
1436
1447
|
/* @__PURE__ */ i(
|
|
1437
1448
|
"div",
|
|
@@ -1439,15 +1450,16 @@ const to = ({
|
|
|
1439
1450
|
"data-testid": `note-card-${t}-content`,
|
|
1440
1451
|
style: {
|
|
1441
1452
|
height: "100%",
|
|
1442
|
-
opacity:
|
|
1453
|
+
opacity: m && E && a ? 0.25 : void 0
|
|
1443
1454
|
},
|
|
1444
|
-
children: /* @__PURE__ */
|
|
1455
|
+
children: /* @__PURE__ */ T(I, { direction: "column", gap: "small", height: "100%", children: [
|
|
1445
1456
|
/* @__PURE__ */ i(
|
|
1446
1457
|
ht,
|
|
1447
1458
|
{
|
|
1448
1459
|
type: s,
|
|
1449
1460
|
onTypeChange: c && u ? (g) => u(t, g) : void 0,
|
|
1450
|
-
renderAsMenuTrigger: c && !!u && !!
|
|
1461
|
+
renderAsMenuTrigger: c && !!u && !!m,
|
|
1462
|
+
theme: h.colors
|
|
1451
1463
|
}
|
|
1452
1464
|
),
|
|
1453
1465
|
n ? /* @__PURE__ */ i(
|
|
@@ -1458,44 +1470,44 @@ const to = ({
|
|
|
1458
1470
|
overflowWrap: "break-word",
|
|
1459
1471
|
whiteSpace: "pre-wrap"
|
|
1460
1472
|
},
|
|
1461
|
-
children: /* @__PURE__ */ i(Z, { children:
|
|
1462
|
-
|
|
1473
|
+
children: /* @__PURE__ */ i(Z, { children: m && c ? /* @__PURE__ */ i(
|
|
1474
|
+
we,
|
|
1463
1475
|
{
|
|
1464
1476
|
type: s,
|
|
1465
|
-
isCardActive: !!
|
|
1466
|
-
theme:
|
|
1477
|
+
isCardActive: !!m || z,
|
|
1478
|
+
theme: h,
|
|
1467
1479
|
children: n
|
|
1468
1480
|
}
|
|
1469
|
-
) : /* @__PURE__ */
|
|
1481
|
+
) : /* @__PURE__ */ T(Xe, { children: [
|
|
1470
1482
|
v && /* @__PURE__ */ i(ye, { children: n }),
|
|
1471
|
-
/* @__PURE__ */ i("span", { "aria-hidden": v, style: { display: "block" }, children: /* @__PURE__ */ i(
|
|
1472
|
-
|
|
1483
|
+
/* @__PURE__ */ i("span", { "aria-hidden": v, style: { display: "block" }, children: /* @__PURE__ */ i(Te, { maxLines: 3, truncate: "word", onUpdate: j, children: /* @__PURE__ */ i(
|
|
1484
|
+
we,
|
|
1473
1485
|
{
|
|
1474
1486
|
type: s,
|
|
1475
|
-
isCardActive: !!
|
|
1476
|
-
theme:
|
|
1487
|
+
isCardActive: !!m || z,
|
|
1488
|
+
theme: h,
|
|
1477
1489
|
children: n
|
|
1478
1490
|
}
|
|
1479
1491
|
) }) })
|
|
1480
1492
|
] }) })
|
|
1481
1493
|
}
|
|
1482
1494
|
) : /* @__PURE__ */ i(gt, { reason: o }),
|
|
1483
|
-
/* @__PURE__ */ i(
|
|
1484
|
-
|
|
1495
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ T(I, { direction: "column", gap: "small", height: "100%", children: [
|
|
1496
|
+
S && c ? /* @__PURE__ */ T(I, { direction: "column", gap: "x-small", margin: "xx-small", children: [
|
|
1485
1497
|
/* @__PURE__ */ i(
|
|
1486
1498
|
Ze,
|
|
1487
1499
|
{
|
|
1488
|
-
label: /* @__PURE__ */ i(ye, { children:
|
|
1500
|
+
label: /* @__PURE__ */ i(ye, { children: R.editNote }),
|
|
1489
1501
|
value: D,
|
|
1490
1502
|
onChange: (g) => G(g.target.value),
|
|
1491
|
-
placeholder:
|
|
1503
|
+
placeholder: R.addNoteOptional,
|
|
1492
1504
|
textareaRef: (g) => {
|
|
1493
1505
|
se.current = g;
|
|
1494
1506
|
}
|
|
1495
1507
|
}
|
|
1496
1508
|
),
|
|
1497
|
-
/* @__PURE__ */
|
|
1498
|
-
/* @__PURE__ */ i(
|
|
1509
|
+
/* @__PURE__ */ T(I, { gap: "xx-small", children: [
|
|
1510
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1499
1511
|
ne,
|
|
1500
1512
|
{
|
|
1501
1513
|
display: "block",
|
|
@@ -1504,10 +1516,10 @@ const to = ({
|
|
|
1504
1516
|
onClick: () => {
|
|
1505
1517
|
G(r || ""), P(!1);
|
|
1506
1518
|
},
|
|
1507
|
-
children:
|
|
1519
|
+
children: R.cancel
|
|
1508
1520
|
}
|
|
1509
1521
|
) }),
|
|
1510
|
-
/* @__PURE__ */ i(
|
|
1522
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1511
1523
|
ne,
|
|
1512
1524
|
{
|
|
1513
1525
|
display: "block",
|
|
@@ -1515,9 +1527,9 @@ const to = ({
|
|
|
1515
1527
|
size: "small",
|
|
1516
1528
|
"data-testid": `note-card-${t}-save`,
|
|
1517
1529
|
onClick: () => {
|
|
1518
|
-
|
|
1530
|
+
f == null || f(t, D.trim()), P(!1);
|
|
1519
1531
|
},
|
|
1520
|
-
children:
|
|
1532
|
+
children: R.save
|
|
1521
1533
|
}
|
|
1522
1534
|
) })
|
|
1523
1535
|
] })
|
|
@@ -1529,7 +1541,7 @@ const to = ({
|
|
|
1529
1541
|
overflowWrap: "break-word",
|
|
1530
1542
|
whiteSpace: "pre-wrap"
|
|
1531
1543
|
},
|
|
1532
|
-
children:
|
|
1544
|
+
children: m && c ? /* @__PURE__ */ T(Z, { children: [
|
|
1533
1545
|
r,
|
|
1534
1546
|
" ",
|
|
1535
1547
|
/* @__PURE__ */ i(
|
|
@@ -1539,7 +1551,7 @@ const to = ({
|
|
|
1539
1551
|
withBackground: !1,
|
|
1540
1552
|
withBorder: !1,
|
|
1541
1553
|
margin: "xx-small 0 0 xxx-small",
|
|
1542
|
-
screenReaderLabel:
|
|
1554
|
+
screenReaderLabel: R.editNote,
|
|
1543
1555
|
"data-testid": `note-card-${t}-edit`,
|
|
1544
1556
|
elementRef: (g) => {
|
|
1545
1557
|
A.current = g;
|
|
@@ -1547,16 +1559,16 @@ const to = ({
|
|
|
1547
1559
|
onClick: (g) => {
|
|
1548
1560
|
g.stopPropagation(), P(!0);
|
|
1549
1561
|
},
|
|
1550
|
-
children: /* @__PURE__ */ i(
|
|
1562
|
+
children: /* @__PURE__ */ i(Oe, {})
|
|
1551
1563
|
}
|
|
1552
1564
|
)
|
|
1553
|
-
] }) : /* @__PURE__ */
|
|
1565
|
+
] }) : /* @__PURE__ */ T(Z, { children: [
|
|
1554
1566
|
ee && /* @__PURE__ */ i(ye, { children: r }),
|
|
1555
|
-
/* @__PURE__ */ i("span", { "aria-hidden": ee, style: { display: "block" }, children: /* @__PURE__ */ i(
|
|
1567
|
+
/* @__PURE__ */ i("span", { "aria-hidden": ee, style: { display: "block" }, children: /* @__PURE__ */ i(Te, { maxLines: 3, truncate: "word", onUpdate: Q, children: r }) })
|
|
1556
1568
|
] })
|
|
1557
1569
|
}
|
|
1558
|
-
) : c &&
|
|
1559
|
-
|
|
1570
|
+
) : c && m ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ T(Z, { color: "secondary", children: [
|
|
1571
|
+
R.addNotePrompt,
|
|
1560
1572
|
" ",
|
|
1561
1573
|
/* @__PURE__ */ i(
|
|
1562
1574
|
ge,
|
|
@@ -1565,7 +1577,7 @@ const to = ({
|
|
|
1565
1577
|
withBackground: !1,
|
|
1566
1578
|
withBorder: !1,
|
|
1567
1579
|
margin: "xx-small 0 0 xxx-small",
|
|
1568
|
-
screenReaderLabel:
|
|
1580
|
+
screenReaderLabel: R.editNote,
|
|
1569
1581
|
"data-testid": `note-card-${t}-edit`,
|
|
1570
1582
|
elementRef: (g) => {
|
|
1571
1583
|
A.current = g;
|
|
@@ -1573,13 +1585,13 @@ const to = ({
|
|
|
1573
1585
|
onClick: (g) => {
|
|
1574
1586
|
g.stopPropagation(), P(!0);
|
|
1575
1587
|
},
|
|
1576
|
-
children: /* @__PURE__ */ i(
|
|
1588
|
+
children: /* @__PURE__ */ i(Oe, {})
|
|
1577
1589
|
}
|
|
1578
1590
|
)
|
|
1579
1591
|
] }) }) : null,
|
|
1580
|
-
/* @__PURE__ */
|
|
1592
|
+
/* @__PURE__ */ T(I, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
|
|
1581
1593
|
/* @__PURE__ */ i(Z, { as: "div", size: "small", color: "secondary", children: Ke(e, N) }),
|
|
1582
|
-
|
|
1594
|
+
m && a && /* @__PURE__ */ i(
|
|
1583
1595
|
ge,
|
|
1584
1596
|
{
|
|
1585
1597
|
size: "small",
|
|
@@ -1587,19 +1599,19 @@ const to = ({
|
|
|
1587
1599
|
withBorder: !1,
|
|
1588
1600
|
color: "danger",
|
|
1589
1601
|
margin: "xx-small",
|
|
1590
|
-
screenReaderLabel:
|
|
1602
|
+
screenReaderLabel: R.deleteNote,
|
|
1591
1603
|
"data-testid": `note-card-${t}-delete`,
|
|
1592
1604
|
elementRef: (g) => {
|
|
1593
1605
|
ue.current = g;
|
|
1594
1606
|
},
|
|
1595
1607
|
onClick: (g) => {
|
|
1596
|
-
g.stopPropagation(),
|
|
1608
|
+
g.stopPropagation(), C.current = !1, w(!0);
|
|
1597
1609
|
},
|
|
1598
|
-
children: /* @__PURE__ */ i(
|
|
1610
|
+
children: /* @__PURE__ */ i(Se, {})
|
|
1599
1611
|
}
|
|
1600
1612
|
)
|
|
1601
1613
|
] }),
|
|
1602
|
-
|
|
1614
|
+
y && /* @__PURE__ */ T(
|
|
1603
1615
|
Z,
|
|
1604
1616
|
{
|
|
1605
1617
|
as: "div",
|
|
@@ -1607,8 +1619,8 @@ const to = ({
|
|
|
1607
1619
|
color: "secondary",
|
|
1608
1620
|
"data-testid": `note-card-${t}-course`,
|
|
1609
1621
|
children: [
|
|
1610
|
-
ae && /* @__PURE__ */ i(ye, { children:
|
|
1611
|
-
/* @__PURE__ */ i("span", { "aria-hidden": ae, style: { display: "block" }, children: /* @__PURE__ */ i(
|
|
1622
|
+
ae && /* @__PURE__ */ i(ye, { children: y }),
|
|
1623
|
+
/* @__PURE__ */ i("span", { "aria-hidden": ae, style: { display: "block" }, children: /* @__PURE__ */ i(Te, { maxLines: 1, onUpdate: de, children: y }) })
|
|
1612
1624
|
]
|
|
1613
1625
|
}
|
|
1614
1626
|
)
|
|
@@ -1616,12 +1628,12 @@ const to = ({
|
|
|
1616
1628
|
] })
|
|
1617
1629
|
}
|
|
1618
1630
|
),
|
|
1619
|
-
|
|
1620
|
-
|
|
1631
|
+
m && E && a && /* @__PURE__ */ i(
|
|
1632
|
+
Ct,
|
|
1621
1633
|
{
|
|
1622
1634
|
open: !0,
|
|
1623
1635
|
as: "div",
|
|
1624
|
-
label:
|
|
1636
|
+
label: R.deleteNoteConfirmation,
|
|
1625
1637
|
shouldContainFocus: !0,
|
|
1626
1638
|
shouldFocusOnOpen: !0,
|
|
1627
1639
|
defaultFocusElement: () => M.current,
|
|
@@ -1642,8 +1654,8 @@ const to = ({
|
|
|
1642
1654
|
insetInlineStart: "0",
|
|
1643
1655
|
insetInlineEnd: "0",
|
|
1644
1656
|
stacking: "above",
|
|
1645
|
-
children: /* @__PURE__ */
|
|
1646
|
-
|
|
1657
|
+
children: /* @__PURE__ */ T(
|
|
1658
|
+
I,
|
|
1647
1659
|
{
|
|
1648
1660
|
direction: "column",
|
|
1649
1661
|
justifyItems: "center",
|
|
@@ -1657,12 +1669,12 @@ const to = ({
|
|
|
1657
1669
|
display: "block",
|
|
1658
1670
|
color: "danger",
|
|
1659
1671
|
withBackground: !1,
|
|
1660
|
-
renderIcon: /* @__PURE__ */ i(
|
|
1672
|
+
renderIcon: /* @__PURE__ */ i(Se, {}),
|
|
1661
1673
|
"data-testid": `note-card-${t}-confirm-delete`,
|
|
1662
1674
|
onClick: (g) => {
|
|
1663
1675
|
g.stopPropagation(), a(t), w(!1);
|
|
1664
1676
|
},
|
|
1665
|
-
children:
|
|
1677
|
+
children: R.deleteNote
|
|
1666
1678
|
}
|
|
1667
1679
|
),
|
|
1668
1680
|
/* @__PURE__ */ i(
|
|
@@ -1677,7 +1689,7 @@ const to = ({
|
|
|
1677
1689
|
onClick: (g) => {
|
|
1678
1690
|
g.stopPropagation(), _();
|
|
1679
1691
|
},
|
|
1680
|
-
children:
|
|
1692
|
+
children: R.cancel
|
|
1681
1693
|
}
|
|
1682
1694
|
)
|
|
1683
1695
|
]
|
|
@@ -1690,8 +1702,8 @@ const to = ({
|
|
|
1690
1702
|
]
|
|
1691
1703
|
}
|
|
1692
1704
|
);
|
|
1693
|
-
return
|
|
1694
|
-
},
|
|
1705
|
+
return p && x ? x({ href: p, children: U, ariaLabel: O }) : U;
|
|
1706
|
+
}, oo = {
|
|
1695
1707
|
display: "grid",
|
|
1696
1708
|
gap: "1rem",
|
|
1697
1709
|
boxSizing: "border-box",
|
|
@@ -1699,7 +1711,7 @@ const to = ({
|
|
|
1699
1711
|
margin: 0,
|
|
1700
1712
|
padding: 0,
|
|
1701
1713
|
listStyle: "none"
|
|
1702
|
-
},
|
|
1714
|
+
}, Ao = ({
|
|
1703
1715
|
notes: t,
|
|
1704
1716
|
isLoading: e,
|
|
1705
1717
|
isError: n,
|
|
@@ -1708,19 +1720,19 @@ const to = ({
|
|
|
1708
1720
|
onPageChange: s,
|
|
1709
1721
|
onNoteSelect: l,
|
|
1710
1722
|
onNoteDelete: a,
|
|
1711
|
-
onNoteSave:
|
|
1723
|
+
onNoteSave: f,
|
|
1712
1724
|
onNoteTypeChange: u,
|
|
1713
|
-
onNotesEmptied:
|
|
1725
|
+
onNotesEmptied: m,
|
|
1714
1726
|
selectedNoteId: c,
|
|
1715
|
-
hasActiveFilter:
|
|
1727
|
+
hasActiveFilter: y = !1,
|
|
1716
1728
|
columnCount: N = 1,
|
|
1717
|
-
highlightTheme:
|
|
1729
|
+
highlightTheme: h,
|
|
1718
1730
|
locale: x,
|
|
1719
|
-
courseNames:
|
|
1720
|
-
renderNoteLink:
|
|
1731
|
+
courseNames: p,
|
|
1732
|
+
renderNoteLink: R,
|
|
1721
1733
|
noteHref: z
|
|
1722
1734
|
}) => {
|
|
1723
|
-
const { translations: b } = J(),
|
|
1735
|
+
const { translations: b } = J(), S = F(null), P = F(null), D = K(
|
|
1724
1736
|
(E) => {
|
|
1725
1737
|
const w = t.findIndex((j) => j.id === E);
|
|
1726
1738
|
let v = null;
|
|
@@ -1733,32 +1745,32 @@ const to = ({
|
|
|
1733
1745
|
const E = P.current;
|
|
1734
1746
|
if (E)
|
|
1735
1747
|
if (P.current = null, E.targetId === null)
|
|
1736
|
-
|
|
1748
|
+
m == null || m();
|
|
1737
1749
|
else {
|
|
1738
|
-
const v = (w =
|
|
1750
|
+
const v = (w = S.current) == null ? void 0 : w.querySelector(
|
|
1739
1751
|
`[data-testid="note-card-${E.targetId}"]`
|
|
1740
1752
|
);
|
|
1741
1753
|
v == null || v.focus();
|
|
1742
1754
|
}
|
|
1743
|
-
}, [t,
|
|
1755
|
+
}, [t, m]), e)
|
|
1744
1756
|
return /* @__PURE__ */ i(V, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ i(xt, { renderTitle: b.loadingNotes }) });
|
|
1745
1757
|
if (n)
|
|
1746
1758
|
return /* @__PURE__ */ i(V, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(ve, { level: "h4", children: b.failedToLoadNotes }) });
|
|
1747
1759
|
if (t.length === 0)
|
|
1748
|
-
return /* @__PURE__ */ i(V, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(Jn, { hasActiveFilter:
|
|
1760
|
+
return /* @__PURE__ */ i(V, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(Jn, { hasActiveFilter: y }) });
|
|
1749
1761
|
const G = typeof o == "number" && typeof r == "number" && r > 1 && s !== void 0;
|
|
1750
|
-
return /* @__PURE__ */
|
|
1762
|
+
return /* @__PURE__ */ T(Xe, { children: [
|
|
1751
1763
|
/* @__PURE__ */ i(
|
|
1752
1764
|
"ul",
|
|
1753
1765
|
{
|
|
1754
|
-
ref:
|
|
1755
|
-
style: { ...
|
|
1766
|
+
ref: S,
|
|
1767
|
+
style: { ...oo, gridTemplateColumns: `repeat(${N}, minmax(0, 1fr))` },
|
|
1756
1768
|
role: "list",
|
|
1757
1769
|
"data-testid": "notes-grid",
|
|
1758
1770
|
children: t.map((E) => {
|
|
1759
1771
|
var w;
|
|
1760
1772
|
return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
|
|
1761
|
-
|
|
1773
|
+
no,
|
|
1762
1774
|
{
|
|
1763
1775
|
noteId: E.id,
|
|
1764
1776
|
date: E.createdAt,
|
|
@@ -1770,20 +1782,20 @@ const to = ({
|
|
|
1770
1782
|
isPanelView: !!c,
|
|
1771
1783
|
onClick: l ? () => l(E.id) : void 0,
|
|
1772
1784
|
onDelete: a ? D : void 0,
|
|
1773
|
-
onSaveNote:
|
|
1785
|
+
onSaveNote: f ? (v, j) => f(v, j) : void 0,
|
|
1774
1786
|
onTypeChange: u ? (v, j) => u(v, j) : void 0,
|
|
1775
|
-
highlightTheme:
|
|
1787
|
+
highlightTheme: h,
|
|
1776
1788
|
locale: x,
|
|
1777
|
-
courseName:
|
|
1778
|
-
renderLink:
|
|
1789
|
+
courseName: p == null ? void 0 : p.get(E.courseId),
|
|
1790
|
+
renderLink: R,
|
|
1779
1791
|
href: z ? z(E.id, E) : void 0
|
|
1780
1792
|
}
|
|
1781
1793
|
) }, E.id);
|
|
1782
1794
|
})
|
|
1783
1795
|
}
|
|
1784
1796
|
),
|
|
1785
|
-
G && /* @__PURE__ */ i(
|
|
1786
|
-
|
|
1797
|
+
G && /* @__PURE__ */ i(I, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ i(I.Item, { children: /* @__PURE__ */ i(
|
|
1798
|
+
It,
|
|
1787
1799
|
{
|
|
1788
1800
|
as: "nav",
|
|
1789
1801
|
variant: "input",
|
|
@@ -1795,7 +1807,7 @@ const to = ({
|
|
|
1795
1807
|
}
|
|
1796
1808
|
) }) })
|
|
1797
1809
|
] });
|
|
1798
|
-
},
|
|
1810
|
+
}, Do = ({
|
|
1799
1811
|
noteText: t,
|
|
1800
1812
|
reaction: e,
|
|
1801
1813
|
highlightText: n,
|
|
@@ -1804,24 +1816,32 @@ const to = ({
|
|
|
1804
1816
|
onDelete: s,
|
|
1805
1817
|
onTypeChange: l,
|
|
1806
1818
|
onBack: a,
|
|
1807
|
-
editing:
|
|
1819
|
+
editing: f = !1
|
|
1808
1820
|
}) => {
|
|
1809
|
-
const { translations: u } = J(), [
|
|
1810
|
-
return /* @__PURE__ */
|
|
1811
|
-
n != null ? /* @__PURE__ */ i(V, { as: "div", children: /* @__PURE__ */ i(Z, { children: /* @__PURE__ */ i(
|
|
1812
|
-
/* @__PURE__ */ i(
|
|
1813
|
-
|
|
1821
|
+
const { translations: u } = J(), [m, c] = W(f), [y, N] = W(t || ""), [h, x] = W(!1);
|
|
1822
|
+
return /* @__PURE__ */ T(I, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1823
|
+
n != null ? /* @__PURE__ */ i(V, { as: "div", children: /* @__PURE__ */ i(Z, { children: /* @__PURE__ */ i(we, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ i(gt, {}),
|
|
1824
|
+
/* @__PURE__ */ i(
|
|
1825
|
+
ht,
|
|
1826
|
+
{
|
|
1827
|
+
type: e,
|
|
1828
|
+
onTypeChange: l,
|
|
1829
|
+
renderAsMenuTrigger: !!l,
|
|
1830
|
+
theme: o.colors
|
|
1831
|
+
}
|
|
1832
|
+
),
|
|
1833
|
+
m ? /* @__PURE__ */ T(I, { direction: "column", gap: "x-small", children: [
|
|
1814
1834
|
/* @__PURE__ */ i(
|
|
1815
1835
|
Ze,
|
|
1816
1836
|
{
|
|
1817
1837
|
label: u.addNoteOptional,
|
|
1818
|
-
value:
|
|
1819
|
-
onChange: (
|
|
1838
|
+
value: y,
|
|
1839
|
+
onChange: (p) => N(p.target.value),
|
|
1820
1840
|
resize: "vertical"
|
|
1821
1841
|
}
|
|
1822
1842
|
),
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
/* @__PURE__ */ i(
|
|
1843
|
+
/* @__PURE__ */ T(I, { gap: "xx-small", children: [
|
|
1844
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1825
1845
|
ne,
|
|
1826
1846
|
{
|
|
1827
1847
|
display: "block",
|
|
@@ -1833,7 +1853,7 @@ const to = ({
|
|
|
1833
1853
|
children: u.cancel
|
|
1834
1854
|
}
|
|
1835
1855
|
) }),
|
|
1836
|
-
/* @__PURE__ */ i(
|
|
1856
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1837
1857
|
ne,
|
|
1838
1858
|
{
|
|
1839
1859
|
display: "block",
|
|
@@ -1841,18 +1861,18 @@ const to = ({
|
|
|
1841
1861
|
size: "small",
|
|
1842
1862
|
"data-testid": "single-note-save",
|
|
1843
1863
|
onClick: () => {
|
|
1844
|
-
r(
|
|
1864
|
+
r(y), c(!1);
|
|
1845
1865
|
},
|
|
1846
1866
|
children: u.save
|
|
1847
1867
|
}
|
|
1848
1868
|
) })
|
|
1849
1869
|
] })
|
|
1850
|
-
] }) : /* @__PURE__ */
|
|
1851
|
-
t && /* @__PURE__ */
|
|
1870
|
+
] }) : /* @__PURE__ */ T(I, { direction: "column", gap: "small", children: [
|
|
1871
|
+
t && /* @__PURE__ */ T(V, { as: "div", children: [
|
|
1852
1872
|
/* @__PURE__ */ i(ve, { level: "h4", margin: "0 0 xx-small 0", children: u.note }),
|
|
1853
1873
|
/* @__PURE__ */ i(Z, { children: t })
|
|
1854
1874
|
] }),
|
|
1855
|
-
/* @__PURE__ */
|
|
1875
|
+
/* @__PURE__ */ T(I, { justifyItems: "space-between", children: [
|
|
1856
1876
|
/* @__PURE__ */ i(
|
|
1857
1877
|
ne,
|
|
1858
1878
|
{
|
|
@@ -1863,7 +1883,7 @@ const to = ({
|
|
|
1863
1883
|
children: u.back
|
|
1864
1884
|
}
|
|
1865
1885
|
),
|
|
1866
|
-
/* @__PURE__ */
|
|
1886
|
+
/* @__PURE__ */ T(I, { gap: "xx-small", children: [
|
|
1867
1887
|
s && /* @__PURE__ */ i(
|
|
1868
1888
|
ge,
|
|
1869
1889
|
{
|
|
@@ -1874,7 +1894,7 @@ const to = ({
|
|
|
1874
1894
|
screenReaderLabel: u.deleteNote,
|
|
1875
1895
|
"data-testid": "single-note-delete",
|
|
1876
1896
|
onClick: () => x(!0),
|
|
1877
|
-
children: /* @__PURE__ */ i(
|
|
1897
|
+
children: /* @__PURE__ */ i(Se, {})
|
|
1878
1898
|
}
|
|
1879
1899
|
),
|
|
1880
1900
|
/* @__PURE__ */ i(
|
|
@@ -1886,19 +1906,19 @@ const to = ({
|
|
|
1886
1906
|
screenReaderLabel: u.editNote,
|
|
1887
1907
|
"data-testid": "single-note-edit",
|
|
1888
1908
|
onClick: () => c(!0),
|
|
1889
|
-
children: /* @__PURE__ */ i(
|
|
1909
|
+
children: /* @__PURE__ */ i(Oe, {})
|
|
1890
1910
|
}
|
|
1891
1911
|
)
|
|
1892
1912
|
] })
|
|
1893
1913
|
] }),
|
|
1894
|
-
|
|
1914
|
+
h && s && /* @__PURE__ */ i(V, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ T(I, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1895
1915
|
/* @__PURE__ */ i(
|
|
1896
1916
|
ne,
|
|
1897
1917
|
{
|
|
1898
1918
|
display: "block",
|
|
1899
1919
|
color: "danger",
|
|
1900
1920
|
size: "small",
|
|
1901
|
-
renderIcon: /* @__PURE__ */ i(
|
|
1921
|
+
renderIcon: /* @__PURE__ */ i(Se, {}),
|
|
1902
1922
|
"data-testid": "single-note-confirm-delete",
|
|
1903
1923
|
onClick: () => {
|
|
1904
1924
|
s(), x(!1);
|
|
@@ -1922,18 +1942,18 @@ const to = ({
|
|
|
1922
1942
|
};
|
|
1923
1943
|
export {
|
|
1924
1944
|
wo as ContentWithNoteWrapper,
|
|
1925
|
-
|
|
1945
|
+
we as Highlight,
|
|
1926
1946
|
gt as HighlightError,
|
|
1927
|
-
|
|
1947
|
+
no as NoteCard,
|
|
1928
1948
|
ht as NoteChip,
|
|
1929
1949
|
Vn as NoteReactionMenu,
|
|
1930
1950
|
Jn as NotebookEmptyState,
|
|
1931
|
-
|
|
1951
|
+
Ro as NotebookProvider,
|
|
1932
1952
|
qn as NotebookTranslationsProvider,
|
|
1933
|
-
|
|
1934
|
-
|
|
1953
|
+
Oo as NotebookTray,
|
|
1954
|
+
Ao as NotesListView,
|
|
1935
1955
|
L as REACTION_TYPE,
|
|
1936
|
-
|
|
1956
|
+
Do as SingleNote,
|
|
1937
1957
|
Me as createTransparentColor,
|
|
1938
1958
|
mt as getHighlightUnavailableMessage,
|
|
1939
1959
|
tn as useCreateNote,
|
|
@@ -1942,6 +1962,6 @@ export {
|
|
|
1942
1962
|
ut as useNotebook,
|
|
1943
1963
|
J as useNotebookTranslations,
|
|
1944
1964
|
ko as useNotesData,
|
|
1945
|
-
|
|
1965
|
+
Lo as useReactionFilter,
|
|
1946
1966
|
rn as useUpdateNote
|
|
1947
1967
|
};
|