startx 0.1.5 → 0.2.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.
- package/.editorconfig +20 -20
- package/.github/workflows/publish.yml +48 -0
- package/LICENSE +21 -21
- package/configs/eslint-config/plugins.d.ts +1 -1
- package/configs/eslint-config/src/rules/no-argument-spread.ts +96 -96
- package/configs/eslint-config/src/rules/no-internal-package-import.ts +40 -40
- package/configs/eslint-config/src/rules/no-interpolation-in-regular-string.ts +32 -32
- package/configs/eslint-config/src/rules/no-skipped-tests.ts +61 -61
- package/configs/eslint-config/src/rules/no-top-level-relative-imports-in-backend-module.ts +27 -27
- package/configs/eslint-config/src/rules/no-type-unsafe-event-emitter.ts +33 -33
- package/configs/eslint-config/src/rules/no-uncaught-json-parse.test.ts +21 -21
- package/configs/eslint-config/src/rules/no-untyped-config-class-field.ts +26 -26
- package/configs/eslint-config/src/rules/no-unused-param-catch-clause.ts +33 -33
- package/configs/eslint-config/src/rules/no-useless-catch-throw.test.ts +34 -34
- package/configs/eslint-config/src/rules/no-useless-catch-throw.ts +47 -47
- package/configs/eslint-config/src/utils/json.ts +21 -21
- package/package.json +34 -35
- package/packages/@repo/constants/src/api.ts +1 -1
- package/packages/@repo/constants/src/time.ts +23 -23
- package/packages/@repo/db/src/schema/index.ts +1 -1
- package/packages/@repo/lib/src/error-handlers-module/index.ts +11 -11
- package/packages/cli/dist/index.mjs +2 -2
- package/packages/cli/tsdown.config.ts +1 -0
- package/packages/ui/src/components/custom/grid-component.tsx +23 -23
- package/packages/ui/src/components/custom/hover-tool.tsx +38 -38
- package/packages/ui/src/components/custom/image-picker.tsx +109 -109
- package/packages/ui/src/components/custom/no-content.tsx +37 -37
- package/packages/ui/src/components/custom/page-container.tsx +24 -24
- package/packages/ui/src/components/custom/simple-popover.tsx +29 -29
- package/packages/ui/src/components/custom/switch-component.tsx +20 -20
- package/packages/ui/src/components/custom/theme-provider.tsx +74 -74
- package/packages/ui/src/components/hooks/event/use-click.tsx +39 -39
- package/packages/ui/src/components/hooks/time/useDebounce.tsx +21 -21
- package/packages/ui/src/components/hooks/time/useInterval.tsx +35 -35
- package/packages/ui/src/components/hooks/time/useTimeout.tsx +19 -19
- package/packages/ui/src/components/hooks/time/useTimer.tsx +51 -51
- package/packages/ui/src/components/hooks/use-media-query.tsx +19 -19
- package/packages/ui/src/components/hooks/use-persistent-storage.tsx +52 -52
- package/packages/ui/src/components/hooks/use-window-dimension.tsx +30 -30
- package/packages/ui/src/components/sonner.tsx +1 -1
- package/packages/ui/src/components/ui/button.tsx +96 -96
- package/packages/ui/src/components/ui/dropdown-menu.tsx +226 -226
- package/packages/ui/src/components/ui/label.tsx +24 -24
- package/packages/ui/src/components/ui/popover.tsx +42 -42
- package/packages/ui/src/components/ui/select.tsx +170 -170
- package/packages/ui/src/components/ui/separator.tsx +28 -28
- package/packages/ui/src/components/ui/sheet.tsx +130 -130
- package/packages/ui/src/components/ui/skeleton.tsx +13 -13
- package/packages/ui/src/components/ui/spinner.tsx +16 -16
- package/packages/ui/src/components/ui/switch.tsx +28 -28
- package/packages/ui/src/components/ui/tabs.tsx +54 -54
- package/packages/ui/src/components/ui/tooltip.tsx +30 -30
- package/packages/ui/src/components/util/n-formattor.ts +22 -22
- package/packages/ui/src/components/util/storage.ts +37 -37
- package/packages/ui/src/globals.css +87 -87
- package/configs/vitest-config/dist/base.mjs +0 -1
- package/configs/vitest-config/dist/frontend.mjs +0 -1
- package/configs/vitest-config/dist/node.mjs +0 -1
- package/packages/@repo/redis/dist/index.d.mts +0 -3
- package/packages/@repo/redis/dist/index.mjs +0 -5
- package/packages/@repo/redis/dist/lib/redis-client.d.mts +0 -7
- package/packages/@repo/redis/dist/lib/redis-client.mjs +0 -25
- package/packages/@repo/redis/dist/lib/redis-client.mjs.map +0 -1
- package/packages/@repo/redis/dist/lib/redis-module.d.mts +0 -5
- package/packages/@repo/redis/dist/lib/redis-module.mjs +0 -6
- package/packages/@repo/redis/dist/lib/redis-module.mjs.map +0 -1
- /package/{apps/core-server/.env.example → .env.example} +0 -0
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useState, useEffect, type Dispatch, type SetStateAction } from 'react';
|
|
3
|
-
|
|
4
|
-
export function useLocalStorage<T>(key: string, initialValue: T): [T, Dispatch<SetStateAction<T>>] {
|
|
5
|
-
// Retrieve stored value from localStorage, or use initialValue if none is found
|
|
6
|
-
const getStoredValue = (): T => {
|
|
7
|
-
// if (typeof window === "undefined") return initialValue;
|
|
8
|
-
const storedValue = localStorage.getItem(key);
|
|
9
|
-
if (storedValue !== null) {
|
|
10
|
-
try {
|
|
11
|
-
return JSON.parse(storedValue) as T;
|
|
12
|
-
} catch (error) {
|
|
13
|
-
console.error('Error parsing stored value:', error);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return initialValue;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const [value, setValue] = useState<T>(getStoredValue);
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
localStorage.setItem(key, JSON.stringify(value));
|
|
23
|
-
}, [key, value]);
|
|
24
|
-
|
|
25
|
-
return [value, setValue];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function useSessionStorage<T>(
|
|
29
|
-
key: string,
|
|
30
|
-
initialValue: T,
|
|
31
|
-
): [T, Dispatch<SetStateAction<T>>] {
|
|
32
|
-
// Retrieve stored value from localStorage, or use initialValue if none is found
|
|
33
|
-
const getStoredValue = (): T => {
|
|
34
|
-
const storedValue = sessionStorage.getItem(key);
|
|
35
|
-
if (storedValue !== null) {
|
|
36
|
-
try {
|
|
37
|
-
return JSON.parse(storedValue) as T;
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.error('Error parsing stored value:', error);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return initialValue;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const [value, setValue] = useState<T>(getStoredValue);
|
|
46
|
-
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
sessionStorage.setItem(key, JSON.stringify(value));
|
|
49
|
-
}, [key, value]);
|
|
50
|
-
|
|
51
|
-
return [value, setValue];
|
|
52
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState, useEffect, type Dispatch, type SetStateAction } from 'react';
|
|
3
|
+
|
|
4
|
+
export function useLocalStorage<T>(key: string, initialValue: T): [T, Dispatch<SetStateAction<T>>] {
|
|
5
|
+
// Retrieve stored value from localStorage, or use initialValue if none is found
|
|
6
|
+
const getStoredValue = (): T => {
|
|
7
|
+
// if (typeof window === "undefined") return initialValue;
|
|
8
|
+
const storedValue = localStorage.getItem(key);
|
|
9
|
+
if (storedValue !== null) {
|
|
10
|
+
try {
|
|
11
|
+
return JSON.parse(storedValue) as T;
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error('Error parsing stored value:', error);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return initialValue;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const [value, setValue] = useState<T>(getStoredValue);
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
23
|
+
}, [key, value]);
|
|
24
|
+
|
|
25
|
+
return [value, setValue];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useSessionStorage<T>(
|
|
29
|
+
key: string,
|
|
30
|
+
initialValue: T,
|
|
31
|
+
): [T, Dispatch<SetStateAction<T>>] {
|
|
32
|
+
// Retrieve stored value from localStorage, or use initialValue if none is found
|
|
33
|
+
const getStoredValue = (): T => {
|
|
34
|
+
const storedValue = sessionStorage.getItem(key);
|
|
35
|
+
if (storedValue !== null) {
|
|
36
|
+
try {
|
|
37
|
+
return JSON.parse(storedValue) as T;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('Error parsing stored value:', error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return initialValue;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const [value, setValue] = useState<T>(getStoredValue);
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
sessionStorage.setItem(key, JSON.stringify(value));
|
|
49
|
+
}, [key, value]);
|
|
50
|
+
|
|
51
|
+
return [value, setValue];
|
|
52
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
type WindowDimensions = {
|
|
5
|
-
width: number | undefined;
|
|
6
|
-
height: number | undefined;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const useWindowDimensions = (): WindowDimensions => {
|
|
10
|
-
const win = typeof window !== 'undefined' ? window : undefined;
|
|
11
|
-
const [windowDimensions, setWindowDimensions] = useState<WindowDimensions>({
|
|
12
|
-
width: win && window?.innerWidth,
|
|
13
|
-
height: win && window?.innerHeight,
|
|
14
|
-
});
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
function handleResize(): void {
|
|
17
|
-
setWindowDimensions({
|
|
18
|
-
width: window?.innerWidth,
|
|
19
|
-
height: window?.innerHeight,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
handleResize();
|
|
23
|
-
window.addEventListener('resize', handleResize);
|
|
24
|
-
return (): void => window.removeEventListener('resize', handleResize);
|
|
25
|
-
}, []);
|
|
26
|
-
|
|
27
|
-
return windowDimensions;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export { useWindowDimensions };
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
type WindowDimensions = {
|
|
5
|
+
width: number | undefined;
|
|
6
|
+
height: number | undefined;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const useWindowDimensions = (): WindowDimensions => {
|
|
10
|
+
const win = typeof window !== 'undefined' ? window : undefined;
|
|
11
|
+
const [windowDimensions, setWindowDimensions] = useState<WindowDimensions>({
|
|
12
|
+
width: win && window?.innerWidth,
|
|
13
|
+
height: win && window?.innerHeight,
|
|
14
|
+
});
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
function handleResize(): void {
|
|
17
|
+
setWindowDimensions({
|
|
18
|
+
width: window?.innerWidth,
|
|
19
|
+
height: window?.innerHeight,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
handleResize();
|
|
23
|
+
window.addEventListener('resize', handleResize);
|
|
24
|
+
return (): void => window.removeEventListener('resize', handleResize);
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
return windowDimensions;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { useWindowDimensions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "sonner";
|
|
1
|
+
export * from "sonner";
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { RiLoader3Line } from "react-icons/ri";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../lib/utils";
|
|
7
|
-
|
|
8
|
-
const buttonVariants = cva(
|
|
9
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
10
|
-
{
|
|
11
|
-
variants: {
|
|
12
|
-
variant: {
|
|
13
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14
|
-
destructive:
|
|
15
|
-
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
16
|
-
outline:
|
|
17
|
-
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
18
|
-
secondary:
|
|
19
|
-
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
20
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
21
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
22
|
-
disabled: "text-gray-500 bg-gray-400 pointed-none",
|
|
23
|
-
minimal: "py-0 px-0 md:py-0 md:p-0 max-h-fit",
|
|
24
|
-
},
|
|
25
|
-
size: {
|
|
26
|
-
default: "h-10 px-4 py-2",
|
|
27
|
-
sm: "h-9 rounded-md px-3",
|
|
28
|
-
lg: "h-11 rounded-md px-8",
|
|
29
|
-
icon: "h-10 w-10",
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
defaultVariants: {
|
|
33
|
-
variant: "default",
|
|
34
|
-
size: "default",
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
export interface ButtonProps
|
|
40
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
41
|
-
VariantProps<typeof buttonVariants> {
|
|
42
|
-
asChild?: boolean;
|
|
43
|
-
loading?: boolean;
|
|
44
|
-
disabled?: boolean;
|
|
45
|
-
hideChild?: boolean;
|
|
46
|
-
icon?: React.ReactNode;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
50
|
-
(
|
|
51
|
-
{
|
|
52
|
-
className,
|
|
53
|
-
variant,
|
|
54
|
-
icon,
|
|
55
|
-
size,
|
|
56
|
-
disabled = false,
|
|
57
|
-
loading = false,
|
|
58
|
-
asChild = false,
|
|
59
|
-
hideChild = false,
|
|
60
|
-
...props
|
|
61
|
-
},
|
|
62
|
-
ref
|
|
63
|
-
) => {
|
|
64
|
-
const Comp = asChild ? Slot : "button";
|
|
65
|
-
return (
|
|
66
|
-
<Comp
|
|
67
|
-
ref={ref}
|
|
68
|
-
{...props}
|
|
69
|
-
disabled={disabled || loading}
|
|
70
|
-
className={`${cn(
|
|
71
|
-
"ease-in-out duration-75 active:scale-95",
|
|
72
|
-
buttonVariants({ variant, size, className }),
|
|
73
|
-
"transition-transform will-change-transform cursor-pointer"
|
|
74
|
-
)} `}
|
|
75
|
-
>
|
|
76
|
-
<RiLoader3Line
|
|
77
|
-
className={`${loading ? "size-6 animate-spin " : "hidden"} ${
|
|
78
|
-
!hideChild && "mr-2"
|
|
79
|
-
} transition-transform `}
|
|
80
|
-
/>
|
|
81
|
-
<span
|
|
82
|
-
className={cn(
|
|
83
|
-
(!icon || (hideChild && loading)) && "hidden",
|
|
84
|
-
props.children && "mr-2"
|
|
85
|
-
)}
|
|
86
|
-
>
|
|
87
|
-
{icon}
|
|
88
|
-
</span>
|
|
89
|
-
<>{hideChild ? !loading && props.children : props.children}</>
|
|
90
|
-
</Comp>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
Button.displayName = "Button";
|
|
95
|
-
|
|
96
|
-
export { Button, buttonVariants };
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { RiLoader3Line } from "react-icons/ri";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../lib/utils";
|
|
7
|
+
|
|
8
|
+
const buttonVariants = cva(
|
|
9
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
14
|
+
destructive:
|
|
15
|
+
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
16
|
+
outline:
|
|
17
|
+
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
18
|
+
secondary:
|
|
19
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
20
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
21
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
22
|
+
disabled: "text-gray-500 bg-gray-400 pointed-none",
|
|
23
|
+
minimal: "py-0 px-0 md:py-0 md:p-0 max-h-fit",
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
default: "h-10 px-4 py-2",
|
|
27
|
+
sm: "h-9 rounded-md px-3",
|
|
28
|
+
lg: "h-11 rounded-md px-8",
|
|
29
|
+
icon: "h-10 w-10",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: "default",
|
|
34
|
+
size: "default",
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export interface ButtonProps
|
|
40
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
41
|
+
VariantProps<typeof buttonVariants> {
|
|
42
|
+
asChild?: boolean;
|
|
43
|
+
loading?: boolean;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
hideChild?: boolean;
|
|
46
|
+
icon?: React.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
50
|
+
(
|
|
51
|
+
{
|
|
52
|
+
className,
|
|
53
|
+
variant,
|
|
54
|
+
icon,
|
|
55
|
+
size,
|
|
56
|
+
disabled = false,
|
|
57
|
+
loading = false,
|
|
58
|
+
asChild = false,
|
|
59
|
+
hideChild = false,
|
|
60
|
+
...props
|
|
61
|
+
},
|
|
62
|
+
ref
|
|
63
|
+
) => {
|
|
64
|
+
const Comp = asChild ? Slot : "button";
|
|
65
|
+
return (
|
|
66
|
+
<Comp
|
|
67
|
+
ref={ref}
|
|
68
|
+
{...props}
|
|
69
|
+
disabled={disabled || loading}
|
|
70
|
+
className={`${cn(
|
|
71
|
+
"ease-in-out duration-75 active:scale-95",
|
|
72
|
+
buttonVariants({ variant, size, className }),
|
|
73
|
+
"transition-transform will-change-transform cursor-pointer"
|
|
74
|
+
)} `}
|
|
75
|
+
>
|
|
76
|
+
<RiLoader3Line
|
|
77
|
+
className={`${loading ? "size-6 animate-spin " : "hidden"} ${
|
|
78
|
+
!hideChild && "mr-2"
|
|
79
|
+
} transition-transform `}
|
|
80
|
+
/>
|
|
81
|
+
<span
|
|
82
|
+
className={cn(
|
|
83
|
+
(!icon || (hideChild && loading)) && "hidden",
|
|
84
|
+
props.children && "mr-2"
|
|
85
|
+
)}
|
|
86
|
+
>
|
|
87
|
+
{icon}
|
|
88
|
+
</span>
|
|
89
|
+
<>{hideChild ? !loading && props.children : props.children}</>
|
|
90
|
+
</Comp>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
Button.displayName = "Button";
|
|
95
|
+
|
|
96
|
+
export { Button, buttonVariants };
|