@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,290 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { cn } from '../../lib/utils';
5
+ import * as RechartsPrimitive from 'recharts';
6
+
7
+ // Format: { THEME_NAME: CSS_SELECTOR }
8
+ const THEMES = { light: '', dark: '.dark' } as const;
9
+
10
+ export type ChartConfig = {
11
+ [k in string]: {
12
+ label?: React.ReactNode;
13
+ icon?: React.ComponentType;
14
+ } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> });
15
+ };
16
+
17
+ type ChartContextProps = {
18
+ config: ChartConfig;
19
+ };
20
+
21
+ const ChartContext = React.createContext<ChartContextProps | null>(null);
22
+
23
+ function useChart() {
24
+ const context = React.useContext(ChartContext);
25
+
26
+ if (!context) {
27
+ throw new Error('useChart must be used within a <ChartContainer />');
28
+ }
29
+
30
+ return context;
31
+ }
32
+
33
+ function ChartContainer({
34
+ id,
35
+ className,
36
+ children,
37
+ config,
38
+ ...props
39
+ }: React.ComponentProps<'div'> & {
40
+ config: ChartConfig;
41
+ children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
42
+ }) {
43
+ const uniqueId = React.useId();
44
+ const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
45
+
46
+ return (
47
+ <ChartContext.Provider value={{ config }}>
48
+ <div
49
+ data-slot="chart"
50
+ data-chart={chartId}
51
+ className={cn(
52
+ "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
53
+ className,
54
+ )}
55
+ {...props}
56
+ >
57
+ <ChartStyle id={chartId} config={config} />
58
+ <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>
59
+ </div>
60
+ </ChartContext.Provider>
61
+ );
62
+ }
63
+
64
+ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
65
+ const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
66
+
67
+ if (!colorConfig.length) {
68
+ return null;
69
+ }
70
+
71
+ return (
72
+ <style
73
+ dangerouslySetInnerHTML={{
74
+ __html: Object.entries(THEMES)
75
+ .map(
76
+ ([theme, prefix]) => `
77
+ ${prefix} [data-chart=${id}] {
78
+ ${colorConfig
79
+ .map(([key, itemConfig]) => {
80
+ const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color;
81
+ return color ? ` --color-${key}: ${color};` : null;
82
+ })
83
+ .join('\n')}
84
+ }
85
+ `,
86
+ )
87
+ .join('\n'),
88
+ }}
89
+ />
90
+ );
91
+ };
92
+
93
+ const ChartTooltip = RechartsPrimitive.Tooltip;
94
+
95
+ function ChartTooltipContent({
96
+ active,
97
+ payload,
98
+ className,
99
+ indicator = 'dot',
100
+ hideLabel = false,
101
+ hideIndicator = false,
102
+ label,
103
+ labelFormatter,
104
+ labelClassName,
105
+ formatter,
106
+ color,
107
+ nameKey,
108
+ labelKey,
109
+ }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
110
+ React.ComponentProps<'div'> & {
111
+ hideLabel?: boolean;
112
+ hideIndicator?: boolean;
113
+ indicator?: 'line' | 'dot' | 'dashed';
114
+ nameKey?: string;
115
+ labelKey?: string;
116
+ }) {
117
+ const { config } = useChart();
118
+
119
+ const tooltipLabel = React.useMemo(() => {
120
+ if (hideLabel || !payload?.length) {
121
+ return null;
122
+ }
123
+
124
+ const [item] = payload;
125
+ const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;
126
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
127
+ const value =
128
+ !labelKey && typeof label === 'string' ? config[label as keyof typeof config]?.label || label : itemConfig?.label;
129
+
130
+ if (labelFormatter) {
131
+ return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>;
132
+ }
133
+
134
+ if (!value) {
135
+ return null;
136
+ }
137
+
138
+ return <div className={cn('font-medium', labelClassName)}>{value}</div>;
139
+ }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
140
+
141
+ if (!active || !payload?.length) {
142
+ return null;
143
+ }
144
+
145
+ const nestLabel = payload.length === 1 && indicator !== 'dot';
146
+
147
+ return (
148
+ <div
149
+ className={cn(
150
+ 'border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',
151
+ className,
152
+ )}
153
+ >
154
+ {!nestLabel ? tooltipLabel : null}
155
+ <div className="grid gap-1.5">
156
+ {payload.map((item, index) => {
157
+ const key = `${nameKey || item.name || item.dataKey || 'value'}`;
158
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
159
+ const indicatorColor = color || item.payload.fill || item.color;
160
+
161
+ return (
162
+ <div
163
+ key={item.dataKey}
164
+ className={cn(
165
+ '[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',
166
+ indicator === 'dot' && 'items-center',
167
+ )}
168
+ >
169
+ {formatter && item?.value !== undefined && item.name ? (
170
+ formatter(item.value, item.name, item, index, item.payload)
171
+ ) : (
172
+ <>
173
+ {itemConfig?.icon ? (
174
+ <itemConfig.icon />
175
+ ) : (
176
+ !hideIndicator && (
177
+ <div
178
+ className={cn('shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)', {
179
+ 'h-2.5 w-2.5': indicator === 'dot',
180
+ 'w-1': indicator === 'line',
181
+ 'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',
182
+ 'my-0.5': nestLabel && indicator === 'dashed',
183
+ })}
184
+ style={
185
+ {
186
+ '--color-bg': indicatorColor,
187
+ '--color-border': indicatorColor,
188
+ } as React.CSSProperties
189
+ }
190
+ />
191
+ )
192
+ )}
193
+ <div
194
+ className={cn('flex flex-1 justify-between leading-none', nestLabel ? 'items-end' : 'items-center')}
195
+ >
196
+ <div className="grid gap-1.5">
197
+ {nestLabel ? tooltipLabel : null}
198
+ <span className="text-muted-foreground">{itemConfig?.label || item.name}</span>
199
+ </div>
200
+ {item.value && (
201
+ <span className="text-foreground font-mono font-medium tabular-nums">
202
+ {item.value.toLocaleString()}
203
+ </span>
204
+ )}
205
+ </div>
206
+ </>
207
+ )}
208
+ </div>
209
+ );
210
+ })}
211
+ </div>
212
+ </div>
213
+ );
214
+ }
215
+
216
+ const ChartLegend = RechartsPrimitive.Legend;
217
+
218
+ function ChartLegendContent({
219
+ className,
220
+ hideIcon = false,
221
+ payload,
222
+ verticalAlign = 'bottom',
223
+ nameKey,
224
+ }: React.ComponentProps<'div'> &
225
+ Pick<RechartsPrimitive.LegendProps, 'payload' | 'verticalAlign'> & {
226
+ hideIcon?: boolean;
227
+ nameKey?: string;
228
+ }) {
229
+ const { config } = useChart();
230
+
231
+ if (!payload?.length) {
232
+ return null;
233
+ }
234
+
235
+ return (
236
+ <div className={cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className)}>
237
+ {payload.map((item) => {
238
+ const key = `${nameKey || item.dataKey || 'value'}`;
239
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
240
+
241
+ return (
242
+ <div
243
+ key={item.value}
244
+ className={cn('[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3')}
245
+ >
246
+ {itemConfig?.icon && !hideIcon ? (
247
+ <itemConfig.icon />
248
+ ) : (
249
+ <div
250
+ className="h-2 w-2 shrink-0 rounded-[2px]"
251
+ style={{
252
+ backgroundColor: item.color,
253
+ }}
254
+ />
255
+ )}
256
+ {itemConfig?.label}
257
+ </div>
258
+ );
259
+ })}
260
+ </div>
261
+ );
262
+ }
263
+
264
+ // Helper to extract item config from a payload.
265
+ function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
266
+ if (typeof payload !== 'object' || payload === null) {
267
+ return undefined;
268
+ }
269
+
270
+ const payloadPayload =
271
+ 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null
272
+ ? payload.payload
273
+ : undefined;
274
+
275
+ let configLabelKey: string = key;
276
+
277
+ if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {
278
+ configLabelKey = payload[key as keyof typeof payload] as string;
279
+ } else if (
280
+ payloadPayload &&
281
+ key in payloadPayload &&
282
+ typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'
283
+ ) {
284
+ configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;
285
+ }
286
+
287
+ return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];
288
+ }
289
+
290
+ export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle };
@@ -0,0 +1,47 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { cn } from '../../lib/utils';
5
+ import { cva, VariantProps } from 'class-variance-authority';
6
+ import { Check, Minus } from 'lucide-react';
7
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
8
+
9
+ // Define the variants for the Checkbox using cva.
10
+ const checkboxVariants = cva(
11
+ `
12
+ group peer bg-background shrink-0 rounded-md border border-input ring-offset-background focus-visible:outline-none
13
+ focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50
14
+ aria-invalid:border-destructive/60 aria-invalid:ring-destructive/10 dark:aria-invalid:border-destructive dark:aria-invalid:ring-destructive/20
15
+ [[data-invalid=true]_&]:border-destructive/60 [[data-invalid=true]_&]:ring-destructive/10 dark:[[data-invalid=true]_&]:border-destructive dark:[[data-invalid=true]_&]:ring-destructive/20,
16
+ data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground
17
+ `,
18
+ {
19
+ variants: {
20
+ size: {
21
+ sm: 'size-4.5 [&_svg]:size-3',
22
+ md: 'size-5 [&_svg]:size-3.5',
23
+ lg: 'size-5.5 [&_svg]:size-4',
24
+ },
25
+ },
26
+ defaultVariants: {
27
+ size: 'md',
28
+ },
29
+ },
30
+ );
31
+
32
+ function Checkbox({
33
+ className,
34
+ size,
35
+ ...props
36
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root> & VariantProps<typeof checkboxVariants>) {
37
+ return (
38
+ <CheckboxPrimitive.Root data-slot="checkbox" className={cn(checkboxVariants({ size }), className)} {...props}>
39
+ <CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}>
40
+ <Check className="group-data-[state=indeterminate]:hidden" />
41
+ <Minus className="hidden group-data-[state=indeterminate]:block" />
42
+ </CheckboxPrimitive.Indicator>
43
+ </CheckboxPrimitive.Root>
44
+ );
45
+ }
46
+
47
+ export { Checkbox };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Code — inline + block code wrappers, monospace and tinted surface.
3
+ *
4
+ * Inline: <Code>P901-00042</Code>
5
+ * Block: <CodeBlock>{`const x = 1`}</CodeBlock>
6
+ */
7
+ import * as React from 'react';
8
+
9
+ import { cn } from '../../lib/utils';
10
+
11
+ export function Code({
12
+ className,
13
+ children,
14
+ ...props
15
+ }: React.HTMLAttributes<HTMLElement>) {
16
+ return (
17
+ <code
18
+ className={cn(
19
+ 'rounded bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground',
20
+ className,
21
+ )}
22
+ {...props}
23
+ >
24
+ {children}
25
+ </code>
26
+ );
27
+ }
28
+
29
+ export function CodeBlock({
30
+ className,
31
+ children,
32
+ ...props
33
+ }: React.HTMLAttributes<HTMLPreElement>) {
34
+ return (
35
+ <pre
36
+ className={cn(
37
+ 'overflow-x-auto rounded-lg border bg-surface-raised p-4 font-mono text-xs leading-relaxed text-foreground',
38
+ className,
39
+ )}
40
+ {...props}
41
+ >
42
+ {children}
43
+ </pre>
44
+ );
45
+ }
@@ -0,0 +1,31 @@
1
+ import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
2
+
3
+ function Collapsible({
4
+ ...props
5
+ }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
6
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
7
+ }
8
+
9
+ function CollapsibleTrigger({
10
+ ...props
11
+ }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
12
+ return (
13
+ <CollapsiblePrimitive.CollapsibleTrigger
14
+ data-slot="collapsible-trigger"
15
+ {...props}
16
+ />
17
+ )
18
+ }
19
+
20
+ function CollapsibleContent({
21
+ ...props
22
+ }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
23
+ return (
24
+ <CollapsiblePrimitive.CollapsibleContent
25
+ data-slot="collapsible-content"
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent }
@@ -0,0 +1,189 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * CommandPalette — global Ctrl+K / ⌘K launcher.
5
+ *
6
+ * Renders a centred dialog with a fuzzy-searchable list of commands.
7
+ * Mount once near the app root (already added in app.tsx via
8
+ * <CommandPaletteRoot/>). Pass the commands as a prop or extend via
9
+ * the global window event `command-palette:register`.
10
+ *
11
+ * <CommandPaletteRoot commands={[
12
+ * { id: 'orders', label: 'Go to Orders', href: '/orders', icon: ShoppingBag },
13
+ * ]} />
14
+ *
15
+ * available in the consuming app.
16
+ */
17
+ import { Command } from 'cmdk';
18
+ import type { LucideIcon } from 'lucide-react';
19
+ import { PlatformLink, usePlatformNavigate } from '../../platform/context';
20
+ import { Search } from 'lucide-react';
21
+ import * as React from 'react';
22
+
23
+ import { Dialog, DialogContent } from './dialog';
24
+ import { Kbd } from './kbd';
25
+ import { cn } from '../../lib/utils';
26
+
27
+ export type CommandItem = {
28
+ id: string;
29
+ label: string;
30
+ description?: string;
31
+ icon?: LucideIcon;
32
+ href?: string;
33
+ /** Custom handler — fires before closing the palette. */
34
+ onSelect?: () => void;
35
+ /** Group label; items without a group fall under "Commands". */
36
+ group?: string;
37
+ /** Extra search terms not visible in the label. */
38
+ keywords?: string[];
39
+ };
40
+
41
+ type Props = {
42
+ commands?: CommandItem[];
43
+ };
44
+
45
+ export function CommandPaletteRoot({ commands = [] }: Props) {
46
+ const navigate = usePlatformNavigate();
47
+ const [open, setOpen] = React.useState(false);
48
+
49
+ React.useEffect(() => {
50
+ const onKey = (e: KeyboardEvent) => {
51
+ if (e.key === 'k' && (e.metaKey || e.ctrlKey)) {
52
+ e.preventDefault();
53
+ setOpen((prev) => !prev);
54
+ }
55
+ };
56
+ window.addEventListener('keydown', onKey);
57
+ return () => window.removeEventListener('keydown', onKey);
58
+ }, []);
59
+
60
+ React.useEffect(() => {
61
+ const onOpen = () => setOpen(true);
62
+ window.addEventListener('command-palette:open', onOpen);
63
+ return () =>
64
+ window.removeEventListener('command-palette:open', onOpen);
65
+ }, []);
66
+
67
+ const groups = React.useMemo(() => {
68
+ const buckets = new Map<string, CommandItem[]>();
69
+ for (const cmd of commands) {
70
+ const key = cmd.group ?? 'Commands';
71
+ if (!buckets.has(key)) buckets.set(key, []);
72
+ buckets.get(key)!.push(cmd);
73
+ }
74
+ return Array.from(buckets.entries());
75
+ }, [commands]);
76
+
77
+ return (
78
+ <Dialog open={open} onOpenChange={setOpen}>
79
+ <DialogContent
80
+ showCloseButton={false}
81
+ className="overflow-hidden p-0 sm:max-w-[560px]"
82
+ >
83
+ <Command
84
+ label="Global command palette"
85
+ className="flex flex-col"
86
+ >
87
+ <div className="flex items-center gap-2 border-b px-3 py-2.5">
88
+ <Search
89
+ aria-hidden="true"
90
+ className="size-4 text-muted-foreground"
91
+ />
92
+ <Command.Input
93
+ autoFocus
94
+ placeholder="Search commands…"
95
+ className="flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
96
+ />
97
+ <Kbd>esc</Kbd>
98
+ </div>
99
+ <Command.List className="max-h-[360px] overflow-y-auto p-1">
100
+ <Command.Empty className="py-6 text-center text-sm text-muted-foreground">
101
+ No matches.
102
+ </Command.Empty>
103
+ {groups.map(([group, items]) => (
104
+ <Command.Group
105
+ key={group}
106
+ heading={group}
107
+ className="px-2 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground [&_[cmdk-group-heading]]:px-1 [&_[cmdk-group-heading]]:py-1"
108
+ >
109
+ {items.map((cmd) => {
110
+ const Icon = cmd.icon;
111
+ const onSelect = () => {
112
+ cmd.onSelect?.();
113
+ if (cmd.href) navigate(cmd.href);
114
+ setOpen(false);
115
+ };
116
+ return (
117
+ <Command.Item
118
+ key={cmd.id}
119
+ value={[
120
+ cmd.label,
121
+ cmd.description ?? '',
122
+ ...(cmd.keywords ?? []),
123
+ ].join(' ')}
124
+ onSelect={onSelect}
125
+ className={cn(
126
+ 'flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-sm text-foreground transition-colors',
127
+ 'aria-selected:bg-accent aria-selected:text-accent-foreground',
128
+ )}
129
+ >
130
+ {Icon && (
131
+ <Icon
132
+ aria-hidden="true"
133
+ className="size-4 text-muted-foreground"
134
+ />
135
+ )}
136
+ <span className="flex-1">
137
+ {cmd.label}
138
+ </span>
139
+ {cmd.description && (
140
+ <span className="text-xs text-muted-foreground">
141
+ {cmd.description}
142
+ </span>
143
+ )}
144
+ </Command.Item>
145
+ );
146
+ })}
147
+ </Command.Group>
148
+ ))}
149
+ </Command.List>
150
+ </Command>
151
+ </DialogContent>
152
+ </Dialog>
153
+ );
154
+ }
155
+
156
+ /** Convenience link for the top bar trigger — pairs a search icon + shortcut hint. */
157
+ export function CommandPaletteTrigger({
158
+ className,
159
+ }: {
160
+ className?: string;
161
+ }) {
162
+ return (
163
+ <button
164
+ type="button"
165
+ onClick={() =>
166
+ window.dispatchEvent(new CustomEvent('command-palette:open'))
167
+ }
168
+ className={cn(
169
+ 'inline-flex items-center gap-2 rounded-md border bg-surface px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground',
170
+ className,
171
+ )}
172
+ >
173
+ <Search aria-hidden="true" className="size-3.5" />
174
+ <span>Search…</span>
175
+ <Kbd className="ml-2">⌘K</Kbd>
176
+ </button>
177
+ );
178
+ }
179
+
180
+ /** Static fallback for SSR / tests where Link isn't useful. */
181
+ export function CommandPaletteLink({
182
+ href,
183
+ children,
184
+ }: {
185
+ href: string;
186
+ children: React.ReactNode;
187
+ }) {
188
+ return <PlatformLink href={href}>{children}</PlatformLink>;
189
+ }