create-croissant 0.1.39 → 0.1.41

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 (164) hide show
  1. package/dist/index.js +5 -5
  2. package/package.json +7 -10
  3. package/template/.oxlintignore +11 -0
  4. package/template/README.md +6 -6
  5. package/template/apps/desktop/README.md +1 -1
  6. package/template/apps/desktop/electron-builder.yml +6 -6
  7. package/template/apps/desktop/electron.vite.config.ts +8 -8
  8. package/template/apps/desktop/package.json +4 -13
  9. package/template/apps/desktop/src/main/index.ts +32 -32
  10. package/template/apps/desktop/src/preload/index.d.ts +3 -3
  11. package/template/apps/desktop/src/preload/index.ts +8 -8
  12. package/template/apps/desktop/src/renderer/src/App.tsx +5 -5
  13. package/template/apps/desktop/src/renderer/src/assets/base.css +4 -4
  14. package/template/apps/desktop/src/renderer/src/assets/main.css +3 -3
  15. package/template/apps/desktop/src/renderer/src/components/Versions.tsx +4 -4
  16. package/template/apps/desktop/src/renderer/src/main.tsx +7 -7
  17. package/template/apps/desktop/tsconfig.json +1 -4
  18. package/template/apps/desktop/tsconfig.node.json +1 -1
  19. package/template/apps/desktop/tsconfig.web.json +4 -11
  20. package/template/apps/mobile/app/(tabs)/_layout.tsx +11 -10
  21. package/template/apps/mobile/app/(tabs)/explore.tsx +29 -27
  22. package/template/apps/mobile/app/(tabs)/index.tsx +25 -24
  23. package/template/apps/mobile/app/_layout.tsx +8 -8
  24. package/template/apps/mobile/app/modal.tsx +6 -6
  25. package/template/apps/mobile/components/external-link.tsx +5 -5
  26. package/template/apps/mobile/components/haptic-tab.tsx +4 -4
  27. package/template/apps/mobile/components/hello-wave.tsx +5 -4
  28. package/template/apps/mobile/components/parallax-scroll-view.tsx +15 -13
  29. package/template/apps/mobile/components/themed-text.tsx +14 -14
  30. package/template/apps/mobile/components/themed-view.tsx +3 -3
  31. package/template/apps/mobile/components/ui/collapsible.tsx +14 -13
  32. package/template/apps/mobile/components/ui/icon-symbol.ios.tsx +4 -4
  33. package/template/apps/mobile/components/ui/icon-symbol.tsx +9 -9
  34. package/template/apps/mobile/constants/theme.ts +19 -19
  35. package/template/apps/mobile/hooks/use-color-scheme.ts +1 -1
  36. package/template/apps/mobile/hooks/use-color-scheme.web.ts +3 -3
  37. package/template/apps/mobile/hooks/use-theme-color.ts +4 -4
  38. package/template/apps/mobile/package.json +3 -6
  39. package/template/apps/mobile/scripts/reset-project.js +2 -2
  40. package/template/apps/mobile/tsconfig.json +2 -9
  41. package/template/apps/platform/drizzle.config.ts +5 -5
  42. package/template/apps/platform/package.json +2 -6
  43. package/template/apps/platform/src/components/app-sidebar.tsx +60 -69
  44. package/template/apps/platform/src/components/login-form.tsx +32 -39
  45. package/template/apps/platform/src/components/search-form.tsx +5 -13
  46. package/template/apps/platform/src/components/signup-form.tsx +39 -49
  47. package/template/apps/platform/src/components/version-switcher.tsx +11 -21
  48. package/template/apps/platform/src/lib/auth-utils.ts +12 -14
  49. package/template/apps/platform/src/lib/orpc.ts +17 -17
  50. package/template/apps/platform/src/routeTree.gen.ts +264 -267
  51. package/template/apps/platform/src/router.tsx +5 -5
  52. package/template/apps/platform/src/routes/__root.tsx +13 -15
  53. package/template/apps/platform/src/routes/_auth/account.tsx +61 -50
  54. package/template/apps/platform/src/routes/_auth/dashboard.tsx +17 -17
  55. package/template/apps/platform/src/routes/_auth/examples/client-orpc-auth.tsx +13 -13
  56. package/template/apps/platform/src/routes/_auth/examples/ssr-orpc-auth.tsx +17 -17
  57. package/template/apps/platform/src/routes/_auth.tsx +5 -5
  58. package/template/apps/platform/src/routes/_public/examples/client-orpc.tsx +108 -88
  59. package/template/apps/platform/src/routes/_public/examples/isr.tsx +14 -14
  60. package/template/apps/platform/src/routes/_public/examples/ssr-orpc.tsx +92 -75
  61. package/template/apps/platform/src/routes/_public/index.tsx +22 -19
  62. package/template/apps/platform/src/routes/_public/login.tsx +4 -4
  63. package/template/apps/platform/src/routes/_public/signup.tsx +6 -5
  64. package/template/apps/platform/src/routes/_public.tsx +5 -5
  65. package/template/apps/platform/src/routes/api/auth/$.ts +13 -13
  66. package/template/apps/platform/src/routes/api/rpc.$.ts +13 -13
  67. package/template/apps/platform/tsconfig.json +1 -1
  68. package/template/apps/platform/vite.config.ts +8 -8
  69. package/template/docker-compose.yml +1 -1
  70. package/template/package.json +24 -22
  71. package/template/packages/auth/package.json +8 -12
  72. package/template/packages/auth/src/lib/auth.ts +1 -1
  73. package/template/packages/auth/tsconfig.json +1 -1
  74. package/template/packages/db/package.json +6 -10
  75. package/template/packages/db/src/index.ts +4 -4
  76. package/template/packages/db/src/schema.ts +2 -2
  77. package/template/packages/db/tsconfig.json +1 -1
  78. package/template/packages/orpc/package.json +6 -10
  79. package/template/packages/orpc/src/lib/planets.ts +39 -43
  80. package/template/packages/orpc/src/lib/router.ts +15 -15
  81. package/template/packages/orpc/tsconfig.json +1 -1
  82. package/template/packages/ui/package.json +8 -12
  83. package/template/packages/ui/src/components/accordion.tsx +20 -22
  84. package/template/packages/ui/src/components/alert-dialog.tsx +31 -56
  85. package/template/packages/ui/src/components/alert.tsx +15 -23
  86. package/template/packages/ui/src/components/aspect-ratio.tsx +3 -3
  87. package/template/packages/ui/src/components/avatar.tsx +19 -35
  88. package/template/packages/ui/src/components/badge.tsx +13 -17
  89. package/template/packages/ui/src/components/breadcrumb.tsx +22 -44
  90. package/template/packages/ui/src/components/button-group.tsx +16 -25
  91. package/template/packages/ui/src/components/button.tsx +8 -9
  92. package/template/packages/ui/src/components/calendar.tsx +43 -82
  93. package/template/packages/ui/src/components/card.tsx +15 -26
  94. package/template/packages/ui/src/components/carousel.tsx +70 -78
  95. package/template/packages/ui/src/components/chart.tsx +84 -117
  96. package/template/packages/ui/src/components/checkbox.tsx +8 -9
  97. package/template/packages/ui/src/components/collapsible.tsx +5 -9
  98. package/template/packages/ui/src/components/combobox.tsx +44 -68
  99. package/template/packages/ui/src/components/command.tsx +32 -47
  100. package/template/packages/ui/src/components/context-menu.tsx +45 -71
  101. package/template/packages/ui/src/components/dialog.tsx +29 -51
  102. package/template/packages/ui/src/components/direction.tsx +1 -4
  103. package/template/packages/ui/src/components/drawer.tsx +24 -38
  104. package/template/packages/ui/src/components/dropdown-menu.tsx +45 -55
  105. package/template/packages/ui/src/components/empty.tsx +16 -27
  106. package/template/packages/ui/src/components/field.tsx +49 -63
  107. package/template/packages/ui/src/components/hover-card.tsx +9 -14
  108. package/template/packages/ui/src/components/input-group.tsx +40 -52
  109. package/template/packages/ui/src/components/input-otp.tsx +17 -18
  110. package/template/packages/ui/src/components/input.tsx +6 -6
  111. package/template/packages/ui/src/components/item.tsx +31 -44
  112. package/template/packages/ui/src/components/kbd.tsx +5 -5
  113. package/template/packages/ui/src/components/label.tsx +6 -6
  114. package/template/packages/ui/src/components/menubar.tsx +51 -64
  115. package/template/packages/ui/src/components/mode-toggle.tsx +9 -15
  116. package/template/packages/ui/src/components/native-select.tsx +18 -24
  117. package/template/packages/ui/src/components/navigation-menu.tsx +28 -35
  118. package/template/packages/ui/src/components/pagination.tsx +19 -31
  119. package/template/packages/ui/src/components/popover.tsx +13 -26
  120. package/template/packages/ui/src/components/progress.tsx +13 -30
  121. package/template/packages/ui/src/components/radio-group.tsx +7 -7
  122. package/template/packages/ui/src/components/resizable.tsx +12 -20
  123. package/template/packages/ui/src/components/scroll-area.tsx +8 -12
  124. package/template/packages/ui/src/components/select.tsx +31 -42
  125. package/template/packages/ui/src/components/separator.tsx +6 -10
  126. package/template/packages/ui/src/components/sheet.tsx +25 -38
  127. package/template/packages/ui/src/components/sidebar.tsx +137 -170
  128. package/template/packages/ui/src/components/skeleton.tsx +3 -3
  129. package/template/packages/ui/src/components/slider.tsx +5 -5
  130. package/template/packages/ui/src/components/sonner.tsx +20 -24
  131. package/template/packages/ui/src/components/spinner.tsx +10 -5
  132. package/template/packages/ui/src/components/switch.tsx +6 -6
  133. package/template/packages/ui/src/components/table.tsx +18 -45
  134. package/template/packages/ui/src/components/tabs.tsx +14 -22
  135. package/template/packages/ui/src/components/textarea.tsx +5 -5
  136. package/template/packages/ui/src/components/theme-provider.tsx +43 -48
  137. package/template/packages/ui/src/components/toggle-group.tsx +18 -20
  138. package/template/packages/ui/src/components/toggle.tsx +9 -10
  139. package/template/packages/ui/src/components/tooltip.tsx +10 -22
  140. package/template/packages/ui/src/hooks/use-mobile.ts +11 -11
  141. package/template/packages/ui/src/lib/utils.ts +4 -4
  142. package/template/packages/ui/src/styles/globals.css +106 -106
  143. package/template/packages/ui/tsconfig.json +1 -1
  144. package/template/turbo.json +15 -6
  145. package/template/.prettierignore +0 -10
  146. package/template/apps/desktop/.prettierignore +0 -6
  147. package/template/apps/desktop/eslint.config.ts +0 -11
  148. package/template/apps/desktop/prettier.config.ts +0 -3
  149. package/template/apps/mobile/eslint.config.js +0 -10
  150. package/template/apps/platform/eslint.config.ts +0 -11
  151. package/template/apps/platform/prettier.config.ts +0 -3
  152. package/template/packages/auth/eslint.config.ts +0 -3
  153. package/template/packages/auth/prettier.config.ts +0 -3
  154. package/template/packages/config-eslint/index.ts +0 -24
  155. package/template/packages/config-eslint/package.json +0 -11
  156. package/template/packages/config-prettier/index.ts +0 -14
  157. package/template/packages/config-prettier/package.json +0 -7
  158. package/template/packages/db/eslint.config.ts +0 -3
  159. package/template/packages/db/prettier.config.ts +0 -3
  160. package/template/packages/orpc/eslint.config.ts +0 -3
  161. package/template/packages/orpc/prettier.config.ts +0 -3
  162. package/template/packages/ui/eslint.config.ts +0 -3
  163. package/template/packages/ui/prettier.config.ts +0 -3
  164. package/template/prettier.config.ts +0 -15
