startx 1.0.2 → 1.0.4

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 (148) hide show
  1. package/.dockerignore +4 -0
  2. package/apps/cli/src/commands/index.ts +1 -1
  3. package/apps/cli/src/commands/{common → test}/test.ts +4 -2
  4. package/apps/cli/tsconfig.json +0 -1
  5. package/apps/core-server/Dockerfile +5 -4
  6. package/apps/core-server/package.json +1 -1
  7. package/apps/core-server/tsconfig.json +1 -1
  8. package/apps/queue-worker/package.json +1 -1
  9. package/apps/queue-worker/tsconfig.json +1 -1
  10. package/apps/startx-cli/dist/index.mjs +68 -53
  11. package/apps/startx-cli/src/commands/package.ts +453 -0
  12. package/apps/startx-cli/src/configs/scripts.ts +18 -2
  13. package/apps/startx-cli/src/index.ts +2 -4
  14. package/apps/startx-cli/src/types.ts +2 -4
  15. package/apps/startx-cli/src/utils/inquirer.ts +8 -1
  16. package/apps/web-client/.dockerignore +4 -0
  17. package/apps/web-client/app/app.css +1 -0
  18. package/apps/web-client/app/components.json +23 -0
  19. package/apps/web-client/app/config/auth/auth-state.ts +59 -0
  20. package/apps/web-client/app/config/axios-client.ts +87 -0
  21. package/apps/web-client/app/config/env.ts +5 -0
  22. package/apps/web-client/app/entry.client.tsx +7 -0
  23. package/apps/web-client/app/eslint.config.ts +4 -0
  24. package/apps/web-client/app/root.tsx +77 -0
  25. package/apps/web-client/app/routes/home.tsx +12 -0
  26. package/apps/web-client/app/routes.ts +3 -0
  27. package/apps/web-client/eslint.config.ts +4 -0
  28. package/apps/web-client/package.json +55 -0
  29. package/apps/web-client/react-router.config.ts +7 -0
  30. package/apps/web-client/tsconfig.json +22 -0
  31. package/apps/web-client/vite-env.d.ts +8 -0
  32. package/apps/web-client/vite.config.ts +30 -0
  33. package/biome.json +5 -0
  34. package/configs/eslint-config/eslint.config.ts +1 -0
  35. package/configs/eslint-config/src/configs/base.ts +2 -1
  36. package/configs/eslint-config/src/configs/frontend.ts +1 -1
  37. package/configs/eslint-config/tsconfig.json +1 -1
  38. package/configs/typescript-config/tsconfig.frontend.json +1 -1
  39. package/configs/vitest-config/tsconfig.json +1 -1
  40. package/package.json +1 -1
  41. package/packages/@db/drizzle/tsconfig.json +1 -1
  42. package/packages/@db/sqlite/tsconfig.json +1 -1
  43. package/packages/@repo/env/package.json +1 -2
  44. package/packages/@repo/env/src/utils.ts +17 -11
  45. package/packages/@repo/env/tsconfig.json +1 -1
  46. package/packages/@repo/lib/package.json +3 -1
  47. package/packages/@repo/lib/src/session-module/i-session.ts +108 -0
  48. package/packages/@repo/lib/src/session-module/index.ts +8 -111
  49. package/packages/@repo/lib/src/session-module/redis-session.ts +44 -0
  50. package/packages/@repo/lib/tsconfig.json +0 -1
  51. package/packages/@repo/logger/package.json +0 -1
  52. package/packages/@repo/logger/tsconfig.json +1 -1
  53. package/packages/@repo/mail/tsconfig.json +1 -1
  54. package/packages/@repo/redis/tsconfig.json +1 -1
  55. package/packages/aix/package.json +2 -0
  56. package/packages/aix/src/providers/ai-interface.ts +4 -4
  57. package/packages/aix/src/providers/bedrock/bedrock.ts +261 -0
  58. package/packages/aix/src/providers/default-models.ts +65 -0
  59. package/packages/aix/src/providers/openai/openai.ts +2 -2
  60. package/packages/aix/src/providers/providers.ts +11 -0
  61. package/packages/aix/src/providers/types.ts +1 -1
  62. package/packages/{constants → common}/package.json +4 -2
  63. package/packages/{constants/src/index.ts → common/src/constants.ts} +0 -5
  64. package/packages/common/src/types/users.ts +10 -0
  65. package/packages/{constants → common}/tsconfig.json +0 -3
  66. package/packages/ui/components.json +15 -8
  67. package/packages/ui/package.json +24 -36
  68. package/packages/ui/src/api/axios/i-client.ts +40 -0
  69. package/packages/ui/src/api/index.ts +6 -0
  70. package/packages/ui/src/api/query-provider.tsx +34 -0
  71. package/packages/ui/src/api/use-api/api-builder.ts +139 -0
  72. package/packages/ui/src/api/use-api/api-helpers.ts +165 -0
  73. package/packages/ui/src/api/use-api/api-types.ts +138 -0
  74. package/packages/ui/src/api/use-api/query-factory.ts +66 -0
  75. package/packages/ui/src/api/use-api/react-query/types.ts +64 -0
  76. package/packages/ui/src/api/use-api/react-query/use-api-client.ts +56 -0
  77. package/packages/ui/src/api/use-api/react-query/use-api.ts +297 -0
  78. package/packages/ui/src/components/custom/form-wrapper.tsx +113 -160
  79. package/packages/ui/src/components/custom/grid-component.tsx +4 -4
  80. package/packages/ui/src/components/custom/hover-tool.tsx +1 -1
  81. package/packages/ui/src/components/custom/image-picker.tsx +18 -20
  82. package/packages/ui/src/components/custom/no-content.tsx +6 -16
  83. package/packages/ui/src/components/custom/page-section.tsx +14 -17
  84. package/packages/ui/src/components/custom/simple-popover.tsx +5 -9
  85. package/packages/ui/src/components/custom/theme-provider.tsx +117 -42
  86. package/packages/ui/src/components/custom/typography.tsx +20 -22
  87. package/packages/ui/src/components/extensions/timeline.tsx +100 -0
  88. package/packages/ui/src/components/ui/alert-dialog.tsx +46 -108
  89. package/packages/ui/src/components/ui/avatar.tsx +79 -42
  90. package/packages/ui/src/components/ui/badge.tsx +29 -34
  91. package/packages/ui/src/components/ui/breadcrumb.tsx +65 -81
  92. package/packages/ui/src/components/ui/button.tsx +80 -80
  93. package/packages/ui/src/components/ui/card.tsx +48 -69
  94. package/packages/ui/src/components/ui/carousel.tsx +184 -211
  95. package/packages/ui/src/components/ui/checkbox.tsx +21 -24
  96. package/packages/ui/src/components/ui/command.tsx +121 -102
  97. package/packages/ui/src/components/ui/dialog.tsx +45 -32
  98. package/packages/ui/src/components/ui/dropdown-menu.tsx +45 -33
  99. package/packages/ui/src/components/ui/field.tsx +218 -0
  100. package/packages/ui/src/components/ui/form.tsx +63 -76
  101. package/packages/ui/src/components/ui/input-group.tsx +137 -0
  102. package/packages/ui/src/components/ui/input-otp.tsx +60 -50
  103. package/packages/ui/src/components/ui/input.tsx +16 -15
  104. package/packages/ui/src/components/ui/label.tsx +14 -17
  105. package/packages/ui/src/components/ui/multiple-select.tsx +22 -33
  106. package/packages/ui/src/components/ui/popover.tsx +20 -8
  107. package/packages/ui/src/components/ui/select.tsx +33 -34
  108. package/packages/ui/src/components/ui/separator.tsx +8 -8
  109. package/packages/ui/src/components/ui/sheet.tsx +32 -59
  110. package/packages/ui/src/components/ui/sidebar.tsx +654 -0
  111. package/packages/ui/src/components/ui/skeleton.tsx +2 -8
  112. package/packages/ui/src/components/ui/sonner.tsx +39 -0
  113. package/packages/ui/src/components/ui/spinner.tsx +6 -13
  114. package/packages/ui/src/components/ui/switch.tsx +15 -10
  115. package/packages/ui/src/components/ui/table.tsx +48 -89
  116. package/packages/ui/src/components/ui/tabs.tsx +37 -15
  117. package/packages/ui/src/components/ui/textarea.tsx +13 -13
  118. package/packages/ui/src/components/ui/tooltip.tsx +37 -23
  119. package/packages/ui/src/{components/hooks → hooks}/event/use-click.tsx +6 -10
  120. package/packages/ui/src/hooks/time/use-timer.tsx +51 -0
  121. package/packages/ui/src/hooks/use-media-query.tsx +19 -0
  122. package/packages/ui/src/hooks/use-mobile.tsx +17 -0
  123. package/packages/ui/src/{components/hooks → hooks}/use-update-effect.tsx +2 -2
  124. package/packages/ui/src/lib/utils.ts +113 -0
  125. package/packages/ui/src/styles/globals.css +314 -0
  126. package/packages/ui/src/styles/tailwind.css +89 -0
  127. package/packages/ui/tsconfig.json +7 -9
  128. package/pnpm-workspace.yaml +74 -64
  129. package/packages/ui/postcss.config.mjs +0 -9
  130. package/packages/ui/src/components/extensions/carousel.tsx +0 -392
  131. package/packages/ui/src/components/hooks/time/useTimer.tsx +0 -51
  132. package/packages/ui/src/components/hooks/use-media-query.tsx +0 -19
  133. package/packages/ui/src/components/lib/utils.ts +0 -242
  134. package/packages/ui/src/components/ui/timeline.tsx +0 -118
  135. package/packages/ui/src/components/util/n-formattor.ts +0 -22
  136. package/packages/ui/src/components/util/storage.ts +0 -37
  137. package/packages/ui/src/globals.css +0 -87
  138. package/packages/ui/tailwind.config.ts +0 -94
  139. /package/packages/{constants → common}/eslint.config.ts +0 -0
  140. /package/packages/{constants → common}/src/api.ts +0 -0
  141. /package/packages/{constants → common}/src/time.ts +0 -0
  142. /package/packages/{constants → common}/vitest.config.ts +0 -0
  143. /package/packages/ui/src/{components/hooks/time/useDebounce.tsx → hooks/time/use-debounce.tsx} +0 -0
  144. /package/packages/ui/src/{components/hooks/time/useInterval.tsx → hooks/time/use-interval.tsx} +0 -0
  145. /package/packages/ui/src/{components/hooks/time/useTimeout.tsx → hooks/time/use-timeout.tsx} +0 -0
  146. /package/packages/ui/src/{components/hooks → hooks}/use-persistent-storage.tsx +0 -0
  147. /package/packages/ui/src/{components/hooks → hooks}/use-window-dimension.tsx +0 -0
  148. /package/packages/ui/src/{components/sonner.tsx → sonner.ts} +0 -0
