@shellui/core 0.0.4

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 (247) hide show
  1. package/README.md +17 -0
  2. package/dist/ContentView-CZG-ro_B.js +146 -0
  3. package/dist/ContentView-CZG-ro_B.js.map +1 -0
  4. package/dist/CookiePreferencesView-MhO9FO-4.js +213 -0
  5. package/dist/CookiePreferencesView-MhO9FO-4.js.map +1 -0
  6. package/dist/DefaultLayout-Dbb3uJED.js +394 -0
  7. package/dist/DefaultLayout-Dbb3uJED.js.map +1 -0
  8. package/dist/FullscreenLayout-1SgPHWw-.js +30 -0
  9. package/dist/FullscreenLayout-1SgPHWw-.js.map +1 -0
  10. package/dist/HomeView-DYU-O_Il.js +21 -0
  11. package/dist/HomeView-DYU-O_Il.js.map +1 -0
  12. package/dist/NotFoundView-CeYjJNg0.js +52 -0
  13. package/dist/NotFoundView-CeYjJNg0.js.map +1 -0
  14. package/dist/OverlayShell-pzbqQW25.js +642 -0
  15. package/dist/OverlayShell-pzbqQW25.js.map +1 -0
  16. package/dist/SettingsView-Bndrta44.js +2207 -0
  17. package/dist/SettingsView-Bndrta44.js.map +1 -0
  18. package/dist/ViewRoute-ChSPabOy.js +32 -0
  19. package/dist/ViewRoute-ChSPabOy.js.map +1 -0
  20. package/dist/WindowsLayout-CXGNPKoY.js +633 -0
  21. package/dist/WindowsLayout-CXGNPKoY.js.map +1 -0
  22. package/dist/app.d.ts +3 -0
  23. package/dist/app.d.ts.map +1 -0
  24. package/dist/components/ContentView.d.ts +10 -0
  25. package/dist/components/ContentView.d.ts.map +1 -0
  26. package/dist/components/HomeView.d.ts +2 -0
  27. package/dist/components/HomeView.d.ts.map +1 -0
  28. package/dist/components/LoadingOverlay.d.ts +2 -0
  29. package/dist/components/LoadingOverlay.d.ts.map +1 -0
  30. package/dist/components/NotFoundView.d.ts +2 -0
  31. package/dist/components/NotFoundView.d.ts.map +1 -0
  32. package/dist/components/RouteErrorBoundary.d.ts +2 -0
  33. package/dist/components/RouteErrorBoundary.d.ts.map +1 -0
  34. package/dist/components/ViewRoute.d.ts +7 -0
  35. package/dist/components/ViewRoute.d.ts.map +1 -0
  36. package/dist/components/ui/alert-dialog.d.ts +32 -0
  37. package/dist/components/ui/alert-dialog.d.ts.map +1 -0
  38. package/dist/components/ui/breadcrumb.d.ts +20 -0
  39. package/dist/components/ui/breadcrumb.d.ts.map +1 -0
  40. package/dist/components/ui/button-group.d.ts +7 -0
  41. package/dist/components/ui/button-group.d.ts.map +1 -0
  42. package/dist/components/ui/button.d.ts +12 -0
  43. package/dist/components/ui/button.d.ts.map +1 -0
  44. package/dist/components/ui/dialog.d.ts +24 -0
  45. package/dist/components/ui/dialog.d.ts.map +1 -0
  46. package/dist/components/ui/drawer.d.ts +38 -0
  47. package/dist/components/ui/drawer.d.ts.map +1 -0
  48. package/dist/components/ui/select.d.ts +5 -0
  49. package/dist/components/ui/select.d.ts.map +1 -0
  50. package/dist/components/ui/sidebar.d.ts +46 -0
  51. package/dist/components/ui/sidebar.d.ts.map +1 -0
  52. package/dist/components/ui/sonner.d.ts +6 -0
  53. package/dist/components/ui/sonner.d.ts.map +1 -0
  54. package/dist/components/ui/switch.d.ts +8 -0
  55. package/dist/components/ui/switch.d.ts.map +1 -0
  56. package/dist/constants/urls.d.ts +6 -0
  57. package/dist/constants/urls.d.ts.map +1 -0
  58. package/dist/constants/urls.js +8 -0
  59. package/dist/constants/urls.js.map +1 -0
  60. package/dist/features/alertDialog/DialogContext.d.ts +12 -0
  61. package/dist/features/alertDialog/DialogContext.d.ts.map +1 -0
  62. package/dist/features/config/ConfigProvider.d.ts +15 -0
  63. package/dist/features/config/ConfigProvider.d.ts.map +1 -0
  64. package/dist/features/config/types.d.ts +177 -0
  65. package/dist/features/config/types.d.ts.map +1 -0
  66. package/dist/features/config/useConfig.d.ts +8 -0
  67. package/dist/features/config/useConfig.d.ts.map +1 -0
  68. package/dist/features/cookieConsent/CookieConsentModal.d.ts +6 -0
  69. package/dist/features/cookieConsent/CookieConsentModal.d.ts.map +1 -0
  70. package/dist/features/cookieConsent/CookiePreferencesView.d.ts +2 -0
  71. package/dist/features/cookieConsent/CookiePreferencesView.d.ts.map +1 -0
  72. package/dist/features/cookieConsent/cookieConsent.d.ts +22 -0
  73. package/dist/features/cookieConsent/cookieConsent.d.ts.map +1 -0
  74. package/dist/features/cookieConsent/useCookieConsent.d.ts +15 -0
  75. package/dist/features/cookieConsent/useCookieConsent.d.ts.map +1 -0
  76. package/dist/features/drawer/DrawerContext.d.ts +24 -0
  77. package/dist/features/drawer/DrawerContext.d.ts.map +1 -0
  78. package/dist/features/layouts/AppLayout.d.ts +12 -0
  79. package/dist/features/layouts/AppLayout.d.ts.map +1 -0
  80. package/dist/features/layouts/DefaultLayout.d.ts +10 -0
  81. package/dist/features/layouts/DefaultLayout.d.ts.map +1 -0
  82. package/dist/features/layouts/FullscreenLayout.d.ts +9 -0
  83. package/dist/features/layouts/FullscreenLayout.d.ts.map +1 -0
  84. package/dist/features/layouts/LayoutProviders.d.ts +9 -0
  85. package/dist/features/layouts/LayoutProviders.d.ts.map +1 -0
  86. package/dist/features/layouts/OverlayShell.d.ts +10 -0
  87. package/dist/features/layouts/OverlayShell.d.ts.map +1 -0
  88. package/dist/features/layouts/WindowsLayout.d.ts +24 -0
  89. package/dist/features/layouts/WindowsLayout.d.ts.map +1 -0
  90. package/dist/features/layouts/utils.d.ts +16 -0
  91. package/dist/features/layouts/utils.d.ts.map +1 -0
  92. package/dist/features/modal/ModalContext.d.ts +20 -0
  93. package/dist/features/modal/ModalContext.d.ts.map +1 -0
  94. package/dist/features/sentry/initSentry.d.ts +14 -0
  95. package/dist/features/sentry/initSentry.d.ts.map +1 -0
  96. package/dist/features/settings/SettingsContext.d.ts +10 -0
  97. package/dist/features/settings/SettingsContext.d.ts.map +1 -0
  98. package/dist/features/settings/SettingsIcons.d.ts +22 -0
  99. package/dist/features/settings/SettingsIcons.d.ts.map +1 -0
  100. package/dist/features/settings/SettingsProvider.d.ts +5 -0
  101. package/dist/features/settings/SettingsProvider.d.ts.map +1 -0
  102. package/dist/features/settings/SettingsRoutes.d.ts +7 -0
  103. package/dist/features/settings/SettingsRoutes.d.ts.map +1 -0
  104. package/dist/features/settings/SettingsView.d.ts +2 -0
  105. package/dist/features/settings/SettingsView.d.ts.map +1 -0
  106. package/dist/features/settings/components/Advanced.d.ts +2 -0
  107. package/dist/features/settings/components/Advanced.d.ts.map +1 -0
  108. package/dist/features/settings/components/Appearance.d.ts +2 -0
  109. package/dist/features/settings/components/Appearance.d.ts.map +1 -0
  110. package/dist/features/settings/components/DataPrivacy.d.ts +2 -0
  111. package/dist/features/settings/components/DataPrivacy.d.ts.map +1 -0
  112. package/dist/features/settings/components/Develop.d.ts +2 -0
  113. package/dist/features/settings/components/Develop.d.ts.map +1 -0
  114. package/dist/features/settings/components/LanguageAndRegion.d.ts +2 -0
  115. package/dist/features/settings/components/LanguageAndRegion.d.ts.map +1 -0
  116. package/dist/features/settings/components/ServiceWorker.d.ts +2 -0
  117. package/dist/features/settings/components/ServiceWorker.d.ts.map +1 -0
  118. package/dist/features/settings/components/UpdateApp.d.ts +2 -0
  119. package/dist/features/settings/components/UpdateApp.d.ts.map +1 -0
  120. package/dist/features/settings/components/develop/DialogTestButtons.d.ts +2 -0
  121. package/dist/features/settings/components/develop/DialogTestButtons.d.ts.map +1 -0
  122. package/dist/features/settings/components/develop/DrawerTestButtons.d.ts +2 -0
  123. package/dist/features/settings/components/develop/DrawerTestButtons.d.ts.map +1 -0
  124. package/dist/features/settings/components/develop/ModalTestButtons.d.ts +2 -0
  125. package/dist/features/settings/components/develop/ModalTestButtons.d.ts.map +1 -0
  126. package/dist/features/settings/components/develop/ToastTestButtons.d.ts +2 -0
  127. package/dist/features/settings/components/develop/ToastTestButtons.d.ts.map +1 -0
  128. package/dist/features/settings/hooks/useSettings.d.ts +2 -0
  129. package/dist/features/settings/hooks/useSettings.d.ts.map +1 -0
  130. package/dist/features/sonner/SonnerContext.d.ts +29 -0
  131. package/dist/features/sonner/SonnerContext.d.ts.map +1 -0
  132. package/dist/features/theme/ThemeProvider.d.ts +11 -0
  133. package/dist/features/theme/ThemeProvider.d.ts.map +1 -0
  134. package/dist/features/theme/themes.d.ts +114 -0
  135. package/dist/features/theme/themes.d.ts.map +1 -0
  136. package/dist/features/theme/useTheme.d.ts +10 -0
  137. package/dist/features/theme/useTheme.d.ts.map +1 -0
  138. package/dist/i18n/I18nProvider.d.ts +9 -0
  139. package/dist/i18n/I18nProvider.d.ts.map +1 -0
  140. package/dist/i18n/config.d.ts +23 -0
  141. package/dist/i18n/config.d.ts.map +1 -0
  142. package/dist/i18n/translations/en/common.json.d.ts +19 -0
  143. package/dist/i18n/translations/en/cookieConsent.json.d.ts +53 -0
  144. package/dist/i18n/translations/en/settings.json.d.ts +358 -0
  145. package/dist/i18n/translations/fr/common.json.d.ts +19 -0
  146. package/dist/i18n/translations/fr/cookieConsent.json.d.ts +53 -0
  147. package/dist/i18n/translations/fr/settings.json.d.ts +358 -0
  148. package/dist/index-lmRk5L6z.js +2160 -0
  149. package/dist/index-lmRk5L6z.js.map +1 -0
  150. package/dist/index.d.ts +7 -0
  151. package/dist/index.d.ts.map +1 -0
  152. package/dist/index.js +12 -0
  153. package/dist/index.js.map +1 -0
  154. package/dist/lib/utils.d.ts +3 -0
  155. package/dist/lib/utils.d.ts.map +1 -0
  156. package/dist/lib/z-index.d.ts +29 -0
  157. package/dist/lib/z-index.d.ts.map +1 -0
  158. package/dist/router/router.d.ts +3 -0
  159. package/dist/router/router.d.ts.map +1 -0
  160. package/dist/router/routes.d.ts +4 -0
  161. package/dist/router/routes.d.ts.map +1 -0
  162. package/dist/sidebar-ClIeZ2zb.js +303 -0
  163. package/dist/sidebar-ClIeZ2zb.js.map +1 -0
  164. package/dist/style.css +1 -0
  165. package/dist/switch-8SzUJz7Q.js +44 -0
  166. package/dist/switch-8SzUJz7Q.js.map +1 -0
  167. package/dist/types.js +2 -0
  168. package/dist/types.js.map +1 -0
  169. package/package.json +93 -0
  170. package/postcss.config.js +6 -0
  171. package/src/app.tsx +119 -0
  172. package/src/components/ContentView.tsx +258 -0
  173. package/src/components/HomeView.tsx +19 -0
  174. package/src/components/LoadingOverlay.tsx +12 -0
  175. package/src/components/NotFoundView.tsx +84 -0
  176. package/src/components/RouteErrorBoundary.tsx +95 -0
  177. package/src/components/ViewRoute.tsx +47 -0
  178. package/src/components/ui/alert-dialog.tsx +181 -0
  179. package/src/components/ui/breadcrumb.tsx +155 -0
  180. package/src/components/ui/button-group.tsx +52 -0
  181. package/src/components/ui/button.tsx +51 -0
  182. package/src/components/ui/dialog.tsx +160 -0
  183. package/src/components/ui/drawer.tsx +200 -0
  184. package/src/components/ui/select.tsx +24 -0
  185. package/src/components/ui/sidebar.tsx +406 -0
  186. package/src/components/ui/sonner.tsx +36 -0
  187. package/src/components/ui/switch.tsx +45 -0
  188. package/src/constants/urls.ts +4 -0
  189. package/src/features/alertDialog/DialogContext.tsx +468 -0
  190. package/src/features/config/ConfigProvider.ts +96 -0
  191. package/src/features/config/types.ts +195 -0
  192. package/src/features/config/useConfig.ts +15 -0
  193. package/src/features/cookieConsent/CookieConsentModal.tsx +122 -0
  194. package/src/features/cookieConsent/CookiePreferencesView.tsx +328 -0
  195. package/src/features/cookieConsent/cookieConsent.ts +84 -0
  196. package/src/features/cookieConsent/useCookieConsent.ts +39 -0
  197. package/src/features/drawer/DrawerContext.tsx +116 -0
  198. package/src/features/layouts/AppLayout.tsx +63 -0
  199. package/src/features/layouts/DefaultLayout.tsx +625 -0
  200. package/src/features/layouts/FullscreenLayout.tsx +55 -0
  201. package/src/features/layouts/LayoutProviders.tsx +20 -0
  202. package/src/features/layouts/OverlayShell.tsx +171 -0
  203. package/src/features/layouts/WindowsLayout.tsx +860 -0
  204. package/src/features/layouts/utils.ts +99 -0
  205. package/src/features/modal/ModalContext.tsx +112 -0
  206. package/src/features/sentry/initSentry.ts +72 -0
  207. package/src/features/settings/SettingsContext.tsx +19 -0
  208. package/src/features/settings/SettingsIcons.tsx +452 -0
  209. package/src/features/settings/SettingsProvider.tsx +341 -0
  210. package/src/features/settings/SettingsRoutes.tsx +66 -0
  211. package/src/features/settings/SettingsView.tsx +327 -0
  212. package/src/features/settings/components/Advanced.tsx +128 -0
  213. package/src/features/settings/components/Appearance.tsx +306 -0
  214. package/src/features/settings/components/DataPrivacy.tsx +142 -0
  215. package/src/features/settings/components/Develop.tsx +174 -0
  216. package/src/features/settings/components/LanguageAndRegion.tsx +329 -0
  217. package/src/features/settings/components/ServiceWorker.tsx +363 -0
  218. package/src/features/settings/components/UpdateApp.tsx +206 -0
  219. package/src/features/settings/components/develop/DialogTestButtons.tsx +137 -0
  220. package/src/features/settings/components/develop/DrawerTestButtons.tsx +67 -0
  221. package/src/features/settings/components/develop/ModalTestButtons.tsx +30 -0
  222. package/src/features/settings/components/develop/ToastTestButtons.tsx +179 -0
  223. package/src/features/settings/hooks/useSettings.tsx +10 -0
  224. package/src/features/sonner/SonnerContext.tsx +286 -0
  225. package/src/features/theme/ThemeProvider.tsx +16 -0
  226. package/src/features/theme/themes.ts +561 -0
  227. package/src/features/theme/useTheme.tsx +71 -0
  228. package/src/i18n/I18nProvider.tsx +32 -0
  229. package/src/i18n/config.ts +107 -0
  230. package/src/i18n/translations/en/common.json +16 -0
  231. package/src/i18n/translations/en/cookieConsent.json +50 -0
  232. package/src/i18n/translations/en/settings.json +355 -0
  233. package/src/i18n/translations/fr/common.json +16 -0
  234. package/src/i18n/translations/fr/cookieConsent.json +50 -0
  235. package/src/i18n/translations/fr/settings.json +355 -0
  236. package/src/index.css +412 -0
  237. package/src/index.html +100 -0
  238. package/src/index.ts +31 -0
  239. package/src/lib/utils.ts +6 -0
  240. package/src/lib/z-index.ts +29 -0
  241. package/src/main.tsx +26 -0
  242. package/src/router/router.tsx +8 -0
  243. package/src/router/routes.tsx +115 -0
  244. package/src/service-worker/register.ts +1199 -0
  245. package/src/service-worker/sw-dev.ts +87 -0
  246. package/src/service-worker/sw.ts +105 -0
  247. package/tailwind.config.js +60 -0