@@ -1,15 +1,10 @@
1
- import * as React from "react"
2
- import {
3
-
4
- DayPicker,
5
-
6
- getDefaultClassNames
7
- } from "react-day-picker"
1
+ import * as React from "react";
2
+ import { DayPicker, getDefaultClassNames } from "react-day-picker";
8
3
 
9
- import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
10
- import { cn } from "@workspace/ui/lib/utils"
11
- import { Button, buttonVariants } from "@workspace/ui/components/button"
12
- import type {DayButton, Locale} from "react-day-picker";
4
+ import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
5
+ import { cn } from "@workspace/ui/lib/utils";
6
+ import { Button, buttonVariants } from "@workspace/ui/components/button";
7
+ import type { DayButton, Locale } from "react-day-picker";
13
8
 
14
9
  function Calendar({
15
10
  className,
@@ -22,9 +17,9 @@ function Calendar({
22
17
  components,
23
18
  ...props
24
19
  }: React.ComponentProps<typeof DayPicker> & {
25
- buttonVariant?: React.ComponentProps<typeof Button>["variant"]
20
+ buttonVariant?: React.ComponentProps<typeof Button>["variant"];
26
21
  }) {
27
- const defaultClassNames = getDefaultClassNames()
22
+ const defaultClassNames = getDefaultClassNames();
28
23
 
29
24
  return (
30
25
  <DayPicker
@@ -33,141 +28,107 @@ function Calendar({
33
28
  "group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
34
29
  String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
35
30
  String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
36
- className
31
+ className,
37
32
  )}
38
33
  captionLayout={captionLayout}
39
34
  locale={locale}
40
35
  formatters={{
41
- formatMonthDropdown: (date) =>
42
- date.toLocaleString(locale?.code, { month: "short" }),
36
+ formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
43
37
  ...formatters,
44
38
  }}
45
39
  classNames={{
46
40
  root: cn("w-fit", defaultClassNames.root),
47
- months: cn(
48
- "relative flex flex-col gap-4 md:flex-row",
49
- defaultClassNames.months
50
- ),
41
+ months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
51
42
  month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
52
43
  nav: cn(
53
44
  "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
54
- defaultClassNames.nav
45
+ defaultClassNames.nav,
55
46
  ),
56
47
  button_previous: cn(
57
48
  buttonVariants({ variant: buttonVariant }),
58
49
  "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
59
- defaultClassNames.button_previous
50
+ defaultClassNames.button_previous,
60
51
  ),
61
52
  button_next: cn(
62
53
  buttonVariants({ variant: buttonVariant }),
63
54
  "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
64
- defaultClassNames.button_next
55
+ defaultClassNames.button_next,
65
56
  ),
66
57
  month_caption: cn(
67
58
  "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
68
- defaultClassNames.month_caption
59
+ defaultClassNames.month_caption,
69
60
  ),
70
61
  dropdowns: cn(
71
62
  "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
72
- defaultClassNames.dropdowns
73
- ),
74
- dropdown_root: cn(
75
- "relative rounded-(--cell-radius)",
76
- defaultClassNames.dropdown_root
77
- ),
78
- dropdown: cn(
79
- "absolute inset-0 bg-popover opacity-0",
80
- defaultClassNames.dropdown
63
+ defaultClassNames.dropdowns,
81
64
  ),
65
+ dropdown_root: cn("relative rounded-(--cell-radius)", defaultClassNames.dropdown_root),
66
+ dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
82
67
  caption_label: cn(
83
68
  "font-medium select-none",
84
69
  captionLayout === "label"
85
70
  ? "text-sm"
86
71
  : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
87
- defaultClassNames.caption_label
72
+ defaultClassNames.caption_label,
88
73
  ),
89
74
  table: "w-full border-collapse",
90
75
  weekdays: cn("flex", defaultClassNames.weekdays),
91
76
  weekday: cn(
92
77
  "flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",
93
- defaultClassNames.weekday
78
+ defaultClassNames.weekday,
94
79
  ),
95
80
  week: cn("mt-2 flex w-full", defaultClassNames.week),
96
- week_number_header: cn(
97
- "w-(--cell-size) select-none",
98
- defaultClassNames.week_number_header
99
- ),
81
+ week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
100
82
  week_number: cn(
101
83
  "text-[0.8rem] text-muted-foreground select-none",
102
- defaultClassNames.week_number
84
+ defaultClassNames.week_number,
103
85
  ),
104
86
  day: cn(
105
87
  "group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
106
88
  props.showWeekNumber
107
89
  ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)"
108
90
  : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
109
- defaultClassNames.day
91
+ defaultClassNames.day,
110
92
  ),
111
93
  range_start: cn(
112
94
  "relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
113
- defaultClassNames.range_start
95
+ defaultClassNames.range_start,
114
96
  ),
115
97
  range_middle: cn("rounded-none", defaultClassNames.range_middle),
116
98
  range_end: cn(
117
99
  "relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
118
- defaultClassNames.range_end
100
+ defaultClassNames.range_end,
119
101
  ),
120
102
  today: cn(
121
103
  "rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
122
- defaultClassNames.today
104
+ defaultClassNames.today,
123
105
  ),
124
106
  outside: cn(
125
107
  "text-muted-foreground aria-selected:text-muted-foreground",
126
- defaultClassNames.outside
127
- ),
128
- disabled: cn(
129
- "text-muted-foreground opacity-50",
130
- defaultClassNames.disabled
108
+ defaultClassNames.outside,
131
109
  ),
110
+ disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
132
111
  hidden: cn("invisible", defaultClassNames.hidden),
133
112
  ...classNames,
134
113
  }}
135
114
  components={{
136
115
  Root: ({ className: rootClassName, rootRef, ...rootProps }) => {
137
116
  return (
138
- <div
139
- data-slot="calendar"
140
- ref={rootRef}
141
- className={cn(rootClassName)}
142
- {...rootProps}
143
- />
144
- )
117
+ <div data-slot="calendar" ref={rootRef} className={cn(rootClassName)} {...rootProps} />
118
+ );
145
119
  },
146
120
  Chevron: ({ className: chevronClassName, orientation, ...chevronProps }) => {
147
121
  if (orientation === "left") {
148
- return (
149
- <ChevronLeftIcon
150
- className={cn("size-4", chevronClassName)}
151
- {...chevronProps}
152
- />
153
- )
122
+ return <ChevronLeftIcon className={cn("size-4", chevronClassName)} {...chevronProps} />;
154
123
  }
155
124
 
156
125
  if (orientation === "right") {
157
126
  return (
158
- <ChevronRightIcon
159
- className={cn("size-4", chevronClassName)}
160
- {...chevronProps}
161
- />
162
- )
127
+ <ChevronRightIcon className={cn("size-4", chevronClassName)} {...chevronProps} />
128
+ );
163
129
  }
164
130
 
165
- return (
166
- <ChevronDownIcon
167
- className={cn("size-4", chevronClassName)}
168
- {...chevronProps}
169
- />
170
- )
131
+ return <ChevronDownIcon className={cn("size-4", chevronClassName)} {...chevronProps} />;
171
132
  },
172
133
  DayButton: ({ ...dayButtonProps }) => (
173
134
  <CalendarDayButton locale={locale} {...dayButtonProps} />
@@ -179,13 +140,13 @@ function Calendar({
179
140
  {children}
180
141
  </div>
181
142
  </td>
182
- )
143
+ );
183
144
  },
184
145
  ...components,
185
146
  }}
186
147
  {...props}
187
148
  />
188
- )
149
+ );
189
150
  }
