@instructure/platform-rubrics 0.8.0 → 1.0.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 (22) hide show
  1. package/dist/_internal/ViewRubrics/useRubricsQuery.d.ts.map +1 -1
  2. package/dist/_internal/ViewRubrics/useViewRubrics.d.ts.map +1 -1
  3. package/dist/_internal/constants/i18n.d.ts +2 -0
  4. package/dist/_internal/constants/i18n.d.ts.map +1 -1
  5. package/dist/canvas.js +1 -1
  6. package/dist/chunks/{ErrorShip-Dzd13wSZ.js → ErrorShip-DEitKD2c.js} +663 -661
  7. package/dist/foundation/RubricBuilder/components/RubricBuilderHeader.d.ts +2 -1
  8. package/dist/foundation/RubricBuilder/components/RubricBuilderHeader.d.ts.map +1 -1
  9. package/dist/foundation/RubricBuilder/components/RubricDetailsCard.d.ts.map +1 -1
  10. package/dist/foundation/RubricBuilder/components/criteria/CriteriaList.d.ts +4 -1
  11. package/dist/foundation/RubricBuilder/components/criteria/CriteriaList.d.ts.map +1 -1
  12. package/dist/foundation/RubricBuilder/components/criteria/CriterionCard.d.ts +4 -1
  13. package/dist/foundation/RubricBuilder/components/criteria/CriterionCard.d.ts.map +1 -1
  14. package/dist/foundation/RubricBuilder/components/criteria/PointsPossibleField.d.ts +6 -0
  15. package/dist/foundation/RubricBuilder/components/criteria/PointsPossibleField.d.ts.map +1 -0
  16. package/dist/foundation/RubricBuilder/components/criteria/RatingList.d.ts +3 -1
  17. package/dist/foundation/RubricBuilder/components/criteria/RatingList.d.ts.map +1 -1
  18. package/dist/foundation/RubricBuilder/components/criteria/RatingRow.d.ts +2 -1
  19. package/dist/foundation/RubricBuilder/components/criteria/RatingRow.d.ts.map +1 -1
  20. package/dist/foundation.js +475 -403
  21. package/locales/en.json +2 -0
  22. package/package.json +4 -4
@@ -1,30 +1,30 @@
1
- import { g as De, u as we, R as Le, r as Te, e as ee, b as Ee } from "./chunks/errorPage-Jon3K-u6.js";
2
- import { D as Zr, a as ei } from "./chunks/errorPage-Jon3K-u6.js";
1
+ import { g as Le, u as De, R as Pe, r as Te, e as ie, b as Ee } from "./chunks/errorPage-Jon3K-u6.js";
2
+ import { D as ti, a as ni } from "./chunks/errorPage-Jon3K-u6.js";
3
3
  import "@instructure/platform-provider";
4
- import { useState as k, useEffect as $, useRef as X, useCallback as ke } from "react";
5
- import { jsx as e, jsxs as c, Fragment as xe } from "react/jsx-runtime";
6
- import { Heading as A } from "@instructure/ui-heading";
4
+ import { useState as x, useEffect as F, useRef as Z, useCallback as xe } from "react";
5
+ import { jsx as e, jsxs as c, Fragment as ke } from "react/jsx-runtime";
6
+ import { Heading as _ } from "@instructure/ui-heading";
7
7
  import { View as h } from "@instructure/ui-view";
