@perses-dev/components 0.49.0 → 0.50.0-rc.1

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 (357) hide show
  1. package/dist/AlignSelector/AlignSelector.d.ts +2 -1
  2. package/dist/AlignSelector/AlignSelector.d.ts.map +1 -1
  3. package/dist/AlignSelector/AlignSelector.js +0 -3
  4. package/dist/AlignSelector/AlignSelector.js.map +1 -1
  5. package/dist/BarChart/BarChart.d.ts +2 -1
  6. package/dist/BarChart/BarChart.d.ts.map +1 -1
  7. package/dist/BarChart/BarChart.js +10 -5
  8. package/dist/BarChart/BarChart.js.map +1 -1
  9. package/dist/ColorPicker/ColorPicker.d.ts +2 -1
  10. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  11. package/dist/ColorPicker/ColorPicker.js +3 -3
  12. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  13. package/dist/ColorPicker/OptionsColorPicker.d.ts +2 -1
  14. package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -1
  15. package/dist/ColorPicker/OptionsColorPicker.js +2 -2
  16. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
  17. package/dist/ContentWithLegend/ContentWithLegend.d.ts +2 -1
  18. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  19. package/dist/ContentWithLegend/ContentWithLegend.js +8 -5
  20. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  21. package/dist/DensitySelector/DensitySelector.d.ts +2 -1
  22. package/dist/DensitySelector/DensitySelector.d.ts.map +1 -1
  23. package/dist/DensitySelector/DensitySelector.js.map +1 -1
  24. package/dist/Dialog/Dialog.d.ts +8 -8
  25. package/dist/Dialog/Dialog.d.ts.map +1 -1
  26. package/dist/Dialog/Dialog.js +0 -1
  27. package/dist/Dialog/Dialog.js.map +1 -1
  28. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +2 -1
  29. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  30. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  31. package/dist/DragAndDrop/DragAndDropList.d.ts +24 -0
  32. package/dist/DragAndDrop/DragAndDropList.d.ts.map +1 -0
  33. package/dist/DragAndDrop/DragAndDropList.js +153 -0
  34. package/dist/DragAndDrop/DragAndDropList.js.map +1 -0
  35. package/dist/DragAndDrop/DragButton.d.ts +13 -0
  36. package/dist/DragAndDrop/DragButton.d.ts.map +1 -0
  37. package/dist/DragAndDrop/DragButton.js +97 -0
  38. package/dist/DragAndDrop/DragButton.js.map +1 -0
  39. package/dist/DragAndDrop/DropIndicator.d.ts +3 -0
  40. package/dist/DragAndDrop/DropIndicator.d.ts.map +1 -0
  41. package/dist/DragAndDrop/DropIndicator.js +44 -0
  42. package/dist/DragAndDrop/DropIndicator.js.map +1 -0
  43. package/dist/DragAndDrop/index.d.ts +4 -0
  44. package/dist/DragAndDrop/index.d.ts.map +1 -0
  45. package/dist/DragAndDrop/index.js +17 -0
  46. package/dist/DragAndDrop/index.js.map +1 -0
  47. package/dist/DragAndDrop/model.d.ts +11 -0
  48. package/dist/DragAndDrop/model.d.ts.map +1 -0
  49. package/dist/DragAndDrop/model.js +17 -0
  50. package/dist/DragAndDrop/model.js.map +1 -0
  51. package/dist/Drawer/Drawer.d.ts +2 -1
  52. package/dist/Drawer/Drawer.d.ts.map +1 -1
  53. package/dist/Drawer/Drawer.js.map +1 -1
  54. package/dist/EChart/EChart.d.ts +2 -2
  55. package/dist/EChart/EChart.d.ts.map +1 -1
  56. package/dist/EChart/EChart.js +2 -2
  57. package/dist/EChart/EChart.js.map +1 -1
  58. package/dist/ErrorAlert.d.ts +2 -1
  59. package/dist/ErrorAlert.d.ts.map +1 -1
  60. package/dist/ErrorAlert.js.map +1 -1
  61. package/dist/FontSizeSelector/FontSizeSelector.d.ts +2 -1
  62. package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
  63. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  64. package/dist/FormEditor/FormActions.d.ts +16 -0
  65. package/dist/FormEditor/FormActions.d.ts.map +1 -0
  66. package/dist/FormEditor/FormActions.js +75 -0
  67. package/dist/FormEditor/FormActions.js.map +1 -0
  68. package/dist/FormEditor/index.d.ts +2 -0
  69. package/dist/FormEditor/index.d.ts.map +1 -0
  70. package/dist/FormEditor/index.js +15 -0
  71. package/dist/FormEditor/index.js.map +1 -0
  72. package/dist/FormatControls/FormatControls.d.ts +2 -1
  73. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  74. package/dist/FormatControls/FormatControls.js +2 -2
  75. package/dist/FormatControls/FormatControls.js.map +1 -1
  76. package/dist/GaugeChart/GaugeChart.d.ts +2 -1
  77. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  78. package/dist/GaugeChart/GaugeChart.js +1 -1
  79. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  80. package/dist/InfoTooltip/InfoTooltip.d.ts +3 -3
  81. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  82. package/dist/InfoTooltip/InfoTooltip.js +0 -1
  83. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  84. package/dist/JSONEditor.d.ts +2 -1
  85. package/dist/JSONEditor.d.ts.map +1 -1
  86. package/dist/JSONEditor.js.map +1 -1
  87. package/dist/Legend/CompactLegend.d.ts +2 -1
  88. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  89. package/dist/Legend/CompactLegend.js.map +1 -1
  90. package/dist/Legend/Legend.d.ts +2 -1
  91. package/dist/Legend/Legend.d.ts.map +1 -1
  92. package/dist/Legend/Legend.js +8 -4
  93. package/dist/Legend/Legend.js.map +1 -1
  94. package/dist/Legend/LegendColorBadge.d.ts +2 -2
  95. package/dist/Legend/LegendColorBadge.d.ts.map +1 -1
  96. package/dist/Legend/LegendColorBadge.js +2 -2
  97. package/dist/Legend/LegendColorBadge.js.map +1 -1
  98. package/dist/Legend/ListLegend.d.ts +2 -1
  99. package/dist/Legend/ListLegend.d.ts.map +1 -1
  100. package/dist/Legend/ListLegend.js.map +1 -1
  101. package/dist/Legend/ListLegendItem.d.ts +5 -5
  102. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  103. package/dist/Legend/ListLegendItem.js +5 -8
  104. package/dist/Legend/ListLegendItem.js.map +1 -1
  105. package/dist/Legend/TableLegend.d.ts +2 -1
  106. package/dist/Legend/TableLegend.d.ts.map +1 -1
  107. package/dist/Legend/TableLegend.js +1 -0
  108. package/dist/Legend/TableLegend.js.map +1 -1
  109. package/dist/Legend/legend-model.d.ts.map +1 -1
  110. package/dist/Legend/legend-model.js.map +1 -1
  111. package/dist/LineChart/LineChart.d.ts +1 -1
  112. package/dist/LineChart/LineChart.d.ts.map +1 -1
  113. package/dist/LineChart/LineChart.js +2 -3
  114. package/dist/LineChart/LineChart.js.map +1 -1
  115. package/dist/LinksEditor/LinksEditor.d.ts +2 -2
  116. package/dist/LinksEditor/LinksEditor.d.ts.map +1 -1
  117. package/dist/LinksEditor/LinksEditor.js +1 -1
  118. package/dist/LinksEditor/LinksEditor.js.map +1 -1
  119. package/dist/ModeSelector/ModeSelector.d.ts +2 -1
  120. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
  121. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  122. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +2 -2
  123. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  124. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  125. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -1
  126. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  127. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  128. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +2 -2
  129. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  130. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  131. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -2
  132. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  133. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  134. package/dist/Overlay/Overlay.d.ts +4 -3
  135. package/dist/Overlay/Overlay.d.ts.map +1 -1
  136. package/dist/Overlay/Overlay.js.map +1 -1
  137. package/dist/PieChart/PieChart.d.ts +2 -1
  138. package/dist/PieChart/PieChart.d.ts.map +1 -1
  139. package/dist/PieChart/PieChart.js +4 -2
  140. package/dist/PieChart/PieChart.js.map +1 -1
  141. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +2 -1
  142. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  143. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  144. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +2 -2
  145. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
  146. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +5 -3
  147. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  148. package/dist/SortSelector/SortSelector.d.ts +2 -1
  149. package/dist/SortSelector/SortSelector.d.ts.map +1 -1
  150. package/dist/SortSelector/SortSelector.js.map +1 -1
  151. package/dist/SortSelector/SortSelectorButtons.d.ts +2 -1
  152. package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -1
  153. package/dist/SortSelector/SortSelectorButtons.js +2 -5
  154. package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
  155. package/dist/StatChart/StatChart.d.ts +2 -1
  156. package/dist/StatChart/StatChart.d.ts.map +1 -1
  157. package/dist/StatChart/StatChart.js.map +1 -1
  158. package/dist/StatChart/calculateFontSize.d.ts.map +1 -1
  159. package/dist/StatChart/calculateFontSize.js.map +1 -1
  160. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +14 -0
  161. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +1 -0
  162. package/dist/StatusHistoryChart/StatusHistoryChart.js +149 -0
  163. package/dist/StatusHistoryChart/StatusHistoryChart.js.map +1 -0
  164. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +12 -0
  165. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +1 -0
  166. package/dist/StatusHistoryChart/StatusHistoryTooltip.js +47 -0
  167. package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +1 -0
  168. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +2 -0
  169. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +1 -0
  170. package/dist/StatusHistoryChart/get-formatted-axis-label.js +41 -0
  171. package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +1 -0
  172. package/dist/StatusHistoryChart/index.d.ts +3 -0
  173. package/dist/StatusHistoryChart/index.d.ts.map +1 -0
  174. package/dist/StatusHistoryChart/index.js +16 -0
  175. package/dist/StatusHistoryChart/index.js.map +1 -0
  176. package/dist/StatusHistoryChart/utils/get-color.d.ts +6 -0
  177. package/dist/StatusHistoryChart/utils/get-color.d.ts.map +1 -0
  178. package/dist/StatusHistoryChart/utils/get-color.js +100 -0
  179. package/dist/StatusHistoryChart/utils/get-color.js.map +1 -0
  180. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +3 -0
  181. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +1 -0
  182. package/dist/StatusHistoryChart/utils/get-tooltip-position.js +27 -0
  183. package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +1 -0
  184. package/dist/Table/Table.d.ts +2 -1
  185. package/dist/Table/Table.d.ts.map +1 -1
  186. package/dist/Table/Table.js +3 -2
  187. package/dist/Table/Table.js.map +1 -1
  188. package/dist/Table/TableCell.d.ts +2 -2
  189. package/dist/Table/TableCell.d.ts.map +1 -1
  190. package/dist/Table/TableCell.js +19 -2
  191. package/dist/Table/TableCell.js.map +1 -1
  192. package/dist/Table/TableCheckbox.d.ts +2 -1
  193. package/dist/Table/TableCheckbox.d.ts.map +1 -1
  194. package/dist/Table/TableCheckbox.js.map +1 -1
  195. package/dist/Table/TableHeaderCell.d.ts +2 -1
  196. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  197. package/dist/Table/TableHeaderCell.js.map +1 -1
  198. package/dist/Table/VirtualizedTable.d.ts +3 -3
  199. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  200. package/dist/Table/VirtualizedTable.js +4 -4
  201. package/dist/Table/VirtualizedTable.js.map +1 -1
  202. package/dist/Table/hooks/useTableKeyboardNav.d.ts +2 -2
  203. package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
  204. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  205. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +10 -12
  206. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
  207. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  208. package/dist/Table/index.d.ts +1 -2
  209. package/dist/Table/index.d.ts.map +1 -1
  210. package/dist/Table/index.js +1 -1
  211. package/dist/Table/index.js.map +1 -1
  212. package/dist/Table/model/table-model.d.ts +7 -1
  213. package/dist/Table/model/table-model.d.ts.map +1 -1
  214. package/dist/Table/model/table-model.js +1 -0
  215. package/dist/Table/model/table-model.js.map +1 -1
  216. package/dist/ThresholdsEditor/ThresholdInput.d.ts +2 -2
  217. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  218. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  219. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +2 -1
  220. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  221. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  222. package/dist/TimeChart/TimeChart.js +1 -1
  223. package/dist/TimeChart/TimeChart.js.map +1 -1
  224. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +2 -1
  225. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
  226. package/dist/TimeRangeSelector/DateTimeRangePicker.js +0 -2
  227. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  228. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +2 -1
  229. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
  230. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  231. package/dist/TimeRangeSelector/utils.d.ts.map +1 -1
  232. package/dist/TimeRangeSelector/utils.js.map +1 -1
  233. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
  234. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  235. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  236. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +2 -1
  237. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  238. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  239. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +2 -1
  240. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
  241. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  242. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +2 -1
  243. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
  244. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  245. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  246. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  247. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  248. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +2 -1
  249. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  250. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  251. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  252. package/dist/TimeSeriesTooltip/TooltipHeader.js +2 -4
  253. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  254. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  255. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  256. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  257. package/dist/TimeSeriesTooltip/utils.d.ts +1 -21
  258. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  259. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  260. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  261. package/dist/TransformsEditor/TransformEditor.d.ts +2 -1
  262. package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -1
  263. package/dist/TransformsEditor/TransformEditor.js +10 -9
  264. package/dist/TransformsEditor/TransformEditor.js.map +1 -1
  265. package/dist/TransformsEditor/TransformEditorContainer.d.ts +2 -1
  266. package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
  267. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  268. package/dist/TransformsEditor/TransformsEditor.d.ts +2 -1
  269. package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -1
  270. package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
  271. package/dist/YAxisLabel.d.ts +2 -1
  272. package/dist/YAxisLabel.d.ts.map +1 -1
  273. package/dist/YAxisLabel.js +4 -2
  274. package/dist/YAxisLabel.js.map +1 -1
  275. package/dist/cjs/AlignSelector/AlignSelector.js +0 -3
  276. package/dist/cjs/BarChart/BarChart.js +11 -6
  277. package/dist/cjs/ColorPicker/ColorPicker.js +3 -44
  278. package/dist/cjs/ColorPicker/OptionsColorPicker.js +2 -2
  279. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +8 -10
  280. package/dist/cjs/Dialog/Dialog.js +0 -1
  281. package/dist/cjs/DragAndDrop/DragAndDropList.js +159 -0
  282. package/dist/cjs/DragAndDrop/DragButton.js +121 -0
  283. package/dist/cjs/DragAndDrop/DropIndicator.js +52 -0
  284. package/dist/cjs/DragAndDrop/index.js +32 -0
  285. package/dist/cjs/DragAndDrop/model.js +25 -0
  286. package/dist/cjs/EChart/EChart.js +2 -43
  287. package/dist/cjs/FormEditor/FormActions.js +83 -0
  288. package/dist/cjs/FormEditor/index.js +30 -0
  289. package/dist/cjs/FormatControls/FormatControls.js +2 -2
  290. package/dist/cjs/GaugeChart/GaugeChart.js +2 -2
  291. package/dist/cjs/InfoTooltip/InfoTooltip.js +0 -6
  292. package/dist/cjs/Legend/Legend.js +8 -4
  293. package/dist/cjs/Legend/LegendColorBadge.js +2 -7
  294. package/dist/cjs/Legend/ListLegendItem.js +3 -46
  295. package/dist/cjs/Legend/TableLegend.js +1 -0
  296. package/dist/cjs/LineChart/LineChart.js +4 -5
  297. package/dist/cjs/LinksEditor/LinksEditor.js +1 -42
  298. package/dist/cjs/PieChart/PieChart.js +4 -2
  299. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +5 -3
  300. package/dist/cjs/SortSelector/SortSelectorButtons.js +2 -5
  301. package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +157 -0
  302. package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +55 -0
  303. package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +48 -0
  304. package/dist/cjs/StatusHistoryChart/index.js +31 -0
  305. package/dist/cjs/StatusHistoryChart/utils/get-color.js +125 -0
  306. package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +35 -0
  307. package/dist/cjs/Table/Table.js +2 -1
  308. package/dist/cjs/Table/TableCell.js +19 -2
  309. package/dist/cjs/Table/VirtualizedTable.js +4 -4
  310. package/dist/cjs/Table/index.js +1 -7
  311. package/dist/cjs/Table/model/table-model.js +4 -0
  312. package/dist/cjs/TimeChart/TimeChart.js +1 -1
  313. package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +0 -2
  314. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +2 -4
  315. package/dist/cjs/TransformsEditor/TransformEditor.js +10 -9
  316. package/dist/cjs/YAxisLabel.js +4 -2
  317. package/dist/cjs/controls/TextField.js +54 -0
  318. package/dist/cjs/controls/index.js +30 -0
  319. package/dist/cjs/index.js +4 -0
  320. package/dist/cjs/theme/theme.js +3 -4
  321. package/dist/cjs/utils/format.js +18 -0
  322. package/dist/context/ChartsProvider.d.ts +2 -2
  323. package/dist/context/ChartsProvider.d.ts.map +1 -1
  324. package/dist/context/ChartsProvider.js.map +1 -1
  325. package/dist/context/TimeZoneProvider.d.ts +4 -4
  326. package/dist/context/TimeZoneProvider.d.ts.map +1 -1
  327. package/dist/context/TimeZoneProvider.js.map +1 -1
  328. package/dist/controls/TextField.d.ts +9 -0
  329. package/dist/controls/TextField.d.ts.map +1 -0
  330. package/dist/controls/TextField.js +41 -0
  331. package/dist/controls/TextField.js.map +1 -0
  332. package/dist/controls/index.d.ts +2 -0
  333. package/dist/controls/index.d.ts.map +1 -0
  334. package/dist/controls/index.js +15 -0
  335. package/dist/controls/index.js.map +1 -0
  336. package/dist/index.d.ts +4 -0
  337. package/dist/index.d.ts.map +1 -1
  338. package/dist/index.js +4 -0
  339. package/dist/index.js.map +1 -1
  340. package/dist/test/render.d.ts +3 -3
  341. package/dist/test/render.d.ts.map +1 -1
  342. package/dist/test/render.js.map +1 -1
  343. package/dist/theme/theme.d.ts.map +1 -1
  344. package/dist/theme/theme.js +2 -3
  345. package/dist/theme/theme.js.map +1 -1
  346. package/dist/utils/axis.d.ts +1 -7
  347. package/dist/utils/axis.d.ts.map +1 -1
  348. package/dist/utils/axis.js.map +1 -1
  349. package/dist/utils/chart-actions.d.ts.map +1 -1
  350. package/dist/utils/chart-actions.js.map +1 -1
  351. package/dist/utils/component-ids.d.ts.map +1 -1
  352. package/dist/utils/component-ids.js.map +1 -1
  353. package/dist/utils/format.d.ts +10 -4
  354. package/dist/utils/format.d.ts.map +1 -1
  355. package/dist/utils/format.js +15 -0
  356. package/dist/utils/format.js.map +1 -1
  357. package/package.json +10 -8
