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,40 +1,39 @@
1
- import * as React from "react"
2
- import * as RechartsPrimitive from "recharts"
3
- import { cn } from "@workspace/ui/lib/utils"
4
- import type { TooltipValueType } from "recharts"
5
-
1
+ import * as React from "react";
2
+ import * as RechartsPrimitive from "recharts";
3
+ import { cn } from "@workspace/ui/lib/utils";
4
+ import type { TooltipValueType } from "recharts";
6
5
 
7
6
  // Format: { THEME_NAME: CSS_SELECTOR }
8
- const THEMES = { light: "", dark: ".dark" } as const
7
+ const THEMES = { light: "", dark: ".dark" } as const;
9
8
 
10
- const INITIAL_DIMENSION = { width: 320, height: 200 } as const
11
- type TooltipNameType = number | string
9
+ const INITIAL_DIMENSION = { width: 320, height: 200 } as const;
10
+ type TooltipNameType = number | string;
12
11
 
13
12
  export type ChartConfig = Record<
14
13
  string,
15
14
  {
16
- label?: React.ReactNode
17
- icon?: React.ComponentType
15
+ label?: React.ReactNode;
16
+ icon?: React.ComponentType;
18
17
  } & (
19
18
  | { color?: string; theme?: never }
20
19
  | { color?: never; theme: Record<keyof typeof THEMES, string> }
21
20
  )
22
- >
21
+ >;
23
22
 
24
23
  type ChartContextProps = {
25
- config: ChartConfig
26
- }
24
+ config: ChartConfig;
25
+ };
27
26
 
28
- const ChartContext = React.createContext<ChartContextProps | null>(null)
27
+ const ChartContext = React.createContext<ChartContextProps | null>(null);
29
28
 
30
29
  function useChart() {
31
- const context = React.useContext(ChartContext)
30
+ const context = React.useContext(ChartContext);
32
31
 
33
32
  if (!context) {
34
- throw new Error("useChart must be used within a <ChartContainer />")
33
+ throw new Error("useChart must be used within a <ChartContainer />");
35
34
  }
36
35
 
37
- return context
36
+ return context;
38
37
  }
39
38
 
