@instructure/platform-rubrics 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/_internal/RubricAssignment/hooks/useAssignmentRubric.d.ts +1 -0
  2. package/dist/_internal/RubricAssignment/hooks/useAssignmentRubric.d.ts.map +1 -1
  3. package/dist/_internal/RubricAssignment/hooks/useAssignmentRubricState.d.ts +1 -0
  4. package/dist/_internal/RubricAssignment/hooks/useAssignmentRubricState.d.ts.map +1 -1
  5. package/dist/_internal/RubricForm/components/RubricGeneratorNutritionFacts.d.ts.map +1 -0
  6. package/dist/_internal/ViewRubrics/useRubricsQuery.d.ts.map +1 -1
  7. package/dist/_internal/ViewRubrics/useViewRubrics.d.ts.map +1 -1
  8. package/dist/_internal/constants/i18n.d.ts +14 -0
  9. package/dist/_internal/constants/i18n.d.ts.map +1 -1
  10. package/dist/_internal/utils/i18n.d.ts +14 -0
  11. package/dist/_internal/utils/i18n.d.ts.map +1 -1
  12. package/dist/canvas.js +4752 -8509
  13. package/dist/chunks/{errorPage-CYyehhNJ.js → errorPage-B145UIKY.js} +51 -37
  14. package/dist/chunks/useAssignmentRubricState-Cha3tHoC.js +8508 -0
  15. package/dist/foundation/RubricAssignmentBuilder/RubricAssignmentBuilder.d.ts +28 -0
  16. package/dist/foundation/RubricAssignmentBuilder/RubricAssignmentBuilder.d.ts.map +1 -0
  17. package/dist/foundation/RubricBuilder/RubricBuilder.d.ts.map +1 -1
  18. package/dist/foundation/RubricBuilder/components/CriteriaSection.d.ts +3 -1
  19. package/dist/foundation/RubricBuilder/components/CriteriaSection.d.ts.map +1 -1
  20. package/dist/foundation/RubricBuilder/components/generator/GenerateCriteriaForm.d.ts +14 -0
  21. package/dist/foundation/RubricBuilder/components/generator/GenerateCriteriaForm.d.ts.map +1 -0
  22. package/dist/foundation/RubricBuilder/components/generator/GeneratedCriteriaFeedback.d.ts +8 -0
  23. package/dist/foundation/RubricBuilder/components/generator/GeneratedCriteriaFeedback.d.ts.map +1 -0
  24. package/dist/foundation/RubricBuilder/components/generator/GeneratedCriteriaSummary.d.ts +11 -0
  25. package/dist/foundation/RubricBuilder/components/generator/GeneratedCriteriaSummary.d.ts.map +1 -0
  26. package/dist/foundation/RubricBuilder/components/generator/RegenerateCriteriaModal.d.ts +7 -0
  27. package/dist/foundation/RubricBuilder/components/generator/RegenerateCriteriaModal.d.ts.map +1 -0
  28. package/dist/foundation/RubricBuilder/components/generator/RubricGeneratorPanel.d.ts +9 -0
  29. package/dist/foundation/RubricBuilder/components/generator/RubricGeneratorPanel.d.ts.map +1 -0
  30. package/dist/foundation/RubricBuilder/components/generator/RubricGeneratorStatus.d.ts +9 -0
  31. package/dist/foundation/RubricBuilder/components/generator/RubricGeneratorStatus.d.ts.map +1 -0
  32. package/dist/foundation/RubricBuilder/useCriteriaGenerator.d.ts +44 -0
  33. package/dist/foundation/RubricBuilder/useCriteriaGenerator.d.ts.map +1 -0
  34. package/dist/foundation/index.d.ts +2 -0
  35. package/dist/foundation/index.d.ts.map +1 -1
  36. package/dist/foundation.js +1110 -512
  37. package/dist/index.js +1 -1
  38. package/locales/en.json +14 -0
  39. package/package.json +2 -2
  40. package/dist/canvas/RubricForm/components/AIGeneratedCriteria/RubricGeneratorNutritionFacts.d.ts.map +0 -1
  41. package/dist/chunks/ErrorShip-COgM3wMV.js +0 -4726
  42. /package/dist/{canvas/RubricForm/components/AIGeneratedCriteria → _internal/RubricForm/components}/RubricGeneratorNutritionFacts.d.ts +0 -0
@@ -1,36 +1,44 @@
1
- import { g as Ue, R as be, u as D, f as _e, h as Ge, r as $e, i as le, b as Fe } from "./chunks/errorPage-CYyehhNJ.js";
2
- import { D as ki, a as Ti, d as xi } from "./chunks/errorPage-CYyehhNJ.js";
1
+ import { g as gr, R as Ce, u as I, f as ue, h as Ne, r as hr, i as Te, b as pr, j as fr } from "./chunks/errorPage-B145UIKY.js";
2
+ import { D as wt, a as Et, d as Pt } from "./chunks/errorPage-B145UIKY.js";
3
3
  import "@instructure/platform-provider";
