startx 0.0.1 → 0.1.1

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.
Files changed (155) hide show
  1. package/.prettierignore +0 -13
  2. package/.prettierrc.js +52 -52
  3. package/.vscode/launch.json +32 -0
  4. package/.vscode/settings.json +9 -3
  5. package/apps/core-server/.env.example +18 -24
  6. package/apps/core-server/Dockerfile +35 -61
  7. package/apps/core-server/eslint.config.ts +7 -0
  8. package/apps/core-server/package.json +41 -52
  9. package/apps/core-server/src/config/custom-type.ts +2 -40
  10. package/apps/core-server/src/events/index.ts +37 -37
  11. package/apps/core-server/src/index.ts +4 -13
  12. package/apps/core-server/src/middlewares/auth-middleware.ts +24 -7
  13. package/apps/core-server/src/middlewares/cors-middleware.ts +7 -6
  14. package/apps/core-server/src/middlewares/error-middleware.ts +7 -4
  15. package/apps/core-server/src/middlewares/logger-middleware.ts +81 -21
  16. package/apps/core-server/src/middlewares/notfound-middleware.ts +6 -14
  17. package/apps/core-server/src/middlewares/serve-static.ts +30 -24
  18. package/apps/core-server/src/routes/files/router.ts +9 -7
  19. package/apps/core-server/src/routes/server.ts +30 -36
  20. package/apps/core-server/tsdown.config.ts +4 -3
  21. package/biome.json +58 -60
  22. package/configs/eslint-config/package.json +16 -19
  23. package/configs/eslint-config/src/configs/base.ts +185 -225
  24. package/configs/eslint-config/src/configs/extend.ts +3 -0
  25. package/configs/eslint-config/src/configs/frontend.ts +81 -56
  26. package/configs/eslint-config/src/configs/node.ts +6 -6
  27. package/configs/eslint-config/src/plugin.ts +1 -0
  28. package/configs/eslint-config/src/rules/index.ts +8 -12
  29. package/configs/eslint-config/src/rules/no-json-parse-json-stringify.test.ts +30 -17
  30. package/configs/eslint-config/src/rules/no-json-parse-json-stringify.ts +52 -49
  31. package/configs/eslint-config/src/rules/no-uncaught-json-parse.ts +43 -45
  32. package/configs/tsdown-config/package.json +10 -3
  33. package/configs/typescript-config/package.json +10 -1
  34. package/configs/typescript-config/tsconfig.common.json +3 -3
  35. package/configs/vitest-config/dist/base.mjs +1 -0
  36. package/configs/vitest-config/dist/frontend.mjs +1 -0
  37. package/configs/vitest-config/dist/node.mjs +1 -0
  38. package/configs/vitest-config/package.json +12 -0
  39. package/configs/vitest-config/src/base.ts +17 -29
  40. package/configs/vitest-config/src/index.ts +1 -0
  41. package/package.json +15 -26
  42. package/packages/@repo/constants/eslint.config.ts +4 -0
  43. package/packages/@repo/constants/package.json +16 -0
  44. package/packages/@repo/constants/src/index.ts +8 -8
  45. package/packages/@repo/db/eslint.config.ts +4 -0
  46. package/packages/@repo/db/package.json +16 -8
  47. package/packages/@repo/db/src/index.ts +26 -20
  48. package/packages/@repo/db/src/schema/common.ts +45 -49
  49. package/packages/@repo/env/eslint.config.ts +4 -0
  50. package/packages/@repo/env/package.json +39 -0
  51. package/packages/@repo/env/src/default-env.ts +12 -0
  52. package/packages/@repo/env/src/define-env.ts +70 -0
  53. package/packages/@repo/env/src/index.ts +2 -0
  54. package/packages/@repo/env/src/utils.ts +52 -0
  55. package/packages/@repo/env/tsconfig.json +7 -0
  56. package/packages/@repo/lib/eslint.config.ts +4 -0
  57. package/packages/@repo/lib/package.json +34 -34
  58. package/packages/@repo/lib/src/bucket-module/file-storage.ts +50 -49
  59. package/packages/@repo/lib/src/bucket-module/index.ts +3 -0
  60. package/packages/@repo/lib/src/bucket-module/s3-storage.ts +120 -114
  61. package/packages/@repo/lib/src/bucket-module/utils.ts +10 -11
  62. package/packages/@repo/lib/src/{cookie-module.ts → cookie-module/cookie-module.ts} +48 -42
  63. package/packages/@repo/lib/src/cookie-module/index.ts +1 -0
  64. package/packages/@repo/lib/src/extra/index.ts +1 -0
  65. package/packages/@repo/lib/src/extra/pagination-module.ts +35 -0
  66. package/packages/@repo/lib/src/{token-module.ts → extra/token-module.ts} +12 -5
  67. package/packages/@repo/lib/src/file-system-module/index.ts +170 -0
  68. package/packages/@repo/lib/src/{hashing-module.ts → hashing-module/index.ts} +9 -9
  69. package/packages/@repo/lib/src/index.ts +0 -26
  70. package/packages/@repo/lib/src/mail-module/index.ts +2 -0
  71. package/packages/@repo/lib/src/mail-module/mock.ts +8 -8
  72. package/packages/@repo/lib/src/mail-module/nodemailer.ts +17 -7
  73. package/packages/@repo/lib/src/notification-module/index.ts +1 -172
  74. package/packages/@repo/lib/src/notification-module/push-notification.ts +97 -90
  75. package/packages/@repo/lib/src/{oauth2-client.ts → oauth2-module/index.ts} +107 -109
  76. package/packages/@repo/lib/src/otp-module/index.ts +91 -0
  77. package/packages/@repo/lib/src/session-module/index.ts +113 -0
  78. package/packages/@repo/lib/src/utils.ts +43 -42
  79. package/packages/@repo/lib/src/validation-module/index.ts +242 -0
  80. package/packages/@repo/logger/eslint.config.ts +4 -0
  81. package/packages/@repo/logger/package.json +40 -0
  82. package/packages/@repo/logger/src/index.ts +2 -0
  83. package/packages/@repo/logger/src/logger.ts +72 -0
  84. package/packages/@repo/{lib/src/logger-module → logger/src}/memory-profiler.ts +64 -65
  85. package/packages/@repo/logger/tsconfig.json +7 -0
  86. package/packages/@repo/mail/eslint.config.ts +4 -0
  87. package/packages/@repo/mail/package.json +10 -3
  88. package/packages/@repo/mail/src/emails/admin/OtpEmail.tsx +169 -168
  89. package/packages/@repo/mail/src/index.ts +1 -2
  90. package/packages/@repo/mail/tsconfig.json +3 -3
  91. package/packages/@repo/redis/dist/index.d.mts +3 -0
  92. package/packages/@repo/redis/dist/index.mjs +5 -0
  93. package/packages/@repo/redis/dist/lib/redis-client.d.mts +7 -0
  94. package/packages/@repo/redis/dist/lib/redis-client.mjs +25 -0
  95. package/packages/@repo/redis/dist/lib/redis-client.mjs.map +1 -0
  96. package/packages/@repo/redis/dist/lib/redis-module.d.mts +5 -0
  97. package/packages/@repo/redis/dist/lib/redis-module.mjs +6 -0
  98. package/packages/@repo/redis/dist/lib/redis-module.mjs.map +1 -0
  99. package/packages/@repo/redis/eslint.config.ts +4 -0
  100. package/packages/@repo/redis/package.json +13 -10
  101. package/packages/@repo/redis/src/index.ts +2 -2
  102. package/packages/@repo/redis/src/lib/redis-client.ts +36 -23
  103. package/packages/@repo/redis/src/lib/redis-module.ts +69 -3
  104. package/packages/cli/dist/index.mjs +203 -0
  105. package/packages/cli/eslint.config.ts +4 -0
  106. package/packages/cli/package.json +44 -0
  107. package/packages/cli/tsconfig.json +12 -0
  108. package/packages/cli/tsdown.config.ts +17 -0
  109. package/packages/ui/components.json +0 -1
  110. package/packages/ui/eslint.config.ts +4 -0
  111. package/packages/ui/package.json +16 -3
  112. package/packages/ui/postcss.config.mjs +9 -9
  113. package/packages/ui/src/components/lib/utils.ts +53 -53
  114. package/packages/ui/src/components/ui/alert-dialog.tsx +118 -116
  115. package/packages/ui/src/components/ui/avatar.tsx +52 -53
  116. package/packages/ui/src/components/ui/badge.tsx +45 -46
  117. package/packages/ui/src/components/ui/breadcrumb.tsx +108 -109
  118. package/packages/ui/src/components/ui/card.tsx +91 -92
  119. package/packages/ui/src/components/ui/carousel.tsx +243 -243
  120. package/packages/ui/src/components/ui/checkbox.tsx +32 -32
  121. package/packages/ui/src/components/ui/command.tsx +144 -155
  122. package/packages/ui/src/components/ui/dialog.tsx +124 -127
  123. package/packages/ui/src/components/ui/form.tsx +166 -165
  124. package/packages/ui/src/components/ui/input-otp.tsx +74 -76
  125. package/packages/ui/src/components/ui/input.tsx +19 -21
  126. package/packages/ui/src/components/ui/multiple-select.tsx +4 -4
  127. package/packages/ui/src/{components/lucide.tsx → lucide.ts} +3 -3
  128. package/packages/ui/tailwind.config.ts +94 -94
  129. package/packages/ui/tsconfig.json +7 -1
  130. package/pnpm-workspace.yaml +41 -1
  131. package/startx.json +22 -0
  132. package/turbo.json +20 -27
  133. package/apps/core-server/eslint.config.mjs +0 -47
  134. package/configs/eslint-config/src/rules/no-dynamic-import-template.ts +0 -32
  135. package/configs/eslint-config/src/rules/no-plain-errors.ts +0 -50
  136. package/configs/eslint-config/tsdown.config.ts +0 -11
  137. package/packages/@repo/constants/eslint.config.mjs +0 -21
  138. package/packages/@repo/db/eslint.config.mjs +0 -21
  139. package/packages/@repo/lib/eslint.config.mjs +0 -49
  140. package/packages/@repo/lib/src/command-module.ts +0 -77
  141. package/packages/@repo/lib/src/constants.ts +0 -3
  142. package/packages/@repo/lib/src/custom-type.ts +0 -54
  143. package/packages/@repo/lib/src/env.ts +0 -13
  144. package/packages/@repo/lib/src/file-system/index.ts +0 -90
  145. package/packages/@repo/lib/src/logger-module/log-config.ts +0 -16
  146. package/packages/@repo/lib/src/logger-module/logger.ts +0 -78
  147. package/packages/@repo/lib/src/mail-module/api.ts +0 -0
  148. package/packages/@repo/lib/src/otp-module.ts +0 -98
  149. package/packages/@repo/lib/src/pagination-module.ts +0 -49
  150. package/packages/@repo/lib/src/user-session.ts +0 -117
  151. package/packages/@repo/lib/src/validation-module.ts +0 -187
  152. package/packages/@repo/mail/tsconfig.build.json +0 -14
  153. package/packages/@repo/mail/tsdown.config.ts +0 -9
  154. package/packages/@repo/redis/eslint.config.mjs +0 -8
  155. package/packages/ui/eslint.config.mjs +0 -18