@@ -1,52 +1,89 @@
1
- "use client"
1
+ "use client";
2
2
 
3
- import * as AvatarPrimitive from "@radix-ui/react-avatar"
3
+ import { Avatar as AvatarPrimitive } from "radix-ui";
4
+ import * as React from "react";
4
5
 
5
- import { cn } from "../lib/utils"
6
+ import { cn } from "@repo/ui/lib/utils";
6
7
 
7
8
  function Avatar({
8
- className,
9
- ...props
10
- }: React.ComponentProps<typeof AvatarPrimitive.Root>) {
11
- return (
12
- <AvatarPrimitive.Root
13
- data-slot="avatar"
14
- className={cn(
15
- "relative flex size-8 shrink-0 overflow-hidden rounded-full",
16
- className
17
- )}
18
- {...props}
19
- />
20
- )
9
+ className,
10
+ size = "default",
11
+ ...props
12
+ }: React.ComponentProps<typeof AvatarPrimitive.Root> & {
13
+ size?: "default" | "sm" | "lg";
14
+ }) {
15
+ return (
16
+ <AvatarPrimitive.Root
17
+ data-slot="avatar"
18
+ data-size={size}
19
+ className={cn(
20
+ "group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",
21
+ className
22
+ )}
23
+ {...props}
24
+ />
25
+ );
21
26
  }
