@trackany-device/components 1.0.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 (289) hide show
  1. package/package.json +185 -0
  2. package/src/assets/logo.png +0 -0
  3. package/src/assets/map/arrows/map-arrow-blue.png +0 -0
  4. package/src/assets/map/arrows/map-arrow-green.png +0 -0
  5. package/src/assets/map/arrows/map-arrow-purple.png +0 -0
  6. package/src/assets/map/arrows/map-arrow-red.png +0 -0
  7. package/src/assets/map/flags/flag-blue.png +0 -0
  8. package/src/assets/map/flags/flag-green.png +0 -0
  9. package/src/assets/map/flags/flag-red.png +0 -0
  10. package/src/assets/map/flags/flag-yellow.png +0 -0
  11. package/src/assets/map/pins/map-pin-blue.png +0 -0
  12. package/src/assets/map/pins/map-pin-green.png +0 -0
  13. package/src/assets/map/pins/map-pin-purple.png +0 -0
  14. package/src/assets/map/pins/map-pin-red.png +0 -0
  15. package/src/components/Card.tsx +9 -0
  16. package/src/components/alert-error.tsx +24 -0
  17. package/src/components/app-content.tsx +22 -0
  18. package/src/components/app-header.tsx +153 -0
  19. package/src/components/app-logo-icon.tsx +13 -0
  20. package/src/components/app-logo.tsx +21 -0
  21. package/src/components/app-shell.tsx +19 -0
  22. package/src/components/app-sidebar-header.tsx +68 -0
  23. package/src/components/app-sidebar.tsx +106 -0
  24. package/src/components/appearance-tabs.tsx +46 -0
  25. package/src/components/breadcrumbs.tsx +50 -0
  26. package/src/components/cms/blurred-image.tsx +111 -0
  27. package/src/components/cms/section-bg.tsx +473 -0
  28. package/src/components/cms/section-button.tsx +127 -0
  29. package/src/components/cms/sections/banner-5050-section.tsx +135 -0
  30. package/src/components/cms/sections/blogs-listing-section.tsx +270 -0
  31. package/src/components/cms/sections/cards-grid-section.tsx +185 -0
  32. package/src/components/cms/sections/contact-form-section.tsx +157 -0
  33. package/src/components/cms/sections/cta-section.tsx +101 -0
  34. package/src/components/cms/sections/featured-blog-slider-section.tsx +256 -0
  35. package/src/components/cms/sections/featured-products-grid-section.tsx +173 -0
  36. package/src/components/cms/sections/featured-solutions-grid-section.tsx +183 -0
  37. package/src/components/cms/sections/hero-section.tsx +180 -0
  38. package/src/components/cms/sections/solutions-with-filter-section.tsx +234 -0
  39. package/src/components/cms/sections/text-section.tsx +77 -0
  40. package/src/components/cutout-image.tsx +228 -0
  41. package/src/components/devices/devices-mini-map.tsx +275 -0
  42. package/src/components/docs/docs-shell.tsx +280 -0
  43. package/src/components/fleet-hero-animated.tsx +383 -0
  44. package/src/components/input-error.tsx +17 -0
  45. package/src/components/keenicons/assets/duotone/Read Me.txt +7 -0
  46. package/src/components/keenicons/assets/duotone/demo-files/demo.css +160 -0
  47. package/src/components/keenicons/assets/duotone/demo-files/demo.js +32 -0
  48. package/src/components/keenicons/assets/duotone/demo.html +12424 -0
  49. package/src/components/keenicons/assets/duotone/fonts/keenicons-duotone.svg +1109 -0
  50. package/src/components/keenicons/assets/duotone/fonts/keenicons-duotone.ttf +0 -0
  51. package/src/components/keenicons/assets/duotone/fonts/keenicons-duotone.woff +0 -0
  52. package/src/components/keenicons/assets/duotone/selection.json +17313 -0
  53. package/src/components/keenicons/assets/duotone/style.css +4931 -0
  54. package/src/components/keenicons/assets/filled/Read Me.txt +7 -0
  55. package/src/components/keenicons/assets/filled/demo-files/demo.css +160 -0
  56. package/src/components/keenicons/assets/filled/demo-files/demo.js +32 -0
  57. package/src/components/keenicons/assets/filled/demo.html +12370 -0
  58. package/src/components/keenicons/assets/filled/fonts/keenicons-filled.svg +1082 -0
  59. package/src/components/keenicons/assets/filled/fonts/keenicons-filled.ttf +0 -0
  60. package/src/components/keenicons/assets/filled/fonts/keenicons-filled.woff +0 -0
  61. package/src/components/keenicons/assets/filled/selection.json +17096 -0
  62. package/src/components/keenicons/assets/filled/style.css +4769 -0
  63. package/src/components/keenicons/assets/outline/Read Me.txt +7 -0
  64. package/src/components/keenicons/assets/outline/demo-files/demo.css +160 -0
  65. package/src/components/keenicons/assets/outline/demo-files/demo.js +32 -0
  66. package/src/components/keenicons/assets/outline/demo.html +11356 -0
  67. package/src/components/keenicons/assets/outline/fonts/keenicons-outline.svg +575 -0
  68. package/src/components/keenicons/assets/outline/fonts/keenicons-outline.ttf +0 -0
  69. package/src/components/keenicons/assets/outline/fonts/keenicons-outline.woff +0 -0
  70. package/src/components/keenicons/assets/outline/selection.json +13054 -0
  71. package/src/components/keenicons/assets/outline/style.css +1721 -0
  72. package/src/components/keenicons/assets/solid/Read Me.txt +7 -0
  73. package/src/components/keenicons/assets/solid/demo-files/demo.css +160 -0
  74. package/src/components/keenicons/assets/solid/demo-files/demo.js +32 -0
  75. package/src/components/keenicons/assets/solid/demo.html +11356 -0
  76. package/src/components/keenicons/assets/solid/fonts/keenicons-solid.svg +575 -0
  77. package/src/components/keenicons/assets/solid/fonts/keenicons-solid.ttf +0 -0
  78. package/src/components/keenicons/assets/solid/fonts/keenicons-solid.woff +0 -0
  79. package/src/components/keenicons/assets/solid/selection.json +13048 -0
  80. package/src/components/keenicons/assets/solid/style.css +1721 -0
  81. package/src/components/keenicons/assets/styles.css +4 -0
  82. package/src/components/keenicons/index.ts +2 -0
  83. package/src/components/keenicons/keenicons.tsx +16 -0
  84. package/src/components/keenicons/types.ts +7 -0
  85. package/src/components/nav-footer.tsx +49 -0
  86. package/src/components/nav-main.tsx +53 -0
  87. package/src/components/nav-user.tsx +59 -0
  88. package/src/components/notification-bell.tsx +190 -0
  89. package/src/components/products/product-card.tsx +159 -0
  90. package/src/components/text-link.tsx +23 -0
  91. package/src/components/ui/accordion-menu.tsx +322 -0
  92. package/src/components/ui/accordion.tsx +133 -0
  93. package/src/components/ui/alert-dialog.tsx +82 -0
  94. package/src/components/ui/alert.tsx +63 -0
  95. package/src/components/ui/avatar-group.tsx +129 -0
  96. package/src/components/ui/avatar.tsx +67 -0
  97. package/src/components/ui/badge.tsx +230 -0
  98. package/src/components/ui/breadcrumb.tsx +88 -0
  99. package/src/components/ui/button.tsx +412 -0
  100. package/src/components/ui/calendar.tsx +56 -0
  101. package/src/components/ui/card.tsx +147 -0
  102. package/src/components/ui/chart.tsx +290 -0
  103. package/src/components/ui/checkbox.tsx +47 -0
  104. package/src/components/ui/code.tsx +45 -0
  105. package/src/components/ui/collapsible.tsx +31 -0
  106. package/src/components/ui/command-palette.tsx +189 -0
  107. package/src/components/ui/command.tsx +138 -0
  108. package/src/components/ui/cookie-banner.tsx +220 -0
  109. package/src/components/ui/copy-button.tsx +60 -0
  110. package/src/components/ui/data-grid-column-filter.tsx +124 -0
  111. package/src/components/ui/data-grid-column-header.tsx +284 -0
  112. package/src/components/ui/data-grid-column-visibility.tsx +38 -0
  113. package/src/components/ui/data-grid-pagination.tsx +206 -0
  114. package/src/components/ui/data-grid-table-dnd-rows.tsx +147 -0
  115. package/src/components/ui/data-grid-table-dnd.tsx +175 -0
  116. package/src/components/ui/data-grid-table.tsx +500 -0
  117. package/src/components/ui/data-grid.tsx +193 -0
  118. package/src/components/ui/data-list.tsx +76 -0
  119. package/src/components/ui/datefield.tsx +91 -0
  120. package/src/components/ui/dialog.tsx +139 -0
  121. package/src/components/ui/divider.tsx +41 -0
  122. package/src/components/ui/drawer.tsx +59 -0
  123. package/src/components/ui/dropdown-menu.tsx +224 -0
  124. package/src/components/ui/empty-state.tsx +54 -0
  125. package/src/components/ui/file-upload.tsx +152 -0
  126. package/src/components/ui/form.tsx +88 -0
  127. package/src/components/ui/icon.tsx +14 -0
  128. package/src/components/ui/input-otp.tsx +71 -0
  129. package/src/components/ui/input.tsx +155 -0
  130. package/src/components/ui/kbd.tsx +26 -0
  131. package/src/components/ui/label.tsx +31 -0
  132. package/src/components/ui/navigation-menu.tsx +168 -0
  133. package/src/components/ui/pagination.tsx +37 -0
  134. package/src/components/ui/placeholder-pattern.tsx +21 -0
  135. package/src/components/ui/popover.tsx +50 -0
  136. package/src/components/ui/progress.tsx +65 -0
  137. package/src/components/ui/radio-group.tsx +73 -0
  138. package/src/components/ui/resizable.tsx +39 -0
  139. package/src/components/ui/scroll-area.tsx +50 -0
  140. package/src/components/ui/select.tsx +234 -0
  141. package/src/components/ui/separator.tsx +24 -0
  142. package/src/components/ui/sheet.tsx +147 -0
  143. package/src/components/ui/sidebar.tsx +721 -0
  144. package/src/components/ui/skeleton.tsx +15 -0
  145. package/src/components/ui/slider.tsx +35 -0
  146. package/src/components/ui/sonner.tsx +28 -0
  147. package/src/components/ui/sortable.tsx +724 -0
  148. package/src/components/ui/spinner.tsx +17 -0
  149. package/src/components/ui/stat-card.tsx +82 -0
  150. package/src/components/ui/stepper.tsx +410 -0
  151. package/src/components/ui/switch.tsx +68 -0
  152. package/src/components/ui/table.tsx +42 -0
  153. package/src/components/ui/tabs.tsx +196 -0
  154. package/src/components/ui/timeline.tsx +90 -0
  155. package/src/components/ui/toggle-group.tsx +73 -0
  156. package/src/components/ui/toggle.tsx +45 -0
  157. package/src/components/ui/tooltip.tsx +55 -0
  158. package/src/components/user-info.tsx +33 -0
  159. package/src/components/user-menu-content.tsx +53 -0
  160. package/src/components/web/SiteFooter.tsx +154 -0
  161. package/src/components/web/SiteHeader.tsx +159 -0
  162. package/src/components/workflows/workflow-canvas.tsx +321 -0
  163. package/src/controls/Blockquote.tsx +25 -0
  164. package/src/controls/Button.tsx +101 -0
  165. package/src/controls/Checkbox.tsx +29 -0
  166. package/src/controls/DateField.tsx +37 -0
  167. package/src/controls/FormField.tsx +20 -0
  168. package/src/controls/Heading.tsx +28 -0
  169. package/src/controls/Input.tsx +21 -0
  170. package/src/controls/Label.tsx +18 -0
  171. package/src/controls/Paragraph.tsx +39 -0
  172. package/src/controls/PasswordInput.tsx +40 -0
  173. package/src/controls/RadioGroup.tsx +70 -0
  174. package/src/controls/Select.tsx +24 -0
  175. package/src/controls/Slider.tsx +33 -0
  176. package/src/controls/Switch.tsx +31 -0
  177. package/src/controls/Textarea.tsx +22 -0
  178. package/src/elements/ConfirmPasswordForm.tsx +43 -0
  179. package/src/elements/DeviceStatusBadge.tsx +38 -0
  180. package/src/elements/DriverCard.tsx +67 -0
  181. package/src/elements/ForgotPasswordForm.tsx +64 -0
  182. package/src/elements/IncidentCard.tsx +67 -0
  183. package/src/elements/LoginForm.tsx +100 -0
  184. package/src/elements/OtpForm.tsx +71 -0
  185. package/src/elements/RegisterForm.tsx +150 -0
  186. package/src/elements/ResetPasswordForm.tsx +72 -0
  187. package/src/elements/SmsChallengeForm.tsx +104 -0
  188. package/src/elements/VehicleCard.tsx +73 -0
  189. package/src/elements/VerifyEmailForm.tsx +39 -0
  190. package/src/hooks/use-appearance.tsx +117 -0
  191. package/src/hooks/use-applied-theme.ts +98 -0
  192. package/src/hooks/use-clipboard.ts +34 -0
  193. package/src/hooks/use-current-url.ts +83 -0
  194. package/src/hooks/use-dark-mode.ts +48 -0
  195. package/src/hooks/use-flash-toast.ts +29 -0
  196. package/src/hooks/use-initials.tsx +24 -0
  197. package/src/hooks/use-mobile-navigation.ts +12 -0
  198. package/src/hooks/use-mobile.tsx +38 -0
  199. package/src/index.ts +408 -0
  200. package/src/layouts/AppLayout.tsx +60 -0
  201. package/src/layouts/AuthLayout.tsx +32 -0
  202. package/src/layouts/SettingsLayout.tsx +21 -0
  203. package/src/layouts/app/AIChatLayout.tsx +73 -0
  204. package/src/layouts/app/AsideSidebarLayout.tsx +3 -0
  205. package/src/layouts/app/CalendarSidebarLayout.tsx +69 -0
  206. package/src/layouts/app/CommunitiesNavbarLayout.tsx +3 -0
  207. package/src/layouts/app/DualNavbarSidebarLayout.tsx +3 -0
  208. package/src/layouts/app/FocusSidebarLayout.tsx +75 -0
  209. package/src/layouts/app/MailLayout.tsx +69 -0
  210. package/src/layouts/app/MegaMenuHeaderLayout.tsx +3 -0
  211. package/src/layouts/app/MegaMenuLayout.tsx +81 -0
  212. package/src/layouts/app/MegaMenuNavbarLayout.tsx +88 -0
  213. package/src/layouts/app/MegaMenuSearchNavbarLayout.tsx +3 -0
  214. package/src/layouts/app/NavbarCollapsibleLayout.tsx +88 -0
  215. package/src/layouts/app/NavbarCollapsibleLinksLayout.tsx +3 -0
  216. package/src/layouts/app/NavbarMinimalLayout.tsx +3 -0
  217. package/src/layouts/app/NavbarMinimalSidebarLayout.tsx +3 -0
  218. package/src/layouts/app/NavbarSidebarDashboardLayout.tsx +3 -0
  219. package/src/layouts/app/NavbarSidebarLayout.tsx +92 -0
  220. package/src/layouts/app/NavbarSimpleSidebarLayout.tsx +3 -0
  221. package/src/layouts/app/NavbarTitledSidebarLayout.tsx +3 -0
  222. package/src/layouts/app/PanelSidebarLayout.tsx +3 -0
  223. package/src/layouts/app/SearchNavbarSidebarLayout.tsx +3 -0
  224. package/src/layouts/app/SidebarBreadcrumbLayout.tsx +3 -0
  225. package/src/layouts/app/SidebarCleanLayout.tsx +3 -0
  226. package/src/layouts/app/SidebarCommunitiesLayout.tsx +3 -0
  227. package/src/layouts/app/SidebarContentLayout.tsx +3 -0
  228. package/src/layouts/app/SidebarDualMenuLayout.tsx +104 -0
  229. package/src/layouts/app/SidebarFixedLayout.tsx +166 -0
  230. package/src/layouts/app/SidebarFooterNavbarLayout.tsx +3 -0
  231. package/src/layouts/app/SidebarHeaderMenuLayout.tsx +3 -0
  232. package/src/layouts/app/SidebarMegaMenuLayout.tsx +4 -0
  233. package/src/layouts/app/SidebarMinimalLayout.tsx +70 -0
  234. package/src/layouts/app/SidebarMobileSearchLayout.tsx +3 -0
  235. package/src/layouts/app/SidebarMultiPanelLayout.tsx +3 -0
  236. package/src/layouts/app/SidebarPrimarySecondaryLayout.tsx +3 -0
  237. package/src/layouts/app/SidebarSearchHeaderLayout.tsx +103 -0
  238. package/src/layouts/app/SidebarSearchToolbarLayout.tsx +3 -0
  239. package/src/layouts/app/SidebarTabsDualLayout.tsx +3 -0
  240. package/src/layouts/app/SidebarTabsLayout.tsx +98 -0
  241. package/src/layouts/app/SidebarTreeLayout.tsx +3 -0
  242. package/src/layouts/app/SplitNavbarLayout.tsx +3 -0
  243. package/src/layouts/app/SplitSidebarDashboardLayout.tsx +3 -0
  244. package/src/layouts/app/SplitSidebarLayout.tsx +99 -0
  245. package/src/layouts/app/TopNavLayout.tsx +105 -0
  246. package/src/layouts/app/TopNavLinksLayout.tsx +3 -0
  247. package/src/layouts/app/WorkspaceBreadcrumbLayout.tsx +3 -0
  248. package/src/layouts/app/WorkspaceCommunitiesLayout.tsx +3 -0
  249. package/src/layouts/app/WorkspaceNavbarLayout.tsx +3 -0
  250. package/src/layouts/app/WorkspaceSidebarLayout.tsx +98 -0
  251. package/src/layouts/app/WorkspaceSidebarTitleLayout.tsx +3 -0
  252. package/src/layouts/app/app-header-layout.tsx +45 -0
  253. package/src/layouts/app/app-sidebar-layout.tsx +56 -0
  254. package/src/layouts/app/layout-context.tsx +44 -0
  255. package/src/layouts/app/layout-types.ts +47 -0
  256. package/src/layouts/app/partials/Footer.tsx +35 -0
  257. package/src/layouts/app/partials/HeaderTopbar.tsx +96 -0
  258. package/src/layouts/app/partials/Navbar.tsx +85 -0
  259. package/src/layouts/app/partials/Toolbar.tsx +47 -0
  260. package/src/layouts/app-layout.tsx +29 -0
  261. package/src/layouts/auth/AuthBrandedLayout.tsx +58 -0
  262. package/src/layouts/auth/AuthCardLayout.tsx +31 -0
  263. package/src/layouts/auth/AuthCenteredLayout.tsx +41 -0
  264. package/src/layouts/auth/AuthClassicLayout.tsx +41 -0
  265. package/src/layouts/auth/AuthSimpleLayout.tsx +33 -0
  266. package/src/layouts/auth/AuthSplitLayout.tsx +89 -0
  267. package/src/layouts/web-app-layout.tsx +162 -0
  268. package/src/layouts/web-layout.tsx +23 -0
  269. package/src/lib/datetime.ts +188 -0
  270. package/src/lib/google-maps-loader.ts +99 -0
  271. package/src/lib/location.ts +127 -0
  272. package/src/lib/lucide-icon-map.ts +132 -0
  273. package/src/lib/map-markers.ts +124 -0
  274. package/src/lib/map-styles.ts +351 -0
  275. package/src/lib/utils.ts +11 -0
  276. package/src/platform/adapters/default.tsx +156 -0
  277. package/src/platform/adapters/inertia.tsx +88 -0
  278. package/src/platform/adapters/nextjs.ts +86 -0
  279. package/src/platform/context.tsx +106 -0
  280. package/src/platform/index.ts +27 -0
  281. package/src/platform/types.ts +105 -0
  282. package/src/styles/layouts/sidebar-fixed.css +161 -0
  283. package/src/styles/themes.css +583 -0
  284. package/src/types/assets.d.ts +5 -0
  285. package/src/types/auth.ts +25 -0
  286. package/src/types/global.d.ts +13 -0
  287. package/src/types/index.ts +9 -0
  288. package/src/types/navigation.ts +15 -0
  289. package/src/types/ui.ts +32 -0
