@openconsole/shadcn 0.0.0 → 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.
Files changed (73) hide show
  1. package/README.md +380 -0
  2. package/accordion.tsx +66 -66
  3. package/alert-dialog.tsx +196 -196
  4. package/alert.tsx +66 -66
  5. package/aspect-ratio.tsx +11 -11
  6. package/avatar.tsx +53 -53
  7. package/badge.tsx +46 -46
  8. package/breadcrumb.tsx +109 -109
  9. package/button-group.tsx +83 -83
  10. package/button.tsx +60 -60
  11. package/calendar.tsx +219 -219
  12. package/card.tsx +92 -92
  13. package/carousel.tsx +241 -241
  14. package/chart.tsx +374 -374
  15. package/checkbox.tsx +32 -32
  16. package/collapsible.tsx +33 -33
  17. package/command.tsx +184 -184
  18. package/context-menu.tsx +252 -252
  19. package/dialog.tsx +143 -143
  20. package/direction.tsx +22 -22
  21. package/drawer.tsx +135 -135
  22. package/dropdown-menu.tsx +257 -257
  23. package/empty.tsx +104 -104
  24. package/field.tsx +248 -248
  25. package/form.tsx +167 -167
  26. package/hooks/index.ts +1 -1
  27. package/hooks/use-mobile.ts +19 -19
  28. package/hover-card.tsx +44 -44
  29. package/icon.tsx +21 -21
  30. package/index.ts +59 -59
  31. package/input-group.tsx +170 -170
  32. package/input-otp.tsx +77 -77
  33. package/input.tsx +21 -21
  34. package/item.tsx +193 -193
  35. package/kbd.tsx +28 -28
  36. package/label.tsx +24 -24
  37. package/lib/index.ts +1 -1
  38. package/lib/utils.ts +6 -6
  39. package/menubar.tsx +276 -276
  40. package/native-select.tsx +62 -62
  41. package/navigation-menu.tsx +168 -168
  42. package/package.json +10 -2
  43. package/pagination.tsx +127 -127
  44. package/popover.tsx +89 -89
  45. package/progress.tsx +31 -31
  46. package/radio-group.tsx +45 -45
  47. package/resizable.tsx +53 -53
  48. package/scroll-area.tsx +58 -58
  49. package/select.tsx +187 -187
  50. package/separator.tsx +28 -28
  51. package/sheet.tsx +139 -139
  52. package/sidebar.tsx +724 -724
  53. package/skeleton.tsx +13 -13
  54. package/slider.tsx +63 -63
  55. package/sonner.tsx +40 -40
  56. package/spinner.tsx +16 -16
  57. package/styles.css +122 -0
  58. package/switch.tsx +35 -35
  59. package/table.tsx +116 -116
  60. package/tabs.tsx +66 -66
  61. package/textarea.tsx +18 -18
  62. package/toggle-group.tsx +83 -83
  63. package/toggle.tsx +47 -47
  64. package/tooltip.tsx +61 -61
  65. package/tsconfig.json +12 -12
  66. package/tsconfig.tsbuildinfo +1 -1
  67. package/skill/SKILL.md +0 -599
  68. package/skill/customization.md +0 -263
  69. package/skill/rules/base-vs-radix.md +0 -167
  70. package/skill/rules/composition.md +0 -240
  71. package/skill/rules/forms.md +0 -271
  72. package/skill/rules/icons.md +0 -136
  73. package/skill/rules/styling.md +0 -180
