@abpjs/theme-shared 0.8.0 → 1.0.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/index.js CHANGED
@@ -35,7 +35,8 @@ __export(index_exports, {
35
35
  AbpModalHeader: () => AbpModalHeader,
36
36
  Alert: () => Alert,
37
37
  Button: () => Button3,
38
- ChakraDialog: () => import_react10.Dialog,
38
+ ChakraDialog: () => import_react11.Dialog,
39
+ ChangePassword: () => ChangePassword,
39
40
  Checkbox: () => Checkbox,
40
41
  ConfirmationDialog: () => ConfirmationDialog,
41
42
  ConfirmationProvider: () => ConfirmationProvider,
@@ -47,6 +48,7 @@ __export(index_exports, {
47
48
  ModalBody: () => AbpModalBody,
48
49
  ModalFooter: () => AbpModalFooter,
49
50
  ModalHeader: () => AbpModalHeader,
51
+ Profile: () => Profile,
50
52
  THEME_SHARED_STYLES: () => THEME_SHARED_STYLES,
51
53
  ThemeSharedProvider: () => ThemeSharedProvider,
52
54
  ToastContainer: () => ToastContainer,
@@ -56,7 +58,7 @@ __export(index_exports, {
56
58
  createAbpSystem: () => createAbpSystem,
57
59
  createErrorInterceptor: () => createErrorInterceptor,
58
60
  defaultAbpConfig: () => defaultAbpConfig,
59
- defineConfig: () => import_react17.defineConfig,
61
+ defineConfig: () => import_react22.defineConfig,
60
62
  getSeverityBg: () => getSeverityBg,
61
63
  getSeverityBorderColor: () => getSeverityBorderColor,
62
64
  getSeverityColorScheme: () => getSeverityColorPalette,
@@ -851,7 +853,8 @@ function LoaderBar({
851
853
  }
852
854
 
853
855
  // src/components/modal/Modal.tsx
854
- var import_react10 = require("@chakra-ui/react");
856
+ var import_react10 = __toESM(require("react"));
857
+ var import_react11 = require("@chakra-ui/react");
855
858
  var import_jsx_runtime7 = require("react/jsx-runtime");
856
859
  function getSizeWidth(size) {
857
860
  switch (size) {
@@ -872,9 +875,12 @@ function getSizeWidth(size) {
872
875
  function Modal({
873
876
  visible,
874
877
  onVisibleChange,
878
+ busy = false,
875
879
  size = "md",
876
880
  centered = true,
877
881
  modalClass,
882
+ height,
883
+ minHeight,
878
884
  header,
879
885
  children,
880
886
  footer,
@@ -884,44 +890,61 @@ function Modal({
884
890
  scrollBehavior = "inside",
885
891
  motionPreset = "scale",
886
892
  trapFocus = true,
887
- preventScroll = true
893
+ preventScroll = true,
894
+ onInit
888
895
  }) {
896
+ const prevVisibleRef = import_react10.default.useRef(false);
897
+ const onInitRef = import_react10.default.useRef(onInit);
898
+ import_react10.default.useEffect(() => {
899
+ onInitRef.current = onInit;
900
+ }, [onInit]);
901
+ import_react10.default.useEffect(() => {
902
+ if (visible && !prevVisibleRef.current && onInitRef.current) {
903
+ onInitRef.current();
904
+ }
905
+ prevVisibleRef.current = visible;
906
+ }, [visible]);
889
907
  const handleOpenChange = (details) => {
908
+ if (busy && !details.open) {
909
+ return;
910
+ }
890
911
  onVisibleChange?.(details.open);
891
912
  };
892
913
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
893
- import_react10.Dialog.Root,
914
+ import_react11.Dialog.Root,
894
915
  {
895
916
  open: visible,
896
917
  onOpenChange: handleOpenChange,
897
918
  placement: centered ? "center" : "top",
898
- closeOnInteractOutside: closeOnOverlayClick,
899
- closeOnEscape,
919
+ closeOnInteractOutside: closeOnOverlayClick && !busy,
920
+ closeOnEscape: closeOnEscape && !busy,
900
921
  scrollBehavior,
901
922
  motionPreset,
902
923
  trapFocus,
903
924
  preventScroll,
904
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react10.Portal, { children: [
905
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Dialog.Backdrop, {}),
906
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Dialog.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
907
- import_react10.Dialog.Content,
925
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react11.Portal, { children: [
926
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Dialog.Backdrop, {}),
927
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Dialog.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
928
+ import_react11.Dialog.Content,
908
929
  {
909
930
  className: modalClass,
910
931
  width: getSizeWidth(size),
911
932
  maxWidth: size === "full" ? "100vw" : void 0,
912
933
  maxHeight: size === "full" ? "100vh" : void 0,
934
+ height,
935
+ minHeight,
913
936
  children: [
914
937
  (header || showCloseButton) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
915
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react10.Flex, { justify: "space-between", align: "center", width: "100%", children: [
916
- header && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Dialog.Title, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Text, { fontWeight: "bold", fontSize: "lg", children: header }) }),
917
- showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Dialog.CloseTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.CloseButton, { size: "sm" }) })
938
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react11.Flex, { justify: "space-between", align: "center", width: "100%", children: [
939
+ header && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Dialog.Title, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Text, { fontWeight: "bold", fontSize: "lg", children: header }) }),
940
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Dialog.CloseTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.CloseButton, { size: "sm" }) })
918
941
  ] }) }),
919
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Separator, {})
942
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Separator, {})
920
943
  ] }),