@@ -0,0 +1,46 @@
1
+ 'use client';
2
+ import type { LucideIcon } from 'lucide-react';
3
+ import { Monitor, Moon, Sun } from 'lucide-react';
4
+ import type { HTMLAttributes } from 'react';
5
+ import type { Appearance } from '../hooks/use-appearance';
6
+ import { useAppearance } from '../hooks/use-appearance';
7
+ import { cn } from '../lib/utils';
8
+
9
+ export default function AppearanceTabs({
10
+ className = '',
11
+ ...props
12
+ }: HTMLAttributes<HTMLDivElement>) {
13
+ const { appearance, updateAppearance } = useAppearance();
14
+
15
+ const tabs: { value: Appearance; icon: LucideIcon; label: string }[] = [
16
+ { value: 'light', icon: Sun, label: 'Light' },
17
+ { value: 'dark', icon: Moon, label: 'Dark' },
18
+ { value: 'system', icon: Monitor, label: 'System' },
19
+ ];
20
+
21
+ return (
22
+ <div
23
+ className={cn(
24
+ 'inline-flex gap-1 rounded-lg bg-neutral-100 p-1 dark:bg-neutral-800',
25
+ className,
26
+ )}
27
+ {...props}
28
+ >
29
+ {tabs.map(({ value, icon: Icon, label }) => (
30
+ <button
31
+ key={value}
32
+ onClick={() => updateAppearance(value)}
33
+ className={cn(
34
+ 'flex items-center rounded-md px-3.5 py-1.5 transition-colors',
35
+ appearance === value
36
+ ? 'bg-white shadow-xs dark:bg-neutral-700 dark:text-neutral-100'
37
+ : 'text-neutral-500 hover:bg-neutral-200/60 hover:text-black dark:text-neutral-400 dark:hover:bg-neutral-700/60',
38
+ )}
39
+ >
40
+ <Icon className="-ml-1 h-4 w-4" />
41
+ <span className="ml-1.5 text-sm">{label}</span>
42
+ </button>
43
+ ))}
44
+ </div>
45
+ );
46
+ }
@@ -0,0 +1,50 @@
1
+ import { PlatformLink } from '../platform/context';
2
+ import { Fragment } from 'react';
3
+ import {
4
+ Breadcrumb,
5
+ BreadcrumbItem,
6
+ BreadcrumbLink,
7
+ BreadcrumbList,
8
+ BreadcrumbPage,
9
+ BreadcrumbSeparator,
10
+ } from './ui/breadcrumb';
11
+ import type { BreadcrumbItem as BreadcrumbItemType } from '../types/navigation';
12
+
13
+ export function Breadcrumbs({
14
+ breadcrumbs,
15
+ }: {
16
+ breadcrumbs: BreadcrumbItemType[];
17
+ }) {
18
+ return (
19
+ <>
20
+ {breadcrumbs.length > 0 && (
21
+ <Breadcrumb>
22
+ <BreadcrumbList>
23
+ {breadcrumbs.map((item, index) => {
24
+ const isLast = index === breadcrumbs.length - 1;
25
+
26
+ return (
27
+ <Fragment key={index}>
28
+ <BreadcrumbItem>
29
+ {isLast ? (
30
+ <BreadcrumbPage>
31
+ {item.title}
32
+ </BreadcrumbPage>
33
+ ) : (
34
+ <BreadcrumbLink asChild>
35
+ <PlatformLink href={item.href}>
36
+ {item.title}
37
+ </PlatformLink>
38
+ </BreadcrumbLink>
39
+ )}
40
+ </BreadcrumbItem>
41
+ {!isLast && <BreadcrumbSeparator />}
42
+ </Fragment>
43
+ );
44
+ })}
45
+ </BreadcrumbList>
46
+ </Breadcrumb>
47
+ )}
48
+ </>
49
+ );
50
+ }
@@ -0,0 +1,111 @@
1
+ import { ImageOff } from 'lucide-react';
2
+
3
+ import { cn } from '../../lib/utils';
4
+
5
+ type Props = {
6
+ src: string | null | undefined;
7
+ alt: string;
8
+ className?: string;
9
+ /** Inner padding around the sharp image. Larger value = bigger blur halo. */
10
+ padding?: string;
11
+ /** Object-fit for the sharp image. */
12
+ fit?: 'contain' | 'cover';
13
+ /** Rounding on the wrapper. */
14
+ rounded?: 'md' | 'lg' | 'xl' | '2xl' | 'full';
15
+ /** Blur radius on the background. */
16
+ blur?: 'md' | 'lg' | 'xl' | '2xl' | '3xl';
17
+ /** Opacity of the white wash overlaying the blur (0–100). */
18
+ whiteWash?: number;
19
+ };
20
+
21
+ /**
22
+ * Image with a blurred copy of itself behind it, washed toward the
23
+ * surface color (white in light mode, --background in dark mode) so the
24
+ * image edge fades seamlessly into the page background regardless of the
25
+ * original asset's edges. Use for: partner logos, customer avatars,
26
+ * device product photos, blog cover images.
27
+ *
28
+ * Inspired by the Launch UI / Apple TV poster glow technique.
29
+ */
30
+ export function BlurredImage({
31
+ src,
32
+ alt,
33
+ className,
34
+ padding = 'p-6',
35
+ fit = 'contain',
36
+ rounded = 'xl',
37
+ blur = '2xl',
38
+ whiteWash = 70,
39
+ }: Props) {
40
+ const roundedCls = {
41
+ md: 'rounded-md',
42
+ lg: 'rounded-lg',
43
+ xl: 'rounded-xl',
44
+ '2xl': 'rounded-2xl',
45
+ full: 'rounded-full',
46
+ }[rounded];
47
+
48
+ const blurCls = {
49
+ md: 'blur-md',
50
+ lg: 'blur-lg',
51
+ xl: 'blur-xl',
52
+ '2xl': 'blur-2xl',
53
+ '3xl': 'blur-3xl',
54
+ }[blur];
55
+
56
+ if (!src) {
57
+ return (
58
+ <div
59
+ className={cn(
60
+ 'inline-flex aspect-square items-center justify-center bg-muted text-muted-foreground',
61
+ roundedCls,
62
+ padding,
63
+ className,
64
+ )}
65
+ aria-label={alt}
66
+ >
67
+ <ImageOff className="size-1/2 opacity-40" />
68
+ </div>
69
+ );
70
+ }
71
+
72
+ return (
73
+ <div
74
+ className={cn(
75
+ 'relative inline-flex items-center justify-center overflow-hidden',
76
+ roundedCls,
77
+ padding,
78
+ className,
79
+ )}
80
+ >
81
+ {/* Layer 1: scaled, blurred copy of the image acts as ambient halo */}
82
+ <div
83
+ aria-hidden
84
+ className={cn('absolute inset-0 scale-125', blurCls)}
85
+ style={{
86
+ backgroundImage: `url(${src})`,
87
+ backgroundSize: 'cover',
88
+ backgroundPosition: 'center',
89
+ }}
90
+ />
91
+ {/* Layer 2: surface-coloured wash blends the blur edge to white
92
+ (light) / --background (dark) so the image dissolves into the
93
+ page rather than terminating with a hard rectangle */}
94
+ <div
95
+ aria-hidden
96
+ className="absolute inset-0 bg-background"
97
+ style={{ opacity: whiteWash / 100 }}
98
+ />
99
+ {/* Layer 3: the sharp source image */}
100
+ <img
101
+ src={src}
102
+ alt={alt}
103
+ className={cn(
104
+ 'relative h-full w-full',
105
+ fit === 'cover' ? 'object-cover' : 'object-contain',
106
+ )}
107
+ loading="lazy"
108
+ />
109
+ </div>
110
+ );
111
+ }
@@ -0,0 +1,473 @@
1
+ 'use client';
2
+
3
+ import { useEffect, useRef } from 'react';
4
+
5
+ import { hasGoogleMapsKey, loadGoogleMaps } from '../../lib/google-maps-loader';
6
+ import {
7
+ isDarkMode,
8
+ mapStyleForAppearance,
9
+ watchDarkMode,
10
+ } from '../../lib/map-styles';
11
+ import { cn } from '../../lib/utils';
12
+
13
+ export type CmsBackground = {
14
+ kind?: 'image' | 'color' | 'gradient' | 'video' | 'map' | null;
15
+ image_path?: string | null;
16
+ video_url?: string | null;
17
+ video_poster?: string | null;
18
+ color_token?: string | null;
19
+ gradient_from?: string | null;
20
+ gradient_to?: string | null;
21
+ gradient_direction?: string | null;
22
+ overlay_alpha?: number | null;
23
+ map_center_lat?: number | null;
24
+ map_center_lng?: number | null;
25
+ map_zoom?: number | null;
26
+ map_show_devices?: boolean | null;
27
+ };
28
+
29
+ const COLOR_TOKEN_CLASSES: Record<string, string> = {
30
+ primary: 'bg-primary',
31
+ accent: 'bg-accent',
32
+ muted: 'bg-muted',
33
+ surface: 'bg-card',
34
+ card: 'bg-card',
35
+ secondary: 'bg-secondary',
36
+ };
37
+
38
+ const GRADIENT_DIRECTION_CLASSES: Record<string, string> = {
39
+ 'to-r': 'bg-gradient-to-r',
40
+ 'to-l': 'bg-gradient-to-l',
41
+ 'to-b': 'bg-gradient-to-b',
42
+ 'to-t': 'bg-gradient-to-t',
43
+ 'to-br': 'bg-gradient-to-br',
44
+ 'to-bl': 'bg-gradient-to-bl',
45
+ };
46
+
47
+ /**
48
+ * Absolute-positioned background layer for a section. Sits behind content;
49
+ * caller is responsible for putting it inside a `relative` parent and giving
50
+ * the parent dimensions.
51
+ */
52
+ export function SectionBackground({ bg }: { bg?: CmsBackground | null }) {
53
+ if (!bg || !bg.kind) {
54
+ return null;
55
+ }
56
+
57
+ const overlay = bg.overlay_alpha ?? 0;
58
+
59
+ if (bg.kind === 'color') {
60
+ return (
61
+ <div
62
+ aria-hidden
63
+ className={cn(
64
+ 'absolute inset-0',
65
+ COLOR_TOKEN_CLASSES[bg.color_token ?? 'primary'] ??
66
+ 'bg-primary',
67
+ )}
68
+ />
69
+ );
70
+ }
71
+
72
+ if (bg.kind === 'gradient') {
73
+ const directionClass =
74
+ GRADIENT_DIRECTION_CLASSES[bg.gradient_direction ?? 'to-br'] ??
75
+ 'bg-gradient-to-br';
76
+
77
+ return (
78
+ <>
79
+ <div
80
+ aria-hidden
81
+ className={cn('absolute inset-0', directionClass)}
82
+ style={{
83
+ backgroundImage: `linear-gradient(${cssDirection(bg.gradient_direction)}, ${bg.gradient_from ?? '#1e293b'}, ${bg.gradient_to ?? '#0f172a'})`,
84
+ }}
85
+ />
86
+ <div
87
+ aria-hidden
88
+ className="absolute inset-0"
89
+ style={{
90
+ backgroundImage:
91
+ 'linear-gradient(to bottom, rgba(0,0,0,0.10), rgba(0,0,0,0.35))',
92
+ }}
93
+ />
94
+ {overlay > 0 && (
95
+ <div
96
+ aria-hidden
97
+ className="absolute inset-0 bg-black"
98
+ style={{ opacity: overlay / 100 }}
99
+ />
100
+ )}
101
+ </>
102
+ );
103
+ }
104
+
105
+ if (bg.kind === 'image' && bg.image_path) {
106
+ const imageOverlay = bg.overlay_alpha == null ? 50 : overlay;
107
+
108
+ return (
109
+ <>
110
+ <div
111
+ aria-hidden
112
+ className="absolute inset-0 bg-cover bg-center"
113
+ style={{ backgroundImage: `url(${bg.image_path})` }}
114
+ />
115
+ {imageOverlay > 0 && (
116
+ <div
117
+ aria-hidden
118
+ className="absolute inset-0 bg-black"
119
+ style={{ opacity: imageOverlay / 100 }}
120
+ />
121
+ )}
122
+ </>
123
+ );
124
+ }
125
+
126
+ if (bg.kind === 'video' && bg.video_url) {
127
+ const videoOverlay = bg.overlay_alpha == null ? 50 : overlay;
128
+
129
+ return (
130
+ <>
131
+ <video
132
+ aria-hidden
133
+ autoPlay
134
+ muted
135
+ loop
136
+ playsInline
137
+ poster={bg.video_poster ?? undefined}
138
+ className="absolute inset-0 h-full w-full object-cover"
139
+ >
140
+ <source src={bg.video_url} />
141
+ </video>
142
+ {videoOverlay > 0 && (
143
+ <div
144
+ aria-hidden
145
+ className="absolute inset-0 bg-black"
146
+ style={{ opacity: videoOverlay / 100 }}
147
+ />
148
+ )}
149
+ </>
150
+ );
151
+ }
152
+
153
+ if (bg.kind === 'map') {
154
+ return (
155
+ <MapBackground
156
+ lat={bg.map_center_lat ?? 31.5204}
157
+ lng={bg.map_center_lng ?? 74.3587}
158
+ zoom={bg.map_zoom ?? 6}
159
+ showDevices={bg.map_show_devices ?? false}
160
+ overlay={overlay}
161
+ />
162
+ );
163
+ }
164
+
165
+ return null;
166
+ }
167
+
168
+ function cssDirection(dir?: string | null): string {
169
+ switch (dir) {
170
+ case 'to-r':
171
+ return 'to right';
172
+ case 'to-l':
173
+ return 'to left';
174
+ case 'to-b':
175
+ return 'to bottom';
176
+ case 'to-t':
177
+ return 'to top';
178
+ case 'to-bl':
179
+ return 'to bottom left';
180
+ case 'to-br':
181
+ default:
182
+ return 'to bottom right';
183
+ }
184
+ }
185
+
186
+ function MapBackground({
187
+ lat,
188
+ lng,
189
+ zoom,
190
+ showDevices,
191
+ overlay,
192
+ }: {
193
+ lat: number;
194
+ lng: number;
195
+ zoom: number;
196
+ showDevices: boolean;
197
+ overlay: number;
198
+ }) {
199
+ const containerRef = useRef<HTMLDivElement>(null);
200
+ const mapRef = useRef<google.maps.Map | null>(null);
201
+ const animationRef = useRef<number | null>(null);
202
+ const panCleanupRef = useRef<(() => void) | null>(null);
203
+
204
+ useEffect(() => {
205
+ if (!containerRef.current || mapRef.current || !hasGoogleMapsKey()) {
206
+ return;
207
+ }
208
+
209
+ const container = containerRef.current;
210
+
211
+ loadGoogleMaps()
212
+ .then((maps) => {
213
+ if (!containerRef.current) {
214
+ return;
215
+ }
216
+
217
+ mapRef.current = new maps.Map(containerRef.current, {
218
+ center: { lat, lng },
219
+ zoom,
220
+ disableDefaultUI: true,
221
+ gestureHandling: 'none',
222
+ keyboardShortcuts: false,
223
+ clickableIcons: false,
224
+ backgroundColor: isDarkMode() ? '#212121' : '#f5f5f5',
225
+ styles: mapStyleForAppearance(isDarkMode()),
226
+ });
227
+
228
+ if (showDevices) {
229
+ const samples: Array<{ lat: number; lng: number }> = [
230
+ { lat: lat + 0.3, lng: lng - 0.8 },
231
+ { lat: lat - 0.4, lng: lng + 0.6 },
232
+ { lat: lat + 0.1, lng: lng + 1.2 },
233
+ { lat: lat - 0.6, lng: lng - 0.5 },
234
+ { lat: lat + 0.5, lng: lng + 0.2 },
235
+ ];
236
+ samples.forEach((p) => {
237
+ new maps.Marker({
238
+ position: p,
239
+ map: mapRef.current!,
240
+ icon: {
241
+ path: maps.SymbolPath.CIRCLE,
242
+ scale: 6,
243
+ fillColor: 'var(--primary)',
244
+ fillOpacity: 0.9,
245
+ strokeColor: '#ffffff',
246
+ strokeWeight: 2,
247
+ },
248
+ });
249
+ });
250
+ }
251
+
252
+ panCleanupRef.current = startSlowPan(
253
+ maps,
254
+ mapRef,
255
+ animationRef,
256
+ container,
257
+ { lat, lng },
258
+ );
259
+ })
260
+ .catch((e) => {
261
+ console.warn('Google Maps load failed', e);
262
+ });
263
+
264
+ return () => {
265
+ if (animationRef.current !== null) {
266
+ cancelAnimationFrame(animationRef.current);
267
+ animationRef.current = null;
268
+ }
269
+
270
+ if (panCleanupRef.current) {
271
+ panCleanupRef.current();
272
+ panCleanupRef.current = null;
273
+ }
274
+ };
275
+ }, [lat, lng, zoom, showDevices]);
276
+
277
+ useEffect(() => {
278
+ return watchDarkMode((isDark) => {
279
+ mapRef.current?.setOptions({
280
+ styles: mapStyleForAppearance(isDark),
281
+ backgroundColor: isDark ? '#212121' : '#f5f5f5',
282
+ });
283
+ });
284
+ }, []);
285
+
286
+ if (!hasGoogleMapsKey()) {
287
+ return <MapBackgroundStub overlay={overlay} />;
288
+ }
289
+
290
+ return (
291
+ <>
292
+ <div aria-hidden ref={containerRef} className="absolute inset-0" />
293
+ <div
294
+ aria-hidden
295
+ className="absolute inset-0"
296
+ style={{
297
+ background:
298
+ 'radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.35) 45%, rgba(0,0,0,0.15) 100%)',
299
+ }}
300
+ />
301
+ {overlay > 0 && (
302
+ <div
303
+ aria-hidden
304
+ className="absolute inset-0 bg-black"
305
+ style={{ opacity: overlay / 100 }}
306
+ />
307
+ )}
308
+ </>
309
+ );
310
+ }
311
+
312
+ function startSlowPan(
313
+ maps: typeof google.maps,
314
+ mapRef: React.MutableRefObject<google.maps.Map | null>,
315
+ animationRef: React.MutableRefObject<number | null>,
316
+ container: HTMLElement,
317
+ origin: { lat: number; lng: number },
318
+ ): () => void {
319
+ const noop = () => {};
320
+
321
+ if (typeof window === 'undefined') {
322
+ return noop;
323
+ }
324
+
325
+ const reduced = window.matchMedia('(prefers-reduced-motion: reduce)');
326
+
327
+ if (reduced.matches) {
328
+ return noop;
329
+ }
330
+
331
+ const maxRadiusLat = 0.8;
332
+ const maxRadiusLng = 1.1;
333
+ const speedLat = 0.35;
334
+ const speedLng = 0.5;
335
+ const decayPerSec = 0.6;
336
+ const deadZone = 0.05;
337
+
338
+ let cursor: { x: number; y: number } | null = null;
339
+
340
+ const handleMove = (e: PointerEvent) => {
341
+ const rect = container.getBoundingClientRect();
342
+
343
+ if (rect.width === 0 || rect.height === 0) {
344
+ return;
345
+ }
346
+
347
+ const nx = ((e.clientX - rect.left) / rect.width) * 2 - 1;
348
+ const ny = ((e.clientY - rect.top) / rect.height) * 2 - 1;
349
+ cursor = {
350
+ x: Math.max(-1, Math.min(1, nx)),
351
+ y: Math.max(-1, Math.min(1, ny)),
352
+ };
353
+ };
354
+
355
+ const handleLeave = () => {
356
+ cursor = null;
357
+ };
358
+
359
+ container.addEventListener('pointermove', handleMove);
360
+ container.addEventListener('pointerleave', handleLeave);
361
+ container.addEventListener('pointercancel', handleLeave);
362
+
363
+ let offsetLat = 0;
364
+ let offsetLng = 0;
365
+ let last = performance.now();
366
+
367
+ const tick = (now: number) => {
368
+ if (!mapRef.current) {
369
+ return;
370
+ }
371
+
372
+ const dt = Math.min(0.1, Math.max(0, (now - last) / 1000));
373
+ last = now;
374
+
375
+ if (cursor) {
376
+ const mag = Math.hypot(cursor.x, cursor.y);
377
+
378
+ if (mag > deadZone) {
379
+ offsetLat += -cursor.y * speedLat * dt;
380
+ offsetLng += cursor.x * speedLng * dt;
381
+ }
382
+ } else if (offsetLat !== 0 || offsetLng !== 0) {
383
+ const decay = Math.max(0, 1 - decayPerSec * dt);
384
+ offsetLat *= decay;
385
+ offsetLng *= decay;
386
+ }
387
+
388
+ offsetLat = Math.max(-maxRadiusLat, Math.min(maxRadiusLat, offsetLat));
389
+ offsetLng = Math.max(-maxRadiusLng, Math.min(maxRadiusLng, offsetLng));
390
+
391
+ mapRef.current.panTo(
392
+ new maps.LatLng(origin.lat + offsetLat, origin.lng + offsetLng),
393
+ );
394
+ animationRef.current = window.requestAnimationFrame(tick);
395
+ };
396
+
397
+ animationRef.current = window.requestAnimationFrame(tick);
398
+
399
+ return () => {
400
+ container.removeEventListener('pointermove', handleMove);
401
+ container.removeEventListener('pointerleave', handleLeave);
402
+ container.removeEventListener('pointercancel', handleLeave);
403
+ };
404
+ }
405
+
406
+ function MapBackgroundStub({ overlay }: { overlay: number }) {
407
+ return (
408
+ <>
409
+ <div
410
+ aria-hidden
411
+ className="absolute inset-0 bg-muted"
412
+ style={{
413
+ backgroundImage:
414
+ 'radial-gradient(circle, oklch(0 0 0 / 0.06) 1px, transparent 1px)',
415
+ backgroundSize: '24px 24px',
416
+ }}
417
+ />
418
+ <svg
419
+ aria-hidden
420
+ className="absolute inset-0 h-full w-full"
421
+ viewBox="0 0 800 400"
422
+ preserveAspectRatio="xMidYMid slice"
423
+ >
424
+ {[
425
+ [180, 120],
426
+ [320, 250],
427
+ [500, 90],
428
+ [640, 220],
429
+ [240, 320],
430
+ [560, 340],
431
+ ].map(([cx, cy], i) => (
432
+ <g key={i}>
433
+ <circle
434
+ cx={cx}
435
+ cy={cy}
436
+ r="14"
437
+ className="fill-primary"
438
+ opacity="0.15"
439
+ >
440
+ <animate
441
+ attributeName="r"
442
+ values="14;28;14"
443
+ dur="2.5s"
444
+ begin={`${i * 0.3}s`}
445
+ repeatCount="indefinite"
446
+ />
447
+ <animate
448
+ attributeName="opacity"
449
+ values="0.4;0;0.4"
450
+ dur="2.5s"
451
+ begin={`${i * 0.3}s`}
452
+ repeatCount="indefinite"
453
+ />
454
+ </circle>
455
+ <circle
456
+ cx={cx}
457
+ cy={cy}
458
+ r="5"
459
+ className="fill-primary"
460
+ />
461
+ </g>
462
+ ))}
463
+ </svg>
464
+ {overlay > 0 && (
465
+ <div
466
+ aria-hidden
467
+ className="absolute inset-0 bg-background"
468
+ style={{ opacity: overlay / 100 }}
469
+ />
470
+ )}
471
+ </>
472
+ );
473
+ }