190
151
 
191
152
  function CalendarDayButton({
@@ -195,12 +156,12 @@ function CalendarDayButton({
195
156
  locale,
196
157
  ...props
197
158
  }: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {
198
- const defaultClassNames = getDefaultClassNames()
159
+ const defaultClassNames = getDefaultClassNames();
199
160
 
200
- const ref = React.useRef<HTMLButtonElement>(null)
161
+ const ref = React.useRef<HTMLButtonElement>(null);
201
162
  React.useEffect(() => {
202
- if (modifiers.focused) ref.current?.focus()
203
- }, [modifiers.focused])
163
+ if (modifiers.focused) ref.current?.focus();
164
+ }, [modifiers.focused]);
204
165
 
205
166
  return (
206
167
  <Button
@@ -219,11 +180,11 @@ function CalendarDayButton({
219
180
  className={cn(
220
181
  "relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70",
221
182
  defaultClassNames.day,
222
- className
183
+ className,
223
184
  )}
224
185
  {...props}
225
186
  />
226
- )
187
+ );
227
188
  }
228
189
 
229
- export { Calendar, CalendarDayButton }
190
+ export { Calendar, CalendarDayButton };
@@ -1,6 +1,6 @@
1
- import * as React from "react"
1
+ import * as React from "react";
2
2
 
3
- import { cn } from "@workspace/ui/lib/utils"
3
+ import { cn } from "@workspace/ui/lib/utils";
4
4
 
5
5
  function Card({
6
6
  className,
@@ -13,11 +13,11 @@ function Card({
13
13
  data-size={size}
14
14
  className={cn(
15
15
  "group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
16
- className
16
+ className,
17
17
  )}
18
18
  {...props}
19
19
  />
20
- )
20
+ );
21
21
  }
22
22
 
23
23
  function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
@@ -26,11 +26,11 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
26
26
  data-slot="card-header"
27
27
  className={cn(
28
28
  "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",
29
- className
29
+ className,
30
30
  )}
31
31
  {...props}
32
32
  />
33
- )
33
+ );
34
34
  }
