analytica-frontend-lib 1.2.24 → 1.2.25
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/Accordation/index.js.map +1 -1
- package/dist/Accordation/index.mjs.map +1 -1
- package/dist/ActivityFilters/index.css +19181 -0
- package/dist/ActivityFilters/index.css.map +1 -0
- package/dist/ActivityFilters/index.d.mts +5 -0
- package/dist/ActivityFilters/index.d.ts +5 -0
- package/dist/ActivityFilters/index.js +4902 -0
- package/dist/ActivityFilters/index.js.map +1 -0
- package/dist/ActivityFilters/index.mjs +4917 -0
- package/dist/ActivityFilters/index.mjs.map +1 -0
- package/dist/ActivityFilters-Cs3TpGAY.d.ts +97 -0
- package/dist/ActivityFilters-CsX8y41f.d.mts +97 -0
- package/dist/Alert/index.js.map +1 -1
- package/dist/Alert/index.mjs.map +1 -1
- package/dist/AlertDialog/index.js.map +1 -1
- package/dist/AlertDialog/index.mjs.map +1 -1
- package/dist/AlertManager/index.css +15 -0
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/AlertManager/index.js.map +1 -1
- package/dist/AlertManager/index.mjs.map +1 -1
- package/dist/AlertManagerView/index.js.map +1 -1
- package/dist/AlertManagerView/index.mjs.map +1 -1
- package/dist/Alternative/index.js.map +1 -1
- package/dist/Alternative/index.mjs.map +1 -1
- package/dist/Badge/index.js.map +1 -1
- package/dist/Badge/index.mjs.map +1 -1
- package/dist/BreadcrumbMenu/index.js.map +1 -1
- package/dist/BreadcrumbMenu/index.mjs.map +1 -1
- package/dist/Button/index.js.map +1 -1
- package/dist/Button/index.mjs.map +1 -1
- package/dist/Calendar/index.js.map +1 -1
- package/dist/Calendar/index.mjs.map +1 -1
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs.map +1 -1
- package/dist/CheckBox/index.d.mts +1 -1
- package/dist/CheckBox/index.d.ts +1 -1
- package/dist/CheckBox/index.js.map +1 -1
- package/dist/CheckBox/index.mjs.map +1 -1
- package/dist/Chips/index.js.map +1 -1
- package/dist/Chips/index.mjs.map +1 -1
- package/dist/Divider/index.js.map +1 -1
- package/dist/Divider/index.mjs.map +1 -1
- package/dist/DownloadButton/index.js.map +1 -1
- package/dist/DownloadButton/index.mjs.map +1 -1
- package/dist/DropdownMenu/index.js.map +1 -1
- package/dist/DropdownMenu/index.mjs.map +1 -1
- package/dist/EmptyState/index.js.map +1 -1
- package/dist/EmptyState/index.mjs.map +1 -1
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButton/index.mjs.map +1 -1
- package/dist/IconRoundedButton/index.js.map +1 -1
- package/dist/IconRoundedButton/index.mjs.map +1 -1
- package/dist/LatexRenderer/index.js.map +1 -1
- package/dist/LatexRenderer/index.mjs.map +1 -1
- package/dist/Menu/index.js.map +1 -1
- package/dist/Menu/index.mjs.map +1 -1
- package/dist/Modal/index.js.map +1 -1
- package/dist/Modal/index.mjs.map +1 -1
- package/dist/MultipleChoice/index.js.map +1 -1
- package/dist/MultipleChoice/index.mjs.map +1 -1
- package/dist/NavButton/index.js.map +1 -1
- package/dist/NavButton/index.mjs.map +1 -1
- package/dist/NoSearchResult/index.js.map +1 -1
- package/dist/NoSearchResult/index.mjs.map +1 -1
- package/dist/NotFound/index.js.map +1 -1
- package/dist/NotFound/index.mjs.map +1 -1
- package/dist/NotificationCard/index.js.map +1 -1
- package/dist/NotificationCard/index.mjs.map +1 -1
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/ProgressBar/index.mjs.map +1 -1
- package/dist/ProgressCircle/index.js.map +1 -1
- package/dist/ProgressCircle/index.mjs.map +1 -1
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/Radio/index.d.mts +2 -2
- package/dist/Radio/index.d.ts +2 -2
- package/dist/Radio/index.js.map +1 -1
- package/dist/Radio/index.mjs.map +1 -1
- package/dist/Search/index.d.mts +1 -1
- package/dist/Search/index.d.ts +1 -1
- package/dist/Search/index.js.map +1 -1
- package/dist/Search/index.mjs.map +1 -1
- package/dist/Select/index.js.map +1 -1
- package/dist/Select/index.mjs.map +1 -1
- package/dist/SelectionButton/index.js.map +1 -1
- package/dist/SelectionButton/index.mjs.map +1 -1
- package/dist/Skeleton/index.js.map +1 -1
- package/dist/Skeleton/index.mjs.map +1 -1
- package/dist/StatisticsCard/index.js.map +1 -1
- package/dist/StatisticsCard/index.mjs.map +1 -1
- package/dist/Stepper/index.js.map +1 -1
- package/dist/Stepper/index.mjs.map +1 -1
- package/dist/Table/TablePagination/index.js.map +1 -1
- package/dist/Table/TablePagination/index.mjs.map +1 -1
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/index.mjs.map +1 -1
- package/dist/TableProvider/index.css +15 -0
- package/dist/TableProvider/index.css.map +1 -1
- package/dist/TableProvider/index.js.map +1 -1
- package/dist/TableProvider/index.mjs.map +1 -1
- package/dist/Text/index.js.map +1 -1
- package/dist/Text/index.mjs.map +1 -1
- package/dist/TextArea/index.js.map +1 -1
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/ThemeToggle/index.js.map +1 -1
- package/dist/ThemeToggle/index.mjs.map +1 -1
- package/dist/Toast/Toaster/index.js.map +1 -1
- package/dist/Toast/Toaster/index.mjs.map +1 -1
- package/dist/Toast/index.js.map +1 -1
- package/dist/Toast/index.mjs.map +1 -1
- package/dist/VideoPlayer/index.js.map +1 -1
- package/dist/VideoPlayer/index.mjs.map +1 -1
- package/dist/Whiteboard/index.js.map +1 -1
- package/dist/Whiteboard/index.mjs.map +1 -1
- package/dist/index.css +15 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +5860 -5475
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5883 -5504
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +15 -0
- package/dist/styles.css.map +1 -1
- package/dist/utils/index.d.mts +25 -1
- package/dist/utils/index.d.ts +25 -1
- package/dist/utils/index.js +24 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +20 -1
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,4902 @@
|
|
|
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/ActivityFilters/ActivityFilters.tsx
|
|
31
|
+
var ActivityFilters_exports = {};
|
|
32
|
+
__export(ActivityFilters_exports, {
|
|
33
|
+
ActivityFilters: () => ActivityFilters,
|
|
34
|
+
ActivityFiltersPopover: () => ActivityFiltersPopover
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(ActivityFilters_exports);
|
|
37
|
+
var import_react13 = require("react");
|
|
38
|
+
|
|
39
|
+
// src/utils/utils.ts
|
|
40
|
+
var import_clsx = require("clsx");
|
|
41
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
42
|
+
|
|
43
|
+
// src/utils/activityFilters.ts
|
|
44
|
+
function getSelectedIdsFromCategories(categories, keys) {
|
|
45
|
+
const result = {};
|
|
46
|
+
for (const [outputKey, categoryKey] of Object.entries(keys)) {
|
|
47
|
+
const category = categories.find((c) => c.key === categoryKey);
|
|
48
|
+
result[outputKey] = category?.selectedIds || [];
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
function toggleArrayItem(array, item) {
|
|
53
|
+
return array.includes(item) ? array.filter((i) => i !== item) : [...array, item];
|
|
54
|
+
}
|
|
55
|
+
function toggleSingleValue(currentValue, newValue) {
|
|
56
|
+
return currentValue === newValue ? null : newValue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/utils/utils.ts
|
|
60
|
+
function cn(...inputs) {
|
|
61
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
62
|
+
}
|
|
63
|
+
function getSubjectColorWithOpacity(hexColor, isDark) {
|
|
64
|
+
if (!hexColor) return void 0;
|
|
65
|
+
let color = hexColor.replace(/^#/, "").toLowerCase();
|
|
66
|
+
if (isDark) {
|
|
67
|
+
if (color.length === 8) {
|
|
68
|
+
color = color.slice(0, 6);
|
|
69
|
+
}
|
|
70
|
+
return `#${color}`;
|
|
71
|
+
} else {
|
|
72
|
+
let resultColor;
|
|
73
|
+
if (color.length === 6) {
|
|
74
|
+
resultColor = `#${color}4d`;
|
|
75
|
+
} else if (color.length === 8) {
|
|
76
|
+
resultColor = `#${color}`;
|
|
77
|
+
} else {
|
|
78
|
+
resultColor = `#${color}`;
|
|
79
|
+
}
|
|
80
|
+
return resultColor;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// src/components/Text/Text.tsx
|
|
85
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
86
|
+
var Text = ({
|
|
87
|
+
children,
|
|
88
|
+
size = "md",
|
|
89
|
+
weight = "normal",
|
|
90
|
+
color = "text-text-950",
|
|
91
|
+
as,
|
|
92
|
+
className = "",
|
|
93
|
+
...props
|
|
94
|
+
}) => {
|
|
95
|
+
let sizeClasses = "";
|
|
96
|
+
let weightClasses = "";
|
|
97
|
+
const sizeClassMap = {
|
|
98
|
+
"2xs": "text-2xs",
|
|
99
|
+
xs: "text-xs",
|
|
100
|
+
sm: "text-sm",
|
|
101
|
+
md: "text-md",
|
|
102
|
+
lg: "text-lg",
|
|
103
|
+
xl: "text-xl",
|
|
104
|
+
"2xl": "text-2xl",
|
|
105
|
+
"3xl": "text-3xl",
|
|
106
|
+
"4xl": "text-4xl",
|
|
107
|
+
"5xl": "text-5xl",
|
|
108
|
+
"6xl": "text-6xl"
|
|
109
|
+
};
|
|
110
|
+
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
111
|
+
const weightClassMap = {
|
|
112
|
+
hairline: "font-hairline",
|
|
113
|
+
light: "font-light",
|
|
114
|
+
normal: "font-normal",
|
|
115
|
+
medium: "font-medium",
|
|
116
|
+
semibold: "font-semibold",
|
|
117
|
+
bold: "font-bold",
|
|
118
|
+
extrabold: "font-extrabold",
|
|
119
|
+
black: "font-black"
|
|
120
|
+
};
|
|
121
|
+
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
122
|
+
const baseClasses = "font-primary";
|
|
123
|
+
const Component = as ?? "p";
|
|
124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
125
|
+
Component,
|
|
126
|
+
{
|
|
127
|
+
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
128
|
+
...props,
|
|
129
|
+
children
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
var Text_default = Text;
|
|
134
|
+
|
|
135
|
+
// src/components/Button/Button.tsx
|
|
136
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
137
|
+
var VARIANT_ACTION_CLASSES = {
|
|
138
|
+
solid: {
|
|
139
|
+
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",
|
|
140
|
+
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",
|
|
141
|
+
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"
|
|
142
|
+
},
|
|
143
|
+
outline: {
|
|
144
|
+
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",
|
|
145
|
+
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",
|
|
146
|
+
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"
|
|
147
|
+
},
|
|
148
|
+
link: {
|
|
149
|
+
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",
|
|
150
|
+
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",
|
|
151
|
+
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"
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
var SIZE_CLASSES = {
|
|
155
|
+
"extra-small": "text-xs px-3.5 py-2",
|
|
156
|
+
small: "text-sm px-4 py-2.5",
|
|
157
|
+
medium: "text-md px-5 py-2.5",
|
|
158
|
+
large: "text-lg px-6 py-3",
|
|
159
|
+
"extra-large": "text-lg px-7 py-3.5"
|
|
160
|
+
};
|
|
161
|
+
var Button = ({
|
|
162
|
+
children,
|
|
163
|
+
iconLeft,
|
|
164
|
+
iconRight,
|
|
165
|
+
size = "medium",
|
|
166
|
+
variant = "solid",
|
|
167
|
+
action = "primary",
|
|
168
|
+
className = "",
|
|
169
|
+
disabled,
|
|
170
|
+
type = "button",
|
|
171
|
+
...props
|
|
172
|
+
}) => {
|
|
173
|
+
const sizeClasses = SIZE_CLASSES[size];
|
|
174
|
+
const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
|
|
175
|
+
const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
|
|
176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
177
|
+
"button",
|
|
178
|
+
{
|
|
179
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
180
|
+
disabled,
|
|
181
|
+
type,
|
|
182
|
+
...props,
|
|
183
|
+
children: [
|
|
184
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mr-2 flex items-center", children: iconLeft }),
|
|
185
|
+
children,
|
|
186
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ml-2 flex items-center", children: iconRight })
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
var Button_default = Button;
|
|
192
|
+
|
|
193
|
+
// src/components/Badge/Badge.tsx
|
|
194
|
+
var import_phosphor_react = require("phosphor-react");
|
|
195
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
196
|
+
var VARIANT_ACTION_CLASSES2 = {
|
|
197
|
+
solid: {
|
|
198
|
+
error: "bg-error-background text-error-700 focus-visible:outline-none",
|
|
199
|
+
warning: "bg-warning text-warning-800 focus-visible:outline-none",
|
|
200
|
+
success: "bg-success text-success-800 focus-visible:outline-none",
|
|
201
|
+
info: "bg-info text-info-800 focus-visible:outline-none",
|
|
202
|
+
muted: "bg-background-muted text-background-800 focus-visible:outline-none"
|
|
203
|
+
},
|
|
204
|
+
outlined: {
|
|
205
|
+
error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
|
|
206
|
+
warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
|
|
207
|
+
success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
|
|
208
|
+
info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
|
|
209
|
+
muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
|
|
210
|
+
},
|
|
211
|
+
exams: {
|
|
212
|
+
exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
|
|
213
|
+
exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
|
|
214
|
+
exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
|
|
215
|
+
exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
|
|
216
|
+
},
|
|
217
|
+
examsOutlined: {
|
|
218
|
+
exam1: "bg-exam-1 text-info-700 border border-info-700 focus-visible:outline-none",
|
|
219
|
+
exam2: "bg-exam-2 text-typography-1 border border-typography-1 focus-visible:outline-none",
|
|
220
|
+
exam3: "bg-exam-3 text-typography-2 border border-typography-2 focus-visible:outline-none",
|
|
221
|
+
exam4: "bg-exam-4 text-success-700 border border-success-700 focus-visible:outline-none"
|
|
222
|
+
},
|
|
223
|
+
resultStatus: {
|
|
224
|
+
negative: "bg-error text-error-800 focus-visible:outline-none",
|
|
225
|
+
positive: "bg-success text-success-800 focus-visible:outline-none"
|
|
226
|
+
},
|
|
227
|
+
notification: "text-primary"
|
|
228
|
+
};
|
|
229
|
+
var SIZE_CLASSES2 = {
|
|
230
|
+
small: "text-2xs px-2 py-1",
|
|
231
|
+
medium: "text-xs px-2 py-1",
|
|
232
|
+
large: "text-sm px-2 py-1"
|
|
233
|
+
};
|
|
234
|
+
var SIZE_CLASSES_ICON = {
|
|
235
|
+
small: "size-3",
|
|
236
|
+
medium: "size-3.5",
|
|
237
|
+
large: "size-4"
|
|
238
|
+
};
|
|
239
|
+
var Badge = ({
|
|
240
|
+
children,
|
|
241
|
+
iconLeft,
|
|
242
|
+
iconRight,
|
|
243
|
+
size = "medium",
|
|
244
|
+
variant = "solid",
|
|
245
|
+
action = "error",
|
|
246
|
+
className = "",
|
|
247
|
+
notificationActive = false,
|
|
248
|
+
...props
|
|
249
|
+
}) => {
|
|
250
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
251
|
+
const sizeClassesIcon = SIZE_CLASSES_ICON[size];
|
|
252
|
+
const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
|
|
253
|
+
const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
|
|
254
|
+
const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
|
|
255
|
+
const baseClassesIcon = "flex items-center";
|
|
256
|
+
if (variant === "notification") {
|
|
257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
258
|
+
"div",
|
|
259
|
+
{
|
|
260
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
261
|
+
...props,
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
|
|
264
|
+
notificationActive && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
265
|
+
"span",
|
|
266
|
+
{
|
|
267
|
+
"data-testid": "notification-dot",
|
|
268
|
+
className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
|
|
269
|
+
}
|
|
270
|
+
)
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
276
|
+
"div",
|
|
277
|
+
{
|
|
278
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
279
|
+
...props,
|
|
280
|
+
children: [
|
|
281
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
|
|
282
|
+
children,
|
|
283
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
};
|
|
288
|
+
var Badge_default = Badge;
|
|
289
|
+
|
|
290
|
+
// src/components/SelectionButton/SelectionButton.tsx
|
|
291
|
+
var import_react = require("react");
|
|
292
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
293
|
+
var SelectionButton = (0, import_react.forwardRef)(
|
|
294
|
+
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
295
|
+
const baseClasses = [
|
|
296
|
+
"inline-flex",
|
|
297
|
+
"items-center",
|
|
298
|
+
"justify-start",
|
|
299
|
+
"gap-2",
|
|
300
|
+
"p-4",
|
|
301
|
+
"rounded-xl",
|
|
302
|
+
"cursor-pointer",
|
|
303
|
+
"border",
|
|
304
|
+
"border-border-50",
|
|
305
|
+
"bg-background",
|
|
306
|
+
"text-sm",
|
|
307
|
+
"text-text-700",
|
|
308
|
+
"font-bold",
|
|
309
|
+
"shadow-soft-shadow-1",
|
|
310
|
+
"hover:bg-background-100",
|
|
311
|
+
"focus-visible:outline-none",
|
|
312
|
+
"focus-visible:ring-2",
|
|
313
|
+
"focus-visible:ring-indicator-info",
|
|
314
|
+
"focus-visible:ring-offset-0",
|
|
315
|
+
"focus-visible:shadow-none",
|
|
316
|
+
"active:ring-2",
|
|
317
|
+
"active:ring-primary-950",
|
|
318
|
+
"active:ring-offset-0",
|
|
319
|
+
"active:shadow-none",
|
|
320
|
+
"disabled:opacity-50",
|
|
321
|
+
"disabled:cursor-not-allowed"
|
|
322
|
+
];
|
|
323
|
+
const stateClasses = selected ? ["ring-primary-950", "ring-2", "ring-offset-0", "shadow-none"] : [];
|
|
324
|
+
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
326
|
+
"button",
|
|
327
|
+
{
|
|
328
|
+
ref,
|
|
329
|
+
type: "button",
|
|
330
|
+
className: cn(allClasses, className),
|
|
331
|
+
disabled,
|
|
332
|
+
"aria-pressed": selected,
|
|
333
|
+
...props,
|
|
334
|
+
children: [
|
|
335
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "flex items-center justify-center w-6 h-6", children: icon }),
|
|
336
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: label })
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
SelectionButton.displayName = "SelectionButton";
|
|
343
|
+
var SelectionButton_default = SelectionButton;
|
|
344
|
+
|
|
345
|
+
// src/components/CheckBox/CheckBox.tsx
|
|
346
|
+
var import_react2 = require("react");
|
|
347
|
+
var import_phosphor_react2 = require("phosphor-react");
|
|
348
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
349
|
+
var SIZE_CLASSES3 = {
|
|
350
|
+
small: {
|
|
351
|
+
checkbox: "w-4 h-4",
|
|
352
|
+
// 16px x 16px
|
|
353
|
+
textSize: "sm",
|
|
354
|
+
spacing: "gap-1.5",
|
|
355
|
+
// 6px
|
|
356
|
+
borderWidth: "border-2",
|
|
357
|
+
iconSize: 14,
|
|
358
|
+
// pixels for Phosphor icons
|
|
359
|
+
labelHeight: "h-[21px]"
|
|
360
|
+
},
|
|
361
|
+
medium: {
|
|
362
|
+
checkbox: "w-5 h-5",
|
|
363
|
+
// 20px x 20px
|
|
364
|
+
textSize: "md",
|
|
365
|
+
spacing: "gap-2",
|
|
366
|
+
// 8px
|
|
367
|
+
borderWidth: "border-2",
|
|
368
|
+
iconSize: 16,
|
|
369
|
+
// pixels for Phosphor icons
|
|
370
|
+
labelHeight: "h-6"
|
|
371
|
+
},
|
|
372
|
+
large: {
|
|
373
|
+
checkbox: "w-6 h-6",
|
|
374
|
+
// 24px x 24px
|
|
375
|
+
textSize: "lg",
|
|
376
|
+
spacing: "gap-2",
|
|
377
|
+
// 8px
|
|
378
|
+
borderWidth: "border-[3px]",
|
|
379
|
+
// 3px border
|
|
380
|
+
iconSize: 20,
|
|
381
|
+
// pixels for Phosphor icons
|
|
382
|
+
labelHeight: "h-[27px]"
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
386
|
+
var STATE_CLASSES = {
|
|
387
|
+
default: {
|
|
388
|
+
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
389
|
+
checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
|
|
390
|
+
},
|
|
391
|
+
hovered: {
|
|
392
|
+
unchecked: "border-border-500 bg-background",
|
|
393
|
+
checked: "border-primary-800 bg-primary-800 text-text"
|
|
394
|
+
},
|
|
395
|
+
focused: {
|
|
396
|
+
unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
|
|
397
|
+
checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
|
|
398
|
+
},
|
|
399
|
+
invalid: {
|
|
400
|
+
unchecked: "border-error-700 bg-background hover:border-error-600",
|
|
401
|
+
checked: "border-error-700 bg-primary-950 text-text"
|
|
402
|
+
},
|
|
403
|
+
disabled: {
|
|
404
|
+
unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
|
|
405
|
+
checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
var CheckBox = (0, import_react2.forwardRef)(
|
|
409
|
+
({
|
|
410
|
+
label,
|
|
411
|
+
size = "medium",
|
|
412
|
+
state = "default",
|
|
413
|
+
indeterminate = false,
|
|
414
|
+
errorMessage,
|
|
415
|
+
helperText,
|
|
416
|
+
className = "",
|
|
417
|
+
labelClassName = "",
|
|
418
|
+
checked: checkedProp,
|
|
419
|
+
disabled,
|
|
420
|
+
id,
|
|
421
|
+
onChange,
|
|
422
|
+
...props
|
|
423
|
+
}, ref) => {
|
|
424
|
+
const generatedId = (0, import_react2.useId)();
|
|
425
|
+
const inputId = id ?? `checkbox-${generatedId}`;
|
|
426
|
+
const [internalChecked, setInternalChecked] = (0, import_react2.useState)(false);
|
|
427
|
+
const isControlled = checkedProp !== void 0;
|
|
428
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
429
|
+
const handleChange = (event) => {
|
|
430
|
+
if (!isControlled) {
|
|
431
|
+
setInternalChecked(event.target.checked);
|
|
432
|
+
}
|
|
433
|
+
onChange?.(event);
|
|
434
|
+
};
|
|
435
|
+
const currentState = disabled ? "disabled" : state;
|
|
436
|
+
const sizeClasses = SIZE_CLASSES3[size];
|
|
437
|
+
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
438
|
+
const stylingClasses = STATE_CLASSES[currentState][checkVariant];
|
|
439
|
+
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
440
|
+
const checkboxClasses = cn(
|
|
441
|
+
BASE_CHECKBOX_CLASSES,
|
|
442
|
+
sizeClasses.checkbox,
|
|
443
|
+
borderWidthClass,
|
|
444
|
+
stylingClasses,
|
|
445
|
+
className
|
|
446
|
+
);
|
|
447
|
+
const renderIcon = () => {
|
|
448
|
+
if (indeterminate) {
|
|
449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
450
|
+
import_phosphor_react2.Minus,
|
|
451
|
+
{
|
|
452
|
+
size: sizeClasses.iconSize,
|
|
453
|
+
weight: "bold",
|
|
454
|
+
color: "currentColor"
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
if (checked) {
|
|
459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
460
|
+
import_phosphor_react2.Check,
|
|
461
|
+
{
|
|
462
|
+
size: sizeClasses.iconSize,
|
|
463
|
+
weight: "bold",
|
|
464
|
+
color: "currentColor"
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
return null;
|
|
469
|
+
};
|
|
470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col", children: [
|
|
471
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
472
|
+
"div",
|
|
473
|
+
{
|
|
474
|
+
className: cn(
|
|
475
|
+
"flex flex-row items-center",
|
|
476
|
+
sizeClasses.spacing,
|
|
477
|
+
disabled ? "opacity-40" : ""
|
|
478
|
+
),
|
|
479
|
+
children: [
|
|
480
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
481
|
+
"input",
|
|
482
|
+
{
|
|
483
|
+
ref,
|
|
484
|
+
type: "checkbox",
|
|
485
|
+
id: inputId,
|
|
486
|
+
checked,
|
|
487
|
+
disabled,
|
|
488
|
+
onChange: handleChange,
|
|
489
|
+
className: "sr-only",
|
|
490
|
+
...props
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
494
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
495
|
+
"div",
|
|
496
|
+
{
|
|
497
|
+
className: cn(
|
|
498
|
+
"flex flex-row items-center",
|
|
499
|
+
sizeClasses.labelHeight
|
|
500
|
+
),
|
|
501
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
502
|
+
Text_default,
|
|
503
|
+
{
|
|
504
|
+
as: "label",
|
|
505
|
+
htmlFor: inputId,
|
|
506
|
+
size: sizeClasses.textSize,
|
|
507
|
+
weight: "normal",
|
|
508
|
+
className: cn(
|
|
509
|
+
"cursor-pointer select-none leading-[150%] flex items-center font-roboto",
|
|
510
|
+
labelClassName
|
|
511
|
+
),
|
|
512
|
+
children: label
|
|
513
|
+
}
|
|
514
|
+
)
|
|
515
|
+
}
|
|
516
|
+
)
|
|
517
|
+
]
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
521
|
+
Text_default,
|
|
522
|
+
{
|
|
523
|
+
size: "sm",
|
|
524
|
+
weight: "normal",
|
|
525
|
+
className: "mt-1.5",
|
|
526
|
+
color: "text-error-600",
|
|
527
|
+
children: errorMessage
|
|
528
|
+
}
|
|
529
|
+
),
|
|
530
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
531
|
+
Text_default,
|
|
532
|
+
{
|
|
533
|
+
size: "sm",
|
|
534
|
+
weight: "normal",
|
|
535
|
+
className: "mt-1.5",
|
|
536
|
+
color: "text-text-500",
|
|
537
|
+
children: helperText
|
|
538
|
+
}
|
|
539
|
+
)
|
|
540
|
+
] });
|
|
541
|
+
}
|
|
542
|
+
);
|
|
543
|
+
CheckBox.displayName = "CheckBox";
|
|
544
|
+
var CheckBox_default = CheckBox;
|
|
545
|
+
|
|
546
|
+
// src/components/CheckBoxGroup/CheckBoxGroup.tsx
|
|
547
|
+
var import_react3 = require("react");
|
|
548
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
549
|
+
var CheckboxGroup = ({
|
|
550
|
+
categories,
|
|
551
|
+
onCategoriesChange
|
|
552
|
+
}) => {
|
|
553
|
+
const [openAccordion, setOpenAccordion] = (0, import_react3.useState)("");
|
|
554
|
+
const autoSelectionAppliedRef = (0, import_react3.useRef)(false);
|
|
555
|
+
const onCategoriesChangeRef = (0, import_react3.useRef)(onCategoriesChange);
|
|
556
|
+
const previousCategoriesRef = (0, import_react3.useRef)(categories);
|
|
557
|
+
(0, import_react3.useEffect)(() => {
|
|
558
|
+
onCategoriesChangeRef.current = onCategoriesChange;
|
|
559
|
+
}, [onCategoriesChange]);
|
|
560
|
+
const areSelectedIdsEqual = (ids1, ids2) => {
|
|
561
|
+
if (ids1 === ids2) return true;
|
|
562
|
+
if (!ids1 || !ids2) return ids1 === ids2;
|
|
563
|
+
if (ids1.length !== ids2.length) return false;
|
|
564
|
+
for (let i = 0; i < ids1.length; i++) {
|
|
565
|
+
if (ids1[i] !== ids2[i]) return false;
|
|
566
|
+
}
|
|
567
|
+
return true;
|
|
568
|
+
};
|
|
569
|
+
const categoriesWithAutoSelection = (0, import_react3.useMemo)(() => {
|
|
570
|
+
return categories.map((category) => {
|
|
571
|
+
if (category.itens?.length === 1 && (!category.selectedIds || category.selectedIds.length === 0)) {
|
|
572
|
+
return {
|
|
573
|
+
...category,
|
|
574
|
+
selectedIds: [category.itens[0].id]
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
return category;
|
|
578
|
+
});
|
|
579
|
+
}, [categories]);
|
|
580
|
+
(0, import_react3.useEffect)(() => {
|
|
581
|
+
const categoriesChanged = categories !== previousCategoriesRef.current;
|
|
582
|
+
if (!categoriesChanged && autoSelectionAppliedRef.current) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
previousCategoriesRef.current = categories;
|
|
586
|
+
const hasAutoSelectionChanges = categoriesWithAutoSelection.some(
|
|
587
|
+
(cat, index) => {
|
|
588
|
+
const originalCat = categories[index];
|
|
589
|
+
return !areSelectedIdsEqual(cat.selectedIds, originalCat.selectedIds);
|
|
590
|
+
}
|
|
591
|
+
);
|
|
592
|
+
if (hasAutoSelectionChanges) {
|
|
593
|
+
autoSelectionAppliedRef.current = true;
|
|
594
|
+
onCategoriesChangeRef.current(categoriesWithAutoSelection);
|
|
595
|
+
} else if (categoriesChanged) {
|
|
596
|
+
autoSelectionAppliedRef.current = false;
|
|
597
|
+
}
|
|
598
|
+
}, [categoriesWithAutoSelection, categories]);
|
|
599
|
+
const isCheckBoxIsSelected = (categoryKey, itemId) => {
|
|
600
|
+
const category = categories.find((c) => c.key === categoryKey);
|
|
601
|
+
if (!category) return false;
|
|
602
|
+
return category.selectedIds?.includes(itemId) || false;
|
|
603
|
+
};
|
|
604
|
+
const isMinimalOneCheckBoxIsSelected = (categoryKey) => {
|
|
605
|
+
const category = categories.find((c) => c.key === categoryKey);
|
|
606
|
+
if (!category) return false;
|
|
607
|
+
const formattedItems = getFormattedItems(categoryKey);
|
|
608
|
+
const filteredItems = formattedItems.flatMap((group) => group.itens || []);
|
|
609
|
+
const filteredItemIds = filteredItems.map((item) => item.id);
|
|
610
|
+
return filteredItemIds.some(
|
|
611
|
+
(itemId) => category.selectedIds?.includes(itemId)
|
|
612
|
+
);
|
|
613
|
+
};
|
|
614
|
+
const createCombinations = (acc, currentArray) => {
|
|
615
|
+
const combinations = [];
|
|
616
|
+
for (const existingCombo of acc) {
|
|
617
|
+
for (const item of currentArray) {
|
|
618
|
+
combinations.push([...existingCombo, item]);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return combinations;
|
|
622
|
+
};
|
|
623
|
+
const cartesian = (arr) => {
|
|
624
|
+
return arr.reduce(createCombinations, [[]]);
|
|
625
|
+
};
|
|
626
|
+
const getSelectedIdsForFilters = (filters) => {
|
|
627
|
+
return filters.map((f) => {
|
|
628
|
+
const parentCat = categories.find((c) => c.key === f.key);
|
|
629
|
+
if (!parentCat?.selectedIds?.length) {
|
|
630
|
+
return [];
|
|
631
|
+
}
|
|
632
|
+
return parentCat.selectedIds;
|
|
633
|
+
});
|
|
634
|
+
};
|
|
635
|
+
const generateSingleFilterLabel = (filter, comboId) => {
|
|
636
|
+
const cat = categories.find((c) => c.key === filter.key);
|
|
637
|
+
return cat?.itens?.find((i) => i.id === comboId)?.name || comboId;
|
|
638
|
+
};
|
|
639
|
+
const generateMultipleFiltersLabel = (filters, comboIds) => {
|
|
640
|
+
const firstCat = categories.find((c) => c.key === filters[0].key);
|
|
641
|
+
const firstVal = firstCat?.itens?.find((i) => i.id === comboIds[0])?.name || comboIds[0];
|
|
642
|
+
const labelParts = [firstVal];
|
|
643
|
+
for (let idx = 1; idx < filters.length; idx++) {
|
|
644
|
+
const f = filters[idx];
|
|
645
|
+
const cat = categories.find((c) => c.key === f.key);
|
|
646
|
+
const val = cat?.itens?.find((i) => i.id === comboIds[idx])?.name || comboIds[idx];
|
|
647
|
+
labelParts.push(`(${val})`);
|
|
648
|
+
}
|
|
649
|
+
return labelParts.join(" ");
|
|
650
|
+
};
|
|
651
|
+
const processCombination = (comboIds, filters, category, groupedMap) => {
|
|
652
|
+
const filteredItems = (category?.itens || []).filter(
|
|
653
|
+
(item) => filters.every((f, idx) => item[f.internalField] === comboIds[idx])
|
|
654
|
+
);
|
|
655
|
+
if (filteredItems.length === 0) return;
|
|
656
|
+
let groupLabel = void 0;
|
|
657
|
+
if (filters.length === 1) {
|
|
658
|
+
groupLabel = generateSingleFilterLabel(filters[0], comboIds[0]);
|
|
659
|
+
} else if (filters.length > 1) {
|
|
660
|
+
groupLabel = generateMultipleFiltersLabel(filters, comboIds);
|
|
661
|
+
}
|
|
662
|
+
const key = groupLabel || "";
|
|
663
|
+
if (!groupedMap[key]) {
|
|
664
|
+
groupedMap[key] = groupLabel ? { groupLabel, itens: [] } : { itens: [] };
|
|
665
|
+
}
|
|
666
|
+
groupedMap[key].itens.push(...filteredItems);
|
|
667
|
+
};
|
|
668
|
+
const calculateFormattedItems = (categoryKey) => {
|
|
669
|
+
const category = categories.find((c) => c.key === categoryKey);
|
|
670
|
+
if (!category?.dependsOn || category.dependsOn.length === 0) {
|
|
671
|
+
return [{ itens: category?.itens || [] }];
|
|
672
|
+
}
|
|
673
|
+
const isEnabled = category.dependsOn.every((depKey) => {
|
|
674
|
+
const depCat = categories.find((c) => c.key === depKey);
|
|
675
|
+
return depCat?.selectedIds && depCat.selectedIds.length > 0;
|
|
676
|
+
});
|
|
677
|
+
if (!isEnabled) {
|
|
678
|
+
return [{ itens: [] }];
|
|
679
|
+
}
|
|
680
|
+
const filters = category.filteredBy || [];
|
|
681
|
+
if (filters.length === 0) {
|
|
682
|
+
return [{ itens: category?.itens || [] }];
|
|
683
|
+
}
|
|
684
|
+
const selectedIdsArr = getSelectedIdsForFilters(filters);
|
|
685
|
+
if (selectedIdsArr.some((arr) => arr.length === 0)) {
|
|
686
|
+
return [{ itens: [] }];
|
|
687
|
+
}
|
|
688
|
+
const combinations = cartesian(selectedIdsArr);
|
|
689
|
+
const groupedMap = {};
|
|
690
|
+
for (const comboIds of combinations) {
|
|
691
|
+
processCombination(comboIds, filters, category, groupedMap);
|
|
692
|
+
}
|
|
693
|
+
const groupedItems = Object.values(groupedMap).filter(
|
|
694
|
+
(g) => g.itens.length
|
|
695
|
+
);
|
|
696
|
+
return groupedItems.length ? groupedItems : [{ itens: [] }];
|
|
697
|
+
};
|
|
698
|
+
const formattedItemsMap = (0, import_react3.useMemo)(() => {
|
|
699
|
+
const formattedItemsMap2 = {};
|
|
700
|
+
for (const category of categories) {
|
|
701
|
+
const formattedItems = calculateFormattedItems(category.key);
|
|
702
|
+
formattedItemsMap2[category.key] = formattedItems;
|
|
703
|
+
}
|
|
704
|
+
return formattedItemsMap2;
|
|
705
|
+
}, [categories]);
|
|
706
|
+
const getFormattedItems = (categoryKey) => {
|
|
707
|
+
return formattedItemsMap[categoryKey] || [{ itens: [] }];
|
|
708
|
+
};
|
|
709
|
+
const getDependentCategories = (categoryKey) => {
|
|
710
|
+
return categories.filter((cat) => cat.dependsOn?.includes(categoryKey)).map((cat) => cat.key);
|
|
711
|
+
};
|
|
712
|
+
const findItemsToRemove = (depCategory, relevantFilter, deselectedItemId) => {
|
|
713
|
+
return depCategory.itens?.filter(
|
|
714
|
+
(item) => item[relevantFilter.internalField] === deselectedItemId
|
|
715
|
+
).map((item) => item.id) || [];
|
|
716
|
+
};
|
|
717
|
+
const processDependentCategory = (depCategoryKey, categoryKey, deselectedItemId, itemsToDeselect) => {
|
|
718
|
+
const depCategory = categories.find((c) => c.key === depCategoryKey);
|
|
719
|
+
if (!depCategory?.filteredBy) return;
|
|
720
|
+
const relevantFilter = depCategory.filteredBy.find(
|
|
721
|
+
(f) => f.key === categoryKey
|
|
722
|
+
);
|
|
723
|
+
if (!relevantFilter) return;
|
|
724
|
+
const itemsToRemove = findItemsToRemove(
|
|
725
|
+
depCategory,
|
|
726
|
+
relevantFilter,
|
|
727
|
+
deselectedItemId
|
|
728
|
+
);
|
|
729
|
+
if (itemsToRemove.length > 0) {
|
|
730
|
+
itemsToDeselect[depCategoryKey] = itemsToRemove;
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
const getItemsToDeselect = (categoryKey, deselectedItemId) => {
|
|
734
|
+
const deselectedItem = categories.find((c) => c.key === categoryKey)?.itens?.find((item) => item.id === deselectedItemId);
|
|
735
|
+
if (!deselectedItem) return {};
|
|
736
|
+
const itemsToDeselect = {};
|
|
737
|
+
const dependentCategories = getDependentCategories(categoryKey);
|
|
738
|
+
for (const depCategoryKey of dependentCategories) {
|
|
739
|
+
processDependentCategory(
|
|
740
|
+
depCategoryKey,
|
|
741
|
+
categoryKey,
|
|
742
|
+
deselectedItemId,
|
|
743
|
+
itemsToDeselect
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
return itemsToDeselect;
|
|
747
|
+
};
|
|
748
|
+
const updateCategorySelectedIds = (updatedCategories, depCategoryIndex, depCategory, itemIds) => {
|
|
749
|
+
const newSelectedIds = depCategory.selectedIds?.filter((id) => !itemIds.includes(id)) || [];
|
|
750
|
+
updatedCategories[depCategoryIndex] = {
|
|
751
|
+
...depCategory,
|
|
752
|
+
selectedIds: newSelectedIds
|
|
753
|
+
};
|
|
754
|
+
return updatedCategories;
|
|
755
|
+
};
|
|
756
|
+
const applyRecursiveCascade = (depCategoryKey, itemIds, updatedCategories) => {
|
|
757
|
+
let result = updatedCategories;
|
|
758
|
+
for (const itemId of itemIds) {
|
|
759
|
+
result = applyCascadeDeselection(depCategoryKey, itemId, result);
|
|
760
|
+
}
|
|
761
|
+
return result;
|
|
762
|
+
};
|
|
763
|
+
const applyCascadeDeselection = (categoryKey, deselectedItemId, currentCategories) => {
|
|
764
|
+
const itemsToDeselect = getItemsToDeselect(categoryKey, deselectedItemId);
|
|
765
|
+
let updatedCategories = [...currentCategories];
|
|
766
|
+
for (const [depCategoryKey, itemIds] of Object.entries(itemsToDeselect)) {
|
|
767
|
+
const depCategoryIndex = updatedCategories.findIndex(
|
|
768
|
+
(c) => c.key === depCategoryKey
|
|
769
|
+
);
|
|
770
|
+
if (depCategoryIndex !== -1) {
|
|
771
|
+
const depCategory = updatedCategories[depCategoryIndex];
|
|
772
|
+
updatedCategories = updateCategorySelectedIds(
|
|
773
|
+
updatedCategories,
|
|
774
|
+
depCategoryIndex,
|
|
775
|
+
depCategory,
|
|
776
|
+
itemIds
|
|
777
|
+
);
|
|
778
|
+
updatedCategories = applyRecursiveCascade(
|
|
779
|
+
depCategoryKey,
|
|
780
|
+
itemIds,
|
|
781
|
+
updatedCategories
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return updatedCategories;
|
|
786
|
+
};
|
|
787
|
+
const toggleAllInCategory = (categoryKey) => {
|
|
788
|
+
const category = categories.find((c) => c.key === categoryKey);
|
|
789
|
+
if (!category) return;
|
|
790
|
+
const formattedItems = getFormattedItems(categoryKey);
|
|
791
|
+
const filteredItems = formattedItems.flatMap((group) => group.itens || []);
|
|
792
|
+
const filteredItemIds = filteredItems.map((item) => item.id);
|
|
793
|
+
const selectedFilteredCount = filteredItemIds.filter(
|
|
794
|
+
(itemId) => category.selectedIds?.includes(itemId)
|
|
795
|
+
).length;
|
|
796
|
+
const allFilteredSelected = selectedFilteredCount === filteredItemIds.length;
|
|
797
|
+
const newSelection = allFilteredSelected ? category.selectedIds?.filter((id) => !filteredItemIds.includes(id)) || [] : [
|
|
798
|
+
...category.selectedIds || [],
|
|
799
|
+
...filteredItemIds.filter(
|
|
800
|
+
(id) => !category.selectedIds?.includes(id)
|
|
801
|
+
)
|
|
802
|
+
];
|
|
803
|
+
let updatedCategories = categories.map(
|
|
804
|
+
(c) => c.key === categoryKey ? { ...c, selectedIds: newSelection } : c
|
|
805
|
+
);
|
|
806
|
+
if (allFilteredSelected) {
|
|
807
|
+
for (const itemId of filteredItemIds) {
|
|
808
|
+
updatedCategories = applyCascadeDeselection(
|
|
809
|
+
categoryKey,
|
|
810
|
+
itemId,
|
|
811
|
+
updatedCategories
|
|
812
|
+
);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
onCategoriesChange(updatedCategories);
|
|
816
|
+
};
|
|
817
|
+
const toggleItem = (categoryKey, itemId) => {
|
|
818
|
+
const category = categories.find((c) => c.key === categoryKey);
|
|
819
|
+
if (!category) return;
|
|
820
|
+
const isCurrentlySelected = category.selectedIds?.includes(itemId);
|
|
821
|
+
const newSelection = isCurrentlySelected ? category.selectedIds?.filter((id) => id !== itemId) : [...category.selectedIds || [], itemId];
|
|
822
|
+
let updatedCategories = categories.map(
|
|
823
|
+
(c) => c.key === categoryKey ? { ...c, selectedIds: newSelection } : c
|
|
824
|
+
);
|
|
825
|
+
if (isCurrentlySelected) {
|
|
826
|
+
updatedCategories = applyCascadeDeselection(
|
|
827
|
+
categoryKey,
|
|
828
|
+
itemId,
|
|
829
|
+
updatedCategories
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
onCategoriesChange(updatedCategories);
|
|
833
|
+
};
|
|
834
|
+
const renderCheckboxItem = (item, categoryKey) => {
|
|
835
|
+
const uniqueId = `${categoryKey}-${item.id}`;
|
|
836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
837
|
+
"div",
|
|
838
|
+
{
|
|
839
|
+
className: "flex items-center gap-3 px-2",
|
|
840
|
+
role: "presentation",
|
|
841
|
+
onClick: (e) => e.stopPropagation(),
|
|
842
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
843
|
+
onMouseUp: (e) => e.stopPropagation(),
|
|
844
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
845
|
+
children: [
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
847
|
+
CheckBox_default,
|
|
848
|
+
{
|
|
849
|
+
id: uniqueId,
|
|
850
|
+
checked: isCheckBoxIsSelected(categoryKey, item.id),
|
|
851
|
+
onChange: () => toggleItem(categoryKey, item.id)
|
|
852
|
+
}
|
|
853
|
+
),
|
|
854
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
855
|
+
"label",
|
|
856
|
+
{
|
|
857
|
+
htmlFor: uniqueId,
|
|
858
|
+
className: "text-sm text-text-950 cursor-pointer select-none",
|
|
859
|
+
children: item.name
|
|
860
|
+
}
|
|
861
|
+
)
|
|
862
|
+
]
|
|
863
|
+
},
|
|
864
|
+
item.id
|
|
865
|
+
);
|
|
866
|
+
};
|
|
867
|
+
const renderFormattedGroup = (formattedGroup, idx, categoryKey) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
868
|
+
"div",
|
|
869
|
+
{
|
|
870
|
+
className: "flex flex-col gap-3",
|
|
871
|
+
children: [
|
|
872
|
+
"groupLabel" in formattedGroup && formattedGroup.groupLabel && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { size: "sm", className: "mt-2", weight: "semibold", children: formattedGroup.groupLabel }),
|
|
873
|
+
formattedGroup.itens?.map(
|
|
874
|
+
(item) => renderCheckboxItem(item, categoryKey)
|
|
875
|
+
)
|
|
876
|
+
]
|
|
877
|
+
},
|
|
878
|
+
formattedGroup.groupLabel || `group-${idx}`
|
|
879
|
+
);
|
|
880
|
+
const renderAccordionTrigger = (category, isEnabled) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center justify-between w-full p-2", children: [
|
|
881
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
882
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
883
|
+
CheckBox_default,
|
|
884
|
+
{
|
|
885
|
+
checked: isMinimalOneCheckBoxIsSelected(category.key),
|
|
886
|
+
disabled: !isEnabled,
|
|
887
|
+
indeterminate: isMinimalOneCheckBoxIsSelected(category.key),
|
|
888
|
+
onChange: () => toggleAllInCategory(category.key)
|
|
889
|
+
}
|
|
890
|
+
),
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
892
|
+
Text_default,
|
|
893
|
+
{
|
|
894
|
+
size: "sm",
|
|
895
|
+
weight: "medium",
|
|
896
|
+
className: cn("text-text-800", !isEnabled && "opacity-40"),
|
|
897
|
+
children: category.label
|
|
898
|
+
}
|
|
899
|
+
)
|
|
900
|
+
] }),
|
|
901
|
+
(openAccordion === category.key || isEnabled) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge_default, { variant: "solid", action: "info", children: (() => {
|
|
902
|
+
const visibleIds = getFormattedItems(category.key).flatMap((group) => group.itens || []).map((i) => i.id);
|
|
903
|
+
const selectedVisibleCount = visibleIds.filter(
|
|
904
|
+
(id) => category.selectedIds?.includes(id)
|
|
905
|
+
).length;
|
|
906
|
+
const totalVisible = visibleIds.length;
|
|
907
|
+
return `${selectedVisibleCount} de ${totalVisible} ${selectedVisibleCount === 1 ? "selecionado" : "selecionados"}`;
|
|
908
|
+
})() })
|
|
909
|
+
] });
|
|
910
|
+
const renderCategoryAccordion = (category) => {
|
|
911
|
+
const isEnabled = !category.dependsOn || category.dependsOn.every((depKey) => {
|
|
912
|
+
const depCat = categories.find((c) => c.key === depKey);
|
|
913
|
+
return depCat?.selectedIds && depCat.selectedIds.length > 0;
|
|
914
|
+
});
|
|
915
|
+
const hasOnlyOneItem = category.itens?.length === 1;
|
|
916
|
+
if (hasOnlyOneItem) {
|
|
917
|
+
return null;
|
|
918
|
+
}
|
|
919
|
+
const formattedItems = getFormattedItems(category.key);
|
|
920
|
+
const hasNoItems = formattedItems.every(
|
|
921
|
+
(group) => !group.itens || group.itens.length === 0
|
|
922
|
+
);
|
|
923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
925
|
+
CardAccordation,
|
|
926
|
+
{
|
|
927
|
+
value: category.key,
|
|
928
|
+
disabled: !isEnabled,
|
|
929
|
+
className: cn(
|
|
930
|
+
"bg-transparent border-0",
|
|
931
|
+
openAccordion === category.key && "bg-background-50 border-none"
|
|
932
|
+
),
|
|
933
|
+
trigger: renderAccordionTrigger(category, isEnabled),
|
|
934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-col gap-3 pt-2", children: hasNoItems && isEnabled ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "px-2 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { size: "sm", className: "text-text-500 text-center", children: "Sem dados" }) }) : formattedItems.map(
|
|
935
|
+
(formattedGroup, idx) => renderFormattedGroup(formattedGroup, idx, category.key)
|
|
936
|
+
) })
|
|
937
|
+
}
|
|
938
|
+
),
|
|
939
|
+
openAccordion !== category.key && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Divider_default, {})
|
|
940
|
+
] }, category.key);
|
|
941
|
+
};
|
|
942
|
+
(0, import_react3.useEffect)(() => {
|
|
943
|
+
if (!openAccordion) return;
|
|
944
|
+
const category = categories.find((c) => c.key === openAccordion);
|
|
945
|
+
if (!category) return;
|
|
946
|
+
const isEnabled = !category.dependsOn || category.dependsOn.every((depKey) => {
|
|
947
|
+
const depCat = categories.find((c) => c.key === depKey);
|
|
948
|
+
return depCat?.selectedIds && depCat.selectedIds.length > 0;
|
|
949
|
+
});
|
|
950
|
+
if (!isEnabled) {
|
|
951
|
+
setTimeout(() => {
|
|
952
|
+
setOpenAccordion("");
|
|
953
|
+
}, 0);
|
|
954
|
+
}
|
|
955
|
+
}, [categories, openAccordion]);
|
|
956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
957
|
+
AccordionGroup,
|
|
958
|
+
{
|
|
959
|
+
type: "single",
|
|
960
|
+
collapsible: true,
|
|
961
|
+
value: openAccordion,
|
|
962
|
+
onValueChange: (value) => {
|
|
963
|
+
if (typeof value === "string") {
|
|
964
|
+
if (value) {
|
|
965
|
+
const category = categories.find((c) => c.key === value);
|
|
966
|
+
const isEnabled = !category?.dependsOn || category.dependsOn.every((depKey) => {
|
|
967
|
+
const depCat = categories.find((c) => c.key === depKey);
|
|
968
|
+
return depCat?.selectedIds && depCat.selectedIds.length > 0;
|
|
969
|
+
});
|
|
970
|
+
if (!isEnabled) {
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
setOpenAccordion(value);
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
children: categories.map(renderCategoryAccordion)
|
|
978
|
+
}
|
|
979
|
+
);
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
// src/components/Modal/Modal.tsx
|
|
983
|
+
var import_react4 = require("react");
|
|
984
|
+
var import_phosphor_react3 = require("phosphor-react");
|
|
985
|
+
|
|
986
|
+
// src/components/Modal/utils/videoUtils.ts
|
|
987
|
+
var isYouTubeUrl = (url) => {
|
|
988
|
+
const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
|
|
989
|
+
return youtubeRegex.test(url);
|
|
990
|
+
};
|
|
991
|
+
var isValidYouTubeHost = (host) => {
|
|
992
|
+
if (host === "youtu.be") return "youtu.be";
|
|
993
|
+
const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
|
|
994
|
+
if (isValidYouTubeCom) return "youtube";
|
|
995
|
+
const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
|
|
996
|
+
if (isValidNoCookie) return "nocookie";
|
|
997
|
+
return null;
|
|
998
|
+
};
|
|
999
|
+
var extractYoutuBeId = (pathname) => {
|
|
1000
|
+
const firstSeg = pathname.split("/").filter(Boolean)[0];
|
|
1001
|
+
return firstSeg || null;
|
|
1002
|
+
};
|
|
1003
|
+
var extractYouTubeId = (pathname, searchParams) => {
|
|
1004
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
1005
|
+
const [first, second] = parts;
|
|
1006
|
+
if (first === "embed" && second) return second;
|
|
1007
|
+
if (first === "shorts" && second) return second;
|
|
1008
|
+
if (first === "live" && second) return second;
|
|
1009
|
+
const v = searchParams.get("v");
|
|
1010
|
+
if (v) return v;
|
|
1011
|
+
return null;
|
|
1012
|
+
};
|
|
1013
|
+
var getYouTubeVideoId = (url) => {
|
|
1014
|
+
try {
|
|
1015
|
+
const u = new URL(url);
|
|
1016
|
+
const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
|
|
1017
|
+
if (!hostType) return null;
|
|
1018
|
+
if (hostType === "youtu.be") {
|
|
1019
|
+
return extractYoutuBeId(u.pathname);
|
|
1020
|
+
}
|
|
1021
|
+
return extractYouTubeId(u.pathname, u.searchParams);
|
|
1022
|
+
} catch {
|
|
1023
|
+
return null;
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
var getYouTubeEmbedUrl = (videoId) => {
|
|
1027
|
+
return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
// src/components/Modal/Modal.tsx
|
|
1031
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1032
|
+
var SIZE_CLASSES4 = {
|
|
1033
|
+
xs: "max-w-[360px]",
|
|
1034
|
+
sm: "max-w-[420px]",
|
|
1035
|
+
md: "max-w-[510px]",
|
|
1036
|
+
lg: "max-w-[640px]",
|
|
1037
|
+
xl: "max-w-[970px]"
|
|
1038
|
+
};
|
|
1039
|
+
var Modal = ({
|
|
1040
|
+
isOpen,
|
|
1041
|
+
onClose,
|
|
1042
|
+
title,
|
|
1043
|
+
children,
|
|
1044
|
+
size = "md",
|
|
1045
|
+
className = "",
|
|
1046
|
+
closeOnEscape = true,
|
|
1047
|
+
footer,
|
|
1048
|
+
hideCloseButton = false,
|
|
1049
|
+
variant = "default",
|
|
1050
|
+
description,
|
|
1051
|
+
image,
|
|
1052
|
+
imageAlt,
|
|
1053
|
+
actionLink,
|
|
1054
|
+
actionLabel,
|
|
1055
|
+
contentClassName = ""
|
|
1056
|
+
}) => {
|
|
1057
|
+
const titleId = (0, import_react4.useId)();
|
|
1058
|
+
(0, import_react4.useEffect)(() => {
|
|
1059
|
+
if (!isOpen || !closeOnEscape) return;
|
|
1060
|
+
const handleEscape = (event) => {
|
|
1061
|
+
if (event.key === "Escape") {
|
|
1062
|
+
onClose();
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
document.addEventListener("keydown", handleEscape);
|
|
1066
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
1067
|
+
}, [isOpen, closeOnEscape, onClose]);
|
|
1068
|
+
(0, import_react4.useEffect)(() => {
|
|
1069
|
+
if (!isOpen) return;
|
|
1070
|
+
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
1071
|
+
const originalOverflow = document.body.style.overflow;
|
|
1072
|
+
const originalPaddingRight = document.body.style.paddingRight;
|
|
1073
|
+
document.body.style.overflow = "hidden";
|
|
1074
|
+
if (scrollbarWidth > 0) {
|
|
1075
|
+
document.body.style.paddingRight = `${scrollbarWidth}px`;
|
|
1076
|
+
const overlay = document.createElement("div");
|
|
1077
|
+
overlay.id = "modal-scrollbar-overlay";
|
|
1078
|
+
overlay.style.cssText = `
|
|
1079
|
+
position: fixed;
|
|
1080
|
+
top: 0;
|
|
1081
|
+
right: 0;
|
|
1082
|
+
width: ${scrollbarWidth}px;
|
|
1083
|
+
height: 100vh;
|
|
1084
|
+
background-color: rgb(0 0 0 / 0.6);
|
|
1085
|
+
z-index: 40;
|
|
1086
|
+
pointer-events: none;
|
|
1087
|
+
`;
|
|
1088
|
+
document.body.appendChild(overlay);
|
|
1089
|
+
}
|
|
1090
|
+
return () => {
|
|
1091
|
+
document.body.style.overflow = originalOverflow;
|
|
1092
|
+
document.body.style.paddingRight = originalPaddingRight;
|
|
1093
|
+
const overlay = document.getElementById("modal-scrollbar-overlay");
|
|
1094
|
+
if (overlay) {
|
|
1095
|
+
overlay.remove();
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
}, [isOpen]);
|
|
1099
|
+
if (!isOpen) return null;
|
|
1100
|
+
const sizeClasses = SIZE_CLASSES4[size];
|
|
1101
|
+
const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
1102
|
+
const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
|
|
1103
|
+
const modalClasses = cn(
|
|
1104
|
+
baseClasses,
|
|
1105
|
+
sizeClasses,
|
|
1106
|
+
dialogResetClasses,
|
|
1107
|
+
className
|
|
1108
|
+
);
|
|
1109
|
+
const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
|
|
1110
|
+
const handleActionClick = () => {
|
|
1111
|
+
if (actionLink) {
|
|
1112
|
+
window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
if (variant === "activity") {
|
|
1116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs border-none p-0 m-0 w-full cursor-default", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1117
|
+
"dialog",
|
|
1118
|
+
{
|
|
1119
|
+
className: modalClasses,
|
|
1120
|
+
"aria-labelledby": titleId,
|
|
1121
|
+
"aria-modal": "true",
|
|
1122
|
+
open: true,
|
|
1123
|
+
children: [
|
|
1124
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1125
|
+
"button",
|
|
1126
|
+
{
|
|
1127
|
+
onClick: onClose,
|
|
1128
|
+
className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
|
|
1129
|
+
"aria-label": "Fechar modal",
|
|
1130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react3.X, { size: 18 })
|
|
1131
|
+
}
|
|
1132
|
+
) }),
|
|
1133
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
|
|
1134
|
+
image && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1135
|
+
"img",
|
|
1136
|
+
{
|
|
1137
|
+
src: image,
|
|
1138
|
+
alt: imageAlt ?? "",
|
|
1139
|
+
className: "w-[122px] h-[122px] object-contain"
|
|
1140
|
+
}
|
|
1141
|
+
) }),
|
|
1142
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1143
|
+
"h2",
|
|
1144
|
+
{
|
|
1145
|
+
id: titleId,
|
|
1146
|
+
className: "text-lg font-semibold text-text-950 text-center",
|
|
1147
|
+
children: title
|
|
1148
|
+
}
|
|
1149
|
+
),
|
|
1150
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-sm font-normal text-text-400 text-center max-w-md leading-[21px]", children: description }),
|
|
1151
|
+
actionLink && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w-full", children: [
|
|
1152
|
+
(() => {
|
|
1153
|
+
const normalized = normalizeUrl(actionLink);
|
|
1154
|
+
const isYT = isYouTubeUrl(normalized);
|
|
1155
|
+
if (!isYT) return null;
|
|
1156
|
+
const id = getYouTubeVideoId(normalized);
|
|
1157
|
+
if (!id) {
|
|
1158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1159
|
+
Button_default,
|
|
1160
|
+
{
|
|
1161
|
+
variant: "solid",
|
|
1162
|
+
action: "primary",
|
|
1163
|
+
size: "large",
|
|
1164
|
+
className: "w-full",
|
|
1165
|
+
onClick: handleActionClick,
|
|
1166
|
+
children: actionLabel || "Iniciar Atividade"
|
|
1167
|
+
}
|
|
1168
|
+
);
|
|
1169
|
+
}
|
|
1170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1171
|
+
"iframe",
|
|
1172
|
+
{
|
|
1173
|
+
src: getYouTubeEmbedUrl(id),
|
|
1174
|
+
className: "w-full aspect-video rounded-lg",
|
|
1175
|
+
allowFullScreen: true,
|
|
1176
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
1177
|
+
title: "V\xEDdeo YouTube"
|
|
1178
|
+
}
|
|
1179
|
+
);
|
|
1180
|
+
})(),
|
|
1181
|
+
!isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1182
|
+
Button_default,
|
|
1183
|
+
{
|
|
1184
|
+
variant: "solid",
|
|
1185
|
+
action: "primary",
|
|
1186
|
+
size: "large",
|
|
1187
|
+
className: "w-full",
|
|
1188
|
+
onClick: handleActionClick,
|
|
1189
|
+
children: actionLabel || "Iniciar Atividade"
|
|
1190
|
+
}
|
|
1191
|
+
)
|
|
1192
|
+
] })
|
|
1193
|
+
] })
|
|
1194
|
+
]
|
|
1195
|
+
}
|
|
1196
|
+
) });
|
|
1197
|
+
}
|
|
1198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs border-none p-0 m-0 w-full cursor-default", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1199
|
+
"dialog",
|
|
1200
|
+
{
|
|
1201
|
+
className: modalClasses,
|
|
1202
|
+
"aria-labelledby": titleId,
|
|
1203
|
+
"aria-modal": "true",
|
|
1204
|
+
open: true,
|
|
1205
|
+
children: [
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between px-6 py-6", children: [
|
|
1207
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
|
|
1208
|
+
!hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1209
|
+
"button",
|
|
1210
|
+
{
|
|
1211
|
+
onClick: onClose,
|
|
1212
|
+
className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
|
|
1213
|
+
"aria-label": "Fechar modal",
|
|
1214
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react3.X, { size: 18 })
|
|
1215
|
+
}
|
|
1216
|
+
)
|
|
1217
|
+
] }),
|
|
1218
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: cn("px-6 pb-6", contentClassName), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
|
|
1219
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
|
|
1220
|
+
]
|
|
1221
|
+
}
|
|
1222
|
+
) });
|
|
1223
|
+
};
|
|
1224
|
+
var Modal_default = Modal;
|
|
1225
|
+
|
|
1226
|
+
// src/components/Divider/Divider.tsx
|
|
1227
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1228
|
+
var Divider = ({
|
|
1229
|
+
orientation = "horizontal",
|
|
1230
|
+
className = "",
|
|
1231
|
+
...props
|
|
1232
|
+
}) => {
|
|
1233
|
+
const baseClasses = "bg-border-200 border-0";
|
|
1234
|
+
const orientationClasses = {
|
|
1235
|
+
horizontal: "w-full h-px",
|
|
1236
|
+
vertical: "h-full w-px"
|
|
1237
|
+
};
|
|
1238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1239
|
+
"hr",
|
|
1240
|
+
{
|
|
1241
|
+
className: cn(baseClasses, orientationClasses[orientation], className),
|
|
1242
|
+
"aria-orientation": orientation,
|
|
1243
|
+
...props
|
|
1244
|
+
}
|
|
1245
|
+
);
|
|
1246
|
+
};
|
|
1247
|
+
var Divider_default = Divider;
|
|
1248
|
+
|
|
1249
|
+
// src/components/Radio/Radio.tsx
|
|
1250
|
+
var import_react5 = require("react");
|
|
1251
|
+
var import_zustand = require("zustand");
|
|
1252
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1253
|
+
var SIZE_CLASSES5 = {
|
|
1254
|
+
small: {
|
|
1255
|
+
radio: "w-5 h-5",
|
|
1256
|
+
textSize: "sm",
|
|
1257
|
+
spacing: "gap-1.5",
|
|
1258
|
+
borderWidth: "border-2",
|
|
1259
|
+
dotSize: "w-2.5 h-2.5",
|
|
1260
|
+
labelHeight: "h-5"
|
|
1261
|
+
},
|
|
1262
|
+
medium: {
|
|
1263
|
+
radio: "w-6 h-6",
|
|
1264
|
+
textSize: "md",
|
|
1265
|
+
spacing: "gap-2",
|
|
1266
|
+
borderWidth: "border-2",
|
|
1267
|
+
dotSize: "w-3 h-3",
|
|
1268
|
+
labelHeight: "h-6"
|
|
1269
|
+
},
|
|
1270
|
+
large: {
|
|
1271
|
+
radio: "w-7 h-7",
|
|
1272
|
+
textSize: "lg",
|
|
1273
|
+
spacing: "gap-2",
|
|
1274
|
+
borderWidth: "border-2",
|
|
1275
|
+
dotSize: "w-3.5 h-3.5",
|
|
1276
|
+
labelHeight: "h-7"
|
|
1277
|
+
},
|
|
1278
|
+
extraLarge: {
|
|
1279
|
+
radio: "w-8 h-8",
|
|
1280
|
+
textSize: "xl",
|
|
1281
|
+
spacing: "gap-3",
|
|
1282
|
+
borderWidth: "border-2",
|
|
1283
|
+
dotSize: "w-4 h-4",
|
|
1284
|
+
labelHeight: "h-8"
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
var BASE_RADIO_CLASSES = "rounded-full border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
1288
|
+
var STATE_CLASSES2 = {
|
|
1289
|
+
default: {
|
|
1290
|
+
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
1291
|
+
checked: "border-primary-950 bg-background hover:border-primary-800"
|
|
1292
|
+
},
|
|
1293
|
+
hovered: {
|
|
1294
|
+
unchecked: "border-border-500 bg-background",
|
|
1295
|
+
checked: "border-info-700 bg-background"
|
|
1296
|
+
},
|
|
1297
|
+
focused: {
|
|
1298
|
+
unchecked: "border-border-400 bg-background",
|
|
1299
|
+
checked: "border-primary-950 bg-background"
|
|
1300
|
+
},
|
|
1301
|
+
invalid: {
|
|
1302
|
+
unchecked: "border-border-400 bg-background",
|
|
1303
|
+
checked: "border-primary-950 bg-background"
|
|
1304
|
+
},
|
|
1305
|
+
disabled: {
|
|
1306
|
+
unchecked: "border-border-400 bg-background cursor-not-allowed",
|
|
1307
|
+
checked: "border-primary-950 bg-background cursor-not-allowed"
|
|
1308
|
+
}
|
|
1309
|
+
};
|
|
1310
|
+
var DOT_CLASSES = {
|
|
1311
|
+
default: "bg-primary-950",
|
|
1312
|
+
hovered: "bg-info-700",
|
|
1313
|
+
focused: "bg-primary-950",
|
|
1314
|
+
invalid: "bg-primary-950",
|
|
1315
|
+
disabled: "bg-primary-950"
|
|
1316
|
+
};
|
|
1317
|
+
var Radio = (0, import_react5.forwardRef)(
|
|
1318
|
+
({
|
|
1319
|
+
label,
|
|
1320
|
+
size = "medium",
|
|
1321
|
+
state = "default",
|
|
1322
|
+
errorMessage,
|
|
1323
|
+
helperText,
|
|
1324
|
+
className = "",
|
|
1325
|
+
labelClassName = "",
|
|
1326
|
+
checked: checkedProp,
|
|
1327
|
+
defaultChecked = false,
|
|
1328
|
+
disabled,
|
|
1329
|
+
id,
|
|
1330
|
+
name,
|
|
1331
|
+
value,
|
|
1332
|
+
onChange,
|
|
1333
|
+
...props
|
|
1334
|
+
}, ref) => {
|
|
1335
|
+
const generatedId = (0, import_react5.useId)();
|
|
1336
|
+
const inputId = id ?? `radio-${generatedId}`;
|
|
1337
|
+
const inputRef = (0, import_react5.useRef)(null);
|
|
1338
|
+
const [internalChecked, setInternalChecked] = (0, import_react5.useState)(defaultChecked);
|
|
1339
|
+
const isControlled = checkedProp !== void 0;
|
|
1340
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
1341
|
+
const handleChange = (event) => {
|
|
1342
|
+
const newChecked = event.target.checked;
|
|
1343
|
+
if (!isControlled) {
|
|
1344
|
+
setInternalChecked(newChecked);
|
|
1345
|
+
}
|
|
1346
|
+
if (event.target) {
|
|
1347
|
+
event.target.blur();
|
|
1348
|
+
}
|
|
1349
|
+
onChange?.(event);
|
|
1350
|
+
};
|
|
1351
|
+
const currentState = disabled ? "disabled" : state;
|
|
1352
|
+
const sizeClasses = SIZE_CLASSES5[size];
|
|
1353
|
+
const actualRadioSize = sizeClasses.radio;
|
|
1354
|
+
const actualDotSize = sizeClasses.dotSize;
|
|
1355
|
+
const radioVariant = checked ? "checked" : "unchecked";
|
|
1356
|
+
const stylingClasses = STATE_CLASSES2[currentState][radioVariant];
|
|
1357
|
+
const getBorderWidth = () => {
|
|
1358
|
+
if (currentState === "focused") {
|
|
1359
|
+
return "border-2";
|
|
1360
|
+
}
|
|
1361
|
+
return sizeClasses.borderWidth;
|
|
1362
|
+
};
|
|
1363
|
+
const borderWidthClass = getBorderWidth();
|
|
1364
|
+
const radioClasses = cn(
|
|
1365
|
+
BASE_RADIO_CLASSES,
|
|
1366
|
+
actualRadioSize,
|
|
1367
|
+
borderWidthClass,
|
|
1368
|
+
stylingClasses,
|
|
1369
|
+
className
|
|
1370
|
+
);
|
|
1371
|
+
const dotClasses = cn(
|
|
1372
|
+
actualDotSize,
|
|
1373
|
+
"rounded-full",
|
|
1374
|
+
DOT_CLASSES[currentState],
|
|
1375
|
+
"transition-all duration-200"
|
|
1376
|
+
);
|
|
1377
|
+
const isWrapperNeeded = currentState === "focused" || currentState === "invalid";
|
|
1378
|
+
const wrapperBorderColor = currentState === "focused" ? "border-indicator-info" : "border-indicator-error";
|
|
1379
|
+
const getTextColor = () => {
|
|
1380
|
+
if (currentState === "disabled") {
|
|
1381
|
+
return checked ? "text-text-900" : "text-text-600";
|
|
1382
|
+
}
|
|
1383
|
+
if (currentState === "focused") {
|
|
1384
|
+
return "text-text-900";
|
|
1385
|
+
}
|
|
1386
|
+
return checked ? "text-text-900" : "text-text-600";
|
|
1387
|
+
};
|
|
1388
|
+
const getCursorClass = () => {
|
|
1389
|
+
return currentState === "disabled" ? "cursor-not-allowed" : "cursor-pointer";
|
|
1390
|
+
};
|
|
1391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col", children: [
|
|
1392
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1393
|
+
"div",
|
|
1394
|
+
{
|
|
1395
|
+
className: cn(
|
|
1396
|
+
"flex flex-row items-center",
|
|
1397
|
+
isWrapperNeeded ? cn("p-1 border-2", wrapperBorderColor, "rounded-lg gap-1.5") : sizeClasses.spacing,
|
|
1398
|
+
disabled ? "opacity-40" : ""
|
|
1399
|
+
),
|
|
1400
|
+
children: [
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1402
|
+
"input",
|
|
1403
|
+
{
|
|
1404
|
+
ref: (node) => {
|
|
1405
|
+
inputRef.current = node;
|
|
1406
|
+
if (typeof ref === "function") ref(node);
|
|
1407
|
+
else if (ref) ref.current = node;
|
|
1408
|
+
},
|
|
1409
|
+
type: "radio",
|
|
1410
|
+
id: inputId,
|
|
1411
|
+
checked,
|
|
1412
|
+
disabled,
|
|
1413
|
+
name,
|
|
1414
|
+
value,
|
|
1415
|
+
onChange: handleChange,
|
|
1416
|
+
className: "sr-only",
|
|
1417
|
+
style: {
|
|
1418
|
+
position: "absolute",
|
|
1419
|
+
left: "-9999px",
|
|
1420
|
+
visibility: "hidden"
|
|
1421
|
+
},
|
|
1422
|
+
...props
|
|
1423
|
+
}
|
|
1424
|
+
),
|
|
1425
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1426
|
+
"button",
|
|
1427
|
+
{
|
|
1428
|
+
type: "button",
|
|
1429
|
+
className: radioClasses,
|
|
1430
|
+
disabled,
|
|
1431
|
+
"aria-pressed": checked,
|
|
1432
|
+
onClick: (e) => {
|
|
1433
|
+
e.preventDefault();
|
|
1434
|
+
if (!disabled) {
|
|
1435
|
+
if (inputRef.current) {
|
|
1436
|
+
inputRef.current.click();
|
|
1437
|
+
inputRef.current.blur();
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
},
|
|
1441
|
+
onKeyDown: (e) => {
|
|
1442
|
+
if ((e.key === "Enter" || e.key === " ") && !disabled) {
|
|
1443
|
+
e.preventDefault();
|
|
1444
|
+
if (inputRef.current) {
|
|
1445
|
+
inputRef.current.click();
|
|
1446
|
+
inputRef.current.blur();
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1450
|
+
children: checked && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: dotClasses })
|
|
1451
|
+
}
|
|
1452
|
+
),
|
|
1453
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1454
|
+
"div",
|
|
1455
|
+
{
|
|
1456
|
+
className: cn(
|
|
1457
|
+
"flex flex-row items-center",
|
|
1458
|
+
sizeClasses.labelHeight,
|
|
1459
|
+
"flex-1 min-w-0"
|
|
1460
|
+
),
|
|
1461
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1462
|
+
Text_default,
|
|
1463
|
+
{
|
|
1464
|
+
as: "label",
|
|
1465
|
+
htmlFor: inputId,
|
|
1466
|
+
size: sizeClasses.textSize,
|
|
1467
|
+
weight: "normal",
|
|
1468
|
+
className: cn(
|
|
1469
|
+
getCursorClass(),
|
|
1470
|
+
"select-none leading-normal flex items-center font-roboto truncate",
|
|
1471
|
+
labelClassName
|
|
1472
|
+
),
|
|
1473
|
+
color: getTextColor(),
|
|
1474
|
+
children: label
|
|
1475
|
+
}
|
|
1476
|
+
)
|
|
1477
|
+
}
|
|
1478
|
+
)
|
|
1479
|
+
]
|
|
1480
|
+
}
|
|
1481
|
+
),
|
|
1482
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1483
|
+
Text_default,
|
|
1484
|
+
{
|
|
1485
|
+
size: "sm",
|
|
1486
|
+
weight: "normal",
|
|
1487
|
+
className: "mt-1.5 truncate",
|
|
1488
|
+
color: "text-error-600",
|
|
1489
|
+
children: errorMessage
|
|
1490
|
+
}
|
|
1491
|
+
),
|
|
1492
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1493
|
+
Text_default,
|
|
1494
|
+
{
|
|
1495
|
+
size: "sm",
|
|
1496
|
+
weight: "normal",
|
|
1497
|
+
className: "mt-1.5 truncate",
|
|
1498
|
+
color: "text-text-500",
|
|
1499
|
+
children: helperText
|
|
1500
|
+
}
|
|
1501
|
+
)
|
|
1502
|
+
] });
|
|
1503
|
+
}
|
|
1504
|
+
);
|
|
1505
|
+
Radio.displayName = "Radio";
|
|
1506
|
+
var createRadioGroupStore = (name, defaultValue, disabled, onValueChange) => (0, import_zustand.create)((set, get) => ({
|
|
1507
|
+
value: defaultValue,
|
|
1508
|
+
setValue: (value) => {
|
|
1509
|
+
if (!get().disabled) {
|
|
1510
|
+
set({ value });
|
|
1511
|
+
get().onValueChange?.(value);
|
|
1512
|
+
}
|
|
1513
|
+
},
|
|
1514
|
+
onValueChange,
|
|
1515
|
+
disabled,
|
|
1516
|
+
name
|
|
1517
|
+
}));
|
|
1518
|
+
var useRadioGroupStore = (externalStore) => {
|
|
1519
|
+
if (!externalStore) {
|
|
1520
|
+
throw new Error("RadioGroupItem must be used within a RadioGroup");
|
|
1521
|
+
}
|
|
1522
|
+
return externalStore;
|
|
1523
|
+
};
|
|
1524
|
+
var injectStore = (children, store) => import_react5.Children.map(children, (child) => {
|
|
1525
|
+
if (!(0, import_react5.isValidElement)(child)) return child;
|
|
1526
|
+
const typedChild = child;
|
|
1527
|
+
const shouldInject = typedChild.type === RadioGroupItem;
|
|
1528
|
+
return (0, import_react5.cloneElement)(typedChild, {
|
|
1529
|
+
...shouldInject ? { store } : {},
|
|
1530
|
+
...typedChild.props.children ? { children: injectStore(typedChild.props.children, store) } : {}
|
|
1531
|
+
});
|
|
1532
|
+
});
|
|
1533
|
+
var RadioGroup = (0, import_react5.forwardRef)(
|
|
1534
|
+
({
|
|
1535
|
+
value: propValue,
|
|
1536
|
+
defaultValue = "",
|
|
1537
|
+
onValueChange,
|
|
1538
|
+
name: propName,
|
|
1539
|
+
disabled = false,
|
|
1540
|
+
className = "",
|
|
1541
|
+
children,
|
|
1542
|
+
...props
|
|
1543
|
+
}, ref) => {
|
|
1544
|
+
const generatedId = (0, import_react5.useId)();
|
|
1545
|
+
const name = propName || `radio-group-${generatedId}`;
|
|
1546
|
+
const storeRef = (0, import_react5.useRef)(null);
|
|
1547
|
+
storeRef.current ??= createRadioGroupStore(
|
|
1548
|
+
name,
|
|
1549
|
+
defaultValue,
|
|
1550
|
+
disabled,
|
|
1551
|
+
onValueChange
|
|
1552
|
+
);
|
|
1553
|
+
const store = storeRef.current;
|
|
1554
|
+
const { setValue } = (0, import_zustand.useStore)(store, (s) => s);
|
|
1555
|
+
(0, import_react5.useEffect)(() => {
|
|
1556
|
+
const currentValue = store.getState().value;
|
|
1557
|
+
if (currentValue && onValueChange) {
|
|
1558
|
+
onValueChange(currentValue);
|
|
1559
|
+
}
|
|
1560
|
+
}, []);
|
|
1561
|
+
(0, import_react5.useEffect)(() => {
|
|
1562
|
+
if (propValue !== void 0) {
|
|
1563
|
+
setValue(propValue);
|
|
1564
|
+
}
|
|
1565
|
+
}, [propValue, setValue]);
|
|
1566
|
+
(0, import_react5.useEffect)(() => {
|
|
1567
|
+
store.setState({ disabled });
|
|
1568
|
+
}, [disabled, store]);
|
|
1569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1570
|
+
"div",
|
|
1571
|
+
{
|
|
1572
|
+
ref,
|
|
1573
|
+
className,
|
|
1574
|
+
role: "radiogroup",
|
|
1575
|
+
"aria-label": name,
|
|
1576
|
+
...props,
|
|
1577
|
+
children: injectStore(children, store)
|
|
1578
|
+
}
|
|
1579
|
+
);
|
|
1580
|
+
}
|
|
1581
|
+
);
|
|
1582
|
+
RadioGroup.displayName = "RadioGroup";
|
|
1583
|
+
var RadioGroupItem = (0, import_react5.forwardRef)(
|
|
1584
|
+
({
|
|
1585
|
+
value,
|
|
1586
|
+
store: externalStore,
|
|
1587
|
+
disabled: itemDisabled,
|
|
1588
|
+
size = "medium",
|
|
1589
|
+
state = "default",
|
|
1590
|
+
className = "",
|
|
1591
|
+
id,
|
|
1592
|
+
...props
|
|
1593
|
+
}, ref) => {
|
|
1594
|
+
const store = useRadioGroupStore(externalStore);
|
|
1595
|
+
const {
|
|
1596
|
+
value: groupValue,
|
|
1597
|
+
setValue,
|
|
1598
|
+
disabled: groupDisabled,
|
|
1599
|
+
name
|
|
1600
|
+
} = (0, import_zustand.useStore)(store);
|
|
1601
|
+
const generatedId = (0, import_react5.useId)();
|
|
1602
|
+
const inputId = id ?? `radio-item-${generatedId}`;
|
|
1603
|
+
const isChecked = groupValue === value;
|
|
1604
|
+
const isDisabled = groupDisabled || itemDisabled;
|
|
1605
|
+
const currentState = isDisabled ? "disabled" : state;
|
|
1606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1607
|
+
Radio,
|
|
1608
|
+
{
|
|
1609
|
+
ref,
|
|
1610
|
+
id: inputId,
|
|
1611
|
+
name,
|
|
1612
|
+
value,
|
|
1613
|
+
checked: isChecked,
|
|
1614
|
+
disabled: isDisabled,
|
|
1615
|
+
size,
|
|
1616
|
+
state: currentState,
|
|
1617
|
+
className,
|
|
1618
|
+
onChange: (e) => {
|
|
1619
|
+
if (e.target.checked && !isDisabled) {
|
|
1620
|
+
setValue(value);
|
|
1621
|
+
}
|
|
1622
|
+
},
|
|
1623
|
+
...props
|
|
1624
|
+
}
|
|
1625
|
+
);
|
|
1626
|
+
}
|
|
1627
|
+
);
|
|
1628
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
1629
|
+
var Radio_default = Radio;
|
|
1630
|
+
|
|
1631
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
1632
|
+
var import_phosphor_react5 = require("phosphor-react");
|
|
1633
|
+
var import_react8 = require("react");
|
|
1634
|
+
var import_zustand3 = require("zustand");
|
|
1635
|
+
|
|
1636
|
+
// src/components/ThemeToggle/ThemeToggle.tsx
|
|
1637
|
+
var import_phosphor_react4 = require("phosphor-react");
|
|
1638
|
+
var import_react7 = require("react");
|
|
1639
|
+
|
|
1640
|
+
// src/hooks/useTheme.ts
|
|
1641
|
+
var import_react6 = require("react");
|
|
1642
|
+
|
|
1643
|
+
// src/store/themeStore.ts
|
|
1644
|
+
var import_zustand2 = require("zustand");
|
|
1645
|
+
var import_middleware = require("zustand/middleware");
|
|
1646
|
+
var applyThemeToDOM = (mode) => {
|
|
1647
|
+
const htmlElement = document.documentElement;
|
|
1648
|
+
const originalTheme = htmlElement.getAttribute("data-original-theme");
|
|
1649
|
+
if (mode === "dark") {
|
|
1650
|
+
htmlElement.setAttribute("data-theme", "dark");
|
|
1651
|
+
return true;
|
|
1652
|
+
} else if (mode === "light") {
|
|
1653
|
+
if (originalTheme) {
|
|
1654
|
+
htmlElement.setAttribute("data-theme", originalTheme);
|
|
1655
|
+
}
|
|
1656
|
+
return false;
|
|
1657
|
+
} else if (mode === "system") {
|
|
1658
|
+
const isSystemDark = window.matchMedia(
|
|
1659
|
+
"(prefers-color-scheme: dark)"
|
|
1660
|
+
).matches;
|
|
1661
|
+
if (isSystemDark) {
|
|
1662
|
+
htmlElement.setAttribute("data-theme", "dark");
|
|
1663
|
+
return true;
|
|
1664
|
+
} else if (originalTheme) {
|
|
1665
|
+
htmlElement.setAttribute("data-theme", originalTheme);
|
|
1666
|
+
return false;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
return false;
|
|
1670
|
+
};
|
|
1671
|
+
var saveOriginalTheme = () => {
|
|
1672
|
+
const htmlElement = document.documentElement;
|
|
1673
|
+
const currentTheme = htmlElement.getAttribute("data-theme");
|
|
1674
|
+
if (currentTheme && !htmlElement.getAttribute("data-original-theme")) {
|
|
1675
|
+
htmlElement.setAttribute("data-original-theme", currentTheme);
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
var useThemeStore = (0, import_zustand2.create)()(
|
|
1679
|
+
(0, import_middleware.devtools)(
|
|
1680
|
+
(0, import_middleware.persist)(
|
|
1681
|
+
(set, get) => ({
|
|
1682
|
+
// Initial state
|
|
1683
|
+
themeMode: "system",
|
|
1684
|
+
isDark: false,
|
|
1685
|
+
// Actions
|
|
1686
|
+
applyTheme: (mode) => {
|
|
1687
|
+
const isDark = applyThemeToDOM(mode);
|
|
1688
|
+
set({ isDark });
|
|
1689
|
+
},
|
|
1690
|
+
toggleTheme: () => {
|
|
1691
|
+
const { themeMode, applyTheme } = get();
|
|
1692
|
+
let newMode;
|
|
1693
|
+
if (themeMode === "light") {
|
|
1694
|
+
newMode = "dark";
|
|
1695
|
+
} else if (themeMode === "dark") {
|
|
1696
|
+
newMode = "light";
|
|
1697
|
+
} else {
|
|
1698
|
+
newMode = "dark";
|
|
1699
|
+
}
|
|
1700
|
+
set({ themeMode: newMode });
|
|
1701
|
+
applyTheme(newMode);
|
|
1702
|
+
},
|
|
1703
|
+
setTheme: (mode) => {
|
|
1704
|
+
const { applyTheme } = get();
|
|
1705
|
+
set({ themeMode: mode });
|
|
1706
|
+
applyTheme(mode);
|
|
1707
|
+
},
|
|
1708
|
+
initializeTheme: () => {
|
|
1709
|
+
const { themeMode, applyTheme } = get();
|
|
1710
|
+
saveOriginalTheme();
|
|
1711
|
+
applyTheme(themeMode);
|
|
1712
|
+
},
|
|
1713
|
+
handleSystemThemeChange: () => {
|
|
1714
|
+
const { themeMode, applyTheme } = get();
|
|
1715
|
+
if (themeMode === "system") {
|
|
1716
|
+
applyTheme("system");
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
}),
|
|
1720
|
+
{
|
|
1721
|
+
name: "theme-store",
|
|
1722
|
+
// Nome da chave no localStorage
|
|
1723
|
+
partialize: (state) => ({
|
|
1724
|
+
themeMode: state.themeMode
|
|
1725
|
+
})
|
|
1726
|
+
// Só persiste o themeMode, não o isDark
|
|
1727
|
+
}
|
|
1728
|
+
),
|
|
1729
|
+
{
|
|
1730
|
+
name: "theme-store"
|
|
1731
|
+
}
|
|
1732
|
+
)
|
|
1733
|
+
);
|
|
1734
|
+
|
|
1735
|
+
// src/hooks/useTheme.ts
|
|
1736
|
+
var useTheme = () => {
|
|
1737
|
+
const {
|
|
1738
|
+
themeMode,
|
|
1739
|
+
isDark,
|
|
1740
|
+
toggleTheme,
|
|
1741
|
+
setTheme,
|
|
1742
|
+
initializeTheme,
|
|
1743
|
+
handleSystemThemeChange
|
|
1744
|
+
} = useThemeStore();
|
|
1745
|
+
(0, import_react6.useEffect)(() => {
|
|
1746
|
+
initializeTheme();
|
|
1747
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1748
|
+
mediaQuery.addEventListener("change", handleSystemThemeChange);
|
|
1749
|
+
return () => {
|
|
1750
|
+
mediaQuery.removeEventListener("change", handleSystemThemeChange);
|
|
1751
|
+
};
|
|
1752
|
+
}, [initializeTheme, handleSystemThemeChange]);
|
|
1753
|
+
return {
|
|
1754
|
+
themeMode,
|
|
1755
|
+
isDark,
|
|
1756
|
+
toggleTheme,
|
|
1757
|
+
setTheme
|
|
1758
|
+
};
|
|
1759
|
+
};
|
|
1760
|
+
|
|
1761
|
+
// src/components/ThemeToggle/ThemeToggle.tsx
|
|
1762
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1763
|
+
var ThemeToggle = ({
|
|
1764
|
+
variant = "default",
|
|
1765
|
+
onToggle
|
|
1766
|
+
}) => {
|
|
1767
|
+
const { themeMode, setTheme } = useTheme();
|
|
1768
|
+
const [tempTheme, setTempTheme] = (0, import_react7.useState)(themeMode);
|
|
1769
|
+
(0, import_react7.useEffect)(() => {
|
|
1770
|
+
setTempTheme(themeMode);
|
|
1771
|
+
}, [themeMode]);
|
|
1772
|
+
const problemTypes = [
|
|
1773
|
+
{
|
|
1774
|
+
id: "light",
|
|
1775
|
+
title: "Claro",
|
|
1776
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_phosphor_react4.Sun, { size: 24 })
|
|
1777
|
+
},
|
|
1778
|
+
{
|
|
1779
|
+
id: "dark",
|
|
1780
|
+
title: "Escuro",
|
|
1781
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_phosphor_react4.Moon, { size: 24 })
|
|
1782
|
+
},
|
|
1783
|
+
{
|
|
1784
|
+
id: "system",
|
|
1785
|
+
title: "Sistema",
|
|
1786
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1787
|
+
"svg",
|
|
1788
|
+
{
|
|
1789
|
+
width: "25",
|
|
1790
|
+
height: "25",
|
|
1791
|
+
viewBox: "0 0 25 25",
|
|
1792
|
+
fill: "none",
|
|
1793
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1794
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1795
|
+
"path",
|
|
1796
|
+
{
|
|
1797
|
+
d: "M12.5 2.75C15.085 2.75276 17.5637 3.78054 19.3916 5.6084C21.2195 7.43628 22.2473 9.915 22.25 12.5C22.25 14.4284 21.6778 16.3136 20.6064 17.917C19.5352 19.5201 18.0128 20.7699 16.2314 21.5078C14.4499 22.2458 12.489 22.4387 10.5977 22.0625C8.70642 21.6863 6.96899 20.758 5.60547 19.3945C4.24197 18.031 3.31374 16.2936 2.9375 14.4023C2.56129 12.511 2.75423 10.5501 3.49219 8.76855C4.23012 6.98718 5.47982 5.46483 7.08301 4.39355C8.68639 3.32221 10.5716 2.75 12.5 2.75ZM11.75 4.28516C9.70145 4.47452 7.7973 5.42115 6.41016 6.94043C5.02299 8.4599 4.25247 10.4426 4.25 12.5C4.25247 14.5574 5.02299 16.5401 6.41016 18.0596C7.7973 19.5789 9.70145 20.5255 11.75 20.7148V4.28516Z",
|
|
1798
|
+
fill: "#525252"
|
|
1799
|
+
}
|
|
1800
|
+
)
|
|
1801
|
+
}
|
|
1802
|
+
)
|
|
1803
|
+
}
|
|
1804
|
+
];
|
|
1805
|
+
const handleThemeSelect = (selectedTheme) => {
|
|
1806
|
+
if (variant === "with-save") {
|
|
1807
|
+
setTempTheme(selectedTheme);
|
|
1808
|
+
} else {
|
|
1809
|
+
setTheme(selectedTheme);
|
|
1810
|
+
}
|
|
1811
|
+
if (onToggle) {
|
|
1812
|
+
onToggle(selectedTheme);
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
const currentTheme = variant === "with-save" ? tempTheme : themeMode;
|
|
1816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-row gap-2 sm:gap-4 py-2", children: problemTypes.map((type) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1817
|
+
SelectionButton_default,
|
|
1818
|
+
{
|
|
1819
|
+
icon: type.icon,
|
|
1820
|
+
label: type.title,
|
|
1821
|
+
selected: currentTheme === type.id,
|
|
1822
|
+
onClick: () => handleThemeSelect(type.id),
|
|
1823
|
+
className: "w-full p-2 sm:p-4"
|
|
1824
|
+
},
|
|
1825
|
+
type.id
|
|
1826
|
+
)) });
|
|
1827
|
+
};
|
|
1828
|
+
|
|
1829
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
1830
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1831
|
+
function createDropdownStore() {
|
|
1832
|
+
return (0, import_zustand3.create)((set) => ({
|
|
1833
|
+
open: false,
|
|
1834
|
+
setOpen: (open) => set({ open })
|
|
1835
|
+
}));
|
|
1836
|
+
}
|
|
1837
|
+
var useDropdownStore = (externalStore) => {
|
|
1838
|
+
if (!externalStore) {
|
|
1839
|
+
throw new Error(
|
|
1840
|
+
"Component must be used within a DropdownMenu (store is missing)"
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
return externalStore;
|
|
1844
|
+
};
|
|
1845
|
+
var injectStore2 = (children, store) => {
|
|
1846
|
+
return import_react8.Children.map(children, (child) => {
|
|
1847
|
+
if ((0, import_react8.isValidElement)(child)) {
|
|
1848
|
+
const typedChild = child;
|
|
1849
|
+
const displayName = typedChild.type.displayName;
|
|
1850
|
+
const allowed = [
|
|
1851
|
+
"DropdownMenuTrigger",
|
|
1852
|
+
"DropdownContent",
|
|
1853
|
+
"DropdownMenuContent",
|
|
1854
|
+
"DropdownMenuSeparator",
|
|
1855
|
+
"DropdownMenuItem",
|
|
1856
|
+
"MenuLabel",
|
|
1857
|
+
"ProfileMenuTrigger",
|
|
1858
|
+
"ProfileMenuHeader",
|
|
1859
|
+
"ProfileMenuFooter",
|
|
1860
|
+
"ProfileToggleTheme"
|
|
1861
|
+
];
|
|
1862
|
+
let newProps = {};
|
|
1863
|
+
if (allowed.includes(displayName)) {
|
|
1864
|
+
newProps.store = store;
|
|
1865
|
+
}
|
|
1866
|
+
if (typedChild.props.children) {
|
|
1867
|
+
newProps.children = injectStore2(typedChild.props.children, store);
|
|
1868
|
+
}
|
|
1869
|
+
return (0, import_react8.cloneElement)(typedChild, newProps);
|
|
1870
|
+
}
|
|
1871
|
+
return child;
|
|
1872
|
+
});
|
|
1873
|
+
};
|
|
1874
|
+
var DropdownMenu = ({
|
|
1875
|
+
children,
|
|
1876
|
+
open: propOpen,
|
|
1877
|
+
onOpenChange
|
|
1878
|
+
}) => {
|
|
1879
|
+
const storeRef = (0, import_react8.useRef)(null);
|
|
1880
|
+
storeRef.current ??= createDropdownStore();
|
|
1881
|
+
const store = storeRef.current;
|
|
1882
|
+
const { open, setOpen: storeSetOpen } = (0, import_zustand3.useStore)(store, (s) => s);
|
|
1883
|
+
const setOpen = (newOpen) => {
|
|
1884
|
+
storeSetOpen(newOpen);
|
|
1885
|
+
};
|
|
1886
|
+
const menuRef = (0, import_react8.useRef)(null);
|
|
1887
|
+
const handleArrowDownOrArrowUp = (event) => {
|
|
1888
|
+
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
1889
|
+
if (menuContent) {
|
|
1890
|
+
event.preventDefault();
|
|
1891
|
+
const items = Array.from(
|
|
1892
|
+
menuContent.querySelectorAll(
|
|
1893
|
+
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
1894
|
+
)
|
|
1895
|
+
).filter((el) => el instanceof HTMLElement);
|
|
1896
|
+
if (items.length === 0) return;
|
|
1897
|
+
const focusedItem = document.activeElement;
|
|
1898
|
+
const currentIndex = items.findIndex((item) => item === focusedItem);
|
|
1899
|
+
let nextIndex;
|
|
1900
|
+
if (event.key === "ArrowDown") {
|
|
1901
|
+
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
1902
|
+
} else {
|
|
1903
|
+
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
1904
|
+
}
|
|
1905
|
+
items[nextIndex]?.focus();
|
|
1906
|
+
}
|
|
1907
|
+
};
|
|
1908
|
+
const handleDownkey = (event) => {
|
|
1909
|
+
if (event.key === "Escape") {
|
|
1910
|
+
setOpen(false);
|
|
1911
|
+
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
1912
|
+
handleArrowDownOrArrowUp(event);
|
|
1913
|
+
}
|
|
1914
|
+
};
|
|
1915
|
+
const handleClickOutside = (event) => {
|
|
1916
|
+
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
1917
|
+
setOpen(false);
|
|
1918
|
+
}
|
|
1919
|
+
};
|
|
1920
|
+
(0, import_react8.useEffect)(() => {
|
|
1921
|
+
if (open) {
|
|
1922
|
+
document.addEventListener("pointerdown", handleClickOutside);
|
|
1923
|
+
document.addEventListener("keydown", handleDownkey);
|
|
1924
|
+
}
|
|
1925
|
+
return () => {
|
|
1926
|
+
document.removeEventListener("pointerdown", handleClickOutside);
|
|
1927
|
+
document.removeEventListener("keydown", handleDownkey);
|
|
1928
|
+
};
|
|
1929
|
+
}, [open]);
|
|
1930
|
+
(0, import_react8.useEffect)(() => {
|
|
1931
|
+
onOpenChange?.(open);
|
|
1932
|
+
}, [open, onOpenChange]);
|
|
1933
|
+
(0, import_react8.useEffect)(() => {
|
|
1934
|
+
if (propOpen !== void 0) {
|
|
1935
|
+
setOpen(propOpen);
|
|
1936
|
+
}
|
|
1937
|
+
}, [propOpen]);
|
|
1938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative", ref: menuRef, children: injectStore2(children, store) });
|
|
1939
|
+
};
|
|
1940
|
+
var DropdownMenuTrigger = ({
|
|
1941
|
+
className,
|
|
1942
|
+
children,
|
|
1943
|
+
onClick,
|
|
1944
|
+
store: externalStore,
|
|
1945
|
+
...props
|
|
1946
|
+
}) => {
|
|
1947
|
+
const store = useDropdownStore(externalStore);
|
|
1948
|
+
const open = (0, import_zustand3.useStore)(store, (s) => s.open);
|
|
1949
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
1950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1951
|
+
"div",
|
|
1952
|
+
{
|
|
1953
|
+
onClick: (e) => {
|
|
1954
|
+
e.stopPropagation();
|
|
1955
|
+
toggleOpen();
|
|
1956
|
+
if (onClick) onClick(e);
|
|
1957
|
+
},
|
|
1958
|
+
role: "button",
|
|
1959
|
+
onKeyDown: (e) => {
|
|
1960
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1961
|
+
e.preventDefault();
|
|
1962
|
+
toggleOpen();
|
|
1963
|
+
if (onClick) onClick(e);
|
|
1964
|
+
}
|
|
1965
|
+
},
|
|
1966
|
+
tabIndex: 0,
|
|
1967
|
+
"aria-expanded": open,
|
|
1968
|
+
className: cn(className),
|
|
1969
|
+
...props,
|
|
1970
|
+
children
|
|
1971
|
+
}
|
|
1972
|
+
);
|
|
1973
|
+
};
|
|
1974
|
+
DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
|
|
1975
|
+
var ITEM_SIZE_CLASSES = {
|
|
1976
|
+
small: "text-sm",
|
|
1977
|
+
medium: "text-md"
|
|
1978
|
+
};
|
|
1979
|
+
var SIDE_CLASSES = {
|
|
1980
|
+
top: "bottom-full",
|
|
1981
|
+
right: "top-full",
|
|
1982
|
+
bottom: "top-full",
|
|
1983
|
+
left: "top-full"
|
|
1984
|
+
};
|
|
1985
|
+
var ALIGN_CLASSES = {
|
|
1986
|
+
start: "left-0",
|
|
1987
|
+
center: "left-1/2 -translate-x-1/2",
|
|
1988
|
+
end: "right-0"
|
|
1989
|
+
};
|
|
1990
|
+
var MENUCONTENT_VARIANT_CLASSES = {
|
|
1991
|
+
menu: "p-1",
|
|
1992
|
+
profile: "p-6"
|
|
1993
|
+
};
|
|
1994
|
+
var MenuLabel = (0, import_react8.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
|
|
1995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1996
|
+
"div",
|
|
1997
|
+
{
|
|
1998
|
+
ref,
|
|
1999
|
+
className: cn("text-sm w-full", inset ? "pl-8" : "", className),
|
|
2000
|
+
...props
|
|
2001
|
+
}
|
|
2002
|
+
);
|
|
2003
|
+
});
|
|
2004
|
+
MenuLabel.displayName = "MenuLabel";
|
|
2005
|
+
var DropdownMenuContent = (0, import_react8.forwardRef)(
|
|
2006
|
+
({
|
|
2007
|
+
className,
|
|
2008
|
+
align = "start",
|
|
2009
|
+
side = "bottom",
|
|
2010
|
+
variant = "menu",
|
|
2011
|
+
sideOffset = 4,
|
|
2012
|
+
children,
|
|
2013
|
+
store: externalStore,
|
|
2014
|
+
...props
|
|
2015
|
+
}, ref) => {
|
|
2016
|
+
const store = useDropdownStore(externalStore);
|
|
2017
|
+
const open = (0, import_zustand3.useStore)(store, (s) => s.open);
|
|
2018
|
+
const [isVisible, setIsVisible] = (0, import_react8.useState)(open);
|
|
2019
|
+
(0, import_react8.useEffect)(() => {
|
|
2020
|
+
if (open) {
|
|
2021
|
+
setIsVisible(true);
|
|
2022
|
+
} else {
|
|
2023
|
+
const timer = setTimeout(() => setIsVisible(false), 200);
|
|
2024
|
+
return () => clearTimeout(timer);
|
|
2025
|
+
}
|
|
2026
|
+
}, [open]);
|
|
2027
|
+
if (!isVisible) return null;
|
|
2028
|
+
const getPositionClasses = () => {
|
|
2029
|
+
const vertical = SIDE_CLASSES[side];
|
|
2030
|
+
const horizontal = ALIGN_CLASSES[align];
|
|
2031
|
+
return `absolute ${vertical} ${horizontal}`;
|
|
2032
|
+
};
|
|
2033
|
+
const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
|
|
2034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2035
|
+
"div",
|
|
2036
|
+
{
|
|
2037
|
+
ref,
|
|
2038
|
+
role: "menu",
|
|
2039
|
+
className: `
|
|
2040
|
+
bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md border-border-100
|
|
2041
|
+
${open ? "animate-in fade-in-0 zoom-in-95" : "animate-out fade-out-0 zoom-out-95"}
|
|
2042
|
+
${getPositionClasses()}
|
|
2043
|
+
${variantClasses}
|
|
2044
|
+
${className}
|
|
2045
|
+
`,
|
|
2046
|
+
style: {
|
|
2047
|
+
marginTop: side === "bottom" ? sideOffset : void 0,
|
|
2048
|
+
marginBottom: side === "top" ? sideOffset : void 0,
|
|
2049
|
+
marginLeft: side === "right" ? sideOffset : void 0,
|
|
2050
|
+
marginRight: side === "left" ? sideOffset : void 0
|
|
2051
|
+
},
|
|
2052
|
+
...props,
|
|
2053
|
+
children
|
|
2054
|
+
}
|
|
2055
|
+
);
|
|
2056
|
+
}
|
|
2057
|
+
);
|
|
2058
|
+
DropdownMenuContent.displayName = "DropdownMenuContent";
|
|
2059
|
+
var DropdownMenuItem = (0, import_react8.forwardRef)(
|
|
2060
|
+
({
|
|
2061
|
+
className,
|
|
2062
|
+
size = "small",
|
|
2063
|
+
children,
|
|
2064
|
+
iconRight,
|
|
2065
|
+
iconLeft,
|
|
2066
|
+
disabled = false,
|
|
2067
|
+
onClick,
|
|
2068
|
+
variant = "menu",
|
|
2069
|
+
store: externalStore,
|
|
2070
|
+
preventClose = false,
|
|
2071
|
+
...props
|
|
2072
|
+
}, ref) => {
|
|
2073
|
+
const store = useDropdownStore(externalStore);
|
|
2074
|
+
const setOpen = (0, import_zustand3.useStore)(store, (s) => s.setOpen);
|
|
2075
|
+
const sizeClasses = ITEM_SIZE_CLASSES[size];
|
|
2076
|
+
const handleClick = (e) => {
|
|
2077
|
+
if (disabled) {
|
|
2078
|
+
e.preventDefault();
|
|
2079
|
+
e.stopPropagation();
|
|
2080
|
+
return;
|
|
2081
|
+
}
|
|
2082
|
+
if (e.type === "click") {
|
|
2083
|
+
onClick?.(e);
|
|
2084
|
+
} else if (e.type === "keydown") {
|
|
2085
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2086
|
+
onClick?.(e);
|
|
2087
|
+
}
|
|
2088
|
+
props.onKeyDown?.(e);
|
|
2089
|
+
}
|
|
2090
|
+
if (!preventClose) {
|
|
2091
|
+
setOpen(false);
|
|
2092
|
+
}
|
|
2093
|
+
};
|
|
2094
|
+
const getVariantClasses = () => {
|
|
2095
|
+
if (variant === "profile") {
|
|
2096
|
+
return "relative flex flex-row justify-between select-none items-center gap-2 rounded-sm p-4 text-sm outline-none transition-colors [&>svg]:size-6 [&>svg]:shrink-0";
|
|
2097
|
+
}
|
|
2098
|
+
return "relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0";
|
|
2099
|
+
};
|
|
2100
|
+
const getVariantProps = () => {
|
|
2101
|
+
return variant === "profile" ? { "data-variant": "profile" } : {};
|
|
2102
|
+
};
|
|
2103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2104
|
+
"div",
|
|
2105
|
+
{
|
|
2106
|
+
ref,
|
|
2107
|
+
role: "menuitem",
|
|
2108
|
+
...getVariantProps(),
|
|
2109
|
+
"aria-disabled": disabled,
|
|
2110
|
+
className: `
|
|
2111
|
+
focus-visible:bg-background-50
|
|
2112
|
+
${getVariantClasses()}
|
|
2113
|
+
${sizeClasses}
|
|
2114
|
+
${className}
|
|
2115
|
+
${disabled ? "cursor-not-allowed text-text-400" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
2116
|
+
`,
|
|
2117
|
+
onClick: handleClick,
|
|
2118
|
+
onKeyDown: (e) => {
|
|
2119
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2120
|
+
e.preventDefault();
|
|
2121
|
+
e.stopPropagation();
|
|
2122
|
+
handleClick(e);
|
|
2123
|
+
}
|
|
2124
|
+
},
|
|
2125
|
+
tabIndex: disabled ? -1 : 0,
|
|
2126
|
+
...props,
|
|
2127
|
+
children: [
|
|
2128
|
+
iconLeft,
|
|
2129
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-full", children }),
|
|
2130
|
+
iconRight
|
|
2131
|
+
]
|
|
2132
|
+
}
|
|
2133
|
+
);
|
|
2134
|
+
}
|
|
2135
|
+
);
|
|
2136
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
2137
|
+
var DropdownMenuSeparator = (0, import_react8.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2138
|
+
"div",
|
|
2139
|
+
{
|
|
2140
|
+
ref,
|
|
2141
|
+
className: cn("my-1 h-px bg-border-200", className),
|
|
2142
|
+
...props
|
|
2143
|
+
}
|
|
2144
|
+
));
|
|
2145
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
2146
|
+
var ProfileMenuTrigger = (0, import_react8.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
|
|
2147
|
+
const store = useDropdownStore(externalStore);
|
|
2148
|
+
const open = (0, import_zustand3.useStore)(store, (s) => s.open);
|
|
2149
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
2150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2151
|
+
"button",
|
|
2152
|
+
{
|
|
2153
|
+
ref,
|
|
2154
|
+
className: cn(
|
|
2155
|
+
"rounded-lg size-10 bg-primary-50 flex items-center justify-center cursor-pointer",
|
|
2156
|
+
className
|
|
2157
|
+
),
|
|
2158
|
+
onClick: (e) => {
|
|
2159
|
+
e.stopPropagation();
|
|
2160
|
+
toggleOpen();
|
|
2161
|
+
onClick?.(e);
|
|
2162
|
+
},
|
|
2163
|
+
"aria-expanded": open,
|
|
2164
|
+
...props,
|
|
2165
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "size-6 rounded-full bg-primary-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.User, { className: "text-primary-950", size: 18 }) })
|
|
2166
|
+
}
|
|
2167
|
+
);
|
|
2168
|
+
});
|
|
2169
|
+
ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
|
|
2170
|
+
var ProfileMenuHeader = (0, import_react8.forwardRef)(({ className, name, email, photoUrl, store: _store, ...props }, ref) => {
|
|
2171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2172
|
+
"div",
|
|
2173
|
+
{
|
|
2174
|
+
ref,
|
|
2175
|
+
"data-component": "ProfileMenuHeader",
|
|
2176
|
+
className: cn(
|
|
2177
|
+
"flex flex-row gap-4 items-center min-w-[280px]",
|
|
2178
|
+
className
|
|
2179
|
+
),
|
|
2180
|
+
...props,
|
|
2181
|
+
children: [
|
|
2182
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-16 h-16 bg-primary-100 rounded-full flex items-center justify-center overflow-hidden flex-shrink-0", children: photoUrl ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2183
|
+
"img",
|
|
2184
|
+
{
|
|
2185
|
+
src: photoUrl,
|
|
2186
|
+
alt: "Foto de perfil",
|
|
2187
|
+
className: "w-full h-full object-cover"
|
|
2188
|
+
}
|
|
2189
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.User, { size: 34, className: "text-primary-800" }) }),
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col min-w-0", children: [
|
|
2191
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2192
|
+
Text_default,
|
|
2193
|
+
{
|
|
2194
|
+
size: "xl",
|
|
2195
|
+
weight: "bold",
|
|
2196
|
+
color: "text-text-950",
|
|
2197
|
+
className: "truncate",
|
|
2198
|
+
children: name
|
|
2199
|
+
}
|
|
2200
|
+
),
|
|
2201
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { size: "md", color: "text-text-600", className: "truncate", children: email })
|
|
2202
|
+
] })
|
|
2203
|
+
]
|
|
2204
|
+
}
|
|
2205
|
+
);
|
|
2206
|
+
});
|
|
2207
|
+
ProfileMenuHeader.displayName = "ProfileMenuHeader";
|
|
2208
|
+
var ProfileMenuInfo = (0, import_react8.forwardRef)(
|
|
2209
|
+
({
|
|
2210
|
+
className,
|
|
2211
|
+
schoolName,
|
|
2212
|
+
classYearName,
|
|
2213
|
+
schoolYearName,
|
|
2214
|
+
store: _store,
|
|
2215
|
+
...props
|
|
2216
|
+
}, ref) => {
|
|
2217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2218
|
+
"div",
|
|
2219
|
+
{
|
|
2220
|
+
ref,
|
|
2221
|
+
"data-component": "ProfileMenuInfo",
|
|
2222
|
+
className: cn("flex flex-row gap-4 items-center", className),
|
|
2223
|
+
...props,
|
|
2224
|
+
children: [
|
|
2225
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-16 h-16" }),
|
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col ", children: [
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { size: "md", color: "text-text-600", children: schoolName }),
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "flex flex-row items-center gap-2", children: [
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { size: "md", color: "text-text-600", children: classYearName }),
|
|
2230
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-text-600 text-xs align-middle", children: "\u25CF" }),
|
|
2231
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { size: "md", color: "text-text-600", children: schoolYearName })
|
|
2232
|
+
] })
|
|
2233
|
+
] })
|
|
2234
|
+
]
|
|
2235
|
+
}
|
|
2236
|
+
);
|
|
2237
|
+
}
|
|
2238
|
+
);
|
|
2239
|
+
ProfileMenuInfo.displayName = "ProfileMenuInfo";
|
|
2240
|
+
var ProfileToggleTheme = ({
|
|
2241
|
+
store: externalStore,
|
|
2242
|
+
...props
|
|
2243
|
+
}) => {
|
|
2244
|
+
const { themeMode, setTheme } = useTheme();
|
|
2245
|
+
const [modalThemeToggle, setModalThemeToggle] = (0, import_react8.useState)(false);
|
|
2246
|
+
const [selectedTheme, setSelectedTheme] = (0, import_react8.useState)(themeMode);
|
|
2247
|
+
const internalStoreRef = (0, import_react8.useRef)(null);
|
|
2248
|
+
internalStoreRef.current ??= createDropdownStore();
|
|
2249
|
+
const store = externalStore ?? internalStoreRef.current;
|
|
2250
|
+
const setOpen = (0, import_zustand3.useStore)(store, (s) => s.setOpen);
|
|
2251
|
+
const handleClick = (e) => {
|
|
2252
|
+
e.preventDefault();
|
|
2253
|
+
e.stopPropagation();
|
|
2254
|
+
setModalThemeToggle(true);
|
|
2255
|
+
};
|
|
2256
|
+
const handleSave = () => {
|
|
2257
|
+
setTheme(selectedTheme);
|
|
2258
|
+
setModalThemeToggle(false);
|
|
2259
|
+
setOpen(false);
|
|
2260
|
+
};
|
|
2261
|
+
const handleCancel = () => {
|
|
2262
|
+
setSelectedTheme(themeMode);
|
|
2263
|
+
setModalThemeToggle(false);
|
|
2264
|
+
setOpen(false);
|
|
2265
|
+
};
|
|
2266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2267
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2268
|
+
DropdownMenuItem,
|
|
2269
|
+
{
|
|
2270
|
+
variant: "profile",
|
|
2271
|
+
preventClose: true,
|
|
2272
|
+
store,
|
|
2273
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2274
|
+
"svg",
|
|
2275
|
+
{
|
|
2276
|
+
width: "24",
|
|
2277
|
+
height: "24",
|
|
2278
|
+
viewBox: "0 0 25 25",
|
|
2279
|
+
fill: "none",
|
|
2280
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2281
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2282
|
+
"path",
|
|
2283
|
+
{
|
|
2284
|
+
d: "M12.5 2.75C15.085 2.75276 17.5637 3.78054 19.3916 5.6084C21.2195 7.43628 22.2473 9.915 22.25 12.5C22.25 14.4284 21.6778 16.3136 20.6064 17.917C19.5352 19.5201 18.0128 20.7699 16.2314 21.5078C14.4499 22.2458 12.489 22.4387 10.5977 22.0625C8.70642 21.6863 6.96899 20.758 5.60547 19.3945C4.24197 18.031 3.31374 16.2936 2.9375 14.4023C2.56129 12.511 2.75423 10.5501 3.49219 8.76855C4.23012 6.98718 5.47982 5.46483 7.08301 4.39355C8.68639 3.32221 10.5716 2.75 12.5 2.75ZM11.75 4.28516C9.70145 4.47452 7.7973 5.42115 6.41016 6.94043C5.02299 8.4599 4.25247 10.4426 4.25 12.5C4.25247 14.5574 5.02299 16.5401 6.41016 18.0596C7.7973 19.5789 9.70145 20.5255 11.75 20.7148V4.28516Z",
|
|
2285
|
+
fill: "currentColor"
|
|
2286
|
+
}
|
|
2287
|
+
)
|
|
2288
|
+
}
|
|
2289
|
+
),
|
|
2290
|
+
iconRight: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.CaretRight, {}),
|
|
2291
|
+
onClick: handleClick,
|
|
2292
|
+
onKeyDown: (e) => {
|
|
2293
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2294
|
+
e.preventDefault();
|
|
2295
|
+
e.stopPropagation();
|
|
2296
|
+
setModalThemeToggle(true);
|
|
2297
|
+
}
|
|
2298
|
+
},
|
|
2299
|
+
...props,
|
|
2300
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { size: "md", color: "text-text-700", children: "Apar\xEAncia" })
|
|
2301
|
+
}
|
|
2302
|
+
),
|
|
2303
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2304
|
+
Modal_default,
|
|
2305
|
+
{
|
|
2306
|
+
isOpen: modalThemeToggle,
|
|
2307
|
+
onClose: handleCancel,
|
|
2308
|
+
title: "Apar\xEAncia",
|
|
2309
|
+
size: "md",
|
|
2310
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-3", children: [
|
|
2311
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button_default, { variant: "outline", onClick: handleCancel, children: "Cancelar" }),
|
|
2312
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button_default, { variant: "solid", onClick: handleSave, children: "Salvar" })
|
|
2313
|
+
] }),
|
|
2314
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col", children: [
|
|
2315
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-sm text-text-500", children: "Escolha o tema:" }),
|
|
2316
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThemeToggle, { variant: "with-save", onToggle: setSelectedTheme })
|
|
2317
|
+
] })
|
|
2318
|
+
}
|
|
2319
|
+
)
|
|
2320
|
+
] });
|
|
2321
|
+
};
|
|
2322
|
+
ProfileToggleTheme.displayName = "ProfileToggleTheme";
|
|
2323
|
+
var ProfileMenuSection = (0, import_react8.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
|
|
2324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
|
|
2325
|
+
});
|
|
2326
|
+
ProfileMenuSection.displayName = "ProfileMenuSection";
|
|
2327
|
+
var ProfileMenuFooter = ({
|
|
2328
|
+
className,
|
|
2329
|
+
disabled = false,
|
|
2330
|
+
onClick,
|
|
2331
|
+
store: externalStore,
|
|
2332
|
+
...props
|
|
2333
|
+
}) => {
|
|
2334
|
+
const store = useDropdownStore(externalStore);
|
|
2335
|
+
const setOpen = (0, import_zustand3.useStore)(store, (s) => s.setOpen);
|
|
2336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2337
|
+
Button_default,
|
|
2338
|
+
{
|
|
2339
|
+
variant: "outline",
|
|
2340
|
+
className: cn("w-full", className),
|
|
2341
|
+
disabled,
|
|
2342
|
+
onClick: (e) => {
|
|
2343
|
+
setOpen(false);
|
|
2344
|
+
onClick?.(e);
|
|
2345
|
+
},
|
|
2346
|
+
...props,
|
|
2347
|
+
children: [
|
|
2348
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.SignOut, { className: "text-inherit" }) }),
|
|
2349
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { color: "inherit", children: "Sair" })
|
|
2350
|
+
]
|
|
2351
|
+
}
|
|
2352
|
+
);
|
|
2353
|
+
};
|
|
2354
|
+
ProfileMenuFooter.displayName = "ProfileMenuFooter";
|
|
2355
|
+
var DropdownMenu_default = DropdownMenu;
|
|
2356
|
+
|
|
2357
|
+
// src/components/Chips/Chips.tsx
|
|
2358
|
+
var import_phosphor_react6 = require("phosphor-react");
|
|
2359
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2360
|
+
var STATE_CLASSES3 = {
|
|
2361
|
+
default: "bg-background text-text-950 border border-border-100 hover:bg-secondary-50 hover:border-border-300",
|
|
2362
|
+
selected: "bg-info-background text-primary-950 border-2 border-primary-950 hover:bg-secondary-50 focus-visible:border-0"
|
|
2363
|
+
};
|
|
2364
|
+
var Chips = ({
|
|
2365
|
+
children,
|
|
2366
|
+
selected = false,
|
|
2367
|
+
className = "",
|
|
2368
|
+
disabled,
|
|
2369
|
+
type = "button",
|
|
2370
|
+
...props
|
|
2371
|
+
}) => {
|
|
2372
|
+
const stateClasses = selected ? STATE_CLASSES3.selected : STATE_CLASSES3.default;
|
|
2373
|
+
const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-normal text-sm px-4 py-2 gap-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-primary-600 disabled:opacity-40 disabled:cursor-not-allowed";
|
|
2374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2375
|
+
"button",
|
|
2376
|
+
{
|
|
2377
|
+
className: cn(baseClasses, stateClasses, className),
|
|
2378
|
+
disabled,
|
|
2379
|
+
type,
|
|
2380
|
+
...props,
|
|
2381
|
+
children: [
|
|
2382
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: `flex items-center`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_phosphor_react6.Check, { weight: "bold", size: 16 }) }),
|
|
2383
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex-1", children })
|
|
2384
|
+
]
|
|
2385
|
+
}
|
|
2386
|
+
);
|
|
2387
|
+
};
|
|
2388
|
+
var Chips_default = Chips;
|
|
2389
|
+
|
|
2390
|
+
// src/components/ProgressBar/ProgressBar.tsx
|
|
2391
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2392
|
+
var SIZE_CLASSES6 = {
|
|
2393
|
+
small: {
|
|
2394
|
+
container: "h-1",
|
|
2395
|
+
// 4px height (h-1 = 4px in Tailwind)
|
|
2396
|
+
bar: "h-1",
|
|
2397
|
+
// 4px height for the fill bar
|
|
2398
|
+
spacing: "gap-2",
|
|
2399
|
+
// 8px gap between label and progress bar
|
|
2400
|
+
layout: "flex-col",
|
|
2401
|
+
// vertical layout for small
|
|
2402
|
+
borderRadius: "rounded-full"
|
|
2403
|
+
// 9999px border radius
|
|
2404
|
+
},
|
|
2405
|
+
medium: {
|
|
2406
|
+
container: "h-2",
|
|
2407
|
+
// 8px height (h-2 = 8px in Tailwind)
|
|
2408
|
+
bar: "h-2",
|
|
2409
|
+
// 8px height for the fill bar
|
|
2410
|
+
spacing: "gap-2",
|
|
2411
|
+
// 8px gap between progress bar and label
|
|
2412
|
+
layout: "flex-row items-center",
|
|
2413
|
+
// horizontal layout for medium
|
|
2414
|
+
borderRadius: "rounded-lg"
|
|
2415
|
+
// 8px border radius
|
|
2416
|
+
}
|
|
2417
|
+
};
|
|
2418
|
+
var VARIANT_CLASSES = {
|
|
2419
|
+
blue: {
|
|
2420
|
+
background: "bg-background-300",
|
|
2421
|
+
// Background track color (#D5D4D4)
|
|
2422
|
+
fill: "bg-primary-700"
|
|
2423
|
+
// Blue for activity progress (#2271C4)
|
|
2424
|
+
},
|
|
2425
|
+
green: {
|
|
2426
|
+
background: "bg-background-300",
|
|
2427
|
+
// Background track color (#D5D4D4)
|
|
2428
|
+
fill: "bg-success-200"
|
|
2429
|
+
// Green for performance (#84D3A2)
|
|
2430
|
+
}
|
|
2431
|
+
};
|
|
2432
|
+
var calculateProgressValues = (value, max) => {
|
|
2433
|
+
const safeValue = isNaN(value) ? 0 : value;
|
|
2434
|
+
const clampedValue = Math.max(0, Math.min(safeValue, max));
|
|
2435
|
+
const percentage = max === 0 ? 0 : clampedValue / max * 100;
|
|
2436
|
+
return { clampedValue, percentage };
|
|
2437
|
+
};
|
|
2438
|
+
var shouldShowHeader = (label, showPercentage, showHitCount) => {
|
|
2439
|
+
return !!(label || showPercentage || showHitCount);
|
|
2440
|
+
};
|
|
2441
|
+
var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
|
|
2442
|
+
if (showHitCount) {
|
|
2443
|
+
return {
|
|
2444
|
+
type: "hitCount",
|
|
2445
|
+
content: `${Math.round(clampedValue)} de ${max}`,
|
|
2446
|
+
hasMetrics: true
|
|
2447
|
+
};
|
|
2448
|
+
}
|
|
2449
|
+
if (showPercentage) {
|
|
2450
|
+
return {
|
|
2451
|
+
type: "percentage",
|
|
2452
|
+
content: `${Math.round(percentage)}%`,
|
|
2453
|
+
hasMetrics: true
|
|
2454
|
+
};
|
|
2455
|
+
}
|
|
2456
|
+
return {
|
|
2457
|
+
type: "label",
|
|
2458
|
+
content: label,
|
|
2459
|
+
hasMetrics: false
|
|
2460
|
+
};
|
|
2461
|
+
};
|
|
2462
|
+
var getCompactLayoutConfig = ({
|
|
2463
|
+
showPercentage,
|
|
2464
|
+
showHitCount,
|
|
2465
|
+
percentage,
|
|
2466
|
+
clampedValue,
|
|
2467
|
+
max,
|
|
2468
|
+
label,
|
|
2469
|
+
percentageClassName,
|
|
2470
|
+
labelClassName
|
|
2471
|
+
}) => {
|
|
2472
|
+
const displayPriority = getDisplayPriority(
|
|
2473
|
+
showHitCount,
|
|
2474
|
+
showPercentage,
|
|
2475
|
+
label,
|
|
2476
|
+
clampedValue,
|
|
2477
|
+
max,
|
|
2478
|
+
percentage
|
|
2479
|
+
);
|
|
2480
|
+
return {
|
|
2481
|
+
color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
|
|
2482
|
+
className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
|
|
2483
|
+
content: displayPriority.content
|
|
2484
|
+
};
|
|
2485
|
+
};
|
|
2486
|
+
var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
|
|
2487
|
+
showHeader: size === "small" && !!(label || showPercentage),
|
|
2488
|
+
showPercentage: size === "medium" && showPercentage,
|
|
2489
|
+
showLabel: size === "medium" && !!label && !showPercentage
|
|
2490
|
+
// Only show label when percentage is not shown
|
|
2491
|
+
});
|
|
2492
|
+
var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
|
|
2493
|
+
if (!showHitCount && !showPercentage) return null;
|
|
2494
|
+
const displayPriority = getDisplayPriority(
|
|
2495
|
+
showHitCount,
|
|
2496
|
+
showPercentage,
|
|
2497
|
+
null,
|
|
2498
|
+
// label is not relevant for stacked layout metrics display
|
|
2499
|
+
clampedValue,
|
|
2500
|
+
max,
|
|
2501
|
+
percentage
|
|
2502
|
+
);
|
|
2503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2504
|
+
"div",
|
|
2505
|
+
{
|
|
2506
|
+
className: cn(
|
|
2507
|
+
"text-xs font-medium leading-[14px] text-right",
|
|
2508
|
+
percentageClassName
|
|
2509
|
+
),
|
|
2510
|
+
children: displayPriority.type === "hitCount" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2511
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-success-200", children: Math.round(clampedValue) }),
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-text-600", children: [
|
|
2513
|
+
" de ",
|
|
2514
|
+
max
|
|
2515
|
+
] })
|
|
2516
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
|
|
2517
|
+
Math.round(percentage),
|
|
2518
|
+
"%"
|
|
2519
|
+
] })
|
|
2520
|
+
}
|
|
2521
|
+
);
|
|
2522
|
+
};
|
|
2523
|
+
var ProgressBarBase = ({
|
|
2524
|
+
clampedValue,
|
|
2525
|
+
max,
|
|
2526
|
+
percentage,
|
|
2527
|
+
label,
|
|
2528
|
+
variantClasses,
|
|
2529
|
+
containerClassName,
|
|
2530
|
+
fillClassName
|
|
2531
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2532
|
+
"div",
|
|
2533
|
+
{
|
|
2534
|
+
className: cn(
|
|
2535
|
+
containerClassName,
|
|
2536
|
+
variantClasses.background,
|
|
2537
|
+
"overflow-hidden relative"
|
|
2538
|
+
),
|
|
2539
|
+
children: [
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2541
|
+
"progress",
|
|
2542
|
+
{
|
|
2543
|
+
value: clampedValue,
|
|
2544
|
+
max,
|
|
2545
|
+
"aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
|
|
2546
|
+
className: "absolute inset-0 w-full h-full opacity-0"
|
|
2547
|
+
}
|
|
2548
|
+
),
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2550
|
+
"div",
|
|
2551
|
+
{
|
|
2552
|
+
className: cn(
|
|
2553
|
+
fillClassName,
|
|
2554
|
+
variantClasses.fill,
|
|
2555
|
+
"transition-all duration-300 ease-out"
|
|
2556
|
+
),
|
|
2557
|
+
style: { width: `${percentage}%` }
|
|
2558
|
+
}
|
|
2559
|
+
)
|
|
2560
|
+
]
|
|
2561
|
+
}
|
|
2562
|
+
);
|
|
2563
|
+
var StackedLayout = ({
|
|
2564
|
+
className,
|
|
2565
|
+
label,
|
|
2566
|
+
showPercentage,
|
|
2567
|
+
showHitCount,
|
|
2568
|
+
labelClassName,
|
|
2569
|
+
percentageClassName,
|
|
2570
|
+
clampedValue,
|
|
2571
|
+
max,
|
|
2572
|
+
percentage,
|
|
2573
|
+
variantClasses,
|
|
2574
|
+
dimensions
|
|
2575
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2576
|
+
"div",
|
|
2577
|
+
{
|
|
2578
|
+
className: cn(
|
|
2579
|
+
"flex flex-col items-start gap-2",
|
|
2580
|
+
dimensions.width,
|
|
2581
|
+
dimensions.height,
|
|
2582
|
+
className
|
|
2583
|
+
),
|
|
2584
|
+
children: [
|
|
2585
|
+
shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
|
|
2586
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2587
|
+
Text_default,
|
|
2588
|
+
{
|
|
2589
|
+
as: "div",
|
|
2590
|
+
size: "md",
|
|
2591
|
+
weight: "medium",
|
|
2592
|
+
className: cn("text-text-600 leading-[19px]", labelClassName),
|
|
2593
|
+
children: label
|
|
2594
|
+
}
|
|
2595
|
+
),
|
|
2596
|
+
renderStackedHitCountDisplay(
|
|
2597
|
+
showHitCount,
|
|
2598
|
+
showPercentage,
|
|
2599
|
+
clampedValue,
|
|
2600
|
+
max,
|
|
2601
|
+
percentage,
|
|
2602
|
+
percentageClassName
|
|
2603
|
+
)
|
|
2604
|
+
] }),
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2606
|
+
ProgressBarBase,
|
|
2607
|
+
{
|
|
2608
|
+
clampedValue,
|
|
2609
|
+
max,
|
|
2610
|
+
percentage,
|
|
2611
|
+
label,
|
|
2612
|
+
variantClasses,
|
|
2613
|
+
containerClassName: "w-full h-2 rounded-lg",
|
|
2614
|
+
fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
|
|
2615
|
+
}
|
|
2616
|
+
)
|
|
2617
|
+
]
|
|
2618
|
+
}
|
|
2619
|
+
);
|
|
2620
|
+
var CompactLayout = ({
|
|
2621
|
+
className,
|
|
2622
|
+
label,
|
|
2623
|
+
showPercentage,
|
|
2624
|
+
showHitCount,
|
|
2625
|
+
labelClassName,
|
|
2626
|
+
percentageClassName,
|
|
2627
|
+
clampedValue,
|
|
2628
|
+
max,
|
|
2629
|
+
percentage,
|
|
2630
|
+
variantClasses,
|
|
2631
|
+
dimensions
|
|
2632
|
+
}) => {
|
|
2633
|
+
const {
|
|
2634
|
+
color,
|
|
2635
|
+
className: compactClassName,
|
|
2636
|
+
content
|
|
2637
|
+
} = getCompactLayoutConfig({
|
|
2638
|
+
showPercentage,
|
|
2639
|
+
showHitCount,
|
|
2640
|
+
percentage,
|
|
2641
|
+
clampedValue,
|
|
2642
|
+
max,
|
|
2643
|
+
label,
|
|
2644
|
+
percentageClassName,
|
|
2645
|
+
labelClassName
|
|
2646
|
+
});
|
|
2647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2648
|
+
"div",
|
|
2649
|
+
{
|
|
2650
|
+
className: cn(
|
|
2651
|
+
"flex flex-col items-start gap-1",
|
|
2652
|
+
dimensions.width,
|
|
2653
|
+
dimensions.height,
|
|
2654
|
+
className
|
|
2655
|
+
),
|
|
2656
|
+
children: [
|
|
2657
|
+
shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2658
|
+
Text_default,
|
|
2659
|
+
{
|
|
2660
|
+
as: "div",
|
|
2661
|
+
size: "sm",
|
|
2662
|
+
weight: "medium",
|
|
2663
|
+
color,
|
|
2664
|
+
className: cn("leading-4 w-full", compactClassName),
|
|
2665
|
+
children: content
|
|
2666
|
+
}
|
|
2667
|
+
),
|
|
2668
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2669
|
+
ProgressBarBase,
|
|
2670
|
+
{
|
|
2671
|
+
clampedValue,
|
|
2672
|
+
max,
|
|
2673
|
+
percentage,
|
|
2674
|
+
label,
|
|
2675
|
+
variantClasses,
|
|
2676
|
+
containerClassName: "w-full h-1 rounded-full",
|
|
2677
|
+
fillClassName: "h-1 rounded-full"
|
|
2678
|
+
}
|
|
2679
|
+
)
|
|
2680
|
+
]
|
|
2681
|
+
}
|
|
2682
|
+
);
|
|
2683
|
+
};
|
|
2684
|
+
var DefaultLayout = ({
|
|
2685
|
+
className,
|
|
2686
|
+
size,
|
|
2687
|
+
sizeClasses,
|
|
2688
|
+
variantClasses,
|
|
2689
|
+
label,
|
|
2690
|
+
showPercentage,
|
|
2691
|
+
labelClassName,
|
|
2692
|
+
percentageClassName,
|
|
2693
|
+
clampedValue,
|
|
2694
|
+
max,
|
|
2695
|
+
percentage
|
|
2696
|
+
}) => {
|
|
2697
|
+
const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
|
|
2698
|
+
const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
|
|
2699
|
+
const displayConfig = getDefaultLayoutDisplayConfig(
|
|
2700
|
+
size,
|
|
2701
|
+
label,
|
|
2702
|
+
showPercentage
|
|
2703
|
+
);
|
|
2704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("flex", sizeClasses.layout, gapClass, className), children: [
|
|
2705
|
+
displayConfig.showHeader && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-row items-center justify-between w-full", children: [
|
|
2706
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2707
|
+
Text_default,
|
|
2708
|
+
{
|
|
2709
|
+
as: "div",
|
|
2710
|
+
size: "xs",
|
|
2711
|
+
weight: "medium",
|
|
2712
|
+
className: cn(
|
|
2713
|
+
"text-text-950 leading-none tracking-normal text-center",
|
|
2714
|
+
labelClassName
|
|
2715
|
+
),
|
|
2716
|
+
children: label
|
|
2717
|
+
}
|
|
2718
|
+
),
|
|
2719
|
+
showPercentage && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2720
|
+
Text_default,
|
|
2721
|
+
{
|
|
2722
|
+
size: "xs",
|
|
2723
|
+
weight: "medium",
|
|
2724
|
+
className: cn(
|
|
2725
|
+
"text-text-950 leading-none tracking-normal text-center",
|
|
2726
|
+
percentageClassName
|
|
2727
|
+
),
|
|
2728
|
+
children: [
|
|
2729
|
+
Math.round(percentage),
|
|
2730
|
+
"%"
|
|
2731
|
+
]
|
|
2732
|
+
}
|
|
2733
|
+
)
|
|
2734
|
+
] }),
|
|
2735
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2736
|
+
ProgressBarBase,
|
|
2737
|
+
{
|
|
2738
|
+
clampedValue,
|
|
2739
|
+
max,
|
|
2740
|
+
percentage,
|
|
2741
|
+
label,
|
|
2742
|
+
variantClasses,
|
|
2743
|
+
containerClassName: cn(
|
|
2744
|
+
progressBarClass,
|
|
2745
|
+
sizeClasses.container,
|
|
2746
|
+
sizeClasses.borderRadius
|
|
2747
|
+
),
|
|
2748
|
+
fillClassName: cn(
|
|
2749
|
+
sizeClasses.bar,
|
|
2750
|
+
sizeClasses.borderRadius,
|
|
2751
|
+
"shadow-hard-shadow-3"
|
|
2752
|
+
)
|
|
2753
|
+
}
|
|
2754
|
+
),
|
|
2755
|
+
displayConfig.showPercentage && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2756
|
+
Text_default,
|
|
2757
|
+
{
|
|
2758
|
+
size: "xs",
|
|
2759
|
+
weight: "medium",
|
|
2760
|
+
className: cn(
|
|
2761
|
+
"text-text-950 leading-none tracking-normal text-center flex-none",
|
|
2762
|
+
percentageClassName
|
|
2763
|
+
),
|
|
2764
|
+
children: [
|
|
2765
|
+
Math.round(percentage),
|
|
2766
|
+
"%"
|
|
2767
|
+
]
|
|
2768
|
+
}
|
|
2769
|
+
),
|
|
2770
|
+
displayConfig.showLabel && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2771
|
+
Text_default,
|
|
2772
|
+
{
|
|
2773
|
+
as: "div",
|
|
2774
|
+
size: "xs",
|
|
2775
|
+
weight: "medium",
|
|
2776
|
+
className: cn(
|
|
2777
|
+
"text-text-950 leading-none tracking-normal text-center flex-none",
|
|
2778
|
+
labelClassName
|
|
2779
|
+
),
|
|
2780
|
+
children: label
|
|
2781
|
+
}
|
|
2782
|
+
)
|
|
2783
|
+
] });
|
|
2784
|
+
};
|
|
2785
|
+
var ProgressBar = ({
|
|
2786
|
+
value,
|
|
2787
|
+
max = 100,
|
|
2788
|
+
size = "medium",
|
|
2789
|
+
variant = "blue",
|
|
2790
|
+
layout = "default",
|
|
2791
|
+
label,
|
|
2792
|
+
showPercentage = false,
|
|
2793
|
+
showHitCount = false,
|
|
2794
|
+
className = "",
|
|
2795
|
+
labelClassName = "",
|
|
2796
|
+
percentageClassName = "",
|
|
2797
|
+
stackedWidth,
|
|
2798
|
+
stackedHeight,
|
|
2799
|
+
compactWidth,
|
|
2800
|
+
compactHeight
|
|
2801
|
+
}) => {
|
|
2802
|
+
const { clampedValue, percentage } = calculateProgressValues(value, max);
|
|
2803
|
+
const sizeClasses = SIZE_CLASSES6[size];
|
|
2804
|
+
const variantClasses = VARIANT_CLASSES[variant];
|
|
2805
|
+
if (layout === "stacked") {
|
|
2806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2807
|
+
StackedLayout,
|
|
2808
|
+
{
|
|
2809
|
+
className,
|
|
2810
|
+
label,
|
|
2811
|
+
showPercentage,
|
|
2812
|
+
showHitCount,
|
|
2813
|
+
labelClassName,
|
|
2814
|
+
percentageClassName,
|
|
2815
|
+
clampedValue,
|
|
2816
|
+
max,
|
|
2817
|
+
percentage,
|
|
2818
|
+
variantClasses,
|
|
2819
|
+
dimensions: {
|
|
2820
|
+
width: stackedWidth ?? "w-[380px]",
|
|
2821
|
+
height: stackedHeight ?? "h-[35px]"
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
);
|
|
2825
|
+
}
|
|
2826
|
+
if (layout === "compact") {
|
|
2827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2828
|
+
CompactLayout,
|
|
2829
|
+
{
|
|
2830
|
+
className,
|
|
2831
|
+
label,
|
|
2832
|
+
showPercentage,
|
|
2833
|
+
showHitCount,
|
|
2834
|
+
labelClassName,
|
|
2835
|
+
percentageClassName,
|
|
2836
|
+
clampedValue,
|
|
2837
|
+
max,
|
|
2838
|
+
percentage,
|
|
2839
|
+
variantClasses,
|
|
2840
|
+
dimensions: {
|
|
2841
|
+
width: compactWidth ?? "w-[131px]",
|
|
2842
|
+
height: compactHeight ?? "h-[24px]"
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
);
|
|
2846
|
+
}
|
|
2847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2848
|
+
DefaultLayout,
|
|
2849
|
+
{
|
|
2850
|
+
className,
|
|
2851
|
+
size,
|
|
2852
|
+
sizeClasses,
|
|
2853
|
+
variantClasses,
|
|
2854
|
+
label,
|
|
2855
|
+
showPercentage,
|
|
2856
|
+
labelClassName,
|
|
2857
|
+
percentageClassName,
|
|
2858
|
+
clampedValue,
|
|
2859
|
+
max,
|
|
2860
|
+
percentage
|
|
2861
|
+
}
|
|
2862
|
+
);
|
|
2863
|
+
};
|
|
2864
|
+
var ProgressBar_default = ProgressBar;
|
|
2865
|
+
|
|
2866
|
+
// src/assets/icons/subjects/ChatEN.tsx
|
|
2867
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2868
|
+
var ChatEN = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2869
|
+
"svg",
|
|
2870
|
+
{
|
|
2871
|
+
width: size,
|
|
2872
|
+
height: size,
|
|
2873
|
+
viewBox: "0 0 32 32",
|
|
2874
|
+
fill: "none",
|
|
2875
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2876
|
+
children: [
|
|
2877
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2878
|
+
"path",
|
|
2879
|
+
{
|
|
2880
|
+
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",
|
|
2881
|
+
fill: color
|
|
2882
|
+
}
|
|
2883
|
+
),
|
|
2884
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2885
|
+
"path",
|
|
2886
|
+
{
|
|
2887
|
+
d: "M22.5488 12V20.5312H21.0781L17.252 14.4199V20.5312H15.7812V12H17.252L21.0898 18.123V12H22.5488Z",
|
|
2888
|
+
fill: color
|
|
2889
|
+
}
|
|
2890
|
+
),
|
|
2891
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2892
|
+
"path",
|
|
2893
|
+
{
|
|
2894
|
+
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",
|
|
2895
|
+
fill: color
|
|
2896
|
+
}
|
|
2897
|
+
)
|
|
2898
|
+
]
|
|
2899
|
+
}
|
|
2900
|
+
);
|
|
2901
|
+
|
|
2902
|
+
// src/assets/icons/subjects/ChatES.tsx
|
|
2903
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2904
|
+
var ChatES = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2905
|
+
"svg",
|
|
2906
|
+
{
|
|
2907
|
+
width: size,
|
|
2908
|
+
height: size,
|
|
2909
|
+
viewBox: "0 0 32 32",
|
|
2910
|
+
fill: "none",
|
|
2911
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2912
|
+
children: [
|
|
2913
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2914
|
+
"path",
|
|
2915
|
+
{
|
|
2916
|
+
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",
|
|
2917
|
+
fill: color
|
|
2918
|
+
}
|
|
2919
|
+
),
|
|
2920
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2921
|
+
"path",
|
|
2922
|
+
{
|
|
2923
|
+
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",
|
|
2924
|
+
fill: color
|
|
2925
|
+
}
|
|
2926
|
+
),
|
|
2927
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2928
|
+
"path",
|
|
2929
|
+
{
|
|
2930
|
+
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",
|
|
2931
|
+
fill: color
|
|
2932
|
+
}
|
|
2933
|
+
)
|
|
2934
|
+
]
|
|
2935
|
+
}
|
|
2936
|
+
);
|
|
2937
|
+
|
|
2938
|
+
// src/assets/icons/subjects/ChatPT.tsx
|
|
2939
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2940
|
+
var ChatPT = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2941
|
+
"svg",
|
|
2942
|
+
{
|
|
2943
|
+
width: size,
|
|
2944
|
+
height: size,
|
|
2945
|
+
viewBox: "0 0 32 32",
|
|
2946
|
+
fill: "none",
|
|
2947
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2948
|
+
children: [
|
|
2949
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2950
|
+
"path",
|
|
2951
|
+
{
|
|
2952
|
+
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",
|
|
2953
|
+
fill: color
|
|
2954
|
+
}
|
|
2955
|
+
),
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2957
|
+
"path",
|
|
2958
|
+
{
|
|
2959
|
+
d: "M21.1758 12V20.5312H19.7168V12H21.1758ZM23.8535 12V13.1719H17.0625V12H23.8535Z",
|
|
2960
|
+
fill: color
|
|
2961
|
+
}
|
|
2962
|
+
),
|
|
2963
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2964
|
+
"path",
|
|
2965
|
+
{
|
|
2966
|
+
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",
|
|
2967
|
+
fill: color
|
|
2968
|
+
}
|
|
2969
|
+
)
|
|
2970
|
+
]
|
|
2971
|
+
}
|
|
2972
|
+
);
|
|
2973
|
+
|
|
2974
|
+
// src/types/questionTypes.ts
|
|
2975
|
+
var questionTypeLabels = {
|
|
2976
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: "Alternativa",
|
|
2977
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: "Verdadeiro ou Falso",
|
|
2978
|
+
["DISSERTATIVA" /* DISSERTATIVA */]: "Discursiva",
|
|
2979
|
+
["IMAGEM" /* IMAGEM */]: "Imagem",
|
|
2980
|
+
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: "M\xFAltipla Escolha",
|
|
2981
|
+
["LIGAR_PONTOS" /* LIGAR_PONTOS */]: "Ligar Pontos",
|
|
2982
|
+
["PREENCHER" /* PREENCHER */]: "Preencher Lacunas"
|
|
2983
|
+
};
|
|
2984
|
+
|
|
2985
|
+
// src/components/Card/Card.tsx
|
|
2986
|
+
var import_react10 = require("react");
|
|
2987
|
+
var import_phosphor_react7 = require("phosphor-react");
|
|
2988
|
+
|
|
2989
|
+
// src/components/IconRender/IconRender.tsx
|
|
2990
|
+
var import_react9 = require("react");
|
|
2991
|
+
var PhosphorIcons = __toESM(require("phosphor-react"));
|
|
2992
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2993
|
+
var IconRender = ({
|
|
2994
|
+
iconName,
|
|
2995
|
+
color = "#000000",
|
|
2996
|
+
size = 24,
|
|
2997
|
+
weight = "regular"
|
|
2998
|
+
}) => {
|
|
2999
|
+
if (typeof iconName === "string") {
|
|
3000
|
+
switch (iconName) {
|
|
3001
|
+
case "Chat_PT":
|
|
3002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChatPT, { size, color });
|
|
3003
|
+
case "Chat_EN":
|
|
3004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChatEN, { size, color });
|
|
3005
|
+
case "Chat_ES":
|
|
3006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChatES, { size, color });
|
|
3007
|
+
default: {
|
|
3008
|
+
const IconComponent = PhosphorIcons[iconName] || PhosphorIcons.Question;
|
|
3009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconComponent, { size, color, weight });
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
} else {
|
|
3013
|
+
return (0, import_react9.cloneElement)(iconName, {
|
|
3014
|
+
size,
|
|
3015
|
+
color: "currentColor"
|
|
3016
|
+
});
|
|
3017
|
+
}
|
|
3018
|
+
};
|
|
3019
|
+
var IconRender_default = IconRender;
|
|
3020
|
+
|
|
3021
|
+
// src/components/Card/Card.tsx
|
|
3022
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3023
|
+
var CARD_BASE_CLASSES = {
|
|
3024
|
+
default: "w-full bg-background border border-border-50 rounded-xl",
|
|
3025
|
+
compact: "w-full bg-background border border-border-50 rounded-lg",
|
|
3026
|
+
minimal: "w-full bg-background border border-border-100 rounded-md"
|
|
3027
|
+
};
|
|
3028
|
+
var CARD_PADDING_CLASSES = {
|
|
3029
|
+
none: "",
|
|
3030
|
+
small: "p-2",
|
|
3031
|
+
medium: "p-4",
|
|
3032
|
+
large: "p-6"
|
|
3033
|
+
};
|
|
3034
|
+
var CARD_MIN_HEIGHT_CLASSES = {
|
|
3035
|
+
none: "",
|
|
3036
|
+
small: "min-h-16",
|
|
3037
|
+
medium: "min-h-20",
|
|
3038
|
+
large: "min-h-24"
|
|
3039
|
+
};
|
|
3040
|
+
var CARD_LAYOUT_CLASSES = {
|
|
3041
|
+
horizontal: "flex flex-row",
|
|
3042
|
+
vertical: "flex flex-col"
|
|
3043
|
+
};
|
|
3044
|
+
var CARD_CURSOR_CLASSES = {
|
|
3045
|
+
default: "",
|
|
3046
|
+
pointer: "cursor-pointer"
|
|
3047
|
+
};
|
|
3048
|
+
var CardBase = (0, import_react10.forwardRef)(
|
|
3049
|
+
({
|
|
3050
|
+
children,
|
|
3051
|
+
variant = "default",
|
|
3052
|
+
layout = "horizontal",
|
|
3053
|
+
padding = "medium",
|
|
3054
|
+
minHeight = "medium",
|
|
3055
|
+
cursor = "default",
|
|
3056
|
+
className = "",
|
|
3057
|
+
...props
|
|
3058
|
+
}, ref) => {
|
|
3059
|
+
const baseClasses = CARD_BASE_CLASSES[variant];
|
|
3060
|
+
const paddingClasses = CARD_PADDING_CLASSES[padding];
|
|
3061
|
+
const minHeightClasses = CARD_MIN_HEIGHT_CLASSES[minHeight];
|
|
3062
|
+
const layoutClasses = CARD_LAYOUT_CLASSES[layout];
|
|
3063
|
+
const cursorClasses = CARD_CURSOR_CLASSES[cursor];
|
|
3064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3065
|
+
"div",
|
|
3066
|
+
{
|
|
3067
|
+
ref,
|
|
3068
|
+
className: cn(
|
|
3069
|
+
baseClasses,
|
|
3070
|
+
paddingClasses,
|
|
3071
|
+
minHeightClasses,
|
|
3072
|
+
layoutClasses,
|
|
3073
|
+
cursorClasses,
|
|
3074
|
+
className
|
|
3075
|
+
),
|
|
3076
|
+
...props,
|
|
3077
|
+
children
|
|
3078
|
+
}
|
|
3079
|
+
);
|
|
3080
|
+
}
|
|
3081
|
+
);
|
|
3082
|
+
var ACTION_CARD_CLASSES = {
|
|
3083
|
+
warning: "bg-warning-background",
|
|
3084
|
+
success: "bg-success-200",
|
|
3085
|
+
error: "bg-error-100",
|
|
3086
|
+
info: "bg-info-background"
|
|
3087
|
+
};
|
|
3088
|
+
var ACTION_ICON_CLASSES = {
|
|
3089
|
+
warning: "bg-warning-300 text-text",
|
|
3090
|
+
success: "bg-indicator-positive text-text-950",
|
|
3091
|
+
error: "bg-indicator-negative text-text",
|
|
3092
|
+
info: "bg-info-500 text-text"
|
|
3093
|
+
};
|
|
3094
|
+
var ACTION_SUBTITLE_CLASSES = {
|
|
3095
|
+
warning: "text-warning-600",
|
|
3096
|
+
success: "text-success-700",
|
|
3097
|
+
error: "text-error-700",
|
|
3098
|
+
info: "text-info-700"
|
|
3099
|
+
};
|
|
3100
|
+
var ACTION_HEADER_CLASSES = {
|
|
3101
|
+
warning: "text-warning-300",
|
|
3102
|
+
success: "text-success-300",
|
|
3103
|
+
error: "text-error-300",
|
|
3104
|
+
info: "text-info-300"
|
|
3105
|
+
};
|
|
3106
|
+
var CardActivitiesResults = (0, import_react10.forwardRef)(
|
|
3107
|
+
({
|
|
3108
|
+
icon,
|
|
3109
|
+
title,
|
|
3110
|
+
subTitle,
|
|
3111
|
+
header,
|
|
3112
|
+
extended = false,
|
|
3113
|
+
action = "success",
|
|
3114
|
+
description,
|
|
3115
|
+
className,
|
|
3116
|
+
...props
|
|
3117
|
+
}, ref) => {
|
|
3118
|
+
const actionCardClasses = ACTION_CARD_CLASSES[action];
|
|
3119
|
+
const actionIconClasses = ACTION_ICON_CLASSES[action];
|
|
3120
|
+
const actionSubTitleClasses = ACTION_SUBTITLE_CLASSES[action];
|
|
3121
|
+
const actionHeaderClasses = ACTION_HEADER_CLASSES[action];
|
|
3122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3123
|
+
"div",
|
|
3124
|
+
{
|
|
3125
|
+
ref,
|
|
3126
|
+
className: cn(
|
|
3127
|
+
"w-full flex flex-col border border-border-50 bg-background rounded-xl",
|
|
3128
|
+
className
|
|
3129
|
+
),
|
|
3130
|
+
...props,
|
|
3131
|
+
children: [
|
|
3132
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3133
|
+
"div",
|
|
3134
|
+
{
|
|
3135
|
+
className: cn(
|
|
3136
|
+
"flex flex-col gap-1 items-center justify-center p-4",
|
|
3137
|
+
actionCardClasses,
|
|
3138
|
+
extended ? "rounded-t-xl" : "rounded-xl"
|
|
3139
|
+
),
|
|
3140
|
+
children: [
|
|
3141
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3142
|
+
"span",
|
|
3143
|
+
{
|
|
3144
|
+
className: cn(
|
|
3145
|
+
"size-7.5 rounded-full flex items-center justify-center",
|
|
3146
|
+
actionIconClasses
|
|
3147
|
+
),
|
|
3148
|
+
children: icon
|
|
3149
|
+
}
|
|
3150
|
+
),
|
|
3151
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3152
|
+
Text_default,
|
|
3153
|
+
{
|
|
3154
|
+
size: "2xs",
|
|
3155
|
+
weight: "medium",
|
|
3156
|
+
className: "text-text-800 uppercase truncate",
|
|
3157
|
+
children: title
|
|
3158
|
+
}
|
|
3159
|
+
),
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3161
|
+
"p",
|
|
3162
|
+
{
|
|
3163
|
+
className: cn("text-lg font-bold truncate", actionSubTitleClasses),
|
|
3164
|
+
children: subTitle
|
|
3165
|
+
}
|
|
3166
|
+
)
|
|
3167
|
+
]
|
|
3168
|
+
}
|
|
3169
|
+
),
|
|
3170
|
+
extended && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col items-center gap-2.5 pb-9.5 pt-2.5", children: [
|
|
3171
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3172
|
+
"p",
|
|
3173
|
+
{
|
|
3174
|
+
className: cn(
|
|
3175
|
+
"text-2xs font-medium uppercase truncate",
|
|
3176
|
+
actionHeaderClasses
|
|
3177
|
+
),
|
|
3178
|
+
children: header
|
|
3179
|
+
}
|
|
3180
|
+
),
|
|
3181
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { size: "large", action: "info", children: description })
|
|
3182
|
+
] })
|
|
3183
|
+
]
|
|
3184
|
+
}
|
|
3185
|
+
);
|
|
3186
|
+
}
|
|
3187
|
+
);
|
|
3188
|
+
var CardQuestions = (0, import_react10.forwardRef)(
|
|
3189
|
+
({
|
|
3190
|
+
header,
|
|
3191
|
+
state = "undone",
|
|
3192
|
+
className,
|
|
3193
|
+
onClickButton,
|
|
3194
|
+
valueButton,
|
|
3195
|
+
...props
|
|
3196
|
+
}, ref) => {
|
|
3197
|
+
const isDone = state === "done";
|
|
3198
|
+
const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
|
|
3199
|
+
const buttonLabel = isDone ? "Ver Resultado" : "Responder";
|
|
3200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3201
|
+
CardBase,
|
|
3202
|
+
{
|
|
3203
|
+
ref,
|
|
3204
|
+
layout: "horizontal",
|
|
3205
|
+
padding: "medium",
|
|
3206
|
+
minHeight: "medium",
|
|
3207
|
+
className: cn("justify-between gap-4", className),
|
|
3208
|
+
...props,
|
|
3209
|
+
children: [
|
|
3210
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
|
|
3211
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "font-bold text-xs text-text-950 truncate", children: header }),
|
|
3212
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-row gap-6 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3213
|
+
Badge_default,
|
|
3214
|
+
{
|
|
3215
|
+
size: "medium",
|
|
3216
|
+
variant: "solid",
|
|
3217
|
+
action: isDone ? "success" : "error",
|
|
3218
|
+
children: stateLabel
|
|
3219
|
+
}
|
|
3220
|
+
) })
|
|
3221
|
+
] }),
|
|
3222
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3223
|
+
Button_default,
|
|
3224
|
+
{
|
|
3225
|
+
size: "extra-small",
|
|
3226
|
+
onClick: () => onClickButton?.(valueButton),
|
|
3227
|
+
className: "min-w-fit",
|
|
3228
|
+
children: buttonLabel
|
|
3229
|
+
}
|
|
3230
|
+
) })
|
|
3231
|
+
]
|
|
3232
|
+
}
|
|
3233
|
+
);
|
|
3234
|
+
}
|
|
3235
|
+
);
|
|
3236
|
+
var CardProgress = (0, import_react10.forwardRef)(
|
|
3237
|
+
({
|
|
3238
|
+
header,
|
|
3239
|
+
subhead,
|
|
3240
|
+
initialDate,
|
|
3241
|
+
endDate,
|
|
3242
|
+
progress = 0,
|
|
3243
|
+
direction = "horizontal",
|
|
3244
|
+
icon,
|
|
3245
|
+
color = "#B7DFFF",
|
|
3246
|
+
progressVariant = "blue",
|
|
3247
|
+
showDates = true,
|
|
3248
|
+
className,
|
|
3249
|
+
...props
|
|
3250
|
+
}, ref) => {
|
|
3251
|
+
const isHorizontal = direction === "horizontal";
|
|
3252
|
+
const contentComponent = {
|
|
3253
|
+
horizontal: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3254
|
+
showDates && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row gap-6 items-center", children: [
|
|
3255
|
+
initialDate && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
|
|
3256
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-800 font-semibold", children: "In\xEDcio" }),
|
|
3257
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-600", children: initialDate })
|
|
3258
|
+
] }),
|
|
3259
|
+
endDate && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
|
|
3260
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-800 font-semibold", children: "Fim" }),
|
|
3261
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-600", children: endDate })
|
|
3262
|
+
] })
|
|
3263
|
+
] }),
|
|
3264
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
|
|
3265
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3266
|
+
ProgressBar_default,
|
|
3267
|
+
{
|
|
3268
|
+
size: "small",
|
|
3269
|
+
value: progress,
|
|
3270
|
+
variant: progressVariant,
|
|
3271
|
+
"data-testid": "progress-bar"
|
|
3272
|
+
}
|
|
3273
|
+
),
|
|
3274
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3275
|
+
Text_default,
|
|
3276
|
+
{
|
|
3277
|
+
size: "xs",
|
|
3278
|
+
weight: "medium",
|
|
3279
|
+
className: cn(
|
|
3280
|
+
"text-text-950 leading-none tracking-normal text-center flex-none"
|
|
3281
|
+
),
|
|
3282
|
+
children: [
|
|
3283
|
+
Math.round(progress),
|
|
3284
|
+
"%"
|
|
3285
|
+
]
|
|
3286
|
+
}
|
|
3287
|
+
)
|
|
3288
|
+
] })
|
|
3289
|
+
] }),
|
|
3290
|
+
vertical: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-text-800", children: subhead })
|
|
3291
|
+
};
|
|
3292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3293
|
+
CardBase,
|
|
3294
|
+
{
|
|
3295
|
+
ref,
|
|
3296
|
+
layout: isHorizontal ? "horizontal" : "vertical",
|
|
3297
|
+
padding: "none",
|
|
3298
|
+
minHeight: "medium",
|
|
3299
|
+
cursor: "pointer",
|
|
3300
|
+
className: cn(isHorizontal ? "h-20" : "", className),
|
|
3301
|
+
...props,
|
|
3302
|
+
children: [
|
|
3303
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3304
|
+
"div",
|
|
3305
|
+
{
|
|
3306
|
+
className: cn(
|
|
3307
|
+
"flex justify-center items-center [&>svg]:size-6 text-text-950",
|
|
3308
|
+
isHorizontal ? "min-w-[80px] min-h-[80px] rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl",
|
|
3309
|
+
!color.startsWith("#") ? `${color}` : ""
|
|
3310
|
+
),
|
|
3311
|
+
style: color.startsWith("#") ? { backgroundColor: color } : void 0,
|
|
3312
|
+
"data-testid": "icon-container",
|
|
3313
|
+
children: icon
|
|
3314
|
+
}
|
|
3315
|
+
),
|
|
3316
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3317
|
+
"div",
|
|
3318
|
+
{
|
|
3319
|
+
className: cn(
|
|
3320
|
+
"p-4 flex flex-col justify-between w-full h-full",
|
|
3321
|
+
!isHorizontal && "gap-4"
|
|
3322
|
+
),
|
|
3323
|
+
children: [
|
|
3324
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950 truncate", children: header }),
|
|
3325
|
+
contentComponent[direction]
|
|
3326
|
+
]
|
|
3327
|
+
}
|
|
3328
|
+
)
|
|
3329
|
+
]
|
|
3330
|
+
}
|
|
3331
|
+
);
|
|
3332
|
+
}
|
|
3333
|
+
);
|
|
3334
|
+
var CardTopic = (0, import_react10.forwardRef)(
|
|
3335
|
+
({
|
|
3336
|
+
header,
|
|
3337
|
+
subHead,
|
|
3338
|
+
progress,
|
|
3339
|
+
showPercentage = false,
|
|
3340
|
+
progressVariant = "blue",
|
|
3341
|
+
className = "",
|
|
3342
|
+
...props
|
|
3343
|
+
}, ref) => {
|
|
3344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3345
|
+
CardBase,
|
|
3346
|
+
{
|
|
3347
|
+
ref,
|
|
3348
|
+
layout: "vertical",
|
|
3349
|
+
padding: "small",
|
|
3350
|
+
minHeight: "medium",
|
|
3351
|
+
cursor: "pointer",
|
|
3352
|
+
className: cn("justify-center gap-2 py-2 px-4", className),
|
|
3353
|
+
...props,
|
|
3354
|
+
children: [
|
|
3355
|
+
subHead && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react10.Fragment, { children: [
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: text }),
|
|
3357
|
+
index < subHead.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: "\u2022" })
|
|
3358
|
+
] }, `${text} - ${index}`)) }),
|
|
3359
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }),
|
|
3360
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
|
|
3361
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3362
|
+
ProgressBar_default,
|
|
3363
|
+
{
|
|
3364
|
+
size: "small",
|
|
3365
|
+
value: progress,
|
|
3366
|
+
variant: progressVariant,
|
|
3367
|
+
"data-testid": "progress-bar"
|
|
3368
|
+
}
|
|
3369
|
+
),
|
|
3370
|
+
showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3371
|
+
Text_default,
|
|
3372
|
+
{
|
|
3373
|
+
size: "xs",
|
|
3374
|
+
weight: "medium",
|
|
3375
|
+
className: cn(
|
|
3376
|
+
"text-text-950 leading-none tracking-normal text-center flex-none"
|
|
3377
|
+
),
|
|
3378
|
+
children: [
|
|
3379
|
+
Math.round(progress),
|
|
3380
|
+
"%"
|
|
3381
|
+
]
|
|
3382
|
+
}
|
|
3383
|
+
)
|
|
3384
|
+
] })
|
|
3385
|
+
]
|
|
3386
|
+
}
|
|
3387
|
+
);
|
|
3388
|
+
}
|
|
3389
|
+
);
|
|
3390
|
+
var CardPerformance = (0, import_react10.forwardRef)(
|
|
3391
|
+
({
|
|
3392
|
+
header,
|
|
3393
|
+
progress,
|
|
3394
|
+
description = "Sem dados ainda! Voc\xEA ainda n\xE3o fez um question\xE1rio neste assunto.",
|
|
3395
|
+
actionVariant = "button",
|
|
3396
|
+
progressVariant = "blue",
|
|
3397
|
+
labelProgress = "",
|
|
3398
|
+
className = "",
|
|
3399
|
+
onClickButton,
|
|
3400
|
+
valueButton,
|
|
3401
|
+
...props
|
|
3402
|
+
}, ref) => {
|
|
3403
|
+
const hasProgress = progress !== void 0;
|
|
3404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3405
|
+
CardBase,
|
|
3406
|
+
{
|
|
3407
|
+
ref,
|
|
3408
|
+
layout: "horizontal",
|
|
3409
|
+
padding: "medium",
|
|
3410
|
+
minHeight: "none",
|
|
3411
|
+
className: cn(
|
|
3412
|
+
actionVariant == "caret" ? "cursor-pointer" : "",
|
|
3413
|
+
className
|
|
3414
|
+
),
|
|
3415
|
+
onClick: () => actionVariant == "caret" && onClickButton?.(valueButton),
|
|
3416
|
+
...props,
|
|
3417
|
+
children: [
|
|
3418
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "w-full flex flex-col justify-between gap-2", children: [
|
|
3419
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row justify-between items-center gap-2", children: [
|
|
3420
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-lg font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
|
|
3421
|
+
actionVariant === "button" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3422
|
+
Button_default,
|
|
3423
|
+
{
|
|
3424
|
+
variant: "outline",
|
|
3425
|
+
size: "extra-small",
|
|
3426
|
+
onClick: () => onClickButton?.(valueButton),
|
|
3427
|
+
className: "min-w-fit flex-shrink-0",
|
|
3428
|
+
children: "Ver Aula"
|
|
3429
|
+
}
|
|
3430
|
+
)
|
|
3431
|
+
] }),
|
|
3432
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-full", children: hasProgress ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3433
|
+
ProgressBar_default,
|
|
3434
|
+
{
|
|
3435
|
+
value: progress,
|
|
3436
|
+
label: `${progress}% ${labelProgress}`,
|
|
3437
|
+
variant: progressVariant
|
|
3438
|
+
}
|
|
3439
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xs text-text-600 truncate", children: description }) })
|
|
3440
|
+
] }),
|
|
3441
|
+
actionVariant == "caret" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3442
|
+
import_phosphor_react7.CaretRight,
|
|
3443
|
+
{
|
|
3444
|
+
className: "size-4.5 text-text-800 cursor-pointer",
|
|
3445
|
+
"data-testid": "caret-icon"
|
|
3446
|
+
}
|
|
3447
|
+
)
|
|
3448
|
+
]
|
|
3449
|
+
}
|
|
3450
|
+
);
|
|
3451
|
+
}
|
|
3452
|
+
);
|
|
3453
|
+
var CardResults = (0, import_react10.forwardRef)(
|
|
3454
|
+
({
|
|
3455
|
+
header,
|
|
3456
|
+
correct_answers,
|
|
3457
|
+
incorrect_answers,
|
|
3458
|
+
icon,
|
|
3459
|
+
direction = "col",
|
|
3460
|
+
color = "#B7DFFF",
|
|
3461
|
+
className,
|
|
3462
|
+
...props
|
|
3463
|
+
}, ref) => {
|
|
3464
|
+
const isRow = direction == "row";
|
|
3465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3466
|
+
CardBase,
|
|
3467
|
+
{
|
|
3468
|
+
ref,
|
|
3469
|
+
layout: "horizontal",
|
|
3470
|
+
padding: "none",
|
|
3471
|
+
minHeight: "medium",
|
|
3472
|
+
className: cn("items-stretch cursor-pointer pr-4", className),
|
|
3473
|
+
...props,
|
|
3474
|
+
children: [
|
|
3475
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3476
|
+
"div",
|
|
3477
|
+
{
|
|
3478
|
+
className: cn(
|
|
3479
|
+
"flex justify-center items-center [&>svg]:size-8 text-text-950 min-w-20 max-w-20 min-h-full rounded-l-xl"
|
|
3480
|
+
),
|
|
3481
|
+
style: {
|
|
3482
|
+
backgroundColor: color
|
|
3483
|
+
},
|
|
3484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(IconRender_default, { iconName: icon, color: "currentColor", size: 20 })
|
|
3485
|
+
}
|
|
3486
|
+
),
|
|
3487
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "w-full flex flex-row justify-between items-center", children: [
|
|
3488
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3489
|
+
"div",
|
|
3490
|
+
{
|
|
3491
|
+
className: cn(
|
|
3492
|
+
"p-4 flex flex-wrap justify-between w-full h-full",
|
|
3493
|
+
isRow ? "flex-row items-center gap-2" : "flex-col"
|
|
3494
|
+
),
|
|
3495
|
+
children: [
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm font-bold text-text-950 flex-1", children: header }),
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-wrap flex-row gap-1 items-center", children: [
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3499
|
+
Badge_default,
|
|
3500
|
+
{
|
|
3501
|
+
action: "success",
|
|
3502
|
+
variant: "solid",
|
|
3503
|
+
size: "large",
|
|
3504
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.CheckCircle, {}),
|
|
3505
|
+
children: [
|
|
3506
|
+
correct_answers,
|
|
3507
|
+
" Corretas"
|
|
3508
|
+
]
|
|
3509
|
+
}
|
|
3510
|
+
),
|
|
3511
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3512
|
+
Badge_default,
|
|
3513
|
+
{
|
|
3514
|
+
action: "error",
|
|
3515
|
+
variant: "solid",
|
|
3516
|
+
size: "large",
|
|
3517
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.XCircle, {}),
|
|
3518
|
+
children: [
|
|
3519
|
+
incorrect_answers,
|
|
3520
|
+
" Incorretas"
|
|
3521
|
+
]
|
|
3522
|
+
}
|
|
3523
|
+
)
|
|
3524
|
+
] })
|
|
3525
|
+
]
|
|
3526
|
+
}
|
|
3527
|
+
),
|
|
3528
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
|
|
3529
|
+
] })
|
|
3530
|
+
]
|
|
3531
|
+
}
|
|
3532
|
+
);
|
|
3533
|
+
}
|
|
3534
|
+
);
|
|
3535
|
+
var CardStatus = (0, import_react10.forwardRef)(
|
|
3536
|
+
({ header, className, status, label, ...props }, ref) => {
|
|
3537
|
+
const getLabelBadge = (status2) => {
|
|
3538
|
+
switch (status2) {
|
|
3539
|
+
case "correct":
|
|
3540
|
+
return "Correta";
|
|
3541
|
+
case "incorrect":
|
|
3542
|
+
return "Incorreta";
|
|
3543
|
+
case "unanswered":
|
|
3544
|
+
return "Em branco";
|
|
3545
|
+
case "pending":
|
|
3546
|
+
return "Avalia\xE7\xE3o pendente";
|
|
3547
|
+
default:
|
|
3548
|
+
return "Em branco";
|
|
3549
|
+
}
|
|
3550
|
+
};
|
|
3551
|
+
const getIconBadge = (status2) => {
|
|
3552
|
+
switch (status2) {
|
|
3553
|
+
case "correct":
|
|
3554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.CheckCircle, {});
|
|
3555
|
+
case "incorrect":
|
|
3556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.XCircle, {});
|
|
3557
|
+
case "pending":
|
|
3558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.Clock, {});
|
|
3559
|
+
default:
|
|
3560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.XCircle, {});
|
|
3561
|
+
}
|
|
3562
|
+
};
|
|
3563
|
+
const getActionBadge = (status2) => {
|
|
3564
|
+
switch (status2) {
|
|
3565
|
+
case "correct":
|
|
3566
|
+
return "success";
|
|
3567
|
+
case "incorrect":
|
|
3568
|
+
return "error";
|
|
3569
|
+
case "pending":
|
|
3570
|
+
return "info";
|
|
3571
|
+
default:
|
|
3572
|
+
return "info";
|
|
3573
|
+
}
|
|
3574
|
+
};
|
|
3575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3576
|
+
CardBase,
|
|
3577
|
+
{
|
|
3578
|
+
ref,
|
|
3579
|
+
layout: "horizontal",
|
|
3580
|
+
padding: "medium",
|
|
3581
|
+
minHeight: "medium",
|
|
3582
|
+
className: cn("items-center cursor-pointer", className),
|
|
3583
|
+
...props,
|
|
3584
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
|
|
3585
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
|
|
3587
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3588
|
+
Badge_default,
|
|
3589
|
+
{
|
|
3590
|
+
action: getActionBadge(status),
|
|
3591
|
+
variant: "solid",
|
|
3592
|
+
size: "medium",
|
|
3593
|
+
iconLeft: getIconBadge(status),
|
|
3594
|
+
children: getLabelBadge(status)
|
|
3595
|
+
}
|
|
3596
|
+
),
|
|
3597
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-text-800", children: label })
|
|
3598
|
+
] }),
|
|
3599
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer flex-shrink-0 ml-2" })
|
|
3600
|
+
] })
|
|
3601
|
+
}
|
|
3602
|
+
);
|
|
3603
|
+
}
|
|
3604
|
+
);
|
|
3605
|
+
var CardSettings = (0, import_react10.forwardRef)(
|
|
3606
|
+
({ header, className, icon, ...props }, ref) => {
|
|
3607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3608
|
+
CardBase,
|
|
3609
|
+
{
|
|
3610
|
+
ref,
|
|
3611
|
+
layout: "horizontal",
|
|
3612
|
+
padding: "small",
|
|
3613
|
+
minHeight: "none",
|
|
3614
|
+
className: cn(
|
|
3615
|
+
"border-none items-center gap-2 text-text-700",
|
|
3616
|
+
className
|
|
3617
|
+
),
|
|
3618
|
+
...props,
|
|
3619
|
+
children: [
|
|
3620
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "[&>svg]:size-6", children: icon }),
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "w-full text-sm truncate", children: header }),
|
|
3622
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.CaretRight, { size: 24, className: "cursor-pointer" })
|
|
3623
|
+
]
|
|
3624
|
+
}
|
|
3625
|
+
);
|
|
3626
|
+
}
|
|
3627
|
+
);
|
|
3628
|
+
var CardSupport = (0, import_react10.forwardRef)(
|
|
3629
|
+
({ header, className, direction = "col", children, ...props }, ref) => {
|
|
3630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3631
|
+
CardBase,
|
|
3632
|
+
{
|
|
3633
|
+
ref,
|
|
3634
|
+
layout: "horizontal",
|
|
3635
|
+
padding: "medium",
|
|
3636
|
+
minHeight: "none",
|
|
3637
|
+
className: cn(
|
|
3638
|
+
"border-none items-center gap-2 text-text-700",
|
|
3639
|
+
className
|
|
3640
|
+
),
|
|
3641
|
+
...props,
|
|
3642
|
+
children: [
|
|
3643
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3644
|
+
"div",
|
|
3645
|
+
{
|
|
3646
|
+
className: cn(
|
|
3647
|
+
"w-full flex",
|
|
3648
|
+
direction == "col" ? "flex-col" : "flex-row items-center"
|
|
3649
|
+
),
|
|
3650
|
+
children: [
|
|
3651
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }) }),
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "flex flex-row gap-1", children })
|
|
3653
|
+
]
|
|
3654
|
+
}
|
|
3655
|
+
),
|
|
3656
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
|
|
3657
|
+
]
|
|
3658
|
+
}
|
|
3659
|
+
);
|
|
3660
|
+
}
|
|
3661
|
+
);
|
|
3662
|
+
var CardForum = (0, import_react10.forwardRef)(
|
|
3663
|
+
({
|
|
3664
|
+
title,
|
|
3665
|
+
content,
|
|
3666
|
+
comments,
|
|
3667
|
+
onClickComments,
|
|
3668
|
+
valueComments,
|
|
3669
|
+
onClickProfile,
|
|
3670
|
+
valueProfile,
|
|
3671
|
+
className = "",
|
|
3672
|
+
date,
|
|
3673
|
+
hour,
|
|
3674
|
+
...props
|
|
3675
|
+
}, ref) => {
|
|
3676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3677
|
+
CardBase,
|
|
3678
|
+
{
|
|
3679
|
+
ref,
|
|
3680
|
+
layout: "horizontal",
|
|
3681
|
+
padding: "medium",
|
|
3682
|
+
minHeight: "none",
|
|
3683
|
+
variant: "minimal",
|
|
3684
|
+
className: cn("w-auto h-auto gap-3", className),
|
|
3685
|
+
...props,
|
|
3686
|
+
children: [
|
|
3687
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3688
|
+
"button",
|
|
3689
|
+
{
|
|
3690
|
+
type: "button",
|
|
3691
|
+
"aria-label": "Ver perfil",
|
|
3692
|
+
onClick: () => onClickProfile?.(valueProfile),
|
|
3693
|
+
className: "min-w-8 h-8 rounded-full bg-background-950"
|
|
3694
|
+
}
|
|
3695
|
+
),
|
|
3696
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
|
|
3697
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row gap-1 items-center flex-wrap", children: [
|
|
3698
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xs font-semibold text-primary-700 truncate", children: title }),
|
|
3699
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "text-xs text-text-600", children: [
|
|
3700
|
+
"\u2022 ",
|
|
3701
|
+
date,
|
|
3702
|
+
" \u2022 ",
|
|
3703
|
+
hour
|
|
3704
|
+
] })
|
|
3705
|
+
] }),
|
|
3706
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-950 text-sm line-clamp-2 truncate", children: content }),
|
|
3707
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3708
|
+
"button",
|
|
3709
|
+
{
|
|
3710
|
+
type: "button",
|
|
3711
|
+
"aria-label": "Ver coment\xE1rios",
|
|
3712
|
+
onClick: () => onClickComments?.(valueComments),
|
|
3713
|
+
className: "text-text-600 flex flex-row gap-2 items-center",
|
|
3714
|
+
children: [
|
|
3715
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.ChatCircleText, { "aria-hidden": "true", size: 16 }),
|
|
3716
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "text-xs", children: [
|
|
3717
|
+
comments,
|
|
3718
|
+
" respostas"
|
|
3719
|
+
] })
|
|
3720
|
+
]
|
|
3721
|
+
}
|
|
3722
|
+
)
|
|
3723
|
+
] })
|
|
3724
|
+
]
|
|
3725
|
+
}
|
|
3726
|
+
);
|
|
3727
|
+
}
|
|
3728
|
+
);
|
|
3729
|
+
var CardAudio = (0, import_react10.forwardRef)(
|
|
3730
|
+
({
|
|
3731
|
+
src,
|
|
3732
|
+
title,
|
|
3733
|
+
onPlay,
|
|
3734
|
+
onPause,
|
|
3735
|
+
onEnded,
|
|
3736
|
+
onAudioTimeUpdate,
|
|
3737
|
+
loop = false,
|
|
3738
|
+
preload = "metadata",
|
|
3739
|
+
tracks,
|
|
3740
|
+
className,
|
|
3741
|
+
...props
|
|
3742
|
+
}, ref) => {
|
|
3743
|
+
const [isPlaying, setIsPlaying] = (0, import_react10.useState)(false);
|
|
3744
|
+
const [currentTime, setCurrentTime] = (0, import_react10.useState)(0);
|
|
3745
|
+
const [duration, setDuration] = (0, import_react10.useState)(0);
|
|
3746
|
+
const [volume, setVolume] = (0, import_react10.useState)(1);
|
|
3747
|
+
const [showVolumeControl, setShowVolumeControl] = (0, import_react10.useState)(false);
|
|
3748
|
+
const [showSpeedMenu, setShowSpeedMenu] = (0, import_react10.useState)(false);
|
|
3749
|
+
const [playbackRate, setPlaybackRate] = (0, import_react10.useState)(1);
|
|
3750
|
+
const audioRef = (0, import_react10.useRef)(null);
|
|
3751
|
+
const volumeControlRef = (0, import_react10.useRef)(null);
|
|
3752
|
+
const speedMenuRef = (0, import_react10.useRef)(null);
|
|
3753
|
+
const formatTime = (time) => {
|
|
3754
|
+
const minutes = Math.floor(time / 60);
|
|
3755
|
+
const seconds = Math.floor(time % 60);
|
|
3756
|
+
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
|
3757
|
+
};
|
|
3758
|
+
const handlePlayPause = () => {
|
|
3759
|
+
if (isPlaying) {
|
|
3760
|
+
audioRef.current?.pause();
|
|
3761
|
+
setIsPlaying(false);
|
|
3762
|
+
onPause?.();
|
|
3763
|
+
} else {
|
|
3764
|
+
audioRef.current?.play();
|
|
3765
|
+
setIsPlaying(true);
|
|
3766
|
+
onPlay?.();
|
|
3767
|
+
}
|
|
3768
|
+
};
|
|
3769
|
+
const handleTimeUpdate = () => {
|
|
3770
|
+
const current = audioRef.current?.currentTime ?? 0;
|
|
3771
|
+
const total = audioRef.current?.duration ?? 0;
|
|
3772
|
+
setCurrentTime(current);
|
|
3773
|
+
setDuration(total);
|
|
3774
|
+
onAudioTimeUpdate?.(current, total);
|
|
3775
|
+
};
|
|
3776
|
+
const handleLoadedMetadata = () => {
|
|
3777
|
+
setDuration(audioRef.current?.duration ?? 0);
|
|
3778
|
+
};
|
|
3779
|
+
const handleEnded = () => {
|
|
3780
|
+
setIsPlaying(false);
|
|
3781
|
+
setCurrentTime(0);
|
|
3782
|
+
onEnded?.();
|
|
3783
|
+
};
|
|
3784
|
+
const handleProgressClick = (e) => {
|
|
3785
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
3786
|
+
const clickX = e.clientX - rect.left;
|
|
3787
|
+
const width = rect.width;
|
|
3788
|
+
const percentage = clickX / width;
|
|
3789
|
+
const newTime = percentage * duration;
|
|
3790
|
+
if (audioRef.current) {
|
|
3791
|
+
audioRef.current.currentTime = newTime;
|
|
3792
|
+
}
|
|
3793
|
+
setCurrentTime(newTime);
|
|
3794
|
+
};
|
|
3795
|
+
const handleVolumeChange = (e) => {
|
|
3796
|
+
const newVolume = parseFloat(e.target.value);
|
|
3797
|
+
setVolume(newVolume);
|
|
3798
|
+
if (audioRef.current) {
|
|
3799
|
+
audioRef.current.volume = newVolume;
|
|
3800
|
+
}
|
|
3801
|
+
};
|
|
3802
|
+
const toggleVolumeControl = () => {
|
|
3803
|
+
setShowVolumeControl(!showVolumeControl);
|
|
3804
|
+
setShowSpeedMenu(false);
|
|
3805
|
+
};
|
|
3806
|
+
const toggleSpeedMenu = () => {
|
|
3807
|
+
setShowSpeedMenu(!showSpeedMenu);
|
|
3808
|
+
setShowVolumeControl(false);
|
|
3809
|
+
};
|
|
3810
|
+
const handleSpeedChange = (speed) => {
|
|
3811
|
+
setPlaybackRate(speed);
|
|
3812
|
+
if (audioRef.current) {
|
|
3813
|
+
audioRef.current.playbackRate = speed;
|
|
3814
|
+
}
|
|
3815
|
+
setShowSpeedMenu(false);
|
|
3816
|
+
};
|
|
3817
|
+
const getVolumeIcon = () => {
|
|
3818
|
+
if (volume === 0) {
|
|
3819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.SpeakerSimpleX, { size: 24 });
|
|
3820
|
+
}
|
|
3821
|
+
if (volume < 0.5) {
|
|
3822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.SpeakerLow, { size: 24 });
|
|
3823
|
+
}
|
|
3824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.SpeakerHigh, { size: 24 });
|
|
3825
|
+
};
|
|
3826
|
+
(0, import_react10.useEffect)(() => {
|
|
3827
|
+
const handleClickOutside = (event) => {
|
|
3828
|
+
if (volumeControlRef.current && !volumeControlRef.current.contains(event.target)) {
|
|
3829
|
+
setShowVolumeControl(false);
|
|
3830
|
+
}
|
|
3831
|
+
if (speedMenuRef.current && !speedMenuRef.current.contains(event.target)) {
|
|
3832
|
+
setShowSpeedMenu(false);
|
|
3833
|
+
}
|
|
3834
|
+
};
|
|
3835
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
3836
|
+
return () => {
|
|
3837
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
3838
|
+
};
|
|
3839
|
+
}, []);
|
|
3840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3841
|
+
CardBase,
|
|
3842
|
+
{
|
|
3843
|
+
ref,
|
|
3844
|
+
layout: "horizontal",
|
|
3845
|
+
padding: "medium",
|
|
3846
|
+
minHeight: "none",
|
|
3847
|
+
className: cn(
|
|
3848
|
+
"flex flex-row w-auto h-14 items-center gap-2",
|
|
3849
|
+
className
|
|
3850
|
+
),
|
|
3851
|
+
...props,
|
|
3852
|
+
children: [
|
|
3853
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3854
|
+
"audio",
|
|
3855
|
+
{
|
|
3856
|
+
ref: audioRef,
|
|
3857
|
+
src,
|
|
3858
|
+
loop,
|
|
3859
|
+
preload,
|
|
3860
|
+
onTimeUpdate: handleTimeUpdate,
|
|
3861
|
+
onLoadedMetadata: handleLoadedMetadata,
|
|
3862
|
+
onEnded: handleEnded,
|
|
3863
|
+
"data-testid": "audio-element",
|
|
3864
|
+
"aria-label": title,
|
|
3865
|
+
children: tracks ? tracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3866
|
+
"track",
|
|
3867
|
+
{
|
|
3868
|
+
kind: track.kind,
|
|
3869
|
+
src: track.src,
|
|
3870
|
+
srcLang: track.srcLang,
|
|
3871
|
+
label: track.label,
|
|
3872
|
+
default: track.default
|
|
3873
|
+
},
|
|
3874
|
+
track.src
|
|
3875
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3876
|
+
"track",
|
|
3877
|
+
{
|
|
3878
|
+
kind: "captions",
|
|
3879
|
+
src: "data:text/vtt;base64,",
|
|
3880
|
+
srcLang: "pt",
|
|
3881
|
+
label: "Sem legendas dispon\xEDveis"
|
|
3882
|
+
}
|
|
3883
|
+
)
|
|
3884
|
+
}
|
|
3885
|
+
),
|
|
3886
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3887
|
+
"button",
|
|
3888
|
+
{
|
|
3889
|
+
type: "button",
|
|
3890
|
+
onClick: handlePlayPause,
|
|
3891
|
+
disabled: !src,
|
|
3892
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
|
|
3893
|
+
"aria-label": isPlaying ? "Pausar" : "Reproduzir",
|
|
3894
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-0.5", children: [
|
|
3895
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" }),
|
|
3896
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" })
|
|
3897
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.Play, { size: 24 })
|
|
3898
|
+
}
|
|
3899
|
+
),
|
|
3900
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
|
|
3901
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3902
|
+
"button",
|
|
3903
|
+
{
|
|
3904
|
+
type: "button",
|
|
3905
|
+
className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
|
|
3906
|
+
onClick: handleProgressClick,
|
|
3907
|
+
onKeyDown: (e) => {
|
|
3908
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3909
|
+
e.preventDefault();
|
|
3910
|
+
handleProgressClick(
|
|
3911
|
+
e
|
|
3912
|
+
);
|
|
3913
|
+
}
|
|
3914
|
+
},
|
|
3915
|
+
"aria-label": "Barra de progresso do \xE1udio",
|
|
3916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3917
|
+
"div",
|
|
3918
|
+
{
|
|
3919
|
+
className: "h-full bg-primary-600 rounded-full transition-all duration-100",
|
|
3920
|
+
style: {
|
|
3921
|
+
width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
)
|
|
3925
|
+
}
|
|
3926
|
+
) }),
|
|
3927
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(duration) }),
|
|
3928
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative h-6", ref: volumeControlRef, children: [
|
|
3929
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3930
|
+
"button",
|
|
3931
|
+
{
|
|
3932
|
+
type: "button",
|
|
3933
|
+
onClick: toggleVolumeControl,
|
|
3934
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600",
|
|
3935
|
+
"aria-label": "Controle de volume",
|
|
3936
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
|
|
3937
|
+
}
|
|
3938
|
+
),
|
|
3939
|
+
showVolumeControl && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3940
|
+
"button",
|
|
3941
|
+
{
|
|
3942
|
+
type: "button",
|
|
3943
|
+
className: "absolute bottom-full right-0 mb-2 p-2 bg-background border border-border-100 rounded-lg shadow-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
3944
|
+
onKeyDown: (e) => {
|
|
3945
|
+
if (e.key === "Escape") {
|
|
3946
|
+
setShowVolumeControl(false);
|
|
3947
|
+
}
|
|
3948
|
+
},
|
|
3949
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3950
|
+
"input",
|
|
3951
|
+
{
|
|
3952
|
+
type: "range",
|
|
3953
|
+
min: "0",
|
|
3954
|
+
max: "1",
|
|
3955
|
+
step: "0.1",
|
|
3956
|
+
value: volume,
|
|
3957
|
+
onChange: handleVolumeChange,
|
|
3958
|
+
onKeyDown: (e) => {
|
|
3959
|
+
if (e.key === "ArrowUp" || e.key === "ArrowRight") {
|
|
3960
|
+
e.preventDefault();
|
|
3961
|
+
const newVolume = Math.min(
|
|
3962
|
+
1,
|
|
3963
|
+
Math.round((volume + 0.1) * 10) / 10
|
|
3964
|
+
);
|
|
3965
|
+
setVolume(newVolume);
|
|
3966
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
3967
|
+
} else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
|
|
3968
|
+
e.preventDefault();
|
|
3969
|
+
const newVolume = Math.max(
|
|
3970
|
+
0,
|
|
3971
|
+
Math.round((volume - 0.1) * 10) / 10
|
|
3972
|
+
);
|
|
3973
|
+
setVolume(newVolume);
|
|
3974
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
3975
|
+
}
|
|
3976
|
+
},
|
|
3977
|
+
className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
|
|
3978
|
+
style: {
|
|
3979
|
+
background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
|
|
3980
|
+
},
|
|
3981
|
+
"aria-label": "Volume",
|
|
3982
|
+
"aria-valuenow": Math.round(volume * 100),
|
|
3983
|
+
"aria-valuemin": 0,
|
|
3984
|
+
"aria-valuemax": 100
|
|
3985
|
+
}
|
|
3986
|
+
)
|
|
3987
|
+
}
|
|
3988
|
+
)
|
|
3989
|
+
] }),
|
|
3990
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative h-6", ref: speedMenuRef, children: [
|
|
3991
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3992
|
+
"button",
|
|
3993
|
+
{
|
|
3994
|
+
type: "button",
|
|
3995
|
+
onClick: toggleSpeedMenu,
|
|
3996
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600",
|
|
3997
|
+
"aria-label": "Op\xE7\xF5es de velocidade",
|
|
3998
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.DotsThreeVertical, { size: 24 })
|
|
3999
|
+
}
|
|
4000
|
+
),
|
|
4001
|
+
showSpeedMenu && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "absolute bottom-full right-0 mb-2 p-2 bg-background border border-border-100 rounded-lg shadow-lg min-w-24 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-col gap-1", children: [
|
|
4002
|
+
{ speed: 1, label: "1x" },
|
|
4003
|
+
{ speed: 1.5, label: "1.5x" },
|
|
4004
|
+
{ speed: 2, label: "2x" }
|
|
4005
|
+
].map(({ speed, label }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4006
|
+
"button",
|
|
4007
|
+
{
|
|
4008
|
+
type: "button",
|
|
4009
|
+
onClick: () => handleSpeedChange(speed),
|
|
4010
|
+
className: cn(
|
|
4011
|
+
"px-3 py-1 text-sm text-left rounded hover:bg-border-50 transition-colors",
|
|
4012
|
+
playbackRate === speed ? "bg-primary-950 text-secondary-100 font-medium" : "text-text-950"
|
|
4013
|
+
),
|
|
4014
|
+
children: label
|
|
4015
|
+
},
|
|
4016
|
+
speed
|
|
4017
|
+
)) }) })
|
|
4018
|
+
] })
|
|
4019
|
+
]
|
|
4020
|
+
}
|
|
4021
|
+
);
|
|
4022
|
+
}
|
|
4023
|
+
);
|
|
4024
|
+
var SIMULADO_BACKGROUND_CLASSES = {
|
|
4025
|
+
enem: "bg-exam-1",
|
|
4026
|
+
prova: "bg-exam-2",
|
|
4027
|
+
simuladao: "bg-exam-3",
|
|
4028
|
+
vestibular: "bg-exam-4"
|
|
4029
|
+
};
|
|
4030
|
+
var CardSimulado = (0, import_react10.forwardRef)(
|
|
4031
|
+
({ title, duration, info, backgroundColor, className, ...props }, ref) => {
|
|
4032
|
+
const backgroundClass = SIMULADO_BACKGROUND_CLASSES[backgroundColor];
|
|
4033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4034
|
+
CardBase,
|
|
4035
|
+
{
|
|
4036
|
+
ref,
|
|
4037
|
+
layout: "horizontal",
|
|
4038
|
+
padding: "medium",
|
|
4039
|
+
minHeight: "none",
|
|
4040
|
+
cursor: "pointer",
|
|
4041
|
+
className: cn(
|
|
4042
|
+
`${backgroundClass} hover:shadow-soft-shadow-2 transition-shadow duration-200`,
|
|
4043
|
+
className
|
|
4044
|
+
),
|
|
4045
|
+
...props,
|
|
4046
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex justify-between items-center w-full gap-4", children: [
|
|
4047
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
|
|
4048
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { size: "lg", weight: "bold", className: "text-text-950 truncate", children: title }),
|
|
4049
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-4 text-text-700", children: [
|
|
4050
|
+
duration && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4051
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.Clock, { size: 16, className: "flex-shrink-0" }),
|
|
4052
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { size: "sm", children: duration })
|
|
4053
|
+
] }),
|
|
4054
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { size: "sm", className: "truncate", children: info })
|
|
4055
|
+
] })
|
|
4056
|
+
] }),
|
|
4057
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4058
|
+
import_phosphor_react7.CaretRight,
|
|
4059
|
+
{
|
|
4060
|
+
size: 24,
|
|
4061
|
+
className: "text-text-800 flex-shrink-0",
|
|
4062
|
+
"data-testid": "caret-icon"
|
|
4063
|
+
}
|
|
4064
|
+
)
|
|
4065
|
+
] })
|
|
4066
|
+
}
|
|
4067
|
+
);
|
|
4068
|
+
}
|
|
4069
|
+
);
|
|
4070
|
+
var CardTest = (0, import_react10.forwardRef)(
|
|
4071
|
+
({
|
|
4072
|
+
title,
|
|
4073
|
+
duration,
|
|
4074
|
+
questionsCount,
|
|
4075
|
+
additionalInfo,
|
|
4076
|
+
selected = false,
|
|
4077
|
+
onSelect,
|
|
4078
|
+
className = "",
|
|
4079
|
+
...props
|
|
4080
|
+
}, ref) => {
|
|
4081
|
+
const handleClick = () => {
|
|
4082
|
+
if (onSelect) {
|
|
4083
|
+
onSelect(!selected);
|
|
4084
|
+
}
|
|
4085
|
+
};
|
|
4086
|
+
const handleKeyDown = (event) => {
|
|
4087
|
+
if ((event.key === "Enter" || event.key === " ") && onSelect) {
|
|
4088
|
+
event.preventDefault();
|
|
4089
|
+
onSelect(!selected);
|
|
4090
|
+
}
|
|
4091
|
+
};
|
|
4092
|
+
const isSelectable = !!onSelect;
|
|
4093
|
+
const getQuestionsText = (count) => {
|
|
4094
|
+
const singular = count === 1 ? "quest\xE3o" : "quest\xF5es";
|
|
4095
|
+
return `${count} ${singular}`;
|
|
4096
|
+
};
|
|
4097
|
+
const displayInfo = questionsCount ? getQuestionsText(questionsCount) : additionalInfo || "";
|
|
4098
|
+
const baseClasses = "flex flex-row items-center p-4 gap-2 w-full max-w-full bg-background shadow-soft-shadow-1 rounded-xl isolate border-0 text-left";
|
|
4099
|
+
const interactiveClasses = isSelectable ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary-950 focus:ring-offset-2" : "";
|
|
4100
|
+
const selectedClasses = selected ? "ring-2 ring-primary-950 ring-offset-2" : "";
|
|
4101
|
+
if (isSelectable) {
|
|
4102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4103
|
+
"button",
|
|
4104
|
+
{
|
|
4105
|
+
ref,
|
|
4106
|
+
type: "button",
|
|
4107
|
+
className: cn(
|
|
4108
|
+
`${baseClasses} ${interactiveClasses} ${selectedClasses} ${className}`.trim()
|
|
4109
|
+
),
|
|
4110
|
+
onClick: handleClick,
|
|
4111
|
+
onKeyDown: handleKeyDown,
|
|
4112
|
+
"aria-pressed": selected,
|
|
4113
|
+
...props,
|
|
4114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
|
|
4115
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4116
|
+
Text_default,
|
|
4117
|
+
{
|
|
4118
|
+
size: "md",
|
|
4119
|
+
weight: "bold",
|
|
4120
|
+
className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
|
|
4121
|
+
children: title
|
|
4122
|
+
}
|
|
4123
|
+
),
|
|
4124
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
|
|
4125
|
+
duration && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
|
|
4126
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.Clock, { size: 16, className: "text-text-700" }),
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4128
|
+
Text_default,
|
|
4129
|
+
{
|
|
4130
|
+
size: "sm",
|
|
4131
|
+
className: "text-text-700 leading-[21px] whitespace-nowrap",
|
|
4132
|
+
children: duration
|
|
4133
|
+
}
|
|
4134
|
+
)
|
|
4135
|
+
] }),
|
|
4136
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4137
|
+
Text_default,
|
|
4138
|
+
{
|
|
4139
|
+
size: "sm",
|
|
4140
|
+
className: "text-text-700 leading-[21px] flex-grow truncate",
|
|
4141
|
+
children: displayInfo
|
|
4142
|
+
}
|
|
4143
|
+
)
|
|
4144
|
+
] })
|
|
4145
|
+
] })
|
|
4146
|
+
}
|
|
4147
|
+
);
|
|
4148
|
+
}
|
|
4149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4150
|
+
"div",
|
|
4151
|
+
{
|
|
4152
|
+
ref,
|
|
4153
|
+
className: cn(`${baseClasses} ${className}`.trim()),
|
|
4154
|
+
...props,
|
|
4155
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4157
|
+
Text_default,
|
|
4158
|
+
{
|
|
4159
|
+
size: "md",
|
|
4160
|
+
weight: "bold",
|
|
4161
|
+
className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
|
|
4162
|
+
children: title
|
|
4163
|
+
}
|
|
4164
|
+
),
|
|
4165
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
|
|
4166
|
+
duration && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
|
|
4167
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.Clock, { size: 16, className: "text-text-700" }),
|
|
4168
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4169
|
+
Text_default,
|
|
4170
|
+
{
|
|
4171
|
+
size: "sm",
|
|
4172
|
+
className: "text-text-700 leading-[21px] whitespace-nowrap",
|
|
4173
|
+
children: duration
|
|
4174
|
+
}
|
|
4175
|
+
)
|
|
4176
|
+
] }),
|
|
4177
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4178
|
+
Text_default,
|
|
4179
|
+
{
|
|
4180
|
+
size: "sm",
|
|
4181
|
+
className: "text-text-700 leading-[21px] flex-grow truncate min-w-0",
|
|
4182
|
+
children: displayInfo
|
|
4183
|
+
}
|
|
4184
|
+
)
|
|
4185
|
+
] })
|
|
4186
|
+
] })
|
|
4187
|
+
}
|
|
4188
|
+
);
|
|
4189
|
+
}
|
|
4190
|
+
);
|
|
4191
|
+
var SIMULATION_TYPE_STYLES = {
|
|
4192
|
+
enem: {
|
|
4193
|
+
background: "bg-exam-1",
|
|
4194
|
+
badge: "exam1",
|
|
4195
|
+
text: "Enem"
|
|
4196
|
+
},
|
|
4197
|
+
prova: {
|
|
4198
|
+
background: "bg-exam-2",
|
|
4199
|
+
badge: "exam2",
|
|
4200
|
+
text: "Prova"
|
|
4201
|
+
},
|
|
4202
|
+
simulado: {
|
|
4203
|
+
background: "bg-exam-3",
|
|
4204
|
+
badge: "exam3",
|
|
4205
|
+
text: "Simulad\xE3o"
|
|
4206
|
+
},
|
|
4207
|
+
vestibular: {
|
|
4208
|
+
background: "bg-exam-4",
|
|
4209
|
+
badge: "exam4",
|
|
4210
|
+
text: "Vestibular"
|
|
4211
|
+
}
|
|
4212
|
+
};
|
|
4213
|
+
var CardSimulationHistory = (0, import_react10.forwardRef)(({ data, onSimulationClick, className, ...props }, ref) => {
|
|
4214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4215
|
+
"div",
|
|
4216
|
+
{
|
|
4217
|
+
ref,
|
|
4218
|
+
className: cn("w-full max-w-[992px] h-auto", className),
|
|
4219
|
+
...props,
|
|
4220
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-0", children: [
|
|
4221
|
+
data.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
4222
|
+
"div",
|
|
4223
|
+
{
|
|
4224
|
+
className: cn(
|
|
4225
|
+
"flex flex-row justify-center items-start px-4 py-6 gap-2 w-full bg-background",
|
|
4226
|
+
sectionIndex === 0 ? "rounded-t-3xl" : ""
|
|
4227
|
+
),
|
|
4228
|
+
children: [
|
|
4229
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4230
|
+
Text_default,
|
|
4231
|
+
{
|
|
4232
|
+
size: "xs",
|
|
4233
|
+
weight: "bold",
|
|
4234
|
+
className: "text-text-800 w-11 flex-shrink-0",
|
|
4235
|
+
children: section.date
|
|
4236
|
+
}
|
|
4237
|
+
),
|
|
4238
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-col gap-2 flex-1", children: section.simulations.map((simulation) => {
|
|
4239
|
+
const typeStyles = SIMULATION_TYPE_STYLES[simulation.type];
|
|
4240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4241
|
+
CardBase,
|
|
4242
|
+
{
|
|
4243
|
+
layout: "horizontal",
|
|
4244
|
+
padding: "medium",
|
|
4245
|
+
minHeight: "none",
|
|
4246
|
+
cursor: "pointer",
|
|
4247
|
+
className: cn(
|
|
4248
|
+
`${typeStyles.background} rounded-xl hover:shadow-soft-shadow-2
|
|
4249
|
+
transition-shadow duration-200 h-auto min-h-[61px]`
|
|
4250
|
+
),
|
|
4251
|
+
onClick: () => onSimulationClick?.(simulation),
|
|
4252
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex justify-between items-center w-full gap-2", children: [
|
|
4253
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap flex-col justify-between sm:flex-row gap-2 flex-1 min-w-0", children: [
|
|
4254
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4255
|
+
Text_default,
|
|
4256
|
+
{
|
|
4257
|
+
size: "lg",
|
|
4258
|
+
weight: "bold",
|
|
4259
|
+
className: "text-text-950 truncate",
|
|
4260
|
+
children: simulation.title
|
|
4261
|
+
}
|
|
4262
|
+
),
|
|
4263
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4264
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4265
|
+
Badge_default,
|
|
4266
|
+
{
|
|
4267
|
+
variant: "examsOutlined",
|
|
4268
|
+
action: typeStyles.badge,
|
|
4269
|
+
size: "medium",
|
|
4270
|
+
children: typeStyles.text
|
|
4271
|
+
}
|
|
4272
|
+
),
|
|
4273
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { size: "sm", className: "text-text-800 truncate", children: simulation.info })
|
|
4274
|
+
] })
|
|
4275
|
+
] }),
|
|
4276
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4277
|
+
import_phosphor_react7.CaretRight,
|
|
4278
|
+
{
|
|
4279
|
+
size: 24,
|
|
4280
|
+
className: "text-text-800 flex-shrink-0",
|
|
4281
|
+
"data-testid": "caret-icon"
|
|
4282
|
+
}
|
|
4283
|
+
)
|
|
4284
|
+
] })
|
|
4285
|
+
},
|
|
4286
|
+
simulation.id
|
|
4287
|
+
);
|
|
4288
|
+
}) })
|
|
4289
|
+
]
|
|
4290
|
+
}
|
|
4291
|
+
) }, section.date)),
|
|
4292
|
+
data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-full h-6 bg-background rounded-b-3xl" })
|
|
4293
|
+
] })
|
|
4294
|
+
}
|
|
4295
|
+
);
|
|
4296
|
+
});
|
|
4297
|
+
|
|
4298
|
+
// src/components/Accordation/Accordation.tsx
|
|
4299
|
+
var import_react11 = require("react");
|
|
4300
|
+
var import_phosphor_react8 = require("phosphor-react");
|
|
4301
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4302
|
+
var CardAccordation = (0, import_react11.forwardRef)(
|
|
4303
|
+
({
|
|
4304
|
+
trigger,
|
|
4305
|
+
children,
|
|
4306
|
+
className,
|
|
4307
|
+
defaultExpanded = false,
|
|
4308
|
+
expanded: controlledExpanded,
|
|
4309
|
+
onToggleExpanded,
|
|
4310
|
+
value,
|
|
4311
|
+
disabled = false,
|
|
4312
|
+
...props
|
|
4313
|
+
}, ref) => {
|
|
4314
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react11.useState)(defaultExpanded);
|
|
4315
|
+
const generatedId = (0, import_react11.useId)();
|
|
4316
|
+
const contentId = value ? `accordion-content-${value}` : generatedId;
|
|
4317
|
+
const headerId = value ? `accordion-header-${value}` : `${generatedId}-header`;
|
|
4318
|
+
const isControlled = controlledExpanded !== void 0;
|
|
4319
|
+
const isExpanded = isControlled ? controlledExpanded : internalExpanded;
|
|
4320
|
+
(0, import_react11.useEffect)(() => {
|
|
4321
|
+
if (isControlled) {
|
|
4322
|
+
setInternalExpanded(controlledExpanded);
|
|
4323
|
+
}
|
|
4324
|
+
}, [isControlled, controlledExpanded]);
|
|
4325
|
+
const handleToggle = () => {
|
|
4326
|
+
if (disabled) return;
|
|
4327
|
+
const newExpanded = !isExpanded;
|
|
4328
|
+
if (!isControlled) {
|
|
4329
|
+
setInternalExpanded(newExpanded);
|
|
4330
|
+
}
|
|
4331
|
+
onToggleExpanded?.(newExpanded);
|
|
4332
|
+
};
|
|
4333
|
+
const handleKeyDown = (event) => {
|
|
4334
|
+
if (disabled) return;
|
|
4335
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
4336
|
+
event.preventDefault();
|
|
4337
|
+
handleToggle();
|
|
4338
|
+
}
|
|
4339
|
+
};
|
|
4340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
4341
|
+
CardBase,
|
|
4342
|
+
{
|
|
4343
|
+
ref,
|
|
4344
|
+
layout: "vertical",
|
|
4345
|
+
padding: "none",
|
|
4346
|
+
minHeight: "none",
|
|
4347
|
+
className: cn("overflow-hidden", className),
|
|
4348
|
+
...props,
|
|
4349
|
+
children: [
|
|
4350
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
4351
|
+
"button",
|
|
4352
|
+
{
|
|
4353
|
+
id: headerId,
|
|
4354
|
+
type: "button",
|
|
4355
|
+
onClick: handleToggle,
|
|
4356
|
+
onKeyDown: handleKeyDown,
|
|
4357
|
+
disabled,
|
|
4358
|
+
className: cn(
|
|
4359
|
+
"w-full cursor-pointer not-aria-expanded:rounded-xl aria-expanded:rounded-t-xl flex items-center justify-between gap-3 text-left transition-colors duration-200 focus:outline-none focus:border-2 focus:border-primary-950 focus:ring-inset px-2",
|
|
4360
|
+
disabled && "cursor-not-allowed text-text-400"
|
|
4361
|
+
),
|
|
4362
|
+
"aria-expanded": isExpanded,
|
|
4363
|
+
"aria-controls": contentId,
|
|
4364
|
+
"aria-disabled": disabled,
|
|
4365
|
+
"data-value": value,
|
|
4366
|
+
children: [
|
|
4367
|
+
trigger,
|
|
4368
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4369
|
+
import_phosphor_react8.CaretRight,
|
|
4370
|
+
{
|
|
4371
|
+
size: 20,
|
|
4372
|
+
className: cn(
|
|
4373
|
+
"transition-transform duration-200 flex-shrink-0",
|
|
4374
|
+
disabled ? "text-gray-400" : "text-text-700",
|
|
4375
|
+
isExpanded ? "rotate-90" : "rotate-0"
|
|
4376
|
+
),
|
|
4377
|
+
"data-testid": "accordion-caret"
|
|
4378
|
+
}
|
|
4379
|
+
)
|
|
4380
|
+
]
|
|
4381
|
+
}
|
|
4382
|
+
),
|
|
4383
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4384
|
+
"section",
|
|
4385
|
+
{
|
|
4386
|
+
id: contentId,
|
|
4387
|
+
"aria-labelledby": headerId,
|
|
4388
|
+
"aria-hidden": !isExpanded,
|
|
4389
|
+
className: cn(
|
|
4390
|
+
"transition-all duration-300 ease-in-out overflow-hidden",
|
|
4391
|
+
isExpanded ? "max-h-screen opacity-100" : "max-h-0 opacity-0"
|
|
4392
|
+
),
|
|
4393
|
+
"data-testid": "accordion-content",
|
|
4394
|
+
"data-value": value,
|
|
4395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "p-4 pt-0", children })
|
|
4396
|
+
}
|
|
4397
|
+
)
|
|
4398
|
+
]
|
|
4399
|
+
}
|
|
4400
|
+
);
|
|
4401
|
+
}
|
|
4402
|
+
);
|
|
4403
|
+
CardAccordation.displayName = "CardAccordation";
|
|
4404
|
+
|
|
4405
|
+
// src/components/Accordation/AccordionGroup.tsx
|
|
4406
|
+
var import_react12 = require("react");
|
|
4407
|
+
var import_zustand4 = require("zustand");
|
|
4408
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4409
|
+
function createAccordionGroupStore(type, initialValue, collapsible) {
|
|
4410
|
+
return (0, import_zustand4.create)((set, get) => ({
|
|
4411
|
+
type,
|
|
4412
|
+
value: initialValue,
|
|
4413
|
+
collapsible,
|
|
4414
|
+
setValue: (value) => set({ value }),
|
|
4415
|
+
isItemExpanded: (itemValue) => {
|
|
4416
|
+
const state = get();
|
|
4417
|
+
if (state.type === "single") {
|
|
4418
|
+
return state.value === itemValue;
|
|
4419
|
+
} else {
|
|
4420
|
+
return Array.isArray(state.value) && state.value.includes(itemValue);
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
}));
|
|
4424
|
+
}
|
|
4425
|
+
var injectStore3 = (children, store, indexRef, onItemToggle) => {
|
|
4426
|
+
return import_react12.Children.map(children, (child) => {
|
|
4427
|
+
if (!(0, import_react12.isValidElement)(child)) {
|
|
4428
|
+
return child;
|
|
4429
|
+
}
|
|
4430
|
+
const typedChild = child;
|
|
4431
|
+
const displayName = typedChild.type?.displayName;
|
|
4432
|
+
let newProps = {};
|
|
4433
|
+
if (displayName === "CardAccordation") {
|
|
4434
|
+
const itemValue = typedChild.props.value || `accordion-item-${indexRef.current++}`;
|
|
4435
|
+
const storeState = store.getState();
|
|
4436
|
+
const expanded = storeState.isItemExpanded(itemValue);
|
|
4437
|
+
newProps.value = itemValue;
|
|
4438
|
+
newProps.expanded = expanded;
|
|
4439
|
+
newProps.onToggleExpanded = (isExpanded) => {
|
|
4440
|
+
onItemToggle(itemValue, isExpanded);
|
|
4441
|
+
typedChild.props.onToggleExpanded?.(isExpanded);
|
|
4442
|
+
};
|
|
4443
|
+
}
|
|
4444
|
+
if (typedChild.props.children) {
|
|
4445
|
+
const processedChildren = injectStore3(
|
|
4446
|
+
typedChild.props.children,
|
|
4447
|
+
store,
|
|
4448
|
+
indexRef,
|
|
4449
|
+
onItemToggle
|
|
4450
|
+
);
|
|
4451
|
+
if (displayName === "CardAccordation") {
|
|
4452
|
+
newProps.children = processedChildren;
|
|
4453
|
+
} else if (processedChildren !== typedChild.props.children) {
|
|
4454
|
+
return (0, import_react12.cloneElement)(typedChild, { children: processedChildren });
|
|
4455
|
+
}
|
|
4456
|
+
}
|
|
4457
|
+
if (Object.keys(newProps).length > 0) {
|
|
4458
|
+
return (0, import_react12.cloneElement)(typedChild, newProps);
|
|
4459
|
+
}
|
|
4460
|
+
return child;
|
|
4461
|
+
});
|
|
4462
|
+
};
|
|
4463
|
+
var AccordionGroup = (0, import_react12.forwardRef)(
|
|
4464
|
+
({
|
|
4465
|
+
type = "single",
|
|
4466
|
+
defaultValue,
|
|
4467
|
+
value: controlledValue,
|
|
4468
|
+
onValueChange,
|
|
4469
|
+
collapsible = true,
|
|
4470
|
+
children,
|
|
4471
|
+
className,
|
|
4472
|
+
...props
|
|
4473
|
+
}, ref) => {
|
|
4474
|
+
const [internalValue, setInternalValue] = (0, import_react12.useState)(
|
|
4475
|
+
defaultValue || (type === "single" ? "" : [])
|
|
4476
|
+
);
|
|
4477
|
+
const isControlled = controlledValue !== void 0;
|
|
4478
|
+
const currentValue = isControlled ? controlledValue : internalValue;
|
|
4479
|
+
const storeRef = (0, import_react12.useRef)(null);
|
|
4480
|
+
if (storeRef.current) {
|
|
4481
|
+
storeRef.current.setState((prev) => {
|
|
4482
|
+
const nextState = {};
|
|
4483
|
+
if (prev.type !== type) {
|
|
4484
|
+
nextState.type = type;
|
|
4485
|
+
}
|
|
4486
|
+
if (prev.collapsible !== collapsible) {
|
|
4487
|
+
nextState.collapsible = collapsible;
|
|
4488
|
+
}
|
|
4489
|
+
return nextState;
|
|
4490
|
+
});
|
|
4491
|
+
} else {
|
|
4492
|
+
storeRef.current = createAccordionGroupStore(
|
|
4493
|
+
type,
|
|
4494
|
+
currentValue,
|
|
4495
|
+
collapsible
|
|
4496
|
+
);
|
|
4497
|
+
}
|
|
4498
|
+
const store = storeRef.current;
|
|
4499
|
+
(0, import_react12.useEffect)(() => {
|
|
4500
|
+
store.setState({ value: currentValue });
|
|
4501
|
+
}, [currentValue, store]);
|
|
4502
|
+
(0, import_react12.useEffect)(() => {
|
|
4503
|
+
if (!isControlled) {
|
|
4504
|
+
setInternalValue((prev) => {
|
|
4505
|
+
if (type === "single") {
|
|
4506
|
+
if (Array.isArray(prev)) {
|
|
4507
|
+
return prev[0] ?? "";
|
|
4508
|
+
}
|
|
4509
|
+
return typeof prev === "string" ? prev : "";
|
|
4510
|
+
}
|
|
4511
|
+
if (Array.isArray(prev)) {
|
|
4512
|
+
return prev;
|
|
4513
|
+
}
|
|
4514
|
+
return prev ? [prev] : [];
|
|
4515
|
+
});
|
|
4516
|
+
}
|
|
4517
|
+
}, [isControlled, type]);
|
|
4518
|
+
const handleItemToggle = (itemValue, isExpanded) => {
|
|
4519
|
+
const storeState = store.getState();
|
|
4520
|
+
let newValue;
|
|
4521
|
+
if (type === "single") {
|
|
4522
|
+
if (isExpanded) {
|
|
4523
|
+
newValue = itemValue;
|
|
4524
|
+
} else {
|
|
4525
|
+
newValue = collapsible ? "" : storeState.value;
|
|
4526
|
+
}
|
|
4527
|
+
} else {
|
|
4528
|
+
const currentArray = Array.isArray(storeState.value) ? storeState.value : [];
|
|
4529
|
+
if (isExpanded) {
|
|
4530
|
+
newValue = [...currentArray, itemValue];
|
|
4531
|
+
} else {
|
|
4532
|
+
newValue = currentArray.filter((v) => v !== itemValue);
|
|
4533
|
+
}
|
|
4534
|
+
}
|
|
4535
|
+
if (!isControlled) {
|
|
4536
|
+
setInternalValue(newValue);
|
|
4537
|
+
}
|
|
4538
|
+
store.setState({ value: newValue });
|
|
4539
|
+
onValueChange?.(newValue);
|
|
4540
|
+
};
|
|
4541
|
+
const indexRef = { current: 0 };
|
|
4542
|
+
const enhancedChildren = injectStore3(
|
|
4543
|
+
children,
|
|
4544
|
+
store,
|
|
4545
|
+
indexRef,
|
|
4546
|
+
handleItemToggle
|
|
4547
|
+
);
|
|
4548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ref, className, ...props, children: enhancedChildren });
|
|
4549
|
+
}
|
|
4550
|
+
);
|
|
4551
|
+
AccordionGroup.displayName = "AccordionGroup";
|
|
4552
|
+
|
|
4553
|
+
// src/components/ActivityFilters/ActivityFilters.tsx
|
|
4554
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4555
|
+
var questionTypes = [
|
|
4556
|
+
"ALTERNATIVA" /* ALTERNATIVA */,
|
|
4557
|
+
"VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */,
|
|
4558
|
+
"DISSERTATIVA" /* DISSERTATIVA */,
|
|
4559
|
+
"IMAGEM" /* IMAGEM */,
|
|
4560
|
+
"MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */,
|
|
4561
|
+
"LIGAR_PONTOS" /* LIGAR_PONTOS */,
|
|
4562
|
+
"PREENCHER" /* PREENCHER */
|
|
4563
|
+
];
|
|
4564
|
+
var QuestionTypeFilter = ({
|
|
4565
|
+
selectedTypes,
|
|
4566
|
+
onToggleType
|
|
4567
|
+
}) => {
|
|
4568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
4569
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Tipo de quest\xE3o" }),
|
|
4570
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-2 gap-2", children: questionTypes.map((questionType) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4571
|
+
Chips_default,
|
|
4572
|
+
{
|
|
4573
|
+
selected: selectedTypes.includes(questionType),
|
|
4574
|
+
onClick: () => onToggleType(questionType),
|
|
4575
|
+
children: questionTypeLabels[questionType]
|
|
4576
|
+
},
|
|
4577
|
+
questionType
|
|
4578
|
+
)) })
|
|
4579
|
+
] });
|
|
4580
|
+
};
|
|
4581
|
+
var BanksFilter = ({
|
|
4582
|
+
banks,
|
|
4583
|
+
selectedBanks,
|
|
4584
|
+
onToggleBank,
|
|
4585
|
+
loading = false,
|
|
4586
|
+
error = null
|
|
4587
|
+
}) => {
|
|
4588
|
+
if (loading) {
|
|
4589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: "Carregando bancas..." });
|
|
4590
|
+
}
|
|
4591
|
+
if (error) {
|
|
4592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: error });
|
|
4593
|
+
}
|
|
4594
|
+
if (banks.length === 0) {
|
|
4595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: "Nenhuma banca encontrada" });
|
|
4596
|
+
}
|
|
4597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-2 gap-2", children: banks.map((bank) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4598
|
+
Chips_default,
|
|
4599
|
+
{
|
|
4600
|
+
selected: selectedBanks.includes(bank.examInstitution),
|
|
4601
|
+
onClick: () => onToggleBank(bank.examInstitution),
|
|
4602
|
+
children: bank.examInstitution
|
|
4603
|
+
},
|
|
4604
|
+
bank.examInstitution
|
|
4605
|
+
)) });
|
|
4606
|
+
};
|
|
4607
|
+
var SubjectsFilter = ({
|
|
4608
|
+
knowledgeAreas,
|
|
4609
|
+
selectedSubject,
|
|
4610
|
+
onSubjectChange,
|
|
4611
|
+
loading = false,
|
|
4612
|
+
error = null
|
|
4613
|
+
}) => {
|
|
4614
|
+
const { isDark } = useTheme();
|
|
4615
|
+
if (loading) {
|
|
4616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: "Carregando mat\xE9rias..." });
|
|
4617
|
+
}
|
|
4618
|
+
if (error) {
|
|
4619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: error });
|
|
4620
|
+
}
|
|
4621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-3 gap-3", children: knowledgeAreas.map((area) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4622
|
+
Radio_default,
|
|
4623
|
+
{
|
|
4624
|
+
value: area.id,
|
|
4625
|
+
checked: selectedSubject === area.id,
|
|
4626
|
+
onChange: () => onSubjectChange(area.id),
|
|
4627
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 w-full min-w-0", children: [
|
|
4628
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4629
|
+
"span",
|
|
4630
|
+
{
|
|
4631
|
+
className: "size-4 rounded-sm flex items-center justify-center shrink-0 text-text-950",
|
|
4632
|
+
style: {
|
|
4633
|
+
backgroundColor: getSubjectColorWithOpacity(
|
|
4634
|
+
area.color,
|
|
4635
|
+
isDark
|
|
4636
|
+
)
|
|
4637
|
+
},
|
|
4638
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4639
|
+
IconRender_default,
|
|
4640
|
+
{
|
|
4641
|
+
iconName: area.icon || "BookOpen",
|
|
4642
|
+
size: 14,
|
|
4643
|
+
color: "currentColor"
|
|
4644
|
+
}
|
|
4645
|
+
)
|
|
4646
|
+
}
|
|
4647
|
+
),
|
|
4648
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate flex-1", children: area.name })
|
|
4649
|
+
] })
|
|
4650
|
+
},
|
|
4651
|
+
area.id
|
|
4652
|
+
)) });
|
|
4653
|
+
};
|
|
4654
|
+
var KnowledgeSummary = ({
|
|
4655
|
+
knowledgeStructure,
|
|
4656
|
+
selectedKnowledgeSummary
|
|
4657
|
+
}) => {
|
|
4658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mt-4 p-3 bg-background-50 rounded-lg border border-border-200", children: [
|
|
4659
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", weight: "bold", className: "mb-2 block", children: "Resumo da sele\xE7\xE3o" }),
|
|
4660
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4661
|
+
knowledgeStructure.topics.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
4662
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "xs", weight: "medium", className: "text-text-600", children: "Tema:" }),
|
|
4663
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1 mt-1", children: selectedKnowledgeSummary.topics.map((topic) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Chips_default, { selected: true, children: topic }, topic)) })
|
|
4664
|
+
] }),
|
|
4665
|
+
knowledgeStructure.subtopics.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
4666
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "xs", weight: "medium", className: "text-text-600", children: "Subtema:" }),
|
|
4667
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1 mt-1", children: selectedKnowledgeSummary.subtopics.map((subtopic) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Chips_default, { selected: true, children: subtopic }, subtopic)) })
|
|
4668
|
+
] }),
|
|
4669
|
+
knowledgeStructure.contents.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
4670
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "xs", weight: "medium", className: "text-text-600", children: "Assunto:" }),
|
|
4671
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1 mt-1", children: selectedKnowledgeSummary.contents.map((content) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Chips_default, { selected: true, children: content }, content)) })
|
|
4672
|
+
] })
|
|
4673
|
+
] })
|
|
4674
|
+
] });
|
|
4675
|
+
};
|
|
4676
|
+
var KnowledgeStructureFilter = ({
|
|
4677
|
+
knowledgeStructure,
|
|
4678
|
+
knowledgeCategories,
|
|
4679
|
+
handleCategoriesChange,
|
|
4680
|
+
selectedKnowledgeSummary = {
|
|
4681
|
+
topics: [],
|
|
4682
|
+
subtopics: [],
|
|
4683
|
+
contents: []
|
|
4684
|
+
},
|
|
4685
|
+
enableSummary = false
|
|
4686
|
+
}) => {
|
|
4687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mt-4", children: [
|
|
4688
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Tema, Subtema e Assunto" }),
|
|
4689
|
+
knowledgeStructure.loading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600 mb-3", children: "Carregando estrutura de conhecimento..." }),
|
|
4690
|
+
knowledgeStructure.error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "mb-3 text-error-500", children: knowledgeStructure.error }),
|
|
4691
|
+
knowledgeCategories.length > 0 && handleCategoriesChange && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4692
|
+
CheckboxGroup,
|
|
4693
|
+
{
|
|
4694
|
+
categories: knowledgeCategories,
|
|
4695
|
+
onCategoriesChange: handleCategoriesChange
|
|
4696
|
+
}
|
|
4697
|
+
),
|
|
4698
|
+
!knowledgeStructure.loading && knowledgeCategories.length === 0 && knowledgeStructure.topics.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: "Nenhum tema dispon\xEDvel para as mat\xE9rias selecionadas" }),
|
|
4699
|
+
enableSummary && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4700
|
+
KnowledgeSummary,
|
|
4701
|
+
{
|
|
4702
|
+
knowledgeStructure,
|
|
4703
|
+
selectedKnowledgeSummary
|
|
4704
|
+
}
|
|
4705
|
+
)
|
|
4706
|
+
] });
|
|
4707
|
+
};
|
|
4708
|
+
var FilterActions = ({
|
|
4709
|
+
onClearFilters,
|
|
4710
|
+
onApplyFilters
|
|
4711
|
+
}) => {
|
|
4712
|
+
if (!onClearFilters && !onApplyFilters) {
|
|
4713
|
+
return null;
|
|
4714
|
+
}
|
|
4715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "grid grid-cols-2 gap-2 justify-end mt-4 px-4 pt-4 border-t border-border-200", children: [
|
|
4716
|
+
onClearFilters && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button_default, { variant: "link", onClick: onClearFilters, size: "small", children: "Limpar filtros" }),
|
|
4717
|
+
onApplyFilters && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button_default, { variant: "outline", onClick: onApplyFilters, size: "small", children: "Filtrar" })
|
|
4718
|
+
] });
|
|
4719
|
+
};
|
|
4720
|
+
var ActivityFilters = ({
|
|
4721
|
+
onFiltersChange,
|
|
4722
|
+
variant = "default",
|
|
4723
|
+
// Data
|
|
4724
|
+
banks = [],
|
|
4725
|
+
knowledgeAreas = [],
|
|
4726
|
+
knowledgeStructure = {
|
|
4727
|
+
topics: [],
|
|
4728
|
+
subtopics: [],
|
|
4729
|
+
contents: [],
|
|
4730
|
+
loading: false,
|
|
4731
|
+
error: null
|
|
4732
|
+
},
|
|
4733
|
+
knowledgeCategories = [],
|
|
4734
|
+
// Loading states
|
|
4735
|
+
loadingBanks = false,
|
|
4736
|
+
loadingKnowledge: _loadingKnowledge = false,
|
|
4737
|
+
loadingSubjects = false,
|
|
4738
|
+
// Errors
|
|
4739
|
+
banksError = null,
|
|
4740
|
+
subjectsError = null,
|
|
4741
|
+
// Load functions
|
|
4742
|
+
loadBanks,
|
|
4743
|
+
loadKnowledge,
|
|
4744
|
+
loadTopics,
|
|
4745
|
+
loadSubtopics: _loadSubtopics,
|
|
4746
|
+
loadContents: _loadContents,
|
|
4747
|
+
// Handlers
|
|
4748
|
+
handleCategoriesChange,
|
|
4749
|
+
selectedKnowledgeSummary = {
|
|
4750
|
+
topics: [],
|
|
4751
|
+
subtopics: [],
|
|
4752
|
+
contents: []
|
|
4753
|
+
},
|
|
4754
|
+
enableSummary = false,
|
|
4755
|
+
// Action buttons
|
|
4756
|
+
onClearFilters,
|
|
4757
|
+
onApplyFilters
|
|
4758
|
+
}) => {
|
|
4759
|
+
const [selectedQuestionTypes, setSelectedQuestionTypes] = (0, import_react13.useState)([]);
|
|
4760
|
+
const [selectedBanks, setSelectedBanks] = (0, import_react13.useState)([]);
|
|
4761
|
+
const [selectedSubject, setSelectedSubject] = (0, import_react13.useState)(null);
|
|
4762
|
+
const selectedSubjects = (0, import_react13.useMemo)(
|
|
4763
|
+
() => selectedSubject ? [selectedSubject] : [],
|
|
4764
|
+
[selectedSubject]
|
|
4765
|
+
);
|
|
4766
|
+
const toggleQuestionType = (questionType) => {
|
|
4767
|
+
setSelectedQuestionTypes((prev) => toggleArrayItem(prev, questionType));
|
|
4768
|
+
};
|
|
4769
|
+
const toggleBank = (bankName) => {
|
|
4770
|
+
setSelectedBanks((prev) => toggleArrayItem(prev, bankName));
|
|
4771
|
+
};
|
|
4772
|
+
const handleSubjectChange = (subjectId) => {
|
|
4773
|
+
setSelectedSubject(toggleSingleValue(selectedSubject, subjectId));
|
|
4774
|
+
};
|
|
4775
|
+
(0, import_react13.useEffect)(() => {
|
|
4776
|
+
if (loadBanks) {
|
|
4777
|
+
loadBanks();
|
|
4778
|
+
}
|
|
4779
|
+
if (loadKnowledge) {
|
|
4780
|
+
loadKnowledge();
|
|
4781
|
+
}
|
|
4782
|
+
}, [loadBanks, loadKnowledge]);
|
|
4783
|
+
(0, import_react13.useEffect)(() => {
|
|
4784
|
+
if (selectedSubject && loadTopics) {
|
|
4785
|
+
loadTopics([selectedSubject]);
|
|
4786
|
+
}
|
|
4787
|
+
}, [selectedSubject, loadTopics]);
|
|
4788
|
+
const getSelectedKnowledgeIds = (0, import_react13.useCallback)(() => {
|
|
4789
|
+
return getSelectedIdsFromCategories(knowledgeCategories, {
|
|
4790
|
+
topicIds: "tema",
|
|
4791
|
+
subtopicIds: "subtema",
|
|
4792
|
+
contentIds: "assunto"
|
|
4793
|
+
});
|
|
4794
|
+
}, [knowledgeCategories]);
|
|
4795
|
+
(0, import_react13.useEffect)(() => {
|
|
4796
|
+
const knowledgeIds = getSelectedKnowledgeIds();
|
|
4797
|
+
const filters = {
|
|
4798
|
+
types: selectedQuestionTypes,
|
|
4799
|
+
bankIds: selectedBanks,
|
|
4800
|
+
knowledgeIds: selectedSubjects,
|
|
4801
|
+
topicIds: knowledgeIds.topicIds,
|
|
4802
|
+
subtopicIds: knowledgeIds.subtopicIds,
|
|
4803
|
+
contentIds: knowledgeIds.contentIds
|
|
4804
|
+
};
|
|
4805
|
+
onFiltersChange(filters);
|
|
4806
|
+
}, [
|
|
4807
|
+
selectedQuestionTypes,
|
|
4808
|
+
selectedBanks,
|
|
4809
|
+
selectedSubjects,
|
|
4810
|
+
knowledgeCategories,
|
|
4811
|
+
getSelectedKnowledgeIds,
|
|
4812
|
+
onFiltersChange
|
|
4813
|
+
]);
|
|
4814
|
+
const containerClassName = variant === "popover" ? "w-full bg-background" : "w-[400px] flex-shrink-0 p-4 bg-background";
|
|
4815
|
+
const contentClassName = variant === "popover" ? "p-4" : "";
|
|
4816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: containerClassName, children: [
|
|
4817
|
+
variant === "default" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("section", { className: "flex flex-row items-center gap-2 text-text-950 mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "lg", weight: "bold", children: "Filtro de quest\xF5es" }) }),
|
|
4818
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: contentClassName, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: "flex flex-col gap-4", children: [
|
|
4819
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4820
|
+
QuestionTypeFilter,
|
|
4821
|
+
{
|
|
4822
|
+
selectedTypes: selectedQuestionTypes,
|
|
4823
|
+
onToggleType: toggleQuestionType
|
|
4824
|
+
}
|
|
4825
|
+
),
|
|
4826
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
4827
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Banca de vestibular" }),
|
|
4828
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4829
|
+
BanksFilter,
|
|
4830
|
+
{
|
|
4831
|
+
banks,
|
|
4832
|
+
selectedBanks,
|
|
4833
|
+
onToggleBank: toggleBank,
|
|
4834
|
+
loading: loadingBanks,
|
|
4835
|
+
error: banksError
|
|
4836
|
+
}
|
|
4837
|
+
)
|
|
4838
|
+
] }),
|
|
4839
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
4840
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-row justify-between items-center mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", weight: "bold", children: "Mat\xE9ria" }) }),
|
|
4841
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4842
|
+
SubjectsFilter,
|
|
4843
|
+
{
|
|
4844
|
+
knowledgeAreas,
|
|
4845
|
+
selectedSubject,
|
|
4846
|
+
onSubjectChange: handleSubjectChange,
|
|
4847
|
+
loading: loadingSubjects,
|
|
4848
|
+
error: subjectsError
|
|
4849
|
+
}
|
|
4850
|
+
)
|
|
4851
|
+
] }),
|
|
4852
|
+
selectedSubject && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4853
|
+
KnowledgeStructureFilter,
|
|
4854
|
+
{
|
|
4855
|
+
knowledgeStructure,
|
|
4856
|
+
knowledgeCategories,
|
|
4857
|
+
handleCategoriesChange,
|
|
4858
|
+
selectedKnowledgeSummary,
|
|
4859
|
+
enableSummary
|
|
4860
|
+
}
|
|
4861
|
+
),
|
|
4862
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4863
|
+
FilterActions,
|
|
4864
|
+
{
|
|
4865
|
+
onClearFilters,
|
|
4866
|
+
onApplyFilters
|
|
4867
|
+
}
|
|
4868
|
+
)
|
|
4869
|
+
] }) })
|
|
4870
|
+
] });
|
|
4871
|
+
};
|
|
4872
|
+
var ActivityFiltersPopover = ({
|
|
4873
|
+
onFiltersChange,
|
|
4874
|
+
triggerLabel = "Filtro de quest\xF5es",
|
|
4875
|
+
...activityFiltersProps
|
|
4876
|
+
}) => {
|
|
4877
|
+
const [open, setOpen] = (0, import_react13.useState)(false);
|
|
4878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu_default, { open, onOpenChange: setOpen, children: [
|
|
4879
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button_default, { variant: "outline", children: triggerLabel }) }),
|
|
4880
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4881
|
+
DropdownMenuContent,
|
|
4882
|
+
{
|
|
4883
|
+
className: "w-[90vw] max-w-[400px] max-h-[calc(100vh-8rem)] overflow-y-auto p-0",
|
|
4884
|
+
align: "start",
|
|
4885
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4886
|
+
ActivityFilters,
|
|
4887
|
+
{
|
|
4888
|
+
onFiltersChange,
|
|
4889
|
+
variant: "popover",
|
|
4890
|
+
...activityFiltersProps
|
|
4891
|
+
}
|
|
4892
|
+
)
|
|
4893
|
+
}
|
|
4894
|
+
)
|
|
4895
|
+
] });
|
|
4896
|
+
};
|
|
4897
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4898
|
+
0 && (module.exports = {
|
|
4899
|
+
ActivityFilters,
|
|
4900
|
+
ActivityFiltersPopover
|
|
4901
|
+
});
|
|
4902
|
+
//# sourceMappingURL=index.js.map
|