analytica-frontend-lib 1.0.70 → 1.0.72
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.d.mts +12 -0
- package/dist/Accordation/index.d.ts +12 -0
- package/dist/Accordation/index.js +1663 -0
- package/dist/Accordation/index.js.map +1 -0
- package/dist/Accordation/index.mjs +1654 -0
- package/dist/Accordation/index.mjs.map +1 -0
- package/dist/AlertDialog/index.d.mts +40 -0
- package/dist/AlertDialog/index.d.ts +40 -0
- package/dist/AlertDialog/index.js +233 -0
- package/dist/AlertDialog/index.js.map +1 -0
- package/dist/AlertDialog/index.mjs +212 -0
- package/dist/AlertDialog/index.mjs.map +1 -0
- package/dist/Alternative/index.d.mts +81 -0
- package/dist/Alternative/index.d.ts +81 -0
- package/dist/Alternative/index.js +745 -0
- package/dist/Alternative/index.js.map +1 -0
- package/dist/Alternative/index.mjs +728 -0
- package/dist/Alternative/index.mjs.map +1 -0
- package/dist/Badge/index.js +1 -1
- package/dist/Badge/index.js.map +1 -1
- package/dist/Badge/index.mjs +1 -1
- package/dist/Badge/index.mjs.map +1 -1
- package/dist/Card/index.js +1 -1
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs +1 -1
- package/dist/Card/index.mjs.map +1 -1
- package/dist/Radio/index.d.mts +120 -2
- package/dist/Radio/index.d.ts +120 -2
- package/dist/Radio/index.js +176 -3
- package/dist/Radio/index.js.map +1 -1
- package/dist/Radio/index.mjs +176 -4
- package/dist/Radio/index.mjs.map +1 -1
- package/dist/Skeleton/index.d.mts +10 -9
- package/dist/Skeleton/index.d.ts +10 -9
- package/dist/Skeleton/index.js.map +1 -1
- package/dist/Skeleton/index.mjs.map +1 -1
- package/dist/index.css +173 -83
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2361 -1916
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2412 -1962
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +173 -83
- package/dist/styles.css.map +1 -1
- package/package.json +4 -2
- package/dist/Tab/index.d.mts +0 -37
- package/dist/Tab/index.d.ts +0 -37
- package/dist/Tab/index.js +0 -182
- package/dist/Tab/index.js.map +0 -1
- package/dist/Tab/index.mjs +0 -161
- package/dist/Tab/index.mjs.map +0 -1
|
@@ -0,0 +1,1654 @@
|
|
|
1
|
+
// src/components/Accordation/Accordation.tsx
|
|
2
|
+
import { forwardRef as forwardRef2, useId, useState as useState2 } from "react";
|
|
3
|
+
|
|
4
|
+
// src/components/Card/Card.tsx
|
|
5
|
+
import {
|
|
6
|
+
forwardRef,
|
|
7
|
+
Fragment as Fragment2,
|
|
8
|
+
useState,
|
|
9
|
+
useRef
|
|
10
|
+
} from "react";
|
|
11
|
+
|
|
12
|
+
// src/components/Button/Button.tsx
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
var VARIANT_ACTION_CLASSES = {
|
|
15
|
+
solid: {
|
|
16
|
+
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",
|
|
17
|
+
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",
|
|
18
|
+
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"
|
|
19
|
+
},
|
|
20
|
+
outline: {
|
|
21
|
+
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",
|
|
22
|
+
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",
|
|
23
|
+
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"
|
|
24
|
+
},
|
|
25
|
+
link: {
|
|
26
|
+
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",
|
|
27
|
+
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",
|
|
28
|
+
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"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var SIZE_CLASSES = {
|
|
32
|
+
"extra-small": "text-xs px-3.5 py-2",
|
|
33
|
+
small: "text-sm px-4 py-2.5",
|
|
34
|
+
medium: "text-md px-5 py-2.5",
|
|
35
|
+
large: "text-lg px-6 py-3",
|
|
36
|
+
"extra-large": "text-lg px-7 py-3.5"
|
|
37
|
+
};
|
|
38
|
+
var Button = ({
|
|
39
|
+
children,
|
|
40
|
+
iconLeft,
|
|
41
|
+
iconRight,
|
|
42
|
+
size = "medium",
|
|
43
|
+
variant = "solid",
|
|
44
|
+
action = "primary",
|
|
45
|
+
className = "",
|
|
46
|
+
disabled,
|
|
47
|
+
type = "button",
|
|
48
|
+
...props
|
|
49
|
+
}) => {
|
|
50
|
+
const sizeClasses = SIZE_CLASSES[size];
|
|
51
|
+
const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
|
|
52
|
+
const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
|
|
53
|
+
return /* @__PURE__ */ jsxs(
|
|
54
|
+
"button",
|
|
55
|
+
{
|
|
56
|
+
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
57
|
+
disabled,
|
|
58
|
+
type,
|
|
59
|
+
...props,
|
|
60
|
+
children: [
|
|
61
|
+
iconLeft && /* @__PURE__ */ jsx("span", { className: "mr-2 flex items-center", children: iconLeft }),
|
|
62
|
+
children,
|
|
63
|
+
iconRight && /* @__PURE__ */ jsx("span", { className: "ml-2 flex items-center", children: iconRight })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
var Button_default = Button;
|
|
69
|
+
|
|
70
|
+
// src/components/Badge/Badge.tsx
|
|
71
|
+
import { Bell } from "phosphor-react";
|
|
72
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
73
|
+
var VARIANT_ACTION_CLASSES2 = {
|
|
74
|
+
solid: {
|
|
75
|
+
error: "bg-error-background text-error-700 focus-visible:outline-none",
|
|
76
|
+
warning: "bg-warning text-warning-800 focus-visible:outline-none",
|
|
77
|
+
success: "bg-success text-success-800 focus-visible:outline-none",
|
|
78
|
+
info: "bg-info text-info-800 focus-visible:outline-none",
|
|
79
|
+
muted: "bg-background-muted text-background-800 focus-visible:outline-none"
|
|
80
|
+
},
|
|
81
|
+
outlined: {
|
|
82
|
+
error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
|
|
83
|
+
warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
|
|
84
|
+
success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
|
|
85
|
+
info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
|
|
86
|
+
muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
|
|
87
|
+
},
|
|
88
|
+
exams: {
|
|
89
|
+
exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
|
|
90
|
+
exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
|
|
91
|
+
exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
|
|
92
|
+
exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
|
|
93
|
+
},
|
|
94
|
+
resultStatus: {
|
|
95
|
+
negative: "bg-error text-error-800 focus-visible:outline-none",
|
|
96
|
+
positive: "bg-success text-success-800 focus-visible:outline-none"
|
|
97
|
+
},
|
|
98
|
+
notification: "text-primary"
|
|
99
|
+
};
|
|
100
|
+
var SIZE_CLASSES2 = {
|
|
101
|
+
small: "text-2xs px-2 py-1",
|
|
102
|
+
medium: "text-xs px-2 py-1",
|
|
103
|
+
large: "text-sm px-2 py-1"
|
|
104
|
+
};
|
|
105
|
+
var SIZE_CLASSES_ICON = {
|
|
106
|
+
small: "size-3",
|
|
107
|
+
medium: "size-3.5",
|
|
108
|
+
large: "size-4"
|
|
109
|
+
};
|
|
110
|
+
var Badge = ({
|
|
111
|
+
children,
|
|
112
|
+
iconLeft,
|
|
113
|
+
iconRight,
|
|
114
|
+
size = "medium",
|
|
115
|
+
variant = "solid",
|
|
116
|
+
action = "error",
|
|
117
|
+
className = "",
|
|
118
|
+
notificationActive = false,
|
|
119
|
+
...props
|
|
120
|
+
}) => {
|
|
121
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
122
|
+
const sizeClassesIcon = SIZE_CLASSES_ICON[size];
|
|
123
|
+
const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
|
|
124
|
+
const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
|
|
125
|
+
const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
|
|
126
|
+
const baseClassesIcon = "flex items-center";
|
|
127
|
+
if (variant === "notification") {
|
|
128
|
+
return /* @__PURE__ */ jsxs2(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
132
|
+
...props,
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsx2(Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
|
|
135
|
+
notificationActive && /* @__PURE__ */ jsx2(
|
|
136
|
+
"span",
|
|
137
|
+
{
|
|
138
|
+
"data-testid": "notification-dot",
|
|
139
|
+
className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
return /* @__PURE__ */ jsxs2(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
150
|
+
...props,
|
|
151
|
+
children: [
|
|
152
|
+
iconLeft && /* @__PURE__ */ jsx2("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconLeft }),
|
|
153
|
+
children,
|
|
154
|
+
iconRight && /* @__PURE__ */ jsx2("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconRight })
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
var Badge_default = Badge;
|
|
160
|
+
|
|
161
|
+
// src/components/Text/Text.tsx
|
|
162
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
163
|
+
var Text = ({
|
|
164
|
+
children,
|
|
165
|
+
size = "md",
|
|
166
|
+
weight = "normal",
|
|
167
|
+
color = "text-text-950",
|
|
168
|
+
as,
|
|
169
|
+
className = "",
|
|
170
|
+
...props
|
|
171
|
+
}) => {
|
|
172
|
+
let sizeClasses = "";
|
|
173
|
+
let weightClasses = "";
|
|
174
|
+
const sizeClassMap = {
|
|
175
|
+
"2xs": "text-2xs",
|
|
176
|
+
xs: "text-xs",
|
|
177
|
+
sm: "text-sm",
|
|
178
|
+
md: "text-md",
|
|
179
|
+
lg: "text-lg",
|
|
180
|
+
xl: "text-xl",
|
|
181
|
+
"2xl": "text-2xl",
|
|
182
|
+
"3xl": "text-3xl",
|
|
183
|
+
"4xl": "text-4xl",
|
|
184
|
+
"5xl": "text-5xl",
|
|
185
|
+
"6xl": "text-6xl"
|
|
186
|
+
};
|
|
187
|
+
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
188
|
+
const weightClassMap = {
|
|
189
|
+
hairline: "font-hairline",
|
|
190
|
+
light: "font-light",
|
|
191
|
+
normal: "font-normal",
|
|
192
|
+
medium: "font-medium",
|
|
193
|
+
semibold: "font-semibold",
|
|
194
|
+
bold: "font-bold",
|
|
195
|
+
extrabold: "font-extrabold",
|
|
196
|
+
black: "font-black"
|
|
197
|
+
};
|
|
198
|
+
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
199
|
+
const baseClasses = "font-primary";
|
|
200
|
+
const Component = as ?? "p";
|
|
201
|
+
return /* @__PURE__ */ jsx3(
|
|
202
|
+
Component,
|
|
203
|
+
{
|
|
204
|
+
className: `${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`,
|
|
205
|
+
...props,
|
|
206
|
+
children
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
var Text_default = Text;
|
|
211
|
+
|
|
212
|
+
// src/components/ProgressBar/ProgressBar.tsx
|
|
213
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
214
|
+
var SIZE_CLASSES3 = {
|
|
215
|
+
small: {
|
|
216
|
+
container: "h-1",
|
|
217
|
+
// 4px height (h-1 = 4px in Tailwind)
|
|
218
|
+
bar: "h-1",
|
|
219
|
+
// 4px height for the fill bar
|
|
220
|
+
spacing: "gap-2",
|
|
221
|
+
// 8px gap between label and progress bar
|
|
222
|
+
layout: "flex-col",
|
|
223
|
+
// vertical layout for small
|
|
224
|
+
borderRadius: "rounded-full"
|
|
225
|
+
// 9999px border radius
|
|
226
|
+
},
|
|
227
|
+
medium: {
|
|
228
|
+
container: "h-2",
|
|
229
|
+
// 8px height (h-2 = 8px in Tailwind)
|
|
230
|
+
bar: "h-2",
|
|
231
|
+
// 8px height for the fill bar
|
|
232
|
+
spacing: "gap-2",
|
|
233
|
+
// 8px gap between progress bar and label
|
|
234
|
+
layout: "flex-row items-center",
|
|
235
|
+
// horizontal layout for medium
|
|
236
|
+
borderRadius: "rounded-lg"
|
|
237
|
+
// 8px border radius
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
var VARIANT_CLASSES = {
|
|
241
|
+
blue: {
|
|
242
|
+
background: "bg-background-300",
|
|
243
|
+
// Background track color (#D5D4D4)
|
|
244
|
+
fill: "bg-primary-700"
|
|
245
|
+
// Blue for activity progress (#2271C4)
|
|
246
|
+
},
|
|
247
|
+
green: {
|
|
248
|
+
background: "bg-background-300",
|
|
249
|
+
// Background track color (#D5D4D4)
|
|
250
|
+
fill: "bg-success-200"
|
|
251
|
+
// Green for performance (#84D3A2)
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var calculateProgressValues = (value, max) => {
|
|
255
|
+
const safeValue = isNaN(value) ? 0 : value;
|
|
256
|
+
const clampedValue = Math.max(0, Math.min(safeValue, max));
|
|
257
|
+
const percentage = max === 0 ? 0 : clampedValue / max * 100;
|
|
258
|
+
return { clampedValue, percentage };
|
|
259
|
+
};
|
|
260
|
+
var shouldShowHeader = (label, showPercentage, showHitCount) => {
|
|
261
|
+
return !!(label || showPercentage || showHitCount);
|
|
262
|
+
};
|
|
263
|
+
var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
|
|
264
|
+
if (showHitCount) {
|
|
265
|
+
return {
|
|
266
|
+
type: "hitCount",
|
|
267
|
+
content: `${Math.round(clampedValue)} de ${max}`,
|
|
268
|
+
hasMetrics: true
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
if (showPercentage) {
|
|
272
|
+
return {
|
|
273
|
+
type: "percentage",
|
|
274
|
+
content: `${Math.round(percentage)}%`,
|
|
275
|
+
hasMetrics: true
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
type: "label",
|
|
280
|
+
content: label,
|
|
281
|
+
hasMetrics: false
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
var getCompactLayoutConfig = ({
|
|
285
|
+
showPercentage,
|
|
286
|
+
showHitCount,
|
|
287
|
+
percentage,
|
|
288
|
+
clampedValue,
|
|
289
|
+
max,
|
|
290
|
+
label,
|
|
291
|
+
percentageClassName,
|
|
292
|
+
labelClassName
|
|
293
|
+
}) => {
|
|
294
|
+
const displayPriority = getDisplayPriority(
|
|
295
|
+
showHitCount,
|
|
296
|
+
showPercentage,
|
|
297
|
+
label,
|
|
298
|
+
clampedValue,
|
|
299
|
+
max,
|
|
300
|
+
percentage
|
|
301
|
+
);
|
|
302
|
+
return {
|
|
303
|
+
color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
|
|
304
|
+
className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
|
|
305
|
+
content: displayPriority.content
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
|
|
309
|
+
showHeader: size === "small" && !!(label || showPercentage),
|
|
310
|
+
showPercentage: size === "medium" && showPercentage,
|
|
311
|
+
showLabel: size === "medium" && !!label && !showPercentage
|
|
312
|
+
// Only show label when percentage is not shown
|
|
313
|
+
});
|
|
314
|
+
var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
|
|
315
|
+
if (!showHitCount && !showPercentage) return null;
|
|
316
|
+
const displayPriority = getDisplayPriority(
|
|
317
|
+
showHitCount,
|
|
318
|
+
showPercentage,
|
|
319
|
+
null,
|
|
320
|
+
// label is not relevant for stacked layout metrics display
|
|
321
|
+
clampedValue,
|
|
322
|
+
max,
|
|
323
|
+
percentage
|
|
324
|
+
);
|
|
325
|
+
return /* @__PURE__ */ jsx4(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
className: `text-xs font-medium leading-[14px] text-right ${percentageClassName}`,
|
|
329
|
+
children: displayPriority.type === "hitCount" ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
330
|
+
/* @__PURE__ */ jsx4("span", { className: "text-success-200", children: Math.round(clampedValue) }),
|
|
331
|
+
/* @__PURE__ */ jsxs3("span", { className: "text-text-600", children: [
|
|
332
|
+
" de ",
|
|
333
|
+
max
|
|
334
|
+
] })
|
|
335
|
+
] }) : /* @__PURE__ */ jsxs3(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
|
|
336
|
+
Math.round(percentage),
|
|
337
|
+
"%"
|
|
338
|
+
] })
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
};
|
|
342
|
+
var ProgressBarBase = ({
|
|
343
|
+
clampedValue,
|
|
344
|
+
max,
|
|
345
|
+
percentage,
|
|
346
|
+
label,
|
|
347
|
+
variantClasses,
|
|
348
|
+
containerClassName,
|
|
349
|
+
fillClassName
|
|
350
|
+
}) => /* @__PURE__ */ jsxs3(
|
|
351
|
+
"div",
|
|
352
|
+
{
|
|
353
|
+
className: `${containerClassName} ${variantClasses.background} overflow-hidden relative`,
|
|
354
|
+
children: [
|
|
355
|
+
/* @__PURE__ */ jsx4(
|
|
356
|
+
"progress",
|
|
357
|
+
{
|
|
358
|
+
value: clampedValue,
|
|
359
|
+
max,
|
|
360
|
+
"aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
|
|
361
|
+
className: "absolute inset-0 w-full h-full opacity-0"
|
|
362
|
+
}
|
|
363
|
+
),
|
|
364
|
+
/* @__PURE__ */ jsx4(
|
|
365
|
+
"div",
|
|
366
|
+
{
|
|
367
|
+
className: `${fillClassName} ${variantClasses.fill} transition-all duration-300 ease-out`,
|
|
368
|
+
style: { width: `${percentage}%` }
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
var StackedLayout = ({
|
|
375
|
+
className,
|
|
376
|
+
label,
|
|
377
|
+
showPercentage,
|
|
378
|
+
showHitCount,
|
|
379
|
+
labelClassName,
|
|
380
|
+
percentageClassName,
|
|
381
|
+
clampedValue,
|
|
382
|
+
max,
|
|
383
|
+
percentage,
|
|
384
|
+
variantClasses,
|
|
385
|
+
dimensions
|
|
386
|
+
}) => /* @__PURE__ */ jsxs3(
|
|
387
|
+
"div",
|
|
388
|
+
{
|
|
389
|
+
className: `flex flex-col items-start gap-2 ${dimensions.width} ${dimensions.height} ${className}`,
|
|
390
|
+
children: [
|
|
391
|
+
shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ jsxs3("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
|
|
392
|
+
label && /* @__PURE__ */ jsx4(
|
|
393
|
+
Text_default,
|
|
394
|
+
{
|
|
395
|
+
as: "div",
|
|
396
|
+
size: "md",
|
|
397
|
+
weight: "medium",
|
|
398
|
+
className: `text-text-600 leading-[19px] ${labelClassName}`,
|
|
399
|
+
children: label
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
renderStackedHitCountDisplay(
|
|
403
|
+
showHitCount,
|
|
404
|
+
showPercentage,
|
|
405
|
+
clampedValue,
|
|
406
|
+
max,
|
|
407
|
+
percentage,
|
|
408
|
+
percentageClassName
|
|
409
|
+
)
|
|
410
|
+
] }),
|
|
411
|
+
/* @__PURE__ */ jsx4(
|
|
412
|
+
ProgressBarBase,
|
|
413
|
+
{
|
|
414
|
+
clampedValue,
|
|
415
|
+
max,
|
|
416
|
+
percentage,
|
|
417
|
+
label,
|
|
418
|
+
variantClasses,
|
|
419
|
+
containerClassName: "w-full h-2 rounded-lg",
|
|
420
|
+
fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
|
|
421
|
+
}
|
|
422
|
+
)
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
);
|
|
426
|
+
var CompactLayout = ({
|
|
427
|
+
className,
|
|
428
|
+
label,
|
|
429
|
+
showPercentage,
|
|
430
|
+
showHitCount,
|
|
431
|
+
labelClassName,
|
|
432
|
+
percentageClassName,
|
|
433
|
+
clampedValue,
|
|
434
|
+
max,
|
|
435
|
+
percentage,
|
|
436
|
+
variantClasses,
|
|
437
|
+
dimensions
|
|
438
|
+
}) => {
|
|
439
|
+
const {
|
|
440
|
+
color,
|
|
441
|
+
className: compactClassName,
|
|
442
|
+
content
|
|
443
|
+
} = getCompactLayoutConfig({
|
|
444
|
+
showPercentage,
|
|
445
|
+
showHitCount,
|
|
446
|
+
percentage,
|
|
447
|
+
clampedValue,
|
|
448
|
+
max,
|
|
449
|
+
label,
|
|
450
|
+
percentageClassName,
|
|
451
|
+
labelClassName
|
|
452
|
+
});
|
|
453
|
+
return /* @__PURE__ */ jsxs3(
|
|
454
|
+
"div",
|
|
455
|
+
{
|
|
456
|
+
className: `flex flex-col items-start gap-1 ${dimensions.width} ${dimensions.height} ${className}`,
|
|
457
|
+
children: [
|
|
458
|
+
shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ jsx4(
|
|
459
|
+
Text_default,
|
|
460
|
+
{
|
|
461
|
+
as: "div",
|
|
462
|
+
size: "sm",
|
|
463
|
+
weight: "medium",
|
|
464
|
+
color,
|
|
465
|
+
className: `leading-4 w-full ${compactClassName}`,
|
|
466
|
+
children: content
|
|
467
|
+
}
|
|
468
|
+
),
|
|
469
|
+
/* @__PURE__ */ jsx4(
|
|
470
|
+
ProgressBarBase,
|
|
471
|
+
{
|
|
472
|
+
clampedValue,
|
|
473
|
+
max,
|
|
474
|
+
percentage,
|
|
475
|
+
label,
|
|
476
|
+
variantClasses,
|
|
477
|
+
containerClassName: "w-full h-1 rounded-full",
|
|
478
|
+
fillClassName: "h-1 rounded-full"
|
|
479
|
+
}
|
|
480
|
+
)
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
);
|
|
484
|
+
};
|
|
485
|
+
var DefaultLayout = ({
|
|
486
|
+
className,
|
|
487
|
+
size,
|
|
488
|
+
sizeClasses,
|
|
489
|
+
variantClasses,
|
|
490
|
+
label,
|
|
491
|
+
showPercentage,
|
|
492
|
+
labelClassName,
|
|
493
|
+
percentageClassName,
|
|
494
|
+
clampedValue,
|
|
495
|
+
max,
|
|
496
|
+
percentage
|
|
497
|
+
}) => {
|
|
498
|
+
const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
|
|
499
|
+
const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
|
|
500
|
+
const displayConfig = getDefaultLayoutDisplayConfig(
|
|
501
|
+
size,
|
|
502
|
+
label,
|
|
503
|
+
showPercentage
|
|
504
|
+
);
|
|
505
|
+
return /* @__PURE__ */ jsxs3("div", { className: `flex ${sizeClasses.layout} ${gapClass} ${className}`, children: [
|
|
506
|
+
displayConfig.showHeader && /* @__PURE__ */ jsxs3("div", { className: "flex flex-row items-center justify-between w-full", children: [
|
|
507
|
+
label && /* @__PURE__ */ jsx4(
|
|
508
|
+
Text_default,
|
|
509
|
+
{
|
|
510
|
+
as: "div",
|
|
511
|
+
size: "xs",
|
|
512
|
+
weight: "medium",
|
|
513
|
+
className: `text-text-950 leading-none tracking-normal text-center ${labelClassName}`,
|
|
514
|
+
children: label
|
|
515
|
+
}
|
|
516
|
+
),
|
|
517
|
+
showPercentage && /* @__PURE__ */ jsxs3(
|
|
518
|
+
Text_default,
|
|
519
|
+
{
|
|
520
|
+
size: "xs",
|
|
521
|
+
weight: "medium",
|
|
522
|
+
className: `text-text-950 leading-none tracking-normal text-center ${percentageClassName}`,
|
|
523
|
+
children: [
|
|
524
|
+
Math.round(percentage),
|
|
525
|
+
"%"
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
] }),
|
|
530
|
+
/* @__PURE__ */ jsx4(
|
|
531
|
+
ProgressBarBase,
|
|
532
|
+
{
|
|
533
|
+
clampedValue,
|
|
534
|
+
max,
|
|
535
|
+
percentage,
|
|
536
|
+
label,
|
|
537
|
+
variantClasses,
|
|
538
|
+
containerClassName: `${progressBarClass} ${sizeClasses.container} ${sizeClasses.borderRadius}`,
|
|
539
|
+
fillClassName: `${sizeClasses.bar} ${sizeClasses.borderRadius} shadow-hard-shadow-3`
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
displayConfig.showPercentage && /* @__PURE__ */ jsxs3(
|
|
543
|
+
Text_default,
|
|
544
|
+
{
|
|
545
|
+
size: "xs",
|
|
546
|
+
weight: "medium",
|
|
547
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none ${percentageClassName}`,
|
|
548
|
+
children: [
|
|
549
|
+
Math.round(percentage),
|
|
550
|
+
"%"
|
|
551
|
+
]
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
displayConfig.showLabel && /* @__PURE__ */ jsx4(
|
|
555
|
+
Text_default,
|
|
556
|
+
{
|
|
557
|
+
as: "div",
|
|
558
|
+
size: "xs",
|
|
559
|
+
weight: "medium",
|
|
560
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none ${labelClassName}`,
|
|
561
|
+
children: label
|
|
562
|
+
}
|
|
563
|
+
)
|
|
564
|
+
] });
|
|
565
|
+
};
|
|
566
|
+
var ProgressBar = ({
|
|
567
|
+
value,
|
|
568
|
+
max = 100,
|
|
569
|
+
size = "medium",
|
|
570
|
+
variant = "blue",
|
|
571
|
+
layout = "default",
|
|
572
|
+
label,
|
|
573
|
+
showPercentage = false,
|
|
574
|
+
showHitCount = false,
|
|
575
|
+
className = "",
|
|
576
|
+
labelClassName = "",
|
|
577
|
+
percentageClassName = "",
|
|
578
|
+
stackedWidth,
|
|
579
|
+
stackedHeight,
|
|
580
|
+
compactWidth,
|
|
581
|
+
compactHeight
|
|
582
|
+
}) => {
|
|
583
|
+
const { clampedValue, percentage } = calculateProgressValues(value, max);
|
|
584
|
+
const sizeClasses = SIZE_CLASSES3[size];
|
|
585
|
+
const variantClasses = VARIANT_CLASSES[variant];
|
|
586
|
+
if (layout === "stacked") {
|
|
587
|
+
return /* @__PURE__ */ jsx4(
|
|
588
|
+
StackedLayout,
|
|
589
|
+
{
|
|
590
|
+
className,
|
|
591
|
+
label,
|
|
592
|
+
showPercentage,
|
|
593
|
+
showHitCount,
|
|
594
|
+
labelClassName,
|
|
595
|
+
percentageClassName,
|
|
596
|
+
clampedValue,
|
|
597
|
+
max,
|
|
598
|
+
percentage,
|
|
599
|
+
variantClasses,
|
|
600
|
+
dimensions: {
|
|
601
|
+
width: stackedWidth ?? "w-[380px]",
|
|
602
|
+
height: stackedHeight ?? "h-[35px]"
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
if (layout === "compact") {
|
|
608
|
+
return /* @__PURE__ */ jsx4(
|
|
609
|
+
CompactLayout,
|
|
610
|
+
{
|
|
611
|
+
className,
|
|
612
|
+
label,
|
|
613
|
+
showPercentage,
|
|
614
|
+
showHitCount,
|
|
615
|
+
labelClassName,
|
|
616
|
+
percentageClassName,
|
|
617
|
+
clampedValue,
|
|
618
|
+
max,
|
|
619
|
+
percentage,
|
|
620
|
+
variantClasses,
|
|
621
|
+
dimensions: {
|
|
622
|
+
width: compactWidth ?? "w-[131px]",
|
|
623
|
+
height: compactHeight ?? "h-[24px]"
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
return /* @__PURE__ */ jsx4(
|
|
629
|
+
DefaultLayout,
|
|
630
|
+
{
|
|
631
|
+
className,
|
|
632
|
+
size,
|
|
633
|
+
sizeClasses,
|
|
634
|
+
variantClasses,
|
|
635
|
+
label,
|
|
636
|
+
showPercentage,
|
|
637
|
+
labelClassName,
|
|
638
|
+
percentageClassName,
|
|
639
|
+
clampedValue,
|
|
640
|
+
max,
|
|
641
|
+
percentage
|
|
642
|
+
}
|
|
643
|
+
);
|
|
644
|
+
};
|
|
645
|
+
var ProgressBar_default = ProgressBar;
|
|
646
|
+
|
|
647
|
+
// src/components/Card/Card.tsx
|
|
648
|
+
import {
|
|
649
|
+
CaretRight,
|
|
650
|
+
ChatCircleText,
|
|
651
|
+
CheckCircle,
|
|
652
|
+
Clock,
|
|
653
|
+
DotsThreeVertical,
|
|
654
|
+
Play,
|
|
655
|
+
SpeakerHigh,
|
|
656
|
+
SpeakerLow,
|
|
657
|
+
SpeakerSimpleX,
|
|
658
|
+
XCircle
|
|
659
|
+
} from "phosphor-react";
|
|
660
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
661
|
+
var CARD_BASE_CLASSES = {
|
|
662
|
+
default: "w-full bg-background border border-border-50 rounded-xl",
|
|
663
|
+
compact: "w-full bg-background border border-border-50 rounded-lg",
|
|
664
|
+
minimal: "w-full bg-background border border-border-100 rounded-md"
|
|
665
|
+
};
|
|
666
|
+
var CARD_PADDING_CLASSES = {
|
|
667
|
+
none: "",
|
|
668
|
+
small: "p-2",
|
|
669
|
+
medium: "p-4",
|
|
670
|
+
large: "p-6"
|
|
671
|
+
};
|
|
672
|
+
var CARD_MIN_HEIGHT_CLASSES = {
|
|
673
|
+
none: "",
|
|
674
|
+
small: "min-h-16",
|
|
675
|
+
medium: "min-h-20",
|
|
676
|
+
large: "min-h-24"
|
|
677
|
+
};
|
|
678
|
+
var CARD_LAYOUT_CLASSES = {
|
|
679
|
+
horizontal: "flex flex-row",
|
|
680
|
+
vertical: "flex flex-col"
|
|
681
|
+
};
|
|
682
|
+
var CARD_CURSOR_CLASSES = {
|
|
683
|
+
default: "",
|
|
684
|
+
pointer: "cursor-pointer"
|
|
685
|
+
};
|
|
686
|
+
var CardBase = forwardRef(
|
|
687
|
+
({
|
|
688
|
+
children,
|
|
689
|
+
variant = "default",
|
|
690
|
+
layout = "horizontal",
|
|
691
|
+
padding = "medium",
|
|
692
|
+
minHeight = "medium",
|
|
693
|
+
cursor = "default",
|
|
694
|
+
className = "",
|
|
695
|
+
...props
|
|
696
|
+
}, ref) => {
|
|
697
|
+
const baseClasses = CARD_BASE_CLASSES[variant];
|
|
698
|
+
const paddingClasses = CARD_PADDING_CLASSES[padding];
|
|
699
|
+
const minHeightClasses = CARD_MIN_HEIGHT_CLASSES[minHeight];
|
|
700
|
+
const layoutClasses = CARD_LAYOUT_CLASSES[layout];
|
|
701
|
+
const cursorClasses = CARD_CURSOR_CLASSES[cursor];
|
|
702
|
+
const combinedClasses = [
|
|
703
|
+
baseClasses,
|
|
704
|
+
paddingClasses,
|
|
705
|
+
minHeightClasses,
|
|
706
|
+
layoutClasses,
|
|
707
|
+
cursorClasses,
|
|
708
|
+
className
|
|
709
|
+
].filter(Boolean).join(" ");
|
|
710
|
+
return /* @__PURE__ */ jsx5("div", { ref, className: combinedClasses, ...props, children });
|
|
711
|
+
}
|
|
712
|
+
);
|
|
713
|
+
var ACTION_CARD_CLASSES = {
|
|
714
|
+
warning: "bg-warning-background",
|
|
715
|
+
success: "bg-success-300",
|
|
716
|
+
error: "bg-error-100",
|
|
717
|
+
info: "bg-info-background"
|
|
718
|
+
};
|
|
719
|
+
var ACTION_ICON_CLASSES = {
|
|
720
|
+
warning: "bg-warning-300 text-text",
|
|
721
|
+
success: "bg-yellow-300 text-text-950",
|
|
722
|
+
error: "bg-error-500 text-text",
|
|
723
|
+
info: "bg-info-500 text-text"
|
|
724
|
+
};
|
|
725
|
+
var ACTION_SUBTITLE_CLASSES = {
|
|
726
|
+
warning: "text-warning-600",
|
|
727
|
+
success: "text-success-700",
|
|
728
|
+
error: "text-error-700",
|
|
729
|
+
info: "text-info-700"
|
|
730
|
+
};
|
|
731
|
+
var ACTION_HEADER_CLASSES = {
|
|
732
|
+
warning: "text-warning-300",
|
|
733
|
+
success: "text-success-300",
|
|
734
|
+
error: "text-error-300",
|
|
735
|
+
info: "text-info-300"
|
|
736
|
+
};
|
|
737
|
+
var CardActivitiesResults = forwardRef(
|
|
738
|
+
({
|
|
739
|
+
icon,
|
|
740
|
+
title,
|
|
741
|
+
subTitle,
|
|
742
|
+
header,
|
|
743
|
+
extended = false,
|
|
744
|
+
action = "success",
|
|
745
|
+
description,
|
|
746
|
+
className,
|
|
747
|
+
...props
|
|
748
|
+
}, ref) => {
|
|
749
|
+
const actionCardClasses = ACTION_CARD_CLASSES[action];
|
|
750
|
+
const actionIconClasses = ACTION_ICON_CLASSES[action];
|
|
751
|
+
const actionSubTitleClasses = ACTION_SUBTITLE_CLASSES[action];
|
|
752
|
+
const actionHeaderClasses = ACTION_HEADER_CLASSES[action];
|
|
753
|
+
return /* @__PURE__ */ jsxs4(
|
|
754
|
+
"div",
|
|
755
|
+
{
|
|
756
|
+
ref,
|
|
757
|
+
className: `w-full flex flex-col border border-border-50 bg-background rounded-xl ${className}`,
|
|
758
|
+
...props,
|
|
759
|
+
children: [
|
|
760
|
+
/* @__PURE__ */ jsxs4(
|
|
761
|
+
"div",
|
|
762
|
+
{
|
|
763
|
+
className: `
|
|
764
|
+
flex flex-col gap-1 items-center justify-center p-4
|
|
765
|
+
${actionCardClasses}
|
|
766
|
+
${extended ? "rounded-t-xl" : "rounded-xl"}`,
|
|
767
|
+
children: [
|
|
768
|
+
/* @__PURE__ */ jsx5(
|
|
769
|
+
"span",
|
|
770
|
+
{
|
|
771
|
+
className: `size-7.5 rounded-full flex items-center justify-center ${actionIconClasses}`,
|
|
772
|
+
children: icon
|
|
773
|
+
}
|
|
774
|
+
),
|
|
775
|
+
/* @__PURE__ */ jsx5(
|
|
776
|
+
Text_default,
|
|
777
|
+
{
|
|
778
|
+
size: "2xs",
|
|
779
|
+
weight: "medium",
|
|
780
|
+
className: "text-text-800 uppercase truncate",
|
|
781
|
+
children: title
|
|
782
|
+
}
|
|
783
|
+
),
|
|
784
|
+
/* @__PURE__ */ jsx5("p", { className: `text-lg font-bold truncate ${actionSubTitleClasses}`, children: subTitle })
|
|
785
|
+
]
|
|
786
|
+
}
|
|
787
|
+
),
|
|
788
|
+
extended && /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-2.5 pb-9.5 pt-2.5", children: [
|
|
789
|
+
/* @__PURE__ */ jsx5(
|
|
790
|
+
"p",
|
|
791
|
+
{
|
|
792
|
+
className: `text-2xs font-medium uppercase truncate ${actionHeaderClasses}`,
|
|
793
|
+
children: header
|
|
794
|
+
}
|
|
795
|
+
),
|
|
796
|
+
/* @__PURE__ */ jsx5(Badge_default, { size: "large", action: "info", children: description })
|
|
797
|
+
] })
|
|
798
|
+
]
|
|
799
|
+
}
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
);
|
|
803
|
+
var CardQuestions = forwardRef(
|
|
804
|
+
({
|
|
805
|
+
header,
|
|
806
|
+
state = "undone",
|
|
807
|
+
className,
|
|
808
|
+
onClickButton,
|
|
809
|
+
valueButton,
|
|
810
|
+
...props
|
|
811
|
+
}, ref) => {
|
|
812
|
+
const isDone = state === "done";
|
|
813
|
+
const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
|
|
814
|
+
const buttonLabel = isDone ? "Ver Quest\xE3o" : "Responder";
|
|
815
|
+
return /* @__PURE__ */ jsxs4(
|
|
816
|
+
CardBase,
|
|
817
|
+
{
|
|
818
|
+
ref,
|
|
819
|
+
layout: "horizontal",
|
|
820
|
+
padding: "medium",
|
|
821
|
+
minHeight: "medium",
|
|
822
|
+
className: `justify-between gap-4 ${className}`,
|
|
823
|
+
...props,
|
|
824
|
+
children: [
|
|
825
|
+
/* @__PURE__ */ jsxs4("section", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
|
|
826
|
+
/* @__PURE__ */ jsx5("p", { className: "font-bold text-xs text-text-950 truncate", children: header }),
|
|
827
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-row gap-6 items-center", children: [
|
|
828
|
+
/* @__PURE__ */ jsx5(
|
|
829
|
+
Badge_default,
|
|
830
|
+
{
|
|
831
|
+
size: "medium",
|
|
832
|
+
variant: "solid",
|
|
833
|
+
action: isDone ? "success" : "error",
|
|
834
|
+
children: stateLabel
|
|
835
|
+
}
|
|
836
|
+
),
|
|
837
|
+
/* @__PURE__ */ jsxs4("span", { className: "flex flex-row items-center gap-1 text-text-700 text-xs", children: [
|
|
838
|
+
isDone ? "Nota" : "Sem nota",
|
|
839
|
+
isDone && /* @__PURE__ */ jsx5(Badge_default, { size: "medium", action: "success", children: "00" })
|
|
840
|
+
] })
|
|
841
|
+
] })
|
|
842
|
+
] }),
|
|
843
|
+
/* @__PURE__ */ jsx5("span", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx5(
|
|
844
|
+
Button_default,
|
|
845
|
+
{
|
|
846
|
+
size: "extra-small",
|
|
847
|
+
onClick: () => onClickButton?.(valueButton),
|
|
848
|
+
className: "min-w-fit",
|
|
849
|
+
children: buttonLabel
|
|
850
|
+
}
|
|
851
|
+
) })
|
|
852
|
+
]
|
|
853
|
+
}
|
|
854
|
+
);
|
|
855
|
+
}
|
|
856
|
+
);
|
|
857
|
+
var CardProgress = forwardRef(
|
|
858
|
+
({
|
|
859
|
+
header,
|
|
860
|
+
subhead,
|
|
861
|
+
initialDate,
|
|
862
|
+
endDate,
|
|
863
|
+
progress = 0,
|
|
864
|
+
direction = "horizontal",
|
|
865
|
+
icon,
|
|
866
|
+
color = "#B7DFFF",
|
|
867
|
+
progressVariant = "blue",
|
|
868
|
+
showDates = true,
|
|
869
|
+
className,
|
|
870
|
+
...props
|
|
871
|
+
}, ref) => {
|
|
872
|
+
const isHorizontal = direction === "horizontal";
|
|
873
|
+
const contentComponent = {
|
|
874
|
+
horizontal: /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
875
|
+
showDates && /* @__PURE__ */ jsxs4("div", { className: "flex flex-row gap-6 items-center", children: [
|
|
876
|
+
initialDate && /* @__PURE__ */ jsxs4("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
|
|
877
|
+
/* @__PURE__ */ jsx5("p", { className: "text-text-800 font-semibold", children: "In\xEDcio" }),
|
|
878
|
+
/* @__PURE__ */ jsx5("p", { className: "text-text-600", children: initialDate })
|
|
879
|
+
] }),
|
|
880
|
+
endDate && /* @__PURE__ */ jsxs4("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
|
|
881
|
+
/* @__PURE__ */ jsx5("p", { className: "text-text-800 font-semibold", children: "Fim" }),
|
|
882
|
+
/* @__PURE__ */ jsx5("p", { className: "text-text-600", children: endDate })
|
|
883
|
+
] })
|
|
884
|
+
] }),
|
|
885
|
+
/* @__PURE__ */ jsxs4("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
|
|
886
|
+
/* @__PURE__ */ jsx5(
|
|
887
|
+
ProgressBar_default,
|
|
888
|
+
{
|
|
889
|
+
size: "small",
|
|
890
|
+
value: progress,
|
|
891
|
+
variant: progressVariant,
|
|
892
|
+
"data-testid": "progress-bar"
|
|
893
|
+
}
|
|
894
|
+
),
|
|
895
|
+
/* @__PURE__ */ jsxs4(
|
|
896
|
+
Text_default,
|
|
897
|
+
{
|
|
898
|
+
size: "xs",
|
|
899
|
+
weight: "medium",
|
|
900
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none`,
|
|
901
|
+
children: [
|
|
902
|
+
Math.round(progress),
|
|
903
|
+
"%"
|
|
904
|
+
]
|
|
905
|
+
}
|
|
906
|
+
)
|
|
907
|
+
] })
|
|
908
|
+
] }),
|
|
909
|
+
vertical: /* @__PURE__ */ jsx5("p", { className: "text-sm text-text-800", children: subhead })
|
|
910
|
+
};
|
|
911
|
+
return /* @__PURE__ */ jsxs4(
|
|
912
|
+
CardBase,
|
|
913
|
+
{
|
|
914
|
+
ref,
|
|
915
|
+
layout: isHorizontal ? "horizontal" : "vertical",
|
|
916
|
+
padding: "none",
|
|
917
|
+
minHeight: "medium",
|
|
918
|
+
cursor: "pointer",
|
|
919
|
+
className: `${isHorizontal ? "h-20" : ""} ${className}`,
|
|
920
|
+
...props,
|
|
921
|
+
children: [
|
|
922
|
+
/* @__PURE__ */ jsx5(
|
|
923
|
+
"div",
|
|
924
|
+
{
|
|
925
|
+
className: `
|
|
926
|
+
flex justify-center items-center [&>svg]:size-6 text-text-950
|
|
927
|
+
${isHorizontal ? "min-w-[80px] min-h-[80px] rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl"}
|
|
928
|
+
${!color.startsWith("#") ? `bg-${color}` : ""}
|
|
929
|
+
`,
|
|
930
|
+
style: color.startsWith("#") ? { backgroundColor: color } : void 0,
|
|
931
|
+
"data-testid": "icon-container",
|
|
932
|
+
children: icon
|
|
933
|
+
}
|
|
934
|
+
),
|
|
935
|
+
/* @__PURE__ */ jsxs4(
|
|
936
|
+
"div",
|
|
937
|
+
{
|
|
938
|
+
className: `
|
|
939
|
+
p-4 flex flex-col justify-between w-full h-full
|
|
940
|
+
${!isHorizontal && "gap-4"}
|
|
941
|
+
`,
|
|
942
|
+
children: [
|
|
943
|
+
/* @__PURE__ */ jsx5(Text_default, { size: "sm", weight: "bold", className: "text-text-950 truncate", children: header }),
|
|
944
|
+
contentComponent[direction]
|
|
945
|
+
]
|
|
946
|
+
}
|
|
947
|
+
)
|
|
948
|
+
]
|
|
949
|
+
}
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
);
|
|
953
|
+
var CardTopic = forwardRef(
|
|
954
|
+
({
|
|
955
|
+
header,
|
|
956
|
+
subHead,
|
|
957
|
+
progress,
|
|
958
|
+
showPercentage = false,
|
|
959
|
+
progressVariant = "blue",
|
|
960
|
+
className = "",
|
|
961
|
+
...props
|
|
962
|
+
}, ref) => {
|
|
963
|
+
return /* @__PURE__ */ jsxs4(
|
|
964
|
+
CardBase,
|
|
965
|
+
{
|
|
966
|
+
ref,
|
|
967
|
+
layout: "vertical",
|
|
968
|
+
padding: "small",
|
|
969
|
+
minHeight: "medium",
|
|
970
|
+
cursor: "pointer",
|
|
971
|
+
className: `justify-center gap-2 py-2 px-4 ${className}`,
|
|
972
|
+
...props,
|
|
973
|
+
children: [
|
|
974
|
+
subHead && /* @__PURE__ */ jsx5("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
975
|
+
/* @__PURE__ */ jsx5("p", { children: text }),
|
|
976
|
+
index < subHead.length - 1 && /* @__PURE__ */ jsx5("p", { children: "\u2022" })
|
|
977
|
+
] }, `${text} - ${index}`)) }),
|
|
978
|
+
/* @__PURE__ */ jsx5("p", { className: "text-sm text-text-950 font-bold truncate", children: header }),
|
|
979
|
+
/* @__PURE__ */ jsxs4("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
|
|
980
|
+
/* @__PURE__ */ jsx5(
|
|
981
|
+
ProgressBar_default,
|
|
982
|
+
{
|
|
983
|
+
size: "small",
|
|
984
|
+
value: progress,
|
|
985
|
+
variant: progressVariant,
|
|
986
|
+
"data-testid": "progress-bar"
|
|
987
|
+
}
|
|
988
|
+
),
|
|
989
|
+
showPercentage && /* @__PURE__ */ jsxs4(
|
|
990
|
+
Text_default,
|
|
991
|
+
{
|
|
992
|
+
size: "xs",
|
|
993
|
+
weight: "medium",
|
|
994
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none`,
|
|
995
|
+
children: [
|
|
996
|
+
Math.round(progress),
|
|
997
|
+
"%"
|
|
998
|
+
]
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] })
|
|
1002
|
+
]
|
|
1003
|
+
}
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
);
|
|
1007
|
+
var CardPerformance = forwardRef(
|
|
1008
|
+
({
|
|
1009
|
+
header,
|
|
1010
|
+
progress,
|
|
1011
|
+
description = "Sem dados ainda! Voc\xEA ainda n\xE3o fez um question\xE1rio neste assunto.",
|
|
1012
|
+
actionVariant = "button",
|
|
1013
|
+
progressVariant = "blue",
|
|
1014
|
+
labelProgress = "",
|
|
1015
|
+
className = "",
|
|
1016
|
+
onClickButton,
|
|
1017
|
+
valueButton,
|
|
1018
|
+
...props
|
|
1019
|
+
}, ref) => {
|
|
1020
|
+
const hasProgress = progress !== void 0;
|
|
1021
|
+
return /* @__PURE__ */ jsxs4(
|
|
1022
|
+
CardBase,
|
|
1023
|
+
{
|
|
1024
|
+
ref,
|
|
1025
|
+
layout: "horizontal",
|
|
1026
|
+
padding: "medium",
|
|
1027
|
+
minHeight: "none",
|
|
1028
|
+
className: `justify-between gap-2 ${actionVariant == "caret" ? "cursor-pointer" : ""} ${className}`,
|
|
1029
|
+
onClick: () => actionVariant == "caret" && onClickButton?.(valueButton),
|
|
1030
|
+
...props,
|
|
1031
|
+
children: [
|
|
1032
|
+
/* @__PURE__ */ jsxs4("div", { className: "w-full flex flex-col justify-between gap-2", children: [
|
|
1033
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-row justify-between items-center gap-2", children: [
|
|
1034
|
+
/* @__PURE__ */ jsx5("p", { className: "text-lg font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
|
|
1035
|
+
actionVariant === "button" && /* @__PURE__ */ jsx5(
|
|
1036
|
+
Button_default,
|
|
1037
|
+
{
|
|
1038
|
+
variant: "outline",
|
|
1039
|
+
size: "extra-small",
|
|
1040
|
+
onClick: () => onClickButton?.(valueButton),
|
|
1041
|
+
className: "min-w-fit flex-shrink-0",
|
|
1042
|
+
children: "Ver Aula"
|
|
1043
|
+
}
|
|
1044
|
+
)
|
|
1045
|
+
] }),
|
|
1046
|
+
/* @__PURE__ */ jsx5("div", { className: "w-full", children: hasProgress ? /* @__PURE__ */ jsx5(
|
|
1047
|
+
ProgressBar_default,
|
|
1048
|
+
{
|
|
1049
|
+
value: progress,
|
|
1050
|
+
label: `${progress}% ${labelProgress}`,
|
|
1051
|
+
variant: progressVariant
|
|
1052
|
+
}
|
|
1053
|
+
) : /* @__PURE__ */ jsx5("p", { className: "text-xs text-text-600 truncate", children: description }) })
|
|
1054
|
+
] }),
|
|
1055
|
+
actionVariant == "caret" && /* @__PURE__ */ jsx5(
|
|
1056
|
+
CaretRight,
|
|
1057
|
+
{
|
|
1058
|
+
className: "size-4.5 text-text-800 cursor-pointer",
|
|
1059
|
+
"data-testid": "caret-icon"
|
|
1060
|
+
}
|
|
1061
|
+
)
|
|
1062
|
+
]
|
|
1063
|
+
}
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
1066
|
+
);
|
|
1067
|
+
var CardResults = forwardRef(
|
|
1068
|
+
({
|
|
1069
|
+
header,
|
|
1070
|
+
correct_answers,
|
|
1071
|
+
incorrect_answers,
|
|
1072
|
+
icon,
|
|
1073
|
+
direction = "col",
|
|
1074
|
+
color = "#B7DFFF",
|
|
1075
|
+
className,
|
|
1076
|
+
...props
|
|
1077
|
+
}, ref) => {
|
|
1078
|
+
const isRow = direction == "row";
|
|
1079
|
+
return /* @__PURE__ */ jsxs4(
|
|
1080
|
+
CardBase,
|
|
1081
|
+
{
|
|
1082
|
+
ref,
|
|
1083
|
+
layout: "horizontal",
|
|
1084
|
+
padding: "none",
|
|
1085
|
+
minHeight: "medium",
|
|
1086
|
+
className: `items-center pr-4 ${className}`,
|
|
1087
|
+
...props,
|
|
1088
|
+
children: [
|
|
1089
|
+
/* @__PURE__ */ jsx5(
|
|
1090
|
+
"div",
|
|
1091
|
+
{
|
|
1092
|
+
className: `
|
|
1093
|
+
flex justify-center items-center [&>svg]:size-8 text-text-950 min-w-20 max-w-20 min-h-20 h-full rounded-l-xl
|
|
1094
|
+
`,
|
|
1095
|
+
style: {
|
|
1096
|
+
backgroundColor: color
|
|
1097
|
+
},
|
|
1098
|
+
children: icon
|
|
1099
|
+
}
|
|
1100
|
+
),
|
|
1101
|
+
/* @__PURE__ */ jsxs4(
|
|
1102
|
+
"div",
|
|
1103
|
+
{
|
|
1104
|
+
className: `
|
|
1105
|
+
p-4 flex justify-between w-full h-full
|
|
1106
|
+
${isRow ? "flex-row items-center gap-2" : "flex-col"}
|
|
1107
|
+
`,
|
|
1108
|
+
children: [
|
|
1109
|
+
/* @__PURE__ */ jsx5("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
|
|
1110
|
+
/* @__PURE__ */ jsxs4("span", { className: "flex flex-row gap-1 items-center", children: [
|
|
1111
|
+
/* @__PURE__ */ jsxs4(
|
|
1112
|
+
Badge_default,
|
|
1113
|
+
{
|
|
1114
|
+
action: "success",
|
|
1115
|
+
variant: "solid",
|
|
1116
|
+
size: "medium",
|
|
1117
|
+
iconLeft: /* @__PURE__ */ jsx5(CheckCircle, {}),
|
|
1118
|
+
children: [
|
|
1119
|
+
correct_answers,
|
|
1120
|
+
" Corretas"
|
|
1121
|
+
]
|
|
1122
|
+
}
|
|
1123
|
+
),
|
|
1124
|
+
/* @__PURE__ */ jsxs4(
|
|
1125
|
+
Badge_default,
|
|
1126
|
+
{
|
|
1127
|
+
action: "error",
|
|
1128
|
+
variant: "solid",
|
|
1129
|
+
size: "medium",
|
|
1130
|
+
iconLeft: /* @__PURE__ */ jsx5(XCircle, {}),
|
|
1131
|
+
children: [
|
|
1132
|
+
incorrect_answers,
|
|
1133
|
+
" Incorretas"
|
|
1134
|
+
]
|
|
1135
|
+
}
|
|
1136
|
+
)
|
|
1137
|
+
] })
|
|
1138
|
+
]
|
|
1139
|
+
}
|
|
1140
|
+
),
|
|
1141
|
+
/* @__PURE__ */ jsx5(CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer" })
|
|
1142
|
+
]
|
|
1143
|
+
}
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1146
|
+
);
|
|
1147
|
+
var CardStatus = forwardRef(
|
|
1148
|
+
({ header, className, status, ...props }, ref) => {
|
|
1149
|
+
return /* @__PURE__ */ jsx5(
|
|
1150
|
+
CardBase,
|
|
1151
|
+
{
|
|
1152
|
+
ref,
|
|
1153
|
+
layout: "horizontal",
|
|
1154
|
+
padding: "medium",
|
|
1155
|
+
minHeight: "medium",
|
|
1156
|
+
className: `items-center ${className}`,
|
|
1157
|
+
...props,
|
|
1158
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
|
|
1159
|
+
/* @__PURE__ */ jsx5("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
|
|
1160
|
+
status && /* @__PURE__ */ jsxs4("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
|
|
1161
|
+
/* @__PURE__ */ jsx5(
|
|
1162
|
+
Badge_default,
|
|
1163
|
+
{
|
|
1164
|
+
action: status == "correct" ? "success" : "error",
|
|
1165
|
+
variant: "solid",
|
|
1166
|
+
size: "medium",
|
|
1167
|
+
iconLeft: /* @__PURE__ */ jsx5(CheckCircle, {}),
|
|
1168
|
+
children: status == "correct" ? "Correta" : "Incorreta"
|
|
1169
|
+
}
|
|
1170
|
+
),
|
|
1171
|
+
/* @__PURE__ */ jsx5("p", { className: "text-sm text-text-800", children: "Respondida" })
|
|
1172
|
+
] }),
|
|
1173
|
+
/* @__PURE__ */ jsx5(CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer flex-shrink-0 ml-2" })
|
|
1174
|
+
] })
|
|
1175
|
+
}
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1178
|
+
);
|
|
1179
|
+
var CardSettings = forwardRef(
|
|
1180
|
+
({ header, className, icon, ...props }, ref) => {
|
|
1181
|
+
return /* @__PURE__ */ jsxs4(
|
|
1182
|
+
CardBase,
|
|
1183
|
+
{
|
|
1184
|
+
ref,
|
|
1185
|
+
layout: "horizontal",
|
|
1186
|
+
padding: "small",
|
|
1187
|
+
minHeight: "none",
|
|
1188
|
+
className: `border-none items-center gap-2 text-text-700 ${className}`,
|
|
1189
|
+
...props,
|
|
1190
|
+
children: [
|
|
1191
|
+
/* @__PURE__ */ jsx5("span", { className: "[&>svg]:size-6", children: icon }),
|
|
1192
|
+
/* @__PURE__ */ jsx5("p", { className: "w-full text-sm truncate", children: header }),
|
|
1193
|
+
/* @__PURE__ */ jsx5(CaretRight, { size: 24, className: "cursor-pointer" })
|
|
1194
|
+
]
|
|
1195
|
+
}
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
);
|
|
1199
|
+
var CardSupport = forwardRef(
|
|
1200
|
+
({ header, className, direction = "col", children, ...props }, ref) => {
|
|
1201
|
+
return /* @__PURE__ */ jsxs4(
|
|
1202
|
+
CardBase,
|
|
1203
|
+
{
|
|
1204
|
+
ref,
|
|
1205
|
+
layout: "horizontal",
|
|
1206
|
+
padding: "medium",
|
|
1207
|
+
minHeight: "none",
|
|
1208
|
+
className: `border-none items-center gap-2 text-text-700 ${className}`,
|
|
1209
|
+
...props,
|
|
1210
|
+
children: [
|
|
1211
|
+
/* @__PURE__ */ jsxs4(
|
|
1212
|
+
"div",
|
|
1213
|
+
{
|
|
1214
|
+
className: `
|
|
1215
|
+
w-full flex ${direction == "col" ? "flex-col" : "flex-row items-center"} gap-2
|
|
1216
|
+
`,
|
|
1217
|
+
children: [
|
|
1218
|
+
/* @__PURE__ */ jsx5("span", { className: "w-full min-w-0", children: /* @__PURE__ */ jsx5("p", { className: "text-sm text-text-950 font-bold truncate", children: header }) }),
|
|
1219
|
+
/* @__PURE__ */ jsx5("span", { className: "flex flex-row gap-1", children })
|
|
1220
|
+
]
|
|
1221
|
+
}
|
|
1222
|
+
),
|
|
1223
|
+
/* @__PURE__ */ jsx5(CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
|
|
1224
|
+
]
|
|
1225
|
+
}
|
|
1226
|
+
);
|
|
1227
|
+
}
|
|
1228
|
+
);
|
|
1229
|
+
var CardForum = forwardRef(
|
|
1230
|
+
({
|
|
1231
|
+
title,
|
|
1232
|
+
content,
|
|
1233
|
+
comments,
|
|
1234
|
+
onClickComments,
|
|
1235
|
+
valueComments,
|
|
1236
|
+
onClickProfile,
|
|
1237
|
+
valueProfile,
|
|
1238
|
+
className = "",
|
|
1239
|
+
date,
|
|
1240
|
+
hour,
|
|
1241
|
+
...props
|
|
1242
|
+
}, ref) => {
|
|
1243
|
+
return /* @__PURE__ */ jsxs4(
|
|
1244
|
+
CardBase,
|
|
1245
|
+
{
|
|
1246
|
+
ref,
|
|
1247
|
+
layout: "horizontal",
|
|
1248
|
+
padding: "medium",
|
|
1249
|
+
minHeight: "none",
|
|
1250
|
+
variant: "minimal",
|
|
1251
|
+
className: `w-auto h-auto gap-3 ${className}`,
|
|
1252
|
+
...props,
|
|
1253
|
+
children: [
|
|
1254
|
+
/* @__PURE__ */ jsx5(
|
|
1255
|
+
"button",
|
|
1256
|
+
{
|
|
1257
|
+
type: "button",
|
|
1258
|
+
"aria-label": "Ver perfil",
|
|
1259
|
+
onClick: () => onClickProfile?.(valueProfile),
|
|
1260
|
+
className: "min-w-8 h-8 rounded-full bg-background-950"
|
|
1261
|
+
}
|
|
1262
|
+
),
|
|
1263
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
|
|
1264
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-row gap-1 items-center flex-wrap", children: [
|
|
1265
|
+
/* @__PURE__ */ jsx5("p", { className: "text-xs font-semibold text-primary-700 truncate", children: title }),
|
|
1266
|
+
/* @__PURE__ */ jsxs4("p", { className: "text-xs text-text-600", children: [
|
|
1267
|
+
"\u2022 ",
|
|
1268
|
+
date,
|
|
1269
|
+
" \u2022 ",
|
|
1270
|
+
hour
|
|
1271
|
+
] })
|
|
1272
|
+
] }),
|
|
1273
|
+
/* @__PURE__ */ jsx5("p", { className: "text-text-950 text-sm line-clamp-2 truncate", children: content }),
|
|
1274
|
+
/* @__PURE__ */ jsxs4(
|
|
1275
|
+
"button",
|
|
1276
|
+
{
|
|
1277
|
+
type: "button",
|
|
1278
|
+
"aria-label": "Ver coment\xE1rios",
|
|
1279
|
+
onClick: () => onClickComments?.(valueComments),
|
|
1280
|
+
className: "text-text-600 flex flex-row gap-2 items-center",
|
|
1281
|
+
children: [
|
|
1282
|
+
/* @__PURE__ */ jsx5(ChatCircleText, { "aria-hidden": "true", size: 16 }),
|
|
1283
|
+
/* @__PURE__ */ jsxs4("p", { className: "text-xs", children: [
|
|
1284
|
+
comments,
|
|
1285
|
+
" respostas"
|
|
1286
|
+
] })
|
|
1287
|
+
]
|
|
1288
|
+
}
|
|
1289
|
+
)
|
|
1290
|
+
] })
|
|
1291
|
+
]
|
|
1292
|
+
}
|
|
1293
|
+
);
|
|
1294
|
+
}
|
|
1295
|
+
);
|
|
1296
|
+
var CardAudio = forwardRef(
|
|
1297
|
+
({
|
|
1298
|
+
src,
|
|
1299
|
+
title,
|
|
1300
|
+
onPlay,
|
|
1301
|
+
onPause,
|
|
1302
|
+
onEnded,
|
|
1303
|
+
onAudioTimeUpdate,
|
|
1304
|
+
loop = false,
|
|
1305
|
+
preload = "metadata",
|
|
1306
|
+
tracks,
|
|
1307
|
+
className,
|
|
1308
|
+
...props
|
|
1309
|
+
}, ref) => {
|
|
1310
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
1311
|
+
const [currentTime, setCurrentTime] = useState(0);
|
|
1312
|
+
const [duration, setDuration] = useState(0);
|
|
1313
|
+
const [volume, setVolume] = useState(1);
|
|
1314
|
+
const [showVolumeControl, setShowVolumeControl] = useState(false);
|
|
1315
|
+
const audioRef = useRef(null);
|
|
1316
|
+
const formatTime = (time) => {
|
|
1317
|
+
const minutes = Math.floor(time / 60);
|
|
1318
|
+
const seconds = Math.floor(time % 60);
|
|
1319
|
+
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
|
1320
|
+
};
|
|
1321
|
+
const handlePlayPause = () => {
|
|
1322
|
+
if (isPlaying) {
|
|
1323
|
+
audioRef.current?.pause();
|
|
1324
|
+
setIsPlaying(false);
|
|
1325
|
+
onPause?.();
|
|
1326
|
+
} else {
|
|
1327
|
+
audioRef.current?.play();
|
|
1328
|
+
setIsPlaying(true);
|
|
1329
|
+
onPlay?.();
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
const handleTimeUpdate = () => {
|
|
1333
|
+
const current = audioRef.current?.currentTime ?? 0;
|
|
1334
|
+
const total = audioRef.current?.duration ?? 0;
|
|
1335
|
+
setCurrentTime(current);
|
|
1336
|
+
setDuration(total);
|
|
1337
|
+
onAudioTimeUpdate?.(current, total);
|
|
1338
|
+
};
|
|
1339
|
+
const handleLoadedMetadata = () => {
|
|
1340
|
+
setDuration(audioRef.current?.duration ?? 0);
|
|
1341
|
+
};
|
|
1342
|
+
const handleEnded = () => {
|
|
1343
|
+
setIsPlaying(false);
|
|
1344
|
+
setCurrentTime(0);
|
|
1345
|
+
onEnded?.();
|
|
1346
|
+
};
|
|
1347
|
+
const handleProgressClick = (e) => {
|
|
1348
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
1349
|
+
const clickX = e.clientX - rect.left;
|
|
1350
|
+
const width = rect.width;
|
|
1351
|
+
const percentage = clickX / width;
|
|
1352
|
+
const newTime = percentage * duration;
|
|
1353
|
+
if (audioRef.current) {
|
|
1354
|
+
audioRef.current.currentTime = newTime;
|
|
1355
|
+
}
|
|
1356
|
+
setCurrentTime(newTime);
|
|
1357
|
+
};
|
|
1358
|
+
const handleVolumeChange = (e) => {
|
|
1359
|
+
const newVolume = parseFloat(e.target.value);
|
|
1360
|
+
setVolume(newVolume);
|
|
1361
|
+
if (audioRef.current) {
|
|
1362
|
+
audioRef.current.volume = newVolume;
|
|
1363
|
+
}
|
|
1364
|
+
};
|
|
1365
|
+
const toggleVolumeControl = () => {
|
|
1366
|
+
setShowVolumeControl(!showVolumeControl);
|
|
1367
|
+
};
|
|
1368
|
+
const getVolumeIcon = () => {
|
|
1369
|
+
if (volume === 0) {
|
|
1370
|
+
return /* @__PURE__ */ jsx5(SpeakerSimpleX, {});
|
|
1371
|
+
}
|
|
1372
|
+
if (volume < 0.5) {
|
|
1373
|
+
return /* @__PURE__ */ jsx5(SpeakerLow, {});
|
|
1374
|
+
}
|
|
1375
|
+
return /* @__PURE__ */ jsx5(SpeakerHigh, {});
|
|
1376
|
+
};
|
|
1377
|
+
return /* @__PURE__ */ jsxs4(
|
|
1378
|
+
CardBase,
|
|
1379
|
+
{
|
|
1380
|
+
ref,
|
|
1381
|
+
layout: "horizontal",
|
|
1382
|
+
padding: "medium",
|
|
1383
|
+
minHeight: "none",
|
|
1384
|
+
className: `w-auto h-14 items-center gap-2 ${className}`,
|
|
1385
|
+
...props,
|
|
1386
|
+
children: [
|
|
1387
|
+
/* @__PURE__ */ jsx5(
|
|
1388
|
+
"audio",
|
|
1389
|
+
{
|
|
1390
|
+
ref: audioRef,
|
|
1391
|
+
src,
|
|
1392
|
+
loop,
|
|
1393
|
+
preload,
|
|
1394
|
+
onTimeUpdate: handleTimeUpdate,
|
|
1395
|
+
onLoadedMetadata: handleLoadedMetadata,
|
|
1396
|
+
onEnded: handleEnded,
|
|
1397
|
+
"data-testid": "audio-element",
|
|
1398
|
+
"aria-label": title,
|
|
1399
|
+
children: tracks ? tracks.map((track) => /* @__PURE__ */ jsx5(
|
|
1400
|
+
"track",
|
|
1401
|
+
{
|
|
1402
|
+
kind: track.kind,
|
|
1403
|
+
src: track.src,
|
|
1404
|
+
srcLang: track.srcLang,
|
|
1405
|
+
label: track.label,
|
|
1406
|
+
default: track.default
|
|
1407
|
+
},
|
|
1408
|
+
track.src
|
|
1409
|
+
)) : /* @__PURE__ */ jsx5(
|
|
1410
|
+
"track",
|
|
1411
|
+
{
|
|
1412
|
+
kind: "captions",
|
|
1413
|
+
src: "data:text/vtt;base64,",
|
|
1414
|
+
srcLang: "pt",
|
|
1415
|
+
label: "Sem legendas dispon\xEDveis"
|
|
1416
|
+
}
|
|
1417
|
+
)
|
|
1418
|
+
}
|
|
1419
|
+
),
|
|
1420
|
+
/* @__PURE__ */ jsx5(
|
|
1421
|
+
"button",
|
|
1422
|
+
{
|
|
1423
|
+
type: "button",
|
|
1424
|
+
onClick: handlePlayPause,
|
|
1425
|
+
disabled: !src,
|
|
1426
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
|
|
1427
|
+
"aria-label": isPlaying ? "Pausar" : "Reproduzir",
|
|
1428
|
+
children: isPlaying ? /* @__PURE__ */ jsx5("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ jsxs4("div", { className: "flex gap-0.5", children: [
|
|
1429
|
+
/* @__PURE__ */ jsx5("div", { className: "w-1 h-4 bg-current rounded-sm" }),
|
|
1430
|
+
/* @__PURE__ */ jsx5("div", { className: "w-1 h-4 bg-current rounded-sm" })
|
|
1431
|
+
] }) }) : /* @__PURE__ */ jsx5(Play, { size: 24 })
|
|
1432
|
+
}
|
|
1433
|
+
),
|
|
1434
|
+
/* @__PURE__ */ jsx5("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
|
|
1435
|
+
/* @__PURE__ */ jsx5("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ jsx5(
|
|
1436
|
+
"button",
|
|
1437
|
+
{
|
|
1438
|
+
type: "button",
|
|
1439
|
+
className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
|
|
1440
|
+
onClick: handleProgressClick,
|
|
1441
|
+
onKeyDown: (e) => {
|
|
1442
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1443
|
+
e.preventDefault();
|
|
1444
|
+
handleProgressClick(
|
|
1445
|
+
e
|
|
1446
|
+
);
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
"aria-label": "Barra de progresso do \xE1udio",
|
|
1450
|
+
children: /* @__PURE__ */ jsx5(
|
|
1451
|
+
"div",
|
|
1452
|
+
{
|
|
1453
|
+
className: "h-full bg-primary-600 rounded-full transition-all duration-100",
|
|
1454
|
+
style: {
|
|
1455
|
+
width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
)
|
|
1459
|
+
}
|
|
1460
|
+
) }),
|
|
1461
|
+
/* @__PURE__ */ jsx5("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(duration) }),
|
|
1462
|
+
/* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
1463
|
+
/* @__PURE__ */ jsx5(
|
|
1464
|
+
"button",
|
|
1465
|
+
{
|
|
1466
|
+
type: "button",
|
|
1467
|
+
onClick: toggleVolumeControl,
|
|
1468
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600",
|
|
1469
|
+
"aria-label": "Controle de volume",
|
|
1470
|
+
children: /* @__PURE__ */ jsx5("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
|
|
1471
|
+
}
|
|
1472
|
+
),
|
|
1473
|
+
showVolumeControl && /* @__PURE__ */ jsx5(
|
|
1474
|
+
"button",
|
|
1475
|
+
{
|
|
1476
|
+
type: "button",
|
|
1477
|
+
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",
|
|
1478
|
+
onKeyDown: (e) => {
|
|
1479
|
+
if (e.key === "Escape") {
|
|
1480
|
+
setShowVolumeControl(false);
|
|
1481
|
+
}
|
|
1482
|
+
},
|
|
1483
|
+
children: /* @__PURE__ */ jsx5(
|
|
1484
|
+
"input",
|
|
1485
|
+
{
|
|
1486
|
+
type: "range",
|
|
1487
|
+
min: "0",
|
|
1488
|
+
max: "1",
|
|
1489
|
+
step: "0.1",
|
|
1490
|
+
value: volume,
|
|
1491
|
+
onChange: handleVolumeChange,
|
|
1492
|
+
onKeyDown: (e) => {
|
|
1493
|
+
if (e.key === "ArrowUp" || e.key === "ArrowRight") {
|
|
1494
|
+
e.preventDefault();
|
|
1495
|
+
const newVolume = Math.min(
|
|
1496
|
+
1,
|
|
1497
|
+
Math.round((volume + 0.1) * 10) / 10
|
|
1498
|
+
);
|
|
1499
|
+
setVolume(newVolume);
|
|
1500
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
1501
|
+
} else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
|
|
1502
|
+
e.preventDefault();
|
|
1503
|
+
const newVolume = Math.max(
|
|
1504
|
+
0,
|
|
1505
|
+
Math.round((volume - 0.1) * 10) / 10
|
|
1506
|
+
);
|
|
1507
|
+
setVolume(newVolume);
|
|
1508
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
1509
|
+
}
|
|
1510
|
+
},
|
|
1511
|
+
className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
|
|
1512
|
+
style: {
|
|
1513
|
+
background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
|
|
1514
|
+
},
|
|
1515
|
+
"aria-label": "Volume",
|
|
1516
|
+
"aria-valuenow": Math.round(volume * 100),
|
|
1517
|
+
"aria-valuemin": 0,
|
|
1518
|
+
"aria-valuemax": 100
|
|
1519
|
+
}
|
|
1520
|
+
)
|
|
1521
|
+
}
|
|
1522
|
+
)
|
|
1523
|
+
] }),
|
|
1524
|
+
/* @__PURE__ */ jsx5(
|
|
1525
|
+
DotsThreeVertical,
|
|
1526
|
+
{
|
|
1527
|
+
size: 24,
|
|
1528
|
+
className: "text-text-950 cursor-pointer hover:text-primary-600"
|
|
1529
|
+
}
|
|
1530
|
+
)
|
|
1531
|
+
]
|
|
1532
|
+
}
|
|
1533
|
+
);
|
|
1534
|
+
}
|
|
1535
|
+
);
|
|
1536
|
+
var SIMULADO_BACKGROUND_CLASSES = {
|
|
1537
|
+
enem: "bg-exam-1",
|
|
1538
|
+
prova: "bg-exam-2",
|
|
1539
|
+
simuladao: "bg-exam-3",
|
|
1540
|
+
vestibular: "bg-exam-4"
|
|
1541
|
+
};
|
|
1542
|
+
var CardSimulado = forwardRef(
|
|
1543
|
+
({ title, duration, info, backgroundColor, className, ...props }, ref) => {
|
|
1544
|
+
const backgroundClass = SIMULADO_BACKGROUND_CLASSES[backgroundColor];
|
|
1545
|
+
return /* @__PURE__ */ jsx5(
|
|
1546
|
+
CardBase,
|
|
1547
|
+
{
|
|
1548
|
+
ref,
|
|
1549
|
+
layout: "horizontal",
|
|
1550
|
+
padding: "medium",
|
|
1551
|
+
minHeight: "none",
|
|
1552
|
+
cursor: "pointer",
|
|
1553
|
+
className: `${backgroundClass} hover:shadow-soft-shadow-2 transition-shadow duration-200 ${className}`,
|
|
1554
|
+
...props,
|
|
1555
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "flex justify-between items-center w-full gap-4", children: [
|
|
1556
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
|
|
1557
|
+
/* @__PURE__ */ jsx5(Text_default, { size: "lg", weight: "bold", className: "text-text-950 truncate", children: title }),
|
|
1558
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-4 text-text-700", children: [
|
|
1559
|
+
duration && /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
|
|
1560
|
+
/* @__PURE__ */ jsx5(Clock, { size: 16, className: "flex-shrink-0" }),
|
|
1561
|
+
/* @__PURE__ */ jsx5(Text_default, { size: "sm", children: duration })
|
|
1562
|
+
] }),
|
|
1563
|
+
/* @__PURE__ */ jsx5(Text_default, { size: "sm", className: "truncate", children: info })
|
|
1564
|
+
] })
|
|
1565
|
+
] }),
|
|
1566
|
+
/* @__PURE__ */ jsx5(
|
|
1567
|
+
CaretRight,
|
|
1568
|
+
{
|
|
1569
|
+
size: 24,
|
|
1570
|
+
className: "text-text-800 flex-shrink-0",
|
|
1571
|
+
"data-testid": "caret-icon"
|
|
1572
|
+
}
|
|
1573
|
+
)
|
|
1574
|
+
] })
|
|
1575
|
+
}
|
|
1576
|
+
);
|
|
1577
|
+
}
|
|
1578
|
+
);
|
|
1579
|
+
|
|
1580
|
+
// src/components/Accordation/Accordation.tsx
|
|
1581
|
+
import { CaretRight as CaretRight2 } from "phosphor-react";
|
|
1582
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1583
|
+
var CardAccordation = forwardRef2(
|
|
1584
|
+
({
|
|
1585
|
+
title,
|
|
1586
|
+
children,
|
|
1587
|
+
className,
|
|
1588
|
+
defaultExpanded = false,
|
|
1589
|
+
onToggleExpanded,
|
|
1590
|
+
...props
|
|
1591
|
+
}, ref) => {
|
|
1592
|
+
const [isExpanded, setIsExpanded] = useState2(defaultExpanded);
|
|
1593
|
+
const contentId = useId();
|
|
1594
|
+
const handleToggle = () => {
|
|
1595
|
+
const newExpanded = !isExpanded;
|
|
1596
|
+
setIsExpanded(newExpanded);
|
|
1597
|
+
onToggleExpanded?.(newExpanded);
|
|
1598
|
+
};
|
|
1599
|
+
return /* @__PURE__ */ jsxs5(
|
|
1600
|
+
CardBase,
|
|
1601
|
+
{
|
|
1602
|
+
ref,
|
|
1603
|
+
layout: "vertical",
|
|
1604
|
+
padding: "none",
|
|
1605
|
+
minHeight: "none",
|
|
1606
|
+
className: `overflow-hidden ${className}`,
|
|
1607
|
+
...props,
|
|
1608
|
+
children: [
|
|
1609
|
+
/* @__PURE__ */ jsxs5(
|
|
1610
|
+
"button",
|
|
1611
|
+
{
|
|
1612
|
+
onClick: handleToggle,
|
|
1613
|
+
className: "w-full cursor-pointer p-4 flex items-center justify-between gap-3 text-left transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-inset",
|
|
1614
|
+
"aria-expanded": isExpanded,
|
|
1615
|
+
"aria-controls": "accordion-content",
|
|
1616
|
+
children: [
|
|
1617
|
+
/* @__PURE__ */ jsx6(
|
|
1618
|
+
Text_default,
|
|
1619
|
+
{
|
|
1620
|
+
size: "sm",
|
|
1621
|
+
weight: "bold",
|
|
1622
|
+
className: "text-text-950 truncate flex-1",
|
|
1623
|
+
children: title
|
|
1624
|
+
}
|
|
1625
|
+
),
|
|
1626
|
+
/* @__PURE__ */ jsx6(
|
|
1627
|
+
CaretRight2,
|
|
1628
|
+
{
|
|
1629
|
+
size: 20,
|
|
1630
|
+
className: `text-text-700 transition-transform duration-200 flex-shrink-0 ${isExpanded ? "rotate-90" : "rotate-0"}`,
|
|
1631
|
+
"data-testid": "accordion-caret"
|
|
1632
|
+
}
|
|
1633
|
+
)
|
|
1634
|
+
]
|
|
1635
|
+
}
|
|
1636
|
+
),
|
|
1637
|
+
/* @__PURE__ */ jsx6(
|
|
1638
|
+
"div",
|
|
1639
|
+
{
|
|
1640
|
+
id: contentId,
|
|
1641
|
+
className: `transition-all duration-300 ease-in-out overflow-hidden ${isExpanded ? "max-h-screen opacity-100" : "max-h-0 opacity-0"}`,
|
|
1642
|
+
"data-testid": "accordion-content",
|
|
1643
|
+
children: /* @__PURE__ */ jsx6("div", { className: "p-4 pt-0 border-border-50", children })
|
|
1644
|
+
}
|
|
1645
|
+
)
|
|
1646
|
+
]
|
|
1647
|
+
}
|
|
1648
|
+
);
|
|
1649
|
+
}
|
|
1650
|
+
);
|
|
1651
|
+
export {
|
|
1652
|
+
CardAccordation
|
|
1653
|
+
};
|
|
1654
|
+
//# sourceMappingURL=index.mjs.map
|