@abpjs/theme-shared 0.7.6 → 0.8.0
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/components/errors/ErrorComponent.d.ts +35 -0
- package/dist/components/errors/index.d.ts +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/loader-bar/LoaderBar.d.ts +34 -0
- package/dist/components/loader-bar/index.d.ts +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/styles.d.ts +24 -0
- package/dist/handlers/error.handler.d.ts +14 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +320 -83
- package/dist/index.mjs +294 -60
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -9,6 +9,94 @@ var Toaster;
|
|
|
9
9
|
})(Status = Toaster2.Status || (Toaster2.Status = {}));
|
|
10
10
|
})(Toaster || (Toaster = {}));
|
|
11
11
|
|
|
12
|
+
// src/constants/styles.ts
|
|
13
|
+
var DEFAULT_STYLES = `
|
|
14
|
+
.is-invalid .form-control {
|
|
15
|
+
border-color: #dc3545;
|
|
16
|
+
border-style: solid !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.is-invalid .invalid-feedback,
|
|
20
|
+
.is-invalid + * .invalid-feedback {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.data-tables-filter {
|
|
25
|
+
text-align: right;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pointer {
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.navbar .dropdown-submenu a::after {
|
|
33
|
+
transform: rotate(-90deg);
|
|
34
|
+
position: absolute;
|
|
35
|
+
right: 16px;
|
|
36
|
+
top: 18px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.modal {
|
|
40
|
+
background-color: rgba(0, 0, 0, .6);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.abp-ellipsis {
|
|
44
|
+
display: inline-block;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
text-overflow: ellipsis;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* <animations */
|
|
51
|
+
|
|
52
|
+
.fade-in-top {
|
|
53
|
+
animation: fadeInTop 0.4s ease-in-out;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.fade-out-top {
|
|
57
|
+
animation: fadeOutTop 0.4s ease-in-out;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@keyframes fadeInTop {
|
|
61
|
+
from {
|
|
62
|
+
transform: translateY(-5px);
|
|
63
|
+
opacity: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
to {
|
|
67
|
+
transform: translateY(5px);
|
|
68
|
+
opacity: 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@keyframes fadeOutTop {
|
|
73
|
+
to {
|
|
74
|
+
transform: translateY(-5px);
|
|
75
|
+
opacity: 0;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* </animations */
|
|
80
|
+
|
|
81
|
+
/* Loader bar styles */
|
|
82
|
+
.abp-loader-bar {
|
|
83
|
+
position: fixed;
|
|
84
|
+
top: 0;
|
|
85
|
+
left: 0;
|
|
86
|
+
right: 0;
|
|
87
|
+
height: 3px;
|
|
88
|
+
z-index: 9999;
|
|
89
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.abp-progress {
|
|
94
|
+
height: 100%;
|
|
95
|
+
background-color: #3182ce;
|
|
96
|
+
transition: width 0.3s ease-out;
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
|
|
12
100
|
// src/contexts/toaster.context.tsx
|
|
13
101
|
import {
|
|
14
102
|
createContext,
|
|
@@ -241,7 +329,7 @@ function useConfirmationContext() {
|
|
|
241
329
|
}
|
|
242
330
|
|
|
243
331
|
// src/handlers/error.handler.ts
|
|
244
|
-
import { useCallback as useCallback3 } from "react";
|
|
332
|
+
import { useCallback as useCallback3, useState as useState3 } from "react";
|
|
245
333
|
var DEFAULT_ERROR_MESSAGES = {
|
|
246
334
|
400: "AbpUi::DefaultErrorMessage400",
|
|
247
335
|
401: "AbpUi::DefaultErrorMessage401",
|
|
@@ -253,6 +341,7 @@ var DEFAULT_ERROR_MESSAGES = {
|
|
|
253
341
|
function useErrorHandler(options = {}) {
|
|
254
342
|
const { navigate, loginPath = "/account/login" } = options;
|
|
255
343
|
const confirmation = useConfirmation();
|
|
344
|
+
const [errorComponentProps, setErrorComponentProps] = useState3(null);
|
|
256
345
|
const navigateToLogin = useCallback3(() => {
|
|
257
346
|
if (navigate) {
|
|
258
347
|
navigate(loginPath);
|
|
@@ -264,6 +353,22 @@ function useErrorHandler(options = {}) {
|
|
|
264
353
|
},
|
|
265
354
|
[confirmation]
|
|
266
355
|
);
|
|
356
|
+
const clearErrorComponent = useCallback3(() => {
|
|
357
|
+
setErrorComponentProps(null);
|
|
358
|
+
}, []);
|
|
359
|
+
const createErrorComponent = useCallback3(
|
|
360
|
+
(instance) => {
|
|
361
|
+
const props = {
|
|
362
|
+
title: instance.title || "Error",
|
|
363
|
+
details: instance.details || "An error has occurred.",
|
|
364
|
+
onDestroy: clearErrorComponent,
|
|
365
|
+
showCloseButton: true
|
|
366
|
+
};
|
|
367
|
+
setErrorComponentProps(props);
|
|
368
|
+
return props;
|
|
369
|
+
},
|
|
370
|
+
[clearErrorComponent]
|
|
371
|
+
);
|
|
267
372
|
const handleError = useCallback3(
|
|
268
373
|
async (error) => {
|
|
269
374
|
if (error.status === 401) {
|
|
@@ -287,7 +392,10 @@ function useErrorHandler(options = {}) {
|
|
|
287
392
|
return {
|
|
288
393
|
handleError,
|
|
289
394
|
showError,
|
|
290
|
-
navigateToLogin
|
|
395
|
+
navigateToLogin,
|
|
396
|
+
createErrorComponent,
|
|
397
|
+
errorComponentProps,
|
|
398
|
+
clearErrorComponent
|
|
291
399
|
};
|
|
292
400
|
}
|
|
293
401
|
function createErrorInterceptor(errorHandler) {
|
|
@@ -585,17 +693,140 @@ function ConfirmationDialog({ className }) {
|
|
|
585
693
|
);
|
|
586
694
|
}
|
|
587
695
|
|
|
696
|
+
// src/components/errors/ErrorComponent.tsx
|
|
697
|
+
import { Heading, Text as Text2, VStack, Button as Button2, Container } from "@chakra-ui/react";
|
|
698
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
699
|
+
function ErrorComponent({
|
|
700
|
+
title = "Error",
|
|
701
|
+
details = "An error has occurred.",
|
|
702
|
+
onDestroy,
|
|
703
|
+
showCloseButton = true,
|
|
704
|
+
closeButtonText = "Go Back"
|
|
705
|
+
}) {
|
|
706
|
+
return /* @__PURE__ */ jsx5(Container, { maxW: "container.md", py: 20, children: /* @__PURE__ */ jsxs3(VStack, { gap: 6, textAlign: "center", children: [
|
|
707
|
+
/* @__PURE__ */ jsx5(
|
|
708
|
+
Heading,
|
|
709
|
+
{
|
|
710
|
+
size: "4xl",
|
|
711
|
+
color: "red.500",
|
|
712
|
+
fontWeight: "bold",
|
|
713
|
+
children: title
|
|
714
|
+
}
|
|
715
|
+
),
|
|
716
|
+
/* @__PURE__ */ jsx5(Text2, { fontSize: "lg", color: "gray.600", children: details }),
|
|
717
|
+
showCloseButton && onDestroy && /* @__PURE__ */ jsx5(
|
|
718
|
+
Button2,
|
|
719
|
+
{
|
|
720
|
+
colorPalette: "blue",
|
|
721
|
+
size: "lg",
|
|
722
|
+
onClick: onDestroy,
|
|
723
|
+
children: closeButtonText
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
] }) });
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
// src/components/loader-bar/LoaderBar.tsx
|
|
730
|
+
import { useEffect as useEffect2, useRef as useRef5, useState as useState4 } from "react";
|
|
731
|
+
import { useLoader } from "@abpjs/core";
|
|
732
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
733
|
+
function LoaderBar({
|
|
734
|
+
containerClass = "abp-loader-bar",
|
|
735
|
+
progressClass = "abp-progress",
|
|
736
|
+
filter
|
|
737
|
+
}) {
|
|
738
|
+
const { loading } = useLoader();
|
|
739
|
+
const [isLoading, setIsLoading] = useState4(false);
|
|
740
|
+
const [progressLevel, setProgressLevel] = useState4(0);
|
|
741
|
+
const intervalRef = useRef5(null);
|
|
742
|
+
useEffect2(() => {
|
|
743
|
+
if (loading) {
|
|
744
|
+
startLoading();
|
|
745
|
+
} else {
|
|
746
|
+
stopLoading();
|
|
747
|
+
}
|
|
748
|
+
}, [loading]);
|
|
749
|
+
useEffect2(() => {
|
|
750
|
+
return () => {
|
|
751
|
+
if (intervalRef.current) {
|
|
752
|
+
clearInterval(intervalRef.current);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
}, []);
|
|
756
|
+
const startLoading = () => {
|
|
757
|
+
setIsLoading(true);
|
|
758
|
+
setProgressLevel(0);
|
|
759
|
+
if (intervalRef.current) {
|
|
760
|
+
clearInterval(intervalRef.current);
|
|
761
|
+
}
|
|
762
|
+
intervalRef.current = setInterval(() => {
|
|
763
|
+
setProgressLevel((prev) => {
|
|
764
|
+
if (prev >= 90) {
|
|
765
|
+
return prev + 0.5;
|
|
766
|
+
} else if (prev >= 75) {
|
|
767
|
+
return prev + 2;
|
|
768
|
+
} else if (prev >= 50) {
|
|
769
|
+
return prev + 5;
|
|
770
|
+
}
|
|
771
|
+
return prev + 10;
|
|
772
|
+
});
|
|
773
|
+
}, 300);
|
|
774
|
+
};
|
|
775
|
+
const stopLoading = () => {
|
|
776
|
+
setProgressLevel(100);
|
|
777
|
+
if (intervalRef.current) {
|
|
778
|
+
clearInterval(intervalRef.current);
|
|
779
|
+
intervalRef.current = null;
|
|
780
|
+
}
|
|
781
|
+
setTimeout(() => {
|
|
782
|
+
setIsLoading(false);
|
|
783
|
+
setProgressLevel(0);
|
|
784
|
+
}, 400);
|
|
785
|
+
};
|
|
786
|
+
if (!isLoading && progressLevel === 0) {
|
|
787
|
+
return null;
|
|
788
|
+
}
|
|
789
|
+
return /* @__PURE__ */ jsx6(
|
|
790
|
+
"div",
|
|
791
|
+
{
|
|
792
|
+
className: containerClass,
|
|
793
|
+
style: {
|
|
794
|
+
position: "fixed",
|
|
795
|
+
top: 0,
|
|
796
|
+
left: 0,
|
|
797
|
+
right: 0,
|
|
798
|
+
height: "3px",
|
|
799
|
+
zIndex: 9999,
|
|
800
|
+
backgroundColor: "rgba(0, 0, 0, 0.1)",
|
|
801
|
+
overflow: "hidden"
|
|
802
|
+
},
|
|
803
|
+
children: /* @__PURE__ */ jsx6(
|
|
804
|
+
"div",
|
|
805
|
+
{
|
|
806
|
+
className: progressClass,
|
|
807
|
+
style: {
|
|
808
|
+
height: "100%",
|
|
809
|
+
backgroundColor: "#3182ce",
|
|
810
|
+
transition: "width 0.3s ease-out",
|
|
811
|
+
width: `${Math.min(progressLevel, 100)}%`
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
)
|
|
815
|
+
}
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
|
|
588
819
|
// src/components/modal/Modal.tsx
|
|
589
820
|
import {
|
|
590
821
|
Dialog as Dialog2,
|
|
591
822
|
Portal as Portal3,
|
|
592
|
-
Box as
|
|
823
|
+
Box as Box3,
|
|
593
824
|
Flex as Flex3,
|
|
594
|
-
Text as
|
|
825
|
+
Text as Text3,
|
|
595
826
|
Separator,
|
|
596
827
|
CloseButton as CloseButton2
|
|
597
828
|
} from "@chakra-ui/react";
|
|
598
|
-
import { Fragment, jsx as
|
|
829
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
599
830
|
function getSizeWidth(size) {
|
|
600
831
|
switch (size) {
|
|
601
832
|
case "sm":
|
|
@@ -632,7 +863,7 @@ function Modal({
|
|
|
632
863
|
const handleOpenChange = (details) => {
|
|
633
864
|
onVisibleChange?.(details.open);
|
|
634
865
|
};
|
|
635
|
-
return /* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ jsx7(
|
|
636
867
|
Dialog2.Root,
|
|
637
868
|
{
|
|
638
869
|
open: visible,
|
|
@@ -644,9 +875,9 @@ function Modal({
|
|
|
644
875
|
motionPreset,
|
|
645
876
|
trapFocus,
|
|
646
877
|
preventScroll,
|
|
647
|
-
children: /* @__PURE__ */
|
|
648
|
-
/* @__PURE__ */
|
|
649
|
-
/* @__PURE__ */
|
|
878
|
+
children: /* @__PURE__ */ jsxs4(Portal3, { children: [
|
|
879
|
+
/* @__PURE__ */ jsx7(Dialog2.Backdrop, {}),
|
|
880
|
+
/* @__PURE__ */ jsx7(Dialog2.Positioner, { children: /* @__PURE__ */ jsxs4(
|
|
650
881
|
Dialog2.Content,
|
|
651
882
|
{
|
|
652
883
|
className: modalClass,
|
|
@@ -654,17 +885,17 @@ function Modal({
|
|
|
654
885
|
maxWidth: size === "full" ? "100vw" : void 0,
|
|
655
886
|
maxHeight: size === "full" ? "100vh" : void 0,
|
|
656
887
|
children: [
|
|
657
|
-
(header || showCloseButton) && /* @__PURE__ */
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
header && /* @__PURE__ */
|
|
660
|
-
showCloseButton && /* @__PURE__ */
|
|
888
|
+
(header || showCloseButton) && /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
889
|
+
/* @__PURE__ */ jsx7(Dialog2.Header, { children: /* @__PURE__ */ jsxs4(Flex3, { justify: "space-between", align: "center", width: "100%", children: [
|
|
890
|
+
header && /* @__PURE__ */ jsx7(Dialog2.Title, { children: /* @__PURE__ */ jsx7(Text3, { fontWeight: "bold", fontSize: "lg", children: header }) }),
|
|
891
|
+
showCloseButton && /* @__PURE__ */ jsx7(Dialog2.CloseTrigger, { asChild: true, children: /* @__PURE__ */ jsx7(CloseButton2, { size: "sm" }) })
|
|
661
892
|
] }) }),
|
|
662
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ jsx7(Separator, {})
|
|
663
894
|
] }),
|
|
664
|
-
children && /* @__PURE__ */
|
|
665
|
-
footer && /* @__PURE__ */
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
/* @__PURE__ */
|
|
895
|
+
children && /* @__PURE__ */ jsx7(Dialog2.Body, { py: 4, children }),
|
|
896
|
+
footer && /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
897
|
+
/* @__PURE__ */ jsx7(Separator, {}),
|
|
898
|
+
/* @__PURE__ */ jsx7(Dialog2.Footer, { children: /* @__PURE__ */ jsx7(Flex3, { gap: 3, justify: "flex-end", w: "100%", children: footer }) })
|
|
668
899
|
] })
|
|
669
900
|
]
|
|
670
901
|
}
|
|
@@ -674,18 +905,18 @@ function Modal({
|
|
|
674
905
|
);
|
|
675
906
|
}
|
|
676
907
|
function AbpModalHeader({ children, className }) {
|
|
677
|
-
return /* @__PURE__ */
|
|
908
|
+
return /* @__PURE__ */ jsx7(Text3, { fontWeight: "bold", fontSize: "lg", className, children });
|
|
678
909
|
}
|
|
679
910
|
function AbpModalBody({ children, className }) {
|
|
680
|
-
return /* @__PURE__ */
|
|
911
|
+
return /* @__PURE__ */ jsx7(Box3, { color: "gray.600", className, children });
|
|
681
912
|
}
|
|
682
913
|
function AbpModalFooter({ children, className }) {
|
|
683
|
-
return /* @__PURE__ */
|
|
914
|
+
return /* @__PURE__ */ jsx7(Flex3, { gap: 3, justify: "flex-end", className, children });
|
|
684
915
|
}
|
|
685
916
|
|
|
686
917
|
// src/components/ui/Alert.tsx
|
|
687
918
|
import { Alert as ChakraAlert } from "@chakra-ui/react";
|
|
688
|
-
import { Fragment as Fragment2, jsx as
|
|
919
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
689
920
|
function Alert({
|
|
690
921
|
status = "info",
|
|
691
922
|
children,
|
|
@@ -696,7 +927,7 @@ function Alert({
|
|
|
696
927
|
mb,
|
|
697
928
|
borderRadius = "md"
|
|
698
929
|
}) {
|
|
699
|
-
return /* @__PURE__ */
|
|
930
|
+
return /* @__PURE__ */ jsxs5(
|
|
700
931
|
ChakraAlert.Root,
|
|
701
932
|
{
|
|
702
933
|
status,
|
|
@@ -704,11 +935,11 @@ function Alert({
|
|
|
704
935
|
mb,
|
|
705
936
|
borderRadius,
|
|
706
937
|
children: [
|
|
707
|
-
showIcon && /* @__PURE__ */
|
|
708
|
-
title ? /* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
(description || children) && /* @__PURE__ */
|
|
711
|
-
] }) : /* @__PURE__ */
|
|
938
|
+
showIcon && /* @__PURE__ */ jsx8(ChakraAlert.Indicator, {}),
|
|
939
|
+
title ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
940
|
+
/* @__PURE__ */ jsx8(ChakraAlert.Title, { children: title }),
|
|
941
|
+
(description || children) && /* @__PURE__ */ jsx8(ChakraAlert.Description, { children: description || children })
|
|
942
|
+
] }) : /* @__PURE__ */ jsx8(ChakraAlert.Title, { children })
|
|
712
943
|
]
|
|
713
944
|
}
|
|
714
945
|
);
|
|
@@ -717,9 +948,9 @@ function Alert({
|
|
|
717
948
|
// src/components/ui/Button.tsx
|
|
718
949
|
import { forwardRef } from "react";
|
|
719
950
|
import { Button as ChakraButton } from "@chakra-ui/react";
|
|
720
|
-
import { jsx as
|
|
721
|
-
var
|
|
722
|
-
function
|
|
951
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
952
|
+
var Button3 = forwardRef(
|
|
953
|
+
function Button4({
|
|
723
954
|
children,
|
|
724
955
|
type = "button",
|
|
725
956
|
variant = "solid",
|
|
@@ -734,7 +965,7 @@ var Button2 = forwardRef(
|
|
|
734
965
|
mr,
|
|
735
966
|
ml
|
|
736
967
|
}, ref) {
|
|
737
|
-
return /* @__PURE__ */
|
|
968
|
+
return /* @__PURE__ */ jsx9(
|
|
738
969
|
ChakraButton,
|
|
739
970
|
{
|
|
740
971
|
ref,
|
|
@@ -759,7 +990,7 @@ var Button2 = forwardRef(
|
|
|
759
990
|
// src/components/ui/Checkbox.tsx
|
|
760
991
|
import { forwardRef as forwardRef2 } from "react";
|
|
761
992
|
import { Checkbox as ChakraCheckbox } from "@chakra-ui/react";
|
|
762
|
-
import { jsx as
|
|
993
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
763
994
|
var Checkbox = forwardRef2(
|
|
764
995
|
function Checkbox2({
|
|
765
996
|
children,
|
|
@@ -777,7 +1008,7 @@ var Checkbox = forwardRef2(
|
|
|
777
1008
|
onChange,
|
|
778
1009
|
className
|
|
779
1010
|
}, ref) {
|
|
780
|
-
return /* @__PURE__ */
|
|
1011
|
+
return /* @__PURE__ */ jsxs6(
|
|
781
1012
|
ChakraCheckbox.Root,
|
|
782
1013
|
{
|
|
783
1014
|
checked,
|
|
@@ -790,7 +1021,7 @@ var Checkbox = forwardRef2(
|
|
|
790
1021
|
size,
|
|
791
1022
|
className,
|
|
792
1023
|
children: [
|
|
793
|
-
/* @__PURE__ */
|
|
1024
|
+
/* @__PURE__ */ jsx10(
|
|
794
1025
|
ChakraCheckbox.HiddenInput,
|
|
795
1026
|
{
|
|
796
1027
|
ref,
|
|
@@ -800,8 +1031,8 @@ var Checkbox = forwardRef2(
|
|
|
800
1031
|
onChange
|
|
801
1032
|
}
|
|
802
1033
|
),
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
children && /* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ jsx10(ChakraCheckbox.Control, {}),
|
|
1035
|
+
children && /* @__PURE__ */ jsx10(ChakraCheckbox.Label, { children })
|
|
805
1036
|
]
|
|
806
1037
|
}
|
|
807
1038
|
);
|
|
@@ -810,7 +1041,7 @@ var Checkbox = forwardRef2(
|
|
|
810
1041
|
|
|
811
1042
|
// src/components/ui/FormField.tsx
|
|
812
1043
|
import { Field } from "@chakra-ui/react";
|
|
813
|
-
import { jsx as
|
|
1044
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
814
1045
|
function FormField({
|
|
815
1046
|
label,
|
|
816
1047
|
invalid = false,
|
|
@@ -822,14 +1053,14 @@ function FormField({
|
|
|
822
1053
|
htmlFor,
|
|
823
1054
|
className
|
|
824
1055
|
}) {
|
|
825
|
-
return /* @__PURE__ */
|
|
826
|
-
label && /* @__PURE__ */
|
|
1056
|
+
return /* @__PURE__ */ jsxs7(Field.Root, { invalid, disabled, className, children: [
|
|
1057
|
+
label && /* @__PURE__ */ jsxs7(Field.Label, { htmlFor, children: [
|
|
827
1058
|
label,
|
|
828
|
-
required && /* @__PURE__ */
|
|
1059
|
+
required && /* @__PURE__ */ jsx11(Field.RequiredIndicator, {})
|
|
829
1060
|
] }),
|
|
830
1061
|
children,
|
|
831
|
-
helperText && !invalid && /* @__PURE__ */
|
|
832
|
-
invalid && errorText && /* @__PURE__ */
|
|
1062
|
+
helperText && !invalid && /* @__PURE__ */ jsx11(Field.HelperText, { children: helperText }),
|
|
1063
|
+
invalid && errorText && /* @__PURE__ */ jsx11(Field.ErrorText, { children: errorText })
|
|
833
1064
|
] });
|
|
834
1065
|
}
|
|
835
1066
|
|
|
@@ -1071,11 +1302,11 @@ var abpSystem = createAbpSystem();
|
|
|
1071
1302
|
// src/components/ui/color-mode.tsx
|
|
1072
1303
|
import { ClientOnly, IconButton, Skeleton, Span } from "@chakra-ui/react";
|
|
1073
1304
|
import { ThemeProvider, useTheme } from "next-themes";
|
|
1074
|
-
import * as
|
|
1305
|
+
import * as React8 from "react";
|
|
1075
1306
|
import { Moon, Sun } from "lucide-react";
|
|
1076
|
-
import { jsx as
|
|
1307
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1077
1308
|
function ColorModeProvider(props) {
|
|
1078
|
-
return /* @__PURE__ */
|
|
1309
|
+
return /* @__PURE__ */ jsx12(ThemeProvider, { attribute: "class", disableTransitionOnChange: true, ...props });
|
|
1079
1310
|
}
|
|
1080
1311
|
function useColorMode() {
|
|
1081
1312
|
const { resolvedTheme, setTheme, forcedTheme } = useTheme();
|
|
@@ -1091,11 +1322,11 @@ function useColorMode() {
|
|
|
1091
1322
|
}
|
|
1092
1323
|
function ColorModeIcon() {
|
|
1093
1324
|
const { colorMode } = useColorMode();
|
|
1094
|
-
return colorMode === "dark" ? /* @__PURE__ */
|
|
1325
|
+
return colorMode === "dark" ? /* @__PURE__ */ jsx12(Moon, {}) : /* @__PURE__ */ jsx12(Sun, {});
|
|
1095
1326
|
}
|
|
1096
|
-
var ColorModeButton =
|
|
1327
|
+
var ColorModeButton = React8.forwardRef(function ColorModeButton2(props, ref) {
|
|
1097
1328
|
const { toggleColorMode } = useColorMode();
|
|
1098
|
-
return /* @__PURE__ */
|
|
1329
|
+
return /* @__PURE__ */ jsx12(ClientOnly, { fallback: /* @__PURE__ */ jsx12(Skeleton, { boxSize: "9" }), children: /* @__PURE__ */ jsx12(
|
|
1099
1330
|
IconButton,
|
|
1100
1331
|
{
|
|
1101
1332
|
onClick: toggleColorMode,
|
|
@@ -1110,13 +1341,13 @@ var ColorModeButton = React7.forwardRef(function ColorModeButton2(props, ref) {
|
|
|
1110
1341
|
height: "5"
|
|
1111
1342
|
}
|
|
1112
1343
|
},
|
|
1113
|
-
children: /* @__PURE__ */
|
|
1344
|
+
children: /* @__PURE__ */ jsx12(ColorModeIcon, {})
|
|
1114
1345
|
}
|
|
1115
1346
|
) });
|
|
1116
1347
|
});
|
|
1117
|
-
var LightMode =
|
|
1348
|
+
var LightMode = React8.forwardRef(
|
|
1118
1349
|
function LightMode2(props, ref) {
|
|
1119
|
-
return /* @__PURE__ */
|
|
1350
|
+
return /* @__PURE__ */ jsx12(
|
|
1120
1351
|
Span,
|
|
1121
1352
|
{
|
|
1122
1353
|
color: "fg",
|
|
@@ -1130,9 +1361,9 @@ var LightMode = React7.forwardRef(
|
|
|
1130
1361
|
);
|
|
1131
1362
|
}
|
|
1132
1363
|
);
|
|
1133
|
-
var DarkMode =
|
|
1364
|
+
var DarkMode = React8.forwardRef(
|
|
1134
1365
|
function DarkMode2(props, ref) {
|
|
1135
|
-
return /* @__PURE__ */
|
|
1366
|
+
return /* @__PURE__ */ jsx12(
|
|
1136
1367
|
Span,
|
|
1137
1368
|
{
|
|
1138
1369
|
color: "fg",
|
|
@@ -1149,7 +1380,7 @@ var DarkMode = React7.forwardRef(
|
|
|
1149
1380
|
|
|
1150
1381
|
// src/providers/ThemeSharedProvider.tsx
|
|
1151
1382
|
import { useDirection } from "@abpjs/core";
|
|
1152
|
-
import { jsx as
|
|
1383
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1153
1384
|
function ThemeSharedProvider({
|
|
1154
1385
|
children,
|
|
1155
1386
|
renderToasts = true,
|
|
@@ -1163,13 +1394,13 @@ function ThemeSharedProvider({
|
|
|
1163
1394
|
const system = themeOverrides ? createAbpSystem(themeOverrides) : abpSystem;
|
|
1164
1395
|
const { endSide } = useDirection();
|
|
1165
1396
|
toastPosition = `bottom-${endSide}`;
|
|
1166
|
-
const content = /* @__PURE__ */
|
|
1397
|
+
const content = /* @__PURE__ */ jsx13(ToasterProvider, { children: /* @__PURE__ */ jsxs8(ConfirmationProvider, { children: [
|
|
1167
1398
|
children,
|
|
1168
|
-
renderToasts && /* @__PURE__ */
|
|
1169
|
-
renderConfirmation && /* @__PURE__ */
|
|
1399
|
+
renderToasts && /* @__PURE__ */ jsx13(ToastContainer, { position: toastPosition }),
|
|
1400
|
+
renderConfirmation && /* @__PURE__ */ jsx13(ConfirmationDialog, {})
|
|
1170
1401
|
] }) });
|
|
1171
1402
|
const colorModeProps = enableColorMode ? { defaultTheme: defaultColorMode } : { forcedTheme: "light" };
|
|
1172
|
-
return /* @__PURE__ */
|
|
1403
|
+
return /* @__PURE__ */ jsx13(ChakraProvider, { value: system, children: /* @__PURE__ */ jsx13(LocaleProvider, { locale, children: /* @__PURE__ */ jsx13(ColorModeProvider, { ...colorModeProps, children: content }) }) });
|
|
1173
1404
|
}
|
|
1174
1405
|
|
|
1175
1406
|
// src/utils/styles.ts
|
|
@@ -1247,12 +1478,15 @@ export {
|
|
|
1247
1478
|
AbpModalFooter,
|
|
1248
1479
|
AbpModalHeader,
|
|
1249
1480
|
Alert,
|
|
1250
|
-
|
|
1481
|
+
Button3 as Button,
|
|
1251
1482
|
Dialog2 as ChakraDialog,
|
|
1252
1483
|
Checkbox,
|
|
1253
1484
|
ConfirmationDialog,
|
|
1254
1485
|
ConfirmationProvider,
|
|
1486
|
+
DEFAULT_STYLES,
|
|
1487
|
+
ErrorComponent,
|
|
1255
1488
|
FormField,
|
|
1489
|
+
LoaderBar,
|
|
1256
1490
|
Modal,
|
|
1257
1491
|
AbpModalBody as ModalBody,
|
|
1258
1492
|
AbpModalFooter as ModalFooter,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abpjs/theme-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "ABP Framework Theme Shared components for React - translated from @abp/ng.theme.shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"lucide-react": "^0.400.0",
|
|
27
27
|
"next-themes": "^0.4.6",
|
|
28
28
|
"react-icons": "^5.5.0",
|
|
29
|
-
"@abpjs/core": "0.
|
|
29
|
+
"@abpjs/core": "0.8.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@abp/ng.theme.shared": "0.
|
|
32
|
+
"@abp/ng.theme.shared": "0.8.0"
|
|
33
33
|
},
|
|
34
34
|
"author": "tekthar.com",
|
|
35
35
|
"license": "LGPL-3.0",
|