@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.
@@ -4459,6 +4459,68 @@ var ChangePassword = ({ onSuccess, appearance }) => {
4459
4459
  )
4460
4460
  ] }) });
4461
4461
  };
4462
+
4463
+ // src/react/components/utils/injectModalStyles.ts
4464
+ var injectModalStyles = () => {
4465
+ if (document.getElementById("ttf-auth-modal-styles")) {
4466
+ return;
4467
+ }
4468
+ const styleElement = document.createElement("style");
4469
+ styleElement.id = "ttf-auth-modal-styles";
4470
+ styleElement.textContent = `
4471
+ /* ImageManager Modal Styles - Critical for proper modal display */
4472
+ /* Radix UI Dialog styles - Force visibility */
4473
+ [data-radix-portal] {
4474
+ z-index: 99999 !important;
4475
+ position: fixed !important;
4476
+ inset: 0 !important;
4477
+ pointer-events: none !important;
4478
+ }
4479
+
4480
+ [data-radix-portal] > * {
4481
+ pointer-events: auto !important;
4482
+ }
4483
+
4484
+ /* Dialog Overlay */
4485
+ [data-state="open"][data-radix-dialog-overlay],
4486
+ [role="dialog"] + [data-radix-dialog-overlay] {
4487
+ position: fixed !important;
4488
+ inset: 0 !important;
4489
+ z-index: 99998 !important;
4490
+ background-color: rgba(0, 0, 0, 0.6) !important;
4491
+ pointer-events: auto !important;
4492
+ }
4493
+
4494
+ /* Dialog Content - Center the modal properly */
4495
+ [data-state="open"][data-radix-dialog-content],
4496
+ [role="dialog"][data-radix-dialog-content] {
4497
+ position: fixed !important;
4498
+ left: 50% !important;
4499
+ top: 50% !important;
4500
+ transform: translate(-50%, -50%) !important;
4501
+ z-index: 99999 !important;
4502
+ background: white !important;
4503
+ border-radius: 16px !important;
4504
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
4505
+ pointer-events: auto !important;
4506
+ width: 95vw !important;
4507
+ max-width: 1280px !important;
4508
+ height: 90vh !important;
4509
+ max-height: 90vh !important;
4510
+ min-width: 800px !important;
4511
+ min-height: 600px !important;
4512
+ overflow: hidden !important;
4513
+ }
4514
+
4515
+ /* Dark mode support */
4516
+ .dark [data-state="open"][data-radix-dialog-content],
4517
+ .dark [role="dialog"][data-radix-dialog-content] {
4518
+ background: #0f172a !important;
4519
+ border: 1px solid #334155 !important;
4520
+ }
4521
+ `;
4522
+ document.head.appendChild(styleElement);
4523
+ };
4462
4524
  var AvatarUploader = ({
4463
4525
  onUploadComplete,
4464
4526
  onError,
@@ -4469,13 +4531,21 @@ var AvatarUploader = ({
4469
4531
  upfilesConfig,
4470
4532
  buttonText = "Upload Avatar"
4471
4533
  }) => {
4472
- const { uploadAndUpdateAvatar } = useAuth2();
4534
+ const { user, updateProfile } = useAuth2();
4473
4535
  const [open, setOpen] = useState(false);
4474
4536
  const [uploading, setUploading] = useState(false);
4537
+ useEffect(() => {
4538
+ injectModalStyles();
4539
+ }, []);
4540
+ const effectiveFolderPath = useMemo(() => {
4541
+ if (user?.id) {
4542
+ return `users/${user.id}/`;
4543
+ }
4544
+ return upfilesConfig.folderPath || "/";
4545
+ }, [user?.id, upfilesConfig.folderPath]);
4475
4546
  const handleSelect = async (image) => {
4476
4547
  setUploading(true);
4477
4548
  try {
4478
- const { updateProfile } = useAuth2();
4479
4549
  const response = await updateProfile({ avatar: image.url });
4480
4550
  if (response.success && response.user?.avatar) {
4481
4551
  onUploadComplete?.(response.user.avatar);
@@ -4514,7 +4584,7 @@ var AvatarUploader = ({
4514
4584
  presignPath: upfilesConfig.presignPath
4515
4585
  },
4516
4586
  projectId: upfilesConfig.projectId,
4517
- folderPath: upfilesConfig.folderPath || "avatars/",
4587
+ folderPath: effectiveFolderPath,
4518
4588
  title: "Select Avatar",
4519
4589
  description: "Upload a new avatar or select from existing images.",
4520
4590
  mode: "full",
@@ -4841,8 +4911,17 @@ var AvatarManager = ({
4841
4911
  onDelete,
4842
4912
  upfilesConfig
4843
4913
  }) => {
4844
- const { updateProfile } = useAuth2();
4914
+ const { user, updateProfile } = useAuth2();
4845
4915
  const [updating, setUpdating] = useState(false);
4916
+ useEffect(() => {
4917
+ injectModalStyles();
4918
+ }, []);
4919
+ const effectiveFolderPath = useMemo(() => {
4920
+ if (user?.id) {
4921
+ return `users/${user.id}/`;
4922
+ }
4923
+ return upfilesConfig.folderPath || "/";
4924
+ }, [user?.id, upfilesConfig.folderPath]);
4846
4925
  const handleSelect = async (image) => {
4847
4926
  setUpdating(true);
4848
4927
  try {
@@ -4875,7 +4954,7 @@ var AvatarManager = ({
4875
4954
  withCredentials: upfilesConfig.withCredentials
4876
4955
  },
4877
4956
  projectId,
4878
- folderPath: upfilesConfig.folderPath || "/",
4957
+ folderPath: effectiveFolderPath,
4879
4958
  title,
4880
4959
  description,
4881
4960
  className,