analytica-frontend-lib 1.0.43 → 1.0.45
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/Calendar/index.js +12 -12
- package/dist/Calendar/index.js.map +1 -1
- package/dist/Calendar/index.mjs +18 -13
- package/dist/Calendar/index.mjs.map +1 -1
- package/dist/DropdownMenu/index.d.mts +1 -1
- package/dist/DropdownMenu/index.d.ts +1 -1
- package/dist/DropdownMenu/index.js +16 -12
- package/dist/DropdownMenu/index.js.map +1 -1
- package/dist/DropdownMenu/index.mjs +16 -12
- package/dist/DropdownMenu/index.mjs.map +1 -1
- package/dist/Input/index.js +5 -2
- package/dist/Input/index.js.map +1 -1
- package/dist/Input/index.mjs +5 -2
- package/dist/Input/index.mjs.map +1 -1
- package/dist/ProgressBar/index.d.mts +36 -1
- package/dist/ProgressBar/index.d.ts +36 -1
- package/dist/ProgressBar/index.js +371 -75
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/ProgressBar/index.mjs +372 -76
- package/dist/ProgressBar/index.mjs.map +1 -1
- package/dist/Select/index.js +15 -8
- package/dist/Select/index.js.map +1 -1
- package/dist/Select/index.mjs +15 -8
- package/dist/Select/index.mjs.map +1 -1
- package/dist/index.css +138 -5
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +66 -2
- package/dist/index.d.ts +66 -2
- package/dist/index.js +600 -192
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +572 -160
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +138 -5
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
|
@@ -9,6 +9,10 @@ type ProgressBarSize = 'small' | 'medium';
|
|
|
9
9
|
* Progress bar color variants
|
|
10
10
|
*/
|
|
11
11
|
type ProgressBarVariant = 'blue' | 'green';
|
|
12
|
+
/**
|
|
13
|
+
* Progress bar layout variants
|
|
14
|
+
*/
|
|
15
|
+
type ProgressBarLayout = 'default' | 'stacked' | 'compact';
|
|
12
16
|
/**
|
|
13
17
|
* ProgressBar component props interface
|
|
14
18
|
*/
|
|
@@ -21,16 +25,34 @@ type ProgressBarProps = {
|
|
|
21
25
|
size?: ProgressBarSize;
|
|
22
26
|
/** Color variant of the progress bar */
|
|
23
27
|
variant?: ProgressBarVariant;
|
|
28
|
+
/** Layout variant of the progress bar */
|
|
29
|
+
layout?: ProgressBarLayout;
|
|
24
30
|
/** Optional label to display */
|
|
25
31
|
label?: ReactNode;
|
|
26
32
|
/** Show percentage text */
|
|
27
33
|
showPercentage?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Show hit count (e.g., "28 de 30") instead of percentage
|
|
36
|
+
*
|
|
37
|
+
* PRIORITY: When both showHitCount and showPercentage are true,
|
|
38
|
+
* showHitCount takes precedence (stacked and compact layouts only).
|
|
39
|
+
* Default layout does not support showHitCount.
|
|
40
|
+
*/
|
|
41
|
+
showHitCount?: boolean;
|
|
28
42
|
/** Additional CSS classes */
|
|
29
43
|
className?: string;
|
|
30
44
|
/** Label CSS classes */
|
|
31
45
|
labelClassName?: string;
|
|
32
46
|
/** Percentage text CSS classes */
|
|
33
47
|
percentageClassName?: string;
|
|
48
|
+
/** Custom width for stacked layout (defaults to w-[380px]) */
|
|
49
|
+
stackedWidth?: string;
|
|
50
|
+
/** Custom height for stacked layout (defaults to h-[35px]) */
|
|
51
|
+
stackedHeight?: string;
|
|
52
|
+
/** Custom width for compact layout (defaults to w-[131px]) */
|
|
53
|
+
compactWidth?: string;
|
|
54
|
+
/** Custom height for compact layout (defaults to h-[24px]) */
|
|
55
|
+
compactHeight?: string;
|
|
34
56
|
};
|
|
35
57
|
/**
|
|
36
58
|
* ProgressBar component for Analytica Ensino platforms
|
|
@@ -40,6 +62,13 @@ type ProgressBarProps = {
|
|
|
40
62
|
* Uses the Analytica Ensino Design System colors from styles.css with automatic
|
|
41
63
|
* light/dark mode support. Includes Text component integration for consistent typography.
|
|
42
64
|
*
|
|
65
|
+
* CONTENT DISPLAY PRIORITY (Consistent across all layouts):
|
|
66
|
+
* 1. showHitCount (highest) - "X de Y" format (stacked/compact only)
|
|
67
|
+
* 2. showPercentage - "X%" format
|
|
68
|
+
* 3. label (lowest) - Custom label text
|
|
69
|
+
*
|
|
70
|
+
* When multiple display options are enabled, higher priority options take precedence.
|
|
71
|
+
*
|
|
43
72
|
* @example
|
|
44
73
|
* ```tsx
|
|
45
74
|
* // Basic progress bar
|
|
@@ -53,8 +82,14 @@ type ProgressBarProps = {
|
|
|
53
82
|
*
|
|
54
83
|
* // Small size with custom max value
|
|
55
84
|
* <ProgressBar size="small" value={3} max={5} showPercentage />
|
|
85
|
+
*
|
|
86
|
+
* // Stacked layout with fixed width and hit count
|
|
87
|
+
* <ProgressBar layout="stacked" variant="green" value={28} max={30} label="Fáceis" showHitCount />
|
|
88
|
+
*
|
|
89
|
+
* // Compact layout for small cards
|
|
90
|
+
* <ProgressBar layout="compact" variant="blue" value={70} label="Questão 08" />
|
|
56
91
|
* ```
|
|
57
92
|
*/
|
|
58
|
-
declare const ProgressBar: ({ value, max, size, variant, label, showPercentage, className, labelClassName, percentageClassName, }: ProgressBarProps) => react_jsx_runtime.JSX.Element;
|
|
93
|
+
declare const ProgressBar: ({ value, max, size, variant, layout, label, showPercentage, showHitCount, className, labelClassName, percentageClassName, stackedWidth, stackedHeight, compactWidth, compactHeight, }: ProgressBarProps) => react_jsx_runtime.JSX.Element;
|
|
59
94
|
|
|
60
95
|
export { type ProgressBarProps, ProgressBar as default };
|
|
@@ -9,6 +9,10 @@ type ProgressBarSize = 'small' | 'medium';
|
|
|
9
9
|
* Progress bar color variants
|
|
10
10
|
*/
|
|
11
11
|
type ProgressBarVariant = 'blue' | 'green';
|
|
12
|
+
/**
|
|
13
|
+
* Progress bar layout variants
|
|
14
|
+
*/
|
|
15
|
+
type ProgressBarLayout = 'default' | 'stacked' | 'compact';
|
|
12
16
|
/**
|
|
13
17
|
* ProgressBar component props interface
|
|
14
18
|
*/
|
|
@@ -21,16 +25,34 @@ type ProgressBarProps = {
|
|
|
21
25
|
size?: ProgressBarSize;
|
|
22
26
|
/** Color variant of the progress bar */
|
|
23
27
|
variant?: ProgressBarVariant;
|
|
28
|
+
/** Layout variant of the progress bar */
|
|
29
|
+
layout?: ProgressBarLayout;
|
|
24
30
|
/** Optional label to display */
|
|
25
31
|
label?: ReactNode;
|
|
26
32
|
/** Show percentage text */
|
|
27
33
|
showPercentage?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Show hit count (e.g., "28 de 30") instead of percentage
|
|
36
|
+
*
|
|
37
|
+
* PRIORITY: When both showHitCount and showPercentage are true,
|
|
38
|
+
* showHitCount takes precedence (stacked and compact layouts only).
|
|
39
|
+
* Default layout does not support showHitCount.
|
|
40
|
+
*/
|
|
41
|
+
showHitCount?: boolean;
|
|
28
42
|
/** Additional CSS classes */
|
|
29
43
|
className?: string;
|
|
30
44
|
/** Label CSS classes */
|
|
31
45
|
labelClassName?: string;
|
|
32
46
|
/** Percentage text CSS classes */
|
|
33
47
|
percentageClassName?: string;
|
|
48
|
+
/** Custom width for stacked layout (defaults to w-[380px]) */
|
|
49
|
+
stackedWidth?: string;
|
|
50
|
+
/** Custom height for stacked layout (defaults to h-[35px]) */
|
|
51
|
+
stackedHeight?: string;
|
|
52
|
+
/** Custom width for compact layout (defaults to w-[131px]) */
|
|
53
|
+
compactWidth?: string;
|
|
54
|
+
/** Custom height for compact layout (defaults to h-[24px]) */
|
|
55
|
+
compactHeight?: string;
|
|
34
56
|
};
|
|
35
57
|
/**
|
|
36
58
|
* ProgressBar component for Analytica Ensino platforms
|
|
@@ -40,6 +62,13 @@ type ProgressBarProps = {
|
|
|
40
62
|
* Uses the Analytica Ensino Design System colors from styles.css with automatic
|
|
41
63
|
* light/dark mode support. Includes Text component integration for consistent typography.
|
|
42
64
|
*
|
|
65
|
+
* CONTENT DISPLAY PRIORITY (Consistent across all layouts):
|
|
66
|
+
* 1. showHitCount (highest) - "X de Y" format (stacked/compact only)
|
|
67
|
+
* 2. showPercentage - "X%" format
|
|
68
|
+
* 3. label (lowest) - Custom label text
|
|
69
|
+
*
|
|
70
|
+
* When multiple display options are enabled, higher priority options take precedence.
|
|
71
|
+
*
|
|
43
72
|
* @example
|
|
44
73
|
* ```tsx
|
|
45
74
|
* // Basic progress bar
|
|
@@ -53,8 +82,14 @@ type ProgressBarProps = {
|
|
|
53
82
|
*
|
|
54
83
|
* // Small size with custom max value
|
|
55
84
|
* <ProgressBar size="small" value={3} max={5} showPercentage />
|
|
85
|
+
*
|
|
86
|
+
* // Stacked layout with fixed width and hit count
|
|
87
|
+
* <ProgressBar layout="stacked" variant="green" value={28} max={30} label="Fáceis" showHitCount />
|
|
88
|
+
*
|
|
89
|
+
* // Compact layout for small cards
|
|
90
|
+
* <ProgressBar layout="compact" variant="blue" value={70} label="Questão 08" />
|
|
56
91
|
* ```
|
|
57
92
|
*/
|
|
58
|
-
declare const ProgressBar: ({ value, max, size, variant, label, showPercentage, className, labelClassName, percentageClassName, }: ProgressBarProps) => react_jsx_runtime.JSX.Element;
|
|
93
|
+
declare const ProgressBar: ({ value, max, size, variant, layout, label, showPercentage, showHitCount, className, labelClassName, percentageClassName, stackedWidth, stackedHeight, compactWidth, compactHeight, }: ProgressBarProps) => react_jsx_runtime.JSX.Element;
|
|
59
94
|
|
|
60
95
|
export { type ProgressBarProps, ProgressBar as default };
|
|
@@ -117,100 +117,396 @@ var VARIANT_CLASSES = {
|
|
|
117
117
|
// Green for performance (#84D3A2)
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
var
|
|
121
|
-
value,
|
|
122
|
-
max = 100,
|
|
123
|
-
size = "medium",
|
|
124
|
-
variant = "blue",
|
|
125
|
-
label,
|
|
126
|
-
showPercentage = false,
|
|
127
|
-
className = "",
|
|
128
|
-
labelClassName = "",
|
|
129
|
-
percentageClassName = ""
|
|
130
|
-
}) => {
|
|
120
|
+
var calculateProgressValues = (value, max) => {
|
|
131
121
|
const safeValue = isNaN(value) ? 0 : value;
|
|
132
122
|
const clampedValue = Math.max(0, Math.min(safeValue, max));
|
|
133
123
|
const percentage = max === 0 ? 0 : clampedValue / max * 100;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
124
|
+
return { clampedValue, percentage };
|
|
125
|
+
};
|
|
126
|
+
var shouldShowHeader = (label, showPercentage, showHitCount) => {
|
|
127
|
+
return !!(label || showPercentage || showHitCount);
|
|
128
|
+
};
|
|
129
|
+
var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
|
|
130
|
+
if (showHitCount) {
|
|
131
|
+
return {
|
|
132
|
+
type: "hitCount",
|
|
133
|
+
content: `${Math.round(clampedValue)} de ${max}`,
|
|
134
|
+
hasMetrics: true
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (showPercentage) {
|
|
138
|
+
return {
|
|
139
|
+
type: "percentage",
|
|
140
|
+
content: `${Math.round(percentage)}%`,
|
|
141
|
+
hasMetrics: true
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
type: "label",
|
|
146
|
+
content: label,
|
|
147
|
+
hasMetrics: false
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
var getCompactLayoutConfig = ({
|
|
151
|
+
showPercentage,
|
|
152
|
+
showHitCount,
|
|
153
|
+
percentage,
|
|
154
|
+
clampedValue,
|
|
155
|
+
max,
|
|
156
|
+
label,
|
|
157
|
+
percentageClassName,
|
|
158
|
+
labelClassName
|
|
159
|
+
}) => {
|
|
160
|
+
const displayPriority = getDisplayPriority(
|
|
161
|
+
showHitCount,
|
|
162
|
+
showPercentage,
|
|
163
|
+
label,
|
|
164
|
+
clampedValue,
|
|
165
|
+
max,
|
|
166
|
+
percentage
|
|
167
|
+
);
|
|
168
|
+
return {
|
|
169
|
+
color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
|
|
170
|
+
className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
|
|
171
|
+
content: displayPriority.content
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
|
|
175
|
+
showHeader: size === "small" && !!(label || showPercentage),
|
|
176
|
+
showPercentage: size === "medium" && showPercentage,
|
|
177
|
+
showLabel: size === "medium" && !!label && !showPercentage
|
|
178
|
+
// Only show label when percentage is not shown
|
|
179
|
+
});
|
|
180
|
+
var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
|
|
181
|
+
if (!showHitCount && !showPercentage) return null;
|
|
182
|
+
const displayPriority = getDisplayPriority(
|
|
183
|
+
showHitCount,
|
|
184
|
+
showPercentage,
|
|
185
|
+
null,
|
|
186
|
+
// label is not relevant for stacked layout metrics display
|
|
187
|
+
clampedValue,
|
|
188
|
+
max,
|
|
189
|
+
percentage
|
|
190
|
+
);
|
|
191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
137
192
|
"div",
|
|
138
193
|
{
|
|
139
|
-
className: `
|
|
140
|
-
children: [
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
194
|
+
className: `text-xs font-medium leading-[14px] text-right ${percentageClassName}`,
|
|
195
|
+
children: displayPriority.type === "hitCount" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
196
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-success-200", children: Math.round(clampedValue) }),
|
|
197
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "text-text-600", children: [
|
|
198
|
+
" de ",
|
|
199
|
+
max
|
|
200
|
+
] })
|
|
201
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
|
|
202
|
+
Math.round(percentage),
|
|
203
|
+
"%"
|
|
204
|
+
] })
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
};
|
|
208
|
+
var ProgressBarBase = ({
|
|
209
|
+
clampedValue,
|
|
210
|
+
max,
|
|
211
|
+
percentage,
|
|
212
|
+
label,
|
|
213
|
+
variantClasses,
|
|
214
|
+
containerClassName,
|
|
215
|
+
fillClassName
|
|
216
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
217
|
+
"div",
|
|
218
|
+
{
|
|
219
|
+
className: `${containerClassName} ${variantClasses.background} overflow-hidden relative`,
|
|
220
|
+
children: [
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
222
|
+
"progress",
|
|
223
|
+
{
|
|
224
|
+
value: clampedValue,
|
|
225
|
+
max,
|
|
226
|
+
"aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
|
|
227
|
+
className: "absolute inset-0 w-full h-full opacity-0"
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
231
|
+
"div",
|
|
232
|
+
{
|
|
233
|
+
className: `${fillClassName} ${variantClasses.fill} transition-all duration-300 ease-out`,
|
|
234
|
+
style: { width: `${percentage}%` }
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
var StackedLayout = ({
|
|
241
|
+
className,
|
|
242
|
+
label,
|
|
243
|
+
showPercentage,
|
|
244
|
+
showHitCount,
|
|
245
|
+
labelClassName,
|
|
246
|
+
percentageClassName,
|
|
247
|
+
clampedValue,
|
|
248
|
+
max,
|
|
249
|
+
percentage,
|
|
250
|
+
variantClasses,
|
|
251
|
+
dimensions
|
|
252
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
253
|
+
"div",
|
|
254
|
+
{
|
|
255
|
+
className: `flex flex-col items-start gap-2 ${dimensions.width} ${dimensions.height} ${className}`,
|
|
256
|
+
children: [
|
|
257
|
+
shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
|
|
258
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
190
259
|
Text_default,
|
|
191
260
|
{
|
|
192
|
-
|
|
261
|
+
as: "div",
|
|
262
|
+
size: "md",
|
|
193
263
|
weight: "medium",
|
|
194
|
-
className: `text-text-
|
|
195
|
-
children:
|
|
196
|
-
Math.round(percentage),
|
|
197
|
-
"%"
|
|
198
|
-
]
|
|
264
|
+
className: `text-text-600 leading-[19px] ${labelClassName}`,
|
|
265
|
+
children: label
|
|
199
266
|
}
|
|
200
267
|
),
|
|
201
|
-
|
|
268
|
+
renderStackedHitCountDisplay(
|
|
269
|
+
showHitCount,
|
|
270
|
+
showPercentage,
|
|
271
|
+
clampedValue,
|
|
272
|
+
max,
|
|
273
|
+
percentage,
|
|
274
|
+
percentageClassName
|
|
275
|
+
)
|
|
276
|
+
] }),
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
278
|
+
ProgressBarBase,
|
|
279
|
+
{
|
|
280
|
+
clampedValue,
|
|
281
|
+
max,
|
|
282
|
+
percentage,
|
|
283
|
+
label,
|
|
284
|
+
variantClasses,
|
|
285
|
+
containerClassName: "w-full h-2 rounded-lg",
|
|
286
|
+
fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
var CompactLayout = ({
|
|
293
|
+
className,
|
|
294
|
+
label,
|
|
295
|
+
showPercentage,
|
|
296
|
+
showHitCount,
|
|
297
|
+
labelClassName,
|
|
298
|
+
percentageClassName,
|
|
299
|
+
clampedValue,
|
|
300
|
+
max,
|
|
301
|
+
percentage,
|
|
302
|
+
variantClasses,
|
|
303
|
+
dimensions
|
|
304
|
+
}) => {
|
|
305
|
+
const {
|
|
306
|
+
color,
|
|
307
|
+
className: compactClassName,
|
|
308
|
+
content
|
|
309
|
+
} = getCompactLayoutConfig({
|
|
310
|
+
showPercentage,
|
|
311
|
+
showHitCount,
|
|
312
|
+
percentage,
|
|
313
|
+
clampedValue,
|
|
314
|
+
max,
|
|
315
|
+
label,
|
|
316
|
+
percentageClassName,
|
|
317
|
+
labelClassName
|
|
318
|
+
});
|
|
319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
320
|
+
"div",
|
|
321
|
+
{
|
|
322
|
+
className: `flex flex-col items-start gap-1 ${dimensions.width} ${dimensions.height} ${className}`,
|
|
323
|
+
children: [
|
|
324
|
+
shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
202
325
|
Text_default,
|
|
203
326
|
{
|
|
204
327
|
as: "div",
|
|
205
|
-
size: "
|
|
328
|
+
size: "sm",
|
|
206
329
|
weight: "medium",
|
|
207
|
-
|
|
208
|
-
|
|
330
|
+
color,
|
|
331
|
+
className: `leading-4 w-full ${compactClassName}`,
|
|
332
|
+
children: content
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
336
|
+
ProgressBarBase,
|
|
337
|
+
{
|
|
338
|
+
clampedValue,
|
|
339
|
+
max,
|
|
340
|
+
percentage,
|
|
341
|
+
label,
|
|
342
|
+
variantClasses,
|
|
343
|
+
containerClassName: "w-full h-1 rounded-full",
|
|
344
|
+
fillClassName: "h-1 rounded-full"
|
|
209
345
|
}
|
|
210
346
|
)
|
|
211
347
|
]
|
|
212
348
|
}
|
|
213
349
|
);
|
|
214
350
|
};
|
|
351
|
+
var DefaultLayout = ({
|
|
352
|
+
className,
|
|
353
|
+
size,
|
|
354
|
+
sizeClasses,
|
|
355
|
+
variantClasses,
|
|
356
|
+
label,
|
|
357
|
+
showPercentage,
|
|
358
|
+
labelClassName,
|
|
359
|
+
percentageClassName,
|
|
360
|
+
clampedValue,
|
|
361
|
+
max,
|
|
362
|
+
percentage
|
|
363
|
+
}) => {
|
|
364
|
+
const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
|
|
365
|
+
const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
|
|
366
|
+
const displayConfig = getDefaultLayoutDisplayConfig(
|
|
367
|
+
size,
|
|
368
|
+
label,
|
|
369
|
+
showPercentage
|
|
370
|
+
);
|
|
371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `flex ${sizeClasses.layout} ${gapClass} ${className}`, children: [
|
|
372
|
+
displayConfig.showHeader && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-row items-center justify-between w-full", children: [
|
|
373
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
374
|
+
Text_default,
|
|
375
|
+
{
|
|
376
|
+
as: "div",
|
|
377
|
+
size: "xs",
|
|
378
|
+
weight: "medium",
|
|
379
|
+
className: `text-text-950 leading-none tracking-normal text-center ${labelClassName}`,
|
|
380
|
+
children: label
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
showPercentage && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
384
|
+
Text_default,
|
|
385
|
+
{
|
|
386
|
+
size: "xs",
|
|
387
|
+
weight: "medium",
|
|
388
|
+
className: `text-text-950 leading-none tracking-normal text-center ${percentageClassName}`,
|
|
389
|
+
children: [
|
|
390
|
+
Math.round(percentage),
|
|
391
|
+
"%"
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
] }),
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
397
|
+
ProgressBarBase,
|
|
398
|
+
{
|
|
399
|
+
clampedValue,
|
|
400
|
+
max,
|
|
401
|
+
percentage,
|
|
402
|
+
label,
|
|
403
|
+
variantClasses,
|
|
404
|
+
containerClassName: `${progressBarClass} ${sizeClasses.container} ${sizeClasses.borderRadius}`,
|
|
405
|
+
fillClassName: `${sizeClasses.bar} ${sizeClasses.borderRadius} shadow-hard-shadow-3`
|
|
406
|
+
}
|
|
407
|
+
),
|
|
408
|
+
displayConfig.showPercentage && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
409
|
+
Text_default,
|
|
410
|
+
{
|
|
411
|
+
size: "xs",
|
|
412
|
+
weight: "medium",
|
|
413
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none ${percentageClassName}`,
|
|
414
|
+
children: [
|
|
415
|
+
Math.round(percentage),
|
|
416
|
+
"%"
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
),
|
|
420
|
+
displayConfig.showLabel && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
421
|
+
Text_default,
|
|
422
|
+
{
|
|
423
|
+
as: "div",
|
|
424
|
+
size: "xs",
|
|
425
|
+
weight: "medium",
|
|
426
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none ${labelClassName}`,
|
|
427
|
+
children: label
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
] });
|
|
431
|
+
};
|
|
432
|
+
var ProgressBar = ({
|
|
433
|
+
value,
|
|
434
|
+
max = 100,
|
|
435
|
+
size = "medium",
|
|
436
|
+
variant = "blue",
|
|
437
|
+
layout = "default",
|
|
438
|
+
label,
|
|
439
|
+
showPercentage = false,
|
|
440
|
+
showHitCount = false,
|
|
441
|
+
className = "",
|
|
442
|
+
labelClassName = "",
|
|
443
|
+
percentageClassName = "",
|
|
444
|
+
stackedWidth,
|
|
445
|
+
stackedHeight,
|
|
446
|
+
compactWidth,
|
|
447
|
+
compactHeight
|
|
448
|
+
}) => {
|
|
449
|
+
const { clampedValue, percentage } = calculateProgressValues(value, max);
|
|
450
|
+
const sizeClasses = SIZE_CLASSES[size];
|
|
451
|
+
const variantClasses = VARIANT_CLASSES[variant];
|
|
452
|
+
if (layout === "stacked") {
|
|
453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
454
|
+
StackedLayout,
|
|
455
|
+
{
|
|
456
|
+
className,
|
|
457
|
+
label,
|
|
458
|
+
showPercentage,
|
|
459
|
+
showHitCount,
|
|
460
|
+
labelClassName,
|
|
461
|
+
percentageClassName,
|
|
462
|
+
clampedValue,
|
|
463
|
+
max,
|
|
464
|
+
percentage,
|
|
465
|
+
variantClasses,
|
|
466
|
+
dimensions: {
|
|
467
|
+
width: stackedWidth ?? "w-[380px]",
|
|
468
|
+
height: stackedHeight ?? "h-[35px]"
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
if (layout === "compact") {
|
|
474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
475
|
+
CompactLayout,
|
|
476
|
+
{
|
|
477
|
+
className,
|
|
478
|
+
label,
|
|
479
|
+
showPercentage,
|
|
480
|
+
showHitCount,
|
|
481
|
+
labelClassName,
|
|
482
|
+
percentageClassName,
|
|
483
|
+
clampedValue,
|
|
484
|
+
max,
|
|
485
|
+
percentage,
|
|
486
|
+
variantClasses,
|
|
487
|
+
dimensions: {
|
|
488
|
+
width: compactWidth ?? "w-[131px]",
|
|
489
|
+
height: compactHeight ?? "h-[24px]"
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
495
|
+
DefaultLayout,
|
|
496
|
+
{
|
|
497
|
+
className,
|
|
498
|
+
size,
|
|
499
|
+
sizeClasses,
|
|
500
|
+
variantClasses,
|
|
501
|
+
label,
|
|
502
|
+
showPercentage,
|
|
503
|
+
labelClassName,
|
|
504
|
+
percentageClassName,
|
|
505
|
+
clampedValue,
|
|
506
|
+
max,
|
|
507
|
+
percentage
|
|
508
|
+
}
|
|
509
|
+
);
|
|
510
|
+
};
|
|
215
511
|
var ProgressBar_default = ProgressBar;
|
|
216
512
|
//# sourceMappingURL=index.js.map
|