@carlonicora/nextjs-jsonapi 1.36.1 → 1.38.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 (190) hide show
  1. package/dist/{BlockNoteEditor-4MDHRUS2.js → BlockNoteEditor-3S2B36O3.js} +15 -15
  2. package/dist/{BlockNoteEditor-4MDHRUS2.js.map → BlockNoteEditor-3S2B36O3.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-SZWO3MDO.mjs → BlockNoteEditor-WQUJTVJL.mjs} +5 -5
  4. package/dist/BlockNoteEditor-WQUJTVJL.mjs.map +1 -0
  5. package/dist/billing/index.d.mts +15 -5
  6. package/dist/billing/index.d.ts +15 -5
  7. package/dist/billing/index.js +750 -520
  8. package/dist/billing/index.js.map +1 -1
  9. package/dist/billing/index.mjs +665 -435
  10. package/dist/billing/index.mjs.map +1 -1
  11. package/dist/{chunk-53IPQJVH.js → chunk-3EZX4G2E.js} +147 -23
  12. package/dist/chunk-3EZX4G2E.js.map +1 -0
  13. package/dist/{chunk-I7DFEJFF.mjs → chunk-4PHADEKA.mjs} +738 -1418
  14. package/dist/chunk-4PHADEKA.mjs.map +1 -0
  15. package/dist/{chunk-E6PQQTWF.js → chunk-T2JCZYWK.js} +999 -1679
  16. package/dist/chunk-T2JCZYWK.js.map +1 -0
  17. package/dist/{chunk-P7R2DPD6.mjs → chunk-TQ5GRRTM.mjs} +125 -1
  18. package/dist/chunk-TQ5GRRTM.mjs.map +1 -0
  19. package/dist/client/index.js +3 -3
  20. package/dist/client/index.mjs +2 -2
  21. package/dist/components/index.d.mts +23 -8
  22. package/dist/components/index.d.ts +23 -8
  23. package/dist/components/index.js +3 -3
  24. package/dist/components/index.mjs +2 -2
  25. package/dist/contexts/index.d.mts +1 -1
  26. package/dist/contexts/index.d.ts +1 -1
  27. package/dist/contexts/index.js +3 -3
  28. package/dist/contexts/index.mjs +2 -2
  29. package/dist/core/index.d.mts +47 -3
  30. package/dist/core/index.d.ts +47 -3
  31. package/dist/core/index.js +8 -2
  32. package/dist/core/index.js.map +1 -1
  33. package/dist/core/index.mjs +7 -1
  34. package/dist/index.d.mts +2 -2
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +8 -2
  37. package/dist/index.js.map +1 -1
  38. package/dist/index.mjs +7 -1
  39. package/dist/server/index.js +3 -3
  40. package/dist/server/index.mjs +1 -1
  41. package/dist/{stripe-subscription.interface-DK7BJaNd.d.ts → stripe-promotion-code.interface-BcJty0rv.d.ts} +18 -1
  42. package/dist/{stripe-subscription.interface-C8uhCYIZ.d.mts → stripe-promotion-code.interface-Dnm2DJKQ.d.mts} +18 -1
  43. package/dist/testing/index.js.map +1 -1
  44. package/dist/testing/index.mjs.map +1 -1
  45. package/package.json +2 -2
  46. package/src/billing/index.ts +1 -0
  47. package/src/client/context/JsonApiProvider.tsx +1 -5
  48. package/src/client/hooks/__tests__/useJsonApiGet.test.tsx +9 -9
  49. package/src/client/hooks/__tests__/useJsonApiMutation.test.tsx +11 -11
  50. package/src/client/hooks/__tests__/useRehydration.test.ts +13 -34
  51. package/src/components/editors/BlockNoteEditor.tsx +2 -2
  52. package/src/components/forms/CommonEditorTrigger.tsx +1 -1
  53. package/src/components/forms/FormCheckbox.tsx +2 -12
  54. package/src/components/forms/FormDate.tsx +1 -6
  55. package/src/components/forms/FormInput.tsx +1 -1
  56. package/src/components/forms/FormPassword.tsx +1 -7
  57. package/src/components/forms/FormSelect.tsx +2 -8
  58. package/src/components/forms/FormSlider.tsx +1 -5
  59. package/src/components/forms/FormSwitch.tsx +1 -5
  60. package/src/components/forms/GdprConsentCheckbox.tsx +2 -8
  61. package/src/components/forms/PasswordInput.tsx +28 -26
  62. package/src/components/forms/__tests__/FormCheckbox.test.tsx +16 -18
  63. package/src/components/forms/__tests__/FormDate.test.tsx +14 -30
  64. package/src/components/forms/__tests__/FormInput.test.tsx +21 -37
  65. package/src/components/forms/__tests__/FormSelect.test.tsx +15 -21
  66. package/src/components/tables/ContentListTable.tsx +1 -1
  67. package/src/components/tables/__tests__/ContentListTable.test.tsx +17 -89
  68. package/src/components/tables/cells/cell.component.tsx +1 -1
  69. package/src/contexts/HeaderChildrenContext.tsx +3 -1
  70. package/src/core/endpoint/__tests__/EndpointCreator.test.ts +2 -7
  71. package/src/core/factories/__tests__/JsonApiDataFactory.test.ts +3 -3
  72. package/src/core/factories/__tests__/RehydrationFactory.test.ts +4 -6
  73. package/src/core/index.ts +1 -0
  74. package/src/core/registry/ModuleRegistry.ts +1 -0
  75. package/src/core/registry/__tests__/DataClassRegistry.test.ts +5 -15
  76. package/src/core/registry/__tests__/ModuleRegistrar.test.ts +5 -15
  77. package/src/features/auth/components/GdprConsentSection.tsx +1 -6
  78. package/src/features/auth/components/details/LandingComponent.tsx +6 -1
  79. package/src/features/auth/components/forms/AcceptInvitation.tsx +1 -1
  80. package/src/features/auth/components/forms/ResetPassword.tsx +1 -1
  81. package/src/features/billing/components/cards/PaymentMethodSummaryCard.tsx +13 -18
  82. package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +12 -17
  83. package/src/features/billing/components/modals/BillingDetailModal.tsx +2 -13
  84. package/src/features/billing/stripe-customer/components/details/PaymentMethodCard.tsx +8 -1
  85. package/src/features/billing/stripe-customer/components/forms/PaymentMethodEditor.tsx +2 -13
  86. package/src/features/billing/stripe-customer/components/forms/PaymentMethodForm.tsx +2 -12
  87. package/src/features/billing/stripe-invoice/components/details/InvoiceDetails.tsx +6 -1
  88. package/src/features/billing/stripe-invoice/data/stripe-invoice.interface.ts +1 -0
  89. package/src/features/billing/stripe-price/components/lists/PricesList.tsx +13 -5
  90. package/src/features/billing/stripe-product/components/lists/ProductsList.tsx +5 -5
  91. package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +108 -0
  92. package/src/features/billing/stripe-promotion-code/components/index.ts +1 -0
  93. package/src/features/billing/stripe-promotion-code/data/index.ts +3 -0
  94. package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.interface.ts +14 -0
  95. package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.service.ts +64 -0
  96. package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.ts +66 -0
  97. package/src/features/billing/stripe-promotion-code/index.ts +2 -0
  98. package/src/features/billing/stripe-promotion-code/stripe-promotion-code.module.ts +9 -0
  99. package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +1 -3
  100. package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +4 -1
  101. package/src/features/billing/stripe-subscription/components/forms/CancelSubscriptionDialog.tsx +1 -1
  102. package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +24 -4
  103. package/src/features/billing/stripe-subscription/components/widgets/PricingCard.tsx +9 -2
  104. package/src/features/billing/stripe-subscription/components/widgets/SubscriptionStatusBadge.tsx +3 -1
  105. package/src/features/billing/stripe-subscription/components/wizards/SubscriptionWizard.tsx +7 -7
  106. package/src/features/billing/stripe-subscription/components/wizards/WizardProgressIndicator.tsx +2 -10
  107. package/src/features/billing/stripe-subscription/components/wizards/WizardStepPaymentMethod.tsx +3 -13
  108. package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +134 -23
  109. package/src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts +2 -0
  110. package/src/features/billing/stripe-subscription/data/stripe-subscription.ts +8 -0
  111. package/src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts +93 -7
  112. package/src/features/billing/stripe-usage/components/details/UsageSummaryCard.tsx +1 -1
  113. package/src/features/billing/stripe-usage/components/lists/UsageHistoryTable.tsx +1 -1
  114. package/src/features/company/components/details/CompanyDetails.tsx +2 -2
  115. package/src/features/company/components/forms/CompanyConfigurationSecurityForm.tsx +1 -1
  116. package/src/features/index.ts +1 -0
  117. package/src/features/notification/components/containers/NotificationsListContainer.tsx +1 -1
  118. package/src/features/notification/components/modals/NotificationModal.tsx +6 -2
  119. package/src/features/notification/contexts/NotificationContext.tsx +1 -3
  120. package/src/features/oauth/components/OAuthClientCard.tsx +15 -17
  121. package/src/features/oauth/components/OAuthClientDetail.tsx +7 -19
  122. package/src/features/oauth/components/OAuthClientForm.tsx +4 -13
  123. package/src/features/oauth/components/OAuthClientSecretDisplay.tsx +4 -20
  124. package/src/features/oauth/components/OAuthRedirectUriInput.tsx +5 -12
  125. package/src/features/oauth/components/OAuthScopeSelector.tsx +17 -23
  126. package/src/features/oauth/components/consent/OAuthConsentActions.tsx +3 -16
  127. package/src/features/oauth/components/consent/OAuthConsentHeader.tsx +3 -12
  128. package/src/features/oauth/components/consent/OAuthConsentScreen.tsx +5 -20
  129. package/src/features/oauth/components/consent/OAuthScopeList.tsx +3 -18
  130. package/src/features/onboarding/contexts/OnboardingContext.tsx +3 -3
  131. package/src/features/role/components/forms/FormRoles.tsx +1 -7
  132. package/src/features/user/components/containers/UserContainer.tsx +1 -1
  133. package/src/features/user/components/details/UserDetails.tsx +1 -1
  134. package/src/features/user/components/forms/UserDeleter.tsx +1 -1
  135. package/src/features/user/components/forms/UserEditor.tsx +1 -1
  136. package/src/features/user/components/forms/UserMultiSelect.tsx +7 -7
  137. package/src/features/user/components/lists/UserListInAdd.tsx +2 -2
  138. package/src/features/user/components/lists/UsersList.tsx +7 -1
  139. package/src/features/user/contexts/CurrentUserContext.tsx +36 -33
  140. package/src/hooks/__tests__/useDataListRetriever.test.ts +15 -21
  141. package/src/hooks/__tests__/useDebounce.test.ts +2 -7
  142. package/src/hooks/useCustomD3Graph.tsx +2 -2
  143. package/src/shadcnui/custom/multi-select.tsx +28 -2
  144. package/src/shadcnui/ui/accordion.tsx +21 -23
  145. package/src/shadcnui/ui/alert-dialog.tsx +45 -62
  146. package/src/shadcnui/ui/alert.tsx +25 -41
  147. package/src/shadcnui/ui/avatar.tsx +23 -36
  148. package/src/shadcnui/ui/badge.tsx +13 -11
  149. package/src/shadcnui/ui/breadcrumb.tsx +21 -55
  150. package/src/shadcnui/ui/button.tsx +17 -18
  151. package/src/shadcnui/ui/calendar.tsx +44 -93
  152. package/src/shadcnui/ui/carousel.tsx +72 -100
  153. package/src/shadcnui/ui/chart.tsx +102 -161
  154. package/src/shadcnui/ui/checkbox.tsx +8 -9
  155. package/src/shadcnui/ui/combobox.tsx +52 -83
  156. package/src/shadcnui/ui/command.tsx +43 -77
  157. package/src/shadcnui/ui/context-menu.tsx +47 -86
  158. package/src/shadcnui/ui/dialog.tsx +34 -60
  159. package/src/shadcnui/ui/drawer.tsx +32 -53
  160. package/src/shadcnui/ui/dropdown-menu.tsx +48 -65
  161. package/src/shadcnui/ui/field.tsx +39 -48
  162. package/src/shadcnui/ui/hover-card.tsx +9 -14
  163. package/src/shadcnui/ui/input-group.tsx +44 -55
  164. package/src/shadcnui/ui/input-otp.tsx +22 -26
  165. package/src/shadcnui/ui/input.tsx +6 -6
  166. package/src/shadcnui/ui/label.tsx +6 -6
  167. package/src/shadcnui/ui/navigation-menu.tsx +36 -60
  168. package/src/shadcnui/ui/popover.tsx +15 -38
  169. package/src/shadcnui/ui/progress.tsx +12 -29
  170. package/src/shadcnui/ui/radio-group.tsx +9 -15
  171. package/src/shadcnui/ui/resizable.tsx +14 -24
  172. package/src/shadcnui/ui/scroll-area.tsx +12 -27
  173. package/src/shadcnui/ui/select.tsx +41 -65
  174. package/src/shadcnui/ui/separator.tsx +7 -11
  175. package/src/shadcnui/ui/sheet.tsx +30 -55
  176. package/src/shadcnui/ui/sidebar.tsx +141 -189
  177. package/src/shadcnui/ui/skeleton.tsx +3 -9
  178. package/src/shadcnui/ui/slider.tsx +11 -23
  179. package/src/shadcnui/ui/switch.tsx +8 -8
  180. package/src/shadcnui/ui/tabs.tsx +14 -21
  181. package/src/shadcnui/ui/textarea.tsx +5 -5
  182. package/src/shadcnui/ui/toggle.tsx +8 -14
  183. package/src/shadcnui/ui/tooltip.tsx +11 -23
  184. package/src/testing/providers/MockJsonApiProvider.tsx +1 -5
  185. package/src/testing/utils/renderWithProviders.tsx +6 -10
  186. package/dist/BlockNoteEditor-SZWO3MDO.mjs.map +0 -1
  187. package/dist/chunk-53IPQJVH.js.map +0 -1
  188. package/dist/chunk-E6PQQTWF.js.map +0 -1
  189. package/dist/chunk-I7DFEJFF.mjs.map +0 -1
  190. package/dist/chunk-P7R2DPD6.mjs.map +0 -1
