@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.
@@ -4130,6 +4130,68 @@ var ChangePassword = ({ onSuccess, appearance }) => {
4130
4130
  )
4131
4131
  ] }) });
4132
4132
  };
4133
+
4134
+ // src/react/components/utils/injectModalStyles.ts
4135
+ var injectModalStyles = () => {
4136
+ if (document.getElementById("ttf-auth-modal-styles")) {
4137
+ return;
4138
+ }
4139
+ const styleElement = document.createElement("style");
4140
+ styleElement.id = "ttf-auth-modal-styles";
4141
+ styleElement.textContent = `
4142
+ /* ImageManager Modal Styles - Critical for proper modal display */
4143
+ /* Radix UI Dialog styles - Force visibility */
4144
+ [data-radix-portal] {
4145
+ z-index: 99999 !important;
4146
+ position: fixed !important;
4147
+ inset: 0 !important;
4148
+ pointer-events: none !important;
4149
+ }
4150
+
4151
+ [data-radix-portal] > * {
4152
+ pointer-events: auto !important;
4153
+ }
4154
+
4155
+ /* Dialog Overlay */
4156
+ [data-state="open"][data-radix-dialog-overlay],
4157
+ [role="dialog"] + [data-radix-dialog-overlay] {
4158
+ position: fixed !important;
4159
+ inset: 0 !important;
4160
+ z-index: 99998 !important;
4161
+ background-color: rgba(0, 0, 0, 0.6) !important;
4162
+ pointer-events: auto !important;
4163
+ }
4164
+
4165
+ /* Dialog Content - Center the modal properly */
4166
+ [data-state="open"][data-radix-dialog-content],
4167
+ [role="dialog"][data-radix-dialog-content] {
4168
+ position: fixed !important;
4169
+ left: 50% !important;
4170
+ top: 50% !important;
4171
+ transform: translate(-50%, -50%) !important;
4172
+ z-index: 99999 !important;
4173
+ background: white !important;
4174
+ border-radius: 16px !important;
4175
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
4176
+ pointer-events: auto !important;
4177
+ width: 95vw !important;
4178
+ max-width: 1280px !important;
4179
+ height: 90vh !important;
4180
+ max-height: 90vh !important;
4181
+ min-width: 800px !important;
4182
+ min-height: 600px !important;
4183
+ overflow: hidden !important;
4184
+ }
4185
+
4186
+ /* Dark mode support */
4187
+ .dark [data-state="open"][data-radix-dialog-content],
4188
+ .dark [role="dialog"][data-radix-dialog-content] {
4189
+ background: #0f172a !important;
4190
+ border: 1px solid #334155 !important;
4191
+ }
4192
+ `;
4193
+ document.head.appendChild(styleElement);
4194
+ };
4133
4195
  var AvatarUploader = ({
4134
4196
  onUploadComplete,
4135
4197
  onError,
@@ -4140,13 +4202,21 @@ var AvatarUploader = ({
4140
4202
  upfilesConfig,
4141
4203
  buttonText = "Upload Avatar"
4142
4204
  }) => {
4143
- const { uploadAndUpdateAvatar } = useAuth2();
4205
+ const { user, updateProfile } = useAuth2();
4144
4206
  const [open, setOpen] = useState(false);
4145
4207
  const [uploading, setUploading] = useState(false);
4208
+ useEffect(() => {
4209
+ injectModalStyles();
4210
+ }, []);
4211
+ const effectiveFolderPath = useMemo(() => {
4212
+ if (user?.id) {
4213
+ return `users/${user.id}/`;
4214
+ }
4215
+ return upfilesConfig.folderPath || "/";
4216
+ }, [user?.id, upfilesConfig.folderPath]);
4146
4217
  const handleSelect = async (image) => {
4147
4218
  setUploading(true);
4148
4219
  try {
4149
- const { updateProfile } = useAuth2();
4150
4220
  const response = await updateProfile({ avatar: image.url });
4151
4221
  if (response.success && response.user?.avatar) {
4152
4222
  onUploadComplete?.(response.user.avatar);
@@ -4185,7 +4255,7 @@ var AvatarUploader = ({
4185
4255
  presignPath: upfilesConfig.presignPath
4186
4256
  },
4187
4257
  projectId: upfilesConfig.projectId,
4188
- folderPath: upfilesConfig.folderPath || "avatars/",
4258
+ folderPath: effectiveFolderPath,
4189
4259
  title: "Select Avatar",
4190
4260
  description: "Upload a new avatar or select from existing images.",
4191
4261
  mode: "full",
@@ -4512,8 +4582,17 @@ var AvatarManager = ({
4512
4582
  onDelete,
4513
4583
  upfilesConfig
4514
4584
  }) => {
4515
- const { updateProfile } = useAuth2();
4585
+ const { user, updateProfile } = useAuth2();
4516
4586
  const [updating, setUpdating] = useState(false);
4587
+ useEffect(() => {
4588
+ injectModalStyles();
4589
+ }, []);
4590
+ const effectiveFolderPath = useMemo(() => {
4591
+ if (user?.id) {
4592
+ return `users/${user.id}/`;
4593
+ }
4594
+ return upfilesConfig.folderPath || "/";
4595
+ }, [user?.id, upfilesConfig.folderPath]);
4517
4596
  const handleSelect = async (image) => {
4518
4597
  setUpdating(true);
4519
4598
  try {
@@ -4546,7 +4625,7 @@ var AvatarManager = ({
4546
4625
  withCredentials: upfilesConfig.withCredentials
4547
4626
  },
4548
4627
  projectId,
4549
- folderPath: upfilesConfig.folderPath || "/",
4628
+ folderPath: effectiveFolderPath,
4550
4629
  title,
4551
4630
  description,
4552
4631
  className,