@perses-dev/components 0.0.0-snapshot-panel-extra-content-2-2767e21 → 0.0.0-snapshot-scatter-chart-embed-8efdfab

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 (360) hide show
  1. package/dist/BarChart/BarChart.d.ts +2 -2
  2. package/dist/BarChart/BarChart.d.ts.map +1 -1
  3. package/dist/BarChart/BarChart.js +16 -10
  4. package/dist/BarChart/BarChart.js.map +1 -1
  5. package/dist/BarChart/index.js.map +1 -1
  6. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  7. package/dist/ColorPicker/index.js.map +1 -1
  8. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  9. package/dist/ContentWithLegend/index.js.map +1 -1
  10. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +1 -1
  11. package/dist/ContentWithLegend/model/content-with-legend-model.js +19 -19
  12. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  13. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
  14. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +6 -22
  15. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
  16. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
  17. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
  18. package/dist/DateTimeRangePicker/index.js.map +1 -1
  19. package/dist/DateTimeRangePicker/utils.js.map +1 -1
  20. package/dist/Dialog/Dialog.js.map +1 -1
  21. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  22. package/dist/Dialog/index.js.map +1 -1
  23. package/dist/Drawer/Drawer.d.ts.map +1 -1
  24. package/dist/Drawer/Drawer.js +3 -2
  25. package/dist/Drawer/Drawer.js.map +1 -1
  26. package/dist/Drawer/index.js.map +1 -1
  27. package/dist/EChart/EChart.js +2 -2
  28. package/dist/EChart/EChart.js.map +1 -1
  29. package/dist/EChart/index.js.map +1 -1
  30. package/dist/ErrorAlert.js.map +1 -1
  31. package/dist/ErrorBoundary.js.map +1 -1
  32. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  33. package/dist/FontSizeSelector/index.js.map +1 -1
  34. package/dist/FormatControls/FormatControls.d.ts +9 -0
  35. package/dist/FormatControls/FormatControls.d.ts.map +1 -0
  36. package/dist/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +26 -26
  37. package/dist/FormatControls/FormatControls.js.map +1 -0
  38. package/dist/FormatControls/index.d.ts +2 -0
  39. package/dist/FormatControls/index.d.ts.map +1 -0
  40. package/dist/{UnitSelector → FormatControls}/index.js +1 -1
  41. package/dist/FormatControls/index.js.map +1 -0
  42. package/dist/GaugeChart/GaugeChart.d.ts +3 -3
  43. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  44. package/dist/GaugeChart/GaugeChart.js +12 -12
  45. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  46. package/dist/GaugeChart/index.js.map +1 -1
  47. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  48. package/dist/InfoTooltip/index.js.map +1 -1
  49. package/dist/JSONEditor.d.ts +2 -1
  50. package/dist/JSONEditor.d.ts.map +1 -1
  51. package/dist/JSONEditor.js +9 -8
  52. package/dist/JSONEditor.js.map +1 -1
  53. package/dist/Legend/CompactLegend.js.map +1 -1
  54. package/dist/Legend/Legend.js +3 -3
  55. package/dist/Legend/Legend.js.map +1 -1
  56. package/dist/Legend/LegendColorBadge.js.map +1 -1
  57. package/dist/Legend/ListLegend.js.map +1 -1
  58. package/dist/Legend/ListLegendItem.js +2 -2
  59. package/dist/Legend/ListLegendItem.js.map +1 -1
  60. package/dist/Legend/TableLegend.js.map +1 -1
  61. package/dist/Legend/index.js.map +1 -1
  62. package/dist/Legend/legend-model.js.map +1 -1
  63. package/dist/LineChart/LineChart.d.ts +2 -2
  64. package/dist/LineChart/LineChart.d.ts.map +1 -1
  65. package/dist/LineChart/LineChart.js +20 -23
  66. package/dist/LineChart/LineChart.js.map +1 -1
  67. package/dist/LineChart/index.js.map +1 -1
  68. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  69. package/dist/ModeSelector/index.js.map +1 -1
  70. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  71. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  72. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  73. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  74. package/dist/OptionsEditorLayout/index.js.map +1 -1
  75. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  76. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +22 -6
  77. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  78. package/dist/RefreshIntervalPicker/index.js.map +1 -1
  79. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +2 -2
  80. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  81. package/dist/SettingsAutocomplete/index.js.map +1 -1
  82. package/dist/SortSelector/SortSelector.js.map +1 -1
  83. package/dist/SortSelector/index.js.map +1 -1
  84. package/dist/StatChart/StatChart.d.ts +2 -2
  85. package/dist/StatChart/StatChart.d.ts.map +1 -1
  86. package/dist/StatChart/StatChart.js +8 -8
  87. package/dist/StatChart/StatChart.js.map +1 -1
  88. package/dist/StatChart/calculateFontSize.js +7 -7
  89. package/dist/StatChart/calculateFontSize.js.map +1 -1
  90. package/dist/StatChart/index.js.map +1 -1
  91. package/dist/Table/InnerTable.js.map +1 -1
  92. package/dist/Table/Table.js.map +1 -1
  93. package/dist/Table/TableBody.js.map +1 -1
  94. package/dist/Table/TableCell.js +2 -2
  95. package/dist/Table/TableCell.js.map +1 -1
  96. package/dist/Table/TableCheckbox.js.map +1 -1
  97. package/dist/Table/TableHead.js.map +1 -1
  98. package/dist/Table/TableHeaderCell.js.map +1 -1
  99. package/dist/Table/TableRow.js.map +1 -1
  100. package/dist/Table/VirtualizedTable.js +6 -6
  101. package/dist/Table/VirtualizedTable.js.map +1 -1
  102. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  103. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  104. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +20 -20
  105. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  106. package/dist/Table/index.js.map +1 -1
  107. package/dist/Table/model/table-model.js +9 -9
  108. package/dist/Table/model/table-model.js.map +1 -1
  109. package/dist/ThresholdsEditor/ThresholdColorPicker.js +2 -2
  110. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -1
  111. package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
  112. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  113. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  114. package/dist/ThresholdsEditor/ThresholdsEditor.js +19 -18
  115. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  116. package/dist/ThresholdsEditor/index.js.map +1 -1
  117. package/dist/TimeChart/TimeChart.d.ts +3 -3
  118. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  119. package/dist/TimeChart/TimeChart.js +109 -66
  120. package/dist/TimeChart/TimeChart.js.map +1 -1
  121. package/dist/TimeChart/index.js.map +1 -1
  122. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +3 -2
  123. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  124. package/dist/TimeSeriesTooltip/LineChartTooltip.js +12 -10
  125. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  126. package/dist/TimeSeriesTooltip/SeriesInfo.js +2 -2
  127. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  128. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  129. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  130. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +3 -2
  131. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  132. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +7 -6
  133. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  134. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  135. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +1 -0
  136. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  137. package/dist/TimeSeriesTooltip/TooltipHeader.js +11 -11
  138. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  139. package/dist/TimeSeriesTooltip/index.js.map +1 -1
  140. package/dist/TimeSeriesTooltip/nearby-series.d.ts +7 -7
  141. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  142. package/dist/TimeSeriesTooltip/nearby-series.js +42 -43
  143. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  144. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +13 -22
  145. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  146. package/dist/TimeSeriesTooltip/tooltip-model.js +10 -10
  147. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  148. package/dist/TimeSeriesTooltip/utils.d.ts +1 -1
  149. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  150. package/dist/TimeSeriesTooltip/utils.js +5 -4
  151. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  152. package/dist/YAxisLabel.js.map +1 -1
  153. package/dist/cjs/BarChart/BarChart.js +24 -16
  154. package/dist/cjs/BarChart/index.js +10 -8
  155. package/dist/cjs/ColorPicker/ColorPicker.js +15 -13
  156. package/dist/cjs/ColorPicker/index.js +10 -8
  157. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +12 -10
  158. package/dist/cjs/ContentWithLegend/index.js +10 -8
  159. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +27 -23
  160. package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +29 -43
  161. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +12 -10
  162. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +13 -11
  163. package/dist/cjs/DateTimeRangePicker/index.js +12 -10
  164. package/dist/cjs/DateTimeRangePicker/utils.js +9 -5
  165. package/dist/cjs/Dialog/Dialog.js +15 -13
  166. package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +11 -9
  167. package/dist/cjs/Dialog/index.js +11 -9
  168. package/dist/cjs/Drawer/Drawer.js +7 -4
  169. package/dist/cjs/Drawer/index.js +10 -8
  170. package/dist/cjs/EChart/EChart.js +12 -10
  171. package/dist/cjs/EChart/index.js +10 -8
  172. package/dist/cjs/ErrorAlert.js +5 -3
  173. package/dist/cjs/ErrorBoundary.js +4 -2
  174. package/dist/cjs/FontSizeSelector/FontSizeSelector.js +8 -6
  175. package/dist/cjs/FontSizeSelector/index.js +10 -8
  176. package/dist/cjs/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +38 -36
  177. package/dist/cjs/{UnitSelector → FormatControls}/index.js +10 -8
  178. package/dist/cjs/GaugeChart/GaugeChart.js +22 -18
  179. package/dist/cjs/GaugeChart/index.js +10 -8
  180. package/dist/cjs/InfoTooltip/InfoTooltip.js +13 -11
  181. package/dist/cjs/InfoTooltip/index.js +10 -8
  182. package/dist/cjs/JSONEditor.js +19 -16
  183. package/dist/cjs/Legend/CompactLegend.js +9 -7
  184. package/dist/cjs/Legend/Legend.js +15 -13
  185. package/dist/cjs/Legend/LegendColorBadge.js +7 -5
  186. package/dist/cjs/Legend/ListLegend.js +10 -8
  187. package/dist/cjs/Legend/ListLegendItem.js +12 -10
  188. package/dist/cjs/Legend/TableLegend.js +7 -5
  189. package/dist/cjs/Legend/index.js +11 -9
  190. package/dist/cjs/Legend/legend-model.js +3 -1
  191. package/dist/cjs/LineChart/LineChart.js +29 -30
  192. package/dist/cjs/LineChart/index.js +10 -8
  193. package/dist/cjs/ModeSelector/ModeSelector.js +8 -6
  194. package/dist/cjs/ModeSelector/index.js +10 -8
  195. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +6 -4
  196. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +16 -14
  197. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +5 -3
  198. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +11 -9
  199. package/dist/cjs/OptionsEditorLayout/index.js +13 -11
  200. package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +27 -9
  201. package/dist/cjs/RefreshIntervalPicker/index.js +10 -8
  202. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +12 -10
  203. package/dist/cjs/SettingsAutocomplete/index.js +10 -8
  204. package/dist/cjs/SortSelector/SortSelector.js +8 -6
  205. package/dist/cjs/SortSelector/index.js +10 -8
  206. package/dist/cjs/StatChart/StatChart.js +20 -18
  207. package/dist/cjs/StatChart/calculateFontSize.js +10 -8
  208. package/dist/cjs/StatChart/index.js +10 -8
  209. package/dist/cjs/Table/InnerTable.js +5 -3
  210. package/dist/cjs/Table/Table.js +15 -13
  211. package/dist/cjs/Table/TableBody.js +5 -3
  212. package/dist/cjs/Table/TableCell.js +10 -8
  213. package/dist/cjs/Table/TableCheckbox.js +5 -3
  214. package/dist/cjs/Table/TableHead.js +5 -3
  215. package/dist/cjs/Table/TableHeaderCell.js +8 -6
  216. package/dist/cjs/Table/TableRow.js +5 -3
  217. package/dist/cjs/Table/VirtualizedTable.js +32 -30
  218. package/dist/cjs/Table/VirtualizedTableContainer.js +5 -3
  219. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +3 -1
  220. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +23 -21
  221. package/dist/cjs/Table/index.js +14 -10
  222. package/dist/cjs/Table/model/table-model.js +15 -11
  223. package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +15 -13
  224. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +14 -12
  225. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +44 -41
  226. package/dist/cjs/ThresholdsEditor/index.js +10 -8
  227. package/dist/cjs/TimeChart/TimeChart.js +122 -77
  228. package/dist/cjs/TimeChart/index.js +10 -8
  229. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +33 -29
  230. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +17 -15
  231. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +15 -13
  232. package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +5 -3
  233. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +25 -22
  234. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +7 -5
  235. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +36 -34
  236. package/dist/cjs/TimeSeriesTooltip/index.js +19 -17
  237. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +68 -51
  238. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +61 -24
  239. package/dist/cjs/TimeSeriesTooltip/utils.js +19 -14
  240. package/dist/cjs/YAxisLabel.js +6 -4
  241. package/dist/cjs/context/{ChartsThemeProvider.js → ChartsProvider.js} +38 -11
  242. package/dist/cjs/context/SnackbarProvider.js +6 -2
  243. package/dist/cjs/context/TimeZoneProvider.js +13 -7
  244. package/dist/cjs/context/index.js +32 -0
  245. package/dist/cjs/index.js +41 -41
  246. package/dist/cjs/model/graph.js +9 -3
  247. package/dist/cjs/model/index.js +12 -10
  248. package/dist/cjs/test/index.js +10 -8
  249. package/dist/cjs/test/render.js +7 -5
  250. package/dist/cjs/test-utils/index.js +10 -8
  251. package/dist/cjs/test-utils/theme.js +38 -19
  252. package/dist/cjs/theme/component-overrides/alert.js +3 -1
  253. package/dist/cjs/theme/component-overrides/paper.js +3 -1
  254. package/dist/cjs/theme/index.js +10 -8
  255. package/dist/cjs/theme/palette/background.js +6 -2
  256. package/dist/cjs/theme/palette/colors/blue.js +3 -1
  257. package/dist/cjs/theme/palette/colors/common.js +6 -2
  258. package/dist/cjs/theme/palette/colors/green.js +3 -1
  259. package/dist/cjs/theme/palette/colors/grey.js +3 -1
  260. package/dist/cjs/theme/palette/colors/index.js +17 -15
  261. package/dist/cjs/theme/palette/colors/orange.js +3 -1
  262. package/dist/cjs/theme/palette/colors/purple.js +3 -1
  263. package/dist/cjs/theme/palette/colors/red.js +3 -1
  264. package/dist/cjs/theme/palette/error.js +3 -1
  265. package/dist/cjs/theme/palette/grey.js +3 -1
  266. package/dist/cjs/theme/palette/index.js +10 -8
  267. package/dist/cjs/theme/palette/palette-options.js +3 -1
  268. package/dist/cjs/theme/palette/primary.js +3 -1
  269. package/dist/cjs/theme/palette/secondary.js +3 -1
  270. package/dist/cjs/theme/palette/success.js +3 -1
  271. package/dist/cjs/theme/palette/text.js +3 -1
  272. package/dist/cjs/theme/palette/warning.js +3 -1
  273. package/dist/cjs/theme/theme.js +5 -3
  274. package/dist/cjs/theme/typography.js +3 -1
  275. package/dist/cjs/utils/axis.js +11 -7
  276. package/dist/cjs/utils/chart-actions.js +68 -12
  277. package/dist/cjs/utils/combine-sx.js +3 -1
  278. package/dist/cjs/utils/component-ids.js +3 -1
  279. package/dist/cjs/utils/format.js +16 -8
  280. package/dist/cjs/utils/index.js +15 -13
  281. package/dist/cjs/utils/mathjs.js +3 -1
  282. package/dist/cjs/utils/theme-gen.js +16 -18
  283. package/dist/context/ChartsProvider.d.ts +19 -0
  284. package/dist/context/ChartsProvider.d.ts.map +1 -0
  285. package/dist/context/{ChartsThemeProvider.js → ChartsProvider.js} +24 -6
  286. package/dist/context/ChartsProvider.js.map +1 -0
  287. package/dist/context/SnackbarProvider.js.map +1 -1
  288. package/dist/context/TimeZoneProvider.js.map +1 -1
  289. package/dist/context/index.d.ts +4 -0
  290. package/dist/context/index.d.ts.map +1 -0
  291. package/dist/context/index.js +17 -0
  292. package/dist/context/index.js.map +1 -0
  293. package/dist/index.d.ts +2 -4
  294. package/dist/index.d.ts.map +1 -1
  295. package/dist/index.js +2 -4
  296. package/dist/index.js.map +1 -1
  297. package/dist/model/graph.js.map +1 -1
  298. package/dist/model/index.js.map +1 -1
  299. package/dist/test/index.js.map +1 -1
  300. package/dist/test/render.js.map +1 -1
  301. package/dist/test/setup-tests.js.map +1 -1
  302. package/dist/test-utils/index.js.map +1 -1
  303. package/dist/test-utils/theme.d.ts +2 -0
  304. package/dist/test-utils/theme.d.ts.map +1 -1
  305. package/dist/test-utils/theme.js +25 -16
  306. package/dist/test-utils/theme.js.map +1 -1
  307. package/dist/theme/component-overrides/alert.js.map +1 -1
  308. package/dist/theme/component-overrides/paper.js.map +1 -1
  309. package/dist/theme/index.d.ts +1 -0
  310. package/dist/theme/index.d.ts.map +1 -1
  311. package/dist/theme/index.js.map +1 -1
  312. package/dist/theme/palette/background.d.ts.map +1 -1
  313. package/dist/theme/palette/background.js +3 -1
  314. package/dist/theme/palette/background.js.map +1 -1
  315. package/dist/theme/palette/colors/blue.js.map +1 -1
  316. package/dist/theme/palette/colors/common.js.map +1 -1
  317. package/dist/theme/palette/colors/green.js.map +1 -1
  318. package/dist/theme/palette/colors/grey.js.map +1 -1
  319. package/dist/theme/palette/colors/index.js.map +1 -1
  320. package/dist/theme/palette/colors/orange.js.map +1 -1
  321. package/dist/theme/palette/colors/purple.js.map +1 -1
  322. package/dist/theme/palette/colors/red.js.map +1 -1
  323. package/dist/theme/palette/error.js.map +1 -1
  324. package/dist/theme/palette/grey.js.map +1 -1
  325. package/dist/theme/palette/index.js.map +1 -1
  326. package/dist/theme/palette/palette-options.js.map +1 -1
  327. package/dist/theme/palette/primary.js.map +1 -1
  328. package/dist/theme/palette/secondary.js.map +1 -1
  329. package/dist/theme/palette/success.js.map +1 -1
  330. package/dist/theme/palette/text.js.map +1 -1
  331. package/dist/theme/palette/warning.js.map +1 -1
  332. package/dist/theme/theme.js.map +1 -1
  333. package/dist/theme/typography.js.map +1 -1
  334. package/dist/utils/axis.d.ts +4 -4
  335. package/dist/utils/axis.d.ts.map +1 -1
  336. package/dist/utils/axis.js +4 -4
  337. package/dist/utils/axis.js.map +1 -1
  338. package/dist/utils/chart-actions.d.ts +6 -2
  339. package/dist/utils/chart-actions.d.ts.map +1 -1
  340. package/dist/utils/chart-actions.js +51 -7
  341. package/dist/utils/chart-actions.js.map +1 -1
  342. package/dist/utils/combine-sx.js.map +1 -1
  343. package/dist/utils/component-ids.js.map +1 -1
  344. package/dist/utils/format.js.map +1 -1
  345. package/dist/utils/index.js.map +1 -1
  346. package/dist/utils/mathjs.js.map +1 -1
  347. package/dist/utils/theme-gen.d.ts +2 -7
  348. package/dist/utils/theme-gen.d.ts.map +1 -1
  349. package/dist/utils/theme-gen.js +11 -15
  350. package/dist/utils/theme-gen.js.map +1 -1
  351. package/package.json +7 -6
  352. package/dist/UnitSelector/UnitSelector.d.ts +0 -9
  353. package/dist/UnitSelector/UnitSelector.d.ts.map +0 -1
  354. package/dist/UnitSelector/UnitSelector.js.map +0 -1
  355. package/dist/UnitSelector/index.d.ts +0 -2
  356. package/dist/UnitSelector/index.d.ts.map +0 -1
  357. package/dist/UnitSelector/index.js.map +0 -1
  358. package/dist/context/ChartsThemeProvider.d.ts +0 -10
  359. package/dist/context/ChartsThemeProvider.d.ts.map +0 -1
  360. package/dist/context/ChartsThemeProvider.js.map +0 -1
