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