@dinachi/cli 0.1.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 (50) hide show
  1. package/README.md +131 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +643 -0
  4. package/package.json +56 -0
  5. package/templates/accordion/accordion.tsx +85 -0
  6. package/templates/accordion/index.ts +1 -0
  7. package/templates/alert-dialog/alert-dialog.tsx +162 -0
  8. package/templates/alert-dialog/index.ts +13 -0
  9. package/templates/avatar/avatar.tsx +64 -0
  10. package/templates/avatar/index.ts +1 -0
  11. package/templates/button/button.tsx +54 -0
  12. package/templates/button/index.ts +2 -0
  13. package/templates/checkbox/checkbox.tsx +29 -0
  14. package/templates/checkbox/index.ts +1 -0
  15. package/templates/checkbox-group/checkbox-group.tsx +19 -0
  16. package/templates/checkbox-group/index.ts +1 -0
  17. package/templates/collapsible/collapsible.tsx +65 -0
  18. package/templates/collapsible/index.ts +1 -0
  19. package/templates/context-menu/context-menu.tsx +278 -0
  20. package/templates/context-menu/index.ts +17 -0
  21. package/templates/dialog/dialog.tsx +158 -0
  22. package/templates/dialog/index.ts +1 -0
  23. package/templates/field/field.tsx +119 -0
  24. package/templates/field/index.ts +1 -0
  25. package/templates/form/form.tsx +71 -0
  26. package/templates/form/index.ts +1 -0
  27. package/templates/input/index.ts +2 -0
  28. package/templates/input/input.tsx +17 -0
  29. package/templates/menubar/index.ts +18 -0
  30. package/templates/menubar/menubar.tsx +303 -0
  31. package/templates/navigation-menu/index.ts +13 -0
  32. package/templates/navigation-menu/navigation-menu.tsx +205 -0
  33. package/templates/preview-card/index.ts +1 -0
  34. package/templates/preview-card/preview-card.tsx +142 -0
  35. package/templates/select/index.ts +1 -0
  36. package/templates/select/select.tsx +208 -0
  37. package/templates/slider/index.ts +9 -0
  38. package/templates/slider/slider.tsx +121 -0
  39. package/templates/tabs/index.ts +7 -0
  40. package/templates/tabs/tabs.tsx +89 -0
  41. package/templates/toast/index.ts +1 -0
  42. package/templates/toast/toast.tsx +276 -0
  43. package/templates/toggle/index.ts +1 -0
  44. package/templates/toggle/toggle.tsx +83 -0
  45. package/templates/toolbar/index.ts +1 -0
  46. package/templates/toolbar/toolbar.tsx +124 -0
  47. package/templates/tooltip/index.ts +1 -0
  48. package/templates/tooltip/tooltip.tsx +217 -0
  49. package/templates/utils/utils.ts +7 -0
  50. package/templates/utils/variants.ts +7 -0