35
35
 
36
36
  function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
@@ -39,11 +39,11 @@ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
39
39
  data-slot="card-title"
40
40
  className={cn(
41
41
  "font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
42
- className
42
+ className,
43
43
  )}
44
44
  {...props}
45
45
  />
46
- )
46
+ );
47
47
  }
48
48
 
49
49
  function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
@@ -53,20 +53,17 @@ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
53
53
  className={cn("text-sm text-muted-foreground", className)}
54
54
  {...props}
55
55
  />
56
- )
56
+ );
57
57
  }
58
58
 
59
59
  function CardAction({ className, ...props }: React.ComponentProps<"div">) {
60
60
  return (
61
61
  <div
62
62
  data-slot="card-action"
63
- className={cn(
64
- "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
65
- className
66
- )}
63
+ className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}
67
64
  {...props}
68
65
  />
69
- )
66
+ );
70
67
  }
71
68
 
72
69
  function CardContent({ className, ...props }: React.ComponentProps<"div">) {
@@ -76,7 +73,7 @@ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
76
73
  className={cn("px-4 group-data-[size=sm]/card:px-3", className)}
77
74
  {...props}
78
75
  />
79
- )
76
+ );
80
77
  }
81
78
 
82
79
  function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
@@ -85,19 +82,11 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
85
82
  data-slot="card-footer"