4
- import { useState as w, useEffect as $, useRef as ae, useCallback as qe } from "react";
5
- import { jsx as e, jsxs as m, Fragment as ze } from "react/jsx-runtime";
6
- import { Heading as U } from "@instructure/ui-heading";
7
- import { View as p } from "@instructure/ui-view";
8
- import { Button as A, CloseButton as We, IconButton as Y } from "@instructure/ui-buttons";
9
- import { Flex as v } from "@instructure/ui-flex";
10
- import { SimpleSelect as te } from "@instructure/ui-simple-select";
11
- import { Spinner as je } from "@instructure/ui-spinner";
12
- import { Text as k } from "@instructure/ui-text";
13
- import { useQuery as Ke } from "@tanstack/react-query";
14
- import { u as ge, g as Qe, p as Ve, a as he, b as de, C as pe, c as ce, i as Xe, d as fe, e as J, s as Ce, K as ve, P as Re, r as Ye, D as Be, S as Se, v as ye, f as Ze, h as Je, j as er, k as rr, l as ir, m as tr, n as nr, w as ue, o as ar, q as or, t as sr, x as lr, y as dr, z as cr, A as ur, B as mr, E as br } from "./chunks/ErrorShip-COgM3wMV.js";
15
- import gr from "graphql-tag";
16
- import { LoadingIndicator as hr } from "@instructure/platform-loading-indicator";
17
- import { Alert as pr } from "@instructure/ui-alerts";
18
- import { IconDragHandleLine as De, IconTrashLine as Ie, IconAddLine as Le, IconArrowOpenDownLine as fr, IconArrowOpenEndLine as Cr, IconCommentLine as vr, IconDuplicateLine as Rr } from "@instructure/ui-icons";
19
- import { Checkbox as ne } from "@instructure/ui-checkbox/v11_7";
20
- import { Flex as Br } from "@instructure/ui-flex/v11_7";
21
- import { Modal as Q } from "@instructure/ui-modal";
22
- import { ScreenReaderContent as Sr } from "@instructure/ui-a11y-content";
23
- import { Checkbox as yr } from "@instructure/ui-checkbox";
24
- import { Pill as we } from "@instructure/ui-pill";
25
- import { TextArea as Dr } from "@instructure/ui-text-area";
26
- import { TextInput as F } from "@instructure/ui-text-input";
27
- import { NumberInput as Ir } from "@instructure/ui-number-input";
28
- import { CloseButton as Lr, Button as me } from "@instructure/ui-buttons/v11_7";
29
- import { Heading as wr } from "@instructure/ui-heading/v11_7";
30
- import { Modal as V } from "@instructure/ui-modal/v11_7";
31
- import { Text as kr } from "@instructure/ui-text/v11_7";
32
- import { RadioInputGroup as Tr, RadioInput as xr } from "@instructure/ui-radio-input";
33
- const yi = () => /* @__PURE__ */ e(p, { as: "div", padding: "small", children: /* @__PURE__ */ e(U, { level: "h2", children: Ue("foundation") }) }), Pr = gr`
4
+ import { useState as k, useEffect as F, useRef as $, useMemo as De, useCallback as Fe } from "react";
5
+ import { jsx as e, jsxs as b, Fragment as ve } from "react/jsx-runtime";
6
+ import { Heading as q } from "@instructure/ui-heading";
7
+ import { View as y } from "@instructure/ui-view";
8
+ import { Button as H, CloseButton as Cr, IconButton as ae } from "@instructure/ui-buttons";
9
+ import { Flex as w } from "@instructure/ui-flex";
10
+ import { SimpleSelect as pe } from "@instructure/ui-simple-select";
11
+ import { Spinner as vr } from "@instructure/ui-spinner";
12
+ import { Text as G } from "@instructure/ui-text";
13
+ import { useQuery as Rr } from "@tanstack/react-query";
14
+ import { u as Re, g as Lr, p as Sr, a as He, b as we, C as $e, c as Ee, i as Br, d as ze, e as se, s as Ue, K as qe, P as We, r as Ir, D as je, S as Ke, v as Ve, f as kr, h as yr, j as Tr, k as Dr, l as wr, m as Er, n as Pr, w as Pe, o as xr, q as Ar, t as Or, x as Gr, y as xe, A as fe, G as Mr, z as _r, B as Ae, E as Nr, F as Oe, R as Fr, H as Hr, I as $r, J as zr, L as Ur, M as qr, N as Wr, O as jr, Q as Kr, T as Vr, U as Qr, V as Xr } from "./chunks/useAssignmentRubricState-Cha3tHoC.js";
15
+ import Yr from "graphql-tag";
16
+ import { LoadingIndicator as Qe } from "@instructure/platform-loading-indicator";
17
+ import { Alert as Jr } from "@instructure/ui-alerts";
18
+ import { IconDragHandleLine as Xe, IconTrashLine as Ye, IconAddLine as Je, IconArrowOpenDownLine as Zr, IconArrowOpenEndLine as ei, IconCommentLine as ri, IconDuplicateLine as ii, IconAiSolid as be, IconLikeSolid as Ge, IconLikeLine as Me, IconAiColoredSolid as Ze } from "@instructure/ui-icons";
19
+ import { Checkbox as oe } from "@instructure/ui-checkbox/v11_7";
20
+ import { Flex as P } from "@instructure/ui-flex/v11_7";
21
+ import { Modal as te } from "@instructure/ui-modal";
22
+ import { ScreenReaderContent as er } from "@instructure/ui-a11y-content";
23
+ import { Checkbox as ti } from "@instructure/ui-checkbox";
24
+ import { Pill as rr } from "@instructure/ui-pill";
25
+ import { TextArea as ni } from "@instructure/ui-text-area";
26
+ import { TextInput as V } from "@instructure/ui-text-input";
27
+ import { NumberInput as ai } from "@instructure/ui-number-input";
28
+ import { CloseButton as Le, Button as _, IconButton as _e } from "@instructure/ui-buttons/v11_7";
29
+ import { Heading as Q } from "@instructure/ui-heading/v11_7";
30
+ import { Modal as x } from "@instructure/ui-modal/v11_7";
31
+ import { Text as de } from "@instructure/ui-text/v11_7";
32
+ import { RadioInputGroup as oi, RadioInput as li } from "@instructure/ui-radio-input";
33
+ import { ProgressBar as si } from "@instructure/ui-progress/v11_7";
34
+ import { Spinner as di } from "@instructure/ui-spinner/v11_7";
35
+ import { View as ci } from "@instructure/ui-view/v11_7";
36
+ import { SimpleSelect as U } from "@instructure/ui-simple-select/v11_7";
37
+ import { TextArea as ce } from "@instructure/ui-text-area/v11_7";
38
+ import { TextInput as ui } from "@instructure/ui-text-input/v11_7";
39
+ import { Tooltip as bi } from "@instructure/ui-tooltip/v11_7";
40
+ import { Alert as mi } from "@instructure/ui-alerts/v11_7";
41
+ const It = () => /* @__PURE__ */ e(y, { as: "div", padding: "small", children: /* @__PURE__ */ e(q, { level: "h2", children: gr("foundation") }) }), gi = Yr`
34
42
  query CourseRubricsList($courseId: ID!, $first: Int) {
35
43
  course(id: $courseId) {
36
44
  rubricsConnection(first: $first) {
@@ -48,19 +56,19 @@ const yi = () => /* @__PURE__ */ e(p, { as: "div", padding: "small", children: /
48
56
  }
49
57
  }
50
58
  `;
51
- function Er(r) {
52
- const { executeQuery: o } = ge();
53
- return Ke({
59
+ function hi(r) {
60
+ const { executeQuery: n } = Re();
61
+ return Rr({
54
62
  queryKey: ["courseRubrics", r],
55
63
  queryFn: async () => {
56
64
  var a;
57
- const { course: s } = await o(Pr, {
65
+ const { course: s } = await n(gi, {
58
66
  courseId: r,
59
67
  first: 50
60
68
  }), i = s == null ? void 0 : s.rubricsConnection;
61
69
  return {
62
70
  rubrics: ((i == null ? void 0 : i.nodes) ?? []).filter(
63
- (d) => d != null
71
+ (l) => l != null
64
72
  ),
65
73
  hasMore: ((a = i == null ? void 0 : i.pageInfo) == null ? void 0 : a.hasNextPage) ?? !1
66
74
  };
@@ -68,473 +76,475 @@ function Er(r) {
68
76
  enabled: !!r
69
77
  });
70
78
  }
71
- const Di = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children: /* @__PURE__ */ e(Or, { ...r }) }), Or = ({
79
+ const kt = (r) => /* @__PURE__ */ e(Ce, { translations: r.translations, children: /* @__PURE__ */ e(pi, { ...r }) }), pi = ({
72
80
  courseId: r,
73
- value: o,
81
+ value: n,
74
82
  onChange: s
75
83
  }) => {
76
- const { translations: i } = D(), { data: a, isLoading: d, isError: t, refetch: g } = Er(r), l = a == null ? void 0 : a.rubrics;
77
- return d ? /* @__PURE__ */ m(p, { as: "div", role: "status", "aria-live": "polite", margin: "0 0 medium", children: [
78
- /* @__PURE__ */ e(je, { renderTitle: i.rubricSelectorLoading, size: "x-small" }),
79
- /* @__PURE__ */ e(p, { as: "span", padding: "0 0 0 x-small", children: /* @__PURE__ */ e(k, { size: "small", children: i.rubricSelectorLoading }) })
80
- ] }) : t ? /* @__PURE__ */ e(p, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ m(v, { gap: "small", alignItems: "center", wrap: "wrap", children: [
81
- /* @__PURE__ */ e(v.Item, { children: /* @__PURE__ */ m(k, { size: "small", color: "danger", children: [
84
+ const { translations: i } = I(), { data: a, isLoading: l, isError: o, refetch: g } = hi(r), t = a == null ? void 0 : a.rubrics;
85
+ return l ? /* @__PURE__ */ b(y, { as: "div", role: "status", "aria-live": "polite", margin: "0 0 medium", children: [
86
+ /* @__PURE__ */ e(vr, { renderTitle: i.rubricSelectorLoading, size: "x-small" }),
87
+ /* @__PURE__ */ e(y, { as: "span", padding: "0 0 0 x-small", children: /* @__PURE__ */ e(G, { size: "small", children: i.rubricSelectorLoading }) })
88
+ ] }) : o ? /* @__PURE__ */ e(y, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ b(w, { gap: "small", alignItems: "center", wrap: "wrap", children: [
89
+ /* @__PURE__ */ e(w.Item, { children: /* @__PURE__ */ b(G, { size: "small", color: "danger", children: [
82
90
  i.rubricSelectorErrorTitle,
83
91
  ". ",
84
92
  i.rubricSelectorErrorBody
85
93
  ] }) }),
86
- /* @__PURE__ */ e(v.Item, { children: /* @__PURE__ */ e(A, { size: "small", onClick: () => g(), children: i.rubricSelectorRetry }) })
87
- ] }) }) : !l || l.length === 0 ? /* @__PURE__ */ e(p, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ e(k, { size: "small", children: i.rubricSelectorEmpty }) }) : /* @__PURE__ */ m(p, { as: "div", margin: "0 0 medium", maxWidth: "360px", children: [
88
- /* @__PURE__ */ m(
89
- te,
94
+ /* @__PURE__ */ e(w.Item, { children: /* @__PURE__ */ e(H, { size: "small", onClick: () => g(), children: i.rubricSelectorRetry }) })
95
+ ] }) }) : !t || t.length === 0 ? /* @__PURE__ */ e(y, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ e(G, { size: "small", children: i.rubricSelectorEmpty }) }) : /* @__PURE__ */ b(y, { as: "div", margin: "0 0 medium", maxWidth: "360px", children: [
96
+ /* @__PURE__ */ b(
97
+ pe,
90
98
  {
91
99
  renderLabel: i.rubricSelectorLabel,
92
100
  assistiveText: i.rubricSelectorAssistiveText,
93
- value: o ?? "",
94
- onChange: (u, { value: b }) => {
95
- if (typeof b != "string" || !b) return;
96
- const c = l.find((n) => n.id === b);
97
- s(b, (c == null ? void 0 : c.title) ?? "");
101
+ value: n ?? "",
102
+ onChange: (c, { value: h }) => {
103
+ if (typeof h != "string" || !h) return;
104
+ const d = t.find((u) => u.id === h);
105
+ s(h, (d == null ? void 0 : d.title) ?? "");
98
106
  },
99
107
  children: [
100
- o === void 0 && /* @__PURE__ */ e(te.Option, { id: "rubrics-rubric-selector-placeholder", value: "", children: i.rubricSelectorPlaceholder }),
101
- l.map((u) => /* @__PURE__ */ e(
102
- te.Option,
108
+ n === void 0 && /* @__PURE__ */ e(pe.Option, { id: "rubrics-rubric-selector-placeholder", value: "", children: i.rubricSelectorPlaceholder }),
109
+ t.map((c) => /* @__PURE__ */ e(
110
+ pe.Option,
103
111
  {
104
- id: `rubrics-rubric-selector-option-${u.id}`,
105
- value: u.id,
106
- children: u.title || i.rubricSelectorUntitled
112
+ id: `rubrics-rubric-selector-option-${c.id}`,
113
+ value: c.id,
114
+ children: c.title || i.rubricSelectorUntitled
107
115
  },
108
- u.id
116
+ c.id
109
117
  ))
110
118
  ]
111
119
  }
112
120
  ),
113
- (a == null ? void 0 : a.hasMore) && /* @__PURE__ */ e(p, { as: "div", padding: "xx-small 0 0", children: /* @__PURE__ */ e(k, { size: "x-small", color: "secondary", children: i.rubricSelectorTruncated }) })
121
+ (a == null ? void 0 : a.hasMore) && /* @__PURE__ */ e(y, { as: "div", padding: "xx-small 0 0", children: /* @__PURE__ */ e(G, { size: "x-small", color: "secondary", children: i.rubricSelectorTruncated }) })
114
122
  ] });
115
- }, Mr = ({
123
+ }, fi = ({
116
124
  rubricForm: r,
117
- canUseForGrading: o,
125
+ canUseForGrading: n,
118
126
  setRubricFormField: s
119
127
  }) => {
120
- const { translations: i } = D(), { hidePoints: a, useForGrading: d, hideScoreTotal: t, hideOutcomeResults: g } = r, l = (u) => {
121
- const b = Qe(u);
122
- s("useForGrading", b.useForGrading), s("hideScoreTotal", b.hideScoreTotal);
128
+ const { translations: i } = I(), { hidePoints: a, useForGrading: l, hideScoreTotal: o, hideOutcomeResults: g } = r, t = (c) => {
129
+ const h = Lr(c);
130
+ s("useForGrading", h.useForGrading), s("hideScoreTotal", h.hideScoreTotal);
123
131
  };
124
- return /* @__PURE__ */ m(Br, { direction: "column", gap: "small", "data-testid": "rubric-builder-assignment-settings", children: [
132
+ return /* @__PURE__ */ b(P, { direction: "column", gap: "small", "data-testid": "rubric-builder-assignment-settings", children: [
125
133
  /* @__PURE__ */ e(
126
- ne,
134
+ oe,
127
135
  {
128
136
  variant: "toggle",
129
137
  label: i.hideOutcomeResultsLabel,
130
138
  checked: g,
131
- onChange: (u) => s("hideOutcomeResults", u.target.checked),
139
+ onChange: (c) => s("hideOutcomeResults", c.target.checked),
132
140
  "data-testid": "rubric-builder-hide-outcome-results"
133
141
  }
134
142
  ),
135
- !a && o && /* @__PURE__ */ e(
136
- ne,
143
+ !a && n && /* @__PURE__ */ e(
144
+ oe,
137
145
  {
138
146
  variant: "toggle",
139
147
  label: i.useForGradingLabel,
140
- checked: d,
141
- onChange: (u) => l(u.target.checked),
148
+ checked: l,
149
+ onChange: (c) => t(c.target.checked),
142
150
  "data-testid": "rubric-builder-use-for-grading"
143
151
  }
144
152
  ),
145
- !a && !d && /* @__PURE__ */ e(
146
- ne,
153
+ !a && !l && /* @__PURE__ */ e(
154
+ oe,
147
155
  {
148
156
  variant: "toggle",
149
157
  label: i.hideScoreTotalLabel,
150
- checked: t,
151
- onChange: (u) => s("hideScoreTotal", u.target.checked),
158
+ checked: o,
159
+ onChange: (c) => s("hideScoreTotal", c.target.checked),
152
160
  "data-testid": "rubric-builder-hide-score-total"
153
161
  }
154
162
  )
155
163
  ] });
156
- }, Z = ({
164
+ }, le = ({
157
165
  isOpen: r,
158
- heading: o,
166
+ heading: n,
159
167
  body: s,
160
168
  confirmLabel: i,
161
169
  cancelLabel: a,
162
- onConfirm: d,
163
- onDismiss: t,
170
+ onConfirm: l,
171
+ onDismiss: o,
164
172
  "data-testid": g
165
173
  }) => {
166
- const { translations: l } = D();
167
- return /* @__PURE__ */ m(Q, { open: r, onDismiss: t, size: "small", label: o, "data-testid": g, children: [
168
- /* @__PURE__ */ m(Q.Header, { children: [
174
+ const { translations: t } = I();
175
+ return /* @__PURE__ */ b(te, { open: r, onDismiss: o, size: "small", label: n, "data-testid": g, children: [
176
+ /* @__PURE__ */ b(te.Header, { children: [
169
177
  /* @__PURE__ */ e(
170
- We,
178
+ Cr,
171
179
  {
172
180
  placement: "end",
173
181
  offset: "small",
174
- onClick: t,
175
- screenReaderLabel: l.close
182
+ onClick: o,
183
+ screenReaderLabel: t.close
176
184
  }
177
185
  ),
178
- /* @__PURE__ */ e(U, { level: "h2", children: o })
186
+ /* @__PURE__ */ e(q, { level: "h2", children: n })
179
187
  ] }),
180
- /* @__PURE__ */ e(Q.Body, { children: /* @__PURE__ */ e(k, { children: s }) }),
181
- /* @__PURE__ */ m(Q.Footer, { children: [
182
- /* @__PURE__ */ e(A, { onClick: t, margin: "0 x-small 0 0", children: a }),
183
- /* @__PURE__ */ e(A, { color: "primary", onClick: d, "data-testid": "confirm-modal-confirm", children: i })
188
+ /* @__PURE__ */ e(te.Body, { children: /* @__PURE__ */ e(G, { children: s }) }),
189
+ /* @__PURE__ */ b(te.Footer, { children: [
190
+ /* @__PURE__ */ e(H, { onClick: o, margin: "0 x-small 0 0", children: a }),
191
+ /* @__PURE__ */ e(H, { color: "primary", onClick: l, "data-testid": "confirm-modal-confirm", children: i })
184
192
  ] })
185
193
  ] });
186
- }, Ar = ({
194
+ }, Ci = ({
187
195
  criteriaCount: r,
188
- showMissingCriteriaError: o,
196
+ showMissingCriteriaError: n,
189
197
  actions: s,
190
- children: i
198
+ panel: i,
199
+ children: a
191
200
  }) => {
192
- const { translations: a } = D();
193
- return /* @__PURE__ */ m(p, { as: "section", "aria-labelledby": "rubric-builder-criteria-heading", children: [
194
- /* @__PURE__ */ m(v, { justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
195
- /* @__PURE__ */ e(U, { level: "h3", id: "rubric-builder-criteria-heading", children: a.rubricBuilderCriteriaHeading }),
196
- s && /* @__PURE__ */ e(v, { gap: "small", wrap: "wrap", children: s })
201
+ const { translations: l } = I();
202
+ return /* @__PURE__ */ b(y, { as: "section", "aria-labelledby": "rubric-builder-criteria-heading", children: [
203
+ /* @__PURE__ */ b(w, { justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
204
+ /* @__PURE__ */ e(q, { level: "h3", id: "rubric-builder-criteria-heading", children: l.rubricBuilderCriteriaHeading }),
205
+ s && /* @__PURE__ */ e(w, { gap: "small", wrap: "wrap", children: s })
197
206
  ] }),
198
- /* @__PURE__ */ e(p, { as: "div", margin: "small 0 0", children: r === 0 ? /* @__PURE__ */ e(k, { color: "secondary", children: a.rubricBuilderCriteriaEmpty }) : i }),
199
- /* @__PURE__ */ e("div", { "aria-live": "polite", children: o && r === 0 && /* @__PURE__ */ e(k, { color: "danger", "data-testid": "rubric-builder-criteria-error", children: a.rubricBuilderAddCriterionError }) })
207
+ i,
208
+ /* @__PURE__ */ e(y, { as: "div", margin: "small 0 0", children: r === 0 ? /* @__PURE__ */ e(G, { color: "secondary", children: l.rubricBuilderCriteriaEmpty }) : a }),
209
+ /* @__PURE__ */ e("div", { "aria-live": "polite", children: n && r === 0 && /* @__PURE__ */ e(G, { color: "danger", "data-testid": "rubric-builder-criteria-error", children: l.rubricBuilderAddCriterionError }) })
200
210
  ] });
201
- }, Nr = ({ points: r, onCommit: o }) => {
202
- const { translations: s } = D(), [i, a] = w(String(r));
203
- return $(() => {
211
+ }, vi = ({ points: r, onCommit: n }) => {
212
+ const { translations: s } = I(), [i, a] = k(String(r));
213
+ return F(() => {
204
214
  a(String(r));
205
215
  }, [r]), /* @__PURE__ */ e(
206
- F,
216
+ V,
207
217
  {
208
218
  renderLabel: s.rubricBuilderPointsPossibleLabel,
209
219
  width: "8rem",
210
220
  value: i,
211
- onChange: (d) => a(d.target.value),
212
- onBlur: (d) => {
213
- const t = Ve(d.target.value);
214
- a(String(t)), t !== r && o(t);
221
+ onChange: (l) => a(l.target.value),
222
+ onBlur: (l) => {
223
+ const o = Sr(l.target.value);
224
+ a(String(o)), o !== r && n(o);
215
225
  },
216
226
  "data-testid": "rubric-builder-points-possible"
217
227
  }
218
228
  );
219
- }, Hr = ({
229
+ }, Ri = ({
220
230
  rating: r,
221
- sortableId: o,
231
+ sortableId: n,
222
232
  position: s,
223
233
  rangeStart: i,
224
234
  useRange: a,
225
- hidePoints: d,
226
- showNameError: t,
235
+ hidePoints: l,
236
+ showNameError: o,
227
237
  canRemove: g,
228
- onChange: l,
229
- onPointsBlur: u,
230
- onRemove: b
238
+ onChange: t,
239
+ onPointsBlur: c,
240
+ onRemove: h
231
241
  }) => {
232
- const { translations: c, translate: n } = D(), { attributes: C, listeners: y, setNodeRef: f, transform: I, transition: P } = he({
233
- id: o
234
- }), [E, S] = w(String(r.points));
235
- $(() => {
236
- de(E) !== r.points && S(String(r.points));
242
+ const { translations: d, translate: u } = I(), { attributes: p, listeners: v, setNodeRef: f, transform: m, transition: C } = He({
243
+ id: n
244
+ }), [E, R] = k(String(r.points));
245
+ F(() => {
246
+ we(E) !== r.points && R(String(r.points));
237
247
  }, [r.points]);
238
- const B = (R, T) => {
239
- S(T), l({ ...r, points: R });
248
+ const S = (B, T) => {
249
+ R(T), t({ ...r, points: B });
240
250
  };
241
251
  return /* @__PURE__ */ e(
242
252
  "div",
243
253
  {
244
254
  ref: f,
245
- style: { transform: pe.Transform.toString(I), transition: P },
255
+ style: { transform: $e.Transform.toString(m), transition: C },
246
256
  "data-testid": "rubric-builder-rating-row",
247
- children: /* @__PURE__ */ m(v, { gap: "small", alignItems: "start", wrap: "wrap", margin: "0 0 small", children: [
257
+ children: /* @__PURE__ */ b(w, { gap: "small", alignItems: "start", wrap: "wrap", margin: "0 0 small", children: [
248
258
  /* @__PURE__ */ e(
249
- p,
259
+ y,
250
260
  {
251
261
  as: "div",
252
262
  cursor: "grab",
253
263
  margin: "medium 0 0",
254
- "aria-label": n("rubricBuilderReorderRating", { position: s }),
255
- ...C,
256
- ...y,
257
- children: /* @__PURE__ */ e(De, { "aria-hidden": "true" })
264
+ "aria-label": u("rubricBuilderReorderRating", { position: s }),
265
+ ...p,
266
+ ...v,
267
+ children: /* @__PURE__ */ e(Xe, { "aria-hidden": "true" })
258
268
  }
259
269
  ),
260
- /* @__PURE__ */ e(p, { as: "div", minWidth: "1.5rem", margin: "medium 0 0", children: /* @__PURE__ */ e(k, { weight: "bold", "aria-hidden": "true", children: s }) }),
261
- !d && /* @__PURE__ */ m(v, { gap: "x-small", alignItems: "end", children: [
262
- a && i !== void 0 && /* @__PURE__ */ e(p, { as: "div", margin: "0 0 x-small", children: /* @__PURE__ */ e(k, { children: n("rangeStartPrefix", { rangeStart: i }) }) }),
270
+ /* @__PURE__ */ e(y, { as: "div", minWidth: "1.5rem", margin: "medium 0 0", children: /* @__PURE__ */ e(G, { weight: "bold", "aria-hidden": "true", children: s }) }),
271
+ !l && /* @__PURE__ */ b(w, { gap: "x-small", alignItems: "end", children: [
272
+ a && i !== void 0 && /* @__PURE__ */ e(y, { as: "div", margin: "0 0 x-small", children: /* @__PURE__ */ e(G, { children: u("rangeStartPrefix", { rangeStart: i }) }) }),
263
273
  /* @__PURE__ */ e(
264
- Ir,
274
+ ai,
265
275
  {
266
- renderLabel: a ? c.rubricBuilderPointRangeLabel : c.rubricBuilderPointsLabel,
276
+ renderLabel: a ? d.rubricBuilderPointRangeLabel : d.rubricBuilderPointsLabel,
267
277
  allowStringValue: !0,
268
278
  showArrows: !1,
269
279
  width: "6rem",
270
280
  value: E,
271
- onChange: (R, T) => {
272
- Xe(T) && B(de(T), T);
281
+ onChange: (B, T) => {
282
+ Br(T) && S(we(T), T);
273
283
  },
274
284
  onIncrement: () => {
275
- const R = ce(Math.floor(r.points) + 1);
276
- B(R, String(R));
285
+ const B = Ee(Math.floor(r.points) + 1);
286
+ S(B, String(B));
277
287
  },
278
288
  onDecrement: () => {
279
- const R = ce(Math.floor(r.points) - 1);
280
- B(R, String(R));
289
+ const B = Ee(Math.floor(r.points) - 1);
290
+ S(B, String(B));
281
291
  },
282
- onBlur: u,
292
+ onBlur: c,
283
293
  "data-testid": "rubric-builder-rating-points"
284
294
  }
285
295
  )
286
296
  ] }),
287
- /* @__PURE__ */ e(v.Item, { shouldGrow: !0, shouldShrink: !0, size: "10rem", children: /* @__PURE__ */ e(
288
- F,
297
+ /* @__PURE__ */ e(w.Item, { shouldGrow: !0, shouldShrink: !0, size: "10rem", children: /* @__PURE__ */ e(
298
+ V,
289
299
  {
290
- renderLabel: c.rubricBuilderRatingNameLabel,
300
+ renderLabel: d.rubricBuilderRatingNameLabel,
291
301
  isRequired: !0,
292
302
  value: r.description,
293
- onChange: (R) => l({ ...r, description: R.target.value }),
294
- messages: t ? [{ text: c.rubricBuilderRatingNameRequired, type: "error" }] : [],
303
+ onChange: (B) => t({ ...r, description: B.target.value }),
304
+ messages: o ? [{ text: d.rubricBuilderRatingNameRequired, type: "error" }] : [],
295
305
  "data-testid": "rubric-builder-rating-name"
296
306
  }
297
307
  ) }),
298
- /* @__PURE__ */ e(v.Item, { shouldGrow: !0, shouldShrink: !0, size: "14rem", children: /* @__PURE__ */ e(
299
- F,
308
+ /* @__PURE__ */ e(w.Item, { shouldGrow: !0, shouldShrink: !0, size: "14rem", children: /* @__PURE__ */ e(
309
+ V,
300
310
  {
301
- renderLabel: c.rubricBuilderRatingDescriptionLabel,
311
+ renderLabel: d.rubricBuilderRatingDescriptionLabel,
302
312
  value: r.longDescription,
303
- onChange: (R) => l({ ...r, longDescription: R.target.value }),
313
+ onChange: (B) => t({ ...r, longDescription: B.target.value }),
304
314
  "data-testid": "rubric-builder-rating-description"
305
315
  }
306
316
  ) }),
307
- g && /* @__PURE__ */ e(p, { as: "div", margin: "medium 0 0", children: /* @__PURE__ */ e(
308
- Y,
317
+ g && /* @__PURE__ */ e(y, { as: "div", margin: "medium 0 0", children: /* @__PURE__ */ e(
318
+ ae,
309
319
  {
310
- screenReaderLabel: n("rubricBuilderRemoveRating", { position: s }),
320
+ screenReaderLabel: u("rubricBuilderRemoveRating", { position: s }),
311
321
  withBackground: !1,
312
322
  withBorder: !1,
313
- onClick: b,
323
+ onClick: h,
314
324
  "data-testid": "rubric-builder-remove-rating",
315
- children: /* @__PURE__ */ e(Ie, {})
325
+ children: /* @__PURE__ */ e(Ye, {})
316
326
  }
317
327
  ) })
318
328
  ] })
319
329
  }
320
330
  );
321
- }, Ur = ({
331
+ }, Li = ({
322
332
  ratings: r,
323
- useRange: o,
333
+ useRange: n,
324
334
  hidePoints: s,
325
335
  ratingOrder: i,
326
336
  ratingNamesRequired: a,
327
- onChange: d
337
+ onChange: l
328
338
  }) => {
329
- const { translations: t } = D(), g = fe(
330
- J(Re, { activationConstraint: { distance: 8 } }),
331
- J(ve, { coordinateGetter: Ce })
332
- ), l = r.map(Ye), u = i === "ascending", b = r.map((n, C) => u ? r.length - 1 - C : C);
333
- return /* @__PURE__ */ m(p, { as: "div", children: [
334
- /* @__PURE__ */ e(Be, { sensors: g, onDragEnd: ({ active: n, over: C }) => {
335
- if (!C || n.id === C.id) return;
336
- const y = l.indexOf(String(n.id)), f = l.indexOf(String(C.id));
337
- y === -1 || f === -1 || d(tr({ list: r, startIndex: y, endIndex: f }));
339
+ const { translations: o } = I(), g = ze(
340
+ se(We, { activationConstraint: { distance: 8 } }),
341
+ se(qe, { coordinateGetter: Ue })
342
+ ), t = r.map(Ir), c = i === "ascending", h = r.map((u, p) => c ? r.length - 1 - p : p);
343
+ return /* @__PURE__ */ b(y, { as: "div", children: [
344
+ /* @__PURE__ */ e(je, { sensors: g, onDragEnd: ({ active: u, over: p }) => {
345
+ if (!p || u.id === p.id) return;
346
+ const v = t.indexOf(String(u.id)), f = t.indexOf(String(p.id));
347
+ v === -1 || f === -1 || l(Er({ list: r, startIndex: v, endIndex: f }));
338
348
  }, children: /* @__PURE__ */ e(
339
- Se,
349
+ Ke,
340
350
  {
341
- items: b.map((n) => l[n]),
342
- strategy: ye,
343
- children: b.map((n, C) => /* @__PURE__ */ e(
344
- Hr,
351
+ items: h.map((u) => t[u]),
352
+ strategy: Ve,
353
+ children: h.map((u, p) => /* @__PURE__ */ e(
354
+ Ri,
345
355
  {
346
- rating: r[n],
347
- sortableId: l[n],
348
- position: C + 1,
349
- rangeStart: Ze(r, n),
350
- useRange: o,
356
+ rating: r[u],
357
+ sortableId: t[u],
358
+ position: p + 1,
359
+ rangeStart: kr(r, u),
360
+ useRange: n,
351
361
  hidePoints: s,
352
- showNameError: a.includes(n),
362
+ showNameError: a.includes(u),
353
363
  canRemove: r.length > 1,
354
- onChange: (y) => d(rr(r, n, y)),
355
- onPointsBlur: () => d(er(r)),
356
- onRemove: () => d(Je(r, n))
364
+ onChange: (v) => l(Dr(r, u, v)),
365
+ onPointsBlur: () => l(Tr(r)),
366
+ onRemove: () => l(yr(r, u))
357
367
  },
358
- l[n]
368
+ t[u]
359
369
  ))
360
370
  }
361
371
  ) }),
362
372
  /* @__PURE__ */ e(
363
- A,
373
+ H,
364
374
  {
365
- renderIcon: /* @__PURE__ */ e(Le, {}),
375
+ renderIcon: /* @__PURE__ */ e(Je, {}),
366
376
  withBackground: !1,
367
- onClick: () => d(ir(r, u ? 0 : r.length)),
377
+ onClick: () => l(wr(r, c ? 0 : r.length)),
368
378
  "data-testid": "rubric-builder-add-rating",
369
- children: t.rubricBuilderAddRatingLevel
379
+ children: o.rubricBuilderAddRatingLevel
370
380
  }
371
381
  )
372
382
  ] });
373
- }, _r = ({
383
+ }, Si = ({
374
384
  criterion: r,
375
- sortableId: o,
385
+ sortableId: n,
376
386
  position: s,
377
387
  hidePoints: i,
378
388
  freeFormCriterionComments: a,
379
- ratingOrder: d,
380
- errors: t,
389
+ ratingOrder: l,
390
+ errors: o,
381
391
  showErrors: g,
382
- shouldFocusName: l,
383
- shouldFocusHandle: u,
384
- onNameFocused: b,
385
- onHandleFocused: c,
386
- onChange: n,
387
- onDuplicate: C,
388
- onDelete: y
392
+ shouldFocusName: t,
393
+ shouldFocusHandle: c,
394
+ onNameFocused: h,
395
+ onHandleFocused: d,
396
+ onChange: u,
397
+ onDuplicate: p,
398
+ onDelete: v
389
399
  }) => {
390
- const { translations: f, translate: I } = D(), { rubricCriterionRange: P } = _e(), { attributes: E, listeners: S, setNodeRef: B, transform: R, transition: T, isDragging: O } = he({
391
- id: o
392
- }), [x, q] = w(!r.description.trim()), [ee, _] = w(!1), N = ae(null), z = ae(null), W = g && nr(t), G = I("rubricBuilderCriterionHeading", { position: s }), H = r.description.trim(), M = H || G, j = `rubric-builder-criterion-body-${o}`;
393
- return $(() => {
394
- W && q(!0);
395
- }, [W]), $(() => {
396
- var h;
397
- l && x && ((h = N.current) == null || h.focus(), b());
398
- }, [l, x, b]), $(() => {
399
- var h;
400
- u && ((h = z.current) == null || h.focus(), c());
401
- }, [u, c]), /* @__PURE__ */ m(
400
+ const { translations: f, translate: m } = I(), { rubricCriterionRange: C } = ue(), { attributes: E, listeners: R, setNodeRef: S, transform: B, transition: T, isDragging: A } = He({
401
+ id: n
402
+ }), [M, O] = k(!r.description.trim()), [X, W] = k(!1), Y = $(null), J = $(null), z = g && Pr(o), Z = m("rubricBuilderCriterionHeading", { position: s }), j = r.description.trim(), N = j || Z, K = `rubric-builder-criterion-body-${n}`;
403
+ return F(() => {
404
+ z && O(!0);
405
+ }, [z]), F(() => {
406
+ var L;
407
+ t && M && ((L = Y.current) == null || L.focus(), h());
408
+ }, [t, M, h]), F(() => {
409
+ var L;
410
+ c && ((L = J.current) == null || L.focus(), d());
411
+ }, [c, d]), /* @__PURE__ */ b(
402
412
  "div",
403
413
  {
404
- ref: B,
405
- style: { transform: pe.Transform.toString(R), transition: T },
414
+ ref: S,
415
+ style: { transform: $e.Transform.toString(B), transition: T },
406
416
  "data-testid": "rubric-builder-criterion-card",
407
417
  children: [
408
- /* @__PURE__ */ m(
409
- p,
418
+ /* @__PURE__ */ b(
419
+ y,
410
420
  {
411
421
  as: "section",
412
- "aria-label": M,
422
+ "aria-label": N,
413
423
  borderWidth: "small",
414
424
  borderRadius: "medium",
415
425
  padding: "small medium",
416
426
  margin: "0 0 small",
417
427
  background: "primary",
418
- shadow: O ? "above" : "none",
428
+ shadow: A ? "above" : "none",
419
429
  children: [
420
- /* @__PURE__ */ m(v, { gap: "small", alignItems: "center", wrap: "wrap", children: [
430
+ /* @__PURE__ */ b(w, { gap: "small", alignItems: "center", wrap: "wrap", children: [
421
431
  /* @__PURE__ */ e(
422
432
  "div",
423
433
  {
424
- ref: z,
425
- "aria-label": I("rubricBuilderReorderCriterion", { name: M }),
434
+ ref: J,
435
+ "aria-label": m("rubricBuilderReorderCriterion", { name: N }),
426
436
  "data-testid": "rubric-builder-criterion-drag-handle",
427
437
  ...E,
428
- ...S,
429
- children: /* @__PURE__ */ e(De, { "aria-hidden": "true" })
438
+ ...R,
439
+ children: /* @__PURE__ */ e(Xe, { "aria-hidden": "true" })
430
440
  }
431
441
  ),
432
442
  /* @__PURE__ */ e(
433
- Y,
443
+ ae,
434
444
  {
435
- screenReaderLabel: I(
436
- x ? "rubricBuilderCollapseCriterion" : "rubricBuilderExpandCriterion",
437
- { name: M }
445
+ screenReaderLabel: m(
446
+ M ? "rubricBuilderCollapseCriterion" : "rubricBuilderExpandCriterion",
447
+ { name: N }
438
448
  ),
439
- "aria-expanded": x,
440
- "aria-controls": j,
449
+ "aria-expanded": M,
450
+ "aria-controls": K,
441
451
  withBackground: !1,
442
452
  withBorder: !1,
443
453
  size: "small",
444
- onClick: () => q((h) => !h),
454
+ onClick: () => O((L) => !L),
445
455
  "data-testid": "rubric-builder-criterion-toggle",
446
- children: x ? /* @__PURE__ */ e(fr, {}) : /* @__PURE__ */ e(Cr, {})
456
+ children: M ? /* @__PURE__ */ e(Zr, {}) : /* @__PURE__ */ e(ei, {})
447
457
  }
448
458
  ),
449
459
  a && /* @__PURE__ */ e(
450
- vr,
460
+ ri,
451
461
  {
452
462
  title: f.rubricBuilderWrittenFeedback,
453
463
  "data-testid": "rubric-builder-criterion-written-icon"
454
464
  }
455
465
  ),
456
- /* @__PURE__ */ e(v.Item, { shouldGrow: !0, shouldShrink: !0, children: /* @__PURE__ */ m(U, { level: "h4", children: [
457
- G,
458
- H && /* @__PURE__ */ e(k, { weight: "normal", "data-testid": "rubric-builder-criterion-name", children: `: ${H}` })
466
+ /* @__PURE__ */ e(w.Item, { shouldGrow: !0, shouldShrink: !0, children: /* @__PURE__ */ b(q, { level: "h4", children: [
467
+ Z,
468
+ j && /* @__PURE__ */ e(G, { weight: "normal", "data-testid": "rubric-builder-criterion-name", children: `: ${j}` })
459
469
  ] }) }),
460
- !i && /* @__PURE__ */ e(we, { "data-testid": "rubric-builder-criterion-max", children: I("rubricBuilderCriterionMaxPoints", { count: r.points }) }),
470
+ !i && /* @__PURE__ */ e(rr, { "data-testid": "rubric-builder-criterion-max", children: m("rubricBuilderCriterionMaxPoints", { count: r.points }) }),
461
471
  /* @__PURE__ */ e(
462
- Y,
472
+ ae,
463
473
  {
464
- screenReaderLabel: I("rubricBuilderDuplicateCriterion", { name: M }),
474
+ screenReaderLabel: m("rubricBuilderDuplicateCriterion", { name: N }),
465
475
  withBackground: !1,
466
476
  withBorder: !1,
467
- onClick: C,
477
+ onClick: p,
468
478
  "data-testid": "rubric-builder-duplicate-criterion",
469
- children: /* @__PURE__ */ e(Rr, {})
479
+ children: /* @__PURE__ */ e(ii, {})
470
480
  }
471
481
  ),
472
482
  /* @__PURE__ */ e(
473
- Y,
483
+ ae,
474
484
  {
475
- screenReaderLabel: I("rubricBuilderDeleteCriterion", { name: M }),
485
+ screenReaderLabel: m("rubricBuilderDeleteCriterion", { name: N }),
476
486
  withBackground: !1,
477
487
  withBorder: !1,
478
- onClick: () => _(!0),
488
+ onClick: () => W(!0),
479
489
  "data-testid": "rubric-builder-delete-criterion",
480
- children: /* @__PURE__ */ e(Ie, {})
490
+ children: /* @__PURE__ */ e(Ye, {})
481
491
  }
482
492
  )
483
493
  ] }),
484
- x && /* @__PURE__ */ e(p, { as: "div", id: j, margin: "medium 0 0", children: /* @__PURE__ */ m(v, { direction: "column", gap: "medium", children: [
494
+ M && /* @__PURE__ */ e(y, { as: "div", id: K, margin: "medium 0 0", children: /* @__PURE__ */ b(w, { direction: "column", gap: "medium", children: [
485
495
  /* @__PURE__ */ e(
486
- F,
496
+ V,
487
497
  {
488
498
  renderLabel: f.rubricBuilderCriterionNameLabel,
489
499
  isRequired: !0,
490
500
  value: r.description,
491
- inputRef: (h) => {
492
- N.current = h;
501
+ inputRef: (L) => {
502
+ Y.current = L;
493
503
  },
494
- onChange: (h) => n({ ...r, description: h.target.value }),
495
- messages: g && t.nameRequired ? [{ text: f.rubricBuilderCriterionNameRequired, type: "error" }] : [],
504
+ onChange: (L) => u({ ...r, description: L.target.value }),
505
+ messages: g && o.nameRequired ? [{ text: f.rubricBuilderCriterionNameRequired, type: "error" }] : [],
496
506
  "data-testid": "rubric-builder-criterion-name-input"
497
507
  }
498
508
  ),
499
509
  /* @__PURE__ */ e(
500
- Dr,
510
+ ni,
501
511
  {
502
512
  label: f.rubricBuilderCriterionDescriptionLabel,
503
513
  value: r.longDescription ?? "",
504
- onChange: (h) => n({ ...r, longDescription: h.target.value }),
514
+ onChange: (L) => u({ ...r, longDescription: L.target.value }),
505
515
  "data-testid": "rubric-builder-criterion-description"
506
516
  }
507
517
  ),
508
- P && !i && !a && /* @__PURE__ */ e(
509
- yr,
518
+ C && !i && !a && /* @__PURE__ */ e(
519
+ ti,
510
520
  {
511
521
  variant: "toggle",
512
522
  label: f.rubricBuilderEnableRange,
513
523
  checked: r.criterionUseRange,
514
- onChange: (h) => n({ ...r, criterionUseRange: h.target.checked }),
524
+ onChange: (L) => u({ ...r, criterionUseRange: L.target.checked }),
515
525
  "data-testid": "rubric-builder-enable-range"
516
526
  }
517
527
  ),
518
528
  a ? !i && /* @__PURE__ */ e(
519
- Nr,
529
+ vi,
520
530
  {
521
531
  points: r.points,
522
- onCommit: (h) => n(
523
- ue(
532
+ onCommit: (L) => u(
533
+ Pe(
524
534
  r,
525
- ar(r.ratings, h)
535
+ xr(r.ratings, L)
526
536
  )
527
537
  )
528
538
  }
529
539
  ) : /* @__PURE__ */ e(
530
- Ur,
540
+ Li,
531
541
  {
532
542
  ratings: r.ratings,
533
543
  useRange: r.criterionUseRange && !i,
534
544
  hidePoints: i,
535
- ratingOrder: d,
536
- ratingNamesRequired: g ? t.ratingNamesRequired : [],
537
- onChange: (h) => n(ue(r, h))
545
+ ratingOrder: l,
546
+ ratingNamesRequired: g ? o.ratingNamesRequired : [],
547
+ onChange: (L) => u(Pe(r, L))
538
548
  }
539
549
  )
540
550
  ] }) })
@@ -542,127 +552,127 @@ const Di = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children
542
552
  }
543
553
  ),
544
554
  /* @__PURE__ */ e(
545
- Z,
555
+ le,
546
556
  {
547
- isOpen: ee,
557
+ isOpen: X,
548
558
  heading: f.rubricBuilderCriterionDeleteHeading,
549
559
  body: f.rubricBuilderCriterionDeleteBody,
550
560
  confirmLabel: f.delete,
551
561
  cancelLabel: f.cancel,
552
562
  onConfirm: () => {
553
- _(!1), y();
563
+ W(!1), v();
554
564
  },
555
- onDismiss: () => _(!1),
565
+ onDismiss: () => W(!1),
556
566
  "data-testid": "rubric-builder-delete-criterion-modal"
557
567
  }
558
568
  )
559
569
  ]
560
570
  }
561
571
  );
562
- }, Gr = ({
572
+ }, Bi = ({
563
573
  criteria: r,
564
- hidePoints: o,
574
+ hidePoints: n,
565
575
  freeFormCriterionComments: s,
566
576
  ratingOrder: i,
567
577
  criteriaValidationErrors: a,
568
- showErrors: d,
569
- focusNameCriterionId: t,
578
+ showErrors: l,
579
+ focusNameCriterionId: o,
570
580
  onFocusedName: g,
571
- onChangeCriterion: l,
572
- onDuplicateCriterion: u,
573
- onDeleteCriterion: b,
574
- onReorderCriteria: c
581
+ onChangeCriterion: t,
582
+ onDuplicateCriterion: c,
583
+ onDeleteCriterion: h,
584
+ onReorderCriteria: d
575
585
  }) => {
576
586
  const {
577
- sortableIds: n,
578
- movedCriterionId: C,
579
- clearMovedCriterion: y,
587
+ sortableIds: u,
588
+ movedCriterionId: p,
589
+ clearMovedCriterion: v,
580
590
  srAnnouncement: f,
581
- moveCriterionBySortableId: I
582
- } = or({ criteria: r, onReorderCriteria: c }), P = fe(
583
- J(Re, { activationConstraint: { distance: 8 } }),
584
- J(ve, { coordinateGetter: Ce })
591
+ moveCriterionBySortableId: m
592
+ } = Ar({ criteria: r, onReorderCriteria: d }), C = ze(
593
+ se(We, { activationConstraint: { distance: 8 } }),
594
+ se(qe, { coordinateGetter: Ue })
585
595
  );
586
- return /* @__PURE__ */ m(ze, { children: [
587
- /* @__PURE__ */ e(Sr, { children: /* @__PURE__ */ e("div", { "aria-live": "polite", "aria-atomic": "true", children: f }) }),
588
- /* @__PURE__ */ e(Be, { sensors: P, onDragEnd: ({ active: S, over: B }) => {
589
- B && I(S.id, B.id);
590
- }, children: /* @__PURE__ */ e(Se, { items: n, strategy: ye, children: r.map((S, B) => /* @__PURE__ */ e(
591
- _r,
596
+ return /* @__PURE__ */ b(ve, { children: [
597
+ /* @__PURE__ */ e(er, { children: /* @__PURE__ */ e("div", { "aria-live": "polite", "aria-atomic": "true", children: f }) }),
598
+ /* @__PURE__ */ e(je, { sensors: C, onDragEnd: ({ active: R, over: S }) => {
599
+ S && m(R.id, S.id);
600
+ }, children: /* @__PURE__ */ e(Ke, { items: u, strategy: Ve, children: r.map((R, S) => /* @__PURE__ */ e(
601
+ Si,
592
602
  {
593
- criterion: S,
594
- sortableId: n[B],
595
- position: B + 1,
596
- hidePoints: o,
603
+ criterion: R,
604
+ sortableId: u[S],
605
+ position: S + 1,
606
+ hidePoints: n,
597
607
  freeFormCriterionComments: s,
598
608
  ratingOrder: i,
599
- errors: a[B],
600
- showErrors: d,
601
- shouldFocusName: S.id === t,
602
- shouldFocusHandle: S.id === C,
609
+ errors: a[S],
610
+ showErrors: l,
611
+ shouldFocusName: R.id === o,
612
+ shouldFocusHandle: R.id === p,
603
613
  onNameFocused: g,
604
- onHandleFocused: y,
605
- onChange: l,
606
- onDuplicate: () => u(S),
607
- onDelete: () => b(S)
614
+ onHandleFocused: v,
615
+ onChange: t,
616
+ onDuplicate: () => c(R),
617
+ onDelete: () => h(R)
608
618
  },
609
- n[B]
619
+ u[S]
610
620
  )) }) })
611
621
  ] });
612
- }, $r = ({
622
+ }, Ii = ({
613
623
  isOpen: r,
614
- assignmentPoints: o,
624
+ assignmentPoints: n,
615
625
  rubricPoints: s,
616
626
  onChange: i,
617
627
  onLeaveDifferent: a,
618
- onDismiss: d
628
+ onDismiss: l
619
629
  }) => {
620
- const { translations: t, translate: g } = D(), { locale: l } = ge(), u = sr(s, o, l), b = u === null ? g("pointsDifferenceModalBodyZeroAssignmentPoints", { rubricPoints: s }) : g("pointsDifferenceModalBody", { assignmentPoints: o, rubricPoints: s, pointRatio: u });
621
- return /* @__PURE__ */ m(
622
- V,
630
+ const { translations: o, translate: g } = I(), { locale: t } = Re(), c = Or(s, n, t), h = c === null ? g("pointsDifferenceModalBodyZeroAssignmentPoints", { rubricPoints: s }) : g("pointsDifferenceModalBody", { assignmentPoints: n, rubricPoints: s, pointRatio: c });
631
+ return /* @__PURE__ */ b(
632
+ x,
623
633
  {
624
634
  open: r,
625
- onDismiss: d,
635
+ onDismiss: l,
626
636
  size: "small",
627
- label: t.pointsDifferenceModalLabel,
637
+ label: o.pointsDifferenceModalLabel,
628
638
  "data-testid": "rubric-builder-points-difference-modal",
629
639
  children: [
630
- /* @__PURE__ */ m(V.Header, { children: [
640
+ /* @__PURE__ */ b(x.Header, { children: [
631
641
  /* @__PURE__ */ e(
632
- Lr,
642
+ Le,
633
643
  {
634
644
  placement: "end",
635
645
  offset: "small",
636
- onClick: d,
637
- screenReaderLabel: t.close
646
+ onClick: l,
647
+ screenReaderLabel: o.close
638
648
  }
639
649
  ),
640
- /* @__PURE__ */ e(wr, { level: "h2", children: t.confirmToContinueHeader })
650
+ /* @__PURE__ */ e(Q, { level: "h2", children: o.confirmToContinueHeader })
641
651
  ] }),
642
- /* @__PURE__ */ e(V.Body, { children: /* @__PURE__ */ e(kr, { children: b }) }),
643
- /* @__PURE__ */ m(V.Footer, { children: [
652
+ /* @__PURE__ */ e(x.Body, { children: /* @__PURE__ */ e(de, { children: h }) }),
653
+ /* @__PURE__ */ b(x.Footer, { children: [
644
654
  /* @__PURE__ */ e(
645
- me,
655
+ _,
646
656
  {
647
657
  onClick: a,
648
658
  margin: "0 x-small 0 0",
649
659
  "data-testid": "rubric-builder-leave-points-different",
650
- children: t.pointsDifferenceModalLeaveDifferent
660
+ children: o.pointsDifferenceModalLeaveDifferent
651
661
  }
652
662
  ),
653
- /* @__PURE__ */ e(me, { color: "primary", onClick: i, "data-testid": "rubric-builder-change-points", children: t.pointsDifferenceModalChange })
663
+ /* @__PURE__ */ e(_, { color: "primary", onClick: i, "data-testid": "rubric-builder-change-points", children: o.pointsDifferenceModalChange })
654
664
  ] })
655
665
  ]
656
666
  }
657
667
  );
658
- }, Fr = ({
668
+ }, ki = ({
659
669
  savePending: r,
660
- onDiscard: o,
670
+ onDiscard: n,
661
671
  onSave: s
662
672
  }) => {
663
- const { translations: i } = D();
673
+ const { translations: i } = I();
664
674
  return /* @__PURE__ */ e(
665
- p,
675
+ y,
666
676
  {
667
677
  as: "footer",
668
678
  position: "sticky",
@@ -671,10 +681,10 @@ const Di = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children
671
681
  borderWidth: "small none none none",
672
682
  padding: "small 0",
673
683
  stacking: "above",
674
- children: /* @__PURE__ */ m(v, { justifyItems: "end", gap: "small", wrap: "wrap", children: [
675
- /* @__PURE__ */ e(A, { onClick: o, "data-testid": "rubric-builder-discard", children: i.rubricBuilderDiscard }),
684
+ children: /* @__PURE__ */ b(w, { justifyItems: "end", gap: "small", wrap: "wrap", children: [
685
+ /* @__PURE__ */ e(H, { onClick: n, "data-testid": "rubric-builder-discard", children: i.rubricBuilderDiscard }),
676
686
  /* @__PURE__ */ e(
677
- A,
687
+ H,
678
688
  {
679
689
  color: "primary",
680
690
  onClick: s,
@@ -686,44 +696,44 @@ const Di = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children
686
696
  ] })
687
697
  }
688
698
  );
689
- }, qr = ({
699
+ }, yi = ({
690
700
  isNewRubric: r,
691
- pointsPossible: o,
701
+ pointsPossible: n,
692
702
  hidePoints: s
693
703
  }) => {
694
- const { translations: i, translate: a } = D();
695
- return /* @__PURE__ */ m(v, { as: "header", justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
696
- /* @__PURE__ */ e(U, { level: "h2", children: r ? i.rubricBuilderCreateTitle : i.rubricBuilderEditTitle }),
697
- !s && /* @__PURE__ */ e(we, { "data-testid": "rubric-builder-current-total", children: a("rubricBuilderCurrentTotal", { count: o }) })
704
+ const { translations: i, translate: a } = I();
705
+ return /* @__PURE__ */ b(w, { as: "header", justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
706
+ /* @__PURE__ */ e(q, { level: "h2", children: r ? i.rubricBuilderCreateTitle : i.rubricBuilderEditTitle }),
707
+ !s && /* @__PURE__ */ e(rr, { "data-testid": "rubric-builder-current-total", children: a("rubricBuilderCurrentTotal", { count: n }) })
698
708
  ] });
699
- }, X = ({ name: r, label: o, value: s, options: i, onChange: a }) => /* @__PURE__ */ e(
700
- Tr,
709
+ }, ne = ({ name: r, label: n, value: s, options: i, onChange: a }) => /* @__PURE__ */ e(
710
+ oi,
701
711
  {
702
712
  name: r,
703
- description: o,
713
+ description: n,
704
714
  variant: "toggle",
705
715
  layout: "columns",
706
716
  value: s,
707
- onChange: (d, t) => a(t),
708
- children: i.map((d) => /* @__PURE__ */ e(xr, { value: d.value, label: d.label }, d.value))
717
+ onChange: (l, o) => a(o),
718
+ children: i.map((l) => /* @__PURE__ */ e(li, { value: l.value, label: l.label }, l.value))
709
719
  }
710
- ), zr = ({
720
+ ), Ti = ({
711
721
  rubricForm: r,
712
- setRubricFormField: o,
722
+ setRubricFormField: n,
713
723
  validateTitle: s,
714
724
  titleError: i,
715
725
  titleInputRef: a,
716
- assignmentSettings: d
726
+ assignmentSettings: l
717
727
  }) => {
718
- const { translations: t } = D(), g = (l) => {
719
- if (l === "unscored" === r.hidePoints) return;
720
- const { hidePoints: u, hideScoreTotal: b, useForGrading: c, buttonDisplay: n } = lr(
728
+ const { translations: o } = I(), g = (t) => {
729
+ if (t === "unscored" === r.hidePoints) return;
730
+ const { hidePoints: c, hideScoreTotal: h, useForGrading: d, buttonDisplay: u } = Gr(
721
731
  r.hidePoints
722
732
  );
723
- o("hidePoints", u), o("hideScoreTotal", b), o("useForGrading", c), n && o("buttonDisplay", n);
733
+ n("hidePoints", c), n("hideScoreTotal", h), n("useForGrading", d), u && n("buttonDisplay", u);
724
734
  };
725
- return /* @__PURE__ */ m(
726
- p,
735
+ return /* @__PURE__ */ b(
736
+ y,
727
737
  {
728
738
  as: "section",
729
739
  "aria-labelledby": "rubric-builder-details-heading",
@@ -731,310 +741,898 @@ const Di = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children
731
741
  borderRadius: "medium",
732
742
  padding: "medium",
733
743
  children: [
734
- /* @__PURE__ */ e(U, { level: "h3", id: "rubric-builder-details-heading", margin: "0 0 medium", children: t.rubricBuilderDetailsHeading }),
735
- /* @__PURE__ */ m(v, { direction: "column", gap: "medium", children: [
744
+ /* @__PURE__ */ e(q, { level: "h3", id: "rubric-builder-details-heading", margin: "0 0 medium", children: o.rubricBuilderDetailsHeading }),
745
+ /* @__PURE__ */ b(w, { direction: "column", gap: "medium", children: [
736
746
  /* @__PURE__ */ e(
737
- F,
747
+ V,
738
748
  {
739
749
  "data-testid": "rubric-builder-name",
740
- renderLabel: t.rubricBuilderNameLabel,
750
+ renderLabel: o.rubricBuilderNameLabel,
741
751
  isRequired: !0,
742
752
  value: r.title,
743
753
  inputRef: a,
744
- onChange: (l) => o("title", l.target.value),
745
- onBlur: (l) => s(l.target.value),
754
+ onChange: (t) => n("title", t.target.value),
755
+ onBlur: (t) => s(t.target.value),
746
756
  messages: i ? [{ text: i, type: "error" }] : []
747
757
  }
748
758
  ),
749
- /* @__PURE__ */ m(v, { gap: "medium", wrap: "wrap", children: [
759
+ /* @__PURE__ */ b(w, { gap: "medium", wrap: "wrap", children: [
750
760
  /* @__PURE__ */ e(
751
- X,
761
+ ne,
752
762
  {
753
763
  name: "rubric-builder-scoring",
754
- label: t.scoringTypeSelectLabel,
764
+ label: o.scoringTypeSelectLabel,
755
765
  value: r.hidePoints ? "unscored" : "scored",
756
766
  options: [
757
- { value: "scored", label: t.scoringTypeScored },
758
- { value: "unscored", label: t.scoringTypeUnscored }
767
+ { value: "scored", label: o.scoringTypeScored },
768
+ { value: "unscored", label: o.scoringTypeUnscored }
759
769
  ],
760
770
  onChange: g
761
771
  }
762
772
  ),
763
773
  !r.hidePoints && !r.freeFormCriterionComments && /* @__PURE__ */ e(
764
- X,
774
+ ne,
765
775
  {
766
776
  name: "rubric-builder-display",
767
- label: t.rubricBuilderDisplayLabel,
777
+ label: o.rubricBuilderDisplayLabel,
768
778
  value: r.buttonDisplay,
769
779
  options: [
770
- { value: "points", label: t.ratingDisplayPoints },
771
- { value: "numeric", label: t.ratingDisplayLevel }
780
+ { value: "points", label: o.ratingDisplayPoints },
781
+ { value: "numeric", label: o.ratingDisplayLevel }
772
782
  ],
773
- onChange: (l) => o("buttonDisplay", l)
783
+ onChange: (t) => n("buttonDisplay", t)
774
784
  }
775
785
  ),
776
786
  /* @__PURE__ */ e(
777
- X,
787
+ ne,
778
788
  {
779
789
  name: "rubric-builder-feedback",
780
- label: t.rubricBuilderFeedbackLabel,
790
+ label: o.rubricBuilderFeedbackLabel,
781
791
  value: r.freeFormCriterionComments ? "freeForm" : "scale",
782
792
  options: [
783
- { value: "scale", label: t.gradingTypeScale },
784
- { value: "freeForm", label: t.rubricBuilderFeedbackWrittenOnly }
793
+ { value: "scale", label: o.gradingTypeScale },
794
+ { value: "freeForm", label: o.rubricBuilderFeedbackWrittenOnly }
785
795
  ],
786
- onChange: (l) => o("freeFormCriterionComments", l === "freeForm")
796
+ onChange: (t) => n("freeFormCriterionComments", t === "freeForm")
787
797
  }
788
798
  ),
789
799
  !r.freeFormCriterionComments && /* @__PURE__ */ e(
790
- X,
800
+ ne,
791
801
  {
792
802
  name: "rubric-builder-rating-order",
793
- label: t.rubricBuilderRatingOrderLabel,
803
+ label: o.rubricBuilderRatingOrderLabel,
794
804
  value: r.ratingOrder,
795
805
  options: [
796
- { value: "ascending", label: t.rubricBuilderRatingOrderLowToHigh },
797
- { value: "descending", label: t.rubricBuilderRatingOrderHighToLow }
806
+ { value: "ascending", label: o.rubricBuilderRatingOrderLowToHigh },
807
+ { value: "descending", label: o.rubricBuilderRatingOrderHighToLow }
798
808
  ],
799
- onChange: (l) => o("ratingOrder", l)
809
+ onChange: (t) => n("ratingOrder", t)
800
810
  }
801
811
  )
802
812
  ] }),
803
- d
813
+ l
804
814
  ] })
805
815
  ]
806
816
  }
807
817
  );
808
- }, Ii = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children: /* @__PURE__ */ e(
809
- Ge,
818
+ }, Di = ({
819
+ options: r,
820
+ maxCriterionCount: n,
821
+ maxRatingCount: s,
822
+ rangeEnabled: i,
823
+ isPending: a,
824
+ onChange: l,
825
+ onGenerate: o,
826
+ onCancel: g
827
+ }) => {
828
+ const { translations: t } = I(), [c, h] = k(!1), d = (m, C) => l({ ...r, [m]: C }), u = xe(r.totalPoints), p = r.standard.length > fe, v = r.additionalPromptInfo.length > fe, f = () => {
829
+ if (!u) {
830
+ h(!0);
831
+ return;
832
+ }
833
+ o();
834
+ };
835
+ return /* @__PURE__ */ b(P, { direction: "column", gap: "medium", "data-testid": "rubric-builder-generator-form", children: [
836
+ /* @__PURE__ */ b(P, { gap: "small", wrap: "wrap", alignItems: "start", children: [
837
+ /* @__PURE__ */ e(P.Item, { shouldGrow: !0, shouldShrink: !0, size: "12rem", children: /* @__PURE__ */ e(
838
+ U,
839
+ {
840
+ renderLabel: t.rubricBuilderGeneratorDifficultyLabel,
841
+ value: r.gradeLevel,
842
+ onChange: (m, { value: C }) => C && d("gradeLevel", String(C)),
843
+ "data-testid": "rubric-builder-generator-difficulty",
844
+ children: Mr.map((m) => /* @__PURE__ */ e(U.Option, { id: `rubric-builder-grade-level-${m}`, value: m, children: t[_r[m]] }, m))
845
+ }
846
+ ) }),
847
+ /* @__PURE__ */ e(P.Item, { shouldGrow: !0, shouldShrink: !0, size: "10rem", children: /* @__PURE__ */ e(
848
+ U,
849
+ {
850
+ renderLabel: t.rubricBuilderGeneratorCriteriaCountLabel,
851
+ isRequired: !0,
852
+ value: String(r.criteriaCount),
853
+ onChange: (m, { value: C }) => C && d("criteriaCount", Number(C)),
854
+ "data-testid": "rubric-builder-generator-criteria-count",
855
+ children: Ae(n).map((m) => /* @__PURE__ */ e(
856
+ U.Option,
857
+ {
858
+ id: `rubric-builder-criteria-count-${m}`,
859
+ value: String(m),
860
+ children: String(m)
861
+ },
862
+ m
863
+ ))
864
+ }
865
+ ) }),
866
+ /* @__PURE__ */ e(P.Item, { shouldGrow: !0, shouldShrink: !0, size: "10rem", children: /* @__PURE__ */ e(
867
+ U,
868
+ {
869
+ renderLabel: t.rubricBuilderGeneratorRatingCountLabel,
870
+ isRequired: !0,
871
+ value: String(r.ratingCount),
872
+ onChange: (m, { value: C }) => C && d("ratingCount", Number(C)),
873
+ "data-testid": "rubric-builder-generator-rating-count",
874
+ children: Ae(s).map((m) => /* @__PURE__ */ e(
875
+ U.Option,
876
+ {
877
+ id: `rubric-builder-rating-count-${m}`,
878
+ value: String(m),
879
+ children: String(m)
880
+ },
881
+ m
882
+ ))
883
+ }
884
+ ) }),
885
+ /* @__PURE__ */ e(P.Item, { shouldGrow: !0, shouldShrink: !0, size: "8rem", children: /* @__PURE__ */ e(
886
+ ui,
887
+ {
888
+ renderLabel: t.generateCriteriaTotalPointsLabel,
889
+ isRequired: !0,
890
+ value: r.totalPoints,
891
+ onChange: (m, C) => {
892
+ d("totalPoints", C), xe(C) && h(!1);
893
+ },
894
+ messages: c && !u ? [{ text: t.generateCriteriaTotalPointsError, type: "error" }] : [],
895
+ "data-testid": "rubric-builder-generator-total-points"
896
+ }
897
+ ) })
898
+ ] }),
899
+ i && /* @__PURE__ */ e(
900
+ oe,
901
+ {
902
+ variant: "toggle",
903
+ label: t.rubricBuilderEnableRange,
904
+ checked: r.useRange,
905
+ onChange: (m) => d("useRange", m.target.checked),
906
+ "data-testid": "rubric-builder-generator-use-range"
907
+ }
908
+ ),
909
+ /* @__PURE__ */ e(
910
+ ce,
911
+ {
912
+ label: t.rubricBuilderGeneratorStandardLabel,
913
+ placeholder: t.standardObjectivePlaceholder,
914
+ value: r.standard,
915
+ onChange: (m) => d("standard", m.target.value),
916
+ messages: p ? [{ text: t.standardObjectiveTooLong, type: "error" }] : [],
917
+ "data-testid": "rubric-builder-generator-standard"
918
+ }
919
+ ),
920
+ /* @__PURE__ */ e(
921
+ ce,
922
+ {
923
+ label: t.rubricBuilderGeneratorAdditionalLabel,
924
+ placeholder: t.generateCriteriaAdditionalPromptPlaceholder,
925
+ value: r.additionalPromptInfo,
926
+ onChange: (m) => d("additionalPromptInfo", m.target.value),
927
+ messages: v ? [{ text: t.generateCriteriaAdditionalPromptTooLong, type: "error" }] : [],
928
+ "data-testid": "rubric-builder-generator-additional"
929
+ }
930
+ ),
931
+ /* @__PURE__ */ b(P, { justifyItems: "end", gap: "small", children: [
932
+ /* @__PURE__ */ e(
933
+ _,
934
+ {
935
+ onClick: g,
936
+ disabled: a,
937
+ "data-testid": "rubric-builder-generator-cancel",
938
+ children: t.cancel
939
+ }
940
+ ),
941
+ /* @__PURE__ */ e(
942
+ _,
943
+ {
944
+ color: "ai-primary",
945
+ renderIcon: /* @__PURE__ */ e(be, {}),
946
+ onClick: f,
947
+ disabled: a || p || v,
948
+ "data-testid": "rubric-builder-generator-generate",
949
+ children: t.rubricBuilderGeneratorGenerate
950
+ }
951
+ )
952
+ ] })
953
+ ] });
954
+ }, wi = ({
955
+ courseId: r,
956
+ responseId: n,
957
+ responseType: s
958
+ }) => {
959
+ const { translations: i, translate: a } = I(), { locale: l } = Re(), [o, g] = k(null), [t, c] = k(null), [h, d] = k("");
960
+ F(() => {
961
+ g(null), c(null);
962
+ }, [n]);
963
+ const u = () => {
964
+ d(""), c(null);
965
+ }, { submitFeedback: p, isPending: v } = Nr({
966
+ courseId: r,
967
+ responseId: n,
968
+ responseType: s,
969
+ onSubmitted: () => {
970
+ g(t), u();
971
+ }
972
+ }), f = t ?? o, m = h.length > Oe, C = t === "positive" ? i.positiveFeedbackLabel : i.negativeFeedbackLabel, E = (R) => {
973
+ o !== R && c(R);
974
+ };
975
+ return /* @__PURE__ */ b(ve, { children: [
976
+ /* @__PURE__ */ b(P, { alignItems: "center", gap: "xx-small", "data-testid": "rubric-builder-generator-feedback", children: [
977
+ /* @__PURE__ */ e(de, { children: i.generatedCriteriaFeedbackLabel }),
978
+ /* @__PURE__ */ e(
979
+ _e,
980
+ {
981
+ withBackground: !1,
982
+ withBorder: !1,
983
+ size: "small",
984
+ screenReaderLabel: i.positiveFeedbackLabel,
985
+ "aria-pressed": f === "positive",
986
+ onClick: () => E("positive"),
987
+ "data-testid": "rubric-builder-generator-feedback-positive",
988
+ children: f === "positive" ? /* @__PURE__ */ e(Ge, {}) : /* @__PURE__ */ e(Me, {})
989
+ }
990
+ ),
991
+ /* @__PURE__ */ e(
992
+ _e,
993
+ {
994
+ withBackground: !1,
995
+ withBorder: !1,
996
+ size: "small",
997
+ screenReaderLabel: i.negativeFeedbackLabel,
998
+ "aria-pressed": f === "negative",
999
+ onClick: () => E("negative"),
1000
+ "data-testid": "rubric-builder-generator-feedback-negative",
1001
+ children: f === "negative" ? /* @__PURE__ */ e(Ge, { rotate: "180" }) : /* @__PURE__ */ e(Me, { rotate: "180" })
1002
+ }
1003
+ )
1004
+ ] }),
1005
+ /* @__PURE__ */ b(
1006
+ x,
1007
+ {
1008
+ open: t != null,
1009
+ onDismiss: v ? void 0 : u,
1010
+ size: "medium",
1011
+ label: C,
1012
+ shouldCloseOnDocumentClick: !1,
1013
+ "data-testid": "rubric-builder-generator-feedback-modal",
1014
+ children: [
1015
+ /* @__PURE__ */ b(x.Header, { children: [
1016
+ /* @__PURE__ */ e(
1017
+ Le,
1018
+ {
1019
+ placement: "end",
1020
+ offset: "small",
1021
+ onClick: u,
1022
+ screenReaderLabel: i.feedbackModalCancelLabel
1023
+ }
1024
+ ),
1025
+ /* @__PURE__ */ e(Q, { level: "h2", children: C })
1026
+ ] }),
1027
+ /* @__PURE__ */ b(x.Body, { children: [
1028
+ /* @__PURE__ */ e(de, { as: "p", children: i.feedbackModalDescription }),
1029
+ /* @__PURE__ */ e(
1030
+ ce,
1031
+ {
1032
+ label: i.feedbackModalCommentLabel,
1033
+ placeholder: i.feedbackModalCommentPlaceholder,
1034
+ value: h,
1035
+ disabled: v,
1036
+ onChange: (R) => d(R.target.value),
1037
+ messages: m ? [
1038
+ {
1039
+ text: a("feedbackModalCommentTooLong", {
1040
+ limit: new Intl.NumberFormat(l).format(Oe)
1041
+ }),
1042
+ type: "error"
1043
+ }
1044
+ ] : [],
1045
+ "data-testid": "rubric-builder-generator-feedback-comment"
1046
+ }
1047
+ )
1048
+ ] }),
1049
+ /* @__PURE__ */ b(x.Footer, { children: [
1050
+ /* @__PURE__ */ e(_, { onClick: u, disabled: v, margin: "0 x-small 0 0", children: i.cancel }),
1051
+ /* @__PURE__ */ e(
1052
+ _,
1053
+ {
1054
+ color: "primary",
1055
+ disabled: m || v,
1056
+ onClick: () => t && p({ feedbackType: t, comment: h }),
1057
+ "data-testid": "rubric-builder-generator-feedback-submit",
1058
+ children: v ? i.feedbackModalSubmitting : i.feedbackModalSubmit
1059
+ }
1060
+ )
1061
+ ] })
1062
+ ]
1063
+ }
1064
+ )
1065
+ ] });
1066
+ }, Ei = ({
1067
+ isOpen: r,
1068
+ onRegenerate: n,
1069
+ onDismiss: s
1070
+ }) => {
1071
+ const { translations: i } = I(), a = $(null), [l, o] = k(""), g = l.length > fe, t = () => {
1072
+ o(""), s();
1073
+ };
1074
+ return /* @__PURE__ */ b(
1075
+ x,
1076
+ {
1077
+ open: r,
1078
+ onDismiss: t,
1079
+ size: "medium",
1080
+ label: i.regenerateModalCriteriaLabel,
1081
+ shouldCloseOnDocumentClick: !1,
1082
+ defaultFocusElement: () => a.current,
1083
+ "data-testid": "rubric-builder-regenerate-modal",
1084
+ children: [
1085
+ /* @__PURE__ */ b(x.Header, { children: [
1086
+ /* @__PURE__ */ e(Le, { placement: "end", offset: "small", onClick: t, screenReaderLabel: i.close }),
1087
+ /* @__PURE__ */ e(Q, { level: "h2", children: i.regenerateModalCriteriaLabel })
1088
+ ] }),
1089
+ /* @__PURE__ */ b(x.Body, { children: [
1090
+ /* @__PURE__ */ e(de, { as: "p", children: i.regenerateModalDescriptionCriteria }),
1091
+ /* @__PURE__ */ e(
1092
+ ce,
1093
+ {
1094
+ label: i.regenerateModalPromptLabel,
1095
+ placeholder: i.regenerateModalPromptPlaceholder,
1096
+ value: l,
1097
+ textareaRef: (c) => {
1098
+ a.current = c;
1099
+ },
1100
+ onChange: (c) => o(c.target.value),
1101
+ messages: g ? [{ text: i.regenerateModalPromptTooLong, type: "error" }] : [],
1102
+ "data-testid": "rubric-builder-regenerate-prompt"
1103
+ }
1104
+ )
1105
+ ] }),
1106
+ /* @__PURE__ */ b(x.Footer, { children: [
1107
+ /* @__PURE__ */ e(_, { onClick: t, margin: "0 x-small 0 0", children: i.cancel }),
1108
+ /* @__PURE__ */ e(
1109
+ _,
1110
+ {
1111
+ color: "ai-primary",
1112
+ renderIcon: /* @__PURE__ */ e(be, {}),
1113
+ disabled: g,
1114
+ onClick: () => {
1115
+ n(l), t();
1116
+ },
1117
+ "data-testid": "rubric-builder-regenerate-submit",
1118
+ children: i.regenerateButtonLabel
1119
+ }
1120
+ )
1121
+ ] })
1122
+ ]
1123
+ }
1124
+ );
1125
+ }, Pi = ({
1126
+ courseId: r,
1127
+ responseId: n,
1128
+ responseType: s,
1129
+ canRegenerate: i,
1130
+ isPending: a,
1131
+ onRegenerate: l
1132
+ }) => {
1133
+ const { translations: o } = I(), g = $(null), [t, c] = k(!1);
1134
+ F(() => {
1135
+ var d;
1136
+ (d = g.current) == null || d.focus();
1137
+ }, []);
1138
+ const h = /* @__PURE__ */ e(
1139
+ _,
1140
+ {
1141
+ color: "ai-secondary",
1142
+ renderIcon: /* @__PURE__ */ e(be, {}),
1143
+ disabled: a || !i,
1144
+ onClick: () => c(!0),
1145
+ "data-testid": "rubric-builder-generator-regenerate",
1146
+ children: o.regenerateButtonLabel
1147
+ }
1148
+ );
1149
+ return /* @__PURE__ */ b(P, { direction: "column", gap: "small", "data-testid": "rubric-builder-generator-summary", children: [
1150
+ /* @__PURE__ */ e(
1151
+ Q,
1152
+ {
1153
+ level: "h4",
1154
+ elementRef: (d) => {
1155
+ g.current = d;
1156
+ },
1157
+ tabIndex: -1,
1158
+ children: o.rubricBuilderGeneratorDoneHeading
1159
+ }
1160
+ ),
1161
+ /* @__PURE__ */ b(P, { justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
1162
+ n ? /* @__PURE__ */ e(
1163
+ wi,
1164
+ {
1165
+ courseId: r,
1166
+ responseId: n,
1167
+ responseType: s
1168
+ }
1169
+ ) : /* @__PURE__ */ e("span", {}),
1170
+ i ? h : /* @__PURE__ */ e(bi, { renderTip: o.noCriteriaForRegenerationTooltip, children: h })
1171
+ ] }),
1172
+ /* @__PURE__ */ e(
1173
+ Ei,
1174
+ {
1175
+ isOpen: t,
1176
+ onRegenerate: l,
1177
+ onDismiss: () => c(!1)
1178
+ }
1179
+ )
1180
+ ] });
1181
+ }, ir = "rubric-builder-generator", xi = ({
1182
+ courseId: r,
1183
+ generator: n,
1184
+ onCancel: s
1185
+ }) => {
1186
+ const { translations: i } = I(), { aiRubricsMaxCriterionCount: a, aiRubricsMaxRatingCount: l, rubricCriterionRange: o } = ue(), { isPending: g, progress: t } = n, c = t == null ? void 0 : t.completion;
1187
+ return /* @__PURE__ */ e(
1188
+ ci,
1189
+ {
1190
+ as: "section",
1191
+ id: ir,
1192
+ "aria-labelledby": "rubric-builder-generator-heading",
1193
+ borderWidth: "small",
1194
+ borderRadius: "medium",
1195
+ padding: "medium",
1196
+ margin: "small 0 0",
1197
+ background: "secondary",
1198
+ "data-testid": "rubric-builder-generator-panel",
1199
+ children: /* @__PURE__ */ b(P, { direction: "column", gap: "medium", children: [
1200
+ /* @__PURE__ */ b(P, { alignItems: "center", gap: "small", children: [
1201
+ /* @__PURE__ */ e(Ze, {}),
1202
+ /* @__PURE__ */ e(Q, { level: "h4", id: "rubric-builder-generator-heading", children: i.rubricBuilderGeneratorToggle }),
1203
+ /* @__PURE__ */ e(Fr, { enabled: !0 })
1204
+ ] }),
1205
+ g && (typeof c == "number" ? /* @__PURE__ */ e(
1206
+ si,
1207
+ {
1208
+ screenReaderLabel: i.rubricBuilderGeneratorGenerating,
1209
+ valueNow: c,
1210
+ valueMax: 100,
1211
+ "data-testid": "rubric-builder-generator-progress"
1212
+ }
1213
+ ) : /* @__PURE__ */ e(
1214
+ di,
1215
+ {
1216
+ size: "small",
1217
+ renderTitle: i.rubricBuilderGeneratorGenerating,
1218
+ "data-testid": "rubric-builder-generator-progress"
1219
+ }
1220
+ )),
1221
+ n.isGenerated ? /* @__PURE__ */ e(
1222
+ Pi,
1223
+ {
1224
+ courseId: r,
1225
+ responseId: n.feedbackResponseId,
1226
+ responseType: n.feedbackResponseType,
1227
+ canRegenerate: n.canRegenerate,
1228
+ isPending: g,
1229
+ onRegenerate: n.regenerateAll
1230
+ }
1231
+ ) : /* @__PURE__ */ e(
1232
+ Di,
1233
+ {
1234
+ options: n.options,
1235
+ maxCriterionCount: a,
1236
+ maxRatingCount: l,
1237
+ rangeEnabled: o,
1238
+ isPending: g,
1239
+ onChange: n.setOptions,
1240
+ onGenerate: n.generate,
1241
+ onCancel: s
1242
+ }
1243
+ )
1244
+ ] })
1245
+ }
1246
+ );
1247
+ }, Ai = ({ generator: r }) => {
1248
+ const { translations: n, translate: s } = I(), { isPending: i, lastResult: a } = r, l = i ? n.rubricBuilderGeneratorGenerating : (a == null ? void 0 : a.kind) === "generated" ? s("rubricBuilderGeneratorAdded", { count: a.count }) : (a == null ? void 0 : a.kind) === "regenerated" ? n.rubricBuilderGeneratorRegenerated : "";
1249
+ return /* @__PURE__ */ e(er, { children: /* @__PURE__ */ e("div", { "aria-live": "polite", "aria-atomic": "true", "data-testid": "rubric-builder-generator-status", children: l }) });
1250
+ }, Oi = (r) => {
1251
+ try {
1252
+ return qr(r).criteria.length;
1253
+ } catch {
1254
+ return 0;
1255
+ }
1256
+ }, Gi = ({
1257
+ courseId: r,
1258
+ assignmentId: n,
1259
+ assignmentPointsPossible: s,
1260
+ criteria: i,
1261
+ criteriaRef: a,
1262
+ setRubricFormField: l
1263
+ }) => {
1264
+ const { aiRubricsMaxCriterionCount: o, aiRubricsMaxRatingCount: g } = ue(), t = De(
1265
+ () => Hr({
1266
+ maxCriterionCount: o,
1267
+ maxRatingCount: g,
1268
+ assignmentPointsPossible: s
1269
+ }),
1270
+ [o, g, s]
1271
+ ), [c, h] = k(t), d = Fe(() => h(t), [t]), {
1272
+ generateCriteriaProgress: u,
1273
+ generateCriteriaIsPending: p,
1274
+ generateCriteriaIsSuccess: v,
1275
+ generateCriteriaMutation: f,
1276
+ generateResponseId: m
1277
+ } = $r({
1278
+ courseId: r,
1279
+ assignmentId: n,
1280
+ generateOptions: c,
1281
+ criteriaRef: a,
1282
+ setRubricFormField: l
1283
+ }), {
1284
+ regeneratedCriteriaProgress: C,
1285
+ regenerateCriteriaIsPending: E,
1286
+ regenerateCriteriaIsSuccess: R,
1287
+ regenerateAllCriteria: S,
1288
+ regenerateResponseId: B,
1289
+ regenerateResponseType: T
1290
+ } = zr({
1291
+ courseId: r,
1292
+ assignmentId: n,
1293
+ criteriaRef: a,
1294
+ generateOptions: c,
1295
+ setRubricFormField: l
1296
+ }), A = De(
1297
+ () => v ? Oi(u == null ? void 0 : u.results) : 0,
1298
+ [v, u]
1299
+ );
1300
+ return {
1301
+ options: c,
1302
+ setOptions: h,
1303
+ resetOptions: d,
1304
+ generate: () => f(),
1305
+ regenerateAll: S,
1306
+ isPending: p || E,
1307
+ progress: E ? C : u,
1308
+ isGenerated: v,
1309
+ lastResult: R ? { kind: "regenerated" } : v ? { kind: "generated", count: A } : null,
1310
+ // Outcome-linked criteria can't be regenerated, so there must be another one.
1311
+ canRegenerate: i.some((O) => !O.learningOutcomeId),
1312
+ feedbackResponseId: B ?? m ?? "",
1313
+ feedbackResponseType: T ?? Ur.GENERATE_CRITERIA
1314
+ };
1315
+ }, Mi = (r) => /* @__PURE__ */ e(Ce, { translations: r.translations, children: /* @__PURE__ */ e(
1316
+ Ne,
810
1317
  {
811
1318
  courseId: r.courseId,
812
1319
  accountId: r.accountId,
813
1320
  featureFlags: r.featureFlags,
814
1321
  aiLimits: r.aiLimits,
815
- children: /* @__PURE__ */ e(Wr, { ...r })
1322
+ children: /* @__PURE__ */ e(_i, { ...r })
816
1323
  }
817
- ) }), Wr = ({
1324
+ ) }), _i = ({
818
1325
  rubricId: r,
819
- rubric: o,
1326
+ rubric: n,
820
1327
  rubricAssociation: s,
821
1328
  assignmentId: i,
822
1329
  assignmentPointsPossible: a,
823
- canUseForGrading: d = !0,
824
- accountId: t,
1330
+ canUseForGrading: l = !0,
1331
+ accountId: o,
825
1332
  courseId: g,
826
- canManageRubrics: l,
827
- onSaveRubric: u,
828
- onDiscard: b
1333
+ canManageRubrics: t,
1334
+ onSaveRubric: c,
1335
+ onDiscard: h
829
1336
  }) => {
830
- var se;
831
- const { translations: c } = D(), {
832
- rubricForm: n,
833
- setRubricFormField: C,
834
- validateField: y,
835
- validationErrors: f,
836
- isNewRubric: I,
837
- load: { data: P, isLoading: E, isError: S, isSuccess: B },
838
- savePending: R,
839
- saveError: T,
1337
+ var ye;
1338
+ const { translations: d } = I(), { aiRubricsEnabled: u } = ue(), {
1339
+ rubricForm: p,
1340
+ criteriaRef: v,
1341
+ setRubricFormField: f,
1342
+ validateField: m,
1343
+ validationErrors: C,
1344
+ isNewRubric: E,
1345
+ load: { data: R, isLoading: S, isError: B, isSuccess: T },
1346
+ savePending: A,
1347
+ saveError: M,
840
1348
  save: O,
841
- saveAction: x,
842
- isDirty: q,
843
- criteriaValid: ee,
844
- criteriaValidationErrors: _,
845
- saveCriterion: N,
846
- deleteCriterion: z,
847
- reorderCriteria: W
848
- } = dr({
1349
+ saveAction: X,
1350
+ isDirty: W,
1351
+ criteriaValid: Y,
1352
+ criteriaValidationErrors: J,
1353
+ saveCriterion: z,
1354
+ deleteCriterion: Z,
1355
+ reorderCriteria: j
1356
+ } = Wr({
849
1357
  rubricId: r,
850
- rubric: o,
1358
+ rubric: n,
851
1359
  rubricAssociation: s,
852
1360
  assignmentId: i,
853
1361
  assignmentPointsPossible: a,
854
- accountId: t,
1362
+ accountId: o,
855
1363
  courseId: g,
856
- canManageRubrics: l,
857
- onSaveRubric: u
858
- }), G = ae(null), [H, M] = w(!1), [j, h] = w(!1), [ke, re] = w(!1), [Te, ie] = w(!1), [xe, K] = w(!1), [Pe, oe] = w(), Ee = cr(), Oe = qe(() => oe(void 0), []);
859
- if (r && E)
860
- return /* @__PURE__ */ e(hr, {});
1364
+ canManageRubrics: t,
1365
+ onSaveRubric: c
1366
+ }), N = $(null), [K, L] = k(!1), [tr, Se] = k(!1), [nr, me] = k(!1), [ar, ge] = k(!1), [or, ee] = k(!1), [lr, Be] = k(), sr = jr(), dr = Fe(() => Be(void 0), []), re = Gi({
1367
+ courseId: g,
1368
+ assignmentId: i,
1369
+ assignmentPointsPossible: a,
1370
+ criteria: p.criteria,
1371
+ criteriaRef: v,
1372
+ setRubricFormField: f
1373
+ }), [ie, Ie] = k(!1), ke = $(null), he = u && E && !!g;
861
1374
  if (r && S)
862
- return $e({
863
- errorImageUrl: ur,
864
- errorCategory: c.rubricErrorPageCategory,
865
- translations: le(c)
1375
+ return /* @__PURE__ */ e(Qe, {});
1376
+ if (r && B)
1377
+ return hr({
1378
+ errorImageUrl: Kr,
1379
+ errorCategory: d.rubricErrorPageCategory,
1380
+ translations: Te(d)
866
1381
  });
867
- if (r && B && !P)
868
- return Fe({ translations: le(c) });
869
- const Me = () => {
870
- var L;
871
- if (M(!0), !y("title", n.title)) {
872
- (L = G.current) == null || L.focus();
1382
+ if (r && T && !R)
1383
+ return pr({ translations: Te(d) });
1384
+ const cr = () => {
1385
+ var D;
1386
+ if (L(!0), !m("title", p.title)) {
1387
+ (D = N.current) == null || D.focus();
873
1388
  return;
874
1389
  }
875
- if (!(n.criteria.length === 0 || !ee))
876
- switch (x) {
1390
+ if (!(p.criteria.length === 0 || !Y))
1391
+ switch (X) {
877
1392
  case "confirmPointsDifference":
878
- K(!0);
1393
+ ee(!0);
879
1394
  break;
880
1395
  case "confirmAssessedEdit":
881
- ie(!0);
1396
+ ge(!0);
882
1397
  break;
883
1398
  case "confirmSave":
884
- re(!0);
1399
+ me(!0);
885
1400
  break;
886
1401
  case "save":
887
1402
  O();
888
1403
  break;
889
1404
  default: {
890
- const He = x;
891
- throw new Error(`Unhandled save action: ${He}`);
1405
+ const mr = X;
1406
+ throw new Error(`Unhandled save action: ${mr}`);
892
1407
  }
893
1408
  }
894
- }, Ae = () => {
895
- const L = br(Ee());
896
- N(L), oe(L.id);
897
- }, Ne = () => {
898
- q ? h(!0) : b();
1409
+ }, ur = () => {
1410
+ const D = Qr(sr());
1411
+ z(D), Be(D.id);
1412
+ }, br = () => {
1413
+ W ? Se(!0) : h();
899
1414
  };
900
- return /* @__PURE__ */ m(p, { as: "div", "data-testid": "rubric-builder", children: [
901
- /* @__PURE__ */ m(v, { direction: "column", gap: "medium", padding: "medium 0", children: [
1415
+ return /* @__PURE__ */ b(y, { as: "div", "data-testid": "rubric-builder", children: [
1416
+ /* @__PURE__ */ b(w, { direction: "column", gap: "medium", padding: "medium 0", children: [
902
1417
  /* @__PURE__ */ e(
903
- qr,
1418
+ yi,
904
1419
  {
905
- isNewRubric: I,
906
- pointsPossible: n.pointsPossible,
907
- hidePoints: n.hidePoints
1420
+ isNewRubric: E,
1421
+ pointsPossible: p.pointsPossible,
1422
+ hidePoints: p.hidePoints
908
1423
  }
909
1424
  ),
910
- T && /* @__PURE__ */ e(pr, { variant: "error", margin: "0", children: c.rubricFormSaveError }),
1425
+ M && /* @__PURE__ */ e(Jr, { variant: "error", margin: "0", children: d.rubricFormSaveError }),
911
1426
  /* @__PURE__ */ e(
912
- zr,
1427
+ Ti,
913
1428
  {
914
- rubricForm: n,
915
- setRubricFormField: C,
916
- validateTitle: (L) => y("title", L),
917
- titleError: (se = f.title) == null ? void 0 : se.message,
918
- titleInputRef: (L) => {
919
- G.current = L;
1429
+ rubricForm: p,
1430
+ setRubricFormField: f,
1431
+ validateTitle: (D) => m("title", D),
1432
+ titleError: (ye = C.title) == null ? void 0 : ye.message,
1433
+ titleInputRef: (D) => {
1434
+ N.current = D;
920
1435
  },
921
1436
  assignmentSettings: /* @__PURE__ */ e(
922
- Mr,
1437
+ fi,
923
1438
  {
924
- rubricForm: n,
925
- canUseForGrading: d,
926
- setRubricFormField: C
1439
+ rubricForm: p,
1440
+ canUseForGrading: l,
1441
+ setRubricFormField: f
927
1442
  }
928
1443
  )
929
1444
  }
930
1445
  ),
931
1446
  /* @__PURE__ */ e(
932
- Ar,
1447
+ Ci,
933
1448
  {
934
- criteriaCount: n.criteria.length,
935
- showMissingCriteriaError: H,
936
- actions: /* @__PURE__ */ e(
937
- A,
1449
+ criteriaCount: p.criteria.length,
1450
+ showMissingCriteriaError: K,
1451
+ actions: /* @__PURE__ */ b(ve, { children: [
1452
+ he && /* @__PURE__ */ e(
1453
+ H,
1454
+ {
1455
+ color: ie ? "ai-primary" : "ai-secondary",
1456
+ renderIcon: ie ? /* @__PURE__ */ e(be, {}) : /* @__PURE__ */ e(Ze, {}),
1457
+ "aria-expanded": ie,
1458
+ "aria-controls": ir,
1459
+ onClick: () => Ie((D) => !D),
1460
+ elementRef: (D) => {
1461
+ ke.current = D;
1462
+ },
1463
+ "data-testid": "rubric-builder-generator-toggle",
1464
+ children: d.rubricBuilderGeneratorToggle
1465
+ }
1466
+ ),
1467
+ /* @__PURE__ */ e(
1468
+ H,
1469
+ {
1470
+ renderIcon: /* @__PURE__ */ e(Je, {}),
1471
+ onClick: ur,
1472
+ disabled: re.isPending,
1473
+ "data-testid": "rubric-builder-add-criterion",
1474
+ children: d.rubricBuilderAddCriterion
1475
+ }
1476
+ )
1477
+ ] }),
1478
+ panel: he && g && // Hidden rather than unmounted, so a run and its result survive a collapse.
1479
+ /* @__PURE__ */ e("div", { hidden: !ie, children: /* @__PURE__ */ e(
1480
+ xi,
938
1481
  {
939
- renderIcon: /* @__PURE__ */ e(Le, {}),
940
- onClick: Ae,
941
- "data-testid": "rubric-builder-add-criterion",
942
- children: c.rubricBuilderAddCriterion
1482
+ courseId: g,
1483
+ generator: re,
1484
+ onCancel: () => {
1485
+ var D;
1486
+ re.resetOptions(), Ie(!1), (D = ke.current) == null || D.focus();
1487
+ }
943
1488
  }
944
- ),
1489
+ ) }),
945
1490
  children: /* @__PURE__ */ e(
946
- Gr,
1491
+ Bi,
947
1492
  {
948
- criteria: n.criteria,
949
- hidePoints: n.hidePoints,
950
- freeFormCriterionComments: n.freeFormCriterionComments,
951
- ratingOrder: n.ratingOrder,
952
- criteriaValidationErrors: _,
953
- showErrors: H,
954
- focusNameCriterionId: Pe,
955
- onFocusedName: Oe,
956
- onChangeCriterion: N,
957
- onDuplicateCriterion: (L) => N(mr(L)),
958
- onDeleteCriterion: z,
959
- onReorderCriteria: W
1493
+ criteria: p.criteria,
1494
+ hidePoints: p.hidePoints,
1495
+ freeFormCriterionComments: p.freeFormCriterionComments,
1496
+ ratingOrder: p.ratingOrder,
1497
+ criteriaValidationErrors: J,
1498
+ showErrors: K,
1499
+ focusNameCriterionId: lr,
1500
+ onFocusedName: dr,
1501
+ onChangeCriterion: z,
1502
+ onDuplicateCriterion: (D) => z(Vr(D)),
1503
+ onDeleteCriterion: Z,
1504
+ onReorderCriteria: j
960
1505
  }
961
1506
  )
962
1507
  }
963
- )
1508
+ ),
1509
+ he && /* @__PURE__ */ e(Ai, { generator: re })
964
1510
  ] }),
965
1511
  /* @__PURE__ */ e(
966
- Fr,
1512
+ ki,
967
1513
  {
968
- savePending: R,
969
- onDiscard: Ne,
970
- onSave: Me
1514
+ savePending: A,
1515
+ onDiscard: br,
1516
+ onSave: cr
971
1517
  }
972
1518
  ),
973
1519
  /* @__PURE__ */ e(
974
- Z,
1520
+ le,
975
1521
  {
976
- isOpen: j,
977
- heading: c.rubricBuilderDiscardHeading,
978
- body: c.rubricBuilderDiscardBody,
979
- confirmLabel: c.rubricBuilderDiscard,
980
- cancelLabel: c.rubricBuilderKeepEditing,
981
- onConfirm: b,
982
- onDismiss: () => h(!1),
1522
+ isOpen: tr,
1523
+ heading: d.rubricBuilderDiscardHeading,
1524
+ body: d.rubricBuilderDiscardBody,
1525
+ confirmLabel: d.rubricBuilderDiscard,
1526
+ cancelLabel: d.rubricBuilderKeepEditing,
1527
+ onConfirm: h,
1528
+ onDismiss: () => Se(!1),
983
1529
  "data-testid": "rubric-builder-discard-modal"
984
1530
  }
985
1531
  ),
986
1532
  /* @__PURE__ */ e(
987
- Z,
1533
+ le,
988
1534
  {
989
- isOpen: ke,
990
- heading: c.confirmToContinueHeader,
991
- body: c.gradingHistoryWarning,
992
- confirmLabel: c.saveConfirmModalSave,
993
- cancelLabel: c.cancel,
1535
+ isOpen: nr,
1536
+ heading: d.confirmToContinueHeader,
1537
+ body: d.gradingHistoryWarning,
1538
+ confirmLabel: d.saveConfirmModalSave,
1539
+ cancelLabel: d.cancel,
994
1540
  onConfirm: () => {
995
- re(!1), O();
1541
+ me(!1), O();
996
1542
  },
997
- onDismiss: () => re(!1),
1543
+ onDismiss: () => me(!1),
998
1544
  "data-testid": "rubric-builder-save-confirm-modal"
999
1545
  }
1000
1546
  ),
1001
1547
  /* @__PURE__ */ e(
1002
- Z,
1548
+ le,
1003
1549
  {
1004
- isOpen: Te,
1005
- heading: c.confirmToContinueHeader,
1006
- body: c.gradingHistoryWarning,
1007
- confirmLabel: c.editConfirmModalConfirm,
1008
- cancelLabel: c.cancel,
1550
+ isOpen: ar,
1551
+ heading: d.confirmToContinueHeader,
1552
+ body: d.gradingHistoryWarning,
1553
+ confirmLabel: d.editConfirmModalConfirm,
1554
+ cancelLabel: d.cancel,
1009
1555
  onConfirm: () => {
1010
- ie(!1), O();
1556
+ ge(!1), O();
1011
1557
  },
1012
- onDismiss: () => ie(!1),
1558
+ onDismiss: () => ge(!1),
1013
1559
  "data-testid": "rubric-builder-assessed-edit-modal"
1014
1560
  }
1015
1561
  ),
1016
1562
  /* @__PURE__ */ e(
1017
- $r,
1563
+ Ii,
1018
1564
  {
1019
- isOpen: xe,
1565
+ isOpen: or,
1020
1566
  assignmentPoints: a ?? 0,
1021
- rubricPoints: n.pointsPossible,
1567
+ rubricPoints: p.pointsPossible,
1022
1568
  onChange: () => {
1023
- K(!1), O(!1);
1569
+ ee(!1), O(!1);
1024
1570
  },
1025
1571
  onLeaveDifferent: () => {
1026
- K(!1), O(!0);
1572
+ ee(!1), O(!0);
1027
1573
  },
1028
- onDismiss: () => K(!1)
1574
+ onDismiss: () => ee(!1)
1029
1575
  }
1030
1576
  )
1031
1577
  ] });
1578
+ }, yt = (r) => /* @__PURE__ */ e(Ce, { translations: r.translations, children: /* @__PURE__ */ e(
1579
+ Ne,
1580
+ {
1581
+ courseId: r.courseId,
1582
+ featureFlags: r.featureFlags,
1583
+ aiLimits: r.aiLimits,
1584
+ children: /* @__PURE__ */ e(Ni, { ...r })
1585
+ }
1586
+ ) }), Ni = ({
1587
+ courseId: r,
1588
+ assignmentId: n,
1589
+ assignmentPointsPossible: s,
1590
+ canManageRubrics: i,
1591
+ canUseForGrading: a = !0,
1592
+ featureFlags: l,
1593
+ aiLimits: o,
1594
+ onAssignmentPointsPossibleChange: g,
1595
+ onRubricChange: t
1596
+ }) => {
1597
+ const { translations: c } = I(), h = fr(), { rubric: d, rubricAssociation: u, isLoading: p, error: v, applySavedRubric: f, reload: m } = Xr({
1598
+ courseId: r,
1599
+ assignmentId: n,
1600
+ canUseForGrading: a,
1601
+ onAssignmentPointsPossibleChange: g,
1602
+ onRubricChange: t
1603
+ }), [C, E] = k(0), R = $(null), S = () => E((T) => T + 1);
1604
+ F(() => {
1605
+ var T, A;
1606
+ C > 0 && ((A = (T = R.current) == null ? void 0 : T.querySelector('input[data-testid="rubric-builder-name"]')) == null || A.focus());
1607
+ }, [C]);
1608
+ const B = (T, A) => f(T, A, () => {
1609
+ m().finally(S);
1610
+ });
1611
+ return p ? /* @__PURE__ */ e(Qe, {}) : v ? /* @__PURE__ */ e(mi, { variant: "error", children: c.rubricAssignmentContainerLoadError }) : /* @__PURE__ */ e("div", { ref: R, children: /* @__PURE__ */ e(
1612
+ Mi,
1613
+ {
1614
+ translations: h,
1615
+ courseId: r,
1616
+ featureFlags: l,
1617
+ aiLimits: o,
1618
+ assignmentId: n,
1619
+ assignmentPointsPossible: s,
1620
+ rubric: d,
1621
+ rubricAssociation: u,
1622
+ canUseForGrading: a,
1623
+ canManageRubrics: i,
1624
+ onSaveRubric: B,
1625
+ onDiscard: S
1626
+ },
1627
+ C
1628
+ ) });
1032
1629
  };
1033
1630
  export {
1034
- ki as DEFAULT_AI_MAX_CRITERION_COUNT,
1035
- Ti as DEFAULT_AI_MAX_RATING_COUNT,
1036
- yi as HelloWorld,
1037
- Ii as RubricBuilder,
1038
- Di as RubricSelector,
1039
- xi as defaultRubricsTranslations
1631
+ wt as DEFAULT_AI_MAX_CRITERION_COUNT,
1632
+ Et as DEFAULT_AI_MAX_RATING_COUNT,
1633
+ It as HelloWorld,
1634
+ yt as RubricAssignmentBuilder,
1635
+ Mi as RubricBuilder,
1636
+ kt as RubricSelector,
1637
+ Pt as defaultRubricsTranslations
1040
1638
  };