@firecms/user_management 3.2.0 → 3.3.0-canary.451aa49

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.es.js CHANGED
@@ -2099,7 +2099,7 @@ function canUserBeEdited(loggedUser, user, users, roles, t, prevUser) {
2099
2099
  return true;
2100
2100
  }
2101
2101
  function UserDetailsForm(t0) {
2102
- const $ = c(112);
2102
+ const $ = c(114);
2103
2103
  const {
2104
2104
  open,
2105
2105
  user: userProp,
@@ -2241,7 +2241,7 @@ function UserDetailsForm(t0) {
2241
2241
  }
2242
2242
  let t9;
2243
2243
  if ($[25] !== t8) {
2244
- t9 = /* @__PURE__ */ jsx(DialogTitle, { variant: "h4", gutterBottom: false, children: t8 });
2244
+ t9 = /* @__PURE__ */ jsx("div", { children: t8 });
2245
2245
  $[25] = t8;
2246
2246
  $[26] = t9;
2247
2247
  } else {
@@ -2249,17 +2249,16 @@ function UserDetailsForm(t0) {
2249
2249
  }
2250
2250
  let t10;
2251
2251
  if ($[27] !== isNewUser || $[28] !== snackbarController || $[29] !== t || $[30] !== userProp) {
2252
- t10 = !isNewUser && userProp?.uid && /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2253
- /* @__PURE__ */ jsx("span", { className: "text-sm text-surface-accent-600 dark:text-surface-accent-400", children: t("user_id") }),
2254
- /* @__PURE__ */ jsx(Chip, { size: "small", children: userProp.uid }),
2255
- /* @__PURE__ */ jsx(Tooltip, { title: t("copy"), children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => {
2252
+ t10 = !isNewUser && userProp?.uid && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2253
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-surface-accent-500 dark:text-surface-accent-400 font-normal", children: userProp.uid }),
2254
+ /* @__PURE__ */ jsx(Tooltip, { title: t("copy"), children: /* @__PURE__ */ jsx(IconButton, { size: "smallest", onClick: () => {
2256
2255
  navigator.clipboard.writeText(userProp.uid);
2257
2256
  snackbarController.open({
2258
2257
  type: "success",
2259
2258
  message: t("copied")
2260
2259
  });
2261
- }, children: /* @__PURE__ */ jsx(CopyIcon, { size: "small" }) }) })
2262
- ] }) });
2260
+ }, children: /* @__PURE__ */ jsx(CopyIcon, { size: "smallest" }) }) })
2261
+ ] });
2263
2262
  $[27] = isNewUser;
2264
2263
  $[28] = snackbarController;
2265
2264
  $[29] = t;
@@ -2268,262 +2267,272 @@ function UserDetailsForm(t0) {
2268
2267
  } else {
2269
2268
  t10 = $[31];
2270
2269
  }
2271
- const t11 = submitCount > 0 && Boolean(errors.displayName);
2272
- const t12 = values_0.displayName ?? "";
2273
- let t13;
2274
- if ($[32] !== t) {
2275
- t13 = t("name");
2276
- $[32] = t;
2277
- $[33] = t13;
2270
+ let t11;
2271
+ if ($[32] !== t10 || $[33] !== t9) {
2272
+ t11 = /* @__PURE__ */ jsx(DialogTitle, { variant: "h4", gutterBottom: false, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
2273
+ t9,
2274
+ t10
2275
+ ] }) });
2276
+ $[32] = t10;
2277
+ $[33] = t9;
2278
+ $[34] = t11;
2278
2279
  } else {
2279
- t13 = $[33];
2280
+ t11 = $[34];
2280
2281
  }
2282
+ const t12 = submitCount > 0 && Boolean(errors.displayName);
2283
+ const t13 = values_0.displayName ?? "";
2281
2284
  let t14;