@@ -1,48 +1,45 @@
1
- "use client"
1
+ "use client";
2
2
 
3
- import * as React from "react"
4
- import * as RechartsPrimitive from "recharts"
3
+ import * as React from "react";
4
+ import * as RechartsPrimitive from "recharts";
5
5
 
6
- import { cn } from "@/lib/utils"
6
+ import { cn } from "@/lib/utils";
7
7
 
8
8
  // Format: { THEME_NAME: CSS_SELECTOR }
9
- const THEMES = { light: "", dark: ".dark" } as const
9
+ const THEMES = { light: "", dark: ".dark" } as const;
10
10
 
11
11
  // Custom type for tooltip/legend payload items
12
12
  type PayloadItem = {
13
- dataKey?: string | number
14
- name?: string
15
- value?: string | number
16
- type?: string
17
- color?: string
18
- payload?: Record<string, unknown> & { fill?: string }
19
- fill?: string
20
- }
13
+ dataKey?: string | number;
14
+ name?: string;
15
+ value?: string | number;
16
+ type?: string;
17
+ color?: string;
18
+ payload?: Record<string, unknown> & { fill?: string };
19
+ fill?: string;
20
+ };
21
21
 
22
22
  export type ChartConfig = {
23
23
  [k in string]: {
24
- label?: React.ReactNode
25
- icon?: React.ComponentType
26
- } & (
27
- | { color?: string; theme?: never }
28
- | { color?: never; theme: Record<keyof typeof THEMES, string> }
29
- )
30
- }
24
+ label?: React.ReactNode;
25
+ icon?: React.ComponentType;
26
+ } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> });
27
+ };
31
28
 
