@pelcro/react-pelcro-js 4.0.0-alpha.64 → 4.0.0-alpha.65

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.cjs.js CHANGED
@@ -38996,7 +38996,7 @@ const hasActiveMemberships = () => {
38996
38996
  };
38997
38997
 
38998
38998
  const DashboardContent = props => {
38999
- var _window$Pelcro$user$r, _window$Pelcro, _window$Pelcro$uiSett, _props$children;
38999
+ var _window$Pelcro$user$r, _props$children;
39000
39000
 
39001
39001
  const {
39002
39002
  state: {
@@ -39020,24 +39020,25 @@ const DashboardContent = props => {
39020
39020
  const menuRef = React.useRef(null);
39021
39021
  const user = window.Pelcro.user.read();
39022
39022
  const userHasName = user.first_name || user.last_name;
39023
- const profilePicture = (_window$Pelcro$user$r = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : userSolidIcon;
39024
- const newsletters = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.newsletters;
39025
- Array.isArray(newsletters) && newsletters.length > 0;
39026
-
39027
- const initializeHideMenuHandler = () => {
39028
- document.addEventListener("click", hideMenuIfClickedOutside);
39029
- };
39030
-
39031
- const hideMenuIfClickedOutside = event => {
39032
- const dashboardSubmenus = document.getElementById("pelcro-view-dashboard-submenus");
39033
- const didClickOutsideMenu = isOpen && menuRef.current && !menuRef.current.contains(event.target) && !(dashboardSubmenus !== null && dashboardSubmenus !== void 0 && dashboardSubmenus.contains(event.target));
39034
-
39035
- if (didClickOutsideMenu) {
39036
- dispatch({
39037
- type: CLOSE_DASHBOARD
39038
- });
39039
- }
39040
- };
39023
+ const profilePicture = (_window$Pelcro$user$r = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : userSolidIcon; // const newsletters = window.Pelcro?.uiSettings?.newsletters;
39024
+ // const siteHasNewslettersDefined =
39025
+ // Array.isArray(newsletters) && newsletters.length > 0;
39026
+ // const initializeHideMenuHandler = () => {
39027
+ // document.addEventListener("click", hideMenuIfClickedOutside);
39028
+ // };
39029
+ // const hideMenuIfClickedOutside = (event) => {
39030
+ // const dashboardSubmenus = document.getElementById(
39031
+ // "pelcro-view-dashboard-submenus"
39032
+ // );
39033
+ // const didClickOutsideMenu =
39034
+ // isOpen &&
39035
+ // menuRef.current &&
39036
+ // !menuRef.current.contains(event.target) &&
39037
+ // !dashboardSubmenus?.contains(event.target);
39038
+ // if (didClickOutsideMenu) {
39039
+ // dispatch({ type: CLOSE_DASHBOARD });
39040
+ // }
39041
+ // };
39041
39042
 
39042
39043
  const setActiveDashboardLink = submenuName => {
39043
39044
  dispatch({
@@ -39176,18 +39177,25 @@ const DashboardContent = props => {
39176
39177
  });
39177
39178
  };
39178
39179
 
39179
- React.useEffect(() => {
39180
- return () => {
39181
- document.removeEventListener("click", hideMenuIfClickedOutside);
39182
- };
39183
- }, []);
39180
+ const closeSubMenusTab = () => {
39181
+ dispatch({
39182
+ type: SET_ACTIVE_DASHBOARD_LINK,
39183
+ payload: null
39184
+ });
39185
+ }; // useEffect(() => {
39186
+ // return () => {
39187
+ // document.removeEventListener("click", hideMenuIfClickedOutside);
39188
+ // };
39189
+ // }, []);
39190
+
39191
+
39184
39192
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(Transition, {
39185
39193
  className: `plc-fixed plc-inset-y-0 plc-h-full lg:plc-w-3/12 plc-w-full plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max ${dashboardLayout == "left" ? "plc-left-0" : "plc-right-0"}`,
39186
39194
  show: isOpen,
39187
39195
  enter: "plc-transform plc-transition plc-duration-500",
39188
39196
  enterFrom: `${dashboardLayout == "left" ? "plc--translate-x-full" : "plc-translate-x-full"}`,
39189
- enterTo: "plc-translate-x-0",
39190
- afterEnter: initializeHideMenuHandler,
39197
+ enterTo: "plc-translate-x-0" // afterEnter={initializeHideMenuHandler}
39198
+ ,
39191
39199
  leave: "plc-transform plc-transition plc-duration-500",
39192
39200
  leaveFrom: "plc-translate-x-0",
39193
39201
  leaveTo: `${dashboardLayout == "left" ? "plc--translate-x-full" : "plc-translate-x-full"}`,
@@ -39214,12 +39222,10 @@ const DashboardContent = props => {
39214
39222
  className: "plc-font-bold plc-break-all"
39215
39223
  }, user.first_name, " ", user.last_name), /*#__PURE__*/React__default['default'].createElement("p", {
39216
39224
  className: `plc-m-0 plc-text-sm plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
39217
- }, user.email)), /*#__PURE__*/React__default['default'].createElement("div", {
39218
- className: "lg:plc-hidden"
39219
- }, /*#__PURE__*/React__default['default'].createElement(Button, {
39225
+ }, user.email)), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(Button, {
39220
39226
  variant: "ghost",
39221
39227
  type: "button",
39222
- className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-5 plc-right-10",
39228
+ className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-5 plc-right-5",
39223
39229
  onClick: closeDashboard
39224
39230
  }, /*#__PURE__*/React__default['default'].createElement(SvgXIcon, {
39225
39231
  className: "plc-fill-current"
@@ -39257,8 +39263,8 @@ const DashboardContent = props => {
39257
39263
  }), activeDashboardLink === SUB_MENUS.ORDERS && /*#__PURE__*/React__default['default'].createElement(OrdersMenu, null), activeDashboardLink === SUB_MENUS.INVOICES && /*#__PURE__*/React__default['default'].createElement(InvoicesMenu, null), activeDashboardLink === SUB_MENUS.LOGOUT && logout(), /*#__PURE__*/React__default['default'].createElement(Button, {
39258
39264
  variant: "ghost",
39259
39265
  type: "button",
39260
- className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-2 plc-right-2 md:plc-top-5 md:plc-right-10",
39261
- onClick: closeDashboard
39266
+ className: `plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-2 md:plc-top-5 ${dashboardLayout == "left" ? "plc-right-2 md:plc-right-10" : "plc-left-2 md:plc-left-10"}`,
39267
+ onClick: closeSubMenusTab
39262
39268
  }, /*#__PURE__*/React__default['default'].createElement(SvgXIcon, {
39263
39269
  className: "plc-fill-current"
39264
39270
  }))));
package/dist/index.esm.js CHANGED
@@ -38966,7 +38966,7 @@ const hasActiveMemberships = () => {
38966
38966
  };
38967
38967
 
38968
38968
  const DashboardContent = props => {
38969
- var _window$Pelcro$user$r, _window$Pelcro, _window$Pelcro$uiSett, _props$children;
38969
+ var _window$Pelcro$user$r, _props$children;
38970
38970
 
38971
38971
  const {
38972
38972
  state: {
@@ -38990,24 +38990,25 @@ const DashboardContent = props => {
38990
38990
  const menuRef = useRef(null);
38991
38991
  const user = window.Pelcro.user.read();
38992
38992
  const userHasName = user.first_name || user.last_name;
38993
- const profilePicture = (_window$Pelcro$user$r = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : userSolidIcon;
38994
- const newsletters = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.newsletters;
38995
- Array.isArray(newsletters) && newsletters.length > 0;
38996
-
38997
- const initializeHideMenuHandler = () => {
38998
- document.addEventListener("click", hideMenuIfClickedOutside);
38999
- };
39000
-
39001
- const hideMenuIfClickedOutside = event => {
39002
- const dashboardSubmenus = document.getElementById("pelcro-view-dashboard-submenus");
39003
- const didClickOutsideMenu = isOpen && menuRef.current && !menuRef.current.contains(event.target) && !(dashboardSubmenus !== null && dashboardSubmenus !== void 0 && dashboardSubmenus.contains(event.target));
39004
-
39005
- if (didClickOutsideMenu) {
39006
- dispatch({
39007
- type: CLOSE_DASHBOARD
39008
- });
39009
- }
39010
- };
38993
+ const profilePicture = (_window$Pelcro$user$r = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : userSolidIcon; // const newsletters = window.Pelcro?.uiSettings?.newsletters;
38994
+ // const siteHasNewslettersDefined =
38995
+ // Array.isArray(newsletters) && newsletters.length > 0;
38996
+ // const initializeHideMenuHandler = () => {
38997
+ // document.addEventListener("click", hideMenuIfClickedOutside);
38998
+ // };
38999
+ // const hideMenuIfClickedOutside = (event) => {
39000
+ // const dashboardSubmenus = document.getElementById(
39001
+ // "pelcro-view-dashboard-submenus"
39002
+ // );
39003
+ // const didClickOutsideMenu =
39004
+ // isOpen &&
39005
+ // menuRef.current &&
39006
+ // !menuRef.current.contains(event.target) &&
39007
+ // !dashboardSubmenus?.contains(event.target);
39008
+ // if (didClickOutsideMenu) {
39009
+ // dispatch({ type: CLOSE_DASHBOARD });
39010
+ // }
39011
+ // };
39011
39012
 
39012
39013
  const setActiveDashboardLink = submenuName => {
39013
39014
  dispatch({
@@ -39146,18 +39147,25 @@ const DashboardContent = props => {
39146
39147
  });
39147
39148
  };
39148
39149
 
39149
- useEffect(() => {
39150
- return () => {
39151
- document.removeEventListener("click", hideMenuIfClickedOutside);
39152
- };
39153
- }, []);
39150
+ const closeSubMenusTab = () => {
39151
+ dispatch({
39152
+ type: SET_ACTIVE_DASHBOARD_LINK,
39153
+ payload: null
39154
+ });
39155
+ }; // useEffect(() => {
39156
+ // return () => {
39157
+ // document.removeEventListener("click", hideMenuIfClickedOutside);
39158
+ // };
39159
+ // }, []);
39160
+
39161
+
39154
39162
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Transition, {
39155
39163
  className: `plc-fixed plc-inset-y-0 plc-h-full lg:plc-w-3/12 plc-w-full plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max ${dashboardLayout == "left" ? "plc-left-0" : "plc-right-0"}`,
39156
39164
  show: isOpen,
39157
39165
  enter: "plc-transform plc-transition plc-duration-500",
39158
39166
  enterFrom: `${dashboardLayout == "left" ? "plc--translate-x-full" : "plc-translate-x-full"}`,
39159
- enterTo: "plc-translate-x-0",
39160
- afterEnter: initializeHideMenuHandler,
39167
+ enterTo: "plc-translate-x-0" // afterEnter={initializeHideMenuHandler}
39168
+ ,
39161
39169
  leave: "plc-transform plc-transition plc-duration-500",
39162
39170
  leaveFrom: "plc-translate-x-0",
39163
39171
  leaveTo: `${dashboardLayout == "left" ? "plc--translate-x-full" : "plc-translate-x-full"}`,
@@ -39184,12 +39192,10 @@ const DashboardContent = props => {
39184
39192
  className: "plc-font-bold plc-break-all"
39185
39193
  }, user.first_name, " ", user.last_name), /*#__PURE__*/React__default.createElement("p", {
39186
39194
  className: `plc-m-0 plc-text-sm plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
39187
- }, user.email)), /*#__PURE__*/React__default.createElement("div", {
39188
- className: "lg:plc-hidden"
39189
- }, /*#__PURE__*/React__default.createElement(Button, {
39195
+ }, user.email)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Button, {
39190
39196
  variant: "ghost",
39191
39197
  type: "button",
39192
- className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-5 plc-right-10",
39198
+ className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-5 plc-right-5",
39193
39199
  onClick: closeDashboard
39194
39200
  }, /*#__PURE__*/React__default.createElement(SvgXIcon, {
39195
39201
  className: "plc-fill-current"
@@ -39227,8 +39233,8 @@ const DashboardContent = props => {
39227
39233
  }), activeDashboardLink === SUB_MENUS.ORDERS && /*#__PURE__*/React__default.createElement(OrdersMenu, null), activeDashboardLink === SUB_MENUS.INVOICES && /*#__PURE__*/React__default.createElement(InvoicesMenu, null), activeDashboardLink === SUB_MENUS.LOGOUT && logout(), /*#__PURE__*/React__default.createElement(Button, {
39228
39234
  variant: "ghost",
39229
39235
  type: "button",
39230
- className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-2 plc-right-2 md:plc-top-5 md:plc-right-10",
39231
- onClick: closeDashboard
39236
+ className: `plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-2 md:plc-top-5 ${dashboardLayout == "left" ? "plc-right-2 md:plc-right-10" : "plc-left-2 md:plc-left-10"}`,
39237
+ onClick: closeSubMenusTab
39232
39238
  }, /*#__PURE__*/React__default.createElement(SvgXIcon, {
39233
39239
  className: "plc-fill-current"
39234
39240
  }))));
package/dist/pelcro.css CHANGED
@@ -2104,10 +2104,6 @@ apple-pay-button {
2104
2104
  right: 1.25rem;
2105
2105
  }
2106
2106
 
2107
- .pelcro-root .plc-right-10{
2108
- right: 2.5rem;
2109
- }
2110
-
2111
2107
  .pelcro-root .plc--right-14{
2112
2108
  right: -3.5rem;
2113
2109
  }
@@ -2124,6 +2120,10 @@ apple-pay-button {
2124
2120
  left: 0px;
2125
2121
  }
2126
2122
 
2123
+ .pelcro-root .plc-left-2{
2124
+ left: 0.5rem;
2125
+ }
2126
+
2127
2127
  .pelcro-root .plc-left-4{
2128
2128
  left: 1rem;
2129
2129
  }
@@ -3860,6 +3860,10 @@ apple-pay-button {
3860
3860
  right: 2.5rem;
3861
3861
  }
3862
3862
 
3863
+ .pelcro-root .md\:plc-left-10{
3864
+ left: 2.5rem;
3865
+ }
3866
+
3863
3867
  .pelcro-root .md\:plc-mx-auto{
3864
3868
  margin-left: auto;
3865
3869
  margin-right: auto;
@@ -3952,10 +3956,6 @@ apple-pay-button {
3952
3956
  }
3953
3957
 
3954
3958
  @media (min-width: 1024px){
3955
- .pelcro-root .lg\:plc-hidden{
3956
- display: none;
3957
- }
3958
-
3959
3959
  .pelcro-root .lg\:plc-w-3\/12{
3960
3960
  width: 25%;
3961
3961
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "4.0.0-alpha.64",
4
+ "version": "4.0.0-alpha.65",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",