@thetechfossil/auth2 1.2.16 → 1.2.17

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.
@@ -4466,6 +4466,68 @@ var ChangePassword = ({ onSuccess, appearance }) => {
4466
4466
  )
4467
4467
  ] }) });
4468
4468
  };
4469
+
4470
+ // src/react/components/utils/injectModalStyles.ts
4471
+ var injectModalStyles = () => {
4472
+ if (document.getElementById("ttf-auth-modal-styles")) {
4473
+ return;
4474
+ }
4475
+ const styleElement = document.createElement("style");
4476
+ styleElement.id = "ttf-auth-modal-styles";
4477
+ styleElement.textContent = `
4478
+ /* ImageManager Modal Styles - Critical for proper modal display */
4479
+ /* Radix UI Dialog styles - Force visibility */
4480
+ [data-radix-portal] {
4481
+ z-index: 99999 !important;
4482
+ position: fixed !important;
4483
+ inset: 0 !important;
4484
+ pointer-events: none !important;
4485
+ }
4486
+
4487
+ [data-radix-portal] > * {
4488
+ pointer-events: auto !important;
4489
+ }
4490
+
4491
+ /* Dialog Overlay */
4492
+ [data-state="open"][data-radix-dialog-overlay],
4493
+ [role="dialog"] + [data-radix-dialog-overlay] {
4494
+ position: fixed !important;
4495
+ inset: 0 !important;
4496
+ z-index: 99998 !important;
4497
+ background-color: rgba(0, 0, 0, 0.6) !important;
4498
+ pointer-events: auto !important;
4499
+ }
4500
+
4501
+ /* Dialog Content - Center the modal properly */
4502
+ [data-state="open"][data-radix-dialog-content],
4503
+ [role="dialog"][data-radix-dialog-content] {
4504
+ position: fixed !important;
4505
+ left: 50% !important;
4506
+ top: 50% !important;
4507
+ transform: translate(-50%, -50%) !important;
4508
+ z-index: 99999 !important;
4509
+ background: white !important;
4510
+ border-radius: 16px !important;
4511
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
4512
+ pointer-events: auto !important;
4513
+ width: 95vw !important;
4514
+ max-width: 1280px !important;
4515
+ height: 90vh !important;
4516
+ max-height: 90vh !important;
4517
+ min-width: 800px !important;
4518
+ min-height: 600px !important;
4519
+ overflow: hidden !important;
4520
+ }
4521
+
4522
+ /* Dark mode support */
4523
+ .dark [data-state="open"][data-radix-dialog-content],
4524
+ .dark [role="dialog"][data-radix-dialog-content] {
4525
+ background: #0f172a !important;
4526
+ border: 1px solid #334155 !important;
4527
+ }
4528
+ `;
4529
+ document.head.appendChild(styleElement);
4530
+ };
4469
4531
  var AvatarUploader = ({
4470
4532
  onUploadComplete,
4471
4533
  onError,
@@ -4476,13 +4538,21 @@ var AvatarUploader = ({
4476
4538
  upfilesConfig,
4477
4539
  buttonText = "Upload Avatar"
4478
4540
  }) => {
4479
- const { uploadAndUpdateAvatar } = useAuth2();
4541
+ const { user, updateProfile } = useAuth2();
4480
4542
  const [open, setOpen] = React.useState(false);
4481
4543
  const [uploading, setUploading] = React.useState(false);
4544
+ React.useEffect(() => {
4545
+ injectModalStyles();
4546
+ }, []);
4547
+ const effectiveFolderPath = React.useMemo(() => {
4548
+ if (user?.id) {
4549
+ return `users/${user.id}/`;
4550
+ }
4551
+ return upfilesConfig.folderPath || "/";
4552
+ }, [user?.id, upfilesConfig.folderPath]);
4482
4553
  const handleSelect = async (image) => {
4483
4554
  setUploading(true);
4484
4555
  try {
4485
- const { updateProfile } = useAuth2();
4486
4556
  const response = await updateProfile({ avatar: image.url });
4487
4557
  if (response.success && response.user?.avatar) {
4488
4558
  onUploadComplete?.(response.user.avatar);
@@ -4521,7 +4591,7 @@ var AvatarUploader = ({
4521
4591
  presignPath: upfilesConfig.presignPath
4522
4592
  },
4523
4593
  projectId: upfilesConfig.projectId,
4524
- folderPath: upfilesConfig.folderPath || "avatars/",
4594
+ folderPath: effectiveFolderPath,
4525
4595
  title: "Select Avatar",
4526
4596
  description: "Upload a new avatar or select from existing images.",
4527
4597
  mode: "full",
@@ -4848,8 +4918,17 @@ var AvatarManager = ({
4848
4918
  onDelete,
4849
4919
  upfilesConfig
4850
4920
  }) => {
4851
- const { updateProfile } = useAuth2();
4921
+ const { user, updateProfile } = useAuth2();
4852
4922
  const [updating, setUpdating] = React.useState(false);
4923
+ React.useEffect(() => {
4924
+ injectModalStyles();
4925
+ }, []);
4926
+ const effectiveFolderPath = React.useMemo(() => {
4927
+ if (user?.id) {
4928
+ return `users/${user.id}/`;
4929
+ }
4930
+ return upfilesConfig.folderPath || "/";
4931
+ }, [user?.id, upfilesConfig.folderPath]);
4853
4932
  const handleSelect = async (image) => {
4854
4933
  setUpdating(true);
4855
4934
  try {
@@ -4882,7 +4961,7 @@ var AvatarManager = ({
4882
4961
  withCredentials: upfilesConfig.withCredentials
4883
4962
  },
4884
4963
  projectId,
4885
- folderPath: upfilesConfig.folderPath || "/",
4964
+ folderPath: effectiveFolderPath,
4886
4965
  title,
4887
4966
  description,
4888
4967
  className,