2282
- if ($[34] !== handleChange || $[35] !== t11 || $[36] !== t12 || $[37] !== t13) {
2283
- t14 = /* @__PURE__ */ jsx(TextField, { name: "displayName", required: true, error: t11, value: t12, onChange: handleChange, "aria-describedby": "name-helper-text", label: t13 });
2284
- $[34] = handleChange;
2285
- $[35] = t11;
2286
- $[36] = t12;
2287
- $[37] = t13;
2288
- $[38] = t14;
2285
+ if ($[35] !== t) {
2286
+ t14 = t("name");
2287
+ $[35] = t;
2288
+ $[36] = t14;
2289
2289
  } else {
2290
- t14 = $[38];
2290
+ t14 = $[36];
2291
2291
  }
2292
2292
  let t15;
2293
- if ($[39] !== errors || $[40] !== submitCount || $[41] !== t) {
2294
- t15 = submitCount > 0 && Boolean(errors.displayName) ? errors.displayName : t("name_of_this_user");
2295
- $[39] = errors;
2296
- $[40] = submitCount;
2297
- $[41] = t;
2298
- $[42] = t15;
2293
+ if ($[37] !== handleChange || $[38] !== t12 || $[39] !== t13 || $[40] !== t14) {
2294
+ t15 = /* @__PURE__ */ jsx(TextField, { name: "displayName", required: true, error: t12, value: t13, onChange: handleChange, "aria-describedby": "name-helper-text", label: t14 });
2295
+ $[37] = handleChange;
2296
+ $[38] = t12;
2297
+ $[39] = t13;
2298
+ $[40] = t14;
2299
+ $[41] = t15;
2299
2300
  } else {
2300
- t15 = $[42];
2301
+ t15 = $[41];
2301
2302
  }
2302
2303
  let t16;
2303
- if ($[43] !== t15) {
2304
- t16 = /* @__PURE__ */ jsx(FieldCaption, { children: t15 });
2305
- $[43] = t15;
2306
- $[44] = t16;
2304
+ if ($[42] !== errors || $[43] !== submitCount || $[44] !== t) {
2305
+ t16 = submitCount > 0 && Boolean(errors.displayName) ? errors.displayName : t("name_of_this_user");
2306
+ $[42] = errors;
2307
+ $[43] = submitCount;
2308
+ $[44] = t;
2309
+ $[45] = t16;
2307
2310
  } else {
2308
- t16 = $[44];
2311
+ t16 = $[45];
2309
2312
  }
2310
2313
  let t17;
2311
- if ($[45] !== t14 || $[46] !== t16) {
2312
- t17 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
2313
- t14,
2314
- t16
2315
- ] });
2316
- $[45] = t14;
2314
+ if ($[46] !== t16) {
2315
+ t17 = /* @__PURE__ */ jsx(FieldCaption, { children: t16 });
2317
2316
  $[46] = t16;
2318
2317
  $[47] = t17;
2319
2318
  } else {
2320
2319
  t17 = $[47];
2321
2320
  }
2322
- const t18 = submitCount > 0 && Boolean(errors.email);
2323
- const t19 = values_0.email ?? "";
2324
- let t20;
2325
- if ($[48] !== t) {
2326
- t20 = t("email");
2327
- $[48] = t;
2328
- $[49] = t20;
2321
+ let t18;
2322
+ if ($[48] !== t15 || $[49] !== t17) {
2323
+ t18 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
2324
+ t15,
2325
+ t17
2326
+ ] });
2327
+ $[48] = t15;
2328
+ $[49] = t17;
2329
+ $[50] = t18;
2329
2330
  } else {
2330
- t20 = $[49];
2331
+ t18 = $[50];
2331
2332
  }
2333
+ const t19 = submitCount > 0 && Boolean(errors.email);
2334
+ const t20 = values_0.email ?? "";
2332
2335
  let t21;
