cooterlabs 2.0.0 → 2.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.
@@ -1,10 +1,5 @@
1
1
  import * as React from "react"
2
- import { clsx, type ClassValue } from "clsx"
3
- import { twMerge } from "tailwind-merge"
4
-
5
- export function cn(...inputs: ClassValue[]) {
6
- return twMerge(clsx(inputs))
7
- }
2
+ import { cn } from "../../lib/utils"
8
3
 
9
4
  export interface PageControlProps
10
5
  extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
@@ -42,7 +37,7 @@ const PageControl = React.forwardRef<HTMLDivElement, PageControlProps>(
42
37
  disabled={!onChange}
43
38
  onClick={() => onChange?.(i)}
44
39
  className={cn(
45
- "size-2 rounded-full ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",
40
+ "size-2 rounded-full transition-colors focus-visible:outline-none focus-visible:shadow-focus disabled:pointer-events-none",
46
41
  i === index ? "bg-primary" : "bg-grey-200 hover:bg-grey-300"
47
42
  )}
48
43
  />
@@ -1,11 +1,6 @@
1
1
  import * as React from "react"
2
2
  import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"
3
- import { clsx, type ClassValue } from "clsx"
4
- import { twMerge } from "tailwind-merge"
5
-
6
- export function cn(...inputs: ClassValue[]) {
7
- return twMerge(clsx(inputs))
8
- }
3
+ import { cn } from "../../lib/utils"
9
4
 
10
5
  const Pagination = ({
11
6
  className,
@@ -49,7 +44,7 @@ const PaginationLink = React.forwardRef<HTMLAnchorElement, PaginationLinkProps>(
49
44
  ref={ref}
50
45
  aria-current={isActive ? "page" : undefined}
51
46
  className={cn(
52
- "inline-flex size-12 items-center justify-center whitespace-nowrap rounded-xs text-b4 ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 aria-disabled:pointer-events-none aria-disabled:text-grey-400 [&_svg]:size-4",
47
+ "inline-flex size-12 items-center justify-center whitespace-nowrap rounded-xs text-b4 transition-colors focus-visible:outline-none focus-visible:shadow-focus aria-disabled:pointer-events-none aria-disabled:text-grey-400 [&_svg]:size-4",
53
48
  isActive
54
49
  ? "bg-primary text-primary-foreground"
55
50
  : "text-foreground hover:bg-secondary",
@@ -1,11 +1,6 @@
1
1
  import * as React from "react"
2
2
  import * as ProgressPrimitive from "@radix-ui/react-progress"
3
- import { clsx, type ClassValue } from "clsx"
4
- import { twMerge } from "tailwind-merge"
5
-
6
- export function cn(...inputs: ClassValue[]) {
7
- return twMerge(clsx(inputs))
8
- }
3
+ import { cn } from "../../lib/utils"
9
4
 
10
5
  export interface ProgressProps
11
6
  extends React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> {
@@ -1,11 +1,6 @@
1
1
  import * as React from "react"
2
2
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
3
- import { clsx, type ClassValue } from "clsx"
4
- import { twMerge } from "tailwind-merge"
5
-
6
- export function cn(...inputs: ClassValue[]) {
7
- return twMerge(clsx(inputs))
8
- }
3
+ import { cn } from "../../lib/utils"
9
4
 
10
5
  const RadioGroup = React.forwardRef<
11
6
  React.ElementRef<typeof RadioGroupPrimitive.Root>,
@@ -26,7 +21,7 @@ const RadioGroupItem = React.forwardRef<
26
21
  <RadioGroupPrimitive.Item
27
22
  ref={ref}
28
23
  className={cn(
29
- "aspect-square size-5 shrink-0 rounded-full border border-grey-300 bg-background ring-offset-background transition-colors hover:border-grey-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:border-grey-200 disabled:bg-muted data-[state=checked]:border-primary",
24
+ "aspect-square size-5 shrink-0 rounded-full border border-grey-300 bg-background transition-colors hover:border-grey-400 focus-visible:outline-none focus-visible:shadow-focus disabled:pointer-events-none disabled:border-grey-200 disabled:bg-muted data-[state=checked]:border-primary",
30
25
  className
31
26
  )}
32
27
  {...props}
@@ -0,0 +1,113 @@
1
+ import * as React from "react"
2
+ import * as SelectPrimitive from "@radix-ui/react-select"
3
+ import { Check, ChevronDown } from "lucide-react"
4
+ import { cn } from "../../lib/utils"
5
+ import {
6
+ inputVariants,
7
+ inputSizes,
8
+ inputStatuses,
9
+ statusTextColors,
10
+ } from "./input"
11
+
12
+ const Select = SelectPrimitive.Root
13
+ const SelectGroup = SelectPrimitive.Group
14
+ const SelectValue = SelectPrimitive.Value
15
+
16
+ export interface SelectTriggerProps
17
+ extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> {
18
+ variant?: keyof typeof inputVariants
19
+ size?: keyof typeof inputSizes
20
+ status?: keyof typeof statusTextColors
21
+ }
22
+
23
+ const SelectTrigger = React.forwardRef<
24
+ React.ElementRef<typeof SelectPrimitive.Trigger>,
25
+ SelectTriggerProps
26
+ >(
27
+ (
28
+ {
29
+ className,
30
+ variant = "outline",
31
+ size = "large",
32
+ status,
33
+ children,
34
+ ...props
35
+ },
36
+ ref
37
+ ) => (
38
+ <SelectPrimitive.Trigger
39
+ ref={ref}
40
+ className={cn(
41
+ "flex w-full items-center justify-between gap-2 rounded-xs border-[1.5px] text-foreground transition-colors focus-visible:outline-none focus-visible:shadow-focus disabled:pointer-events-none disabled:border-grey-200 disabled:bg-secondary disabled:text-grey-400 data-[placeholder]:text-muted-foreground [&>span]:truncate",
42
+ inputVariants[variant],
43
+ inputSizes[size],
44
+ status && inputStatuses[variant][status],
45
+ className
46
+ )}
47
+ {...props}
48
+ >
49
+ {children}
50
+ <SelectPrimitive.Icon asChild>
51
+ <ChevronDown
52
+ className={cn(
53
+ "size-4 shrink-0 text-muted-foreground",
54
+ status && statusTextColors[status]
55
+ )}
56
+ />
57
+ </SelectPrimitive.Icon>
58
+ </SelectPrimitive.Trigger>
59
+ )
60
+ )
61
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
62
+
63
+ const SelectContent = React.forwardRef<
64
+ React.ElementRef<typeof SelectPrimitive.Content>,
65
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
66
+ >(({ className, children, position = "popper", sideOffset = 4, ...props }, ref) => (
67
+ <SelectPrimitive.Portal>
68
+ <SelectPrimitive.Content
69
+ ref={ref}
70
+ position={position}
71
+ sideOffset={sideOffset}
72
+ className={cn(
73
+ "z-50 max-h-72 min-w-[var(--radix-select-trigger-width)] overflow-y-auto rounded-xs border border-grey-100 bg-popover text-popover-foreground shadow-400",
74
+ className
75
+ )}
76
+ {...props}
77
+ >
78
+ <SelectPrimitive.Viewport className="p-1">
79
+ {children}
80
+ </SelectPrimitive.Viewport>
81
+ </SelectPrimitive.Content>
82
+ </SelectPrimitive.Portal>
83
+ ))
84
+ SelectContent.displayName = SelectPrimitive.Content.displayName
85
+
86
+ const SelectItem = React.forwardRef<
87
+ React.ElementRef<typeof SelectPrimitive.Item>,
88
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
89
+ >(({ className, children, ...props }, ref) => (
90
+ <SelectPrimitive.Item
91
+ ref={ref}
92
+ className={cn(
93
+ "relative flex h-10 cursor-default select-none items-center gap-2 rounded-xxs px-3 pr-9 text-b3 outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0",
94
+ className
95
+ )}
96
+ {...props}
97
+ >
98
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
99
+ <SelectPrimitive.ItemIndicator className="absolute right-3">
100
+ <Check />
101
+ </SelectPrimitive.ItemIndicator>
102
+ </SelectPrimitive.Item>
103
+ ))
104
+ SelectItem.displayName = SelectPrimitive.Item.displayName
105
+
106
+ export {
107
+ Select,
108
+ SelectGroup,
109
+ SelectValue,
110
+ SelectTrigger,
111
+ SelectContent,
112
+ SelectItem,
113
+ }
@@ -1,11 +1,6 @@
1
1
  import * as React from "react"
2
2
  import { Check } from "lucide-react"
3
- import { clsx, type ClassValue } from "clsx"
4
- import { twMerge } from "tailwind-merge"
5
-
6
- export function cn(...inputs: ClassValue[]) {
7
- return twMerge(clsx(inputs))
8
- }
3
+ import { cn } from "../../lib/utils"
9
4
 
10
5
  const stepperCircleStates = {
11
6
  completed: "bg-primary text-primary-foreground",
@@ -1,11 +1,6 @@
1
1
  import * as React from "react"
2
2
  import * as TabsPrimitive from "@radix-ui/react-tabs"
3
- import { clsx, type ClassValue } from "clsx"
4
- import { twMerge } from "tailwind-merge"
5
-
6
- export function cn(...inputs: ClassValue[]) {
7
- return twMerge(clsx(inputs))
8
- }
3
+ import { cn } from "../../lib/utils"
9
4
 
10
5
  const Tabs = TabsPrimitive.Root
11
6
 
@@ -16,7 +11,7 @@ const TabsList = React.forwardRef<
16
11
  <TabsPrimitive.List
17
12
  ref={ref}
18
13
  className={cn(
19
- "inline-flex items-center justify-center gap-1 rounded-xs bg-secondary p-1",
14
+ "inline-flex items-center justify-center gap-1 rounded-full bg-secondary p-2",
20
15
  className
21
16
  )}
22
17
  {...props}
@@ -31,7 +26,7 @@ const TabsTrigger = React.forwardRef<
31
26
  <TabsPrimitive.Trigger
32
27
  ref={ref}
33
28
  className={cn(
34
- "inline-flex h-10 items-center justify-center whitespace-nowrap rounded-xxs px-4 text-b4 text-muted-foreground ring-offset-background transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:text-grey-400 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-100",
29
+ "inline-flex h-10 items-center justify-center whitespace-nowrap rounded-full px-4 text-b4 text-accent transition-colors hover:text-foreground hover:bg-primary-50 focus-visible:outline-none focus-visible:shadow-focus disabled:pointer-events-none disabled:text-disabled data-[state=active]:bg-primary-500 data-[state=active]:text-white data-[state=active]:shadow-100",
35
30
  className
36
31
  )}
37
32
  {...props}
@@ -46,7 +41,7 @@ const TabsContent = React.forwardRef<
46
41
  <TabsPrimitive.Content
47
42
  ref={ref}
48
43
  className={cn(
49
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
44
+ "mt-2 focus-visible:outline-none focus-visible:shadow-focus",
50
45
  className
51
46
  )}
52
47
  {...props}
@@ -1,10 +1,5 @@
1
1
  import * as React from "react"
2
- import { clsx, type ClassValue } from "clsx"
3
- import { twMerge } from "tailwind-merge"
4
-
5
- export function cn(...inputs: ClassValue[]) {
6
- return twMerge(clsx(inputs))
7
- }
2
+ import { cn } from "../../lib/utils"
8
3
 
9
4
  export interface TextareaProps
10
5
  extends React.TextareaHTMLAttributes<HTMLTextAreaElement> { }
@@ -14,7 +9,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
14
9
  return (
15
10
  <textarea
16
11
  className={cn(
17
- "flex min-h-24 w-full rounded-xs border border-input bg-background px-4 py-3 text-b1 text-foreground ring-offset-background transition-colors placeholder:text-muted-foreground hover:border-grey-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 aria-invalid:border-error disabled:pointer-events-none disabled:border-grey-200 disabled:bg-secondary disabled:text-grey-400",
12
+ "flex min-h-24 w-full rounded-xs border border-input bg-background px-4 py-3 text-b1 text-foreground transition-colors placeholder:text-muted-foreground hover:border-grey-300 focus-visible:outline-none focus-visible:shadow-focus aria-invalid:border-error disabled:pointer-events-none disabled:border-grey-200 disabled:bg-secondary disabled:text-grey-400",
18
13
  className
19
14
  )}
20
15
  ref={ref}
@@ -1,11 +1,6 @@
1
1
  import * as React from "react"
2
2
  import * as SwitchPrimitive from "@radix-ui/react-switch"
3
- import { clsx, type ClassValue } from "clsx"
4
- import { twMerge } from "tailwind-merge"
5
-
6
- export function cn(...inputs: ClassValue[]) {
7
- return twMerge(clsx(inputs))
8
- }
3
+ import { cn } from "../../lib/utils"
9
4
 
10
5
  const Toggle = React.forwardRef<
11
6
  React.ElementRef<typeof SwitchPrimitive.Root>,
@@ -14,7 +9,7 @@ const Toggle = React.forwardRef<
14
9
  <SwitchPrimitive.Root
15
10
  ref={ref}
16
11
  className={cn(
17
- "peer inline-flex h-6 w-11 shrink-0 items-center rounded-full bg-grey-200 px-0.5 ring-offset-background transition-colors hover:bg-grey-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:hover:bg-primary-700",
12
+ "peer inline-flex h-6 w-11 shrink-0 items-center rounded-full bg-grey-200 px-0.5 transition-colors hover:bg-grey-300 focus-visible:outline-none focus-visible:shadow-focus disabled:pointer-events-none disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:hover:bg-primary-700",
18
13
  className
19
14
  )}
20
15
  {...props}
@@ -1,11 +1,6 @@
1
1
  import * as React from "react"
2
2
  import * as TooltipPrimitive from "@radix-ui/react-tooltip"
3
- import { clsx, type ClassValue } from "clsx"
4
- import { twMerge } from "tailwind-merge"
5
-
6
- export function cn(...inputs: ClassValue[]) {
7
- return twMerge(clsx(inputs))
8
- }
3
+ import { cn } from "../../lib/utils"
9
4
 
10
5
  const TooltipProvider = TooltipPrimitive.Provider
11
6
 
@@ -22,7 +17,7 @@ const TooltipContent = React.forwardRef<
22
17
  ref={ref}
23
18
  sideOffset={sideOffset}
24
19
  className={cn(
25
- "z-50 overflow-hidden rounded-xxs bg-grey-900 px-3 py-1.5 text-c2 font-medium text-white shadow-300",
20
+ "z-50 overflow-hidden rounded-xs bg-primary-500 px-3 py-1.5 text-b3 font-medium text-white shadow-300",
26
21
  className
27
22
  )}
28
23
  {...props}