@@ -0,0 +1,4 @@
1
+ import { baseConfig } from "eslint-config/base";
2
+ import { extend } from "eslint-config/extend";
3
+
4
+ export default extend(baseConfig, {});
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "cli",
3
+ "version": "1.0.0",
4
+ "description": "Cli powered by Commander.js",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "build": "tsdown --config-loader unrun",
10
+ "dev": "cross-env STARTX_ENV=development tsx src/index.ts"
11
+ },
12
+ "keywords": [],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "devDependencies": {
16
+ "cross-env": "^10.1.0",
17
+ "eslint-config": "workspace:*",
18
+ "tsdown-config": "workspace:*",
19
+ "typescript-config": "workspace:*",
20
+ "vitest-config": "workspace:*"
21
+ },
22
+ "dependencies": {
23
+ "@inquirer/prompts": "^8.3.0",
24
+ "@repo/lib": "workspace:*",
25
+ "@repo/logger": "workspace:*",
26
+ "@repo/env": "workspace:*",
27
+ "chokidar": "^4.0.3",
28
+ "commander": "^14.0.0",
29
+ "type-fest": "^5.4.4"
30
+ },
31
+ "startx": {
32
+ "tags": [
33
+ "node"
34
+ ],
35
+ "requiredDeps": [
36
+ "@repo/env",
37
+ "@repo/lib",
38
+ "@repo/logger"
39
+ ],
40
+ "requiredDevDeps": [
41
+ "typescript-config"
42
+ ]
43
+ }
44
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "typescript-config/tsconfig.node.json",
3
+ "compilerOptions": {
4
+ // "baseUrl": "./src",
5
+ "moduleResolution": "bundler",
6
+ "module": "esnext",
7
+ "target": "es2022",
8
+ "resolveJsonModule": true
9
+ },
10
+
11
+ "include": ["src/**/*.ts"]
12
+ }
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from "tsdown";
2
+ import { baseConfig } from "tsdown-config";
3
+
4
+ export default defineConfig({
5
+ ...baseConfig,
6
+ platform: "node",
7
+ external: ["sharp"],
8
+ noExternal: [/(.*)/],
9
+ outputOptions: {
10
+ codeSplitting: false,
11
+ preserveModules: false,
12
+ legalComments: "none",
13
+ },
14
+ define: {
15
+ "process.env.NODE_ENV": JSON.stringify("production"),
16
+ },
17
+ });
@@ -11,7 +11,6 @@
11
11
  },
