@bikiran/utils 2.2.6 → 2.2.8

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.d.ts CHANGED
@@ -13,8 +13,10 @@ export { default as UserInfoComp } from "./components/user-info/UserInfoComp";
13
13
  export { default as ProjectSelector } from "./components/project-selector/ProjectSelector";
14
14
  export { default as InformationTooltip } from "./components/information-tooltip/InformationTooltip";
15
15
  export { default as CopyWrapper } from "./components/copy-wrapper/CopyWrapper";
16
- export { GetDate, GetTime, timeAgo, timeRemaining } from "./lib/utils/date";
16
+ export { GetDate, GetTime, timeAgo, timeRemaining, getTimestamp, } from "./lib/utils/date";
17
17
  export { default as capitalizeFirstLetter } from "./lib/utils/capitalizeFirstLetter";
18
+ export { default as capitalizeSentence } from "./lib/utils/capitalizeSentence";
19
+ export { default as scrollToSection } from "./lib/utils/scrollToSection";
18
20
  export { cn } from "./lib/utils/cn";
19
21
  export { default as Copy } from "./lib/utils/Copy";
20
22
  export { default as Cookie } from "./lib/utils/Cookie";
@@ -24,3 +26,4 @@ export { convertToYears } from "./lib/utils/convertToYears";
24
26
  export { showCurrencySign, showInt } from "./lib/utils/show";
25
27
  export { addOption, addOption2 } from "./lib/utils/option";
26
28
  export { getBikiranUrl, getAccountUrl, getApiUrl, getApi2Url, getApi3Url, getBaseDomain, isDev, getMode, } from "./lib/utils/Env";
29
+ export type { TInputChangeEvent, TTextAreaChangeEvent, TMouseEvent, TFormEvent, TKeyboardEvent, TFocusEvent, TDragEvent, TState, } from "./lib/types/GlobalType";
package/dist/index.js CHANGED
@@ -13,8 +13,10 @@ export { default as UserInfoComp } from "./components/user-info/UserInfoComp";
13
13
  export { default as ProjectSelector } from "./components/project-selector/ProjectSelector";
14
14
  export { default as InformationTooltip } from "./components/information-tooltip/InformationTooltip";
15
15
  export { default as CopyWrapper } from "./components/copy-wrapper/CopyWrapper";
16
- export { GetDate, GetTime, timeAgo, timeRemaining } from "./lib/utils/date";
16
+ export { GetDate, GetTime, timeAgo, timeRemaining, getTimestamp, } from "./lib/utils/date";
17
17
  export { default as capitalizeFirstLetter } from "./lib/utils/capitalizeFirstLetter";
18
+ export { default as capitalizeSentence } from "./lib/utils/capitalizeSentence";
19
+ export { default as scrollToSection } from "./lib/utils/scrollToSection";
18
20
  export { cn } from "./lib/utils/cn";
19
21
  export { default as Copy } from "./lib/utils/Copy";
20
22
  export { default as Cookie } from "./lib/utils/Cookie";
package/dist/index.ts CHANGED
@@ -13,8 +13,16 @@ export { default as UserInfoComp } from "./components/user-info/UserInfoComp";
13
13
  export { default as ProjectSelector } from "./components/project-selector/ProjectSelector";
14
14
  export { default as InformationTooltip } from "./components/information-tooltip/InformationTooltip";
15
15
  export { default as CopyWrapper } from "./components/copy-wrapper/CopyWrapper";
16
- export { GetDate, GetTime, timeAgo, timeRemaining } from "./lib/utils/date";
16
+ export {
17
+ GetDate,
18
+ GetTime,
19
+ timeAgo,
20
+ timeRemaining,
21
+ getTimestamp,
22
+ } from "./lib/utils/date";
17
23
  export { default as capitalizeFirstLetter } from "./lib/utils/capitalizeFirstLetter";
24
+ export { default as capitalizeSentence } from "./lib/utils/capitalizeSentence";
25
+ export { default as scrollToSection } from "./lib/utils/scrollToSection";
18
26
  export { cn } from "./lib/utils/cn";
19
27
  export { default as Copy } from "./lib/utils/Copy";
20
28
  export { default as Cookie } from "./lib/utils/Cookie";
@@ -33,3 +41,13 @@ export {
33
41
  isDev,
34
42
  getMode,
35
43
  } from "./lib/utils/Env";
44
+ export type {
45
+ TInputChangeEvent,
46
+ TTextAreaChangeEvent,
47
+ TMouseEvent,
48
+ TFormEvent,
49
+ TKeyboardEvent,
50
+ TFocusEvent,
51
+ TDragEvent,
52
+ TState,
53
+ } from "./lib/types/GlobalType";
@@ -0,0 +1,2 @@
1
+ declare const capitalizeSentence: (sentence: string | null | undefined) => string;
2
+ export default capitalizeSentence;
@@ -0,0 +1,7 @@
1
+ const capitalizeSentence = (sentence) => {
2
+ return (sentence || "")
3
+ .split(" ")
4
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
5
+ .join(" ");
6
+ };
7
+ export default capitalizeSentence;
@@ -0,0 +1,11 @@
1
+ const capitalizeSentence = (sentence: string | null | undefined): string => {
2
+ return (sentence || "")
3
+ .split(" ")
4
+ .map(
5
+ (word: string) =>
6
+ word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
7
+ )
8
+ .join(" ");
9
+ };
10
+
11
+ export default capitalizeSentence;
@@ -2,3 +2,4 @@ export declare function GetDate(timeStamp: number | null | undefined, format?: s
2
2
  export declare function GetTime(timeStamp: number | null | undefined, format?: string): string | null;
3
3
  export declare const timeAgo: (timestamp: number) => string;
4
4
  export declare const timeRemaining: (timestamp: number) => string;
5
+ export declare const getTimestamp: () => number;
@@ -58,3 +58,8 @@ export const timeRemaining = (timestamp) => {
58
58
  return `${interval} minutes remaining`;
59
59
  return `${seconds} seconds remaining`;
60
60
  };
61
+ export const getTimestamp = () => {
62
+ let timeStamp = new Date().getTime();
63
+ timeStamp = Math.floor(timeStamp / 1000);
64
+ return timeStamp;
65
+ };
@@ -66,3 +66,9 @@ export const timeRemaining = (timestamp: number) => {
66
66
 
67
67
  return `${seconds} seconds remaining`;
68
68
  };
69
+
70
+ export const getTimestamp = (): number => {
71
+ let timeStamp = new Date().getTime();
72
+ timeStamp = Math.floor(timeStamp / 1000);
73
+ return timeStamp;
74
+ };
@@ -0,0 +1,2 @@
1
+ declare const scrollToSection: (id: string) => void;
2
+ export default scrollToSection;
@@ -0,0 +1,11 @@
1
+ const scrollToSection = (id) => {
2
+ const element = document.getElementById(id);
3
+ if (element) {
4
+ element.scrollIntoView({
5
+ block: "start",
6
+ behavior: "smooth",
7
+ });
8
+ window.location.hash = `#${id}`;
9
+ }
10
+ };
11
+ export default scrollToSection;
@@ -0,0 +1,12 @@
1
+ const scrollToSection = (id: string) => {
2
+ const element = document.getElementById(id);
3
+ if (element) {
4
+ element.scrollIntoView({
5
+ block: "start",
6
+ behavior: "smooth",
7
+ });
8
+ window.location.hash = `#${id}`;
9
+ }
10
+ };
11
+
12
+ export default scrollToSection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikiran/utils",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [