@firecms/user_management 3.0.0-canary.289 → 3.0.0-canary.290

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.umd.js CHANGED
@@ -1094,7 +1094,7 @@
1094
1094
  }
1095
1095
  let t78;
1096
1096
  if ($[135] !== t14 || $[136] !== t21 || $[137] !== t45 || $[138] !== t55 || $[139] !== t66 || $[140] !== t77) {
1097
- t78 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-8", children: [
1097
+ t78 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1098
1098
  t14,
1099
1099
  t21,
1100
1100
  t45,
@@ -1202,7 +1202,7 @@
1202
1202
  function _temp3$1(values) {
1203
1203
  return RoleYupSchema.validate(values, {
1204
1204
  abortEarly: false
1205
- }).then(_temp$2).catch(_temp2$1);
1205
+ }).then(_temp$3).catch(_temp2$1);
1206
1206
  }
1207
1207
  function _temp2$1(e_1) {
1208
1208
  const errors = {};
@@ -1211,7 +1211,7 @@
1211
1211
  });
1212
1212
  return errors;
1213
1213
  }
1214
- function _temp$2() {
1214
+ function _temp$3() {
1215
1215
  return {};
1216
1216
  }
1217
1217
  const DEFAULT_ROLES = [{
@@ -1540,7 +1540,7 @@
1540
1540
  t2 = userProp ?? {
1541
1541
  displayName: "",
1542
1542
  email: "",
1543
- roles: roles.filter(_temp$1)
1543
+ roles: roles.filter(_temp$2)
1544
1544
  };
1545
1545
  $[6] = roles;
1546
1546
  $[7] = userProp;
@@ -1719,7 +1719,7 @@
1719
1719
  }
1720
1720
  let t24;
1721
1721
  if ($[49] !== t13 || $[50] !== t19 || $[51] !== t23) {
1722
- t24 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-8", children: [
1722
+ t24 = /* @__PURE__ */ jsxRuntime.jsx(ui.DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1723
1723
  t13,
1724
1724
  t19,
1725
1725
  t23
@@ -1821,7 +1821,7 @@
1821
1821
  function _temp2() {
1822
1822
  return {};
1823
1823
  }
1824
- function _temp$1(r) {
1824
+ function _temp$2(r) {
1825
1825
  return r.id === "editor";
1826
1826
  }
1827
1827
  function UsersTable(t0) {
@@ -1870,7 +1870,7 @@
1870
1870
  }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, {}) }) }) }),
1871
1871
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: user.email }),
1872
1872
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "font-medium align-left", children: user.displayName }),
1873
- /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "align-left", children: userRoles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: userRoles.map(_temp) }) : null }),
1873
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "align-left", children: userRoles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: userRoles.map(_temp$1) }) : null }),
1874
1874
  /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: formattedDate })
1875
1875
  ] }, "row_" + user.uid);
1876
1876
  });
@@ -2004,16 +2004,17 @@
2004
2004
  }
2005
2005
  return t11;
2006
2006
  }
2007
- function _temp(userRole) {
2007
+ function _temp$1(userRole) {
2008
2008
  return /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id);
2009
2009
  }
2010
2010
  const UsersView = function UsersView2(t0) {
2011
- const $ = reactCompilerRuntime.c(12);
2011
+ const $ = reactCompilerRuntime.c(13);
2012
2012
  const {
2013
2013
  children
2014
2014
  } = t0;
2015
- const [dialogOpen, setDialogOpen] = React.useState();
2015
+ const [dialogOpen, setDialogOpen] = React.useState(false);
2016
2016
  const [selectedUser, setSelectedUser] = React.useState();
2017
+ const [newFormKey, setNewFormKey] = React.useState(0);
2017
2018
  useUserManagement();
2018
2019
  let t1;
2019
2020
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -2039,53 +2040,67 @@
2039
2040
  const handleClose = t2;
2040
2041
  let t3;
2041
2042
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2042
- t3 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Users" });
2043
+ t3 = () => {
2044
+ setSelectedUser(void 0);
2045
+ setNewFormKey(_temp);
2046
+ setDialogOpen(true);
2047
+ };
2043
2048
  $[2] = t3;
2044
2049
  } else {
2045
2050
  t3 = $[2];
2046
2051
  }
2052
+ const handleAddUser = t3;
2047
2053
  let t4;
2048
- let t5;
2049
2054
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2050
- t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2051
- t3,
2052
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add user" })
2053
- ] });
2054
- t5 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
2055
+ t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Users" });
2055
2056
  $[3] = t4;
2056
- $[4] = t5;
2057
2057
  } else {
2058
2058
  t4 = $[3];
2059
+ }
2060
+ let t5;
2061
+ let t6;
2062
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
2063
+ t5 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2064
+ t4,
2065
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: handleAddUser, children: "Add user" })
2066
+ ] });
2067
+ t6 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
2068
+ $[4] = t5;
2069
+ $[5] = t6;
2070
+ } else {
2059
2071
  t5 = $[4];
2072
+ t6 = $[5];
2060
2073
  }
2061
- const t6 = selectedUser?.uid ?? "new";
2062
- const t7 = dialogOpen ?? false;
2074
+ const t7 = selectedUser?.uid ?? `new-${newFormKey}`;
2063
2075
  let t8;
2064
- if ($[5] !== selectedUser || $[6] !== t6 || $[7] !== t7) {
2065
- t8 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: t7, user: selectedUser, handleClose }, t6);
2066
- $[5] = selectedUser;
2067
- $[6] = t6;
2068
- $[7] = t7;
2069
- $[8] = t8;
2076
+ if ($[6] !== dialogOpen || $[7] !== selectedUser || $[8] !== t7) {
2077
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: dialogOpen, user: selectedUser, handleClose }, t7);
2078
+ $[6] = dialogOpen;
2079
+ $[7] = selectedUser;
2080
+ $[8] = t7;
2081
+ $[9] = t8;
2070
2082
  } else {
2071
- t8 = $[8];
2083
+ t8 = $[9];
2072
2084
  }
2073
2085
  let t9;
2074
- if ($[9] !== children || $[10] !== t8) {
2086
+ if ($[10] !== children || $[11] !== t8) {
2075
2087
  t9 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2076
2088
  children,
2077
- t4,
2078
2089
  t5,
2090
+ t6,
2079
2091
  t8
2080
2092
  ] });
2081
- $[9] = children;
2082
- $[10] = t8;
2083
- $[11] = t9;
2093
+ $[10] = children;
2094
+ $[11] = t8;
2095
+ $[12] = t9;
2084
2096
  } else {
2085
- t9 = $[11];
2097
+ t9 = $[12];
2086
2098
  }
2087
2099
  return t9;
2088
2100
  };
2101
+ function _temp(k) {
2102
+ return k + 1;
2103
+ }
2089
2104
  function useUserManagementPlugin(t0) {
2090
2105
  const $ = reactCompilerRuntime.c(15);
2091
2106
  const {