@@ -0,0 +1,47 @@
1
+ import { useMemo } from 'react';
2
+ import { Navigate, useLocation } from 'react-router';
3
+ import { ContentView } from './ContentView';
4
+ import type { NavigationItem } from '../features/config/types';
5
+
6
+ interface ViewRouteProps {
7
+ navigation: NavigationItem[];
8
+ }
9
+
10
+ export const ViewRoute = ({ navigation }: ViewRouteProps) => {
11
+ const location = useLocation();
12
+ const pathname = location.pathname;
13
+
14
+ const navItem = useMemo(() => {
15
+ return navigation.find((item) => {
16
+ const pathPrefix = `/${item.path}`;
17
+ return pathname === pathPrefix || pathname.startsWith(`${pathPrefix}/`);
18
+ });
19
+ }, [navigation, pathname]);
20
+
21
+ if (!navItem) {
22
+ return (
23
+ <Navigate
24
+ to="/"
25
+ replace
26
+ />
27
+ );
28
+ }
29
+ // Calculate the relative path from the navItem.path
30
+ // e.g. if item.path is "docs" and pathname is "/docs/intro", subPath is "intro"
31
+ const pathPrefix = `/${navItem.path}`;
32
+ const subPath = pathname.length > pathPrefix.length ? pathname.slice(pathPrefix.length + 1) : '';
33
+
34
+ // Construct the final URL for the iframe
35
+ let finalUrl = navItem.url;
36
+ if (subPath) {
37
+ const baseUrl = navItem.url.endsWith('/') ? navItem.url : `${navItem.url}/`;
38
+ finalUrl = `${baseUrl}${subPath}`;
39
+ }
40
+ return (
41
+ <ContentView
42
+ url={finalUrl}
43
+ pathPrefix={navItem.path}
44
+ navItem={navItem}
45
+ />
46
+ );
47
+ };
@@ -0,0 +1,181 @@
1
+ import {
2
+ forwardRef,
3
+ type ElementRef,
4
+ type ComponentPropsWithoutRef,
5
+ type HTMLAttributes,
6
+ } from 'react';
7
+ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
8
+ import { cva, type VariantProps } from 'class-variance-authority';
9
+ import { cn } from '@/lib/utils';
10
+ import { Z_INDEX } from '@/lib/z-index';
11
+ import { Button, type ButtonProps } from '@/components/ui/button';
12
+
13
+ const AlertDialog = AlertDialogPrimitive.Root;
14
+
15
+ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
16
+
17
+ const AlertDialogPortal = AlertDialogPrimitive.Portal;
18
+
19
+ const AlertDialogOverlay = forwardRef<
20
+ ElementRef<typeof AlertDialogPrimitive.Overlay>,
21
+ ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
22
+ >(({ className, ...props }, ref) => (
23
+ <AlertDialogPrimitive.Overlay
24
+ ref={ref}
25
+ data-dialog-overlay
26
+ className={cn('fixed inset-0 bg-[hsl(var(--background)/0.8)] backdrop-blur-[1px]', className)}
27
+ style={{ zIndex: Z_INDEX.ALERT_DIALOG_OVERLAY }}
28
+ {...props}
29
+ />
30
+ ));
31
+ AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
32
+
33
+ const alertDialogContentVariants = cva(
34
+ 'fixed left-[50%] top-[50%] grid w-full min-w-0 max-w-[calc(100vw-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background py-6 shadow-lg box-border overflow-hidden sm:rounded-lg',
35
+ {
36
+ variants: {
37
+ size: {
38
+ default: 'max-w-lg',
39
+ sm: 'max-w-sm',
40
+ },
41
+ },
42
+ defaultVariants: {
43
+ size: 'default',
44
+ },
45
+ },
46
+ );
47
+
48
+ interface AlertDialogContentProps
49
+ extends
50
+ ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>,
51
+ VariantProps<typeof alertDialogContentVariants> {}
52
+
53
+ const AlertDialogContent = forwardRef<
54
+ ElementRef<typeof AlertDialogPrimitive.Content>,
55
+ AlertDialogContentProps
56
+ >(({ className, size = 'default', children, style, ...props }, ref) => (
57
+ <AlertDialogPortal>
58
+ <AlertDialogOverlay />
59
+ <AlertDialogPrimitive.Content
60
+ ref={ref}
61
+ data-dialog-content
62
+ className={cn(alertDialogContentVariants({ size }), 'group', className)}
63
+ data-size={size}
64
+ style={{ zIndex: Z_INDEX.ALERT_DIALOG_CONTENT, ...style }}
65
+ {...props}
66
+ >
67
+ {children}
68
+ </AlertDialogPrimitive.Content>
69
+ </AlertDialogPortal>
70
+ ));
71
+ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
72
+
73
+ const AlertDialogHeader = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
74
+ <div
75
+ className={cn(
76
+ 'flex flex-col px-6 space-y-2 text-left group-data-[size=sm]:items-center group-data-[size=sm]:text-center',
77
+ className,
78
+ )}
79
+ {...props}
80
+ />
81
+ );
82
+ AlertDialogHeader.displayName = 'AlertDialogHeader';
83
+
84
+ const AlertDialogMedia = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
85
+ <div
86
+ className={cn(
87
+ 'flex size-10 shrink-0 items-center justify-center rounded-lg mb-4 [&>svg]:size-5',
88
+ className,
89
+ )}
90
+ {...props}
91
+ />
92
+ );
93
+ AlertDialogMedia.displayName = 'AlertDialogMedia';
94
+
95
+ const AlertDialogFooter = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
96
+ <div
97
+ className={cn(
98
+ 'flex w-full min-w-full flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
99
+ '-mb-6 mt-2 border-t border-border bg-muted/50 px-6 py-3 sm:rounded-b-lg',
100
+ '[&_button]:h-8 [&_button]:text-xs [&_button]:px-3',
101
+ 'group-data-[size=sm]:flex-row group-data-[size=sm]:gap-2',
102
+ 'group-data-[size=sm]:[&>*:not(:only-child)]:min-w-0 group-data-[size=sm]:[&>*:not(:only-child)]:flex-1',
103
+ className,
104
+ )}
105
+ {...props}
106
+ />
107
+ );
108
+ AlertDialogFooter.displayName = 'AlertDialogFooter';
109
+
110
+ const AlertDialogTitle = forwardRef<
111
+ ElementRef<typeof AlertDialogPrimitive.Title>,
112
+ ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
113
+ >(({ className, ...props }, ref) => (
114
+ <AlertDialogPrimitive.Title
115
+ ref={ref}
116
+ className={cn('text-lg font-semibold leading-none tracking-tight', className)}
117
+ {...props}
118
+ />
119
+ ));
120
+ AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
121
+
122
+ const AlertDialogDescription = forwardRef<
123
+ ElementRef<typeof AlertDialogPrimitive.Description>,
124
+ ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
125
+ >(({ className, ...props }, ref) => (
126
+ <AlertDialogPrimitive.Description
127
+ ref={ref}
128
+ className={cn('text-sm text-muted-foreground', className)}
129
+ {...props}
130
+ />
131
+ ));
132
+ AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
133
+
134
+ const AlertDialogAction = forwardRef<
135
+ ElementRef<typeof AlertDialogPrimitive.Action>,
136
+ ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action> &
137
+ Pick<ButtonProps, 'variant' | 'size'>
138
+ >(({ className, variant, size, ...props }, ref) => (
139
+ <AlertDialogPrimitive.Action asChild>
140
+ <Button
141
+ ref={ref}
142
+ variant={variant}
143
+ size={size}
144
+ className={className}
145
+ {...props}
146
+ />
147
+ </AlertDialogPrimitive.Action>
148
+ ));
149
+ AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
150
+
151
+ const AlertDialogCancel = forwardRef<
152
+ ElementRef<typeof AlertDialogPrimitive.Cancel>,
153
+ ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel> &
154
+ Pick<ButtonProps, 'variant' | 'size'>
155
+ >(({ className, variant, size, ...props }, ref) => (
156
+ <AlertDialogPrimitive.Cancel asChild>
157
+ <Button
158
+ ref={ref}
159
+ variant={variant}
160
+ size={size}
161
+ className={className}
162
+ {...props}
163
+ />
164
+ </AlertDialogPrimitive.Cancel>
165
+ ));
166
+ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
167
+
168
+ export {
169
+ AlertDialog,
170
+ AlertDialogPortal,
171
+ AlertDialogOverlay,
172
+ AlertDialogTrigger,
173
+ AlertDialogContent,
174
+ AlertDialogHeader,
175
+ AlertDialogMedia,
176
+ AlertDialogFooter,
177
+ AlertDialogTitle,
178
+ AlertDialogDescription,
179
+ AlertDialogAction,
180
+ AlertDialogCancel,
181
+ };
@@ -0,0 +1,155 @@
1
+ import {
2
+ forwardRef,
3
+ type ComponentPropsWithoutRef,
4
+ type ComponentProps,
5
+ type ReactNode,
6
+ } from 'react';
7
+ import { Slot } from '@radix-ui/react-slot';
8
+ import { cn } from '@/lib/utils';
9
+
10
+ const Breadcrumb = forwardRef<
11
+ HTMLElement,
12
+ ComponentPropsWithoutRef<'nav'> & {
13
+ separator?: ReactNode;
14
+ }
15
+ >(({ ...props }, ref) => (
16
+ <nav
17
+ ref={ref}
18
+ aria-label="breadcrumb"
19
+ {...props}
20
+ />
21
+ ));
22
+ Breadcrumb.displayName = 'Breadcrumb';
23
+
24
+ const BreadcrumbList = forwardRef<HTMLOListElement, ComponentPropsWithoutRef<'ol'>>(
25
+ ({ className, ...props }, ref) => (
26
+ <ol
27
+ ref={ref}
28
+ className={cn(
29
+ 'flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5',
30
+ className,
31
+ )}
32
+ {...props}
33
+ />
34
+ ),
35
+ );
36
+ BreadcrumbList.displayName = 'BreadcrumbList';
37
+
38
+ const BreadcrumbItem = forwardRef<HTMLLIElement, ComponentPropsWithoutRef<'li'>>(
39
+ ({ className, ...props }, ref) => (
40
+ <li
41
+ ref={ref}
42
+ className={cn('inline-flex items-center gap-1.5', className)}
43
+ {...props}
44
+ />
45
+ ),
46
+ );
47
+ BreadcrumbItem.displayName = 'BreadcrumbItem';
48
+
49
+ const BreadcrumbLink = forwardRef<
50
+ HTMLAnchorElement,
51
+ ComponentPropsWithoutRef<'a'> & {
52
+ asChild?: boolean;
53
+ }
54
+ >(({ asChild, className, ...props }, ref) => {
55
+ const Comp = asChild ? Slot : 'a';
56
+
57
+ return (
58
+ <Comp
59
+ ref={ref}
60
+ className={cn('transition-colors hover:text-foreground', className)}
61
+ {...props}
62
+ />
63
+ );
64
+ });
65
+ BreadcrumbLink.displayName = 'BreadcrumbLink';
66
+
67
+ const BreadcrumbPage = forwardRef<HTMLSpanElement, ComponentPropsWithoutRef<'span'>>(
68
+ ({ className, ...props }, ref) => (
69
+ <span
70
+ ref={ref}
71
+ role="link"
72
+ aria-disabled="true"
73
+ aria-current="page"
74
+ className={cn('font-normal text-foreground', className)}
75
+ {...props}
76
+ />
77
+ ),
78
+ );
79
+ BreadcrumbPage.displayName = 'BreadcrumbPage';
80
+
81
+ const BreadcrumbSeparator = ({ children, className, ...props }: ComponentProps<'li'>) => (
82
+ <li
83
+ role="presentation"
84
+ aria-hidden="true"
85
+ className={cn('[&>svg]:size-3.5', className)}
86
+ {...props}
87
+ >
88
+ {children ?? (
89
+ <svg
90
+ xmlns="http://www.w3.org/2000/svg"
91
+ width="24"
92
+ height="24"
93
+ viewBox="0 0 24 24"
94
+ fill="none"
95
+ stroke="currentColor"
96
+ strokeWidth="2"
97
+ strokeLinecap="round"
98
+ strokeLinejoin="round"
99
+ >
100
+ <polyline points="9 18 15 12 9 6" />
101
+ </svg>
102
+ )}
103
+ </li>
104
+ );
105
+ BreadcrumbSeparator.displayName = 'BreadcrumbSeparator';
106
+
107
+ const BreadcrumbEllipsis = ({ className, ...props }: ComponentProps<'span'>) => (
108
+ <span
109
+ role="presentation"
110
+ aria-hidden="true"
111
+ className={cn('flex h-9 w-9 items-center justify-center', className)}
112
+ {...props}
113
+ >
114
+ <svg
115
+ xmlns="http://www.w3.org/2000/svg"
116
+ width="24"
117
+ height="24"
118
+ viewBox="0 0 24 24"
119
+ fill="none"
120
+ stroke="currentColor"
121
+ strokeWidth="2"
122
+ strokeLinecap="round"
123
+ strokeLinejoin="round"
124
+ className="h-4 w-4"
125
+ >
126
+ <circle
127
+ cx="12"
128
+ cy="12"
129
+ r="1"
130
+ />
131
+ <circle
132
+ cx="19"
133
+ cy="12"
134
+ r="1"
135
+ />
136
+ <circle
137
+ cx="5"
138
+ cy="12"
139
+ r="1"
140
+ />
141
+ </svg>
142
+ <span className="sr-only">More</span>
143
+ </span>
144
+ );
145
+ BreadcrumbEllipsis.displayName = 'BreadcrumbEllipsis';
146
+
147
+ export {
148
+ Breadcrumb,
149
+ BreadcrumbList,
150
+ BreadcrumbItem,
151
+ BreadcrumbLink,
152
+ BreadcrumbPage,
153
+ BreadcrumbSeparator,
154
+ BreadcrumbEllipsis,
155
+ };
@@ -0,0 +1,52 @@
1
+ import {
2
+ forwardRef,
3
+ Children,
4
+ isValidElement,
5
+ cloneElement,
6
+ type HTMLAttributes,
7
+ type ReactNode,
8
+ type ReactElement,
9
+ } from 'react';
10
+ import { cn } from '@/lib/utils';
11
+
12
+ export interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {
13
+ children: ReactNode;
14
+ }
15
+
16
+ const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(
17
+ ({ className, children, ...props }, ref) => {
18
+ return (
19
+ <div
20
+ ref={ref}
21
+ className={cn('inline-flex rounded-md', className)}
22
+ role="group"
23
+ {...props}
24
+ >
25
+ {Children.map(children, (child, index) => {
26
+ if (isValidElement(child)) {
27
+ const isFirst = index === 0;
28
+ const isLast = index === Children.count(children) - 1;
29
+
30
+ return cloneElement(child as ReactElement<Record<string, unknown>>, {
31
+ className: cn(
32
+ // Remove rounded corners from all buttons
33
+ 'rounded-none',
34
+ // First button: rounded left only (uses theme radius)
35
+ isFirst && 'rounded-l-md',
36
+ // Last button: rounded right only (uses theme radius)
37
+ isLast && 'rounded-r-md',
38
+ // Remove left border from all except first, using theme border color
39
+ !isFirst && 'border-l-0 -ml-px',
40
+ (child as ReactElement<{ className?: string }>).props.className,
41
+ ),
42
+ });
43
+ }
44
+ return child;
45
+ })}
46
+ </div>
47
+ );
48
+ },
49
+ );
50
+ ButtonGroup.displayName = 'ButtonGroup';
51
+
52
+ export { ButtonGroup };
@@ -0,0 +1,51 @@
1
+ import { forwardRef, type ButtonHTMLAttributes } from 'react';
2
+ import { Slot } from '@radix-ui/react-slot';
3
+ import { cva, type VariantProps } from 'class-variance-authority';
4
+ import { cn } from '@/lib/utils';
5
+
6
+ const buttonVariants = cva(
7
+ 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-pointer disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: 'bg-primary text-primary-foreground hover:bg-primary/90',
12
+ destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
13
+ outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
14
+ secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
15
+ ghost: 'hover:bg-accent hover:text-accent-foreground',
16
+ link: 'text-primary underline-offset-4 hover:underline',
17
+ },
18
+ size: {
19
+ default: 'h-10 px-4 py-2',
20
+ sm: 'h-9 rounded-md px-3',
21
+ lg: 'h-11 rounded-md px-8',
22
+ icon: 'h-10 w-10',
23
+ },
24
+ },
25
+ defaultVariants: {
26
+ variant: 'default',
27
+ size: 'default',
28
+ },
29
+ },
30
+ );
31
+
32
+ export interface ButtonProps
33
+ extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
34
+ asChild?: boolean;
35
+ }
36
+
37
+ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
38
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
39
+ const Comp = asChild ? Slot : 'button';
40
+ return (
41
+ <Comp
42
+ className={cn(buttonVariants({ variant, size, className }))}
43
+ ref={ref}
44
+ {...props}
45
+ />
46
+ );
47
+ },
48
+ );
49
+ Button.displayName = 'Button';
50
+
51
+ export { Button, buttonVariants };
@@ -0,0 +1,160 @@
1
+ import {
2
+ forwardRef,
3
+ useCallback,
4
+ Children,
5
+ type ElementRef,
6
+ type ComponentPropsWithoutRef,
7
+ type ComponentProps,
8
+ type HTMLAttributes,
9
+ } from 'react';
10
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
11
+ import { cn } from '@/lib/utils';
12
+ import { Z_INDEX } from '@/lib/z-index';
13
+
14
+ const Dialog = DialogPrimitive.Root;
15
+
16
+ const DialogTrigger = DialogPrimitive.Trigger;
17
+
18
+ const DialogPortal = DialogPrimitive.Portal;
19
+
20
+ const DialogClose = DialogPrimitive.Close;
21
+
22
+ const DialogOverlay = forwardRef<
23
+ ElementRef<typeof DialogPrimitive.Overlay>,
24
+ ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
25
+ >(({ className, ...props }, ref) => (
26
+ <DialogPrimitive.Overlay
27
+ ref={ref}
28
+ data-dialog-overlay
29
+ className={cn('fixed inset-0 bg-[hsl(var(--background)/0.8)] backdrop-blur-[1px]', className)}
30
+ style={{ zIndex: Z_INDEX.MODAL_OVERLAY }}
31
+ {...props}
32
+ />
33
+ ));
34
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
35
+
36
+ interface DialogContentProps extends ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
37
+ /** When true, the default close (X) button is not rendered. Escape and overlay still close. */
38
+ hideCloseButton?: boolean;
39
+ }
40
+
41
+ const DialogContent = forwardRef<ElementRef<typeof DialogPrimitive.Content>, DialogContentProps>(
42
+ ({ className, children, onPointerDownOutside, hideCloseButton, ...props }, ref) => {
43
+ const hasContent = Children.count(children) > 2;
44
+
45
+ const handlePointerDownOutside = useCallback(
46
+ (
47
+ event: Parameters<NonNullable<ComponentProps<typeof DialogPrimitive.Content>['onPointerDownOutside']>>[0],
48
+ ) => {
49
+ const target = event?.target as Element | null;
50
+ if (target?.closest?.('[data-sonner-toaster]')) {
51
+ event.preventDefault();
52
+ }
53
+ onPointerDownOutside?.(event);
54
+ },
55
+ [onPointerDownOutside],
56
+ );
57
+
58
+ return (
59
+ <DialogPortal>
60
+ <DialogOverlay />
61
+ <DialogPrimitive.Content
62
+ ref={ref}
63
+ data-dialog-content
64
+ data-has-content={hasContent}
65
+ className={cn(
66
+ 'fixed left-[50%] top-[50%] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-6 border bg-background px-6 pt-0 pb-0 shadow-lg sm:rounded-lg',
67
+ 'data-[has-content=false]:gap-0 data-[has-content=false]:[&>[data-dialog-header]]:border-b-0 data-[has-content=false]:[&>[data-dialog-header]]:pb-0',
68
+ className,
69
+ )}
70
+ style={{ backgroundColor: 'hsl(var(--background))', zIndex: Z_INDEX.MODAL_CONTENT }}
71
+ onPointerDownOutside={handlePointerDownOutside}
72
+ {...props}
73
+ >
74
+ {children}
75
+ {!hideCloseButton && (
76
+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground cursor-pointer">
77
+ <svg
78
+ xmlns="http://www.w3.org/2000/svg"
79
+ width="24"
80
+ height="24"
81
+ viewBox="0 0 24 24"
82
+ fill="none"
83
+ stroke="currentColor"
84
+ strokeWidth="2"
85
+ strokeLinecap="round"
86
+ strokeLinejoin="round"
87
+ className="h-4 w-4"
88
+ >
89
+ <path d="M18 6 6 18" />
90
+ <path d="m6 6 12 12" />
91
+ </svg>
92
+ <span className="sr-only">Close</span>
93
+ </DialogPrimitive.Close>
94
+ )}
95
+ </DialogPrimitive.Content>
96
+ </DialogPortal>
97
+ );
98
+ },
99
+ );
100
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
101
+
102
+ const DialogHeader = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
103
+ <div
104
+ data-dialog-header
105
+ className={cn(
106
+ '-mx-6 flex flex-col space-y-2.5 border-b border-border/60 px-6 pt-5 pb-4 text-left',
107
+ className,
108
+ )}
109
+ {...props}
110
+ />
111
+ );
112
+ DialogHeader.displayName = 'DialogHeader';
113
+
114
+ const DialogFooter = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
115
+ <div
116
+ className={cn(
117
+ '-mx-6 mt-4 flex flex-col-reverse gap-2 rounded-b-lg border-t border-border bg-sidebar-background px-6 py-2 text-sidebar-foreground sm:flex-row sm:justify-end sm:space-x-2 [&_button]:h-8 [&_button]:px-3 [&_button]:text-xs',
118
+ className,
119
+ )}
120
+ {...props}
121
+ />
122
+ );
123
+ DialogFooter.displayName = 'DialogFooter';
124
+
125
+ const DialogTitle = forwardRef<
126
+ ElementRef<typeof DialogPrimitive.Title>,
127
+ ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
128
+ >(({ className, ...props }, ref) => (
129
+ <DialogPrimitive.Title
130
+ ref={ref}
131
+ className={cn('text-lg font-semibold leading-none tracking-tight', className)}
132
+ {...props}
133
+ />
134
+ ));
135
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
136
+
137
+ const DialogDescription = forwardRef<
138
+ ElementRef<typeof DialogPrimitive.Description>,
139
+ ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
140
+ >(({ className, ...props }, ref) => (
141
+ <DialogPrimitive.Description
142
+ ref={ref}
143
+ className={cn('text-sm text-muted-foreground', className)}
144
+ {...props}
145
+ />
146
+ ));
147
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
148
+
149
+ export {
150
+ Dialog,
151
+ DialogPortal,
152
+ DialogOverlay,
153
+ DialogClose,
154
+ DialogTrigger,
155
+ DialogContent,
156
+ DialogHeader,
157
+ DialogFooter,
158
+ DialogTitle,
159
+ DialogDescription,
160
+ };