@firecms/user_management 3.0.0-rc.3 → 3.0.0-tw4.1

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
@@ -1082,7 +1082,7 @@ function RolesDetailsForm(t0) {
1082
1082
  }
1083
1083
  let t78;
1084
1084
  if ($[135] !== t14 || $[136] !== t21 || $[137] !== t45 || $[138] !== t55 || $[139] !== t66 || $[140] !== t77) {
1085
- t78 = /* @__PURE__ */ jsx(DialogContent, { className: "flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-8", children: [
1085
+ t78 = /* @__PURE__ */ jsx(DialogContent, { className: "flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1086
1086
  t14,
1087
1087
  t21,
1088
1088
  t45,
@@ -1190,7 +1190,7 @@ function _temp4$1(value) {
1190
1190
  function _temp3$1(values) {
1191
1191
  return RoleYupSchema.validate(values, {
1192
1192
  abortEarly: false
1193
- }).then(_temp$2).catch(_temp2$1);
1193
+ }).then(_temp$3).catch(_temp2$1);
1194
1194
  }
1195
1195
  function _temp2$1(e_1) {
1196
1196
  const errors = {};
@@ -1199,7 +1199,7 @@ function _temp2$1(e_1) {
1199
1199
  });
1200
1200
  return errors;
1201
1201
  }
1202
- function _temp$2() {
1202
+ function _temp$3() {
1203
1203
  return {};
1204
1204
  }
1205
1205
  const DEFAULT_ROLES = [{
@@ -1528,7 +1528,7 @@ function UserDetailsForm(t0) {
1528
1528
  t2 = userProp ?? {
1529
1529
  displayName: "",
1530
1530
  email: "",
1531
- roles: roles.filter(_temp$1)
1531
+ roles: roles.filter(_temp$2)
1532
1532
  };
1533
1533
  $[6] = roles;
1534
1534
  $[7] = userProp;
@@ -1707,7 +1707,7 @@ function UserDetailsForm(t0) {
1707
1707
  }
1708
1708
  let t24;
1709
1709
  if ($[49] !== t13 || $[50] !== t19 || $[51] !== t23) {
1710
- t24 = /* @__PURE__ */ jsx(DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-8", children: [
1710
+ t24 = /* @__PURE__ */ jsx(DialogContent, { className: "h-full flex-grow", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
1711
1711
  t13,
1712
1712
  t19,
1713
1713
  t23
@@ -1809,7 +1809,7 @@ function _temp3(acc, error) {
1809
1809
  function _temp2() {
1810
1810
  return {};
1811
1811
  }
1812
- function _temp$1(r) {
1812
+ function _temp$2(r) {
1813
1813
  return r.id === "editor";
1814
1814
  }
1815
1815
  function UsersTable(t0) {
@@ -1858,7 +1858,7 @@ function UsersTable(t0) {
1858
1858
  }, children: /* @__PURE__ */ jsx(DeleteIcon, {}) }) }) }),
1859
1859
  /* @__PURE__ */ jsx(TableCell, { children: user.email }),
1860
1860
  /* @__PURE__ */ jsx(TableCell, { className: "font-medium align-left", children: user.displayName }),
1861
- /* @__PURE__ */ jsx(TableCell, { className: "align-left", children: userRoles ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: userRoles.map(_temp) }) : null }),
1861
+ /* @__PURE__ */ jsx(TableCell, { className: "align-left", children: userRoles ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: userRoles.map(_temp$1) }) : null }),
1862
1862
  /* @__PURE__ */ jsx(TableCell, { children: formattedDate })
1863
1863
  ] }, "row_" + user.uid);
1864
1864
  });
@@ -1992,16 +1992,17 @@ function UsersTable(t0) {
1992
1992
  }
1993
1993
  return t11;
1994
1994
  }
