analytica-frontend-lib 1.0.20 → 1.0.22
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/index.css +103 -0
- package/dist/index.d.mts +71 -5
- package/dist/index.d.ts +71 -5
- package/dist/index.js +237 -93
- package/dist/index.mjs +235 -88
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
TableHeader: () => TableHeader,
|
|
43
43
|
TableRow: () => TableRow,
|
|
44
44
|
Text: () => Text,
|
|
45
|
+
TextArea: () => TextArea,
|
|
45
46
|
Toast: () => Toast,
|
|
46
47
|
Toaster: () => Toaster,
|
|
47
48
|
useToast: () => useToast,
|
|
@@ -207,14 +208,13 @@ var Text = ({
|
|
|
207
208
|
children,
|
|
208
209
|
size = "md",
|
|
209
210
|
weight = "normal",
|
|
210
|
-
color = "
|
|
211
|
+
color = "text-text-950",
|
|
211
212
|
as,
|
|
212
213
|
className = "",
|
|
213
214
|
...props
|
|
214
215
|
}) => {
|
|
215
216
|
let sizeClasses = "";
|
|
216
217
|
let weightClasses = "";
|
|
217
|
-
let colorClasses = "";
|
|
218
218
|
const sizeClassMap = {
|
|
219
219
|
"2xs": "text-2xs",
|
|
220
220
|
xs: "text-xs",
|
|
@@ -240,26 +240,152 @@ var Text = ({
|
|
|
240
240
|
black: "font-black"
|
|
241
241
|
};
|
|
242
242
|
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
243
|
-
const colorClassMap = {
|
|
244
|
-
white: "text-text",
|
|
245
|
-
black: "text-text-950"
|
|
246
|
-
};
|
|
247
|
-
colorClasses = colorClassMap[color] ?? colorClassMap.black;
|
|
248
243
|
const baseClasses = "font-primary";
|
|
249
244
|
const Component = as ?? "p";
|
|
250
245
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
251
246
|
Component,
|
|
252
247
|
{
|
|
253
|
-
className: `${baseClasses} ${sizeClasses} ${weightClasses} ${
|
|
248
|
+
className: `${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`,
|
|
254
249
|
...props,
|
|
255
250
|
children
|
|
256
251
|
}
|
|
257
252
|
);
|
|
258
253
|
};
|
|
259
254
|
|
|
255
|
+
// src/components/TextArea/TextArea.tsx
|
|
256
|
+
var import_react2 = require("react");
|
|
257
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
258
|
+
var SIZE_CLASSES2 = {
|
|
259
|
+
small: {
|
|
260
|
+
container: "w-72",
|
|
261
|
+
// 288px width
|
|
262
|
+
textarea: "h-24 text-sm",
|
|
263
|
+
// 96px height, 14px font
|
|
264
|
+
textSize: "sm"
|
|
265
|
+
},
|
|
266
|
+
medium: {
|
|
267
|
+
container: "w-72",
|
|
268
|
+
// 288px width
|
|
269
|
+
textarea: "h-24 text-base",
|
|
270
|
+
// 96px height, 16px font
|
|
271
|
+
textSize: "md"
|
|
272
|
+
},
|
|
273
|
+
large: {
|
|
274
|
+
container: "w-72",
|
|
275
|
+
// 288px width
|
|
276
|
+
textarea: "h-24 text-lg",
|
|
277
|
+
// 96px height, 18px font
|
|
278
|
+
textSize: "lg"
|
|
279
|
+
},
|
|
280
|
+
extraLarge: {
|
|
281
|
+
container: "w-72",
|
|
282
|
+
// 288px width
|
|
283
|
+
textarea: "h-24 text-xl",
|
|
284
|
+
// 96px height, 20px font
|
|
285
|
+
textSize: "xl"
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
var BASE_TEXTAREA_CLASSES = "w-full box-border p-3 bg-background border border-solid rounded-[4px] resize-none focus:outline-none font-roboto font-normal leading-[150%] placeholder:text-text-600 transition-all duration-200";
|
|
289
|
+
var STATE_CLASSES = {
|
|
290
|
+
default: {
|
|
291
|
+
base: "border-border-300 bg-background text-text-600",
|
|
292
|
+
hover: "hover:border-border-400",
|
|
293
|
+
focus: "focus:border-border-500"
|
|
294
|
+
},
|
|
295
|
+
hovered: {
|
|
296
|
+
base: "border-border-400 bg-background text-text-600",
|
|
297
|
+
hover: "",
|
|
298
|
+
focus: "focus:border-border-500"
|
|
299
|
+
},
|
|
300
|
+
focused: {
|
|
301
|
+
base: "border-2 border-primary-950 bg-background text-text-900",
|
|
302
|
+
hover: "",
|
|
303
|
+
focus: ""
|
|
304
|
+
},
|
|
305
|
+
invalid: {
|
|
306
|
+
base: "border-2 border-red-700 bg-white text-gray-800",
|
|
307
|
+
hover: "hover:border-red-700",
|
|
308
|
+
focus: "focus:border-red-700"
|
|
309
|
+
},
|
|
310
|
+
disabled: {
|
|
311
|
+
base: "border-border-300 bg-background text-text-600 cursor-not-allowed opacity-40",
|
|
312
|
+
hover: "",
|
|
313
|
+
focus: ""
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
var TextArea = (0, import_react2.forwardRef)(
|
|
317
|
+
({
|
|
318
|
+
label,
|
|
319
|
+
size = "medium",
|
|
320
|
+
state = "default",
|
|
321
|
+
errorMessage,
|
|
322
|
+
helperMessage,
|
|
323
|
+
className = "",
|
|
324
|
+
labelClassName = "",
|
|
325
|
+
disabled,
|
|
326
|
+
id,
|
|
327
|
+
onChange,
|
|
328
|
+
placeholder,
|
|
329
|
+
...props
|
|
330
|
+
}, ref) => {
|
|
331
|
+
const generatedId = (0, import_react2.useId)();
|
|
332
|
+
const inputId = id ?? `textarea-${generatedId}`;
|
|
333
|
+
const [isFocused, setIsFocused] = (0, import_react2.useState)(false);
|
|
334
|
+
const handleChange = (event) => {
|
|
335
|
+
onChange?.(event);
|
|
336
|
+
};
|
|
337
|
+
const handleFocus = (event) => {
|
|
338
|
+
setIsFocused(true);
|
|
339
|
+
props.onFocus?.(event);
|
|
340
|
+
};
|
|
341
|
+
const handleBlur = (event) => {
|
|
342
|
+
setIsFocused(false);
|
|
343
|
+
props.onBlur?.(event);
|
|
344
|
+
};
|
|
345
|
+
let currentState = disabled ? "disabled" : state;
|
|
346
|
+
if (isFocused && currentState !== "invalid" && currentState !== "disabled") {
|
|
347
|
+
currentState = "focused";
|
|
348
|
+
}
|
|
349
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
350
|
+
const stateClasses = STATE_CLASSES[currentState];
|
|
351
|
+
const textareaClasses = `${BASE_TEXTAREA_CLASSES} ${sizeClasses.textarea} ${stateClasses.base} ${stateClasses.hover} ${stateClasses.focus} ${className}`;
|
|
352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex flex-col ${sizeClasses.container}`, children: [
|
|
353
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
354
|
+
Text,
|
|
355
|
+
{
|
|
356
|
+
as: "label",
|
|
357
|
+
htmlFor: inputId,
|
|
358
|
+
size: sizeClasses.textSize,
|
|
359
|
+
weight: "medium",
|
|
360
|
+
color: "text-text-950",
|
|
361
|
+
className: `mb-1.5 ${labelClassName}`,
|
|
362
|
+
children: label
|
|
363
|
+
}
|
|
364
|
+
),
|
|
365
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
366
|
+
"textarea",
|
|
367
|
+
{
|
|
368
|
+
ref,
|
|
369
|
+
id: inputId,
|
|
370
|
+
disabled,
|
|
371
|
+
onChange: handleChange,
|
|
372
|
+
onFocus: handleFocus,
|
|
373
|
+
onBlur: handleBlur,
|
|
374
|
+
className: textareaClasses,
|
|
375
|
+
placeholder,
|
|
376
|
+
...props
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
|
|
380
|
+
helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperMessage })
|
|
381
|
+
] });
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
TextArea.displayName = "TextArea";
|
|
385
|
+
|
|
260
386
|
// src/components/Badge/Badge.tsx
|
|
261
387
|
var import_phosphor_react = require("phosphor-react");
|
|
262
|
-
var
|
|
388
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
263
389
|
var VARIANT_ACTION_CLASSES2 = {
|
|
264
390
|
solid: {
|
|
265
391
|
error: "bg-error text-error-700 focus-visible:outline-none",
|
|
@@ -287,7 +413,7 @@ var VARIANT_ACTION_CLASSES2 = {
|
|
|
287
413
|
},
|
|
288
414
|
notification: "text-primary"
|
|
289
415
|
};
|
|
290
|
-
var
|
|
416
|
+
var SIZE_CLASSES3 = {
|
|
291
417
|
small: "text-2xs px-2 py-1",
|
|
292
418
|
medium: "text-xs px-2 py-1",
|
|
293
419
|
large: "text-sm px-2 py-1"
|
|
@@ -308,21 +434,21 @@ var Badge = ({
|
|
|
308
434
|
notificationActive = false,
|
|
309
435
|
...props
|
|
310
436
|
}) => {
|
|
311
|
-
const sizeClasses =
|
|
437
|
+
const sizeClasses = SIZE_CLASSES3[size];
|
|
312
438
|
const sizeClassesIcon = SIZE_CLASSES_ICON[size];
|
|
313
439
|
const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
|
|
314
440
|
const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
|
|
315
441
|
const baseClasses = "inline-flex items-center justify-center rounded-xs font-medium gap-1 relative";
|
|
316
442
|
const baseClassesIcon = "flex items-center";
|
|
317
443
|
if (variant === "notification") {
|
|
318
|
-
return /* @__PURE__ */ (0,
|
|
444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
319
445
|
"div",
|
|
320
446
|
{
|
|
321
447
|
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
322
448
|
...props,
|
|
323
449
|
children: [
|
|
324
|
-
/* @__PURE__ */ (0,
|
|
325
|
-
notificationActive && /* @__PURE__ */ (0,
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react.Bell, { size: 24, className: "text-primary-950" }),
|
|
451
|
+
notificationActive && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
326
452
|
"span",
|
|
327
453
|
{
|
|
328
454
|
"data-testid": "notification-dot",
|
|
@@ -333,25 +459,25 @@ var Badge = ({
|
|
|
333
459
|
}
|
|
334
460
|
);
|
|
335
461
|
}
|
|
336
|
-
return /* @__PURE__ */ (0,
|
|
462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
337
463
|
"div",
|
|
338
464
|
{
|
|
339
465
|
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
340
466
|
...props,
|
|
341
467
|
children: [
|
|
342
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
468
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconLeft }),
|
|
343
469
|
children,
|
|
344
|
-
iconRight && /* @__PURE__ */ (0,
|
|
470
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconRight })
|
|
345
471
|
]
|
|
346
472
|
}
|
|
347
473
|
);
|
|
348
474
|
};
|
|
349
475
|
|
|
350
476
|
// src/components/CheckBox/CheckBox.tsx
|
|
351
|
-
var
|
|
477
|
+
var import_react3 = require("react");
|
|
352
478
|
var import_phosphor_react2 = require("phosphor-react");
|
|
353
|
-
var
|
|
354
|
-
var
|
|
479
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
480
|
+
var SIZE_CLASSES4 = {
|
|
355
481
|
small: {
|
|
356
482
|
checkbox: "w-4 h-4",
|
|
357
483
|
// 16px x 16px
|
|
@@ -388,7 +514,7 @@ var SIZE_CLASSES3 = {
|
|
|
388
514
|
}
|
|
389
515
|
};
|
|
390
516
|
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
391
|
-
var
|
|
517
|
+
var STATE_CLASSES2 = {
|
|
392
518
|
default: {
|
|
393
519
|
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
394
520
|
checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
|
|
@@ -410,7 +536,7 @@ var STATE_CLASSES = {
|
|
|
410
536
|
checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
|
|
411
537
|
}
|
|
412
538
|
};
|
|
413
|
-
var CheckBox = (0,
|
|
539
|
+
var CheckBox = (0, import_react3.forwardRef)(
|
|
414
540
|
({
|
|
415
541
|
label,
|
|
416
542
|
size = "medium",
|
|
@@ -426,9 +552,9 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
426
552
|
onChange,
|
|
427
553
|
...props
|
|
428
554
|
}, ref) => {
|
|
429
|
-
const generatedId = (0,
|
|
555
|
+
const generatedId = (0, import_react3.useId)();
|
|
430
556
|
const inputId = id ?? `checkbox-${generatedId}`;
|
|
431
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
557
|
+
const [internalChecked, setInternalChecked] = (0, import_react3.useState)(false);
|
|
432
558
|
const isControlled = checkedProp !== void 0;
|
|
433
559
|
const checked = isControlled ? checkedProp : internalChecked;
|
|
434
560
|
const handleChange = (event) => {
|
|
@@ -438,14 +564,14 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
438
564
|
onChange?.(event);
|
|
439
565
|
};
|
|
440
566
|
const currentState = disabled ? "disabled" : state;
|
|
441
|
-
const sizeClasses =
|
|
567
|
+
const sizeClasses = SIZE_CLASSES4[size];
|
|
442
568
|
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
443
|
-
const stylingClasses =
|
|
569
|
+
const stylingClasses = STATE_CLASSES2[currentState][checkVariant];
|
|
444
570
|
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
445
571
|
const checkboxClasses = `${BASE_CHECKBOX_CLASSES} ${sizeClasses.checkbox} ${borderWidthClass} ${stylingClasses} ${className}`;
|
|
446
572
|
const renderIcon = () => {
|
|
447
573
|
if (indeterminate) {
|
|
448
|
-
return /* @__PURE__ */ (0,
|
|
574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
449
575
|
import_phosphor_react2.Minus,
|
|
450
576
|
{
|
|
451
577
|
size: sizeClasses.iconSize,
|
|
@@ -455,7 +581,7 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
455
581
|
);
|
|
456
582
|
}
|
|
457
583
|
if (checked) {
|
|
458
|
-
return /* @__PURE__ */ (0,
|
|
584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
459
585
|
import_phosphor_react2.Check,
|
|
460
586
|
{
|
|
461
587
|
size: sizeClasses.iconSize,
|
|
@@ -466,13 +592,13 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
466
592
|
}
|
|
467
593
|
return null;
|
|
468
594
|
};
|
|
469
|
-
return /* @__PURE__ */ (0,
|
|
470
|
-
/* @__PURE__ */ (0,
|
|
595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col", children: [
|
|
596
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
471
597
|
"div",
|
|
472
598
|
{
|
|
473
599
|
className: `flex flex-row items-center ${sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
|
|
474
600
|
children: [
|
|
475
|
-
/* @__PURE__ */ (0,
|
|
601
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
476
602
|
"input",
|
|
477
603
|
{
|
|
478
604
|
ref,
|
|
@@ -485,19 +611,18 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
485
611
|
...props
|
|
486
612
|
}
|
|
487
613
|
),
|
|
488
|
-
/* @__PURE__ */ (0,
|
|
489
|
-
label && /* @__PURE__ */ (0,
|
|
614
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
615
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
490
616
|
"div",
|
|
491
617
|
{
|
|
492
618
|
className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
|
|
493
|
-
children: /* @__PURE__ */ (0,
|
|
619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
494
620
|
Text,
|
|
495
621
|
{
|
|
496
622
|
as: "label",
|
|
497
623
|
htmlFor: inputId,
|
|
498
624
|
size: sizeClasses.textSize,
|
|
499
625
|
weight: "normal",
|
|
500
|
-
color: "black",
|
|
501
626
|
className: `cursor-pointer select-none leading-[150%] flex items-center font-roboto ${labelClassName}`,
|
|
502
627
|
children: label
|
|
503
628
|
}
|
|
@@ -507,32 +632,50 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
507
632
|
]
|
|
508
633
|
}
|
|
509
634
|
),
|
|
510
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
511
|
-
|
|
635
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
636
|
+
Text,
|
|
637
|
+
{
|
|
638
|
+
size: "sm",
|
|
639
|
+
weight: "normal",
|
|
640
|
+
className: "mt-1.5",
|
|
641
|
+
color: "text-error-600",
|
|
642
|
+
children: errorMessage
|
|
643
|
+
}
|
|
644
|
+
),
|
|
645
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
646
|
+
Text,
|
|
647
|
+
{
|
|
648
|
+
size: "sm",
|
|
649
|
+
weight: "normal",
|
|
650
|
+
className: "mt-1.5",
|
|
651
|
+
color: "text-text-500",
|
|
652
|
+
children: helperText
|
|
653
|
+
}
|
|
654
|
+
)
|
|
512
655
|
] });
|
|
513
656
|
}
|
|
514
657
|
);
|
|
515
658
|
CheckBox.displayName = "CheckBox";
|
|
516
659
|
|
|
517
660
|
// src/components/Table/Table.tsx
|
|
518
|
-
var
|
|
519
|
-
var
|
|
520
|
-
var Table = (0,
|
|
521
|
-
({ className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
661
|
+
var import_react4 = require("react");
|
|
662
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
663
|
+
var Table = (0, import_react4.forwardRef)(
|
|
664
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
522
665
|
"table",
|
|
523
666
|
{
|
|
524
667
|
ref,
|
|
525
668
|
className: `w-full caption-bottom text-sm ${className ?? ""}`,
|
|
526
669
|
...props,
|
|
527
670
|
children: [
|
|
528
|
-
/* @__PURE__ */ (0,
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
529
672
|
children
|
|
530
673
|
]
|
|
531
674
|
}
|
|
532
675
|
) })
|
|
533
676
|
);
|
|
534
677
|
Table.displayName = "Table";
|
|
535
|
-
var TableHeader = (0,
|
|
678
|
+
var TableHeader = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
536
679
|
"thead",
|
|
537
680
|
{
|
|
538
681
|
ref,
|
|
@@ -541,7 +684,7 @@ var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) =
|
|
|
541
684
|
}
|
|
542
685
|
));
|
|
543
686
|
TableHeader.displayName = "TableHeader";
|
|
544
|
-
var TableBody = (0,
|
|
687
|
+
var TableBody = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
545
688
|
"tbody",
|
|
546
689
|
{
|
|
547
690
|
ref,
|
|
@@ -550,7 +693,7 @@ var TableBody = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
550
693
|
}
|
|
551
694
|
));
|
|
552
695
|
TableBody.displayName = "TableBody";
|
|
553
|
-
var TableFooter = (0,
|
|
696
|
+
var TableFooter = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
554
697
|
"tfoot",
|
|
555
698
|
{
|
|
556
699
|
ref,
|
|
@@ -565,9 +708,9 @@ var VARIANT_STATES_ROW = {
|
|
|
565
708
|
invalid: "border-b-2 border-indicator-error",
|
|
566
709
|
disabled: "border-b border-border-100 bg-background-50 opacity-50 cursor-not-allowed"
|
|
567
710
|
};
|
|
568
|
-
var TableRow = (0,
|
|
711
|
+
var TableRow = (0, import_react4.forwardRef)(
|
|
569
712
|
({ state = "default", className, ...props }, ref) => {
|
|
570
|
-
return /* @__PURE__ */ (0,
|
|
713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
571
714
|
"tr",
|
|
572
715
|
{
|
|
573
716
|
ref,
|
|
@@ -584,7 +727,7 @@ var TableRow = (0, import_react3.forwardRef)(
|
|
|
584
727
|
}
|
|
585
728
|
);
|
|
586
729
|
TableRow.displayName = "TableRow";
|
|
587
|
-
var TableHead = (0,
|
|
730
|
+
var TableHead = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
588
731
|
"th",
|
|
589
732
|
{
|
|
590
733
|
ref,
|
|
@@ -593,7 +736,7 @@ var TableHead = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
593
736
|
}
|
|
594
737
|
));
|
|
595
738
|
TableHead.displayName = "TableHead";
|
|
596
|
-
var TableCell = (0,
|
|
739
|
+
var TableCell = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
597
740
|
"td",
|
|
598
741
|
{
|
|
599
742
|
ref,
|
|
@@ -602,7 +745,7 @@ var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
602
745
|
}
|
|
603
746
|
));
|
|
604
747
|
TableCell.displayName = "TableCell";
|
|
605
|
-
var TableCaption = (0,
|
|
748
|
+
var TableCaption = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
606
749
|
"caption",
|
|
607
750
|
{
|
|
608
751
|
ref,
|
|
@@ -613,23 +756,23 @@ var TableCaption = (0, import_react3.forwardRef)(({ className, ...props }, ref)
|
|
|
613
756
|
TableCaption.displayName = "TableCaption";
|
|
614
757
|
|
|
615
758
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
616
|
-
var
|
|
617
|
-
var
|
|
618
|
-
var DropdownMenuContext = (0,
|
|
759
|
+
var import_react5 = require("react");
|
|
760
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
761
|
+
var DropdownMenuContext = (0, import_react5.createContext)(
|
|
619
762
|
void 0
|
|
620
763
|
);
|
|
621
764
|
var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
622
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
765
|
+
const [internalOpen, setInternalOpen] = (0, import_react5.useState)(false);
|
|
623
766
|
const isControlled = open !== void 0;
|
|
624
767
|
const currentOpen = isControlled ? open : internalOpen;
|
|
625
|
-
const setOpen = (0,
|
|
768
|
+
const setOpen = (0, import_react5.useCallback)(
|
|
626
769
|
(newOpen) => {
|
|
627
770
|
if (onOpenChange) onOpenChange(newOpen);
|
|
628
771
|
if (!isControlled) setInternalOpen(newOpen);
|
|
629
772
|
},
|
|
630
773
|
[isControlled, onOpenChange]
|
|
631
774
|
);
|
|
632
|
-
const menuRef = (0,
|
|
775
|
+
const menuRef = (0, import_react5.useRef)(null);
|
|
633
776
|
const handleArrowDownOrArrowUp = (event) => {
|
|
634
777
|
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
635
778
|
if (menuContent) {
|
|
@@ -663,7 +806,7 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
663
806
|
setOpen(false);
|
|
664
807
|
}
|
|
665
808
|
};
|
|
666
|
-
(0,
|
|
809
|
+
(0, import_react5.useEffect)(() => {
|
|
667
810
|
if (currentOpen) {
|
|
668
811
|
document.addEventListener("mousedown", handleClickOutside);
|
|
669
812
|
document.addEventListener("keydown", handleDownkey);
|
|
@@ -673,18 +816,18 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
673
816
|
document.removeEventListener("keydown", handleDownkey);
|
|
674
817
|
};
|
|
675
818
|
}, [currentOpen]);
|
|
676
|
-
const value = (0,
|
|
819
|
+
const value = (0, import_react5.useMemo)(
|
|
677
820
|
() => ({ open: currentOpen, setOpen }),
|
|
678
821
|
[currentOpen, setOpen]
|
|
679
822
|
);
|
|
680
|
-
return /* @__PURE__ */ (0,
|
|
823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative", ref: menuRef, children }) });
|
|
681
824
|
};
|
|
682
|
-
var DropdownMenuTrigger = (0,
|
|
683
|
-
const context = (0,
|
|
825
|
+
var DropdownMenuTrigger = (0, import_react5.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
826
|
+
const context = (0, import_react5.useContext)(DropdownMenuContext);
|
|
684
827
|
if (!context)
|
|
685
828
|
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
686
829
|
const { open, setOpen } = context;
|
|
687
|
-
return /* @__PURE__ */ (0,
|
|
830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
688
831
|
"button",
|
|
689
832
|
{
|
|
690
833
|
ref,
|
|
@@ -716,7 +859,7 @@ var ALIGN_CLASSES = {
|
|
|
716
859
|
center: "left-1/2 -translate-x-1/2",
|
|
717
860
|
end: "right-0"
|
|
718
861
|
};
|
|
719
|
-
var MenuLabel = (0,
|
|
862
|
+
var MenuLabel = (0, import_react5.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
720
863
|
"fieldset",
|
|
721
864
|
{
|
|
722
865
|
ref,
|
|
@@ -726,7 +869,7 @@ var MenuLabel = (0, import_react4.forwardRef)(({ className, inset, ...props }, r
|
|
|
726
869
|
}
|
|
727
870
|
));
|
|
728
871
|
MenuLabel.displayName = "MenuLabel";
|
|
729
|
-
var MenuContent = (0,
|
|
872
|
+
var MenuContent = (0, import_react5.forwardRef)(
|
|
730
873
|
({
|
|
731
874
|
className,
|
|
732
875
|
align = "start",
|
|
@@ -735,9 +878,9 @@ var MenuContent = (0, import_react4.forwardRef)(
|
|
|
735
878
|
children,
|
|
736
879
|
...props
|
|
737
880
|
}, ref) => {
|
|
738
|
-
const { open } = (0,
|
|
739
|
-
const [isVisible, setIsVisible] = (0,
|
|
740
|
-
(0,
|
|
881
|
+
const { open } = (0, import_react5.useContext)(DropdownMenuContext);
|
|
882
|
+
const [isVisible, setIsVisible] = (0, import_react5.useState)(open);
|
|
883
|
+
(0, import_react5.useEffect)(() => {
|
|
741
884
|
if (open) {
|
|
742
885
|
setIsVisible(true);
|
|
743
886
|
} else {
|
|
@@ -751,7 +894,7 @@ var MenuContent = (0, import_react4.forwardRef)(
|
|
|
751
894
|
const horizontal = ALIGN_CLASSES[align];
|
|
752
895
|
return `absolute ${vertical} ${horizontal}`;
|
|
753
896
|
};
|
|
754
|
-
return /* @__PURE__ */ (0,
|
|
897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
755
898
|
"div",
|
|
756
899
|
{
|
|
757
900
|
ref,
|
|
@@ -775,7 +918,7 @@ var MenuContent = (0, import_react4.forwardRef)(
|
|
|
775
918
|
}
|
|
776
919
|
);
|
|
777
920
|
MenuContent.displayName = "MenuContent";
|
|
778
|
-
var MenuItem = (0,
|
|
921
|
+
var MenuItem = (0, import_react5.forwardRef)(
|
|
779
922
|
({
|
|
780
923
|
className,
|
|
781
924
|
inset,
|
|
@@ -796,7 +939,7 @@ var MenuItem = (0, import_react4.forwardRef)(
|
|
|
796
939
|
}
|
|
797
940
|
onClick?.(e);
|
|
798
941
|
};
|
|
799
|
-
return /* @__PURE__ */ (0,
|
|
942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
800
943
|
"div",
|
|
801
944
|
{
|
|
802
945
|
ref,
|
|
@@ -826,7 +969,7 @@ var MenuItem = (0, import_react4.forwardRef)(
|
|
|
826
969
|
}
|
|
827
970
|
);
|
|
828
971
|
MenuItem.displayName = "MenuItem";
|
|
829
|
-
var MenuSeparator = (0,
|
|
972
|
+
var MenuSeparator = (0, import_react5.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
830
973
|
"div",
|
|
831
974
|
{
|
|
832
975
|
ref,
|
|
@@ -837,9 +980,9 @@ var MenuSeparator = (0, import_react4.forwardRef)(({ className, ...props }, ref)
|
|
|
837
980
|
MenuSeparator.displayName = "MenuSeparator";
|
|
838
981
|
|
|
839
982
|
// src/components/NavButton/NavButton.tsx
|
|
840
|
-
var
|
|
841
|
-
var
|
|
842
|
-
var NavButton = (0,
|
|
983
|
+
var import_react6 = require("react");
|
|
984
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
985
|
+
var NavButton = (0, import_react6.forwardRef)(
|
|
843
986
|
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
844
987
|
const baseClasses = [
|
|
845
988
|
"flex",
|
|
@@ -866,7 +1009,7 @@ var NavButton = (0, import_react5.forwardRef)(
|
|
|
866
1009
|
];
|
|
867
1010
|
const stateClasses = selected ? ["bg-primary-50", "text-primary-950"] : [];
|
|
868
1011
|
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
869
|
-
return /* @__PURE__ */ (0,
|
|
1012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
870
1013
|
"button",
|
|
871
1014
|
{
|
|
872
1015
|
ref,
|
|
@@ -876,8 +1019,8 @@ var NavButton = (0, import_react5.forwardRef)(
|
|
|
876
1019
|
"aria-pressed": selected,
|
|
877
1020
|
...props,
|
|
878
1021
|
children: [
|
|
879
|
-
/* @__PURE__ */ (0,
|
|
880
|
-
/* @__PURE__ */ (0,
|
|
1022
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex items-center justify-center w-5 h-5", children: icon }),
|
|
1023
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "whitespace-nowrap", children: label })
|
|
881
1024
|
]
|
|
882
1025
|
}
|
|
883
1026
|
);
|
|
@@ -886,9 +1029,9 @@ var NavButton = (0, import_react5.forwardRef)(
|
|
|
886
1029
|
NavButton.displayName = "NavButton";
|
|
887
1030
|
|
|
888
1031
|
// src/components/IconButton/IconButton.tsx
|
|
889
|
-
var
|
|
890
|
-
var
|
|
891
|
-
var IconButton = (0,
|
|
1032
|
+
var import_react7 = require("react");
|
|
1033
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1034
|
+
var IconButton = (0, import_react7.forwardRef)(
|
|
892
1035
|
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
893
1036
|
const baseClasses = [
|
|
894
1037
|
"inline-flex",
|
|
@@ -920,7 +1063,7 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
920
1063
|
...activeClasses
|
|
921
1064
|
].join(" ");
|
|
922
1065
|
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
923
|
-
return /* @__PURE__ */ (0,
|
|
1066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
924
1067
|
"button",
|
|
925
1068
|
{
|
|
926
1069
|
ref,
|
|
@@ -930,7 +1073,7 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
930
1073
|
"aria-pressed": active,
|
|
931
1074
|
"aria-label": ariaLabel,
|
|
932
1075
|
...props,
|
|
933
|
-
children: /* @__PURE__ */ (0,
|
|
1076
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex items-center justify-center", children: icon })
|
|
934
1077
|
}
|
|
935
1078
|
);
|
|
936
1079
|
}
|
|
@@ -939,7 +1082,7 @@ IconButton.displayName = "IconButton";
|
|
|
939
1082
|
|
|
940
1083
|
// src/components/Toast/Toast.tsx
|
|
941
1084
|
var import_phosphor_react3 = require("phosphor-react");
|
|
942
|
-
var
|
|
1085
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
943
1086
|
var VARIANT_ACTION_CLASSES3 = {
|
|
944
1087
|
solid: {
|
|
945
1088
|
warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
|
|
@@ -979,7 +1122,7 @@ var Toast = ({
|
|
|
979
1122
|
};
|
|
980
1123
|
const IconAction = iconMap[action] || iconMap["success"];
|
|
981
1124
|
const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
|
|
982
|
-
return /* @__PURE__ */ (0,
|
|
1125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
983
1126
|
"div",
|
|
984
1127
|
{
|
|
985
1128
|
role: "alert",
|
|
@@ -988,20 +1131,20 @@ var Toast = ({
|
|
|
988
1131
|
className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
|
|
989
1132
|
...props,
|
|
990
1133
|
children: [
|
|
991
|
-
/* @__PURE__ */ (0,
|
|
992
|
-
/* @__PURE__ */ (0,
|
|
993
|
-
/* @__PURE__ */ (0,
|
|
994
|
-
/* @__PURE__ */ (0,
|
|
995
|
-
description && /* @__PURE__ */ (0,
|
|
1134
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-row items-start gap-3", children: [
|
|
1135
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconAction, {}) }),
|
|
1136
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col items-start justify-start", children: [
|
|
1137
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "font-semibold text-md", children: title }),
|
|
1138
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-md text-text-900", children: description })
|
|
996
1139
|
] })
|
|
997
1140
|
] }),
|
|
998
|
-
/* @__PURE__ */ (0,
|
|
1141
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
999
1142
|
"button",
|
|
1000
1143
|
{
|
|
1001
1144
|
onClick: onClose,
|
|
1002
1145
|
"aria-label": "Dismiss notification",
|
|
1003
1146
|
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1004
|
-
children: /* @__PURE__ */ (0,
|
|
1147
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_phosphor_react3.X, {})
|
|
1005
1148
|
}
|
|
1006
1149
|
)
|
|
1007
1150
|
]
|
|
@@ -1027,11 +1170,11 @@ var useToastStore = (0, import_zustand.create)((set) => ({
|
|
|
1027
1170
|
}));
|
|
1028
1171
|
|
|
1029
1172
|
// src/components/Toast/utils/Toaster.tsx
|
|
1030
|
-
var
|
|
1173
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1031
1174
|
var Toaster = () => {
|
|
1032
1175
|
const toasts = useToastStore((state) => state.toasts);
|
|
1033
1176
|
const removeToast = useToastStore((state) => state.removeToast);
|
|
1034
|
-
return /* @__PURE__ */ (0,
|
|
1177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1035
1178
|
Toast,
|
|
1036
1179
|
{
|
|
1037
1180
|
title: toast.title,
|
|
@@ -1073,6 +1216,7 @@ var useToast = () => {
|
|
|
1073
1216
|
TableHeader,
|
|
1074
1217
|
TableRow,
|
|
1075
1218
|
Text,
|
|
1219
|
+
TextArea,
|
|
1076
1220
|
Toast,
|
|
1077
1221
|
Toaster,
|
|
1078
1222
|
useToast,
|