86
83
  className={cn(
87
84
  "flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",
88
- className
85
+ className,
89
86
  )}
90
87
  {...props}
91
88
  />
92
- )
89
+ );
93
90
  }
94
91
 
95
- export {
96
- Card,
97
- CardHeader,
98
- CardFooter,
99
- CardTitle,
100
- CardAction,
101
- CardDescription,
102
- CardContent,
103
- }
92
+ export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent };
@@ -1,44 +1,44 @@
1
- "use client"
1
+ "use client";
2
2
 
3
- import * as React from "react"
4
- import useEmblaCarousel from "embla-carousel-react"
3
+ import * as React from "react";
4
+ import useEmblaCarousel from "embla-carousel-react";
5
5
 
6
- import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
7
- import { cn } from "@workspace/ui/lib/utils"
8
- import { Button } from "@workspace/ui/components/button"
9
- import type {UseEmblaCarouselType} from "embla-carousel-react";
6
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
7
+ import { cn } from "@workspace/ui/lib/utils";
8
+ import { Button } from "@workspace/ui/components/button";
9
+ import type { UseEmblaCarouselType } from "embla-carousel-react";
10
10
 
11
- type CarouselApi = UseEmblaCarouselType[1]
12
- type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
13
- type CarouselOptions = UseCarouselParameters[0]
14
- type CarouselPlugin = UseCarouselParameters[1]
11
+ type CarouselApi = UseEmblaCarouselType[1];
12
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
13
+ type CarouselOptions = UseCarouselParameters[0];
14
+ type CarouselPlugin = UseCarouselParameters[1];
15
15
 