2333
- if ($[50] !== handleChange || $[51] !== t18 || $[52] !== t19 || $[53] !== t20) {
2334
- t21 = /* @__PURE__ */ jsx(TextField, { required: true, error: t18, name: "email", value: t19, onChange: handleChange, "aria-describedby": "email-helper-text", label: t20 });
2335
- $[50] = handleChange;
2336
- $[51] = t18;
2337
- $[52] = t19;
2338
- $[53] = t20;
2339
- $[54] = t21;
2336
+ if ($[51] !== t) {
2337
+ t21 = t("email");
2338
+ $[51] = t;
2339
+ $[52] = t21;
2340
2340
  } else {
2341
- t21 = $[54];
2341
+ t21 = $[52];
2342
2342
  }
2343
2343
  let t22;
2344
- if ($[55] !== errors || $[56] !== submitCount || $[57] !== t) {
2345
- t22 = submitCount > 0 && Boolean(errors.email) ? errors.email : t("email_of_this_user");
2346
- $[55] = errors;
2347
- $[56] = submitCount;
2348
- $[57] = t;
2349
- $[58] = t22;
2344
+ if ($[53] !== handleChange || $[54] !== t19 || $[55] !== t20 || $[56] !== t21) {
2345
+ t22 = /* @__PURE__ */ jsx(TextField, { required: true, error: t19, name: "email", value: t20, onChange: handleChange, "aria-describedby": "email-helper-text", label: t21 });
2346
+ $[53] = handleChange;
2347
+ $[54] = t19;
2348
+ $[55] = t20;
2349
+ $[56] = t21;
2350
+ $[57] = t22;
2350
2351
  } else {
2351
- t22 = $[58];
2352
+ t22 = $[57];
2352
2353
  }
2353
2354
  let t23;
2354
- if ($[59] !== t22) {
2355
- t23 = /* @__PURE__ */ jsx(FieldCaption, { children: t22 });
2356
- $[59] = t22;
2357
- $[60] = t23;
2355
+ if ($[58] !== errors || $[59] !== submitCount || $[60] !== t) {
2356
+ t23 = submitCount > 0 && Boolean(errors.email) ? errors.email : t("email_of_this_user");
2357
+ $[58] = errors;
2358
+ $[59] = submitCount;
2359
+ $[60] = t;
2360
+ $[61] = t23;
2358
2361
  } else {
2359
- t23 = $[60];
2362
+ t23 = $[61];
2360
2363
  }
2361
2364
  let t24;
2362
- if ($[61] !== t21 || $[62] !== t23) {
2363
- t24 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
2364
- t21,
2365
- t23
2366
- ] });
2367
- $[61] = t21;
2365
+ if ($[62] !== t23) {
2366
+ t24 = /* @__PURE__ */ jsx(FieldCaption, { children: t23 });
2368
2367
  $[62] = t23;
2369
2368
  $[63] = t24;
2370
2369
  } else {
2371
2370
  t24 = $[63];
2372
2371
  }
2373
2372
  let t25;
2374
- if ($[64] !== t) {
2375
- t25 = t("roles");
2376
- $[64] = t;
2377
- $[65] = t25;
2373
+ if ($[64] !== t22 || $[65] !== t24) {
2374
+ t25 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
2375
+ t22,
2376
+ t24
2377
+ ] });
2378
+ $[64] = t22;
2379
+ $[65] = t24;
2380
+ $[66] = t25;
2378
2381
  } else {
2379
- t25 = $[65];
2382
+ t25 = $[66];
2380
2383
  }
2381
2384
  let t26;
