@cnc-ti/layout-basic 5.0.0 → 6.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnc-ti/layout-basic",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/postcss.config.js CHANGED
@@ -1,6 +1,6 @@
1
- module.exports = {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- }
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
@@ -1,100 +1,100 @@
1
- import { Slot } from "@radix-ui/react-slot";
2
- import { type VariantProps, cva } from "class-variance-authority";
3
- import { Loader2 } from "lucide-react";
4
- import React from "react";
5
- import { cn } from "../utils";
6
-
7
- const buttonVariants = cva(
8
- "inline-flex items-center justify-center border text-white whitespace-nowrap rounded-md text-sm font-medium 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 disabled:opacity-50",
9
- {
10
- variants: {
11
- variant: {
12
- confirm:
13
- "bg-brand-blue-400 border-brand-blue-500 hover:bg-brand-blue-400/90",
14
- create:
15
- "bg-brand-green-100 border-brand-green-200 hover:bg-brand-green-100/80",
16
- secondary:
17
- "bg-brand-gray-20 text-secondary-foreground hover:brightness-95",
18
- danger:
19
- "bg-brand-red-500 border-brand-red-600 hover:bg-brand-red-500/80",
20
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
21
- },
22
- size: {
23
- default: "h-10 px-4 py-2",
24
- sm: "h-9 rounded-md px-3",
25
- lg: "h-11 rounded-md px-8",
26
- icon: "h-10 w-10",
27
- },
28
- outline: {
29
- true: "bg-transparent",
30
- false: "",
31
- },
32
- },
33
- defaultVariants: {
34
- variant: "default",
35
- size: "default",
36
- outline: false,
37
- },
38
- compoundVariants: [
39
- {
40
- variant: "confirm",
41
- outline: true,
42
- className: "text-brand-blue-400 hover:text-white",
43
- },
44
- {
45
- variant: "create",
46
- outline: true,
47
- className: "text-brand-green-100 hover:text-white",
48
- },
49
- ],
50
- }
51
- );
52
- export interface ButtonProps
53
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
54
- VariantProps<typeof buttonVariants> {
55
- asChild?: boolean;
56
- isLoading?: boolean;
57
- }
58
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
59
- (
60
- {
61
- className,
62
- variant,
63
- size,
64
- asChild = false,
65
- isLoading = false,
66
- outline = false,
67
- disabled,
68
- children,
69
- ...props
70
- },
71
- ref
72
- ) => {
73
- const Comp = asChild ? Slot : "button";
74
-
75
- return (
76
- <Comp
77
- className={cn(
78
- buttonVariants({ variant, size, className, outline }),
79
- disabled &&
80
- "cursor-not-allowed border-gray-100 bg-brand-gray-10 text-brand-gray-600",
81
- isLoading &&
82
- "cursor-not-allowed border-gray-100 bg-brand-gray-10 text-brand-gray-600"
83
- )}
84
- ref={ref}
85
- disabled={isLoading || disabled}
86
- {...props}
87
- >
88
- <>
89
- {isLoading && (
90
- <Loader2 className="mr-2 h-4 w-4 animate-spin text-brand-gray-600" />
91
- )}
92
- {children}
93
- </>
94
- </Comp>
95
- );
96
- }
97
- );
98
- Button.displayName = "Button";
99
-
100
- export { Button, buttonVariants };
1
+ import { Slot } from "@radix-ui/react-slot";
2
+ import { type VariantProps, cva } from "class-variance-authority";
3
+ import { Loader2 } from "lucide-react";
4
+ import React from "react";
5
+ import { cn } from "../utils";
6
+
7
+ const buttonVariants = cva(
8
+ "inline-flex items-center justify-center border text-white whitespace-nowrap rounded-md text-sm font-medium 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 disabled:opacity-50",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ confirm:
13
+ "bg-brand-blue-400 border-brand-blue-500 hover:bg-brand-blue-400/90",
14
+ create:
15
+ "bg-brand-green-100 border-brand-green-200 hover:bg-brand-green-100/80",
16
+ secondary:
17
+ "bg-brand-gray-20 text-secondary-foreground hover:brightness-95",
18
+ danger:
19
+ "bg-brand-red-500 border-brand-red-600 hover:bg-brand-red-500/80",
20
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
21
+ },
22
+ size: {
23
+ default: "h-10 px-4 py-2",
24
+ sm: "h-9 rounded-md px-3",
25
+ lg: "h-11 rounded-md px-8",
26
+ icon: "h-10 w-10",
27
+ },
28
+ outline: {
29
+ true: "bg-transparent",
30
+ false: "",
31
+ },
32
+ },
33
+ defaultVariants: {
34
+ variant: "default",
35
+ size: "default",
36
+ outline: false,
37
+ },
38
+ compoundVariants: [
39
+ {
40
+ variant: "confirm",
41
+ outline: true,
42
+ className: "text-brand-blue-400 hover:text-white",
43
+ },
44
+ {
45
+ variant: "create",
46
+ outline: true,
47
+ className: "text-brand-green-100 hover:text-white",
48
+ },
49
+ ],
50
+ }
51
+ );
52
+ export interface ButtonProps
53
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
54
+ VariantProps<typeof buttonVariants> {
55
+ asChild?: boolean;
56
+ isLoading?: boolean;
57
+ }
58
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
59
+ (
60
+ {
61
+ className,
62
+ variant,
63
+ size,
64
+ asChild = false,
65
+ isLoading = false,
66
+ outline = false,
67
+ disabled,
68
+ children,
69
+ ...props
70
+ },
71
+ ref
72
+ ) => {
73
+ const Comp = asChild ? Slot : "button";
74
+
75
+ return (
76
+ <Comp
77
+ className={cn(
78
+ buttonVariants({ variant, size, className, outline }),
79
+ disabled &&
80
+ "cursor-not-allowed border-gray-100 bg-brand-gray-10 text-brand-gray-600",
81
+ isLoading &&
82
+ "cursor-not-allowed border-gray-100 bg-brand-gray-10 text-brand-gray-600"
83
+ )}
84
+ ref={ref}
85
+ disabled={isLoading || disabled}
86
+ {...props}
87
+ >
88
+ <>
89
+ {isLoading && (
90
+ <Loader2 className="mr-2 h-4 w-4 animate-spin text-brand-gray-600" />
91
+ )}
92
+ {children}
93
+ </>
94
+ </Comp>
95
+ );
96
+ }
97
+ );
98
+ Button.displayName = "Button";
99
+
100
+ export { Button, buttonVariants };
@@ -1,156 +1,156 @@
1
- "use client";
2
-
3
- import { type DialogProps } from "@radix-ui/react-dialog";
4
- import { Command as CommandPrimitive } from "cmdk";
5
- import { Search } from "lucide-react";
6
- import * as React from "react";
7
-
8
- import { Dialog, DialogContent } from "../Dialog";
9
- import { cn } from "../utils";
10
-
11
- const Command = React.forwardRef<
12
- React.ElementRef<typeof CommandPrimitive>,
13
- React.ComponentPropsWithoutRef<typeof CommandPrimitive>
14
- >(({ className, ...props }, ref) => (
15
- <CommandPrimitive
16
- ref={ref}
17
- className={cn(
18
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
19
- className
20
- )}
21
- {...props}
22
- />
23
- ));
24
- Command.displayName = CommandPrimitive.displayName;
25
-
26
- interface CommandDialogProps extends DialogProps {}
27
-
28
- const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
29
- return (
30
- <Dialog {...props}>
31
- <DialogContent className="overflow-hidden p-0 shadow-lg">
32
- <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
33
- {children}
34
- </Command>
35
- </DialogContent>
36
- </Dialog>
37
- );
38
- };
39
-
40
- const CommandInput = React.forwardRef<
41
- React.ElementRef<typeof CommandPrimitive.Input>,
42
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
43
- >(({ className, ...props }, ref) => (
44
- <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
45
- <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
46
- <CommandPrimitive.Input
47
- ref={ref}
48
- className={cn(
49
- "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
50
- className
51
- )}
52
- {...props}
53
- />
54
- </div>
55
- ));
56
-
57
- CommandInput.displayName = CommandPrimitive.Input.displayName;
58
-
59
- const CommandList = React.forwardRef<
60
- React.ElementRef<typeof CommandPrimitive.List>,
61
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
62
- >(({ className, ...props }, ref) => (
63
- <CommandPrimitive.List
64
- ref={ref}
65
- className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
66
- {...props}
67
- />
68
- ));
69
-
70
- CommandList.displayName = CommandPrimitive.List.displayName;
71
-
72
- const CommandEmpty = React.forwardRef<
73
- React.ElementRef<typeof CommandPrimitive.Empty>,
74
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
75
- >((props, ref) => (
76
- <CommandPrimitive.Empty
77
- ref={ref}
78
- className="py-6 text-center text-sm"
79
- {...props}
80
- />
81
- ));
82
-
83
- CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
84
-
85
- const CommandGroup = React.forwardRef<
86
- React.ElementRef<typeof CommandPrimitive.Group>,
87
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
88
- >(({ className, ...props }, ref) => (
89
- <CommandPrimitive.Group
90
- ref={ref}
91
- className={cn(
92
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
93
- className
94
- )}
95
- {...props}
96
- />
97
- ));
98
-
99
- CommandGroup.displayName = CommandPrimitive.Group.displayName;
100
-
101
- const CommandSeparator = React.forwardRef<
102
- React.ElementRef<typeof CommandPrimitive.Separator>,
103
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
104
- >(({ className, ...props }, ref) => (
105
- <CommandPrimitive.Separator
106
- ref={ref}
107
- className={cn("-mx-1 h-px bg-border", className)}
108
- {...props}
109
- />
110
- ));
111
- CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
112
-
113
- const CommandItem = React.forwardRef<
114
- React.ElementRef<typeof CommandPrimitive.Item>,
115
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
116
- >(({ className, ...props }, ref) => (
117
- <CommandPrimitive.Item
118
- ref={ref}
119
- className={cn(
120
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",
121
- className
122
- )}
123
- {...props}
124
- />
125
- ));
126
-
127
- CommandItem.displayName = CommandPrimitive.Item.displayName;
128
-
129
- const CommandShortcut = ({
130
- className,
131
- ...props
132
- }: React.HTMLAttributes<HTMLSpanElement>) => {
133
- return (
134
- <span
135
- className={cn(
136
- "ml-auto text-xs tracking-widest text-muted-foreground",
137
- className
138
- )}
139
- {...props}
140
- />
141
- );
142
- };
143
- CommandShortcut.displayName = "CommandShortcut";
144
-
145
- export {
146
- Command,
147
- CommandDialog,
148
- CommandEmpty,
149
- CommandGroup,
150
- CommandInput,
151
- CommandItem,
152
- CommandList,
153
- CommandSeparator,
154
- CommandShortcut
155
- };
156
-
1
+ "use client";
2
+
3
+ import { type DialogProps } from "@radix-ui/react-dialog";
4
+ import { Command as CommandPrimitive } from "cmdk";
5
+ import { Search } from "lucide-react";
6
+ import * as React from "react";
7
+
8
+ import { Dialog, DialogContent } from "../Dialog";
9
+ import { cn } from "../utils";
10
+
11
+ const Command = React.forwardRef<
12
+ React.ElementRef<typeof CommandPrimitive>,
13
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
14
+ >(({ className, ...props }, ref) => (
15
+ <CommandPrimitive
16
+ ref={ref}
17
+ className={cn(
18
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
19
+ className
20
+ )}
21
+ {...props}
22
+ />
23
+ ));
24
+ Command.displayName = CommandPrimitive.displayName;
25
+
26
+ interface CommandDialogProps extends DialogProps {}
27
+
28
+ const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
29
+ return (
30
+ <Dialog {...props}>
31
+ <DialogContent className="overflow-hidden p-0 shadow-lg">
32
+ <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
33
+ {children}
34
+ </Command>
35
+ </DialogContent>
36
+ </Dialog>
37
+ );
38
+ };
39
+
40
+ const CommandInput = React.forwardRef<
41
+ React.ElementRef<typeof CommandPrimitive.Input>,
42
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
43
+ >(({ className, ...props }, ref) => (
44
+ <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
45
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
46
+ <CommandPrimitive.Input
47
+ ref={ref}
48
+ className={cn(
49
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
50
+ className
51
+ )}
52
+ {...props}
53
+ />
54
+ </div>
55
+ ));
56
+
57
+ CommandInput.displayName = CommandPrimitive.Input.displayName;
58
+
59
+ const CommandList = React.forwardRef<
60
+ React.ElementRef<typeof CommandPrimitive.List>,
61
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
62
+ >(({ className, ...props }, ref) => (
63
+ <CommandPrimitive.List
64
+ ref={ref}
65
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
66
+ {...props}
67
+ />
68
+ ));
69
+
70
+ CommandList.displayName = CommandPrimitive.List.displayName;
71
+
72
+ const CommandEmpty = React.forwardRef<
73
+ React.ElementRef<typeof CommandPrimitive.Empty>,
74
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
75
+ >((props, ref) => (
76
+ <CommandPrimitive.Empty
77
+ ref={ref}
78
+ className="py-6 text-center text-sm"
79
+ {...props}
80
+ />
81
+ ));
82
+
83
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
84
+
85
+ const CommandGroup = React.forwardRef<
86
+ React.ElementRef<typeof CommandPrimitive.Group>,
87
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
88
+ >(({ className, ...props }, ref) => (
89
+ <CommandPrimitive.Group
90
+ ref={ref}
91
+ className={cn(
92
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
93
+ className
94
+ )}
95
+ {...props}
96
+ />
97
+ ));
98
+
99
+ CommandGroup.displayName = CommandPrimitive.Group.displayName;
100
+
101
+ const CommandSeparator = React.forwardRef<
102
+ React.ElementRef<typeof CommandPrimitive.Separator>,
103
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
104
+ >(({ className, ...props }, ref) => (
105
+ <CommandPrimitive.Separator
106
+ ref={ref}
107
+ className={cn("-mx-1 h-px bg-border", className)}
108
+ {...props}
109
+ />
110
+ ));
111
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
112
+
113
+ const CommandItem = React.forwardRef<
114
+ React.ElementRef<typeof CommandPrimitive.Item>,
115
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
116
+ >(({ className, ...props }, ref) => (
117
+ <CommandPrimitive.Item
118
+ ref={ref}
119
+ className={cn(
120
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",
121
+ className
122
+ )}
123
+ {...props}
124
+ />
125
+ ));
126
+
127
+ CommandItem.displayName = CommandPrimitive.Item.displayName;
128
+
129
+ const CommandShortcut = ({
130
+ className,
131
+ ...props
132
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
133
+ return (
134
+ <span
135
+ className={cn(
136
+ "ml-auto text-xs tracking-widest text-muted-foreground",
137
+ className
138
+ )}
139
+ {...props}
140
+ />
141
+ );
142
+ };
143
+ CommandShortcut.displayName = "CommandShortcut";
144
+
145
+ export {
146
+ Command,
147
+ CommandDialog,
148
+ CommandEmpty,
149
+ CommandGroup,
150
+ CommandInput,
151
+ CommandItem,
152
+ CommandList,
153
+ CommandSeparator,
154
+ CommandShortcut
155
+ };
156
+