22
27
 
23
- function AvatarImage({
24
- className,
25
- ...props
26
- }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
27
- return (
28
- <AvatarPrimitive.Image
29
- data-slot="avatar-image"
30
- className={cn("aspect-square size-full", className)}
31
- {...props}
32
- />
33
- )
28
+ function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
29
+ return (
30
+ <AvatarPrimitive.Image data-slot="avatar-image" className={cn("aspect-square size-full", className)} {...props} />
31
+ );
34
32
  }
35
33
 
36
- function AvatarFallback({
37
- className,
38
- ...props
39
- }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
40
- return (
41
- <AvatarPrimitive.Fallback
42
- data-slot="avatar-fallback"
43
- className={cn(
44
- "bg-muted flex size-full items-center justify-center rounded-full",
45
- className
46
- )}
47
- {...props}
48
- />
49
- )
34
+ function AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
35
+ return (
36
+ <AvatarPrimitive.Fallback
37
+ data-slot="avatar-fallback"
38
+ className={cn(
39
+ "flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ );
50
45
  }
51
46
 
52
- export { Avatar, AvatarImage, AvatarFallback }
47
+ function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
48
+ return (
49
+ <span
50
+ data-slot="avatar-badge"
51
+ className={cn(
52
+ "absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground ring-2 ring-background select-none",
53
+ "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
54
+ "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
55
+ "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
56
+ className
57
+ )}
58
+ {...props}
59
+ />
60
+ );
61
+ }
62
+
63
+ function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {
64
+ return (
65
+ <div
66
+ data-slot="avatar-group"
67
+ className={cn(
68
+ "group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
69
+ className
70
+ )}
71
+ {...props}
72
+ />
73
+ );
74
+ }
75
+
76
+ function AvatarGroupCount({ className, ...props }: React.ComponentProps<"div">) {
77
+ return (
78
+ <div
79
+ data-slot="avatar-group-count"
80
+ className={cn(
81
+ "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
82
+ className
83
+ )}
84
+ {...props}
85
+ />
86
+ );
87
+ }
88
+
89
+ export { Avatar, AvatarImage, AvatarFallback, AvatarBadge, AvatarGroup, AvatarGroupCount };
@@ -1,45 +1,40 @@
1
- import { Slot } from "@radix-ui/react-slot";
2
1
  import { cva, type VariantProps } from "class-variance-authority";
2
+ import { Slot } from "radix-ui";
3
+ import * as React from "react";
3
4
 
4
- import { cn } from "../lib/utils";
5
+ import { cn } from "@repo/ui/lib/utils";
5
6
 
6
7
  const badgeVariants = cva(
7
- "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
8
- {
9
- variants: {
10
- variant: {
11
- default:
12
- "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
13
- secondary:
14
- "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
15
- destructive:
16
- "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/70",
17
- outline:
18
- "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
19
- },
20
- },
21
- defaultVariants: {
22
- variant: "default",
23
- },
24
- }
8
+ "inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
13
+ secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
14
+ destructive:
15
+ "bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
16
+ outline: "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
17
+ ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
18
+ link: "text-primary underline-offset-4 [a&]:hover:underline",
19
+ },
20
+ },
21
+ defaultVariants: {
22
+ variant: "default",
23
+ },
24
+ }
25
25
  );