921
- children && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Dialog.Body, { py: 4, children }),
944
+ children && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Dialog.Body, { py: 4, children }),
922
945
  footer && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
923
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Separator, {}),
924
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Dialog.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Flex, { gap: 3, justify: "flex-end", w: "100%", children: footer }) })
946
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Separator, {}),
947
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Dialog.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Flex, { gap: 3, justify: "flex-end", w: "100%", children: footer }) })
925
948
  ] })
926
949
  ]
927
950
  }
@@ -931,17 +954,17 @@ function Modal({
931
954
  );
932
955
  }
933
956
  function AbpModalHeader({ children, className }) {
934
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Text, { fontWeight: "bold", fontSize: "lg", className, children });
957
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Text, { fontWeight: "bold", fontSize: "lg", className, children });
935
958
  }
936
959
  function AbpModalBody({ children, className }) {
937
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Box, { color: "gray.600", className, children });
960
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Box, { color: "gray.600", className, children });
938
961
  }
939
962
  function AbpModalFooter({ children, className }) {
940
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react10.Flex, { gap: 3, justify: "flex-end", className, children });
963
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Flex, { gap: 3, justify: "flex-end", className, children });
941
964
  }
942
965
 
943
966
  // src/components/ui/Alert.tsx
944
- var import_react11 = require("@chakra-ui/react");
967
+ var import_react12 = require("@chakra-ui/react");
945
968
  var import_jsx_runtime8 = require("react/jsx-runtime");
946
969
  function Alert({
947
970
  status = "info",
@@ -954,28 +977,28 @@ function Alert({
954
977
  borderRadius = "md"
955
978
  }) {
956
979
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
957
- import_react11.Alert.Root,
980
+ import_react12.Alert.Root,
958
981
  {
959
982
  status,
960
983
  className,
961
984
  mb,
962
985
  borderRadius,
963
986
  children: [
964
- showIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react11.Alert.Indicator, {}),
987
+ showIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react12.Alert.Indicator, {}),
965
988
  title ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
966
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react11.Alert.Title, { children: title }),
967
- (description || children) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react11.Alert.Description, { children: description || children })
968
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react11.Alert.Title, { children })
989
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react12.Alert.Title, { children: title }),
990
+ (description || children) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react12.Alert.Description, { children: description || children })
991
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react12.Alert.Title, { children })
969
992
  ]
970
993
  }
971
994
  );
972
995
  }
973
996
 
974
997
  // src/components/ui/Button.tsx
975
- var import_react12 = require("react");
976
- var import_react13 = require("@chakra-ui/react");
998
+ var import_react13 = require("react");
999
+ var import_react14 = require("@chakra-ui/react");
977
1000
  var import_jsx_runtime9 = require("react/jsx-runtime");