package/skeleton.tsx CHANGED
@@ -1,13 +1,13 @@
1
- import { cn } from "./lib/utils";
2
-
3
- function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
4
- return (
5
- <div
6
- data-slot="skeleton"
7
- className={cn("bg-accent animate-pulse rounded-md", className)}
8
- {...props}
9
- />
10
- );
11
- }
12
-
13
- export { Skeleton };
1
+ import { cn } from "./lib/utils";
2
+
3
+ function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
4
+ return (
5
+ <div
6
+ data-slot="skeleton"
7
+ className={cn("bg-accent animate-pulse rounded-md", className)}
8
+ {...props}
9
+ />
10
+ );
11
+ }
12
+
13
+ export { Skeleton };
package/slider.tsx CHANGED
@@ -1,63 +1,63 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { Slider as SliderPrimitive } from "radix-ui"
5
-
6
- import { cn } from "./lib/utils"
7
-
8
- function Slider({
9
- className,
10
- defaultValue,
11
- value,
12
- min = 0,
13
- max = 100,
14
- ...props
15
- }: React.ComponentProps<typeof SliderPrimitive.Root>) {
16
- const _values = React.useMemo(
17
- () =>
18
- Array.isArray(value)
19
- ? value
20
- : Array.isArray(defaultValue)
21
- ? defaultValue
22
- : [min, max],
23
- [value, defaultValue, min, max]
24
- )
25
-
26
- return (
27
- <SliderPrimitive.Root
28
- data-slot="slider"
29
- defaultValue={defaultValue}
30
- value={value}
31
- min={min}
32
- max={max}
33
- className={cn(
34
- "relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
35
- className
36
- )}
37
- {...props}
38
- >
39
- <SliderPrimitive.Track
40
- data-slot="slider-track"
41
- className={cn(
42
- "relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
43
- )}
44
- >
45
- <SliderPrimitive.Range
46
- data-slot="slider-range"
47
- className={cn(
48
- "absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
49
- )}
50
- />
51
- </SliderPrimitive.Track>
52
- {Array.from({ length: _values.length }, (_, index) => (
53
- <SliderPrimitive.Thumb
54
- data-slot="slider-thumb"
55
- key={index}
56
- className="block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
57
- />
58
- ))}
59
- </SliderPrimitive.Root>
60
- )
61
- }
62
-
63
- export { Slider }
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Slider as SliderPrimitive } from "radix-ui"
5
+
6
+ import { cn } from "./lib/utils"
7
+
8
+ function Slider({
9
+ className,
10
+ defaultValue,
11
+ value,
12
+ min = 0,
13
+ max = 100,
14
+ ...props
15
+ }: React.ComponentProps<typeof SliderPrimitive.Root>) {
16
+ const _values = React.useMemo(
17
+ () =>
18
+ Array.isArray(value)
19
+ ? value
20
+ : Array.isArray(defaultValue)
21
+ ? defaultValue
22
+ : [min, max],
23
+ [value, defaultValue, min, max]
24
+ )
25
+
26
+ return (
27
+ <SliderPrimitive.Root
28
+ data-slot="slider"
29
+ defaultValue={defaultValue}
30
+ value={value}
31
+ min={min}
32
+ max={max}
33
+ className={cn(
34
+ "relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
35
+ className
36
+ )}
37
+ {...props}
38
+ >
39
+ <SliderPrimitive.Track
40
+ data-slot="slider-track"
41
+ className={cn(
42
+ "relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
43
+ )}
44
+ >
45
+ <SliderPrimitive.Range
46
+ data-slot="slider-range"
47
+ className={cn(
48
+ "absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
49
+ )}
50
+ />
51
+ </SliderPrimitive.Track>
52
+ {Array.from({ length: _values.length }, (_, index) => (
53
+ <SliderPrimitive.Thumb
54
+ data-slot="slider-thumb"
55
+ key={index}
56
+ className="block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
57
+ />
58
+ ))}
59
+ </SliderPrimitive.Root>
60
+ )
61
+ }
62
+
63
+ export { Slider }
package/sonner.tsx CHANGED
@@ -1,40 +1,40 @@
1
- "use client";
2
-
3
- import {
4
- CircleCheckIcon,
5
- InfoIcon,
6
- Loader2Icon,
7
- OctagonXIcon,
8
- TriangleAlertIcon,
9
- } from "lucide-react";
10
- import { useTheme } from "next-themes";
11
- import { Toaster as Sonner, type ToasterProps } from "sonner";
12
-
13
- const Toaster = ({ ...props }: ToasterProps) => {
14
- const { theme = "system" } = useTheme();
15
-
16
- return (
17
- <Sonner
18
- theme={theme as ToasterProps["theme"]}
19
- className="toaster group [&_div[data-content]]:w-full"
20
- icons={{
21
- success: <CircleCheckIcon className="size-4" />,
22
- info: <InfoIcon className="size-4" />,
23
- warning: <TriangleAlertIcon className="size-4" />,
24
- error: <OctagonXIcon className="size-4" />,
25
- loading: <Loader2Icon className="size-4 animate-spin" />,
26
- }}
27
- style={
28
- {
29
- "--normal-bg": "var(--popover)",
30
- "--normal-text": "var(--popover-foreground)",
31
- "--normal-border": "var(--border)",
32
- "--border-radius": "var(--radius)",
33
- } as React.CSSProperties
34
- }
35
- {...props}
36
- />
37
- );
38
- };
39
-
40
- export { Toaster };
1
+ "use client";
2
+
3
+ import {
4
+ CircleCheckIcon,
5
+ InfoIcon,
6
+ Loader2Icon,
7
+ OctagonXIcon,
8
+ TriangleAlertIcon,
9
+ } from "lucide-react";
10
+ import { useTheme } from "next-themes";
11
+ import { Toaster as Sonner, type ToasterProps } from "sonner";
12
+
13
+ const Toaster = ({ ...props }: ToasterProps) => {
14
+ const { theme = "system" } = useTheme();
15
+
16
+ return (
17
+ <Sonner
18
+ theme={theme as ToasterProps["theme"]}
19
+ className="toaster group [&_div[data-content]]:w-full"
20
+ icons={{
21
+ success: <CircleCheckIcon className="size-4" />,
22
+ info: <InfoIcon className="size-4" />,
23
+ warning: <TriangleAlertIcon className="size-4" />,
24
+ error: <OctagonXIcon className="size-4" />,
25
+ loading: <Loader2Icon className="size-4 animate-spin" />,
26
+ }}
27
+ style={
28
+ {
29
+ "--normal-bg": "var(--popover)",
30
+ "--normal-text": "var(--popover-foreground)",
31
+ "--normal-border": "var(--border)",
32
+ "--border-radius": "var(--radius)",
33
+ } as React.CSSProperties
34
+ }
35
+ {...props}
36
+ />
37
+ );
38
+ };
39
+
40
+ export { Toaster };
package/spinner.tsx CHANGED
@@ -1,16 +1,16 @@
1
- import { Loader2Icon } from "lucide-react"
2
-
3
- import { cn } from "./lib/utils"
4
-
5
- function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
6
- return (
7
- <Loader2Icon
8
- role="status"
9
- aria-label="Loading"
10
- className={cn("size-4 animate-spin", className)}
11
- {...props}
12
- />
13
- )
14
- }
15
-
16
- export { Spinner }
1
+ import { Loader2Icon } from "lucide-react"
2
+
3
+ import { cn } from "./lib/utils"
4
+
5
+ function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
6
+ return (
7
+ <Loader2Icon
8
+ role="status"
9
+ aria-label="Loading"
10
+ className={cn("size-4 animate-spin", className)}
11
+ {...props}
12
+ />
13
+ )
14
+ }
15
+
16
+ export { Spinner }
package/styles.css ADDED
@@ -0,0 +1,122 @@
1
+ @import "tw-animate-css";
2
+
3
+ /* Register this package's source files as Tailwind content sources. */
4
+ @source "./**/*.{ts,tsx}";
5
+
6
+ @custom-variant dark (&:is(.dark *));
7
+
8
+ @theme inline {
9
+ --color-background: var(--background);
10
+ --color-foreground: var(--foreground);
11
+ --color-sidebar-ring: var(--sidebar-ring);
12
+ --color-sidebar-border: var(--sidebar-border);
13
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
14
+ --color-sidebar-accent: var(--sidebar-accent);
15
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
16
+ --color-sidebar-primary: var(--sidebar-primary);
17
+ --color-sidebar-foreground: var(--sidebar-foreground);
18
+ --color-sidebar: var(--sidebar);
19
+ --color-chart-5: var(--chart-5);
20
+ --color-chart-4: var(--chart-4);
21
+ --color-chart-3: var(--chart-3);
22
+ --color-chart-2: var(--chart-2);
23
+ --color-chart-1: var(--chart-1);
24
+ --color-ring: var(--ring);
25
+ --color-input: var(--input);
26
+ --color-border: var(--border);
27
+ --color-destructive: var(--destructive);
28
+ --color-accent-foreground: var(--accent-foreground);
29
+ --color-accent: var(--accent);
30
+ --color-muted-foreground: var(--muted-foreground);
31
+ --color-muted: var(--muted);
32
+ --color-secondary-foreground: var(--secondary-foreground);
33
+ --color-secondary: var(--secondary);
34
+ --color-primary-foreground: var(--primary-foreground);
35
+ --color-primary: var(--primary);
36
+ --color-popover-foreground: var(--popover-foreground);
37
+ --color-popover: var(--popover);
38
+ --color-card-foreground: var(--card-foreground);
39
+ --color-card: var(--card);
40
+ --radius-sm: calc(var(--radius) - 4px);
41
+ --radius-md: calc(var(--radius) - 2px);
42
+ --radius-lg: var(--radius);
43
+ --radius-xl: calc(var(--radius) + 4px);
44
+ }
45
+
46
+ :root {
47
+ --radius: 0.625rem;
48
+ --background: oklch(1 0 0);
49
+ --foreground: oklch(0.145 0 0);
50
+ --card: oklch(1 0 0);
51
+ --card-foreground: oklch(0.145 0 0);
52
+ --popover: oklch(1 0 0);
53
+ --popover-foreground: oklch(0.145 0 0);
54
+ --primary: oklch(0.205 0 0);
55
+ --primary-foreground: oklch(0.985 0 0);
56
+ --secondary: oklch(0.97 0 0);
57
+ --secondary-foreground: oklch(0.205 0 0);
58
+ --muted: oklch(0.97 0 0);
59
+ --muted-foreground: oklch(0.556 0 0);
60
+ --accent: oklch(0.97 0 0);
61
+ --accent-foreground: oklch(0.205 0 0);
62
+ --destructive: oklch(0.577 0.245 27.325);
63
+ --border: oklch(0.922 0 0);
64
+ --input: oklch(0.922 0 0);
65
+ --ring: oklch(0.708 0 0);
66
+ --chart-1: oklch(0.646 0.222 41.116);
67
+ --chart-2: oklch(0.6 0.118 184.704);
68
+ --chart-3: oklch(0.398 0.07 227.392);
69
+ --chart-4: oklch(0.828 0.189 84.429);
70
+ --chart-5: oklch(0.769 0.188 70.08);
71
+ --sidebar: oklch(0.985 0 0);
72
+ --sidebar-foreground: oklch(0.145 0 0);
73
+ --sidebar-primary: oklch(0.205 0 0);
74
+ --sidebar-primary-foreground: oklch(0.985 0 0);
75
+ --sidebar-accent: oklch(0.97 0 0);
76
+ --sidebar-accent-foreground: oklch(0.205 0 0);
77
+ --sidebar-border: oklch(0.922 0 0);
78
+ --sidebar-ring: oklch(0.708 0 0);
79
+ }
80
+
81
+ .dark {
82
+ --background: oklch(0.145 0 0);
83
+ --foreground: oklch(0.985 0 0);
84
+ --card: oklch(0.205 0 0);
85
+ --card-foreground: oklch(0.985 0 0);
86
+ --popover: oklch(0.205 0 0);
87
+ --popover-foreground: oklch(0.985 0 0);
88
+ --primary: oklch(0.922 0 0);
89
+ --primary-foreground: oklch(0.205 0 0);
90
+ --secondary: oklch(0.269 0 0);
91
+ --secondary-foreground: oklch(0.985 0 0);
92
+ --muted: oklch(0.269 0 0);
93
+ --muted-foreground: oklch(0.708 0 0);
94
+ --accent: oklch(0.269 0 0);
95
+ --accent-foreground: oklch(0.985 0 0);
96
+ --destructive: oklch(0.704 0.191 22.216);
97
+ --border: oklch(1 0 0 / 10%);
98
+ --input: oklch(1 0 0 / 15%);
99
+ --ring: oklch(0.556 0 0);
100
+ --chart-1: oklch(0.488 0.243 264.376);
101
+ --chart-2: oklch(0.696 0.17 162.48);
102
+ --chart-3: oklch(0.769 0.188 70.08);
103
+ --chart-4: oklch(0.627 0.265 303.9);
104
+ --chart-5: oklch(0.645 0.246 16.439);
105
+ --sidebar: oklch(0.205 0 0);
106
+ --sidebar-foreground: oklch(0.985 0 0);
107
+ --sidebar-primary: oklch(0.488 0.243 264.376);
108
+ --sidebar-primary-foreground: oklch(0.985 0 0);
109
+ --sidebar-accent: oklch(0.269 0 0);
110
+ --sidebar-accent-foreground: oklch(0.985 0 0);
111
+ --sidebar-border: oklch(1 0 0 / 10%);
112
+ --sidebar-ring: oklch(0.556 0 0);
113
+ }
114
+
115
+ @layer base {
116
+ * {
117
+ @apply border-border outline-ring/50;
118
+ }
119
+ body {
120
+ @apply bg-background text-foreground;
121
+ }
122
+ }
package/switch.tsx CHANGED
@@ -1,35 +1,35 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { Switch as SwitchPrimitive } from "radix-ui"
5
-
6
- import { cn } from "./lib/utils"
7
-
8
- function Switch({
9
- className,
10
- size = "default",
11
- ...props
12
- }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
13
- size?: "sm" | "default"
14
- }) {
15
- return (
16
- <SwitchPrimitive.Root
17
- data-slot="switch"
18
- data-size={size}
19
- className={cn(
20
- "peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
21
- className
22
- )}
23
- {...props}
24
- >
25
- <SwitchPrimitive.Thumb
26
- data-slot="switch-thumb"
27
- className={cn(
28
- "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"
29
- )}
30
- />
31
- </SwitchPrimitive.Root>
32
- )
33
- }
34
-
35
- export { Switch }
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Switch as SwitchPrimitive } from "radix-ui"
5
+
6
+ import { cn } from "./lib/utils"
7
+
8
+ function Switch({
9
+ className,
10
+ size = "default",
11
+ ...props
12
+ }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
13
+ size?: "sm" | "default"
14
+ }) {
15
+ return (
16
+ <SwitchPrimitive.Root
17
+ data-slot="switch"
18
+ data-size={size}
19
+ className={cn(
20
+ "peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
21
+ className
22
+ )}
23
+ {...props}
24
+ >
25
+ <SwitchPrimitive.Thumb
26
+ data-slot="switch-thumb"
27
+ className={cn(
28
+ "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"
29
+ )}
30
+ />
31
+ </SwitchPrimitive.Root>
32
+ )
33
+ }
34
+
35
+ export { Switch }