32
29
  type ChartContextProps = {
33
- config: ChartConfig
34
- }
30
+ config: ChartConfig;
31
+ };
35
32
 
36
- const ChartContext = React.createContext<ChartContextProps | null>(null)
33
+ const ChartContext = React.createContext<ChartContextProps | null>(null);
37
34
 
38
35
  function useChart() {
39
- const context = React.useContext(ChartContext)
36
+ const context = React.useContext(ChartContext);
40
37
 
41
38
  if (!context) {
42
- throw new Error("useChart must be used within a <ChartContainer />")
39
+ throw new Error("useChart must be used within a <ChartContainer />");
43
40
  }
44
41
 
45
- return context
42
+ return context;
46
43
  }
47
44
 
48
45
  function ChartContainer({
@@ -52,13 +49,11 @@ function ChartContainer({
52
49
  config,
53
50
  ...props
54
51
  }: React.ComponentProps<"div"> & {
55
- config: ChartConfig
56
- children: React.ComponentProps<
57
- typeof RechartsPrimitive.ResponsiveContainer
58
- >["children"]
52
+ config: ChartConfig;
53
+ children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
59
54
  }) {
60
- const uniqueId = React.useId()
61
- const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
55
+ const uniqueId = React.useId();
56
+ const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
62
57
 
63
58
  return (
64
59
  <ChartContext.Provider value={{ config }}>
@@ -67,26 +62,22 @@ function ChartContainer({
67
62
  data-chart={chartId}
68
63
  className={cn(
69
64
  "[&_.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-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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
70
- className
65
+ className,
71
66
  )}
72
67
  {...props}
73
68
  >
74
69
  <ChartStyle id={chartId} config={config} />
75
- <RechartsPrimitive.ResponsiveContainer>
76
- {children}
77
- </RechartsPrimitive.ResponsiveContainer>
70
+ <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>
78
71
  </div>
79
72
  </ChartContext.Provider>
80
- )
73
+ );
81
74
  }
82
75
 
83
76
  const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
84
- const colorConfig = Object.entries(config).filter(
85
- ([, config]) => config.theme || config.color
86
- )
77
+ const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
87
78
 
88
79
  if (!colorConfig.length) {
89
- return null
80
+ return null;
90
81
  }
91
82
 
92
83
  return (
@@ -98,22 +89,20 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
98
89
  ${prefix} [data-chart=${id}] {
99
90
  ${colorConfig
100
91
  .map(([key, itemConfig]) => {
101
- const color =
102
- itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
103
- itemConfig.color
104
- return color ? ` --color-${key}: ${color};` : null
92
+ const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color;
93
+ return color ? ` --color-${key}: ${color};` : null;
105
94
  })
106
95
  .join("\n")}
107
96
  }
108
- `
97
+ `,
109
98
  )
110
99
  .join("\n"),
111
100
  }}
112
101
  />
113
- )
114
- }
102
+ );
103
+ };
115
104
 