1995
- function _temp(userRole) {
1995
+ function _temp$1(userRole) {
1996
1996
  return /* @__PURE__ */ jsx(RoleChip, { role: userRole }, userRole?.id);
1997
1997
  }
1998
1998
  const UsersView = function UsersView2(t0) {
1999
- const $ = c(12);
1999
+ const $ = c(13);
2000
2000
  const {
2001
2001
  children
2002
2002
  } = t0;
2003
- const [dialogOpen, setDialogOpen] = useState();
2003
+ const [dialogOpen, setDialogOpen] = useState(false);
2004
2004
  const [selectedUser, setSelectedUser] = useState();
2005
+ const [newFormKey, setNewFormKey] = useState(0);
2005
2006
  useUserManagement();
2006
2007
  let t1;
2007
2008
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -2027,53 +2028,67 @@ const UsersView = function UsersView2(t0) {
2027
2028
  const handleClose = t2;
2028
2029
  let t3;
2029
2030
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2030
- t3 = /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Users" });
2031
+ t3 = () => {
2032
+ setSelectedUser(void 0);
2033
+ setNewFormKey(_temp);
2034
+ setDialogOpen(true);
2035
+ };
2031
2036
  $[2] = t3;
2032
2037
  } else {
2033
2038
  t3 = $[2];
2034
2039
  }
2040
+ const handleAddUser = t3;
2035
2041
  let t4;
2036
- let t5;
2037
2042
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2038
- t4 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
2039
- t3,
2040
- /* @__PURE__ */ jsx(Button, { size: "large", startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add user" })
2041
- ] });
2042
- t5 = /* @__PURE__ */ jsx(UsersTable, { onUserClicked });
2043
+ t4 = /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Users" });
2043
2044
  $[3] = t4;
2044
- $[4] = t5;
2045
2045
  } else {
2046
2046
  t4 = $[3];
2047
+ }
2048
+ let t5;
2049
+ let t6;
2050
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
2051
+ t5 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
2052
+ t4,
2053
+ /* @__PURE__ */ jsx(Button, { size: "large", startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: handleAddUser, children: "Add user" })
2054
+ ] });
2055
+ t6 = /* @__PURE__ */ jsx(UsersTable, { onUserClicked });
2056
+ $[4] = t5;
2057
+ $[5] = t6;
2058
+ } else {
2047
2059
  t5 = $[4];
2060
+ t6 = $[5];
2048
2061
  }
2049
- const t6 = selectedUser?.uid ?? "new";
2050
- const t7 = dialogOpen ?? false;
2062
+ const t7 = selectedUser?.uid ?? `new-${newFormKey}`;
2051
2063
  let t8;
2052
- if ($[5] !== selectedUser || $[6] !== t6 || $[7] !== t7) {
2053
- t8 = /* @__PURE__ */ jsx(UserDetailsForm, { open: t7, user: selectedUser, handleClose }, t6);
2054
- $[5] = selectedUser;
2055
- $[6] = t6;
2056
- $[7] = t7;
2057
- $[8] = t8;
2064
+ if ($[6] !== dialogOpen || $[7] !== selectedUser || $[8] !== t7) {
2065
+ t8 = /* @__PURE__ */ jsx(UserDetailsForm, { open: dialogOpen, user: selectedUser, handleClose }, t7);
2066
+ $[6] = dialogOpen;
2067
+ $[7] = selectedUser;
2068
+ $[8] = t7;
2069
+ $[9] = t8;
2058
2070
  } else {
2059
- t8 = $[8];
2071
+ t8 = $[9];
2060
2072
  }
2061
2073
  let t9;
2062
- if ($[9] !== children || $[10] !== t8) {
2074
+ if ($[10] !== children || $[11] !== t8) {
2063
2075
  t9 = /* @__PURE__ */ jsxs(Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2064
2076
  children,
2065
- t4,
2066
2077
  t5,
2078
+ t6,
2067
2079
  t8
2068
2080
  ] });
2069
- $[9] = children;
2070
- $[10] = t8;
2071
- $[11] = t9;
2081
+ $[10] = children;
2082
+ $[11] = t8;
2083
+ $[12] = t9;
2072
2084
  } else {
2073
- t9 = $[11];
2085
+ t9 = $[12];
2074
2086
  }
2075
2087
  return t9;
2076
2088
  };
2089
+ function _temp(k) {
2090
+ return k + 1;
2091
+ }
2077
2092
  function useUserManagementPlugin(t0) {
2078
2093
  const $ = c(15);
2079
2094
  const {