@capsitech/react-utilities 0.1.8 → 0.1.10

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.
@@ -1,6 +1,42 @@
1
- import "dayjs";
2
- import { d } from "../../dayjs-aKjfjjRl.mjs";
1
+ import e from "dayjs";
2
+ import "dayjs/locale/en-gb";
3
+ import f from "dayjs/plugin/advancedFormat";
4
+ import p from "dayjs/plugin/customParseFormat";
5
+ import x from "dayjs/plugin/duration";
6
+ import y from "dayjs/plugin/isSameOrAfter";
7
+ import c from "dayjs/plugin/isSameOrBefore";
8
+ import v from "dayjs/plugin/relativeTime";
9
+ import h from "dayjs/plugin/timezone";
10
+ import l from "dayjs/plugin/utc";
11
+ import b from "dayjs/plugin/weekday";
12
+ e.locale("en-gb");
13
+ e.extend(f);
14
+ e.extend(p);
15
+ e.extend(b);
16
+ e.extend(y);
17
+ e.extend(c);
18
+ e.extend(v);
19
+ e.extend(l);
20
+ e.extend(h);
21
+ e.extend(x);
22
+ const u = (I, i) => {
23
+ function m(r) {
24
+ return r = +r, r > 0 ? 1 : -1;
25
+ }
26
+ i.prototype.addWorkdays = function(r) {
27
+ if (r === 0 || isNaN(r))
28
+ return this;
29
+ var o = m(r), t = this.day(), n = Math.abs(r), d = 0;
30
+ (t === 0 && o === -1 || t === 6 && o === 1) && (d = 1);
31
+ var a = n;
32
+ t !== 0 && t !== 6 && o > 0 ? a += t : t !== 0 && t !== 6 && o < 0 && (a += 6 - t);
33
+ var s = Math.max(Math.floor(a / 5) - 1, 0) + (a > 5 && a % 5 > 0 ? 1 : 0);
34
+ return d += n + s * 2, this.add(o * d, "day");
35
+ };
36
+ };
37
+ e.extend(u);
38
+ const O = e;
3
39
  export {
4
- d as dayjs
40
+ O as dayjs
5
41
  };
