@edifice.io/react 2.5.8-develop-b2school.20260123153909 → 2.5.8-develop-b2school.20260128112517

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.
@@ -0,0 +1,4 @@
1
+ var isSameOrAfter = { exports: {} };
2
+ export {
3
+ isSameOrAfter as __module
4
+ };
@@ -0,0 +1,4 @@
1
+ var isToday = { exports: {} };
2
+ export {
3
+ isToday as __module
4
+ };
@@ -6,7 +6,7 @@ const WidgetAppsFooter = () => {
6
6
  t
7
7
  } = useTranslation();
8
8
  return /* @__PURE__ */ jsx("div", { className: "widget-footer", children: /* @__PURE__ */ jsx("div", { className: "widget-footer-action", children: /* @__PURE__ */ jsx("a", { href: "/welcome", className: "link", children: t("plus") }) }) });
9
- }, WidgetAppsBody = ({
9
+ }, appToOpenOnBlank = ["Administration"], WidgetAppsBody = ({
10
10
  bookmarkedApps
11
11
  }) => {
12
12
  const {
@@ -14,7 +14,7 @@ const WidgetAppsFooter = () => {
14
14
  } = useTranslation();
15
15
  return /* @__PURE__ */ jsxs("div", { className: "widget-body d-flex flex-wrap", children: [
16
16
  !bookmarkedApps.length && /* @__PURE__ */ jsx("div", { className: "text-dark", children: t("navbar.myapps.more") }),
17
- bookmarkedApps.slice(0, 6).map((app, index) => /* @__PURE__ */ jsx("a", { href: app.address, className: "bookmarked-app", target: app.isExternal || app.category === "connector" ? "_blank" : void 0, children: /* @__PURE__ */ jsx(AppIcon, { app, size: "32" }) }, index))
17
+ bookmarkedApps.slice(0, 6).map((app, index) => /* @__PURE__ */ jsx("a", { href: app.address, className: "bookmarked-app", target: appToOpenOnBlank.includes(app.name) || app.isExternal || app.category === "connector" ? "_blank" : void 0, rel: appToOpenOnBlank.includes(app.name) || app.isExternal || app.category === "connector" ? "noopener noreferrer" : void 0, children: /* @__PURE__ */ jsx(AppIcon, { app, size: "32" }) }, index))
18
18
  ] });
19
19
  };
20
20
  export {
@@ -1,10 +1,11 @@
1
+ import { OpUnitType } from 'dayjs';
1
2
  export type MongoDate = {
2
3
  $date: number | string;
3
4
  };
4
5
  export type IsoDate = string;
5
6
  export type NumberDate = number;
6
7
  /** Date formats we are going to deal with. */
7
- export type CoreDate = IsoDate | MongoDate | NumberDate;
8
+ export type CoreDate = IsoDate | MongoDate | NumberDate | Date;
8
9
  /**
9
10
  * Custom React hook for date parsing, formatting, and localization.
10
11
  *
@@ -25,4 +26,7 @@ export default function useDate(): {
25
26
  fromNow: (date: CoreDate) => string;
26
27
  formatDate: (date: CoreDate, format?: string) => string;
27
28
  formatTimeAgo: (date: CoreDate) => string;
29
+ dateIsSame: (date: CoreDate, date2: CoreDate, unit?: OpUnitType) => boolean;
30
+ dateIsSameOrAfter: (date: CoreDate, date2: CoreDate, unit?: OpUnitType) => boolean;
31
+ dateIsToday: (date: CoreDate) => boolean;
28
32
  };
@@ -1,5 +1,7 @@
1
1
  import { useCallback } from "react";
2
2
  import dayjs from "dayjs";
3
+ import isSameOrAfter from "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isSameOrAfter.js";
4
+ import isToday from "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isToday.js";
3
5
  import customParseFormat from "dayjs/plugin/customParseFormat.js";
4
6
  import localizedFormat from "dayjs/plugin/localizedFormat.js";
5
7
  import relativeTime from "dayjs/plugin/relativeTime.js";
@@ -13,6 +15,8 @@ import { useEdificeClient } from "../../providers/EdificeClientProvider/EdificeC
13
15
  dayjs.extend(relativeTime);
14
16
  dayjs.extend(customParseFormat);
15
17
  dayjs.extend(localizedFormat);
18
+ dayjs.extend(isSameOrAfter);
19
+ dayjs.extend(isToday);
16
20
  function useDate() {
17
21
  const {
18
22
  currentLanguage
@@ -29,7 +33,7 @@ function useDate() {
29
33
  }, [currentLanguage]), toComputedDate = useCallback((date) => {
30
34
  let computedDate = dayjs();
31
35
  try {
32
- return typeof date > "u" ? void 0 : (typeof date == "string" ? computedDate = parseDate(date) : typeof date == "number" ? computedDate = dayjs(date).locale(currentLanguage) : typeof date.$date == "number" ? computedDate = dayjs(new Date(date.$date)).locale(currentLanguage) : typeof date.$date == "string" && (computedDate = parseDate(date.$date)), computedDate);
36
+ return typeof date > "u" ? void 0 : (typeof date == "string" ? computedDate = parseDate(date) : date instanceof Date ? computedDate = dayjs(date).locale(currentLanguage) : typeof date == "number" ? computedDate = dayjs(date).locale(currentLanguage) : typeof date.$date == "number" ? computedDate = dayjs(new Date(date.$date)).locale(currentLanguage) : typeof date.$date == "string" && (computedDate = parseDate(date.$date)), computedDate);
33
37
  } catch (error) {
34
38
  console.error(error);
35
39
  }
@@ -59,11 +63,23 @@ function useDate() {
59
63
  dayjsFormat = format;
60
64
  }
61
65
  return computedDate != null && computedDate.isValid() ? computedDate.locale(currentLanguage).format(dayjsFormat) : "";
66
+ }, [currentLanguage, parseDate]), dateIsSame = useCallback((date, date2, unit = "day") => {
67
+ const computedDate = toComputedDate(date), computedDate2 = toComputedDate(date2);
68
+ return (computedDate == null ? void 0 : computedDate.isSame(computedDate2, unit)) ?? !1;
69
+ }, [currentLanguage, parseDate]), dateIsSameOrAfter = useCallback((date, date2, unit = "day") => {
70
+ const computedDate = toComputedDate(date), computedDate2 = toComputedDate(date2);
71
+ return (computedDate == null ? void 0 : computedDate.isSameOrAfter(computedDate2, unit)) ?? !1;
72
+ }, [currentLanguage, parseDate]), dateIsToday = useCallback((date) => {
73
+ const computedDate = toComputedDate(date);
74
+ return (computedDate == null ? void 0 : computedDate.isToday()) ?? !1;
62
75
  }, [currentLanguage, parseDate]);
63
76
  return {
64
77
  fromNow,
65
78
  formatDate,
66
- formatTimeAgo
79
+ formatTimeAgo,
80
+ dateIsSame,
81
+ dateIsSameOrAfter,
82
+ dateIsToday
67
83
  };
68
84
  }
69
85
  export {
@@ -0,0 +1,18 @@
1
+ import { commonjsGlobal, getDefaultExportFromCjs } from "../../../../../../_virtual/_commonjsHelpers.js";
2
+ import { __module as isSameOrAfter$1 } from "../../../../../../_virtual/isSameOrAfter.js";
3
+ (function(module, exports$1) {
4
+ (function(e, t) {
5
+ module.exports = t();
6
+ })(commonjsGlobal, function() {
7
+ return function(e, t) {
8
+ t.prototype.isSameOrAfter = function(e2, t2) {
9
+ return this.isSame(e2, t2) || this.isAfter(e2, t2);
10
+ };
11
+ };
12
+ });
13
+ })(isSameOrAfter$1);
14
+ var isSameOrAfterExports = isSameOrAfter$1.exports;
15
+ const isSameOrAfter = /* @__PURE__ */ getDefaultExportFromCjs(isSameOrAfterExports);
16
+ export {
17
+ isSameOrAfter as default
18
+ };
@@ -0,0 +1,19 @@
1
+ import { commonjsGlobal, getDefaultExportFromCjs } from "../../../../../../_virtual/_commonjsHelpers.js";
2
+ import { __module as isToday$1 } from "../../../../../../_virtual/isToday.js";
3
+ (function(module, exports$1) {
4
+ (function(e, o) {
5
+ module.exports = o();
6
+ })(commonjsGlobal, function() {
7
+ return function(e, o, t) {
8
+ o.prototype.isToday = function() {
9
+ var e2 = "YYYY-MM-DD", o2 = t();
10
+ return this.format(e2) === o2.format(e2);
11
+ };
12
+ };
13
+ });
14
+ })(isToday$1);
15
+ var isTodayExports = isToday$1.exports;
16
+ const isToday = /* @__PURE__ */ getDefaultExportFromCjs(isTodayExports);
17
+ export {
18
+ isToday as default
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.5.8-develop-b2school.20260123153909",
3
+ "version": "2.5.8-develop-b2school.20260128112517",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -134,9 +134,9 @@
134
134
  "react-slugify": "^3.0.3",
135
135
  "swiper": "^10.1.0",
136
136
  "ua-parser-js": "^1.0.36",
137
- "@edifice.io/bootstrap": "2.5.8-develop-b2school.20260123153909",
138
- "@edifice.io/tiptap-extensions": "2.5.8-develop-b2school.20260123153909",
139
- "@edifice.io/utilities": "2.5.8-develop-b2school.20260123153909"
137
+ "@edifice.io/bootstrap": "2.5.8-develop-b2school.20260128112517",
138
+ "@edifice.io/utilities": "2.5.8-develop-b2school.20260128112517",
139
+ "@edifice.io/tiptap-extensions": "2.5.8-develop-b2school.20260128112517"
140
140
  },
141
141
  "devDependencies": {
142
142
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -167,8 +167,8 @@
167
167
  "vite": "^5.4.11",
168
168
  "vite-plugin-dts": "^4.1.0",
169
169
  "vite-tsconfig-paths": "^5.0.1",
170
- "@edifice.io/client": "2.5.8-develop-b2school.20260123153909",
171
- "@edifice.io/config": "2.5.8-develop-b2school.20260123153909"
170
+ "@edifice.io/config": "2.5.8-develop-b2school.20260128112517",
171
+ "@edifice.io/client": "2.5.8-develop-b2school.20260128112517"
172
172
  },
173
173
  "peerDependencies": {
174
174
  "@react-spring/web": "^9.7.5",