2382
- if ($[66] !== values_0.roles) {
2383
- t26 = values_0.roles?.map(_temp5) ?? [];
2384
- $[66] = values_0.roles;
2385
- $[67] = t26;
2385
+ if ($[67] !== t) {
2386
+ t26 = t("roles");
2387
+ $[67] = t;
2388
+ $[68] = t26;
2386
2389
  } else {
2387
- t26 = $[67];
2390
+ t26 = $[68];
2388
2391
  }
2389
2392
  let t27;
2390
- if ($[68] !== roles || $[69] !== setFieldValue) {
2391
- t27 = (value) => setFieldValue("roles", value.map((id) => roles.find((r_1) => r_1.id === id)));
2392
- $[68] = roles;
2393
- $[69] = setFieldValue;
2393
+ if ($[69] !== values_0.roles) {
2394
+ t27 = values_0.roles?.map(_temp5) ?? [];
2395
+ $[69] = values_0.roles;
2394
2396
  $[70] = t27;
2395
2397
  } else {
2396
2398
  t27 = $[70];
2397
2399
  }
2398
2400
  let t28;
2399
- if ($[71] !== roles) {
2400
- t28 = roles.map(_temp6);
2401
+ if ($[71] !== roles || $[72] !== setFieldValue) {
2402
+ t28 = (value) => setFieldValue("roles", value.map((id) => roles.find((r_1) => r_1.id === id)));
2401
2403
  $[71] = roles;
2402
- $[72] = t28;
2404
+ $[72] = setFieldValue;
2405
+ $[73] = t28;
2403
2406
  } else {
2404
- t28 = $[72];
2407
+ t28 = $[73];
2405
2408
  }
2406
2409
  let t29;
2407
- if ($[73] !== t25 || $[74] !== t26 || $[75] !== t27 || $[76] !== t28) {
2408
- t29 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(MultiSelect, { className: "w-full", label: t25, value: t26, onValueChange: t27, children: t28 }) });
2409
- $[73] = t25;
2410
- $[74] = t26;
2411
- $[75] = t27;
2412
- $[76] = t28;
2413
- $[77] = t29;
2410
+ if ($[74] !== roles) {
2411
+ t29 = roles.map(_temp6);
2412
+ $[74] = roles;
2413
+ $[75] = t29;
2414
2414
  } else {
2415
- t29 = $[77];
2415
+ t29 = $[75];
2416
2416
  }
2417
2417
  let t30;
2418
- if ($[78] !== t10 || $[79] !== t17 || $[80] !== t24 || $[81] !== t29) {
2419
- t30 = /* @__PURE__ */ jsx(DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
2420
- t10,
2421
- t17,
2422
- t24,
2423
- t29
2424
- ] }) });
2425
- $[78] = t10;
2426
- $[79] = t17;
2427
- $[80] = t24;
2428
- $[81] = t29;
2429
- $[82] = t30;
2418
+ if ($[76] !== t26 || $[77] !== t27 || $[78] !== t28 || $[79] !== t29) {
2419
+ t30 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(MultiSelect, { className: "w-full", label: t26, value: t27, onValueChange: t28, children: t29 }) });
2420
+ $[76] = t26;
2421
+ $[77] = t27;
2422
+ $[78] = t28;
2423
+ $[79] = t29;
2424
+ $[80] = t30;
2430
2425
  } else {
2431
- t30 = $[82];
2426
+ t30 = $[80];
2432
2427
  }
2433
2428
  let t31;
2434
- if ($[83] !== handleClose) {
2435
- t31 = () => {
2436
- handleClose();
2437
- };
2438
- $[83] = handleClose;
2429
+ if ($[81] !== t18 || $[82] !== t25 || $[83] !== t30) {
2430
+ t31 = /* @__PURE__ */ jsx(DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
2431
+ t18,
2432
+ t25,
2433
+ t30
2434
+ ] }) });
2435
+ $[81] = t18;
2436
+ $[82] = t25;
2437
+ $[83] = t30;
2439
2438
  $[84] = t31;
2440
2439
  } else {
2441
2440
  t31 = $[84];
2442
2441
  }
2443
2442
  let t32;
