analytica-frontend-lib 1.0.17 → 1.0.18
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 +92 -0
- package/dist/index.d.mts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +161 -40
- package/dist/index.mjs +153 -36
- package/package.json +5 -2
package/dist/index.css
CHANGED
|
@@ -78,22 +78,32 @@
|
|
|
78
78
|
--color-background-50: #f6f6f6;
|
|
79
79
|
--color-background-100: #f2f1f1;
|
|
80
80
|
--color-background-200: #dcdbdb;
|
|
81
|
+
--color-background-500: #8e8e8e;
|
|
81
82
|
--color-background-muted: #f7f8f7;
|
|
82
83
|
--color-border-50: #f3f3f3;
|
|
83
84
|
--color-border-100: #e6e6e6;
|
|
84
85
|
--color-border-200: #dddcdb;
|
|
85
86
|
--color-border-400: #a5a3a3;
|
|
86
87
|
--color-border-500: #8c8d8d;
|
|
88
|
+
--color-success: #e4fff4;
|
|
89
|
+
--color-success-200: #84d3a2;
|
|
87
90
|
--color-success-300: #66b584;
|
|
88
91
|
--color-success-400: #489766;
|
|
89
92
|
--color-success-500: #348352;
|
|
90
93
|
--color-success-600: #2a7948;
|
|
91
94
|
--color-success-700: #206f3e;
|
|
95
|
+
--color-success-800: #166534;
|
|
92
96
|
--color-error-300: #f87171;
|
|
93
97
|
--color-error-400: #ef4444;
|
|
94
98
|
--color-error-500: #e63535;
|
|
95
99
|
--color-error-600: #dc2626;
|
|
96
100
|
--color-error-700: #b91c1c;
|
|
101
|
+
--color-warning: #fff9f5;
|
|
102
|
+
--color-warning-200: #fecdaa;
|
|
103
|
+
--color-warning-800: #824417;
|
|
104
|
+
--color-info: #ecf8fe;
|
|
105
|
+
--color-info-200: #7ccff8;
|
|
106
|
+
--color-info-800: #075a83;
|
|
97
107
|
--color-indicator-primary: #373737;
|
|
98
108
|
--color-indicator-info: #5399ec;
|
|
99
109
|
--color-indicator-error: #b91c1c;
|
|
@@ -324,12 +334,21 @@
|
|
|
324
334
|
.relative {
|
|
325
335
|
position: relative;
|
|
326
336
|
}
|
|
337
|
+
.top-4 {
|
|
338
|
+
top: calc(var(--spacing) * 4);
|
|
339
|
+
}
|
|
327
340
|
.top-full {
|
|
328
341
|
top: 100%;
|
|
329
342
|
}
|
|
330
343
|
.right-0 {
|
|
331
344
|
right: calc(var(--spacing) * 0);
|
|
332
345
|
}
|
|
346
|
+
.right-4 {
|
|
347
|
+
right: calc(var(--spacing) * 4);
|
|
348
|
+
}
|
|
349
|
+
.bottom-4 {
|
|
350
|
+
bottom: calc(var(--spacing) * 4);
|
|
351
|
+
}
|
|
333
352
|
.bottom-full {
|
|
334
353
|
bottom: 100%;
|
|
335
354
|
}
|
|
@@ -339,6 +358,9 @@
|
|
|
339
358
|
.left-1\/2 {
|
|
340
359
|
left: calc(1/2 * 100%);
|
|
341
360
|
}
|
|
361
|
+
.left-4 {
|
|
362
|
+
left: calc(var(--spacing) * 4);
|
|
363
|
+
}
|
|
342
364
|
.z-50 {
|
|
343
365
|
z-index: 50;
|
|
344
366
|
}
|
|
@@ -369,6 +391,9 @@
|
|
|
369
391
|
.my-4 {
|
|
370
392
|
margin-block: calc(var(--spacing) * 4);
|
|
371
393
|
}
|
|
394
|
+
.mt-1 {
|
|
395
|
+
margin-top: calc(var(--spacing) * 1);
|
|
396
|
+
}
|
|
372
397
|
.mt-1\.5 {
|
|
373
398
|
margin-top: calc(var(--spacing) * 1.5);
|
|
374
399
|
}
|
|
@@ -453,6 +478,9 @@
|
|
|
453
478
|
.w-full {
|
|
454
479
|
width: 100%;
|
|
455
480
|
}
|
|
481
|
+
.max-w-\[390px\] {
|
|
482
|
+
max-width: 390px;
|
|
483
|
+
}
|
|
456
484
|
.min-w-\[210px\] {
|
|
457
485
|
min-width: 210px;
|
|
458
486
|
}
|
|
@@ -490,6 +518,12 @@
|
|
|
490
518
|
.items-end {
|
|
491
519
|
align-items: flex-end;
|
|
492
520
|
}
|
|
521
|
+
.items-start {
|
|
522
|
+
align-items: flex-start;
|
|
523
|
+
}
|
|
524
|
+
.justify-between {
|
|
525
|
+
justify-content: space-between;
|
|
526
|
+
}
|
|
493
527
|
.justify-center {
|
|
494
528
|
justify-content: center;
|
|
495
529
|
}
|
|
@@ -562,6 +596,10 @@
|
|
|
562
596
|
border-bottom-style: var(--tw-border-style);
|
|
563
597
|
border-bottom-width: 2px;
|
|
564
598
|
}
|
|
599
|
+
.border-none {
|
|
600
|
+
--tw-border-style: none;
|
|
601
|
+
border-style: none;
|
|
602
|
+
}
|
|
565
603
|
.border-background-200 {
|
|
566
604
|
border-color: var(--color-background-200);
|
|
567
605
|
}
|
|
@@ -598,6 +636,9 @@
|
|
|
598
636
|
.border-indicator-primary {
|
|
599
637
|
border-color: var(--color-indicator-primary);
|
|
600
638
|
}
|
|
639
|
+
.border-info-200 {
|
|
640
|
+
border-color: var(--color-info-200);
|
|
641
|
+
}
|
|
601
642
|
.border-primary-600 {
|
|
602
643
|
border-color: var(--color-primary-600);
|
|
603
644
|
}
|
|
@@ -607,12 +648,18 @@
|
|
|
607
648
|
.border-primary-950 {
|
|
608
649
|
border-color: var(--color-primary-950);
|
|
609
650
|
}
|
|
651
|
+
.border-success-200 {
|
|
652
|
+
border-color: var(--color-success-200);
|
|
653
|
+
}
|
|
610
654
|
.border-success-300 {
|
|
611
655
|
border-color: var(--color-success-300);
|
|
612
656
|
}
|
|
613
657
|
.border-success-500 {
|
|
614
658
|
border-color: var(--color-success-500);
|
|
615
659
|
}
|
|
660
|
+
.border-warning-200 {
|
|
661
|
+
border-color: var(--color-warning-200);
|
|
662
|
+
}
|
|
616
663
|
.\!bg-primary-50 {
|
|
617
664
|
background-color: var(--color-primary-50) !important;
|
|
618
665
|
}
|
|
@@ -631,6 +678,9 @@
|
|
|
631
678
|
.bg-error-500 {
|
|
632
679
|
background-color: var(--color-error-500);
|
|
633
680
|
}
|
|
681
|
+
.bg-info {
|
|
682
|
+
background-color: var(--color-info);
|
|
683
|
+
}
|
|
634
684
|
.bg-primary-50 {
|
|
635
685
|
background-color: var(--color-primary-50);
|
|
636
686
|
}
|
|
@@ -643,12 +693,18 @@
|
|
|
643
693
|
.bg-primary-950 {
|
|
644
694
|
background-color: var(--color-primary-950);
|
|
645
695
|
}
|
|
696
|
+
.bg-success {
|
|
697
|
+
background-color: var(--color-success);
|
|
698
|
+
}
|
|
646
699
|
.bg-success-500 {
|
|
647
700
|
background-color: var(--color-success-500);
|
|
648
701
|
}
|
|
649
702
|
.bg-transparent {
|
|
650
703
|
background-color: transparent;
|
|
651
704
|
}
|
|
705
|
+
.bg-warning {
|
|
706
|
+
background-color: var(--color-warning);
|
|
707
|
+
}
|
|
652
708
|
.p-1 {
|
|
653
709
|
padding: calc(var(--spacing) * 1);
|
|
654
710
|
}
|
|
@@ -802,18 +858,27 @@
|
|
|
802
858
|
.\!text-primary-950 {
|
|
803
859
|
color: var(--color-primary-950) !important;
|
|
804
860
|
}
|
|
861
|
+
.text-background-500 {
|
|
862
|
+
color: var(--color-background-500);
|
|
863
|
+
}
|
|
805
864
|
.text-error-500 {
|
|
806
865
|
color: var(--color-error-500);
|
|
807
866
|
}
|
|
808
867
|
.text-error-600 {
|
|
809
868
|
color: var(--color-error-600);
|
|
810
869
|
}
|
|
870
|
+
.text-info-800 {
|
|
871
|
+
color: var(--color-info-800);
|
|
872
|
+
}
|
|
811
873
|
.text-primary-950 {
|
|
812
874
|
color: var(--color-primary-950);
|
|
813
875
|
}
|
|
814
876
|
.text-success-500 {
|
|
815
877
|
color: var(--color-success-500);
|
|
816
878
|
}
|
|
879
|
+
.text-success-800 {
|
|
880
|
+
color: var(--color-success-800);
|
|
881
|
+
}
|
|
817
882
|
.text-text {
|
|
818
883
|
color: var(--color-text);
|
|
819
884
|
}
|
|
@@ -838,18 +903,33 @@
|
|
|
838
903
|
.text-text-950 {
|
|
839
904
|
color: var(--color-text-950);
|
|
840
905
|
}
|
|
906
|
+
.text-warning-800 {
|
|
907
|
+
color: var(--color-warning-800);
|
|
908
|
+
}
|
|
841
909
|
.capitalize {
|
|
842
910
|
text-transform: capitalize;
|
|
843
911
|
}
|
|
844
912
|
.italic {
|
|
845
913
|
font-style: italic;
|
|
846
914
|
}
|
|
915
|
+
.opacity-0 {
|
|
916
|
+
opacity: 0%;
|
|
917
|
+
}
|
|
847
918
|
.opacity-40 {
|
|
848
919
|
opacity: 40%;
|
|
849
920
|
}
|
|
850
921
|
.opacity-50 {
|
|
851
922
|
opacity: 50%;
|
|
852
923
|
}
|
|
924
|
+
.shadow-lg {
|
|
925
|
+
--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
|
926
|
+
box-shadow:
|
|
927
|
+
var(--tw-inset-shadow),
|
|
928
|
+
var(--tw-inset-ring-shadow),
|
|
929
|
+
var(--tw-ring-offset-shadow),
|
|
930
|
+
var(--tw-ring-shadow),
|
|
931
|
+
var(--tw-shadow);
|
|
932
|
+
}
|
|
853
933
|
.shadow-md {
|
|
854
934
|
--tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
|
855
935
|
box-shadow:
|
|
@@ -923,6 +1003,11 @@
|
|
|
923
1003
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
924
1004
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
925
1005
|
}
|
|
1006
|
+
.transition-opacity {
|
|
1007
|
+
transition-property: opacity;
|
|
1008
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
1009
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
1010
|
+
}
|
|
926
1011
|
.duration-200 {
|
|
927
1012
|
--tw-duration: 200ms;
|
|
928
1013
|
transition-duration: 200ms;
|
|
@@ -936,6 +1021,13 @@
|
|
|
936
1021
|
-moz-user-select: none;
|
|
937
1022
|
user-select: none;
|
|
938
1023
|
}
|
|
1024
|
+
.group-hover\:opacity-100 {
|
|
1025
|
+
&:is(:where(.group):hover *) {
|
|
1026
|
+
@media (hover: hover) {
|
|
1027
|
+
opacity: 100%;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
939
1031
|
.hover\:border-border-500 {
|
|
940
1032
|
&:hover {
|
|
941
1033
|
@media (hover: hover) {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithoutRef,
|
|
3
|
+
import { ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithoutRef, HTMLAttributes, InputHTMLAttributes, TdHTMLAttributes } from 'react';
|
|
4
|
+
import * as zustand from 'zustand';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Button component props interface
|
|
@@ -184,6 +185,41 @@ type TextProps<T extends ElementType = 'p'> = BaseTextProps & {
|
|
|
184
185
|
*/
|
|
185
186
|
declare const Text: <T extends ElementType = "p">({ children, size, weight, color, as, className, ...props }: TextProps<T>) => react_jsx_runtime.JSX.Element;
|
|
186
187
|
|
|
188
|
+
type ToastPosition$1 = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'default';
|
|
189
|
+
type ToastProps = {
|
|
190
|
+
title: string;
|
|
191
|
+
description?: string;
|
|
192
|
+
onClose: () => void;
|
|
193
|
+
/** Visual variant of the badge */
|
|
194
|
+
variant?: 'solid' | 'outlined';
|
|
195
|
+
/** Action type of the badge */
|
|
196
|
+
action?: 'warning' | 'success' | 'info';
|
|
197
|
+
position?: ToastPosition$1;
|
|
198
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
199
|
+
declare const Toast: ({ variant, action, className, onClose, title, description, position, ...props }: ToastProps) => react_jsx_runtime.JSX.Element;
|
|
200
|
+
|
|
201
|
+
type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'default';
|
|
202
|
+
type ToastData = {
|
|
203
|
+
id: string;
|
|
204
|
+
title: string;
|
|
205
|
+
description?: string;
|
|
206
|
+
variant?: 'solid' | 'outlined';
|
|
207
|
+
action?: 'warning' | 'success' | 'info';
|
|
208
|
+
position?: ToastPosition;
|
|
209
|
+
};
|
|
210
|
+
type ToastStore = {
|
|
211
|
+
toasts: ToastData[];
|
|
212
|
+
addToast: (toast: Omit<ToastData, 'id'>) => void;
|
|
213
|
+
removeToast: (id: string) => void;
|
|
214
|
+
};
|
|
215
|
+
declare const useToastStore: zustand.UseBoundStore<zustand.StoreApi<ToastStore>>;
|
|
216
|
+
|
|
217
|
+
declare const Toaster: () => react_jsx_runtime.JSX.Element;
|
|
218
|
+
declare const useToast: () => {
|
|
219
|
+
addToast: (toast: Omit<ToastData, "id">) => void;
|
|
220
|
+
removeToast: (id: string) => void;
|
|
221
|
+
};
|
|
222
|
+
|
|
187
223
|
/**
|
|
188
224
|
* CheckBox size variants
|
|
189
225
|
*/
|
|
@@ -418,4 +454,4 @@ declare const IconButton: react.ForwardRefExoticComponent<{
|
|
|
418
454
|
className?: string;
|
|
419
455
|
} & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
420
456
|
|
|
421
|
-
export { Button, CheckBox, type CheckBoxProps, DropdownMenu, DropdownMenuTrigger, IconButton, type IconButtonProps, IconRoundedButton, MenuContent, MenuItem, MenuLabel, MenuSeparator, NavButton, SelectionButton, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Text };
|
|
457
|
+
export { Button, CheckBox, type CheckBoxProps, DropdownMenu, DropdownMenuTrigger, IconButton, type IconButtonProps, IconRoundedButton, MenuContent, MenuItem, MenuLabel, MenuSeparator, NavButton, SelectionButton, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Text, Toast, type ToastData, Toaster, useToast, useToastStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithoutRef,
|
|
3
|
+
import { ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithoutRef, HTMLAttributes, InputHTMLAttributes, TdHTMLAttributes } from 'react';
|
|
4
|
+
import * as zustand from 'zustand';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Button component props interface
|
|
@@ -184,6 +185,41 @@ type TextProps<T extends ElementType = 'p'> = BaseTextProps & {
|
|
|
184
185
|
*/
|
|
185
186
|
declare const Text: <T extends ElementType = "p">({ children, size, weight, color, as, className, ...props }: TextProps<T>) => react_jsx_runtime.JSX.Element;
|
|
186
187
|
|
|
188
|
+
type ToastPosition$1 = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'default';
|
|
189
|
+
type ToastProps = {
|
|
190
|
+
title: string;
|
|
191
|
+
description?: string;
|
|
192
|
+
onClose: () => void;
|
|
193
|
+
/** Visual variant of the badge */
|
|
194
|
+
variant?: 'solid' | 'outlined';
|
|
195
|
+
/** Action type of the badge */
|
|
196
|
+
action?: 'warning' | 'success' | 'info';
|
|
197
|
+
position?: ToastPosition$1;
|
|
198
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
199
|
+
declare const Toast: ({ variant, action, className, onClose, title, description, position, ...props }: ToastProps) => react_jsx_runtime.JSX.Element;
|
|
200
|
+
|
|
201
|
+
type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'default';
|
|
202
|
+
type ToastData = {
|
|
203
|
+
id: string;
|
|
204
|
+
title: string;
|
|
205
|
+
description?: string;
|
|
206
|
+
variant?: 'solid' | 'outlined';
|
|
207
|
+
action?: 'warning' | 'success' | 'info';
|
|
208
|
+
position?: ToastPosition;
|
|
209
|
+
};
|
|
210
|
+
type ToastStore = {
|
|
211
|
+
toasts: ToastData[];
|
|
212
|
+
addToast: (toast: Omit<ToastData, 'id'>) => void;
|
|
213
|
+
removeToast: (id: string) => void;
|
|
214
|
+
};
|
|
215
|
+
declare const useToastStore: zustand.UseBoundStore<zustand.StoreApi<ToastStore>>;
|
|
216
|
+
|
|
217
|
+
declare const Toaster: () => react_jsx_runtime.JSX.Element;
|
|
218
|
+
declare const useToast: () => {
|
|
219
|
+
addToast: (toast: Omit<ToastData, "id">) => void;
|
|
220
|
+
removeToast: (id: string) => void;
|
|
221
|
+
};
|
|
222
|
+
|
|
187
223
|
/**
|
|
188
224
|
* CheckBox size variants
|
|
189
225
|
*/
|
|
@@ -418,4 +454,4 @@ declare const IconButton: react.ForwardRefExoticComponent<{
|
|
|
418
454
|
className?: string;
|
|
419
455
|
} & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
420
456
|
|
|
421
|
-
export { Button, CheckBox, type CheckBoxProps, DropdownMenu, DropdownMenuTrigger, IconButton, type IconButtonProps, IconRoundedButton, MenuContent, MenuItem, MenuLabel, MenuSeparator, NavButton, SelectionButton, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Text };
|
|
457
|
+
export { Button, CheckBox, type CheckBoxProps, DropdownMenu, DropdownMenuTrigger, IconButton, type IconButtonProps, IconRoundedButton, MenuContent, MenuItem, MenuLabel, MenuSeparator, NavButton, SelectionButton, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Text, Toast, type ToastData, Toaster, useToast, useToastStore };
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,11 @@ __export(index_exports, {
|
|
|
40
40
|
TableHead: () => TableHead,
|
|
41
41
|
TableHeader: () => TableHeader,
|
|
42
42
|
TableRow: () => TableRow,
|
|
43
|
-
Text: () => Text
|
|
43
|
+
Text: () => Text,
|
|
44
|
+
Toast: () => Toast,
|
|
45
|
+
Toaster: () => Toaster,
|
|
46
|
+
useToast: () => useToast,
|
|
47
|
+
useToastStore: () => useToastStore
|
|
44
48
|
});
|
|
45
49
|
module.exports = __toCommonJS(index_exports);
|
|
46
50
|
|
|
@@ -252,10 +256,123 @@ var Text = ({
|
|
|
252
256
|
);
|
|
253
257
|
};
|
|
254
258
|
|
|
255
|
-
// src/components/
|
|
256
|
-
var import_react2 = require("react");
|
|
259
|
+
// src/components/Toast/Toast.tsx
|
|
257
260
|
var import_phosphor_react = require("phosphor-react");
|
|
258
261
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
262
|
+
var VARIANT_ACTION_CLASSES2 = {
|
|
263
|
+
solid: {
|
|
264
|
+
warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
|
|
265
|
+
success: "bg-success text-success-800 border-none focus-visible:outline-none",
|
|
266
|
+
info: "bg-info text-info-800 border-none focus-visible:outline-none"
|
|
267
|
+
},
|
|
268
|
+
outlined: {
|
|
269
|
+
warning: "bg-warning text-warning-800 border border-warning-200 focus-visible:outline-none",
|
|
270
|
+
success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
|
|
271
|
+
info: "bg-info text-info-800 border border-info-200 focus-visible:outline-none"
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
var iconMap = {
|
|
275
|
+
success: import_phosphor_react.CheckCircle,
|
|
276
|
+
info: import_phosphor_react.Info,
|
|
277
|
+
warning: import_phosphor_react.WarningCircle
|
|
278
|
+
};
|
|
279
|
+
var Toast = ({
|
|
280
|
+
variant = "outlined",
|
|
281
|
+
action = "success",
|
|
282
|
+
className = "",
|
|
283
|
+
onClose,
|
|
284
|
+
title,
|
|
285
|
+
description,
|
|
286
|
+
position = "default",
|
|
287
|
+
...props
|
|
288
|
+
}) => {
|
|
289
|
+
const variantClasses = VARIANT_ACTION_CLASSES2[variant][action];
|
|
290
|
+
const positionClasses = {
|
|
291
|
+
"top-left": "fixed top-4 left-4",
|
|
292
|
+
"top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
|
|
293
|
+
"top-right": "fixed top-4 right-4",
|
|
294
|
+
"bottom-left": "fixed bottom-4 left-4",
|
|
295
|
+
"bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
|
|
296
|
+
"bottom-right": "fixed bottom-4 right-4",
|
|
297
|
+
default: ""
|
|
298
|
+
};
|
|
299
|
+
const IconAction = iconMap[action] || iconMap["success"];
|
|
300
|
+
const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
|
|
301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
role: "alert",
|
|
305
|
+
"aria-live": "assertive",
|
|
306
|
+
"aria-atomic": "true",
|
|
307
|
+
className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
|
|
308
|
+
...props,
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-row items-start gap-3", children: [
|
|
311
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconAction, {}) }),
|
|
312
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col items-start justify-start", children: [
|
|
313
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "font-semibold text-md", children: title }),
|
|
314
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-md text-text-900", children: description })
|
|
315
|
+
] })
|
|
316
|
+
] }),
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
318
|
+
"button",
|
|
319
|
+
{
|
|
320
|
+
onClick: onClose,
|
|
321
|
+
"aria-label": "Dismiss notification",
|
|
322
|
+
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
323
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react.X, {})
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// src/components/Toast/utils/ToastStore.ts
|
|
332
|
+
var import_zustand = require("zustand");
|
|
333
|
+
var useToastStore = (0, import_zustand.create)((set) => ({
|
|
334
|
+
toasts: [],
|
|
335
|
+
addToast: (toast) => {
|
|
336
|
+
const id = crypto.randomUUID();
|
|
337
|
+
set((state) => ({
|
|
338
|
+
toasts: [...state.toasts, { id, ...toast }]
|
|
339
|
+
}));
|
|
340
|
+
},
|
|
341
|
+
removeToast: (id) => {
|
|
342
|
+
set((state) => ({
|
|
343
|
+
toasts: state.toasts.filter((t) => t.id !== id)
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
}));
|
|
347
|
+
|
|
348
|
+
// src/components/Toast/utils/Toaster.tsx
|
|
349
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
350
|
+
var Toaster = () => {
|
|
351
|
+
const toasts = useToastStore((state) => state.toasts);
|
|
352
|
+
const removeToast = useToastStore((state) => state.removeToast);
|
|
353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
354
|
+
Toast,
|
|
355
|
+
{
|
|
356
|
+
title: toast.title,
|
|
357
|
+
description: toast.description,
|
|
358
|
+
variant: toast.variant,
|
|
359
|
+
action: toast.action,
|
|
360
|
+
position: toast.position,
|
|
361
|
+
onClose: () => removeToast(toast.id)
|
|
362
|
+
},
|
|
363
|
+
toast.id
|
|
364
|
+
)) });
|
|
365
|
+
};
|
|
366
|
+
var useToast = () => {
|
|
367
|
+
const addToast = useToastStore((state) => state.addToast);
|
|
368
|
+
const removeToast = useToastStore((state) => state.removeToast);
|
|
369
|
+
return { addToast, removeToast };
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
// src/components/CheckBox/CheckBox.tsx
|
|
373
|
+
var import_react2 = require("react");
|
|
374
|
+
var import_phosphor_react2 = require("phosphor-react");
|
|
375
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
259
376
|
var SIZE_CLASSES2 = {
|
|
260
377
|
small: {
|
|
261
378
|
checkbox: "w-4 h-4",
|
|
@@ -350,8 +467,8 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
350
467
|
const checkboxClasses = `${BASE_CHECKBOX_CLASSES} ${sizeClasses.checkbox} ${borderWidthClass} ${stylingClasses} ${className}`;
|
|
351
468
|
const renderIcon = () => {
|
|
352
469
|
if (indeterminate) {
|
|
353
|
-
return /* @__PURE__ */ (0,
|
|
354
|
-
|
|
470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
471
|
+
import_phosphor_react2.Minus,
|
|
355
472
|
{
|
|
356
473
|
size: sizeClasses.iconSize,
|
|
357
474
|
weight: "bold",
|
|
@@ -360,8 +477,8 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
360
477
|
);
|
|
361
478
|
}
|
|
362
479
|
if (checked) {
|
|
363
|
-
return /* @__PURE__ */ (0,
|
|
364
|
-
|
|
480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
481
|
+
import_phosphor_react2.Check,
|
|
365
482
|
{
|
|
366
483
|
size: sizeClasses.iconSize,
|
|
367
484
|
weight: "bold",
|
|
@@ -371,13 +488,13 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
371
488
|
}
|
|
372
489
|
return null;
|
|
373
490
|
};
|
|
374
|
-
return /* @__PURE__ */ (0,
|
|
375
|
-
/* @__PURE__ */ (0,
|
|
491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col", children: [
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
376
493
|
"div",
|
|
377
494
|
{
|
|
378
495
|
className: `flex flex-row items-center ${sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
|
|
379
496
|
children: [
|
|
380
|
-
/* @__PURE__ */ (0,
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
381
498
|
"input",
|
|
382
499
|
{
|
|
383
500
|
ref,
|
|
@@ -390,12 +507,12 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
390
507
|
...props
|
|
391
508
|
}
|
|
392
509
|
),
|
|
393
|
-
/* @__PURE__ */ (0,
|
|
394
|
-
label && /* @__PURE__ */ (0,
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
511
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
395
512
|
"div",
|
|
396
513
|
{
|
|
397
514
|
className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
|
|
398
|
-
children: /* @__PURE__ */ (0,
|
|
515
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
399
516
|
Text,
|
|
400
517
|
{
|
|
401
518
|
as: "label",
|
|
@@ -412,8 +529,8 @@ var CheckBox = (0, import_react2.forwardRef)(
|
|
|
412
529
|
]
|
|
413
530
|
}
|
|
414
531
|
),
|
|
415
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
416
|
-
helperText && !errorMessage && /* @__PURE__ */ (0,
|
|
532
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
|
|
533
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperText })
|
|
417
534
|
] });
|
|
418
535
|
}
|
|
419
536
|
);
|
|
@@ -421,23 +538,23 @@ CheckBox.displayName = "CheckBox";
|
|
|
421
538
|
|
|
422
539
|
// src/components/Table/Table.tsx
|
|
423
540
|
var import_react3 = require("react");
|
|
424
|
-
var
|
|
541
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
425
542
|
var Table = (0, import_react3.forwardRef)(
|
|
426
|
-
({ className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
543
|
+
({ 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)(
|
|
427
544
|
"table",
|
|
428
545
|
{
|
|
429
546
|
ref,
|
|
430
547
|
className: `w-full caption-bottom text-sm ${className ?? ""}`,
|
|
431
548
|
...props,
|
|
432
549
|
children: [
|
|
433
|
-
/* @__PURE__ */ (0,
|
|
550
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
434
551
|
children
|
|
435
552
|
]
|
|
436
553
|
}
|
|
437
554
|
) })
|
|
438
555
|
);
|
|
439
556
|
Table.displayName = "Table";
|
|
440
|
-
var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
557
|
+
var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
441
558
|
"thead",
|
|
442
559
|
{
|
|
443
560
|
ref,
|
|
@@ -446,7 +563,7 @@ var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) =
|
|
|
446
563
|
}
|
|
447
564
|
));
|
|
448
565
|
TableHeader.displayName = "TableHeader";
|
|
449
|
-
var TableBody = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
566
|
+
var TableBody = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
450
567
|
"tbody",
|
|
451
568
|
{
|
|
452
569
|
ref,
|
|
@@ -455,7 +572,7 @@ var TableBody = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
455
572
|
}
|
|
456
573
|
));
|
|
457
574
|
TableBody.displayName = "TableBody";
|
|
458
|
-
var TableFooter = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
575
|
+
var TableFooter = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
459
576
|
"tfoot",
|
|
460
577
|
{
|
|
461
578
|
ref,
|
|
@@ -472,7 +589,7 @@ var VARIANT_STATES_ROW = {
|
|
|
472
589
|
};
|
|
473
590
|
var TableRow = (0, import_react3.forwardRef)(
|
|
474
591
|
({ state = "default", className, ...props }, ref) => {
|
|
475
|
-
return /* @__PURE__ */ (0,
|
|
592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
476
593
|
"tr",
|
|
477
594
|
{
|
|
478
595
|
ref,
|
|
@@ -489,7 +606,7 @@ var TableRow = (0, import_react3.forwardRef)(
|
|
|
489
606
|
}
|
|
490
607
|
);
|
|
491
608
|
TableRow.displayName = "TableRow";
|
|
492
|
-
var TableHead = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
609
|
+
var TableHead = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
493
610
|
"th",
|
|
494
611
|
{
|
|
495
612
|
ref,
|
|
@@ -498,7 +615,7 @@ var TableHead = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
498
615
|
}
|
|
499
616
|
));
|
|
500
617
|
TableHead.displayName = "TableHead";
|
|
501
|
-
var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
618
|
+
var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
502
619
|
"td",
|
|
503
620
|
{
|
|
504
621
|
ref,
|
|
@@ -507,7 +624,7 @@ var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) =>
|
|
|
507
624
|
}
|
|
508
625
|
));
|
|
509
626
|
TableCell.displayName = "TableCell";
|
|
510
|
-
var TableCaption = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
627
|
+
var TableCaption = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
511
628
|
"caption",
|
|
512
629
|
{
|
|
513
630
|
ref,
|
|
@@ -519,7 +636,7 @@ TableCaption.displayName = "TableCaption";
|
|
|
519
636
|
|
|
520
637
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
521
638
|
var import_react4 = require("react");
|
|
522
|
-
var
|
|
639
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
523
640
|
var DropdownMenuContext = (0, import_react4.createContext)(
|
|
524
641
|
void 0
|
|
525
642
|
);
|
|
@@ -559,14 +676,14 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
559
676
|
() => ({ open: currentOpen, setOpen }),
|
|
560
677
|
[currentOpen, setOpen]
|
|
561
678
|
);
|
|
562
|
-
return /* @__PURE__ */ (0,
|
|
679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative", ref: menuRef, children }) });
|
|
563
680
|
};
|
|
564
681
|
var DropdownMenuTrigger = (0, import_react4.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
565
682
|
const context = (0, import_react4.useContext)(DropdownMenuContext);
|
|
566
683
|
if (!context)
|
|
567
684
|
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
568
685
|
const { open, setOpen } = context;
|
|
569
|
-
return /* @__PURE__ */ (0,
|
|
686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
570
687
|
"button",
|
|
571
688
|
{
|
|
572
689
|
ref,
|
|
@@ -598,7 +715,7 @@ var ALIGN_CLASSES = {
|
|
|
598
715
|
center: "left-1/2 -translate-x-1/2",
|
|
599
716
|
end: "right-0"
|
|
600
717
|
};
|
|
601
|
-
var MenuLabel = (0, import_react4.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0,
|
|
718
|
+
var MenuLabel = (0, import_react4.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
602
719
|
"fieldset",
|
|
603
720
|
{
|
|
604
721
|
ref,
|
|
@@ -633,7 +750,7 @@ var MenuContent = (0, import_react4.forwardRef)(
|
|
|
633
750
|
const horizontal = ALIGN_CLASSES[align];
|
|
634
751
|
return `absolute ${vertical} ${horizontal}`;
|
|
635
752
|
};
|
|
636
|
-
return /* @__PURE__ */ (0,
|
|
753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
637
754
|
"div",
|
|
638
755
|
{
|
|
639
756
|
ref,
|
|
@@ -678,7 +795,7 @@ var MenuItem = (0, import_react4.forwardRef)(
|
|
|
678
795
|
}
|
|
679
796
|
onClick?.(e);
|
|
680
797
|
};
|
|
681
|
-
return /* @__PURE__ */ (0,
|
|
798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
682
799
|
"div",
|
|
683
800
|
{
|
|
684
801
|
ref,
|
|
@@ -707,7 +824,7 @@ var MenuItem = (0, import_react4.forwardRef)(
|
|
|
707
824
|
}
|
|
708
825
|
);
|
|
709
826
|
MenuItem.displayName = "MenuItem";
|
|
710
|
-
var MenuSeparator = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
827
|
+
var MenuSeparator = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
711
828
|
"div",
|
|
712
829
|
{
|
|
713
830
|
ref,
|
|
@@ -719,7 +836,7 @@ MenuSeparator.displayName = "MenuSeparator";
|
|
|
719
836
|
|
|
720
837
|
// src/components/NavButton/NavButton.tsx
|
|
721
838
|
var import_react5 = require("react");
|
|
722
|
-
var
|
|
839
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
723
840
|
var NavButton = (0, import_react5.forwardRef)(
|
|
724
841
|
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
725
842
|
const baseClasses = [
|
|
@@ -747,7 +864,7 @@ var NavButton = (0, import_react5.forwardRef)(
|
|
|
747
864
|
];
|
|
748
865
|
const stateClasses = selected ? ["bg-primary-50", "text-primary-950"] : [];
|
|
749
866
|
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
750
|
-
return /* @__PURE__ */ (0,
|
|
867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
751
868
|
"button",
|
|
752
869
|
{
|
|
753
870
|
ref,
|
|
@@ -757,8 +874,8 @@ var NavButton = (0, import_react5.forwardRef)(
|
|
|
757
874
|
"aria-pressed": selected,
|
|
758
875
|
...props,
|
|
759
876
|
children: [
|
|
760
|
-
/* @__PURE__ */ (0,
|
|
761
|
-
/* @__PURE__ */ (0,
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex items-center justify-center w-5 h-5", children: icon }),
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "whitespace-nowrap", children: label })
|
|
762
879
|
]
|
|
763
880
|
}
|
|
764
881
|
);
|
|
@@ -768,7 +885,7 @@ NavButton.displayName = "NavButton";
|
|
|
768
885
|
|
|
769
886
|
// src/components/IconButton/IconButton.tsx
|
|
770
887
|
var import_react6 = require("react");
|
|
771
|
-
var
|
|
888
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
772
889
|
var IconButton = (0, import_react6.forwardRef)(
|
|
773
890
|
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
774
891
|
const baseClasses = [
|
|
@@ -801,7 +918,7 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
801
918
|
...activeClasses
|
|
802
919
|
].join(" ");
|
|
803
920
|
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
804
|
-
return /* @__PURE__ */ (0,
|
|
921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
805
922
|
"button",
|
|
806
923
|
{
|
|
807
924
|
ref,
|
|
@@ -811,7 +928,7 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
811
928
|
"aria-pressed": active,
|
|
812
929
|
"aria-label": ariaLabel,
|
|
813
930
|
...props,
|
|
814
|
-
children: /* @__PURE__ */ (0,
|
|
931
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex items-center justify-center", children: icon })
|
|
815
932
|
}
|
|
816
933
|
);
|
|
817
934
|
}
|
|
@@ -839,5 +956,9 @@ IconButton.displayName = "IconButton";
|
|
|
839
956
|
TableHead,
|
|
840
957
|
TableHeader,
|
|
841
958
|
TableRow,
|
|
842
|
-
Text
|
|
959
|
+
Text,
|
|
960
|
+
Toast,
|
|
961
|
+
Toaster,
|
|
962
|
+
useToast,
|
|
963
|
+
useToastStore
|
|
843
964
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -206,6 +206,119 @@ var Text = ({
|
|
|
206
206
|
);
|
|
207
207
|
};
|
|
208
208
|
|
|
209
|
+
// src/components/Toast/Toast.tsx
|
|
210
|
+
import { CheckCircle, WarningCircle, Info, X } from "phosphor-react";
|
|
211
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
212
|
+
var VARIANT_ACTION_CLASSES2 = {
|
|
213
|
+
solid: {
|
|
214
|
+
warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
|
|
215
|
+
success: "bg-success text-success-800 border-none focus-visible:outline-none",
|
|
216
|
+
info: "bg-info text-info-800 border-none focus-visible:outline-none"
|
|
217
|
+
},
|
|
218
|
+
outlined: {
|
|
219
|
+
warning: "bg-warning text-warning-800 border border-warning-200 focus-visible:outline-none",
|
|
220
|
+
success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
|
|
221
|
+
info: "bg-info text-info-800 border border-info-200 focus-visible:outline-none"
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
var iconMap = {
|
|
225
|
+
success: CheckCircle,
|
|
226
|
+
info: Info,
|
|
227
|
+
warning: WarningCircle
|
|
228
|
+
};
|
|
229
|
+
var Toast = ({
|
|
230
|
+
variant = "outlined",
|
|
231
|
+
action = "success",
|
|
232
|
+
className = "",
|
|
233
|
+
onClose,
|
|
234
|
+
title,
|
|
235
|
+
description,
|
|
236
|
+
position = "default",
|
|
237
|
+
...props
|
|
238
|
+
}) => {
|
|
239
|
+
const variantClasses = VARIANT_ACTION_CLASSES2[variant][action];
|
|
240
|
+
const positionClasses = {
|
|
241
|
+
"top-left": "fixed top-4 left-4",
|
|
242
|
+
"top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
|
|
243
|
+
"top-right": "fixed top-4 right-4",
|
|
244
|
+
"bottom-left": "fixed bottom-4 left-4",
|
|
245
|
+
"bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
|
|
246
|
+
"bottom-right": "fixed bottom-4 right-4",
|
|
247
|
+
default: ""
|
|
248
|
+
};
|
|
249
|
+
const IconAction = iconMap[action] || iconMap["success"];
|
|
250
|
+
const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
|
|
251
|
+
return /* @__PURE__ */ jsxs3(
|
|
252
|
+
"div",
|
|
253
|
+
{
|
|
254
|
+
role: "alert",
|
|
255
|
+
"aria-live": "assertive",
|
|
256
|
+
"aria-atomic": "true",
|
|
257
|
+
className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
|
|
258
|
+
...props,
|
|
259
|
+
children: [
|
|
260
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-row items-start gap-3", children: [
|
|
261
|
+
/* @__PURE__ */ jsx5("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ jsx5(IconAction, {}) }),
|
|
262
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-start justify-start", children: [
|
|
263
|
+
/* @__PURE__ */ jsx5("p", { className: "font-semibold text-md", children: title }),
|
|
264
|
+
description && /* @__PURE__ */ jsx5("p", { className: "text-md text-text-900", children: description })
|
|
265
|
+
] })
|
|
266
|
+
] }),
|
|
267
|
+
/* @__PURE__ */ jsx5(
|
|
268
|
+
"button",
|
|
269
|
+
{
|
|
270
|
+
onClick: onClose,
|
|
271
|
+
"aria-label": "Dismiss notification",
|
|
272
|
+
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
273
|
+
children: /* @__PURE__ */ jsx5(X, {})
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// src/components/Toast/utils/ToastStore.ts
|
|
282
|
+
import { create } from "zustand";
|
|
283
|
+
var useToastStore = create((set) => ({
|
|
284
|
+
toasts: [],
|
|
285
|
+
addToast: (toast) => {
|
|
286
|
+
const id = crypto.randomUUID();
|
|
287
|
+
set((state) => ({
|
|
288
|
+
toasts: [...state.toasts, { id, ...toast }]
|
|
289
|
+
}));
|
|
290
|
+
},
|
|
291
|
+
removeToast: (id) => {
|
|
292
|
+
set((state) => ({
|
|
293
|
+
toasts: state.toasts.filter((t) => t.id !== id)
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
296
|
+
}));
|
|
297
|
+
|
|
298
|
+
// src/components/Toast/utils/Toaster.tsx
|
|
299
|
+
import { Fragment, jsx as jsx6 } from "react/jsx-runtime";
|
|
300
|
+
var Toaster = () => {
|
|
301
|
+
const toasts = useToastStore((state) => state.toasts);
|
|
302
|
+
const removeToast = useToastStore((state) => state.removeToast);
|
|
303
|
+
return /* @__PURE__ */ jsx6(Fragment, { children: toasts.map((toast) => /* @__PURE__ */ jsx6(
|
|
304
|
+
Toast,
|
|
305
|
+
{
|
|
306
|
+
title: toast.title,
|
|
307
|
+
description: toast.description,
|
|
308
|
+
variant: toast.variant,
|
|
309
|
+
action: toast.action,
|
|
310
|
+
position: toast.position,
|
|
311
|
+
onClose: () => removeToast(toast.id)
|
|
312
|
+
},
|
|
313
|
+
toast.id
|
|
314
|
+
)) });
|
|
315
|
+
};
|
|
316
|
+
var useToast = () => {
|
|
317
|
+
const addToast = useToastStore((state) => state.addToast);
|
|
318
|
+
const removeToast = useToastStore((state) => state.removeToast);
|
|
319
|
+
return { addToast, removeToast };
|
|
320
|
+
};
|
|
321
|
+
|
|
209
322
|
// src/components/CheckBox/CheckBox.tsx
|
|
210
323
|
import {
|
|
211
324
|
forwardRef as forwardRef2,
|
|
@@ -213,7 +326,7 @@ import {
|
|
|
213
326
|
useId
|
|
214
327
|
} from "react";
|
|
215
328
|
import { Check, Minus } from "phosphor-react";
|
|
216
|
-
import { jsx as
|
|
329
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
217
330
|
var SIZE_CLASSES2 = {
|
|
218
331
|
small: {
|
|
219
332
|
checkbox: "w-4 h-4",
|
|
@@ -308,7 +421,7 @@ var CheckBox = forwardRef2(
|
|
|
308
421
|
const checkboxClasses = `${BASE_CHECKBOX_CLASSES} ${sizeClasses.checkbox} ${borderWidthClass} ${stylingClasses} ${className}`;
|
|
309
422
|
const renderIcon = () => {
|
|
310
423
|
if (indeterminate) {
|
|
311
|
-
return /* @__PURE__ */
|
|
424
|
+
return /* @__PURE__ */ jsx7(
|
|
312
425
|
Minus,
|
|
313
426
|
{
|
|
314
427
|
size: sizeClasses.iconSize,
|
|
@@ -318,7 +431,7 @@ var CheckBox = forwardRef2(
|
|
|
318
431
|
);
|
|
319
432
|
}
|
|
320
433
|
if (checked) {
|
|
321
|
-
return /* @__PURE__ */
|
|
434
|
+
return /* @__PURE__ */ jsx7(
|
|
322
435
|
Check,
|
|
323
436
|
{
|
|
324
437
|
size: sizeClasses.iconSize,
|
|
@@ -329,13 +442,13 @@ var CheckBox = forwardRef2(
|
|
|
329
442
|
}
|
|
330
443
|
return null;
|
|
331
444
|
};
|
|
332
|
-
return /* @__PURE__ */
|
|
333
|
-
/* @__PURE__ */
|
|
445
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
|
|
446
|
+
/* @__PURE__ */ jsxs4(
|
|
334
447
|
"div",
|
|
335
448
|
{
|
|
336
449
|
className: `flex flex-row items-center ${sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
|
|
337
450
|
children: [
|
|
338
|
-
/* @__PURE__ */
|
|
451
|
+
/* @__PURE__ */ jsx7(
|
|
339
452
|
"input",
|
|
340
453
|
{
|
|
341
454
|
ref,
|
|
@@ -348,12 +461,12 @@ var CheckBox = forwardRef2(
|
|
|
348
461
|
...props
|
|
349
462
|
}
|
|
350
463
|
),
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
label && /* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
465
|
+
label && /* @__PURE__ */ jsx7(
|
|
353
466
|
"div",
|
|
354
467
|
{
|
|
355
468
|
className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
|
|
356
|
-
children: /* @__PURE__ */
|
|
469
|
+
children: /* @__PURE__ */ jsx7(
|
|
357
470
|
Text,
|
|
358
471
|
{
|
|
359
472
|
as: "label",
|
|
@@ -370,8 +483,8 @@ var CheckBox = forwardRef2(
|
|
|
370
483
|
]
|
|
371
484
|
}
|
|
372
485
|
),
|
|
373
|
-
errorMessage && /* @__PURE__ */
|
|
374
|
-
helperText && !errorMessage && /* @__PURE__ */
|
|
486
|
+
errorMessage && /* @__PURE__ */ jsx7(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
|
|
487
|
+
helperText && !errorMessage && /* @__PURE__ */ jsx7(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperText })
|
|
375
488
|
] });
|
|
376
489
|
}
|
|
377
490
|
);
|
|
@@ -379,23 +492,23 @@ CheckBox.displayName = "CheckBox";
|
|
|
379
492
|
|
|
380
493
|
// src/components/Table/Table.tsx
|
|
381
494
|
import { forwardRef as forwardRef3 } from "react";
|
|
382
|
-
import { jsx as
|
|
495
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
383
496
|
var Table = forwardRef3(
|
|
384
|
-
({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
497
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx8("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ jsxs5(
|
|
385
498
|
"table",
|
|
386
499
|
{
|
|
387
500
|
ref,
|
|
388
501
|
className: `w-full caption-bottom text-sm ${className ?? ""}`,
|
|
389
502
|
...props,
|
|
390
503
|
children: [
|
|
391
|
-
/* @__PURE__ */
|
|
504
|
+
/* @__PURE__ */ jsx8("caption", { className: "sr-only", children: "My Table" }),
|
|
392
505
|
children
|
|
393
506
|
]
|
|
394
507
|
}
|
|
395
508
|
) })
|
|
396
509
|
);
|
|
397
510
|
Table.displayName = "Table";
|
|
398
|
-
var TableHeader = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */
|
|
511
|
+
var TableHeader = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
399
512
|
"thead",
|
|
400
513
|
{
|
|
401
514
|
ref,
|
|
@@ -404,7 +517,7 @@ var TableHeader = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
404
517
|
}
|
|
405
518
|
));
|
|
406
519
|
TableHeader.displayName = "TableHeader";
|
|
407
|
-
var TableBody = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */
|
|
520
|
+
var TableBody = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
408
521
|
"tbody",
|
|
409
522
|
{
|
|
410
523
|
ref,
|
|
@@ -413,7 +526,7 @@ var TableBody = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ js
|
|
|
413
526
|
}
|
|
414
527
|
));
|
|
415
528
|
TableBody.displayName = "TableBody";
|
|
416
|
-
var TableFooter = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */
|
|
529
|
+
var TableFooter = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
417
530
|
"tfoot",
|
|
418
531
|
{
|
|
419
532
|
ref,
|
|
@@ -430,7 +543,7 @@ var VARIANT_STATES_ROW = {
|
|
|
430
543
|
};
|
|
431
544
|
var TableRow = forwardRef3(
|
|
432
545
|
({ state = "default", className, ...props }, ref) => {
|
|
433
|
-
return /* @__PURE__ */
|
|
546
|
+
return /* @__PURE__ */ jsx8(
|
|
434
547
|
"tr",
|
|
435
548
|
{
|
|
436
549
|
ref,
|
|
@@ -447,7 +560,7 @@ var TableRow = forwardRef3(
|
|
|
447
560
|
}
|
|
448
561
|
);
|
|
449
562
|
TableRow.displayName = "TableRow";
|
|
450
|
-
var TableHead = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */
|
|
563
|
+
var TableHead = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
451
564
|
"th",
|
|
452
565
|
{
|
|
453
566
|
ref,
|
|
@@ -456,7 +569,7 @@ var TableHead = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ js
|
|
|
456
569
|
}
|
|
457
570
|
));
|
|
458
571
|
TableHead.displayName = "TableHead";
|
|
459
|
-
var TableCell = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */
|
|
572
|
+
var TableCell = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
460
573
|
"td",
|
|
461
574
|
{
|
|
462
575
|
ref,
|
|
@@ -465,7 +578,7 @@ var TableCell = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ js
|
|
|
465
578
|
}
|
|
466
579
|
));
|
|
467
580
|
TableCell.displayName = "TableCell";
|
|
468
|
-
var TableCaption = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */
|
|
581
|
+
var TableCaption = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
469
582
|
"caption",
|
|
470
583
|
{
|
|
471
584
|
ref,
|
|
@@ -486,7 +599,7 @@ import {
|
|
|
486
599
|
useRef,
|
|
487
600
|
useMemo
|
|
488
601
|
} from "react";
|
|
489
|
-
import { jsx as
|
|
602
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
490
603
|
var DropdownMenuContext = createContext(
|
|
491
604
|
void 0
|
|
492
605
|
);
|
|
@@ -526,14 +639,14 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
526
639
|
() => ({ open: currentOpen, setOpen }),
|
|
527
640
|
[currentOpen, setOpen]
|
|
528
641
|
);
|
|
529
|
-
return /* @__PURE__ */
|
|
642
|
+
return /* @__PURE__ */ jsx9(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ jsx9("div", { className: "relative", ref: menuRef, children }) });
|
|
530
643
|
};
|
|
531
644
|
var DropdownMenuTrigger = forwardRef4(({ className, children, onClick, ...props }, ref) => {
|
|
532
645
|
const context = useContext(DropdownMenuContext);
|
|
533
646
|
if (!context)
|
|
534
647
|
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
535
648
|
const { open, setOpen } = context;
|
|
536
|
-
return /* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ jsx9(
|
|
537
650
|
"button",
|
|
538
651
|
{
|
|
539
652
|
ref,
|
|
@@ -565,7 +678,7 @@ var ALIGN_CLASSES = {
|
|
|
565
678
|
center: "left-1/2 -translate-x-1/2",
|
|
566
679
|
end: "right-0"
|
|
567
680
|
};
|
|
568
|
-
var MenuLabel = forwardRef4(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
681
|
+
var MenuLabel = forwardRef4(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx9(
|
|
569
682
|
"fieldset",
|
|
570
683
|
{
|
|
571
684
|
ref,
|
|
@@ -600,7 +713,7 @@ var MenuContent = forwardRef4(
|
|
|
600
713
|
const horizontal = ALIGN_CLASSES[align];
|
|
601
714
|
return `absolute ${vertical} ${horizontal}`;
|
|
602
715
|
};
|
|
603
|
-
return /* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ jsx9(
|
|
604
717
|
"div",
|
|
605
718
|
{
|
|
606
719
|
ref,
|
|
@@ -645,7 +758,7 @@ var MenuItem = forwardRef4(
|
|
|
645
758
|
}
|
|
646
759
|
onClick?.(e);
|
|
647
760
|
};
|
|
648
|
-
return /* @__PURE__ */
|
|
761
|
+
return /* @__PURE__ */ jsxs6(
|
|
649
762
|
"div",
|
|
650
763
|
{
|
|
651
764
|
ref,
|
|
@@ -674,7 +787,7 @@ var MenuItem = forwardRef4(
|
|
|
674
787
|
}
|
|
675
788
|
);
|
|
676
789
|
MenuItem.displayName = "MenuItem";
|
|
677
|
-
var MenuSeparator = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */
|
|
790
|
+
var MenuSeparator = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
|
|
678
791
|
"div",
|
|
679
792
|
{
|
|
680
793
|
ref,
|
|
@@ -686,7 +799,7 @@ MenuSeparator.displayName = "MenuSeparator";
|
|
|
686
799
|
|
|
687
800
|
// src/components/NavButton/NavButton.tsx
|
|
688
801
|
import { forwardRef as forwardRef5 } from "react";
|
|
689
|
-
import { jsx as
|
|
802
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
690
803
|
var NavButton = forwardRef5(
|
|
691
804
|
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
692
805
|
const baseClasses = [
|
|
@@ -714,7 +827,7 @@ var NavButton = forwardRef5(
|
|
|
714
827
|
];
|
|
715
828
|
const stateClasses = selected ? ["bg-primary-50", "text-primary-950"] : [];
|
|
716
829
|
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
717
|
-
return /* @__PURE__ */
|
|
830
|
+
return /* @__PURE__ */ jsxs7(
|
|
718
831
|
"button",
|
|
719
832
|
{
|
|
720
833
|
ref,
|
|
@@ -724,8 +837,8 @@ var NavButton = forwardRef5(
|
|
|
724
837
|
"aria-pressed": selected,
|
|
725
838
|
...props,
|
|
726
839
|
children: [
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
840
|
+
/* @__PURE__ */ jsx10("span", { className: "flex items-center justify-center w-5 h-5", children: icon }),
|
|
841
|
+
/* @__PURE__ */ jsx10("span", { className: "whitespace-nowrap", children: label })
|
|
729
842
|
]
|
|
730
843
|
}
|
|
731
844
|
);
|
|
@@ -735,7 +848,7 @@ NavButton.displayName = "NavButton";
|
|
|
735
848
|
|
|
736
849
|
// src/components/IconButton/IconButton.tsx
|
|
737
850
|
import { forwardRef as forwardRef6 } from "react";
|
|
738
|
-
import { jsx as
|
|
851
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
739
852
|
var IconButton = forwardRef6(
|
|
740
853
|
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
741
854
|
const baseClasses = [
|
|
@@ -768,7 +881,7 @@ var IconButton = forwardRef6(
|
|
|
768
881
|
...activeClasses
|
|
769
882
|
].join(" ");
|
|
770
883
|
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
771
|
-
return /* @__PURE__ */
|
|
884
|
+
return /* @__PURE__ */ jsx11(
|
|
772
885
|
"button",
|
|
773
886
|
{
|
|
774
887
|
ref,
|
|
@@ -778,7 +891,7 @@ var IconButton = forwardRef6(
|
|
|
778
891
|
"aria-pressed": active,
|
|
779
892
|
"aria-label": ariaLabel,
|
|
780
893
|
...props,
|
|
781
|
-
children: /* @__PURE__ */
|
|
894
|
+
children: /* @__PURE__ */ jsx11("span", { className: "flex items-center justify-center", children: icon })
|
|
782
895
|
}
|
|
783
896
|
);
|
|
784
897
|
}
|
|
@@ -805,5 +918,9 @@ export {
|
|
|
805
918
|
TableHead,
|
|
806
919
|
TableHeader,
|
|
807
920
|
TableRow,
|
|
808
|
-
Text
|
|
921
|
+
Text,
|
|
922
|
+
Toast,
|
|
923
|
+
Toaster,
|
|
924
|
+
useToast,
|
|
925
|
+
useToastStore
|
|
809
926
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "analytica-frontend-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "Repositório público dos componentes utilizados nas plataformas da Analytica Ensino",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -64,7 +64,10 @@
|
|
|
64
64
|
"react-dom": ">=19.0.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"phosphor-react": "^1.4.1"
|
|
67
|
+
"phosphor-react": "^1.4.1",
|
|
68
|
+
"react": "^19.1.0",
|
|
69
|
+
"react-dom": "^19.1.0",
|
|
70
|
+
"zustand": "^5.0.5"
|
|
68
71
|
},
|
|
69
72
|
"devDependencies": {
|
|
70
73
|
"@eslint/eslintrc": "^3.3.1",
|