@instructure/platform-notebook 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NotesListView.d.ts +2 -1
- package/dist/NotesListView.d.ts.map +1 -1
- package/dist/index.js +392 -390
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { createContext as ze, useMemo as me, useContext as qe, useReducer as Ke, useRef as
|
|
1
|
+
import { jsx as i, jsxs as x, Fragment as dt } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ze, useMemo as me, useContext as qe, useReducer as Ke, useRef as F, useEffect as W, useState as j, useCallback as q } from "react";
|
|
3
3
|
import { createPortal as ut } from "react-dom";
|
|
4
4
|
import { z as f } from "zod";
|
|
5
5
|
import ft from "diff-match-patch";
|
|
6
6
|
import { useQueryClient as xe, useMutation as Re, useQuery as mt } from "@tanstack/react-query";
|
|
7
7
|
import { CloseButton as gt, Button as te, IconButton as ue } from "@instructure/ui-buttons";
|
|
8
|
-
import { Flex as
|
|
8
|
+
import { Flex as R } from "@instructure/ui-flex";
|
|
9
9
|
import { Heading as Ne } from "@instructure/ui-heading";
|
|
10
10
|
import { Tray as ht } from "@instructure/ui-tray";
|
|
11
|
-
import { View as
|
|
11
|
+
import { View as X } from "@instructure/ui-view";
|
|
12
12
|
import { IconQuestionLine as ke, IconPinLine as we, IconWarningLine as pt, IconNoteLine as yt, IconEditLine as ve, IconTrashLine as ye, IconArrowStartLine as Nt } from "@instructure/ui-icons";
|
|
13
13
|
import { Menu as ce } from "@instructure/ui-menu";
|
|
14
14
|
import { TruncateText as Ie } from "@instructure/ui-truncate-text";
|
|
@@ -35,7 +35,7 @@ const vt = f.object({
|
|
|
35
35
|
range: vt.nullable(),
|
|
36
36
|
pageLastModifiedAt: f.string()
|
|
37
37
|
});
|
|
38
|
-
var
|
|
38
|
+
var L = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(L || {});
|
|
39
39
|
const Le = f.enum([
|
|
40
40
|
"Important",
|
|
41
41
|
"Confusing"
|
|
@@ -122,17 +122,17 @@ class ne {
|
|
|
122
122
|
return o.setStart(e.node, e.offset), o.setEnd(n.node, n.offset), o;
|
|
123
123
|
}
|
|
124
124
|
static fromRange(e) {
|
|
125
|
-
const n =
|
|
125
|
+
const n = K.fromPoint(e.startContainer, e.startOffset), o = K.fromPoint(e.endContainer, e.endOffset);
|
|
126
126
|
return !n || !o ? null : new ne(n, o);
|
|
127
127
|
}
|
|
128
128
|
static fromOffsets(e, n, o) {
|
|
129
|
-
return new ne(new
|
|
129
|
+
return new ne(new K(e, n), new K(e, o));
|
|
130
130
|
}
|
|
131
131
|
relativeTo(e) {
|
|
132
132
|
return new ne(this.start.relativeTo(e), this.end.relativeTo(e));
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
class
|
|
135
|
+
class K {
|
|
136
136
|
constructor(e, n) {
|
|
137
137
|
n < 0 && console.error("Offset is invalid"), this.element = e, this.offset = n;
|
|
138
138
|
}
|
|
@@ -154,9 +154,9 @@ class X {
|
|
|
154
154
|
static fromCharOffset(e, n) {
|
|
155
155
|
switch (e.nodeType) {
|
|
156
156
|
case Node.TEXT_NODE:
|
|
157
|
-
return
|
|
157
|
+
return K.fromPoint(e, n);
|
|
158
158
|
case Node.ELEMENT_NODE:
|
|
159
|
-
return new
|
|
159
|
+
return new K(e, n);
|
|
160
160
|
default:
|
|
161
161
|
return console.error("Node is not an element or text node"), null;
|
|
162
162
|
}
|
|
@@ -169,7 +169,7 @@ class X {
|
|
|
169
169
|
if (!e.parentElement)
|
|
170
170
|
return console.error("Text node has no parent"), null;
|
|
171
171
|
const o = Ge(e) + n;
|
|
172
|
-
return new
|
|
172
|
+
return new K(e.parentElement, o);
|
|
173
173
|
}
|
|
174
174
|
case Node.ELEMENT_NODE: {
|
|
175
175
|
if (n < 0 || n > e.childNodes.length)
|
|
@@ -177,7 +177,7 @@ class X {
|
|
|
177
177
|
let o = 0;
|
|
178
178
|
for (let r = 0; r < n; r++)
|
|
179
179
|
o += Ye(e.childNodes[r]);
|
|
180
|
-
return new
|
|
180
|
+
return new K(e, o);
|
|
181
181
|
}
|
|
182
182
|
default:
|
|
183
183
|
return console.error("Point is not in an element or text node"), null;
|
|
@@ -189,7 +189,7 @@ class X {
|
|
|
189
189
|
let n = this.element, o = this.offset;
|
|
190
190
|
for (; n !== e; )
|
|
191
191
|
o += Ge(n), n.parentElement && (n = n.parentElement);
|
|
192
|
-
return new
|
|
192
|
+
return new K(n, o);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
const wt = (t) => {
|
|
@@ -269,7 +269,7 @@ class ie {
|
|
|
269
269
|
const r = He(n.endContainer, e);
|
|
270
270
|
if (!r)
|
|
271
271
|
return console.error("Failed to resolve endContainer XPath"), null;
|
|
272
|
-
const s =
|
|
272
|
+
const s = K.fromCharOffset(o, n.startOffset), l = K.fromCharOffset(r, n.endOffset);
|
|
273
273
|
if (!s || !l)
|
|
274
274
|
return null;
|
|
275
275
|
const a = new ne(s, l).toRange();
|
|
@@ -352,10 +352,10 @@ const Ye = (t) => {
|
|
|
352
352
|
const p = r.match_main(s, a, o), d = p + a.length;
|
|
353
353
|
if (c === -1 || p === -1)
|
|
354
354
|
return null;
|
|
355
|
-
const
|
|
356
|
-
if ((c > d ||
|
|
355
|
+
const h = d - c, E = Math.abs(h - m);
|
|
356
|
+
if ((c > d || E > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(s, l, d), c !== -1 && c < d))
|
|
357
357
|
return Pt(t, c, d, m);
|
|
358
|
-
if (c < d &&
|
|
358
|
+
if (c < d && E <= 5)
|
|
359
359
|
return oe.fromSelector(t, {
|
|
360
360
|
start: c,
|
|
361
361
|
end: d
|
|
@@ -428,11 +428,11 @@ const Ye = (t) => {
|
|
|
428
428
|
if (!e.length)
|
|
429
429
|
return null;
|
|
430
430
|
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, m = (y) => {
|
|
431
|
-
const
|
|
432
|
-
return y >= s &&
|
|
431
|
+
const S = y + he;
|
|
432
|
+
return y >= s && S <= l - s;
|
|
433
433
|
}, c = (y) => {
|
|
434
|
-
const
|
|
435
|
-
return y >= s &&
|
|
434
|
+
const S = y + ge;
|
|
435
|
+
return y >= s && S <= a - s;
|
|
436
436
|
};
|
|
437
437
|
let p;
|
|
438
438
|
const d = n.right - he;
|
|
@@ -443,19 +443,19 @@ const Ye = (t) => {
|
|
|
443
443
|
if (m(y))
|
|
444
444
|
p = y;
|
|
445
445
|
else {
|
|
446
|
-
const
|
|
447
|
-
m(
|
|
446
|
+
const g = (n.left + n.right) / 2 - he / 2;
|
|
447
|
+
m(g) ? p = g : d < s ? p = s : p = l - he - s;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
let
|
|
451
|
-
const
|
|
452
|
-
if (c(
|
|
453
|
-
|
|
450
|
+
let h;
|
|
451
|
+
const E = o.bottom + r;
|
|
452
|
+
if (c(E))
|
|
453
|
+
h = E;
|
|
454
454
|
else {
|
|
455
455
|
const y = n.top - ge - r;
|
|
456
|
-
c(y) ?
|
|
456
|
+
c(y) ? h = y : E + ge > a - s ? h = a - ge - s : h = s;
|
|
457
457
|
}
|
|
458
|
-
return { top:
|
|
458
|
+
return { top: h, left: p };
|
|
459
459
|
}, Ht = (t, e) => {
|
|
460
460
|
for (const n of e)
|
|
461
461
|
if (t.start < n.end && t.end > n.start)
|
|
@@ -503,44 +503,44 @@ const Ye = (t) => {
|
|
|
503
503
|
Qt(e, n);
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
|
-
const l = e.type ===
|
|
506
|
+
const l = e.type === L.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, m = a ? l : De(l, 0.5), c = e.type === L.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, p = e.type === L.IMPORTANT ? "solid" : "dashed", d = document.createElement("span");
|
|
507
507
|
d.id = `${r}-start`, d.className = "highlight-marker-start", d.dataset.highlightId = o || "";
|
|
508
|
-
const
|
|
509
|
-
d.setAttribute("role", "button"), d.setAttribute("tabindex", "0"), d.setAttribute("aria-label",
|
|
510
|
-
const
|
|
511
|
-
|
|
508
|
+
const h = e.labelPrefix ?? zt;
|
|
509
|
+
d.setAttribute("role", "button"), d.setAttribute("tabindex", "0"), d.setAttribute("aria-label", h), d.setAttribute("aria-haspopup", "dialog"), d.setAttribute("aria-expanded", String(a && !!e.isTrayOpen)), a && d.setAttribute("aria-current", "true"), e.popupId && d.setAttribute("aria-controls", e.popupId), d.style.position = "relative", d.style.fontSize = "0", d.style.lineHeight = "0", d.style.width = "0", d.style.height = "0", d.style.margin = "0", d.style.padding = "0", d.style.border = "0", d.style.outline = "none";
|
|
510
|
+
const E = document.createElement("span");
|
|
511
|
+
E.id = Ze(o), E.className = "highlight-marker-end", E.dataset.highlightId = o || "";
|
|
512
512
|
const y = t.cloneRange();
|
|
513
|
-
y.collapse(!1), y.insertNode(
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
var
|
|
521
|
-
const
|
|
522
|
-
if ((
|
|
523
|
-
const
|
|
524
|
-
let
|
|
525
|
-
|
|
526
|
-
const
|
|
527
|
-
|
|
513
|
+
y.collapse(!1), y.insertNode(E);
|
|
514
|
+
const S = t.cloneRange();
|
|
515
|
+
S.collapse(!0), S.insertNode(d);
|
|
516
|
+
const g = document.createRange();
|
|
517
|
+
g.setStartAfter(d), g.setEndBefore(E);
|
|
518
|
+
const G = Kt(g).filter((N) => N.textContent && N.textContent.length > 0);
|
|
519
|
+
G.forEach((N, C) => {
|
|
520
|
+
var _;
|
|
521
|
+
const D = N.parentElement;
|
|
522
|
+
if ((D == null ? void 0 : D.dataset.highlightId) === o) return;
|
|
523
|
+
const M = C === 0, P = C === G.length - 1, T = G.length === 1;
|
|
524
|
+
let A;
|
|
525
|
+
T ? A = "single" : M ? A = "first" : P ? A = "last" : A = "middle";
|
|
526
|
+
const v = document.createElement("span");
|
|
527
|
+
v.className = "highlight-content", v.dataset.highlightId = o || "", v.dataset.position = A, v.style.textDecorationLine = "underline", v.style.textDecorationColor = c, v.style.textDecorationStyle = p, v.style.textDecorationThickness = n.borderWidthSmall, v.style.textUnderlineOffset = n.underlineOffset, v.style.cursor = "pointer", et(v, a, m, c, p), v.addEventListener("click", (z) => {
|
|
528
528
|
var Y;
|
|
529
|
-
|
|
530
|
-
}), (
|
|
529
|
+
z.target.tagName !== "A" && ((Y = e.onClick) == null || Y.call(e));
|
|
530
|
+
}), (_ = N.parentNode) == null || _.insertBefore(v, N), v.appendChild(N);
|
|
531
531
|
}), d.addEventListener("click", (N) => {
|
|
532
|
-
var
|
|
533
|
-
N.target.tagName !== "A" && ((
|
|
532
|
+
var C;
|
|
533
|
+
N.target.tagName !== "A" && ((C = e.onClick) == null || C.call(e));
|
|
534
534
|
}), d.addEventListener("keydown", (N) => {
|
|
535
|
-
var
|
|
535
|
+
var C;
|
|
536
536
|
if (N.key === "Enter" || N.key === " ")
|
|
537
|
-
N.preventDefault(), (
|
|
537
|
+
N.preventDefault(), (C = e.onClick) == null || C.call(e);
|
|
538
538
|
else if (N.key === "Tab" && !N.shiftKey) {
|
|
539
|
-
const
|
|
540
|
-
for (const
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
543
|
-
N.preventDefault(),
|
|
539
|
+
const D = document.querySelectorAll(fe(o));
|
|
540
|
+
for (const M of D) {
|
|
541
|
+
const P = M.querySelector("a");
|
|
542
|
+
if (P) {
|
|
543
|
+
N.preventDefault(), P.focus();
|
|
544
544
|
break;
|
|
545
545
|
}
|
|
546
546
|
}
|
|
@@ -548,19 +548,19 @@ const Ye = (t) => {
|
|
|
548
548
|
}), d.addEventListener("focus", () => {
|
|
549
549
|
document.querySelectorAll(
|
|
550
550
|
`.highlight-content${fe(o)}`
|
|
551
|
-
).forEach((
|
|
552
|
-
|
|
551
|
+
).forEach((C) => {
|
|
552
|
+
C.style.boxShadow = `0 0 0 ${Gt} ${n.colors.focusOutline}`, C.style.borderRadius = Ut;
|
|
553
553
|
});
|
|
554
554
|
}), d.addEventListener("blur", () => {
|
|
555
555
|
document.querySelectorAll(
|
|
556
556
|
`.highlight-content${fe(o)}`
|
|
557
|
-
).forEach((
|
|
558
|
-
|
|
557
|
+
).forEach((C) => {
|
|
558
|
+
C.style.boxShadow = "", C.style.borderRadius = C.dataset.selected ? Je : "";
|
|
559
559
|
});
|
|
560
560
|
});
|
|
561
561
|
};
|
|
562
562
|
function Qt(t, e) {
|
|
563
|
-
const n = t.type ===
|
|
563
|
+
const n = t.type === L.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, o = t.id === t.selectedNoteId, r = o ? n : De(n, 0.5), s = t.type === L.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline, l = t.type === L.IMPORTANT ? "solid" : "dashed";
|
|
564
564
|
document.querySelectorAll(
|
|
565
565
|
`.highlight-content${fe(t.id ?? "")}`
|
|
566
566
|
).forEach((c) => {
|
|
@@ -763,7 +763,7 @@ function Eo({
|
|
|
763
763
|
translate: c,
|
|
764
764
|
children: p
|
|
765
765
|
}) {
|
|
766
|
-
const [d,
|
|
766
|
+
const [d, h] = Ke(Un, Gn(a)), E = F(a != null), y = me(
|
|
767
767
|
() => ({
|
|
768
768
|
api: t,
|
|
769
769
|
currentUserId: e,
|
|
@@ -772,14 +772,14 @@ function Eo({
|
|
|
772
772
|
courseId: r,
|
|
773
773
|
pageLastModifiedAt: s,
|
|
774
774
|
...d,
|
|
775
|
-
selectNote: (
|
|
776
|
-
clearSelectedNote: () =>
|
|
777
|
-
setEditing: (
|
|
775
|
+
selectNote: (S, g = !1) => h({ type: "SELECT_NOTE", payload: { id: S, isEditing: g } }),
|
|
776
|
+
clearSelectedNote: () => h({ type: "CLEAR_SELECTED_NOTE" }),
|
|
777
|
+
setEditing: (S) => h({ type: "SET_EDITING", payload: S }),
|
|
778
778
|
openTray: () => {
|
|
779
|
-
|
|
779
|
+
E.current || (E.current = !0, l == null || l()), h({ type: "OPEN_TRAY" });
|
|
780
780
|
},
|
|
781
781
|
closeTray: () => {
|
|
782
|
-
|
|
782
|
+
E.current = !1, h({ type: "CLOSE_TRAY" });
|
|
783
783
|
}
|
|
784
784
|
}),
|
|
785
785
|
[t, e, n, o, r, s, l, d]
|
|
@@ -802,8 +802,8 @@ const lt = "notebook-tray-content", So = ({ children: t }) => {
|
|
|
802
802
|
onDismiss: n,
|
|
803
803
|
placement: "end",
|
|
804
804
|
size: "regular",
|
|
805
|
-
children: /* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */ i(
|
|
805
|
+
children: /* @__PURE__ */ x(R, { direction: "column", height: "100vh", id: lt, children: [
|
|
806
|
+
/* @__PURE__ */ i(R.Item, { children: /* @__PURE__ */ i(X, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ x(R, { justifyItems: "space-between", alignItems: "center", children: [
|
|
807
807
|
/* @__PURE__ */ i(Ne, { level: "h3", children: o.notebook }),
|
|
808
808
|
/* @__PURE__ */ i(
|
|
809
809
|
gt,
|
|
@@ -815,16 +815,16 @@ const lt = "notebook-tray-content", So = ({ children: t }) => {
|
|
|
815
815
|
}
|
|
816
816
|
)
|
|
817
817
|
] }) }) }),
|
|
818
|
-
/* @__PURE__ */ i(
|
|
818
|
+
/* @__PURE__ */ i(R.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
|
|
819
819
|
] })
|
|
820
820
|
}
|
|
821
821
|
);
|
|
822
822
|
}, jn = ({ currentType: t, onSelectReaction: e }) => {
|
|
823
|
-
const { translations: n } = V(), o =
|
|
824
|
-
return
|
|
825
|
-
t ===
|
|
823
|
+
const { translations: n } = V(), o = F(null), r = F(null);
|
|
824
|
+
return W(() => {
|
|
825
|
+
t === L.CONFUSING && o.current ? o.current.focus() : t === L.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
|
|
826
826
|
}, [t]), /* @__PURE__ */ i(
|
|
827
|
-
|
|
827
|
+
X,
|
|
828
828
|
{
|
|
829
829
|
as: "div",
|
|
830
830
|
background: "primary",
|
|
@@ -832,23 +832,23 @@ const lt = "notebook-tray-content", So = ({ children: t }) => {
|
|
|
832
832
|
borderColor: "secondary",
|
|
833
833
|
borderRadius: "medium",
|
|
834
834
|
shadow: "resting",
|
|
835
|
-
children: /* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */
|
|
835
|
+
children: /* @__PURE__ */ x(ce, { children: [
|
|
836
|
+
/* @__PURE__ */ x(
|
|
837
837
|
ce.Item,
|
|
838
838
|
{
|
|
839
839
|
ref: o,
|
|
840
|
-
onClick: () => e(
|
|
840
|
+
onClick: () => e(L.CONFUSING),
|
|
841
841
|
children: [
|
|
842
842
|
/* @__PURE__ */ i(ke, { size: "x-small" }),
|
|
843
843
|
` ${n.markUnclear}`
|
|
844
844
|
]
|
|
845
845
|
}
|
|
846
846
|
),
|
|
847
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ x(
|
|
848
848
|
ce.Item,
|
|
849
849
|
{
|
|
850
850
|
ref: r,
|
|
851
|
-
onClick: () => e(
|
|
851
|
+
onClick: () => e(L.IMPORTANT),
|
|
852
852
|
children: [
|
|
853
853
|
/* @__PURE__ */ i(we, { size: "x-small" }),
|
|
854
854
|
` ${n.markImportant}`
|
|
@@ -874,158 +874,158 @@ function To({
|
|
|
874
874
|
objectType: c,
|
|
875
875
|
courseId: p,
|
|
876
876
|
pageLastModifiedAt: d,
|
|
877
|
-
selectedNoteId:
|
|
878
|
-
isTrayOpen:
|
|
877
|
+
selectedNoteId: h,
|
|
878
|
+
isTrayOpen: E,
|
|
879
879
|
selectNote: y,
|
|
880
|
-
openTray:
|
|
881
|
-
} = it(), { translations:
|
|
880
|
+
openTray: S
|
|
881
|
+
} = it(), { translations: g } = V(), { data: Q } = nt({
|
|
882
882
|
api: a,
|
|
883
883
|
courseId: p,
|
|
884
884
|
learningObject: { type: c, id: m }
|
|
885
|
-
}), { mutate:
|
|
886
|
-
re.current =
|
|
887
|
-
const [Z, J] =
|
|
888
|
-
|
|
889
|
-
const
|
|
890
|
-
if (!
|
|
891
|
-
const I =
|
|
885
|
+
}), { mutate: G } = Vt(a), { mutateAsync: N } = en(a), { mutate: C } = Zt(a), D = F([]), [M, P] = j([]), [T, A] = j(null), [v, _] = j(""), [z, Y] = j(null), re = F(null);
|
|
886
|
+
re.current = z;
|
|
887
|
+
const [Z, J] = j(!1);
|
|
888
|
+
W(() => {
|
|
889
|
+
const k = t.current;
|
|
890
|
+
if (!k) return;
|
|
891
|
+
const I = k.closest(".user_content") ?? k;
|
|
892
892
|
if (I.classList.contains("enhanced")) {
|
|
893
893
|
J(!0);
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
896
|
-
const
|
|
897
|
-
for (const
|
|
898
|
-
if (
|
|
899
|
-
J(!0),
|
|
896
|
+
const B = new MutationObserver((u) => {
|
|
897
|
+
for (const b of u)
|
|
898
|
+
if (b.type === "attributes" && b.attributeName === "class" && b.target.classList.contains("enhanced")) {
|
|
899
|
+
J(!0), B.disconnect();
|
|
900
900
|
return;
|
|
901
901
|
}
|
|
902
902
|
});
|
|
903
|
-
return
|
|
903
|
+
return B.observe(I, { attributes: !0, attributeFilter: ["class"] }), () => B.disconnect();
|
|
904
904
|
}, [t]);
|
|
905
|
-
const
|
|
906
|
-
Y(null),
|
|
905
|
+
const U = q(() => {
|
|
906
|
+
Y(null), A(null), _("");
|
|
907
907
|
}, []);
|
|
908
|
-
|
|
908
|
+
W(() => {
|
|
909
909
|
if (!Z || !t.current) return;
|
|
910
910
|
let I = null;
|
|
911
|
-
const
|
|
911
|
+
const B = () => {
|
|
912
912
|
I && clearTimeout(I), I = setTimeout(() => {
|
|
913
913
|
var Fe;
|
|
914
|
-
const
|
|
915
|
-
if (!(
|
|
916
|
-
const le =
|
|
914
|
+
const O = window.getSelection(), H = t.current;
|
|
915
|
+
if (!(O != null && O.rangeCount) || !H) return;
|
|
916
|
+
const le = O.toString().trim();
|
|
917
917
|
if (le === "") return;
|
|
918
|
-
const ae =
|
|
918
|
+
const ae = O.getRangeAt(0);
|
|
919
919
|
if (!H.contains(ae.commonAncestorContainer)) return;
|
|
920
920
|
const _e = (Fe = oe.fromRange(H, ae)) == null ? void 0 : Fe.toSelector();
|
|
921
|
-
_e && !Ht(_e,
|
|
921
|
+
_e && !Ht(_e, M) && (A(ae.cloneRange()), _(le), Y($t(ae)));
|
|
922
922
|
}, n);
|
|
923
|
-
}, u = (
|
|
924
|
-
if (!(
|
|
923
|
+
}, u = (O) => {
|
|
924
|
+
if (!(O.target instanceof Node)) return;
|
|
925
925
|
const H = document.getElementById(Se);
|
|
926
|
-
H != null && H.contains(
|
|
927
|
-
},
|
|
928
|
-
|
|
929
|
-
},
|
|
930
|
-
|
|
926
|
+
H != null && H.contains(O.target) ? (O.preventDefault(), O.stopImmediatePropagation()) : U();
|
|
927
|
+
}, b = () => {
|
|
928
|
+
U();
|
|
929
|
+
}, w = (O) => {
|
|
930
|
+
O.key === "Escape" && re.current !== null && (U(), O.stopImmediatePropagation());
|
|
931
931
|
};
|
|
932
|
-
return document.addEventListener("selectionchange",
|
|
933
|
-
I && clearTimeout(I), document.removeEventListener("selectionchange",
|
|
932
|
+
return document.addEventListener("selectionchange", B), document.addEventListener("mousedown", u), document.addEventListener("touchstart", u), document.addEventListener("keydown", w), window.addEventListener("scroll", b, !0), () => {
|
|
933
|
+
I && clearTimeout(I), document.removeEventListener("selectionchange", B), document.removeEventListener("mousedown", u), document.removeEventListener("touchstart", u), document.removeEventListener("keydown", w), window.removeEventListener("scroll", b, !0);
|
|
934
934
|
};
|
|
935
|
-
}, [Z,
|
|
936
|
-
const se =
|
|
937
|
-
(
|
|
935
|
+
}, [Z, M, n, t, U]);
|
|
936
|
+
const se = q(
|
|
937
|
+
(k) => {
|
|
938
938
|
var H;
|
|
939
939
|
const I = t.current;
|
|
940
|
-
if (!I || !
|
|
941
|
-
const { highlightData:
|
|
942
|
-
if (
|
|
943
|
-
const le = u[0] ===
|
|
944
|
-
id:
|
|
945
|
-
selectedNoteId:
|
|
940
|
+
if (!I || !k.highlightData) return null;
|
|
941
|
+
const { highlightData: B, reaction: u, id: b } = k, { range: w } = B, O = w && ((H = ie.fromSelector(I, w)) == null ? void 0 : H.toRange());
|
|
942
|
+
if (O) {
|
|
943
|
+
const le = u[0] === L.IMPORTANT ? g.important : g.unclear, ae = {
|
|
944
|
+
id: b,
|
|
945
|
+
selectedNoteId: h,
|
|
946
946
|
type: u[0],
|
|
947
|
-
isTrayOpen:
|
|
948
|
-
labelPrefix: `${
|
|
947
|
+
isTrayOpen: E,
|
|
948
|
+
labelPrefix: `${g.notebookNote} (${le})`,
|
|
949
949
|
popupId: lt,
|
|
950
950
|
onClick: () => {
|
|
951
|
-
y(
|
|
951
|
+
y(b), S();
|
|
952
952
|
}
|
|
953
953
|
};
|
|
954
|
-
return Xt(
|
|
954
|
+
return Xt(O, ae, e), B.textPosition;
|
|
955
955
|
}
|
|
956
956
|
return null;
|
|
957
957
|
},
|
|
958
|
-
[t,
|
|
958
|
+
[t, h, E, e, g, y, S]
|
|
959
959
|
);
|
|
960
|
-
|
|
961
|
-
if (!Z || !
|
|
962
|
-
const
|
|
960
|
+
W(() => {
|
|
961
|
+
if (!Z || !Q || !t.current) return;
|
|
962
|
+
const k = t.current, I = Q.notes, B = /* @__PURE__ */ new Set(), u = [], b = [];
|
|
963
963
|
if (I.length === 0) {
|
|
964
|
-
if (
|
|
965
|
-
for (const
|
|
966
|
-
Ue(
|
|
967
|
-
|
|
964
|
+
if (D.current.length > 0) {
|
|
965
|
+
for (const w of D.current)
|
|
966
|
+
Ue(w, k);
|
|
967
|
+
D.current = [], P([]);
|
|
968
968
|
}
|
|
969
969
|
return;
|
|
970
970
|
}
|
|
971
971
|
if (d && I[0].highlightData.pageLastModifiedAt !== d) {
|
|
972
|
-
const { notesForUpdate:
|
|
973
|
-
|
|
972
|
+
const { notesForUpdate: w, noteIdsForDelete: O } = Mt(
|
|
973
|
+
k,
|
|
974
974
|
I,
|
|
975
975
|
d
|
|
976
976
|
);
|
|
977
|
-
for (const H of
|
|
977
|
+
for (const H of w)
|
|
978
978
|
N({ id: H.id, input: H }).catch((le) => r == null ? void 0 : r(le));
|
|
979
|
-
for (const H of
|
|
980
|
-
|
|
979
|
+
for (const H of O)
|
|
980
|
+
C(H, { onError: s });
|
|
981
981
|
} else {
|
|
982
|
-
for (const
|
|
983
|
-
const
|
|
984
|
-
|
|
982
|
+
for (const w of I) {
|
|
983
|
+
const O = se(w);
|
|
984
|
+
B.add(w.id), O && (u.push(w), b.push(O));
|
|
985
985
|
}
|
|
986
|
-
for (const
|
|
987
|
-
|
|
988
|
-
b
|
|
986
|
+
for (const w of D.current)
|
|
987
|
+
B.has(w.id) || Ue(w, k);
|
|
988
|
+
P(b), D.current = u, h && Bt(h);
|
|
989
989
|
}
|
|
990
990
|
}, [
|
|
991
991
|
Z,
|
|
992
|
-
|
|
992
|
+
Q,
|
|
993
993
|
se,
|
|
994
994
|
d,
|
|
995
995
|
t,
|
|
996
996
|
N,
|
|
997
|
-
|
|
998
|
-
|
|
997
|
+
C,
|
|
998
|
+
h
|
|
999
999
|
]);
|
|
1000
|
-
const $ = (
|
|
1000
|
+
const $ = (k) => {
|
|
1001
1001
|
const I = t.current;
|
|
1002
|
-
if (!
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1002
|
+
if (!T || !I) return;
|
|
1003
|
+
const B = ie.fromRange(I, T), u = oe.fromRange(I, T);
|
|
1004
|
+
G(
|
|
1005
1005
|
{
|
|
1006
1006
|
courseId: p,
|
|
1007
1007
|
objectId: m,
|
|
1008
1008
|
objectType: c,
|
|
1009
1009
|
userText: "",
|
|
1010
|
-
reaction: [
|
|
1010
|
+
reaction: [k],
|
|
1011
1011
|
highlightData: {
|
|
1012
|
-
selectedText:
|
|
1012
|
+
selectedText: v,
|
|
1013
1013
|
textPosition: (u == null ? void 0 : u.toSelector()) ?? null,
|
|
1014
|
-
range:
|
|
1014
|
+
range: B.toSelector(),
|
|
1015
1015
|
pageLastModifiedAt: d ?? ""
|
|
1016
1016
|
}
|
|
1017
1017
|
},
|
|
1018
1018
|
{
|
|
1019
|
-
onSuccess: (
|
|
1020
|
-
var
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1019
|
+
onSuccess: (b) => {
|
|
1020
|
+
var O;
|
|
1021
|
+
const w = b.id;
|
|
1022
|
+
U(), (O = window.getSelection()) == null || O.removeAllRanges(), y(w), S(), l == null || l(b);
|
|
1023
1023
|
},
|
|
1024
1024
|
onError: o
|
|
1025
1025
|
}
|
|
1026
1026
|
);
|
|
1027
1027
|
};
|
|
1028
|
-
return !
|
|
1028
|
+
return !T || !z ? null : ut(
|
|
1029
1029
|
/* @__PURE__ */ i(
|
|
1030
1030
|
"div",
|
|
1031
1031
|
{
|
|
@@ -1034,13 +1034,13 @@ function To({
|
|
|
1034
1034
|
style: {
|
|
1035
1035
|
position: "fixed",
|
|
1036
1036
|
zIndex: 100,
|
|
1037
|
-
top:
|
|
1038
|
-
left:
|
|
1037
|
+
top: z.top,
|
|
1038
|
+
left: z.left,
|
|
1039
1039
|
whiteSpace: "nowrap"
|
|
1040
1040
|
},
|
|
1041
|
-
onBlur: (
|
|
1041
|
+
onBlur: (k) => {
|
|
1042
1042
|
const I = document.getElementById(Se);
|
|
1043
|
-
I != null && I.contains(
|
|
1043
|
+
I != null && I.contains(k.relatedTarget) || U();
|
|
1044
1044
|
},
|
|
1045
1045
|
children: /* @__PURE__ */ i(jn, { onSelectReaction: $ })
|
|
1046
1046
|
}
|
|
@@ -1049,12 +1049,12 @@ function To({
|
|
|
1049
1049
|
);
|
|
1050
1050
|
}
|
|
1051
1051
|
const Wn = (t, e) => ({
|
|
1052
|
-
backgroundColor: t ===
|
|
1053
|
-
underlineColor: t ===
|
|
1054
|
-
underlineStyle: t ===
|
|
1052
|
+
backgroundColor: t === L.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
1053
|
+
underlineColor: t === L.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
1054
|
+
underlineStyle: t === L.IMPORTANT ? "solid" : "dashed"
|
|
1055
1055
|
}), Ce = ({
|
|
1056
1056
|
children: t,
|
|
1057
|
-
type: e =
|
|
1057
|
+
type: e = L.IMPORTANT,
|
|
1058
1058
|
isCardActive: n = !0,
|
|
1059
1059
|
theme: o
|
|
1060
1060
|
}) => {
|
|
@@ -1071,9 +1071,9 @@ const Wn = (t, e) => ({
|
|
|
1071
1071
|
return /* @__PURE__ */ i("span", { "data-note-highlight": "true", style: l, children: t });
|
|
1072
1072
|
}, at = () => {
|
|
1073
1073
|
const { translations: t } = V();
|
|
1074
|
-
return /* @__PURE__ */
|
|
1075
|
-
/* @__PURE__ */ i(
|
|
1076
|
-
/* @__PURE__ */ i(
|
|
1074
|
+
return /* @__PURE__ */ x(R, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1075
|
+
/* @__PURE__ */ i(R.Item, { as: "div", children: /* @__PURE__ */ i(pt, { color: "error" }) }),
|
|
1076
|
+
/* @__PURE__ */ i(R.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ i(Ie, { maxLines: 3, children: t.highlightUnavailable }) })
|
|
1077
1077
|
] });
|
|
1078
1078
|
}, zn = {
|
|
1079
1079
|
filter: null,
|
|
@@ -1119,80 +1119,80 @@ function vo({
|
|
|
1119
1119
|
}) {
|
|
1120
1120
|
var se;
|
|
1121
1121
|
const [l, a] = Ke(qn, zn), { filter: m, courseFilter: c, currentPage: p, totalPages: d } = l;
|
|
1122
|
-
|
|
1122
|
+
W(() => {
|
|
1123
1123
|
a({ type: "SET_PAGE", payload: 1 });
|
|
1124
1124
|
}, [r]);
|
|
1125
|
-
const
|
|
1126
|
-
...
|
|
1125
|
+
const h = n ? c : e, E = (p - 1) * r, y = !!o, S = {
|
|
1126
|
+
...h ? { courseId: h } : {},
|
|
1127
1127
|
...m ? { reactions: [m] } : {},
|
|
1128
1128
|
...o ? { learningObject: o } : {}
|
|
1129
1129
|
}, {
|
|
1130
|
-
data:
|
|
1131
|
-
isLoading:
|
|
1132
|
-
isError:
|
|
1130
|
+
data: g,
|
|
1131
|
+
isLoading: Q,
|
|
1132
|
+
isError: G
|
|
1133
1133
|
} = tt({
|
|
1134
1134
|
api: t,
|
|
1135
|
-
filter:
|
|
1136
|
-
offset:
|
|
1135
|
+
filter: S,
|
|
1136
|
+
offset: E,
|
|
1137
1137
|
pageSize: r,
|
|
1138
1138
|
enabled: !y
|
|
1139
1139
|
}), {
|
|
1140
1140
|
data: N,
|
|
1141
|
-
isLoading:
|
|
1142
|
-
isError:
|
|
1141
|
+
isLoading: C,
|
|
1142
|
+
isError: D
|
|
1143
1143
|
} = nt({
|
|
1144
1144
|
api: t,
|
|
1145
|
-
courseId:
|
|
1145
|
+
courseId: h ?? void 0,
|
|
1146
1146
|
learningObject: o,
|
|
1147
1147
|
enabled: y
|
|
1148
|
-
}),
|
|
1148
|
+
}), M = me(() => {
|
|
1149
1149
|
const $ = (N == null ? void 0 : N.notes) ?? [];
|
|
1150
|
-
return m ? $.filter((
|
|
1151
|
-
}, [N, m]),
|
|
1152
|
-
|
|
1150
|
+
return m ? $.filter((k) => k.reaction.includes(m)) : $;
|
|
1151
|
+
}, [N, m]), P = F(null);
|
|
1152
|
+
W(() => {
|
|
1153
1153
|
if (!s) {
|
|
1154
|
-
|
|
1154
|
+
P.current = null;
|
|
1155
1155
|
return;
|
|
1156
1156
|
}
|
|
1157
|
-
if (
|
|
1158
|
-
const $ =
|
|
1157
|
+
if (P.current === s) return;
|
|
1158
|
+
const $ = M.findIndex((I) => I.id === s);
|
|
1159
1159
|
if ($ === -1) return;
|
|
1160
|
-
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
}, [s,
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
a({ type: "SET_TOTAL_PAGES", payload:
|
|
1167
|
-
}, [
|
|
1168
|
-
const Y =
|
|
1160
|
+
P.current = s;
|
|
1161
|
+
const k = Math.floor($ / r) + 1;
|
|
1162
|
+
k !== p && a({ type: "FOCUS_PAGE", payload: k });
|
|
1163
|
+
}, [s, M, r, p]);
|
|
1164
|
+
const T = y ? M.slice(E, E + r) : (g == null ? void 0 : g.notes) ?? [], A = y ? C : Q, v = y ? D : G, _ = y ? Math.max(1, Math.ceil(M.length / r)) : ((se = g == null ? void 0 : g.pageInfo) == null ? void 0 : se.totalNrOfPages) ?? void 0, z = y ? { totalCount: M.length, totalNrOfPages: _ } : g == null ? void 0 : g.pageInfo;
|
|
1165
|
+
W(() => {
|
|
1166
|
+
a({ type: "SET_TOTAL_PAGES", payload: _ });
|
|
1167
|
+
}, [_]);
|
|
1168
|
+
const Y = q(($) => {
|
|
1169
1169
|
a({ type: "SET_PAGE", payload: $ });
|
|
1170
|
-
}, []), re =
|
|
1170
|
+
}, []), re = q(() => {
|
|
1171
1171
|
a({
|
|
1172
1172
|
type: "INCREMENT_PAGE"
|
|
1173
1173
|
/* IncrementPage */
|
|
1174
1174
|
});
|
|
1175
|
-
}, []), Z =
|
|
1175
|
+
}, []), Z = q(() => {
|
|
1176
1176
|
a({
|
|
1177
1177
|
type: "DECREMENT_PAGE"
|
|
1178
1178
|
/* DecrementPage */
|
|
1179
1179
|
});
|
|
1180
|
-
}, []), J =
|
|
1180
|
+
}, []), J = q(($) => {
|
|
1181
1181
|
a({ type: "SET_FILTER", payload: $ });
|
|
1182
|
-
}, []),
|
|
1182
|
+
}, []), U = q(($) => {
|
|
1183
1183
|
a({ type: "SET_COURSE_FILTER", payload: $ });
|
|
1184
1184
|
}, []);
|
|
1185
1185
|
return {
|
|
1186
|
-
notes:
|
|
1187
|
-
pageInfo:
|
|
1188
|
-
isLoading:
|
|
1189
|
-
isError:
|
|
1186
|
+
notes: T,
|
|
1187
|
+
pageInfo: z,
|
|
1188
|
+
isLoading: A,
|
|
1189
|
+
isError: v,
|
|
1190
1190
|
filter: m,
|
|
1191
1191
|
courseFilter: c,
|
|
1192
1192
|
currentPage: p,
|
|
1193
1193
|
totalPages: d,
|
|
1194
1194
|
setFilter: J,
|
|
1195
|
-
setCourseFilter:
|
|
1195
|
+
setCourseFilter: U,
|
|
1196
1196
|
setPage: Y,
|
|
1197
1197
|
fetchNextPage: re,
|
|
1198
1198
|
fetchPreviousPage: Z
|
|
@@ -1203,11 +1203,11 @@ function Io({ filter: t, setFilter: e }) {
|
|
|
1203
1203
|
const { translations: n } = V(), o = me(
|
|
1204
1204
|
() => [
|
|
1205
1205
|
{ label: n.allNotes, value: Te },
|
|
1206
|
-
{ label: n.important, value:
|
|
1207
|
-
{ label: n.unclear, value:
|
|
1206
|
+
{ label: n.important, value: L.IMPORTANT },
|
|
1207
|
+
{ label: n.unclear, value: L.CONFUSING }
|
|
1208
1208
|
],
|
|
1209
1209
|
[n]
|
|
1210
|
-
), r =
|
|
1210
|
+
), r = q(
|
|
1211
1211
|
(l, { value: a }) => {
|
|
1212
1212
|
e(!a || a === Te ? null : a);
|
|
1213
1213
|
},
|
|
@@ -1232,46 +1232,46 @@ function Io({ filter: t, setFilter: e }) {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
1234
1234
|
const { translations: e } = V(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1235
|
-
return /* @__PURE__ */ i(
|
|
1235
|
+
return /* @__PURE__ */ i(X, { as: "div", textAlign: "center", children: /* @__PURE__ */ x(R, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1236
1236
|
!t && /* @__PURE__ */ i(yt, { size: "medium" }),
|
|
1237
1237
|
/* @__PURE__ */ i(Ne, { level: "h3", children: n }),
|
|
1238
1238
|
/* @__PURE__ */ i(ee, { color: "secondary", children: o })
|
|
1239
1239
|
] }) });
|
|
1240
1240
|
}, Xn = {
|
|
1241
|
-
[
|
|
1241
|
+
[L.IMPORTANT]: {
|
|
1242
1242
|
color: "success",
|
|
1243
1243
|
translationKey: "important",
|
|
1244
1244
|
icon: /* @__PURE__ */ i(we, { size: "x-small" })
|
|
1245
1245
|
},
|
|
1246
|
-
[
|
|
1246
|
+
[L.CONFUSING]: {
|
|
1247
1247
|
color: "danger",
|
|
1248
1248
|
translationKey: "unclear",
|
|
1249
1249
|
icon: /* @__PURE__ */ i(ke, { size: "x-small" })
|
|
1250
1250
|
}
|
|
1251
1251
|
}, ct = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
|
|
1252
|
-
const { translations: o } = V(), r = Xn[t], s = o[r.translationKey], [l, a] =
|
|
1253
|
-
(
|
|
1254
|
-
e == null || e(
|
|
1252
|
+
const { translations: o } = V(), r = Xn[t], s = o[r.translationKey], [l, a] = j(!1), m = F(null), c = F(null), p = F(null), d = q(
|
|
1253
|
+
(h) => {
|
|
1254
|
+
e == null || e(h), a(!1);
|
|
1255
1255
|
},
|
|
1256
1256
|
[e]
|
|
1257
1257
|
);
|
|
1258
|
-
return
|
|
1258
|
+
return W(() => {
|
|
1259
1259
|
if (!l) return;
|
|
1260
|
-
const
|
|
1260
|
+
const h = (y) => {
|
|
1261
1261
|
y.key === "Escape" && y.stopPropagation();
|
|
1262
|
-
},
|
|
1263
|
-
var
|
|
1264
|
-
y.key === "Escape" && (y.stopPropagation(), a(!1), (
|
|
1262
|
+
}, E = (y) => {
|
|
1263
|
+
var S;
|
|
1264
|
+
y.key === "Escape" && (y.stopPropagation(), a(!1), (S = p.current) == null || S.focus());
|
|
1265
1265
|
};
|
|
1266
|
-
return document.addEventListener("keydown",
|
|
1267
|
-
document.removeEventListener("keydown",
|
|
1266
|
+
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup", E, !0), () => {
|
|
1267
|
+
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup", E, !0);
|
|
1268
1268
|
};
|
|
1269
|
-
}, [l]), n && e ? /* @__PURE__ */
|
|
1269
|
+
}, [l]), n && e ? /* @__PURE__ */ x(
|
|
1270
1270
|
ce,
|
|
1271
1271
|
{
|
|
1272
1272
|
placement: "bottom start",
|
|
1273
1273
|
show: l,
|
|
1274
|
-
onToggle: (
|
|
1274
|
+
onToggle: (h) => a(h),
|
|
1275
1275
|
shouldHideOnSelect: !0,
|
|
1276
1276
|
shouldFocusTriggerOnClose: !0,
|
|
1277
1277
|
trigger: /* @__PURE__ */ i(
|
|
@@ -1279,24 +1279,24 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1279
1279
|
{
|
|
1280
1280
|
color: r.color,
|
|
1281
1281
|
renderIcon: r.icon,
|
|
1282
|
-
elementRef: (
|
|
1283
|
-
p.current =
|
|
1282
|
+
elementRef: (h) => {
|
|
1283
|
+
p.current = h;
|
|
1284
1284
|
},
|
|
1285
1285
|
children: s
|
|
1286
1286
|
}
|
|
1287
1287
|
),
|
|
1288
1288
|
children: [
|
|
1289
|
-
/* @__PURE__ */
|
|
1289
|
+
/* @__PURE__ */ x(ce.Item, { ref: m, onClick: () => d(L.CONFUSING), children: [
|
|
1290
1290
|
/* @__PURE__ */ i(ke, { size: "x-small" }),
|
|
1291
1291
|
` ${o.markUnclear}`
|
|
1292
1292
|
] }),
|
|
1293
|
-
/* @__PURE__ */
|
|
1293
|
+
/* @__PURE__ */ x(ce.Item, { ref: c, onClick: () => d(L.IMPORTANT), children: [
|
|
1294
1294
|
/* @__PURE__ */ i(we, { size: "x-small" }),
|
|
1295
1295
|
` ${o.markImportant}`
|
|
1296
1296
|
] })
|
|
1297
1297
|
]
|
|
1298
1298
|
}
|
|
1299
|
-
) : /* @__PURE__ */ i(
|
|
1299
|
+
) : /* @__PURE__ */ i(X, { display: "inline-flex", children: /* @__PURE__ */ i(Be, { color: r.color, renderIcon: r.icon, children: s }) });
|
|
1300
1300
|
}, je = "0.75rem";
|
|
1301
1301
|
function We(t, e) {
|
|
1302
1302
|
return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
|
|
@@ -1318,47 +1318,47 @@ const Qn = ({
|
|
|
1318
1318
|
isActive: c,
|
|
1319
1319
|
isPanelView: p = !1,
|
|
1320
1320
|
courseName: d,
|
|
1321
|
-
locale:
|
|
1322
|
-
highlightTheme:
|
|
1321
|
+
locale: h,
|
|
1322
|
+
highlightTheme: E,
|
|
1323
1323
|
renderLink: y,
|
|
1324
|
-
href:
|
|
1324
|
+
href: S
|
|
1325
1325
|
}) => {
|
|
1326
|
-
const { translations:
|
|
1327
|
-
|
|
1328
|
-
}, []),
|
|
1329
|
-
|
|
1330
|
-
var u,
|
|
1331
|
-
c ? ((u =
|
|
1332
|
-
}, [c]),
|
|
1333
|
-
var u,
|
|
1334
|
-
N ? (Y.current = !0, (u =
|
|
1335
|
-
}, [N]),
|
|
1336
|
-
if (!
|
|
1326
|
+
const { translations: g } = V(), [Q, G] = j(!1), [N, C] = j(!1), [D, M] = j(o || ""), [P, T] = j(!1), A = F(null), v = q((u) => {
|
|
1327
|
+
A.current = u;
|
|
1328
|
+
}, []), _ = F(null), z = F(null), Y = F(!1), re = F(null), Z = F(null), J = F(!1);
|
|
1329
|
+
W(() => {
|
|
1330
|
+
var u, b;
|
|
1331
|
+
c ? ((u = A.current) == null || u.scrollIntoView({ behavior: "smooth", block: "nearest" }), (b = A.current) == null || b.focus()) : T(!1);
|
|
1332
|
+
}, [c]), W(() => {
|
|
1333
|
+
var u, b;
|
|
1334
|
+
N ? (Y.current = !0, (u = _.current) == null || u.focus()) : Y.current && (Y.current = !1, (b = z.current) == null || b.focus());
|
|
1335
|
+
}, [N]), W(() => {
|
|
1336
|
+
if (!P && J.current) {
|
|
1337
1337
|
J.current = !1;
|
|
1338
1338
|
const u = re.current;
|
|
1339
1339
|
u != null && u.isConnected && u.focus();
|
|
1340
1340
|
}
|
|
1341
|
-
}, [
|
|
1342
|
-
const
|
|
1343
|
-
J.current = !
|
|
1341
|
+
}, [P]);
|
|
1342
|
+
const U = q((u, b) => {
|
|
1343
|
+
J.current = !b, T(!1);
|
|
1344
1344
|
}, []);
|
|
1345
|
-
|
|
1346
|
-
if (!
|
|
1347
|
-
const u = (
|
|
1348
|
-
|
|
1349
|
-
},
|
|
1350
|
-
|
|
1345
|
+
W(() => {
|
|
1346
|
+
if (!P) return;
|
|
1347
|
+
const u = (w) => {
|
|
1348
|
+
w.key === "Escape" && w.stopPropagation();
|
|
1349
|
+
}, b = (w) => {
|
|
1350
|
+
w.key === "Escape" && (w.stopPropagation(), U());
|
|
1351
1351
|
};
|
|
1352
|
-
return window.addEventListener("keydown", u, !0), window.addEventListener("keyup",
|
|
1353
|
-
window.removeEventListener("keydown", u, !0), window.removeEventListener("keyup",
|
|
1352
|
+
return window.addEventListener("keydown", u, !0), window.addEventListener("keyup", b, !0), () => {
|
|
1353
|
+
window.removeEventListener("keydown", u, !0), window.removeEventListener("keyup", b, !0);
|
|
1354
1354
|
};
|
|
1355
|
-
}, [
|
|
1356
|
-
const se = r ===
|
|
1355
|
+
}, [P, U]);
|
|
1356
|
+
const se = r === L.IMPORTANT ? g.important : g.unclear, $ = (u) => {
|
|
1357
1357
|
u.key === "Enter" && (u.preventDefault(), s == null || s());
|
|
1358
|
-
},
|
|
1359
|
-
n &&
|
|
1360
|
-
const I =
|
|
1361
|
-
|
|
1358
|
+
}, k = [se, g.note];
|
|
1359
|
+
n && k.push(n), o && k.push(o), e && k.push(We(e, h)), d && k.push(d);
|
|
1360
|
+
const I = k.join(", "), B = /* @__PURE__ */ x(
|
|
1361
|
+
X,
|
|
1362
1362
|
{
|
|
1363
1363
|
as: "div",
|
|
1364
1364
|
height: "100%",
|
|
@@ -1366,15 +1366,15 @@ const Qn = ({
|
|
|
1366
1366
|
borderRadius: "medium",
|
|
1367
1367
|
padding: "small",
|
|
1368
1368
|
position: "relative",
|
|
1369
|
-
role:
|
|
1370
|
-
"aria-label":
|
|
1371
|
-
"aria-pressed":
|
|
1372
|
-
tabIndex:
|
|
1369
|
+
role: S ? void 0 : c || N ? "group" : "button",
|
|
1370
|
+
"aria-label": S ? void 0 : I,
|
|
1371
|
+
"aria-pressed": S || c || N ? void 0 : c,
|
|
1372
|
+
tabIndex: S || c ? -1 : 0,
|
|
1373
1373
|
"data-testid": `note-card-${t}`,
|
|
1374
|
-
elementRef:
|
|
1374
|
+
elementRef: v,
|
|
1375
1375
|
onClick: c ? void 0 : s,
|
|
1376
|
-
onMouseEnter: () =>
|
|
1377
|
-
onMouseLeave: () =>
|
|
1376
|
+
onMouseEnter: () => G(!0),
|
|
1377
|
+
onMouseLeave: () => G(!1),
|
|
1378
1378
|
onKeyDown: c ? void 0 : $,
|
|
1379
1379
|
cursor: N ? "default" : "pointer",
|
|
1380
1380
|
children: [
|
|
@@ -1384,9 +1384,9 @@ const Qn = ({
|
|
|
1384
1384
|
"data-testid": `note-card-${t}-content`,
|
|
1385
1385
|
style: {
|
|
1386
1386
|
height: "100%",
|
|
1387
|
-
opacity: c &&
|
|
1387
|
+
opacity: c && P && l ? 0.25 : void 0
|
|
1388
1388
|
},
|
|
1389
|
-
children: /* @__PURE__ */
|
|
1389
|
+
children: /* @__PURE__ */ x(R, { direction: "column", gap: "small", height: "100%", children: [
|
|
1390
1390
|
/* @__PURE__ */ i(
|
|
1391
1391
|
ct,
|
|
1392
1392
|
{
|
|
@@ -1399,47 +1399,47 @@ const Qn = ({
|
|
|
1399
1399
|
Ce,
|
|
1400
1400
|
{
|
|
1401
1401
|
type: r,
|
|
1402
|
-
isCardActive: !!c ||
|
|
1403
|
-
theme:
|
|
1402
|
+
isCardActive: !!c || Q,
|
|
1403
|
+
theme: E,
|
|
1404
1404
|
children: n
|
|
1405
1405
|
}
|
|
1406
1406
|
) : /* @__PURE__ */ i(Ie, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ i(
|
|
1407
1407
|
Ce,
|
|
1408
1408
|
{
|
|
1409
1409
|
type: r,
|
|
1410
|
-
isCardActive: !!c ||
|
|
1411
|
-
theme:
|
|
1410
|
+
isCardActive: !!c || Q,
|
|
1411
|
+
theme: E,
|
|
1412
1412
|
children: n
|
|
1413
1413
|
}
|
|
1414
1414
|
) }) }) }) : /* @__PURE__ */ i(at, {}),
|
|
1415
|
-
/* @__PURE__ */ i(
|
|
1416
|
-
N && p ? /* @__PURE__ */
|
|
1415
|
+
/* @__PURE__ */ i(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ x(R, { direction: "column", gap: "small", height: "100%", children: [
|
|
1416
|
+
N && p ? /* @__PURE__ */ x(R, { direction: "column", gap: "x-small", margin: "xx-small", children: [
|
|
1417
1417
|
/* @__PURE__ */ i(
|
|
1418
1418
|
Xe,
|
|
1419
1419
|
{
|
|
1420
|
-
label: /* @__PURE__ */ i(bt, { children:
|
|
1421
|
-
value:
|
|
1422
|
-
onChange: (u) =>
|
|
1423
|
-
placeholder:
|
|
1420
|
+
label: /* @__PURE__ */ i(bt, { children: g.editNote }),
|
|
1421
|
+
value: D,
|
|
1422
|
+
onChange: (u) => M(u.target.value),
|
|
1423
|
+
placeholder: g.addNoteOptional,
|
|
1424
1424
|
textareaRef: (u) => {
|
|
1425
|
-
|
|
1425
|
+
_.current = u;
|
|
1426
1426
|
}
|
|
1427
1427
|
}
|
|
1428
1428
|
),
|
|
1429
|
-
/* @__PURE__ */
|
|
1430
|
-
/* @__PURE__ */ i(
|
|
1429
|
+
/* @__PURE__ */ x(R, { gap: "xx-small", children: [
|
|
1430
|
+
/* @__PURE__ */ i(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1431
1431
|
te,
|
|
1432
1432
|
{
|
|
1433
1433
|
display: "block",
|
|
1434
1434
|
size: "small",
|
|
1435
1435
|
"data-testid": `note-card-${t}-cancel`,
|
|
1436
1436
|
onClick: () => {
|
|
1437
|
-
|
|
1437
|
+
M(o || ""), C(!1);
|
|
1438
1438
|
},
|
|
1439
|
-
children:
|
|
1439
|
+
children: g.cancel
|
|
1440
1440
|
}
|
|
1441
1441
|
) }),
|
|
1442
|
-
/* @__PURE__ */ i(
|
|
1442
|
+
/* @__PURE__ */ i(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1443
1443
|
te,
|
|
1444
1444
|
{
|
|
1445
1445
|
display: "block",
|
|
@@ -1447,13 +1447,13 @@ const Qn = ({
|
|
|
1447
1447
|
size: "small",
|
|
1448
1448
|
"data-testid": `note-card-${t}-save`,
|
|
1449
1449
|
onClick: () => {
|
|
1450
|
-
a == null || a(t,
|
|
1450
|
+
a == null || a(t, D.trim()), C(!1);
|
|
1451
1451
|
},
|
|
1452
|
-
children:
|
|
1452
|
+
children: g.save
|
|
1453
1453
|
}
|
|
1454
1454
|
) })
|
|
1455
1455
|
] })
|
|
1456
|
-
] }) : o ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && p ? /* @__PURE__ */
|
|
1456
|
+
] }) : o ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && p ? /* @__PURE__ */ x(ee, { children: [
|
|
1457
1457
|
o,
|
|
1458
1458
|
" ",
|
|
1459
1459
|
/* @__PURE__ */ i(
|
|
@@ -1463,19 +1463,19 @@ const Qn = ({
|
|
|
1463
1463
|
withBackground: !1,
|
|
1464
1464
|
withBorder: !1,
|
|
1465
1465
|
margin: "xx-small 0 0 xxx-small",
|
|
1466
|
-
screenReaderLabel:
|
|
1466
|
+
screenReaderLabel: g.editNote,
|
|
1467
1467
|
"data-testid": `note-card-${t}-edit`,
|
|
1468
1468
|
elementRef: (u) => {
|
|
1469
|
-
|
|
1469
|
+
z.current = u;
|
|
1470
1470
|
},
|
|
1471
1471
|
onClick: (u) => {
|
|
1472
|
-
u.stopPropagation(),
|
|
1472
|
+
u.stopPropagation(), C(!0);
|
|
1473
1473
|
},
|
|
1474
1474
|
children: /* @__PURE__ */ i(ve, {})
|
|
1475
1475
|
}
|
|
1476
1476
|
)
|
|
1477
|
-
] }) : /* @__PURE__ */ i(ee, { children: /* @__PURE__ */ i(Ie, { maxLines: 3, truncate: "word", children: o }) }) }) : p && c ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */
|
|
1478
|
-
|
|
1477
|
+
] }) : /* @__PURE__ */ i(ee, { children: /* @__PURE__ */ i(Ie, { maxLines: 3, truncate: "word", children: o }) }) }) : p && c ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ x(ee, { color: "secondary", children: [
|
|
1478
|
+
g.addNotePrompt,
|
|
1479
1479
|
" ",
|
|
1480
1480
|
/* @__PURE__ */ i(
|
|
1481
1481
|
ue,
|
|
@@ -1484,20 +1484,20 @@ const Qn = ({
|
|
|
1484
1484
|
withBackground: !1,
|
|
1485
1485
|
withBorder: !1,
|
|
1486
1486
|
margin: "xx-small 0 0 xxx-small",
|
|
1487
|
-
screenReaderLabel:
|
|
1487
|
+
screenReaderLabel: g.editNote,
|
|
1488
1488
|
"data-testid": `note-card-${t}-edit`,
|
|
1489
1489
|
elementRef: (u) => {
|
|
1490
|
-
|
|
1490
|
+
z.current = u;
|
|
1491
1491
|
},
|
|
1492
1492
|
onClick: (u) => {
|
|
1493
|
-
u.stopPropagation(),
|
|
1493
|
+
u.stopPropagation(), C(!0);
|
|
1494
1494
|
},
|
|
1495
1495
|
children: /* @__PURE__ */ i(ve, {})
|
|
1496
1496
|
}
|
|
1497
1497
|
)
|
|
1498
1498
|
] }) }) : null,
|
|
1499
|
-
/* @__PURE__ */
|
|
1500
|
-
/* @__PURE__ */ i(ee, { size: "small", color: "secondary", children: We(e,
|
|
1499
|
+
/* @__PURE__ */ x(R, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
|
|
1500
|
+
/* @__PURE__ */ i(ee, { size: "small", color: "secondary", children: We(e, h) }),
|
|
1501
1501
|
c && l && /* @__PURE__ */ i(
|
|
1502
1502
|
ue,
|
|
1503
1503
|
{
|
|
@@ -1506,38 +1506,38 @@ const Qn = ({
|
|
|
1506
1506
|
withBorder: !1,
|
|
1507
1507
|
color: "danger",
|
|
1508
1508
|
margin: "xx-small",
|
|
1509
|
-
screenReaderLabel:
|
|
1509
|
+
screenReaderLabel: g.deleteNote,
|
|
1510
1510
|
"data-testid": `note-card-${t}-delete`,
|
|
1511
1511
|
elementRef: (u) => {
|
|
1512
1512
|
re.current = u;
|
|
1513
1513
|
},
|
|
1514
1514
|
onClick: (u) => {
|
|
1515
|
-
u.stopPropagation(), J.current = !1,
|
|
1515
|
+
u.stopPropagation(), J.current = !1, T(!0);
|
|
1516
1516
|
},
|
|
1517
1517
|
children: /* @__PURE__ */ i(ye, {})
|
|
1518
1518
|
}
|
|
1519
1519
|
)
|
|
1520
1520
|
] }),
|
|
1521
|
-
d && /* @__PURE__ */ i(ee, { size: "small", color: "secondary", children: d })
|
|
1521
|
+
d && /* @__PURE__ */ i(ee, { size: "small", color: "secondary", "data-testid": `note-card-${t}-course`, children: d })
|
|
1522
1522
|
] }) })
|
|
1523
1523
|
] })
|
|
1524
1524
|
}
|
|
1525
1525
|
),
|
|
1526
|
-
c &&
|
|
1526
|
+
c && P && l && /* @__PURE__ */ i(
|
|
1527
1527
|
Et,
|
|
1528
1528
|
{
|
|
1529
1529
|
open: !0,
|
|
1530
1530
|
as: "div",
|
|
1531
|
-
label:
|
|
1531
|
+
label: g.deleteNoteConfirmation,
|
|
1532
1532
|
shouldContainFocus: !0,
|
|
1533
1533
|
shouldFocusOnOpen: !0,
|
|
1534
1534
|
defaultFocusElement: () => Z.current,
|
|
1535
1535
|
shouldCloseOnDocumentClick: !0,
|
|
1536
1536
|
shouldCloseOnEscape: !1,
|
|
1537
1537
|
shouldReturnFocus: !1,
|
|
1538
|
-
onDismiss:
|
|
1538
|
+
onDismiss: U,
|
|
1539
1539
|
children: /* @__PURE__ */ i(
|
|
1540
|
-
|
|
1540
|
+
X,
|
|
1541
1541
|
{
|
|
1542
1542
|
as: "div",
|
|
1543
1543
|
padding: "medium",
|
|
@@ -1547,8 +1547,8 @@ const Qn = ({
|
|
|
1547
1547
|
insetInlineStart: "0",
|
|
1548
1548
|
insetInlineEnd: "0",
|
|
1549
1549
|
stacking: "above",
|
|
1550
|
-
children: /* @__PURE__ */
|
|
1551
|
-
|
|
1550
|
+
children: /* @__PURE__ */ x(
|
|
1551
|
+
R,
|
|
1552
1552
|
{
|
|
1553
1553
|
direction: "column",
|
|
1554
1554
|
justifyItems: "center",
|
|
@@ -1562,22 +1562,22 @@ const Qn = ({
|
|
|
1562
1562
|
display: "block",
|
|
1563
1563
|
color: "danger",
|
|
1564
1564
|
withBackground: !1,
|
|
1565
|
-
themeOverride: (u,
|
|
1565
|
+
themeOverride: (u, b) => ({
|
|
1566
1566
|
borderRadius: je,
|
|
1567
1567
|
// Ghost states default to translucent fills; the faded card would show through.
|
|
1568
|
-
dangerGhostBackground:
|
|
1569
|
-
dangerGhostHoverBackground:
|
|
1570
|
-
dangerGhostActiveBackground:
|
|
1568
|
+
dangerGhostBackground: b.colors.contrasts.white1010,
|
|
1569
|
+
dangerGhostHoverBackground: b.colors.contrasts.red1212,
|
|
1570
|
+
dangerGhostActiveBackground: b.colors.contrasts.red1212,
|
|
1571
1571
|
// red45 on the hover tint is 3.74:1; red57 clears AA in every state.
|
|
1572
|
-
dangerGhostColor:
|
|
1573
|
-
dangerGhostBorderColor:
|
|
1572
|
+
dangerGhostColor: b.colors.contrasts.red5782,
|
|
1573
|
+
dangerGhostBorderColor: b.colors.contrasts.red5782
|
|
1574
1574
|
}),
|
|
1575
1575
|
renderIcon: /* @__PURE__ */ i(ye, {}),
|
|
1576
1576
|
"data-testid": `note-card-${t}-confirm-delete`,
|
|
1577
1577
|
onClick: (u) => {
|
|
1578
|
-
u.stopPropagation(), l(t),
|
|
1578
|
+
u.stopPropagation(), l(t), T(!1);
|
|
1579
1579
|
},
|
|
1580
|
-
children:
|
|
1580
|
+
children: g.deleteNote
|
|
1581
1581
|
}
|
|
1582
1582
|
),
|
|
1583
1583
|
/* @__PURE__ */ i(
|
|
@@ -1585,19 +1585,19 @@ const Qn = ({
|
|
|
1585
1585
|
{
|
|
1586
1586
|
display: "block",
|
|
1587
1587
|
withBackground: !1,
|
|
1588
|
-
themeOverride: (u,
|
|
1588
|
+
themeOverride: (u, b) => ({
|
|
1589
1589
|
borderRadius: je,
|
|
1590
|
-
secondaryGhostBackground:
|
|
1591
|
-
secondaryGhostActiveBackground:
|
|
1590
|
+
secondaryGhostBackground: b.colors.contrasts.white1010,
|
|
1591
|
+
secondaryGhostActiveBackground: b.colors.contrasts.grey1111
|
|
1592
1592
|
}),
|
|
1593
1593
|
"data-testid": `note-card-${t}-cancel-delete`,
|
|
1594
1594
|
elementRef: (u) => {
|
|
1595
1595
|
Z.current = u;
|
|
1596
1596
|
},
|
|
1597
1597
|
onClick: (u) => {
|
|
1598
|
-
u.stopPropagation(),
|
|
1598
|
+
u.stopPropagation(), U();
|
|
1599
1599
|
},
|
|
1600
|
-
children:
|
|
1600
|
+
children: g.cancel
|
|
1601
1601
|
}
|
|
1602
1602
|
)
|
|
1603
1603
|
]
|
|
@@ -1610,7 +1610,7 @@ const Qn = ({
|
|
|
1610
1610
|
]
|
|
1611
1611
|
}
|
|
1612
1612
|
);
|
|
1613
|
-
return
|
|
1613
|
+
return S && y ? y({ href: S, children: B, ariaLabel: I }) : B;
|
|
1614
1614
|
}, Yn = {
|
|
1615
1615
|
display: "grid",
|
|
1616
1616
|
gap: "1rem",
|
|
@@ -1632,80 +1632,82 @@ const Qn = ({
|
|
|
1632
1632
|
onNoteTypeChange: c,
|
|
1633
1633
|
onNotesEmptied: p,
|
|
1634
1634
|
selectedNoteId: d,
|
|
1635
|
-
hasActiveFilter:
|
|
1636
|
-
columnCount:
|
|
1635
|
+
hasActiveFilter: h = !1,
|
|
1636
|
+
columnCount: E = 1,
|
|
1637
1637
|
highlightTheme: y,
|
|
1638
|
-
locale:
|
|
1639
|
-
|
|
1640
|
-
|
|
1638
|
+
locale: S,
|
|
1639
|
+
courseNames: g,
|
|
1640
|
+
renderNoteLink: Q,
|
|
1641
|
+
noteHref: G
|
|
1641
1642
|
}) => {
|
|
1642
|
-
const { translations:
|
|
1643
|
-
(
|
|
1644
|
-
const
|
|
1645
|
-
let
|
|
1646
|
-
t.length > 1 && (
|
|
1643
|
+
const { translations: N } = V(), C = F(null), D = F(null), M = q(
|
|
1644
|
+
(T) => {
|
|
1645
|
+
const A = t.findIndex((_) => _.id === T);
|
|
1646
|
+
let v = null;
|
|
1647
|
+
t.length > 1 && (v = A > 0 ? t[A - 1].id : t[1].id), D.current = { targetId: v }, a == null || a(T);
|
|
1647
1648
|
},
|
|
1648
1649
|
[t, a]
|
|
1649
1650
|
);
|
|
1650
|
-
if (
|
|
1651
|
-
var
|
|
1652
|
-
const
|
|
1653
|
-
if (
|
|
1654
|
-
if (
|
|
1651
|
+
if (W(() => {
|
|
1652
|
+
var A;
|
|
1653
|
+
const T = D.current;
|
|
1654
|
+
if (T)
|
|
1655
|
+
if (D.current = null, T.targetId === null)
|
|
1655
1656
|
p == null || p();
|
|
1656
1657
|
else {
|
|
1657
|
-
const
|
|
1658
|
-
`[data-testid="note-card-${
|
|
1658
|
+
const v = (A = C.current) == null ? void 0 : A.querySelector(
|
|
1659
|
+
`[data-testid="note-card-${T.targetId}"]`
|
|
1659
1660
|
);
|
|
1660
|
-
|
|
1661
|
+
v == null || v.focus();
|
|
1661
1662
|
}
|
|
1662
1663
|
}, [t, p]), e)
|
|
1663
|
-
return /* @__PURE__ */ i(
|
|
1664
|
+
return /* @__PURE__ */ i(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ i(Tt, { renderTitle: N.loadingNotes }) });
|
|
1664
1665
|
if (n)
|
|
1665
|
-
return /* @__PURE__ */ i(
|
|
1666
|
+
return /* @__PURE__ */ i(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(Ne, { level: "h4", children: N.failedToLoadNotes }) });
|
|
1666
1667
|
if (t.length === 0)
|
|
1667
|
-
return /* @__PURE__ */ i(
|
|
1668
|
-
const
|
|
1669
|
-
return /* @__PURE__ */
|
|
1668
|
+
return /* @__PURE__ */ i(X, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(Kn, { hasActiveFilter: h }) });
|
|
1669
|
+
const P = typeof o == "number" && typeof r == "number" && r > 1 && s !== void 0;
|
|
1670
|
+
return /* @__PURE__ */ x(dt, { children: [
|
|
1670
1671
|
/* @__PURE__ */ i(
|
|
1671
1672
|
"ul",
|
|
1672
1673
|
{
|
|
1673
|
-
ref:
|
|
1674
|
-
style: { ...Yn, gridTemplateColumns: `repeat(${
|
|
1674
|
+
ref: C,
|
|
1675
|
+
style: { ...Yn, gridTemplateColumns: `repeat(${E}, minmax(0, 1fr))` },
|
|
1675
1676
|
role: "list",
|
|
1676
1677
|
"data-testid": "notes-grid",
|
|
1677
|
-
children: t.map((
|
|
1678
|
-
var
|
|
1678
|
+
children: t.map((T) => {
|
|
1679
|
+
var A;
|
|
1679
1680
|
return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
|
|
1680
1681
|
Qn,
|
|
1681
1682
|
{
|
|
1682
|
-
noteId:
|
|
1683
|
-
date:
|
|
1684
|
-
type:
|
|
1685
|
-
highlight: (
|
|
1686
|
-
note:
|
|
1687
|
-
isActive: d ===
|
|
1683
|
+
noteId: T.id,
|
|
1684
|
+
date: T.createdAt,
|
|
1685
|
+
type: T.reaction[0] ?? L.IMPORTANT,
|
|
1686
|
+
highlight: (A = T.highlightData) == null ? void 0 : A.selectedText,
|
|
1687
|
+
note: T.userText,
|
|
1688
|
+
isActive: d === T.id,
|
|
1688
1689
|
isPanelView: !!d,
|
|
1689
|
-
onClick: l ? () => l(
|
|
1690
|
-
onDelete: a ?
|
|
1691
|
-
onSaveNote: m ? (
|
|
1692
|
-
onTypeChange: c ? (
|
|
1690
|
+
onClick: l ? () => l(T.id) : void 0,
|
|
1691
|
+
onDelete: a ? M : void 0,
|
|
1692
|
+
onSaveNote: m ? (v, _) => m(v, _) : void 0,
|
|
1693
|
+
onTypeChange: c ? (v, _) => c(v, _) : void 0,
|
|
1693
1694
|
highlightTheme: y,
|
|
1694
|
-
locale:
|
|
1695
|
-
|
|
1696
|
-
|
|
1695
|
+
locale: S,
|
|
1696
|
+
courseName: g == null ? void 0 : g.get(T.courseId),
|
|
1697
|
+
renderLink: Q,
|
|
1698
|
+
href: G ? G(T.id, T) : void 0
|
|
1697
1699
|
}
|
|
1698
|
-
) },
|
|
1700
|
+
) }, T.id);
|
|
1699
1701
|
})
|
|
1700
1702
|
}
|
|
1701
1703
|
),
|
|
1702
|
-
|
|
1704
|
+
P && /* @__PURE__ */ i(R, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ i(R.Item, { children: /* @__PURE__ */ i(
|
|
1703
1705
|
St,
|
|
1704
1706
|
{
|
|
1705
1707
|
as: "nav",
|
|
1706
1708
|
variant: "input",
|
|
1707
|
-
labelNext:
|
|
1708
|
-
labelPrev:
|
|
1709
|
+
labelNext: N.nextPage,
|
|
1710
|
+
labelPrev: N.previousPage,
|
|
1709
1711
|
currentPage: o,
|
|
1710
1712
|
totalPageNumber: r,
|
|
1711
1713
|
onPageChange: s
|
|
@@ -1723,34 +1725,34 @@ const Qn = ({
|
|
|
1723
1725
|
onBack: a,
|
|
1724
1726
|
editing: m = !1
|
|
1725
1727
|
}) => {
|
|
1726
|
-
const { translations: c } = V(), [p, d] =
|
|
1727
|
-
return /* @__PURE__ */
|
|
1728
|
-
n != null ? /* @__PURE__ */ i(
|
|
1728
|
+
const { translations: c } = V(), [p, d] = j(m), [h, E] = j(t || ""), [y, S] = j(!1);
|
|
1729
|
+
return /* @__PURE__ */ x(R, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1730
|
+
n != null ? /* @__PURE__ */ i(X, { as: "div", children: /* @__PURE__ */ i(ee, { children: /* @__PURE__ */ i(Ce, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ i(at, {}),
|
|
1729
1731
|
/* @__PURE__ */ i(ct, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1730
|
-
p ? /* @__PURE__ */
|
|
1732
|
+
p ? /* @__PURE__ */ x(R, { direction: "column", gap: "x-small", children: [
|
|
1731
1733
|
/* @__PURE__ */ i(
|
|
1732
1734
|
Xe,
|
|
1733
1735
|
{
|
|
1734
1736
|
label: c.addNoteOptional,
|
|
1735
|
-
value:
|
|
1736
|
-
onChange: (
|
|
1737
|
+
value: h,
|
|
1738
|
+
onChange: (g) => E(g.target.value),
|
|
1737
1739
|
resize: "vertical"
|
|
1738
1740
|
}
|
|
1739
1741
|
),
|
|
1740
|
-
/* @__PURE__ */
|
|
1741
|
-
/* @__PURE__ */ i(
|
|
1742
|
+
/* @__PURE__ */ x(R, { gap: "xx-small", children: [
|
|
1743
|
+
/* @__PURE__ */ i(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1742
1744
|
te,
|
|
1743
1745
|
{
|
|
1744
1746
|
display: "block",
|
|
1745
1747
|
size: "small",
|
|
1746
1748
|
"data-testid": "single-note-cancel",
|
|
1747
1749
|
onClick: () => {
|
|
1748
|
-
|
|
1750
|
+
E(t || ""), d(!1);
|
|
1749
1751
|
},
|
|
1750
1752
|
children: c.cancel
|
|
1751
1753
|
}
|
|
1752
1754
|
) }),
|
|
1753
|
-
/* @__PURE__ */ i(
|
|
1755
|
+
/* @__PURE__ */ i(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1754
1756
|
te,
|
|
1755
1757
|
{
|
|
1756
1758
|
display: "block",
|
|
@@ -1758,18 +1760,18 @@ const Qn = ({
|
|
|
1758
1760
|
size: "small",
|
|
1759
1761
|
"data-testid": "single-note-save",
|
|
1760
1762
|
onClick: () => {
|
|
1761
|
-
r(
|
|
1763
|
+
r(h), d(!1);
|
|
1762
1764
|
},
|
|
1763
1765
|
children: c.save
|
|
1764
1766
|
}
|
|
1765
1767
|
) })
|
|
1766
1768
|
] })
|
|
1767
|
-
] }) : /* @__PURE__ */
|
|
1768
|
-
t && /* @__PURE__ */
|
|
1769
|
+
] }) : /* @__PURE__ */ x(R, { direction: "column", gap: "small", children: [
|
|
1770
|
+
t && /* @__PURE__ */ x(X, { as: "div", children: [
|
|
1769
1771
|
/* @__PURE__ */ i(Ne, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
|
|
1770
1772
|
/* @__PURE__ */ i(ee, { children: t })
|
|
1771
1773
|
] }),
|
|
1772
|
-
/* @__PURE__ */
|
|
1774
|
+
/* @__PURE__ */ x(R, { justifyItems: "space-between", children: [
|
|
1773
1775
|
/* @__PURE__ */ i(
|
|
1774
1776
|
te,
|
|
1775
1777
|
{
|
|
@@ -1780,7 +1782,7 @@ const Qn = ({
|
|
|
1780
1782
|
children: c.back
|
|
1781
1783
|
}
|
|
1782
1784
|
),
|
|
1783
|
-
/* @__PURE__ */
|
|
1785
|
+
/* @__PURE__ */ x(R, { gap: "xx-small", children: [
|
|
1784
1786
|
s && /* @__PURE__ */ i(
|
|
1785
1787
|
ue,
|
|
1786
1788
|
{
|
|
@@ -1790,7 +1792,7 @@ const Qn = ({
|
|
|
1790
1792
|
color: "danger",
|
|
1791
1793
|
screenReaderLabel: c.deleteNote,
|
|
1792
1794
|
"data-testid": "single-note-delete",
|
|
1793
|
-
onClick: () =>
|
|
1795
|
+
onClick: () => S(!0),
|
|
1794
1796
|
children: /* @__PURE__ */ i(ye, {})
|
|
1795
1797
|
}
|
|
1796
1798
|
),
|
|
@@ -1808,7 +1810,7 @@ const Qn = ({
|
|
|
1808
1810
|
)
|
|
1809
1811
|
] })
|
|
1810
1812
|
] }),
|
|
1811
|
-
y && s && /* @__PURE__ */ i(
|
|
1813
|
+
y && s && /* @__PURE__ */ i(X, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ x(R, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1812
1814
|
/* @__PURE__ */ i(
|
|
1813
1815
|
te,
|
|
1814
1816
|
{
|
|
@@ -1818,7 +1820,7 @@ const Qn = ({
|
|
|
1818
1820
|
renderIcon: /* @__PURE__ */ i(ye, {}),
|
|
1819
1821
|
"data-testid": "single-note-confirm-delete",
|
|
1820
1822
|
onClick: () => {
|
|
1821
|
-
s(),
|
|
1823
|
+
s(), S(!1);
|
|
1822
1824
|
},
|
|
1823
1825
|
children: c.deleteNote
|
|
1824
1826
|
}
|
|
@@ -1829,7 +1831,7 @@ const Qn = ({
|
|
|
1829
1831
|
display: "block",
|
|
1830
1832
|
size: "small",
|
|
1831
1833
|
"data-testid": "single-note-cancel-delete",
|
|
1832
|
-
onClick: () =>
|
|
1834
|
+
onClick: () => S(!1),
|
|
1833
1835
|
children: c.cancel
|
|
1834
1836
|
}
|
|
1835
1837
|
)
|
|
@@ -1849,7 +1851,7 @@ export {
|
|
|
1849
1851
|
Hn as NotebookTranslationsProvider,
|
|
1850
1852
|
So as NotebookTray,
|
|
1851
1853
|
Co as NotesListView,
|
|
1852
|
-
|
|
1854
|
+
L as REACTION_TYPE,
|
|
1853
1855
|
xo as SingleNote,
|
|
1854
1856
|
De as createTransparentColor,
|
|
1855
1857
|
Vt as useCreateNote,
|