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