16
16
  type CarouselProps = {
17
- opts?: CarouselOptions
18
- plugins?: CarouselPlugin
19
- orientation?: "horizontal" | "vertical"
20
- setApi?: (api: CarouselApi) => void
21
- }
17
+ opts?: CarouselOptions;
18
+ plugins?: CarouselPlugin;
19
+ orientation?: "horizontal" | "vertical";
20
+ setApi?: (api: CarouselApi) => void;
21
+ };
22
22
 
23
23
  type CarouselContextProps = {
24
- carouselRef: ReturnType<typeof useEmblaCarousel>[0]
25
- api: ReturnType<typeof useEmblaCarousel>[1]
26
- scrollPrev: () => void
27
- scrollNext: () => void
28
- canScrollPrev: boolean
29
- canScrollNext: boolean
30
- } & CarouselProps
24
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0];
25
+ api: ReturnType<typeof useEmblaCarousel>[1];
26
+ scrollPrev: () => void;
27
+ scrollNext: () => void;
28
+ canScrollPrev: boolean;
29
+ canScrollNext: boolean;
30
+ } & CarouselProps;
31
31
 
32
- const CarouselContext = React.createContext<CarouselContextProps | null>(null)
32
+ const CarouselContext = React.createContext<CarouselContextProps | null>(null);
33
33
 