6
42
  //# sourceMappingURL=dayjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dayjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"dayjs.js","sources":["../../../src/Utilities/dayjs.ts"],"sourcesContent":["import dayjsBase from 'dayjs';\r\nimport 'dayjs/locale/en-gb';\r\nimport AdvancedFormat from 'dayjs/plugin/advancedFormat';\r\nimport CustomParseFormat from 'dayjs/plugin/customParseFormat';\r\nimport Duration from 'dayjs/plugin/duration';\r\nimport IsSameOrAfter from 'dayjs/plugin/isSameOrAfter';\r\nimport IsSameOrBefore from 'dayjs/plugin/isSameOrBefore';\r\nimport RelativeTime from 'dayjs/plugin/relativeTime';\r\nimport tz from 'dayjs/plugin/timezone';\r\nimport utc from 'dayjs/plugin/utc';\r\nimport Weekday from 'dayjs/plugin/weekday';\r\n\r\ndayjsBase.locale('en-gb');\r\ndayjsBase.extend(AdvancedFormat);\r\ndayjsBase.extend(CustomParseFormat);\r\ndayjsBase.extend(Weekday);\r\ndayjsBase.extend(IsSameOrAfter);\r\ndayjsBase.extend(IsSameOrBefore);\r\ndayjsBase.extend(RelativeTime);\r\ndayjsBase.extend(utc);\r\ndayjsBase.extend(tz);\r\ndayjsBase.extend(Duration);\r\n\r\n// Custom plugin to add workdays to a dayjs object\r\ndeclare module 'dayjs' {\r\n interface Dayjs {\r\n addWorkdays(amount: number): dayjsBase.Dayjs;\r\n }\r\n}\r\nconst addWorkdays: dayjsBase.PluginFunc = (option, c) => {\r\n function determineSign(x: number) {\r\n x = +x;\r\n return x > 0 ? 1 : -1;\r\n }\r\n\r\n c.prototype.addWorkdays = function (amount: number) {\r\n if (amount === 0 || isNaN(amount)) {\r\n return this;\r\n }\r\n\r\n var sign = determineSign(amount);\r\n var day = this.day();\r\n var absIncrement = Math.abs(amount);\r\n\r\n var days = 0;\r\n\r\n if (day === 0 && sign === -1) {\r\n days = 1;\r\n } else if (day === 6 && sign === 1) {\r\n days = 1;\r\n }\r\n // Add padding for weekends.\r\n var paddedAbsIncrement = absIncrement;\r\n if (day !== 0 && day !== 6 && sign > 0) {\r\n paddedAbsIncrement += day;\r\n } else if (day !== 0 && day !== 6 && sign < 0) {\r\n paddedAbsIncrement += 6 - day;\r\n }\r\n\r\n var weekendsInbetween = Math.max(Math.floor(paddedAbsIncrement / 5) - 1, 0) + (paddedAbsIncrement > 5 && paddedAbsIncrement % 5 > 0 ? 1 : 0);\r\n\r\n // Add the increment and number of weekends.\r\n days += absIncrement + weekendsInbetween * 2;\r\n\r\n return this.add(sign * days, 'day');\r\n };\r\n};\r\ndayjsBase.extend(addWorkdays);\r\n\r\n// Export the customized dayjs instance\r\nexport const dayjs = dayjsBase;\r\n\r\n//temp type to export plugin interfaces\r\nexport type tmpDayJs =\r\n | typeof dayjsBase\r\n | typeof AdvancedFormat\r\n | typeof CustomParseFormat\r\n | typeof Weekday\r\n | typeof IsSameOrAfter\r\n | typeof IsSameOrBefore\r\n | typeof RelativeTime\r\n | typeof utc\r\n | typeof tz\r\n | typeof Duration;\r\n"],"names":["dayjsBase","AdvancedFormat","CustomParseFormat","Weekday","IsSameOrAfter","IsSameOrBefore","RelativeTime","utc","tz","Duration","addWorkdays","option","c","determineSign","x","amount","sign","day","absIncrement","days","paddedAbsIncrement","weekendsInbetween","dayjs"],"mappings":";;;;;;;;;;;AAYAA,EAAU,OAAO,OAAO;AACxBA,EAAU,OAAOC,CAAc;AAC/BD,EAAU,OAAOE,CAAiB;AAClCF,EAAU,OAAOG,CAAO;AACxBH,EAAU,OAAOI,CAAa;AAC9BJ,EAAU,OAAOK,CAAc;AAC/BL,EAAU,OAAOM,CAAY;AAC7BN,EAAU,OAAOO,CAAG;AACpBP,EAAU,OAAOQ,CAAE;AACnBR,EAAU,OAAOS,CAAQ;AAQzB,MAAMC,IAAoC,CAACC,GAAQC,MAAM;AACvD,WAASC,EAAcC,GAAW;AAChC,WAAAA,IAAI,CAACA,GACEA,IAAI,IAAI,IAAI;AAAA,EACrB;AAEA,EAAAF,EAAE,UAAU,cAAc,SAAUG,GAAgB;AAClD,QAAIA,MAAW,KAAK,MAAMA,CAAM;AAC9B,aAAO;AAGT,QAAIC,IAAOH,EAAcE,CAAM,GAC3BE,IAAM,KAAK,IAAA,GACXC,IAAe,KAAK,IAAIH,CAAM,GAE9BI,IAAO;AAEX,KAAIF,MAAQ,KAAKD,MAAS,MAEfC,MAAQ,KAAKD,MAAS,OAC/BG,IAAO;AAGT,QAAIC,IAAqBF;AACzB,IAAID,MAAQ,KAAKA,MAAQ,KAAKD,IAAO,IACnCI,KAAsBH,IACbA,MAAQ,KAAKA,MAAQ,KAAKD,IAAO,MAC1CI,KAAsB,IAAIH;AAG5B,QAAII,IAAoB,KAAK,IAAI,KAAK,MAAMD,IAAqB,CAAC,IAAI,GAAG,CAAC,KAAKA,IAAqB,KAAKA,IAAqB,IAAI,IAAI,IAAI;AAG1I,WAAAD,KAAQD,IAAeG,IAAoB,GAEpC,KAAK,IAAIL,IAAOG,GAAM,KAAK;AAAA,EACpC;AACF;AACAnB,EAAU,OAAOU,CAAW;AAGrB,MAAMY,IAAQtB;"}