40
39
  function ChartContainer({
@@ -45,17 +44,15 @@ function ChartContainer({
45
44
  initialDimension = INITIAL_DIMENSION,
46
45
  ...props
47
46
  }: React.ComponentProps<"div"> & {
48
- config: ChartConfig
49
- children: React.ComponentProps<
50
- typeof RechartsPrimitive.ResponsiveContainer
51
- >["children"]
47
+ config: ChartConfig;
48
+ children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
52
49
  initialDimension?: {
53
- width: number
54
- height: number
55
- }
50
+ width: number;
51
+ height: number;
52
+ };
56
53
  }) {
57
- const uniqueId = React.useId()
58
- const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`
54
+ const uniqueId = React.useId();
55
+ const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
59
56
 
60
57
  return (
61
58
  <ChartContext.Provider value={{ config }}>
@@ -64,28 +61,26 @@ function ChartContainer({
64
61
  data-chart={chartId}
65
62
  className={cn(
66
63
  "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
64
+ className,
68
65
  )}
69
66
  {...props}
70
67
  >
71
68
  <ChartStyle id={chartId} config={config} />
72
- <RechartsPrimitive.ResponsiveContainer
73
- initialDimension={initialDimension}
74
- >
69
+ <RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>
75
70
  {children}
76
71
  </RechartsPrimitive.ResponsiveContainer>
77
72
  </div>
78
73
  </ChartContext.Provider>
79
- )
74
+ );
80
75
  }
81
76
 
82
77
  const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
83
78
  const colorConfig = Object.entries(config).filter(
84
- ([, itemConfig]) => itemConfig.theme ?? itemConfig.color
85
- )
79
+ ([, itemConfig]) => itemConfig.theme ?? itemConfig.color,
80
+ );
86
81
 
87
82
  if (!colorConfig.length) {
88
- return null
83
+ return null;
89
84
  }
90
85
 
91
86
  return (
@@ -97,22 +92,20 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
97
92
  ${prefix} [data-chart=${id}] {
98
93
  ${colorConfig
99
94
  .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
95
+ const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ?? itemConfig.color;
96
+ return color ? ` --color-${key}: ${color};` : null;
104
97
  })
105
98
  .join("\n")}
106
99
  }
107
- `
100
+ `,
108
101
  )
109
102
  .join("\n"),
110
103
  }}
111
104
  />
112
- )
113
- }
105
+ );
106
+ };
114
107
 
115
- const ChartTooltip = RechartsPrimitive.Tooltip
108
+ const ChartTooltip = RechartsPrimitive.Tooltip;
116
109
 
117
110
  function ChartTooltipContent({
118
111
  active,
@@ -130,67 +123,52 @@ function ChartTooltipContent({
130
123
  labelKey,
131
124
  }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
132
125
  React.ComponentProps<"div"> & {
133
- hideLabel?: boolean
134
- hideIndicator?: boolean
135
- indicator?: "line" | "dot" | "dashed"
136
- nameKey?: string
137
- labelKey?: string
126
+ hideLabel?: boolean;
127
+ hideIndicator?: boolean;
128
+ indicator?: "line" | "dot" | "dashed";
129
+ nameKey?: string;
130
+ labelKey?: string;
138
131
  } & Omit<
139
- RechartsPrimitive.DefaultTooltipContentProps<
140
- TooltipValueType,
141
- TooltipNameType
142
- >,
132
+ RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameType>,
143
133
  "accessibilityLayer"
144
134
  >) {
145
- const { config } = useChart()
135
+ const { config } = useChart();
146
136
 
147
137
  const tooltipLabel = React.useMemo(() => {
148
138
  if (hideLabel || !payload?.length) {
149
- return null
139
+ return null;
150
140
  }
151
141
 
152
- const [item] = payload
153
- const key = `${labelKey ?? item.dataKey ?? item.name ?? "value"}`
154
- const itemConfig = getPayloadConfigFromPayload(config, item, key)
142
+ const [item] = payload;
143
+ const key = `${labelKey ?? item.dataKey ?? item.name ?? "value"}`;
144
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
155
145
  const value =
156
- !labelKey && typeof label === "string"
157
- ? (config[label].label ?? label)
158
- : itemConfig?.label
146
+ !labelKey && typeof label === "string" ? (config[label].label ?? label) : itemConfig?.label;
159
147
 
160
148
  if (labelFormatter) {
161
149
  return (
162
- <div className={cn("font-medium", labelClassName)}>
163
- {labelFormatter(value, payload)}
164
- </div>
165
- )
150
+ <div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>
151
+ );
166
152
  }
167
153
 
168
154
  if (!value) {
169
- return null
155
+ return null;
170
156
  }
171
157
 
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
- ])
158
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>;
159
+ }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
182
160
 
183
161
  if (!active || !payload?.length) {
184
- return null
162
+ return null;
185
163
  }
186
164
 
187
- const nestLabel = payload.length === 1 && indicator !== "dot"
165
+ const nestLabel = payload.length === 1 && indicator !== "dot";
188
166
 
189
167
  return (
190
168
  <div
191
169
  className={cn(
192
170
  "grid min-w-32 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
171
+ className,
194
172
  )}
195
173
  >
196
174
  {!nestLabel ? tooltipLabel : null}
@@ -198,16 +176,16 @@ function ChartTooltipContent({
198
176
  {payload
199
177
  .filter((item) => item.type !== "none")
200
178
  .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
179
+ const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
180
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
181
+ const indicatorColor = color ?? item.payload?.fill ?? item.color;
204
182
 
205
183
  return (
206
184
  <div
207
185
  key={index}
208
186
  className={cn(
209
187
  "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"
188
+ indicator === "dot" && "items-center",
211
189
  )}
212
190
  >
213
191
  {formatter && item.value !== undefined && item.name ? (
@@ -227,7 +205,7 @@ function ChartTooltipContent({
227
205
  "w-0 border-[1.5px] border-dashed bg-transparent":
228
206
  indicator === "dashed",
229
207
  "my-0.5": nestLabel && indicator === "dashed",
230
- }
208
+ },
231
209
  )}
232
210
  style={
233
211
  {
@@ -241,7 +219,7 @@ function ChartTooltipContent({
241
219
  <div
242
220
  className={cn(
243
221
  "flex flex-1 justify-between leading-none",
244
- nestLabel ? "items-end" : "items-center"
222
+ nestLabel ? "items-end" : "items-center",
245
223
  )}
246
224
  >
247
225
  <div className="grid gap-1.5">
@@ -261,14 +239,14 @@ function ChartTooltipContent({
261
239
  </>
262
240
  )}
263
241
  </div>
264
- )
242
+ );
265
243
  })}
266
244
  </div>
267
245
  </div>
268
- )
246
+ );
269
247
  }
270
248
 
271
- const ChartLegend = RechartsPrimitive.Legend
249
+ const ChartLegend = RechartsPrimitive.Legend;
272
250
 
273
251
  function ChartLegendContent({
274
252
  className,
@@ -277,13 +255,13 @@ function ChartLegendContent({
277
255
  verticalAlign = "bottom",
278
256
  nameKey,
279
257
  }: React.ComponentProps<"div"> & {
280
- hideIcon?: boolean
281
- nameKey?: string
258
+ hideIcon?: boolean;
259
+ nameKey?: string;
282
260
  } & RechartsPrimitive.DefaultLegendContentProps) {
283
- const { config } = useChart()
261
+ const { config } = useChart();
284
262
 
285
263
  if (!payload?.length) {
286
- return null
264
+ return null;
287
265
  }
288
266
 
289
267
  return (
@@ -291,20 +269,20 @@ function ChartLegendContent({
291
269
  className={cn(
292
270
  "flex items-center justify-center gap-4",
293
271
  verticalAlign === "top" ? "pb-3" : "pt-3",
294
- className
272
+ className,
295
273
  )}
296
274
  >
297
275
  {payload
298
276
  .filter((item) => item.type !== "none")
299
277
  .map((item, index) => {
300
- const key = `${nameKey ?? item.dataKey ?? "value"}`
301
- const itemConfig = getPayloadConfigFromPayload(config, item, key)
278
+ const key = `${nameKey ?? item.dataKey ?? "value"}`;
279
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
302
280
 
303
281
  return (
304
282
  <div
305
283
  key={index}
306
284
  className={cn(
307
- "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
285
+ "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground",
308
286
  )}
309
287
  >
310
288
  {itemConfig?.icon && !hideIcon ? (
@@ -319,46 +297,35 @@ function ChartLegendContent({
319
297
  )}
320
298
  {itemConfig?.label}
321
299
  </div>
322
- )
300
+ );
323
301
  })}
324
302
  </div>
325
- )
303
+ );
326
304
  }
327
305
 
328
- function getPayloadConfigFromPayload(
329
- config: ChartConfig,
330
- payload: unknown,
331
- key: string
332
- ) {
306
+ function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
333
307
  if (typeof payload !== "object" || payload === null) {
334
- return undefined
308
+ return undefined;
335
309
  }
336
310
 
337
311
  const payloadPayload =
338
- "payload" in payload &&
339
- typeof payload.payload === "object" &&
340
- payload.payload !== null
312
+ "payload" in payload && typeof payload.payload === "object" && payload.payload !== null
341
313
  ? payload.payload
342
- : undefined
314
+ : undefined;
343
315
 
344
- let configLabelKey: string = key
316
+ let configLabelKey: string = key;
345
317
 
346
- if (
347
- key in payload &&
348
- typeof payload[key as keyof typeof payload] === "string"
349
- ) {
350
- configLabelKey = payload[key as keyof typeof payload]
318
+ if (key in payload && typeof payload[key as keyof typeof payload] === "string") {
319
+ configLabelKey = payload[key as keyof typeof payload];
351
320
  } else if (
352
321
  payloadPayload &&
353
322
  key in payloadPayload &&
354
323
  typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
355
324
  ) {
356
- configLabelKey = payloadPayload[
357
- key as keyof typeof payloadPayload
358
- ]
325
+ configLabelKey = payloadPayload[key as keyof typeof payloadPayload];
359
326
  }
360
327
 
361
- return configLabelKey in config ? config[configLabelKey] : config[key]
328
+ return configLabelKey in config ? config[configLabelKey] : config[key];
362
329
  }
363
330
 
364
331
  export {
@@ -368,4 +335,4 @@ export {
368
335
  ChartLegend,
369
336
  ChartLegendContent,
370
337
  ChartStyle,
371
- }
338
+ };
@@ -1,9 +1,9 @@
1
- "use client"
1
+ "use client";
2
2
 
3
- import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
3
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
4
4
 
5
- import { CheckIcon } from "lucide-react"
6
- import { cn } from "@workspace/ui/lib/utils"
5
+ import { CheckIcon } from "lucide-react";
6
+ import { cn } from "@workspace/ui/lib/utils";
7
7
 
8
8
  function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
9
9
  return (
@@ -11,7 +11,7 @@ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
11
11
  data-slot="checkbox"
12
12
  className={cn(
13
13
  "peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
14
- className
14
+ className,
15
15
  )}
16
16
  {...props}
17
17
  >
@@ -19,11 +19,10 @@ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
19
19
  data-slot="checkbox-indicator"
20
20
  className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
21
21
  >
22
- <CheckIcon
23
- />
22
+ <CheckIcon />
24
23
  </CheckboxPrimitive.Indicator>
25
24
  </CheckboxPrimitive.Root>
26
- )
25
+ );
27
26
  }
28
27
 
29
- export { Checkbox }
28
+ export { Checkbox };
@@ -1,19 +1,15 @@
1
- import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"
1
+ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
2
2
 
3
3
  function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
4
- return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
4
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
5
5
  }
6
6
 
7
7
  function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {
8
- return (
9
- <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
10
- )
8
+ return <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />;
11
9
  }
12
10
 
13
11
  function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
14
- return (
15
- <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
16
- )
12
+ return <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />;
17
13
  }
18
14
 
19
- export { Collapsible, CollapsibleTrigger, CollapsibleContent }
15
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent };