@genispace/geniapp 0.1.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 (258) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +153 -0
  3. package/dist/CrossAppRecordPicker-BXchXcK5.js +624 -0
  4. package/dist/CrossAppRecordPicker-BXchXcK5.js.map +1 -0
  5. package/dist/Page-wHZrMN17.js +24 -0
  6. package/dist/Page-wHZrMN17.js.map +1 -0
  7. package/dist/ai/adopt/AiSuggestionPanel.d.ts +30 -0
  8. package/dist/ai/adopt/BusinessGuidancePanel.d.ts +31 -0
  9. package/dist/ai/adopt/DetailPageAiLayout.d.ts +7 -0
  10. package/dist/ai/adopt/adoptPresets.d.ts +11 -0
  11. package/dist/ai/adopt/guidanceContent.d.ts +27 -0
  12. package/dist/ai/adopt/parseAiSummary.d.ts +7 -0
  13. package/dist/ai/components/AgentJobProgress.d.ts +124 -0
  14. package/dist/ai/components/AsyncCombobox.d.ts +44 -0
  15. package/dist/ai/components/BulkActionBar.d.ts +44 -0
  16. package/dist/ai/components/EntityRef.d.ts +39 -0
  17. package/dist/ai/components/JobProgress.d.ts +64 -0
  18. package/dist/ai/components/ServerDataTable.d.ts +89 -0
  19. package/dist/ai/components/Timeline.d.ts +35 -0
  20. package/dist/ai/components/useInfiniteRows.d.ts +25 -0
  21. package/dist/ai/errors/userFacingError.d.ts +14 -0
  22. package/dist/ai/errors/userFacingError.js +48 -0
  23. package/dist/ai/errors/userFacingError.js.map +1 -0
  24. package/dist/ai/index.d.ts +34 -0
  25. package/dist/ai/integrations/partner/createPartnerRecordPickerHook.d.ts +15 -0
  26. package/dist/ai/integrations/partner/partnerRecordPicker.d.ts +20 -0
  27. package/dist/ai/layout/ModalWithAiLayout.d.ts +11 -0
  28. package/dist/ai/layout/aiUi.d.ts +16 -0
  29. package/dist/ai/layout/layoutConstants.d.ts +19 -0
  30. package/dist/ai/layout/modalSizeForAi.d.ts +5 -0
  31. package/dist/ai/locales/sharedAiCopy.d.ts +6 -0
  32. package/dist/ai/managed-data/DatasourceReadonlyTable.d.ts +11 -0
  33. package/dist/ai/managed-data/createTableClient.d.ts +7 -0
  34. package/dist/ai/managed-data/emitManagedEvent.d.ts +18 -0
  35. package/dist/ai/managed-data/executeManagedDatasource.d.ts +21 -0
  36. package/dist/ai/managed-data/queryManagedDatasource.d.ts +28 -0
  37. package/dist/ai/providers/AppUiProviders.d.ts +6 -0
  38. package/dist/ai/types/app-ai.types.d.ts +29 -0
  39. package/dist/ai/types/index.d.ts +1 -0
  40. package/dist/ai.d.ts +1 -0
  41. package/dist/ai.js +1817 -0
  42. package/dist/ai.js.map +1 -0
  43. package/dist/case-workspace/domain.d.ts +41 -0
  44. package/dist/case-workspace/domain.js +24 -0
  45. package/dist/case-workspace/domain.js.map +1 -0
  46. package/dist/case-workspace/index.d.ts +91 -0
  47. package/dist/case-workspace.d.ts +1 -0
  48. package/dist/case-workspace.js +392 -0
  49. package/dist/case-workspace.js.map +1 -0
  50. package/dist/cn-B6yFEsav.js +9 -0
  51. package/dist/cn-B6yFEsav.js.map +1 -0
  52. package/dist/components/ui/calendar.css +7 -0
  53. package/dist/cookieSettings-D_v3KS02.js +97 -0
  54. package/dist/cookieSettings-D_v3KS02.js.map +1 -0
  55. package/dist/dashboard/index.d.ts +16 -0
  56. package/dist/dashboard/src/ChartFrame.d.ts +18 -0
  57. package/dist/dashboard/src/ChartTooltip.d.ts +38 -0
  58. package/dist/dashboard/src/FilterBar.d.ts +23 -0
  59. package/dist/dashboard/src/KpiStatCard.d.ts +29 -0
  60. package/dist/dashboard/src/StatGrid.d.ts +15 -0
  61. package/dist/dashboard/src/TimeRangePicker.d.ts +14 -0
  62. package/dist/dashboard/src/chart.d.ts +10 -0
  63. package/dist/dashboard/src/format.d.ts +16 -0
  64. package/dist/dashboard/src/links.d.ts +2 -0
  65. package/dist/dashboard/src/useDashboardRange.d.ts +27 -0
  66. package/dist/dashboard.d.ts +1 -0
  67. package/dist/dashboard.js +361 -0
  68. package/dist/dashboard.js.map +1 -0
  69. package/dist/fonts.css +15 -0
  70. package/dist/hooks/access/AppAccessGate.d.ts +20 -0
  71. package/dist/hooks/access/AppAccessNotice.d.ts +8 -0
  72. package/dist/hooks/access/useAppAccess.d.ts +26 -0
  73. package/dist/hooks/config/businessLocale.d.ts +12 -0
  74. package/dist/hooks/config/currencies.d.ts +9 -0
  75. package/dist/hooks/index.d.ts +17 -0
  76. package/dist/hooks/picker/CrossAppRecordPicker.d.ts +37 -0
  77. package/dist/hooks/picker/managedAppPicker.d.ts +21 -0
  78. package/dist/hooks/picker/partnerPayload.d.ts +6 -0
  79. package/dist/hooks/routing/draftEntityId.d.ts +5 -0
  80. package/dist/hooks/routing/useRefetchOnRouteMatch.d.ts +6 -0
  81. package/dist/hooks/shell/resolveApiRoot.d.ts +13 -0
  82. package/dist/hooks/shell/shell.d.ts +4 -0
  83. package/dist/hooks/shell/useGenispacePlatformClient.d.ts +7 -0
  84. package/dist/hooks.d.ts +1 -0
  85. package/dist/hooks.js +42 -0
  86. package/dist/hooks.js.map +1 -0
  87. package/dist/index.d.ts +3 -0
  88. package/dist/index.js +77 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/kit.d.ts +50 -0
  91. package/dist/kit.js +2067 -0
  92. package/dist/kit.js.map +1 -0
  93. package/dist/page.d.ts +1 -0
  94. package/dist/page.js +5 -0
  95. package/dist/page.js.map +1 -0
  96. package/dist/shell-DIHnXIUb.js +6 -0
  97. package/dist/shell-DIHnXIUb.js.map +1 -0
  98. package/dist/shell.d.ts +30 -0
  99. package/dist/shell.js +104 -0
  100. package/dist/shell.js.map +1 -0
  101. package/dist/storage/assetPreview.d.ts +12 -0
  102. package/dist/storage/components/AssetThumbnail.d.ts +15 -0
  103. package/dist/storage/components/CopyStorageLinkButton.d.ts +13 -0
  104. package/dist/storage/components/StorageImage.d.ts +9 -0
  105. package/dist/storage/components/StoragePreviewContent.d.ts +22 -0
  106. package/dist/storage/components/StorageVideo.d.ts +9 -0
  107. package/dist/storage/copyTextToClipboard.d.ts +5 -0
  108. package/dist/storage/hooks/useAuthenticatedStorageBlobs.d.ts +3 -0
  109. package/dist/storage/hooks/useImageThumbnailBlobs.d.ts +4 -0
  110. package/dist/storage/hooks/useShareableStorageLink.d.ts +7 -0
  111. package/dist/storage/index.d.ts +12 -0
  112. package/dist/storage/openUrlInNewTab.d.ts +6 -0
  113. package/dist/storage/platformStorage.d.ts +43 -0
  114. package/dist/storage.d.ts +1 -0
  115. package/dist/storage.js +605 -0
  116. package/dist/storage.js.map +1 -0
  117. package/dist/style.css +1 -0
  118. package/dist/styles/base.css +616 -0
  119. package/dist/styles/reduced-motion.css +14 -0
  120. package/dist/styles/tailwind-preset.js +269 -0
  121. package/dist/task-workspace/domain.d.ts +35 -0
  122. package/dist/task-workspace/domain.js +45 -0
  123. package/dist/task-workspace/domain.js.map +1 -0
  124. package/dist/task-workspace/experience.d.ts +50 -0
  125. package/dist/task-workspace/index.d.ts +172 -0
  126. package/dist/task-workspace.d.ts +1 -0
  127. package/dist/task-workspace.js +626 -0
  128. package/dist/task-workspace.js.map +1 -0
  129. package/dist/ui/components/features/app/AppCheckboxInput.d.ts +9 -0
  130. package/dist/ui/components/features/app/AppConfirmDialog.d.ts +12 -0
  131. package/dist/ui/components/features/app/AppDashboardSkeleton.d.ts +9 -0
  132. package/dist/ui/components/features/app/AppDatePicker.d.ts +69 -0
  133. package/dist/ui/components/features/app/AppModal.d.ts +27 -0
  134. package/dist/ui/components/features/app/AppPageStates.d.ts +17 -0
  135. package/dist/ui/components/features/app/AppSelectInput.d.ts +10 -0
  136. package/dist/ui/components/features/app/AppTemporalInput.d.ts +19 -0
  137. package/dist/ui/components/features/app/Page.d.ts +14 -0
  138. package/dist/ui/components/features/app/QueryErrorAlert.d.ts +7 -0
  139. package/dist/ui/components/features/app/Sidebar.d.ts +47 -0
  140. package/dist/ui/components/features/app/index.d.ts +17 -0
  141. package/dist/ui/components/features/user/UserAvatar.d.ts +17 -0
  142. package/dist/ui/components/features/user/UserDisplay.d.ts +10 -0
  143. package/dist/ui/components/features/user/UserSelect.d.ts +14 -0
  144. package/dist/ui/components/features/user/useUserDirectory.d.ts +13 -0
  145. package/dist/ui/components/features/user/userDirectoryTypes.d.ts +18 -0
  146. package/dist/ui/components/patterns/form-section.d.ts +11 -0
  147. package/dist/ui/components/primitives/feedback/index.d.ts +2 -0
  148. package/dist/ui/components/primitives/feedback/toaster.d.ts +1 -0
  149. package/dist/ui/components/primitives/feedback/use-toast.d.ts +46 -0
  150. package/dist/ui/components/primitives/page-skeleton/ChartAreaSkeleton.d.ts +13 -0
  151. package/dist/ui/components/primitives/page-skeleton/ChartEmptyState.d.ts +14 -0
  152. package/dist/ui/components/primitives/page-skeleton/ComponentSkeletonShell.d.ts +16 -0
  153. package/dist/ui/components/primitives/page-skeleton/ConfigEditorSkeleton.d.ts +5 -0
  154. package/dist/ui/components/primitives/page-skeleton/DetailTabsSkeleton.d.ts +6 -0
  155. package/dist/ui/components/primitives/page-skeleton/EmptyStateBadge.d.ts +13 -0
  156. package/dist/ui/components/primitives/page-skeleton/FormCardSkeleton.d.ts +7 -0
  157. package/dist/ui/components/primitives/page-skeleton/FormFieldSkeleton.d.ts +6 -0
  158. package/dist/ui/components/primitives/page-skeleton/FormPageSkeleton.d.ts +6 -0
  159. package/dist/ui/components/primitives/page-skeleton/GridCardsSkeleton.d.ts +6 -0
  160. package/dist/ui/components/primitives/page-skeleton/ListSkeleton.d.ts +26 -0
  161. package/dist/ui/components/primitives/page-skeleton/PageHeaderSkeleton.d.ts +6 -0
  162. package/dist/ui/components/primitives/page-skeleton/SplitPaneSkeleton.d.ts +4 -0
  163. package/dist/ui/components/primitives/page-skeleton/StatsRowSkeleton.d.ts +5 -0
  164. package/dist/ui/components/primitives/page-skeleton/TableEmptyState.d.ts +27 -0
  165. package/dist/ui/components/primitives/page-skeleton/TablePageSkeleton.d.ts +8 -0
  166. package/dist/ui/components/primitives/page-skeleton/TabsBarSkeleton.d.ts +6 -0
  167. package/dist/ui/components/primitives/page-skeleton/index.d.ts +24 -0
  168. package/dist/ui/components/primitives/page-skeleton/skeletonMetrics.d.ts +9 -0
  169. package/dist/ui/components/primitives/page-skeleton/useVisibleCenter.d.ts +34 -0
  170. package/dist/ui/components/ui/accordion.d.ts +7 -0
  171. package/dist/ui/components/ui/ai-draft-banner.d.ts +21 -0
  172. package/dist/ui/components/ui/alert-dialog.d.ts +48 -0
  173. package/dist/ui/components/ui/alert.d.ts +8 -0
  174. package/dist/ui/components/ui/avatar.d.ts +6 -0
  175. package/dist/ui/components/ui/badge.d.ts +9 -0
  176. package/dist/ui/components/ui/breadcrumb.d.ts +19 -0
  177. package/dist/ui/components/ui/button.d.ts +11 -0
  178. package/dist/ui/components/ui/calendar.d.ts +8 -0
  179. package/dist/ui/components/ui/card.d.ts +8 -0
  180. package/dist/ui/components/ui/chart.d.ts +16 -0
  181. package/dist/ui/components/ui/checkbox.d.ts +4 -0
  182. package/dist/ui/components/ui/collapsible.d.ts +5 -0
  183. package/dist/ui/components/ui/column-config.d.ts +42 -0
  184. package/dist/ui/components/ui/date-picker.d.ts +9 -0
  185. package/dist/ui/components/ui/date-range-filter.d.ts +32 -0
  186. package/dist/ui/components/ui/date-range-picker.d.ts +11 -0
  187. package/dist/ui/components/ui/dialog-input.d.ts +17 -0
  188. package/dist/ui/components/ui/dialog-safe-select.d.ts +13 -0
  189. package/dist/ui/components/ui/dialog.d.ts +25 -0
  190. package/dist/ui/components/ui/dropdown-menu.d.ts +27 -0
  191. package/dist/ui/components/ui/feature-guide.d.ts +43 -0
  192. package/dist/ui/components/ui/form.d.ts +25 -0
  193. package/dist/ui/components/ui/help-tip.d.ts +29 -0
  194. package/dist/ui/components/ui/hint-notice.d.ts +22 -0
  195. package/dist/ui/components/ui/index.d.ts +6 -0
  196. package/dist/ui/components/ui/input.d.ts +3 -0
  197. package/dist/ui/components/ui/label.d.ts +5 -0
  198. package/dist/ui/components/ui/modal-container.d.ts +56 -0
  199. package/dist/ui/components/ui/modal-templates.d.ts +46 -0
  200. package/dist/ui/components/ui/multi-select.d.ts +20 -0
  201. package/dist/ui/components/ui/pagination.d.ts +28 -0
  202. package/dist/ui/components/ui/popover.d.ts +7 -0
  203. package/dist/ui/components/ui/progress.d.ts +7 -0
  204. package/dist/ui/components/ui/radio-button-group.d.ts +18 -0
  205. package/dist/ui/components/ui/radio-group.d.ts +5 -0
  206. package/dist/ui/components/ui/scroll-area.d.ts +5 -0
  207. package/dist/ui/components/ui/select.d.ts +16 -0
  208. package/dist/ui/components/ui/separator.d.ts +7 -0
  209. package/dist/ui/components/ui/sheet.d.ts +25 -0
  210. package/dist/ui/components/ui/sidebar-rail.d.ts +9 -0
  211. package/dist/ui/components/ui/skeleton.d.ts +2 -0
  212. package/dist/ui/components/ui/slider.d.ts +13 -0
  213. package/dist/ui/components/ui/switch.d.ts +4 -0
  214. package/dist/ui/components/ui/table.d.ts +10 -0
  215. package/dist/ui/components/ui/tabs.d.ts +10 -0
  216. package/dist/ui/components/ui/textarea.d.ts +3 -0
  217. package/dist/ui/components/ui/toast.d.ts +21 -0
  218. package/dist/ui/components/ui/toggle-group.d.ts +12 -0
  219. package/dist/ui/components/ui/toggle.d.ts +12 -0
  220. package/dist/ui/components/ui/tooltip.d.ts +7 -0
  221. package/dist/ui/components/ui/typography.d.ts +15 -0
  222. package/dist/ui/components/ui/underline-tabs.d.ts +13 -0
  223. package/dist/ui/components/ui/view-mode-toggle.d.ts +9 -0
  224. package/dist/ui/hooks/useIsMobile.d.ts +16 -0
  225. package/dist/ui/styles/design-tokens.d.ts +189 -0
  226. package/dist/ui/styles/z-index-layers.d.ts +46 -0
  227. package/dist/ui.d.ts +2 -0
  228. package/dist/ui.js +35 -0
  229. package/dist/ui.js.map +1 -0
  230. package/dist/useUserDirectory-CqkyCQoR.js +2377 -0
  231. package/dist/useUserDirectory-CqkyCQoR.js.map +1 -0
  232. package/dist/utils/cookieSettings.d.ts +12 -0
  233. package/dist/utils/data/countryCodes.d.ts +26 -0
  234. package/dist/utils/index.d.ts +18 -0
  235. package/dist/utils/utils/appPath.d.ts +5 -0
  236. package/dist/utils/utils/chunkLoadRecovery.d.ts +7 -0
  237. package/dist/utils/utils/cn.d.ts +3 -0
  238. package/dist/utils/utils/crossApp.d.ts +71 -0
  239. package/dist/utils/utils/debounce.d.ts +1 -0
  240. package/dist/utils/utils/formatUserLabel.d.ts +8 -0
  241. package/dist/utils/utils/formatting.d.ts +18 -0
  242. package/dist/utils/utils/logoutNotification.d.ts +28 -0
  243. package/dist/utils/utils/operatorLocale.d.ts +32 -0
  244. package/dist/utils/utils/routeLocalePrefetch.d.ts +5 -0
  245. package/dist/utils/utils/shellIframeUrl.d.ts +20 -0
  246. package/dist/utils/utils/spaceSettings.d.ts +20 -0
  247. package/dist/utils/utils/sso.d.ts +42 -0
  248. package/dist/utils/utils/throttle.d.ts +1 -0
  249. package/dist/utils/utils/timezones.d.ts +14 -0
  250. package/dist/utils/utils/toDateInputValue.d.ts +5 -0
  251. package/dist/utils/utils/watermark.d.ts +1 -0
  252. package/dist/utils.d.ts +1 -0
  253. package/dist/utils.js +1334 -0
  254. package/dist/utils.js.map +1 -0
  255. package/dist/vite.d.ts +22 -0
  256. package/dist/vite.js +74 -0
  257. package/dist/vite.js.map +1 -0
  258. package/package.json +191 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookieSettings-D_v3KS02.js","sources":["../src/utils/cookieSettings.ts"],"sourcesContent":["const COOKIE_PREFIX = 'gs_';\nconst COOKIE_MAX_AGE = 31536000; \n\nfunction getParentDomain(): string | null {\n if (typeof window === 'undefined') return null;\n\n const hostname = window.location.hostname;\n\n if (hostname === 'localhost' || hostname === '127.0.0.1') {\n return null;\n }\n\n const parts = hostname.split('.');\n if (parts.length >= 2) {\n return `.${parts.slice(-2).join('.')}`;\n }\n\n return null;\n}\n\nexport function setCookie(key: string, value: string): void {\n if (typeof document === 'undefined') return;\n\n const parentDomain = getParentDomain();\n\n const domain = parentDomain ? `; domain=${parentDomain}` : '';\n const cookie = `${COOKIE_PREFIX}${key}=${encodeURIComponent(value)}; path=/; max-age=${COOKIE_MAX_AGE}; SameSite=Lax${domain}`;\n document.cookie = cookie;\n}\n\nexport function getCookie(key: string): string | null {\n if (typeof document === 'undefined') return null;\n\n const name = `${COOKIE_PREFIX}${key}=`;\n const cookies = document.cookie.split(';');\n\n for (let cookie of cookies) {\n cookie = cookie.trim();\n if (cookie.indexOf(name) === 0) {\n try {\n const value = decodeURIComponent(cookie.substring(name.length));\n\n if (typeof value === 'string' && value.length > 0) {\n return value;\n }\n } catch (e) {\n\n console.warn(`Failed to decode cookie value for key \"${key}\":`, e);\n return null;\n }\n }\n }\n\n return null;\n}\n\nexport function removeCookie(key: string): void {\n if (typeof document === 'undefined') return;\n\n const parentDomain = getParentDomain();\n const domain = parentDomain ? `; domain=${parentDomain}` : '';\n document.cookie = `${COOKIE_PREFIX}${key}=; path=/; max-age=0${domain}`;\n}\n\nexport function setTheme(theme: string): void {\n\n if (typeof theme !== 'string' || (theme !== 'light' && theme !== 'dark')) {\n console.warn('Invalid theme value:', theme, 'falling back to light');\n theme = 'light';\n }\n\n setCookie('theme', theme);\n\n if (typeof document !== 'undefined') {\n document.documentElement.classList.remove('light', 'dark');\n document.documentElement.classList.add(theme);\n }\n}\n\nexport function getTheme(): string {\n const cookieTheme = getCookie('theme');\n\n if (cookieTheme && (cookieTheme === 'light' || cookieTheme === 'dark')) {\n return cookieTheme;\n }\n\n if (typeof document !== 'undefined') {\n if (document.documentElement.classList.contains('dark')) return 'dark';\n if (document.documentElement.classList.contains('light')) return 'light';\n }\n\n if (typeof window !== 'undefined' && window.matchMedia) {\n if (window.matchMedia('(prefers-color-scheme: dark)').matches) return 'dark';\n }\n\n return 'light';\n}\n\nexport function setLanguage(language: string): void {\n setCookie('lang', language);\n}\n\nexport function getLanguage(): string {\n\n const cookieLang = getCookie('lang');\n if (cookieLang && (cookieLang === 'zh' || cookieLang === 'en')) {\n return cookieLang;\n }\n\n return 'zh';\n}\n\nexport function setTimeZone(timeZone: string): void {\n setCookie('tz', timeZone);\n}\n\nexport function getTimeZone(): string {\n const cookieTz = getCookie('tz');\n if (cookieTz) return cookieTz;\n\n try {\n if (typeof Intl !== 'undefined' && Intl.DateTimeFormat) {\n const systemTz = Intl.DateTimeFormat().resolvedOptions().timeZone;\n return systemTz || 'Asia/Shanghai';\n }\n } catch {\n\n }\n\n return 'Asia/Shanghai';\n}\n\nexport function setSpaceId(spaceId: string | null): void {\n if (spaceId) {\n setCookie('space', spaceId);\n } else {\n removeCookie('space');\n removeCookie('team');\n }\n}\n\nexport function getSpaceId(): string | null {\n return getCookie('space');\n}\n\nexport function initializeSettings(\n onThemeChange?: (theme: string) => void,\n onLanguageChange?: (language: string) => void,\n onTimeZoneChange?: (timeZone: string) => void,\n onSpaceIdChange?: (spaceId: string | null) => void\n): void {\n const theme = getTheme();\n const language = getLanguage();\n const timeZone = getTimeZone();\n const spaceId = getSpaceId();\n\n if (theme && (theme === 'light' || theme === 'dark')) {\n if (onThemeChange) {\n onThemeChange(theme);\n } else if (typeof document !== 'undefined') {\n\n document.documentElement.classList.remove('light', 'dark');\n document.documentElement.classList.add(theme);\n }\n } else {\n\n const defaultTheme = 'light';\n if (onThemeChange) {\n onThemeChange(defaultTheme);\n } else if (typeof document !== 'undefined') {\n document.documentElement.classList.remove('light', 'dark');\n document.documentElement.classList.add(defaultTheme);\n }\n }\n\n if (language && onLanguageChange) {\n onLanguageChange(language);\n }\n\n if (timeZone && onTimeZoneChange) {\n onTimeZoneChange(timeZone);\n }\n\n if (onSpaceIdChange) {\n onSpaceIdChange(spaceId);\n }\n}\n"],"names":["COOKIE_PREFIX","getParentDomain","hostname","parts","setCookie","key","value","parentDomain","domain","cookie","getCookie","name","cookies","e","removeCookie","setTheme","theme","getTheme","cookieTheme","setLanguage","language","getLanguage","cookieLang","setTimeZone","timeZone","getTimeZone","cookieTz","setSpaceId","spaceId","getSpaceId","initializeSettings","onThemeChange","onLanguageChange","onTimeZoneChange","onSpaceIdChange","defaultTheme"],"mappings":"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"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @genispace/app-dashboard — shared "mature dashboard" kit:
