@helpdice/ui 1.4.8 → 1.5.0

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,75 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ var Time = /*#__PURE__*/function () {
4
+ function Time() {
5
+ _classCallCheck(this, Time);
6
+ }
7
+ return _createClass(Time, null, [{
8
+ key: "getTimeFromSeconds",
9
+ value: function getTimeFromSeconds(secs) {
10
+ var totalSeconds = Math.ceil(secs);
11
+ var days = Math.floor(totalSeconds / (60 * 60 * 24));
12
+ var hours = Math.floor(totalSeconds % (60 * 60 * 24) / (60 * 60));
13
+ var minutes = Math.floor(totalSeconds % (60 * 60) / 60);
14
+ var seconds = Math.floor(totalSeconds % 60);
15
+ return {
16
+ totalSeconds: totalSeconds,
17
+ seconds: seconds,
18
+ minutes: minutes,
19
+ hours: hours,
20
+ days: days
21
+ };
22
+ }
23
+ }, {
24
+ key: "getSecondsFromExpiry",
25
+ value: function getSecondsFromExpiry(expiry, shouldRound) {
26
+ var now = new Date().getTime();
27
+ var milliSecondsDistance = expiry - now;
28
+ if (milliSecondsDistance > 0) {
29
+ var val = milliSecondsDistance / 1000;
30
+ return shouldRound ? Math.round(val) : val;
31
+ }
32
+ return 0;
33
+ }
34
+ }, {
35
+ key: "getSecondsFromPrevTime",
36
+ value: function getSecondsFromPrevTime(prevTime, shouldRound) {
37
+ var now = new Date().getTime();
38
+ var milliSecondsDistance = now - prevTime;
39
+ if (milliSecondsDistance > 0) {
40
+ var val = milliSecondsDistance / 1000;
41
+ return shouldRound ? Math.round(val) : val;
42
+ }
43
+ return 0;
44
+ }
45
+ }, {
46
+ key: "getSecondsFromTimeNow",
47
+ value: function getSecondsFromTimeNow() {
48
+ var now = new Date();
49
+ var currentTimestamp = now.getTime();
50
+ var offset = now.getTimezoneOffset() * 60;
51
+ return currentTimestamp / 1000 - offset;
52
+ }
53
+ }, {
54
+ key: "getFormattedTimeFromSeconds",
55
+ value: function getFormattedTimeFromSeconds(totalSeconds, format) {
56
+ var _Time$getTimeFromSeco = Time.getTimeFromSeconds(totalSeconds),
57
+ secondsValue = _Time$getTimeFromSeco.seconds,
58
+ minutes = _Time$getTimeFromSeco.minutes,
59
+ hours = _Time$getTimeFromSeco.hours;
60
+ var ampm = '';
61
+ var hoursValue = hours;
62
+ if (format === '12-hour') {
63
+ ampm = hours >= 12 ? 'pm' : 'am';
64
+ hoursValue = hours % 12;
65
+ }
66
+ return {
67
+ seconds: secondsValue,
68
+ minutes: minutes,
69
+ hours: hoursValue,
70
+ ampm: ampm
71
+ };
72
+ }
73
+ }]);
74
+ }();
75
+ export { Time as default };
@@ -0,0 +1,27 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ var Validate = /*#__PURE__*/function () {
4
+ function Validate() {
5
+ _classCallCheck(this, Validate);
6
+ }
7
+ return _createClass(Validate, null, [{
8
+ key: "expiryTimestamp",
9
+ value: function expiryTimestamp(_expiryTimestamp) {
10
+ var isValid = new Date(_expiryTimestamp).getTime() > 0;
11
+ if (!isValid) {
12
+ console.warn('react-timer-hook: { useTimer } Invalid expiryTimestamp settings', _expiryTimestamp); // eslint-disable-line
13
+ }
14
+ return isValid;
15
+ }
16
+ }, {
17
+ key: "onExpire",
18
+ value: function onExpire(_onExpire) {
19
+ var isValid = _onExpire && typeof _onExpire === 'function';
20
+ if (_onExpire && !isValid) {
21
+ console.warn('react-timer-hook: { useTimer } Invalid onExpire settings function', _onExpire); // eslint-disable-line
22
+ }
23
+ return isValid;
24
+ }
25
+ }]);
26
+ }();
27
+ export { Validate as default };
@@ -0,0 +1,3 @@
1
+ import Time from './Time';
2
+ import Validate from './Validate';
3
+ export { Time, Validate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpdice/ui",
3
- "version": "1.4.8",
3
+ "version": "1.5.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "unpkg": "dist/index.min.js",
@@ -22,7 +22,7 @@
22
22
  "build:after": "node scripts/move-built-in.js",
23
23
  "build:types": "tsc -p ./scripts & tsc -p ./scripts --outDir ./esm",
24
24
  "build": "yarn build:rollup && yarn build:babel && yarn build:types && yarn build:after",
25
- "push": "yarn build && yarn publish --access public --non-interactive"
25
+ "release": "yarn build && yarn publish --access public --non-interactive"
26
26
  },
27
27
  "license": "MIT",
28
28
  "description": "Modern React UI library.",
@@ -100,11 +100,13 @@
100
100
  "babel-plugin-transform-rename-import": "^2.3.0",
101
101
  "clsx": "^2.1.1",
102
102
  "deepmerge": "^4.3.1",
103
+ "dompurify": "^3.2.4",
103
104
  "hoist-non-react-statics": "^3.3.2",
104
105
  "lodash": "^4.17.21",
105
106
  "lodash-es": "^4.17.21",
106
107
  "polished": "^4.3.1",
107
108
  "push": "^0.1.1",
109
+ "pusher": "^5.2.0",
108
110
  "react-fast-compare": "^3.2.2",
109
111
  "react-is": "^19.0.0",
110
112
  "react-syntax-highlighter": "^15.6.1",