12
12
  "aliases": {
13
13
  "components": "@/components",
14
-
15
14
  "utils": "@/lib/utils"
16
15
  }
17
16
  }
@@ -0,0 +1,4 @@
1
+ import { extend } from "eslint-config/extend";
2
+ import { frontendConfig } from "eslint-config/frontend";
3
+
4
+ export default extend(frontendConfig);
@@ -2,6 +2,7 @@
2
2
  "name": "@repo/ui",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
+ "type": "module",
5
6
  "scripts": {
6
7
  "clean": "rimraf dist .turbo",
7
8
  "watch:dev": "pnpm watch",
@@ -55,13 +56,25 @@
55
56
  "react-icons": "^5.5.0",
56
57
  "sonner": "^1.7.0",
57
58
  "tailwind-merge": "^2.3.0",
58
- "tailwindcss-animate": "^1.0.7",
59
- "zod": "^3.23.8"
59
+ "tailwindcss-animate": "^1.0.7"
60
60
  },
61
61
  "exports": {
62
62
  "./globals.css": "./src/globals.css",
63
63
  "./postcss.config": "./postcss.config.mjs",
64
+ "./lucide": "./src/lucide.ts",
64
65
  "./tailwind.config": "./tailwind.config.ts",
65
- "./components/*": "./src/components/*"
66
+ "./*/*": "./src/components/*/*"
67
+ },
68
+ "startx": {
69
+ "tags": [
70
+ "react",
71
+ "frontend"
72
+ ],
73
+ "requiredDevDeps": [
74
+ "typescript-config"
75
+ ],
76
+ "ignore": [
77
+ "vitest-config"
78
+ ]
66
79
  }