26
26
 
27
27
  function Badge({
28
- className,
29
- variant,
30
- asChild = false,
31
- ...props
32
- }: React.ComponentProps<"span"> &
33
- VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
34
- const Comp = asChild ? Slot : "span";
28
+ className,
29
+ variant = "default",
30
+ asChild = false,
31
+ ...props
32
+ }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
33
+ const Comp = asChild ? Slot.Root : "span";
35
34
 
36
- return (
37
- <Comp
38
- data-slot="badge"
39
- className={cn(badgeVariants({ variant }), className)}
40
- {...props}
41
- />
42
- );
35
+ return (
36
+ <Comp data-slot="badge" data-variant={variant} className={cn(badgeVariants({ variant }), className)} {...props} />
37
+ );
43
38
  }
44
39
 
45
40
  export { Badge, badgeVariants };
@@ -1,108 +1,92 @@
1
- import { Slot } from "@radix-ui/react-slot";
2
1
  import { ChevronRight, MoreHorizontal } from "lucide-react";
2
+ import { Slot } from "radix-ui";
3
+ import * as React from "react";
3
4
 
4
- import { cn } from "../lib/utils";
5
+ import { cn } from "@repo/ui/lib/utils";
5
6
 
6
7
  function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
7
- return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
8
+ return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
8
9
  }
