@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,56 +1,46 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { mergeProps } from "@base-ui/react/merge-props"
5
- import { useRender } from "@base-ui/react/use-render"
6
- import { cva, type VariantProps } from "class-variance-authority"
7
-
8
- import { cn } from "@/lib/utils"
9
- import { Button } from "@/components/ui/button"
10
- import { Input } from "@/components/ui/input"
11
- import { Separator } from "@/components/ui/separator"
12
- import {
13
- Sheet,
14
- SheetContent,
15
- SheetDescription,
16
- SheetHeader,
17
- SheetTitle,
18
- } from "@/components/ui/sheet"
19
- import { Skeleton } from "@/components/ui/skeleton"
20
- import {
21
- Tooltip,
22
- TooltipContent,
23
- TooltipTrigger,
24
- } from "@/components/ui/tooltip"
25
- import { useIsMobile } from "@/hooks/use-mobile"
26
- import { PanelLeftIcon } from "lucide-react"
27
-
28
- const SIDEBAR_COOKIE_NAME = "sidebar_state"
29
- const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
30
- const SIDEBAR_WIDTH = "16rem"
31
- const SIDEBAR_WIDTH_MOBILE = "18rem"
32
- const SIDEBAR_WIDTH_ICON = "3rem"
33
- const SIDEBAR_KEYBOARD_SHORTCUT = "b"
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { mergeProps } from "@base-ui/react/merge-props";
5
+ import { useRender } from "@base-ui/react/use-render";
6
+ import { cva, type VariantProps } from "class-variance-authority";
7
+
8
+ import { cn } from "@/lib/utils";
9
+ import { Button } from "@/components/ui/button";
10
+ import { Input } from "@/components/ui/input";
11
+ import { Separator } from "@/components/ui/separator";
12
+ import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@/components/ui/sheet";
13
+ import { Skeleton } from "@/components/ui/skeleton";
14
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
15
+ import { useIsMobile } from "@/hooks/use-mobile";
16
+ import { PanelLeftIcon } from "lucide-react";
17
+
18
+ const SIDEBAR_COOKIE_NAME = "sidebar_state";
19
+ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
20
+ const SIDEBAR_WIDTH = "16rem";
21
+ const SIDEBAR_WIDTH_MOBILE = "18rem";
22
+ const SIDEBAR_WIDTH_ICON = "3rem";
23
+ const SIDEBAR_KEYBOARD_SHORTCUT = "b";
34
24
 
35
25
  type SidebarContextProps = {
36
- state: "expanded" | "collapsed"
37
- open: boolean
38
- setOpen: (open: boolean) => void
39
- openMobile: boolean
40
- setOpenMobile: (open: boolean) => void
41
- isMobile: boolean
42
- toggleSidebar: () => void
43
- }
26
+ state: "expanded" | "collapsed";
27
+ open: boolean;
28
+ setOpen: (open: boolean) => void;
29
+ openMobile: boolean;
30
+ setOpenMobile: (open: boolean) => void;
31
+ isMobile: boolean;
32
+ toggleSidebar: () => void;
33
+ };
44
34
 
45
- const SidebarContext = React.createContext<SidebarContextProps | null>(null)
35
+ const SidebarContext = React.createContext<SidebarContextProps | null>(null);
46
36
 
47
37
  function useSidebar() {
48
- const context = React.useContext(SidebarContext)
38
+ const context = React.useContext(SidebarContext);
49
39
  if (!context) {
50
- throw new Error("useSidebar must be used within a SidebarProvider.")
40
+ throw new Error("useSidebar must be used within a SidebarProvider.");
51
41
  }
52
42
 
53
- return context
43
+ return context;
54
44
  }
55
45
 
56
46
  function SidebarProvider({
@@ -62,56 +52,53 @@ function SidebarProvider({
62
52
  children,
63
53
  ...props
64
54
  }: React.ComponentProps<"div"> & {
65
- defaultOpen?: boolean
66
- open?: boolean
67
- onOpenChange?: (open: boolean) => void
55
+ defaultOpen?: boolean;
56
+ open?: boolean;
57
+ onOpenChange?: (open: boolean) => void;
68
58
  }) {
69
- const isMobile = useIsMobile()
70
- const [openMobile, setOpenMobile] = React.useState(false)
59
+ const isMobile = useIsMobile();
60
+ const [openMobile, setOpenMobile] = React.useState(false);
71
61
 
72
62
  // This is the internal state of the sidebar.
73
63
  // We use openProp and setOpenProp for control from outside the component.
74
- const [_open, _setOpen] = React.useState(defaultOpen)
75
- const open = openProp ?? _open
64
+ const [_open, _setOpen] = React.useState(defaultOpen);
65
+ const open = openProp ?? _open;
76
66
  const setOpen = React.useCallback(
77
67
  (value: boolean | ((value: boolean) => boolean)) => {
78
- const openState = typeof value === "function" ? value(open) : value
68
+ const openState = typeof value === "function" ? value(open) : value;
79
69
  if (setOpenProp) {
80
- setOpenProp(openState)
70
+ setOpenProp(openState);
81
71
  } else {
82
- _setOpen(openState)
72
+ _setOpen(openState);
83
73
  }
84
74
 
85
75
  // This sets the cookie to keep the sidebar state.
86
- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`
76
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
87
77
  },
88
- [setOpenProp, open]
89
- )
78
+ [setOpenProp, open],
79
+ );
90
80
 
91
81
  // Helper to toggle the sidebar.
92
82
  const toggleSidebar = React.useCallback(() => {
93
- return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open)
94
- }, [isMobile, setOpen, setOpenMobile])
83
+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
84
+ }, [isMobile, setOpen, setOpenMobile]);
95
85
 
96
86
  // Adds a keyboard shortcut to toggle the sidebar.
97
87
  React.useEffect(() => {
98
88
  const handleKeyDown = (event: KeyboardEvent) => {
99
- if (
100
- event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
101
- (event.metaKey || event.ctrlKey)
102
- ) {
103
- event.preventDefault()
104
- toggleSidebar()
89
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
90
+ event.preventDefault();
91
+ toggleSidebar();
105
92
  }
106
- }
93
+ };
107
94
 
108
- window.addEventListener("keydown", handleKeyDown)
109
- return () => window.removeEventListener("keydown", handleKeyDown)
110
- }, [toggleSidebar])
95
+ window.addEventListener("keydown", handleKeyDown);
96
+ return () => window.removeEventListener("keydown", handleKeyDown);
97
+ }, [toggleSidebar]);
111
98
 
112
99
  // We add a state so that we can do data-state="expanded" or "collapsed".
113
100
  // This makes it easier to style the sidebar with Tailwind classes.
114
- const state = open ? "expanded" : "collapsed"
101
+ const state = open ? "expanded" : "collapsed";
115
102
 
116
103
  const contextValue = React.useMemo<SidebarContextProps>(
117
104
  () => ({
@@ -123,8 +110,8 @@ function SidebarProvider({
123
110
  setOpenMobile,
124
111
  toggleSidebar,
125
112
  }),
126
- [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
127
- )
113
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
114
+ );
128
115
 
129
116
  return (
130
117
  <SidebarContext.Provider value={contextValue}>
@@ -137,16 +124,13 @@ function SidebarProvider({
137
124
  ...style,
138
125
  } as React.CSSProperties
139
126
  }
140
- className={cn(
141
- "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
142
- className
143
- )}
127
+ className={cn("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", className)}
144
128
  {...props}
145
129
  >
146
130
  {children}
147
131
  </div>
148
132
  </SidebarContext.Provider>
149
- )
133
+ );
150
134
  }
151
135
 
152
136
  function Sidebar({
@@ -157,25 +141,22 @@ function Sidebar({
157
141
  children,
158
142
  ...props
159
143
  }: React.ComponentProps<"div"> & {
160
- side?: "left" | "right"
161
- variant?: "sidebar" | "floating" | "inset"
162
- collapsible?: "offExamples" | "icon" | "none"
144
+ side?: "left" | "right";
145
+ variant?: "sidebar" | "floating" | "inset";
146
+ collapsible?: "offExamples" | "icon" | "none";
163
147
  }) {
164
- const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
148
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
165
149
 
166
150
  if (collapsible === "none") {
167
151
  return (
168
152
  <div
169
153
  data-slot="sidebar"
170
- className={cn(
171
- "bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
172
- className
173
- )}
154
+ className={cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className)}
174
155
  {...props}
175
156
  >
176
157
  {children}
177
158
  </div>
178
- )
159
+ );
179
160
  }
180
161
 
181
162
  if (isMobile) {
@@ -200,7 +181,7 @@ function Sidebar({
200
181
  <div className="flex h-full w-full flex-col">{children}</div>
201
182
  </SheetContent>
202
183
  </Sheet>
203
- )
184
+ );
204
185
  }
205
186
 
206
187
  return (
@@ -221,7 +202,7 @@ function Sidebar({
221
202
  "group-data-[side=right]:rotate-180",
222
203
  variant === "floating" || variant === "inset"
223
204
  ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
224
- : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
205
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
225
206
  )}
226
207
  />
227
208
  <div
@@ -235,7 +216,7 @@ function Sidebar({
235
216
  variant === "floating" || variant === "inset"
236
217
  ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
237
218
  : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
238
- className
219
+ className,
239
220
  )}
240
221
  {...props}
241
222
  >
@@ -248,15 +229,11 @@ function Sidebar({
248
229
  </div>
249
230
  </div>
250
231
  </div>
251
- )
232
+ );
252
233
  }
253
234
 
254
- function SidebarTrigger({
255
- className,
256
- onClick,
257
- ...props
258
- }: React.ComponentProps<typeof Button>) {
259
- const { toggleSidebar } = useSidebar()
235
+ function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
236
+ const { toggleSidebar } = useSidebar();
260
237
 
261
238
  return (
262
239
  <Button
@@ -266,20 +243,19 @@ function SidebarTrigger({
266
243
  size="icon-sm"
267
244
  className={cn(className)}
268
245
  onClick={(event) => {
269
- onClick?.(event)
270
- toggleSidebar()
246
+ onClick?.(event);
247
+ toggleSidebar();
271
248
  }}
272
249
  {...props}
273
250
  >
274
- <PanelLeftIcon
275
- />
251
+ <PanelLeftIcon />
276
252
  <span className="sr-only">Toggle Sidebar</span>
277
253
  </Button>
278
- )
254
+ );
279
255
  }
280
256
 
281
257
  function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
282
- const { toggleSidebar } = useSidebar()
258
+ const { toggleSidebar } = useSidebar();
283
259
 
284
260
  return (
285
261
  <button
@@ -296,11 +272,11 @@ function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
296
272
  "hover:group-data-[collapsible=offExamples]:bg-sidebar group-data-[collapsible=offExamples]:translate-x-0 group-data-[collapsible=offExamples]:after:left-full",
297
273
  "[[data-side=left][data-collapsible=offExamples]_&]:-right-2",
298
274
  "[[data-side=right][data-collapsible=offExamples]_&]:-left-2",
299
- className
275
+ className,
300
276
  )}
301
277
  {...props}
302
278
  />
303
- )
279
+ );
304
280
  }
305
281
 
306
282
  function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
@@ -309,17 +285,14 @@ function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
309
285
  data-slot="sidebar-inset"
310
286
  className={cn(
311
287
  "bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 relative flex w-full flex-1 flex-col",
312
- className
288
+ className,
313
289
  )}
314
290
  {...props}
315
291
  />
316
- )
292
+ );
317
293
  }
318
294
 
319
- function SidebarInput({
320
- className,
321
- ...props
322
- }: React.ComponentProps<typeof Input>) {
295
+ function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>) {
323
296
  return (
324
297
  <Input
325
298
  data-slot="sidebar-input"
@@ -327,7 +300,7 @@ function SidebarInput({
327
300
  className={cn("bg-muted/20 dark:bg-muted/30 border-input h-8 w-full", className)}
328
301
  {...props}
329
302
  />
330
- )
303
+ );
331
304
  }
332
305
 
333
306
  function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {
@@ -338,7 +311,7 @@ function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {
338
311
  className={cn("gap-2 p-2 flex flex-col", className)}
339
312
  {...props}
340
313
  />
341
- )
314
+ );
342
315
  }
343
316
 
344
317
  function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {
@@ -349,13 +322,10 @@ function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {
349
322
  className={cn("gap-2 p-2 flex flex-col", className)}
350
323
  {...props}
351
324
  />
352
- )
325
+ );
353
326
  }
354
327
 
355
- function SidebarSeparator({
356
- className,
357
- ...props
358
- }: React.ComponentProps<typeof Separator>) {
328
+ function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
359
329
  return (
360
330
  <Separator
361
331
  data-slot="sidebar-separator"
@@ -363,7 +333,7 @@ function SidebarSeparator({
363
333
  className={cn("bg-sidebar-border mx-2 w-auto", className)}
364
334
  {...props}
365
335
  />
366
- )
336
+ );
367
337
  }
368
338
 
369
339
  function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
@@ -373,11 +343,11 @@ function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
373
343
  data-sidebar="content"
374
344
  className={cn(
375
345
  "no-scrollbar gap-0 flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden",
376
- className
346
+ className,
377
347
  )}
378
348
  {...props}
379
349
  />
380
- )
350
+ );
381
351
  }
382
352
 
383
353
  function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
@@ -385,13 +355,10 @@ function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
385
355
  <div
386
356
  data-slot="sidebar-group"
387
357
  data-sidebar="group"
388
- className={cn(
389
- "px-2 py-1 relative flex w-full min-w-0 flex-col",
390
- className
391
- )}
358
+ className={cn("px-2 py-1 relative flex w-full min-w-0 flex-col", className)}
392
359
  {...props}
393
360
  />
394
- )
361
+ );
395
362
  }
396
363
 
397
364
  function SidebarGroupLabel({
@@ -405,17 +372,17 @@ function SidebarGroupLabel({
405
372
  {
406
373
  className: cn(
407
374
  "text-sidebar-foreground/70 ring-sidebar-ring h-8 rounded-md px-2 text-xs transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 flex shrink-0 items-center outline-hidden [&>svg]:shrink-0",
408
- className
375
+ className,
409
376
  ),
410
377
  },
411
- props
378
+ props,
412
379
  ),
413
380
  render,
414
381
  state: {
415
382
  slot: "sidebar-group-label",
416
383
  sidebar: "group-label",
417
384
  },
418
- })
385
+ });
419
386
  }
420
387
 
421
388
  function SidebarGroupAction({
@@ -429,23 +396,20 @@ function SidebarGroupAction({
429
396
  {
430
397
  className: cn(
431
398
  "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 w-5 rounded-md p-0 focus-visible:ring-2 [&>svg]:size-4 flex aspect-square items-center justify-center outline-hidden transition-transform [&>svg]:shrink-0 after:absolute after:-inset-2 md:after:hidden group-data-[collapsible=icon]:hidden",
432
- className
399
+ className,
433
400
  ),
434
401
  },
435
- props
402
+ props,
436
403
  ),
437
404
  render,
438
405
  state: {
439
406
  slot: "sidebar-group-action",
440
407
  sidebar: "group-action",
441
408
  },
442
- })
409
+ });
443
410
  }
444
411
 
445
- function SidebarGroupContent({
446
- className,
447
- ...props
448
- }: React.ComponentProps<"div">) {
412
+ function SidebarGroupContent({ className, ...props }: React.ComponentProps<"div">) {
449
413
  return (
450
414
  <div
451
415
  data-slot="sidebar-group-content"
@@ -453,7 +417,7 @@ function SidebarGroupContent({
453
417
  className={cn("text-xs w-full", className)}
454
418
  {...props}
455
419
  />
456
- )
420
+ );
457
421
  }
458
422
 
459
423
  function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
@@ -464,7 +428,7 @@ function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
464
428
  className={cn("gap-px flex w-full min-w-0 flex-col", className)}
465
429
  {...props}
466
430
  />
467
- )
431
+ );
468
432
  }
469
433
 
470
434
  function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
@@ -475,7 +439,7 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
475
439
  className={cn("group/menu-item relative", className)}
476
440
  {...props}
477
441
  />
478
- )
442
+ );
479
443
  }
480
444
 
481
445
  const sidebarMenuButtonVariants = cva(
@@ -484,7 +448,8 @@ const sidebarMenuButtonVariants = cva(
484
448
  variants: {
485
449
  variant: {
486
450
  default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
487
- outline: "bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
451
+ outline:
452
+ "bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
488
453
  },
489
454
  size: {
490
455
  default: "h-8 text-xs",
@@ -496,8 +461,8 @@ const sidebarMenuButtonVariants = cva(
496
461
  variant: "default",
497
462
  size: "default",
498
463
  },
499
- }
500
- )
464
+ },
465
+ );
501
466
 
502
467
  function SidebarMenuButton({
503
468
  render,
@@ -509,17 +474,17 @@ function SidebarMenuButton({
509
474
  ...props
510
475
  }: useRender.ComponentProps<"button"> &
511
476
  React.ComponentProps<"button"> & {
512
- isActive?: boolean
513
- tooltip?: string | React.ComponentProps<typeof TooltipContent>
477
+ isActive?: boolean;
478
+ tooltip?: string | React.ComponentProps<typeof TooltipContent>;
514
479
  } & VariantProps<typeof sidebarMenuButtonVariants>) {
515
- const { isMobile, state } = useSidebar()
480
+ const { isMobile, state } = useSidebar();
516
481
  const comp = useRender({
517
482
  defaultTagName: "button",
518
483
  props: mergeProps<"button">(
519
484
  {
520
485
  className: cn(sidebarMenuButtonVariants({ variant, size }), className),
521
486
  },
522
- props
487
+ props,
523
488
  ),
524
489
  render: !tooltip ? render : TooltipTrigger,
525
490
  state: {
@@ -528,29 +493,24 @@ function SidebarMenuButton({
528
493
  size,
529
494
  active: isActive,
530
495
  },
531
- })
496
+ });
532
497
 
533
498
  if (!tooltip) {
534
- return comp
499
+ return comp;
535
500
  }
536
501
 
537
502
  if (typeof tooltip === "string") {
538
503
  tooltip = {
539
504
  children: tooltip,
540
- }
505
+ };
541
506
  }
542
507
 
543
508
  return (
544
509
  <Tooltip>
545
510
  {comp}
546
- <TooltipContent
547
- side="right"
548
- align="center"
549
- hidden={state !== "collapsed" || isMobile}
550
- {...tooltip}
551
- />
511
+ <TooltipContent side="right" align="center" hidden={state !== "collapsed" || isMobile} {...tooltip} />
552
512
  </Tooltip>
553
- )
513
+ );
554
514
  }
555
515
 
556
516
  function SidebarMenuAction({
@@ -560,7 +520,7 @@ function SidebarMenuAction({
560
520
  ...props
561
521
  }: useRender.ComponentProps<"button"> &
562
522
  React.ComponentProps<"button"> & {
563
- showOnHover?: boolean
523
+ showOnHover?: boolean;
564
524
  }) {
565
525
  return useRender({
566
526
  defaultTagName: "button",
@@ -570,34 +530,31 @@ function SidebarMenuAction({
570
530
  "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 aspect-square w-5 rounded-[calc(var(--radius-sm)-2px)] p-0 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 focus-visible:ring-2 [&>svg]:size-4 flex items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>svg]:shrink-0",
571
531
  showOnHover &&
572
532
  "peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-open:opacity-100 md:opacity-0",
573
- className
533
+ className,
574
534
  ),
575
535
  },
576
- props
536
+ props,
577
537
  ),
578
538
  render,
579
539
  state: {
580
540
  slot: "sidebar-menu-action",
581
541
  sidebar: "menu-action",
582
542
  },
583
- })
543
+ });
584
544
  }
585
545
 
586
- function SidebarMenuBadge({
587
- className,
588
- ...props
589
- }: React.ComponentProps<"div">) {
546
+ function SidebarMenuBadge({ className, ...props }: React.ComponentProps<"div">) {
590
547
  return (
591
548
  <div
592
549
  data-slot="sidebar-menu-badge"
593
550
  data-sidebar="menu-badge"
594
551
  className={cn(
595
552
  "text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 rounded-[calc(var(--radius-sm)-2px)] px-1 text-xs font-medium peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 flex items-center justify-center tabular-nums select-none group-data-[collapsible=icon]:hidden",
596
- className
553
+ className,
597
554
  )}
598
555
  {...props}
599
556
  />
600
- )
557
+ );
601
558
  }
602
559
 
603
560
  function SidebarMenuSkeleton({
@@ -605,12 +562,12 @@ function SidebarMenuSkeleton({
605
562
  showIcon = false,
606
563
  ...props
607
564
  }: React.ComponentProps<"div"> & {
608
- showIcon?: boolean
565
+ showIcon?: boolean;
609
566
  }) {
610
567
  // Random width between 50 to 90%.
611
568
  const [width] = React.useState(() => {
612
- return `${Math.floor(Math.random() * 40) + 50}%`
613
- })
569
+ return `${Math.floor(Math.random() * 40) + 50}%`;
570
+ });
614
571
 
615
572
  return (
616
573
  <div
@@ -619,12 +576,7 @@ function SidebarMenuSkeleton({
619
576
  className={cn("h-8 gap-2 rounded-md px-2 flex items-center", className)}
620
577
  {...props}
621
578
  >
622
- {showIcon && (
623
- <Skeleton
624
- className="size-4 rounded-md"
625
- data-sidebar="menu-skeleton-icon"
626
- />
627
- )}
579
+ {showIcon && <Skeleton className="size-4 rounded-md" data-sidebar="menu-skeleton-icon" />}
628
580
  <Skeleton
629
581
  className="h-4 max-w-(--skeleton-width) flex-1"
630
582
  data-sidebar="menu-skeleton-text"
@@ -635,7 +587,7 @@ function SidebarMenuSkeleton({
635
587
  }
636
588
  />
637
589
  </div>
638
- )
590
+ );
639
591
  }
640
592
 
641
593
  function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
@@ -643,16 +595,16 @@ function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
643
595
  <ul
644
596
  data-slot="sidebar-menu-sub"
645
597
  data-sidebar="menu-sub"
646
- className={cn("border-sidebar-border mx-3.5 translate-x-px gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden flex min-w-0 flex-col", className)}
598
+ className={cn(
599
+ "border-sidebar-border mx-3.5 translate-x-px gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden flex min-w-0 flex-col",
600
+ className,
601
+ )}
647
602
  {...props}
648
603
  />
649
- )
604
+ );
650
605
  }
651
606
 
652
- function SidebarMenuSubItem({
653
- className,
654
- ...props
655
- }: React.ComponentProps<"li">) {
607
+ function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<"li">) {
656
608
  return (
657
609
  <li
658
610
  data-slot="sidebar-menu-sub-item"
@@ -660,7 +612,7 @@ function SidebarMenuSubItem({
660
612
  className={cn("group/menu-sub-item relative", className)}
661
613
  {...props}
662
614
  />
663
- )
615
+ );
664
616
  }
665
617
 
666
618
  function SidebarMenuSubButton({
@@ -671,8 +623,8 @@ function SidebarMenuSubButton({
671
623
  ...props
672
624
  }: useRender.ComponentProps<"a"> &
673
625
  React.ComponentProps<"a"> & {
674
- size?: "sm" | "md"
675
- isActive?: boolean
626
+ size?: "sm" | "md";
627
+ isActive?: boolean;
676
628
  }) {
677
629
  return useRender({
678
630
  defaultTagName: "a",
@@ -680,10 +632,10 @@ function SidebarMenuSubButton({
680
632
  {
681
633
  className: cn(
682
634
  "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground h-7 gap-2 rounded-md px-2 focus-visible:ring-2 data-[size=md]:text-xs data-[size=sm]:text-xs [&>svg]:size-4 flex min-w-0 -translate-x-px items-center overflow-hidden outline-hidden group-data-[collapsible=icon]:hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0",
683
- className
635
+ className,
684
636
  ),
685
637
  },
686
- props
638
+ props,
687
639
  ),
688
640
  render,
689
641
  state: {
@@ -692,7 +644,7 @@ function SidebarMenuSubButton({
692
644
  size,
693
645
  active: isActive,
694
646
  },
695
- })
647
+ });
696
648
  }
697
649
 
698
650
  export {
@@ -720,4 +672,4 @@ export {
720
672
  SidebarSeparator,
721
673
  SidebarTrigger,
722
674
  useSidebar,
723
- }
675
+ };