3
+ * time-range selection with 环比/同比 (period & year-over-year) comparison,
4
+ * KPI stat cards, dimension filters, chart frames and link-to-data helpers.
5
+ * Import only from this barrel in application code.
6
+ */
7
+ export { useDashboardRange, resolvePreset, previousRange, yearOverYearRange, RANGE_PRESETS, type RangePreset, type DateRange, type UseDashboardRangeResult, } from './src/useDashboardRange';
8
+ export { finiteNum, fmtCount, fmtMoney, fmtPct, computeDelta, type Delta, type DeltaDirection, } from './src/format';
9
+ export { CHART_COLORS, CHART_GRID_STROKE, CHART_AXIS_TICK, chartColorAt } from './src/chart';
10
+ export { ChartTooltip, type ChartTooltipProps, ChartGradients, chartGradientRef, } from './src/ChartTooltip';
11
+ export { buildDataLink } from './src/links';
12
+ export { KpiStatCard, type KpiStatCardProps, type KpiComparison } from './src/KpiStatCard';
13
+ export { StatGrid, type StatGridProps, type StatGridColumns } from './src/StatGrid';
14
+ export { TimeRangePicker, type TimeRangePickerProps } from './src/TimeRangePicker';
15
+ export { FilterBar, DimensionSelect, type DimensionSelectProps, type DimensionOption, } from './src/FilterBar';
16
+ export { ChartFrame, type ChartFrameProps } from './src/ChartFrame';
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface ChartFrameProps {
4
+ title: ReactNode;
5
+ /** Right-aligned header slot (e.g. a legend, a small select, a "view all" link). */
6
+ actions?: ReactNode;
7
+ /** Hint under the title. */
8
+ subtitle?: ReactNode;
9
+ /** Fixed chart body height in px (defaults to 280). */
10
+ height?: number;
11
+ children: ReactNode;
12
+ className?: string;
13
+ }
14
+ /**
15
+ * Consistent Card frame for a dashboard chart. Wrap a recharts
16
+ * `<ResponsiveContainer width="100%" height="100%">` as the child.
17
+ */
18
+ export declare function ChartFrame({ title, actions, subtitle, height, children, className }: ChartFrameProps): import("react").JSX.Element;
@@ -0,0 +1,38 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ interface TooltipEntry {
4
+ name?: ReactNode;
5
+ value?: number | string;
6
+ color?: string;
7
+ dataKey?: string | number;
8
+ }
9
+ export interface ChartTooltipProps {
10
+ /** Injected by recharts when used as `<Tooltip content={<ChartTooltip … />} />`. */
11
+ active?: boolean;
12
+ payload?: TooltipEntry[];
13
+ label?: ReactNode;
14
+ /** Format the header label (e.g. a date bucket). */
15
+ labelFormatter?: (label: unknown) => ReactNode;
16
+ /** Format each series value; receives the raw value and series name. */
17
+ formatter?: (value: number | string, name: string) => ReactNode;
18
+ }
19
+ /**
20
+ * Themed recharts tooltip — replaces recharts' default bare white box with a
21
+ * rounded, elevated popover that follows the design tokens (bg-popover, border,
22
+ * shadow, muted labels, per-series color dots). Pass as
23
+ * `<Tooltip content={<ChartTooltip formatter={…} />} cursor={{ fill: 'hsl(var(--muted))', fillOpacity: 0.25 }} />`.
24
+ */
25
+ export declare function ChartTooltip({ active, payload, label, labelFormatter, formatter }: ChartTooltipProps): import("react").JSX.Element | null;
26
+ /**
27
+ * Vertical fade `<defs>` for area/bar fills — one linear gradient per palette
28
+ * color (top → bottom, opacity 0.35 → 0.02). Drop `<ChartGradients />` as the
29
+ * first child of a recharts chart, then fill a series with
30
+ * `fill={chartGradientRef(seriesIndex)}` for a modern soft-fill look instead of
31
+ * a flat block of color.
32
+ */
33
+ export declare function ChartGradients({ colors }: {
34
+ colors?: readonly string[];
35
+ }): import("react").JSX.Element;
36
+ /** `url(#…)` reference to the gradient for palette color `i` (see {@link ChartGradients}). */
37
+ export declare function chartGradientRef(i: number): string;
38
+ export {};
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface DimensionOption {
4
+ value: string;
5
+ label: string;
6
+ }
7
+ export interface DimensionSelectProps {
8
+ /** Small caption shown above/inline. */
9
+ label?: string;
10
+ value: string;
11
+ options: DimensionOption[];
12
+ onChange: (value: string) => void;
13
+ /** Sentinel value for "all" (no filter). Defaults to "__all__". */
14
+ allValue?: string;
15
+ allLabel?: string;
16
+ className?: string;
17
+ }
18
+ /** A single dimension filter (channel / category / tier / store ...). */
19
+ export declare function DimensionSelect({ label, value, options, onChange, allValue, allLabel, className, }: DimensionSelectProps): import("react").JSX.Element;
20
+ /** Horizontal toolbar that lays out time-range + dimension filters. */
21
+ export declare function FilterBar({ children }: {
22
+ children: ReactNode;
23
+ }): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+ import { Delta } from './format';
3
+
4
+ export interface KpiComparison {
5
+ /** Short label, e.g. "环比" / "MoM" / "同比" / "YoY". */
6
+ label: string;
7
+ delta: Delta;
8
+ /**
9
+ * Hover tooltip spelling out what the delta compares against — the exact
10
+ * base period and its value (e.g. "vs 2026-05-13 – 2026-06-11: ¥182K").
11
+ */
12
+ title?: string;
13
+ }
14
+ export interface KpiStatCardProps {
15
+ label: string;
16
+ value: ReactNode;
17
+ icon?: ComponentType<{
18
+ className?: string;
19
+ }>;
20
+ /** Comparison chips (e.g. 环比 + 同比). */
21
+ comparisons?: KpiComparison[];
22
+ /** When false, a DOWN movement is colored good (e.g. churn, dormant). Default true. */
23
+ higherIsBetter?: boolean;
24
+ /** Secondary line under the value. */
25
+ hint?: string;
26
+ /** Drill / link-to-data. Renders the card as an interactive button. */
27
+ onClick?: () => void;
28
+ }
29
+ export declare function KpiStatCard({ label, value, icon: Icon, comparisons, higherIsBetter, hint, onClick, }: KpiStatCardProps): import("react").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ /** Desktop (lg+) column target. Mobile is always 2, tablet (sm) is `md ?? 3`. */
4
+ export type StatGridColumns = 2 | 3 | 4 | 5;
5
+ export interface StatGridProps {
6
+ children: ReactNode;
7
+ /**
8
+ * Column count at the widest (`lg`) breakpoint. The grid is mobile-first:
9
+ * 2 columns on phones (never 1 — see H5 design plan D1), an intermediate step
10
+ * at `sm`, then `columns` at `lg`. Defaults to 4.
11
+ */
12
+ columns?: StatGridColumns;
13
+ className?: string;
14
+ }
15
+ export declare function StatGrid({ children, columns, className }: StatGridProps): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { RangePreset, DateRange } from './useDashboardRange';
2
+
3
+ export interface TimeRangePickerProps {
4
+ range: DateRange;
5
+ setPreset: (p: RangePreset) => void;
6
+ setCustom: (from: string, to: string) => void;
7
+ /** Optional i18n label overrides (per preset, plus `apply`). */
8
+ labels?: Partial<Record<RangePreset, string>> & {
9
+ apply?: string;
10
+ };
11
+ /** Visible presets (defaults to all). */
12
+ presets?: RangePreset[];
13
+ }
14
+ export declare function TimeRangePicker({ range, setPreset, setCustom, labels, presets }: TimeRangePickerProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ /** Shared recharts styling tokens (semantic HSL; consistent across all GeniApp dashboards).
2
+ * The first series follows the app's theme color (--primary) so each app's dashboard
3
+ * leads with its own brand accent; the rest are a fixed categorical palette. */
4
+ export declare const CHART_COLORS: readonly ["hsl(var(--primary))", "hsl(280 65% 55%)", "hsl(160 55% 42%)", "hsl(32 95% 55%)", "hsl(340 72% 52%)", "hsl(199 89% 48%)", "hsl(142 71% 45%)", "hsl(48 96% 53%)"];
5
+ export declare const CHART_GRID_STROKE = "hsl(var(--border))";
6
+ export declare const CHART_AXIS_TICK: {
7
+ readonly fontSize: 11;
8
+ readonly fill: "hsl(var(--muted-foreground))";
9
+ };
10
+ export declare function chartColorAt(i: number): string;
@@ -0,0 +1,16 @@
1
+ /** Numeric/format helpers shared by dashboard widgets. */
2
+ export declare function finiteNum(v: unknown): number | null;
3
+ /** Compact count: 31,204 → "31.2K", 980 → "980". */
4
+ export declare function fmtCount(v: unknown): string;
5
+ /** Compact money: 2_400_000 → "¥2.4M", 186_000 → "¥186K". */
6
+ export declare function fmtMoney(v: unknown, currency?: string): string;
7
+ /** Signed percent for a fraction (0.123 → "+12.3%"). null → em dash. */
8
+ export declare function fmtPct(v: number | null | undefined, digits?: number): string;
9
+ export type DeltaDirection = 'up' | 'down' | 'flat';
10
+ export interface Delta {
11
+ /** Fractional change vs base (0.12 = +12%); null when base is 0 and not computable. */
12
+ pct: number | null;
13
+ direction: DeltaDirection;
14
+ }
15
+ /** Period-over-period delta. base=0 with positive current → direction up, pct null (n/a). */
16
+ export declare function computeDelta(current: unknown, base: unknown): Delta;
@@ -0,0 +1,2 @@
1
+ /** Build a `path?key=value` link-to-data URL, skipping null/empty params. */
2
+ export declare function buildDataLink(path: string, params: Record<string, string | number | null | undefined>): string;
@@ -0,0 +1,27 @@
1
+ /** Preset windows for the dashboard time-range selector. */
2
+ export type RangePreset = 'today' | '7d' | '30d' | 'mtd' | 'qtd' | 'ytd' | '12m' | 'custom';
3
+ export declare const RANGE_PRESETS: RangePreset[];
4
+ /** Inclusive `from`, EXCLUSIVE `to` (YYYY-MM-DD). Query with `>= from AND < to`. */
5
+ export interface DateRange {
6
+ from: string;
7
+ to: string;
8
+ preset: RangePreset;
9
+ }
10
+ /** Resolve a preset into a concrete [from, to) window (to = exclusive, day after today). */
11
+ export declare function resolvePreset(preset: RangePreset): DateRange;
12
+ /** Immediately-preceding window of equal length (环比 / period-over-period). */
13
+ export declare function previousRange(r: DateRange): DateRange;
14
+ /** Same window shifted back one year (同比 / year-over-year). */
15
+ export declare function yearOverYearRange(r: DateRange): DateRange;
16
+ export interface UseDashboardRangeResult {
17
+ range: DateRange;
18
+ prevRange: DateRange;
19
+ yoyRange: DateRange;
20
+ setPreset: (p: RangePreset) => void;
21
+ setCustom: (from: string, to: string) => void;
22
+ }
23
+ /**
24
+ * Dashboard time-range state with derived 环比 (previous) and 同比 (year-over-year)
25
+ * comparison windows. `to` is exclusive; pass `from`/`to` to date-range datasources.
26
+ */
27
+ export declare function useDashboardRange(initial?: RangePreset): UseDashboardRangeResult;
@@ -0,0 +1 @@
1
+ export * from './dashboard/index';
@@ -0,0 +1,361 @@
1
+ import { jsx as s, jsxs as i } from "react/jsx-runtime";
2
+ import { Card as M, CardContent as F, ToggleGroup as R, ToggleGroupItem as k, Popover as A, PopoverTrigger as Y, Button as v, PopoverContent as _, Input as b, Select as G, SelectTrigger as O, SelectValue as P, SelectContent as I, SelectItem as w, CardHeader as j, CardTitle as E } from "@genispace/geniapp/kit";
3
+ import { ArrowUpRight as K, ArrowDownRight as L, Minus as q, CalendarRange as B } from "lucide-react";
4
+ import { formatBusinessNumber as H } from "@genispace/geniapp/hooks";
5
+ import { useState as x, useCallback as y, useMemo as D } from "react";
6
+ const z = ["today", "7d", "30d", "mtd", "qtd", "ytd", "12m"];
7
+ function h(e) {
8
+ return `${e.getUTCFullYear()}-${String(e.getUTCMonth() + 1).padStart(2, "0")}-${String(e.getUTCDate()).padStart(2, "0")}`;
9
+ }
10
+ function g(e) {
11
+ const [t, n, r] = e.split("-").map((a) => parseInt(a, 10));
12
+ return new Date(Date.UTC(t, (n || 1) - 1, r || 1));
13
+ }
14
+ function p(e, t) {
15
+ const n = new Date(e.getTime());
16
+ return n.setUTCDate(n.getUTCDate() + t), n;
17
+ }
18
+ function V(e, t) {
19
+ const n = new Date(e.getTime());
20
+ return n.setUTCMonth(n.getUTCMonth() + t), n;
21
+ }
22
+ function U(e, t) {
23
+ const n = new Date(e.getTime());
24
+ return n.setUTCFullYear(n.getUTCFullYear() + t), n;
25
+ }
26
+ function Q() {
27
+ const e = /* @__PURE__ */ new Date();
28
+ return new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()));
29
+ }
30
+ function $(e) {
31
+ const t = Q(), n = h(p(t, 1));
32
+ let r;
33
+ switch (e) {
34
+ case "today":
35
+ r = t;
36
+ break;
37
+ case "7d":
38
+ r = p(t, -6);
39
+ break;
40
+ case "30d":
41
+ r = p(t, -29);
42
+ break;
43
+ case "mtd":
44
+ r = new Date(Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), 1));
45
+ break;
46
+ case "qtd": {
47
+ const a = Math.floor(t.getUTCMonth() / 3) * 3;
48
+ r = new Date(Date.UTC(t.getUTCFullYear(), a, 1));
49
+ break;
50
+ }
51
+ case "ytd":
52
+ r = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
53
+ break;
54
+ case "12m":
55
+ r = V(new Date(Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), 1)), -11);
56
+ break;
57
+ default:
58
+ r = p(t, -29);
59
+ }
60
+ return { from: h(r), to: n, preset: e };
61
+ }
62
+ function X(e) {
63
+ const t = g(e.from), n = g(e.to), r = Math.round((n.getTime() - t.getTime()) / 864e5);
64
+ return { from: h(p(t, -r)), to: e.from, preset: e.preset };
65
+ }
66
+ function J(e) {
67
+ return { from: h(U(g(e.from), -1)), to: h(U(g(e.to), -1)), preset: e.preset };
68
+ }
69
+ function oe(e = "30d") {
70
+ const [t, n] = x(() => $(e)), r = y((l) => n($(l)), []), a = y((l, c) => {
71
+ n({ from: l, to: h(p(g(c), 1)), preset: "custom" });
72
+ }, []), o = D(() => X(t), [t]), d = D(() => J(t), [t]);
73
+ return { range: t, prevRange: o, yoyRange: d, setPreset: r, setCustom: a };
74
+ }
75
+ function C(e) {
76
+ if (e == null || e === "") return null;
77
+ const t = typeof e == "number" ? e : parseFloat(String(e));
78
+ return Number.isFinite(t) ? t : null;
79
+ }
80
+ function le(e) {
81
+ const t = C(e) ?? 0, n = Math.abs(t);
82
+ return n >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : n >= 1e4 ? `${(t / 1e3).toFixed(t % 1e3 === 0 ? 0 : 1)}K` : H(Math.round(t));
83
+ }
84
+ function ie(e, t = "¥") {
85
+ const n = C(e) ?? 0, r = n < 0 ? "-" : "", a = Math.abs(n);
86
+ return a >= 1e6 ? `${r}${t}${(a / 1e6).toFixed(1)}M` : a >= 1e3 ? `${r}${t}${(a / 1e3).toFixed(0)}K` : `${r}${t}${a.toFixed(0)}`;
87
+ }
88
+ function W(e, t = 1) {
89
+ return e == null || !Number.isFinite(e) ? "—" : `${e > 0 ? "+" : ""}${(e * 100).toFixed(t)}%`;
90
+ }
91
+ function ce(e, t) {
92
+ const n = C(e) ?? 0, r = C(t) ?? 0;
93
+ if (r === 0)
94
+ return { pct: n === 0 ? 0 : null, direction: n > 0 ? "up" : n < 0 ? "down" : "flat" };
95
+ const a = (n - r) / Math.abs(r);
96
+ return { pct: a, direction: a > 1e-4 ? "up" : a < -1e-4 ? "down" : "flat" };
97
+ }
98
+ const m = [
99
+ "hsl(var(--primary))",
100
+ // app theme accent
101
+ "hsl(280 65% 55%)",
102
+ // purple
103
+ "hsl(160 55% 42%)",
104
+ // teal
105
+ "hsl(32 95% 55%)",
106
+ // orange
107
+ "hsl(340 72% 52%)",
108
+ // pink
109
+ "hsl(199 89% 48%)",
110
+ // cyan
111
+ "hsl(142 71% 45%)",
112
+ // green
113
+ "hsl(48 96% 53%)"
114
+ // amber
115
+ ], de = "hsl(var(--border))", ue = { fontSize: 11, fill: "hsl(var(--muted-foreground))" };
116
+ function me(e) {
117
+ return m[e % m.length];
118
+ }
119
+ function fe({ active: e, payload: t, label: n, labelFormatter: r, formatter: a }) {
120
+ return !e || !t || t.length === 0 ? null : /* @__PURE__ */ i("div", { className: "min-w-[8rem] rounded-lg border border-border bg-popover/95 px-3 py-2 text-xs shadow-lg backdrop-blur-sm", children: [
121
+ n != null && n !== "" ? /* @__PURE__ */ s("div", { className: "mb-1.5 font-medium text-foreground", children: r ? r(n) : n }) : null,
122
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: t.map((o, d) => /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
123
+ /* @__PURE__ */ s(
124
+ "span",
125
+ {
126
+ "aria-hidden": !0,
127
+ className: "h-2 w-2 shrink-0 rounded-full",
128
+ style: { backgroundColor: o.color ?? m[d % m.length] }
129
+ }
130
+ ),
131
+ /* @__PURE__ */ s("span", { className: "text-muted-foreground", children: o.name }),
132
+ /* @__PURE__ */ s("span", { className: "ml-auto pl-3 font-medium tabular-nums text-foreground", children: a && o.value != null ? a(o.value, String(o.name ?? "")) : o.value })
133
+ ] }, `${String(o.dataKey ?? d)}`)) })
134
+ ] });
135
+ }
136
+ function pe({ colors: e = m }) {
137
+ return /* @__PURE__ */ s("defs", { children: e.map((t, n) => /* @__PURE__ */ i("linearGradient", { id: `chartGrad${n}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
138
+ /* @__PURE__ */ s("stop", { offset: "0%", stopColor: t, stopOpacity: 0.35 }),
139
+ /* @__PURE__ */ s("stop", { offset: "100%", stopColor: t, stopOpacity: 0.02 })
140
+ ] }, n)) });
141
+ }
142
+ function he(e) {
143
+ return `url(#chartGrad${(e % m.length + m.length) % m.length})`;
144
+ }
145
+ function ge(e, t) {
146
+ const n = new URLSearchParams();
147
+ for (const [a, o] of Object.entries(t)) {
148
+ if (o == null) continue;
149
+ const d = String(o).trim();
150
+ d !== "" && n.set(a, d);
151
+ }
152
+ const r = n.toString();
153
+ return r ? `${e}?${r}` : e;
154
+ }
155
+ function Z(e, t) {
156
+ return e.direction === "flat" || e.pct == null ? "text-muted-foreground" : (t ? e.direction === "up" : e.direction === "down") ? "text-emerald-600" : "text-rose-600";
157
+ }
158
+ function xe({
159
+ label: e,
160
+ value: t,
161
+ icon: n,
162
+ comparisons: r,
163
+ higherIsBetter: a = !0,
164
+ hint: o,
165
+ onClick: d
166
+ }) {
167
+ const l = typeof d == "function";
168
+ return /* @__PURE__ */ s(
169
+ M,
170
+ {
171
+ className: l ? "cursor-pointer transition-colors hover:border-primary/50 hover:bg-accent/40" : void 0,
172
+ onClick: d,
173
+ role: l ? "button" : void 0,
174
+ tabIndex: l ? 0 : void 0,
175
+ onKeyDown: l ? (c) => {
176
+ (c.key === "Enter" || c.key === " ") && (c.preventDefault(), d?.());
177
+ } : void 0,
178
+ children: /* @__PURE__ */ i(F, { className: "py-4 sm:py-5", children: [
179
+ /* @__PURE__ */ i("div", { className: "flex items-start justify-between gap-2", children: [
180
+ /* @__PURE__ */ s("p", { className: "text-xs font-medium text-muted-foreground sm:text-sm", children: e }),
181
+ n ? /* @__PURE__ */ s(n, { className: "h-4 w-4 shrink-0 text-muted-foreground/60" }) : null
182
+ ] }),
183
+ /* @__PURE__ */ s("p", { className: "mt-1.5 text-xl font-semibold tracking-tight text-foreground sm:mt-2 sm:text-2xl", children: t }),
184
+ o ? /* @__PURE__ */ s("p", { className: "mt-1 text-xs text-muted-foreground", children: o }) : null,
185
+ r && r.length > 0 ? /* @__PURE__ */ s("div", { className: "mt-3 flex flex-wrap items-center gap-x-4 gap-y-1", children: r.map((c) => {
186
+ const f = Z(c.delta, a), T = c.delta.direction === "up" ? K : c.delta.direction === "down" ? L : q;
187
+ return /* @__PURE__ */ i(
188
+ "span",
189
+ {
190
+ className: `inline-flex items-center gap-1 text-xs ${c.title ? "cursor-help" : ""}`,
191
+ title: c.title,
192
+ children: [
193
+ /* @__PURE__ */ s(
194
+ "span",
195
+ {
196
+ className: `text-muted-foreground ${c.title ? "border-b border-dotted border-muted-foreground/40" : ""}`,
197
+ children: c.label
198
+ }
199
+ ),
200
+ /* @__PURE__ */ i("span", { className: `inline-flex items-center gap-0.5 font-medium ${f}`, children: [
201
+ /* @__PURE__ */ s(T, { className: "h-3 w-3" }),
202
+ W(c.delta.pct)
203
+ ] })
204
+ ]
205
+ },
206
+ c.label
207
+ );
208
+ }) }) : null
209
+ ] })
210
+ }
211
+ );
212
+ }
213
+ const ee = {
214
+ 2: "grid-cols-2",
215
+ 3: "grid-cols-2 sm:grid-cols-3",
216
+ 4: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-4",
217
+ 5: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-5"
218
+ };
219
+ function Ce({ children: e, columns: t = 4, className: n }) {
220
+ return /* @__PURE__ */ s("div", { className: `grid gap-3 sm:gap-4 ${ee[t]}${n ? ` ${n}` : ""}`, children: e });
221
+ }
222
+ const S = {
223
+ today: "Today",
224
+ "7d": "7D",
225
+ "30d": "30D",
226
+ mtd: "MTD",
227
+ qtd: "QTD",
228
+ ytd: "YTD",
229
+ "12m": "12M",
230
+ custom: "Custom"
231
+ };
232
+ function Te({ range: e, setPreset: t, setCustom: n, labels: r, presets: a = z }) {
233
+ const [o, d] = x(!1), [l, c] = x(e.from), [f, T] = x(e.to), N = (u) => r?.[u] ?? S[u];
234
+ return /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
235
+ /* @__PURE__ */ s(
236
+ R,
237
+ {
238
+ type: "single",
239
+ value: e.preset === "custom" ? "" : e.preset,
240
+ onValueChange: (u) => {
241
+ u && t(u);
242
+ },
243
+ className: "flex-wrap justify-start",
244
+ children: a.map((u) => /* @__PURE__ */ s(k, { value: u, "aria-label": N(u), className: "h-8 px-3 text-xs", children: N(u) }, u))
245
+ }
246
+ ),
247
+ /* @__PURE__ */ i(A, { open: o, onOpenChange: d, children: [
248
+ /* @__PURE__ */ s(Y, { asChild: !0, children: /* @__PURE__ */ i(
249
+ v,
250
+ {
251
+ variant: e.preset === "custom" ? "default" : "outline",
252
+ size: "sm",
253
+ className: "h-8 gap-1.5 text-xs",
254
+ children: [
255
+ /* @__PURE__ */ s(B, { className: "h-3.5 w-3.5" }),
256
+ e.preset === "custom" ? `${e.from} → ${e.to}` : r?.custom ?? S.custom
257
+ ]
258
+ }
259
+ ) }),
260
+ /* @__PURE__ */ i(_, { align: "end", className: "w-auto space-y-3 p-3", children: [
261
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
262
+ /* @__PURE__ */ s(
263
+ b,
264
+ {
265
+ type: "date",
266
+ value: l,
267
+ max: f,
268
+ onChange: (u) => c(u.target.value),
269
+ className: "h-8 w-[150px] text-xs"
270
+ }
271
+ ),
272
+ /* @__PURE__ */ s("span", { className: "text-muted-foreground", children: "→" }),
273
+ /* @__PURE__ */ s(
274
+ b,
275
+ {
276
+ type: "date",
277
+ value: f,
278
+ min: l,
279
+ onChange: (u) => T(u.target.value),
280
+ className: "h-8 w-[150px] text-xs"
281
+ }
282
+ )
283
+ ] }),
284
+ /* @__PURE__ */ s("div", { className: "flex justify-end", children: /* @__PURE__ */ s(
285
+ v,
286
+ {
287
+ size: "sm",
288
+ className: "h-8 text-xs",
289
+ disabled: !l || !f || l > f,
290
+ onClick: () => {
291
+ n(l, f), d(!1);
292
+ },
293
+ children: r?.apply ?? "Apply"
294
+ }
295
+ ) })
296
+ ] })
297
+ ] })
298
+ ] });
299
+ }
300
+ function Ne({
301
+ label: e,
302
+ value: t,
303
+ options: n,
304
+ onChange: r,
305
+ allValue: a = "__all__",
306
+ allLabel: o = "All",
307
+ className: d
308
+ }) {
309
+ return /* @__PURE__ */ i("div", { className: `flex items-center gap-1.5 ${d ?? ""}`, children: [
310
+ e ? /* @__PURE__ */ s("span", { className: "text-xs text-muted-foreground", children: e }) : null,
311
+ /* @__PURE__ */ i(G, { value: t || a, onValueChange: r, children: [
312
+ /* @__PURE__ */ s(O, { className: "h-8 w-[150px] text-xs", children: /* @__PURE__ */ s(P, { placeholder: o }) }),
313
+ /* @__PURE__ */ i(I, { children: [
314
+ /* @__PURE__ */ s(w, { value: a, children: o }),
315
+ n.map((l) => /* @__PURE__ */ s(w, { value: l.value, children: l.label }, l.value))
316
+ ] })
317
+ ] })
318
+ ] });
319
+ }
320
+ function ve({ children: e }) {
321
+ return /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2", children: e });
322
+ }
323
+ function be({ title: e, actions: t, subtitle: n, height: r = 280, children: a, className: o }) {
324
+ return /* @__PURE__ */ i(M, { className: o, children: [
325
+ /* @__PURE__ */ i(j, { className: "flex flex-row items-start justify-between space-y-0 pb-2", children: [
326
+ /* @__PURE__ */ i("div", { children: [
327
+ /* @__PURE__ */ s(E, { className: "text-base", children: e }),
328
+ n ? /* @__PURE__ */ s("p", { className: "mt-1 text-xs text-muted-foreground", children: n }) : null
329
+ ] }),
330
+ t ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: t }) : null
331
+ ] }),
332
+ /* @__PURE__ */ s(F, { children: /* @__PURE__ */ s("div", { style: { height: r }, children: a }) })
333
+ ] });
334
+ }
335
+ export {
336
+ ue as CHART_AXIS_TICK,
337
+ m as CHART_COLORS,
338
+ de as CHART_GRID_STROKE,
339
+ be as ChartFrame,
340
+ pe as ChartGradients,
341
+ fe as ChartTooltip,
342
+ Ne as DimensionSelect,
343
+ ve as FilterBar,
344
+ xe as KpiStatCard,
345
+ z as RANGE_PRESETS,
346
+ Ce as StatGrid,
347
+ Te as TimeRangePicker,
348
+ ge as buildDataLink,
349
+ me as chartColorAt,
350
+ he as chartGradientRef,
351
+ ce as computeDelta,
352
+ C as finiteNum,
353
+ le as fmtCount,
354
+ ie as fmtMoney,
355
+ W as fmtPct,
356
+ X as previousRange,
357
+ $ as resolvePreset,
358
+ oe as useDashboardRange,
359
+ J as yearOverYearRange
360
+ };
361
+ //# sourceMappingURL=dashboard.js.map