analytica-frontend-lib 1.0.45 → 1.0.46

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.
@@ -0,0 +1,1054 @@
1
+ // src/components/Card/Card.tsx
2
+ import { forwardRef, Fragment as Fragment2 } from "react";
3
+
4
+ // src/components/Button/Button.tsx
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ var VARIANT_ACTION_CLASSES = {
7
+ solid: {
8
+ 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",
9
+ 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",
10
+ 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"
11
+ },
12
+ outline: {
13
+ 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",
14
+ 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",
15
+ 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"
16
+ },
17
+ link: {
18
+ 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",
19
+ 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",
20
+ 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"
21
+ }
22
+ };
23
+ var SIZE_CLASSES = {
24
+ "extra-small": "text-xs px-3.5 py-2",
25
+ small: "text-sm px-4 py-2.5",
26
+ medium: "text-md px-5 py-2.5",
27
+ large: "text-lg px-6 py-3",
28
+ "extra-large": "text-lg px-7 py-3.5"
29
+ };
30
+ var Button = ({
31
+ children,
32
+ iconLeft,
33
+ iconRight,
34
+ size = "medium",
35
+ variant = "solid",
36
+ action = "primary",
37
+ className = "",
38
+ disabled,
39
+ type = "button",
40
+ ...props
41
+ }) => {
42
+ const sizeClasses = SIZE_CLASSES[size];
43
+ const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
44
+ const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
45
+ return /* @__PURE__ */ jsxs(
46
+ "button",
47
+ {
48
+ className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
49
+ disabled,
50
+ type,
51
+ ...props,
52
+ children: [
53
+ iconLeft && /* @__PURE__ */ jsx("span", { className: "mr-2 flex items-center", children: iconLeft }),
54
+ children,
55
+ iconRight && /* @__PURE__ */ jsx("span", { className: "ml-2 flex items-center", children: iconRight })
56
+ ]
57
+ }
58
+ );
59
+ };
60
+ var Button_default = Button;
61
+
62
+ // src/components/Badge/Badge.tsx
63
+ import { Bell } from "phosphor-react";
64
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
65
+ var VARIANT_ACTION_CLASSES2 = {
66
+ solid: {
67
+ error: "bg-error text-error-700 focus-visible:outline-none",
68
+ warning: "bg-warning text-warning-800 focus-visible:outline-none",
69
+ success: "bg-success text-success-800 focus-visible:outline-none",
70
+ info: "bg-info text-info-800 focus-visible:outline-none",
71
+ muted: "bg-background-muted text-background-800 focus-visible:outline-none"
72
+ },
73
+ outlined: {
74
+ error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
75
+ warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
76
+ success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
77
+ info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
78
+ muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
79
+ },
80
+ exams: {
81
+ exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
82
+ exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
83
+ exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
84
+ exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
85
+ },
86
+ resultStatus: {
87
+ negative: "bg-error text-error-800 focus-visible:outline-none",
88
+ positive: "bg-success text-success-800 focus-visible:outline-none"
89
+ },
90
+ notification: "text-primary"
91
+ };
92
+ var SIZE_CLASSES2 = {
93
+ small: "text-2xs px-2 py-1",
94
+ medium: "text-xs px-2 py-1",
95
+ large: "text-sm px-2 py-1"
96
+ };
97
+ var SIZE_CLASSES_ICON = {
98
+ small: "size-3",
99
+ medium: "size-3.5",
100
+ large: "size-4"
101
+ };
102
+ var Badge = ({
103
+ children,
104
+ iconLeft,
105
+ iconRight,
106
+ size = "medium",
107
+ variant = "solid",
108
+ action = "error",
109
+ className = "",
110
+ notificationActive = false,
111
+ ...props
112
+ }) => {
113
+ const sizeClasses = SIZE_CLASSES2[size];
114
+ const sizeClassesIcon = SIZE_CLASSES_ICON[size];
115
+ const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
116
+ const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
117
+ const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
118
+ const baseClassesIcon = "flex items-center";
119
+ if (variant === "notification") {
120
+ return /* @__PURE__ */ jsxs2(
121
+ "div",
122
+ {
123
+ className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
124
+ ...props,
125
+ children: [
126
+ /* @__PURE__ */ jsx2(Bell, { size: 24, className: "text-primary-950" }),
127
+ notificationActive && /* @__PURE__ */ jsx2(
128
+ "span",
129
+ {
130
+ "data-testid": "notification-dot",
131
+ className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
132
+ }
133
+ )
134
+ ]
135
+ }
136
+ );
137
+ }
138
+ return /* @__PURE__ */ jsxs2(
139
+ "div",
140
+ {
141
+ className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
142
+ ...props,
143
+ children: [
144
+ iconLeft && /* @__PURE__ */ jsx2("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconLeft }),
145
+ children,
146
+ iconRight && /* @__PURE__ */ jsx2("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconRight })
147
+ ]
148
+ }
149
+ );
150
+ };
151
+ var Badge_default = Badge;
152
+
153
+ // src/components/Text/Text.tsx
154
+ import { jsx as jsx3 } from "react/jsx-runtime";
155
+ var Text = ({
156
+ children,
157
+ size = "md",
158
+ weight = "normal",
159
+ color = "text-text-950",
160
+ as,
161
+ className = "",
162
+ ...props
163
+ }) => {
164
+ let sizeClasses = "";
165
+ let weightClasses = "";
166
+ const sizeClassMap = {
167
+ "2xs": "text-2xs",
168
+ xs: "text-xs",
169
+ sm: "text-sm",
170
+ md: "text-md",
171
+ lg: "text-lg",
172
+ xl: "text-xl",
173
+ "2xl": "text-2xl",
174
+ "3xl": "text-3xl",
175
+ "4xl": "text-4xl",
176
+ "5xl": "text-5xl",
177
+ "6xl": "text-6xl"
178
+ };
179
+ sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
180
+ const weightClassMap = {
181
+ hairline: "font-hairline",
182
+ light: "font-light",
183
+ normal: "font-normal",
184
+ medium: "font-medium",
185
+ semibold: "font-semibold",
186
+ bold: "font-bold",
187
+ extrabold: "font-extrabold",
188
+ black: "font-black"
189
+ };
190
+ weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
191
+ const baseClasses = "font-primary";
192
+ const Component = as ?? "p";
193
+ return /* @__PURE__ */ jsx3(
194
+ Component,
195
+ {
196
+ className: `${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`,
197
+ ...props,
198
+ children
199
+ }
200
+ );
201
+ };
202
+ var Text_default = Text;
203
+
204
+ // src/components/ProgressBar/ProgressBar.tsx
205
+ import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
206
+ var SIZE_CLASSES3 = {
207
+ small: {
208
+ container: "h-1",
209
+ // 4px height (h-1 = 4px in Tailwind)
210
+ bar: "h-1",
211
+ // 4px height for the fill bar
212
+ spacing: "gap-2",
213
+ // 8px gap between label and progress bar
214
+ layout: "flex-col",
215
+ // vertical layout for small
216
+ borderRadius: "rounded-full"
217
+ // 9999px border radius
218
+ },
219
+ medium: {
220
+ container: "h-2",
221
+ // 8px height (h-2 = 8px in Tailwind)
222
+ bar: "h-2",
223
+ // 8px height for the fill bar
224
+ spacing: "gap-2",
225
+ // 8px gap between progress bar and label
226
+ layout: "flex-row items-center",
227
+ // horizontal layout for medium
228
+ borderRadius: "rounded-lg"
229
+ // 8px border radius
230
+ }
231
+ };
232
+ var VARIANT_CLASSES = {
233
+ blue: {
234
+ background: "bg-background-300",
235
+ // Background track color (#D5D4D4)
236
+ fill: "bg-primary-700"
237
+ // Blue for activity progress (#2271C4)
238
+ },
239
+ green: {
240
+ background: "bg-background-300",
241
+ // Background track color (#D5D4D4)
242
+ fill: "bg-success-200"
243
+ // Green for performance (#84D3A2)
244
+ }
245
+ };
246
+ var calculateProgressValues = (value, max) => {
247
+ const safeValue = isNaN(value) ? 0 : value;
248
+ const clampedValue = Math.max(0, Math.min(safeValue, max));
249
+ const percentage = max === 0 ? 0 : clampedValue / max * 100;
250
+ return { clampedValue, percentage };
251
+ };
252
+ var shouldShowHeader = (label, showPercentage, showHitCount) => {
253
+ return !!(label || showPercentage || showHitCount);
254
+ };
255
+ var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
256
+ if (showHitCount) {
257
+ return {
258
+ type: "hitCount",
259
+ content: `${Math.round(clampedValue)} de ${max}`,
260
+ hasMetrics: true
261
+ };
262
+ }
263
+ if (showPercentage) {
264
+ return {
265
+ type: "percentage",
266
+ content: `${Math.round(percentage)}%`,
267
+ hasMetrics: true
268
+ };
269
+ }
270
+ return {
271
+ type: "label",
272
+ content: label,
273
+ hasMetrics: false
274
+ };
275
+ };
276
+ var getCompactLayoutConfig = ({
277
+ showPercentage,
278
+ showHitCount,
279
+ percentage,
280
+ clampedValue,
281
+ max,
282
+ label,
283
+ percentageClassName,
284
+ labelClassName
285
+ }) => {
286
+ const displayPriority = getDisplayPriority(
287
+ showHitCount,
288
+ showPercentage,
289
+ label,
290
+ clampedValue,
291
+ max,
292
+ percentage
293
+ );
294
+ return {
295
+ color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
296
+ className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
297
+ content: displayPriority.content
298
+ };
299
+ };
300
+ var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
301
+ showHeader: size === "small" && !!(label || showPercentage),
302
+ showPercentage: size === "medium" && showPercentage,
303
+ showLabel: size === "medium" && !!label && !showPercentage
304
+ // Only show label when percentage is not shown
305
+ });
306
+ var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
307
+ if (!showHitCount && !showPercentage) return null;
308
+ const displayPriority = getDisplayPriority(
309
+ showHitCount,
310
+ showPercentage,
311
+ null,
312
+ // label is not relevant for stacked layout metrics display
313
+ clampedValue,
314
+ max,
315
+ percentage
316
+ );
317
+ return /* @__PURE__ */ jsx4(
318
+ "div",
319
+ {
320
+ className: `text-xs font-medium leading-[14px] text-right ${percentageClassName}`,
321
+ children: displayPriority.type === "hitCount" ? /* @__PURE__ */ jsxs3(Fragment, { children: [
322
+ /* @__PURE__ */ jsx4("span", { className: "text-success-200", children: Math.round(clampedValue) }),
323
+ /* @__PURE__ */ jsxs3("span", { className: "text-text-600", children: [
324
+ " de ",
325
+ max
326
+ ] })
327
+ ] }) : /* @__PURE__ */ jsxs3(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
328
+ Math.round(percentage),
329
+ "%"
330
+ ] })
331
+ }
332
+ );
333
+ };
334
+ var ProgressBarBase = ({
335
+ clampedValue,
336
+ max,
337
+ percentage,
338
+ label,
339
+ variantClasses,
340
+ containerClassName,
341
+ fillClassName
342
+ }) => /* @__PURE__ */ jsxs3(
343
+ "div",
344
+ {
345
+ className: `${containerClassName} ${variantClasses.background} overflow-hidden relative`,
346
+ children: [
347
+ /* @__PURE__ */ jsx4(
348
+ "progress",
349
+ {
350
+ value: clampedValue,
351
+ max,
352
+ "aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
353
+ className: "absolute inset-0 w-full h-full opacity-0"
354
+ }
355
+ ),
356
+ /* @__PURE__ */ jsx4(
357
+ "div",
358
+ {
359
+ className: `${fillClassName} ${variantClasses.fill} transition-all duration-300 ease-out`,
360
+ style: { width: `${percentage}%` }
361
+ }
362
+ )
363
+ ]
364
+ }
365
+ );
366
+ var StackedLayout = ({
367
+ className,
368
+ label,
369
+ showPercentage,
370
+ showHitCount,
371
+ labelClassName,
372
+ percentageClassName,
373
+ clampedValue,
374
+ max,
375
+ percentage,
376
+ variantClasses,
377
+ dimensions
378
+ }) => /* @__PURE__ */ jsxs3(
379
+ "div",
380
+ {
381
+ className: `flex flex-col items-start gap-2 ${dimensions.width} ${dimensions.height} ${className}`,
382
+ children: [
383
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ jsxs3("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
384
+ label && /* @__PURE__ */ jsx4(
385
+ Text_default,
386
+ {
387
+ as: "div",
388
+ size: "md",
389
+ weight: "medium",
390
+ className: `text-text-600 leading-[19px] ${labelClassName}`,
391
+ children: label
392
+ }
393
+ ),
394
+ renderStackedHitCountDisplay(
395
+ showHitCount,
396
+ showPercentage,
397
+ clampedValue,
398
+ max,
399
+ percentage,
400
+ percentageClassName
401
+ )
402
+ ] }),
403
+ /* @__PURE__ */ jsx4(
404
+ ProgressBarBase,
405
+ {
406
+ clampedValue,
407
+ max,
408
+ percentage,
409
+ label,
410
+ variantClasses,
411
+ containerClassName: "w-full h-2 rounded-lg",
412
+ fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
413
+ }
414
+ )
415
+ ]
416
+ }
417
+ );
418
+ var CompactLayout = ({
419
+ className,
420
+ label,
421
+ showPercentage,
422
+ showHitCount,
423
+ labelClassName,
424
+ percentageClassName,
425
+ clampedValue,
426
+ max,
427
+ percentage,
428
+ variantClasses,
429
+ dimensions
430
+ }) => {
431
+ const {
432
+ color,
433
+ className: compactClassName,
434
+ content
435
+ } = getCompactLayoutConfig({
436
+ showPercentage,
437
+ showHitCount,
438
+ percentage,
439
+ clampedValue,
440
+ max,
441
+ label,
442
+ percentageClassName,
443
+ labelClassName
444
+ });
445
+ return /* @__PURE__ */ jsxs3(
446
+ "div",
447
+ {
448
+ className: `flex flex-col items-start gap-1 ${dimensions.width} ${dimensions.height} ${className}`,
449
+ children: [
450
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ jsx4(
451
+ Text_default,
452
+ {
453
+ as: "div",
454
+ size: "sm",
455
+ weight: "medium",
456
+ color,
457
+ className: `leading-4 w-full ${compactClassName}`,
458
+ children: content
459
+ }
460
+ ),
461
+ /* @__PURE__ */ jsx4(
462
+ ProgressBarBase,
463
+ {
464
+ clampedValue,
465
+ max,
466
+ percentage,
467
+ label,
468
+ variantClasses,
469
+ containerClassName: "w-full h-1 rounded-full",
470
+ fillClassName: "h-1 rounded-full"
471
+ }
472
+ )
473
+ ]
474
+ }
475
+ );
476
+ };
477
+ var DefaultLayout = ({
478
+ className,
479
+ size,
480
+ sizeClasses,
481
+ variantClasses,
482
+ label,
483
+ showPercentage,
484
+ labelClassName,
485
+ percentageClassName,
486
+ clampedValue,
487
+ max,
488
+ percentage
489
+ }) => {
490
+ const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
491
+ const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
492
+ const displayConfig = getDefaultLayoutDisplayConfig(
493
+ size,
494
+ label,
495
+ showPercentage
496
+ );
497
+ return /* @__PURE__ */ jsxs3("div", { className: `flex ${sizeClasses.layout} ${gapClass} ${className}`, children: [
498
+ displayConfig.showHeader && /* @__PURE__ */ jsxs3("div", { className: "flex flex-row items-center justify-between w-full", children: [
499
+ label && /* @__PURE__ */ jsx4(
500
+ Text_default,
501
+ {
502
+ as: "div",
503
+ size: "xs",
504
+ weight: "medium",
505
+ className: `text-text-950 leading-none tracking-normal text-center ${labelClassName}`,
506
+ children: label
507
+ }
508
+ ),
509
+ showPercentage && /* @__PURE__ */ jsxs3(
510
+ Text_default,
511
+ {
512
+ size: "xs",
513
+ weight: "medium",
514
+ className: `text-text-950 leading-none tracking-normal text-center ${percentageClassName}`,
515
+ children: [
516
+ Math.round(percentage),
517
+ "%"
518
+ ]
519
+ }
520
+ )
521
+ ] }),
522
+ /* @__PURE__ */ jsx4(
523
+ ProgressBarBase,
524
+ {
525
+ clampedValue,
526
+ max,
527
+ percentage,
528
+ label,
529
+ variantClasses,
530
+ containerClassName: `${progressBarClass} ${sizeClasses.container} ${sizeClasses.borderRadius}`,
531
+ fillClassName: `${sizeClasses.bar} ${sizeClasses.borderRadius} shadow-hard-shadow-3`
532
+ }
533
+ ),
534
+ displayConfig.showPercentage && /* @__PURE__ */ jsxs3(
535
+ Text_default,
536
+ {
537
+ size: "xs",
538
+ weight: "medium",
539
+ className: `text-text-950 leading-none tracking-normal text-center flex-none ${percentageClassName}`,
540
+ children: [
541
+ Math.round(percentage),
542
+ "%"
543
+ ]
544
+ }
545
+ ),
546
+ displayConfig.showLabel && /* @__PURE__ */ jsx4(
547
+ Text_default,
548
+ {
549
+ as: "div",
550
+ size: "xs",
551
+ weight: "medium",
552
+ className: `text-text-950 leading-none tracking-normal text-center flex-none ${labelClassName}`,
553
+ children: label
554
+ }
555
+ )
556
+ ] });
557
+ };
558
+ var ProgressBar = ({
559
+ value,
560
+ max = 100,
561
+ size = "medium",
562
+ variant = "blue",
563
+ layout = "default",
564
+ label,
565
+ showPercentage = false,
566
+ showHitCount = false,
567
+ className = "",
568
+ labelClassName = "",
569
+ percentageClassName = "",
570
+ stackedWidth,
571
+ stackedHeight,
572
+ compactWidth,
573
+ compactHeight
574
+ }) => {
575
+ const { clampedValue, percentage } = calculateProgressValues(value, max);
576
+ const sizeClasses = SIZE_CLASSES3[size];
577
+ const variantClasses = VARIANT_CLASSES[variant];
578
+ if (layout === "stacked") {
579
+ return /* @__PURE__ */ jsx4(
580
+ StackedLayout,
581
+ {
582
+ className,
583
+ label,
584
+ showPercentage,
585
+ showHitCount,
586
+ labelClassName,
587
+ percentageClassName,
588
+ clampedValue,
589
+ max,
590
+ percentage,
591
+ variantClasses,
592
+ dimensions: {
593
+ width: stackedWidth ?? "w-[380px]",
594
+ height: stackedHeight ?? "h-[35px]"
595
+ }
596
+ }
597
+ );
598
+ }
599
+ if (layout === "compact") {
600
+ return /* @__PURE__ */ jsx4(
601
+ CompactLayout,
602
+ {
603
+ className,
604
+ label,
605
+ showPercentage,
606
+ showHitCount,
607
+ labelClassName,
608
+ percentageClassName,
609
+ clampedValue,
610
+ max,
611
+ percentage,
612
+ variantClasses,
613
+ dimensions: {
614
+ width: compactWidth ?? "w-[131px]",
615
+ height: compactHeight ?? "h-[24px]"
616
+ }
617
+ }
618
+ );
619
+ }
620
+ return /* @__PURE__ */ jsx4(
621
+ DefaultLayout,
622
+ {
623
+ className,
624
+ size,
625
+ sizeClasses,
626
+ variantClasses,
627
+ label,
628
+ showPercentage,
629
+ labelClassName,
630
+ percentageClassName,
631
+ clampedValue,
632
+ max,
633
+ percentage
634
+ }
635
+ );
636
+ };
637
+ var ProgressBar_default = ProgressBar;
638
+
639
+ // src/components/Card/Card.tsx
640
+ import { CaretRight, CheckCircle, XCircle } from "phosphor-react";
641
+ import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
642
+ var ACTION_CARD_CLASSES = {
643
+ warning: "bg-warning-background",
644
+ success: "bg-success-300",
645
+ error: "bg-error-100",
646
+ info: "bg-info-background"
647
+ };
648
+ var ACTION_ICON_CLASSES = {
649
+ warning: "bg-warning-300 text-text",
650
+ success: "bg-yellow-300 text-text-950",
651
+ error: "bg-error-500 text-text",
652
+ info: "bg-info-500 text-text"
653
+ };
654
+ var ACTION_SUBTITLE_CLASSES = {
655
+ warning: "text-warning-600",
656
+ success: "text-success-700",
657
+ error: "text-error-700",
658
+ info: "text-info-700"
659
+ };
660
+ var ACTION_HEADER_CLASSES = {
661
+ warning: "text-warning-300",
662
+ success: "text-success-300",
663
+ error: "text-error-300",
664
+ info: "text-info-300"
665
+ };
666
+ var CardActivesResults = forwardRef(
667
+ ({
668
+ icon,
669
+ title,
670
+ subTitle,
671
+ header,
672
+ extended = false,
673
+ action = "success",
674
+ description,
675
+ className,
676
+ ...props
677
+ }, ref) => {
678
+ const actionCardClasses = ACTION_CARD_CLASSES[action];
679
+ const actionIconClasses = ACTION_ICON_CLASSES[action];
680
+ const actionSubTitleClasses = ACTION_SUBTITLE_CLASSES[action];
681
+ const actionHeaderClasses = ACTION_HEADER_CLASSES[action];
682
+ return /* @__PURE__ */ jsxs4(
683
+ "div",
684
+ {
685
+ ref,
686
+ className: `w-full flex flex-col border border-border-50 bg-background rounded-xl ${className}`,
687
+ ...props,
688
+ children: [
689
+ /* @__PURE__ */ jsxs4(
690
+ "div",
691
+ {
692
+ className: `
693
+ flex flex-col gap-1 items-center justify-center p-4
694
+ ${actionCardClasses}
695
+ ${extended ? "rounded-t-xl" : "rounded-xl"}`,
696
+ children: [
697
+ /* @__PURE__ */ jsx5(
698
+ "span",
699
+ {
700
+ className: `size-7.5 rounded-full flex items-center justify-center ${actionIconClasses}`,
701
+ children: icon
702
+ }
703
+ ),
704
+ /* @__PURE__ */ jsx5("p", { className: "text-text-800 font-medium uppercase text-2xs", children: title }),
705
+ /* @__PURE__ */ jsx5("p", { className: `text-lg font-bold ${actionSubTitleClasses}`, children: subTitle })
706
+ ]
707
+ }
708
+ ),
709
+ extended && /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-2.5 pb-9.5 pt-2.5", children: [
710
+ /* @__PURE__ */ jsx5(
711
+ "p",
712
+ {
713
+ className: `text-2xs font-medium uppercase ${actionHeaderClasses}`,
714
+ children: header
715
+ }
716
+ ),
717
+ /* @__PURE__ */ jsx5("p", { className: "text-sm text-info-800 text-center", children: description })
718
+ ] })
719
+ ]
720
+ }
721
+ );
722
+ }
723
+ );
724
+ var CardQuestions = forwardRef(
725
+ ({
726
+ header,
727
+ state = "undone",
728
+ className,
729
+ onClickButton,
730
+ valueButton,
731
+ ...props
732
+ }, ref) => {
733
+ const isDone = state === "done";
734
+ const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
735
+ const buttonLabel = isDone ? "Ver Quest\xE3o" : "Responder";
736
+ return /* @__PURE__ */ jsxs4(
737
+ "div",
738
+ {
739
+ ref,
740
+ className: `
741
+ w-full flex flex-row justify-between rounded-xl p-4 gap-4 bg-background border border-border-50
742
+ ${className}
743
+ `,
744
+ ...props,
745
+ children: [
746
+ /* @__PURE__ */ jsxs4("section", { className: "flex flex-col gap-1", children: [
747
+ /* @__PURE__ */ jsx5("p", { className: "font-bold text-xs text-text-950", children: header }),
748
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-row gap-6 items-center", children: [
749
+ /* @__PURE__ */ jsx5(
750
+ Badge_default,
751
+ {
752
+ size: "medium",
753
+ variant: "solid",
754
+ action: isDone ? "success" : "error",
755
+ children: stateLabel
756
+ }
757
+ ),
758
+ /* @__PURE__ */ jsxs4("span", { className: "flex flex-row items-center gap-1 text-text-700 text-xs", children: [
759
+ isDone ? "Nota" : "Sem nota",
760
+ isDone && /* @__PURE__ */ jsx5(Badge_default, { size: "medium", action: "success", children: "00" })
761
+ ] })
762
+ ] })
763
+ ] }),
764
+ /* @__PURE__ */ jsx5(Button_default, { size: "extra-small", onClick: () => onClickButton?.(valueButton), children: buttonLabel })
765
+ ]
766
+ }
767
+ );
768
+ }
769
+ );
770
+ var CardProgress = forwardRef(
771
+ ({
772
+ header,
773
+ subhead,
774
+ initialDate,
775
+ endDate,
776
+ progress = 0,
777
+ direction = "horizontal",
778
+ icon,
779
+ color = "#B7DFFF",
780
+ className,
781
+ ...props
782
+ }, ref) => {
783
+ const isHorizontal = direction === "horizontal";
784
+ const contentComponent = {
785
+ horizontal: /* @__PURE__ */ jsxs4(Fragment3, { children: [
786
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-row gap-6 items-center", children: [
787
+ initialDate && /* @__PURE__ */ jsxs4("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
788
+ /* @__PURE__ */ jsx5("p", { className: "text-text-800 font-semibold", children: "In\xEDcio" }),
789
+ /* @__PURE__ */ jsx5("p", { className: "text-text-600", children: initialDate })
790
+ ] }),
791
+ endDate && /* @__PURE__ */ jsxs4("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
792
+ /* @__PURE__ */ jsx5("p", { className: "text-text-800 font-semibold", children: "Fim" }),
793
+ /* @__PURE__ */ jsx5("p", { className: "text-text-600", children: endDate })
794
+ ] })
795
+ ] }),
796
+ /* @__PURE__ */ jsx5(
797
+ ProgressBar_default,
798
+ {
799
+ size: "medium",
800
+ showPercentage: true,
801
+ value: progress,
802
+ "data-testid": "progress-bar"
803
+ }
804
+ )
805
+ ] }),
806
+ vertical: /* @__PURE__ */ jsx5("p", { className: "text-sm text-text-800", children: subhead })
807
+ };
808
+ return /* @__PURE__ */ jsxs4(
809
+ "div",
810
+ {
811
+ ref,
812
+ className: `
813
+ w-full flex border border-border-50 rounded-xl
814
+ ${isHorizontal ? "flex-row h-20" : "flex-col"}
815
+ ${className}
816
+ `,
817
+ ...props,
818
+ children: [
819
+ /* @__PURE__ */ jsx5(
820
+ "div",
821
+ {
822
+ className: `
823
+ flex justify-center items-center [&>svg]:size-8 text-text-950
824
+ ${isHorizontal ? "w-20 h-full rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl"}
825
+ `,
826
+ style: {
827
+ backgroundColor: color
828
+ },
829
+ children: icon
830
+ }
831
+ ),
832
+ /* @__PURE__ */ jsxs4(
833
+ "div",
834
+ {
835
+ className: `
836
+ p-4 flex flex-col justify-between w-full h-full
837
+ ${!isHorizontal && "gap-4"}
838
+ `,
839
+ children: [
840
+ /* @__PURE__ */ jsx5("p", { className: "text-xs font-bold text-text-950", children: header }),
841
+ contentComponent[direction]
842
+ ]
843
+ }
844
+ )
845
+ ]
846
+ }
847
+ );
848
+ }
849
+ );
850
+ var CardTopic = forwardRef(
851
+ ({
852
+ header,
853
+ subHead,
854
+ progress,
855
+ showPercentage = false,
856
+ className = "",
857
+ ...props
858
+ }, ref) => {
859
+ return /* @__PURE__ */ jsxs4(
860
+ "div",
861
+ {
862
+ ref,
863
+ className: `w-full py-2 px-4 flex flex-col justify-center gap-2 border border-border-50 rounded-xl min-h-20 ${className}`,
864
+ ...props,
865
+ children: [
866
+ subHead && /* @__PURE__ */ jsx5("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ jsxs4(Fragment2, { children: [
867
+ /* @__PURE__ */ jsx5("p", { children: text }),
868
+ index < subHead.length - 1 && /* @__PURE__ */ jsx5("p", { children: "\u2022" })
869
+ ] }, `${text} - ${index}`)) }),
870
+ /* @__PURE__ */ jsx5("p", { className: "text-xs text-text-950 font-bold", children: header }),
871
+ /* @__PURE__ */ jsx5(ProgressBar_default, { showPercentage, value: progress })
872
+ ]
873
+ }
874
+ );
875
+ }
876
+ );
877
+ var CardPerformance = forwardRef(
878
+ ({
879
+ header,
880
+ progress,
881
+ description = "Sem dados ainda! Voc\xEA ainda n\xE3o fez um question\xE1rio neste assunto.",
882
+ className = "",
883
+ onClickButton,
884
+ valueButton,
885
+ ...props
886
+ }, ref) => {
887
+ const hasProgress = progress !== void 0;
888
+ return /* @__PURE__ */ jsxs4(
889
+ "div",
890
+ {
891
+ ref,
892
+ className: `w-full h-20.5 flex flex-row justify-between p-4 gap-2 bg-background border border-border-50 ${className}`,
893
+ ...props,
894
+ children: [
895
+ /* @__PURE__ */ jsxs4("div", { className: "w-full flex flex-col justify-between gap-2", children: [
896
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-row justify-between items-center", children: [
897
+ /* @__PURE__ */ jsx5("p", { className: "text-md font-bold text-text-950", children: header }),
898
+ hasProgress && /* @__PURE__ */ jsx5(
899
+ Button_default,
900
+ {
901
+ variant: "outline",
902
+ size: "extra-small",
903
+ onClick: () => onClickButton?.(valueButton),
904
+ children: "Ver Aula"
905
+ }
906
+ )
907
+ ] }),
908
+ /* @__PURE__ */ jsx5("div", { className: "w-full", children: hasProgress ? /* @__PURE__ */ jsx5(ProgressBar_default, { value: progress, label: `${progress}% corretas` }) : /* @__PURE__ */ jsx5("p", { className: "text-xs text-text-600", children: description }) })
909
+ ] }),
910
+ !hasProgress && /* @__PURE__ */ jsx5(
911
+ CaretRight,
912
+ {
913
+ className: "size-4.5",
914
+ "data-testid": "caret-icon",
915
+ onClick: () => onClickButton?.(valueButton)
916
+ }
917
+ )
918
+ ]
919
+ }
920
+ );
921
+ }
922
+ );
923
+ var CardResults = forwardRef(
924
+ ({
925
+ header,
926
+ correct_answers,
927
+ incorrect_answers,
928
+ icon,
929
+ direction = "col",
930
+ color = "#B7DFFF",
931
+ className,
932
+ ...props
933
+ }, ref) => {
934
+ const isRow = direction == "row";
935
+ return /* @__PURE__ */ jsxs4(
936
+ "div",
937
+ {
938
+ ref,
939
+ className: `
940
+ w-full flex border border-border-50 rounded-xl min-h-20 flex-row items-center pr-4
941
+ ${className}
942
+ `,
943
+ ...props,
944
+ children: [
945
+ /* @__PURE__ */ jsx5(
946
+ "div",
947
+ {
948
+ className: `
949
+ flex justify-center items-center [&>svg]:size-8 text-text-950 min-w-20 max-w-20 h-full rounded-l-xl
950
+ `,
951
+ style: {
952
+ backgroundColor: color
953
+ },
954
+ children: icon
955
+ }
956
+ ),
957
+ /* @__PURE__ */ jsxs4(
958
+ "div",
959
+ {
960
+ className: `
961
+ p-4 flex justify-between w-full h-full
962
+ ${isRow ? "flex-row items-center" : "flex-col"}
963
+ `,
964
+ children: [
965
+ /* @__PURE__ */ jsx5("p", { className: "text-xs font-bold text-text-950", children: header }),
966
+ /* @__PURE__ */ jsxs4("span", { className: "flex flex-row gap-1 items-center", children: [
967
+ /* @__PURE__ */ jsxs4(
968
+ Badge_default,
969
+ {
970
+ action: "success",
971
+ variant: "solid",
972
+ size: "medium",
973
+ iconLeft: /* @__PURE__ */ jsx5(CheckCircle, {}),
974
+ children: [
975
+ correct_answers,
976
+ " Corretas"
977
+ ]
978
+ }
979
+ ),
980
+ /* @__PURE__ */ jsxs4(
981
+ Badge_default,
982
+ {
983
+ action: "error",
984
+ variant: "solid",
985
+ size: "medium",
986
+ iconLeft: /* @__PURE__ */ jsx5(XCircle, {}),
987
+ children: [
988
+ incorrect_answers,
989
+ " Incorretas"
990
+ ]
991
+ }
992
+ )
993
+ ] })
994
+ ]
995
+ }
996
+ ),
997
+ /* @__PURE__ */ jsx5(CaretRight, { className: "min-w-6 min-h-6" })
998
+ ]
999
+ }
1000
+ );
1001
+ }
1002
+ );
1003
+ var CardStatus = forwardRef(
1004
+ ({ header, className, status, ...props }, ref) => {
1005
+ return /* @__PURE__ */ jsxs4(
1006
+ "div",
1007
+ {
1008
+ ref,
1009
+ className: `
1010
+ w-full flex border border-border-50 rounded-xl min-h-20 flex-row items-center pr-4
1011
+ ${className}
1012
+ `,
1013
+ ...props,
1014
+ children: [
1015
+ /* @__PURE__ */ jsxs4(
1016
+ "div",
1017
+ {
1018
+ className: `
1019
+ p-4 flex justify-between w-full h-full flex-row items-center
1020
+ `,
1021
+ children: [
1022
+ /* @__PURE__ */ jsx5("p", { className: "text-xs font-bold text-text-950", children: header }),
1023
+ /* @__PURE__ */ jsxs4("span", { className: "flex flex-row gap-1 items-center", children: [
1024
+ /* @__PURE__ */ jsx5(
1025
+ Badge_default,
1026
+ {
1027
+ action: status == "correct" ? "success" : "error",
1028
+ variant: "solid",
1029
+ size: "medium",
1030
+ iconLeft: /* @__PURE__ */ jsx5(CheckCircle, {}),
1031
+ children: status == "correct" ? "Correta" : "Incorreta"
1032
+ }
1033
+ ),
1034
+ /* @__PURE__ */ jsx5("p", { className: "text-sm text-text-800", children: "Respondida" })
1035
+ ] })
1036
+ ]
1037
+ }
1038
+ ),
1039
+ /* @__PURE__ */ jsx5(CaretRight, { className: "min-w-6 min-h-6" })
1040
+ ]
1041
+ }
1042
+ );
1043
+ }
1044
+ );
1045
+ export {
1046
+ CardActivesResults,
1047
+ CardPerformance,
1048
+ CardProgress,
1049
+ CardQuestions,
1050
+ CardResults,
1051
+ CardStatus,
1052
+ CardTopic
1053
+ };
1054
+ //# sourceMappingURL=index.mjs.map