978
- var Button3 = (0, import_react12.forwardRef)(
1001
+ var Button3 = (0, import_react13.forwardRef)(
979
1002
  function Button4({
980
1003
  children,
981
1004
  type = "button",
@@ -992,7 +1015,7 @@ var Button3 = (0, import_react12.forwardRef)(
992
1015
  ml
993
1016
  }, ref) {
994
1017
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
995
- import_react13.Button,
1018
+ import_react14.Button,
996
1019
  {
997
1020
  ref,
998
1021
  type,
@@ -1014,10 +1037,10 @@ var Button3 = (0, import_react12.forwardRef)(
1014
1037
  );
1015
1038
 
1016
1039
  // src/components/ui/Checkbox.tsx
1017
- var import_react14 = require("react");
1018
- var import_react15 = require("@chakra-ui/react");
1040
+ var import_react15 = require("react");
1041
+ var import_react16 = require("@chakra-ui/react");
1019
1042
  var import_jsx_runtime10 = require("react/jsx-runtime");
1020
- var Checkbox = (0, import_react14.forwardRef)(
1043
+ var Checkbox = (0, import_react15.forwardRef)(
1021
1044
  function Checkbox2({
1022
1045
  children,
1023
1046
  checked,
@@ -1035,7 +1058,7 @@ var Checkbox = (0, import_react14.forwardRef)(
1035
1058
  className
1036
1059
  }, ref) {
1037
1060
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1038
- import_react15.Checkbox.Root,
1061
+ import_react16.Checkbox.Root,
1039
1062
  {
1040
1063
  checked,
1041
1064
  defaultChecked,
@@ -1048,7 +1071,7 @@ var Checkbox = (0, import_react14.forwardRef)(
1048
1071
  className,
1049
1072
  children: [
1050
1073
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1051
- import_react15.Checkbox.HiddenInput,
1074
+ import_react16.Checkbox.HiddenInput,
1052
1075
  {
1053
1076
  ref,
1054
1077
  id,
@@ -1057,8 +1080,8 @@ var Checkbox = (0, import_react14.forwardRef)(
1057
1080
  onChange
1058
1081
  }
1059
1082
  ),
1060
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react15.Checkbox.Control, {}),
1061
- children && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react15.Checkbox.Label, { children })
1083
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react16.Checkbox.Control, {}),
1084
+ children && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react16.Checkbox.Label, { children })
1062
1085
  ]
1063
1086
  }
1064
1087
  );
@@ -1066,7 +1089,7 @@ var Checkbox = (0, import_react14.forwardRef)(
1066
1089
  );
1067
1090
 
1068
1091
  // src/components/ui/FormField.tsx
1069
- var import_react16 = require("@chakra-ui/react");
1092
+ var import_react17 = require("@chakra-ui/react");
1070
1093
  var import_jsx_runtime11 = require("react/jsx-runtime");
1071
1094
  function FormField({
1072
1095
  label,
@@ -1079,22 +1102,361 @@ function FormField({
1079
1102
  htmlFor,
1080
1103
  className
1081
1104
  }) {
1082
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react16.Field.Root, { invalid, disabled, className, children: [
1083
- label && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react16.Field.Label, { htmlFor, children: [
1105
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react17.Field.Root, { invalid, disabled, className, children: [
1106
+ label && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react17.Field.Label, { htmlFor, children: [
1084
1107
  label,
1085
- required && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react16.Field.RequiredIndicator, {})
1108
+ required && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react17.Field.RequiredIndicator, {})
1086
1109
  ] }),
1087
1110
  children,
1088
- helperText && !invalid && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react16.Field.HelperText, { children: helperText }),
1089
- invalid && errorText && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react16.Field.ErrorText, { children: errorText })
1111
+ helperText && !invalid && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react17.Field.HelperText, { children: helperText }),
1112
+ invalid && errorText && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react17.Field.ErrorText, { children: errorText })
1090
1113
  ] });
1091
1114
  }
1092
1115
 
1093
- // src/providers/ThemeSharedProvider.tsx
1116
+ // src/components/change-password/ChangePassword.tsx
1117
+ var import_react18 = require("react");
1094
1118
  var import_react19 = require("@chakra-ui/react");
1119
+ var import_react_hook_form = require("react-hook-form");
1120
+ var import_core4 = require("@abpjs/core");
1121
+ var import_lucide_react3 = require("lucide-react");
1122
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1123
+ function ChangePassword({
1124
+ visible,
1125
+ onVisibleChange
1126
+ }) {
1127
+ const { t } = (0, import_core4.useLocalization)();
1128
+ const { changePassword } = (0, import_core4.useProfile)();
1129
+ const toaster = useToaster();
1130
+ const {
1131
+ register,
1132
+ handleSubmit,
1133
+ watch,
1134
+ reset,
1135
+ formState: { errors, isSubmitting }
1136
+ } = (0, import_react_hook_form.useForm)({
1137
+ defaultValues: {
1138
+ password: "",
1139
+ newPassword: "",
1140
+ repeatNewPassword: ""
1141
+ }
1142
+ });
1143
+ const newPassword = watch("newPassword");
1144
+ (0, import_react18.useEffect)(() => {
1145
+ if (visible) {
1146
+ reset();
1147
+ }
1148
+ }, [visible, reset]);
1149
+ const onSubmit = async (data) => {
1150
+ try {
1151
+ await changePassword({
1152
+ currentPassword: data.password,
1153
+ newPassword: data.newPassword
1154
+ });
1155
+ toaster.success(
1156
+ t("AbpIdentity::PasswordChangedMessage") || "Password changed successfully",
1157
+ t("AbpUi::Success") || "Success"
1158
+ );
1159
+ onVisibleChange(false);
1160
+ } catch (error) {
1161
+ toaster.error(
1162
+ error instanceof Error ? error.message : "An error occurred",
1163
+ t("AbpIdentity::PasswordChangeFailed") || "Failed to change password"
1164
+ );
1165
+ }
1166
+ };
1167
+ const handleClose = () => {
1168
+ if (!isSubmitting) {
1169
+ onVisibleChange(false);
1170
+ }
1171
+ };
1172
+ const passwordValidation = {
1173
+ required: t("AbpIdentity::ThisFieldIsRequired") || "This field is required",
1174
+ minLength: {
1175
+ value: 6,
1176
+ message: t("AbpIdentity::PasswordTooShort") || "Password must be at least 6 characters"
1177
+ },
1178
+ validate: {
1179
+ hasLowercase: (value) => /[a-z]/.test(value) || t("AbpIdentity::PasswordRequiresLower") || "Password must contain a lowercase letter",
1180
+ hasUppercase: (value) => /[A-Z]/.test(value) || t("AbpIdentity::PasswordRequiresUpper") || "Password must contain an uppercase letter",
1181
+ hasNumber: (value) => /[0-9]/.test(value) || t("AbpIdentity::PasswordRequiresDigit") || "Password must contain a number",
1182
+ hasSpecial: (value) => /[!@#$%^&*(),.?":{}|<>]/.test(value) || t("AbpIdentity::PasswordRequiresNonAlphanumeric") || "Password must contain a special character"
1183
+ }
1184
+ };
1185
+ const modalFooter = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1186
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react19.Button, { variant: "ghost", mr: 3, onClick: handleClose, disabled: isSubmitting, children: t("AbpIdentity::Cancel") || "Cancel" }),
1187
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1188
+ import_react19.Button,
1189
+ {
1190
+ colorPalette: "blue",
1191
+ type: "submit",
1192
+ loading: isSubmitting,
1193
+ form: "change-password-form",
1194
+ children: [
1195
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Check, { size: 16 }),
1196
+ t("AbpIdentity::Save") || "Save"
1197
+ ]
1198
+ }
1199
+ )
1200
+ ] });
1201
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1202
+ Modal,
1203
+ {
1204
+ visible,
1205
+ onVisibleChange,
1206
+ busy: isSubmitting,
1207
+ header: t("AbpIdentity::ChangePassword") || "Change Password",
1208
+ footer: modalFooter,
1209
+ centered: true,
1210
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("form", { id: "change-password-form", onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react19.VStack, { gap: 4, children: [
1211
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react19.Field.Root, { invalid: !!errors.password, children: [
1212
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react19.Field.Label, { children: [
1213
+ t("AbpIdentity::DisplayName:CurrentPassword") || "Current Password",
1214
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react19.Field.RequiredIndicator, {})
1215
+ ] }),
1216
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1217
+ import_react19.Input,
1218
+ {
1219
+ type: "password",
1220
+ ...register("password", {
1221
+ required: t("AbpIdentity::ThisFieldIsRequired") || "This field is required"
1222
+ })
1223
+ }
1224
+ ),
1225
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react19.Field.ErrorText, { children: errors.password?.message })
1226
+ ] }),
1227
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react19.Field.Root, { invalid: !!errors.newPassword, children: [
1228
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react19.Field.Label, { children: [
1229
+ t("AbpIdentity::DisplayName:NewPassword") || "New Password",
1230
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react19.Field.RequiredIndicator, {})
1231
+ ] }),
1232
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1233
+ import_react19.Input,
1234
+ {
1235
+ type: "password",
1236
+ ...register("newPassword", passwordValidation)
1237
+ }
1238
+ ),
1239
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react19.Field.ErrorText, { children: errors.newPassword?.message })
1240
+ ] }),
1241
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react19.Field.Root, { invalid: !!errors.repeatNewPassword, children: [
1242
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react19.Field.Label, { children: [
1243
+ t("AbpIdentity::DisplayName:NewPasswordConfirm") || "Confirm New Password",
1244
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react19.Field.RequiredIndicator, {})
1245
+ ] }),
1246
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1247
+ import_react19.Input,
1248
+ {
1249
+ type: "password",
1250
+ ...register("repeatNewPassword", {
1251
+ required: t("AbpIdentity::ThisFieldIsRequired") || "This field is required",
1252
+ validate: (value) => value === newPassword || t("AbpIdentity::Identity.PasswordConfirmationFailed") || "Passwords do not match"
1253
+ })
1254
+ }
1255
+ ),
1256
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react19.Field.ErrorText, { children: errors.repeatNewPassword?.message })
1257
+ ] })
1258
+ ] }) })
1259
+ }
1260
+ );
1261
+ }
1262
+
1263
+ // src/components/profile/Profile.tsx
1264
+ var import_react20 = require("react");
1265
+ var import_react21 = require("@chakra-ui/react");
1266
+ var import_react_hook_form2 = require("react-hook-form");
1267
+ var import_core5 = require("@abpjs/core");
1268
+ var import_lucide_react4 = require("lucide-react");
1269
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1270
+ function Profile({
1271
+ visible,
1272
+ onVisibleChange
1273
+ }) {
1274
+ const { t } = (0, import_core5.useLocalization)();
1275
+ const { profile, fetchProfile, updateProfile, loading } = (0, import_core5.useProfile)();
1276
+ const toaster = useToaster();
1277
+ const {
1278
+ register,
1279
+ handleSubmit,
1280
+ reset,
1281
+ formState: { errors, isSubmitting }
1282
+ } = (0, import_react_hook_form2.useForm)({
1283
+ defaultValues: {
1284
+ userName: "",
1285
+ email: "",
1286
+ name: "",
1287
+ surname: "",
1288
+ phoneNumber: ""
1289
+ }
1290
+ });
1291
+ const modalBusy = isSubmitting || loading;
1292
+ (0, import_react20.useEffect)(() => {
1293
+ if (visible) {
1294
+ fetchProfile().then(() => {
1295
+ });
1296
+ }
1297
+ }, [visible, fetchProfile]);
1298
+ (0, import_react20.useEffect)(() => {
1299
+ if (profile) {
1300
+ reset({
1301
+ userName: profile.userName || "",
1302
+ email: profile.email || "",
1303
+ name: profile.name || "",
1304
+ surname: profile.surname || "",
1305
+ phoneNumber: profile.phoneNumber || ""
1306
+ });
1307
+ }
1308
+ }, [profile, reset]);
1309
+ const onSubmit = async (data) => {
1310
+ try {
1311
+ await updateProfile(data);
1312
+ toaster.success(
1313
+ t("AbpIdentity::ProfileUpdatedMessage") || "Profile updated successfully",
1314
+ t("AbpUi::Success") || "Success"
1315
+ );
1316
+ onVisibleChange(false);
1317
+ } catch (error) {
1318
+ toaster.error(
1319
+ error instanceof Error ? error.message : "An error occurred",
1320
+ t("AbpIdentity::ProfileUpdateFailed") || "Failed to update profile"
1321
+ );
1322
+ }
1323
+ };
1324
+ const handleClose = () => {
1325
+ if (!modalBusy) {
1326
+ onVisibleChange(false);
1327
+ }
1328
+ };
1329
+ const modalFooter = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1330
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Button, { variant: "ghost", mr: 3, onClick: handleClose, disabled: modalBusy, children: t("AbpIdentity::Cancel") || "Cancel" }),
1331
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1332
+ import_react21.Button,
1333
+ {
1334
+ colorPalette: "blue",
1335
+ type: "submit",
1336
+ loading: modalBusy,
1337
+ form: "profile-form",
1338
+ children: [
1339
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Check, { size: 16 }),
1340
+ t("AbpIdentity::Save") || "Save"
1341
+ ]
1342
+ }
1343
+ )
1344
+ ] });
1345
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1346
+ Modal,
1347
+ {
1348
+ visible,
1349
+ onVisibleChange,
1350
+ busy: modalBusy,
1351
+ header: t("AbpIdentity::PersonalInfo") || "Personal Info",
1352
+ footer: modalFooter,
1353
+ size: "lg",
1354
+ centered: true,
1355
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("form", { id: "profile-form", onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react21.VStack, { gap: 4, children: [
1356
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react21.Field.Root, { invalid: !!errors.userName, children: [
1357
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react21.Field.Label, { children: [
1358
+ t("AbpIdentity::DisplayName:UserName") || "Username",
1359
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Field.RequiredIndicator, {})
1360
+ ] }),
1361
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1362
+ import_react21.Input,
1363
+ {
1364
+ type: "text",
1365
+ ...register("userName", {
1366
+ required: t("AbpIdentity::ThisFieldIsRequired") || "This field is required",
1367
+ maxLength: {
1368
+ value: 256,
1369
+ message: "Maximum 256 characters"
1370
+ }
1371
+ })
1372
+ }
1373
+ ),
1374
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Field.ErrorText, { children: errors.userName?.message })
1375
+ ] }),
1376
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react21.HStack, { gap: 4, w: "full", children: [
1377
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react21.Field.Root, { invalid: !!errors.name, flex: 1, children: [
1378
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Field.Label, { children: t("AbpIdentity::DisplayName:Name") || "Name" }),
1379
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1380
+ import_react21.Input,
1381
+ {
1382
+ type: "text",
1383
+ ...register("name", {
1384
+ maxLength: {
1385
+ value: 64,
1386
+ message: "Maximum 64 characters"
1387
+ }
1388
+ })
1389
+ }
1390
+ ),
1391
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Field.ErrorText, { children: errors.name?.message })
1392
+ ] }),
1393
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react21.Field.Root, { invalid: !!errors.surname, flex: 1, children: [
1394
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Field.Label, { children: t("AbpIdentity::DisplayName:Surname") || "Surname" }),
1395
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1396
+ import_react21.Input,
1397
+ {
1398
+ type: "text",
1399
+ ...register("surname", {
1400
+ maxLength: {
1401
+ value: 64,
1402
+ message: "Maximum 64 characters"
1403
+ }
1404
+ })
1405
+ }
1406
+ ),
1407
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Field.ErrorText, { children: errors.surname?.message })
1408
+ ] })
1409
+ ] }),
1410
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react21.Field.Root, { invalid: !!errors.email, children: [
1411
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react21.Field.Label, { children: [
1412
+ t("AbpIdentity::DisplayName:EmailAddress") || "Email Address",
1413
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Field.RequiredIndicator, {})
1414
+ ] }),
1415
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1416
+ import_react21.Input,
1417
+ {
1418
+ type: "email",
1419
+ ...register("email", {
1420
+ required: t("AbpIdentity::ThisFieldIsRequired") || "This field is required",
1421
+ pattern: {
1422
+ value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
1423
+ message: t("AbpIdentity::InvalidEmail") || "Invalid email address"
1424
+ },
1425
+ maxLength: {
1426
+ value: 256,
1427
+ message: "Maximum 256 characters"
1428
+ }
1429
+ })
1430
+ }
1431
+ ),
1432
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Field.ErrorText, { children: errors.email?.message })
1433
+ ] }),
1434
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react21.Field.Root, { invalid: !!errors.phoneNumber, children: [
1435
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Field.Label, { children: t("AbpIdentity::DisplayName:PhoneNumber") || "Phone Number" }),
1436
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1437
+ import_react21.Input,
1438
+ {
1439
+ type: "tel",
1440
+ ...register("phoneNumber", {
1441
+ maxLength: {
1442
+ value: 16,
1443
+ message: "Maximum 16 characters"
1444
+ }
1445
+ })
1446
+ }
1447
+ ),
1448
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Field.ErrorText, { children: errors.phoneNumber?.message })
1449
+ ] })
1450
+ ] }) })
1451
+ }
1452
+ );
1453
+ }
1454
+
1455
+ // src/providers/ThemeSharedProvider.tsx
1456
+ var import_react24 = require("@chakra-ui/react");
1095
1457
 