@@ -27,6 +27,9 @@ _export(exports, {
27
27
  formatWithTimeZone: function() {
28
28
  return formatWithTimeZone;
29
29
  },
30
+ getDateAndTime: function() {
31
+ return getDateAndTime;
32
+ },
30
33
  getFormattedAxisLabel: function() {
31
34
  return getFormattedAxisLabel;
32
35
  },
@@ -108,3 +111,18 @@ function getFormattedAxisLabel(rangeMs) {
108
111
  day: '{MM}/{dd}'
109
112
  };
110
113
  }
114
+ const getDateAndTime = (timeMs)=>{
115
+ if (!timeMs) {
116
+ return {
117
+ formattedDate: '',
118
+ formattedTime: ''
119
+ };
120
+ }
121
+ const date = new Date(timeMs);
122
+ const formattedDate = (0, _datefns.format)(date, 'MMM dd, yyyy - ');
123
+ const formattedTime = (0, _datefns.format)(date, 'HH:mm:ss');
124
+ return {
125
+ formattedDate,
126
+ formattedTime
127
+ };
128
+ };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactElement } from 'react';
2
2
  import { PersesChartsTheme } from '../model';
3
3
  import { CursorCoordinates } from '../TimeSeriesTooltip';
4
4
  export interface ChartsProviderProps {
@@ -12,7 +12,7 @@ export interface SharedChartsState {
12
12
  lastTooltipPinnedCoords: CursorCoordinates | null;
13
13
  setLastTooltipPinnedCoords: (lastTooltipPinnedCoords: CursorCoordinates | null) => void;
14
14
  }
15
- export declare function ChartsProvider(props: ChartsProviderProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function ChartsProvider(props: ChartsProviderProps): ReactElement;
16
16
  export declare const ChartsThemeContext: React.Context<SharedChartsState | undefined>;
17
17
  export declare function useChartsContext(): SharedChartsState;
18
18
  export declare function useChartsTheme(): PersesChartsTheme;
@@ -1 +1 @@
1
- {"version":3,"file":"ChartsProvider.d.ts","sourceRoot":"","sources":["../../src/context/ChartsProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAuD,MAAM,OAA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E,CAAC,uBAAuB,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;CACzF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAevE;AAED,eAAO,MAAM,kBAAkB,8CAA0D,CAAC;AAE1F,wBAAgB,gBAAgB,IAAI,iBAAiB,CAMpD;AAED,wBAAgB,cAAc,IAAI,iBAAiB,CAGlD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context/ChartsProvider.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { createContext, useContext, useMemo, useState } from 'react';\nimport { PersesChartsTheme } from '../model';\nimport { CursorCoordinates } from '../TimeSeriesTooltip';\n\nexport interface ChartsProviderProps {\n chartsTheme: PersesChartsTheme;\n enablePinning?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface SharedChartsState {\n chartsTheme: PersesChartsTheme;\n enablePinning: boolean;\n lastTooltipPinnedCoords: CursorCoordinates | null;\n setLastTooltipPinnedCoords: (lastTooltipPinnedCoords: CursorCoordinates | null) => void;\n}\n\nexport function ChartsProvider(props: ChartsProviderProps) {\n const { children, chartsTheme, enablePinning = false } = props;\n\n const [lastTooltipPinnedCoords, setLastTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n\n const ctx = useMemo(() => {\n return {\n chartsTheme,\n enablePinning,\n lastTooltipPinnedCoords,\n setLastTooltipPinnedCoords,\n };\n }, [chartsTheme, enablePinning, lastTooltipPinnedCoords, setLastTooltipPinnedCoords]);\n\n return <ChartsThemeContext.Provider value={ctx}>{children}</ChartsThemeContext.Provider>;\n}\n\nexport const ChartsThemeContext = createContext<SharedChartsState | undefined>(undefined);\n\nexport function useChartsContext(): SharedChartsState {\n const ctx = useContext(ChartsThemeContext);\n if (ctx === undefined) {\n throw new Error('No ChartsThemeContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useChartsTheme(): PersesChartsTheme {\n const ctx = useChartsContext();\n return ctx.chartsTheme;\n}\n"],"names":["React","createContext","useContext","useMemo","useState","ChartsProvider","props","children","chartsTheme","enablePinning","lastTooltipPinnedCoords","setLastTooltipPinnedCoords","ctx","ChartsThemeContext","Provider","value","undefined","useChartsContext","Error","useChartsTheme"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,aAAa,EAAEC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAiB5E,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,gBAAgB,KAAK,EAAE,GAAGH;IAEzD,MAAM,CAACI,yBAAyBC,2BAA2B,GAAGP,SAAmC;IAEjG,MAAMQ,MAAMT,QAAQ;QAClB,OAAO;YACLK;YACAC;YACAC;YACAC;QACF;IACF,GAAG;QAACH;QAAaC;QAAeC;QAAyBC;KAA2B;IAEpF,qBAAO,KAACE,mBAAmBC,QAAQ;QAACC,OAAOH;kBAAML;;AACnD;AAEA,OAAO,MAAMM,mCAAqBZ,cAA6Ce,WAAW;AAE1F,OAAO,SAASC;IACd,MAAML,MAAMV,WAAWW;IACvB,IAAID,QAAQI,WAAW;QACrB,MAAM,IAAIE,MAAM;IAClB;IACA,OAAON;AACT;AAEA,OAAO,SAASO;IACd,MAAMP,MAAMK;IACZ,OAAOL,IAAIJ,WAAW;AACxB"}
1
+ {"version":3,"sources":["../../src/context/ChartsProvider.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { createContext, ReactElement, useContext, useMemo, useState } from 'react';\nimport { PersesChartsTheme } from '../model';\nimport { CursorCoordinates } from '../TimeSeriesTooltip';\n\nexport interface ChartsProviderProps {\n chartsTheme: PersesChartsTheme;\n enablePinning?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface SharedChartsState {\n chartsTheme: PersesChartsTheme;\n enablePinning: boolean;\n lastTooltipPinnedCoords: CursorCoordinates | null;\n setLastTooltipPinnedCoords: (lastTooltipPinnedCoords: CursorCoordinates | null) => void;\n}\n\nexport function ChartsProvider(props: ChartsProviderProps): ReactElement {\n const { children, chartsTheme, enablePinning = false } = props;\n\n const [lastTooltipPinnedCoords, setLastTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n\n const ctx = useMemo(() => {\n return {\n chartsTheme,\n enablePinning,\n lastTooltipPinnedCoords,\n setLastTooltipPinnedCoords,\n };\n }, [chartsTheme, enablePinning, lastTooltipPinnedCoords, setLastTooltipPinnedCoords]);\n\n return <ChartsThemeContext.Provider value={ctx}>{children}</ChartsThemeContext.Provider>;\n}\n\nexport const ChartsThemeContext = createContext<SharedChartsState | undefined>(undefined);\n\nexport function useChartsContext(): SharedChartsState {\n const ctx = useContext(ChartsThemeContext);\n if (ctx === undefined) {\n throw new Error('No ChartsThemeContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useChartsTheme(): PersesChartsTheme {\n const ctx = useChartsContext();\n return ctx.chartsTheme;\n}\n"],"names":["React","createContext","useContext","useMemo","useState","ChartsProvider","props","children","chartsTheme","enablePinning","lastTooltipPinnedCoords","setLastTooltipPinnedCoords","ctx","ChartsThemeContext","Provider","value","undefined","useChartsContext","Error","useChartsTheme"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,aAAa,EAAgBC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAiB1F,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,gBAAgB,KAAK,EAAE,GAAGH;IAEzD,MAAM,CAACI,yBAAyBC,2BAA2B,GAAGP,SAAmC;IAEjG,MAAMQ,MAAMT,QAAQ;QAClB,OAAO;YACLK;YACAC;YACAC;YACAC;QACF;IACF,GAAG;QAACH;QAAaC;QAAeC;QAAyBC;KAA2B;IAEpF,qBAAO,KAACE,mBAAmBC,QAAQ;QAACC,OAAOH;kBAAML;;AACnD;AAEA,OAAO,MAAMM,mCAAqBZ,cAA6Ce,WAAW;AAE1F,OAAO,SAASC;IACd,MAAML,MAAMV,WAAWW;IACvB,IAAID,QAAQI,WAAW;QACrB,MAAM,IAAIE,MAAM;IAClB;IACA,OAAON;AACT;AAEA,OAAO,SAASO;IACd,MAAMP,MAAMK;IACZ,OAAOL,IAAIJ,WAAW;AACxB"}
@@ -1,13 +1,13 @@
1
- import React from 'react';
1
+ import React, { ReactElement } from 'react';
2
2
  export declare const TimeZoneContext: React.Context<string | undefined>;
3
3
  export interface TimeZoneProviderProps {
4
4
  timeZone?: string;
5
5
  children?: React.ReactNode;
6
6
  }
7
- export declare function TimeZoneProvider(props: TimeZoneProviderProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function TimeZoneProvider(props: TimeZoneProviderProps): ReactElement;
8
8
  export declare function useTimeZone(): {
9
9
  timeZone: string;
10
- formatWithUserTimeZone(date: Date, formatString: string): string;
11
- dateFormatOptionsWithUserTimeZone(dateFormatOptions: Intl.DateTimeFormatOptions): Intl.DateTimeFormatOptions;
10
+ formatWithUserTimeZone: (date: Date, formatString: string) => string;
11
+ dateFormatOptionsWithUserTimeZone: (dateFormatOptions: Intl.DateTimeFormatOptions) => Intl.DateTimeFormatOptions;
12
12
  };
13
13
  //# sourceMappingURL=TimeZoneProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimeZoneProvider.d.ts","sourceRoot":"","sources":["../../src/context/TimeZoneProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAGzD,eAAO,MAAM,eAAe,mCAA+C,CAAC;AAE5E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAG5D;AAED,wBAAgB,WAAW;;iCAKM,IAAI,gBAAgB,MAAM;yDAGF,KAAK,qBAAqB;EAIlF"}
1
+ {"version":3,"file":"TimeZoneProvider.d.ts","sourceRoot":"","sources":["../../src/context/TimeZoneProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAiB,YAAY,EAAc,MAAM,OAAO,CAAC;AAGvE,eAAO,MAAM,eAAe,mCAA+C,CAAC;AAE5E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAG3E;AAED,wBAAgB,WAAW,IAAI;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IACrE,iCAAiC,EAAE,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,KAAK,IAAI,CAAC,qBAAqB,CAAC;CAClH,CAYA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context/TimeZoneProvider.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { createContext, useContext } from 'react';\nimport { formatWithTimeZone, dateFormatOptionsWithTimeZone } from '../utils';\n\nexport const TimeZoneContext = createContext<string | undefined>(undefined);\n\nexport interface TimeZoneProviderProps {\n timeZone?: string;\n children?: React.ReactNode;\n}\n\nexport function TimeZoneProvider(props: TimeZoneProviderProps) {\n const { children, timeZone } = props;\n return <TimeZoneContext.Provider value={timeZone}>{children}</TimeZoneContext.Provider>;\n}\n\nexport function useTimeZone() {\n const timeZone = useContext(TimeZoneContext);\n return {\n // fallback to \"local\" timezone if TimeZoneProvider is not present in the React tree\n timeZone: timeZone ?? 'local',\n formatWithUserTimeZone(date: Date, formatString: string) {\n return formatWithTimeZone(date, formatString, timeZone);\n },\n dateFormatOptionsWithUserTimeZone(dateFormatOptions: Intl.DateTimeFormatOptions) {\n return dateFormatOptionsWithTimeZone(dateFormatOptions, timeZone);\n },\n };\n}\n"],"names":["React","createContext","useContext","formatWithTimeZone","dateFormatOptionsWithTimeZone","TimeZoneContext","undefined","TimeZoneProvider","props","children","timeZone","Provider","value","useTimeZone","formatWithUserTimeZone","date","formatString","dateFormatOptionsWithUserTimeZone","dateFormatOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AACzD,SAASC,kBAAkB,EAAEC,6BAA6B,QAAQ,WAAW;AAE7E,OAAO,MAAMC,gCAAkBJ,cAAkCK,WAAW;AAO5E,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGF;IAC/B,qBAAO,KAACH,gBAAgBM,QAAQ;QAACC,OAAOF;kBAAWD;;AACrD;AAEA,OAAO,SAASI;IACd,MAAMH,WAAWR,WAAWG;IAC5B,OAAO;QACL,oFAAoF;QACpFK,UAAUA,qBAAAA,sBAAAA,WAAY;QACtBI,wBAAuBC,IAAU,EAAEC,YAAoB;YACrD,OAAOb,mBAAmBY,MAAMC,cAAcN;QAChD;QACAO,mCAAkCC,iBAA6C;YAC7E,OAAOd,8BAA8Bc,mBAAmBR;QAC1D;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/context/TimeZoneProvider.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { createContext, ReactElement, useContext } from 'react';\nimport { formatWithTimeZone, dateFormatOptionsWithTimeZone } from '../utils';\n\nexport const TimeZoneContext = createContext<string | undefined>(undefined);\n\nexport interface TimeZoneProviderProps {\n timeZone?: string;\n children?: React.ReactNode;\n}\n\nexport function TimeZoneProvider(props: TimeZoneProviderProps): ReactElement {\n const { children, timeZone } = props;\n return <TimeZoneContext.Provider value={timeZone}>{children}</TimeZoneContext.Provider>;\n}\n\nexport function useTimeZone(): {\n timeZone: string;\n formatWithUserTimeZone: (date: Date, formatString: string) => string;\n dateFormatOptionsWithUserTimeZone: (dateFormatOptions: Intl.DateTimeFormatOptions) => Intl.DateTimeFormatOptions;\n} {\n const timeZone = useContext(TimeZoneContext);\n return {\n // fallback to \"local\" timezone if TimeZoneProvider is not present in the React tree\n timeZone: timeZone ?? 'local',\n formatWithUserTimeZone(date: Date, formatString: string): string {\n return formatWithTimeZone(date, formatString, timeZone);\n },\n dateFormatOptionsWithUserTimeZone(dateFormatOptions: Intl.DateTimeFormatOptions): Intl.DateTimeFormatOptions {\n return dateFormatOptionsWithTimeZone(dateFormatOptions, timeZone);\n },\n };\n}\n"],"names":["React","createContext","useContext","formatWithTimeZone","dateFormatOptionsWithTimeZone","TimeZoneContext","undefined","TimeZoneProvider","props","children","timeZone","Provider","value","useTimeZone","formatWithUserTimeZone","date","formatString","dateFormatOptionsWithUserTimeZone","dateFormatOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,aAAa,EAAgBC,UAAU,QAAQ,QAAQ;AACvE,SAASC,kBAAkB,EAAEC,6BAA6B,QAAQ,WAAW;AAE7E,OAAO,MAAMC,gCAAkBJ,cAAkCK,WAAW;AAO5E,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGF;IAC/B,qBAAO,KAACH,gBAAgBM,QAAQ;QAACC,OAAOF;kBAAWD;;AACrD;AAEA,OAAO,SAASI;IAKd,MAAMH,WAAWR,WAAWG;IAC5B,OAAO;QACL,oFAAoF;QACpFK,UAAUA,qBAAAA,sBAAAA,WAAY;QACtBI,wBAAuBC,IAAU,EAAEC,YAAoB;YACrD,OAAOb,mBAAmBY,MAAMC,cAAcN;QAChD;QACAO,mCAAkCC,iBAA6C;YAC7E,OAAOd,8BAA8Bc,mBAAmBR;QAC1D;IACF;AACF"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { TextFieldProps as MuiTextFieldProps } from '@mui/material';
3
+ type TextFieldProps = Omit<MuiTextFieldProps, 'onChange'> & {
4
+ debounceMs?: number;
5
+ onChange?: (value: string) => void;
6
+ };
7
+ export declare const TextField: import("react").ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
8
+ export {};
9
+ //# sourceMappingURL=TextField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../src/controls/TextField.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAA6B,MAAM,eAAe,CAAC;AAI/F,KAAK,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAAC;AAExH,eAAO,MAAM,SAAS,wHAqBpB,CAAC"}
@@ -0,0 +1,41 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { TextField as MuiTextField } from '@mui/material';
15
+ import { forwardRef, useCallback, useMemo, useState } from 'react';
16
+ import debounce from 'lodash/debounce';
17
+ export const TextField = /*#__PURE__*/ forwardRef(function({ debounceMs = 250, value, onChange, ...props }, ref) {
18
+ const [currentValue, setCurrentValue] = useState(value);
19
+ function handleChange(event) {
20
+ setCurrentValue(event.target.value);
21
+ debounceFn(event.target.value);
22
+ }
23
+ const handleDebounceFn = useCallback((inputValue)=>{
24
+ onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
25
+ }, [
26
+ onChange
27
+ ]);
28
+ const debounceFn = useMemo(()=>debounce(handleDebounceFn, debounceMs), [
29
+ debounceMs,
30
+ handleDebounceFn
31
+ ]);
32
+ return /*#__PURE__*/ _jsx(MuiTextField, {
33
+ ref: ref,
34
+ value: currentValue,
35
+ onChange: handleChange,
36
+ ...props
37
+ });
38
+ });
39
+ TextField.displayName = 'TextField';
40
+
41
+ //# sourceMappingURL=TextField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/controls/TextField.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TextFieldProps as MuiTextFieldProps, TextField as MuiTextField } from '@mui/material';\nimport { ChangeEvent, ForwardedRef, forwardRef, useCallback, useMemo, useState } from 'react';\nimport debounce from 'lodash/debounce';\n\ntype TextFieldProps = Omit<MuiTextFieldProps, 'onChange'> & { debounceMs?: number; onChange?: (value: string) => void };\n\nexport const TextField = forwardRef(function (\n { debounceMs = 250, value, onChange, ...props }: TextFieldProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const [currentValue, setCurrentValue] = useState(value);\n\n function handleChange(event: ChangeEvent<HTMLInputElement>): void {\n setCurrentValue(event.target.value);\n debounceFn(event.target.value);\n }\n\n const handleDebounceFn = useCallback(\n (inputValue: string) => {\n onChange?.(inputValue);\n },\n [onChange]\n );\n\n const debounceFn = useMemo(() => debounce(handleDebounceFn, debounceMs), [debounceMs, handleDebounceFn]);\n\n return <MuiTextField ref={ref} value={currentValue} onChange={handleChange} {...props} />;\n});\nTextField.displayName = 'TextField';\n"],"names":["TextField","MuiTextField","forwardRef","useCallback","useMemo","useState","debounce","debounceMs","value","onChange","props","ref","currentValue","setCurrentValue","handleChange","event","target","debounceFn","handleDebounceFn","inputValue","displayName"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAA8CA,aAAaC,YAAY,QAAQ,gBAAgB;AAC/F,SAAoCC,UAAU,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAC9F,OAAOC,cAAc,kBAAkB;AAIvC,OAAO,MAAMN,0BAAYE,WAAW,SAClC,EAAEK,aAAa,GAAG,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGC,OAAuB,EAC/DC,GAAiC;IAEjC,MAAM,CAACC,cAAcC,gBAAgB,GAAGR,SAASG;IAEjD,SAASM,aAAaC,KAAoC;QACxDF,gBAAgBE,MAAMC,MAAM,CAACR,KAAK;QAClCS,WAAWF,MAAMC,MAAM,CAACR,KAAK;IAC/B;IAEA,MAAMU,mBAAmBf,YACvB,CAACgB;QACCV,qBAAAA,+BAAAA,SAAWU;IACb,GACA;QAACV;KAAS;IAGZ,MAAMQ,aAAab,QAAQ,IAAME,SAASY,kBAAkBX,aAAa;QAACA;QAAYW;KAAiB;IAEvG,qBAAO,KAACjB;QAAaU,KAAKA;QAAKH,OAAOI;QAAcH,UAAUK;QAAe,GAAGJ,KAAK;;AACvF,GAAG;AACHV,UAAUoB,WAAW,GAAG"}
@@ -0,0 +1,2 @@
1
+ export * from './TextField';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/controls/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './TextField';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/controls/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './TextField';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc"}
package/dist/index.d.ts CHANGED
@@ -2,13 +2,16 @@ export * from './AlignSelector';
2
2
  export * from './BarChart';
3
3
  export * from './ColorPicker';
4
4
  export * from './ContentWithLegend';
5
+ export * from './controls';
5
6
  export * from './Dialog';
6
7
  export * from './DensitySelector';
8
+ export * from './DragAndDrop';
7
9
  export * from './Drawer';
8
10
  export * from './EChart';
9
11
  export * from './ErrorAlert';
10
12
  export * from './ErrorBoundary';
11
13
  export * from './FontSizeSelector';
14
+ export * from './FormEditor';
12
15
  export * from './GaugeChart';
13
16
  export * from './InfoTooltip';
14
17
  export * from './JSONEditor';
@@ -37,4 +40,5 @@ export * from './theme';
37
40
  export * from './TransformsEditor';
38
41
  export * from './RefreshIntervalPicker';
39
42
  export * from './PieChart';
43
+ export * from './StatusHistoryChart';
40
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC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Aa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -14,13 +14,16 @@ export * from './AlignSelector';
14
14
  export * from './BarChart';
15
15
  export * from './ColorPicker';
16
16
  export * from './ContentWithLegend';
17
+ export * from './controls';
17
18
  export * from './Dialog';
18
19
  export * from './DensitySelector';
20
+ export * from './DragAndDrop';
19
21
  export * from './Drawer';
20
22
  export * from './EChart';
21
23
  export * from './ErrorAlert';
22
24
  export * from './ErrorBoundary';
23
25
  export * from './FontSizeSelector';
26
+ export * from './FormEditor';
24
27
  export * from './GaugeChart';
25
28
  export * from './InfoTooltip';
26
29
  export * from './JSONEditor';
@@ -49,5 +52,6 @@ export * from './theme';
49
52
  export * from './TransformsEditor';
50
53
  export * from './RefreshIntervalPicker';
51
54
  export * from './PieChart';
55
+ export * from './StatusHistoryChart';
52
56
 
53
57
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AlignSelector';\nexport * from './BarChart';\nexport * from './ColorPicker';\nexport * from './ContentWithLegend';\nexport * from './Dialog';\nexport * from './DensitySelector';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './FontSizeSelector';\nexport * from './GaugeChart';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LineChart';\nexport * from './LinksEditor';\nexport * from './ModeSelector';\nexport * from './OptionsEditorLayout';\nexport * from './Overlay';\nexport * from './SettingsAutocomplete';\nexport * from './SortSelector';\nexport * from './StatChart';\nexport * from './Table';\nexport * from './ThresholdsEditor';\nexport * from './TimeChart';\nexport * from './TimeRangeSelector';\nexport * from './TimeSeriesTooltip';\nexport * from './ToolbarIconButton';\nexport * from './FormatControls';\nexport * from './YAxisLabel';\nexport * from './context';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\nexport * from './TransformsEditor';\nexport * from './RefreshIntervalPicker';\nexport * from './PieChart';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB;AAChC,cAAc,aAAa;AAC3B,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,WAAW;AACzB,cAAc,oBAAoB;AAClC,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,qBAAqB;AACnC,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,YAAY;AAC1B,cAAc,yBAAyB;AACvC,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,cAAc;AAC5B,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,0BAA0B;AACxC,cAAc,aAAa"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AlignSelector';\nexport * from './BarChart';\nexport * from './ColorPicker';\nexport * from './ContentWithLegend';\nexport * from './controls';\nexport * from './Dialog';\nexport * from './DensitySelector';\nexport * from './DragAndDrop';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './FontSizeSelector';\nexport * from './FormEditor';\nexport * from './GaugeChart';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LineChart';\nexport * from './LinksEditor';\nexport * from './ModeSelector';\nexport * from './OptionsEditorLayout';\nexport * from './Overlay';\nexport * from './SettingsAutocomplete';\nexport * from './SortSelector';\nexport * from './StatChart';\nexport * from './Table';\nexport * from './ThresholdsEditor';\nexport * from './TimeChart';\nexport * from './TimeRangeSelector';\nexport * from './TimeSeriesTooltip';\nexport * from './ToolbarIconButton';\nexport * from './FormatControls';\nexport * from './YAxisLabel';\nexport * from './context';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\nexport * from './TransformsEditor';\nexport * from './RefreshIntervalPicker';\nexport * from './PieChart';\nexport * from './StatusHistoryChart';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB;AAChC,cAAc,aAAa;AAC3B,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,qBAAqB;AACnC,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,YAAY;AAC1B,cAAc,yBAAyB;AACvC,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,cAAc;AAC5B,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,0BAA0B;AACxC,cAAc,aAAa;AAC3B,cAAc,uBAAuB"}
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
- import { RenderOptions } from '@testing-library/react';
1
+ import { RenderOptions, RenderResult } from '@testing-library/react';
2
+ import { ReactElement } from 'react';
3
3
  /**
4
4
  * Test helper to render a React component with some common app-level providers wrapped around it.
5
5
  */
6
- export declare function renderWithContext(ui: React.ReactElement, options?: Omit<RenderOptions, 'queries'>): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
6
+ export declare function renderWithContext(ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult;
7
7
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAU,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAK/D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,gIAEjG"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAU,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG,YAAY,CAE1G"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/render.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { render, RenderOptions } from '@testing-library/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\n\nconst queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false } } });\n\n/**\n * Test helper to render a React component with some common app-level providers wrapped around it.\n */\nexport function renderWithContext(ui: React.ReactElement, options?: Omit<RenderOptions, 'queries'>) {\n return render(<QueryClientProvider client={queryClient}>{ui}</QueryClientProvider>, options);\n}\n"],"names":["render","QueryClient","QueryClientProvider","queryClient","defaultOptions","queries","refetchOnWindowFocus","renderWithContext","ui","options","client"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAuB,yBAAyB;AAC/D,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AAEzE,MAAMC,cAAc,IAAIF,YAAY;IAAEG,gBAAgB;QAAEC,SAAS;YAAEC,sBAAsB;QAAM;IAAE;AAAE;AAEnG;;CAEC,GACD,OAAO,SAASC,kBAAkBC,EAAsB,EAAEC,OAAwC;IAChG,OAAOT,qBAAO,KAACE;QAAoBQ,QAAQP;kBAAcK;QAA2BC;AACtF"}
1
+ {"version":3,"sources":["../../src/test/render.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { render, RenderOptions, RenderResult } from '@testing-library/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ReactElement } from 'react';\n\nconst queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false } } });\n\n/**\n * Test helper to render a React component with some common app-level providers wrapped around it.\n */\nexport function renderWithContext(ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult {\n return render(<QueryClientProvider client={queryClient}>{ui}</QueryClientProvider>, options);\n}\n"],"names":["render","QueryClient","QueryClientProvider","queryClient","defaultOptions","queries","refetchOnWindowFocus","renderWithContext","ui","options","client"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAqC,yBAAyB;AAC7E,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AAGzE,MAAMC,cAAc,IAAIF,YAAY;IAAEG,gBAAgB;QAAEC,SAAS;YAAEC,sBAAsB;QAAM;IAAE;AAAE;AAEnG;;CAEC,GACD,OAAO,SAASC,kBAAkBC,EAAgB,EAAEC,OAAwC;IAC1F,OAAOT,qBAAO,KAACE;QAAoBQ,QAAQP;kBAAcK;QAA2BC;AACtF"}
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAaA,OAAO,EAAe,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAmB9E;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,GAAE,YAAiB,SASrE"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAaA,OAAO,EAAe,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAuB9E;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,GAAE,YAAiB,GAAG,KAAK,CAQ7E"}
@@ -13,7 +13,7 @@
13
13
  import { createTheme } from '@mui/material';
14
14
  import { MuiAlert } from './component-overrides/alert';
15
15
  import { MuiPaper } from './component-overrides/paper';
16
- import { getPaletteOptions } from './palette/palette-options';
16
+ import { getPaletteOptions } from './palette';
17
17
  import { typography } from './typography';
18
18
  const getModalBackgroundStyle = ({ theme })=>{
19
19
  const backgroundStyle = theme.palette.mode === 'light' ? {} : {
@@ -34,14 +34,13 @@ const getModalBackgroundStyle = ({ theme })=>{
34
34
  * Need to reinstantiate the theme everytime to support switching between light and dark themes
35
35
  * https://github.com/mui-org/material-ui/issues/18831
36
36
  */ export function getTheme(mode, options = {}) {
37
- const theme = createTheme({
37
+ return createTheme({
38
38
  palette: getPaletteOptions(mode),
39
39
  typography,
40
40
  mixins: {},
41
41
  components,
42
42
  ...options
43
43
  });
44
- return theme;
45
44
  }
46
45
  // Overrides for component default prop values and styles go here
47
46
  const components = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/theme/theme.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createTheme, PaletteMode, ThemeOptions, Theme } from '@mui/material';\nimport { MuiAlert } from './component-overrides/alert';\nimport { MuiPaper } from './component-overrides/paper';\nimport { getPaletteOptions } from './palette/palette-options';\nimport { typography } from './typography';\n\nconst getModalBackgroundStyle = ({ theme }: { theme: Omit<Theme, 'components'> }) => {\n const backgroundStyle =\n theme.palette.mode === 'light'\n ? {}\n : {\n backgroundImage: 'unset',\n backgroundColor: theme.palette.designSystem.grey[800],\n };\n return {\n ...backgroundStyle,\n };\n};\n\n/**\n * Gets theme used by all components for the provided mode. For more details, see:\n * - Base colors, typography, sizing - go/chrono-ui-theme\n * - Material UI defaults: https://material-ui.com/customization/default-theme/\n * - Material UI variables: https://material-ui.com/customization/theming/#theme-configuration-variables\n * - Material UI global overrides and default props: https://material-ui.com/customization/globals/#css\n *\n * Need to reinstantiate the theme everytime to support switching between light and dark themes\n * https://github.com/mui-org/material-ui/issues/18831\n */\nexport function getTheme(mode: PaletteMode, options: ThemeOptions = {}) {\n const theme = createTheme({\n palette: getPaletteOptions(mode),\n typography,\n mixins: {},\n components,\n ...options,\n });\n return theme;\n}\n\n// Overrides for component default prop values and styles go here\nconst components: ThemeOptions['components'] = {\n MuiAlert,\n MuiFormControl: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiPaper,\n MuiTextField: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiDrawer: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiDialog: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiPopover: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n};\n"],"names":["createTheme","MuiAlert","MuiPaper","getPaletteOptions","typography","getModalBackgroundStyle","theme","backgroundStyle","palette","mode","backgroundImage","backgroundColor","designSystem","grey","getTheme","options","mixins","components","MuiFormControl","defaultProps","size","MuiTextField","MuiDrawer","styleOverrides","paper","MuiDialog","MuiPopover"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAA0C,gBAAgB;AAC9E,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,UAAU,QAAQ,eAAe;AAE1C,MAAMC,0BAA0B,CAAC,EAAEC,KAAK,EAAwC;IAC9E,MAAMC,kBACJD,MAAME,OAAO,CAACC,IAAI,KAAK,UACnB,CAAC,IACD;QACEC,iBAAiB;QACjBC,iBAAiBL,MAAME,OAAO,CAACI,YAAY,CAACC,IAAI,CAAC,IAAI;IACvD;IACN,OAAO;QACL,GAAGN,eAAe;IACpB;AACF;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASO,SAASL,IAAiB,EAAEM,UAAwB,CAAC,CAAC;IACpE,MAAMT,QAAQN,YAAY;QACxBQ,SAASL,kBAAkBM;QAC3BL;QACAY,QAAQ,CAAC;QACTC;QACA,GAAGF,OAAO;IACZ;IACA,OAAOT;AACT;AAEA,iEAAiE;AACjE,MAAMW,aAAyC;IAC7ChB;IACAiB,gBAAgB;QACdC,cAAc;YACZC,MAAM;QACR;IACF;IACAlB;IACAmB,cAAc;QACZF,cAAc;YACZC,MAAM;QACR;IACF;IACAE,WAAW;QACTC,gBAAgB;YACdC,OAAOnB;QACT;IACF;IACAoB,WAAW;QACTF,gBAAgB;YACdC,OAAOnB;QACT;IACF;IACAqB,YAAY;QACVH,gBAAgB;YACdC,OAAOnB;QACT;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/theme/theme.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createTheme, PaletteMode, ThemeOptions, Theme } from '@mui/material';\nimport { MuiAlert } from './component-overrides/alert';\nimport { MuiPaper } from './component-overrides/paper';\nimport { getPaletteOptions } from './palette';\nimport { typography } from './typography';\n\nconst getModalBackgroundStyle = ({\n theme,\n}: {\n theme: Omit<Theme, 'components'>;\n}): { backgroundImage?: string; backgroundColor?: string } => {\n const backgroundStyle =\n theme.palette.mode === 'light'\n ? {}\n : {\n backgroundImage: 'unset',\n backgroundColor: theme.palette.designSystem.grey[800],\n };\n return {\n ...backgroundStyle,\n };\n};\n\n/**\n * Gets theme used by all components for the provided mode. For more details, see:\n * - Base colors, typography, sizing - go/chrono-ui-theme\n * - Material UI defaults: https://material-ui.com/customization/default-theme/\n * - Material UI variables: https://material-ui.com/customization/theming/#theme-configuration-variables\n * - Material UI global overrides and default props: https://material-ui.com/customization/globals/#css\n *\n * Need to reinstantiate the theme everytime to support switching between light and dark themes\n * https://github.com/mui-org/material-ui/issues/18831\n */\nexport function getTheme(mode: PaletteMode, options: ThemeOptions = {}): Theme {\n return createTheme({\n palette: getPaletteOptions(mode),\n typography,\n mixins: {},\n components,\n ...options,\n });\n}\n\n// Overrides for component default prop values and styles go here\nconst components: ThemeOptions['components'] = {\n MuiAlert,\n MuiFormControl: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiPaper,\n MuiTextField: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiDrawer: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiDialog: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiPopover: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n};\n"],"names":["createTheme","MuiAlert","MuiPaper","getPaletteOptions","typography","getModalBackgroundStyle","theme","backgroundStyle","palette","mode","backgroundImage","backgroundColor","designSystem","grey","getTheme","options","mixins","components","MuiFormControl","defaultProps","size","MuiTextField","MuiDrawer","styleOverrides","paper","MuiDialog","MuiPopover"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAA0C,gBAAgB;AAC9E,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,UAAU,QAAQ,eAAe;AAE1C,MAAMC,0BAA0B,CAAC,EAC/BC,KAAK,EAGN;IACC,MAAMC,kBACJD,MAAME,OAAO,CAACC,IAAI,KAAK,UACnB,CAAC,IACD;QACEC,iBAAiB;QACjBC,iBAAiBL,MAAME,OAAO,CAACI,YAAY,CAACC,IAAI,CAAC,IAAI;IACvD;IACN,OAAO;QACL,GAAGN,eAAe;IACpB;AACF;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASO,SAASL,IAAiB,EAAEM,UAAwB,CAAC,CAAC;IACpE,OAAOf,YAAY;QACjBQ,SAASL,kBAAkBM;QAC3BL;QACAY,QAAQ,CAAC;QACTC;QACA,GAAGF,OAAO;IACZ;AACF;AAEA,iEAAiE;AACjE,MAAME,aAAyC;IAC7ChB;IACAiB,gBAAgB;QACdC,cAAc;YACZC,MAAM;QACR;IACF;IACAlB;IACAmB,cAAc;QACZF,cAAc;YACZC,MAAM;QACR;IACF;IACAE,WAAW;QACTC,gBAAgB;YACdC,OAAOnB;QACT;IACF;IACAoB,WAAW;QACTF,gBAAgB;YACdC,OAAOnB;QACT;IACF;IACAqB,YAAY;QACVH,gBAAgB;YACdC,OAAOnB;QACT;IACF;AACF"}
@@ -1,12 +1,6 @@
1
1
  import type { XAXisComponentOption, YAXisComponentOption } from 'echarts';
2
2
  import { FormatOptions } from '@perses-dev/core';
3
- export declare function getFormattedAxis(axis?: YAXisComponentOption | XAXisComponentOption, unit?: FormatOptions): ({
4
- type: string;
5
- boundaryGap: (string | number)[];
6
- axisLabel: {
7
- formatter: (value: number) => string;
8
- };
9
- } & (YAXisComponentOption | XAXisComponentOption | undefined))[];
3
+ export declare function getFormattedAxis(axis?: YAXisComponentOption | XAXisComponentOption, unit?: FormatOptions): unknown[];
10
4
  /**
11
5
  * Calculate date range, used as a fallback when xAxis time range not passed as prop
12
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../src/utils/axis.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAe,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAK9D,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,IAAI,CAAC,EAAE,aAAa;;;;2BAMhF,MAAM;;iEAM9B;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAM1C"}
1
+ {"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../src/utils/axis.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAe,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAK9D,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,EAAE,CAYpH;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAMnD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/axis.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport merge from 'lodash/merge';\nimport type { XAXisComponentOption, YAXisComponentOption } from 'echarts';\nimport { formatValue, FormatOptions } from '@perses-dev/core';\n\n/*\n * Populate yAxis or xAxis properties, returns an Array since multiple axes will be supported in the future\n */\nexport function getFormattedAxis(axis?: YAXisComponentOption | XAXisComponentOption, unit?: FormatOptions) {\n // TODO: support alternate yAxis that shows on right side\n const AXIS_DEFAULT = {\n type: 'value',\n boundaryGap: [0, '10%'],\n axisLabel: {\n formatter: (value: number) => {\n return formatValue(value, unit);\n },\n },\n };\n return [merge(AXIS_DEFAULT, axis)];\n}\n\n/**\n * Calculate date range, used as a fallback when xAxis time range not passed as prop\n */\nexport function getDateRange(data: number[]) {\n const defaultRange = 3600000; // hour in ms\n if (data.length === 0) return defaultRange;\n const lastDatum = data[data.length - 1];\n if (data[0] === undefined || lastDatum === undefined) return defaultRange;\n return lastDatum - data[0];\n}\n"],"names":["merge","formatValue","getFormattedAxis","axis","unit","AXIS_DEFAULT","type","boundaryGap","axisLabel","formatter","value","getDateRange","data","defaultRange","length","lastDatum","undefined"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,WAAW,eAAe;AAEjC,SAASC,WAAW,QAAuB,mBAAmB;AAE9D;;CAEC,GACD,OAAO,SAASC,iBAAiBC,IAAkD,EAAEC,IAAoB;IACvG,yDAAyD;IACzD,MAAMC,eAAe;QACnBC,MAAM;QACNC,aAAa;YAAC;YAAG;SAAM;QACvBC,WAAW;YACTC,WAAW,CAACC;gBACV,OAAOT,YAAYS,OAAON;YAC5B;QACF;IACF;IACA,OAAO;QAACJ,MAAMK,cAAcF;KAAM;AACpC;AAEA;;CAEC,GACD,OAAO,SAASQ,aAAaC,IAAc;IACzC,MAAMC,eAAe,SAAS,aAAa;IAC3C,IAAID,KAAKE,MAAM,KAAK,GAAG,OAAOD;IAC9B,MAAME,YAAYH,IAAI,CAACA,KAAKE,MAAM,GAAG,EAAE;IACvC,IAAIF,IAAI,CAAC,EAAE,KAAKI,aAAaD,cAAcC,WAAW,OAAOH;IAC7D,OAAOE,YAAYH,IAAI,CAAC,EAAE;AAC5B"}
1
+ {"version":3,"sources":["../../src/utils/axis.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport merge from 'lodash/merge';\nimport type { XAXisComponentOption, YAXisComponentOption } from 'echarts';\nimport { formatValue, FormatOptions } from '@perses-dev/core';\n\n/*\n * Populate yAxis or xAxis properties, returns an Array since multiple axes will be supported in the future\n */\nexport function getFormattedAxis(axis?: YAXisComponentOption | XAXisComponentOption, unit?: FormatOptions): unknown[] {\n // TODO: support alternate yAxis that shows on right side\n const AXIS_DEFAULT = {\n type: 'value',\n boundaryGap: [0, '10%'],\n axisLabel: {\n formatter: (value: number): string => {\n return formatValue(value, unit);\n },\n },\n };\n return [merge(AXIS_DEFAULT, axis)];\n}\n\n/**\n * Calculate date range, used as a fallback when xAxis time range not passed as prop\n */\nexport function getDateRange(data: number[]): number {\n const defaultRange = 3600000; // hour in ms\n if (data.length === 0) return defaultRange;\n const lastDatum = data[data.length - 1];\n if (data[0] === undefined || lastDatum === undefined) return defaultRange;\n return lastDatum - data[0];\n}\n"],"names":["merge","formatValue","getFormattedAxis","axis","unit","AXIS_DEFAULT","type","boundaryGap","axisLabel","formatter","value","getDateRange","data","defaultRange","length","lastDatum","undefined"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,WAAW,eAAe;AAEjC,SAASC,WAAW,QAAuB,mBAAmB;AAE9D;;CAEC,GACD,OAAO,SAASC,iBAAiBC,IAAkD,EAAEC,IAAoB;IACvG,yDAAyD;IACzD,MAAMC,eAAe;QACnBC,MAAM;QACNC,aAAa;YAAC;YAAG;SAAM;QACvBC,WAAW;YACTC,WAAW,CAACC;gBACV,OAAOT,YAAYS,OAAON;YAC5B;QACF;IACF;IACA,OAAO;QAACJ,MAAMK,cAAcF;KAAM;AACpC;AAEA;;CAEC,GACD,OAAO,SAASQ,aAAaC,IAAc;IACzC,MAAMC,eAAe,SAAS,aAAa;IAC3C,IAAID,KAAKE,MAAM,KAAK,GAAG,OAAOD;IAC9B,MAAME,YAAYH,IAAI,CAACA,KAAKE,MAAM,GAAG,EAAE;IACvC,IAAIF,IAAI,CAAC,EAAE,KAAKI,aAAaD,cAAcC,WAAW,OAAOH;IAC7D,OAAOE,YAAYH,IAAI,CAAC,EAAE;AAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"chart-actions.d.ts","sourceRoot":"","sources":["../../src/utils/chart-actions.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAgC,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAE/F,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,M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,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IAEZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAa3D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAKzD;AAMD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAYnE;AAOD,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,eAAe,GAAG,MAAM,EAAE,GAAG,IAAI,CAYnH;AAOD,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,eAAe,EACtB,mBAAmB,EAAE,MAAM,EAAE,EAC7B,uBAAuB,EAAE,MAAM,EAAE,EACjC,0BAA0B,EAAE,MAAM,EAAE,EACpC,oBAAoB,EAAE,aAAa,EAAE,EACrC,mBAAmB,EAAE,aAAa,EAAE,GACnC,IAAI,CAiDN;AAKD,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,sBAAsB,GAAG,OAAO,CAGzF;AAMD,wBAAgB,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgB9G;AAKD,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAapG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/chart-actions.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/core';\nimport { DatapointInfo, PINNED_CROSSHAIR_SERIES_NAME, TimeChartSeriesMapping } from '../model';\n\nexport interface ZoomEventData {\n start: number;\n end: number;\n // TODO: remove startIndex and endIndex once LineChart is deprecated\n startIndex?: number;\n endIndex?: number;\n}\n\n/**\n * Enable dataZoom without requring user to click toolbox icon.\n * https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar\n */\nexport function enableDataZoom(chart: EChartsInstance) {\n const chartModel = chart['_model'];\n if (chartModel === undefined) return;\n if (chartModel.option.toolbox !== undefined && chartModel.option.toolbox.length > 0) {\n // check if hidden data zoom icon is unselected (if selected it would be 'emphasis' instead of 'normal')\n if (chartModel.option.toolbox[0].feature.dataZoom.iconStatus.zoom === 'normal') {\n chart.dispatchAction({\n type: 'takeGlobalCursor',\n key: 'dataZoomSelect',\n dataZoomSelectActive: true,\n });\n }\n }\n}\n\n/**\n * Restore chart to original state before zoom or other actions were dispatched\n */\nexport function restoreChart(chart: EChartsInstance) {\n // TODO: support incremental unzoom instead of restore to original state\n chart.dispatchAction({\n type: 'restore', // https://echarts.apache.org/en/api.html#events.restore\n });\n}\n\n/*\n * Clear all highlighted series when cursor exits canvas\n * https://echarts.apache.org/en/api.html#action.downplay\n */\nexport function clearHighlightedSeries(chart: EChartsInstance) {\n if (chart.dispatchAction !== undefined) {\n // Clear any selected data points\n chart.dispatchAction({\n type: 'unselect',\n });\n\n // Clear any highlighted series\n chart.dispatchAction({\n type: 'downplay',\n });\n }\n}\n\n/*\n * Convert a point from pixel coordinate to logical coordinate.\n * Used to determine if cursor is over chart canvas and closest datapoint.\n * https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel\n */\nexport function getPointInGrid(cursorCoordX: number, cursorCoordY: number, chart?: EChartsInstance) {\n if (chart === undefined) {\n return null;\n }\n\n const pointInPixel = [cursorCoordX, cursorCoordY];\n if (!chart.containPixel('grid', pointInPixel)) {\n return null;\n }\n\n const pointInGrid: number[] = chart.convertFromPixel('grid', pointInPixel);\n return pointInGrid;\n}\n\n/*\n * TimeSeriesChart tooltip is built custom to support finding nearby series instead of single or all series.\n * This means ECharts actions need to be dispatched manually for series highlighting, datapoint select state, etc.\n * More info: https://echarts.apache.org/en/api.html#action\n */\nexport function batchDispatchNearbySeriesActions(\n chart: EChartsInstance,\n nearbySeriesIndexes: number[],\n emphasizedSeriesIndexes: number[],\n nonEmphasizedSeriesIndexes: number[],\n emphasizedDatapoints: DatapointInfo[],\n duplicateDatapoints: DatapointInfo[]\n) {\n // Accounts for multiple series that are rendered direct on top of eachother.\n // Only applies select state to the datapoint that is visible to avoid color mismatch.\n const lastEmphasizedDatapoint =\n duplicateDatapoints.length > 0\n ? duplicateDatapoints[duplicateDatapoints.length - 1]\n : emphasizedDatapoints[emphasizedDatapoints.length - 1];\n if (lastEmphasizedDatapoint !== undefined) {\n // Corresponds to select options inside getTimeSeries util.\n // https://echarts.apache.org/en/option.html#series-line.select.itemStyle\n chart.dispatchAction({\n type: 'select',\n seriesIndex: lastEmphasizedDatapoint.seriesIndex,\n dataIndex: lastEmphasizedDatapoint.dataIndex,\n // Shared crosshair should not emphasize datapoints on adjacent charts.\n escapeConnect: true, // TODO: try to remove escapeConnect and match by seriesName for cross panel correlation\n });\n }\n\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n\n // Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting\n chart.dispatchAction({\n type: 'toggleSelect', // https://echarts.apache.org/en/api.html#action.toggleSelect\n });\n }\n}\n\n/*\n * Determine whether a markLine was pushed into the final series, which means crosshair was already pinned onClick\n */\nexport function checkCrosshairPinnedStatus(seriesMapping: TimeChartSeriesMapping) {\n const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === PINNED_CROSSHAIR_SERIES_NAME;\n return isCrosshairPinned;\n}\n\n/*\n * Find closest timestamp to logical x coordinate returned from echartsInstance.convertFromPixel\n * Used to find nearby series in time series tooltip.\n */\nexport function getClosestTimestamp(timeSeriesValues?: TimeSeriesValueTuple[], cursorX?: number): number | null {\n if (timeSeriesValues === undefined || cursorX === undefined) {\n return null;\n }\n\n let currentClosestTimestamp: number | null = null;\n let currentClosestDistance = Infinity;\n\n for (const [timestamp] of timeSeriesValues) {\n const distance = Math.abs(timestamp - cursorX);\n if (distance < currentClosestDistance) {\n currentClosestTimestamp = timestamp;\n currentClosestDistance = distance;\n }\n }\n return currentClosestTimestamp;\n}\n\n/*\n * Find closest timestamp in full dataset, used to snap crosshair into place onClick when tooltip is pinned.\n */\nexport function getClosestTimestampInFullDataset(data: TimeSeries[], cursorX?: number): number | null {\n if (cursorX === undefined) {\n return null;\n }\n const totalSeries = data.length;\n let closestTimestamp = null;\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;\n if (!currentDataset) break;\n const currentValues: TimeSeriesValueTuple[] = currentDataset.values;\n closestTimestamp = getClosestTimestamp(currentValues, cursorX);\n }\n return closestTimestamp;\n}\n"],"names":["PINNED_CROSSHAIR_SERIES_NAME","enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","getPointInGrid","cursorCoordX","cursorCoordY","pointInPixel","containPixel","pointInGrid","convertFromPixel","batchDispatchNearbySeriesActions","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","lastEmphasizedDatapoint","seriesIndex","dataIndex","escapeConnect","notBlur","checkCrosshairPinnedStatus","seriesMapping","isCrosshairPinned","name","getClosestTimestamp","timeSeriesValues","cursorX","currentClosestTimestamp","currentClosestDistance","Infinity","timestamp","distance","Math","abs","getClosestTimestampInFullDataset","data","totalSeries","closestTimestamp","seriesIdx","currentDataset","currentValues","values"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAAwBA,4BAA4B,QAAgC,WAAW;AAU/F;;;CAGC,GACD,OAAO,SAASC,eAAeC,KAAsB;IACnD,MAAMC,aAAaD,KAAK,CAAC,SAAS;IAClC,IAAIC,eAAeC,WAAW;IAC9B,IAAID,WAAWE,MAAM,CAACC,OAAO,KAAKF,aAAaD,WAAWE,MAAM,CAACC,OAAO,CAACC,MAAM,GAAG,GAAG;QACnF,wGAAwG;QACxG,IAAIJ,WAAWE,MAAM,CAACC,OAAO,CAAC,EAAE,CAACE,OAAO,CAACC,QAAQ,CAACC,UAAU,CAACC,IAAI,KAAK,UAAU;YAC9ET,MAAMU,cAAc,CAAC;gBACnBC,MAAM;gBACNC,KAAK;gBACLC,sBAAs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,gBAAwCD,eAAeE,MAAM;QACnEJ,mBAAmBb,oBAAoBgB,eAAed;IACxD;IACA,OAAOW;AACT"}
1
+ {"version":3,"sources":["../../src/utils/chart-actions.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/core';\nimport { DatapointInfo, PINNED_CROSSHAIR_SERIES_NAME, TimeChartSeriesMapping } from '../model';\n\nexport interface ZoomEventData {\n start: number;\n end: number;\n // TODO: remove startIndex and endIndex once LineChart is deprecated\n startIndex?: number;\n endIndex?: number;\n}\n\n/**\n * Enable dataZoom without requring user to click toolbox icon.\n * https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar\n */\nexport function enableDataZoom(chart: EChartsInstance): void {\n const chartModel = chart['_model'];\n if (chartModel === undefined) return;\n if (chartModel.option.toolbox !== undefined && chartModel.option.toolbox.length > 0) {\n // check if hidden data zoom icon is unselected (if selected it would be 'emphasis' instead of 'normal')\n if (chartModel.option.toolbox[0].feature.dataZoom.iconStatus.zoom === 'normal') {\n chart.dispatchAction({\n type: 'takeGlobalCursor',\n key: 'dataZoomSelect',\n dataZoomSelectActive: true,\n });\n }\n }\n}\n\n/**\n * Restore chart to original state before zoom or other actions were dispatched\n */\nexport function restoreChart(chart: EChartsInstance): void {\n // TODO: support incremental unzoom instead of restore to original state\n chart.dispatchAction({\n type: 'restore', // https://echarts.apache.org/en/api.html#events.restore\n });\n}\n\n/*\n * Clear all highlighted series when cursor exits canvas\n * https://echarts.apache.org/en/api.html#action.downplay\n */\nexport function clearHighlightedSeries(chart: EChartsInstance): void {\n if (chart.dispatchAction !== undefined) {\n // Clear any selected data points\n chart.dispatchAction({\n type: 'unselect',\n });\n\n // Clear any highlighted series\n chart.dispatchAction({\n type: 'downplay',\n });\n }\n}\n\n/*\n * Convert a point from pixel coordinate to logical coordinate.\n * Used to determine if cursor is over chart canvas and closest datapoint.\n * https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel\n */\nexport function getPointInGrid(cursorCoordX: number, cursorCoordY: number, chart?: EChartsInstance): number[] | null {\n if (chart === undefined) {\n return null;\n }\n\n const pointInPixel = [cursorCoordX, cursorCoordY];\n if (!chart.containPixel('grid', pointInPixel)) {\n return null;\n }\n\n const pointInGrid: number[] = chart.convertFromPixel('grid', pointInPixel);\n return pointInGrid;\n}\n\n/*\n * TimeSeriesChart tooltip is built custom to support finding nearby series instead of single or all series.\n * This means ECharts actions need to be dispatched manually for series highlighting, datapoint select state, etc.\n * More info: https://echarts.apache.org/en/api.html#action\n */\nexport function batchDispatchNearbySeriesActions(\n chart: EChartsInstance,\n nearbySeriesIndexes: number[],\n emphasizedSeriesIndexes: number[],\n nonEmphasizedSeriesIndexes: number[],\n emphasizedDatapoints: DatapointInfo[],\n duplicateDatapoints: DatapointInfo[]\n): void {\n // Accounts for multiple series that are rendered direct on top of eachother.\n // Only applies select state to the datapoint that is visible to avoid color mismatch.\n const lastEmphasizedDatapoint =\n duplicateDatapoints.length > 0\n ? duplicateDatapoints[duplicateDatapoints.length - 1]\n : emphasizedDatapoints[emphasizedDatapoints.length - 1];\n if (lastEmphasizedDatapoint !== undefined) {\n // Corresponds to select options inside getTimeSeries util.\n // https://echarts.apache.org/en/option.html#series-line.select.itemStyle\n chart.dispatchAction({\n type: 'select',\n seriesIndex: lastEmphasizedDatapoint.seriesIndex,\n dataIndex: lastEmphasizedDatapoint.dataIndex,\n // Shared crosshair should not emphasize datapoints on adjacent charts.\n escapeConnect: true, // TODO: try to remove escapeConnect and match by seriesName for cross panel correlation\n });\n }\n\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n\n // Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting\n chart.dispatchAction({\n type: 'toggleSelect', // https://echarts.apache.org/en/api.html#action.toggleSelect\n });\n }\n}\n\n/*\n * Determine whether a markLine was pushed into the final series, which means crosshair was already pinned onClick\n */\nexport function checkCrosshairPinnedStatus(seriesMapping: TimeChartSeriesMapping): boolean {\n const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === PINNED_CROSSHAIR_SERIES_NAME;\n return isCrosshairPinned;\n}\n\n/*\n * Find closest timestamp to logical x coordinate returned from echartsInstance.convertFromPixel\n * Used to find nearby series in time series tooltip.\n */\nexport function getClosestTimestamp(timeSeriesValues?: TimeSeriesValueTuple[], cursorX?: number): number | null {\n if (timeSeriesValues === undefined || cursorX === undefined) {\n return null;\n }\n\n let currentClosestTimestamp: number | null = null;\n let currentClosestDistance = Infinity;\n\n for (const [timestamp] of timeSeriesValues) {\n const distance = Math.abs(timestamp - cursorX);\n if (distance < currentClosestDistance) {\n currentClosestTimestamp = timestamp;\n currentClosestDistance = distance;\n }\n }\n return currentClosestTimestamp;\n}\n\n/*\n * Find closest timestamp in full dataset, used to snap crosshair into place onClick when tooltip is pinned.\n */\nexport function getClosestTimestampInFullDataset(data: TimeSeries[], cursorX?: number): number | null {\n if (cursorX === undefined) {\n return null;\n }\n const totalSeries = data.length;\n let closestTimestamp = null;\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;\n if (!currentDataset) break;\n const currentValues: TimeSeriesValueTuple[] = currentDataset.values;\n closestTimestamp = getClosestTimestamp(currentValues, cursorX);\n }\n return closestTimestamp;\n}\n"],"names":["PINNED_CROSSHAIR_SERIES_NAME","enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","getPointInGrid","cursorCoordX","cursorCoordY","pointInPixel","containPixel","pointInGrid","convertFromPixel","batchDispatchNearbySeriesActions","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","lastEmphasizedDatapoint","seriesIndex","dataIndex","escapeConnect","notBlur","checkCrosshairPinnedStatus","seriesMapping","isCrosshairPinned","name","getClosestTimestamp","timeSeriesValues","cursorX","currentClosestTimestamp","currentClosestDistance","Infinity","timestamp","distance","Math","abs","getClosestTimestampInFullDataset","data","totalSeries","closestTimestamp","seriesIdx","currentDataset","currentValues","values"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAAwBA,4BAA4B,QAAgC,WAAW;AAU/F;;;CAGC,GACD,OAAO,SAASC,eAAeC,KAAsB;IACnD,MAAMC,aAAaD,KAAK,CAAC,SAAS;IAClC,IAAIC,eAAeC,WAAW;IAC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O,SAASO,iCAAiCC,IAAkB,EAAET,OAAgB;IACnF,IAAIA,YAAYtC,WAAW;QACzB,OAAO;IACT;IACA,MAAMgD,cAAcD,KAAK5C,MAAM;IAC/B,IAAI8C,mBAAmB;IACvB,IAAK,IAAIC,YAAY,GAAGA,YAAYF,aAAaE,YAAa;QAC5D,MAAMC,iBAAiBH,cAAc,IAAID,IAAI,CAACG,UAAU,GAAG;QAC3D,IAAI,CAACC,gBAAgB;QACrB,MAAMC,gBAAwCD,eAAeE,MAAM;QACnEJ,mBAAmBb,oBAAoBgB,eAAed;IACxD;IACA,OAAOW;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"component-ids.d.ts","sourceRoot":"","sources":["../../src/utils/component-ids.ts"],"names":[],"mappings":"AAeA,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,UAAU,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,UAUnC"}
1
+ {"version":3,"file":"component-ids.d.ts","sourceRoot":"","sources":["../../src/utils/component-ids.ts"],"names":[],"mappings":"AAeA,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,UAAU,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAU5C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/component-ids.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useRef } from 'react';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var useIdValue: number;\n}\n\n/**\n * Generates a unique (stable) ID for a component. Should be replaced with React.useId once we support only React 18.\n */\nexport function useId(prefix: string) {\n if (globalThis.useIdValue === undefined) {\n globalThis.useIdValue = 0;\n }\n\n const id = useRef<string | undefined>(undefined);\n if (id.current === undefined) {\n id.current = `${prefix}-${globalThis.useIdValue++}`;\n }\n return id.current;\n}\n"],"names":["useRef","useId","prefix","globalThis","useIdValue","undefined","id","current"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAQ,QAAQ;AAO/B;;CAEC,GACD,OAAO,SAASC,MAAMC,MAAc;IAClC,IAAIC,WAAWC,UAAU,KAAKC,WAAW;QACvCF,WAAWC,UAAU,GAAG;IAC1B;IAEA,MAAME,KAAKN,OAA2BK;IACtC,IAAIC,GAAGC,OAAO,KAAKF,WAAW;QAC5BC,GAAGC,OAAO,GAAG,CAAC,EAAEL,OAAO,CAAC,EAAEC,WAAWC,UAAU,GAAG,CAAC;IACrD;IACA,OAAOE,GAAGC,OAAO;AACnB"}
1
+ {"version":3,"sources":["../../src/utils/component-ids.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useRef } from 'react';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var useIdValue: number;\n}\n\n/**\n * Generates a unique (stable) ID for a component. Should be replaced with React.useId once we support only React 18.\n */\nexport function useId(prefix: string): string {\n if (globalThis.useIdValue === undefined) {\n globalThis.useIdValue = 0;\n }\n\n const id = useRef<string | undefined>(undefined);\n if (id.current === undefined) {\n id.current = `${prefix}-${globalThis.useIdValue++}`;\n }\n return id.current;\n}\n"],"names":["useRef","useId","prefix","globalThis","useIdValue","undefined","id","current"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAQ,QAAQ;AAO/B;;CAEC,GACD,OAAO,SAASC,MAAMC,MAAc;IAClC,IAAIC,WAAWC,UAAU,KAAKC,WAAW;QACvCF,WAAWC,UAAU,GAAG;IAC1B;IAEA,MAAME,KAAKN,OAA2BK;IACtC,IAAIC,GAAGC,OAAO,KAAKF,WAAW;QAC5BC,GAAGC,OAAO,GAAG,CAAC,EAAEL,OAAO,CAAC,EAAEC,WAAWC,UAAU,GAAG,CAAC;IACrD;IACA,OAAOE,GAAGC,OAAO;AACnB"}
@@ -1,9 +1,15 @@
1
1
  export declare function dateFormatOptionsWithTimeZone(dateFormatOptions: Intl.DateTimeFormatOptions, timeZone?: string): Intl.DateTimeFormatOptions;
2
2
  export declare function formatWithTimeZone(date: Date, formatString: string, timeZone?: string): string;
3
3
  export declare function getFormattedDate(value: number, rangeMs: number, timeZone?: string): string;
4
- export declare function getFormattedAxisLabel(rangeMs: number): "{yyyy}" | "{MMM} {yyyy}" | "{MM}/{dd}" | "{MM}/{dd} {HH}:{mm}" | {
5
- year: string;
6
- month: string;
7
- day: string;
4
+ export declare function getFormattedAxisLabel(rangeMs: number): string | {
5
+ month: '{MMM}';
6
+ year: '{yearStyle|{yyyy}}\n{monthStyle|{MMM}}';
7
+ day: '{MM}/{dd}';
8
8
  };
9
+ interface FormattedDateTime {
10
+ formattedDate: string;
11
+ formattedTime: string;
12
+ }
13
+ export declare const getDateAndTime: (timeMs?: number) => FormattedDateTime;
14
+ export {};
9
15
  //# sourceMappingURL=format.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAgBA,wBAAgB,6BAA6B,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,EAAE,MAAM,8BAgB7G;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,UAYrF;AAKD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,UAoBjF;AAGD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM;;;;EA8BpD"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAgBA,wBAAgB,6BAA6B,CAC3C,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,EAC7C,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAAC,qBAAqB,CAgB5B;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAY9F;AAKD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAoB1F;AAGD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GACjD,MAAM,GACN;IACE,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,wCAAwC,CAAC;IAC/C,GAAG,EAAE,WAAW,CAAC;CAClB,CA8BJ;AAED,UAAU,iBAAiB;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,YAAa,MAAM,KAAG,iBAWhD,CAAC"}
@@ -87,5 +87,20 @@ export function getFormattedAxisLabel(rangeMs) {
87
87
  day: '{MM}/{dd}'
88
88
  };
89
89
  }
90
+ export const getDateAndTime = (timeMs)=>{
91
+ if (!timeMs) {
92
+ return {
93
+ formattedDate: '',
94
+ formattedTime: ''
95
+ };
96
+ }
97
+ const date = new Date(timeMs);
98
+ const formattedDate = format(date, 'MMM dd, yyyy - ');
99
+ const formattedTime = format(date, 'HH:mm:ss');
100
+ return {
101
+ formattedDate,
102
+ formattedTime
103
+ };
104
+ };
90
105
 
91
106
  //# sourceMappingURL=format.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/format.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatInTimeZone } from 'date-fns-tz';\nimport { format } from 'date-fns';\n\nexport function dateFormatOptionsWithTimeZone(dateFormatOptions: Intl.DateTimeFormatOptions, timeZone?: string) {\n /*\n * if timeZone is provided, and is not local|browser,\n * then set timeZone option (recognize UTC regardless of uppercase/lowercase)\n * otherwise, default to browser timeZone setting\n */\n if (timeZone) {\n const lowerTimeZone = timeZone.toLowerCase();\n if (lowerTimeZone !== 'local' && lowerTimeZone !== 'browser') {\n return {\n ...dateFormatOptions,\n timeZone: lowerTimeZone === 'utc' ? 'UTC' : timeZone,\n };\n }\n }\n return dateFormatOptions;\n}\n\nexport function formatWithTimeZone(date: Date, formatString: string, timeZone?: string) {\n /*\n * if timeZone is provided, and is not local|browser,\n * then format using timeZone option (recognize UTC regardless of uppercase/lowercase)\n * otherwise, format without timeZone option, defaulting to browser timeZone setting\n */\n const lowerTimeZone = timeZone?.toLowerCase();\n if (!timeZone || lowerTimeZone === 'local' || lowerTimeZone === 'browser') {\n return format(date, formatString);\n } else {\n return formatInTimeZone(date, lowerTimeZone === 'utc' ? 'UTC' : timeZone, formatString);\n }\n}\n\n/*\n * Determines time granularity for axis labels, defaults to hh:mm\n */\nexport function getFormattedDate(value: number, rangeMs: number, timeZone?: string) {\n const dateFormatOptions: Intl.DateTimeFormatOptions = dateFormatOptionsWithTimeZone(\n {\n hour: 'numeric',\n minute: 'numeric',\n hourCycle: 'h23',\n },\n timeZone\n );\n const thirtyMinMs = 1800000;\n const dayMs = 86400000;\n if (rangeMs <= thirtyMinMs) {\n dateFormatOptions.second = 'numeric';\n } else if (rangeMs >= dayMs) {\n dateFormatOptions.month = 'numeric';\n dateFormatOptions.day = 'numeric';\n }\n const DATE_FORMAT = new Intl.DateTimeFormat(undefined, dateFormatOptions);\n // remove comma when month / day present\n return DATE_FORMAT.format(value).replace(/, /g, ' ');\n}\n\n// https://echarts.apache.org/en/option.html#xAxis.axisLabel.formatter\nexport function getFormattedAxisLabel(rangeMs: number) {\n const dayMs = 86400000;\n const monthMs = 2629440000;\n const yearMs = 31536000000;\n\n // more than 5 years\n if (rangeMs > yearMs * 5) {\n return '{yyyy}';\n }\n\n // more than 2 years\n if (rangeMs > yearMs * 2) {\n return '{MMM} {yyyy}';\n }\n\n // between 5 days to 6 months\n if (rangeMs > dayMs * 5 && rangeMs < monthMs * 6) {\n return '{MM}/{dd}'; // 12/01\n }\n\n // between 2 and 5 days\n if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 5) {\n return '{MM}/{dd} {HH}:{mm}'; // 12/01 12:30\n }\n\n return {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}', // Jan, Feb, ...\n day: '{MM}/{dd}',\n };\n}\n"],"names":["formatInTimeZone","format","dateFormatOptionsWithTimeZone","dateFormatOptions","timeZone","lowerTimeZone","toLowerCase","formatWithTimeZone","date","formatString","getFormattedDate","value","rangeMs","hour","minute","hourCycle","thirtyMinMs","dayMs","second","month","day","DATE_FORMAT","Intl","DateTimeFormat","undefined","replace","getFormattedAxisLabel","monthMs","yearMs","year"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,gBAAgB,QAAQ,cAAc;AAC/C,SAASC,MAAM,QAAQ,WAAW;AAElC,OAAO,SAASC,8BAA8BC,iBAA6C,EAAEC,QAAiB;IAC5G;;;;GAIC,GACD,IAAIA,UAAU;QACZ,MAAMC,gBAAgBD,SAASE,WAAW;QAC1C,IAAID,kBAAkB,WAAWA,kBAAkB,WAAW;YAC5D,OAAO;gBACL,GAAGF,iBAAiB;gBACpBC,UAAUC,kBAAkB,QAAQ,QAAQD;YAC9C;QACF;IACF;IACA,OAAOD;AACT;AAEA,OAAO,SAASI,mBAAmBC,IAAU,EAAEC,YAAoB,EAAEL,QAAiB;IACpF;;;;GAIC,GACD,MAAMC,gBAAgBD,qBAAAA,+BAAAA,SAAUE,WAAW;IAC3C,IAAI,CAACF,YAAYC,kBAAkB,WAAWA,kBAAkB,WAAW;QACzE,OAAOJ,OAAOO,MAAMC;IACtB,OAAO;QACL,OAAOT,iBAAiBQ,MAAMH,kBAAkB,QAAQ,QAAQD,UAAUK;IAC5E;AACF;AAEA;;CAEC,GACD,OAAO,SAASC,iBAAiBC,KAAa,EAAEC,OAAe,EAAER,QAAiB;IAChF,MAAMD,oBAAgDD,8BACpD;QACEW,MAAM;QACNC,QAAQ;QACRC,WAAW;IACb,GACAX;IAEF,MAAMY,cAAc;IACpB,MAAMC,QAAQ;IACd,IAAIL,WAAWI,aAAa;QAC1Bb,kBAAkBe,MAAM,GAAG;IAC7B,OAAO,IAAIN,WAAWK,OAAO;QAC3Bd,kBAAkBgB,KAAK,GAAG;QAC1BhB,kBAAkBiB,GAAG,GAAG;IAC1B;IACA,MAAMC,cAAc,IAAIC,KAAKC,cAAc,CAACC,WAAWrB;IACvD,wCAAwC;IACxC,OAAOkB,YAAYpB,MAAM,CAACU,OAAOc,OAAO,CAAC,OAAO;AAClD;AAEA,sEAAsE;AACtE,OAAO,SAASC,sBAAsBd,OAAe;IACnD,MAAMK,QAAQ;IACd,MAAMU,UAAU;IAChB,MAAMC,SAAS;IAEf,oBAAoB;IACpB,IAAIhB,UAAUgB,SAAS,GAAG;QACxB,OAAO;IACT;IAEA,oBAAoB;IACpB,IAAIhB,UAAUgB,SAAS,GAAG;QACxB,OAAO;IACT;IAEA,6BAA6B;IAC7B,IAAIhB,UAAUK,QAAQ,KAAKL,UAAUe,UAAU,GAAG;QAChD,OAAO,aAAa,QAAQ;IAC9B;IAEA,uBAAuB;IACvB,IAAIf,UAAUK,QAAQ,KAAKL,WAAWK,QAAQ,GAAG;QAC/C,OAAO,uBAAuB,cAAc;IAC9C;IAEA,OAAO;QACLY,MAAM;QACNV,OAAO;QACPC,KAAK;IACP;AACF"}
1
+ {"version":3,"sources":["../../src/utils/format.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatInTimeZone } from 'date-fns-tz';\nimport { format } from 'date-fns';\n\nexport function dateFormatOptionsWithTimeZone(\n dateFormatOptions: Intl.DateTimeFormatOptions,\n timeZone?: string\n): Intl.DateTimeFormatOptions {\n /*\n * if timeZone is provided, and is not local|browser,\n * then set timeZone option (recognize UTC regardless of uppercase/lowercase)\n * otherwise, default to browser timeZone setting\n */\n if (timeZone) {\n const lowerTimeZone = timeZone.toLowerCase();\n if (lowerTimeZone !== 'local' && lowerTimeZone !== 'browser') {\n return {\n ...dateFormatOptions,\n timeZone: lowerTimeZone === 'utc' ? 'UTC' : timeZone,\n };\n }\n }\n return dateFormatOptions;\n}\n\nexport function formatWithTimeZone(date: Date, formatString: string, timeZone?: string): string {\n /*\n * if timeZone is provided, and is not local|browser,\n * then format using timeZone option (recognize UTC regardless of uppercase/lowercase)\n * otherwise, format without timeZone option, defaulting to browser timeZone setting\n */\n const lowerTimeZone = timeZone?.toLowerCase();\n if (!timeZone || lowerTimeZone === 'local' || lowerTimeZone === 'browser') {\n return format(date, formatString);\n } else {\n return formatInTimeZone(date, lowerTimeZone === 'utc' ? 'UTC' : timeZone, formatString);\n }\n}\n\n/*\n * Determines time granularity for axis labels, defaults to hh:mm\n */\nexport function getFormattedDate(value: number, rangeMs: number, timeZone?: string): string {\n const dateFormatOptions: Intl.DateTimeFormatOptions = dateFormatOptionsWithTimeZone(\n {\n hour: 'numeric',\n minute: 'numeric',\n hourCycle: 'h23',\n },\n timeZone\n );\n const thirtyMinMs = 1800000;\n const dayMs = 86400000;\n if (rangeMs <= thirtyMinMs) {\n dateFormatOptions.second = 'numeric';\n } else if (rangeMs >= dayMs) {\n dateFormatOptions.month = 'numeric';\n dateFormatOptions.day = 'numeric';\n }\n const DATE_FORMAT = new Intl.DateTimeFormat(undefined, dateFormatOptions);\n // remove comma when month / day present\n return DATE_FORMAT.format(value).replace(/, /g, ' ');\n}\n\n// https://echarts.apache.org/en/option.html#xAxis.axisLabel.formatter\nexport function getFormattedAxisLabel(rangeMs: number):\n | string\n | {\n month: '{MMM}';\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}';\n day: '{MM}/{dd}';\n } {\n const dayMs = 86400000;\n const monthMs = 2629440000;\n const yearMs = 31536000000;\n\n // more than 5 years\n if (rangeMs > yearMs * 5) {\n return '{yyyy}';\n }\n\n // more than 2 years\n if (rangeMs > yearMs * 2) {\n return '{MMM} {yyyy}';\n }\n\n // between 5 days to 6 months\n if (rangeMs > dayMs * 5 && rangeMs < monthMs * 6) {\n return '{MM}/{dd}'; // 12/01\n }\n\n // between 2 and 5 days\n if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 5) {\n return '{MM}/{dd} {HH}:{mm}'; // 12/01 12:30\n }\n\n return {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}', // Jan, Feb, ...\n day: '{MM}/{dd}',\n };\n}\n\ninterface FormattedDateTime {\n formattedDate: string;\n formattedTime: string;\n}\n\nexport const getDateAndTime = (timeMs?: number): FormattedDateTime => {\n if (!timeMs) {\n return { formattedDate: '', formattedTime: '' };\n }\n const date = new Date(timeMs);\n const formattedDate = format(date, 'MMM dd, yyyy - ');\n const formattedTime = format(date, 'HH:mm:ss');\n return {\n formattedDate,\n formattedTime,\n };\n};\n"],"names":["formatInTimeZone","format","dateFormatOptionsWithTimeZone","dateFormatOptions","timeZone","lowerTimeZone","toLowerCase","formatWithTimeZone","date","formatString","getFormattedDate","value","rangeMs","hour","minute","hourCycle","thirtyMinMs","dayMs","second","month","day","DATE_FORMAT","Intl","DateTimeFormat","undefined","replace","getFormattedAxisLabel","monthMs","yearMs","year","getDateAndTime","timeMs","formattedDate","formattedTime","Date"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,gBAAgB,QAAQ,cAAc;AAC/C,SAASC,MAAM,QAAQ,WAAW;AAElC,OAAO,SAASC,8BACdC,iBAA6C,EAC7CC,QAAiB;IAEjB;;;;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