67
80
  }
@@ -1,9 +1,9 @@
1
- /** @type {import('postcss-load-config').Config} */
2
- const config = {
3
- plugins: {
4
- "@tailwindcss/postcss": {},
5
- autoprefixer: {},
6
- },
7
- };
8
-
9
- export default config;
1
+ /** @type {import('postcss-load-config').Config} */
2
+ const config = {
3
+ plugins: {
4
+ "@tailwindcss/postcss": {},
5
+ autoprefixer: {},
6
+ },
7
+ };
8
+
9
+ export default config;
@@ -1,18 +1,18 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { type ClassValue, clsx } from 'clsx';
2
+ import { type ClassValue, clsx } from "clsx";
3
3
  import {
4
+ differenceInDays,
5
+ differenceInYears,
4
6
  format,
7
+ formatDistance,
8
+ isThisWeek,
5
9
  isToday,
6
10
  isYesterday,
7
- isThisWeek,
8
- differenceInDays,
9
- formatDistance,
10
11
  parseISO,
11
- differenceInYears,
12
- } from 'date-fns';
13
- import { twMerge } from 'tailwind-merge';
12
+ } from "date-fns";
13
+ import { twMerge } from "tailwind-merge";
14
14
 
15
- import type { Store } from '../util/storage';
15
+ import type { Store } from "../util/storage";
16
16
 