@@ -0,0 +1,217 @@
1
+ // @ts-nocheck
2
+ "use client";
3
+
4
+ import * as React from "react";
5
+ import { Tooltip as BaseTooltip } from "@base-ui-components/react/tooltip";
6
+ import { cn } from "@/lib/utils";
7
+
8
+ // Provider Component
9
+ const TooltipProvider = BaseTooltip.Provider;
10
+
11
+ // Root Component
12
+ const Tooltip = BaseTooltip.Root;
13
+
14
+ // Trigger Component with Base UI's native render prop support
15
+ interface TooltipTriggerProps
16
+ extends React.ComponentProps<typeof BaseTooltip.Trigger> {
17
+ variant?: "default" | "ghost" | "outline" | "icon";
18
+ size?: "default" | "sm" | "lg" | "icon";
19
+ }
20
+
21
+ const TooltipTrigger = React.forwardRef<
22
+ React.ElementRef<typeof BaseTooltip.Trigger>,
23
+ TooltipTriggerProps
24
+ >(
25
+ (
26
+ { className, variant = "ghost", size = "default", render, ...props },
27
+ ref
28
+ ) => {
29
+ const variantStyles = {
30
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
31
+ ghost: "hover:bg-accent hover:text-accent-foreground",
32
+ outline:
33
+ "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
34
+ icon: "bg-transparent hover:bg-transparent rounded-full w-fit h-fit",
35
+ };
36
+
37
+ const sizeStyles = {
38
+ default: "h-10 px-4 py-2",
39
+ sm: "h-9 rounded-md px-3",
40
+ lg: "h-11 rounded-md px-8",
41
+ icon: "size-auto",
42
+ };
43
+
44
+ const triggerClassName = cn(
45
+ "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors",
46
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
47
+ "disabled:pointer-events-none disabled:opacity-50",
48
+ "data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground",
49
+ variantStyles[variant],
50
+ sizeStyles[size],
51
+ className
52
+ );
53
+
54
+ return (
55
+ <BaseTooltip.Trigger
56
+ ref={ref}
57
+ className={triggerClassName}
58
+ render={render}
59
+ {...props}
60
+ />
61
+ );
62
+ }
63
+ );
64
+ TooltipTrigger.displayName = "TooltipTrigger";
65
+
66
+ // Portal Component
67
+ const TooltipPortal = BaseTooltip.Portal;
68
+
69
+ // Positioner Component
70
+ const TooltipPositioner = React.forwardRef<
71
+ React.ElementRef<typeof BaseTooltip.Positioner>,
72
+ React.ComponentProps<typeof BaseTooltip.Positioner>
73
+ >(({ className, sideOffset = 4, ...props }, ref) => (
74
+ <BaseTooltip.Positioner
75
+ ref={ref}
76
+ sideOffset={sideOffset}
77
+ className={cn("z-50", className)}
78
+ {...props}
79
+ />
80
+ ));
81
+ TooltipPositioner.displayName = "TooltipPositioner";
82
+
83
+ // Popup Component with variant support
84
+ interface TooltipPopupProps
85
+ extends React.ComponentProps<typeof BaseTooltip.Popup> {
86
+ variant?: "default" | "inverse";
87
+ }
88
+
89
+ const TooltipPopup = React.forwardRef<
90
+ React.ElementRef<typeof BaseTooltip.Popup>,
91
+ TooltipPopupProps
92
+ >(({ className, variant = "default", ...props }, ref) => {
93
+ const variantStyles = {
94
+ default: "bg-popover text-popover-foreground border border-border",
95
+ inverse: "bg-primary text-primary-foreground",
96
+ };
97
+
98
+ return (
99
+ <BaseTooltip.Popup
100
+ ref={ref}
101
+ className={cn(
102
+ "origin-[var(--transform-origin)] rounded-md px-3 py-1.5 text-sm shadow-md",
103
+ "transition-[transform,scale,opacity] duration-200",
104
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
105
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
106
+ variantStyles[variant],
107
+ className
108
+ )}
109
+ {...props}
110
+ />
111
+ );
112
+ });
113
+ TooltipPopup.displayName = "TooltipPopup";
114
+
115
+ // Arrow Component with custom SVG
116
+ const TooltipArrow = React.forwardRef<
117
+ React.ElementRef<typeof BaseTooltip.Arrow>,
118
+ React.ComponentProps<typeof BaseTooltip.Arrow> & {
119
+ children?: React.ReactNode;
120
+ variant?: "default" | "inverse";
121
+ }
122
+ >(({ className, children, variant = "default", ...props }, ref) => (
123
+ <BaseTooltip.Arrow
124
+ ref={ref}
125
+ className={cn(
126
+ "data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90",
127
+ "data-[side=right]:left-[-13px] data-[side=right]:-rotate-90",
128
+ "data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",
129
+ className
130
+ )}
131
+ {...props}
132
+ >
133
+ {children || <TooltipArrowSvg variant={variant} />}
134
+ </BaseTooltip.Arrow>
135
+ ));
136
+ TooltipArrow.displayName = "TooltipArrow";
137
+
138
+ // Combined Content Component for easier usage
139
+ interface TooltipContentProps extends TooltipPopupProps {
140
+ sideOffset?: number;
141
+ side?: "top" | "right" | "bottom" | "left";
142
+ align?: "start" | "center" | "end";
143
+ showArrow?: boolean;
144
+ }
145
+
146
+ const TooltipContent = React.forwardRef<
147
+ React.ElementRef<typeof BaseTooltip.Popup>,
148
+ TooltipContentProps
149
+ >(
150
+ (
151
+ {
152
+ className,
153
+ children,
154
+ sideOffset = 4,
155
+ side = "top",
156
+ align = "center",
157
+ showArrow = true,
158
+ variant = "default",
159
+ ...props
160
+ },
161
+ ref
162
+ ) => (
163
+ <TooltipPortal>
164
+ <TooltipPositioner sideOffset={sideOffset} side={side} align={align}>
165
+ <TooltipPopup
166
+ ref={ref}
167
+ className={className}
168
+ variant={variant}
169
+ {...props}
170
+ >
171
+ {showArrow && <TooltipArrow variant={variant} />}
172
+ {children}
173
+ </TooltipPopup>
174
+ </TooltipPositioner>
175
+ </TooltipPortal>
176
+ )
177
+ );
178
+ TooltipContent.displayName = "TooltipContent";
179
+
180
+ // Optimized Arrow SVG Component
181
+ const TooltipArrowSvg = React.memo(
182
+ ({
183
+ variant = "default",
184
+ ...props
185
+ }: React.ComponentProps<"svg"> & { variant?: "default" | "inverse" }) => {
186
+ const fillClasses = variant === "inverse" ? "fill-primary" : "fill-popover";
187
+
188
+ const borderClasses =
189
+ variant === "inverse" ? "fill-primary" : "fill-border";
190
+
191
+ return (
192
+ <svg width="20" height="10" viewBox="0 0 20 10" fill="none" {...props}>
193
+ <path
194
+ d="M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z"
195
+ className={fillClasses}
196
+ />
197
+ <path
198
+ d="M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z"
199
+ className={borderClasses}
200
+ />
201
+ </svg>
202
+ );
203
+ }
204
+ );
205
+ TooltipArrowSvg.displayName = "TooltipArrowSvg";
206
+
207
+ export {
208
+ TooltipProvider,
209
+ Tooltip,
210
+ TooltipTrigger,
211
+ TooltipPortal,
212
+ TooltipPositioner,
213
+ TooltipPopup,
214
+ TooltipArrow,
215
+ TooltipContent,
216
+ TooltipArrowSvg,
217
+ };
@@ -0,0 +1,7 @@
1
+ // @ts-nocheck
2
+ import { type ClassValue, clsx } from "clsx"
3
+ import { twMerge } from "tailwind-merge"
4
+
5
+ export function cn(...inputs: ClassValue[]) {
6
+ return twMerge(clsx(inputs))
7
+ }
@@ -0,0 +1,7 @@
1
+ // @ts-nocheck
2
+ // This file can contain shared utilities that are NOT component-specific
3
+ // Following shadcn pattern, component variants are embedded in each component
4
+
5
+ // Re-export common types that components might need
6
+ export type { VariantProps } from 'class-variance-authority'
7
+ export { cva } from 'class-variance-authority'