9
10
 
10
11
  function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
11
- return (
12
- <ol
13
- data-slot="breadcrumb-list"
14
- className={cn(
15
- "text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
16
- className
17
- )}
18
- {...props}
19
- />
20
- );
12
+ return (
13
+ <ol
14
+ data-slot="breadcrumb-list"
15
+ className={cn(
16
+ "flex flex-wrap items-center gap-1.5 text-sm wrap-break-words text-muted-foreground sm:gap-2.5",
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ );
21
22
  }
22
23
 
23
24
  function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
24
- return (
25
- <li
26
- data-slot="breadcrumb-item"
27
- className={cn("inline-flex items-center gap-1.5", className)}
28
- {...props}
29
- />
30
- );
25
+ return <li data-slot="breadcrumb-item" className={cn("inline-flex items-center gap-1.5", className)} {...props} />;
31
26
  }
32
27
 
33
28
  function BreadcrumbLink({
34
- asChild,
35
- className,
36
- ...props
29
+ asChild,
30
+ className,
31
+ ...props
37
32
  }: React.ComponentProps<"a"> & {
38
- asChild?: boolean;
33
+ asChild?: boolean;
39
34
  }) {
40
- const Comp = asChild ? Slot : "a";
35
+ const Comp = asChild ? Slot.Root : "a";
41
36
 
42
- return (
43
- <Comp
44
- data-slot="breadcrumb-link"
45
- className={cn("hover:text-foreground transition-colors", className)}
46
- {...props}
47
- />
48
- );
37
+ return (
38
+ <Comp data-slot="breadcrumb-link" className={cn("transition-colors hover:text-foreground", className)} {...props} />
39
+ );
49
40
  }
50
41
 
51
42
  function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
52
- return (
53
- <span
54
- data-slot="breadcrumb-page"
55
- role="link"
56
- aria-disabled="true"
57
- aria-current="page"
58
- className={cn("text-foreground font-normal", className)}
59
- {...props}
60
- />
61
- );
43
+ return (
44
+ <span
45
+ data-slot="breadcrumb-page"
46
+ role="link"
47
+ aria-disabled="true"
48
+ aria-current="page"
49
+ className={cn("font-normal text-foreground", className)}
50
+ {...props}
51
+ />
52
+ );
62
53
  }
63
54
 
64
- function BreadcrumbSeparator({
65
- children,
66
- className,
67
- ...props
68
- }: React.ComponentProps<"li">) {
69
- return (
70
- <li
71
- data-slot="breadcrumb-separator"
72
- role="presentation"
73
- aria-hidden="true"
74
- className={cn("[&>svg]:size-3.5", className)}
75
- {...props}
76
- >
77
- {children ?? <ChevronRight />}
78
- </li>
79
- );
55
+ function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<"li">) {
56
+ return (
57
+ <li
58
+ data-slot="breadcrumb-separator"
59
+ role="presentation"
60
+ aria-hidden="true"
61
+ className={cn("[&>svg]:size-3.5", className)}
62
+ {...props}
63
+ >
64
+ {children ?? <ChevronRight />}
65
+ </li>
66
+ );
80
67
  }
81
68
 