8
- import { Button as x, CloseButton as Pe, IconButton as j } from "@instructure/ui-buttons";
9
- import { Flex as p } from "@instructure/ui-flex";
10
- import { SimpleSelect as V } from "@instructure/ui-simple-select";
11
- import { Spinner as Ae } from "@instructure/ui-spinner";
12
- import { Text as I } from "@instructure/ui-text";
13
- import { useQuery as Oe } from "@tanstack/react-query";
14
- import { u as Ne, T as te, t as ae, i as ne, a as D, b as le, p as re, C as oe, c as ie, d as Me, e as se, f as K, s as de, K as ce, P as ue, r as He, D as me, S as be, v as ge, g as Ue, h as _e, j as qe, k as ze, l as Fe, m as Ge, n as We, w as $e, o as je, q as Ke, x as Qe, y as Ve, z as Xe, A as Ye, B as Je } from "./chunks/ErrorShip-Dzd13wSZ.js";
15
- import Ze from "graphql-tag";
16
- import { LoadingIndicator as er } from "@instructure/platform-loading-indicator";
17
- import { Alert as rr } from "@instructure/ui-alerts";
18
- import { IconDragHandleLine as he, IconTrashLine as pe, IconAddLine as fe, IconArrowOpenDownLine as ir, IconArrowOpenEndLine as tr, IconDuplicateLine as ar } from "@instructure/ui-icons";
19
- import { Modal as G } from "@instructure/ui-modal";
20
- import { ScreenReaderContent as nr } from "@instructure/ui-a11y-content";
21
- import { Checkbox as lr } from "@instructure/ui-checkbox";
22
- import { Pill as Ce } from "@instructure/ui-pill";
23
- import { TextArea as or } from "@instructure/ui-text-area";
24
- import { TextInput as Q } from "@instructure/ui-text-input";
25
- import { NumberInput as sr } from "@instructure/ui-number-input";
26
- import { RadioInputGroup as dr, RadioInput as cr } from "@instructure/ui-radio-input";
27
- const Qr = () => /* @__PURE__ */ e(h, { as: "div", padding: "small", children: /* @__PURE__ */ e(A, { level: "h2", children: De("foundation") }) }), ur = Ze`
8
+ import { Button as N, CloseButton as Ae, IconButton as X } from "@instructure/ui-buttons";
9
+ import { Flex as C } from "@instructure/ui-flex";
10
+ import { SimpleSelect as J } from "@instructure/ui-simple-select";
11
+ import { Spinner as Oe } from "@instructure/ui-spinner";
12
+ import { Text as D } from "@instructure/ui-text";
13
+ import { useQuery as Ne } from "@tanstack/react-query";
14
+ import { u as Me, T as le, t as oe, i as se, a as L, p as _e, b as de, c as te, C as ce, d as ne, e as He, f as ue, g as Y, s as me, K as be, P as ge, r as Ue, D as he, S as pe, v as fe, h as qe, j as Fe, k as ze, l as Ge, m as We, n as $e, o as je, w as ae, q as Ke, x as Qe, y as Ve, z as Xe, A as Ye, B as Je, E as Ze, F as er } from "./chunks/ErrorShip-DEitKD2c.js";
15
+ import rr from "graphql-tag";
16
+ import { LoadingIndicator as ir } from "@instructure/platform-loading-indicator";
17
+ import { Alert as tr } from "@instructure/ui-alerts";
18
+ import { IconDragHandleLine as Ce, IconTrashLine as ve, IconAddLine as Re, IconArrowOpenDownLine as nr, IconArrowOpenEndLine as ar, IconCommentLine as lr, IconDuplicateLine as or } from "@instructure/ui-icons";
19
+ import { Modal as Q } from "@instructure/ui-modal";
20
+ import { ScreenReaderContent as sr } from "@instructure/ui-a11y-content";
21
+ import { Checkbox as dr } from "@instructure/ui-checkbox";
22
+ import { Pill as Be } from "@instructure/ui-pill";
23
+ import { TextArea as cr } from "@instructure/ui-text-area";
24
+ import { TextInput as z } from "@instructure/ui-text-input";
25
+ import { NumberInput as ur } from "@instructure/ui-number-input";
26
+ import { RadioInputGroup as mr, RadioInput as br } from "@instructure/ui-radio-input";
27
+ const Jr = () => /* @__PURE__ */ e(h, { as: "div", padding: "small", children: /* @__PURE__ */ e(_, { level: "h2", children: Le("foundation") }) }), gr = rr`
28
28
  query CourseRubricsList($courseId: ID!, $first: Int) {
29
29
  course(id: $courseId) {
30
30
  rubricsConnection(first: $first) {
@@ -42,400 +42,452 @@ const Qr = () => /* @__PURE__ */ e(h, { as: "div", padding: "small", children: /
42
42
  }
43
43
  }
44
44
  `;
45
- function mr(r) {
46
- const { executeQuery: n } = Ne();
47
- return Oe({
45
+ function hr(r) {
46
+ const { executeQuery: a } = Me();
47
+ return Ne({
48
48
  queryKey: ["courseRubrics", r],
49
49
  queryFn: async () => {
50
- var o;
51
- const { course: d } = await n(ur, {
50
+ var n;
51
+ const { course: s } = await a(gr, {
52
52
  courseId: r,
53
53
  first: 50
54
- }), i = d == null ? void 0 : d.rubricsConnection;
54
+ }), i = s == null ? void 0 : s.rubricsConnection;
55
55
  return {
56
56
  rubrics: ((i == null ? void 0 : i.nodes) ?? []).filter(
57
57
  (t) => t != null
58
58
  ),
59
- hasMore: ((o = i == null ? void 0 : i.pageInfo) == null ? void 0 : o.hasNextPage) ?? !1
59
+ hasMore: ((n = i == null ? void 0 : i.pageInfo) == null ? void 0 : n.hasNextPage) ?? !1
60
60
  };
61
61
  },
62
62
  enabled: !!r
63
63
  });
64
64
  }
65
- const Vr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, children: /* @__PURE__ */ e(br, { ...r }) }), br = ({
65
+ const Zr = (r) => /* @__PURE__ */ e(le, { translations: se, translate: oe, children: /* @__PURE__ */ e(pr, { ...r }) }), pr = ({
66
66
  courseId: r,
67
- value: n,
68
- onChange: d
67
+ value: a,
68
+ onChange: s
69
69
  }) => {
70
- const { translations: i } = D(), { data: o, isLoading: t, isError: a, refetch: s } = mr(r), m = o == null ? void 0 : o.rubrics;
70
+ const { translations: i } = L(), { data: n, isLoading: t, isError: l, refetch: o } = hr(r), u = n == null ? void 0 : n.rubrics;
71
71
  return t ? /* @__PURE__ */ c(h, { as: "div", role: "status", "aria-live": "polite", margin: "0 0 medium", children: [
72
- /* @__PURE__ */ e(Ae, { renderTitle: i.rubricSelectorLoading, size: "x-small" }),
73
- /* @__PURE__ */ e(h, { as: "span", padding: "0 0 0 x-small", children: /* @__PURE__ */ e(I, { size: "small", children: i.rubricSelectorLoading }) })
74
- ] }) : a ? /* @__PURE__ */ e(h, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ c(p, { gap: "small", alignItems: "center", wrap: "wrap", children: [
75
- /* @__PURE__ */ e(p.Item, { children: /* @__PURE__ */ c(I, { size: "small", color: "danger", children: [
72
+ /* @__PURE__ */ e(Oe, { renderTitle: i.rubricSelectorLoading, size: "x-small" }),
73
+ /* @__PURE__ */ e(h, { as: "span", padding: "0 0 0 x-small", children: /* @__PURE__ */ e(D, { size: "small", children: i.rubricSelectorLoading }) })
74
+ ] }) : l ? /* @__PURE__ */ e(h, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ c(C, { gap: "small", alignItems: "center", wrap: "wrap", children: [
75
+ /* @__PURE__ */ e(C.Item, { children: /* @__PURE__ */ c(D, { size: "small", color: "danger", children: [
76
76
  i.rubricSelectorErrorTitle,
77
77
  ". ",
78
78
  i.rubricSelectorErrorBody
79
79
  ] }) }),
80
- /* @__PURE__ */ e(p.Item, { children: /* @__PURE__ */ e(x, { size: "small", onClick: () => s(), children: i.rubricSelectorRetry }) })
81
- ] }) }) : !m || m.length === 0 ? /* @__PURE__ */ e(h, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ e(I, { size: "small", children: i.rubricSelectorEmpty }) }) : /* @__PURE__ */ c(h, { as: "div", margin: "0 0 medium", maxWidth: "360px", children: [
80
+ /* @__PURE__ */ e(C.Item, { children: /* @__PURE__ */ e(N, { size: "small", onClick: () => o(), children: i.rubricSelectorRetry }) })
81
+ ] }) }) : !u || u.length === 0 ? /* @__PURE__ */ e(h, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ e(D, { size: "small", children: i.rubricSelectorEmpty }) }) : /* @__PURE__ */ c(h, { as: "div", margin: "0 0 medium", maxWidth: "360px", children: [
82
82
  /* @__PURE__ */ c(
83
- V,
83
+ J,
84
84
  {
85
85
  renderLabel: i.rubricSelectorLabel,
86
86
  assistiveText: i.rubricSelectorAssistiveText,
87
- value: n ?? "",
88
- onChange: (l, { value: u }) => {
89
- if (typeof u != "string" || !u) return;
90
- const g = m.find((f) => f.id === u);
91
- d(u, (g == null ? void 0 : g.title) ?? "");
87
+ value: a ?? "",
88
+ onChange: (b, { value: p }) => {
89
+ if (typeof p != "string" || !p) return;
90
+ const g = u.find((d) => d.id === p);
91
+ s(p, (g == null ? void 0 : g.title) ?? "");
92
92
  },
93
93
  children: [
94
- n === void 0 && /* @__PURE__ */ e(V.Option, { id: "rubrics-rubric-selector-placeholder", value: "", children: i.rubricSelectorPlaceholder }),
95
- m.map((l) => /* @__PURE__ */ e(
96
- V.Option,
94
+ a === void 0 && /* @__PURE__ */ e(J.Option, { id: "rubrics-rubric-selector-placeholder", value: "", children: i.rubricSelectorPlaceholder }),
95
+ u.map((b) => /* @__PURE__ */ e(
96
+ J.Option,
97
97
  {
98
- id: `rubrics-rubric-selector-option-${l.id}`,
99
- value: l.id,
100
- children: l.title || i.rubricSelectorUntitled
98
+ id: `rubrics-rubric-selector-option-${b.id}`,
99
+ value: b.id,
100
+ children: b.title || i.rubricSelectorUntitled
101
101
  },
102
- l.id
102
+ b.id
103
103
  ))
104
104
  ]
105
105
  }
106
106
  ),
107
- (o == null ? void 0 : o.hasMore) && /* @__PURE__ */ e(h, { as: "div", padding: "xx-small 0 0", children: /* @__PURE__ */ e(I, { size: "x-small", color: "secondary", children: i.rubricSelectorTruncated }) })
107
+ (n == null ? void 0 : n.hasMore) && /* @__PURE__ */ e(h, { as: "div", padding: "xx-small 0 0", children: /* @__PURE__ */ e(D, { size: "x-small", color: "secondary", children: i.rubricSelectorTruncated }) })
108
108
  ] });
109
- }, Y = ({
109
+ }, ee = ({
110
110
  isOpen: r,
111
- heading: n,
112
- body: d,
111
+ heading: a,
112
+ body: s,
113
113
  confirmLabel: i,
114
- cancelLabel: o,
114
+ cancelLabel: n,
115
115
  onConfirm: t,
116
- onDismiss: a,
117
- "data-testid": s
116
+ onDismiss: l,
117
+ "data-testid": o
118
118
  }) => {
119
- const { translations: m } = D();
120
- return /* @__PURE__ */ c(G, { open: r, onDismiss: a, size: "small", label: n, "data-testid": s, children: [
121
- /* @__PURE__ */ c(G.Header, { children: [
119
+ const { translations: u } = L();
120
+ return /* @__PURE__ */ c(Q, { open: r, onDismiss: l, size: "small", label: a, "data-testid": o, children: [
121
+ /* @__PURE__ */ c(Q.Header, { children: [
122
122
  /* @__PURE__ */ e(
123
- Pe,
123
+ Ae,
124
124
  {
125
125
  placement: "end",
126
126
  offset: "small",
127
- onClick: a,
128
- screenReaderLabel: m.close
127
+ onClick: l,
128
+ screenReaderLabel: u.close
129
129
  }
130
130
  ),
131
- /* @__PURE__ */ e(A, { level: "h2", children: n })
131
+ /* @__PURE__ */ e(_, { level: "h2", children: a })
132
132
  ] }),
133
- /* @__PURE__ */ e(G.Body, { children: /* @__PURE__ */ e(I, { children: d }) }),
134
- /* @__PURE__ */ c(G.Footer, { children: [
135
- /* @__PURE__ */ e(x, { onClick: a, margin: "0 x-small 0 0", children: o }),
136
- /* @__PURE__ */ e(x, { color: "primary", onClick: t, "data-testid": "confirm-modal-confirm", children: i })
133
+ /* @__PURE__ */ e(Q.Body, { children: /* @__PURE__ */ e(D, { children: s }) }),
134
+ /* @__PURE__ */ c(Q.Footer, { children: [
135
+ /* @__PURE__ */ e(N, { onClick: l, margin: "0 x-small 0 0", children: n }),
136
+ /* @__PURE__ */ e(N, { color: "primary", onClick: t, "data-testid": "confirm-modal-confirm", children: i })
137
137
  ] })
138
138
  ] });
139
- }, gr = ({
139
+ }, fr = ({
140
140
  criteriaCount: r,
141
- showMissingCriteriaError: n,
142
- actions: d,
141
+ showMissingCriteriaError: a,
142
+ actions: s,
143
143
  children: i
144
144
  }) => {
145
- const { translations: o } = D();
145
+ const { translations: n } = L();
146
146
  return /* @__PURE__ */ c(h, { as: "section", "aria-labelledby": "rubric-builder-criteria-heading", children: [
147
- /* @__PURE__ */ c(p, { justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
148
- /* @__PURE__ */ e(A, { level: "h3", id: "rubric-builder-criteria-heading", children: o.rubricBuilderCriteriaHeading }),
149
- d && /* @__PURE__ */ e(p, { gap: "small", wrap: "wrap", children: d })
147
+ /* @__PURE__ */ c(C, { justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
148
+ /* @__PURE__ */ e(_, { level: "h3", id: "rubric-builder-criteria-heading", children: n.rubricBuilderCriteriaHeading }),
149
+ s && /* @__PURE__ */ e(C, { gap: "small", wrap: "wrap", children: s })
150
150
  ] }),
151
- /* @__PURE__ */ e(h, { as: "div", margin: "small 0 0", children: r === 0 ? /* @__PURE__ */ e(I, { color: "secondary", children: o.rubricBuilderCriteriaEmpty }) : i }),
152
- /* @__PURE__ */ e("div", { "aria-live": "polite", children: n && r === 0 && /* @__PURE__ */ e(I, { color: "danger", "data-testid": "rubric-builder-criteria-error", children: o.rubricBuilderAddCriterionError }) })
151
+ /* @__PURE__ */ e(h, { as: "div", margin: "small 0 0", children: r === 0 ? /* @__PURE__ */ e(D, { color: "secondary", children: n.rubricBuilderCriteriaEmpty }) : i }),
152
+ /* @__PURE__ */ e("div", { "aria-live": "polite", children: a && r === 0 && /* @__PURE__ */ e(D, { color: "danger", "data-testid": "rubric-builder-criteria-error", children: n.rubricBuilderAddCriterionError }) })
153
153
  ] });
154
- }, hr = ({
154
+ }, Cr = ({ points: r, onCommit: a }) => {
155
+ const { translations: s } = L(), [i, n] = x(String(r));
156
+ return F(() => {
157
+ n(String(r));
158
+ }, [r]), /* @__PURE__ */ e(
159
+ z,
160
+ {
161
+ renderLabel: s.rubricBuilderPointsPossibleLabel,
162
+ width: "8rem",
163
+ value: i,
164
+ onChange: (t) => n(t.target.value),
165
+ onBlur: (t) => {
166
+ const l = _e(t.target.value);
167
+ n(String(l)), l !== r && a(l);
168
+ },
169
+ "data-testid": "rubric-builder-points-possible"
170
+ }
171
+ );
172
+ }, vr = ({
155
173
  rating: r,
156
- sortableId: n,
157
- position: d,
174
+ sortableId: a,
175
+ position: s,
158
176
  rangeStart: i,
159
- useRange: o,
160
- showNameError: t,
161
- canRemove: a,
162
- onChange: s,
163
- onPointsBlur: m,
164
- onRemove: l
177
+ useRange: n,
178
+ hidePoints: t,
179
+ showNameError: l,
180
+ canRemove: o,
181
+ onChange: u,
182
+ onPointsBlur: b,
183
+ onRemove: p
165
184
  }) => {
166
- const { translations: u, translate: g } = D(), { attributes: f, listeners: S, setNodeRef: L, transform: P, transition: B } = le({
167
- id: n
168
- }), [v, T] = k(String(r.points));
169
- $(() => {
170
- re(v) !== r.points && T(String(r.points));
185
+ const { translations: g, translate: d } = L(), { attributes: v, listeners: y, setNodeRef: f, transform: I, transition: k } = de({
186
+ id: a
187
+ }), [T, S] = x(String(r.points));
188
+ F(() => {
189
+ te(T) !== r.points && S(String(r.points));
171
190
  }, [r.points]);
172
- const E = (C, R) => {
173
- T(R), s({ ...r, points: C });
191
+ const B = (R, P) => {
192
+ S(P), u({ ...r, points: R });
174
193
  };
175
194
  return /* @__PURE__ */ e(
176
195
  "div",
177
196
  {
178
- ref: L,
179
- style: { transform: oe.Transform.toString(P), transition: B },
197
+ ref: f,
198
+ style: { transform: ce.Transform.toString(I), transition: k },
180
199
  "data-testid": "rubric-builder-rating-row",
181
- children: /* @__PURE__ */ c(p, { gap: "small", alignItems: "start", wrap: "wrap", margin: "0 0 small", children: [
200
+ children: /* @__PURE__ */ c(C, { gap: "small", alignItems: "start", wrap: "wrap", margin: "0 0 small", children: [
182
201
  /* @__PURE__ */ e(
183
202
  h,
184
203
  {
185
204
  as: "div",
186
205
  cursor: "grab",
187
206
  margin: "medium 0 0",
188
- "aria-label": g("rubricBuilderReorderRating", { position: d }),
189
- ...f,
190
- ...S,
191
- children: /* @__PURE__ */ e(he, { "aria-hidden": "true" })
207
+ "aria-label": d("rubricBuilderReorderRating", { position: s }),
208
+ ...v,
209
+ ...y,
210
+ children: /* @__PURE__ */ e(Ce, { "aria-hidden": "true" })
192
211
  }
193
212
  ),
194
- /* @__PURE__ */ e(h, { as: "div", minWidth: "1.5rem", margin: "medium 0 0", children: /* @__PURE__ */ e(I, { weight: "bold", "aria-hidden": "true", children: d }) }),
195
- /* @__PURE__ */ c(p, { gap: "x-small", alignItems: "end", children: [
196
- o && i !== void 0 && /* @__PURE__ */ e(h, { as: "div", margin: "0 0 x-small", children: /* @__PURE__ */ e(I, { children: g("rangeStartPrefix", { rangeStart: i }) }) }),
213
+ /* @__PURE__ */ e(h, { as: "div", minWidth: "1.5rem", margin: "medium 0 0", children: /* @__PURE__ */ e(D, { weight: "bold", "aria-hidden": "true", children: s }) }),
214
+ !t && /* @__PURE__ */ c(C, { gap: "x-small", alignItems: "end", children: [
215
+ n && i !== void 0 && /* @__PURE__ */ e(h, { as: "div", margin: "0 0 x-small", children: /* @__PURE__ */ e(D, { children: d("rangeStartPrefix", { rangeStart: i }) }) }),
197
216
  /* @__PURE__ */ e(
198
- sr,
217
+ ur,
199
218
  {
200
- renderLabel: o ? u.rubricBuilderPointRangeLabel : u.rubricBuilderPointsLabel,
219
+ renderLabel: n ? g.rubricBuilderPointRangeLabel : g.rubricBuilderPointsLabel,
201
220
  allowStringValue: !0,
202
221
  showArrows: !1,
203
222
  width: "6rem",
204
- value: v,
205
- onChange: (C, R) => {
206
- Me(R) && E(re(R), R);
223
+ value: T,
224
+ onChange: (R, P) => {
225
+ He(P) && B(te(P), P);
207
226
  },
208
227
  onIncrement: () => {
209
- const C = ie(Math.floor(r.points) + 1);
210
- E(C, String(C));
228
+ const R = ne(Math.floor(r.points) + 1);
229
+ B(R, String(R));
211
230
  },
212
231
  onDecrement: () => {
213
- const C = ie(Math.floor(r.points) - 1);
214
- E(C, String(C));
232
+ const R = ne(Math.floor(r.points) - 1);
233
+ B(R, String(R));
215
234
  },
216
- onBlur: m,
235
+ onBlur: b,
217
236
  "data-testid": "rubric-builder-rating-points"
218
237
  }
219
238
  )
220
239
  ] }),
221
- /* @__PURE__ */ e(p.Item, { shouldGrow: !0, shouldShrink: !0, size: "10rem", children: /* @__PURE__ */ e(
222
- Q,
240
+ /* @__PURE__ */ e(C.Item, { shouldGrow: !0, shouldShrink: !0, size: "10rem", children: /* @__PURE__ */ e(
241
+ z,
223
242
  {
224
- renderLabel: u.rubricBuilderRatingNameLabel,
243
+ renderLabel: g.rubricBuilderRatingNameLabel,
225
244
  isRequired: !0,
226
245
  value: r.description,
227
- onChange: (C) => s({ ...r, description: C.target.value }),
228
- messages: t ? [{ text: u.rubricBuilderRatingNameRequired, type: "error" }] : [],
246
+ onChange: (R) => u({ ...r, description: R.target.value }),
247
+ messages: l ? [{ text: g.rubricBuilderRatingNameRequired, type: "error" }] : [],
229
248
  "data-testid": "rubric-builder-rating-name"
230
249
  }
231
250
  ) }),
232
- /* @__PURE__ */ e(p.Item, { shouldGrow: !0, shouldShrink: !0, size: "14rem", children: /* @__PURE__ */ e(
233
- Q,
251
+ /* @__PURE__ */ e(C.Item, { shouldGrow: !0, shouldShrink: !0, size: "14rem", children: /* @__PURE__ */ e(
252
+ z,
234
253
  {
235
- renderLabel: u.rubricBuilderRatingDescriptionLabel,
254
+ renderLabel: g.rubricBuilderRatingDescriptionLabel,
236
255
  value: r.longDescription,
237
- onChange: (C) => s({ ...r, longDescription: C.target.value }),
256
+ onChange: (R) => u({ ...r, longDescription: R.target.value }),
238
257
  "data-testid": "rubric-builder-rating-description"
239
258
  }
240
259
  ) }),
241
- a && /* @__PURE__ */ e(h, { as: "div", margin: "medium 0 0", children: /* @__PURE__ */ e(
242
- j,
260
+ o && /* @__PURE__ */ e(h, { as: "div", margin: "medium 0 0", children: /* @__PURE__ */ e(
261
+ X,
243
262
  {
244
- screenReaderLabel: g("rubricBuilderRemoveRating", { position: d }),
263
+ screenReaderLabel: d("rubricBuilderRemoveRating", { position: s }),
245
264
  withBackground: !1,
246
265
  withBorder: !1,
247
- onClick: l,
266
+ onClick: p,
248
267
  "data-testid": "rubric-builder-remove-rating",
249
- children: /* @__PURE__ */ e(pe, {})
268
+ children: /* @__PURE__ */ e(ve, {})
250
269
  }
251
270
  ) })
252
271
  ] })
253
272
  }
254
273
  );
255
- }, pr = ({
274
+ }, Rr = ({
256
275
  ratings: r,
257
- useRange: n,
258
- ratingNamesRequired: d,
259
- onChange: i
276
+ useRange: a,
277
+ hidePoints: s,
278
+ ratingOrder: i,
279
+ ratingNamesRequired: n,
280
+ onChange: t
260
281
  }) => {
261
- const { translations: o } = D(), t = se(
262
- K(ue, { activationConstraint: { distance: 8 } }),
263
- K(ce, { coordinateGetter: de })
264
- ), a = r.map(He);
282
+ const { translations: l } = L(), o = ue(
283
+ Y(ge, { activationConstraint: { distance: 8 } }),
284
+ Y(be, { coordinateGetter: me })
285
+ ), u = r.map(Ue), b = i === "ascending", p = r.map((d, v) => b ? r.length - 1 - v : v);
265
286
  return /* @__PURE__ */ c(h, { as: "div", children: [
266
- /* @__PURE__ */ e(me, { sensors: t, onDragEnd: ({ active: m, over: l }) => {
267
- if (!l || m.id === l.id) return;
268
- const u = a.indexOf(String(m.id)), g = a.indexOf(String(l.id));
269
- u === -1 || g === -1 || i(Ge({ list: r, startIndex: u, endIndex: g }));
270
- }, children: /* @__PURE__ */ e(be, { items: a, strategy: ge, children: r.map((m, l) => /* @__PURE__ */ e(
271
- hr,
287
+ /* @__PURE__ */ e(he, { sensors: o, onDragEnd: ({ active: d, over: v }) => {
288
+ if (!v || d.id === v.id) return;
289
+ const y = u.indexOf(String(d.id)), f = u.indexOf(String(v.id));
290
+ y === -1 || f === -1 || t($e({ list: r, startIndex: y, endIndex: f }));
291
+ }, children: /* @__PURE__ */ e(
292
+ pe,
272
293
  {
273
- rating: m,
274
- sortableId: a[l],
275
- position: l + 1,
276
- rangeStart: Ue(r, l),
277
- useRange: n,
278
- showNameError: d.includes(l),
279
- canRemove: r.length > 1,
280
- onChange: (u) => i(ze(r, l, u)),
281
- onPointsBlur: () => i(qe(r)),
282
- onRemove: () => i(_e(r, l))
283
- },
284
- a[l]
285
- )) }) }),
294
+ items: p.map((d) => u[d]),
295
+ strategy: fe,
296
+ children: p.map((d, v) => /* @__PURE__ */ e(
297
+ vr,
298
+ {
299
+ rating: r[d],
300
+ sortableId: u[d],
301
+ position: v + 1,
302
+ rangeStart: qe(r, d),
303
+ useRange: a,
304
+ hidePoints: s,
305
+ showNameError: n.includes(d),
306
+ canRemove: r.length > 1,
307
+ onChange: (y) => t(Ge(r, d, y)),
308
+ onPointsBlur: () => t(ze(r)),
309
+ onRemove: () => t(Fe(r, d))
310
+ },
311
+ u[d]
312
+ ))
313
+ }
314
+ ) }),
286
315
  /* @__PURE__ */ e(
287
- x,
316
+ N,
288
317
  {
289
- renderIcon: /* @__PURE__ */ e(fe, {}),
318
+ renderIcon: /* @__PURE__ */ e(Re, {}),
290
319
  withBackground: !1,
291
- onClick: () => i(Fe(r, r.length)),
320
+ onClick: () => t(We(r, b ? 0 : r.length)),
292
321
  "data-testid": "rubric-builder-add-rating",
293
- children: o.rubricBuilderAddRatingLevel
322
+ children: l.rubricBuilderAddRatingLevel
294
323
  }
295
324
  )
296
325
  ] });
297
- }, fr = ({
326
+ }, Br = ({
298
327
  criterion: r,
299
- sortableId: n,
300
- position: d,
301
- errors: i,
328
+ sortableId: a,
329
+ position: s,
330
+ hidePoints: i,
331
+ freeFormCriterionComments: n,
332
+ ratingOrder: t,
333
+ errors: l,
302
334
  showErrors: o,
303
- shouldFocusName: t,
304
- shouldFocusHandle: a,
305
- onNameFocused: s,
306
- onHandleFocused: m,
307
- onChange: l,
308
- onDuplicate: u,
309
- onDelete: g
335
+ shouldFocusName: u,
336
+ shouldFocusHandle: b,
337
+ onNameFocused: p,
338
+ onHandleFocused: g,
339
+ onChange: d,
340
+ onDuplicate: v,
341
+ onDelete: y
310
342
  }) => {
311
- const { translations: f, translate: S } = D(), { rubricCriterionRange: L } = we(), { attributes: P, listeners: B, setNodeRef: v, transform: T, transition: E, isDragging: C } = le({
312
- id: n
313
- }), [R, _] = k(!r.description.trim()), [O, N] = k(!1), q = X(null), M = X(null), H = o && We(i), z = S("rubricBuilderCriterionHeading", { position: d }), U = r.description.trim(), w = U || z, F = `rubric-builder-criterion-body-${n}`;
314
- return $(() => {
315
- H && _(!0);
316
- }, [H]), $(() => {
317
- var b;
318
- t && R && ((b = q.current) == null || b.focus(), s());
319
- }, [t, R, s]), $(() => {
320
- var b;
321
- a && ((b = M.current) == null || b.focus(), m());
322
- }, [a, m]), /* @__PURE__ */ c(
343
+ const { translations: f, translate: I } = L(), { rubricCriterionRange: k } = De(), { attributes: T, listeners: S, setNodeRef: B, transform: R, transition: P, isDragging: H } = de({
344
+ id: a
345
+ }), [E, G] = x(!r.description.trim()), [W, M] = x(!1), $ = Z(null), j = Z(null), U = o && je(l), K = I("rubricBuilderCriterionHeading", { position: s }), A = r.description.trim(), O = A || K, q = `rubric-builder-criterion-body-${a}`;
346
+ return F(() => {
347
+ U && G(!0);
348
+ }, [U]), F(() => {
349
+ var m;
350
+ u && E && ((m = $.current) == null || m.focus(), p());
351
+ }, [u, E, p]), F(() => {
352
+ var m;
353
+ b && ((m = j.current) == null || m.focus(), g());
354
+ }, [b, g]), /* @__PURE__ */ c(
323
355
  "div",
324
356
  {
325
- ref: v,
326
- style: { transform: oe.Transform.toString(T), transition: E },
357
+ ref: B,
358
+ style: { transform: ce.Transform.toString(R), transition: P },
327
359
  "data-testid": "rubric-builder-criterion-card",
328
360
  children: [
329
361
  /* @__PURE__ */ c(
330
362
  h,
331
363
  {
332
364
  as: "section",
333
- "aria-label": w,
365
+ "aria-label": O,
334
366
  borderWidth: "small",
335
367
  borderRadius: "medium",
336
368
  padding: "small medium",
337
369
  margin: "0 0 small",
338
370
  background: "primary",
339
- shadow: C ? "above" : "none",
371
+ shadow: H ? "above" : "none",
340
372
  children: [
341
- /* @__PURE__ */ c(p, { gap: "small", alignItems: "center", wrap: "wrap", children: [
373
+ /* @__PURE__ */ c(C, { gap: "small", alignItems: "center", wrap: "wrap", children: [
342
374
  /* @__PURE__ */ e(
343
375
  "div",
344
376
  {
345
- ref: M,
346
- "aria-label": S("rubricBuilderReorderCriterion", { name: w }),
377
+ ref: j,
378
+ "aria-label": I("rubricBuilderReorderCriterion", { name: O }),
347
379
  "data-testid": "rubric-builder-criterion-drag-handle",
348
- ...P,
349
- ...B,
350
- children: /* @__PURE__ */ e(he, { "aria-hidden": "true" })
380
+ ...T,
381
+ ...S,
382
+ children: /* @__PURE__ */ e(Ce, { "aria-hidden": "true" })
351
383
  }
352
384
  ),
353
385
  /* @__PURE__ */ e(
354
- j,
386
+ X,
355
387
  {
356
- screenReaderLabel: S(
357
- R ? "rubricBuilderCollapseCriterion" : "rubricBuilderExpandCriterion",
358
- { name: w }
388
+ screenReaderLabel: I(
389
+ E ? "rubricBuilderCollapseCriterion" : "rubricBuilderExpandCriterion",
390
+ { name: O }
359
391
  ),
360
- "aria-expanded": R,
361
- "aria-controls": F,
392
+ "aria-expanded": E,
393
+ "aria-controls": q,
362
394
  withBackground: !1,
363
395
  withBorder: !1,
364
396
  size: "small",
365
- onClick: () => _((b) => !b),
397
+ onClick: () => G((m) => !m),
366
398
  "data-testid": "rubric-builder-criterion-toggle",
367
- children: R ? /* @__PURE__ */ e(ir, {}) : /* @__PURE__ */ e(tr, {})
399
+ children: E ? /* @__PURE__ */ e(nr, {}) : /* @__PURE__ */ e(ar, {})
368
400
  }
369
401
  ),
370
- /* @__PURE__ */ e(p.Item, { shouldGrow: !0, shouldShrink: !0, children: /* @__PURE__ */ c(A, { level: "h4", children: [
371
- z,
372
- U && /* @__PURE__ */ e(I, { weight: "normal", "data-testid": "rubric-builder-criterion-name", children: `: ${U}` })
402
+ n && /* @__PURE__ */ e(
403
+ lr,
404
+ {
405
+ title: f.rubricBuilderWrittenFeedback,
406
+ "data-testid": "rubric-builder-criterion-written-icon"
407
+ }
408
+ ),
409
+ /* @__PURE__ */ e(C.Item, { shouldGrow: !0, shouldShrink: !0, children: /* @__PURE__ */ c(_, { level: "h4", children: [
410
+ K,
411
+ A && /* @__PURE__ */ e(D, { weight: "normal", "data-testid": "rubric-builder-criterion-name", children: `: ${A}` })
373
412
  ] }) }),
374
- /* @__PURE__ */ e(Ce, { "data-testid": "rubric-builder-criterion-max", children: S("rubricBuilderCriterionMaxPoints", { count: r.points }) }),
413
+ !i && /* @__PURE__ */ e(Be, { "data-testid": "rubric-builder-criterion-max", children: I("rubricBuilderCriterionMaxPoints", { count: r.points }) }),
375
414
  /* @__PURE__ */ e(
376
- j,
415
+ X,
377
416
  {
378
- screenReaderLabel: S("rubricBuilderDuplicateCriterion", { name: w }),
417
+ screenReaderLabel: I("rubricBuilderDuplicateCriterion", { name: O }),
379
418
  withBackground: !1,
380
419
  withBorder: !1,
381
- onClick: u,
420
+ onClick: v,
382
421
  "data-testid": "rubric-builder-duplicate-criterion",
383
- children: /* @__PURE__ */ e(ar, {})
422
+ children: /* @__PURE__ */ e(or, {})
384
423
  }
385
424
  ),
386
425
  /* @__PURE__ */ e(
387
- j,
426
+ X,
388
427
  {
389
- screenReaderLabel: S("rubricBuilderDeleteCriterion", { name: w }),
428
+ screenReaderLabel: I("rubricBuilderDeleteCriterion", { name: O }),
390
429
  withBackground: !1,
391
430
  withBorder: !1,
392
- onClick: () => N(!0),
431
+ onClick: () => M(!0),
393
432
  "data-testid": "rubric-builder-delete-criterion",
394
- children: /* @__PURE__ */ e(pe, {})
433
+ children: /* @__PURE__ */ e(ve, {})
395
434
  }
396
435
  )
397
436
  ] }),
398
- R && /* @__PURE__ */ e(h, { as: "div", id: F, margin: "medium 0 0", children: /* @__PURE__ */ c(p, { direction: "column", gap: "medium", children: [
437
+ E && /* @__PURE__ */ e(h, { as: "div", id: q, margin: "medium 0 0", children: /* @__PURE__ */ c(C, { direction: "column", gap: "medium", children: [
399
438
  /* @__PURE__ */ e(
400
- Q,
439
+ z,
401
440
  {
402
441
  renderLabel: f.rubricBuilderCriterionNameLabel,
403
442
  isRequired: !0,
404
443
  value: r.description,
405
- inputRef: (b) => {
406
- q.current = b;
444
+ inputRef: (m) => {
445
+ $.current = m;
407
446
  },
408
- onChange: (b) => l({ ...r, description: b.target.value }),
409
- messages: o && i.nameRequired ? [{ text: f.rubricBuilderCriterionNameRequired, type: "error" }] : [],
447
+ onChange: (m) => d({ ...r, description: m.target.value }),
448
+ messages: o && l.nameRequired ? [{ text: f.rubricBuilderCriterionNameRequired, type: "error" }] : [],
410
449
  "data-testid": "rubric-builder-criterion-name-input"
411
450
  }
412
451
  ),
413
452
  /* @__PURE__ */ e(
414
- or,
453
+ cr,
415
454
  {
416
455
  label: f.rubricBuilderCriterionDescriptionLabel,
417
456
  value: r.longDescription ?? "",
418
- onChange: (b) => l({ ...r, longDescription: b.target.value }),
457
+ onChange: (m) => d({ ...r, longDescription: m.target.value }),
419
458
  "data-testid": "rubric-builder-criterion-description"
420
459
  }
421
460
  ),
422
- L && /* @__PURE__ */ e(
423
- lr,
461
+ k && !i && !n && /* @__PURE__ */ e(
462
+ dr,
424
463
  {
425
464
  variant: "toggle",
426
465
  label: f.rubricBuilderEnableRange,
427
466
  checked: r.criterionUseRange,
428
- onChange: (b) => l({ ...r, criterionUseRange: b.target.checked }),
467
+ onChange: (m) => d({ ...r, criterionUseRange: m.target.checked }),
429
468
  "data-testid": "rubric-builder-enable-range"
430
469
  }
431
470
  ),
432
- /* @__PURE__ */ e(
433
- pr,
471
+ n ? !i && /* @__PURE__ */ e(
472
+ Cr,
473
+ {
474
+ points: r.points,
475
+ onCommit: (m) => d(
476
+ ae(
477
+ r,
478
+ Ke(r.ratings, m)
479
+ )
480
+ )
481
+ }
482
+ ) : /* @__PURE__ */ e(
483
+ Rr,
434
484
  {
435
485
  ratings: r.ratings,
436
- useRange: r.criterionUseRange,
437
- ratingNamesRequired: o ? i.ratingNamesRequired : [],
438
- onChange: (b) => l($e(r, b))
486
+ useRange: r.criterionUseRange && !i,
487
+ hidePoints: i,
488
+ ratingOrder: t,
489
+ ratingNamesRequired: o ? l.ratingNamesRequired : [],
490
+ onChange: (m) => d(ae(r, m))
439
491
  }
440
492
  )
441
493
  ] }) })
@@ -443,73 +495,79 @@ const Vr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, child
443
495
  }
444
496
  ),
445
497
  /* @__PURE__ */ e(
446
- Y,
498
+ ee,
447
499
  {
448
- isOpen: O,
500
+ isOpen: W,
449
501
  heading: f.rubricBuilderCriterionDeleteHeading,
450
502
  body: f.rubricBuilderCriterionDeleteBody,
451
503
  confirmLabel: f.delete,
452
504
  cancelLabel: f.cancel,
453
505
  onConfirm: () => {
454
- N(!1), g();
506
+ M(!1), y();
455
507
  },
456
- onDismiss: () => N(!1),
508
+ onDismiss: () => M(!1),
457
509
  "data-testid": "rubric-builder-delete-criterion-modal"
458
510
  }
459
511
  )
460
512
  ]
461
513
  }
462
514
  );
463
- }, Cr = ({
515
+ }, Sr = ({
464
516
  criteria: r,
517
+ hidePoints: a,
518
+ freeFormCriterionComments: s,
519
+ ratingOrder: i,
465
520
  criteriaValidationErrors: n,
466
- showErrors: d,
467
- focusNameCriterionId: i,
521
+ showErrors: t,
522
+ focusNameCriterionId: l,
468
523
  onFocusedName: o,
469
- onChangeCriterion: t,
470
- onDuplicateCriterion: a,
471
- onDeleteCriterion: s,
472
- onReorderCriteria: m
524
+ onChangeCriterion: u,
525
+ onDuplicateCriterion: b,
526
+ onDeleteCriterion: p,
527
+ onReorderCriteria: g
473
528
  }) => {
474
529
  const {
475
- sortableIds: l,
476
- movedCriterionId: u,
477
- clearMovedCriterion: g,
530
+ sortableIds: d,
531
+ movedCriterionId: v,
532
+ clearMovedCriterion: y,
478
533
  srAnnouncement: f,
479
- moveCriterionBySortableId: S
480
- } = je({ criteria: r, onReorderCriteria: m }), L = se(
481
- K(ue, { activationConstraint: { distance: 8 } }),
482
- K(ce, { coordinateGetter: de })
534
+ moveCriterionBySortableId: I
535
+ } = Qe({ criteria: r, onReorderCriteria: g }), k = ue(
536
+ Y(ge, { activationConstraint: { distance: 8 } }),
537
+ Y(be, { coordinateGetter: me })
483
538
  );
484
- return /* @__PURE__ */ c(xe, { children: [
485
- /* @__PURE__ */ e(nr, { children: /* @__PURE__ */ e("div", { "aria-live": "polite", "aria-atomic": "true", children: f }) }),
486
- /* @__PURE__ */ e(me, { sensors: L, onDragEnd: ({ active: B, over: v }) => {
487
- v && S(B.id, v.id);
488
- }, children: /* @__PURE__ */ e(be, { items: l, strategy: ge, children: r.map((B, v) => /* @__PURE__ */ e(
489
- fr,
539
+ return /* @__PURE__ */ c(ke, { children: [
540
+ /* @__PURE__ */ e(sr, { children: /* @__PURE__ */ e("div", { "aria-live": "polite", "aria-atomic": "true", children: f }) }),
541
+ /* @__PURE__ */ e(he, { sensors: k, onDragEnd: ({ active: S, over: B }) => {
542
+ B && I(S.id, B.id);
543
+ }, children: /* @__PURE__ */ e(pe, { items: d, strategy: fe, children: r.map((S, B) => /* @__PURE__ */ e(
544
+ Br,
490
545
  {
491
- criterion: B,
492
- sortableId: l[v],
493
- position: v + 1,
494
- errors: n[v],
495
- showErrors: d,
496
- shouldFocusName: B.id === i,
497
- shouldFocusHandle: B.id === u,
546
+ criterion: S,
547
+ sortableId: d[B],
548
+ position: B + 1,
549
+ hidePoints: a,
550
+ freeFormCriterionComments: s,
551
+ ratingOrder: i,
552
+ errors: n[B],
553
+ showErrors: t,
554
+ shouldFocusName: S.id === l,
555
+ shouldFocusHandle: S.id === v,
498
556
  onNameFocused: o,
499
- onHandleFocused: g,
500
- onChange: t,
501
- onDuplicate: () => a(B),
502
- onDelete: () => s(B)
557
+ onHandleFocused: y,
558
+ onChange: u,
559
+ onDuplicate: () => b(S),
560
+ onDelete: () => p(S)
503
561
  },
504
- l[v]
562
+ d[B]
505
563
  )) }) })
506
564
  ] });
507
- }, vr = ({
565
+ }, yr = ({
508
566
  savePending: r,
509
- onDiscard: n,
510
- onSave: d
567
+ onDiscard: a,
568
+ onSave: s
511
569
  }) => {
512
- const { translations: i } = D();
570
+ const { translations: i } = L();
513
571
  return /* @__PURE__ */ e(
514
572
  h,
515
573
  {
@@ -520,13 +578,13 @@ const Vr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, child
520
578
  borderWidth: "small none none none",
521
579
  padding: "small 0",
522
580
  stacking: "above",
523
- children: /* @__PURE__ */ c(p, { justifyItems: "end", gap: "small", wrap: "wrap", children: [
524
- /* @__PURE__ */ e(x, { onClick: n, "data-testid": "rubric-builder-discard", children: i.rubricBuilderDiscard }),
581
+ children: /* @__PURE__ */ c(C, { justifyItems: "end", gap: "small", wrap: "wrap", children: [
582
+ /* @__PURE__ */ e(N, { onClick: a, "data-testid": "rubric-builder-discard", children: i.rubricBuilderDiscard }),
525
583
  /* @__PURE__ */ e(
526
- x,
584
+ N,
527
585
  {
528
586
  color: "primary",
529
- onClick: d,
587
+ onClick: s,
530
588
  interaction: r ? "disabled" : "enabled",
531
589
  "data-testid": "rubric-builder-save",
532
590
  children: i.rubricBuilderSave
@@ -535,36 +593,40 @@ const Vr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, child
535
593
  ] })
536
594
  }
537
595
  );
538
- }, Rr = ({ isNewRubric: r, pointsPossible: n }) => {
539
- const { translations: d, translate: i } = D();
540
- return /* @__PURE__ */ c(p, { as: "header", justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
541
- /* @__PURE__ */ e(A, { level: "h2", children: r ? d.rubricBuilderCreateTitle : d.rubricBuilderEditTitle }),
542
- /* @__PURE__ */ e(Ce, { "data-testid": "rubric-builder-current-total", children: i("rubricBuilderCurrentTotal", { count: n }) })
596
+ }, Ir = ({
597
+ isNewRubric: r,
598
+ pointsPossible: a,
599
+ hidePoints: s
600
+ }) => {
601
+ const { translations: i, translate: n } = L();
602
+ return /* @__PURE__ */ c(C, { as: "header", justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
603
+ /* @__PURE__ */ e(_, { level: "h2", children: r ? i.rubricBuilderCreateTitle : i.rubricBuilderEditTitle }),
604
+ !s && /* @__PURE__ */ e(Be, { "data-testid": "rubric-builder-current-total", children: n("rubricBuilderCurrentTotal", { count: a }) })
543
605
  ] });
544
- }, W = ({ name: r, label: n, value: d, options: i, onChange: o }) => /* @__PURE__ */ e(
545
- dr,
606
+ }, V = ({ name: r, label: a, value: s, options: i, onChange: n }) => /* @__PURE__ */ e(
607
+ mr,
546
608
  {
547
609
  name: r,
548
- description: n,
610
+ description: a,
549
611
  variant: "toggle",
550
612
  layout: "columns",
551
- value: d,
552
- onChange: (t, a) => o(a),
553
- children: i.map((t) => /* @__PURE__ */ e(cr, { value: t.value, label: t.label }, t.value))
613
+ value: s,
614
+ onChange: (t, l) => n(l),
615
+ children: i.map((t) => /* @__PURE__ */ e(br, { value: t.value, label: t.label }, t.value))
554
616
  }
555
- ), Br = ({
617
+ ), wr = ({
556
618
  rubricForm: r,
557
- setRubricFormField: n,
558
- validateTitle: d,
619
+ setRubricFormField: a,
620
+ validateTitle: s,
559
621
  titleError: i,
560
- titleInputRef: o
622
+ titleInputRef: n
561
623
  }) => {
562
- const { translations: t } = D(), a = (s) => {
563
- if (s === "unscored" === r.hidePoints) return;
564
- const { hidePoints: m, hideScoreTotal: l, useForGrading: u, buttonDisplay: g } = Ke(
624
+ const { translations: t } = L(), l = (o) => {
625
+ if (o === "unscored" === r.hidePoints) return;
626
+ const { hidePoints: u, hideScoreTotal: b, useForGrading: p, buttonDisplay: g } = Ve(
565
627
  r.hidePoints
566
628
  );
567
- n("hidePoints", m), n("hideScoreTotal", l), n("useForGrading", u), g && n("buttonDisplay", g);
629
+ a("hidePoints", u), a("hideScoreTotal", b), a("useForGrading", p), g && a("buttonDisplay", g);
568
630
  };
569
631
  return /* @__PURE__ */ c(
570
632
  h,
@@ -575,24 +637,24 @@ const Vr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, child
575
637
  borderRadius: "medium",
576
638
  padding: "medium",
577
639
  children: [
578
- /* @__PURE__ */ e(A, { level: "h3", id: "rubric-builder-details-heading", margin: "0 0 medium", children: t.rubricBuilderDetailsHeading }),
579
- /* @__PURE__ */ c(p, { direction: "column", gap: "medium", children: [
640
+ /* @__PURE__ */ e(_, { level: "h3", id: "rubric-builder-details-heading", margin: "0 0 medium", children: t.rubricBuilderDetailsHeading }),
641
+ /* @__PURE__ */ c(C, { direction: "column", gap: "medium", children: [
580
642
  /* @__PURE__ */ e(
581
- Q,
643
+ z,
582
644
  {
583
645
  "data-testid": "rubric-builder-name",
584
646
  renderLabel: t.rubricBuilderNameLabel,
585
647
  isRequired: !0,
586
648
  value: r.title,
587
- inputRef: o,
588
- onChange: (s) => n("title", s.target.value),
589
- onBlur: (s) => d(s.target.value),
649
+ inputRef: n,
650
+ onChange: (o) => a("title", o.target.value),
651
+ onBlur: (o) => s(o.target.value),
590
652
  messages: i ? [{ text: i, type: "error" }] : []
591
653
  }
592
654
  ),
593
- /* @__PURE__ */ c(p, { gap: "medium", wrap: "wrap", children: [
655
+ /* @__PURE__ */ c(C, { gap: "medium", wrap: "wrap", children: [
594
656
  /* @__PURE__ */ e(
595
- W,
657
+ V,
596
658
  {
597
659
  name: "rubric-builder-scoring",
598
660
  label: t.scoringTypeSelectLabel,
@@ -601,11 +663,11 @@ const Vr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, child
601
663
  { value: "scored", label: t.scoringTypeScored },
602
664
  { value: "unscored", label: t.scoringTypeUnscored }
603
665
  ],
604
- onChange: a
666
+ onChange: l
605
667
  }
606
668
  ),
607
- /* @__PURE__ */ e(
608
- W,
669
+ !r.hidePoints && !r.freeFormCriterionComments && /* @__PURE__ */ e(
670
+ V,
609
671
  {
610
672
  name: "rubric-builder-display",
611
673
  label: t.rubricBuilderDisplayLabel,
@@ -614,11 +676,11 @@ const Vr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, child
614
676
  { value: "points", label: t.ratingDisplayPoints },
615
677
  { value: "numeric", label: t.ratingDisplayLevel }
616
678
  ],
617
- onChange: (s) => n("buttonDisplay", s)
679
+ onChange: (o) => a("buttonDisplay", o)
618
680
  }
619
681
  ),
620
682
  /* @__PURE__ */ e(
621
- W,
683
+ V,
622
684
  {
623
685
  name: "rubric-builder-feedback",
624
686
  label: t.rubricBuilderFeedbackLabel,
@@ -627,11 +689,11 @@ const Vr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, child
627
689
  { value: "scale", label: t.gradingTypeScale },
628
690
  { value: "freeForm", label: t.rubricBuilderFeedbackWrittenOnly }
629
691
  ],
630
- onChange: (s) => n("freeFormCriterionComments", s === "freeForm")
692
+ onChange: (o) => a("freeFormCriterionComments", o === "freeForm")
631
693
  }
632
694
  ),
633
- /* @__PURE__ */ e(
634
- W,
695
+ !r.freeFormCriterionComments && /* @__PURE__ */ e(
696
+ V,
635
697
  {
636
698
  name: "rubric-builder-rating-order",
637
699
  label: t.rubricBuilderRatingOrderLabel,
@@ -640,7 +702,7 @@ const Vr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, child
640
702
  { value: "ascending", label: t.rubricBuilderRatingOrderLowToHigh },
641
703
  { value: "descending", label: t.rubricBuilderRatingOrderHighToLow }
642
704
  ],
643
- onChange: (s) => n("ratingOrder", s)
705
+ onChange: (o) => a("ratingOrder", o)
644
706
  }
645
707
  )
646
708
  ] })
@@ -648,154 +710,164 @@ const Vr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, child
648
710
  ]
649
711
  }
650
712
  );
651
- }, Xr = (r) => /* @__PURE__ */ e(te, { translations: ne, translate: ae, children: /* @__PURE__ */ e(
652
- Le,
713
+ }, ei = (r) => /* @__PURE__ */ e(le, { translations: se, translate: oe, children: /* @__PURE__ */ e(
714
+ Pe,
653
715
  {
654
716
  courseId: r.courseId,
655
717
  accountId: r.accountId,
656
718
  featureFlags: r.featureFlags,
657
719
  aiLimits: r.aiLimits,
658
- children: /* @__PURE__ */ e(Sr, { ...r })
720
+ children: /* @__PURE__ */ e(Lr, { ...r })
659
721
  }
660
- ) }), Sr = ({
722
+ ) }), Lr = ({
661
723
  rubricId: r,
662
- accountId: n,
663
- courseId: d,
724
+ accountId: a,
725
+ courseId: s,
664
726
  canManageRubrics: i,
665
- onSaveRubric: o,
727
+ onSaveRubric: n,
666
728
  onDiscard: t
667
729
  }) => {
668
- var Z;
669
- const { translations: a } = D(), {
670
- rubricForm: s,
671
- setRubricFormField: m,
672
- validateField: l,
673
- validationErrors: u,
730
+ var re;
731
+ const { translations: l } = L(), {
732
+ rubricForm: o,
733
+ setRubricFormField: u,
734
+ validateField: b,
735
+ validationErrors: p,
674
736
  isNewRubric: g,
675
- load: { data: f, isLoading: S, isError: L, isSuccess: P },
676
- savePending: B,
677
- saveError: v,
737
+ load: { data: d, isLoading: v, isError: y, isSuccess: f },
738
+ savePending: I,
739
+ saveError: k,
678
740
  save: T,
679
- saveAction: E,
680
- isDirty: C,
741
+ saveAction: S,
742
+ isDirty: B,
681
743
  criteriaValid: R,
682
- criteriaValidationErrors: _,
683
- saveCriterion: O,
684
- deleteCriterion: N,
685
- reorderCriteria: q
686
- } = Qe({ rubricId: r, accountId: n, courseId: d, canManageRubrics: i, onSaveRubric: o }), M = X(null), [H, z] = k(!1), [U, w] = k(!1), [F, b] = k(!1), [ve, J] = k(), Re = Ve(), Be = ke(() => J(void 0), []);
687
- if (r && S)
688
- return /* @__PURE__ */ e(er, {});
689
- if (r && L)
744
+ criteriaValidationErrors: P,
745
+ saveCriterion: H,
746
+ deleteCriterion: E,
747
+ reorderCriteria: G
748
+ } = Xe({ rubricId: r, accountId: a, courseId: s, canManageRubrics: i, onSaveRubric: n }), W = Z(null), [M, $] = x(!1), [j, U] = x(!1), [K, A] = x(!1), [O, q] = x(), m = Ye(), Se = xe(() => q(void 0), []);
749
+ if (r && v)
750
+ return /* @__PURE__ */ e(ir, {});
751
+ if (r && y)
690
752
  return Te({
691
- errorImageUrl: Xe,
692
- errorCategory: a.rubricErrorPageCategory,
693
- translations: ee(a)
753
+ errorImageUrl: Je,
754
+ errorCategory: l.rubricErrorPageCategory,
755
+ translations: ie(l)
694
756
  });
695
- if (r && P && !f)
696
- return Ee({ translations: ee(a) });
697
- const Se = () => {
698
- var y;
699
- if (z(!0), !l("title", s.title)) {
700
- (y = M.current) == null || y.focus();
757
+ if (r && f && !d)
758
+ return Ee({ translations: ie(l) });
759
+ const ye = () => {
760
+ var w;
761
+ if ($(!0), !b("title", o.title)) {
762
+ (w = W.current) == null || w.focus();
701
763
  return;
702
764
  }
703
- s.criteria.length === 0 || !R || (E === "confirmSave" ? b(!0) : T());
704
- }, ye = () => {
705
- const y = Je(Re());
706
- O(y), J(y.id);
765
+ o.criteria.length === 0 || !R || (S === "confirmSave" ? A(!0) : T());
707
766
  }, Ie = () => {
708
- C ? w(!0) : t();
767
+ const w = er(m());
768
+ H(w), q(w.id);
769
+ }, we = () => {
770
+ B ? U(!0) : t();
709
771
  };
710
772
  return /* @__PURE__ */ c(h, { as: "div", "data-testid": "rubric-builder", children: [
711
- /* @__PURE__ */ c(p, { direction: "column", gap: "medium", padding: "medium 0", children: [
712
- /* @__PURE__ */ e(Rr, { isNewRubric: g, pointsPossible: s.pointsPossible }),
713
- v && /* @__PURE__ */ e(rr, { variant: "error", margin: "0", children: a.rubricFormSaveError }),
773
+ /* @__PURE__ */ c(C, { direction: "column", gap: "medium", padding: "medium 0", children: [
774
+ /* @__PURE__ */ e(
775
+ Ir,
776
+ {
777
+ isNewRubric: g,
778
+ pointsPossible: o.pointsPossible,
779
+ hidePoints: o.hidePoints
780
+ }
781
+ ),
782
+ k && /* @__PURE__ */ e(tr, { variant: "error", margin: "0", children: l.rubricFormSaveError }),
714
783
  /* @__PURE__ */ e(
715
- Br,
784
+ wr,
716
785
  {
717
- rubricForm: s,
718
- setRubricFormField: m,
719
- validateTitle: (y) => l("title", y),
720
- titleError: (Z = u.title) == null ? void 0 : Z.message,
721
- titleInputRef: (y) => {
722
- M.current = y;
786
+ rubricForm: o,
787
+ setRubricFormField: u,
788
+ validateTitle: (w) => b("title", w),
789
+ titleError: (re = p.title) == null ? void 0 : re.message,
790
+ titleInputRef: (w) => {
791
+ W.current = w;
723
792
  }
724
793
  }
725
794
  ),
726
795
  /* @__PURE__ */ e(
727
- gr,
796
+ fr,
728
797
  {
729
- criteriaCount: s.criteria.length,
730
- showMissingCriteriaError: H,
798
+ criteriaCount: o.criteria.length,
799
+ showMissingCriteriaError: M,
731
800
  actions: /* @__PURE__ */ e(
732
- x,
801
+ N,
733
802
  {
734
- renderIcon: /* @__PURE__ */ e(fe, {}),
735
- onClick: ye,
803
+ renderIcon: /* @__PURE__ */ e(Re, {}),
804
+ onClick: Ie,
736
805
  "data-testid": "rubric-builder-add-criterion",
737
- children: a.rubricBuilderAddCriterion
806
+ children: l.rubricBuilderAddCriterion
738
807
  }
739
808
  ),
740
809
  children: /* @__PURE__ */ e(
741
- Cr,
810
+ Sr,
742
811
  {
743
- criteria: s.criteria,
744
- criteriaValidationErrors: _,
745
- showErrors: H,
746
- focusNameCriterionId: ve,
747
- onFocusedName: Be,
748
- onChangeCriterion: O,
749
- onDuplicateCriterion: (y) => O(Ye(y)),
750
- onDeleteCriterion: N,
751
- onReorderCriteria: q
812
+ criteria: o.criteria,
813
+ hidePoints: o.hidePoints,
814
+ freeFormCriterionComments: o.freeFormCriterionComments,
815
+ ratingOrder: o.ratingOrder,
816
+ criteriaValidationErrors: P,
817
+ showErrors: M,
818
+ focusNameCriterionId: O,
819
+ onFocusedName: Se,
820
+ onChangeCriterion: H,
821
+ onDuplicateCriterion: (w) => H(Ze(w)),
822
+ onDeleteCriterion: E,
823
+ onReorderCriteria: G
752
824
  }
753
825
  )
754
826
  }
755
827
  )
756
828
  ] }),
757
829
  /* @__PURE__ */ e(
758
- vr,
830
+ yr,
759
831
  {
760
- savePending: B,
761
- onDiscard: Ie,
762
- onSave: Se
832
+ savePending: I,
833
+ onDiscard: we,
834
+ onSave: ye
763
835
  }
764
836
  ),
765
837
  /* @__PURE__ */ e(
766
- Y,
838
+ ee,
767
839
  {
768
- isOpen: U,
769
- heading: a.rubricBuilderDiscardHeading,
770
- body: a.rubricBuilderDiscardBody,
771
- confirmLabel: a.rubricBuilderDiscard,
772
- cancelLabel: a.rubricBuilderKeepEditing,
840
+ isOpen: j,
841
+ heading: l.rubricBuilderDiscardHeading,
842
+ body: l.rubricBuilderDiscardBody,
843
+ confirmLabel: l.rubricBuilderDiscard,
844
+ cancelLabel: l.rubricBuilderKeepEditing,
773
845
  onConfirm: t,
774
- onDismiss: () => w(!1),
846
+ onDismiss: () => U(!1),
775
847
  "data-testid": "rubric-builder-discard-modal"
776
848
  }
777
849
  ),
778
850
  /* @__PURE__ */ e(
779
- Y,
851
+ ee,
780
852
  {
781
- isOpen: F,
782
- heading: a.confirmToContinueHeader,
783
- body: a.gradingHistoryWarning,
784
- confirmLabel: a.saveConfirmModalSave,
785
- cancelLabel: a.cancel,
853
+ isOpen: K,
854
+ heading: l.confirmToContinueHeader,
855
+ body: l.gradingHistoryWarning,
856
+ confirmLabel: l.saveConfirmModalSave,
857
+ cancelLabel: l.cancel,
786
858
  onConfirm: () => {
787
- b(!1), T();
859
+ A(!1), T();
788
860
  },
789
- onDismiss: () => b(!1),
861
+ onDismiss: () => A(!1),
790
862
  "data-testid": "rubric-builder-save-confirm-modal"
791
863
  }
792
864
  )
793
865
  ] });
794
866
  };
795
867
  export {
796
- Zr as DEFAULT_AI_MAX_CRITERION_COUNT,
797
- ei as DEFAULT_AI_MAX_RATING_COUNT,
798
- Qr as HelloWorld,
799
- Xr as RubricBuilder,
800
- Vr as RubricSelector
868
+ ti as DEFAULT_AI_MAX_CRITERION_COUNT,
869
+ ni as DEFAULT_AI_MAX_RATING_COUNT,
870
+ Jr as HelloWorld,
871
+ ei as RubricBuilder,
872
+ Zr as RubricSelector
801
873
  };