@instructure/platform-notebook 0.10.0 → 0.10.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/ContentWithNoteWrapper.d.ts.map +1 -1
- package/dist/NoteCard.d.ts.map +1 -1
- package/dist/index.js +111 -112
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentWithNoteWrapper.d.ts","sourceRoot":"","sources":["../src/ContentWithNoteWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA4C,MAAM,OAAO,CAAA;AAEhF,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAmB1F,MAAM,WAAW,2BAA2B;IAC1C,YAAY,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC3C,cAAc,EAAE,cAAc,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAID,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,cAAc,EACd,YAAkB,GACnB,EAAE,2BAA2B,
|
|
1
|
+
{"version":3,"file":"ContentWithNoteWrapper.d.ts","sourceRoot":"","sources":["../src/ContentWithNoteWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA4C,MAAM,OAAO,CAAA;AAEhF,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAmB1F,MAAM,WAAW,2BAA2B;IAC1C,YAAY,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC3C,cAAc,EAAE,cAAc,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAID,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,cAAc,EACd,YAAkB,GACnB,EAAE,2BAA2B,sCAyR7B"}
|
package/dist/NoteCard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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{ createContext as Pe, useMemo as re, useContext as _e, useReducer as Fe, useRef as
|
|
1
|
+
import { jsx as s, jsxs as T, Fragment as Ye } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Pe, useMemo as re, useContext as _e, useReducer as Fe, useRef as V, useEffect as ee, useState as W, useCallback as K } from "react";
|
|
3
3
|
import { createPortal as Ze } from "react-dom";
|
|
4
4
|
import { z as c } from "zod";
|
|
5
5
|
import Je from "diff-match-patch";
|
|
@@ -13,7 +13,7 @@ import { ScreenReaderContent as Me } from "@instructure/ui-a11y-content";
|
|
|
13
13
|
import { SimpleSelect as we } from "@instructure/ui-simple-select";
|
|
14
14
|
import { Heading as ae } from "@instructure/ui-heading";
|
|
15
15
|
import { Text as U } from "@instructure/ui-text";
|
|
16
|
-
import { CloseButton as it, Button as $, IconButton as
|
|
16
|
+
import { CloseButton as it, Button as $, IconButton as Q } from "@instructure/ui-buttons";
|
|
17
17
|
import { Tray as lt } from "@instructure/ui-tray";
|
|
18
18
|
import { TextArea as He } from "@instructure/ui-text-area";
|
|
19
19
|
import { Pill as ke } from "@instructure/ui-pill";
|
|
@@ -254,12 +254,12 @@ const pt = (n) => {
|
|
|
254
254
|
return document.evaluate(`.${n}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
class
|
|
257
|
+
class Y {
|
|
258
258
|
constructor(e, t) {
|
|
259
259
|
this.root = e, this.range = t;
|
|
260
260
|
}
|
|
261
261
|
static fromRange(e, t) {
|
|
262
|
-
return new
|
|
262
|
+
return new Y(e, t);
|
|
263
263
|
}
|
|
264
264
|
static fromSelector(e, t) {
|
|
265
265
|
if (!(t != null && t.startContainer) || !(t != null && t.endContainer))
|
|
@@ -274,7 +274,7 @@ class Z {
|
|
|
274
274
|
if (!i || !l)
|
|
275
275
|
return null;
|
|
276
276
|
const a = new q(i, l).toRange();
|
|
277
|
-
return a ? new
|
|
277
|
+
return a ? new Y(e, a) : null;
|
|
278
278
|
}
|
|
279
279
|
toRange() {
|
|
280
280
|
return this.range;
|
|
@@ -384,7 +384,7 @@ const ze = (n) => {
|
|
|
384
384
|
for (const i of e) {
|
|
385
385
|
const l = St(i, n);
|
|
386
386
|
if (l) {
|
|
387
|
-
const a = l.toRange(), m = a &&
|
|
387
|
+
const a = l.toRange(), m = a && Y.fromRange(n, a);
|
|
388
388
|
o.push({
|
|
389
389
|
id: i.id,
|
|
390
390
|
reaction: i.reaction,
|
|
@@ -414,7 +414,7 @@ const ze = (n) => {
|
|
|
414
414
|
var l;
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: t, id: o } = n, { range: r } = t ?? {};
|
|
417
|
-
r && ((l =
|
|
417
|
+
r && ((l = Y.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Rt({ id: o });
|
|
418
418
|
}, Tt = (n) => {
|
|
419
419
|
const e = document.getElementById(ve(n));
|
|
420
420
|
if (e) {
|
|
@@ -509,19 +509,19 @@ const ze = (n) => {
|
|
|
509
509
|
y.collapse(!0), y.insertNode(u);
|
|
510
510
|
const E = document.createRange();
|
|
511
511
|
E.setStartAfter(u), E.setEndBefore(S);
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
var
|
|
512
|
+
const M = wt(E).filter((N) => N.textContent && N.textContent.length > 0);
|
|
513
|
+
M.forEach((N, I) => {
|
|
514
|
+
var Z;
|
|
515
515
|
const k = N.parentElement;
|
|
516
516
|
if ((k == null ? void 0 : k.dataset.highlightId) === o) return;
|
|
517
|
-
const x = I === 0, O = I ===
|
|
518
|
-
let
|
|
519
|
-
_ ?
|
|
517
|
+
const x = I === 0, O = I === M.length - 1, _ = M.length === 1;
|
|
518
|
+
let F;
|
|
519
|
+
_ ? F = "single" : x ? F = "first" : O ? F = "last" : F = "middle";
|
|
520
520
|
const D = document.createElement("span");
|
|
521
|
-
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position =
|
|
521
|
+
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position = F, D.style.backgroundColor = m, D.style.textDecorationLine = "underline", D.style.textDecorationColor = d, D.style.textDecorationStyle = g, D.style.textDecorationThickness = t.borderWidthSmall, D.style.textUnderlineOffset = t.underlineOffset, D.style.cursor = "pointer", D.addEventListener("click", (R) => {
|
|
522
522
|
var b;
|
|
523
523
|
R.target.tagName !== "A" && ((b = e.onClick) == null || b.call(e));
|
|
524
|
-
}), (
|
|
524
|
+
}), (Z = N.parentNode) == null || Z.insertBefore(D, N), D.appendChild(N);
|
|
525
525
|
}), u.addEventListener("click", (N) => {
|
|
526
526
|
var I;
|
|
527
527
|
N.target.tagName !== "A" && ((I = e.onClick) == null || I.call(e));
|
|
@@ -730,7 +730,7 @@ function Qn({
|
|
|
730
730
|
translate: d,
|
|
731
731
|
children: g
|
|
732
732
|
}) {
|
|
733
|
-
const [h, u] = Fe(bn, Nn), S =
|
|
733
|
+
const [h, u] = Fe(bn, Nn), S = V(!1), f = re(
|
|
734
734
|
() => ({
|
|
735
735
|
api: n,
|
|
736
736
|
currentUserId: e,
|
|
@@ -771,8 +771,8 @@ function Xe() {
|
|
|
771
771
|
return n;
|
|
772
772
|
}
|
|
773
773
|
const yn = ({ currentType: n, onSelectReaction: e }) => {
|
|
774
|
-
const { translations: t } = G(), o =
|
|
775
|
-
return
|
|
774
|
+
const { translations: t } = G(), o = V(null), r = V(null);
|
|
775
|
+
return ee(() => {
|
|
776
776
|
n === w.CONFUSING && o.current ? o.current.focus() : n === w.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
|
|
777
777
|
}, [n]), /* @__PURE__ */ s(
|
|
778
778
|
z,
|
|
@@ -783,8 +783,8 @@ const yn = ({ currentType: n, onSelectReaction: e }) => {
|
|
|
783
783
|
borderColor: "secondary",
|
|
784
784
|
borderRadius: "medium",
|
|
785
785
|
shadow: "resting",
|
|
786
|
-
children: /* @__PURE__ */
|
|
787
|
-
/* @__PURE__ */
|
|
786
|
+
children: /* @__PURE__ */ T(te, { children: [
|
|
787
|
+
/* @__PURE__ */ T(
|
|
788
788
|
te.Item,
|
|
789
789
|
{
|
|
790
790
|
ref: o,
|
|
@@ -795,7 +795,7 @@ const yn = ({ currentType: n, onSelectReaction: e }) => {
|
|
|
795
795
|
]
|
|
796
796
|
}
|
|
797
797
|
),
|
|
798
|
-
/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ T(
|
|
799
799
|
te.Item,
|
|
800
800
|
{
|
|
801
801
|
ref: r,
|
|
@@ -831,59 +831,57 @@ function Vn({
|
|
|
831
831
|
},
|
|
832
832
|
courseId: l,
|
|
833
833
|
pageSize: 100
|
|
834
|
-
}), { mutate: u } = Dt(o), { mutate: S } = At(o), { mutate: f } = Lt(o), y =
|
|
835
|
-
|
|
834
|
+
}), { mutate: u } = Dt(o), { mutate: S } = At(o), { mutate: f } = Lt(o), y = V([]), [E, H] = W([]), [M, N] = W(null), [I, k] = W(""), [x, O] = W(null), [_, F] = W(!1);
|
|
835
|
+
ee(() => {
|
|
836
836
|
const R = n.current;
|
|
837
837
|
if (!R) return;
|
|
838
838
|
const b = R.closest(".user_content") ?? R;
|
|
839
839
|
if (b.classList.contains("enhanced")) {
|
|
840
|
-
|
|
840
|
+
F(!0);
|
|
841
841
|
return;
|
|
842
842
|
}
|
|
843
843
|
const P = new MutationObserver((L) => {
|
|
844
844
|
for (const p of L)
|
|
845
845
|
if (p.type === "attributes" && p.attributeName === "class" && p.target.classList.contains("enhanced")) {
|
|
846
|
-
|
|
846
|
+
F(!0), P.disconnect();
|
|
847
847
|
return;
|
|
848
848
|
}
|
|
849
849
|
});
|
|
850
850
|
return P.observe(b, { attributes: !0, attributeFilter: ["class"] }), () => P.disconnect();
|
|
851
|
-
}, [n]),
|
|
851
|
+
}, [n]), ee(() => {
|
|
852
852
|
if (!_ || !n.current) return;
|
|
853
853
|
let b = null;
|
|
854
854
|
const P = () => {
|
|
855
855
|
b && clearTimeout(b), b = setTimeout(() => {
|
|
856
856
|
var xe;
|
|
857
|
-
const
|
|
858
|
-
if (!(
|
|
859
|
-
const j =
|
|
857
|
+
const v = window.getSelection(), A = n.current;
|
|
858
|
+
if (!(v != null && v.rangeCount) || !A) return;
|
|
859
|
+
const j = v.toString().trim();
|
|
860
860
|
if (j === "") return;
|
|
861
|
-
const
|
|
862
|
-
if (!A.contains(
|
|
863
|
-
const Ie = (xe = X.fromRange(A,
|
|
864
|
-
Ie && !It(Ie, E) && (N(
|
|
861
|
+
const J = v.getRangeAt(0);
|
|
862
|
+
if (!A.contains(J.commonAncestorContainer)) return;
|
|
863
|
+
const Ie = (xe = X.fromRange(A, J)) == null ? void 0 : xe.toSelector();
|
|
864
|
+
Ie && !It(Ie, E) && (N(J.cloneRange()), k(j), O(Ct(J)));
|
|
865
865
|
}, t);
|
|
866
|
-
}, L = (
|
|
867
|
-
if (!(
|
|
866
|
+
}, L = (v) => {
|
|
867
|
+
if (!(v.target instanceof Node)) return;
|
|
868
868
|
const A = document.getElementById(de);
|
|
869
|
-
A != null && A.contains(
|
|
869
|
+
A != null && A.contains(v.target) ? (v.preventDefault(), v.stopImmediatePropagation()) : (O(null), N(null), k(""));
|
|
870
870
|
}, p = () => {
|
|
871
871
|
O(null), N(null), k("");
|
|
872
872
|
};
|
|
873
873
|
return document.addEventListener("selectionchange", P), document.addEventListener("mousedown", L), document.addEventListener("touchstart", L), window.addEventListener("scroll", p, !0), () => {
|
|
874
874
|
b && clearTimeout(b), document.removeEventListener("selectionchange", P), document.removeEventListener("mousedown", L), document.removeEventListener("touchstart", L), window.removeEventListener("scroll", p, !0);
|
|
875
875
|
};
|
|
876
|
-
}, [_, E, t, n])
|
|
877
|
-
m && Tt(m);
|
|
878
|
-
}, [m]);
|
|
876
|
+
}, [_, E, t, n]);
|
|
879
877
|
const D = K(
|
|
880
878
|
(R) => {
|
|
881
879
|
var j;
|
|
882
880
|
const b = n.current;
|
|
883
881
|
if (!b || !R.highlightData) return null;
|
|
884
|
-
const { highlightData: P, reaction: L, id: p } = R, { range:
|
|
882
|
+
const { highlightData: P, reaction: L, id: p } = R, { range: v } = P, A = v && ((j = Y.fromSelector(b, v)) == null ? void 0 : j.toRange());
|
|
885
883
|
if (A) {
|
|
886
|
-
const
|
|
884
|
+
const J = {
|
|
887
885
|
id: p,
|
|
888
886
|
selectedNoteId: m,
|
|
889
887
|
type: L[0],
|
|
@@ -891,41 +889,41 @@ function Vn({
|
|
|
891
889
|
d(p), g();
|
|
892
890
|
}
|
|
893
891
|
};
|
|
894
|
-
return kt(A,
|
|
892
|
+
return kt(A, J, e), P.textPosition;
|
|
895
893
|
}
|
|
896
894
|
return null;
|
|
897
895
|
},
|
|
898
896
|
[n, m, e, d, g]
|
|
899
897
|
);
|
|
900
|
-
|
|
898
|
+
ee(() => {
|
|
901
899
|
if (!_ || !h || !n.current) return;
|
|
902
900
|
const R = n.current, b = h.notes, P = /* @__PURE__ */ new Set(), L = [], p = [];
|
|
903
901
|
if (b.length === 0) {
|
|
904
902
|
if (y.current.length > 0) {
|
|
905
|
-
for (const
|
|
906
|
-
Le(
|
|
903
|
+
for (const v of y.current)
|
|
904
|
+
Le(v, R);
|
|
907
905
|
y.current = [], H([]);
|
|
908
906
|
}
|
|
909
907
|
return;
|
|
910
908
|
}
|
|
911
909
|
if (a && b[0].highlightData.pageLastModifiedAt !== a) {
|
|
912
|
-
const { notesForUpdate:
|
|
910
|
+
const { notesForUpdate: v, noteIdsForDelete: A } = vt(
|
|
913
911
|
R,
|
|
914
912
|
b,
|
|
915
913
|
a
|
|
916
914
|
);
|
|
917
|
-
for (const j of
|
|
915
|
+
for (const j of v)
|
|
918
916
|
S({ id: j.id, input: j });
|
|
919
917
|
for (const j of A)
|
|
920
918
|
f(j);
|
|
921
919
|
} else {
|
|
922
|
-
for (const
|
|
923
|
-
const A = D(
|
|
924
|
-
P.add(
|
|
920
|
+
for (const v of b) {
|
|
921
|
+
const A = D(v);
|
|
922
|
+
P.add(v.id), A && (L.push(v), p.push(A));
|
|
925
923
|
}
|
|
926
|
-
for (const
|
|
927
|
-
P.has(
|
|
928
|
-
H(p), y.current = L;
|
|
924
|
+
for (const v of y.current)
|
|
925
|
+
P.has(v.id) || Le(v, R);
|
|
926
|
+
H(p), y.current = L, m && Tt(m);
|
|
929
927
|
}
|
|
930
928
|
}, [
|
|
931
929
|
_,
|
|
@@ -934,12 +932,13 @@ function Vn({
|
|
|
934
932
|
a,
|
|
935
933
|
n,
|
|
936
934
|
S,
|
|
937
|
-
f
|
|
935
|
+
f,
|
|
936
|
+
m
|
|
938
937
|
]);
|
|
939
|
-
const
|
|
938
|
+
const Z = (R) => {
|
|
940
939
|
const b = n.current;
|
|
941
|
-
if (!
|
|
942
|
-
const P =
|
|
940
|
+
if (!M || !b) return;
|
|
941
|
+
const P = Y.fromRange(b, M), L = X.fromRange(b, M);
|
|
943
942
|
u(
|
|
944
943
|
{
|
|
945
944
|
courseId: l,
|
|
@@ -957,13 +956,13 @@ function Vn({
|
|
|
957
956
|
{
|
|
958
957
|
onSuccess: (p) => {
|
|
959
958
|
var A;
|
|
960
|
-
const
|
|
961
|
-
N(null), k(""), O(null), (A = window.getSelection()) == null || A.removeAllRanges(), d(
|
|
959
|
+
const v = p.id;
|
|
960
|
+
N(null), k(""), O(null), (A = window.getSelection()) == null || A.removeAllRanges(), d(v), g();
|
|
962
961
|
}
|
|
963
962
|
}
|
|
964
963
|
);
|
|
965
964
|
};
|
|
966
|
-
return !
|
|
965
|
+
return !M || !x ? null : Ze(
|
|
967
966
|
/* @__PURE__ */ s(
|
|
968
967
|
"div",
|
|
969
968
|
{
|
|
@@ -980,7 +979,7 @@ function Vn({
|
|
|
980
979
|
const b = document.getElementById(de);
|
|
981
980
|
b != null && b.contains(R.relatedTarget) || (O(null), N(null), k(""));
|
|
982
981
|
},
|
|
983
|
-
children: /* @__PURE__ */ s(yn, { onSelectReaction:
|
|
982
|
+
children: /* @__PURE__ */ s(yn, { onSelectReaction: Z })
|
|
984
983
|
}
|
|
985
984
|
),
|
|
986
985
|
document.body
|
|
@@ -1009,7 +1008,7 @@ const En = (n, e) => ({
|
|
|
1009
1008
|
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: n });
|
|
1010
1009
|
}, Qe = () => {
|
|
1011
1010
|
const { translations: n } = G();
|
|
1012
|
-
return /* @__PURE__ */
|
|
1011
|
+
return /* @__PURE__ */ T(C, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1013
1012
|
/* @__PURE__ */ s(C.Item, { as: "div", children: /* @__PURE__ */ s(tt, { color: "error" }) }),
|
|
1014
1013
|
/* @__PURE__ */ s(C.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(me, { maxLines: 3, children: n.highlightUnavailable }) })
|
|
1015
1014
|
] });
|
|
@@ -1038,7 +1037,7 @@ function Yn({
|
|
|
1038
1037
|
pageSize: r = 16
|
|
1039
1038
|
}) {
|
|
1040
1039
|
const [i, l] = Fe(vn, Sn), { filter: a, courseFilter: m, pageParamsWithDirection: d } = i;
|
|
1041
|
-
|
|
1040
|
+
ee(() => {
|
|
1042
1041
|
Object.keys(d).length > 0 && l({ type: "SET_PAGE_PARAMS_WITH_DIRECTION", payload: {} });
|
|
1043
1042
|
}, [r]);
|
|
1044
1043
|
const g = t ? m : e, { direction: h, pageParams: u } = d, S = h === "next" ? (u == null ? void 0 : u.endCursor) ?? void 0 : h === "prev" ? (u == null ? void 0 : u.startCursor) ?? void 0 : void 0, { data: f, isLoading: y, isError: E } = $e({
|
|
@@ -1051,7 +1050,7 @@ function Yn({
|
|
|
1051
1050
|
cursor: S,
|
|
1052
1051
|
direction: h,
|
|
1053
1052
|
pageSize: r
|
|
1054
|
-
}), H = (f == null ? void 0 : f.notes) ?? [],
|
|
1053
|
+
}), H = (f == null ? void 0 : f.notes) ?? [], M = f == null ? void 0 : f.pageInfo, N = K(() => {
|
|
1055
1054
|
l({
|
|
1056
1055
|
type: "SET_PAGE_PARAMS_WITH_DIRECTION",
|
|
1057
1056
|
payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "next" }
|
|
@@ -1068,7 +1067,7 @@ function Yn({
|
|
|
1068
1067
|
}, []);
|
|
1069
1068
|
return {
|
|
1070
1069
|
notes: H,
|
|
1071
|
-
pageInfo:
|
|
1070
|
+
pageInfo: M,
|
|
1072
1071
|
isLoading: y,
|
|
1073
1072
|
isError: E,
|
|
1074
1073
|
filter: a,
|
|
@@ -1113,7 +1112,7 @@ function Zn({ filter: n, setFilter: e }) {
|
|
|
1113
1112
|
}
|
|
1114
1113
|
const Tn = ({ hasActiveFilter: n = !1 }) => {
|
|
1115
1114
|
const { translations: e } = G(), t = n ? e.nothingHereYet : e.emptyStateHeading, o = n ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1116
|
-
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", children: /* @__PURE__ */
|
|
1115
|
+
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", children: /* @__PURE__ */ T(C, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1117
1116
|
!n && /* @__PURE__ */ s(nt, { size: "medium" }),
|
|
1118
1117
|
/* @__PURE__ */ s(ae, { level: "h3", children: t }),
|
|
1119
1118
|
/* @__PURE__ */ s(U, { color: "secondary", children: o })
|
|
@@ -1128,8 +1127,8 @@ const Tn = ({ hasActiveFilter: n = !1 }) => {
|
|
|
1128
1127
|
onDismiss: t,
|
|
1129
1128
|
placement: "end",
|
|
1130
1129
|
size: "regular",
|
|
1131
|
-
children: /* @__PURE__ */
|
|
1132
|
-
/* @__PURE__ */ s(C.Item, { children: /* @__PURE__ */ s(z, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */
|
|
1130
|
+
children: /* @__PURE__ */ T(C, { direction: "column", height: "100vh", children: [
|
|
1131
|
+
/* @__PURE__ */ s(C.Item, { children: /* @__PURE__ */ s(z, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ T(C, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1133
1132
|
/* @__PURE__ */ s(ae, { level: "h3", children: o.notebook }),
|
|
1134
1133
|
/* @__PURE__ */ s(
|
|
1135
1134
|
it,
|
|
@@ -1157,13 +1156,13 @@ const Tn = ({ hasActiveFilter: n = !1 }) => {
|
|
|
1157
1156
|
icon: /* @__PURE__ */ s(Ne, { size: "x-small" })
|
|
1158
1157
|
}
|
|
1159
1158
|
}, Ve = ({ type: n, onTypeChange: e, renderAsMenuTrigger: t = !1 }) => {
|
|
1160
|
-
const { translations: o } = G(), r = Cn[n], i = o[r.translationKey], [l, a] = W(!1), m =
|
|
1159
|
+
const { translations: o } = G(), r = Cn[n], i = o[r.translationKey], [l, a] = W(!1), m = V(null), d = V(null), g = K(
|
|
1161
1160
|
(h) => {
|
|
1162
1161
|
e == null || e(h), a(!1);
|
|
1163
1162
|
},
|
|
1164
1163
|
[e]
|
|
1165
1164
|
);
|
|
1166
|
-
return t && e ? /* @__PURE__ */
|
|
1165
|
+
return t && e ? /* @__PURE__ */ T(
|
|
1167
1166
|
te,
|
|
1168
1167
|
{
|
|
1169
1168
|
placement: "bottom start",
|
|
@@ -1173,11 +1172,11 @@ const Tn = ({ hasActiveFilter: n = !1 }) => {
|
|
|
1173
1172
|
shouldFocusTriggerOnClose: !0,
|
|
1174
1173
|
trigger: /* @__PURE__ */ s(ke, { color: r.color, renderIcon: r.icon, children: i }),
|
|
1175
1174
|
children: [
|
|
1176
|
-
/* @__PURE__ */
|
|
1175
|
+
/* @__PURE__ */ T(te.Item, { ref: m, onClick: () => g(w.CONFUSING), children: [
|
|
1177
1176
|
/* @__PURE__ */ s(Ne, { size: "x-small" }),
|
|
1178
1177
|
` ${o.markUnclear}`
|
|
1179
1178
|
] }),
|
|
1180
|
-
/* @__PURE__ */
|
|
1179
|
+
/* @__PURE__ */ T(te.Item, { ref: d, onClick: () => g(w.IMPORTANT), children: [
|
|
1181
1180
|
/* @__PURE__ */ s(be, { size: "x-small" }),
|
|
1182
1181
|
` ${o.markImportant}`
|
|
1183
1182
|
] })
|
|
@@ -1210,18 +1209,18 @@ const In = ({
|
|
|
1210
1209
|
renderLink: f,
|
|
1211
1210
|
href: y
|
|
1212
1211
|
}) => {
|
|
1213
|
-
const { translations: E } = G(), [H,
|
|
1214
|
-
|
|
1212
|
+
const { translations: E } = G(), [H, M] = W(!1), [N, I] = W(!1), [k, x] = W(o || ""), [O, _] = W(!1), F = V(null), D = K((p) => {
|
|
1213
|
+
F.current = p;
|
|
1215
1214
|
}, []);
|
|
1216
|
-
|
|
1217
|
-
var p;
|
|
1218
|
-
d && ((p =
|
|
1215
|
+
ee(() => {
|
|
1216
|
+
var p, v;
|
|
1217
|
+
d && ((p = F.current) == null || p.scrollIntoView({ behavior: "smooth", block: "nearest" }), (v = F.current) == null || v.focus());
|
|
1219
1218
|
}, [d]);
|
|
1220
|
-
const
|
|
1219
|
+
const Z = r === w.IMPORTANT ? E.important : E.unclear, R = (p) => {
|
|
1221
1220
|
p.key === "Enter" && (p.preventDefault(), i == null || i());
|
|
1222
|
-
}, b = [
|
|
1221
|
+
}, b = [Z, E.note];
|
|
1223
1222
|
t && b.push(t), o && b.push(o), e && b.push(Ae(e, u)), h && b.push(h);
|
|
1224
|
-
const P = b.join(", "), L = /* @__PURE__ */
|
|
1223
|
+
const P = b.join(", "), L = /* @__PURE__ */ T(
|
|
1225
1224
|
z,
|
|
1226
1225
|
{
|
|
1227
1226
|
as: "div",
|
|
@@ -1236,12 +1235,12 @@ const In = ({
|
|
|
1236
1235
|
"data-testid": "note-card",
|
|
1237
1236
|
elementRef: D,
|
|
1238
1237
|
onClick: d ? void 0 : i,
|
|
1239
|
-
onMouseEnter: () =>
|
|
1240
|
-
onMouseLeave: () =>
|
|
1238
|
+
onMouseEnter: () => M(!0),
|
|
1239
|
+
onMouseLeave: () => M(!1),
|
|
1241
1240
|
onKeyDown: d ? void 0 : R,
|
|
1242
1241
|
cursor: N ? "default" : "pointer",
|
|
1243
1242
|
children: [
|
|
1244
|
-
/* @__PURE__ */
|
|
1243
|
+
/* @__PURE__ */ T(C, { direction: "column", gap: "small", children: [
|
|
1245
1244
|
/* @__PURE__ */ s(
|
|
1246
1245
|
Ve,
|
|
1247
1246
|
{
|
|
@@ -1267,8 +1266,8 @@ const In = ({
|
|
|
1267
1266
|
children: t
|
|
1268
1267
|
}
|
|
1269
1268
|
) }) }) }) : /* @__PURE__ */ s(Qe, {}),
|
|
1270
|
-
/* @__PURE__ */
|
|
1271
|
-
N && g ? /* @__PURE__ */
|
|
1269
|
+
/* @__PURE__ */ T(C, { direction: "column", gap: "small", children: [
|
|
1270
|
+
N && g ? /* @__PURE__ */ T(C, { direction: "column", gap: "x-small", children: [
|
|
1272
1271
|
/* @__PURE__ */ s(
|
|
1273
1272
|
He,
|
|
1274
1273
|
{
|
|
@@ -1278,7 +1277,7 @@ const In = ({
|
|
|
1278
1277
|
placeholder: E.addNoteOptional
|
|
1279
1278
|
}
|
|
1280
1279
|
),
|
|
1281
|
-
/* @__PURE__ */
|
|
1280
|
+
/* @__PURE__ */ T(C, { gap: "xx-small", children: [
|
|
1282
1281
|
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1283
1282
|
$,
|
|
1284
1283
|
{
|
|
@@ -1306,11 +1305,11 @@ const In = ({
|
|
|
1306
1305
|
}
|
|
1307
1306
|
) })
|
|
1308
1307
|
] })
|
|
1309
|
-
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: d && g ? /* @__PURE__ */
|
|
1308
|
+
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: d && g ? /* @__PURE__ */ T(U, { children: [
|
|
1310
1309
|
o,
|
|
1311
1310
|
" ",
|
|
1312
1311
|
/* @__PURE__ */ s(
|
|
1313
|
-
|
|
1312
|
+
Q,
|
|
1314
1313
|
{
|
|
1315
1314
|
size: "small",
|
|
1316
1315
|
withBackground: !1,
|
|
@@ -1323,11 +1322,11 @@ const In = ({
|
|
|
1323
1322
|
children: /* @__PURE__ */ s(fe, {})
|
|
1324
1323
|
}
|
|
1325
1324
|
)
|
|
1326
|
-
] }) : /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: o }) }) }) : g && d ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */
|
|
1325
|
+
] }) : /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: o }) }) }) : g && d ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ T(U, { color: "secondary", children: [
|
|
1327
1326
|
E.addNotePrompt,
|
|
1328
1327
|
" ",
|
|
1329
1328
|
/* @__PURE__ */ s(
|
|
1330
|
-
|
|
1329
|
+
Q,
|
|
1331
1330
|
{
|
|
1332
1331
|
size: "small",
|
|
1333
1332
|
withBackground: !1,
|
|
@@ -1341,10 +1340,10 @@ const In = ({
|
|
|
1341
1340
|
}
|
|
1342
1341
|
)
|
|
1343
1342
|
] }) }) : null,
|
|
1344
|
-
/* @__PURE__ */
|
|
1343
|
+
/* @__PURE__ */ T(C, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1345
1344
|
/* @__PURE__ */ s(U, { size: "small", color: "secondary", children: Ae(e, u) }),
|
|
1346
1345
|
d && l && /* @__PURE__ */ s(
|
|
1347
|
-
|
|
1346
|
+
Q,
|
|
1348
1347
|
{
|
|
1349
1348
|
size: "small",
|
|
1350
1349
|
withBackground: !1,
|
|
@@ -1375,7 +1374,7 @@ const In = ({
|
|
|
1375
1374
|
insetInlineStart: "0",
|
|
1376
1375
|
insetInlineEnd: "0",
|
|
1377
1376
|
stacking: "above",
|
|
1378
|
-
children: /* @__PURE__ */
|
|
1377
|
+
children: /* @__PURE__ */ T(
|
|
1379
1378
|
C,
|
|
1380
1379
|
{
|
|
1381
1380
|
direction: "column",
|
|
@@ -1457,12 +1456,12 @@ const wn = {
|
|
|
1457
1456
|
renderNoteLink: y,
|
|
1458
1457
|
noteHref: E
|
|
1459
1458
|
}) => {
|
|
1460
|
-
const { translations: H } = G(),
|
|
1459
|
+
const { translations: H } = G(), M = re(
|
|
1461
1460
|
() => xn(n, u),
|
|
1462
1461
|
[n, u]
|
|
1463
1462
|
), N = (o == null ? void 0 : o.hasNextPage) || (o == null ? void 0 : o.hasPreviousPage);
|
|
1464
|
-
return e ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(at, { renderTitle: H.loadingNotes }) }) : t ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(ae, { level: "h4", children: H.failedToLoadNotes }) }) : n.length === 0 ? /* @__PURE__ */ s(z, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(Tn, { hasActiveFilter: h }) }) : /* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */ s("div", { style: wn, "data-testid": "notes-grid", children:
|
|
1463
|
+
return e ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(at, { renderTitle: H.loadingNotes }) }) : t ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(ae, { level: "h4", children: H.failedToLoadNotes }) }) : n.length === 0 ? /* @__PURE__ */ s(z, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(Tn, { hasActiveFilter: h }) }) : /* @__PURE__ */ T(Ye, { children: [
|
|
1464
|
+
/* @__PURE__ */ s("div", { style: wn, "data-testid": "notes-grid", children: M.map((I, k) => (
|
|
1466
1465
|
// oxlint-disable-next-line react/no-array-index-key -- columns are positional, index is stable
|
|
1467
1466
|
/* @__PURE__ */ s("div", { style: kn, children: I.map((x) => {
|
|
1468
1467
|
var O;
|
|
@@ -1478,8 +1477,8 @@ const wn = {
|
|
|
1478
1477
|
isPanelView: !!g,
|
|
1479
1478
|
onClick: l ? () => l(x.id) : void 0,
|
|
1480
1479
|
onDelete: a ? (_) => a(_) : void 0,
|
|
1481
|
-
onSaveNote: m ? (_,
|
|
1482
|
-
onTypeChange: d ? (_,
|
|
1480
|
+
onSaveNote: m ? (_, F) => m(_, F) : void 0,
|
|
1481
|
+
onTypeChange: d ? (_, F) => d(_, F) : void 0,
|
|
1483
1482
|
highlightTheme: S,
|
|
1484
1483
|
locale: f,
|
|
1485
1484
|
renderLink: y,
|
|
@@ -1489,9 +1488,9 @@ const wn = {
|
|
|
1489
1488
|
);
|
|
1490
1489
|
}) }, k)
|
|
1491
1490
|
)) }),
|
|
1492
|
-
N && /* @__PURE__ */
|
|
1491
|
+
N && /* @__PURE__ */ T(C, { justifyItems: "center", gap: "small", padding: "small", "data-testid": "notes-pagination", children: [
|
|
1493
1492
|
/* @__PURE__ */ s(
|
|
1494
|
-
|
|
1493
|
+
Q,
|
|
1495
1494
|
{
|
|
1496
1495
|
size: "small",
|
|
1497
1496
|
screenReaderLabel: H.previousPage,
|
|
@@ -1502,7 +1501,7 @@ const wn = {
|
|
|
1502
1501
|
}
|
|
1503
1502
|
),
|
|
1504
1503
|
/* @__PURE__ */ s(
|
|
1505
|
-
|
|
1504
|
+
Q,
|
|
1506
1505
|
{
|
|
1507
1506
|
size: "small",
|
|
1508
1507
|
screenReaderLabel: H.nextPage,
|
|
@@ -1526,10 +1525,10 @@ const wn = {
|
|
|
1526
1525
|
editing: m = !1
|
|
1527
1526
|
}) => {
|
|
1528
1527
|
const { translations: d } = G(), [g, h] = W(m), [u, S] = W(n || ""), [f, y] = W(!1);
|
|
1529
|
-
return /* @__PURE__ */
|
|
1528
|
+
return /* @__PURE__ */ T(C, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1530
1529
|
t != null ? /* @__PURE__ */ s(z, { as: "div", children: /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(he, { type: e, isCardActive: !0, theme: o, children: t }) }) }) : /* @__PURE__ */ s(Qe, {}),
|
|
1531
1530
|
/* @__PURE__ */ s(Ve, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1532
|
-
g ? /* @__PURE__ */
|
|
1531
|
+
g ? /* @__PURE__ */ T(C, { direction: "column", gap: "x-small", children: [
|
|
1533
1532
|
/* @__PURE__ */ s(
|
|
1534
1533
|
He,
|
|
1535
1534
|
{
|
|
@@ -1539,7 +1538,7 @@ const wn = {
|
|
|
1539
1538
|
resize: "vertical"
|
|
1540
1539
|
}
|
|
1541
1540
|
),
|
|
1542
|
-
/* @__PURE__ */
|
|
1541
|
+
/* @__PURE__ */ T(C, { gap: "xx-small", children: [
|
|
1543
1542
|
/* @__PURE__ */ s(C.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1544
1543
|
$,
|
|
1545
1544
|
{
|
|
@@ -1566,12 +1565,12 @@ const wn = {
|
|
|
1566
1565
|
}
|
|
1567
1566
|
) })
|
|
1568
1567
|
] })
|
|
1569
|
-
] }) : /* @__PURE__ */
|
|
1570
|
-
n && /* @__PURE__ */
|
|
1568
|
+
] }) : /* @__PURE__ */ T(C, { direction: "column", gap: "small", children: [
|
|
1569
|
+
n && /* @__PURE__ */ T(z, { as: "div", children: [
|
|
1571
1570
|
/* @__PURE__ */ s(ae, { level: "h4", margin: "0 0 xx-small 0", children: d.note }),
|
|
1572
1571
|
/* @__PURE__ */ s(U, { children: n })
|
|
1573
1572
|
] }),
|
|
1574
|
-
/* @__PURE__ */
|
|
1573
|
+
/* @__PURE__ */ T(C, { justifyItems: "space-between", children: [
|
|
1575
1574
|
/* @__PURE__ */ s(
|
|
1576
1575
|
$,
|
|
1577
1576
|
{
|
|
@@ -1582,9 +1581,9 @@ const wn = {
|
|
|
1582
1581
|
children: d.back
|
|
1583
1582
|
}
|
|
1584
1583
|
),
|
|
1585
|
-
/* @__PURE__ */
|
|
1584
|
+
/* @__PURE__ */ T(C, { gap: "xx-small", children: [
|
|
1586
1585
|
i && /* @__PURE__ */ s(
|
|
1587
|
-
|
|
1586
|
+
Q,
|
|
1588
1587
|
{
|
|
1589
1588
|
size: "small",
|
|
1590
1589
|
withBackground: !1,
|
|
@@ -1597,7 +1596,7 @@ const wn = {
|
|
|
1597
1596
|
}
|
|
1598
1597
|
),
|
|
1599
1598
|
/* @__PURE__ */ s(
|
|
1600
|
-
|
|
1599
|
+
Q,
|
|
1601
1600
|
{
|
|
1602
1601
|
size: "small",
|
|
1603
1602
|
withBackground: !1,
|
|
@@ -1610,7 +1609,7 @@ const wn = {
|
|
|
1610
1609
|
)
|
|
1611
1610
|
] })
|
|
1612
1611
|
] }),
|
|
1613
|
-
f && i && /* @__PURE__ */ s(z, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */
|
|
1612
|
+
f && i && /* @__PURE__ */ s(z, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ T(C, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1614
1613
|
/* @__PURE__ */ s(
|
|
1615
1614
|
$,
|
|
1616
1615
|
{
|