34
34
  function useCarousel() {
35
- const context = React.useContext(CarouselContext)
35
+ const context = React.useContext(CarouselContext);
36
36
 
37
37
  if (!context) {
38
- throw new Error("useCarousel must be used within a <Carousel />")
38
+ throw new Error("useCarousel must be used within a <Carousel />");
39
39
  }
40
40
 
41
- return context
41
+ return context;
42
42
  }
43
43
 
44
44
  function Carousel({
@@ -55,53 +55,53 @@ function Carousel({
55
55
  ...opts,
56
56
  axis: orientation === "horizontal" ? "x" : "y",
57
57
  },
58
- plugins
59
- )
60
- const [canScrollPrev, setCanScrollPrev] = React.useState(false)
61
- const [canScrollNext, setCanScrollNext] = React.useState(false)
58
+ plugins,
59
+ );
60
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false);
61
+ const [canScrollNext, setCanScrollNext] = React.useState(false);
62
62
 
63
63
  const onSelect = React.useCallback((emblaApi: CarouselApi) => {
64
- if (!emblaApi) return
65
- setCanScrollPrev(emblaApi.canScrollPrev())
66
- setCanScrollNext(emblaApi.canScrollNext())
67
- }, [])
64
+ if (!emblaApi) return;
65
+ setCanScrollPrev(emblaApi.canScrollPrev());
66
+ setCanScrollNext(emblaApi.canScrollNext());
67
+ }, []);
68
68
 
69
69
  const scrollPrev = React.useCallback(() => {
70
- api?.scrollPrev()
71
- }, [api])
70
+ api?.scrollPrev();
71
+ }, [api]);
72
72
 
73
73
  const scrollNext = React.useCallback(() => {
74
- api?.scrollNext()
75
- }, [api])
74
+ api?.scrollNext();
75
+ }, [api]);
76
76
 
77
77
  const handleKeyDown = React.useCallback(
78
78
  (event: React.KeyboardEvent<HTMLDivElement>) => {
79
79
  if (event.key === "ArrowLeft") {
80
- event.preventDefault()
81
- scrollPrev()
80
+ event.preventDefault();
81
+ scrollPrev();
82
82
  } else if (event.key === "ArrowRight") {
83
- event.preventDefault()
84
- scrollNext()
83
+ event.preventDefault();
84
+ scrollNext();
85
85
  }
86
86
  },
87
- [scrollPrev, scrollNext]
88
- )
87
+ [scrollPrev, scrollNext],
88
+ );
89
89
 
90
90
  React.useEffect(() => {
91
- if (!api || !setApi) return
92
- setApi(api)
93
- }, [api, setApi])
91
+ if (!api || !setApi) return;
92
+ setApi(api);
93
+ }, [api, setApi]);
94
94
 