1096
1458
  // src/theme/index.ts
1097
- var import_react17 = require("@chakra-ui/react");
1459
+ var import_react22 = require("@chakra-ui/react");
1098
1460
  var colors = {
1099
1461
  brand: {
1100
1462
  50: { value: "#e3f2fd" },
@@ -1297,7 +1659,7 @@ var semanticTokens = {
1297
1659
  // },
1298
1660
  // },
1299
1661
  };
1300
- var defaultAbpConfig = (0, import_react17.defineConfig)({
1662
+ var defaultAbpConfig = (0, import_react22.defineConfig)({
1301
1663
  theme: {
1302
1664
  tokens: {
1303
1665
  colors,
@@ -1319,20 +1681,20 @@ var defaultAbpConfig = (0, import_react17.defineConfig)({
1319
1681
  });
1320
1682
  function createAbpSystem(overrides) {
1321
1683
  if (overrides) {
1322
- return (0, import_react17.createSystem)(import_react17.defaultConfig, defaultAbpConfig, overrides);
1684
+ return (0, import_react22.createSystem)(import_react22.defaultConfig, defaultAbpConfig, overrides);
1323
1685
  }
1324
- return (0, import_react17.createSystem)(import_react17.defaultConfig, defaultAbpConfig);
1686
+ return (0, import_react22.createSystem)(import_react22.defaultConfig, defaultAbpConfig);
1325
1687
  }
1326
1688
  var abpSystem = createAbpSystem();
1327
1689
 
1328
1690
  // src/components/ui/color-mode.tsx
1329
- var import_react18 = require("@chakra-ui/react");
1691
+ var import_react23 = require("@chakra-ui/react");
1330
1692
  var import_next_themes = require("next-themes");
1331
- var React8 = __toESM(require("react"));
1332
- var import_lucide_react3 = require("lucide-react");
1333
- var import_jsx_runtime12 = require("react/jsx-runtime");
1693
+ var React11 = __toESM(require("react"));
1694
+ var import_lucide_react5 = require("lucide-react");
1695
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1334
1696
  function ColorModeProvider(props) {
1335
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_next_themes.ThemeProvider, { attribute: "class", disableTransitionOnChange: true, ...props });
1697
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_next_themes.ThemeProvider, { attribute: "class", disableTransitionOnChange: true, ...props });
1336
1698
  }
1337
1699
  function useColorMode() {
1338
1700
  const { resolvedTheme, setTheme, forcedTheme } = (0, import_next_themes.useTheme)();
@@ -1348,12 +1710,12 @@ function useColorMode() {
1348
1710
  }
1349
1711
  function ColorModeIcon() {
1350
1712
  const { colorMode } = useColorMode();
1351
- return colorMode === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Moon, {}) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Sun, {});
1713
+ return colorMode === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.Moon, {}) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.Sun, {});
1352
1714
  }
1353
- var ColorModeButton = React8.forwardRef(function ColorModeButton2(props, ref) {
1715
+ var ColorModeButton = React11.forwardRef(function ColorModeButton2(props, ref) {
1354
1716
  const { toggleColorMode } = useColorMode();
1355
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react18.ClientOnly, { fallback: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react18.Skeleton, { boxSize: "9" }), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1356
- import_react18.IconButton,
1717
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react23.ClientOnly, { fallback: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react23.Skeleton, { boxSize: "9" }), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1718
+ import_react23.IconButton,
1357
1719
  {
1358
1720
  onClick: toggleColorMode,
1359
1721
  variant: "ghost",
@@ -1367,14 +1729,14 @@ var ColorModeButton = React8.forwardRef(function ColorModeButton2(props, ref) {
1367
1729
  height: "5"
1368
1730
  }
1369
1731
  },
1370
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ColorModeIcon, {})
1732
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ColorModeIcon, {})
1371
1733
  }
1372
1734
  ) });
1373
1735
  });
