create-reactivite 1.4.0 → 1.6.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 (132) hide show
  1. package/README.md +326 -290
  2. package/index.js +1 -1
  3. package/package.json +4 -2
  4. package/template/package.json +22 -22
  5. package/template/pnpm-lock.yaml +3274 -3274
  6. package/template/src/components/author-credit.tsx +25 -25
  7. package/template2/.env.example +8 -8
  8. package/template2/.husky/pre-commit +4 -4
  9. package/template2/.prettierrc +5 -5
  10. package/template2/README.md +73 -73
  11. package/template2/__tests__/example.test.ts +20 -20
  12. package/template2/_gitignore +37 -37
  13. package/template2/app/[locale]/(private)/dashboard/page.tsx +52 -52
  14. package/template2/app/[locale]/(public)/login/page.tsx +83 -83
  15. package/template2/app/[locale]/layout.tsx +58 -58
  16. package/template2/app/[locale]/locales.ts +10 -10
  17. package/template2/app/[locale]/page.tsx +38 -38
  18. package/template2/app/api/clear-session/route.ts +10 -10
  19. package/template2/app/globals.css +127 -127
  20. package/template2/app/layout.tsx +7 -7
  21. package/template2/app/page.tsx +6 -6
  22. package/template2/components/AuthEventListener.tsx +22 -22
  23. package/template2/components/author-credit.tsx +25 -25
  24. package/template2/components/theme-provider.tsx +78 -78
  25. package/template2/components/ui/button.tsx +60 -60
  26. package/template2/components/ui/card.tsx +92 -92
  27. package/template2/components/ui/input.tsx +21 -21
  28. package/template2/components/ui/label.tsx +24 -24
  29. package/template2/components/ui/sonner.tsx +40 -40
  30. package/template2/components.json +22 -22
  31. package/template2/config/constants.ts +7 -7
  32. package/template2/config/env.ts +5 -5
  33. package/template2/contexts/translation-context.tsx +70 -70
  34. package/template2/eslint.config.mjs +18 -18
  35. package/template2/hoc/provider.tsx +27 -27
  36. package/template2/lib/paramsSerializer.ts +40 -40
  37. package/template2/lib/utils.ts +6 -6
  38. package/template2/locales/az.json +20 -20
  39. package/template2/locales/en.json +20 -20
  40. package/template2/next-env.d.ts +1 -1
  41. package/template2/next.config.ts +17 -17
  42. package/template2/orval.config.ts +66 -66
  43. package/template2/package.json +62 -62
  44. package/template2/postcss.config.mjs +7 -7
  45. package/template2/scripts/fix-generated-types.mjs +13 -13
  46. package/template2/services/generated/.gitkeep +2 -2
  47. package/template2/services/httpClient/httpClient.ts +70 -70
  48. package/template2/services/httpClient/orvalMutator.ts +10 -10
  49. package/template2/store/example-store.tsx +16 -16
  50. package/template2/store/user-store.tsx +29 -29
  51. package/template2/testing/msw/handlers/index.ts +6 -6
  52. package/template2/testing/msw/server.ts +4 -4
  53. package/template2/tsconfig.json +34 -34
  54. package/template2/vitest.config.ts +17 -17
  55. package/template2/vitest.setup.ts +7 -7
  56. package/template3/README.md +34 -34
  57. package/template3/_gitignore +16 -16
  58. package/template3/components.json +21 -0
  59. package/template3/index.html +8 -2
  60. package/template3/package-lock.json +3934 -0
  61. package/template3/package.json +48 -22
  62. package/template3/postcss.config.mjs +5 -0
  63. package/template3/rspack.config.mjs +59 -51
  64. package/template3/src/App.tsx +16 -11
  65. package/template3/src/components/author-credit.tsx +42 -42
  66. package/template3/src/components/layout.tsx +59 -0
  67. package/template3/src/components/matrix-rain.tsx +71 -0
  68. package/template3/src/components/ui/accordion.tsx +64 -0
  69. package/template3/src/components/ui/alert-dialog.tsx +196 -0
  70. package/template3/src/components/ui/alert.tsx +66 -0
  71. package/template3/src/components/ui/aspect-ratio.tsx +11 -0
  72. package/template3/src/components/ui/avatar.tsx +107 -0
  73. package/template3/src/components/ui/badge.tsx +48 -0
  74. package/template3/src/components/ui/breadcrumb.tsx +109 -0
  75. package/template3/src/components/ui/button-group.tsx +83 -0
  76. package/template3/src/components/ui/button.tsx +64 -0
  77. package/template3/src/components/ui/calendar.tsx +218 -0
  78. package/template3/src/components/ui/card.tsx +92 -0
  79. package/template3/src/components/ui/carousel.tsx +241 -0
  80. package/template3/src/components/ui/chart.tsx +372 -0
  81. package/template3/src/components/ui/checkbox.tsx +32 -0
  82. package/template3/src/components/ui/collapsible.tsx +31 -0
  83. package/template3/src/components/ui/combobox.tsx +310 -0
  84. package/template3/src/components/ui/command.tsx +184 -0
  85. package/template3/src/components/ui/context-menu.tsx +252 -0
  86. package/template3/src/components/ui/dialog.tsx +156 -0
  87. package/template3/src/components/ui/direction.tsx +22 -0
  88. package/template3/src/components/ui/drawer.tsx +133 -0
  89. package/template3/src/components/ui/dropdown-menu.tsx +257 -0
  90. package/template3/src/components/ui/empty.tsx +104 -0
  91. package/template3/src/components/ui/field.tsx +248 -0
  92. package/template3/src/components/ui/form.tsx +165 -0
  93. package/template3/src/components/ui/hover-card.tsx +42 -0
  94. package/template3/src/components/ui/input-group.tsx +168 -0
  95. package/template3/src/components/ui/input-otp.tsx +77 -0
  96. package/template3/src/components/ui/input.tsx +21 -0
  97. package/template3/src/components/ui/item.tsx +193 -0
  98. package/template3/src/components/ui/kbd.tsx +28 -0
  99. package/template3/src/components/ui/label.tsx +22 -0
  100. package/template3/src/components/ui/menubar.tsx +276 -0
  101. package/template3/src/components/ui/native-select.tsx +62 -0
  102. package/template3/src/components/ui/navigation-menu.tsx +168 -0
  103. package/template3/src/components/ui/pagination.tsx +127 -0
  104. package/template3/src/components/ui/popover.tsx +87 -0
  105. package/template3/src/components/ui/progress.tsx +31 -0
  106. package/template3/src/components/ui/radio-group.tsx +43 -0
  107. package/template3/src/components/ui/resizable.tsx +53 -0
  108. package/template3/src/components/ui/scroll-area.tsx +56 -0
  109. package/template3/src/components/ui/select.tsx +190 -0
  110. package/template3/src/components/ui/separator.tsx +26 -0
  111. package/template3/src/components/ui/sheet.tsx +143 -0
  112. package/template3/src/components/ui/sidebar.tsx +724 -0
  113. package/template3/src/components/ui/skeleton.tsx +13 -0
  114. package/template3/src/components/ui/slider.tsx +61 -0
  115. package/template3/src/components/ui/sonner.tsx +40 -0
  116. package/template3/src/components/ui/spinner.tsx +16 -0
  117. package/template3/src/components/ui/switch.tsx +33 -0
  118. package/template3/src/components/ui/table.tsx +116 -0
  119. package/template3/src/components/ui/tabs.tsx +89 -0
  120. package/template3/src/components/ui/textarea.tsx +18 -0
  121. package/template3/src/components/ui/toggle-group.tsx +83 -0
  122. package/template3/src/components/ui/toggle.tsx +47 -0
  123. package/template3/src/components/ui/tooltip.tsx +55 -0
  124. package/template3/src/hooks/use-mobile.ts +19 -0
  125. package/template3/src/index.css +175 -32
  126. package/template3/src/lib/utils.ts +6 -0
  127. package/template3/src/main.tsx +10 -10
  128. package/template3/src/pages/about.tsx +113 -0
  129. package/template3/src/pages/contact.tsx +111 -0
  130. package/template3/src/pages/home.tsx +81 -0
  131. package/template3/tsconfig.json +24 -20
  132. package/template2/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,372 @@
1
+ import * as React from "react"
2
+ import * as RechartsPrimitive from "recharts"
3
+ import type { TooltipValueType } from "recharts"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ // Format: { THEME_NAME: CSS_SELECTOR }
8
+ const THEMES = { light: "", dark: ".dark" } as const
9
+
10
+ const INITIAL_DIMENSION = { width: 320, height: 200 } as const
11
+ type TooltipNameType = number | string
12
+
13
+ export type ChartConfig = Record<
14
+ string,
15
+ {
16
+ label?: React.ReactNode
17
+ icon?: React.ComponentType
18
+ } & (
19
+ | { color?: string; theme?: never }
20
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
21
+ )
22
+ >
23
+
24
+ type ChartContextProps = {
25
+ config: ChartConfig
26
+ }
27
+
28
+ const ChartContext = React.createContext<ChartContextProps | null>(null)
29
+
30
+ function useChart() {
31
+ const context = React.useContext(ChartContext)
32
+
33
+ if (!context) {
34
+ throw new Error("useChart must be used within a <ChartContainer />")
35
+ }
36
+
37
+ return context
38
+ }
39
+
40
+ function ChartContainer({
41
+ id,
42
+ className,
43
+ children,
44
+ config,
45
+ initialDimension = INITIAL_DIMENSION,
46
+ ...props
47
+ }: React.ComponentProps<"div"> & {
48
+ config: ChartConfig
49
+ children: React.ComponentProps<
50
+ typeof RechartsPrimitive.ResponsiveContainer
51
+ >["children"]
52
+ initialDimension?: {
53
+ width: number
54
+ height: number
55
+ }
56
+ }) {
57
+ const uniqueId = React.useId()
58
+ const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`
59
+
60
+ return (
61
+ <ChartContext.Provider value={{ config }}>
62
+ <div
63
+ data-slot="chart"
64
+ data-chart={chartId}
65
+ className={cn(
66
+ "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
67
+ className
68
+ )}
69
+ {...props}
70
+ >
71
+ <ChartStyle id={chartId} config={config} />
72
+ <RechartsPrimitive.ResponsiveContainer
73
+ initialDimension={initialDimension}
74
+ >
75
+ {children}
76
+ </RechartsPrimitive.ResponsiveContainer>
77
+ </div>
78
+ </ChartContext.Provider>
79
+ )
80
+ }
81
+
82
+ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
83
+ const colorConfig = Object.entries(config).filter(
84
+ ([, config]) => config.theme ?? config.color
85
+ )
86
+
87
+ if (!colorConfig.length) {
88
+ return null
89
+ }
90
+
91
+ return (
92
+ <style
93
+ dangerouslySetInnerHTML={{
94
+ __html: Object.entries(THEMES)
95
+ .map(
96
+ ([theme, prefix]) => `
97
+ ${prefix} [data-chart=${id}] {
98
+ ${colorConfig
99
+ .map(([key, itemConfig]) => {
100
+ const color =
101
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??
102
+ itemConfig.color
103
+ return color ? ` --color-${key}: ${color};` : null
104
+ })
105
+ .join("\n")}
106
+ }
107
+ `
108
+ )
109
+ .join("\n"),
110
+ }}
111
+ />
112
+ )
113
+ }
114
+
115
+ const ChartTooltip = RechartsPrimitive.Tooltip
116
+
117
+ function ChartTooltipContent({
118
+ active,
119
+ payload,
120
+ className,
121
+ indicator = "dot",
122
+ hideLabel = false,
123
+ hideIndicator = false,
124
+ label,
125
+ labelFormatter,
126
+ labelClassName,
127
+ formatter,
128
+ color,
129
+ nameKey,
130
+ labelKey,
131
+ }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
132
+ React.ComponentProps<"div"> & {
133
+ hideLabel?: boolean
134
+ hideIndicator?: boolean
135
+ indicator?: "line" | "dot" | "dashed"
136
+ nameKey?: string
137
+ labelKey?: string
138
+ } & Omit<
139
+ RechartsPrimitive.DefaultTooltipContentProps<
140
+ TooltipValueType,
141
+ TooltipNameType
142
+ >,
143
+ "accessibilityLayer"
144
+ >) {
145
+ const { config } = useChart()
146
+
147
+ const tooltipLabel = React.useMemo(() => {
148
+ if (hideLabel || !payload?.length) {
149
+ return null
150
+ }
151
+
152
+ const [item] = payload
153
+ const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`
154
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
155
+ const value =
156
+ !labelKey && typeof label === "string"
157
+ ? (config[label]?.label ?? label)
158
+ : itemConfig?.label
159
+
160
+ if (labelFormatter) {
161
+ return (
162
+ <div className={cn("font-medium", labelClassName)}>
163
+ {labelFormatter(value, payload)}
164
+ </div>
165
+ )
166
+ }
167
+
168
+ if (!value) {
169
+ return null
170
+ }
171
+
172
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>
173
+ }, [
174
+ label,
175
+ labelFormatter,
176
+ payload,
177
+ hideLabel,
178
+ labelClassName,
179
+ config,
180
+ labelKey,
181
+ ])
182
+
183
+ if (!active || !payload?.length) {
184
+ return null
185
+ }
186
+
187
+ const nestLabel = payload.length === 1 && indicator !== "dot"
188
+
189
+ return (
190
+ <div
191
+ className={cn(
192
+ "grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
193
+ className
194
+ )}
195
+ >
196
+ {!nestLabel ? tooltipLabel : null}
197
+ <div className="grid gap-1.5">
198
+ {payload
199
+ .filter((item) => item.type !== "none")
200
+ .map((item, index) => {
201
+ const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`
202
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
203
+ const indicatorColor = color ?? item.payload?.fill ?? item.color
204
+
205
+ return (
206
+ <div
207
+ key={index}
208
+ className={cn(
209
+ "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
210
+ indicator === "dot" && "items-center"
211
+ )}
212
+ >
213
+ {formatter && item?.value !== undefined && item.name ? (
214
+ formatter(item.value, item.name, item, index, item.payload)
215
+ ) : (
216
+ <>
217
+ {itemConfig?.icon ? (
218
+ <itemConfig.icon />
219
+ ) : (
220
+ !hideIndicator && (
221
+ <div
222
+ className={cn(
223
+ "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
224
+ {
225
+ "h-2.5 w-2.5": indicator === "dot",
226
+ "w-1": indicator === "line",
227
+ "w-0 border-[1.5px] border-dashed bg-transparent":
228
+ indicator === "dashed",
229
+ "my-0.5": nestLabel && indicator === "dashed",
230
+ }
231
+ )}
232
+ style={
233
+ {
234
+ "--color-bg": indicatorColor,
235
+ "--color-border": indicatorColor,
236
+ } as React.CSSProperties
237
+ }
238
+ />
239
+ )
240
+ )}
241
+ <div
242
+ className={cn(
243
+ "flex flex-1 justify-between leading-none",
244
+ nestLabel ? "items-end" : "items-center"
245
+ )}
246
+ >
247
+ <div className="grid gap-1.5">
248
+ {nestLabel ? tooltipLabel : null}
249
+ <span className="text-muted-foreground">
250
+ {itemConfig?.label ?? item.name}
251
+ </span>
252
+ </div>
253
+ {item.value != null && (
254
+ <span className="font-mono font-medium text-foreground tabular-nums">
255
+ {typeof item.value === "number"
256
+ ? item.value.toLocaleString()
257
+ : String(item.value)}
258
+ </span>
259
+ )}
260
+ </div>
261
+ </>
262
+ )}
263
+ </div>
264
+ )
265
+ })}
266
+ </div>
267
+ </div>
268
+ )
269
+ }
270
+
271
+ const ChartLegend = RechartsPrimitive.Legend
272
+
273
+ function ChartLegendContent({
274
+ className,
275
+ hideIcon = false,
276
+ payload,
277
+ verticalAlign = "bottom",
278
+ nameKey,
279
+ }: React.ComponentProps<"div"> & {
280
+ hideIcon?: boolean
281
+ nameKey?: string
282
+ } & RechartsPrimitive.DefaultLegendContentProps) {
283
+ const { config } = useChart()
284
+
285
+ if (!payload?.length) {
286
+ return null
287
+ }
288
+
289
+ return (
290
+ <div
291
+ className={cn(
292
+ "flex items-center justify-center gap-4",
293
+ verticalAlign === "top" ? "pb-3" : "pt-3",
294
+ className
295
+ )}
296
+ >
297
+ {payload
298
+ .filter((item) => item.type !== "none")
299
+ .map((item, index) => {
300
+ const key = `${nameKey ?? item.dataKey ?? "value"}`
301
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
302
+
303
+ return (
304
+ <div
305
+ key={index}
306
+ className={cn(
307
+ "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
308
+ )}
309
+ >
310
+ {itemConfig?.icon && !hideIcon ? (
311
+ <itemConfig.icon />
312
+ ) : (
313
+ <div
314
+ className="h-2 w-2 shrink-0 rounded-[2px]"
315
+ style={{
316
+ backgroundColor: item.color,
317
+ }}
318
+ />
319
+ )}
320
+ {itemConfig?.label}
321
+ </div>
322
+ )
323
+ })}
324
+ </div>
325
+ )
326
+ }
327
+
328
+ // Helper to extract item config from a payload.
329
+ function getPayloadConfigFromPayload(
330
+ config: ChartConfig,
331
+ payload: unknown,
332
+ key: string
333
+ ) {
334
+ if (typeof payload !== "object" || payload === null) {
335
+ return undefined
336
+ }
337
+
338
+ const payloadPayload =
339
+ "payload" in payload &&
340
+ typeof payload.payload === "object" &&
341
+ payload.payload !== null
342
+ ? payload.payload
343
+ : undefined
344
+
345
+ let configLabelKey: string = key
346
+
347
+ if (
348
+ key in payload &&
349
+ typeof payload[key as keyof typeof payload] === "string"
350
+ ) {
351
+ configLabelKey = payload[key as keyof typeof payload] as string
352
+ } else if (
353
+ payloadPayload &&
354
+ key in payloadPayload &&
355
+ typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
356
+ ) {
357
+ configLabelKey = payloadPayload[
358
+ key as keyof typeof payloadPayload
359
+ ] as string
360
+ }
361
+
362
+ return configLabelKey in config ? config[configLabelKey] : config[key]
363
+ }
364
+
365
+ export {
366
+ ChartContainer,
367
+ ChartTooltip,
368
+ ChartTooltipContent,
369
+ ChartLegend,
370
+ ChartLegendContent,
371
+ ChartStyle,
372
+ }
@@ -0,0 +1,32 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { CheckIcon } from "lucide-react"
5
+ import { Checkbox as CheckboxPrimitive } from "radix-ui"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ function Checkbox({
10
+ className,
11
+ ...props
12
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
13
+ return (
14
+ <CheckboxPrimitive.Root
15
+ data-slot="checkbox"
16
+ className={cn(
17
+ "peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",
18
+ className
19
+ )}
20
+ {...props}
21
+ >
22
+ <CheckboxPrimitive.Indicator
23
+ data-slot="checkbox-indicator"
24
+ className="grid place-content-center text-current transition-none"
25
+ >
26
+ <CheckIcon className="size-3.5" />
27
+ </CheckboxPrimitive.Indicator>
28
+ </CheckboxPrimitive.Root>
29
+ )
30
+ }
31
+
32
+ export { Checkbox }
@@ -0,0 +1,31 @@
1
+ import { Collapsible as CollapsiblePrimitive } from "radix-ui"
2
+
3
+ function Collapsible({
4
+ ...props
5
+ }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
6
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
7
+ }
8
+
9
+ function CollapsibleTrigger({
10
+ ...props
11
+ }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
12
+ return (
13
+ <CollapsiblePrimitive.CollapsibleTrigger
14
+ data-slot="collapsible-trigger"
15
+ {...props}
16
+ />
17
+ )
18
+ }
19
+
20
+ function CollapsibleContent({
21
+ ...props
22
+ }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
23
+ return (
24
+ <CollapsiblePrimitive.CollapsibleContent
25
+ data-slot="collapsible-content"
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent }