@atomazing-org/design-system 1.0.5 → 1.0.7
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/README.MD +191 -19
- package/dist/index.d.mts +297 -0
- package/dist/index.d.ts +297 -0
- package/dist/index.js +254 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +254 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +64 -40
- package/build/components/DialogBtn.d.ts +0 -5
- package/build/components/DialogBtn.js +0 -8
- package/build/components/ErrorBoundary.d.ts +0 -20
- package/build/components/ErrorBoundary.js +0 -75
- package/build/components/Loading.d.ts +0 -1
- package/build/components/Loading.js +0 -26
- package/build/components/PathName.d.ts +0 -4
- package/build/components/PathName.js +0 -8
- package/build/components/index.d.ts +0 -3
- package/build/components/index.js +0 -3
- package/build/styles/commonComponents.d.ts +0 -2
- package/build/styles/commonComponents.js +0 -69
- package/build/styles/index.d.ts +0 -3
- package/build/styles/index.js +0 -3
- package/build/styles/keyframes.d.ts +0 -10
- package/build/styles/keyframes.js +0 -108
- package/build/styles/typography.d.ts +0 -4
- package/build/styles/typography.js +0 -160
- package/build/utils/displayGreeting.d.ts +0 -5
- package/build/utils/displayGreeting.js +0 -19
- package/build/utils/getDayIdentifier.d.ts +0 -4
- package/build/utils/getDayIdentifier.js +0 -9
- package/build/utils/getSystemInfo.d.ts +0 -7
- package/build/utils/getSystemInfo.js +0 -26
- package/build/utils/index.d.ts +0 -5
- package/build/utils/index.js +0 -5
- package/build/utils/timeAgo.d.ts +0 -9
- package/build/utils/timeAgo.js +0 -56
- package/build/utils/useResponsiveDisplay.d.ts +0 -7
- package/build/utils/useResponsiveDisplay.js +0 -22
- package/index.d.ts +0 -187
- package/index.js +0 -26
package/build/utils/timeAgo.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a given date to a human-readable relative time string.
|
|
3
|
-
*
|
|
4
|
-
* @param {Date} date - The date to be converted.
|
|
5
|
-
* @param lang
|
|
6
|
-
* @returns {string} A string representing the relative time using `Intl` format (e.g., "2 days ago").
|
|
7
|
-
*/
|
|
8
|
-
export const timeAgo = (date, lang = navigator.language || 'en-US') => {
|
|
9
|
-
// Get the current date and time
|
|
10
|
-
const now = new Date();
|
|
11
|
-
date = new Date(date);
|
|
12
|
-
// Calculate the time difference in seconds
|
|
13
|
-
const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);
|
|
14
|
-
// Create an Intl.RelativeTimeFormat instance with the user's language
|
|
15
|
-
const rtf = new Intl.RelativeTimeFormat(lang, { numeric: 'auto' });
|
|
16
|
-
// Determine the appropriate unit and format the result
|
|
17
|
-
if (diffInSeconds < 60) {
|
|
18
|
-
return rtf.format(-diffInSeconds, 'second');
|
|
19
|
-
}
|
|
20
|
-
if (diffInSeconds < 3600) {
|
|
21
|
-
const minutes = Math.floor(diffInSeconds / 60);
|
|
22
|
-
return rtf.format(-minutes, 'minute');
|
|
23
|
-
}
|
|
24
|
-
if (diffInSeconds < 86_400) {
|
|
25
|
-
const hours = Math.floor(diffInSeconds / 3600);
|
|
26
|
-
return rtf.format(-hours, 'hour');
|
|
27
|
-
}
|
|
28
|
-
const days = Math.floor(diffInSeconds / 86_400);
|
|
29
|
-
return rtf.format(-days, 'day');
|
|
30
|
-
};
|
|
31
|
-
export const timeAgoFromStart = (date, lang = navigator.language || 'en-US') => {
|
|
32
|
-
const now = new Date();
|
|
33
|
-
date = new Date(date);
|
|
34
|
-
const difference = (date.getTime() - now.getTime()) / 1000;
|
|
35
|
-
const differenceHours = Math.floor(difference / (60 * 60));
|
|
36
|
-
const differenceMinutes = Math.floor((difference - 60 * 60 * differenceHours) / 60);
|
|
37
|
-
const diffInSeconds = Math.floor(difference - 60 * 60 * differenceHours - 60 * differenceMinutes);
|
|
38
|
-
const rtf = new Intl.RelativeTimeFormat(lang, { numeric: 'auto' });
|
|
39
|
-
if (differenceMinutes === 0 && diffInSeconds < 60) {
|
|
40
|
-
return rtf.format(diffInSeconds, 'second');
|
|
41
|
-
}
|
|
42
|
-
if (differenceHours === 0 && differenceMinutes < 60) {
|
|
43
|
-
return rtf.format(differenceMinutes, 'minute');
|
|
44
|
-
}
|
|
45
|
-
if (differenceHours < 24) {
|
|
46
|
-
const hours = `${new Intl.RelativeTimeFormat(lang, { numeric: 'auto' }).format(differenceHours, 'hour')}`;
|
|
47
|
-
const minutes = ` ${new Intl.RelativeTimeFormat(lang, {
|
|
48
|
-
localeMatcher: 'lookup',
|
|
49
|
-
numeric: 'always',
|
|
50
|
-
style: 'long',
|
|
51
|
-
}).format(differenceMinutes, 'minute')}`.replace(/^\D+/, '');
|
|
52
|
-
return `${hours} ${minutes}`;
|
|
53
|
-
}
|
|
54
|
-
const days = Math.floor(diffInSeconds / 86_400);
|
|
55
|
-
return rtf.format(days, 'day');
|
|
56
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A custom React hook to determine if the current device is a smaller device
|
|
3
|
-
* based on the screen width.
|
|
4
|
-
* @param [breakpoint=768] - The breakpoint in pixels at which a device is considered "smaller".
|
|
5
|
-
* @returns {boolean} - A boolean value indicating whether the current device is a smaller device.
|
|
6
|
-
*/
|
|
7
|
-
export declare const useResponsiveDisplay: (breakpoint?: number) => boolean;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* A custom React hook to determine if the current device is a smaller device
|
|
4
|
-
* based on the screen width.
|
|
5
|
-
* @param [breakpoint=768] - The breakpoint in pixels at which a device is considered "smaller".
|
|
6
|
-
* @returns {boolean} - A boolean value indicating whether the current device is a smaller device.
|
|
7
|
-
*/
|
|
8
|
-
export const useResponsiveDisplay = (breakpoint = 768) => {
|
|
9
|
-
const [isSmallerDevice, setIsSmallerDevice] = useState(false);
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
const checkScreenSize = () => {
|
|
12
|
-
setIsSmallerDevice(window.innerWidth < breakpoint);
|
|
13
|
-
};
|
|
14
|
-
checkScreenSize();
|
|
15
|
-
const handleResize = () => checkScreenSize();
|
|
16
|
-
window.addEventListener("resize", handleResize);
|
|
17
|
-
return () => {
|
|
18
|
-
window.removeEventListener("resize", handleResize);
|
|
19
|
-
};
|
|
20
|
-
}, [breakpoint]);
|
|
21
|
-
return isSmallerDevice;
|
|
22
|
-
};
|
package/index.d.ts
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
systemInfo,
|
|
3
|
-
timeAgo,
|
|
4
|
-
timeAgoFromStart,
|
|
5
|
-
displayGreeting,
|
|
6
|
-
getDayIdentifier,
|
|
7
|
-
useResponsiveDisplay,
|
|
8
|
-
} from "./build/utils";
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
fadeIn,
|
|
12
|
-
fadeInLeft,
|
|
13
|
-
pulseAnimation,
|
|
14
|
-
ring,
|
|
15
|
-
rotate,
|
|
16
|
-
rotateSlideBarIcons,
|
|
17
|
-
scale,
|
|
18
|
-
slideIn,
|
|
19
|
-
slideInBottom,
|
|
20
|
-
typographyProps,
|
|
21
|
-
typographyVariants,
|
|
22
|
-
zoomIn,
|
|
23
|
-
commonComponentProps,
|
|
24
|
-
} from "./build/styles";
|
|
25
|
-
|
|
26
|
-
export { DialogBtn, Loading, PathName } from "./build/components";
|
|
27
|
-
|
|
28
|
-
import "@emotion/react";
|
|
29
|
-
import "@mui/material/styles";
|
|
30
|
-
import "@mui/material/Typography";
|
|
31
|
-
import "react";
|
|
32
|
-
|
|
33
|
-
declare module "@emotion/react" {
|
|
34
|
-
export interface Theme {
|
|
35
|
-
/**
|
|
36
|
-
* Emotion Primary color
|
|
37
|
-
*/
|
|
38
|
-
primary: string;
|
|
39
|
-
/**
|
|
40
|
-
* Emotion Background color
|
|
41
|
-
*/
|
|
42
|
-
secondary: string;
|
|
43
|
-
/**
|
|
44
|
-
* Emotion darkmode
|
|
45
|
-
*/
|
|
46
|
-
darkmode: boolean;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/// <reference types="@mui/types" />
|
|
51
|
-
declare module "@mui/material/styles" {
|
|
52
|
-
export interface TypographyVariants {
|
|
53
|
-
text_xl_regular: React.CSSProperties;
|
|
54
|
-
text_lg_regular: React.CSSProperties;
|
|
55
|
-
text_md_regular: React.CSSProperties;
|
|
56
|
-
text_sm_regular: React.CSSProperties;
|
|
57
|
-
text_xs_regular: React.CSSProperties;
|
|
58
|
-
text_2xs_regular: React.CSSProperties;
|
|
59
|
-
|
|
60
|
-
text_xl_bold: React.CSSProperties;
|
|
61
|
-
text_lg_bold: React.CSSProperties;
|
|
62
|
-
text_md_bold: React.CSSProperties;
|
|
63
|
-
text_sm_bold: React.CSSProperties;
|
|
64
|
-
text_xs_bold: React.CSSProperties;
|
|
65
|
-
text_2xs_bold: React.CSSProperties;
|
|
66
|
-
|
|
67
|
-
text_xl_semibold: React.CSSProperties;
|
|
68
|
-
text_lg_semibold: React.CSSProperties;
|
|
69
|
-
text_md_semibold: React.CSSProperties;
|
|
70
|
-
text_sm_semibold: React.CSSProperties;
|
|
71
|
-
text_xs_semibold: React.CSSProperties;
|
|
72
|
-
text_2xs_semibold: React.CSSProperties;
|
|
73
|
-
|
|
74
|
-
text_xl_thin: React.CSSProperties;
|
|
75
|
-
text_lg_thin: React.CSSProperties;
|
|
76
|
-
text_md_thin: React.CSSProperties;
|
|
77
|
-
text_sm_thin: React.CSSProperties;
|
|
78
|
-
text_xs_thin: React.CSSProperties;
|
|
79
|
-
text_2xs_thin: React.CSSProperties;
|
|
80
|
-
|
|
81
|
-
display_2xl_regular: React.CSSProperties;
|
|
82
|
-
display_xl_regular: React.CSSProperties;
|
|
83
|
-
display_lg_regular: React.CSSProperties;
|
|
84
|
-
display_md_regular: React.CSSProperties;
|
|
85
|
-
display_sm_regular: React.CSSProperties;
|
|
86
|
-
display_xs_regular: React.CSSProperties;
|
|
87
|
-
|
|
88
|
-
display_2xl_bold: React.CSSProperties;
|
|
89
|
-
display_xl_bold: React.CSSProperties;
|
|
90
|
-
display_lg_bold: React.CSSProperties;
|
|
91
|
-
display_md_bold: React.CSSProperties;
|
|
92
|
-
display_sm_bold: React.CSSProperties;
|
|
93
|
-
display_xs_bold: React.CSSProperties;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// allow configuration using `createTheme()`
|
|
97
|
-
export interface TypographyVariantsOptions {
|
|
98
|
-
text_xl_regular?: React.CSSProperties;
|
|
99
|
-
text_lg_regular?: React.CSSProperties;
|
|
100
|
-
text_md_regular?: React.CSSProperties;
|
|
101
|
-
text_sm_regular?: React.CSSProperties;
|
|
102
|
-
text_xs_regular?: React.CSSProperties;
|
|
103
|
-
text_2xs_regular?: React.CSSProperties;
|
|
104
|
-
|
|
105
|
-
text_xl_bold?: React.CSSProperties;
|
|
106
|
-
text_lg_bold?: React.CSSProperties;
|
|
107
|
-
text_md_bold?: React.CSSProperties;
|
|
108
|
-
text_sm_bold?: React.CSSProperties;
|
|
109
|
-
text_xs_bold?: React.CSSProperties;
|
|
110
|
-
text_2xs_bold?: React.CSSProperties;
|
|
111
|
-
|
|
112
|
-
text_xl_semibold?: React.CSSProperties;
|
|
113
|
-
text_lg_semibold?: React.CSSProperties;
|
|
114
|
-
text_md_semibold?: React.CSSProperties;
|
|
115
|
-
text_sm_semibold?: React.CSSProperties;
|
|
116
|
-
text_xs_semibold?: React.CSSProperties;
|
|
117
|
-
text_2xs_semibold?: React.CSSProperties;
|
|
118
|
-
|
|
119
|
-
text_xl_thin?: React.CSSProperties;
|
|
120
|
-
text_lg_thin?: React.CSSProperties;
|
|
121
|
-
text_md_thin?: React.CSSProperties;
|
|
122
|
-
text_sm_thin?: React.CSSProperties;
|
|
123
|
-
text_xs_thin?: React.CSSProperties;
|
|
124
|
-
text_2xs_thin?: React.CSSProperties;
|
|
125
|
-
|
|
126
|
-
display_2xl_regular?: React.CSSProperties;
|
|
127
|
-
display_xl_regular?: React.CSSProperties;
|
|
128
|
-
display_lg_regular?: React.CSSProperties;
|
|
129
|
-
display_md_regular?: React.CSSProperties;
|
|
130
|
-
display_sm_regular?: React.CSSProperties;
|
|
131
|
-
display_xs_regular?: React.CSSProperties;
|
|
132
|
-
|
|
133
|
-
display_2xl_bold?: React.CSSProperties;
|
|
134
|
-
display_xl_bold?: React.CSSProperties;
|
|
135
|
-
display_lg_bold?: React.CSSProperties;
|
|
136
|
-
display_md_bold?: React.CSSProperties;
|
|
137
|
-
display_sm_bold?: React.CSSProperties;
|
|
138
|
-
display_xs_bold?: React.CSSProperties;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Update the Typography's variant prop options
|
|
143
|
-
declare module "@mui/material/Typography" {
|
|
144
|
-
export interface TypographyPropsVariantOverrides {
|
|
145
|
-
text_xl_regular: true;
|
|
146
|
-
text_lg_regular: true;
|
|
147
|
-
text_md_regular: true;
|
|
148
|
-
text_sm_regular: true;
|
|
149
|
-
text_xs_regular: true;
|
|
150
|
-
text_2xs_regular: true;
|
|
151
|
-
|
|
152
|
-
text_xl_bold: true;
|
|
153
|
-
text_lg_bold: true;
|
|
154
|
-
text_md_bold: true;
|
|
155
|
-
text_sm_bold: true;
|
|
156
|
-
text_xs_bold: true;
|
|
157
|
-
text_2xs_bold: true;
|
|
158
|
-
|
|
159
|
-
text_xl_semibold: true;
|
|
160
|
-
text_lg_semibold: true;
|
|
161
|
-
text_md_semibold: true;
|
|
162
|
-
text_sm_semibold: true;
|
|
163
|
-
text_xs_semibold: true;
|
|
164
|
-
text_2xs_semibold: true;
|
|
165
|
-
|
|
166
|
-
text_xl_thin: true;
|
|
167
|
-
text_lg_thin: true;
|
|
168
|
-
text_md_thin: true;
|
|
169
|
-
text_sm_thin: true;
|
|
170
|
-
text_xs_thin: true;
|
|
171
|
-
text_2xs_thin: true;
|
|
172
|
-
|
|
173
|
-
display_2xl_regular: true;
|
|
174
|
-
display_xl_regular: true;
|
|
175
|
-
display_lg_regular: true;
|
|
176
|
-
display_md_regular: true;
|
|
177
|
-
display_sm_regular: true;
|
|
178
|
-
display_xs_regular: true;
|
|
179
|
-
|
|
180
|
-
display_2xl_bold: true;
|
|
181
|
-
display_xl_bold: true;
|
|
182
|
-
display_lg_bold: true;
|
|
183
|
-
display_md_bold: true;
|
|
184
|
-
display_sm_bold: true;
|
|
185
|
-
display_xs_bold: true;
|
|
186
|
-
}
|
|
187
|
-
}
|
package/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
systemInfo,
|
|
3
|
-
timeAgo,
|
|
4
|
-
timeAgoFromStart,
|
|
5
|
-
displayGreeting,
|
|
6
|
-
getDayIdentifier,
|
|
7
|
-
useResponsiveDisplay,
|
|
8
|
-
} from "./build/utils";
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
fadeIn,
|
|
12
|
-
fadeInLeft,
|
|
13
|
-
pulseAnimation,
|
|
14
|
-
ring,
|
|
15
|
-
rotate,
|
|
16
|
-
rotateSlideBarIcons,
|
|
17
|
-
scale,
|
|
18
|
-
slideIn,
|
|
19
|
-
slideInBottom,
|
|
20
|
-
typographyProps,
|
|
21
|
-
typographyVariants,
|
|
22
|
-
zoomIn,
|
|
23
|
-
commonComponentProps,
|
|
24
|
-
} from "./build/styles";
|
|
25
|
-
|
|
26
|
-
export { DialogBtn, Loading, PathName } from "./build/components";
|