@@ -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 { DatapointInfo } 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, totalSeries: number) {\n if (chart.dispatchAction !== undefined) {\n for (let i = 0; i < totalSeries; i++) {\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: i,\n });\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"],"names":["enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","totalSeries","i","seriesIndex","getPointInGrid","cursorCoordX","cursorCoordY","pointInPixel","containPixel","pointInGrid","convertFromPixel","batchDispatchNearbySeriesActions","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","lastEmphasizedDatapoint","dataIndex","escapeConnect","notBlur"],"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;AAajC;;;CAGC,GACD,OAAO,SAASA,cAAc,CAACC,KAAsB,EAAE;IACrD,MAAMC,UAAU,GAAGD,KAAK,CAAC,QAAQ,CAAC,AAAC;IACnC,IAAIC,UAAU,KAAKC,SAAS,EAAE,OAAO;IACrC,IAAID,UAAU,CAACE,MAAM,CAACC,OAAO,KAAKF,SAAS,IAAID,UAAU,CAACE,MAAM,CAACC,OAAO,CAACC,MAAM,GAAG,CAAC,EAAE;QACnF,wGAAwG;QACxG,IAAIJ,UAAU,CAACE,MAAM,CAACC,OAAO,CAAC,CAAC,CAAC,CAACE,OAAO,CAACC,QAAQ,CAACC,UAAU,CAACC,IAAI,KAAK,QAAQ,EAAE;YAC9ET,KAAK,CAACU,cAAc,CAAC;gBACnBC,IAAI,EAAE,kBAAkB;gBACxBC,GAAG,EAAE,gBAAgB;gBACrBC,oBAAoB,EAAE,IAAI;aAC3B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC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C1B,MAAM,GAAG,CAAC,CAAC,GACnDyB,oBAAoB,CAACA,oBAAoB,CAACzB,MAAM,GAAG,CAAC,CAAC,AAAC;IAC5D,IAAI2B,uBAAuB,KAAK9B,SAAS,EAAE;QACzC,2DAA2D;QAC3D,yEAAyE;QACzEF,KAAK,CAACU,cAAc,CAAC;YACnBC,IAAI,EAAE,QAAQ;YACdO,WAAW,EAAEc,uBAAuB,CAACd,WAAW;YAChDe,SAAS,EAAED,uBAAuB,CAACC,SAAS;YAC5C,uEAAuE;YACvEC,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;IACL,CAAC;IAED,8DAA8D;IAC9D,+EAA+E;IAC/ElC,KAAK,CAACU,cAAc,CAAC;QACnBC,IAAI,EAAE,UAAU;QAChBO,WAAW,EAAEW,0BAA0B;KACxC,CAAC,CAAC;IAEH,0DAA0D;IAC1D,IAAID,uBAAuB,CAACvB,MAAM,GAAG,CAAC,EAAE;QACtC,uDAAuD;QACvDL,KAAK,CAACU,cAAc,CAAC;YACnBC,IAAI,EAAE,WAAW;YACjBO,WAAW,EAAEU,uBAAuB;YACpCO,OAAO,EAAE,KAAK;YACdD,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;IACL,OAAO;QACL,2FAA2F;QAC3FlC,KAAK,CAACU,cAAc,CAAC;YACnBC,IAAI,EAAE,WAAW;YACjBO,WAAW,EAAES,mBAAmB;YAChCQ,OAAO,EAAE,IAAI;YACbD,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QAEH,mGAAmG;QACnGlC,KAAK,CAACU,cAAc,CAAC;YACnBC,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
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 == null) 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,OAAOC,YAAYF,aAAaD,WAAWE,OAAOC,QAAQC,SAAS,GAAG;QACnF,wGAAwG;QACxG,IAAIJ,WAAWE,OAAOC,OAAO,CAAC,EAAE,CAACE,QAAQC,SAASC,WAAWC,SAAS,UAAU;YAC9ET,MAAMU,eAAe;gBACnBC,MAAM;gBACNC,KAAK;gBACLC,sBAAsB;YACxB;QACF;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASC,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 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 { SxProps, Theme } from '@mui/material';\n\n/**\n * Combines sx props from multiple sources. Useful when creating a component and\n * you want consumers to be able to provide SxProps that should be combined with\n * some built-in styles.\n */\nexport function combineSx(...sxProps: Array<SxProps<Theme> | undefined>): SxProps<Theme> {\n return sxProps.flatMap((sx) => {\n if (sx === undefined) return [];\n if (Array.isArray(sx)) return sx;\n return [sx];\n });\n}\n"],"names":["combineSx","sxProps","flatMap","sx","undefined","Array","isArray"],"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;;;;CAIC,GACD,OAAO,SAASA,SAAS,CAAC,GAAGC,OAAO,AAAmC,EAAkB;IACvF,OAAOA,OAAO,CAACC,OAAO,CAAC,CAACC,EAAE,GAAK;QAC7B,IAAIA,EAAE,KAAKC,SAAS,EAAE,OAAO,EAAE,CAAC;QAChC,IAAIC,KAAK,CAACC,OAAO,CAACH,EAAE,CAAC,EAAE,OAAOA,EAAE,CAAC;QACjC,OAAO;YAACA,EAAE;SAAC,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/combine-sx.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 { SxProps, Theme } from '@mui/material';\n\n/**\n * Combines sx props from multiple sources. Useful when creating a component and\n * you want consumers to be able to provide SxProps that should be combined with\n * some built-in styles.\n */\nexport function combineSx(...sxProps: Array<SxProps<Theme> | undefined>): SxProps<Theme> {\n return sxProps.flatMap((sx) => {\n if (sx === undefined) return [];\n if (Array.isArray(sx)) return sx;\n return [sx];\n });\n}\n"],"names":["combineSx","sxProps","flatMap","sx","undefined","Array","isArray"],"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;;;;CAIC,GACD,OAAO,SAASA,UAAU,GAAGC,OAA0C;IACrE,OAAOA,QAAQC,QAAQ,CAACC;QACtB,IAAIA,OAAOC,WAAW,OAAO,EAAE;QAC/B,IAAIC,MAAMC,QAAQH,KAAK,OAAOA;QAC9B,OAAO;YAACA;SAAG;IACb;AACF"}
@@ -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,OAAO,CAAC;AAO/B;;CAEC,GACD,OAAO,SAASC,KAAK,CAACC,MAAc,EAAE;IACpC,IAAIC,UAAU,CAACC,UAAU,KAAKC,SAAS,EAAE;QACvCF,UAAU,CAACC,UAAU,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,MAAME,EAAE,GAAGN,MAAM,CAAqBK,SAAS,CAAC,AAAC;IACjD,IAAIC,EAAE,CAACC,OAAO,KAAKF,SAAS,EAAE;QAC5BC,EAAE,CAACC,OAAO,GAAG,CAAC,EAAEL,MAAM,CAAC,CAAC,EAAEC,UAAU,CAACC,UAAU,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,OAAOE,EAAE,CAACC,OAAO,CAAC;AACpB,CAAC"}
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,eAAeC,WAAW;QACvCF,WAAWC,aAAa;IAC1B;IAEA,MAAME,KAAKN,OAA2BK;IACtC,IAAIC,GAAGC,YAAYF,WAAW;QAC5BC,GAAGC,UAAU,CAAC,EAAEL,OAAO,CAAC,EAAEC,WAAWC,aAAa,CAAC;IACrD;IACA,OAAOE,GAAGC;AACZ"}
@@ -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,aAAa,CAAC;AAC/C,SAASC,MAAM,QAAQ,UAAU,CAAC;AAElC,OAAO,SAASC,6BAA6B,CAACC,iBAA6C,EAAEC,QAAiB,EAAE;IAC9G;;;;GAIC,GACD,IAAIA,QAAQ,EAAE;QACZ,MAAMC,aAAa,GAAGD,QAAQ,CAACE,WAAW,EAAE,AAAC;QAC7C,IAAID,aAAa,KAAK,OAAO,IAAIA,aAAa,KAAK,SAAS,EAAE;YAC5D,OAAO;gBACL,GAAGF,iBAAiB;gBACpBC,QAAQ,EAAEC,aAAa,KAAK,KAAK,GAAG,KAAK,GAAGD,QAAQ;aACrD,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAOD,iBAAiB,CAAC;AAC3B,CAAC;AAED,OA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AED,sEAAsE;AACtE,OAAO,SAASC,qBAAqB,CAACd,OAAe,EAAE;IACrD,MAAMK,KAAK,GAAG,QAAQ,AAAC;IACvB,MAAMU,OAAO,GAAG,UAAU,AAAC;IAC3B,MAAMC,MAAM,GAAG,WAAW,AAAC;IAE3B,oBAAoB;IACpB,IAAIhB,OAAO,GAAGgB,MAAM,GAAG,CAAC,EAAE;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,oBAAoB;IACpB,IAAIhB,OAAO,GAAGgB,MAAM,GAAG,CAAC,EAAE;QACxB,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,6BAA6B;IAC7B,IAAIhB,OAAO,GAAGK,KAAK,GAAG,CAAC,IAAIL,OAAO,GAAGe,OAAO,GAAG,CAAC,EAAE;QAChD,OAAO,WAAW,CAAC,CAAC,QAAQ;IAC9B,CAAC;IAED,uBAAuB;IACvB,IAAIf,OAAO,GAAGK,KAAK,GAAG,CAAC,IAAIL,OAAO,IAAIK,KAAK,GAAG,CAAC,EAAE;QAC/C,OAAO,qBAAqB,CAAC,CAAC,cAAc;IAC9C,CAAC;IAED,OAAO;QACLY,IAAI,EAAE,wCAAwC;QAC9CV,KAAK,EAAE,OAAO;QACdC,GAAG,EAAE,WAAW;KACjB,CAAC;AACJ,CAAC"}
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;QAC/B,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,sBAAAA,KAAAA,IAAAA,SAAUE;IAChC,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,SAAS;IAC7B,OAAO,IAAIN,WAAWK,OAAO;QAC3Bd,kBAAkBgB,QAAQ;QAC1BhB,kBAAkBiB,MAAM;IAC1B;IACA,MAAMC,cAAc,IAAIC,KAAKC,eAAeC,WAAWrB;IACvD,wCAAwC;IACxC,OAAOkB,YAAYpB,OAAOU,OAAOc,QAAQ,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 +1 @@
1
- {"version":3,"sources":["../../src/utils/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 './axis';\nexport * from './chart-actions';\nexport * from './combine-sx';\nexport * from './component-ids';\nexport * from './format';\nexport * from './theme-gen';\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,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/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 './axis';\nexport * from './chart-actions';\nexport * from './combine-sx';\nexport * from './component-ids';\nexport * from './format';\nexport * from './theme-gen';\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,SAAS;AACvB,cAAc,kBAAkB;AAChC,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,WAAW;AACzB,cAAc,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/mathjs.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 { roundDependencies, create } from 'mathjs';\n\n// This ensures we get a minimal mathjs bundle for just what we need (see https://mathjs.org/docs/custom_bundling.html)\nconst { round } = create({ roundDependencies });\nexport { round };\n"],"names":["roundDependencies","create","round"],"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,iBAAiB,EAAEC,MAAM,QAAQ,QAAQ,CAAC;AAEnD,uHAAuH;AACvH,MAAM,EAAEC,KAAK,CAAA,EAAE,GAAGD,MAAM,CAAC;IAAED,iBAAiB;CAAE,CAAC,AAAC;AAChD,SAASE,KAAK,GAAG"}
1
+ {"version":3,"sources":["../../src/utils/mathjs.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 { roundDependencies, create } from 'mathjs';\n\n// This ensures we get a minimal mathjs bundle for just what we need (see https://mathjs.org/docs/custom_bundling.html)\nconst { round } = create({ roundDependencies });\nexport { round };\n"],"names":["roundDependencies","create","round"],"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,iBAAiB,EAAEC,MAAM,QAAQ,SAAS;AAEnD,uHAAuH;AACvH,MAAM,EAAEC,MAAK,EAAE,GAAGD,OAAO;IAAED;AAAkB;AAC7C,SAASE,KAAK,GAAG"}
@@ -1,11 +1,6 @@
1
1
  import { Theme } from '@mui/material';
