@instructure/platform-modules 1.12.0 → 1.14.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/README.md +3 -0
- package/dist/adapters/canvasGraphql/index.d.ts.map +1 -1
- package/dist/adapters/canvasGraphql/normalize.d.ts +1 -0
- package/dist/adapters/canvasGraphql/normalize.d.ts.map +1 -1
- package/dist/adapters/canvasGraphql/queries.d.ts +13 -1
- package/dist/adapters/canvasGraphql/queries.d.ts.map +1 -1
- package/dist/chunks/ModulesProgressBar-B4fXbi-4.js +2516 -0
- package/dist/components/FilterSelect.d.ts.map +1 -1
- package/dist/components/ModuleCard.d.ts.map +1 -1
- package/dist/components/ModuleItemRow.d.ts +8 -6
- package/dist/components/ModuleItemRow.d.ts.map +1 -1
- package/dist/components/ModulesList.d.ts.map +1 -1
- package/dist/components/ModulesList.stories.d.ts +1 -0
- package/dist/components/ModulesList.stories.d.ts.map +1 -1
- package/dist/components/ModulesProgressBar.d.ts +23 -2
- package/dist/components/ModulesProgressBar.d.ts.map +1 -1
- package/dist/components/ModulesProgressBar.stories.d.ts.map +1 -1
- package/dist/config/base.d.ts.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/itemMeta.d.ts.map +1 -1
- package/dist/config/itemTypes.d.ts +1 -1
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/schemas.d.ts.map +1 -1
- package/dist/config/types.d.ts +22 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/edit/EditModuleCard.d.ts +17 -0
- package/dist/edit/EditModuleCard.d.ts.map +1 -0
- package/dist/edit/EditModuleItemRow.d.ts +9 -0
- package/dist/edit/EditModuleItemRow.d.ts.map +1 -0
- package/dist/edit/ModulesEditActions.d.ts +7 -0
- package/dist/edit/ModulesEditActions.d.ts.map +1 -0
- package/dist/edit/ModulesEditView.d.ts +10 -0
- package/dist/edit/ModulesEditView.d.ts.map +1 -0
- package/dist/edit/ModulesEditView.stories.d.ts +16 -0
- package/dist/edit/ModulesEditView.stories.d.ts.map +1 -0
- package/dist/edit/adapter/inMemoryEdit.d.ts +5 -0
- package/dist/edit/adapter/inMemoryEdit.d.ts.map +1 -0
- package/dist/edit/adapter/types.d.ts +90 -0
- package/dist/edit/adapter/types.d.ts.map +1 -0
- package/dist/edit/controls/AddItemMenu.d.ts +6 -0
- package/dist/edit/controls/AddItemMenu.d.ts.map +1 -0
- package/dist/edit/controls/AddModuleButton.d.ts +6 -0
- package/dist/edit/controls/AddModuleButton.d.ts.map +1 -0
- package/dist/edit/controls/InlineRename.d.ts +5 -0
- package/dist/edit/controls/InlineRename.d.ts.map +1 -0
- package/dist/edit/controls/ItemActionsMenu.d.ts +7 -0
- package/dist/edit/controls/ItemActionsMenu.d.ts.map +1 -0
- package/dist/edit/controls/ItemPublishToggle.d.ts +6 -0
- package/dist/edit/controls/ItemPublishToggle.d.ts.map +1 -0
- package/dist/edit/controls/ModuleActionsMenu.d.ts +6 -0
- package/dist/edit/controls/ModuleActionsMenu.d.ts.map +1 -0
- package/dist/edit/controls/ModulePublishMenu.d.ts +6 -0
- package/dist/edit/controls/ModulePublishMenu.d.ts.map +1 -0
- package/dist/edit/controls/ModuleSettingsModal.d.ts +6 -0
- package/dist/edit/controls/ModuleSettingsModal.d.ts.map +1 -0
- package/dist/edit/controls/PublishAllMenu.d.ts +6 -0
- package/dist/edit/controls/PublishAllMenu.d.ts.map +1 -0
- package/dist/edit/controls/ViewAsLearnerButton.d.ts +6 -0
- package/dist/edit/controls/ViewAsLearnerButton.d.ts.map +1 -0
- package/dist/edit/hooks/useModulesEditData.d.ts +28 -0
- package/dist/edit/hooks/useModulesEditData.d.ts.map +1 -0
- package/dist/edit/index.d.ts +9 -0
- package/dist/edit/index.d.ts.map +1 -0
- package/dist/edit.js +570 -0
- package/dist/hooks/constants.d.ts +2 -0
- package/dist/hooks/constants.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useIsMobileViewport.d.ts +3 -0
- package/dist/hooks/useIsMobileViewport.d.ts.map +1 -0
- package/dist/hooks/useModulesPageData.d.ts +3 -0
- package/dist/hooks/useModulesPageData.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1210 -3418
- package/dist/types/domain.d.ts +2 -0
- package/dist/types/domain.d.ts.map +1 -1
- package/dist/types/schemas.d.ts.map +1 -1
- package/locales/en.json +14 -1
- package/package.json +8 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { CreateModuleArgs, CreateModuleItemArgs, DeleteModuleArgs, DeleteModuleItemArgs, ModuleItemPatch, ModulePatch, ModulesEditAdapter, ModulesEditCapability, ReorderModuleItemsArgs, ReorderModulesArgs, SetModulesPublishedArgs, UpdateModuleArgs, UpdateModuleItemArgs, } from './adapter/types';
|
|
2
|
+
export { createInMemoryEditAdapter } from './adapter/inMemoryEdit';
|
|
3
|
+
export { type ModulesEditCan, type ModulesEditMutations, useModulesEditData, type UseModulesEditDataOptions, type UseModulesEditDataResult, } from './hooks/useModulesEditData';
|
|
4
|
+
export type { ModulesNotice, ModulesNotify, ModulesPermissions } from '../config/types';
|
|
5
|
+
export { ModulesEditView, type ModulesEditViewProps } from './ModulesEditView';
|
|
6
|
+
export { ModulesEditActions, type ModulesEditActionsProps } from './ModulesEditActions';
|
|
7
|
+
export { EditModuleCard, type EditModuleCardProps } from './EditModuleCard';
|
|
8
|
+
export { EditModuleItemRow, type EditModuleItemRowProps } from './EditModuleItemRow';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/edit/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,4BAA4B,CAAA;AACnC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACvF,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AACvF,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/edit.js
ADDED
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
import { P as X, a7 as Y, Q as J, k as N, aw as K, i as Z, c as ee, u as w, q as D, y as O, v as te, an as ne, ak as ie, aH as E, A as oe, B as $, n as z, aI as le, aJ as re, z as se, p as ae } from "./chunks/ModulesProgressBar-B4fXbi-4.js";
|
|
2
|
+
import { useQueryClient as de, useMutation as ue } from "@tanstack/react-query";
|
|
3
|
+
import { useMemo as j, Fragment as U, useState as ce } from "react";
|
|
4
|
+
import { jsx as t, jsxs as f, Fragment as W } from "react/jsx-runtime";
|
|
5
|
+
import { TruncateWithTooltip as me, getLiveRegion as H, politeAnnounce as pe } from "@instructure/platform-instui-bindings";
|
|
6
|
+
import { Alert as x } from "@instructure/ui-alerts/v11_7";
|
|
7
|
+
import { Heading as G } from "@instructure/ui-heading/v11_7";
|
|
8
|
+
import { Pagination as V } from "@instructure/ui-pagination/v11_7";
|
|
9
|
+
import { Spinner as Q } from "@instructure/ui-spinner/v11_7";
|
|
10
|
+
import { Text as L } from "@instructure/ui-text/v11_7";
|
|
11
|
+
import { View as y } from "@instructure/ui-view/v11_7";
|
|
12
|
+
import { ScreenReaderContent as ge } from "@instructure/ui-a11y-content";
|
|
13
|
+
import { IconButton as he, Button as Me } from "@instructure/ui-buttons/v11_7";
|
|
14
|
+
import { Flex as b } from "@instructure/ui-flex/v11_7";
|
|
15
|
+
import { CornerDownRightInstUIIcon as Ie, IconArrowOpenUpLine as fe, IconArrowOpenDownLine as ve, LayersInstUIIcon as be, ListChecksInstUIIcon as ye, ClockInstUIIcon as Pe, LockInstUIIcon as Ae } from "@instructure/ui-icons";
|
|
16
|
+
import { List as Le, ListItem as ke } from "@instructure/ui-list/v11_7";
|
|
17
|
+
import { Pill as we } from "@instructure/ui-pill/v11_7";
|
|
18
|
+
import { Link as Ce } from "@instructure/ui-link/v11_7";
|
|
19
|
+
const k = (e) => e.map((o, l) => ({ ...o, position: l + 1 })), B = (e, o, l) => {
|
|
20
|
+
const r = l === void 0 ? e.length : Math.min(Math.max(l - 1, 0), e.length);
|
|
21
|
+
return [...e.slice(0, r), o, ...e.slice(r)];
|
|
22
|
+
}, S = (e, o) => {
|
|
23
|
+
const l = new Map(o.map((r, s) => [r, s]));
|
|
24
|
+
return [...e].sort((r, s) => (l.get(r.id) ?? o.length) - (l.get(s.id) ?? o.length));
|
|
25
|
+
};
|
|
26
|
+
function at(e, o = {}) {
|
|
27
|
+
const l = (n) => {
|
|
28
|
+
if (n !== e.courseId)
|
|
29
|
+
throw new Y(e.courseId, n);
|
|
30
|
+
}, r = (n) => {
|
|
31
|
+
const i = e.modules.findIndex((a) => a.id === n);
|
|
32
|
+
if (i === -1) throw new Error(`in-memory adapter has no module ${n}`);
|
|
33
|
+
return i;
|
|
34
|
+
}, s = (n) => e.itemsByModuleId[n] ?? [], u = (n, i) => {
|
|
35
|
+
e.itemsByModuleId[n] = k(i.map((a) => ({ ...a, moduleId: n })));
|
|
36
|
+
}, c = (n) => String(n.reduce((i, a) => Math.max(i, Number(a) || 0), 0) + 1);
|
|
37
|
+
return {
|
|
38
|
+
...X(e, o),
|
|
39
|
+
async createModule({ courseId: n, name: i, position: a }) {
|
|
40
|
+
l(n);
|
|
41
|
+
const p = {
|
|
42
|
+
id: c(e.modules.map((d) => d.id)),
|
|
43
|
+
name: i,
|
|
44
|
+
position: 0,
|
|
45
|
+
published: !1,
|
|
46
|
+
itemCount: 0,
|
|
47
|
+
prerequisiteModules: [],
|
|
48
|
+
requireSequentialProgress: !1
|
|
49
|
+
};
|
|
50
|
+
return e.modules = k(B(e.modules, p, a)), e.itemsByModuleId[p.id] = [], e.modules[r(p.id)];
|
|
51
|
+
},
|
|
52
|
+
async updateModule({ courseId: n, moduleId: i, patch: a }) {
|
|
53
|
+
l(n);
|
|
54
|
+
const { prerequisiteModuleIds: p, position: d, ...m } = a, h = e.modules[r(i)], M = { ...h, ...m };
|
|
55
|
+
p && (M.prerequisiteModules = p.map((I) => ({
|
|
56
|
+
id: I,
|
|
57
|
+
name: e.modules[r(I)].name
|
|
58
|
+
})));
|
|
59
|
+
const P = e.modules.filter((I) => I.id !== i);
|
|
60
|
+
return e.modules = k(B(P, M, d ?? h.position)), e.modules[r(i)];
|
|
61
|
+
},
|
|
62
|
+
async deleteModule({ courseId: n, moduleId: i }) {
|
|
63
|
+
l(n), r(i), e.modules = k(e.modules.filter((a) => a.id !== i)), delete e.itemsByModuleId[i];
|
|
64
|
+
},
|
|
65
|
+
async reorderModules({ courseId: n, moduleIds: i }) {
|
|
66
|
+
l(n), e.modules = k(S(e.modules, i));
|
|
67
|
+
},
|
|
68
|
+
async setModulesPublished({ courseId: n, moduleIds: i, published: a, includeItems: p }) {
|
|
69
|
+
l(n);
|
|
70
|
+
const d = new Set(
|
|
71
|
+
i === "all" ? e.modules.map((m) => m.id) : i
|
|
72
|
+
);
|
|
73
|
+
if (e.modules = e.modules.map(
|
|
74
|
+
(m) => d.has(m.id) ? { ...m, published: a } : m
|
|
75
|
+
), !!p)
|
|
76
|
+
for (const m of d)
|
|
77
|
+
u(
|
|
78
|
+
m,
|
|
79
|
+
s(m).map((h) => ({ ...h, published: a }))
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
async createModuleItem({ courseId: n, moduleId: i, type: a, title: p, position: d, indent: m = 0, extensions: h }) {
|
|
83
|
+
l(n), r(i);
|
|
84
|
+
const M = Object.values(e.itemsByModuleId).flatMap(
|
|
85
|
+
(I) => I.map((v) => v.id)
|
|
86
|
+
), P = {
|
|
87
|
+
id: c(M),
|
|
88
|
+
moduleId: i,
|
|
89
|
+
title: p,
|
|
90
|
+
type: a,
|
|
91
|
+
position: 0,
|
|
92
|
+
indent: m,
|
|
93
|
+
published: !1,
|
|
94
|
+
...h ? { extensions: h } : {}
|
|
95
|
+
};
|
|
96
|
+
return u(i, B(s(i), P, d)), s(i).find((I) => I.id === P.id);
|
|
97
|
+
},
|
|
98
|
+
async updateModuleItem({ courseId: n, moduleId: i, itemId: a, patch: p }) {
|
|
99
|
+
l(n);
|
|
100
|
+
const { moduleId: d = i, position: m, ...h } = p;
|
|
101
|
+
r(d);
|
|
102
|
+
const M = s(i).find((v) => v.id === a);
|
|
103
|
+
if (!M) throw new Error(`in-memory adapter has no item ${a} in module ${i}`);
|
|
104
|
+
u(
|
|
105
|
+
i,
|
|
106
|
+
s(i).filter((v) => v.id !== a)
|
|
107
|
+
);
|
|
108
|
+
const I = m ?? (d !== i ? void 0 : M.position);
|
|
109
|
+
return u(d, B(s(d), { ...M, ...h }, I)), s(d).find((v) => v.id === a);
|
|
110
|
+
},
|
|
111
|
+
async deleteModuleItem({ courseId: n, moduleId: i, itemId: a }) {
|
|
112
|
+
l(n), u(
|
|
113
|
+
i,
|
|
114
|
+
s(i).filter((p) => p.id !== a)
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
async reorderModuleItems({ courseId: n, moduleId: i, itemIds: a }) {
|
|
118
|
+
l(n), u(i, S(s(i), a));
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const Te = [
|
|
123
|
+
"createModule",
|
|
124
|
+
"updateModule",
|
|
125
|
+
"deleteModule",
|
|
126
|
+
"reorderModules",
|
|
127
|
+
"setModulesPublished",
|
|
128
|
+
"createModuleItem",
|
|
129
|
+
"updateModuleItem",
|
|
130
|
+
"deleteModuleItem",
|
|
131
|
+
"reorderModuleItems"
|
|
132
|
+
];
|
|
133
|
+
function A(e, o, l, r, s) {
|
|
134
|
+
return ue({
|
|
135
|
+
mutationFn: (u) => !o[e] || !r ? Promise.reject(new Error(`${e} is not available to this editor`)) : r({ ...u, courseId: l }),
|
|
136
|
+
// Settled, not success: a bulk write that fails partway has still committed part of itself.
|
|
137
|
+
onSettled: (u, c, n) => s(n)
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function dt(e) {
|
|
141
|
+
const { adapter: o, courseId: l } = e, r = J({ ...e, view: "teacher" }), s = de(), { permissions: u } = N(), c = j(
|
|
142
|
+
() => Object.fromEntries(
|
|
143
|
+
Te.map((d) => [
|
|
144
|
+
d,
|
|
145
|
+
typeof o[d] == "function" && u[d] !== !1
|
|
146
|
+
])
|
|
147
|
+
),
|
|
148
|
+
[o, u]
|
|
149
|
+
), n = () => Z(s, l), i = (...d) => Promise.all([
|
|
150
|
+
n(),
|
|
151
|
+
...d.map((m) => ee(s, l, m))
|
|
152
|
+
]), a = (d) => {
|
|
153
|
+
var m;
|
|
154
|
+
return (m = o[d]) == null ? void 0 : m.bind(o);
|
|
155
|
+
}, p = {
|
|
156
|
+
createModule: A("createModule", c, l, a("createModule"), n),
|
|
157
|
+
updateModule: A("updateModule", c, l, a("updateModule"), n),
|
|
158
|
+
deleteModule: A("deleteModule", c, l, a("deleteModule"), n),
|
|
159
|
+
reorderModules: A("reorderModules", c, l, a("reorderModules"), n),
|
|
160
|
+
setModulesPublished: A(
|
|
161
|
+
"setModulesPublished",
|
|
162
|
+
c,
|
|
163
|
+
l,
|
|
164
|
+
a("setModulesPublished"),
|
|
165
|
+
({ includeItems: d }) => d ? K(s, l) : n()
|
|
166
|
+
),
|
|
167
|
+
createModuleItem: A(
|
|
168
|
+
"createModuleItem",
|
|
169
|
+
c,
|
|
170
|
+
l,
|
|
171
|
+
a("createModuleItem"),
|
|
172
|
+
({ moduleId: d }) => i(d)
|
|
173
|
+
),
|
|
174
|
+
updateModuleItem: A(
|
|
175
|
+
"updateModuleItem",
|
|
176
|
+
c,
|
|
177
|
+
l,
|
|
178
|
+
a("updateModuleItem"),
|
|
179
|
+
({ moduleId: d, patch: m }) => i(
|
|
180
|
+
d,
|
|
181
|
+
...m.moduleId && m.moduleId !== d ? [m.moduleId] : []
|
|
182
|
+
)
|
|
183
|
+
),
|
|
184
|
+
deleteModuleItem: A(
|
|
185
|
+
"deleteModuleItem",
|
|
186
|
+
c,
|
|
187
|
+
l,
|
|
188
|
+
a("deleteModuleItem"),
|
|
189
|
+
({ moduleId: d }) => i(d)
|
|
190
|
+
),
|
|
191
|
+
reorderModuleItems: A(
|
|
192
|
+
"reorderModuleItems",
|
|
193
|
+
c,
|
|
194
|
+
l,
|
|
195
|
+
a("reorderModuleItems"),
|
|
196
|
+
({ moduleId: d }) => i(d)
|
|
197
|
+
)
|
|
198
|
+
};
|
|
199
|
+
return { ...r, can: c, mutations: p };
|
|
200
|
+
}
|
|
201
|
+
function Be(e) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
function q(e) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
function Re(e) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
function Ee(e) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
function qe(e) {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
function Fe(e) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
function Se(e) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
function _e({ item: e, module: o, today: l }) {
|
|
223
|
+
var C, T;
|
|
224
|
+
const { t: r, locale: s, timezone: u } = w(), c = D(), n = N(), i = O(), a = j(() => te(n.itemMeta), [n.itemMeta]), p = e.title || r("itemUntitled"), d = /* @__PURE__ */ f(W, { children: [
|
|
225
|
+
/* @__PURE__ */ t(Fe, { module: o, item: e }),
|
|
226
|
+
/* @__PURE__ */ t(Se, { item: e })
|
|
227
|
+
] });
|
|
228
|
+
if (e.type === "sub_header")
|
|
229
|
+
return /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
230
|
+
y,
|
|
231
|
+
{
|
|
232
|
+
as: "div",
|
|
233
|
+
padding: "x-small small",
|
|
234
|
+
borderWidth: "small 0 0 0",
|
|
235
|
+
"data-testid": `edit-item-${e.id}`,
|
|
236
|
+
children: /* @__PURE__ */ f(b, { alignItems: "center", gap: "small", children: [
|
|
237
|
+
/* @__PURE__ */ f(b.Item, { shouldGrow: !0, shouldShrink: !0, children: [
|
|
238
|
+
/* @__PURE__ */ t(L, { weight: "bold", "data-testid": "edit-item-title", children: p }),
|
|
239
|
+
/* @__PURE__ */ t(q, { name: p })
|
|
240
|
+
] }),
|
|
241
|
+
d
|
|
242
|
+
] })
|
|
243
|
+
}
|
|
244
|
+
) });
|
|
245
|
+
const m = ne(n.itemTypes, e.type), h = m != null && m.renderIcon ? m.renderIcon({ item: e }) : m == null ? void 0 : m.icon, M = ((T = (C = n.navigation).getItemEditHref) == null ? void 0 : T.call(C, e)) ?? null, P = { item: e, t: r, today: l, locale: s, timezone: u, formatters: c, config: n }, I = a.map((g) => ({
|
|
246
|
+
key: g.key,
|
|
247
|
+
node: g.render(P),
|
|
248
|
+
icon: g.key === ie ? null : g.renderIcon ? g.renderIcon(P) : g.icon
|
|
249
|
+
})).filter((g) => !E(g.node)), v = /* @__PURE__ */ t(L, { weight: "bold", "data-testid": "edit-item-title", children: p });
|
|
250
|
+
return /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(y, { as: "div", padding: "small", borderWidth: "small 0 0 0", "data-testid": `edit-item-${e.id}`, children: /* @__PURE__ */ t("div", { style: { paddingInlineStart: `${Math.max(e.indent - 1, 0) * le}rem` }, children: /* @__PURE__ */ f(b, { alignItems: "center", gap: "small", children: [
|
|
251
|
+
e.indent > 0 ? /* @__PURE__ */ t(b.Item, { "data-testid": "edit-item-nest-arrow", children: /* @__PURE__ */ t(Ie, { size: "md", color: "mutedColor" }) }) : null,
|
|
252
|
+
E(h) ? null : /* @__PURE__ */ t(b.Item, { "aria-hidden": "true", children: h }),
|
|
253
|
+
/* @__PURE__ */ f(b.Item, { shouldGrow: !0, shouldShrink: !0, children: [
|
|
254
|
+
M ? /* @__PURE__ */ t(Ce, { href: M, forceButtonRole: !1, "data-testid": "edit-item-link", children: v }) : v,
|
|
255
|
+
/* @__PURE__ */ t(q, { name: p }),
|
|
256
|
+
I.length > 0 ? /* @__PURE__ */ t("div", { style: oe, children: /* @__PURE__ */ t(
|
|
257
|
+
L,
|
|
258
|
+
{
|
|
259
|
+
size: "small",
|
|
260
|
+
lineHeight: "default",
|
|
261
|
+
color: "secondary",
|
|
262
|
+
"data-testid": "edit-item-meta",
|
|
263
|
+
children: I.map((g, F) => /* @__PURE__ */ f(U, { children: [
|
|
264
|
+
F > 0 ? /* @__PURE__ */ t("span", { style: $, children: " " }) : null,
|
|
265
|
+
/* @__PURE__ */ f("span", { style: F > 0 ? i : void 0, children: [
|
|
266
|
+
E(g.icon) ? null : /* @__PURE__ */ t("span", { style: z, "aria-hidden": "true", children: g.icon }),
|
|
267
|
+
g.node
|
|
268
|
+
] })
|
|
269
|
+
] }, g.key))
|
|
270
|
+
}
|
|
271
|
+
) }) : null
|
|
272
|
+
] }),
|
|
273
|
+
/* @__PURE__ */ t(b.Item, { children: /* @__PURE__ */ t(we, { "data-testid": "edit-item-requirement", children: e.completionRequirement ? r("itemRequiredTag") : r("itemOptionalTag") }) }),
|
|
274
|
+
d
|
|
275
|
+
] }) }) }) });
|
|
276
|
+
}
|
|
277
|
+
const Ne = re("grey"), _ = (e) => `platform-modules-edit-panel-${e}`, R = { size: "sm", color: "onColor" };
|
|
278
|
+
function De(e, o, l, r) {
|
|
279
|
+
const s = [
|
|
280
|
+
{
|
|
281
|
+
key: "items",
|
|
282
|
+
icon: /* @__PURE__ */ t(be, { ...R }),
|
|
283
|
+
text: l("moduleItemCount", { count: e.itemCount })
|
|
284
|
+
}
|
|
285
|
+
], u = [];
|
|
286
|
+
e.unlockAt && new Date(e.unlockAt) > o && u.push(r.unlockByline(e.unlockAt, o));
|
|
287
|
+
const c = e.prerequisiteModules.map((i) => i.name.trim()).filter(Boolean);
|
|
288
|
+
c.length === 1 ? u.push(l("lockedByPrerequisiteByline", { name: c[0] })) : c.length > 1 && u.push(
|
|
289
|
+
l("lockedByPrerequisitesByline", {
|
|
290
|
+
count: c.length,
|
|
291
|
+
prerequisites: c.join(", ")
|
|
292
|
+
})
|
|
293
|
+
), u.length > 0 && s.push({ key: "lock", icon: /* @__PURE__ */ t(Ae, { ...R }), text: u.join(" ") }), e.completionRequirements && e.completionRequirements.length > 0 && s.push({
|
|
294
|
+
key: "requirement",
|
|
295
|
+
icon: /* @__PURE__ */ t(ye, { ...R }),
|
|
296
|
+
text: e.requireSequentialProgress ? l("moduleRequirementAllInOrder") : e.requirementCount === 1 ? l("moduleRequirementOne") : l("moduleRequirementAll")
|
|
297
|
+
});
|
|
298
|
+
const n = se(e.items);
|
|
299
|
+
return n !== null && s.push({
|
|
300
|
+
key: "duration",
|
|
301
|
+
icon: /* @__PURE__ */ t(Pe, { ...R }),
|
|
302
|
+
text: r.estimatedDurationByline(n)
|
|
303
|
+
}), s;
|
|
304
|
+
}
|
|
305
|
+
function Oe({
|
|
306
|
+
module: e,
|
|
307
|
+
state: o,
|
|
308
|
+
today: l
|
|
309
|
+
}) {
|
|
310
|
+
const { t: r } = w();
|
|
311
|
+
if (o.error)
|
|
312
|
+
return /* @__PURE__ */ t(y, { as: "div", padding: "small", children: /* @__PURE__ */ t(
|
|
313
|
+
x,
|
|
314
|
+
{
|
|
315
|
+
variant: "error",
|
|
316
|
+
margin: "0",
|
|
317
|
+
liveRegion: H,
|
|
318
|
+
liveRegionPoliteness: "assertive",
|
|
319
|
+
"data-testid": "edit-items-error",
|
|
320
|
+
children: r("itemsLoadErrorAlert", { message: o.error.message })
|
|
321
|
+
}
|
|
322
|
+
) });
|
|
323
|
+
if (o.isLoading)
|
|
324
|
+
return /* @__PURE__ */ t(y, { as: "div", padding: "small", "data-testid": "edit-items-loading", children: /* @__PURE__ */ t(Q, { size: "x-small", renderTitle: r("itemsLoadingSpinnerLabel") }) });
|
|
325
|
+
if (o.items.length === 0)
|
|
326
|
+
return /* @__PURE__ */ t(y, { as: "div", padding: "small", "data-testid": "edit-items-empty", children: /* @__PURE__ */ t(L, { size: "small", color: "secondary", children: r("noItemsEmptyState") }) });
|
|
327
|
+
const s = (u) => {
|
|
328
|
+
u === 1 ? o.goToFirstPage() : u === o.page - 1 ? o.goToPreviousPage() : u === o.page + 1 ? o.goToNextPage() : u === o.pageCount && o.goToLastPage();
|
|
329
|
+
};
|
|
330
|
+
return /* @__PURE__ */ f(W, { children: [
|
|
331
|
+
/* @__PURE__ */ t(Le, { isUnstyled: !0, margin: "none", "data-testid": "edit-items-list", children: o.items.map((u) => /* @__PURE__ */ t(ke, { children: /* @__PURE__ */ t(_e, { item: u, module: e, today: l }) }, u.id)) }),
|
|
332
|
+
o.pageCount > 1 ? /* @__PURE__ */ t(
|
|
333
|
+
V,
|
|
334
|
+
{
|
|
335
|
+
as: "nav",
|
|
336
|
+
variant: "compact",
|
|
337
|
+
withFirstAndLastButton: !0,
|
|
338
|
+
margin: "small",
|
|
339
|
+
label: /* @__PURE__ */ t(ge, { children: r("itemsPaginationLabel", { name: e.name }) }),
|
|
340
|
+
labelFirst: r("paginationFirstPage"),
|
|
341
|
+
labelPrev: r("paginationPreviousPage"),
|
|
342
|
+
labelNext: r("paginationNextPage"),
|
|
343
|
+
labelLast: r("paginationLastPage"),
|
|
344
|
+
screenReaderLabelPageButton: (u) => r("paginationPageLabel", { page: u }),
|
|
345
|
+
ellipsis: r("paginationEllipsis"),
|
|
346
|
+
totalPageNumber: o.pageCount,
|
|
347
|
+
currentPage: o.page,
|
|
348
|
+
disabled: o.isRefreshing,
|
|
349
|
+
onPageChange: s,
|
|
350
|
+
"data-testid": "edit-items-pagination"
|
|
351
|
+
}
|
|
352
|
+
) : null
|
|
353
|
+
] });
|
|
354
|
+
}
|
|
355
|
+
function $e({
|
|
356
|
+
module: e,
|
|
357
|
+
expanded: o,
|
|
358
|
+
onToggle: l,
|
|
359
|
+
itemsState: r,
|
|
360
|
+
today: s,
|
|
361
|
+
headingLevel: u = "h3"
|
|
362
|
+
}) {
|
|
363
|
+
var m;
|
|
364
|
+
const { t: c } = w(), n = D(), i = O(), a = ((m = n.moduleLabel(e.position, e)) == null ? void 0 : m.trim()) || null, p = a ? c("moduleNameWithLabel", { label: a, name: e.name }) : e.name, d = De(e, s, c, n);
|
|
365
|
+
return /* @__PURE__ */ f(
|
|
366
|
+
y,
|
|
367
|
+
{
|
|
368
|
+
as: "div",
|
|
369
|
+
background: "primary",
|
|
370
|
+
borderRadius: "card.sm",
|
|
371
|
+
borderWidth: "small",
|
|
372
|
+
shadow: "resting",
|
|
373
|
+
margin: "0 0 small 0",
|
|
374
|
+
overflowX: "hidden",
|
|
375
|
+
overflowY: "hidden",
|
|
376
|
+
"data-testid": `edit-module-card-${e.id}`,
|
|
377
|
+
children: [
|
|
378
|
+
/* @__PURE__ */ t(
|
|
379
|
+
y,
|
|
380
|
+
{
|
|
381
|
+
as: "div",
|
|
382
|
+
background: e.published ? "success" : "primary-inverse",
|
|
383
|
+
themeOverride: e.published ? void 0 : Ne,
|
|
384
|
+
padding: "small",
|
|
385
|
+
"data-testid": "edit-module-header",
|
|
386
|
+
"data-published": e.published ? "true" : "false",
|
|
387
|
+
children: /* @__PURE__ */ f(b, { alignItems: "start", gap: "small", children: [
|
|
388
|
+
/* @__PURE__ */ t(b.Item, { children: /* @__PURE__ */ t(
|
|
389
|
+
he,
|
|
390
|
+
{
|
|
391
|
+
size: "small",
|
|
392
|
+
withBackground: !1,
|
|
393
|
+
withBorder: !1,
|
|
394
|
+
color: "primary-inverse",
|
|
395
|
+
screenReaderLabel: o ? c("collapseModule", { name: e.name }) : c("expandModule", { name: e.name }),
|
|
396
|
+
"aria-expanded": o,
|
|
397
|
+
"aria-controls": _(e.id),
|
|
398
|
+
onClick: () => l(e.id),
|
|
399
|
+
"data-testid": `edit-toggle-module-${e.id}`,
|
|
400
|
+
children: o ? /* @__PURE__ */ t(fe, {}) : /* @__PURE__ */ t(ve, {})
|
|
401
|
+
}
|
|
402
|
+
) }),
|
|
403
|
+
/* @__PURE__ */ f(b.Item, { shouldGrow: !0, shouldShrink: !0, children: [
|
|
404
|
+
/* @__PURE__ */ t(
|
|
405
|
+
G,
|
|
406
|
+
{
|
|
407
|
+
level: u,
|
|
408
|
+
variant: "titleCardMini",
|
|
409
|
+
color: "primary-on",
|
|
410
|
+
"aria-label": p,
|
|
411
|
+
"data-testid": "edit-module-name",
|
|
412
|
+
children: /* @__PURE__ */ t(me, { linesAllowed: 2, children: p })
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
/* @__PURE__ */ t(q, { name: e.name }),
|
|
416
|
+
/* @__PURE__ */ t(y, { as: "div", margin: "xx-small 0 0 0", children: /* @__PURE__ */ t(L, { size: "small", color: "primary-on", "data-testid": "edit-module-meta", children: d.map((h, M) => /* @__PURE__ */ f(U, { children: [
|
|
417
|
+
M > 0 ? /* @__PURE__ */ t("span", { style: $, children: " " }) : null,
|
|
418
|
+
/* @__PURE__ */ f("span", { style: M > 0 ? i : void 0, children: [
|
|
419
|
+
/* @__PURE__ */ t("span", { style: z, "aria-hidden": "true", children: h.icon }),
|
|
420
|
+
h.text
|
|
421
|
+
] })
|
|
422
|
+
] }, h.key)) }) })
|
|
423
|
+
] }),
|
|
424
|
+
/* @__PURE__ */ t(Be, { module: e }),
|
|
425
|
+
/* @__PURE__ */ t(qe, { module: e }),
|
|
426
|
+
/* @__PURE__ */ t(Re, { module: e }),
|
|
427
|
+
/* @__PURE__ */ t(Ee, { module: e })
|
|
428
|
+
] })
|
|
429
|
+
}
|
|
430
|
+
),
|
|
431
|
+
/* @__PURE__ */ t("div", { id: _(e.id), role: "group", "aria-label": e.name, hidden: !o, children: o ? /* @__PURE__ */ t(Oe, { module: e, state: r, today: s }) : null })
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
function ze({
|
|
437
|
+
data: e,
|
|
438
|
+
today: o,
|
|
439
|
+
cardHeadingLevel: l
|
|
440
|
+
}) {
|
|
441
|
+
const { modules: r, expandedModuleIds: s, toggleModule: u, getItems: c } = e;
|
|
442
|
+
return /* @__PURE__ */ t("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, "data-testid": "edit-modules-stack", children: r.map((n) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
443
|
+
$e,
|
|
444
|
+
{
|
|
445
|
+
module: n,
|
|
446
|
+
expanded: s.includes(n.id),
|
|
447
|
+
onToggle: u,
|
|
448
|
+
itemsState: c(n.id),
|
|
449
|
+
today: o,
|
|
450
|
+
headingLevel: l
|
|
451
|
+
}
|
|
452
|
+
) }, n.id)) });
|
|
453
|
+
}
|
|
454
|
+
function ut({
|
|
455
|
+
data: e,
|
|
456
|
+
today: o,
|
|
457
|
+
as: l = "div",
|
|
458
|
+
headingLevel: r = "h2"
|
|
459
|
+
}) {
|
|
460
|
+
const { t: s } = w(), {
|
|
461
|
+
modules: u,
|
|
462
|
+
page: c,
|
|
463
|
+
pageCount: n,
|
|
464
|
+
goToFirstPage: i,
|
|
465
|
+
goToPreviousPage: a,
|
|
466
|
+
goToNextPage: p,
|
|
467
|
+
goToLastPage: d,
|
|
468
|
+
isLoading: m,
|
|
469
|
+
isRefreshing: h,
|
|
470
|
+
error: M
|
|
471
|
+
} = e, [P] = ce(() => /* @__PURE__ */ new Date()), I = r === "h1" ? "h2" : "h3", v = m || h && u.length === 0, C = u.length === 0 && !v && !M, T = (g) => {
|
|
472
|
+
g === 1 ? i() : g === c - 1 ? a() : g === c + 1 ? p() : g === n && d();
|
|
473
|
+
};
|
|
474
|
+
return /* @__PURE__ */ f(y, { as: l, display: "block", "data-testid": "modules-edit-view", children: [
|
|
475
|
+
M ? /* @__PURE__ */ t(
|
|
476
|
+
x,
|
|
477
|
+
{
|
|
478
|
+
variant: "error",
|
|
479
|
+
margin: "0 0 small 0",
|
|
480
|
+
liveRegion: H,
|
|
481
|
+
liveRegionPoliteness: "assertive",
|
|
482
|
+
"data-testid": "edit-modules-error",
|
|
483
|
+
children: s("modulesLoadErrorAlert", { message: M.message })
|
|
484
|
+
}
|
|
485
|
+
) : null,
|
|
486
|
+
v ? /* @__PURE__ */ t(y, { as: "div", padding: "large", textAlign: "center", "data-testid": "edit-modules-loading", children: /* @__PURE__ */ t(Q, { renderTitle: s("modulesLoadingSpinnerLabel") }) }) : null,
|
|
487
|
+
C ? /* @__PURE__ */ f(
|
|
488
|
+
y,
|
|
489
|
+
{
|
|
490
|
+
as: "div",
|
|
491
|
+
background: "primary",
|
|
492
|
+
borderRadius: "card.lg",
|
|
493
|
+
borderWidth: "small",
|
|
494
|
+
shadow: "resting",
|
|
495
|
+
padding: "medium",
|
|
496
|
+
textAlign: "center",
|
|
497
|
+
"data-testid": "edit-modules-empty",
|
|
498
|
+
children: [
|
|
499
|
+
/* @__PURE__ */ t(G, { level: I, variant: "titleCardLarge", margin: "0 0 x-small 0", children: s("editNoModulesTitle") }),
|
|
500
|
+
/* @__PURE__ */ t(L, { color: "secondary", children: s("editNoModulesDescription") })
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
) : null,
|
|
504
|
+
/* @__PURE__ */ t(
|
|
505
|
+
ze,
|
|
506
|
+
{
|
|
507
|
+
data: e,
|
|
508
|
+
today: o ?? P,
|
|
509
|
+
cardHeadingLevel: I
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
n > 1 && !v ? /* @__PURE__ */ t(
|
|
513
|
+
V,
|
|
514
|
+
{
|
|
515
|
+
as: "nav",
|
|
516
|
+
variant: "compact",
|
|
517
|
+
withFirstAndLastButton: !0,
|
|
518
|
+
margin: "small 0 0 0",
|
|
519
|
+
labelFirst: s("paginationFirstPage"),
|
|
520
|
+
labelPrev: s("paginationPreviousPage"),
|
|
521
|
+
labelNext: s("paginationNextPage"),
|
|
522
|
+
labelLast: s("paginationLastPage"),
|
|
523
|
+
screenReaderLabelPageButton: (g) => s("paginationPageLabel", { page: g }),
|
|
524
|
+
ellipsis: s("paginationEllipsis"),
|
|
525
|
+
totalPageNumber: n,
|
|
526
|
+
currentPage: c,
|
|
527
|
+
disabled: h,
|
|
528
|
+
onPageChange: T,
|
|
529
|
+
"data-testid": "edit-modules-pagination"
|
|
530
|
+
}
|
|
531
|
+
) : null
|
|
532
|
+
] });
|
|
533
|
+
}
|
|
534
|
+
function je(e) {
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
function Ue(e) {
|
|
538
|
+
return null;
|
|
539
|
+
}
|
|
540
|
+
function We(e) {
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
function ct({ data: e }) {
|
|
544
|
+
const { t: o } = w(), l = ae(), { expandedModuleIds: r, collapseAllModules: s, isPersistingCollapsed: u } = e, c = r.length, n = () => {
|
|
545
|
+
l("collapse-all"), s(), pe(o("modulesCollapsedAnnouncement", { count: c }));
|
|
546
|
+
};
|
|
547
|
+
return /* @__PURE__ */ f(b, { gap: "x-small", wrap: "wrap", justifyItems: "end", "data-testid": "modules-edit-actions", children: [
|
|
548
|
+
/* @__PURE__ */ t(b.Item, { children: /* @__PURE__ */ t(
|
|
549
|
+
Me,
|
|
550
|
+
{
|
|
551
|
+
size: "small",
|
|
552
|
+
onClick: n,
|
|
553
|
+
interaction: c === 0 || u ? "disabled" : "enabled",
|
|
554
|
+
"data-testid": "edit-collapse-all",
|
|
555
|
+
children: o("collapseAllModules")
|
|
556
|
+
}
|
|
557
|
+
) }),
|
|
558
|
+
/* @__PURE__ */ t(We, { data: e }),
|
|
559
|
+
/* @__PURE__ */ t(je, { data: e }),
|
|
560
|
+
/* @__PURE__ */ t(Ue, { data: e })
|
|
561
|
+
] });
|
|
562
|
+
}
|
|
563
|
+
export {
|
|
564
|
+
$e as EditModuleCard,
|
|
565
|
+
_e as EditModuleItemRow,
|
|
566
|
+
ct as ModulesEditActions,
|
|
567
|
+
ut as ModulesEditView,
|
|
568
|
+
at as createInMemoryEditAdapter,
|
|
569
|
+
dt as useModulesEditData
|
|
570
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const DEFAULT_PAGE_SIZE: number;
|
|
2
|
+
/** Modules per page below the `mobileOnly` breakpoint, where the design's progress bar holds four. */
|
|
3
|
+
export declare const DEFAULT_MOBILE_PAGE_SIZE: number;
|
|
2
4
|
/** The design's items per page. Inline items are sliced to it too. */
|
|
3
5
|
export declare const DEFAULT_ITEM_PAGE_SIZE: number;
|
|
4
6
|
/** Per-module ceiling above which inlining stops paying. @see INLINE_ITEM_LIMIT */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/hooks/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,EAAE,MAAW,CAAA;AAE3C,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,EAAE,MAAW,CAAA;AAEhD,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,EAAE,MAAY,CAAA;AAEnD,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,EAAE,MAAU,CAAA;AAEjD,qGAAqG;AACrG,eAAO,MAAM,kCAAkC,EAAE,MAAU,CAAA;AAE3D,yFAAyF;AACzF,eAAO,MAAM,qBAAqB,EAAE,MAAsB,CAAA;AAE1D,oGAAoG;AACpG,eAAO,MAAM,8BAA8B,EAAE,MAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/hooks/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,EAAE,MAAW,CAAA;AAE3C,sGAAsG;AACtG,eAAO,MAAM,wBAAwB,EAAE,MAAU,CAAA;AAEjD,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,EAAE,MAAW,CAAA;AAEhD,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,EAAE,MAAY,CAAA;AAEnD,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,EAAE,MAAU,CAAA;AAEjD,qGAAqG;AACrG,eAAO,MAAM,kCAAkC,EAAE,MAAU,CAAA;AAE3D,yFAAyF;AACzF,eAAO,MAAM,qBAAqB,EAAE,MAAsB,CAAA;AAE1D,oGAAoG;AACpG,eAAO,MAAM,8BAA8B,EAAE,MAAW,CAAA"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_INLINE_THRESHOLD, DEFAULT_ITEM_CONCURRENCY, DEFAULT_ITEM_PAGE_SIZE, DEFAULT_PAGE_SIZE, DEFAULT_RETAIN_COLLAPSED_LIMIT, DEFAULT_STALE_TIME_MS, } from './constants';
|
|
1
|
+
export { DEFAULT_INLINE_THRESHOLD, DEFAULT_ITEM_CONCURRENCY, DEFAULT_ITEM_PAGE_SIZE, DEFAULT_MOBILE_PAGE_SIZE, DEFAULT_PAGE_SIZE, DEFAULT_RETAIN_COLLAPSED_LIMIT, DEFAULT_STALE_TIME_MS, } from './constants';
|
|
2
2
|
export { moduleItemsQueryOptions, modulesQueryOptions, type ModuleItemsQueryArgs, type ModuleItemsQueryOptions, type ModulesQueryArgs, type ModulesQueryOptions, } from './queryOptions';
|
|
3
3
|
export { useModules, type UseModulesOptions, type UseModulesResult } from './useModules';
|
|
4
4
|
export { resolveItemsMode, inlineShapeOf, type InlineQueryShape, useItemsMode, type ItemsMode, type ResolvedItemsMode, type UseItemsModeOptions, type UseItemsModeResult, } from './useItemsMode';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,KAAK,gBAAgB,EACrB,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,KAAK,gBAAgB,EACrB,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsMobileViewport.d.ts","sourceRoot":"","sources":["../../src/hooks/useIsMobileViewport.ts"],"names":[],"mappings":"AAUA,gGAAgG;AAChG,wBAAgB,mBAAmB,IAAI,OAAO,CAa7C"}
|
|
@@ -27,6 +27,8 @@ export interface UseModulesPageDataOptions {
|
|
|
27
27
|
itemsMode?: ItemsMode;
|
|
28
28
|
inlineThreshold?: number;
|
|
29
29
|
pageSize?: number;
|
|
30
|
+
/** Replaces `pageSize` below the `mobileOnly` breakpoint. */
|
|
31
|
+
mobilePageSize?: number;
|
|
30
32
|
itemPageSize?: number;
|
|
31
33
|
itemConcurrency?: number;
|
|
32
34
|
retainCollapsedLimit?: number;
|
|
@@ -42,6 +44,7 @@ export interface UseModulesPageDataResult {
|
|
|
42
44
|
/** 1-indexed. */
|
|
43
45
|
page: number;
|
|
44
46
|
pageCount: number;
|
|
47
|
+
pageSize: number;
|
|
45
48
|
hasNextPage: boolean;
|
|
46
49
|
hasPreviousPage: boolean;
|
|
47
50
|
goToFirstPage: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModulesPageData.d.ts","sourceRoot":"","sources":["../../src/hooks/useModulesPageData.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAsB,MAAM,mBAAmB,CAAA;AAC/E,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAOnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"useModulesPageData.d.ts","sourceRoot":"","sources":["../../src/hooks/useModulesPageData.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type { ListModuleItemsArgs, ListModulesArgs, ModulesDataAdapter, ModulesP
|
|
|
6
6
|
export { createInMemoryAdapter, InMemoryCourseMismatchError, INLINE_ITEM_LIMIT, type InMemoryAdapterOptions, type InMemoryFixture, type InMemoryOperation, type InMemoryRequest, } from './adapters';
|
|
7
7
|
export { type CanvasGraphqlAdapterOptions, createCanvasGraphqlAdapter, INLINE_QUERY_NODE_BUDGET, type ExecuteQuery, GET_MODULE_ITEMS, GET_MODULES, PartialCanvasResponseError, type PartialResponseSubject, type UnsupportedModuleItem, type UnsupportedModuleStatus, } from './adapters/canvasGraphql';
|
|
8
8
|
export { ACTION_ORDER_LTI_FLOOR, type ActionContext, type ActionEntry, ActionEntrySchema, ALL_FILTER, baseFilters, baseModulesConfig, type BoundFormatters, type BuildActionContext, createActionContext, type CreateActionContextOptions, defaultFormatters, DUE_THIS_WEEK_DAYS, filterClauseOf, type FilterContext, type FilterEntry, FilterEntrySchema, type FormatterContext, hideUnservableFilters, isPredicateServed, type ItemTypeContext, type ItemTypeEntry, ItemTypeEntrySchema, mergeRegistry, type MetaFieldContext, type MetaFieldEntry, MetaFieldEntrySchema, type ModulesConfig, type ModulesConfigOverride, ModulesConfigProvider, type ModulesConfigProviderProps, ModulesConfigSchema, type ModulesFormatters, type ModulesNavigation, NEW_PLACEMENT_FIELD, organizePreviewConfig, partialModulesConfig, type Registry, type RegistryEntry, RegistryEntrySchema, type RegistryOverride, registrySchema, resolveModulesConfig, TYPE_FIELD, unservableFilters, useActionContext, useFieldVisible, useFormatters, useModulesConfig, visibleActions, visibleEntries, type VisibleEntry, visibleEntry, } from './config';
|
|
9
|
-
export { DEFAULT_INLINE_THRESHOLD, DEFAULT_ITEM_CONCURRENCY, DEFAULT_ITEM_PAGE_SIZE, DEFAULT_PAGE_SIZE, DEFAULT_RETAIN_COLLAPSED_LIMIT, DEFAULT_STALE_TIME_MS, type InlineQueryShape, type ItemsMode, type ModuleItemsSource, type ModuleItemsState, type ResolvedItemsMode, useModules, type UseModulesOptions, useModulesPageData, type UseModulesPageDataOptions, type UseModulesPageDataResult, type UseModulesResult, } from './hooks';
|
|
9
|
+
export { DEFAULT_INLINE_THRESHOLD, DEFAULT_ITEM_CONCURRENCY, DEFAULT_ITEM_PAGE_SIZE, DEFAULT_MOBILE_PAGE_SIZE, DEFAULT_PAGE_SIZE, DEFAULT_RETAIN_COLLAPSED_LIMIT, DEFAULT_STALE_TIME_MS, type InlineQueryShape, type ItemsMode, type ModuleItemsSource, type ModuleItemsState, type ResolvedItemsMode, useModules, type UseModulesOptions, useModulesPageData, type UseModulesPageDataOptions, type UseModulesPageDataResult, type UseModulesResult, } from './hooks';
|
|
10
10
|
export { invalidateCourse, invalidateModuleItems, invalidateModuleList, moduleItemsPrefix, type ModuleItemsKeyOptions, modulesKeys, modulesListPrefix, type ModulesListKeyOptions, type ModulesView, } from './cache';
|
|
11
11
|
export { type DueRange, FilterSelect, type FilterSelectProps, ItemDueSoonPill, ModuleCard, type ModuleCardProps, ModuleDueSoonPill, ModuleItemRow, type ModuleItemRowProps, moduleItemStatusLabel, ModuleItemStatusPill, type ModuleItemStatusPillProps, ModulesList, type ModulesListProps, ModulesProgressBar, type ModulesProgressBarProps, type ModulesRequestCounts, moduleStatusLabel, ModuleStatusPill, type ModuleStatusPillProps, } from './components';
|
|
12
12
|
export { createTranslate, DEFAULT_LOCALE, defaultTranslate, type ModulesI18n, ModulesI18nProvider, type ModulesI18nProviderProps, type ModulesTranslationKey, type ModulesTranslations, type PluralForms, type TranslateFunction, useModulesI18n, } from './i18n';
|