116
- const ChartTooltip = RechartsPrimitive.Tooltip
105
+ const ChartTooltip = RechartsPrimitive.Tooltip;
117
106
 
118
107
  function ChartTooltipContent({
119
108
  active,
@@ -130,68 +119,54 @@ function ChartTooltipContent({
130
119
  nameKey,
131
120
  labelKey,
132
121
  }: React.ComponentProps<"div"> & {
133
- active?: boolean
134
- payload?: PayloadItem[]
135
- label?: string | number
136
- labelFormatter?: (label: unknown, payload: PayloadItem[]) => React.ReactNode
137
- formatter?: (value: unknown, name: string, item: PayloadItem, index: number, payload: unknown) => React.ReactNode
138
- hideLabel?: boolean
139
- hideIndicator?: boolean
140
- indicator?: "line" | "dot" | "dashed"
141
- nameKey?: string
142
- labelKey?: string
143
- labelClassName?: string
144
- color?: string
145
- }) {
146
- const { config } = useChart()
122
+ active?: boolean;
123
+ payload?: PayloadItem[];
124
+ label?: string | number;
125
+ labelFormatter?: (label: unknown, payload: PayloadItem[]) => React.ReactNode;
126
+ formatter?: (value: unknown, name: string, item: PayloadItem, index: number, payload: unknown) => React.ReactNode;
127
+ hideLabel?: boolean;
128
+ hideIndicator?: boolean;
129
+ indicator?: "line" | "dot" | "dashed";
130
+ nameKey?: string;
131
+ labelKey?: string;
132
+ labelClassName?: string;
133
+ color?: string;
134
+ }) {
135
+ const { config } = useChart();
147
136
 
148
137
  const tooltipLabel = React.useMemo(() => {
149
138
  if (hideLabel || !payload?.length) {
150
- return null
139
+ return null;
151
140
  }
152
141
 
153
- const [item] = payload
154
- const key = `${labelKey || item?.dataKey || item?.name || "value"}`
155
- 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);
156
145
  const value =
157
- !labelKey && typeof label === "string"
158
- ? config[label as keyof typeof config]?.label || label
159
- : itemConfig?.label
146
+ !labelKey && typeof label === "string" ? config[label as keyof typeof config]?.label || label : itemConfig?.label;
160
147
 
161
148
  if (labelFormatter) {
162
- return (
163
- <div className={cn("font-medium", labelClassName)}>
164
- {labelFormatter(value, payload)}
165
- </div>
166
- )
149
+ return <div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>;
167
150
  }
168
151
 
169
152
  if (!value) {
170
- return null
153
+ return null;
171
154
  }
172
155
 
173
- return <div className={cn("font-medium", labelClassName)}>{value}</div>
174
- }, [
175
- label,
176
- labelFormatter,
177
- payload,
178
- hideLabel,
179
- labelClassName,
180
- config,
181
- labelKey,
182
- ])
156
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>;
157
+ }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
183
158
 