95
95
  React.useEffect(() => {
96
- if (!api) return
97
- onSelect(api)
98
- api.on("reInit", onSelect)
99
- api.on("select", onSelect)
96
+ if (!api) return;
97
+ onSelect(api);
98
+ api.on("reInit", onSelect);
99
+ api.on("select", onSelect);
100
100
 
101
101
  return () => {
102
- api.off("select", onSelect)
103
- }
104
- }, [api, onSelect])
102
+ api.off("select", onSelect);
103
+ };
104
+ }, [api, onSelect]);
105
105
 
106
106
  return (
107
107
  <CarouselContext.Provider
@@ -127,32 +127,24 @@ function Carousel({
127
127
  {children}
128
128
  </div>
129
129
  </CarouselContext.Provider>
130
- )
130
+ );
131
131
  }
132
132
 
133
133
  function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
134
- const { carouselRef, orientation } = useCarousel()
134
+ const { carouselRef, orientation } = useCarousel();
135
135
 
136
136
  return (
137
- <div
138
- ref={carouselRef}
139
- className="overflow-hidden"
140
- data-slot="carousel-content"
141
- >
137
+ <div ref={carouselRef} className="overflow-hidden" data-slot="carousel-content">
142
138
  <div
143
- className={cn(
144
- "flex",
145
- orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
146
- className
147
- )}
139
+ className={cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className)}
148
140
  {...props}
149
141
  />
150
142
  </div>
151
- )
143
+ );
152
144
  }
153
145
 
154
146
  function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
155
- const { orientation } = useCarousel()
147
+ const { orientation } = useCarousel();
156
148
 
157
149
  return (
158
150
  <div
@@ -162,11 +154,11 @@ function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
162
154
  className={cn(
163
155
  "min-w-0 shrink-0 grow-0 basis-full",
164
156
  orientation === "horizontal" ? "pl-4" : "pt-4",
165
- className
157
+ className,
166
158
  )}
167
159
  {...props}
168
160
  />
169
- )
161
+ );
170
162
  }
171
163
 
172
164
  function CarouselPrevious({
@@ -175,7 +167,7 @@ function CarouselPrevious({
175
167
  size = "icon-sm",
176
168
  ...props
177
169
  }: React.ComponentProps<typeof Button>) {
178
- const { orientation, scrollPrev, canScrollPrev } = useCarousel()
170
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel();
179
171
 
180
172
  return (
181
173
  <Button
@@ -187,7 +179,7 @@ function CarouselPrevious({
187
179
  orientation === "horizontal"
188
180
  ? "top-1/2 -left-12 -translate-y-1/2"
189
181
  : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
190
- className
182
+ className,
191
183
  )}
192
184
  disabled={!canScrollPrev}
193
185
  onClick={scrollPrev}
@@ -196,7 +188,7 @@ function CarouselPrevious({
196
188
  <ChevronLeftIcon />
197
189
  <span className="sr-only">Previous slide</span>
198
190
  </Button>
199
- )
191
+ );
200
192
  }
201
193
 
202
194
  function CarouselNext({
@@ -205,7 +197,7 @@ function CarouselNext({
205
197
  size = "icon-sm",
206
198
  ...props
207
199
  }: React.ComponentProps<typeof Button>) {
208
- const { orientation, scrollNext, canScrollNext } = useCarousel()
200
+ const { orientation, scrollNext, canScrollNext } = useCarousel();
209
201
 
210
202
  return (
211
203
  <Button
@@ -217,7 +209,7 @@ function CarouselNext({
217
209
  orientation === "horizontal"
218
210
  ? "top-1/2 -right-12 -translate-y-1/2"
219
211
  : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
220
- className
212
+ className,
221
213
  )}
222
214
  disabled={!canScrollNext}
223
215
  onClick={scrollNext}
@@ -226,7 +218,7 @@ function CarouselNext({
226
218
  <ChevronRightIcon />
227
219
  <span className="sr-only">Next slide</span>
228
220
  </Button>
229
- )
221
+ );
230
222
  }
231
223
 
232
224
  export {
@@ -237,4 +229,4 @@ export {
237
229
  CarouselPrevious,
238
230
  CarouselNext,
239
231
  useCarousel,
240
- }
232
+ };