17
17
  export function cn(...inputs: ClassValue[]) {
18
18
  return twMerge(clsx(inputs));
@@ -42,29 +42,29 @@ export function getFormData(object: {
42
42
  }
43
43
 
44
44
  export function switchPath(pathname: string, tab: string) {
45
- const fragments = pathname.split('/').filter((str) => str);
45
+ const fragments = pathname.split("/").filter(str => str);
46
46
  fragments[2] = tab;
47
- const path = `/${fragments.join('/')}`;
47
+ const path = `/${fragments.join("/")}`;
48
48
  return path;
49
49
  }
50
50
 
51
51
  export function getRelativeDate(date?: string | Date) {
52
52
  const now = new Date();
53
- if (!date) return '';
53
+ if (!date) return "";
54
54
  if (isToday(date)) {
55
- return format(date, 'h:mm a');
55
+ return format(date, "h:mm a");
56
56
  } else if (isYesterday(date)) {
57
- return 'yesterday';
57
+ return "yesterday";
58
58
  } else if (isThisWeek(date) && differenceInDays(now, date) <= 7) {
59
- return format(date, 'EEEE'); // EEEE gives the full name of the day like Sunday, Monday
59
+ return format(date, "EEEE"); // EEEE gives the full name of the day like Sunday, Monday
60
60
  } else {
61
- return format(date, 'dd/MM/yy');
61
+ return format(date, "dd/MM/yy");
62
62
  }
63
63
  }
64
64
 
65
65
  export function getRelativeDateWithTime(date?: string | Date) {
66
66
  const now = new Date();
67
- if (!date) return '';
67
+ if (!date) return "";
68
68
  return formatDistance(new Date(date), now, { addSuffix: true });
69
69
  }
70
70
 
@@ -73,12 +73,12 @@ export function getRelativeProDate(dateString: string) {
73
73
  const date = parseISO(dateString);
74
74
  const now = new Date();
75
75
  const yearsDifference = differenceInYears(now, date);
76
- const dateFormat = yearsDifference >= 1 ? 'dd MMM yyyy, h:mm a' : 'dd MMM, h:mm a';
76
+ const dateFormat = yearsDifference >= 1 ? "dd MMM yyyy, h:mm a" : "dd MMM, h:mm a";
77
77
  const formattedDate = format(date, dateFormat);
78
78
  return formattedDate;
79
79
  } catch (error) {
80
- console.error('Error formatting date:', error);
81
- return '';
80
+ console.error("Error formatting date:", error);
81
+ return "";
82
82
  }
83
83
  }
84
84
  export function isValidId(str: string) {
@@ -88,54 +88,54 @@ export function isValidId(str: string) {
88
88
 
89
89
  export function getRelativeDateOnly(date?: string | Date) {
90
90
  const now = new Date();
91
- if (!date) return '';
91
+ if (!date) return "";
92
92
  if (isToday(date)) {
93
- return 'today';
93
+ return "today";
94
94
  } else if (isYesterday(date)) {
95
- return 'yesterday';
95
+ return "yesterday";
96
96
  } else if (isThisWeek(date) && differenceInDays(now, date) <= 7) {
97
- return format(date, 'EEEE'); // EEEE gives the full name of the day like Sunday, Monday
97
+ return format(date, "EEEE"); // EEEE gives the full name of the day like Sunday, Monday
98
98
  } else {
99
- return format(date, 'dd/MM/yy');
99
+ return format(date, "dd/MM/yy");
100
100
  }
101
101
  }
102
102
  export type SocialMediaUrlMetaData = {
103
- platform: 'youtube' | 'x' | 'instagram';
103
+ platform: "youtube" | "x" | "instagram";
104
104
  url: string;
105
105
  contentId: string;
106
106
  };
107
107
  export function getUrlMetaData(urlString: string): SocialMediaUrlMetaData | null {
108
108
  const url = new URL(urlString);
109
109
  let contentId: string;
110
- let platform: 'youtube' | 'x' | 'instagram';
110
+ let platform: "youtube" | "x" | "instagram";
111
111
  switch (url.origin) {
112
- case 'https://youtu.be':
113
- platform = 'youtube';
114
- contentId = url.pathname.replace('/', '');
112
+ case "https://youtu.be":
113
+ platform = "youtube";
114
+ contentId = url.pathname.replace("/", "");
115
115
  break;
116
- case 'https://www.youtube.com':
117
- platform = 'youtube';
118
- contentId = url.searchParams.get('v') as string;
116
+ case "https://www.youtube.com":
117
+ platform = "youtube";
118
+ contentId = url.searchParams.get("v") as string;
119
119
  break;
120
- case 'https://x.com':
121
- platform = 'x';
120
+ case "https://x.com":
121
+ platform = "x";
122
122
  contentId = url.pathname
123
- .split('/')
124
- .filter((str) => str)
123
+ .split("/")
124
+ .filter(str => str)
125
125
  .at(-1) as string;
126
126
  break;
127
- case 'https://www.instagram.com':
128
- platform = 'instagram';
127
+ case "https://www.instagram.com":
128
+ platform = "instagram";
129
129
  contentId = url.pathname
130
- .split('/')
131
- .filter((str) => str)
130
+ .split("/")
131
+ .filter(str => str)
132
132
  .at(-1) as string;
133
133
  break;
134
- case 'https://instagram.com':
135
- platform = 'instagram';
134
+ case "https://instagram.com":
135
+ platform = "instagram";
136
136
  contentId = url.pathname
137
- .split('/')
138
- .filter((str) => str)
137
+ .split("/")
138
+ .filter(str => str)
139
139
  .at(-1) as string;
140
140
  break;
141
141
  default:
@@ -188,7 +188,7 @@ export function memoizeAsync<T extends (...args: any[]) => Promise<any>>(fn: T):
188
188
  }
189
189
  export function memoizePersistentAsync<T extends (...args: any[]) => Promise<any>>(
190
190
  fn: T,
191
- store: Store,
191
+ store: Store
192
192
  ): T {
193
193
  return (async (...args: Parameters<T>): Promise<ReturnType<T>> => {
194
194
  const key = JSON.stringify(args);
@@ -197,7 +197,7 @@ export function memoizePersistentAsync<T extends (...args: any[]) => Promise<any
197
197
  try {
198
198
  return JSON.parse(cachedValue);
199
199
  } catch (error) {
200
- console.error('Error parsing cached value:', error);
200
+ console.error("Error parsing cached value:", error);
201
201
  return await fn(...args);
202
202
  }
203
203
  } else {
@@ -209,8 +209,8 @@ export function memoizePersistentAsync<T extends (...args: any[]) => Promise<any
209
209
  }
210
210
 
211
211
  export function formatNumberWithKMB(num: number): string {
212
- const formatter = new Intl.NumberFormat('en-US', {
213
- notation: 'compact',
212
+ const formatter = new Intl.NumberFormat("en-US", {
213
+ notation: "compact",
214
214
  minimumSignificantDigits: 1,
215
215
  maximumSignificantDigits: 3,
216
216
  });
@@ -219,14 +219,14 @@ export function formatNumberWithKMB(num: number): string {
219
219
  }
220
220
  export function currencyToNumber(formattedCurrency: string): number {
221
221
  // Remove everything except digits, minus sign, and decimal point
222
- const numericString = formattedCurrency.replace(/[^0-9.-]+/g, '');
222
+ const numericString = formattedCurrency.replace(/[^0-9.-]+/g, "");
223
223
 
224
224
  // Convert the string back to a number
225
225
  const parsedNumber = Number.parseFloat(numericString);
226
226
 
227
227
  // Handle potential NaN if parsing fails
228
228
  if (isNaN(parsedNumber)) {
229
- throw new Error('Invalid currency format');
229
+ throw new Error("Invalid currency format");
230
230
  }
231
231
 
232
232
  return parsedNumber;
@@ -234,9 +234,9 @@ export function currencyToNumber(formattedCurrency: string): number {
234
234
 
235
235
  export function createLabels(e: string) {
236
236
  return e
237
- .replaceAll('_', ' ')
238
- .replace(/\b\w/g, (char) => char.toUpperCase())
237
+ .replaceAll("_", " ")
238
+ .replace(/\b\w/g, char => char.toUpperCase())
239
239
  .trim();
240
240
  }
241
241
 
242
- export { cva, type VariantProps } from 'class-variance-authority';
242
+ export { cva, type VariantProps } from "class-variance-authority";
@@ -1,116 +1,118 @@
1
- "use client";
2
-
3
- import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
4
- import * as React from "react";
5
- import { buttonVariants } from "@/components/ui/button";
6
- import { cn } from "../lib/utils";
7
-
8
- const AlertDialog = AlertDialogPrimitive.Root;
9
-
10
- const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
11
-
12
- const AlertDialogPortal = AlertDialogPrimitive.Portal;
13
-
14
- const AlertDialogOverlay = React.forwardRef<
15
- React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
16
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
17
- >(({ className, ...props }, ref) => (
18
- <AlertDialogPrimitive.Overlay
19
- className={cn(
20
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
21
- className
22
- )}
23
- {...props}
24
- ref={ref}
25
- />
26
- ));
27
- AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
28
-
29
- const AlertDialogContent = React.forwardRef<
30
- React.ElementRef<typeof AlertDialogPrimitive.Content>,
31
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
32
- >(({ className, ...props }, ref) => (
33
- <AlertDialogPortal>
34
- <AlertDialogOverlay />
35
- <AlertDialogPrimitive.Content
36
- ref={ref}
37
- className={cn(
38
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
39
- className
40
- )}
41
- {...props}
42
- />
43
- </AlertDialogPortal>
44
- ));
45
- AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
46
-
47
- const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
48
- <div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
49
- );
50
- AlertDialogHeader.displayName = "AlertDialogHeader";
51
-
52
- const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
53
- <div
54
- className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
55
- {...props}
56
- />
57
- );
58
- AlertDialogFooter.displayName = "AlertDialogFooter";
59
-
60
- const AlertDialogTitle = React.forwardRef<
61
- React.ElementRef<typeof AlertDialogPrimitive.Title>,
62
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
63
- >(({ className, ...props }, ref) => (
64
- <AlertDialogPrimitive.Title
65
- ref={ref}
66
- className={cn("text-lg font-semibold", className)}
67
- {...props}
68
- />
69
- ));
70
- AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
71
-
72
- const AlertDialogDescription = React.forwardRef<
73
- React.ElementRef<typeof AlertDialogPrimitive.Description>,
74
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
75
- >(({ className, ...props }, ref) => (
76
- <AlertDialogPrimitive.Description
77
- ref={ref}
78
- className={cn("text-sm text-muted-foreground", className)}
79
- {...props}
80
- />
81
- ));
82
- AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
83
-
84
- const AlertDialogAction = React.forwardRef<
85
- React.ElementRef<typeof AlertDialogPrimitive.Action>,
86
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
87
- >(({ className, ...props }, ref) => (
88
- <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
89
- ));
90
- AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
91
-
92
- const AlertDialogCancel = React.forwardRef<
93
- React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
94
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
95
- >(({ className, ...props }, ref) => (
96
- <AlertDialogPrimitive.Cancel
97
- ref={ref}
98
- className={cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className)}
99
- {...props}
100
- />
101
- ));
102
- AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
103
-
104
- export {
105
- AlertDialog,
106
- AlertDialogPortal,
107
- AlertDialogOverlay,
108
- AlertDialogTrigger,
109
- AlertDialogContent,
110
- AlertDialogHeader,
111
- AlertDialogFooter,
112
- AlertDialogTitle,
113
- AlertDialogDescription,
114
- AlertDialogAction,
115
- AlertDialogCancel,
116
- };
1
+ "use client";
2
+
3
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
4
+ import React from "react";
5
+
6
+ import { buttonVariants } from "@/components/ui/button";
7
+
8
+ import { cn } from "../lib/utils";
9
+
10
+ const AlertDialog = AlertDialogPrimitive.Root;
11
+
12
+ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
13
+
14
+ const AlertDialogPortal = AlertDialogPrimitive.Portal;
15
+
16
+ const AlertDialogOverlay = React.forwardRef<
17
+ React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
18
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
19
+ >(({ className, ...props }, ref) => (
20
+ <AlertDialogPrimitive.Overlay
21
+ className={cn(
22
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
23
+ className
24
+ )}
25
+ {...props}
26
+ ref={ref}
27
+ />
28
+ ));
29
+ AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
30
+
31
+ const AlertDialogContent = React.forwardRef<
32
+ React.ElementRef<typeof AlertDialogPrimitive.Content>,
33
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
34
+ >(({ className, ...props }, ref) => (
35
+ <AlertDialogPortal>
36
+ <AlertDialogOverlay />
37
+ <AlertDialogPrimitive.Content
38
+ ref={ref}
39
+ className={cn(
40
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
41
+ className
42
+ )}
43
+ {...props}
44
+ />
45
+ </AlertDialogPortal>
46
+ ));
47
+ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
48
+
49
+ const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
50
+ <div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
51
+ );
52
+ AlertDialogHeader.displayName = "AlertDialogHeader";
53
+
54
+ const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
55
+ <div
56
+ className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
57
+ {...props}
58
+ />
59
+ );
60
+ AlertDialogFooter.displayName = "AlertDialogFooter";
61
+
62
+ const AlertDialogTitle = React.forwardRef<
63
+ React.ElementRef<typeof AlertDialogPrimitive.Title>,
64
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
65
+ >(({ className, ...props }, ref) => (
66
+ <AlertDialogPrimitive.Title
67
+ ref={ref}
68
+ className={cn("text-lg font-semibold", className)}
69
+ {...props}
70
+ />
71
+ ));
72
+ AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
73
+
74
+ const AlertDialogDescription = React.forwardRef<
75
+ React.ElementRef<typeof AlertDialogPrimitive.Description>,
76
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
77
+ >(({ className, ...props }, ref) => (
78
+ <AlertDialogPrimitive.Description
79
+ ref={ref}
80
+ className={cn("text-sm text-muted-foreground", className)}
81
+ {...props}
82
+ />
83
+ ));
84
+ AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
85
+
86
+ const AlertDialogAction = React.forwardRef<
87
+ React.ElementRef<typeof AlertDialogPrimitive.Action>,
88
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
89
+ >(({ className, ...props }, ref) => (
90
+ <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
91
+ ));
92
+ AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
93
+
94
+ const AlertDialogCancel = React.forwardRef<
95
+ React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
96
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
97
+ >(({ className, ...props }, ref) => (
98
+ <AlertDialogPrimitive.Cancel
99
+ ref={ref}
100
+ className={cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className)}
101
+ {...props}
102
+ />
103
+ ));
104
+ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
105
+
106
+ export {
107
+ AlertDialog,
108
+ AlertDialogPortal,
109
+ AlertDialogOverlay,
110
+ AlertDialogTrigger,
111
+ AlertDialogContent,
112
+ AlertDialogHeader,
113
+ AlertDialogFooter,
114
+ AlertDialogTitle,
115
+ AlertDialogDescription,
116
+ AlertDialogAction,
117
+ AlertDialogCancel,
118
+ };