analytica-frontend-lib 1.1.94 → 1.1.95

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,608 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/StatisticsCard/StatisticsCard.tsx
21
+ var StatisticsCard_exports = {};
22
+ __export(StatisticsCard_exports, {
23
+ StatisticsCard: () => StatisticsCard
24
+ });
25
+ module.exports = __toCommonJS(StatisticsCard_exports);
26
+
27
+ // src/utils/utils.ts
28
+ var import_clsx = require("clsx");
29
+ var import_tailwind_merge = require("tailwind-merge");
30
+ function cn(...inputs) {
31
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
32
+ }
33
+
34
+ // src/components/Text/Text.tsx
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var Text = ({
37
+ children,
38
+ size = "md",
39
+ weight = "normal",
40
+ color = "text-text-950",
41
+ as,
42
+ className = "",
43
+ ...props
44
+ }) => {
45
+ let sizeClasses = "";
46
+ let weightClasses = "";
47
+ const sizeClassMap = {
48
+ "2xs": "text-2xs",
49
+ xs: "text-xs",
50
+ sm: "text-sm",
51
+ md: "text-md",
52
+ lg: "text-lg",
53
+ xl: "text-xl",
54
+ "2xl": "text-2xl",
55
+ "3xl": "text-3xl",
56
+ "4xl": "text-4xl",
57
+ "5xl": "text-5xl",
58
+ "6xl": "text-6xl"
59
+ };
60
+ sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
61
+ const weightClassMap = {
62
+ hairline: "font-hairline",
63
+ light: "font-light",
64
+ normal: "font-normal",
65
+ medium: "font-medium",
66
+ semibold: "font-semibold",
67
+ bold: "font-bold",
68
+ extrabold: "font-extrabold",
69
+ black: "font-black"
70
+ };
71
+ weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
72
+ const baseClasses = "font-primary";
73
+ const Component = as ?? "p";
74
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
+ Component,
76
+ {
77
+ className: cn(baseClasses, sizeClasses, weightClasses, color, className),
78
+ ...props,
79
+ children
80
+ }
81
+ );
82
+ };
83
+ var Text_default = Text;
84
+
85
+ // src/components/Button/Button.tsx
86
+ var import_jsx_runtime2 = require("react/jsx-runtime");
87
+ var VARIANT_ACTION_CLASSES = {
88
+ solid: {
89
+ 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",
90
+ 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",
91
+ 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"
92
+ },
93
+ outline: {
94
+ 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",
95
+ 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",
96
+ 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"
97
+ },
98
+ link: {
99
+ 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",
100
+ 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",
101
+ 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"
102
+ }
103
+ };
104
+ var SIZE_CLASSES = {
105
+ "extra-small": "text-xs px-3.5 py-2",
106
+ small: "text-sm px-4 py-2.5",
107
+ medium: "text-md px-5 py-2.5",
108
+ large: "text-lg px-6 py-3",
109
+ "extra-large": "text-lg px-7 py-3.5"
110
+ };
111
+ var Button = ({
112
+ children,
113
+ iconLeft,
114
+ iconRight,
115
+ size = "medium",
116
+ variant = "solid",
117
+ action = "primary",
118
+ className = "",
119
+ disabled,
120
+ type = "button",
121
+ ...props
122
+ }) => {
123
+ const sizeClasses = SIZE_CLASSES[size];
124
+ const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
125
+ const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
126
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
127
+ "button",
128
+ {
129
+ className: cn(baseClasses, variantClasses, sizeClasses, className),
130
+ disabled,
131
+ type,
132
+ ...props,
133
+ children: [
134
+ iconLeft && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mr-2 flex items-center", children: iconLeft }),
135
+ children,
136
+ iconRight && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ml-2 flex items-center", children: iconRight })
137
+ ]
138
+ }
139
+ );
140
+ };
141
+ var Button_default = Button;
142
+
143
+ // src/components/Select/Select.tsx
144
+ var import_zustand = require("zustand");
145
+ var import_react = require("react");
146
+ var import_phosphor_react = require("phosphor-react");
147
+ var import_jsx_runtime3 = require("react/jsx-runtime");
148
+ var VARIANT_CLASSES = {
149
+ outlined: "border-2 rounded-lg focus:border-primary-950",
150
+ underlined: "border-b-2 focus:border-primary-950",
151
+ rounded: "border-2 rounded-full focus:border-primary-950"
152
+ };
153
+ var SIZE_CLASSES2 = {
154
+ small: "text-sm",
155
+ medium: "text-md",
156
+ large: "text-lg",
157
+ "extra-large": "text-lg"
158
+ };
159
+ var HEIGHT_CLASSES = {
160
+ small: "h-8",
161
+ medium: "h-9",
162
+ large: "h-10",
163
+ "extra-large": "h-12"
164
+ };
165
+ var PADDING_CLASSES = {
166
+ small: "px-2 py-1",
167
+ medium: "px-3 py-2",
168
+ large: "px-4 py-3",
169
+ "extra-large": "px-5 py-4"
170
+ };
171
+ var SIDE_CLASSES = {
172
+ top: "bottom-full -translate-y-1",
173
+ right: "top-full translate-y-1",
174
+ bottom: "top-full translate-y-1",
175
+ left: "top-full translate-y-1"
176
+ };
177
+ var ALIGN_CLASSES = {
178
+ start: "left-0",
179
+ center: "left-1/2 -translate-x-1/2",
180
+ end: "right-0"
181
+ };
182
+ function createSelectStore(onValueChange) {
183
+ return (0, import_zustand.create)((set) => ({
184
+ open: false,
185
+ setOpen: (open) => set({ open }),
186
+ value: "",
187
+ setValue: (value) => set({ value }),
188
+ selectedLabel: "",
189
+ setSelectedLabel: (label) => set({ selectedLabel: label }),
190
+ onValueChange
191
+ }));
192
+ }
193
+ var useSelectStore = (externalStore) => {
194
+ if (!externalStore) {
195
+ throw new Error(
196
+ "Component must be used within a Select (store is missing)"
197
+ );
198
+ }
199
+ return externalStore;
200
+ };
201
+ function getLabelAsNode(children) {
202
+ if (typeof children === "string" || typeof children === "number") {
203
+ return children;
204
+ }
205
+ const flattened = import_react.Children.toArray(children);
206
+ if (flattened.length === 1) return flattened[0];
207
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: flattened });
208
+ }
209
+ var injectStore = (children, store, size, selectId) => {
210
+ return import_react.Children.map(children, (child) => {
211
+ if ((0, import_react.isValidElement)(child)) {
212
+ const typedChild = child;
213
+ const newProps = {
214
+ store
215
+ };
216
+ if (typedChild.type === SelectTrigger) {
217
+ newProps.size = size;
218
+ newProps.selectId = selectId;
219
+ }
220
+ if (typedChild.props.children) {
221
+ newProps.children = injectStore(
222
+ typedChild.props.children,
223
+ store,
224
+ size,
225
+ selectId
226
+ );
227
+ }
228
+ return (0, import_react.cloneElement)(typedChild, newProps);
229
+ }
230
+ return child;
231
+ });
232
+ };
233
+ var Select = ({
234
+ children,
235
+ defaultValue = "",
236
+ className,
237
+ value: propValue,
238
+ onValueChange,
239
+ size = "small",
240
+ label,
241
+ helperText,
242
+ errorMessage,
243
+ id
244
+ }) => {
245
+ const storeRef = (0, import_react.useRef)(null);
246
+ storeRef.current ??= createSelectStore(onValueChange);
247
+ const store = storeRef.current;
248
+ const selectRef = (0, import_react.useRef)(null);
249
+ const { open, setOpen, setValue, selectedLabel } = (0, import_zustand.useStore)(store, (s) => s);
250
+ const generatedId = (0, import_react.useId)();
251
+ const selectId = id ?? `select-${generatedId}`;
252
+ const findLabelForValue = (children2, targetValue) => {
253
+ let found = null;
254
+ const search = (nodes) => {
255
+ import_react.Children.forEach(nodes, (child) => {
256
+ if (!(0, import_react.isValidElement)(child)) return;
257
+ const typedChild = child;
258
+ if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
259
+ if (typeof typedChild.props.children === "string")
260
+ found = typedChild.props.children;
261
+ }
262
+ if (typedChild.props.children && !found)
263
+ search(typedChild.props.children);
264
+ });
265
+ };
266
+ search(children2);
267
+ return found;
268
+ };
269
+ (0, import_react.useEffect)(() => {
270
+ if (!selectedLabel && defaultValue) {
271
+ const label2 = findLabelForValue(children, defaultValue);
272
+ if (label2) store.setState({ selectedLabel: label2 });
273
+ }
274
+ }, [children, defaultValue, selectedLabel]);
275
+ (0, import_react.useEffect)(() => {
276
+ const handleClickOutside = (event) => {
277
+ if (selectRef.current && !selectRef.current.contains(event.target)) {
278
+ setOpen(false);
279
+ }
280
+ };
281
+ const handleArrowKeys = (event) => {
282
+ const selectContent = selectRef.current?.querySelector('[role="menu"]');
283
+ if (selectContent) {
284
+ event.preventDefault();
285
+ const items = Array.from(
286
+ selectContent.querySelectorAll(
287
+ '[role="menuitem"]:not([aria-disabled="true"])'
288
+ )
289
+ ).filter((el) => el instanceof HTMLElement);
290
+ const focused = document.activeElement;
291
+ const currentIndex = items.findIndex((item) => item === focused);
292
+ let nextIndex = 0;
293
+ if (event.key === "ArrowDown") {
294
+ nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
295
+ } else {
296
+ nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
297
+ }
298
+ items[nextIndex]?.focus();
299
+ }
300
+ };
301
+ if (open) {
302
+ document.addEventListener("mousedown", handleClickOutside);
303
+ document.addEventListener("keydown", handleArrowKeys);
304
+ }
305
+ return () => {
306
+ document.removeEventListener("mousedown", handleClickOutside);
307
+ document.removeEventListener("keydown", handleArrowKeys);
308
+ };
309
+ }, [open]);
310
+ (0, import_react.useEffect)(() => {
311
+ if (propValue) {
312
+ setValue(propValue);
313
+ const label2 = findLabelForValue(children, propValue);
314
+ if (label2) store.setState({ selectedLabel: label2 });
315
+ }
316
+ }, [propValue]);
317
+ const sizeClasses = SIZE_CLASSES2[size];
318
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cn("w-full", className), children: [
319
+ label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
320
+ "label",
321
+ {
322
+ htmlFor: selectId,
323
+ className: cn("block font-bold text-text-900 mb-1.5", sizeClasses),
324
+ children: label
325
+ }
326
+ ),
327
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: cn("relative w-full"), ref: selectRef, children: injectStore(children, store, size, selectId) }),
328
+ (helperText || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mt-1.5 gap-1.5", children: [
329
+ helperText && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-sm text-text-500", children: helperText }),
330
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "flex gap-1 items-center text-sm text-indicator-error", children: [
331
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.WarningCircle, { size: 16 }),
332
+ " ",
333
+ errorMessage
334
+ ] })
335
+ ] })
336
+ ] });
337
+ };
338
+ var SelectValue = ({
339
+ placeholder,
340
+ store: externalStore
341
+ }) => {
342
+ const store = useSelectStore(externalStore);
343
+ const selectedLabel = (0, import_zustand.useStore)(store, (s) => s.selectedLabel);
344
+ const value = (0, import_zustand.useStore)(store, (s) => s.value);
345
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-inherit flex gap-2 items-center", children: selectedLabel || placeholder || value });
346
+ };
347
+ var SelectTrigger = (0, import_react.forwardRef)(
348
+ ({
349
+ className,
350
+ invalid = false,
351
+ variant = "outlined",
352
+ store: externalStore,
353
+ disabled,
354
+ size = "medium",
355
+ selectId,
356
+ ...props
357
+ }, ref) => {
358
+ const store = useSelectStore(externalStore);
359
+ const open = (0, import_zustand.useStore)(store, (s) => s.open);
360
+ const toggleOpen = () => store.setState({ open: !open });
361
+ const variantClasses = VARIANT_CLASSES[variant];
362
+ const heightClasses = HEIGHT_CLASSES[size];
363
+ const paddingClasses = PADDING_CLASSES[size];
364
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
365
+ "button",
366
+ {
367
+ ref,
368
+ id: selectId,
369
+ className: cn(
370
+ "flex w-full items-center justify-between border-border-300",
371
+ heightClasses,
372
+ paddingClasses,
373
+ invalid && `${variant == "underlined" ? "border-b-2" : "border-2"} border-indicator-error text-text-600`,
374
+ disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground",
375
+ !invalid && !disabled ? "text-text-700" : "",
376
+ variantClasses,
377
+ className
378
+ ),
379
+ onClick: toggleOpen,
380
+ "aria-expanded": open,
381
+ "aria-haspopup": "listbox",
382
+ "aria-controls": open ? "select-content" : void 0,
383
+ ...props,
384
+ children: [
385
+ props.children,
386
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
387
+ import_phosphor_react.CaretDown,
388
+ {
389
+ className: cn(
390
+ "h-[1em] w-[1em] opacity-50 transition-transform",
391
+ open ? "rotate-180" : ""
392
+ )
393
+ }
394
+ )
395
+ ]
396
+ }
397
+ );
398
+ }
399
+ );
400
+ SelectTrigger.displayName = "SelectTrigger";
401
+ var SelectContent = (0, import_react.forwardRef)(
402
+ ({
403
+ children,
404
+ className,
405
+ align = "start",
406
+ side = "bottom",
407
+ store: externalStore,
408
+ ...props
409
+ }, ref) => {
410
+ const store = useSelectStore(externalStore);
411
+ const open = (0, import_zustand.useStore)(store, (s) => s.open);
412
+ if (!open) return null;
413
+ const getPositionClasses = () => `w-full min-w-full absolute ${SIDE_CLASSES[side]} ${ALIGN_CLASSES[align]}`;
414
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
415
+ "div",
416
+ {
417
+ role: "menu",
418
+ ref,
419
+ className: cn(
420
+ "bg-secondary z-50 min-w-[210px] max-h-[300px] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md border-border-100",
421
+ getPositionClasses(),
422
+ className
423
+ ),
424
+ ...props,
425
+ children
426
+ }
427
+ );
428
+ }
429
+ );
430
+ SelectContent.displayName = "SelectContent";
431
+ var SelectItem = (0, import_react.forwardRef)(
432
+ ({
433
+ className,
434
+ children,
435
+ value,
436
+ disabled = false,
437
+ store: externalStore,
438
+ ...props
439
+ }, ref) => {
440
+ const store = useSelectStore(externalStore);
441
+ const {
442
+ value: selectedValue,
443
+ setValue,
444
+ setOpen,
445
+ setSelectedLabel,
446
+ onValueChange
447
+ } = (0, import_zustand.useStore)(store, (s) => s);
448
+ const handleClick = (e) => {
449
+ const labelNode = getLabelAsNode(children);
450
+ if (!disabled) {
451
+ setValue(value);
452
+ setSelectedLabel(labelNode);
453
+ setOpen(false);
454
+ onValueChange?.(value);
455
+ }
456
+ props.onClick?.(e);
457
+ };
458
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
459
+ "div",
460
+ {
461
+ role: "menuitem",
462
+ "aria-disabled": disabled,
463
+ ref,
464
+ className: `
465
+ bg-secondary focus-visible:bg-background-50
466
+ relative flex select-none items-center gap-2 rounded-sm p-3 outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0
467
+ ${className}
468
+ ${disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
469
+ ${selectedValue === value && "bg-background-50"}
470
+ `,
471
+ onClick: handleClick,
472
+ onKeyDown: (e) => {
473
+ if (e.key === "Enter" || e.key === " ") handleClick(e);
474
+ },
475
+ tabIndex: disabled ? -1 : 0,
476
+ ...props,
477
+ children: [
478
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: selectedValue === value && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.Check, { className: "" }) }),
479
+ children
480
+ ]
481
+ }
482
+ );
483
+ }
484
+ );
485
+ SelectItem.displayName = "SelectItem";
486
+ var Select_default = Select;
487
+
488
+ // src/components/StatisticsCard/StatisticsCard.tsx
489
+ var import_phosphor_react2 = require("phosphor-react");
490
+ var import_jsx_runtime4 = require("react/jsx-runtime");
491
+ var VARIANT_STYLES = {
492
+ high: "bg-success-background",
493
+ medium: "bg-warning-background",
494
+ low: "bg-error-background",
495
+ total: "bg-info-background"
496
+ };
497
+ var VALUE_TEXT_COLORS = {
498
+ high: "text-success-700",
499
+ medium: "text-warning-600",
500
+ low: "text-error-700",
501
+ total: "text-info-700"
502
+ };
503
+ var StatCard = ({ item }) => {
504
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
505
+ "div",
506
+ {
507
+ className: `rounded-xl py-[17px] px-6 min-h-[105px] flex flex-col justify-center items-start gap-1 ${VARIANT_STYLES[item.variant]}`,
508
+ children: [
509
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
510
+ Text_default,
511
+ {
512
+ size: "4xl",
513
+ weight: "bold",
514
+ className: `${VALUE_TEXT_COLORS[item.variant]} leading-[42px] tracking-[0.2px] self-stretch`,
515
+ children: item.value
516
+ }
517
+ ),
518
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
519
+ Text_default,
520
+ {
521
+ size: "xs",
522
+ weight: "bold",
523
+ className: "uppercase text-[8px] leading-[9px] text-text-800 self-stretch",
524
+ children: item.label
525
+ }
526
+ )
527
+ ]
528
+ }
529
+ );
530
+ };
531
+ var StatisticsCard = ({
532
+ title,
533
+ data,
534
+ emptyStateMessage,
535
+ emptyStateButtonText,
536
+ onEmptyStateButtonClick,
537
+ dropdownOptions,
538
+ selectedDropdownValue,
539
+ onDropdownChange,
540
+ selectPlaceholder = "Selecione um per\xEDodo",
541
+ dropdownAriaLabel = "Filtro de per\xEDodo",
542
+ className = ""
543
+ }) => {
544
+ const hasData = data && data.length > 0;
545
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
546
+ "div",
547
+ {
548
+ className: `bg-background rounded-xl p-4 h-auto lg:h-[185px] flex flex-col gap-2 ${className}`,
549
+ children: [
550
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-row justify-between items-center gap-4", children: [
551
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text_default, { as: "h3", size: "sm", weight: "medium", color: "text-text-600", children: title }),
552
+ dropdownOptions && dropdownOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-[99px]", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
553
+ Select_default,
554
+ {
555
+ value: selectedDropdownValue,
556
+ onValueChange: onDropdownChange,
557
+ size: "medium",
558
+ children: [
559
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
560
+ SelectTrigger,
561
+ {
562
+ className: "border border-border-300 rounded whitespace-nowrap",
563
+ "aria-label": dropdownAriaLabel,
564
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SelectValue, { placeholder: selectPlaceholder })
565
+ }
566
+ ),
567
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SelectContent, { children: dropdownOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SelectItem, { value: option.value, children: option.label }, option.value)) })
568
+ ]
569
+ }
570
+ ) })
571
+ ] }),
572
+ hasData ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-[13px]", children: data.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
573
+ StatCard,
574
+ {
575
+ item
576
+ },
577
+ `${item.variant}-${item.label}-${index}`
578
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "border border-dashed border-border-300 rounded-lg p-6 min-h-[105px] flex flex-col items-center justify-center gap-2", children: [
579
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
580
+ Text_default,
581
+ {
582
+ size: "sm",
583
+ color: "text-text-600",
584
+ className: "text-center max-w-md",
585
+ children: emptyStateMessage
586
+ }
587
+ ),
588
+ onEmptyStateButtonClick && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
589
+ Button_default,
590
+ {
591
+ variant: "outline",
592
+ action: "primary",
593
+ size: "small",
594
+ onClick: onEmptyStateButtonClick,
595
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_phosphor_react2.Plus, { size: 16, weight: "bold" }),
596
+ children: emptyStateButtonText
597
+ }
598
+ )
599
+ ] })
600
+ ]
601
+ }
602
+ );
603
+ };
604
+ // Annotate the CommonJS export names for ESM import in node:
605
+ 0 && (module.exports = {
606
+ StatisticsCard
607
+ });
608
+ //# sourceMappingURL=index.js.map