@sruim/nexus-design 0.0.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.
- package/README.md +195 -0
- package/dist/assets/grid.webp.js +3 -0
- package/dist/components/credits-button/index.d.ts +8 -0
- package/dist/components/credits-button/index.js +40 -0
- package/dist/components/icon/index.d.ts +7 -0
- package/dist/components/icon/index.js +32 -0
- package/dist/components/icon-button/index.d.ts +9 -0
- package/dist/components/icon-button/index.js +36 -0
- package/dist/components/img-uploader/index.d.ts +19 -0
- package/dist/components/img-uploader/index.js +107 -0
- package/dist/components/img-viewer/index.d.ts +16 -0
- package/dist/components/img-viewer/index.js +80 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/loadable/index.d.ts +8 -0
- package/dist/components/loadable/index.js +67 -0
- package/dist/components/loading/assets/loading.webp.js +3 -0
- package/dist/components/loading/index.d.ts +16 -0
- package/dist/components/loading/index.js +85 -0
- package/dist/components/model-uploader/index.d.ts +17 -0
- package/dist/components/model-uploader/index.js +93 -0
- package/dist/components/tree/index.d.ts +14 -0
- package/dist/components/tree/index.js +50 -0
- package/dist/components/tree/node.d.ts +23 -0
- package/dist/components/tree/node.js +185 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +43 -0
- package/dist/style.css +1193 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +96 -0
- package/dist/tokens/materials.d.ts +4 -0
- package/dist/tokens/materials.js +4 -0
- package/dist/tokens/nexus.d.ts +51 -0
- package/dist/tokens/nexus.js +42 -0
- package/dist/ui/avatar/index.d.ts +11 -0
- package/dist/ui/avatar/index.js +55 -0
- package/dist/ui/badge/index.d.ts +2 -0
- package/dist/ui/badge/index.js +45 -0
- package/dist/ui/button.d.ts +8 -0
- package/dist/ui/button.js +61 -0
- package/dist/ui/carousel/index.d.ts +43 -0
- package/dist/ui/carousel/index.js +186 -0
- package/dist/ui/checkbox/index.d.ts +4 -0
- package/dist/ui/checkbox/index.js +34 -0
- package/dist/ui/collapsible/index.d.ts +9 -0
- package/dist/ui/collapsible/index.js +7 -0
- package/dist/ui/dialog/confirm.d.ts +20 -0
- package/dist/ui/dialog/confirm.js +80 -0
- package/dist/ui/dialog/dialog.d.ts +26 -0
- package/dist/ui/dialog/dialog.js +97 -0
- package/dist/ui/dialog/index.d.ts +2 -0
- package/dist/ui/drawer.d.ts +22 -0
- package/dist/ui/drawer.js +98 -0
- package/dist/ui/form.d.ts +33 -0
- package/dist/ui/form.js +138 -0
- package/dist/ui/index.d.ts +24 -0
- package/dist/ui/input-otp.d.ts +14 -0
- package/dist/ui/input-otp.js +73 -0
- package/dist/ui/label.d.ts +4 -0
- package/dist/ui/label.js +32 -0
- package/dist/ui/masonry/index.d.ts +13 -0
- package/dist/ui/masonry/index.js +45 -0
- package/dist/ui/popover/index.d.ts +15 -0
- package/dist/ui/popover/index.js +78 -0
- package/dist/ui/progress.d.ts +6 -0
- package/dist/ui/progress.js +48 -0
- package/dist/ui/select/index.d.ts +21 -0
- package/dist/ui/select/index.js +127 -0
- package/dist/ui/slider/index.d.ts +9 -0
- package/dist/ui/slider/index.js +87 -0
- package/dist/ui/snap-input.d.ts +7 -0
- package/dist/ui/snap-input.js +38 -0
- package/dist/ui/sonner.d.ts +5 -0
- package/dist/ui/sonner.js +50 -0
- package/dist/ui/switch.d.ts +4 -0
- package/dist/ui/switch.js +33 -0
- package/dist/ui/table/index.d.ts +22 -0
- package/dist/ui/table/index.js +70 -0
- package/dist/ui/tabs/index.d.ts +12 -0
- package/dist/ui/tabs/index.js +60 -0
- package/dist/ui/toggle/index.d.ts +2 -0
- package/dist/ui/toggle/toggle-group.d.ts +9 -0
- package/dist/ui/toggle/toggle-group.js +54 -0
- package/dist/ui/toggle/toggle.d.ts +11 -0
- package/dist/ui/toggle/toggle.js +45 -0
- package/dist/ui/tooltip/index.d.ts +17 -0
- package/dist/ui/tooltip/index.js +68 -0
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/config.js +48 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/utils.d.ts +8 -0
- package/dist/utils/utils.js +91 -0
- package/package.json +148 -0
package/dist/theme.d.ts
ADDED
package/dist/theme.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { text, border, surface, status, core, mist, steel, obsidian } from './tokens/nexus.js';
|
|
2
|
+
|
|
3
|
+
const theme = {
|
|
4
|
+
colors: {
|
|
5
|
+
background: "rgba(0, 0, 0, 1)",
|
|
6
|
+
foreground: "rgba(255, 255, 255, 1)",
|
|
7
|
+
obsidian,
|
|
8
|
+
steel,
|
|
9
|
+
mist,
|
|
10
|
+
core,
|
|
11
|
+
status,
|
|
12
|
+
surface,
|
|
13
|
+
border,
|
|
14
|
+
text,
|
|
15
|
+
black: {
|
|
16
|
+
DEFAULT: "rgba(0, 0, 0, 1)",
|
|
17
|
+
0: "rgba(0, 0, 0, 0)",
|
|
18
|
+
5: "rgba(0, 0, 0, 0.05)",
|
|
19
|
+
10: "rgba(0, 0, 0, 0.1)",
|
|
20
|
+
20: "rgba(0, 0, 0, 0.2)",
|
|
21
|
+
30: "rgba(0, 0, 0, 0.3)",
|
|
22
|
+
40: "rgba(0, 0, 0, 0.4)",
|
|
23
|
+
60: "rgba(0, 0, 0, 0.6)",
|
|
24
|
+
80: "rgba(0, 0, 0, 0.8)"
|
|
25
|
+
},
|
|
26
|
+
white: {
|
|
27
|
+
DEFAULT: "rgba(255, 255, 255, 1)",
|
|
28
|
+
5: "rgba(255, 255, 255, 0.05)",
|
|
29
|
+
10: "rgba(255, 255, 255, 0.1)",
|
|
30
|
+
20: "rgba(255, 255, 255, 0.2)",
|
|
31
|
+
30: "rgba(255, 255, 255, 0.3)",
|
|
32
|
+
40: "rgba(255, 255, 255, 0.4)",
|
|
33
|
+
60: "rgba(255, 255, 255, 0.6)",
|
|
34
|
+
80: "rgba(255, 255, 255, 0.8)"
|
|
35
|
+
},
|
|
36
|
+
gray: {
|
|
37
|
+
1: "rgba(12, 13, 16, 1)",
|
|
38
|
+
2: "rgba(16, 17, 20, 1)",
|
|
39
|
+
3: "rgba(27, 29, 32, 1)",
|
|
40
|
+
50: "rgba(250, 250, 250, 1)",
|
|
41
|
+
100: "rgba(242, 242, 242, 1)",
|
|
42
|
+
200: "rgba(229, 229, 229, 1)",
|
|
43
|
+
300: "rgba(204, 204, 204, 1)",
|
|
44
|
+
400: "rgba(153, 153, 153, 1)",
|
|
45
|
+
500: "rgba(102, 102, 102, 1)",
|
|
46
|
+
600: "rgba(68, 68, 68, 1)",
|
|
47
|
+
700: "rgba(58, 58, 58, 1)",
|
|
48
|
+
800: "rgba(51, 51, 51, 1)",
|
|
49
|
+
900: "rgba(32, 32, 32, 1)",
|
|
50
|
+
950: "rgba(28, 28, 28, 1)"
|
|
51
|
+
},
|
|
52
|
+
purple: {
|
|
53
|
+
1: "rgba(80, 59, 227, 1)",
|
|
54
|
+
2: "rgba(167, 155, 236, 1)",
|
|
55
|
+
10: "rgba(80, 59, 227, 0.1)",
|
|
56
|
+
20: "rgba(80, 59, 227, 0.2)",
|
|
57
|
+
60: "rgba(80, 59, 227, 0.6)"
|
|
58
|
+
},
|
|
59
|
+
red: {
|
|
60
|
+
DEFAULT: "rgba(255, 62, 62, 1)",
|
|
61
|
+
15: "rgba(255, 62, 62, 0.15)"
|
|
62
|
+
},
|
|
63
|
+
blue: {
|
|
64
|
+
1: "rgba(89, 111, 255, 1)",
|
|
65
|
+
2: "rgba(28, 161, 241, 1)"
|
|
66
|
+
},
|
|
67
|
+
green: {
|
|
68
|
+
1: "rgba(63, 221, 120, 1)",
|
|
69
|
+
2: "rgba(18, 27, 25, 1)",
|
|
70
|
+
3: "rgba(23, 46, 35, 1)"
|
|
71
|
+
},
|
|
72
|
+
pink: {
|
|
73
|
+
1: "rgba(219, 181, 226, 1)",
|
|
74
|
+
2: "rgba(251, 35, 194, 1)"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
breakpoints: {
|
|
78
|
+
fhd: "1900px"
|
|
79
|
+
},
|
|
80
|
+
animation: {
|
|
81
|
+
keyframes: {
|
|
82
|
+
"scroll-loop": "{0% { transform: translateX(100%); } 100% { transform: translateX(-100%); }}"
|
|
83
|
+
},
|
|
84
|
+
durations: {
|
|
85
|
+
"scroll-loop": "10s"
|
|
86
|
+
},
|
|
87
|
+
counts: {
|
|
88
|
+
"scroll-loop": "infinite"
|
|
89
|
+
},
|
|
90
|
+
timingFns: {
|
|
91
|
+
"scroll-loop": "linear"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export { theme };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
declare const obsidian: {
|
|
2
|
+
readonly 100: "#020617";
|
|
3
|
+
readonly 200: "#0F172A";
|
|
4
|
+
readonly 300: "#1E293B";
|
|
5
|
+
};
|
|
6
|
+
declare const steel: {
|
|
7
|
+
readonly 100: "#CBD5E1";
|
|
8
|
+
readonly 200: "#E2E8F0";
|
|
9
|
+
readonly 300: "#F1F5F9";
|
|
10
|
+
};
|
|
11
|
+
declare const mist: {
|
|
12
|
+
readonly 100: "#E2E8F0";
|
|
13
|
+
readonly 200: "#F1F5F9";
|
|
14
|
+
readonly 300: "#FFFFFF";
|
|
15
|
+
};
|
|
16
|
+
declare const core: {
|
|
17
|
+
readonly blue: "#3B82F6";
|
|
18
|
+
};
|
|
19
|
+
declare const status: {
|
|
20
|
+
readonly error: "#F43F5E";
|
|
21
|
+
readonly success: "#10B981";
|
|
22
|
+
readonly warning: "#F59E0B";
|
|
23
|
+
};
|
|
24
|
+
declare const surface: {
|
|
25
|
+
readonly primary: "#020617";
|
|
26
|
+
readonly secondary: "#CBD5E1";
|
|
27
|
+
readonly dim: "#E2E8F0";
|
|
28
|
+
readonly hover: "#F1F5F9";
|
|
29
|
+
};
|
|
30
|
+
declare const border: {
|
|
31
|
+
readonly subtle: "#E2E8F0";
|
|
32
|
+
readonly dim: "#F1F5F9";
|
|
33
|
+
readonly focus: "#3B82F6";
|
|
34
|
+
};
|
|
35
|
+
declare const text: {
|
|
36
|
+
readonly primary: "#FFFFFF";
|
|
37
|
+
readonly secondary: "#CBD5E1";
|
|
38
|
+
readonly disabled: "#64748B";
|
|
39
|
+
readonly accent: "#3B82F6";
|
|
40
|
+
};
|
|
41
|
+
declare const easing: {
|
|
42
|
+
readonly smooth: "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
43
|
+
readonly spring: "cubic-bezier(0.34, 1.56, 0.64, 1)";
|
|
44
|
+
};
|
|
45
|
+
declare const duration: {
|
|
46
|
+
readonly fast: "150ms";
|
|
47
|
+
readonly base: "200ms";
|
|
48
|
+
readonly slow: "300ms";
|
|
49
|
+
readonly slower: "500ms";
|
|
50
|
+
};
|
|
51
|
+
export { border, core, duration, easing, mist, obsidian, status, steel, surface, text };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const obsidian = {
|
|
2
|
+
100: "#020617",
|
|
3
|
+
200: "#0F172A",
|
|
4
|
+
300: "#1E293B"
|
|
5
|
+
};
|
|
6
|
+
const steel = {
|
|
7
|
+
100: "#CBD5E1",
|
|
8
|
+
200: "#E2E8F0",
|
|
9
|
+
300: "#F1F5F9"
|
|
10
|
+
};
|
|
11
|
+
const mist = {
|
|
12
|
+
100: "#E2E8F0",
|
|
13
|
+
200: "#F1F5F9",
|
|
14
|
+
300: "#FFFFFF"
|
|
15
|
+
};
|
|
16
|
+
const core = {
|
|
17
|
+
blue: "#3B82F6"
|
|
18
|
+
};
|
|
19
|
+
const status = {
|
|
20
|
+
error: "#F43F5E",
|
|
21
|
+
success: "#10B981",
|
|
22
|
+
warning: "#F59E0B"
|
|
23
|
+
};
|
|
24
|
+
const surface = {
|
|
25
|
+
primary: obsidian[100],
|
|
26
|
+
secondary: steel[100],
|
|
27
|
+
dim: steel[200],
|
|
28
|
+
hover: steel[300]
|
|
29
|
+
};
|
|
30
|
+
const border = {
|
|
31
|
+
subtle: mist[100],
|
|
32
|
+
dim: steel[300],
|
|
33
|
+
focus: core.blue
|
|
34
|
+
};
|
|
35
|
+
const text = {
|
|
36
|
+
primary: "#FFFFFF",
|
|
37
|
+
secondary: "#CBD5E1",
|
|
38
|
+
disabled: "#64748B",
|
|
39
|
+
accent: core.blue
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { border, core, mist, obsidian, status, steel, surface, text };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
interface IAvatar extends React.ForwardRefExoticComponent<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLDivElement>> {
|
|
4
|
+
Image: typeof AvatarImage;
|
|
5
|
+
Fallback: typeof AvatarFallback;
|
|
6
|
+
Root: typeof Avatar;
|
|
7
|
+
}
|
|
8
|
+
declare const Avatar: IAvatar;
|
|
9
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
10
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
11
|
+
export { Avatar };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../utils/config.js';
|
|
3
|
+
import '@radix-ui/react-portal';
|
|
4
|
+
import '../button.js';
|
|
5
|
+
import '../carousel/index.js';
|
|
6
|
+
import '../checkbox/index.js';
|
|
7
|
+
import '../collapsible/index.js';
|
|
8
|
+
import '../dialog/confirm.js';
|
|
9
|
+
import '../dialog/dialog.js';
|
|
10
|
+
import '../drawer.js';
|
|
11
|
+
import '../form.js';
|
|
12
|
+
import '../input-otp.js';
|
|
13
|
+
import '../label.js';
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
import '../popover/index.js';
|
|
16
|
+
import '../progress.js';
|
|
17
|
+
import '../select/index.js';
|
|
18
|
+
import '../slider/index.js';
|
|
19
|
+
import '../sonner.js';
|
|
20
|
+
import '../switch.js';
|
|
21
|
+
import '../table/index.js';
|
|
22
|
+
import '../tabs/index.js';
|
|
23
|
+
import '../toggle/toggle.js';
|
|
24
|
+
import '../toggle/toggle-group.js';
|
|
25
|
+
import '../tooltip/index.js';
|
|
26
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
27
|
+
|
|
28
|
+
const Avatar = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
29
|
+
AvatarPrimitive.Root,
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
className: cn(
|
|
33
|
+
"relative flex items-center justify-center overflow-hidden rounded-full",
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
));
|
|
39
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
40
|
+
const AvatarImage = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
41
|
+
AvatarPrimitive.Image,
|
|
42
|
+
{
|
|
43
|
+
ref,
|
|
44
|
+
className: cn("aspect-square size-full", className),
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
));
|
|
48
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
49
|
+
const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, { ref, className: cn(className), ...props }));
|
|
50
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
51
|
+
Avatar.Root = Avatar;
|
|
52
|
+
Avatar.Image = AvatarImage;
|
|
53
|
+
Avatar.Fallback = AvatarFallback;
|
|
54
|
+
|
|
55
|
+
export { Avatar };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../utils/config.js';
|
|
3
|
+
import '@radix-ui/react-portal';
|
|
4
|
+
import '../avatar/index.js';
|
|
5
|
+
import '../button.js';
|
|
6
|
+
import '../carousel/index.js';
|
|
7
|
+
import '../checkbox/index.js';
|
|
8
|
+
import '../collapsible/index.js';
|
|
9
|
+
import '../dialog/confirm.js';
|
|
10
|
+
import '../dialog/dialog.js';
|
|
11
|
+
import '../drawer.js';
|
|
12
|
+
import '../form.js';
|
|
13
|
+
import '../input-otp.js';
|
|
14
|
+
import '../label.js';
|
|
15
|
+
import 'react';
|
|
16
|
+
import '../popover/index.js';
|
|
17
|
+
import '../progress.js';
|
|
18
|
+
import '../select/index.js';
|
|
19
|
+
import '../slider/index.js';
|
|
20
|
+
import '../sonner.js';
|
|
21
|
+
import '../switch.js';
|
|
22
|
+
import '../table/index.js';
|
|
23
|
+
import '../tabs/index.js';
|
|
24
|
+
import '../toggle/toggle.js';
|
|
25
|
+
import '../toggle/toggle-group.js';
|
|
26
|
+
import '../tooltip/index.js';
|
|
27
|
+
|
|
28
|
+
const Badge = ({
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}) => /* @__PURE__ */ jsx(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: cn(
|
|
36
|
+
"absolute right-0 top-0 box-border min-w-3 min-h-2.5 rounded-full bg-status-error px-1.25 py-0.25 text-2.5",
|
|
37
|
+
children && "translate-x-1/2",
|
|
38
|
+
className
|
|
39
|
+
),
|
|
40
|
+
...props,
|
|
41
|
+
children
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export { Badge };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
variant?: 'hollow' | 'solid' | 'plain';
|
|
5
|
+
size?: 'small' | 'middle' | 'large';
|
|
6
|
+
}
|
|
7
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
export { Button };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cn } from '../utils/config.js';
|
|
5
|
+
import '@radix-ui/react-portal';
|
|
6
|
+
import './avatar/index.js';
|
|
7
|
+
import './carousel/index.js';
|
|
8
|
+
import './checkbox/index.js';
|
|
9
|
+
import './collapsible/index.js';
|
|
10
|
+
import './dialog/confirm.js';
|
|
11
|
+
import './dialog/dialog.js';
|
|
12
|
+
import './drawer.js';
|
|
13
|
+
import './form.js';
|
|
14
|
+
import './input-otp.js';
|
|
15
|
+
import './label.js';
|
|
16
|
+
import './popover/index.js';
|
|
17
|
+
import './progress.js';
|
|
18
|
+
import './select/index.js';
|
|
19
|
+
import './slider/index.js';
|
|
20
|
+
import './sonner.js';
|
|
21
|
+
import './switch.js';
|
|
22
|
+
import './table/index.js';
|
|
23
|
+
import './tabs/index.js';
|
|
24
|
+
import './toggle/toggle.js';
|
|
25
|
+
import './toggle/toggle-group.js';
|
|
26
|
+
import './tooltip/index.js';
|
|
27
|
+
|
|
28
|
+
const BaseStyle = "flex items-center justify-center rounded-25 box-border cursor-pointer transition-all duration-fast ease-smooth truncate font-bold active:scale-98";
|
|
29
|
+
const SolidStyle = "bg-core-blue/20 hover:bg-core-blue/30 border border-core-blue/50 text-white shadow-none hover:shadow-[0_0_15px_rgba(59,130,246,0.4)] transition-all duration-fast ease-smooth";
|
|
30
|
+
const HollowStyle = "bg-transparent border border-white/20 text-slate-200 hover:bg-white/10 hover:text-white transition-colors duration-fast ease-smooth";
|
|
31
|
+
const PlainStyle = "bg-transparent text-slate-200 hover:text-white hover:underline transition-colors duration-fast ease-smooth";
|
|
32
|
+
const DisabledStyle = "opacity-50 cursor-not-allowed pointer-events-none";
|
|
33
|
+
const VariantStyle = {
|
|
34
|
+
solid: SolidStyle,
|
|
35
|
+
hollow: HollowStyle,
|
|
36
|
+
plain: PlainStyle
|
|
37
|
+
};
|
|
38
|
+
const SizeMap = {
|
|
39
|
+
small: "h-6 text-2.5",
|
|
40
|
+
middle: "h-8 text-3",
|
|
41
|
+
large: "w-56 h-10 text-3.5"
|
|
42
|
+
};
|
|
43
|
+
const Button = React.forwardRef(
|
|
44
|
+
({ className, variant = "solid", size = "large", ...props }, ref) => {
|
|
45
|
+
const Comp = props.asChild ? Slot : "button";
|
|
46
|
+
const style = props.disabled ? DisabledStyle : VariantStyle[variant];
|
|
47
|
+
const sizeClass = SizeMap[size];
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
Comp,
|
|
50
|
+
{
|
|
51
|
+
className: cn(BaseStyle, style, sizeClass, className),
|
|
52
|
+
ref,
|
|
53
|
+
type: "button",
|
|
54
|
+
...props
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
Button.displayName = "Button";
|
|
60
|
+
|
|
61
|
+
export { Button };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { default as Autoplay } from 'embla-carousel-autoplay';
|
|
2
|
+
import { default as useEmblaCarousel } from 'embla-carousel-react';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
5
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
6
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
7
|
+
type CarouselProps = {
|
|
8
|
+
opts?: CarouselOptions;
|
|
9
|
+
plugins?: CarouselPlugin;
|
|
10
|
+
orientation?: 'horizontal' | 'vertical';
|
|
11
|
+
};
|
|
12
|
+
type CarouselContext = {
|
|
13
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
14
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
15
|
+
scrollPrev: () => void;
|
|
16
|
+
scrollNext: () => void;
|
|
17
|
+
selectedIndex: number;
|
|
18
|
+
canScrollPrev: boolean;
|
|
19
|
+
canScrollNext: boolean;
|
|
20
|
+
} & CarouselProps;
|
|
21
|
+
declare const CarouselContext: React.Context<CarouselContext | null>;
|
|
22
|
+
declare function useCarousel(): CarouselContext;
|
|
23
|
+
interface TCarousel extends React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & CarouselProps & React.RefAttributes<CarouselContext>> {
|
|
24
|
+
Content: typeof CarouselContent;
|
|
25
|
+
Item: typeof CarouselItem;
|
|
26
|
+
Previous: typeof CarouselPrevious;
|
|
27
|
+
Next: typeof CarouselNext;
|
|
28
|
+
Dot: typeof CarouselDot;
|
|
29
|
+
Plugin: typeof CarouselPlugins;
|
|
30
|
+
}
|
|
31
|
+
declare const Carousel: TCarousel;
|
|
32
|
+
declare const CarouselContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
declare const CarouselItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
interface CarouselActionProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, 'disabled' | 'onClick'> {
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
declare const CarouselPrevious: React.ForwardRefExoticComponent<CarouselActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
38
|
+
declare const CarouselNext: React.ForwardRefExoticComponent<CarouselActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
39
|
+
declare const CarouselDot: React.ForwardRefExoticComponent<CarouselActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
declare const CarouselPlugins: {
|
|
41
|
+
Autoplay: typeof Autoplay;
|
|
42
|
+
};
|
|
43
|
+
export { Carousel, useCarousel };
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../utils/config.js';
|
|
3
|
+
import '@radix-ui/react-portal';
|
|
4
|
+
import '../avatar/index.js';
|
|
5
|
+
import '../button.js';
|
|
6
|
+
import '../checkbox/index.js';
|
|
7
|
+
import '../collapsible/index.js';
|
|
8
|
+
import '../dialog/confirm.js';
|
|
9
|
+
import '../dialog/dialog.js';
|
|
10
|
+
import '../drawer.js';
|
|
11
|
+
import '../form.js';
|
|
12
|
+
import '../input-otp.js';
|
|
13
|
+
import '../label.js';
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
import '../popover/index.js';
|
|
16
|
+
import '../progress.js';
|
|
17
|
+
import '../select/index.js';
|
|
18
|
+
import '../slider/index.js';
|
|
19
|
+
import '../sonner.js';
|
|
20
|
+
import '../switch.js';
|
|
21
|
+
import '../table/index.js';
|
|
22
|
+
import '../tabs/index.js';
|
|
23
|
+
import '../toggle/toggle.js';
|
|
24
|
+
import '../toggle/toggle-group.js';
|
|
25
|
+
import '../tooltip/index.js';
|
|
26
|
+
import Autoplay from 'embla-carousel-autoplay';
|
|
27
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
28
|
+
|
|
29
|
+
const CarouselContext = React.createContext(null);
|
|
30
|
+
function useCarousel() {
|
|
31
|
+
const context = React.useContext(CarouselContext);
|
|
32
|
+
if (!context) {
|
|
33
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
34
|
+
}
|
|
35
|
+
return context;
|
|
36
|
+
}
|
|
37
|
+
const Carousel = React.forwardRef(
|
|
38
|
+
({ orientation = "horizontal", opts, plugins, className, children, ...props }, ref) => {
|
|
39
|
+
const [carouselRef, api] = useEmblaCarousel(
|
|
40
|
+
{ ...opts, axis: orientation === "horizontal" ? "x" : "y" },
|
|
41
|
+
plugins
|
|
42
|
+
);
|
|
43
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
44
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
45
|
+
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
46
|
+
const scrollPrev = React.useCallback(() => {
|
|
47
|
+
api?.scrollPrev();
|
|
48
|
+
}, [api]);
|
|
49
|
+
const scrollNext = React.useCallback(() => {
|
|
50
|
+
api?.scrollNext();
|
|
51
|
+
}, [api]);
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
if (!api) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const onSelect = (api2) => {
|
|
57
|
+
if (!api2) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
setSelectedIndex(api2.selectedScrollSnap());
|
|
61
|
+
setCanScrollPrev(api2.canScrollPrev());
|
|
62
|
+
setCanScrollNext(api2.canScrollNext());
|
|
63
|
+
};
|
|
64
|
+
onSelect(api);
|
|
65
|
+
api.on("reInit", onSelect);
|
|
66
|
+
api.on("select", onSelect);
|
|
67
|
+
return () => {
|
|
68
|
+
api?.off("select", onSelect);
|
|
69
|
+
};
|
|
70
|
+
}, [api]);
|
|
71
|
+
React.useImperativeHandle(ref, () => ({
|
|
72
|
+
carouselRef,
|
|
73
|
+
api,
|
|
74
|
+
opts,
|
|
75
|
+
orientation,
|
|
76
|
+
scrollPrev,
|
|
77
|
+
scrollNext,
|
|
78
|
+
selectedIndex,
|
|
79
|
+
canScrollPrev,
|
|
80
|
+
canScrollNext
|
|
81
|
+
}));
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
83
|
+
CarouselContext.Provider,
|
|
84
|
+
{
|
|
85
|
+
value: {
|
|
86
|
+
carouselRef,
|
|
87
|
+
api,
|
|
88
|
+
opts,
|
|
89
|
+
orientation,
|
|
90
|
+
scrollPrev,
|
|
91
|
+
scrollNext,
|
|
92
|
+
selectedIndex,
|
|
93
|
+
canScrollPrev,
|
|
94
|
+
canScrollNext
|
|
95
|
+
},
|
|
96
|
+
children: /* @__PURE__ */ jsx(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
ref: carouselRef,
|
|
100
|
+
className: cn("relative overflow-hidden", className),
|
|
101
|
+
role: "region",
|
|
102
|
+
"aria-roledescription": "carousel",
|
|
103
|
+
...props,
|
|
104
|
+
children
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
Carousel.displayName = "Carousel";
|
|
112
|
+
const CarouselContent = React.forwardRef(
|
|
113
|
+
({ className, ...props }, ref) => {
|
|
114
|
+
const { orientation } = useCarousel();
|
|
115
|
+
return /* @__PURE__ */ jsx(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
ref,
|
|
119
|
+
className: cn("flex", orientation === "vertical" && "flex-col", className),
|
|
120
|
+
...props
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
CarouselContent.displayName = "CarouselContent";
|
|
126
|
+
const CarouselItem = React.forwardRef(
|
|
127
|
+
({ className, ...props }, ref) => {
|
|
128
|
+
return /* @__PURE__ */ jsx(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
ref,
|
|
132
|
+
role: "group",
|
|
133
|
+
"aria-roledescription": "slide",
|
|
134
|
+
className: cn("min-w-0 shrink-0 grow-0 basis-full", className),
|
|
135
|
+
...props
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
CarouselItem.displayName = "CarouselItem";
|
|
141
|
+
const CarouselPrevious = React.forwardRef(
|
|
142
|
+
({ children, ...props }, ref) => {
|
|
143
|
+
const { scrollPrev, canScrollPrev } = useCarousel();
|
|
144
|
+
return /* @__PURE__ */ jsx("button", { ref, ...props, disabled: !canScrollPrev, onClick: scrollPrev, children });
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
CarouselPrevious.displayName = "CarouselPrevious";
|
|
148
|
+
const CarouselNext = React.forwardRef(
|
|
149
|
+
({ children, ...props }, ref) => {
|
|
150
|
+
const { scrollNext, canScrollNext } = useCarousel();
|
|
151
|
+
return /* @__PURE__ */ jsx("button", { ref, ...props, disabled: !canScrollNext, onClick: scrollNext, children });
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
CarouselNext.displayName = "CarouselNext";
|
|
155
|
+
const CarouselDot = React.forwardRef(
|
|
156
|
+
({ children, ...props }, ref) => {
|
|
157
|
+
const { api, selectedIndex } = useCarousel();
|
|
158
|
+
return api?.slideNodes().map((_, index) => {
|
|
159
|
+
return /* @__PURE__ */ jsx(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
ref,
|
|
163
|
+
...props,
|
|
164
|
+
"data-state": index === selectedIndex ? "active" : "inactive",
|
|
165
|
+
onClick: () => {
|
|
166
|
+
api.scrollTo(index);
|
|
167
|
+
},
|
|
168
|
+
children
|
|
169
|
+
},
|
|
170
|
+
index
|
|
171
|
+
);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
CarouselDot.displayName = "CarouselDot";
|
|
176
|
+
const CarouselPlugins = {
|
|
177
|
+
Autoplay
|
|
178
|
+
};
|
|
179
|
+
Carousel.Content = CarouselContent;
|
|
180
|
+
Carousel.Item = CarouselItem;
|
|
181
|
+
Carousel.Previous = CarouselPrevious;
|
|
182
|
+
Carousel.Next = CarouselNext;
|
|
183
|
+
Carousel.Dot = CarouselDot;
|
|
184
|
+
Carousel.Plugin = CarouselPlugins;
|
|
185
|
+
|
|
186
|
+
export { Carousel, useCarousel };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
export { Checkbox };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Icon } from '../../components/icon/index.js';
|
|
5
|
+
import { cn } from '../../utils/config.js';
|
|
6
|
+
import '@radix-ui/react-portal';
|
|
7
|
+
import '../avatar/index.js';
|
|
8
|
+
import '../button.js';
|
|
9
|
+
import '../carousel/index.js';
|
|
10
|
+
import '../collapsible/index.js';
|
|
11
|
+
import '../dialog/confirm.js';
|
|
12
|
+
import '../dialog/dialog.js';
|
|
13
|
+
import '../drawer.js';
|
|
14
|
+
import '../form.js';
|
|
15
|
+
import '../input-otp.js';
|
|
16
|
+
import '../label.js';
|
|
17
|
+
import '../popover/index.js';
|
|
18
|
+
import '../progress.js';
|
|
19
|
+
import '../select/index.js';
|
|
20
|
+
import '../slider/index.js';
|
|
21
|
+
import '../sonner.js';
|
|
22
|
+
import '../switch.js';
|
|
23
|
+
import '../table/index.js';
|
|
24
|
+
import '../tabs/index.js';
|
|
25
|
+
import '../toggle/toggle.js';
|
|
26
|
+
import '../toggle/toggle-group.js';
|
|
27
|
+
import '../tooltip/index.js';
|
|
28
|
+
|
|
29
|
+
const BaseStyle = "size-5 shrink-0 box-border rounded border border-white/10 transition-colors duration-fast ease-smooth";
|
|
30
|
+
const CheckedStyle = "data-[state=checked]:bg-core-blue data-[state=checked]:border-core-blue data-[state=checked]:shadow-[0_0_8px_rgba(59,130,246,0.4)]";
|
|
31
|
+
const Checkbox = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(CheckboxPrimitive.Root, { ref, className: cn(BaseStyle, CheckedStyle, className), ...props, children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, { className: "size-full flex items-center justify-center text-current", children: /* @__PURE__ */ jsx(Icon, { icon: "i-nexus:check-monotone", className: "size-full text-white" }) }) }));
|
|
32
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
33
|
+
|
|
34
|
+
export { Checkbox };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CollapsibleProps } from '@radix-ui/react-collapsible';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
4
|
+
interface TCollapsible extends React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>> {
|
|
5
|
+
Trigger: typeof CollapsiblePrimitive.Trigger;
|
|
6
|
+
Content: typeof CollapsiblePrimitive.Content;
|
|
7
|
+
}
|
|
8
|
+
declare const Collapsible: TCollapsible;
|
|
9
|
+
export { Collapsible };
|