82
- function BreadcrumbEllipsis({
83
- className,
84
- ...props
85
- }: React.ComponentProps<"span">) {
86
- return (
87
- <span
88
- data-slot="breadcrumb-ellipsis"
89
- role="presentation"
90
- aria-hidden="true"
91
- className={cn("flex size-9 items-center justify-center", className)}
92
- {...props}
93
- >
94
- <MoreHorizontal className="size-4" />
95
- <span className="sr-only">More</span>
96
- </span>
97
- );
69
+ function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<"span">) {
70
+ return (
71
+ <span
72
+ data-slot="breadcrumb-ellipsis"
73
+ role="presentation"
74
+ aria-hidden="true"
75
+ className={cn("flex size-9 items-center justify-center", className)}
76
+ {...props}
77
+ >
78
+ <MoreHorizontal className="size-4" />
79
+ <span className="sr-only">More</span>
80
+ </span>
81
+ );
98
82
  }
99
83
 
100
84
  export {
101
- Breadcrumb,
102
- BreadcrumbList,
103
- BreadcrumbItem,
104
- BreadcrumbLink,
105
- BreadcrumbPage,
106
- BreadcrumbSeparator,
107
- BreadcrumbEllipsis,
85
+ Breadcrumb,
86
+ BreadcrumbList,
87
+ BreadcrumbItem,
88
+ BreadcrumbLink,
89
+ BreadcrumbPage,
90
+ BreadcrumbSeparator,
91
+ BreadcrumbEllipsis,
108
92
  };
@@ -1,96 +1,96 @@
1
- import { Slot } from "@radix-ui/react-slot";
2
1
  import { cva, type VariantProps } from "class-variance-authority";
2
+ import { Slot } from "radix-ui";
3
3
  import * as React from "react";
4
4
  import { RiLoader3Line } from "react-icons/ri";
5
5
 
6
- import { cn } from "../lib/utils";
6
+ import { cn } from "@repo/ui/lib/utils";
7
7
 
8
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
- }
9
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
10
+ {
11
+ variants: {
12
+ variant: {
13
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
14
+ outline:
15
+ "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
16
+ secondary:
17
+ "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
18
+ ghost:
19
+ "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
20
+ destructive:
21
+ "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
22
+ link: "text-primary underline-offset-4 hover:underline",
23
+ minimal: "py-0 px-0 md:py-0 md:p-0 max-h-fit",
24
+ },
25
+ size: {
26
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
27
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
28
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
29
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
30
+ icon: "size-8",
31
+ "icon-xs":
32
+ "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
33
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
34
+ "icon-lg": "size-9",
35
+ },
36
+ },
37
+ defaultVariants: {
38
+ variant: "default",
39
+ size: "default",
40
+ },
41
+ }
37
42
  );
38
43
 
39
44
  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;
45
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
46
+ VariantProps<typeof buttonVariants> {
47
+ asChild?: boolean;
48
+ loading?: boolean;
49
+ hideChild?: boolean;
50
+ icon?: React.ReactNode;
47
51
  }
48
52
 
49
53
  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
- }
54
+ (
55
+ {
56
+ className,
57
+ variant = "default",
58
+ size = "default",
59
+ asChild = false,
60
+ disabled = false,
61
+ loading = false,
62
+ hideChild = false,
63
+ icon,
64
+ ...props
65
+ },
66
+ ref
67
+ ) => {
68
+ const Comp = asChild ? Slot.Root : "button";
69
+
70
+ return (
71
+ <Comp
72
+ ref={ref}
73
+ data-slot="button"
74
+ data-variant={variant}
75
+ data-size={size}
76
+ disabled={disabled || loading}
77
+ className={cn(
78
+ buttonVariants({ variant, size }),
79
+ "ease-in-out duration-75 active:scale-95 transition-transform will-change-transform cursor-pointer",
80
+ className
81
+ )}
82
+ {...props}
83
+ >
84
+ <RiLoader3Line
85
+ className={cn(loading ? "size-6 animate-spin" : "hidden", !hideChild && "mr-2", "transition-transform")}
86
+ />
87
+ <span className={cn((!icon || (hideChild && loading)) && "hidden", props.children && "mr-2")}>{icon}</span>
88
+ <>{hideChild ? !loading && props.children : props.children}</>
89
+ </Comp>
90
+ );
91
+ }
93
92
  );
93
+
94
94
  Button.displayName = "Button";
95
95
 
96
96
  export { Button, buttonVariants };