@@ -1,8 +1,8 @@
1
1
  import { ApiUtility as o, FileDownloadStatus as r, HttpMethods as i } from "./ApiUtility.axios.js";
2
- import { getBrowserDoNotTrackStatus as s, getBrowserPluginsAsString as a, getDeviceLocalIPAsString as g, getScreenColourDepth as m, getScreenHeight as p, getScreenScalingFactor as l, getScreenWidth as u, getTimezone as d, getUserAgent as f, getWindowHeight as S, getWindowWidth as c, resetDeviceIpString as x, resetDeviceIpTimeStamp as D } from "./BrowserInfo.js";
2
+ import { getBrowserDoNotTrackStatus as s, getBrowserPluginsAsString as g, getDeviceLocalIPAsString as a, getScreenColourDepth as m, getScreenHeight as p, getScreenScalingFactor as l, getScreenWidth as u, getTimezone as f, getUserAgent as d, getWindowHeight as S, getWindowWidth as c, resetDeviceIpString as x, resetDeviceIpTimeStamp as D } from "./BrowserInfo.js";
3
3
  import { AllCountries as w, getCountries as y, getCountryByPhoneNumber as A, getCountryOptions as C } from "./Countries.js";
4
4
  import { CustomEventEmitter as H } from "./CustomEventEmitter.js";
5
- import { d as T } from "../../dayjs-aKjfjjRl.mjs";
5
+ import { dayjs as T } from "./dayjs.js";
6
6
  import { fastCompare as I } from "./FastCompare.js";
7
7
  import { HideablePromise as U } from "./HideablePromise.js";
8
8
  import { LoadScript as B } from "./LoadScripts.js";
@@ -29,11 +29,11 @@ export {
29
29
  I as fastCompare,
30
30
  M as fraudPreventionHeadersEnum,
31
31
  s as getBrowserDoNotTrackStatus,
32
- a as getBrowserPluginsAsString,
32
+ g as getBrowserPluginsAsString,
33
33
  y as getCountries,
34
34
  A as getCountryByPhoneNumber,
35
35
  C as getCountryOptions,
36
- g as getDeviceLocalIPAsString,
36
+ a as getDeviceLocalIPAsString,
37
37
  O as getFraudPreventionHeaders,
38
38
  j as getNationalityOptions,
39
39
  m as getScreenColourDepth,
@@ -42,8 +42,8 @@ export {
42
42
  l as getScreenScalingFactor,
43
43
  u as getScreenWidth,
44
44
  J as getTimeZoneOptions,
45
- d as getTimezone,
46
- f as getUserAgent,
45
+ f as getTimezone,
46
+ d as getUserAgent,
47
47
  S as getWindowHeight,
48
48
  c as getWindowWidth,
49
49
  x as resetDeviceIpString,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capsitech/react-utilities",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "A set of javascript utility methods",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",
@@ -33,6 +33,18 @@
33
33
  "./Utilities/*": {
34
34
  "types": "./lib/Utilities/*.d.ts",
35
35
  "import": "./lib/src/Utilities/*.js"
36
+ },
37
+ "./lib/Components/*": {
38
+ "types": "./lib/Components/*.d.ts",
39
+ "import": "./lib/src/Components/*.js"
40
+ },
41
+ "./lib/Hooks/*": {
42
+ "types": "./lib/Hooks/*.d.ts",
43
+ "import": "./lib/src/Hooks/*.js"
44
+ },
45
+ "./lib/Utilities/*": {
46
+ "types": "./lib/Utilities/*.d.ts",
47
+ "import": "./lib/src/Utilities/*.js"
36
48
  }
37
49
  },
38
50
  "files": [