184
159
  if (!active || !payload?.length) {
185
- return null
160
+ return null;
186
161
  }
187
162
 
188
- const nestLabel = payload.length === 1 && indicator !== "dot"
163
+ const nestLabel = payload.length === 1 && indicator !== "dot";
189
164
 
190
165
  return (
191
166
  <div
192
167
  className={cn(
193
168
  "border-border/50 bg-background gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs/relaxed shadow-xl grid min-w-[8rem] items-start",
194
- className
169
+ className,
195
170
  )}
196
171
  >
197
172
  {!nestLabel ? tooltipLabel : null}
@@ -199,16 +174,16 @@ function ChartTooltipContent({
199
174
  {payload
200
175
  .filter((item) => item.type !== "none")
201
176
  .map((item, index) => {
202
- const key = `${nameKey || item.name || item.dataKey || "value"}`
203
- const itemConfig = getPayloadConfigFromPayload(config, item, key)
204
- const indicatorColor = color || item.payload?.fill || item.color
177
+ const key = `${nameKey || item.name || item.dataKey || "value"}`;
178
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
179
+ const indicatorColor = color || item.payload?.fill || item.color;
205
180
 
206
181
  return (
207
182
  <div
208
183
  key={item.dataKey}
209
184
  className={cn(
210
185
  "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
211
- indicator === "dot" && "items-center"
186
+ indicator === "dot" && "items-center",
212
187
  )}
213
188
  >
214
189
  {formatter && item?.value !== undefined && item.name ? (
@@ -220,16 +195,12 @@ function ChartTooltipContent({
220
195
  ) : (
221
196
  !hideIndicator && (
222
197
  <div
223
- className={cn(
224
- "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
225
- {
226
- "h-2.5 w-2.5": indicator === "dot",
227
- "w-1": indicator === "line",
228
- "w-0 border-[1.5px] border-dashed bg-transparent":
229
- indicator === "dashed",
230
- "my-0.5": nestLabel && indicator === "dashed",
231
- }
232
- )}
198
+ className={cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
199
+ "h-2.5 w-2.5": indicator === "dot",
200
+ "w-1": indicator === "line",
201
+ "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
202
+ "my-0.5": nestLabel && indicator === "dashed",
203
+ })}
233
204
  style={
234
205
  {
235
206
  "--color-bg": indicatorColor,
@@ -242,14 +213,12 @@ function ChartTooltipContent({
242
213
  <div
243
214
  className={cn(
244
215
  "flex flex-1 justify-between leading-none",
245
- nestLabel ? "items-end" : "items-center"
216
+ nestLabel ? "items-end" : "items-center",
246
217
  )}
247
218
  >
248
219
  <div className="grid gap-1.5">
249
220
  {nestLabel ? tooltipLabel : null}
250
- <span className="text-muted-foreground">
251
- {itemConfig?.label || item.name}
252
- </span>
221
+ <span className="text-muted-foreground">{itemConfig?.label || item.name}</span>
253
222
  </div>
254
223
  {item.value && (
255
224
  <span className="text-foreground font-mono font-medium tabular-nums">
@@ -260,14 +229,14 @@ function ChartTooltipContent({
260
229
  </>
261
230
  )}
262
231
  </div>
263
- )
232
+ );
264
233
  })}
265
234
  </div>
266
235
  </div>
267
- )
236
+ );
268
237
  }
269
238
 
270
- const ChartLegend = RechartsPrimitive.Legend
239
+ const ChartLegend = RechartsPrimitive.Legend;
271
240
 
272
241
  function ChartLegendContent({
273
242
  className,
@@ -276,37 +245,29 @@ function ChartLegendContent({
276
245
  verticalAlign = "bottom",
277
246
  nameKey,
278
247
  }: React.ComponentProps<"div"> & {
279
- payload?: PayloadItem[]
280
- verticalAlign?: "top" | "bottom" | "middle"
281
- hideIcon?: boolean
282
- nameKey?: string
283
- }) {
284
- const { config } = useChart()
248
+ payload?: PayloadItem[];
249
+ verticalAlign?: "top" | "bottom" | "middle";
250
+ hideIcon?: boolean;
251
+ nameKey?: string;
252
+ }) {
253
+ const { config } = useChart();
285
254
 
286
255
  if (!payload?.length) {
287
- return null
256
+ return null;
288
257
  }
289
258
 
290
259
  return (
291
- <div
292
- className={cn(
293
- "flex items-center justify-center gap-4",
294
- verticalAlign === "top" ? "pb-3" : "pt-3",
295
- className
296
- )}
297
- >
260
+ <div className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}>
298
261
  {payload
299
262
  .filter((item) => item.type !== "none")
300
263
  .map((item) => {
301
- const key = `${nameKey || item.dataKey || "value"}`
302
- const itemConfig = getPayloadConfigFromPayload(config, item, key)
264
+ const key = `${nameKey || item.dataKey || "value"}`;
265
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
303
266
 
304
267
  return (
305
268
  <div
306
269
  key={item.value}
307
- className={cn(
308
- "[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
309
- )}
270
+ className={cn("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3")}
310
271
  >
311
272
  {itemConfig?.icon && !hideIcon ? (
312
273
  <itemConfig.icon />
@@ -320,55 +281,35 @@ function ChartLegendContent({
320
281
  )}
321
282
  {itemConfig?.label}
322
283
  </div>
323
- )
284
+ );
324
285
  })}
325
286
  </div>
326
- )
287
+ );
327
288
  }
328
289
 
329
- function getPayloadConfigFromPayload(
330
- config: ChartConfig,
331
- payload: unknown,
332
- key: string
333
- ) {
290
+ function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
334
291
  if (typeof payload !== "object" || payload === null) {
335
- return undefined
292
+ return undefined;
336
293
  }
337
294
 
338
295
  const payloadPayload =
339
- "payload" in payload &&
340
- typeof payload.payload === "object" &&
341
- payload.payload !== null
296
+ "payload" in payload && typeof payload.payload === "object" && payload.payload !== null
342
297
  ? payload.payload
343
- : undefined
298
+ : undefined;
344
299
 
345
- let configLabelKey: string = key
300
+ let configLabelKey: string = key;
346
301
 
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
302
+ if (key in payload && typeof payload[key as keyof typeof payload] === "string") {
303
+ configLabelKey = payload[key as keyof typeof payload] as string;
352
304
  } else if (
353
305
  payloadPayload &&
354
306
  key in payloadPayload &&
355
307
  typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
356
308
  ) {
357
- configLabelKey = payloadPayload[
358
- key as keyof typeof payloadPayload
359
- ] as string
309
+ configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;
360
310
  }
361
311
 
362
- return configLabelKey in config
363
- ? config[configLabelKey]
364
- : config[key as keyof typeof config]
312
+ return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];
365
313
  }
366
314
 
367
- export {
368
- ChartContainer,
369
- ChartTooltip,
370
- ChartTooltipContent,
371
- ChartLegend,
372
- ChartLegendContent,
373
- ChartStyle,
374
- }
315
+ export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle };
@@ -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 { cn } from "@/lib/utils"
6
- import { CheckIcon } from "lucide-react"
5
+ import { cn } from "@/lib/utils";
6
+ import { CheckIcon } from "lucide-react";
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
  "border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex size-4 items-center justify-center rounded-[4px] border transition-shadow group-has-disabled/field:opacity-50 focus-visible:ring-[2px] aria-invalid:ring-[2px] peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50",
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="[&>svg]:size-3.5 grid place-content-center text-current transition-none"
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 };