1374
- var LightMode = React8.forwardRef(
1736
+ var LightMode = React11.forwardRef(
1375
1737
  function LightMode2(props, ref) {
1376
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1377
- import_react18.Span,
1738
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1739
+ import_react23.Span,
1378
1740
  {
1379
1741
  color: "fg",
1380
1742
  display: "contents",
@@ -1387,10 +1749,10 @@ var LightMode = React8.forwardRef(
1387
1749
  );
1388
1750
  }
1389
1751
  );
1390
- var DarkMode = React8.forwardRef(
1752
+ var DarkMode = React11.forwardRef(
1391
1753
  function DarkMode2(props, ref) {
1392
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1393
- import_react18.Span,
1754
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1755
+ import_react23.Span,
1394
1756
  {
1395
1757
  color: "fg",
1396
1758
  display: "contents",
@@ -1405,8 +1767,8 @@ var DarkMode = React8.forwardRef(
1405
1767
  );
1406
1768
 
1407
1769
  // src/providers/ThemeSharedProvider.tsx
1408
- var import_core4 = require("@abpjs/core");
1409
- var import_jsx_runtime13 = require("react/jsx-runtime");
1770
+ var import_core6 = require("@abpjs/core");
1771
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1410
1772
  function ThemeSharedProvider({
1411
1773
  children,
1412
1774
  renderToasts = true,
@@ -1418,15 +1780,15 @@ function ThemeSharedProvider({
1418
1780
  locale = "en-US"
1419
1781
  }) {
1420
1782
  const system = themeOverrides ? createAbpSystem(themeOverrides) : abpSystem;
1421
- const { endSide } = (0, import_core4.useDirection)();
1783
+ const { endSide } = (0, import_core6.useDirection)();
1422
1784
  toastPosition = `bottom-${endSide}`;
1423
- const content = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToasterProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(ConfirmationProvider, { children: [
1785
+ const content = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ToasterProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(ConfirmationProvider, { children: [
1424
1786
  children,
1425
- renderToasts && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToastContainer, { position: toastPosition }),
1426
- renderConfirmation && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ConfirmationDialog, {})
1787
+ renderToasts && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ToastContainer, { position: toastPosition }),
1788
+ renderConfirmation && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ConfirmationDialog, {})
1427
1789
  ] }) });
1428
1790
  const colorModeProps = enableColorMode ? { defaultTheme: defaultColorMode } : { forcedTheme: "light" };
1429
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react19.ChakraProvider, { value: system, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react19.LocaleProvider, { locale, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ColorModeProvider, { ...colorModeProps, children: content }) }) });
1791
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react24.ChakraProvider, { value: system, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react24.LocaleProvider, { locale, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ColorModeProvider, { ...colorModeProps, children: content }) }) });
1430
1792
  }
1431
1793
 
1432
1794
  // src/utils/styles.ts
@@ -1507,6 +1869,7 @@ function injectThemeSharedStyles() {
1507
1869
  Alert,
1508
1870
  Button,
1509
1871
  ChakraDialog,
1872
+ ChangePassword,
1510
1873
  Checkbox,
1511
1874
  ConfirmationDialog,
1512
1875
  ConfirmationProvider,
@@ -1518,6 +1881,7 @@ function injectThemeSharedStyles() {
1518
1881
  ModalBody,
1519
1882
  ModalFooter,
1520
1883
  ModalHeader,
1884
+ Profile,
1521
1885
  THEME_SHARED_STYLES,
1522
1886
  ThemeSharedProvider,
1523
1887
  ToastContainer,