@vertesia/ui 0.67.0 → 0.68.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 (283) hide show
  1. package/lib/esm/core/components/Badge.js +1 -1
  2. package/lib/esm/core/components/Badge.js.map +1 -1
  3. package/lib/esm/core/components/FormItem.js +2 -2
  4. package/lib/esm/core/components/FormItem.js.map +1 -1
  5. package/lib/esm/core/components/InputList.js +2 -2
  6. package/lib/esm/core/components/InputList.js.map +1 -1
  7. package/lib/esm/core/components/shadcn/checkbox.js +1 -1
  8. package/lib/esm/core/components/shadcn/checkbox.js.map +1 -1
  9. package/lib/esm/core/components/shadcn/command.js +1 -1
  10. package/lib/esm/core/components/shadcn/command.js.map +1 -1
  11. package/lib/esm/core/components/shadcn/dialog.js +6 -6
  12. package/lib/esm/core/components/shadcn/dialog.js.map +1 -1
  13. package/lib/esm/core/components/shadcn/filters/DynamicLabel.js.map +1 -1
  14. package/lib/esm/core/components/shadcn/filters/comboBox/DateCombobox.js +129 -0
  15. package/lib/esm/core/components/shadcn/filters/comboBox/DateCombobox.js.map +1 -0
  16. package/lib/esm/core/components/shadcn/filters/comboBox/SelectCombobox.js +46 -0
  17. package/lib/esm/core/components/shadcn/filters/comboBox/SelectCombobox.js.map +1 -0
  18. package/lib/esm/core/components/shadcn/filters/comboBox/StringListCombobox.js +23 -0
  19. package/lib/esm/core/components/shadcn/filters/comboBox/StringListCombobox.js.map +1 -0
  20. package/lib/esm/core/components/shadcn/filters/comboBox/TextCombobox.js +28 -0
  21. package/lib/esm/core/components/shadcn/filters/comboBox/TextCombobox.js.map +1 -0
  22. package/lib/esm/core/components/shadcn/filters/comboBox/comboBox.js +5 -0
  23. package/lib/esm/core/components/shadcn/filters/comboBox/comboBox.js.map +1 -0
  24. package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js +101 -0
  25. package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js.map +1 -0
  26. package/lib/esm/core/components/shadcn/filters/{stringListFilter.js → filter/StringListFilter.js} +3 -3
  27. package/lib/esm/core/components/shadcn/filters/filter/StringListFilter.js.map +1 -0
  28. package/lib/esm/core/components/shadcn/filters/{textFilter.js → filter/TextFilter.js} +4 -4
  29. package/lib/esm/core/components/shadcn/filters/filter/TextFilter.js.map +1 -0
  30. package/lib/esm/core/components/shadcn/filters/filter/dateFilter.js +161 -0
  31. package/lib/esm/core/components/shadcn/filters/filter/dateFilter.js.map +1 -0
  32. package/lib/esm/core/components/shadcn/filters/filter-styles.js +88 -0
  33. package/lib/esm/core/components/shadcn/filters/filter-styles.js.map +1 -0
  34. package/lib/esm/core/components/shadcn/filters/filterBar.js +128 -87
  35. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
  36. package/lib/esm/core/components/shadcn/filters/filters.js +7 -6
  37. package/lib/esm/core/components/shadcn/filters/filters.js.map +1 -1
  38. package/lib/esm/core/components/shadcn/filters/index.js +1 -1
  39. package/lib/esm/core/components/shadcn/filters/index.js.map +1 -1
  40. package/lib/esm/core/components/shadcn/filters/types.js.map +1 -1
  41. package/lib/esm/core/components/toast/NotificationPanel.js +24 -18
  42. package/lib/esm/core/components/toast/NotificationPanel.js.map +1 -1
  43. package/lib/esm/features/agent/PayloadBuilder.js +47 -27
  44. package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
  45. package/lib/esm/features/agent/chat/ModernAgentConversation.js +9 -3
  46. package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -1
  47. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +7 -6
  48. package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
  49. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js +12 -1
  50. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
  51. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingMessages.js +2 -1
  52. package/lib/esm/features/agent/chat/ModernAgentOutput/SlidingMessages.js.map +1 -1
  53. package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js +10 -4
  54. package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js.map +1 -1
  55. package/lib/esm/features/facets/DocumentsFacetsNav.js +133 -0
  56. package/lib/esm/features/facets/DocumentsFacetsNav.js.map +1 -0
  57. package/lib/esm/features/facets/RunsFacetsNav.js +125 -0
  58. package/lib/esm/features/facets/RunsFacetsNav.js.map +1 -0
  59. package/lib/esm/features/facets/VFacetsNav.js +4 -113
  60. package/lib/esm/features/facets/VFacetsNav.js.map +1 -1
  61. package/lib/esm/features/facets/VStringFacet.js +6 -4
  62. package/lib/esm/features/facets/VStringFacet.js.map +1 -1
  63. package/lib/esm/features/facets/VTypeFacet.js +4 -5
  64. package/lib/esm/features/facets/VTypeFacet.js.map +1 -1
  65. package/lib/esm/features/facets/VUserFacet.js +1 -1
  66. package/lib/esm/features/facets/VUserFacet.js.map +1 -1
  67. package/lib/esm/features/facets/WorkflowExecutionsFacetsNav.js +98 -0
  68. package/lib/esm/features/facets/WorkflowExecutionsFacetsNav.js.map +1 -0
  69. package/lib/esm/features/facets/index.js +3 -2
  70. package/lib/esm/features/facets/index.js.map +1 -1
  71. package/lib/esm/features/store/collections/CollectionsTable.js +1 -1
  72. package/lib/esm/features/store/collections/CollectionsTable.js.map +1 -1
  73. package/lib/esm/features/store/collections/CreateCollection.js +10 -9
  74. package/lib/esm/features/store/collections/CreateCollection.js.map +1 -1
  75. package/lib/esm/features/store/collections/EditCollectionView.js +10 -9
  76. package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
  77. package/lib/esm/features/store/collections/SelectCollection.js +1 -1
  78. package/lib/esm/features/store/collections/SelectCollection.js.map +1 -1
  79. package/lib/esm/features/store/objects/DocumentPreviewPanel.js +0 -1
  80. package/lib/esm/features/store/objects/DocumentPreviewPanel.js.map +1 -1
  81. package/lib/esm/features/store/objects/DocumentSearchResults.js +37 -2
  82. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
  83. package/lib/esm/features/store/objects/components/ContentOverview.js +0 -2
  84. package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
  85. package/lib/esm/features/store/objects/components/SelectDocument.js +2 -2
  86. package/lib/esm/features/store/objects/components/SelectDocument.js.map +1 -1
  87. package/lib/esm/features/store/objects/components/VectorSearchWidget.js +1 -1
  88. package/lib/esm/features/store/objects/components/VectorSearchWidget.js.map +1 -1
  89. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +16 -4
  90. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +1 -1
  91. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js +72 -37
  92. package/lib/esm/features/store/objects/upload/DocumentUploadModal.js.map +1 -1
  93. package/lib/esm/features/store/types/ObjectSchemaEditor.js +15 -0
  94. package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +1 -1
  95. package/lib/esm/features/user/UserInfo.js +8 -8
  96. package/lib/esm/features/user/UserInfo.js.map +1 -1
  97. package/lib/esm/router/HistoryNavigator.js +2 -2
  98. package/lib/esm/router/HistoryNavigator.js.map +1 -1
  99. package/lib/esm/shell/SplashScreen.js +19 -0
  100. package/lib/esm/shell/SplashScreen.js.map +1 -0
  101. package/lib/esm/shell/VertesiaShell.js +10 -0
  102. package/lib/esm/shell/VertesiaShell.js.map +1 -0
  103. package/lib/esm/shell/index.js +7 -0
  104. package/lib/esm/shell/index.js.map +1 -0
  105. package/lib/esm/shell/login/EnterpriseSigninButton.js +81 -0
  106. package/lib/esm/shell/login/EnterpriseSigninButton.js.map +1 -0
  107. package/lib/esm/shell/login/GitHubSignInButton.js +24 -0
  108. package/lib/esm/shell/login/GitHubSignInButton.js.map +1 -0
  109. package/lib/esm/shell/login/GoogleSignInButton.js +25 -0
  110. package/lib/esm/shell/login/GoogleSignInButton.js.map +1 -0
  111. package/lib/esm/shell/login/InviteAcceptModal.js +45 -0
  112. package/lib/esm/shell/login/InviteAcceptModal.js.map +1 -0
  113. package/lib/esm/shell/login/MicrosoftSigninButton.js +19 -0
  114. package/lib/esm/shell/login/MicrosoftSigninButton.js.map +1 -0
  115. package/lib/esm/shell/login/PreviewIcon.js +23 -0
  116. package/lib/esm/shell/login/PreviewIcon.js.map +1 -0
  117. package/lib/esm/shell/login/SignInModal.js +9 -0
  118. package/lib/esm/shell/login/SignInModal.js.map +1 -0
  119. package/lib/esm/shell/login/SigninScreen.js +64 -0
  120. package/lib/esm/shell/login/SigninScreen.js.map +1 -0
  121. package/lib/esm/shell/login/SignupForm.js +91 -0
  122. package/lib/esm/shell/login/SignupForm.js.map +1 -0
  123. package/lib/esm/shell/login/TerminalLogin.js +179 -0
  124. package/lib/esm/shell/login/TerminalLogin.js.map +1 -0
  125. package/lib/esm/shell/login/UserInfo.js +40 -0
  126. package/lib/esm/shell/login/UserInfo.js.map +1 -0
  127. package/lib/esm/shell/login/UserSessionMenu.js +31 -0
  128. package/lib/esm/shell/login/UserSessionMenu.js.map +1 -0
  129. package/lib/esm/shell/utils.js +6 -0
  130. package/lib/esm/shell/utils.js.map +1 -0
  131. package/lib/esm/widgets/SvgIcon.js +36 -0
  132. package/lib/esm/widgets/SvgIcon.js.map +1 -0
  133. package/lib/esm/widgets/index.js +7 -6
  134. package/lib/esm/widgets/index.js.map +1 -1
  135. package/lib/esm/widgets/upload/UploadSummary.js +1 -1
  136. package/lib/esm/widgets/upload/UploadSummary.js.map +1 -1
  137. package/lib/tsconfig.tsbuildinfo +1 -1
  138. package/lib/types/core/components/FormItem.d.ts +2 -1
  139. package/lib/types/core/components/shadcn/dialog.d.ts +2 -1
  140. package/lib/types/core/components/shadcn/filters/DynamicLabel.d.ts +1 -1
  141. package/lib/types/core/components/shadcn/filters/comboBox/DateCombobox.d.ts +5 -0
  142. package/lib/types/core/components/shadcn/filters/comboBox/SelectCombobox.d.ts +8 -0
  143. package/lib/types/core/components/shadcn/filters/comboBox/StringListCombobox.d.ts +5 -0
  144. package/lib/types/core/components/shadcn/filters/comboBox/TextCombobox.d.ts +5 -0
  145. package/lib/types/core/components/shadcn/filters/comboBox/comboBox.d.ts +4 -0
  146. package/lib/types/core/components/shadcn/filters/{selectFilter.d.ts → filter/SelectFilter.d.ts} +2 -2
  147. package/lib/types/core/components/shadcn/filters/{stringListFilter.d.ts → filter/StringListFilter.d.ts} +1 -1
  148. package/lib/types/core/components/shadcn/filters/{textFilter.d.ts → filter/TextFilter.d.ts} +1 -1
  149. package/lib/types/core/components/shadcn/filters/{dateFilter.d.ts → filter/dateFilter.d.ts} +1 -1
  150. package/lib/types/core/components/shadcn/filters/filter-styles.d.ts +1 -0
  151. package/lib/types/core/components/shadcn/filters/filterBar.d.ts +14 -4
  152. package/lib/types/core/components/shadcn/filters/index.d.ts +1 -1
  153. package/lib/types/core/components/shadcn/filters/types.d.ts +2 -0
  154. package/lib/types/features/agent/PayloadBuilder.d.ts +17 -8
  155. package/lib/types/features/agent/chat/ModernAgentOutput/utils.d.ts +2 -1
  156. package/lib/types/features/facets/DocumentsFacetsNav.d.ts +16 -0
  157. package/lib/types/features/facets/RunsFacetsNav.d.ts +18 -0
  158. package/lib/types/features/facets/VFacetsNav.d.ts +1 -1
  159. package/lib/types/features/facets/VStringFacet.d.ts +6 -2
  160. package/lib/types/features/facets/VTypeFacet.d.ts +3 -1
  161. package/lib/types/features/facets/WorkflowExecutionsFacetsNav.d.ts +13 -0
  162. package/lib/types/features/facets/index.d.ts +3 -2
  163. package/lib/types/shell/SplashScreen.d.ts +4 -0
  164. package/lib/types/shell/VertesiaShell.d.ts +7 -0
  165. package/lib/types/shell/index.d.ts +6 -0
  166. package/lib/types/shell/login/EnterpriseSigninButton.d.ts +5 -0
  167. package/lib/types/shell/login/GitHubSignInButton.d.ts +5 -0
  168. package/lib/types/shell/login/GoogleSignInButton.d.ts +5 -0
  169. package/lib/types/shell/login/InviteAcceptModal.d.ts +1 -0
  170. package/lib/types/shell/login/MicrosoftSigninButton.d.ts +5 -0
  171. package/lib/types/shell/login/PreviewIcon.d.ts +5 -0
  172. package/lib/types/shell/login/SignInModal.d.ts +6 -0
  173. package/lib/types/shell/login/SigninScreen.d.ts +8 -0
  174. package/lib/types/shell/login/SignupForm.d.ts +7 -0
  175. package/lib/types/shell/login/TerminalLogin.d.ts +1 -0
  176. package/lib/types/shell/login/UserInfo.d.ts +5 -0
  177. package/lib/types/shell/login/UserSessionMenu.d.ts +8 -0
  178. package/lib/types/shell/utils.d.ts +1 -0
  179. package/lib/types/widgets/SvgIcon.d.ts +6 -0
  180. package/lib/types/widgets/index.d.ts +7 -6
  181. package/lib/vertesia-ui-core.js +1 -1
  182. package/lib/vertesia-ui-core.js.map +1 -1
  183. package/lib/vertesia-ui-features.js +1 -1
  184. package/lib/vertesia-ui-features.js.map +1 -1
  185. package/lib/vertesia-ui-router.js +1 -1
  186. package/lib/vertesia-ui-router.js.map +1 -1
  187. package/lib/vertesia-ui-shell.js +2 -0
  188. package/lib/vertesia-ui-shell.js.map +1 -0
  189. package/lib/vertesia-ui-widgets.js +1 -1
  190. package/lib/vertesia-ui-widgets.js.map +1 -1
  191. package/package.json +14 -6
  192. package/src/core/components/Badge.tsx +12 -8
  193. package/src/core/components/FormItem.tsx +4 -3
  194. package/src/core/components/InputList.tsx +21 -17
  195. package/src/core/components/shadcn/checkbox.tsx +2 -2
  196. package/src/core/components/shadcn/command.tsx +1 -1
  197. package/src/core/components/shadcn/dialog.tsx +18 -9
  198. package/src/core/components/shadcn/filters/DynamicLabel.tsx +1 -2
  199. package/src/core/components/shadcn/filters/comboBox/DateCombobox.tsx +211 -0
  200. package/src/core/components/shadcn/filters/{comboBox.tsx → comboBox/SelectCombobox.tsx} +8 -192
  201. package/src/core/components/shadcn/filters/comboBox/StringListCombobox.tsx +76 -0
  202. package/src/core/components/shadcn/filters/comboBox/TextCombobox.tsx +81 -0
  203. package/src/core/components/shadcn/filters/comboBox/comboBox.tsx +4 -0
  204. package/src/core/components/shadcn/filters/filter/SelectFilter.tsx +161 -0
  205. package/src/core/components/shadcn/filters/{stringListFilter.tsx → filter/StringListFilter.tsx} +7 -7
  206. package/src/core/components/shadcn/filters/{textFilter.tsx → filter/TextFilter.tsx} +17 -11
  207. package/src/core/components/shadcn/filters/filter/dateFilter.tsx +256 -0
  208. package/src/core/components/shadcn/filters/filter-styles.ts +87 -0
  209. package/src/core/components/shadcn/filters/filterBar.tsx +208 -152
  210. package/src/core/components/shadcn/filters/filters.tsx +7 -5
  211. package/src/core/components/shadcn/filters/index.ts +1 -1
  212. package/src/core/components/shadcn/filters/types.ts +2 -0
  213. package/src/core/components/toast/NotificationPanel.tsx +38 -22
  214. package/src/features/agent/PayloadBuilder.tsx +56 -31
  215. package/src/features/agent/chat/ModernAgentConversation.tsx +10 -4
  216. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +7 -6
  217. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +12 -1
  218. package/src/features/agent/chat/ModernAgentOutput/SlidingMessages.tsx +2 -1
  219. package/src/features/agent/chat/ModernAgentOutput/utils.ts +12 -4
  220. package/src/features/facets/DocumentsFacetsNav.tsx +171 -0
  221. package/src/features/facets/RunsFacetsNav.tsx +166 -0
  222. package/src/features/facets/VFacetsNav.tsx +10 -126
  223. package/src/features/facets/VStringFacet.tsx +10 -4
  224. package/src/features/facets/VTypeFacet.tsx +6 -5
  225. package/src/features/facets/VUserFacet.tsx +5 -3
  226. package/src/features/facets/WorkflowExecutionsFacetsNav.tsx +132 -0
  227. package/src/features/facets/index.ts +5 -2
  228. package/src/features/store/collections/CollectionsTable.tsx +3 -2
  229. package/src/features/store/collections/CreateCollection.tsx +17 -15
  230. package/src/features/store/collections/EditCollectionView.tsx +19 -16
  231. package/src/features/store/collections/SelectCollection.tsx +1 -1
  232. package/src/features/store/objects/DocumentPreviewPanel.tsx +0 -1
  233. package/src/features/store/objects/DocumentSearchResults.tsx +80 -11
  234. package/src/features/store/objects/components/ContentOverview.tsx +0 -2
  235. package/src/features/store/objects/components/SelectDocument.tsx +2 -2
  236. package/src/features/store/objects/components/VectorSearchWidget.tsx +2 -2
  237. package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +40 -19
  238. package/src/features/store/objects/upload/DocumentUploadModal.tsx +160 -214
  239. package/src/features/store/types/ObjectSchemaEditor.tsx +15 -0
  240. package/src/features/user/UserInfo.tsx +17 -14
  241. package/src/router/HistoryNavigator.ts +2 -2
  242. package/src/shell/SplashScreen.tsx +41 -0
  243. package/src/shell/VertesiaShell.tsx +27 -0
  244. package/src/shell/index.tsx +6 -0
  245. package/src/shell/login/EnterpriseSigninButton.tsx +106 -0
  246. package/src/shell/login/GitHubSignInButton.tsx +40 -0
  247. package/src/shell/login/GoogleSignInButton.tsx +36 -0
  248. package/src/shell/login/InviteAcceptModal.tsx +78 -0
  249. package/src/shell/login/MicrosoftSigninButton.tsx +30 -0
  250. package/src/shell/login/PreviewIcon.tsx +29 -0
  251. package/src/shell/login/SignInModal.tsx +28 -0
  252. package/src/shell/login/SigninScreen.tsx +162 -0
  253. package/src/shell/login/SignupForm.tsx +178 -0
  254. package/src/shell/login/TerminalLogin.tsx +299 -0
  255. package/src/shell/login/UserInfo.tsx +76 -0
  256. package/src/shell/login/UserSessionMenu.tsx +81 -0
  257. package/src/shell/utils.tsx +7 -0
  258. package/src/widgets/SvgIcon.tsx +44 -0
  259. package/src/widgets/index.ts +7 -6
  260. package/src/widgets/upload/UploadSummary.tsx +3 -4
  261. package/lib/esm/core/components/shadcn/filters/comboBox.js +0 -101
  262. package/lib/esm/core/components/shadcn/filters/comboBox.js.map +0 -1
  263. package/lib/esm/core/components/shadcn/filters/dateFilter.js +0 -36
  264. package/lib/esm/core/components/shadcn/filters/dateFilter.js.map +0 -1
  265. package/lib/esm/core/components/shadcn/filters/selectFilter.js +0 -67
  266. package/lib/esm/core/components/shadcn/filters/selectFilter.js.map +0 -1
  267. package/lib/esm/core/components/shadcn/filters/stringListFilter.js.map +0 -1
  268. package/lib/esm/core/components/shadcn/filters/textFilter.js.map +0 -1
  269. package/lib/esm/features/facets/InteractionFacet.js +0 -39
  270. package/lib/esm/features/facets/InteractionFacet.js.map +0 -1
  271. package/lib/esm/features/facets/TypeOptions.js +0 -19
  272. package/lib/esm/features/facets/TypeOptions.js.map +0 -1
  273. package/lib/esm/features/facets/UserFacet.js +0 -33
  274. package/lib/esm/features/facets/UserFacet.js.map +0 -1
  275. package/lib/types/core/components/shadcn/filters/comboBox.d.ts +0 -22
  276. package/lib/types/features/facets/InteractionFacet.d.ts +0 -9
  277. package/lib/types/features/facets/TypeOptions.d.ts +0 -3
  278. package/lib/types/features/facets/UserFacet.d.ts +0 -11
  279. package/src/core/components/shadcn/filters/dateFilter.tsx +0 -82
  280. package/src/core/components/shadcn/filters/selectFilter.tsx +0 -110
  281. package/src/features/facets/InteractionFacet.tsx +0 -53
  282. package/src/features/facets/TypeOptions.tsx +0 -22
  283. package/src/features/facets/UserFacet.tsx +0 -61
