analytica-frontend-lib 1.2.28 → 1.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActivityCardQuestionBanks/index.css +19293 -0
- package/dist/ActivityCardQuestionBanks/index.css.map +1 -0
- package/dist/ActivityCardQuestionBanks/index.d.ts +21 -0
- package/dist/ActivityCardQuestionBanks/index.d.ts.map +1 -0
- package/dist/ActivityCardQuestionBanks/index.js +1717 -0
- package/dist/ActivityCardQuestionBanks/index.js.map +1 -0
- package/dist/ActivityCardQuestionBanks/index.mjs +1701 -0
- package/dist/ActivityCardQuestionBanks/index.mjs.map +1 -0
- package/dist/ActivityDetails/index.js +33 -3
- package/dist/ActivityDetails/index.js.map +1 -1
- package/dist/ActivityDetails/index.mjs +33 -3
- package/dist/ActivityDetails/index.mjs.map +1 -1
- package/dist/ActivityFilters/index.js +33 -3
- package/dist/ActivityFilters/index.js.map +1 -1
- package/dist/ActivityFilters/index.mjs +33 -3
- package/dist/ActivityFilters/index.mjs.map +1 -1
- package/dist/AlertManager/index.js +33 -3
- package/dist/AlertManager/index.js.map +1 -1
- package/dist/AlertManager/index.mjs +33 -3
- package/dist/AlertManager/index.mjs.map +1 -1
- package/dist/TableProvider/index.js +33 -3
- package/dist/TableProvider/index.js.map +1 -1
- package/dist/TableProvider/index.mjs +33 -3
- package/dist/TableProvider/index.mjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +479 -267
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +434 -223
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,1717 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/ActivityCardQuestionBanks/ActivityCardQuestionBanks.tsx
|
|
31
|
+
var ActivityCardQuestionBanks_exports = {};
|
|
32
|
+
__export(ActivityCardQuestionBanks_exports, {
|
|
33
|
+
ActivityCardQuestionBanks: () => ActivityCardQuestionBanks
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(ActivityCardQuestionBanks_exports);
|
|
36
|
+
|
|
37
|
+
// src/utils/utils.ts
|
|
38
|
+
var import_clsx = require("clsx");
|
|
39
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
40
|
+
function cn(...inputs) {
|
|
41
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
42
|
+
}
|
|
43
|
+
function getSubjectColorWithOpacity(hexColor, isDark) {
|
|
44
|
+
if (!hexColor) return void 0;
|
|
45
|
+
let color = hexColor.replace(/^#/, "").toLowerCase();
|
|
46
|
+
if (isDark) {
|
|
47
|
+
if (color.length === 8) {
|
|
48
|
+
color = color.slice(0, 6);
|
|
49
|
+
}
|
|
50
|
+
return `#${color}`;
|
|
51
|
+
} else {
|
|
52
|
+
let resultColor;
|
|
53
|
+
if (color.length === 6) {
|
|
54
|
+
resultColor = `#${color}4d`;
|
|
55
|
+
} else if (color.length === 8) {
|
|
56
|
+
resultColor = `#${color}`;
|
|
57
|
+
} else {
|
|
58
|
+
resultColor = `#${color}`;
|
|
59
|
+
}
|
|
60
|
+
return resultColor;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/components/Text/Text.tsx
|
|
65
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
66
|
+
var Text = ({
|
|
67
|
+
children,
|
|
68
|
+
size = "md",
|
|
69
|
+
weight = "normal",
|
|
70
|
+
color = "text-text-950",
|
|
71
|
+
as,
|
|
72
|
+
className = "",
|
|
73
|
+
...props
|
|
74
|
+
}) => {
|
|
75
|
+
let sizeClasses = "";
|
|
76
|
+
let weightClasses = "";
|
|
77
|
+
const sizeClassMap = {
|
|
78
|
+
"2xs": "text-2xs",
|
|
79
|
+
xs: "text-xs",
|
|
80
|
+
sm: "text-sm",
|
|
81
|
+
md: "text-md",
|
|
82
|
+
lg: "text-lg",
|
|
83
|
+
xl: "text-xl",
|
|
84
|
+
"2xl": "text-2xl",
|
|
85
|
+
"3xl": "text-3xl",
|
|
86
|
+
"4xl": "text-4xl",
|
|
87
|
+
"5xl": "text-5xl",
|
|
88
|
+
"6xl": "text-6xl"
|
|
89
|
+
};
|
|
90
|
+
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
91
|
+
const weightClassMap = {
|
|
92
|
+
hairline: "font-hairline",
|
|
93
|
+
light: "font-light",
|
|
94
|
+
normal: "font-normal",
|
|
95
|
+
medium: "font-medium",
|
|
96
|
+
semibold: "font-semibold",
|
|
97
|
+
bold: "font-bold",
|
|
98
|
+
extrabold: "font-extrabold",
|
|
99
|
+
black: "font-black"
|
|
100
|
+
};
|
|
101
|
+
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
102
|
+
const baseClasses = "font-primary";
|
|
103
|
+
const Component = as ?? "p";
|
|
104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
|
+
Component,
|
|
106
|
+
{
|
|
107
|
+
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
108
|
+
...props,
|
|
109
|
+
children
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
var Text_default = Text;
|
|
114
|
+
|
|
115
|
+
// src/components/Button/Button.tsx
|
|
116
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
117
|
+
var VARIANT_ACTION_CLASSES = {
|
|
118
|
+
solid: {
|
|
119
|
+
primary: "bg-primary-950 text-text border border-primary-950 hover:bg-primary-800 hover:border-primary-800 focus-visible:outline-none focus-visible:bg-primary-950 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-primary-700 active:border-primary-700 disabled:bg-primary-500 disabled:border-primary-500 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
120
|
+
positive: "bg-success-500 text-text border border-success-500 hover:bg-success-600 hover:border-success-600 focus-visible:outline-none focus-visible:bg-success-500 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-success-700 active:border-success-700 disabled:bg-success-500 disabled:border-success-500 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
121
|
+
negative: "bg-error-500 text-text border border-error-500 hover:bg-error-600 hover:border-error-600 focus-visible:outline-none focus-visible:bg-error-500 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-error-700 active:border-error-700 disabled:bg-error-500 disabled:border-error-500 disabled:opacity-40 disabled:cursor-not-allowed"
|
|
122
|
+
},
|
|
123
|
+
outline: {
|
|
124
|
+
primary: "bg-transparent text-primary-950 border border-primary-950 hover:bg-background-50 hover:text-primary-400 hover:border-primary-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 active:border-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
125
|
+
positive: "bg-transparent text-success-500 border border-success-300 hover:bg-background-50 hover:text-success-400 hover:border-success-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-success-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-success-700 active:border-success-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
126
|
+
negative: "bg-transparent text-error-500 border border-error-300 hover:bg-background-50 hover:text-error-400 hover:border-error-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-error-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-error-700 active:border-error-700 disabled:opacity-40 disabled:cursor-not-allowed"
|
|
127
|
+
},
|
|
128
|
+
link: {
|
|
129
|
+
primary: "bg-transparent text-primary-950 hover:text-primary-400 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
130
|
+
positive: "bg-transparent text-success-500 hover:text-success-400 focus-visible:outline-none focus-visible:text-success-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-success-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
131
|
+
negative: "bg-transparent text-error-500 hover:text-error-400 focus-visible:outline-none focus-visible:text-error-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-error-700 disabled:opacity-40 disabled:cursor-not-allowed"
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
var SIZE_CLASSES = {
|
|
135
|
+
"extra-small": "text-xs px-3.5 py-2",
|
|
136
|
+
small: "text-sm px-4 py-2.5",
|
|
137
|
+
medium: "text-md px-5 py-2.5",
|
|
138
|
+
large: "text-lg px-6 py-3",
|
|
139
|
+
"extra-large": "text-lg px-7 py-3.5"
|
|
140
|
+
};
|
|
141
|
+
var Button = ({
|
|
142
|
+
children,
|
|
143
|
+
iconLeft,
|
|
144
|
+
iconRight,
|
|
145
|
+
size = "medium",
|
|
146
|
+
variant = "solid",
|
|
147
|
+
action = "primary",
|
|
148
|
+
className = "",
|
|
149
|
+
disabled,
|
|
150
|
+
type = "button",
|
|
151
|
+
...props
|
|
152
|
+
}) => {
|
|
153
|
+
const sizeClasses = SIZE_CLASSES[size];
|
|
154
|
+
const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
|
|
155
|
+
const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
|
|
156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
157
|
+
"button",
|
|
158
|
+
{
|
|
159
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
160
|
+
disabled,
|
|
161
|
+
type,
|
|
162
|
+
...props,
|
|
163
|
+
children: [
|
|
164
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mr-2 flex items-center", children: iconLeft }),
|
|
165
|
+
children,
|
|
166
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ml-2 flex items-center", children: iconRight })
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
var Button_default = Button;
|
|
172
|
+
|
|
173
|
+
// src/components/Badge/Badge.tsx
|
|
174
|
+
var import_phosphor_react = require("phosphor-react");
|
|
175
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
176
|
+
var VARIANT_ACTION_CLASSES2 = {
|
|
177
|
+
solid: {
|
|
178
|
+
error: "bg-error-background text-error-700 focus-visible:outline-none",
|
|
179
|
+
warning: "bg-warning text-warning-800 focus-visible:outline-none",
|
|
180
|
+
success: "bg-success text-success-800 focus-visible:outline-none",
|
|
181
|
+
info: "bg-info text-info-800 focus-visible:outline-none",
|
|
182
|
+
muted: "bg-background-muted text-background-800 focus-visible:outline-none"
|
|
183
|
+
},
|
|
184
|
+
outlined: {
|
|
185
|
+
error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
|
|
186
|
+
warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
|
|
187
|
+
success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
|
|
188
|
+
info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
|
|
189
|
+
muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
|
|
190
|
+
},
|
|
191
|
+
exams: {
|
|
192
|
+
exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
|
|
193
|
+
exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
|
|
194
|
+
exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
|
|
195
|
+
exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
|
|
196
|
+
},
|
|
197
|
+
examsOutlined: {
|
|
198
|
+
exam1: "bg-exam-1 text-info-700 border border-info-700 focus-visible:outline-none",
|
|
199
|
+
exam2: "bg-exam-2 text-typography-1 border border-typography-1 focus-visible:outline-none",
|
|
200
|
+
exam3: "bg-exam-3 text-typography-2 border border-typography-2 focus-visible:outline-none",
|
|
201
|
+
exam4: "bg-exam-4 text-success-700 border border-success-700 focus-visible:outline-none"
|
|
202
|
+
},
|
|
203
|
+
resultStatus: {
|
|
204
|
+
negative: "bg-error text-error-800 focus-visible:outline-none",
|
|
205
|
+
positive: "bg-success text-success-800 focus-visible:outline-none"
|
|
206
|
+
},
|
|
207
|
+
notification: "text-primary"
|
|
208
|
+
};
|
|
209
|
+
var SIZE_CLASSES2 = {
|
|
210
|
+
small: "text-2xs px-2 py-1",
|
|
211
|
+
medium: "text-xs px-2 py-1",
|
|
212
|
+
large: "text-sm px-2 py-1"
|
|
213
|
+
};
|
|
214
|
+
var SIZE_CLASSES_ICON = {
|
|
215
|
+
small: "size-3",
|
|
216
|
+
medium: "size-3.5",
|
|
217
|
+
large: "size-4"
|
|
218
|
+
};
|
|
219
|
+
var Badge = ({
|
|
220
|
+
children,
|
|
221
|
+
iconLeft,
|
|
222
|
+
iconRight,
|
|
223
|
+
size = "medium",
|
|
224
|
+
variant = "solid",
|
|
225
|
+
action = "error",
|
|
226
|
+
className = "",
|
|
227
|
+
notificationActive = false,
|
|
228
|
+
...props
|
|
229
|
+
}) => {
|
|
230
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
231
|
+
const sizeClassesIcon = SIZE_CLASSES_ICON[size];
|
|
232
|
+
const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
|
|
233
|
+
const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
|
|
234
|
+
const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
|
|
235
|
+
const baseClassesIcon = "flex items-center";
|
|
236
|
+
if (variant === "notification") {
|
|
237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
238
|
+
"div",
|
|
239
|
+
{
|
|
240
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
241
|
+
...props,
|
|
242
|
+
children: [
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
|
|
244
|
+
notificationActive && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
245
|
+
"span",
|
|
246
|
+
{
|
|
247
|
+
"data-testid": "notification-dot",
|
|
248
|
+
className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
259
|
+
...props,
|
|
260
|
+
children: [
|
|
261
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
|
|
262
|
+
children,
|
|
263
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
};
|
|
268
|
+
var Badge_default = Badge;
|
|
269
|
+
|
|
270
|
+
// src/components/CheckBox/CheckBox.tsx
|
|
271
|
+
var import_react = require("react");
|
|
272
|
+
var import_phosphor_react2 = require("phosphor-react");
|
|
273
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
274
|
+
var SIZE_CLASSES3 = {
|
|
275
|
+
small: {
|
|
276
|
+
checkbox: "w-4 h-4",
|
|
277
|
+
// 16px x 16px
|
|
278
|
+
textSize: "sm",
|
|
279
|
+
spacing: "gap-1.5",
|
|
280
|
+
// 6px
|
|
281
|
+
borderWidth: "border-2",
|
|
282
|
+
iconSize: 14,
|
|
283
|
+
// pixels for Phosphor icons
|
|
284
|
+
labelHeight: "h-[21px]"
|
|
285
|
+
},
|
|
286
|
+
medium: {
|
|
287
|
+
checkbox: "w-5 h-5",
|
|
288
|
+
// 20px x 20px
|
|
289
|
+
textSize: "md",
|
|
290
|
+
spacing: "gap-2",
|
|
291
|
+
// 8px
|
|
292
|
+
borderWidth: "border-2",
|
|
293
|
+
iconSize: 16,
|
|
294
|
+
// pixels for Phosphor icons
|
|
295
|
+
labelHeight: "h-6"
|
|
296
|
+
},
|
|
297
|
+
large: {
|
|
298
|
+
checkbox: "w-6 h-6",
|
|
299
|
+
// 24px x 24px
|
|
300
|
+
textSize: "lg",
|
|
301
|
+
spacing: "gap-2",
|
|
302
|
+
// 8px
|
|
303
|
+
borderWidth: "border-[3px]",
|
|
304
|
+
// 3px border
|
|
305
|
+
iconSize: 20,
|
|
306
|
+
// pixels for Phosphor icons
|
|
307
|
+
labelHeight: "h-[27px]"
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
311
|
+
var STATE_CLASSES = {
|
|
312
|
+
default: {
|
|
313
|
+
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
314
|
+
checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
|
|
315
|
+
},
|
|
316
|
+
hovered: {
|
|
317
|
+
unchecked: "border-border-500 bg-background",
|
|
318
|
+
checked: "border-primary-800 bg-primary-800 text-text"
|
|
319
|
+
},
|
|
320
|
+
focused: {
|
|
321
|
+
unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
|
|
322
|
+
checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
|
|
323
|
+
},
|
|
324
|
+
invalid: {
|
|
325
|
+
unchecked: "border-error-700 bg-background hover:border-error-600",
|
|
326
|
+
checked: "border-error-700 bg-primary-950 text-text"
|
|
327
|
+
},
|
|
328
|
+
disabled: {
|
|
329
|
+
unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
|
|
330
|
+
checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
var CheckBox = (0, import_react.forwardRef)(
|
|
334
|
+
({
|
|
335
|
+
label,
|
|
336
|
+
size = "medium",
|
|
337
|
+
state = "default",
|
|
338
|
+
indeterminate = false,
|
|
339
|
+
errorMessage,
|
|
340
|
+
helperText,
|
|
341
|
+
className = "",
|
|
342
|
+
labelClassName = "",
|
|
343
|
+
checked: checkedProp,
|
|
344
|
+
disabled,
|
|
345
|
+
id,
|
|
346
|
+
onChange,
|
|
347
|
+
...props
|
|
348
|
+
}, ref) => {
|
|
349
|
+
const generatedId = (0, import_react.useId)();
|
|
350
|
+
const inputId = id ?? `checkbox-${generatedId}`;
|
|
351
|
+
const [internalChecked, setInternalChecked] = (0, import_react.useState)(false);
|
|
352
|
+
const isControlled = checkedProp !== void 0;
|
|
353
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
354
|
+
const handleChange = (event) => {
|
|
355
|
+
if (!isControlled) {
|
|
356
|
+
setInternalChecked(event.target.checked);
|
|
357
|
+
}
|
|
358
|
+
onChange?.(event);
|
|
359
|
+
};
|
|
360
|
+
const currentState = disabled ? "disabled" : state;
|
|
361
|
+
const sizeClasses = SIZE_CLASSES3[size];
|
|
362
|
+
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
363
|
+
const stylingClasses = STATE_CLASSES[currentState][checkVariant];
|
|
364
|
+
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
365
|
+
const checkboxClasses = cn(
|
|
366
|
+
BASE_CHECKBOX_CLASSES,
|
|
367
|
+
sizeClasses.checkbox,
|
|
368
|
+
borderWidthClass,
|
|
369
|
+
stylingClasses,
|
|
370
|
+
className
|
|
371
|
+
);
|
|
372
|
+
const renderIcon = () => {
|
|
373
|
+
if (indeterminate) {
|
|
374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
375
|
+
import_phosphor_react2.Minus,
|
|
376
|
+
{
|
|
377
|
+
size: sizeClasses.iconSize,
|
|
378
|
+
weight: "bold",
|
|
379
|
+
color: "currentColor"
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
if (checked) {
|
|
384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
385
|
+
import_phosphor_react2.Check,
|
|
386
|
+
{
|
|
387
|
+
size: sizeClasses.iconSize,
|
|
388
|
+
weight: "bold",
|
|
389
|
+
color: "currentColor"
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
return null;
|
|
394
|
+
};
|
|
395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col", children: [
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
397
|
+
"div",
|
|
398
|
+
{
|
|
399
|
+
className: cn(
|
|
400
|
+
"flex flex-row items-center",
|
|
401
|
+
sizeClasses.spacing,
|
|
402
|
+
disabled ? "opacity-40" : ""
|
|
403
|
+
),
|
|
404
|
+
children: [
|
|
405
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
406
|
+
"input",
|
|
407
|
+
{
|
|
408
|
+
ref,
|
|
409
|
+
type: "checkbox",
|
|
410
|
+
id: inputId,
|
|
411
|
+
checked,
|
|
412
|
+
disabled,
|
|
413
|
+
onChange: handleChange,
|
|
414
|
+
className: "sr-only",
|
|
415
|
+
...props
|
|
416
|
+
}
|
|
417
|
+
),
|
|
418
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
419
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
420
|
+
"div",
|
|
421
|
+
{
|
|
422
|
+
className: cn(
|
|
423
|
+
"flex flex-row items-center",
|
|
424
|
+
sizeClasses.labelHeight
|
|
425
|
+
),
|
|
426
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
427
|
+
Text_default,
|
|
428
|
+
{
|
|
429
|
+
as: "label",
|
|
430
|
+
htmlFor: inputId,
|
|
431
|
+
size: sizeClasses.textSize,
|
|
432
|
+
weight: "normal",
|
|
433
|
+
className: cn(
|
|
434
|
+
"cursor-pointer select-none leading-[150%] flex items-center font-roboto",
|
|
435
|
+
labelClassName
|
|
436
|
+
),
|
|
437
|
+
children: label
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
}
|
|
441
|
+
)
|
|
442
|
+
]
|
|
443
|
+
}
|
|
444
|
+
),
|
|
445
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
446
|
+
Text_default,
|
|
447
|
+
{
|
|
448
|
+
size: "sm",
|
|
449
|
+
weight: "normal",
|
|
450
|
+
className: "mt-1.5",
|
|
451
|
+
color: "text-error-600",
|
|
452
|
+
children: errorMessage
|
|
453
|
+
}
|
|
454
|
+
),
|
|
455
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
456
|
+
Text_default,
|
|
457
|
+
{
|
|
458
|
+
size: "sm",
|
|
459
|
+
weight: "normal",
|
|
460
|
+
className: "mt-1.5",
|
|
461
|
+
color: "text-text-500",
|
|
462
|
+
children: helperText
|
|
463
|
+
}
|
|
464
|
+
)
|
|
465
|
+
] });
|
|
466
|
+
}
|
|
467
|
+
);
|
|
468
|
+
CheckBox.displayName = "CheckBox";
|
|
469
|
+
var CheckBox_default = CheckBox;
|
|
470
|
+
|
|
471
|
+
// src/components/CheckBox/CheckboxList.tsx
|
|
472
|
+
var import_react2 = require("react");
|
|
473
|
+
var import_zustand = require("zustand");
|
|
474
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
475
|
+
var createCheckboxListStore = (name, defaultValues, disabled, onValuesChange) => (0, import_zustand.create)((set, get) => ({
|
|
476
|
+
values: defaultValues,
|
|
477
|
+
setValues: (values) => {
|
|
478
|
+
if (!get().disabled) {
|
|
479
|
+
set({ values });
|
|
480
|
+
get().onValuesChange?.(values);
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
toggleValue: (value) => {
|
|
484
|
+
if (!get().disabled) {
|
|
485
|
+
const currentValues = get().values;
|
|
486
|
+
const newValues = currentValues.includes(value) ? currentValues.filter((v) => v !== value) : [...currentValues, value];
|
|
487
|
+
set({ values: newValues });
|
|
488
|
+
get().onValuesChange?.(newValues);
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
onValuesChange,
|
|
492
|
+
disabled,
|
|
493
|
+
name
|
|
494
|
+
}));
|
|
495
|
+
var useCheckboxListStore = (externalStore) => {
|
|
496
|
+
if (!externalStore) {
|
|
497
|
+
throw new Error("CheckboxListItem must be used within a CheckboxList");
|
|
498
|
+
}
|
|
499
|
+
return externalStore;
|
|
500
|
+
};
|
|
501
|
+
var injectStore = (children, store) => import_react2.Children.map(children, (child) => {
|
|
502
|
+
if (!(0, import_react2.isValidElement)(child)) return child;
|
|
503
|
+
const typedChild = child;
|
|
504
|
+
const shouldInject = typedChild.type === CheckboxListItem;
|
|
505
|
+
return (0, import_react2.cloneElement)(typedChild, {
|
|
506
|
+
...shouldInject ? { store } : {},
|
|
507
|
+
...typedChild.props.children ? { children: injectStore(typedChild.props.children, store) } : {}
|
|
508
|
+
});
|
|
509
|
+
});
|
|
510
|
+
var CheckboxList = (0, import_react2.forwardRef)(
|
|
511
|
+
({
|
|
512
|
+
values: propValues,
|
|
513
|
+
defaultValues = [],
|
|
514
|
+
onValuesChange,
|
|
515
|
+
name: propName,
|
|
516
|
+
disabled = false,
|
|
517
|
+
className = "",
|
|
518
|
+
children,
|
|
519
|
+
...props
|
|
520
|
+
}, ref) => {
|
|
521
|
+
const generatedId = (0, import_react2.useId)();
|
|
522
|
+
const name = propName || `checkbox-list-${generatedId}`;
|
|
523
|
+
const storeRef = (0, import_react2.useRef)(null);
|
|
524
|
+
storeRef.current ??= createCheckboxListStore(
|
|
525
|
+
name,
|
|
526
|
+
defaultValues,
|
|
527
|
+
disabled,
|
|
528
|
+
onValuesChange
|
|
529
|
+
);
|
|
530
|
+
const store = storeRef.current;
|
|
531
|
+
const { setValues } = (0, import_zustand.useStore)(store, (s) => s);
|
|
532
|
+
(0, import_react2.useEffect)(() => {
|
|
533
|
+
const currentValues = store.getState().values;
|
|
534
|
+
if (currentValues.length > 0 && onValuesChange) {
|
|
535
|
+
onValuesChange(currentValues);
|
|
536
|
+
}
|
|
537
|
+
}, []);
|
|
538
|
+
(0, import_react2.useEffect)(() => {
|
|
539
|
+
if (propValues !== void 0) {
|
|
540
|
+
setValues(propValues);
|
|
541
|
+
}
|
|
542
|
+
}, [propValues, setValues]);
|
|
543
|
+
(0, import_react2.useEffect)(() => {
|
|
544
|
+
store.setState({ disabled });
|
|
545
|
+
}, [disabled, store]);
|
|
546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
547
|
+
"div",
|
|
548
|
+
{
|
|
549
|
+
ref,
|
|
550
|
+
className: cn("flex flex-col gap-2 w-full", className),
|
|
551
|
+
"aria-label": name,
|
|
552
|
+
...props,
|
|
553
|
+
children: injectStore(children, store)
|
|
554
|
+
}
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
);
|
|
558
|
+
CheckboxList.displayName = "CheckboxList";
|
|
559
|
+
var CheckboxListItem = (0, import_react2.forwardRef)(
|
|
560
|
+
({
|
|
561
|
+
value,
|
|
562
|
+
store: externalStore,
|
|
563
|
+
disabled: itemDisabled,
|
|
564
|
+
size = "medium",
|
|
565
|
+
state = "default",
|
|
566
|
+
className = "",
|
|
567
|
+
id,
|
|
568
|
+
...props
|
|
569
|
+
}, ref) => {
|
|
570
|
+
const store = useCheckboxListStore(externalStore);
|
|
571
|
+
const {
|
|
572
|
+
values: groupValues,
|
|
573
|
+
toggleValue,
|
|
574
|
+
disabled: groupDisabled,
|
|
575
|
+
name
|
|
576
|
+
} = (0, import_zustand.useStore)(store);
|
|
577
|
+
const generatedId = (0, import_react2.useId)();
|
|
578
|
+
const inputId = id ?? `checkbox-item-${generatedId}`;
|
|
579
|
+
const isChecked = groupValues.includes(value);
|
|
580
|
+
const isDisabled = groupDisabled || itemDisabled;
|
|
581
|
+
const currentState = isDisabled ? "disabled" : state;
|
|
582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
583
|
+
CheckBox_default,
|
|
584
|
+
{
|
|
585
|
+
ref,
|
|
586
|
+
id: inputId,
|
|
587
|
+
name,
|
|
588
|
+
value,
|
|
589
|
+
checked: isChecked,
|
|
590
|
+
disabled: isDisabled,
|
|
591
|
+
size,
|
|
592
|
+
state: currentState,
|
|
593
|
+
className,
|
|
594
|
+
onChange: () => {
|
|
595
|
+
if (!isDisabled) {
|
|
596
|
+
toggleValue(value);
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
...props
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
);
|
|
604
|
+
CheckboxListItem.displayName = "CheckboxListItem";
|
|
605
|
+
var CheckboxList_default = CheckboxList;
|
|
606
|
+
|
|
607
|
+
// src/components/Radio/Radio.tsx
|
|
608
|
+
var import_react3 = require("react");
|
|
609
|
+
var import_zustand2 = require("zustand");
|
|
610
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
611
|
+
var SIZE_CLASSES4 = {
|
|
612
|
+
small: {
|
|
613
|
+
radio: "w-5 h-5",
|
|
614
|
+
textSize: "sm",
|
|
615
|
+
spacing: "gap-1.5",
|
|
616
|
+
borderWidth: "border-2",
|
|
617
|
+
dotSize: "w-2.5 h-2.5",
|
|
618
|
+
labelHeight: "h-5"
|
|
619
|
+
},
|
|
620
|
+
medium: {
|
|
621
|
+
radio: "w-6 h-6",
|
|
622
|
+
textSize: "md",
|
|
623
|
+
spacing: "gap-2",
|
|
624
|
+
borderWidth: "border-2",
|
|
625
|
+
dotSize: "w-3 h-3",
|
|
626
|
+
labelHeight: "h-6"
|
|
627
|
+
},
|
|
628
|
+
large: {
|
|
629
|
+
radio: "w-7 h-7",
|
|
630
|
+
textSize: "lg",
|
|
631
|
+
spacing: "gap-2",
|
|
632
|
+
borderWidth: "border-2",
|
|
633
|
+
dotSize: "w-3.5 h-3.5",
|
|
634
|
+
labelHeight: "h-7"
|
|
635
|
+
},
|
|
636
|
+
extraLarge: {
|
|
637
|
+
radio: "w-8 h-8",
|
|
638
|
+
textSize: "xl",
|
|
639
|
+
spacing: "gap-3",
|
|
640
|
+
borderWidth: "border-2",
|
|
641
|
+
dotSize: "w-4 h-4",
|
|
642
|
+
labelHeight: "h-8"
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
var BASE_RADIO_CLASSES = "rounded-full border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
646
|
+
var STATE_CLASSES2 = {
|
|
647
|
+
default: {
|
|
648
|
+
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
649
|
+
checked: "border-primary-950 bg-background hover:border-primary-800"
|
|
650
|
+
},
|
|
651
|
+
hovered: {
|
|
652
|
+
unchecked: "border-border-500 bg-background",
|
|
653
|
+
checked: "border-info-700 bg-background"
|
|
654
|
+
},
|
|
655
|
+
focused: {
|
|
656
|
+
unchecked: "border-border-400 bg-background",
|
|
657
|
+
checked: "border-primary-950 bg-background"
|
|
658
|
+
},
|
|
659
|
+
invalid: {
|
|
660
|
+
unchecked: "border-border-400 bg-background",
|
|
661
|
+
checked: "border-primary-950 bg-background"
|
|
662
|
+
},
|
|
663
|
+
disabled: {
|
|
664
|
+
unchecked: "border-border-400 bg-background cursor-not-allowed",
|
|
665
|
+
checked: "border-primary-950 bg-background cursor-not-allowed"
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
var DOT_CLASSES = {
|
|
669
|
+
default: "bg-primary-950",
|
|
670
|
+
hovered: "bg-info-700",
|
|
671
|
+
focused: "bg-primary-950",
|
|
672
|
+
invalid: "bg-primary-950",
|
|
673
|
+
disabled: "bg-primary-950"
|
|
674
|
+
};
|
|
675
|
+
var Radio = (0, import_react3.forwardRef)(
|
|
676
|
+
({
|
|
677
|
+
label,
|
|
678
|
+
size = "medium",
|
|
679
|
+
state = "default",
|
|
680
|
+
errorMessage,
|
|
681
|
+
helperText,
|
|
682
|
+
className = "",
|
|
683
|
+
labelClassName = "",
|
|
684
|
+
checked: checkedProp,
|
|
685
|
+
defaultChecked = false,
|
|
686
|
+
disabled,
|
|
687
|
+
id,
|
|
688
|
+
name,
|
|
689
|
+
value,
|
|
690
|
+
onChange,
|
|
691
|
+
...props
|
|
692
|
+
}, ref) => {
|
|
693
|
+
const generatedId = (0, import_react3.useId)();
|
|
694
|
+
const inputId = id ?? `radio-${generatedId}`;
|
|
695
|
+
const inputRef = (0, import_react3.useRef)(null);
|
|
696
|
+
const [internalChecked, setInternalChecked] = (0, import_react3.useState)(defaultChecked);
|
|
697
|
+
const isControlled = checkedProp !== void 0;
|
|
698
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
699
|
+
const handleChange = (event) => {
|
|
700
|
+
const newChecked = event.target.checked;
|
|
701
|
+
if (!isControlled) {
|
|
702
|
+
setInternalChecked(newChecked);
|
|
703
|
+
}
|
|
704
|
+
if (event.target) {
|
|
705
|
+
event.target.blur();
|
|
706
|
+
}
|
|
707
|
+
onChange?.(event);
|
|
708
|
+
};
|
|
709
|
+
const currentState = disabled ? "disabled" : state;
|
|
710
|
+
const sizeClasses = SIZE_CLASSES4[size];
|
|
711
|
+
const actualRadioSize = sizeClasses.radio;
|
|
712
|
+
const actualDotSize = sizeClasses.dotSize;
|
|
713
|
+
const radioVariant = checked ? "checked" : "unchecked";
|
|
714
|
+
const stylingClasses = STATE_CLASSES2[currentState][radioVariant];
|
|
715
|
+
const getBorderWidth = () => {
|
|
716
|
+
if (currentState === "focused") {
|
|
717
|
+
return "border-2";
|
|
718
|
+
}
|
|
719
|
+
return sizeClasses.borderWidth;
|
|
720
|
+
};
|
|
721
|
+
const borderWidthClass = getBorderWidth();
|
|
722
|
+
const radioClasses = cn(
|
|
723
|
+
BASE_RADIO_CLASSES,
|
|
724
|
+
actualRadioSize,
|
|
725
|
+
borderWidthClass,
|
|
726
|
+
stylingClasses,
|
|
727
|
+
className
|
|
728
|
+
);
|
|
729
|
+
const dotClasses = cn(
|
|
730
|
+
actualDotSize,
|
|
731
|
+
"rounded-full",
|
|
732
|
+
DOT_CLASSES[currentState],
|
|
733
|
+
"transition-all duration-200"
|
|
734
|
+
);
|
|
735
|
+
const isWrapperNeeded = currentState === "focused" || currentState === "invalid";
|
|
736
|
+
const wrapperBorderColor = currentState === "focused" ? "border-indicator-info" : "border-indicator-error";
|
|
737
|
+
const getTextColor = () => {
|
|
738
|
+
if (currentState === "disabled") {
|
|
739
|
+
return checked ? "text-text-900" : "text-text-600";
|
|
740
|
+
}
|
|
741
|
+
if (currentState === "focused") {
|
|
742
|
+
return "text-text-900";
|
|
743
|
+
}
|
|
744
|
+
return checked ? "text-text-900" : "text-text-600";
|
|
745
|
+
};
|
|
746
|
+
const getCursorClass = () => {
|
|
747
|
+
return currentState === "disabled" ? "cursor-not-allowed" : "cursor-pointer";
|
|
748
|
+
};
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col", children: [
|
|
750
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
751
|
+
"div",
|
|
752
|
+
{
|
|
753
|
+
className: cn(
|
|
754
|
+
"flex flex-row items-center",
|
|
755
|
+
isWrapperNeeded ? cn("p-1 border-2", wrapperBorderColor, "rounded-lg gap-1.5") : sizeClasses.spacing,
|
|
756
|
+
disabled ? "opacity-40" : ""
|
|
757
|
+
),
|
|
758
|
+
children: [
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
760
|
+
"input",
|
|
761
|
+
{
|
|
762
|
+
ref: (node) => {
|
|
763
|
+
inputRef.current = node;
|
|
764
|
+
if (typeof ref === "function") ref(node);
|
|
765
|
+
else if (ref) ref.current = node;
|
|
766
|
+
},
|
|
767
|
+
type: "radio",
|
|
768
|
+
id: inputId,
|
|
769
|
+
checked,
|
|
770
|
+
disabled,
|
|
771
|
+
name,
|
|
772
|
+
value,
|
|
773
|
+
onChange: handleChange,
|
|
774
|
+
className: "sr-only",
|
|
775
|
+
style: {
|
|
776
|
+
position: "absolute",
|
|
777
|
+
left: "-9999px",
|
|
778
|
+
visibility: "hidden"
|
|
779
|
+
},
|
|
780
|
+
...props
|
|
781
|
+
}
|
|
782
|
+
),
|
|
783
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
784
|
+
"button",
|
|
785
|
+
{
|
|
786
|
+
type: "button",
|
|
787
|
+
className: radioClasses,
|
|
788
|
+
disabled,
|
|
789
|
+
"aria-pressed": checked,
|
|
790
|
+
onClick: (e) => {
|
|
791
|
+
e.preventDefault();
|
|
792
|
+
if (!disabled) {
|
|
793
|
+
if (inputRef.current) {
|
|
794
|
+
inputRef.current.click();
|
|
795
|
+
inputRef.current.blur();
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
onKeyDown: (e) => {
|
|
800
|
+
if ((e.key === "Enter" || e.key === " ") && !disabled) {
|
|
801
|
+
e.preventDefault();
|
|
802
|
+
if (inputRef.current) {
|
|
803
|
+
inputRef.current.click();
|
|
804
|
+
inputRef.current.blur();
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
children: checked && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: dotClasses })
|
|
809
|
+
}
|
|
810
|
+
),
|
|
811
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
812
|
+
"div",
|
|
813
|
+
{
|
|
814
|
+
className: cn(
|
|
815
|
+
"flex flex-row items-center",
|
|
816
|
+
sizeClasses.labelHeight,
|
|
817
|
+
"flex-1 min-w-0"
|
|
818
|
+
),
|
|
819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
820
|
+
Text_default,
|
|
821
|
+
{
|
|
822
|
+
as: "label",
|
|
823
|
+
htmlFor: inputId,
|
|
824
|
+
size: sizeClasses.textSize,
|
|
825
|
+
weight: "normal",
|
|
826
|
+
className: cn(
|
|
827
|
+
getCursorClass(),
|
|
828
|
+
"select-none leading-normal flex items-center font-roboto truncate",
|
|
829
|
+
labelClassName
|
|
830
|
+
),
|
|
831
|
+
color: getTextColor(),
|
|
832
|
+
children: label
|
|
833
|
+
}
|
|
834
|
+
)
|
|
835
|
+
}
|
|
836
|
+
)
|
|
837
|
+
]
|
|
838
|
+
}
|
|
839
|
+
),
|
|
840
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
841
|
+
Text_default,
|
|
842
|
+
{
|
|
843
|
+
size: "sm",
|
|
844
|
+
weight: "normal",
|
|
845
|
+
className: "mt-1.5 truncate",
|
|
846
|
+
color: "text-error-600",
|
|
847
|
+
children: errorMessage
|
|
848
|
+
}
|
|
849
|
+
),
|
|
850
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
851
|
+
Text_default,
|
|
852
|
+
{
|
|
853
|
+
size: "sm",
|
|
854
|
+
weight: "normal",
|
|
855
|
+
className: "mt-1.5 truncate",
|
|
856
|
+
color: "text-text-500",
|
|
857
|
+
children: helperText
|
|
858
|
+
}
|
|
859
|
+
)
|
|
860
|
+
] });
|
|
861
|
+
}
|
|
862
|
+
);
|
|
863
|
+
Radio.displayName = "Radio";
|
|
864
|
+
var createRadioGroupStore = (name, defaultValue, disabled, onValueChange) => (0, import_zustand2.create)((set, get) => ({
|
|
865
|
+
value: defaultValue,
|
|
866
|
+
setValue: (value) => {
|
|
867
|
+
if (!get().disabled) {
|
|
868
|
+
set({ value });
|
|
869
|
+
get().onValueChange?.(value);
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
onValueChange,
|
|
873
|
+
disabled,
|
|
874
|
+
name
|
|
875
|
+
}));
|
|
876
|
+
var useRadioGroupStore = (externalStore) => {
|
|
877
|
+
if (!externalStore) {
|
|
878
|
+
throw new Error("RadioGroupItem must be used within a RadioGroup");
|
|
879
|
+
}
|
|
880
|
+
return externalStore;
|
|
881
|
+
};
|
|
882
|
+
var injectStore2 = (children, store) => import_react3.Children.map(children, (child) => {
|
|
883
|
+
if (!(0, import_react3.isValidElement)(child)) return child;
|
|
884
|
+
const typedChild = child;
|
|
885
|
+
const shouldInject = typedChild.type === RadioGroupItem;
|
|
886
|
+
return (0, import_react3.cloneElement)(typedChild, {
|
|
887
|
+
...shouldInject ? { store } : {},
|
|
888
|
+
...typedChild.props.children ? { children: injectStore2(typedChild.props.children, store) } : {}
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
var RadioGroup = (0, import_react3.forwardRef)(
|
|
892
|
+
({
|
|
893
|
+
value: propValue,
|
|
894
|
+
defaultValue = "",
|
|
895
|
+
onValueChange,
|
|
896
|
+
name: propName,
|
|
897
|
+
disabled = false,
|
|
898
|
+
className = "",
|
|
899
|
+
children,
|
|
900
|
+
...props
|
|
901
|
+
}, ref) => {
|
|
902
|
+
const generatedId = (0, import_react3.useId)();
|
|
903
|
+
const name = propName || `radio-group-${generatedId}`;
|
|
904
|
+
const storeRef = (0, import_react3.useRef)(null);
|
|
905
|
+
storeRef.current ??= createRadioGroupStore(
|
|
906
|
+
name,
|
|
907
|
+
defaultValue,
|
|
908
|
+
disabled,
|
|
909
|
+
onValueChange
|
|
910
|
+
);
|
|
911
|
+
const store = storeRef.current;
|
|
912
|
+
const { setValue } = (0, import_zustand2.useStore)(store, (s) => s);
|
|
913
|
+
(0, import_react3.useEffect)(() => {
|
|
914
|
+
const currentValue = store.getState().value;
|
|
915
|
+
if (currentValue && onValueChange) {
|
|
916
|
+
onValueChange(currentValue);
|
|
917
|
+
}
|
|
918
|
+
}, []);
|
|
919
|
+
(0, import_react3.useEffect)(() => {
|
|
920
|
+
if (propValue !== void 0) {
|
|
921
|
+
setValue(propValue);
|
|
922
|
+
}
|
|
923
|
+
}, [propValue, setValue]);
|
|
924
|
+
(0, import_react3.useEffect)(() => {
|
|
925
|
+
store.setState({ disabled });
|
|
926
|
+
}, [disabled, store]);
|
|
927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
928
|
+
"div",
|
|
929
|
+
{
|
|
930
|
+
ref,
|
|
931
|
+
className,
|
|
932
|
+
role: "radiogroup",
|
|
933
|
+
"aria-label": name,
|
|
934
|
+
...props,
|
|
935
|
+
children: injectStore2(children, store)
|
|
936
|
+
}
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
);
|
|
940
|
+
RadioGroup.displayName = "RadioGroup";
|
|
941
|
+
var RadioGroupItem = (0, import_react3.forwardRef)(
|
|
942
|
+
({
|
|
943
|
+
value,
|
|
944
|
+
store: externalStore,
|
|
945
|
+
disabled: itemDisabled,
|
|
946
|
+
size = "medium",
|
|
947
|
+
state = "default",
|
|
948
|
+
className = "",
|
|
949
|
+
id,
|
|
950
|
+
...props
|
|
951
|
+
}, ref) => {
|
|
952
|
+
const store = useRadioGroupStore(externalStore);
|
|
953
|
+
const {
|
|
954
|
+
value: groupValue,
|
|
955
|
+
setValue,
|
|
956
|
+
disabled: groupDisabled,
|
|
957
|
+
name
|
|
958
|
+
} = (0, import_zustand2.useStore)(store);
|
|
959
|
+
const generatedId = (0, import_react3.useId)();
|
|
960
|
+
const inputId = id ?? `radio-item-${generatedId}`;
|
|
961
|
+
const isChecked = groupValue === value;
|
|
962
|
+
const isDisabled = groupDisabled || itemDisabled;
|
|
963
|
+
const currentState = isDisabled ? "disabled" : state;
|
|
964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
965
|
+
Radio,
|
|
966
|
+
{
|
|
967
|
+
ref,
|
|
968
|
+
id: inputId,
|
|
969
|
+
name,
|
|
970
|
+
value,
|
|
971
|
+
checked: isChecked,
|
|
972
|
+
disabled: isDisabled,
|
|
973
|
+
size,
|
|
974
|
+
state: currentState,
|
|
975
|
+
className,
|
|
976
|
+
onChange: (e) => {
|
|
977
|
+
if (e.target.checked && !isDisabled) {
|
|
978
|
+
setValue(value);
|
|
979
|
+
}
|
|
980
|
+
},
|
|
981
|
+
...props
|
|
982
|
+
}
|
|
983
|
+
);
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
987
|
+
|
|
988
|
+
// src/components/Alternative/Alternative.tsx
|
|
989
|
+
var import_phosphor_react3 = require("phosphor-react");
|
|
990
|
+
var import_react4 = require("react");
|
|
991
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
992
|
+
var AlternativesList = ({
|
|
993
|
+
alternatives,
|
|
994
|
+
name,
|
|
995
|
+
defaultValue,
|
|
996
|
+
value,
|
|
997
|
+
onValueChange,
|
|
998
|
+
disabled = false,
|
|
999
|
+
layout = "default",
|
|
1000
|
+
className = "",
|
|
1001
|
+
mode = "interactive",
|
|
1002
|
+
selectedValue
|
|
1003
|
+
}) => {
|
|
1004
|
+
const uniqueId = (0, import_react4.useId)();
|
|
1005
|
+
const groupName = name || `alternatives-${uniqueId}`;
|
|
1006
|
+
const [actualValue, setActualValue] = (0, import_react4.useState)(value);
|
|
1007
|
+
const isReadonly = mode === "readonly";
|
|
1008
|
+
const getStatusStyles = (status, isReadonly2) => {
|
|
1009
|
+
const hoverClass = isReadonly2 ? "" : "hover:bg-background-50";
|
|
1010
|
+
switch (status) {
|
|
1011
|
+
case "correct":
|
|
1012
|
+
return "bg-success-background border-success-300";
|
|
1013
|
+
case "incorrect":
|
|
1014
|
+
return "bg-error-background border-error-300";
|
|
1015
|
+
default:
|
|
1016
|
+
return `bg-background border-border-100 ${hoverClass}`;
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
const getStatusBadge = (status) => {
|
|
1020
|
+
switch (status) {
|
|
1021
|
+
case "correct":
|
|
1022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react3.CheckCircle, {}), children: "Resposta correta" });
|
|
1023
|
+
case "incorrect":
|
|
1024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react3.XCircle, {}), children: "Resposta incorreta" });
|
|
1025
|
+
default:
|
|
1026
|
+
return null;
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
const getLayoutClasses = () => {
|
|
1030
|
+
switch (layout) {
|
|
1031
|
+
case "compact":
|
|
1032
|
+
return "gap-2";
|
|
1033
|
+
case "detailed":
|
|
1034
|
+
return "gap-4";
|
|
1035
|
+
default:
|
|
1036
|
+
return "gap-3.5";
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
const renderReadonlyAlternative = (alternative) => {
|
|
1040
|
+
const alternativeId = alternative.value;
|
|
1041
|
+
const isUserSelected = selectedValue === alternative.value;
|
|
1042
|
+
const isCorrectAnswer = alternative.status === "correct";
|
|
1043
|
+
let displayStatus = void 0;
|
|
1044
|
+
if (isUserSelected && !isCorrectAnswer) {
|
|
1045
|
+
displayStatus = "incorrect";
|
|
1046
|
+
} else if (isCorrectAnswer) {
|
|
1047
|
+
displayStatus = "correct";
|
|
1048
|
+
}
|
|
1049
|
+
const statusStyles = getStatusStyles(displayStatus, true);
|
|
1050
|
+
const statusBadge = getStatusBadge(displayStatus);
|
|
1051
|
+
const renderRadio = () => {
|
|
1052
|
+
const radioClasses = `w-6 h-6 rounded-full border-2 cursor-default transition-all duration-200 flex items-center justify-center ${isUserSelected ? "border-primary-950 bg-background" : "border-border-400 bg-background"}`;
|
|
1053
|
+
const dotClasses = "w-3 h-3 rounded-full bg-primary-950 transition-all duration-200";
|
|
1054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: radioClasses, children: isUserSelected && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: dotClasses }) });
|
|
1055
|
+
};
|
|
1056
|
+
if (layout === "detailed") {
|
|
1057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1058
|
+
"div",
|
|
1059
|
+
{
|
|
1060
|
+
className: cn(
|
|
1061
|
+
"border-2 rounded-lg p-4 w-full",
|
|
1062
|
+
statusStyles,
|
|
1063
|
+
alternative.disabled ? "opacity-50" : ""
|
|
1064
|
+
),
|
|
1065
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mt-1", children: renderRadio() }),
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex-1", children: [
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1070
|
+
"p",
|
|
1071
|
+
{
|
|
1072
|
+
className: cn(
|
|
1073
|
+
"block font-medium",
|
|
1074
|
+
selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"
|
|
1075
|
+
),
|
|
1076
|
+
children: alternative.label
|
|
1077
|
+
}
|
|
1078
|
+
),
|
|
1079
|
+
alternative.description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
|
|
1080
|
+
] })
|
|
1081
|
+
] }),
|
|
1082
|
+
statusBadge && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
|
|
1083
|
+
] })
|
|
1084
|
+
},
|
|
1085
|
+
alternativeId
|
|
1086
|
+
);
|
|
1087
|
+
}
|
|
1088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1089
|
+
"div",
|
|
1090
|
+
{
|
|
1091
|
+
className: cn(
|
|
1092
|
+
"flex flex-row justify-between items-start gap-2 p-2 rounded-lg w-full",
|
|
1093
|
+
statusStyles,
|
|
1094
|
+
alternative.disabled ? "opacity-50" : ""
|
|
1095
|
+
),
|
|
1096
|
+
children: [
|
|
1097
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
1098
|
+
renderRadio(),
|
|
1099
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1100
|
+
"span",
|
|
1101
|
+
{
|
|
1102
|
+
className: cn(
|
|
1103
|
+
"flex-1",
|
|
1104
|
+
selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"
|
|
1105
|
+
),
|
|
1106
|
+
children: alternative.label
|
|
1107
|
+
}
|
|
1108
|
+
)
|
|
1109
|
+
] }),
|
|
1110
|
+
statusBadge && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
|
|
1111
|
+
]
|
|
1112
|
+
},
|
|
1113
|
+
alternativeId
|
|
1114
|
+
);
|
|
1115
|
+
};
|
|
1116
|
+
if (isReadonly) {
|
|
1117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1118
|
+
"div",
|
|
1119
|
+
{
|
|
1120
|
+
className: cn("flex flex-col", getLayoutClasses(), "w-full", className),
|
|
1121
|
+
children: alternatives.map(
|
|
1122
|
+
(alternative) => renderReadonlyAlternative(alternative)
|
|
1123
|
+
)
|
|
1124
|
+
}
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
1127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1128
|
+
RadioGroup,
|
|
1129
|
+
{
|
|
1130
|
+
name: groupName,
|
|
1131
|
+
defaultValue,
|
|
1132
|
+
value,
|
|
1133
|
+
onValueChange: (value2) => {
|
|
1134
|
+
setActualValue(value2);
|
|
1135
|
+
onValueChange?.(value2);
|
|
1136
|
+
},
|
|
1137
|
+
disabled,
|
|
1138
|
+
className: cn("flex flex-col", getLayoutClasses(), className),
|
|
1139
|
+
children: alternatives.map((alternative, index) => {
|
|
1140
|
+
const alternativeId = alternative.value || `alt-${index}`;
|
|
1141
|
+
const statusStyles = getStatusStyles(alternative.status, false);
|
|
1142
|
+
const statusBadge = getStatusBadge(alternative.status);
|
|
1143
|
+
if (layout === "detailed") {
|
|
1144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1145
|
+
"div",
|
|
1146
|
+
{
|
|
1147
|
+
className: cn(
|
|
1148
|
+
"border-2 rounded-lg p-4 transition-all",
|
|
1149
|
+
statusStyles,
|
|
1150
|
+
alternative.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
1151
|
+
),
|
|
1152
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1155
|
+
RadioGroupItem,
|
|
1156
|
+
{
|
|
1157
|
+
value: alternative.value,
|
|
1158
|
+
id: alternativeId,
|
|
1159
|
+
disabled: alternative.disabled,
|
|
1160
|
+
className: "mt-1"
|
|
1161
|
+
}
|
|
1162
|
+
),
|
|
1163
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex-1", children: [
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1165
|
+
"label",
|
|
1166
|
+
{
|
|
1167
|
+
htmlFor: alternativeId,
|
|
1168
|
+
className: cn(
|
|
1169
|
+
"block font-medium",
|
|
1170
|
+
actualValue === alternative.value ? "text-text-950" : "text-text-600",
|
|
1171
|
+
alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1172
|
+
),
|
|
1173
|
+
children: alternative.label
|
|
1174
|
+
}
|
|
1175
|
+
),
|
|
1176
|
+
alternative.description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
|
|
1177
|
+
] })
|
|
1178
|
+
] }),
|
|
1179
|
+
statusBadge && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
|
|
1180
|
+
] })
|
|
1181
|
+
},
|
|
1182
|
+
alternativeId
|
|
1183
|
+
);
|
|
1184
|
+
}
|
|
1185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1186
|
+
"div",
|
|
1187
|
+
{
|
|
1188
|
+
className: cn(
|
|
1189
|
+
"flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
|
|
1190
|
+
statusStyles,
|
|
1191
|
+
alternative.disabled ? "opacity-50 cursor-not-allowed" : ""
|
|
1192
|
+
),
|
|
1193
|
+
children: [
|
|
1194
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1196
|
+
RadioGroupItem,
|
|
1197
|
+
{
|
|
1198
|
+
value: alternative.value,
|
|
1199
|
+
id: alternativeId,
|
|
1200
|
+
disabled: alternative.disabled
|
|
1201
|
+
}
|
|
1202
|
+
),
|
|
1203
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1204
|
+
"label",
|
|
1205
|
+
{
|
|
1206
|
+
htmlFor: alternativeId,
|
|
1207
|
+
className: cn(
|
|
1208
|
+
"flex-1",
|
|
1209
|
+
actualValue === alternative.value ? "text-text-950" : "text-text-600",
|
|
1210
|
+
alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1211
|
+
),
|
|
1212
|
+
children: alternative.label
|
|
1213
|
+
}
|
|
1214
|
+
)
|
|
1215
|
+
] }),
|
|
1216
|
+
statusBadge && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
|
|
1217
|
+
]
|
|
1218
|
+
},
|
|
1219
|
+
alternativeId
|
|
1220
|
+
);
|
|
1221
|
+
})
|
|
1222
|
+
}
|
|
1223
|
+
);
|
|
1224
|
+
};
|
|
1225
|
+
var HeaderAlternative = (0, import_react4.forwardRef)(
|
|
1226
|
+
({ className, title, subTitle, content, ...props }, ref) => {
|
|
1227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1228
|
+
"div",
|
|
1229
|
+
{
|
|
1230
|
+
ref,
|
|
1231
|
+
className: cn(
|
|
1232
|
+
"bg-background p-4 flex flex-col gap-4 rounded-xl",
|
|
1233
|
+
className
|
|
1234
|
+
),
|
|
1235
|
+
...props,
|
|
1236
|
+
children: [
|
|
1237
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "flex flex-col", children: [
|
|
1238
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-text-950 font-bold text-lg", children: title }),
|
|
1239
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-text-700 text-sm ", children: subTitle })
|
|
1240
|
+
] }),
|
|
1241
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-text-950 text-md", children: content })
|
|
1242
|
+
]
|
|
1243
|
+
}
|
|
1244
|
+
);
|
|
1245
|
+
}
|
|
1246
|
+
);
|
|
1247
|
+
|
|
1248
|
+
// src/components/IconRender/IconRender.tsx
|
|
1249
|
+
var import_react5 = require("react");
|
|
1250
|
+
var PhosphorIcons = __toESM(require("phosphor-react"));
|
|
1251
|
+
|
|
1252
|
+
// src/assets/icons/subjects/ChatPT.tsx
|
|
1253
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1254
|
+
var ChatPT = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1255
|
+
"svg",
|
|
1256
|
+
{
|
|
1257
|
+
width: size,
|
|
1258
|
+
height: size,
|
|
1259
|
+
viewBox: "0 0 32 32",
|
|
1260
|
+
fill: "none",
|
|
1261
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1262
|
+
children: [
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1264
|
+
"path",
|
|
1265
|
+
{
|
|
1266
|
+
d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
|
|
1267
|
+
fill: color
|
|
1268
|
+
}
|
|
1269
|
+
),
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1271
|
+
"path",
|
|
1272
|
+
{
|
|
1273
|
+
d: "M21.1758 12V20.5312H19.7168V12H21.1758ZM23.8535 12V13.1719H17.0625V12H23.8535Z",
|
|
1274
|
+
fill: color
|
|
1275
|
+
}
|
|
1276
|
+
),
|
|
1277
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1278
|
+
"path",
|
|
1279
|
+
{
|
|
1280
|
+
d: "M13.2402 17.3496H11.0195V16.1836H13.2402C13.627 16.1836 13.9395 16.1211 14.1777 15.9961C14.416 15.8711 14.5898 15.6992 14.6992 15.4805C14.8125 15.2578 14.8691 15.0039 14.8691 14.7188C14.8691 14.4492 14.8125 14.1973 14.6992 13.9629C14.5898 13.7246 14.416 13.5332 14.1777 13.3887C13.9395 13.2441 13.627 13.1719 13.2402 13.1719H11.4707V20.5312H10V12H13.2402C13.9004 12 14.4609 12.1172 14.9219 12.3516C15.3867 12.582 15.7402 12.9023 15.9824 13.3125C16.2246 13.7188 16.3457 14.1836 16.3457 14.707C16.3457 15.2578 16.2246 15.7305 15.9824 16.125C15.7402 16.5195 15.3867 16.8223 14.9219 17.0332C14.4609 17.2441 13.9004 17.3496 13.2402 17.3496Z",
|
|
1281
|
+
fill: color
|
|
1282
|
+
}
|
|
1283
|
+
)
|
|
1284
|
+
]
|
|
1285
|
+
}
|
|
1286
|
+
);
|
|
1287
|
+
|
|
1288
|
+
// src/assets/icons/subjects/ChatEN.tsx
|
|
1289
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1290
|
+
var ChatEN = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1291
|
+
"svg",
|
|
1292
|
+
{
|
|
1293
|
+
width: size,
|
|
1294
|
+
height: size,
|
|
1295
|
+
viewBox: "0 0 32 32",
|
|
1296
|
+
fill: "none",
|
|
1297
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1298
|
+
children: [
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1300
|
+
"path",
|
|
1301
|
+
{
|
|
1302
|
+
d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
|
|
1303
|
+
fill: color
|
|
1304
|
+
}
|
|
1305
|
+
),
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1307
|
+
"path",
|
|
1308
|
+
{
|
|
1309
|
+
d: "M22.5488 12V20.5312H21.0781L17.252 14.4199V20.5312H15.7812V12H17.252L21.0898 18.123V12H22.5488Z",
|
|
1310
|
+
fill: color
|
|
1311
|
+
}
|
|
1312
|
+
),
|
|
1313
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1314
|
+
"path",
|
|
1315
|
+
{
|
|
1316
|
+
d: "M14.584 19.3652V20.5312H10.0547V19.3652H14.584ZM10.4707 12V20.5312H9V12H10.4707ZM13.9922 15.5625V16.7109H10.0547V15.5625H13.9922ZM14.5547 12V13.1719H10.0547V12H14.5547Z",
|
|
1317
|
+
fill: color
|
|
1318
|
+
}
|
|
1319
|
+
)
|
|
1320
|
+
]
|
|
1321
|
+
}
|
|
1322
|
+
);
|
|
1323
|
+
|
|
1324
|
+
// src/assets/icons/subjects/ChatES.tsx
|
|
1325
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1326
|
+
var ChatES = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1327
|
+
"svg",
|
|
1328
|
+
{
|
|
1329
|
+
width: size,
|
|
1330
|
+
height: size,
|
|
1331
|
+
viewBox: "0 0 32 32",
|
|
1332
|
+
fill: "none",
|
|
1333
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1334
|
+
children: [
|
|
1335
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1336
|
+
"path",
|
|
1337
|
+
{
|
|
1338
|
+
d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
|
|
1339
|
+
fill: color
|
|
1340
|
+
}
|
|
1341
|
+
),
|
|
1342
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1343
|
+
"path",
|
|
1344
|
+
{
|
|
1345
|
+
d: "M21.1426 17.8027C21.1426 17.627 21.1152 17.4707 21.0605 17.334C21.0098 17.1973 20.918 17.0723 20.7852 16.959C20.6523 16.8457 20.4648 16.7363 20.2227 16.6309C19.9844 16.5215 19.6797 16.4102 19.3086 16.2969C18.9023 16.1719 18.5273 16.0332 18.1836 15.8809C17.8438 15.7246 17.5469 15.5449 17.293 15.3418C17.0391 15.1348 16.8418 14.8984 16.7012 14.6328C16.5605 14.3633 16.4902 14.0527 16.4902 13.7012C16.4902 13.3535 16.5625 13.0371 16.707 12.752C16.8555 12.4668 17.0645 12.2207 17.334 12.0137C17.6074 11.8027 17.9297 11.6406 18.3008 11.5273C18.6719 11.4102 19.082 11.3516 19.5312 11.3516C20.1641 11.3516 20.709 11.4688 21.166 11.7031C21.627 11.9375 21.9805 12.252 22.2266 12.6465C22.4766 13.041 22.6016 13.4766 22.6016 13.9531H21.1426C21.1426 13.6719 21.082 13.4238 20.9609 13.209C20.8438 12.9902 20.6641 12.8184 20.4219 12.6934C20.1836 12.5684 19.8809 12.5059 19.5137 12.5059C19.166 12.5059 18.877 12.5586 18.6465 12.6641C18.416 12.7695 18.2441 12.9121 18.1309 13.0918C18.0176 13.2715 17.9609 13.4746 17.9609 13.7012C17.9609 13.8613 17.998 14.0078 18.0723 14.1406C18.1465 14.2695 18.2598 14.3906 18.4121 14.5039C18.5645 14.6133 18.7559 14.7168 18.9863 14.8145C19.2168 14.9121 19.4883 15.0059 19.8008 15.0957C20.2734 15.2363 20.6855 15.3926 21.0371 15.5645C21.3887 15.7324 21.6816 15.9238 21.916 16.1387C22.1504 16.3535 22.3262 16.5977 22.4434 16.8711C22.5605 17.1406 22.6191 17.4473 22.6191 17.791C22.6191 18.1504 22.5469 18.4746 22.4023 18.7637C22.2578 19.0488 22.0508 19.293 21.7812 19.4961C21.5156 19.6953 21.1953 19.8496 20.8203 19.959C20.4492 20.0645 20.0352 20.1172 19.5781 20.1172C19.168 20.1172 18.7637 20.0625 18.3652 19.9531C17.9707 19.8438 17.6113 19.6777 17.2871 19.4551C16.9629 19.2285 16.7051 18.9473 16.5137 18.6113C16.3223 18.2715 16.2266 17.875 16.2266 17.4219H17.6973C17.6973 17.6992 17.7441 17.9355 17.8379 18.1309C17.9355 18.3262 18.0703 18.4863 18.2422 18.6113C18.4141 18.7324 18.6133 18.8223 18.8398 18.8809C19.0703 18.9395 19.3164 18.9688 19.5781 18.9688C19.9219 18.9688 20.209 18.9199 20.4395 18.8223C20.6738 18.7246 20.8496 18.5879 20.9668 18.4121C21.084 18.2363 21.1426 18.0332 21.1426 17.8027Z",
|
|
1346
|
+
fill: color
|
|
1347
|
+
}
|
|
1348
|
+
),
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1350
|
+
"path",
|
|
1351
|
+
{
|
|
1352
|
+
d: "M15.4512 18.834V20H10.9219V18.834H15.4512ZM11.3379 11.4688V20H9.86719V11.4688H11.3379ZM14.8594 15.0312V16.1797H10.9219V15.0312H14.8594ZM15.4219 11.4688V12.6406H10.9219V11.4688H15.4219Z",
|
|
1353
|
+
fill: color
|
|
1354
|
+
}
|
|
1355
|
+
)
|
|
1356
|
+
]
|
|
1357
|
+
}
|
|
1358
|
+
);
|
|
1359
|
+
|
|
1360
|
+
// src/components/IconRender/IconRender.tsx
|
|
1361
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1362
|
+
var IconRender = ({
|
|
1363
|
+
iconName,
|
|
1364
|
+
color = "#000000",
|
|
1365
|
+
size = 24,
|
|
1366
|
+
weight = "regular"
|
|
1367
|
+
}) => {
|
|
1368
|
+
if (typeof iconName === "string") {
|
|
1369
|
+
switch (iconName) {
|
|
1370
|
+
case "Chat_PT":
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChatPT, { size, color });
|
|
1372
|
+
case "Chat_EN":
|
|
1373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChatEN, { size, color });
|
|
1374
|
+
case "Chat_ES":
|
|
1375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChatES, { size, color });
|
|
1376
|
+
default: {
|
|
1377
|
+
const IconComponent = PhosphorIcons[iconName] || PhosphorIcons.Question;
|
|
1378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconComponent, { size, color, weight });
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
} else {
|
|
1382
|
+
return (0, import_react5.cloneElement)(iconName, {
|
|
1383
|
+
size,
|
|
1384
|
+
color: "currentColor"
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
var IconRender_default = IconRender;
|
|
1389
|
+
|
|
1390
|
+
// src/types/questionTypes.ts
|
|
1391
|
+
var questionTypeLabels = {
|
|
1392
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: "Alternativa",
|
|
1393
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: "Verdadeiro ou Falso",
|
|
1394
|
+
["DISSERTATIVA" /* DISSERTATIVA */]: "Discursiva",
|
|
1395
|
+
["IMAGEM" /* IMAGEM */]: "Imagem",
|
|
1396
|
+
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: "M\xFAltipla Escolha",
|
|
1397
|
+
["LIGAR_PONTOS" /* LIGAR_PONTOS */]: "Ligar Pontos",
|
|
1398
|
+
["PREENCHER" /* PREENCHER */]: "Preencher Lacunas"
|
|
1399
|
+
};
|
|
1400
|
+
|
|
1401
|
+
// src/components/MultipleChoice/MultipleChoice.tsx
|
|
1402
|
+
var import_react6 = require("react");
|
|
1403
|
+
var import_phosphor_react4 = require("phosphor-react");
|
|
1404
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1405
|
+
var MultipleChoiceList = ({
|
|
1406
|
+
disabled = false,
|
|
1407
|
+
className = "",
|
|
1408
|
+
choices,
|
|
1409
|
+
name,
|
|
1410
|
+
selectedValues,
|
|
1411
|
+
onHandleSelectedValues,
|
|
1412
|
+
mode = "interactive"
|
|
1413
|
+
}) => {
|
|
1414
|
+
const [actualValue, setActualValue] = (0, import_react6.useState)(selectedValues);
|
|
1415
|
+
(0, import_react6.useEffect)(() => {
|
|
1416
|
+
setActualValue(selectedValues);
|
|
1417
|
+
}, [selectedValues]);
|
|
1418
|
+
const getStatusBadge = (status) => {
|
|
1419
|
+
switch (status) {
|
|
1420
|
+
case "correct":
|
|
1421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_phosphor_react4.CheckCircle, {}), children: "Resposta correta" });
|
|
1422
|
+
case "incorrect":
|
|
1423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_phosphor_react4.XCircle, {}), children: "Resposta incorreta" });
|
|
1424
|
+
default:
|
|
1425
|
+
return null;
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
const getStatusStyles = (status) => {
|
|
1429
|
+
switch (status) {
|
|
1430
|
+
case "correct":
|
|
1431
|
+
return "bg-success-background border-success-300";
|
|
1432
|
+
case "incorrect":
|
|
1433
|
+
return "bg-error-background border-error-300";
|
|
1434
|
+
default:
|
|
1435
|
+
return `bg-background border-border-100`;
|
|
1436
|
+
}
|
|
1437
|
+
};
|
|
1438
|
+
const renderVisualCheckbox = (isSelected, isDisabled) => {
|
|
1439
|
+
const checkboxClasses = cn(
|
|
1440
|
+
"w-5 h-5 rounded border-2 cursor-default transition-all duration-200 flex items-center justify-center",
|
|
1441
|
+
isSelected ? "border-primary-950 bg-primary-950 text-text" : "border-border-400 bg-background",
|
|
1442
|
+
isDisabled && "opacity-40 cursor-not-allowed"
|
|
1443
|
+
);
|
|
1444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: checkboxClasses, children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_phosphor_react4.Check, { size: 16, weight: "bold" }) });
|
|
1445
|
+
};
|
|
1446
|
+
if (mode === "readonly") {
|
|
1447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("flex flex-col gap-2", className), children: choices.map((choice, i) => {
|
|
1448
|
+
const isSelected = actualValue?.includes(choice.value) || false;
|
|
1449
|
+
const statusStyles = getStatusStyles(choice.status);
|
|
1450
|
+
const statusBadge = getStatusBadge(choice.status);
|
|
1451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1452
|
+
"div",
|
|
1453
|
+
{
|
|
1454
|
+
className: cn(
|
|
1455
|
+
"flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
|
|
1456
|
+
statusStyles,
|
|
1457
|
+
choice.disabled ? "opacity-50 cursor-not-allowed" : ""
|
|
1458
|
+
),
|
|
1459
|
+
children: [
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
1461
|
+
renderVisualCheckbox(isSelected, choice.disabled || disabled),
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1463
|
+
"span",
|
|
1464
|
+
{
|
|
1465
|
+
className: cn(
|
|
1466
|
+
"flex-1",
|
|
1467
|
+
isSelected || choice.status && choice.status != "neutral" ? "text-text-950" : "text-text-600",
|
|
1468
|
+
choice.disabled || disabled ? "cursor-not-allowed" : "cursor-default"
|
|
1469
|
+
),
|
|
1470
|
+
children: choice.label
|
|
1471
|
+
}
|
|
1472
|
+
)
|
|
1473
|
+
] }),
|
|
1474
|
+
statusBadge && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
|
|
1475
|
+
]
|
|
1476
|
+
},
|
|
1477
|
+
`readonly-${choice.value}-${i}`
|
|
1478
|
+
);
|
|
1479
|
+
}) });
|
|
1480
|
+
}
|
|
1481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1482
|
+
"div",
|
|
1483
|
+
{
|
|
1484
|
+
className: cn(
|
|
1485
|
+
"flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
|
|
1486
|
+
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
1487
|
+
className
|
|
1488
|
+
),
|
|
1489
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1490
|
+
CheckboxList_default,
|
|
1491
|
+
{
|
|
1492
|
+
name,
|
|
1493
|
+
values: actualValue,
|
|
1494
|
+
onValuesChange: (v) => {
|
|
1495
|
+
setActualValue(v);
|
|
1496
|
+
onHandleSelectedValues?.(v);
|
|
1497
|
+
},
|
|
1498
|
+
disabled,
|
|
1499
|
+
children: choices.map((choice, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1500
|
+
"div",
|
|
1501
|
+
{
|
|
1502
|
+
className: "flex flex-row gap-2 items-center",
|
|
1503
|
+
children: [
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1505
|
+
CheckboxListItem,
|
|
1506
|
+
{
|
|
1507
|
+
value: choice.value,
|
|
1508
|
+
id: `interactive-${choice.value}-${i}`,
|
|
1509
|
+
disabled: choice.disabled || disabled
|
|
1510
|
+
}
|
|
1511
|
+
),
|
|
1512
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1513
|
+
"label",
|
|
1514
|
+
{
|
|
1515
|
+
htmlFor: `interactive-${choice.value}-${i}`,
|
|
1516
|
+
className: cn(
|
|
1517
|
+
"flex-1",
|
|
1518
|
+
actualValue?.includes(choice.value) ? "text-text-950" : "text-text-600",
|
|
1519
|
+
choice.disabled || disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1520
|
+
),
|
|
1521
|
+
children: choice.label
|
|
1522
|
+
}
|
|
1523
|
+
)
|
|
1524
|
+
]
|
|
1525
|
+
},
|
|
1526
|
+
`interactive-${choice.value}-${i}`
|
|
1527
|
+
))
|
|
1528
|
+
}
|
|
1529
|
+
)
|
|
1530
|
+
}
|
|
1531
|
+
);
|
|
1532
|
+
};
|
|
1533
|
+
|
|
1534
|
+
// src/components/ActivityCardQuestionBanks/ActivityCardQuestionBanks.tsx
|
|
1535
|
+
var import_phosphor_react5 = require("phosphor-react");
|
|
1536
|
+
var import_react7 = require("react");
|
|
1537
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1538
|
+
var ActivityCardQuestionBanks = ({
|
|
1539
|
+
question,
|
|
1540
|
+
questionType,
|
|
1541
|
+
iconName = "BookOpen",
|
|
1542
|
+
subjectColor = "#000000",
|
|
1543
|
+
isDark = false,
|
|
1544
|
+
onAddToActivity,
|
|
1545
|
+
assunto,
|
|
1546
|
+
enunciado
|
|
1547
|
+
} = {}) => {
|
|
1548
|
+
const alternatives = (0, import_react7.useMemo)(() => {
|
|
1549
|
+
if (!question?.options || questionType !== "ALTERNATIVA" /* ALTERNATIVA */)
|
|
1550
|
+
return [];
|
|
1551
|
+
const correctOptionIds2 = question.correctOptionIds || [];
|
|
1552
|
+
return question.options.map((option) => {
|
|
1553
|
+
const isCorrect = correctOptionIds2.includes(option.id);
|
|
1554
|
+
return {
|
|
1555
|
+
value: option.id,
|
|
1556
|
+
label: option.option,
|
|
1557
|
+
status: isCorrect ? "correct" : void 0,
|
|
1558
|
+
disabled: !isCorrect
|
|
1559
|
+
};
|
|
1560
|
+
});
|
|
1561
|
+
}, [question, questionType]);
|
|
1562
|
+
const correctOptionId = (0, import_react7.useMemo)(() => {
|
|
1563
|
+
if (!question?.correctOptionIds || question.correctOptionIds.length === 0) {
|
|
1564
|
+
return void 0;
|
|
1565
|
+
}
|
|
1566
|
+
return question.correctOptionIds[0];
|
|
1567
|
+
}, [question]);
|
|
1568
|
+
const multipleChoices = (0, import_react7.useMemo)(() => {
|
|
1569
|
+
if (!question?.options || questionType !== "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */)
|
|
1570
|
+
return [];
|
|
1571
|
+
const correctOptionIds2 = question.correctOptionIds || [];
|
|
1572
|
+
return question.options.map((option) => {
|
|
1573
|
+
const isCorrect = correctOptionIds2.includes(option.id);
|
|
1574
|
+
return {
|
|
1575
|
+
value: option.id,
|
|
1576
|
+
label: option.option,
|
|
1577
|
+
status: isCorrect ? "correct" : void 0,
|
|
1578
|
+
disabled: !isCorrect
|
|
1579
|
+
};
|
|
1580
|
+
});
|
|
1581
|
+
}, [question, questionType]);
|
|
1582
|
+
const correctOptionIds = (0, import_react7.useMemo)(() => {
|
|
1583
|
+
return question?.correctOptionIds || [];
|
|
1584
|
+
}, [question]);
|
|
1585
|
+
const getStatusBadge = (status) => {
|
|
1586
|
+
switch (status) {
|
|
1587
|
+
case "correct":
|
|
1588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react5.CheckCircle, {}), children: "Resposta correta" });
|
|
1589
|
+
case "incorrect":
|
|
1590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react5.XCircle, {}), children: "Resposta incorreta" });
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
const getStatusStyles = (status) => {
|
|
1594
|
+
switch (status) {
|
|
1595
|
+
case "correct":
|
|
1596
|
+
return "bg-success-background border-success-300";
|
|
1597
|
+
case "incorrect":
|
|
1598
|
+
return "bg-error-background border-error-300";
|
|
1599
|
+
}
|
|
1600
|
+
};
|
|
1601
|
+
const getLetterByIndex = (index) => String.fromCodePoint(97 + index);
|
|
1602
|
+
const renderAlternative = () => {
|
|
1603
|
+
if (!question || alternatives.length === 0) return null;
|
|
1604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1605
|
+
AlternativesList,
|
|
1606
|
+
{
|
|
1607
|
+
alternatives,
|
|
1608
|
+
mode: "readonly",
|
|
1609
|
+
layout: "compact",
|
|
1610
|
+
selectedValue: correctOptionId,
|
|
1611
|
+
name: "teacher-question-view"
|
|
1612
|
+
}
|
|
1613
|
+
) });
|
|
1614
|
+
};
|
|
1615
|
+
const renderMultipleChoice = () => {
|
|
1616
|
+
if (!question || multipleChoices.length === 0) return null;
|
|
1617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1618
|
+
MultipleChoiceList,
|
|
1619
|
+
{
|
|
1620
|
+
choices: multipleChoices,
|
|
1621
|
+
mode: "readonly",
|
|
1622
|
+
selectedValues: correctOptionIds,
|
|
1623
|
+
name: "teacher-question-view-multiple"
|
|
1624
|
+
}
|
|
1625
|
+
) });
|
|
1626
|
+
};
|
|
1627
|
+
const renderDissertative = () => {
|
|
1628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "mt-4 px-2 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text_default, { size: "sm", className: "text-text-600 italic", children: "Resposta do aluno" }) });
|
|
1629
|
+
};
|
|
1630
|
+
const renderTrueOrFalse = () => {
|
|
1631
|
+
if (!question || question.options.length === 0) return null;
|
|
1632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-col gap-3.5", children: question.options.map((option, index) => {
|
|
1633
|
+
const isCorrect = correctOptionIds.includes(option.id);
|
|
1634
|
+
const correctAnswer = isCorrect ? "Verdadeiro" : "Falso";
|
|
1635
|
+
const variantCorrect = "correct";
|
|
1636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("section", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1637
|
+
"div",
|
|
1638
|
+
{
|
|
1639
|
+
className: cn(
|
|
1640
|
+
"flex flex-row justify-between items-center gap-2 p-2 rounded-md border",
|
|
1641
|
+
getStatusStyles(variantCorrect)
|
|
1642
|
+
),
|
|
1643
|
+
children: [
|
|
1644
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text_default, { size: "sm", className: "text-text-900", children: getLetterByIndex(index).concat(") ").concat(option.option) }),
|
|
1645
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-row items-center gap-2 flex-shrink-0", children: [
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text_default, { size: "sm", className: "text-text-700", children: [
|
|
1647
|
+
"Resposta correta: ",
|
|
1648
|
+
correctAnswer
|
|
1649
|
+
] }),
|
|
1650
|
+
getStatusBadge(variantCorrect)
|
|
1651
|
+
] })
|
|
1652
|
+
]
|
|
1653
|
+
}
|
|
1654
|
+
) }, option.id);
|
|
1655
|
+
}) }) });
|
|
1656
|
+
};
|
|
1657
|
+
const renderConnectDots = () => {
|
|
1658
|
+
return null;
|
|
1659
|
+
};
|
|
1660
|
+
const renderFill = () => {
|
|
1661
|
+
return null;
|
|
1662
|
+
};
|
|
1663
|
+
const renderImage = () => {
|
|
1664
|
+
return null;
|
|
1665
|
+
};
|
|
1666
|
+
const questionRenderers = {
|
|
1667
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: renderAlternative,
|
|
1668
|
+
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: renderMultipleChoice,
|
|
1669
|
+
["DISSERTATIVA" /* DISSERTATIVA */]: renderDissertative,
|
|
1670
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: renderTrueOrFalse,
|
|
1671
|
+
["LIGAR_PONTOS" /* LIGAR_PONTOS */]: renderConnectDots,
|
|
1672
|
+
["PREENCHER" /* PREENCHER */]: renderFill,
|
|
1673
|
+
["IMAGEM" /* IMAGEM */]: renderImage
|
|
1674
|
+
};
|
|
1675
|
+
const renderQuestionContent = () => {
|
|
1676
|
+
if (!questionType) return null;
|
|
1677
|
+
const renderer = questionRenderers[questionType];
|
|
1678
|
+
return renderer ? renderer() : null;
|
|
1679
|
+
};
|
|
1680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w-full flex flex-col gap-2 px-4 py-6", children: [
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "flex flex-row gap-2 text-text-650", children: [
|
|
1682
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "py-1 px-2 flex flex-row items-center gap-1", children: [
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1684
|
+
"span",
|
|
1685
|
+
{
|
|
1686
|
+
className: "size-4 rounded-sm flex items-center justify-center shrink-0 text-text-950",
|
|
1687
|
+
style: {
|
|
1688
|
+
backgroundColor: getSubjectColorWithOpacity(subjectColor, isDark)
|
|
1689
|
+
},
|
|
1690
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconRender_default, { iconName, size: 14, color: "currentColor" })
|
|
1691
|
+
}
|
|
1692
|
+
),
|
|
1693
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text_default, { size: "sm", children: assunto || "Assunto n\xE3o informado" })
|
|
1694
|
+
] }),
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "py-1 px-2 flex flex-row items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text_default, { size: "sm", className: "", children: questionType ? questionTypeLabels[questionType] : "Tipo de quest\xE3o" }) })
|
|
1696
|
+
] }),
|
|
1697
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "flex flex-col gap-1", children: [
|
|
1698
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text_default, { size: "md", weight: "medium", className: "text-text-950 text-md", children: enunciado || "Enunciado n\xE3o informado" }),
|
|
1699
|
+
renderQuestionContent()
|
|
1700
|
+
] }),
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("section", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1702
|
+
Button_default,
|
|
1703
|
+
{
|
|
1704
|
+
size: "small",
|
|
1705
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react5.Plus, {}),
|
|
1706
|
+
className: "w-full",
|
|
1707
|
+
onClick: onAddToActivity,
|
|
1708
|
+
children: "Adicionar \xE0 atividade"
|
|
1709
|
+
}
|
|
1710
|
+
) })
|
|
1711
|
+
] });
|
|
1712
|
+
};
|
|
1713
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1714
|
+
0 && (module.exports = {
|
|
1715
|
+
ActivityCardQuestionBanks
|
|
1716
|
+
});
|
|
1717
|
+
//# sourceMappingURL=index.js.map
|