@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.
@@ -4137,6 +4137,68 @@ var ChangePassword = ({ onSuccess, appearance }) => {
4137
4137
  )
4138
4138
  ] }) });
4139
4139
  };
4140
+
4141
+ // src/react/components/utils/injectModalStyles.ts
4142
+ var injectModalStyles = () => {
4143
+ if (document.getElementById("ttf-auth-modal-styles")) {
4144
+ return;
4145
+ }
4146
+ const styleElement = document.createElement("style");
4147
+ styleElement.id = "ttf-auth-modal-styles";
4148
+ styleElement.textContent = `
4149
+ /* ImageManager Modal Styles - Critical for proper modal display */
4150
+ /* Radix UI Dialog styles - Force visibility */
4151
+ [data-radix-portal] {
4152
+ z-index: 99999 !important;
4153
+ position: fixed !important;
4154
+ inset: 0 !important;
4155
+ pointer-events: none !important;
4156
+ }
4157
+
4158
+ [data-radix-portal] > * {
4159
+ pointer-events: auto !important;
4160
+ }
4161
+
4162
+ /* Dialog Overlay */
4163
+ [data-state="open"][data-radix-dialog-overlay],
4164
+ [role="dialog"] + [data-radix-dialog-overlay] {
4165
+ position: fixed !important;
4166
+ inset: 0 !important;
4167
+ z-index: 99998 !important;
4168
+ background-color: rgba(0, 0, 0, 0.6) !important;
4169
+ pointer-events: auto !important;
4170
+ }
4171
+
4172
+ /* Dialog Content - Center the modal properly */
4173
+ [data-state="open"][data-radix-dialog-content],
4174
+ [role="dialog"][data-radix-dialog-content] {
4175
+ position: fixed !important;
4176
+ left: 50% !important;
4177
+ top: 50% !important;
4178
+ transform: translate(-50%, -50%) !important;
4179
+ z-index: 99999 !important;
4180
+ background: white !important;
4181
+ border-radius: 16px !important;
4182
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
4183
+ pointer-events: auto !important;
4184
+ width: 95vw !important;
4185
+ max-width: 1280px !important;
4186
+ height: 90vh !important;
4187
+ max-height: 90vh !important;
4188
+ min-width: 800px !important;
4189
+ min-height: 600px !important;
4190
+ overflow: hidden !important;
4191
+ }
4192
+
4193
+ /* Dark mode support */
4194
+ .dark [data-state="open"][data-radix-dialog-content],
4195
+ .dark [role="dialog"][data-radix-dialog-content] {
4196
+ background: #0f172a !important;
4197
+ border: 1px solid #334155 !important;
4198
+ }
4199
+ `;
4200
+ document.head.appendChild(styleElement);
4201
+ };
4140
4202
  var AvatarUploader = ({
4141
4203
  onUploadComplete,
4142
4204
  onError,
@@ -4147,13 +4209,21 @@ var AvatarUploader = ({
4147
4209
  upfilesConfig,
4148
4210
  buttonText = "Upload Avatar"
4149
4211
  }) => {
4150
- const { uploadAndUpdateAvatar } = useAuth2();
4212
+ const { user, updateProfile } = useAuth2();
4151
4213
  const [open, setOpen] = React.useState(false);
4152
4214
  const [uploading, setUploading] = React.useState(false);
4215
+ React.useEffect(() => {
4216
+ injectModalStyles();
4217
+ }, []);
4218
+ const effectiveFolderPath = React.useMemo(() => {
4219
+ if (user?.id) {
4220
+ return `users/${user.id}/`;
4221
+ }
4222
+ return upfilesConfig.folderPath || "/";
4223
+ }, [user?.id, upfilesConfig.folderPath]);
4153
4224
  const handleSelect = async (image) => {
4154
4225
  setUploading(true);
4155
4226
  try {
4156
- const { updateProfile } = useAuth2();
4157
4227
  const response = await updateProfile({ avatar: image.url });
4158
4228
  if (response.success && response.user?.avatar) {
4159
4229
  onUploadComplete?.(response.user.avatar);
@@ -4192,7 +4262,7 @@ var AvatarUploader = ({
4192
4262
  presignPath: upfilesConfig.presignPath
4193
4263
  },
4194
4264
  projectId: upfilesConfig.projectId,
4195
- folderPath: upfilesConfig.folderPath || "avatars/",
4265
+ folderPath: effectiveFolderPath,
4196
4266
  title: "Select Avatar",
4197
4267
  description: "Upload a new avatar or select from existing images.",
4198
4268
  mode: "full",
@@ -4519,8 +4589,17 @@ var AvatarManager = ({
4519
4589
  onDelete,
4520
4590
  upfilesConfig
4521
4591
  }) => {
4522
- const { updateProfile } = useAuth2();
4592
+ const { user, updateProfile } = useAuth2();
4523
4593
  const [updating, setUpdating] = React.useState(false);
4594
+ React.useEffect(() => {
4595
+ injectModalStyles();
4596
+ }, []);
4597
+ const effectiveFolderPath = React.useMemo(() => {
4598
+ if (user?.id) {
4599
+ return `users/${user.id}/`;
4600
+ }
4601
+ return upfilesConfig.folderPath || "/";
4602
+ }, [user?.id, upfilesConfig.folderPath]);
4524
4603
  const handleSelect = async (image) => {
4525
4604
  setUpdating(true);
4526
4605
  try {
@@ -4553,7 +4632,7 @@ var AvatarManager = ({
4553
4632
  withCredentials: upfilesConfig.withCredentials
4554
4633
  },
4555
4634
  projectId,
4556
- folderPath: upfilesConfig.folderPath || "/",
4635
+ folderPath: effectiveFolderPath,
4557
4636
  title,
4558
4637
  description,
4559
4638
  className,