@@ -0,0 +1,256 @@
1
+ import dayjs from "dayjs";
2
+ import React, { useState } from "react";
3
+ import Calendar from "react-calendar";
4
+ import { Button } from "../../button";
5
+ import { Filter, FilterGroup } from "../types";
6
+ import { calendarStyles } from "../filter-styles";
7
+
8
+ type ValuePiece = Date | null;
9
+ type Value = ValuePiece | [ValuePiece, ValuePiece];
10
+
11
+ interface DateFilterProps {
12
+ selectedView: string | null;
13
+ selectedDate: Date | undefined;
14
+ setSelectedDate: React.Dispatch<React.SetStateAction<Date | undefined>>;
15
+ setFilters: React.Dispatch<React.SetStateAction<Filter[]>>;
16
+ filters: Filter[];
17
+ handleClose: () => void;
18
+ filterGroups: FilterGroup[];
19
+ }
20
+
21
+ export default function DateFilter({
22
+ selectedView,
23
+ selectedDate,
24
+ setSelectedDate,
25
+ setFilters,
26
+ filters,
27
+ handleClose,
28
+ filterGroups,
29
+ }: DateFilterProps) {
30
+ const [dateRange, setDateRange] = useState<[Date | null, Date | null]>([null, null]);
31
+ const [localDateRange, setLocalDateRange] = useState<[Date | null, Date | null]>([null, null]);
32
+
33
+ const selectedGroup = filterGroups.find(g => g.name === selectedView);
34
+ const isDateRange = selectedGroup?.multiple;
35
+
36
+ // Create maxDate set to end of today to ensure today is selectable
37
+ const maxDate = new Date();
38
+ maxDate.setHours(23, 59, 59, 999);
39
+
40
+ // Use local state for immediate feedback, fall back to dateRange
41
+ const effectiveDateRange: [Date | null, Date | null] = [
42
+ localDateRange[0] || dateRange[0],
43
+ localDateRange[1] || dateRange[1]
44
+ ];
45
+
46
+ const handleDateChange = (value: Value) => {
47
+ if (isDateRange) {
48
+ // Handle date range selection
49
+ if (Array.isArray(value)) {
50
+ // Update local state immediately for visual feedback
51
+ setLocalDateRange([value[0], value[1]]);
52
+ // Also update the main dateRange state
53
+ setDateRange([value[0], value[1]]);
54
+ } else {
55
+ // Single date in range mode
56
+ setLocalDateRange([value, null]);
57
+ setDateRange([value, null]);
58
+ }
59
+ } else {
60
+ // Handle single date selection
61
+ const date = Array.isArray(value) ? value[0] : value;
62
+ setSelectedDate(date || undefined);
63
+ if (date) {
64
+ // Set date to start of day (00:00)
65
+ const selectedDateStart = new Date(date);
66
+ selectedDateStart.setHours(0, 0, 0, 0);
67
+
68
+ setFilters([
69
+ ...filters,
70
+ {
71
+ name: selectedView || "",
72
+ placeholder: selectedGroup?.placeholder,
73
+ value: [
74
+ {
75
+ value: selectedDateStart.toISOString(),
76
+ label: dayjs(selectedDateStart).format("LLL dd, y"),
77
+ }
78
+ ],
79
+ type: selectedGroup?.type || "date",
80
+ multiple: selectedGroup?.multiple || false,
81
+ } as Filter,
82
+ ]);
83
+
84
+ handleClose();
85
+ }
86
+ }
87
+ };
88
+
89
+ const handleApplyDateRange = () => {
90
+ if (dateRange[0]) {
91
+ const startDate = new Date(dateRange[0]);
92
+ const endDate = dateRange[1] ? new Date(dateRange[1]) : new Date(dateRange[0]);
93
+
94
+ // Set start date to beginning of day
95
+ startDate.setHours(0, 0, 0, 0);
96
+ // Set end date to end of day
97
+ endDate.setHours(23, 59, 59, 999);
98
+
99
+ const filterValue = [];
100
+ filterValue.push({
101
+ value: startDate.toISOString(),
102
+ label: dayjs(startDate).format("LLL dd, y"),
103
+ });
104
+
105
+ if (dateRange[1] && dateRange[0].getTime() !== dateRange[1].getTime()) {
106
+ filterValue.push({
107
+ value: endDate.toISOString(),
108
+ label: dayjs(endDate).format("LLL dd, y"),
109
+ });
110
+ }
111
+
112
+ setFilters([
113
+ ...filters,
114
+ {
115
+ name: selectedView || "",
116
+ placeholder: selectedGroup?.placeholder,
117
+ value: filterValue,
118
+ type: selectedGroup?.type || "date",
119
+ multiple: selectedGroup?.multiple || false,
120
+ } as Filter,
121
+ ]);
122
+
123
+ handleClose();
124
+ }
125
+ };
126
+
127
+ const getDisplayText = () => {
128
+ if (isDateRange) {
129
+ if (effectiveDateRange[0] && effectiveDateRange[1]) {
130
+ return (
131
+ <span className="flex items-center gap-2">
132
+ <span className="text-xs text-muted">From:</span>
133
+ <span className="text-xs font-medium">{dayjs(effectiveDateRange[0]).format("MMMM DD, YYYY")}</span>
134
+ <span className="text-xs text-muted">To:</span>
135
+ <span className="text-xs font-medium">{dayjs(effectiveDateRange[1]).format("MMMM DD, YYYY")}</span>
136
+ </span>
137
+ );
138
+ } else if (effectiveDateRange[0]) {
139
+ return (
140
+ <span className="flex items-center gap-2">
141
+ <span className="text-xs text-muted">From:</span>
142
+ <span className="text-xs font-medium">{dayjs(effectiveDateRange[0]).format("MMMM DD, YYYY")}</span>
143
+ <span className="text-xs text-muted">→ Select end date</span>
144
+ </span>
145
+ );
146
+ } else {
147
+ return <span className="text-muted text-xs">{selectedGroup?.placeholder || selectedGroup?.name || selectedView || "Select date range"}</span>;
148
+ }
149
+ } else {
150
+ return selectedDate ? dayjs(selectedDate).format("MMMM DD, YYYY") : "Pick a date";
151
+ }
152
+ };
153
+
154
+ return (
155
+ <div className="p-2">
156
+ {isDateRange ? (
157
+ <>
158
+ <div>
159
+ {getDisplayText()}
160
+ </div>
161
+ <div className="calendar-wrapper">
162
+ <style>{calendarStyles}</style>
163
+ <Calendar
164
+ key={`${effectiveDateRange[0]?.getTime()}-${effectiveDateRange[1]?.getTime()}`}
165
+ value={effectiveDateRange}
166
+ onChange={handleDateChange}
167
+ selectRange={true}
168
+ returnValue="range"
169
+ maxDate={maxDate}
170
+ className="mb-2 border-0"
171
+ tileClassName={({ date, view }) => {
172
+ if (view === 'month') {
173
+ const currentDate = date.getTime();
174
+ const today = new Date();
175
+ today.setHours(23, 59, 59, 999);
176
+
177
+ // Check if date is disabled (future date)
178
+ if (currentDate > today.getTime()) {
179
+ return 'text-muted/20 cursor-not-allowed';
180
+ }
181
+
182
+ // Handle selected date styling
183
+ if (effectiveDateRange[0]) {
184
+ const startDate = effectiveDateRange[0].getTime();
185
+
186
+ if (effectiveDateRange[1]) {
187
+ // Both dates selected
188
+ const endDate = effectiveDateRange[1].getTime();
189
+
190
+ if (currentDate === startDate) {
191
+ return 'bg-primary text-primary-foreground rounded-l-md font-semibold';
192
+ }
193
+ if (currentDate === endDate) {
194
+ return 'bg-primary text-primary-foreground rounded-r-md font-semibold';
195
+ }
196
+ if (currentDate > startDate && currentDate < endDate) {
197
+ return 'bg-primary/20 text-primary font-medium';
198
+ }
199
+ } else {
200
+ // Only start date selected
201
+ if (currentDate === startDate) {
202
+ return 'bg-primary text-primary-foreground rounded-md font-semibold';
203
+ }
204
+ }
205
+ }
206
+ }
207
+ return '';
208
+ }}
209
+ />
210
+ </div>
211
+ <div className="border-t pt-2">
212
+ <div className="flex gap-2 justify-end">
213
+ <Button variant="ghost" size="sm" onClick={handleClose}>
214
+ Cancel
215
+ </Button>
216
+ <Button size="sm" onClick={handleApplyDateRange} disabled={!effectiveDateRange[0]}>
217
+ Apply
218
+ </Button>
219
+ </div>
220
+ </div>
221
+ </>
222
+ ) : (
223
+ <>
224
+ <div className="calendar-wrapper">
225
+ <style>{calendarStyles}</style>
226
+ <Calendar
227
+ value={selectedDate}
228
+ onChange={handleDateChange}
229
+ selectRange={false}
230
+ maxDate={maxDate}
231
+ className="mb-2 border-0"
232
+ tileClassName={({ date, view }) => {
233
+ if (view === 'month') {
234
+ const currentDate = date.getTime();
235
+ const today = new Date();
236
+ today.setHours(23, 59, 59, 999);
237
+
238
+ // Check if date is disabled (future date)
239
+ if (currentDate > today.getTime()) {
240
+ return 'text-muted/20 cursor-not-allowed';
241
+ }
242
+
243
+ // Handle selected date styling
244
+ if (selectedDate && currentDate === selectedDate.getTime()) {
245
+ return 'bg-primary text-primary-foreground rounded-md font-semibold';
246
+ }
247
+ }
248
+ return '';
249
+ }}
250
+ />
251
+ </div>
252
+ </>
253
+ )}
254
+ </div>
255
+ );
256
+ }
@@ -0,0 +1,87 @@
1
+ export const calendarStyles = `
2
+ .calendar-wrapper .react-calendar__navigation {
3
+ display: flex !important;
4
+ justify-content: space-between !important;
5
+ align-items: center !important;
6
+ gap: 8px !important;
7
+ padding: 8px !important;
8
+ }
9
+
10
+ .calendar-wrapper .react-calendar__navigation__label {
11
+ flex: 1 !important;
12
+ text-align: center !important;
13
+ font-weight: 500 !important;
14
+ }
15
+
16
+ .calendar-wrapper .react-calendar__navigation__arrow {
17
+ display: flex !important;
18
+ align-items: center !important;
19
+ justify-content: center !important;
20
+ min-width: 32px !important;
21
+ height: 32px !important;
22
+ border-radius: 4px !important;
23
+ border: 1px solid hsl(var(--border)) !important;
24
+ background: hsl(var(--background)) !important;
25
+ color: hsl(var(--foreground)) !important;
26
+ }
27
+
28
+ .calendar-wrapper .react-calendar__navigation__arrow:hover {
29
+ background: oklch(var(--muted)) !important;
30
+ }
31
+
32
+ .calendar-wrapper .react-calendar__tile {
33
+ cursor: pointer !important;
34
+ width: 0.5rem !important;
35
+ font-size: 0.875rem !important;
36
+ }
37
+
38
+ .calendar-wrapper .react-calendar__tile:hover,
39
+ .calendar-wrapper .react-calendar__month-view__days__day:hover,
40
+ .calendar-wrapper .react-calendar__decade-view__years__year:hover,
41
+ .calendar-wrapper .react-calendar__year-view__months__month:hover {
42
+ background: #b5b5b580 !important;
43
+ }
44
+
45
+ .calendar-wrapper .react-calendar__tile:not(.react-calendar__tile--active):hover {
46
+ background: #b5b5b580 !important;
47
+ }
48
+
49
+ .calendar-wrapper .react-calendar__tile--hover {
50
+ background: #b5b5b580 !important;
51
+ }
52
+
53
+ .calendar-wrapper .react-calendar__tile--disabled,
54
+ .calendar-wrapper .react-calendar__tile:disabled,
55
+ .calendar-wrapper .react-calendar__month-view__days__day--disabled,
56
+ .calendar-wrapper .react-calendar__month-view__days__day:disabled,
57
+ .calendar-wrapper .react-calendar__year-view__months__month--disabled,
58
+ .calendar-wrapper .react-calendar__year-view__months__month:disabled,
59
+ .calendar-wrapper .react-calendar__decade-view__years__year--disabled,
60
+ .calendar-wrapper .react-calendar__decade-view__years__year:disabled {
61
+ cursor: not-allowed !important;
62
+ color: #9ca3af !important;
63
+ }
64
+
65
+ .calendar-wrapper .react-calendar__tile--disabled:hover,
66
+ .calendar-wrapper .react-calendar__tile:disabled:hover,
67
+ .calendar-wrapper .react-calendar__month-view__days__day--disabled:hover,
68
+ .calendar-wrapper .react-calendar__month-view__days__day:disabled:hover,
69
+ .calendar-wrapper .react-calendar__year-view__months__month--disabled:hover,
70
+ .calendar-wrapper .react-calendar__year-view__months__month:disabled:hover,
71
+ .calendar-wrapper .react-calendar__decade-view__years__year--disabled:hover,
72
+ .calendar-wrapper .react-calendar__decade-view__years__year:disabled:hover {
73
+ background: transparent !important;
74
+ }
75
+
76
+
77
+ .calendar-wrapper .react-calendar__month-view__weekdays {
78
+ font-size: 0.75rem !important;
79
+ }
80
+
81
+ .calendar-wrapper .react-calendar__month-view__weekdays__weekday {
82
+ width: 0.75rem !important;
83
+ font-size: 0.75rem !important;
84
+ text-align: center !important;
85
+ }
86
+
87
+ `;