@ukpc-lib/react 0.2.26 → 0.2.28

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.2.26",
4
+ "version": "0.2.28",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../index-ea3fddce.cjs");const e=require("../index-04dc6603.cjs");exports.TopBar=e.TopBar;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../index-ea3fddce.cjs");const e=require("../index-f93fc96f.cjs");exports.TopBar=e.TopBar;
@@ -1,5 +1,5 @@
1
1
  import "../index-a16031d2.js";
2
- import { T as a } from "../index-aff1e7a4.js";
2
+ import { T as a } from "../index-ed2b29bc.js";
3
3
  export {
4
4
  a as TopBar
5
5
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../index-ea3fddce.cjs");const e=require("../index-04dc6603.cjs");exports.HasPermission=e.HasPermission;exports.getUseHasPermission=e.getUseHasPermission;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../index-ea3fddce.cjs");const e=require("../index-f93fc96f.cjs");exports.HasPermission=e.HasPermission;exports.getUseHasPermission=e.getUseHasPermission;
@@ -1,5 +1,5 @@
1
1
  import "../index-a16031d2.js";
2
- import { H as o, g as r } from "../index-aff1e7a4.js";
2
+ import { H as o, g as r } from "../index-ed2b29bc.js";
3
3
  export {
4
4
  o as HasPermission,
5
5
  r as getUseHasPermission
@@ -2701,8 +2701,24 @@ const KT = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2701
2701
  default: ge
2702
2702
  }, Symbol.toStringTag, { value: "Module" })), XT = ({ notification: e, handleUpdateRead: t }) => {
2703
2703
  const n = (i) => {
2704
- const a = ge(), u = ge(i), c = a.diff(u, "days");
2705
- return c === 0 ? "Today" : c === 1 ? "Yesterday" : c >= 2 && c <= 7 ? `Last ${c} days` : c === 8 || c === 9 || c === 10 ? "1 week ago" : c >= 11 && c <= 14 ? "2 weeks ago" : u.format("MMMM DD, YYYY");
2704
+ const a = ge(), u = ge(i), c = a.diff(u, "days"), m = a.diff(u, "minutes"), y = a.diff(u, "months"), x = a.diff(u, "years");
2705
+ if (m < 1)
2706
+ return "Just now";
2707
+ if (c === 0) {
2708
+ if (m <= 60)
2709
+ return `${m} minutes ago`;
2710
+ const S = Math.floor(m / 60);
2711
+ return `${S} hour${S > 1 ? "s" : ""} ago`;
2712
+ }
2713
+ if (c === 1)
2714
+ return "Yesterday";
2715
+ if (c >= 2 && c <= 7)
2716
+ return `${c} days ago`;
2717
+ if (y === 0 || y === 1) {
2718
+ const S = Math.ceil(c / 7);
2719
+ return `${S} week${S > 1 ? "s" : ""} ago`;
2720
+ }
2721
+ return y < 12 ? `${Math.floor(y / 4)} months ago` : x === 1 ? "1 year ago" : "Over 1 year ago";
2706
2722
  };
2707
2723
  return /* @__PURE__ */ G.jsxs(
2708
2724
  "div",
@@ -20958,80 +20974,86 @@ function wN({
20958
20974
  baseUrl: t,
20959
20975
  notiPath: n
20960
20976
  }) {
20961
- var x;
20977
+ var x, S;
20962
20978
  const { isOpen: i, toggleOpen: a } = se.useContext(ua), { notidata: u, setNotiData: c } = se.useContext(ua), m = Rv({ baseUrl: t, notiPath: n, setNotiData: c }), y = async () => {
20963
- var S, E;
20979
+ var E, T;
20964
20980
  try {
20965
20981
  await m();
20966
- } catch (T) {
20982
+ } catch (B) {
20967
20983
  ul(
20968
- ((E = (S = T.response) == null ? void 0 : S.data) == null ? void 0 : E.errorMessage) || "Have error when get notification list"
20984
+ ((T = (E = B.response) == null ? void 0 : E.data) == null ? void 0 : T.errorMessage) || "Have error when get notification list"
20969
20985
  );
20970
20986
  }
20971
20987
  };
20972
20988
  return se.useEffect(() => {
20973
20989
  y();
20974
- }, []), /* @__PURE__ */ G.jsxs("div", { children: [
20975
- /* @__PURE__ */ G.jsxs(
20976
- "svg",
20977
- {
20978
- width: "24",
20979
- height: "25",
20980
- viewBox: "0 0 24 25",
20981
- fill: "none",
20982
- xmlns: "http://www.w3.org/2000/svg",
20983
- onClick: a,
20984
- style: { cursor: "pointer" },
20985
- children: [
20986
- /* @__PURE__ */ G.jsx(
20987
- "path",
20988
- {
20989
- fillRule: "evenodd",
20990
- clipRule: "evenodd",
20991
- d: "M11.7968 17.4705C16.5901 17.4705 18.8076 16.8556 19.0218 14.3874C19.0218 11.921 17.4757 12.0796 17.4757 9.05334C17.4757 6.68952 15.2352 4 11.7968 4C8.35833 4 6.1178 6.68952 6.1178 9.05334C6.1178 12.0796 4.57178 11.921 4.57178 14.3874C4.78679 16.8649 7.00428 17.4705 11.7968 17.4705Z",
20992
- stroke: e,
20993
- strokeWidth: "1.5",
20994
- strokeLinecap: "round",
20995
- strokeLinejoin: "round"
20996
- }
20997
- ),
20998
- /* @__PURE__ */ G.jsx(
20999
- "path",
21000
- {
21001
- d: "M13.8274 20.0286C12.6679 21.3161 10.8591 21.3313 9.68848 20.0286",
21002
- stroke: e,
21003
- strokeWidth: "1.5",
21004
- strokeLinecap: "round",
21005
- strokeLinejoin: "round"
21006
- }
21007
- )
21008
- ]
21009
- }
21010
- ),
21011
- (u == null ? void 0 : u.unread) && (u == null ? void 0 : u.unread.total) != 0 && /* @__PURE__ */ G.jsx(
21012
- "span",
21013
- {
21014
- style: {
21015
- position: "absolute",
21016
- top: "18px",
21017
- background: `${Pd.dangerDark}`,
21018
- width: "13px",
21019
- height: "13px",
21020
- border: "1px solid #fff",
21021
- borderRadius: "50%",
21022
- color: "#fff",
21023
- fontSize: "8px"
21024
- },
21025
- className: "notification-badge",
21026
- children: (x = u == null ? void 0 : u.unread) == null ? void 0 : x.total
21027
- }
21028
- ),
20990
+ }, [i]), /* @__PURE__ */ G.jsxs("div", { children: [
20991
+ /* @__PURE__ */ G.jsxs("div", { style: { position: "relative" }, children: [
20992
+ /* @__PURE__ */ G.jsxs(
20993
+ "svg",
20994
+ {
20995
+ width: "24",
20996
+ height: "25",
20997
+ viewBox: "0 0 24 25",
20998
+ fill: "none",
20999
+ xmlns: "http://www.w3.org/2000/svg",
21000
+ onClick: a,
21001
+ style: { cursor: "pointer" },
21002
+ children: [
21003
+ /* @__PURE__ */ G.jsx(
21004
+ "path",
21005
+ {
21006
+ fillRule: "evenodd",
21007
+ clipRule: "evenodd",
21008
+ d: "M11.7968 17.4705C16.5901 17.4705 18.8076 16.8556 19.0218 14.3874C19.0218 11.921 17.4757 12.0796 17.4757 9.05334C17.4757 6.68952 15.2352 4 11.7968 4C8.35833 4 6.1178 6.68952 6.1178 9.05334C6.1178 12.0796 4.57178 11.921 4.57178 14.3874C4.78679 16.8649 7.00428 17.4705 11.7968 17.4705Z",
21009
+ stroke: e,
21010
+ strokeWidth: "1.5",
21011
+ strokeLinecap: "round",
21012
+ strokeLinejoin: "round"
21013
+ }
21014
+ ),
21015
+ /* @__PURE__ */ G.jsx(
21016
+ "path",
21017
+ {
21018
+ d: "M13.8274 20.0286C12.6679 21.3161 10.8591 21.3313 9.68848 20.0286",
21019
+ stroke: e,
21020
+ strokeWidth: "1.5",
21021
+ strokeLinecap: "round",
21022
+ strokeLinejoin: "round"
21023
+ }
21024
+ )
21025
+ ]
21026
+ }
21027
+ ),
21028
+ (u == null ? void 0 : u.unread) && (u == null ? void 0 : u.unread.total) != 0 && /* @__PURE__ */ G.jsx(
21029
+ "span",
21030
+ {
21031
+ style: {
21032
+ position: "absolute",
21033
+ top: "-9px",
21034
+ right: "-6px",
21035
+ background: `${Pd.dangerDark}`,
21036
+ width: "20px",
21037
+ height: "20px",
21038
+ border: "1px solid #fff",
21039
+ borderRadius: "50%",
21040
+ color: "#fff",
21041
+ fontSize: "12px",
21042
+ display: "flex",
21043
+ alignItems: "center",
21044
+ justifyContent: "center"
21045
+ },
21046
+ className: "notification-badge",
21047
+ children: ((x = u == null ? void 0 : u.unread) == null ? void 0 : x.total) > 9 ? "9+" : `${(S = u == null ? void 0 : u.unread) == null ? void 0 : S.total}`
21048
+ }
21049
+ )
21050
+ ] }),
21029
21051
  !i && /* @__PURE__ */ G.jsx(bN, { baseUrl: t, notiPath: n })
21030
21052
  ] });
21031
21053
  }
21032
21054
  const xN = `.avatar-dropdown-item{padding:.5rem;font-size:.875rem;line-height:1.25rem;cursor:pointer;border-radius:.25rem}.avartarDropdownMenu{background-color:#fff;padding:.5rem;width:13rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);position:absolute;left:-10rem;top:3.2rem}.avartarDropdownMenu ul{list-style:none;padding-inline-start:0;margin-block-end:0}.navbar{position:fixed;display:flex;z-index:30;background:#292929;top:0;width:100%;padding-left:2.5rem;height:64px}.navbar-container{display:flex;flex-direction:row;align-items:center;width:100%;justify-content:space-between}.logo-container{padding:16px 0;height:100%}.right-side-container{display:flex;flex-direction:row;align-items:center;text-align:center;margin-right:2.5rem;gap:1rem}.userContainer{display:flex;align-items:center;gap:.5rem}.languageDropdown{height:100%;padding:0 8px;display:flex;flex-direction:row;gap:8px;border-radius:3px;align-items:center;justify-content:center;height:41px;background-color:#ffffff1a;cursor:pointer;transition:background-color .2s ease-in-out}.languageDropdown:hover{background-color:#fff3}.userFullName{color:#fff;font-weight:400;font-size:.875rem;line-height:1.25rem}.userAvatar{width:2.5rem;height:2.5rem;cursor:pointer;-o-object-fit:cover;object-fit:cover;border-radius:9999px;border:2px solid #FFFFFF}.userAvatarNull{width:2.5rem;height:2.5rem;background:#DDDDDD;border-radius:100%;color:#fff;font-size:20px;font-weight:400;display:flex;align-items:center;justify-content:center}.relative{position:relative}.cursor-pointer{cursor:pointer}
21033
21055
  `, _N = `.tab-title{min-width:90px;padding:5px 16px;font-size:14px;font-weight:500;color:#c5c5c5;transition:all .3s ease-in-out;position:relative}.tab-title.is-active{color:#2e7d32}.tab-title.is-active:before{transition:all .3s ease-in-out;position:absolute;content:"";width:100%;height:100%;top:0;left:0;border-bottom:2px solid #2E7D32}.tab-content{padding:16px 0}
21034
- `, SN = `:root{--textPrimary: #292929;--textWhite: #fff;--primary500: #2E7D32;--grey100: #FAFAFA;--gray200: #EEEEEE;--gray600: #85858A;--link: #007BFF }.list-content{overflow-y:auto;overflow-x:hidden}.mark-all-read{text-align:right;color:#007bff;margin-bottom:12px;font-size:12px}.notification-items__wrapper{overflow:hidden}.notification-items__content{height:calc(100vh - 275px);overflow-x:hidden;overflow-y:auto}.notitification-item__container{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:#FAFAFA 1px solid;text-align:left;font-size:12px;position:relative;z-index:10;cursor:pointer;border-radius:4px;margin-bottom:8px}.notitification-item__container:hover{background-color:#fafafa}.notitification-item__container:not(:last-child):before{position:absolute;content:"";width:100%;bottom:-5px;left:0;border:1px solid #FAFAFA}.notitification-item__container:hover:before{opacity:1}.notification-item__image-container{width:40px;height:40px;display:flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;margin-right:16px}.notification-item__image-container img{width:100%;height:100%;text-align:center;-o-object-fit:cover;object-fit:cover;color:transparent;text-indent:10000px}.notification-item__context-link{color:#007bff}.notification-item__content{width:65%;padding-right:16px}.notification-item__user-name{margin-bottom:2px;font-size:14px}.notification-item__time{margin-right:15px}.notification-item__read-at{border-width:2px;border-style:solid;border-radius:50%;width:10px;height:10px;display:block;position:relative}.notification-item__read-at:before{position:absolute;top:-30px;right:0;width:91px;background-color:#85858a;color:#fff;border-radius:4px;font-size:10px;text-align:center;padding:4px;opacity:0;visibility:hidden;transition:all .3s cubic-bezier(.39,.575,.565,1)}.notification-item__read-at:hover:before{opacity:1;visibility:visible}.notification-item__read-at.read:before{content:"Mark as unread"}.notification-item__read-at.unread:before{content:"Mark as read"}.notification-item__read-at.read{border-color:#eee}.notification-item__read-at.unread{border-color:#2e7d32;background-color:#2e7d32}
21056
+ `, SN = `:root{--textPrimary: #292929;--textWhite: #fff;--primary500: #2E7D32;--grey100: #FAFAFA;--gray200: #EEEEEE;--gray600: #85858A;--link: #007BFF }.list-content{overflow-y:auto;overflow-x:hidden}.mark-all-read{text-align:right;color:#007bff;margin-bottom:12px;font-size:12px}.notification-items__wrapper{overflow:hidden}.notification-items__content{height:calc(100vh - 275px);overflow-x:hidden;overflow-y:auto}.notitification-item__container{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:#FAFAFA 1px solid;text-align:left;font-size:12px;position:relative;z-index:10;cursor:pointer;border-radius:4px;margin-bottom:8px}.notitification-item__container:hover{background-color:#fafafa}.notitification-item__container:not(:last-child):before{position:absolute;content:"";width:100%;bottom:-5px;left:0;border:1px solid #FAFAFA}.notitification-item__container:hover:before{opacity:1}.notification-item__image-container{width:40px;height:40px;display:flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;margin-right:16px}.notification-item__image-container img{width:100%;height:100%;text-align:center;-o-object-fit:cover;object-fit:cover;color:transparent;text-indent:10000px}.notification-item__context-link{color:#007bff}.notification-item__content{width:62%;padding-right:16px}.notification-item__user-name{margin-bottom:2px;font-size:14px}.notification-item__time{margin-right:15px;text-align:right}.notification-item__read-at{border-width:2px;border-style:solid;border-radius:50%;width:10px;height:10px;display:block;position:relative}.notification-item__read-at:before{position:absolute;top:-30px;right:0;width:91px;background-color:#85858a;color:#fff;border-radius:4px;font-size:10px;text-align:center;padding:4px;opacity:0;visibility:hidden;transition:all .3s cubic-bezier(.39,.575,.565,1)}.notification-item__read-at:hover:before{opacity:1;visibility:visible}.notification-item__read-at.read:before{content:"Mark as unread"}.notification-item__read-at.unread:before{content:"Mark as read"}.notification-item__read-at.read{border-color:#eee}.notification-item__read-at.unread{border-color:#2e7d32;background-color:#2e7d32}
21035
21057
  `, kN = `._notification-massage_container_ql4az_1{background:#fff;padding:0 64px 0 84px;border-radius:8px;font-family:TT Firs Neue Trl,sans-serif}._notification-massage_container_ql4az_1:before{position:absolute;content:"";width:48px;height:48px;background:url(https://ukpcsaprod.blob.core.windows.net/saas/notification-icon.svg) no-repeat center/100%;top:12px;left:24px}._notification-name_ql4az_18{font-weight:500;font-size:14px}._notification-message_service_ql4az_23{font-size:12px}._notification-message_button-close_ql4az_27{position:absolute;top:12px;right:24px;width:24px;height:24px}
21036
21058
  `, CN = `._subscription-diaglog_12x9u_2{position:fixed;width:100vw;height:100vh;top:0;left:0;background-color:#0006;z-index:10000;display:flex;align-items:center;justify-content:center}._subscription-container_12x9u_15{width:610px;height:222px;border-radius:8px;padding:32px 24px 40px;background:#fff}._subscription-title_12x9u_24{font-size:20px;font-weight:500;text-align:center;color:#292929}._subscription-title_12x9u_24,._subscription-text_12x9u_33{margin-bottom:24px}._subscription-btn__container_12x9u_37{display:flex;justify-content:space-between;align-items:center}._btn-success_12x9u_43,._btn-cancel_12x9u_44{width:150px;height:40px;display:flex;align-items:center;justify-content:center;padding:8px;color:#292929;border-radius:1px}._btn-cancel_12x9u_44{background-color:#ddd}._btn-success_12x9u_43{background-color:#93d500}
21037
21059
  `;