2444
- if ($[85] !== t) {
2445
- t32 = t("cancel");
2446
- $[85] = t;
2443
+ if ($[85] !== handleClose) {
2444
+ t32 = () => {
2445
+ handleClose();
2446
+ };
2447
+ $[85] = handleClose;
2447
2448
  $[86] = t32;
2448
2449
  } else {
2449
2450
  t32 = $[86];
2450
2451
  }
2451
2452
  let t33;
2452
- if ($[87] !== t31 || $[88] !== t32) {
2453
- t33 = /* @__PURE__ */ jsx(Button, { variant: "text", onClick: t31, children: t32 });
2454
- $[87] = t31;
2455
- $[88] = t32;
2456
- $[89] = t33;
2453
+ if ($[87] !== t) {
2454
+ t33 = t("cancel");
2455
+ $[87] = t;
2456
+ $[88] = t33;
2457
2457
  } else {
2458
- t33 = $[89];
2458
+ t33 = $[88];
2459
2459
  }
2460
- const t34 = !dirty;
2461
- let t35;
2462
- if ($[90] !== isNewUser || $[91] !== t) {
2463
- t35 = isNewUser ? t("create_user") : t("update");
2464
- $[90] = isNewUser;
2465
- $[91] = t;
2466
- $[92] = t35;
2460
+ let t34;
2461
+ if ($[89] !== t32 || $[90] !== t33) {
2462
+ t34 = /* @__PURE__ */ jsx(Button, { variant: "text", onClick: t32, children: t33 });
2463
+ $[89] = t32;
2464
+ $[90] = t33;
2465
+ $[91] = t34;
2467
2466
  } else {
2468
- t35 = $[92];
2467
+ t34 = $[91];
2469
2468
  }
2469
+ const t35 = !dirty;
2470
2470
  let t36;
2471
- if ($[93] !== isSubmitting || $[94] !== t34 || $[95] !== t35) {
2472
- t36 = /* @__PURE__ */ jsx(LoadingButton, { variant: "filled", type: "submit", disabled: t34, loading: isSubmitting, children: t35 });
2473
- $[93] = isSubmitting;
2474
- $[94] = t34;
2475
- $[95] = t35;
2476
- $[96] = t36;
2471
+ if ($[92] !== isNewUser || $[93] !== t) {
2472
+ t36 = isNewUser ? t("create_user") : t("update");
2473
+ $[92] = isNewUser;
2474
+ $[93] = t;
2475
+ $[94] = t36;
2477
2476
  } else {
2478
- t36 = $[96];
2477
+ t36 = $[94];
2479
2478
  }
2480
2479
  let t37;
2481
- if ($[97] !== t33 || $[98] !== t36) {
2482
- t37 = /* @__PURE__ */ jsxs(DialogActions, { children: [
2483
- t33,
2484
- t36
2485
- ] });
2486
- $[97] = t33;
2487
- $[98] = t36;
2488
- $[99] = t37;
2480
+ if ($[95] !== isSubmitting || $[96] !== t35 || $[97] !== t36) {
2481
+ t37 = /* @__PURE__ */ jsx(LoadingButton, { variant: "filled", type: "submit", disabled: t35, loading: isSubmitting, children: t36 });
2482
+ $[95] = isSubmitting;
2483
+ $[96] = t35;
2484
+ $[97] = t36;
2485
+ $[98] = t37;
2489
2486
  } else {
2490
- t37 = $[99];
2487
+ t37 = $[98];
2491
2488
  }
2492
2489
  let t38;
2493
- if ($[100] !== handleSubmit || $[101] !== t30 || $[102] !== t37 || $[103] !== t9) {
2494
- t38 = /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, autoComplete: "off", noValidate: true, style: t7, children: [
2495
- t9,
2496
- t30,
2490
+ if ($[99] !== t34 || $[100] !== t37) {
2491
+ t38 = /* @__PURE__ */ jsxs(DialogActions, { children: [
2492
+ t34,
2497
2493
  t37
2498
2494
  ] });
2499
- $[100] = handleSubmit;
2500
- $[101] = t30;
2501
- $[102] = t37;
2502
- $[103] = t9;
2503
- $[104] = t38;
2495
+ $[99] = t34;
2496
+ $[100] = t37;
2497
+ $[101] = t38;
2504
2498
  } else {
2505
- t38 = $[104];
2499
+ t38 = $[101];
2506
2500
  }
2507
2501
  let t39;
2508
- if ($[105] !== formex || $[106] !== t38) {
2509
- t39 = /* @__PURE__ */ jsx(Formex, { value: formex, children: t38 });
2510
- $[105] = formex;
2511
- $[106] = t38;
2512
- $[107] = t39;
2502
+ if ($[102] !== handleSubmit || $[103] !== t11 || $[104] !== t31 || $[105] !== t38) {
2503
+ t39 = /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, autoComplete: "off", noValidate: true, style: t7, children: [
2504
+ t11,
2505
+ t31,
2506
+ t38
2507
+ ] });
2508
+ $[102] = handleSubmit;
2509
+ $[103] = t11;
2510
+ $[104] = t31;
2511
+ $[105] = t38;
2512
+ $[106] = t39;
2513
2513
  } else {
2514
- t39 = $[107];
2514
+ t39 = $[106];
2515
2515
  }
2516
2516
  let t40;
2517
- if ($[108] !== open || $[109] !== t39 || $[110] !== t6) {
2518
- t40 = /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: t6, maxWidth: "4xl", children: t39 });
2519
- $[108] = open;
2520
- $[109] = t39;
2521
- $[110] = t6;
2517
+ if ($[107] !== formex || $[108] !== t39) {
2518
+ t40 = /* @__PURE__ */ jsx(Formex, { value: formex, children: t39 });
2519
+ $[107] = formex;
2520
+ $[108] = t39;
2521
+ $[109] = t40;
2522
+ } else {
2523
+ t40 = $[109];
2524
+ }
2525
+ let t41;
2526
+ if ($[110] !== open || $[111] !== t40 || $[112] !== t6) {
2527
+ t41 = /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: t6, maxWidth: "4xl", children: t40 });
2528
+ $[110] = open;
2522
2529
  $[111] = t40;
2530
+ $[112] = t6;
2531
+ $[113] = t41;
2523
2532
  } else {
2524
- t40 = $[111];
2533
+ t41 = $[113];
2525
2534
  }
2526
- return t40;
2535
+ return t41;
2527
2536
  }
2528
2537
  function _temp6(userRole) {
2529
2538
  return /* @__PURE__ */ jsx(MultiSelectItem, { value: userRole.id, children: /* @__PURE__ */ jsx(RoleChip, { role: userRole }, userRole?.id) }, userRole.id);
@@ -2671,7 +2680,10 @@ function UsersTable(t0) {
2671
2680
  onUserClicked(user);
2672
2681
  }, children: [
2673
2682
  /* @__PURE__ */ jsx(TableCell, { className: "w-12", children: /* @__PURE__ */ jsx(Avatar, { src: user.photoURL ?? void 0, outerClassName: "w-8 h-8 min-w-8 min-h-8 p-0", className: "text-sm", hover: false, children: user.displayName ? user.displayName[0].toUpperCase() : user.email ? user.email[0].toUpperCase() : "U" }) }),
2674
- /* @__PURE__ */ jsx(TableCell, { children: user.email }),
2683
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
2684
+ /* @__PURE__ */ jsx("div", { children: user.email }),
2685
+ user.uid && /* @__PURE__ */ jsx("div", { className: "text-xs text-surface-accent-500 dark:text-surface-accent-400 font-mono mt-1", children: user.uid })
2686
+ ] }) }),
2675
2687
  /* @__PURE__ */ jsx(TableCell, { className: "font-medium align-left", children: user.displayName }),
2676
2688
  /* @__PURE__ */ jsx(TableCell, { className: "align-left", children: userRoles ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: userRoles.map(_temp$1) }) : null }),
2677
2689
  /* @__PURE__ */ jsx(TableCell, { children: formattedDate }),