2
- import { EChartsTheme, PersesChartsTheme } from '../model';
2
+ import { PersesChartsTheme } from '../model';
3
3
  declare type MuiTheme = Omit<Theme, 'components'>;
4
- export declare function generateChartsTheme(muiTheme: MuiTheme, echartsTheme: EChartsTheme,
5
- /**
6
- * The id of the container that will have the chart tooltip appended to it.
7
- * By default, chart tooltip uses the body of the top-level document object.
8
- */
9
- tooltipPortalContainerId?: string): PersesChartsTheme;
4
+ export declare function generateChartsTheme(muiTheme: MuiTheme, persesChartsThemeOverride: Partial<PersesChartsTheme>): PersesChartsTheme;
10
5
  export {};
11
6
  //# sourceMappingURL=theme-gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-gen.d.ts","sourceRoot":"","sources":["../../src/utils/theme-gen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK3D,aAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAE1C,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY;AAC1B;;;GAGG;AACH,wBAAwB,CAAC,EAAE,MAAM,GAChC,iBAAiB,CA+OnB"}
1
+ {"version":3,"file":"theme-gen.d.ts","sourceRoot":"","sources":["../../src/utils/theme-gen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAgB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK3D,aAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAE1C,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,EAClB,yBAAyB,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACpD,iBAAiB,CAiPnB"}
@@ -12,13 +12,10 @@
12
12
  // limitations under the License.
13
13
  import merge from 'lodash/merge';
14
14
  const DEFAULT_TEXT_COLOR = '#222';
15
- export function generateChartsTheme(muiTheme, echartsTheme, /**
16
- * The id of the container that will have the chart tooltip appended to it.
17
- * By default, chart tooltip uses the body of the top-level document object.
18
- */ tooltipPortalContainerId) {
19
- var ref, ref1, ref2, ref3, ref4, ref5, ref6;
20
- var ref7;
21
- const primaryTextColor = (ref7 = (ref = muiTheme.palette.text) === null || ref === void 0 ? void 0 : ref.primary) !== null && ref7 !== void 0 ? ref7 : DEFAULT_TEXT_COLOR;
15
+ export function generateChartsTheme(muiTheme, persesChartsThemeOverride) {
16
+ var _muiTheme_palette_text, _muiTheme_palette, _muiTheme_palette_action, _muiTheme_palette1, _muiTheme_palette_action1, _muiTheme_palette_designSystem, _muiTheme_palette_designSystem1;
17
+ var _muiTheme_palette_text_primary;
18
+ const primaryTextColor = (_muiTheme_palette_text_primary = (_muiTheme_palette_text = muiTheme.palette.text) === null || _muiTheme_palette_text === void 0 ? void 0 : _muiTheme_palette_text.primary) !== null && _muiTheme_palette_text_primary !== void 0 ? _muiTheme_palette_text_primary : DEFAULT_TEXT_COLOR;
22
19
  const muiConvertedTheme = {
23
20
  title: {
24
21
  show: false
@@ -145,8 +142,8 @@ export function generateChartsTheme(muiTheme, echartsTheme, /**
145
142
  pageTextStyle: {
146
143
  color: muiTheme.palette.grey[600]
147
144
  },
148
- pageIconColor: muiTheme === null || muiTheme === void 0 ? void 0 : (ref1 = muiTheme.palette) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.action) === null || ref2 === void 0 ? void 0 : ref2.active,
149
- pageIconInactiveColor: muiTheme === null || muiTheme === void 0 ? void 0 : (ref3 = muiTheme.palette) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.action) === null || ref4 === void 0 ? void 0 : ref4.disabled
145
+ pageIconColor: muiTheme === null || muiTheme === void 0 ? void 0 : (_muiTheme_palette = muiTheme.palette) === null || _muiTheme_palette === void 0 ? void 0 : (_muiTheme_palette_action = _muiTheme_palette.action) === null || _muiTheme_palette_action === void 0 ? void 0 : _muiTheme_palette_action.active,
146
+ pageIconInactiveColor: muiTheme === null || muiTheme === void 0 ? void 0 : (_muiTheme_palette1 = muiTheme.palette) === null || _muiTheme_palette1 === void 0 ? void 0 : (_muiTheme_palette_action1 = _muiTheme_palette1.action) === null || _muiTheme_palette_action1 === void 0 ? void 0 : _muiTheme_palette_action1.disabled
150
147
  },
151
148
  toolbox: {
152
149
  show: true,
@@ -157,8 +154,8 @@ export function generateChartsTheme(muiTheme, echartsTheme, /**
157
154
  }
158
155
  },
159
156
  tooltip: {
160
- backgroundColor: (ref5 = muiTheme.palette.designSystem) === null || ref5 === void 0 ? void 0 : ref5.grey[800],
161
- borderColor: (ref6 = muiTheme.palette.designSystem) === null || ref6 === void 0 ? void 0 : ref6.grey[800],
157
+ backgroundColor: (_muiTheme_palette_designSystem = muiTheme.palette.designSystem) === null || _muiTheme_palette_designSystem === void 0 ? void 0 : _muiTheme_palette_designSystem.grey[800],
158
+ borderColor: (_muiTheme_palette_designSystem1 = muiTheme.palette.designSystem) === null || _muiTheme_palette_designSystem1 === void 0 ? void 0 : _muiTheme_palette_designSystem1.grey[800],
162
159
  textStyle: {
163
160
  color: '#fff',
164
161
  fontSize: 11
@@ -222,9 +219,8 @@ export function generateChartsTheme(muiTheme, echartsTheme, /**
222
219
  splitNumber: 12
223
220
  }
224
221
  };
225
- return {
226
- tooltipPortalContainerId,
227
- echartsTheme: merge(muiConvertedTheme, echartsTheme),
222
+ return merge({
223
+ echartsTheme: muiConvertedTheme,
228
224
  noDataOption: {
229
225
  title: {
230
226
  show: true,
@@ -261,7 +257,7 @@ export function generateChartsTheme(muiTheme, echartsTheme, /**
261
257
  muiTheme.palette.error.main
262
258
  ]
263
259
  }
264
- };
260
+ }, persesChartsThemeOverride);
265
261
  }
266
262
 
267
263
  //# sourceMappingURL=theme-gen.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/theme-gen.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 { Theme } from '@mui/material';\nimport merge from 'lodash/merge';\nimport { EChartsTheme, PersesChartsTheme } from '../model';\n\nconst DEFAULT_TEXT_COLOR = '#222';\n\n// avoid component override type errors since only palette and typography are used\ntype MuiTheme = Omit<Theme, 'components'>;\n\nexport function generateChartsTheme(\n muiTheme: MuiTheme,\n echartsTheme: EChartsTheme,\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, chart tooltip uses the body of the top-level document object.\n */\n tooltipPortalContainerId?: string\n): PersesChartsTheme {\n const primaryTextColor = muiTheme.palette.text?.primary ?? DEFAULT_TEXT_COLOR;\n\n const muiConvertedTheme: EChartsTheme = {\n title: {\n show: false,\n },\n textStyle: {\n color: primaryTextColor,\n fontFamily: muiTheme.typography.fontFamily,\n fontSize: 12,\n },\n grid: {\n top: 5,\n right: 20,\n bottom: 0,\n left: 20,\n containLabel: true,\n },\n // Accessible categorical palette from: https://davidmathlogic.com/colorblind\n color: [\n '#56B4E9', // lt blue\n '#009E73', // med green\n '#0072B2', // dk blue\n '#CC79A7', // lt purple\n '#F0E442', // yellow\n '#E69F00', // orange\n '#D55E00', // red\n ],\n categoryAxis: {\n show: true,\n axisLabel: {\n show: true,\n color: primaryTextColor,\n margin: 15,\n },\n axisTick: {\n show: false,\n length: 6,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.4,\n },\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: [muiTheme.palette.grey[300]],\n },\n },\n },\n timeAxis: {\n show: true,\n axisLabel: {\n show: true,\n color: primaryTextColor,\n margin: 15,\n },\n axisTick: {\n show: false,\n length: 6,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.4,\n },\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: [muiTheme.palette.grey[300]],\n },\n },\n },\n valueAxis: {\n show: true,\n axisLabel: {\n color: primaryTextColor,\n margin: 12,\n },\n axisLine: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.6,\n },\n },\n },\n legend: {\n orient: 'horizontal',\n textStyle: {\n color: primaryTextColor,\n },\n pageTextStyle: {\n color: muiTheme.palette.grey[600],\n },\n pageIconColor: muiTheme?.palette?.action?.active,\n pageIconInactiveColor: muiTheme?.palette?.action?.disabled,\n },\n toolbox: {\n show: true,\n top: 10,\n right: 10,\n iconStyle: {\n borderColor: primaryTextColor,\n },\n },\n tooltip: {\n backgroundColor: muiTheme.palette.designSystem?.grey[800],\n borderColor: muiTheme.palette.designSystem?.grey[800],\n textStyle: {\n color: '#fff',\n fontSize: 11,\n },\n },\n axisPointer: {\n lineStyle: {\n color: muiTheme.palette.grey[500],\n },\n },\n markLine: {\n symbol: 'none',\n symbolSize: 0,\n itemStyle: {\n color: muiTheme.palette.grey[500],\n },\n lineStyle: {\n type: 'dashed',\n width: 1,\n },\n },\n line: {\n showSymbol: false,\n symbol: 'circle',\n symbolSize: 4,\n smooth: false,\n lineStyle: {\n width: 1,\n },\n emphasis: {\n lineStyle: {\n width: 1.5,\n },\n },\n },\n bar: {\n barMaxWidth: 150,\n itemStyle: {\n borderWidth: 0,\n borderRadius: 0,\n borderColor: muiTheme.palette.grey[300],\n },\n label: {\n show: false,\n color: primaryTextColor,\n },\n },\n gauge: {\n detail: {\n fontSize: 18,\n fontWeight: 600,\n valueAnimation: false,\n },\n splitLine: {\n distance: 0,\n length: 4,\n lineStyle: {\n width: 1,\n },\n },\n splitNumber: 12,\n },\n };\n\n return {\n tooltipPortalContainerId,\n echartsTheme: merge(muiConvertedTheme, echartsTheme),\n noDataOption: {\n title: {\n show: true,\n textStyle: {\n color: primaryTextColor,\n fontSize: 16,\n fontWeight: 400,\n },\n text: 'No data',\n left: 'center',\n top: 'center',\n },\n xAxis: {\n show: false,\n },\n yAxis: {\n show: false,\n },\n },\n sparkline: {\n width: 2,\n color: '#1976d2',\n },\n container: {\n padding: {\n default: parseInt(muiTheme.spacing(1.5), 10),\n },\n },\n thresholds: {\n defaultColor: muiTheme.palette.success.main,\n palette: ['#FFCC00', muiTheme.palette.warning.main, muiTheme.palette.error.main],\n },\n };\n}\n"],"names":["merge","DEFAULT_TEXT_COLOR","generateChartsTheme","muiTheme","echartsTheme","tooltipPortalContainerId","primaryTextColor","palette","text","primary","muiConvertedTheme","title","show","textStyle","color","fontFamily","typography","fontSize","grid","top","right","bottom","left","containLabel","categoryAxis","axisLabel","margin","axisTick","length","lineStyle","grey","axisLine","splitLine","width","opacity","splitArea","areaStyle","timeAxis","valueAxis","legend","orient","pageTextStyle","pageIconColor","action","active","pageIconInactiveColor","disabled","toolbox","iconStyle","borderColor","tooltip","backgroundColor","designSystem","axisPointer","markLine","symbol","symbolSize","itemStyle","type","line","showSymbol","smooth","emphasis","bar","barMaxWidth","borderWidth","borderRadius","label","gauge","detail","fontWeight","valueAnimation","distance","splitNumber","noDataOption","xAxis","yAxis","sparkline","container","padding","default","parseInt","spacing","thresholds","defaultColor","success","main","warning","error"],"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;AAGjC,OAAOA,KAAK,MAAM,cAAc,CAAC;AAGjC,MAAMC,kBAAkB,GAAG,MAAM,AAAC;AAKlC,OAAO,SAASC,mBAAmB,CACjCC,QAAkB,EAClBC,YAA0B,EAC1B;;;GAGC,GACDC,wBAAiC,EACd;QACMF,GAAqB,EA4H3BA,IAAiB,QACTA,IAAiB,QAWvBA,IAA6B,EACjCA,IAA6B;QAzIrBA,IAA8B;IAAvD,MAAMG,gBAAgB,GAAGH,CAAAA,IAA8B,GAA9BA,CAAAA,GAAqB,GAArBA,QAAQ,CAACI,OAAO,CAACC,IAAI,cAArBL,GAAqB,WAAS,GAA9BA,KAAAA,CAA8B,GAA9BA,GAAqB,CAAEM,OAAO,cAA9BN,IAA8B,cAA9BA,IAA8B,GAAIF,kBAAkB,AAAC;IAE9E,MAAMS,iBAAiB,GAAiB;QACtCC,KAAK,EAAE;YACLC,IAAI,EAAE,KAAK;SACZ;QACDC,SAAS,EAAE;YACTC,KAAK,EAAER,gBAAgB;YACvBS,UAAU,EAAEZ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AAK,CAACU,iBAAiB,EAAEN,YAAY,CAAC;QACpDsE,YAAY,EAAE;YACZ/D,KAAK,EAAE;gBACLC,IAAI,EAAE,IAAI;gBACVC,SAAS,EAAE;oBACTC,KAAK,EAAER,gBAAgB;oBACvBW,QAAQ,EAAE,EAAE;oBACZqD,UAAU,EAAE,GAAG;iBAChB;gBACD9D,IAAI,EAAE,SAAS;gBACfc,IAAI,EAAE,QAAQ;gBACdH,GAAG,EAAE,QAAQ;aACd;YACDwD,KAAK,EAAE;gBACL/D,IAAI,EAAE,KAAK;aACZ;YACDgE,KAAK,EAAE;gBACLhE,IAAI,EAAE,KAAK;aACZ;SACF;QACDiE,SAAS,EAAE;YACT5C,KAAK,EAAE,CAAC;YACRnB,KAAK,EAAE,SAAS;SACjB;QACDgE,SAAS,EAAE;YACTC,OAAO,EAAE;gBACPC,OAAO,EAAEC,QAAQ,CAAC9E,QAAQ,CAAC+E,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;aAC7C;SACF;QACDC,UAAU,EAAE;YACVC,YAAY,EAAEjF,QAAQ,CAACI,OAAO,CAAC8E,OAAO,CAACC,IAAI;YAC3C/E,OAAO,EAAE;gBAAC,SAAS;gBAAEJ,QAAQ,CAACI,OAAO,CAACgF,OAAO,CAACD,IAAI;gBAAEnF,QAAQ,CAACI,OAAO,CAACiF,KAAK,CAACF,IAAI;aAAC;SACjF;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/theme-gen.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 { Theme } from '@mui/material';\nimport merge from 'lodash/merge';\nimport { EChartsTheme, PersesChartsTheme } from '../model';\n\nconst DEFAULT_TEXT_COLOR = '#222';\n\n// avoid component override type errors since only palette and typography are used\ntype MuiTheme = Omit<Theme, 'components'>;\n\nexport function generateChartsTheme(\n muiTheme: MuiTheme,\n persesChartsThemeOverride: Partial<PersesChartsTheme>\n): PersesChartsTheme {\n const primaryTextColor = muiTheme.palette.text?.primary ?? DEFAULT_TEXT_COLOR;\n\n const muiConvertedTheme: EChartsTheme = {\n title: {\n show: false,\n },\n textStyle: {\n color: primaryTextColor,\n fontFamily: muiTheme.typography.fontFamily,\n fontSize: 12,\n },\n grid: {\n top: 5,\n right: 20,\n bottom: 0,\n left: 20,\n containLabel: true,\n },\n // Accessible categorical palette from: https://davidmathlogic.com/colorblind\n color: [\n '#56B4E9', // lt blue\n '#009E73', // med green\n '#0072B2', // dk blue\n '#CC79A7', // lt purple\n '#F0E442', // yellow\n '#E69F00', // orange\n '#D55E00', // red\n ],\n categoryAxis: {\n show: true,\n axisLabel: {\n show: true,\n color: primaryTextColor,\n margin: 15,\n },\n axisTick: {\n show: false,\n length: 6,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.4,\n },\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: [muiTheme.palette.grey[300]],\n },\n },\n },\n timeAxis: {\n show: true,\n axisLabel: {\n show: true,\n color: primaryTextColor,\n margin: 15,\n },\n axisTick: {\n show: false,\n length: 6,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.4,\n },\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: [muiTheme.palette.grey[300]],\n },\n },\n },\n valueAxis: {\n show: true,\n axisLabel: {\n color: primaryTextColor,\n margin: 12,\n },\n axisLine: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.6,\n },\n },\n },\n legend: {\n orient: 'horizontal',\n textStyle: {\n color: primaryTextColor,\n },\n pageTextStyle: {\n color: muiTheme.palette.grey[600],\n },\n pageIconColor: muiTheme?.palette?.action?.active,\n pageIconInactiveColor: muiTheme?.palette?.action?.disabled,\n },\n toolbox: {\n show: true,\n top: 10,\n right: 10,\n iconStyle: {\n borderColor: primaryTextColor,\n },\n },\n tooltip: {\n backgroundColor: muiTheme.palette.designSystem?.grey[800],\n borderColor: muiTheme.palette.designSystem?.grey[800],\n textStyle: {\n color: '#fff',\n fontSize: 11,\n },\n },\n axisPointer: {\n lineStyle: {\n color: muiTheme.palette.grey[500],\n },\n },\n markLine: {\n symbol: 'none',\n symbolSize: 0,\n itemStyle: {\n color: muiTheme.palette.grey[500],\n },\n lineStyle: {\n type: 'dashed',\n width: 1,\n },\n },\n line: {\n showSymbol: false,\n symbol: 'circle',\n symbolSize: 4,\n smooth: false,\n lineStyle: {\n width: 1,\n },\n emphasis: {\n lineStyle: {\n width: 1.5,\n },\n },\n },\n bar: {\n barMaxWidth: 150,\n itemStyle: {\n borderWidth: 0,\n borderRadius: 0,\n borderColor: muiTheme.palette.grey[300],\n },\n label: {\n show: false,\n color: primaryTextColor,\n },\n },\n gauge: {\n detail: {\n fontSize: 18,\n fontWeight: 600,\n valueAnimation: false,\n },\n splitLine: {\n distance: 0,\n length: 4,\n lineStyle: {\n width: 1,\n },\n },\n splitNumber: 12,\n },\n };\n\n return merge(\n {\n echartsTheme: muiConvertedTheme,\n noDataOption: {\n title: {\n show: true,\n textStyle: {\n color: primaryTextColor,\n fontSize: 16,\n fontWeight: 400,\n },\n text: 'No data',\n left: 'center',\n top: 'center',\n },\n xAxis: {\n show: false,\n },\n yAxis: {\n show: false,\n },\n },\n sparkline: {\n width: 2,\n color: '#1976d2',\n },\n container: {\n padding: {\n default: parseInt(muiTheme.spacing(1.5), 10),\n },\n },\n thresholds: {\n defaultColor: muiTheme.palette.success.main,\n palette: ['#FFCC00', muiTheme.palette.warning.main, muiTheme.palette.error.main],\n },\n },\n persesChartsThemeOverride\n );\n}\n"],"names":["merge","DEFAULT_TEXT_COLOR","generateChartsTheme","muiTheme","persesChartsThemeOverride","primaryTextColor","palette","text","primary","muiConvertedTheme","title","show","textStyle","color","fontFamily","typography","fontSize","grid","top","right","bottom","left","containLabel","categoryAxis","axisLabel","margin","axisTick","length","lineStyle","grey","axisLine","splitLine","width","opacity","splitArea","areaStyle","timeAxis","valueAxis","legend","orient","pageTextStyle","pageIconColor","action","active","pageIconInactiveColor","disabled","toolbox","iconStyle","borderColor","tooltip","backgroundColor","designSystem","axisPointer","markLine","symbol","symbolSize","itemStyle","type","line","showSymbol","smooth","emphasis","bar","barMaxWidth","borderWidth","borderRadius","label","gauge","detail","fontWeight","valueAnimation","distance","splitNumber","echartsTheme","noDataOption","xAxis","yAxis","sparkline","container","padding","default","parseInt","spacing","thresholds","defaultColor","success","main","warning","error"],"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;AAGjC,OAAOA,WAAW,eAAe;AAGjC,MAAMC,qBAAqB;AAK3B,OAAO,SAASC,oBACdC,QAAkB,EAClBC,yBAAqD;QAE5BD,wBA4HNA,6CACQA,+CAWNA,gCACJA;QAzIQA;IAAzB,MAAME,mBAAmBF,CAAAA,iCAAAA,CAAAA,yBAAAA,SAASG,QAAQC,kBAAjBJ,oCAAAA,KAAAA,IAAAA,uBAAuBK,qBAAvBL,4CAAAA,iCAAkCF;IAE3D,MAAM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CAAC,IAAI;YACnC;QACF;QACAwB,UAAU;YACRC,QAAQ;YACRC,YAAY;YACZC,WAAW;gBACT3C,OAAOV,SAASG,QAAQuB,IAAI,CAAC,IAAI;YACnC;YACAD,WAAW;gBACT6B,MAAM;gBACNzB,OAAO;YACT;QACF;QACA0B,MAAM;YACJC,YAAY;YACZL,QAAQ;YACRC,YAAY;YACZK,QAAQ;YACRhC,WAAW;gBACTI,OAAO;YACT;YACA6B,UAAU;gBACRjC,WAAW;oBACTI,OAAO;gBACT;YACF;QACF;QACA8B,KAAK;YACHC,aAAa;YACbP,WAAW;gBACTQ,aAAa;gBACbC,cAAc;gBACdjB,aAAa7C,SAASG,QAAQuB,IAAI,CAAC,IAAI;YACzC;YACAqC,OAAO;gBACLvD,MAAM;gBACNE,OAAOR;YACT;QACF;QACA8D,OAAO;YACLC,QAAQ;gBACNpD,UAAU;gBACVqD,YAAY;gBACZC,gBAAgB;YAClB;YACAvC,WAAW;gBACTwC,UAAU;gBACV5C,QAAQ;gBACRC,WAAW;oBACTI,OAAO;gBACT;YACF;YACAwC,aAAa;QACf;IACF;IAEA,OAAOxE,MACL;QACEyE,cAAchE;QACdiE,cAAc;YACZhE,OAAO;gBACLC,MAAM;gBACNC,WAAW;oBACTC,OAAOR;oBACPW,UAAU;oBACVqD,YAAY;gBACd;gBACA9D,MAAM;gBACNc,MAAM;gBACNH,KAAK;YACP;YACAyD,OAAO;gBACLhE,MAAM;YACR;YACAiE,OAAO;gBACLjE,MAAM;YACR;QACF;QACAkE,WAAW;YACT7C,OAAO;YACPnB,OAAO;QACT;QACAiE,WAAW;YACTC,SAAS;gBACPC,SAASC,SAAS9E,SAAS+E,QAAQ,MAAM;YAC3C;QACF;QACAC,YAAY;YACVC,cAAcjF,SAASG,QAAQ+E,QAAQC;YACvChF,SAAS;gBAAC;gBAAWH,SAASG,QAAQiF,QAAQD;gBAAMnF,SAASG,QAAQkF,MAAMF;aAAK;QAClF;IACF,GACAlF;AAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/components",
3
- "version": "0.0.0-snapshot-panel-extra-content-2-2767e21",
3
+ "version": "0.0.0-snapshot-scatter-chart-embed-8efdfab",
4
4
  "description": "Common UI components used across Perses features",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -27,16 +27,16 @@
27
27
  "build:types": "tsc --project tsconfig.build.json",
28
28
  "type-check": "tsc --noEmit",
29
29
  "start": "concurrently -P \"npm:build:* -- {*}\" -- --watch",
30
- "test": "TZ=UTC jest",
31
- "test:watch": "TZ=UTC jest --watch",
30
+ "test": "cross-env TZ=UTC jest",
31
+ "test:watch": "cross-env TZ=UTC jest --watch",
32
32
  "lint": "eslint src --ext .ts,.tsx",
33
33
  "lint:fix": "eslint --fix src --ext .ts,.tsx"
34
34
  },
35
35
  "dependencies": {
36
36
  "@codemirror/lang-json": "^6.0.1",
37
37
  "@fontsource/lato": "^4.5.10",
38
- "@mui/x-date-pickers": "^5.0.0-beta.1",
39
- "@perses-dev/core": "0.0.0-snapshot-panel-extra-content-2-2767e21",
38
+ "@mui/x-date-pickers": "^6.12.1",
39
+ "@perses-dev/core": "0.0.0-snapshot-scatter-chart-embed-8efdfab",
40
40
  "@tanstack/react-table": "^8.9.1",
41
41
  "@uiw/react-codemirror": "^4.19.1",
42
42
  "date-fns": "^2.28.0",
@@ -45,12 +45,13 @@
45
45
  "lodash": "^4.17.21",
46
46
  "mathjs": "^10.6.4",
47
47
  "mdi-material-ui": "^7.4.0",
48
+ "notistack": "^2.0.5",
48
49
  "react-colorful": "^5.6.1",
49
50
  "react-error-boundary": "^3.1.4",
50
51
  "react-virtuoso": "^4.3.6"
51
52
  },
52
53
  "devDependencies": {
53
- "@perses-dev/storybook": "0.0.0-snapshot-panel-extra-content-2-2767e21"
54
+ "@perses-dev/storybook": "0.0.0-snapshot-scatter-chart-embed-8efdfab"
54
55
  },
55
56
  "peerDependencies": {
56
57
  "@mui/material": "^5.10.0",
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import { UnitOptions } from '@perses-dev/core';
3
- export interface UnitSelectorProps {
4
- value: UnitOptions;
5
- onChange: (unit: UnitOptions) => void;
6
- disabled?: boolean;
7
- }
8
- export declare function UnitSelector({ value, onChange, disabled }: UnitSelectorProps): JSX.Element;
9
- //# sourceMappingURL=UnitSelector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnitSelector.d.ts","sourceRoot":"","sources":["../../src/UnitSelector/UnitSelector.tsx"],"names":[],"mappings":";AAaA,OAAO,EAEL,WAAW,EAKZ,MAAM,kBAAkB,CAAC;AAI1B,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA0BD,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAgB,EAAE,EAAE,iBAAiB,eAsEpF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/UnitSelector/UnitSelector.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.\nimport { Switch, SwitchProps } from '@mui/material';\nimport {\n shouldAbbreviate,\n UnitOptions,\n UNIT_CONFIG,\n UnitConfig,\n isUnitWithDecimalPlaces,\n isUnitWithAbbreviate,\n} from '@perses-dev/core';\nimport { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nexport interface UnitSelectorProps {\n value: UnitOptions;\n onChange: (unit: UnitOptions) => void;\n disabled?: boolean;\n}\n\ntype AutocompleteKindOption = UnitConfig & { id: UnitOptions['kind'] };\n\nconst KIND_OPTIONS: AutocompleteKindOption[] = Object.entries(UNIT_CONFIG)\n .map(([id, config]) => {\n return {\n id: id as UnitOptions['kind'],\n ...config,\n };\n })\n .filter((config) => !config.disableSelectorOption);\n\nconst DECIMAL_PLACES_OPTIONS = [\n { id: 'default', label: 'Default', decimal_places: undefined },\n { id: '0', label: '0', decimal_places: 0 },\n { id: '1', label: '1', decimal_places: 1 },\n { id: '2', label: '2', decimal_places: 2 },\n { id: '3', label: '3', decimal_places: 3 },\n { id: '4', label: '4', decimal_places: 4 },\n];\n\nfunction getOptionByDecimalPlaces(decimal_places?: number) {\n return DECIMAL_PLACES_OPTIONS.find((o) => o.decimal_places === decimal_places);\n}\n\nexport function UnitSelector({ value, onChange, disabled = false }: UnitSelectorProps) {\n const hasDecimalPlaces = isUnitWithDecimalPlaces(value);\n const hasAbbreviate = isUnitWithAbbreviate(value);\n\n const handleKindChange = (_: unknown, newValue: AutocompleteKindOption) => {\n onChange({\n kind: newValue.id,\n });\n };\n\n const handleDecimalPlacesChange = (_: unknown, { decimal_places }: { decimal_places: number | undefined }) => {\n if (hasDecimalPlaces) {\n onChange({\n ...value,\n decimal_places: decimal_places,\n });\n }\n };\n\n const handleAbbreviateChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n if (hasAbbreviate) {\n onChange({\n ...value,\n abbreviate: checked,\n });\n }\n };\n\n const kindConfig = UNIT_CONFIG[value.kind];\n\n return (\n <>\n <OptionsEditorControl\n label=\"Abbreviate\"\n control={\n <Switch\n checked={hasAbbreviate ? shouldAbbreviate(value.abbreviate) : false}\n onChange={handleAbbreviateChange}\n disabled={!hasAbbreviate}\n />\n }\n />\n <OptionsEditorControl\n label=\"Unit\"\n control={\n <SettingsAutocomplete\n value={{ id: value.kind, ...kindConfig }}\n options={KIND_OPTIONS}\n groupBy={(option) => option.group}\n onChange={handleKindChange}\n disableClearable\n disabled={disabled}\n ></SettingsAutocomplete>\n }\n />\n <OptionsEditorControl\n label=\"Decimals\"\n control={\n <SettingsAutocomplete\n value={getOptionByDecimalPlaces(value.decimal_places)}\n options={DECIMAL_PLACES_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleDecimalPlacesChange}\n disabled={!hasDecimalPlaces}\n disableClearable\n />\n }\n />\n </>\n );\n}\n"],"names":["Switch","shouldAbbreviate","UNIT_CONFIG","isUnitWithDecimalPlaces","isUnitWithAbbreviate","OptionsEditorControl","SettingsAutocomplete","KIND_OPTIONS","Object","entries","map","id","config","filter","disableSelectorOption","DECIMAL_PLACES_OPTIONS","label","decimal_places","undefined","getOptionByDecimalPlaces","find","o","UnitSelector","value","onChange","disabled","hasDecimalPlaces","hasAbbreviate","handleKindChange","_","newValue","kind","handleDecimalPlacesChange","handleAbbreviateChange","checked","abbreviate","kindConfig","control","options","groupBy","option","group","disableClearable","getOptionLabel"],"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;AACjC;AAAA,SAASA,MAAM,QAAqB,eAAe,CAAC;AACpD,SACEC,gBAAgB,EAEhBC,WAAW,EAEXC,uBAAuB,EACvBC,oBAAoB,QACf,kBAAkB,CAAC;AAC1B,SAASC,oBAAoB,QAAQ,wBAAwB,CAAC;AAC9D,SAASC,oBAAoB,QAAQ,yBAAyB,CAAC;AAU/D,MAAMC,YAAY,GAA6BC,MAAM,CAACC,OAAO,CAACP,WAAW,CAAC,CACvEQ,GAAG,CAAC,CAAC,CAACC,EAAE,EAAEC,MAAM,CAAC,GAAK;IACrB,OAAO;QACLD,EAAE,EAAEA,EAAE;QACN,GAAGC,MAAM;KACV,CAAC;AACJ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CAACN,cAAc,CAAC;oBACrDqB,OAAO,EAAEvB,sBAAsB;oBAC/B4B,cAAc,EAAE,CAACtB,CAAC,GAAKA,CAAC,CAACL,KAAK;oBAC9BQ,QAAQ,EAAEQ,yBAAyB;oBACnCP,QAAQ,EAAE,CAACC,gBAAgB;oBAC3BgB,gBAAgB;kBAChB;cAEJ;;MACD,CACH;AACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './UnitSelector';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/UnitSelector/index.ts"],"names":[],"mappings":"AAaA,cAAc,gBAAgB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/UnitSelector/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 './UnitSelector';\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,gBAAgB,CAAC"}
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { PersesChartsTheme } from '../model';
3
- export interface ChartsThemeProviderProps {
4
- chartsTheme?: PersesChartsTheme;
5
- children?: React.ReactNode;
6
- }
7
- export declare function ChartsThemeProvider(props: ChartsThemeProviderProps): JSX.Element;
8
- export declare const ChartsThemeContext: React.Context<PersesChartsTheme | undefined>;
9
- export declare function useChartsTheme(): PersesChartsTheme;
10
- //# sourceMappingURL=ChartsThemeProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChartsThemeProvider.d.ts","sourceRoot":"","sources":["../../src/context/ChartsThemeProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,WAAW,wBAAwB;IACvC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,eAGlE;AAED,eAAO,MAAM,kBAAkB,8CAA0D,CAAC;AAE1F,wBAAgB,cAAc,IAAI,iBAAiB,CAMlD"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/context/ChartsThemeProvider.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 { PersesChartsTheme } from '../model';\n\nexport interface ChartsThemeProviderProps {\n chartsTheme?: PersesChartsTheme;\n children?: React.ReactNode;\n}\n\nexport function ChartsThemeProvider(props: ChartsThemeProviderProps) {\n const { children, chartsTheme } = props;\n return <ChartsThemeContext.Provider value={chartsTheme}>{children}</ChartsThemeContext.Provider>;\n}\n\nexport const ChartsThemeContext = createContext<PersesChartsTheme | undefined>(undefined);\n\nexport function useChartsTheme(): PersesChartsTheme {\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"],"names":["React","createContext","useContext","ChartsThemeProvider","props","children","chartsTheme","ChartsThemeContext","Provider","value","undefined","useChartsTheme","ctx","Error"],"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;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,QAAQ,OAAO,CAAC;AAQzD,OAAO,SAASC,mBAAmB,CAACC,KAA+B,EAAE;IACnE,MAAM,EAAEC,QAAQ,CAAA,EAAEC,WAAW,CAAA,EAAE,GAAGF,KAAK,AAAC;IACxC,qBAAO,KAACG,kBAAkB,CAACC,QAAQ;QAACC,KAAK,EAAEH,WAAW;kBAAGD,QAAQ;MAA+B,CAAC;AACnG,CAAC;AAED,OAAO,MAAME,kBAAkB,iBAAGN,aAAa,CAAgCS,SAAS,CAAC,CAAC;AAE1F,OAAO,SAASC,cAAc,GAAsB;IAClD,MAAMC,GAAG,GAAGV,UAAU,CAACK,kBAAkB,CAAC,AAAC;IAC3C,IAAIK,GAAG,KAAKF,SAAS,EAAE;QACrB,MAAM,IAAIG,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAOD,GAAG,CAAC;AACb,CAAC"}