@perses-dev/components 0.39.0 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) 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 +8 -8
  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.js.map +1 -1
  24. package/dist/Drawer/index.js.map +1 -1
  25. package/dist/EChart/EChart.js +2 -2
  26. package/dist/EChart/EChart.js.map +1 -1
  27. package/dist/EChart/index.js.map +1 -1
  28. package/dist/ErrorAlert.js.map +1 -1
  29. package/dist/ErrorBoundary.js.map +1 -1
  30. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  31. package/dist/FontSizeSelector/index.js.map +1 -1
  32. package/dist/FormatControls/FormatControls.d.ts +9 -0
  33. package/dist/FormatControls/FormatControls.d.ts.map +1 -0
  34. package/dist/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +26 -26
  35. package/dist/FormatControls/FormatControls.js.map +1 -0
  36. package/dist/FormatControls/index.d.ts +2 -0
  37. package/dist/FormatControls/index.d.ts.map +1 -0
  38. package/dist/{UnitSelector → FormatControls}/index.js +1 -1
  39. package/dist/FormatControls/index.js.map +1 -0
  40. package/dist/GaugeChart/GaugeChart.d.ts +3 -3
  41. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  42. package/dist/GaugeChart/GaugeChart.js +11 -11
  43. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  44. package/dist/GaugeChart/index.js.map +1 -1
  45. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  46. package/dist/InfoTooltip/index.js.map +1 -1
  47. package/dist/JSONEditor.js.map +1 -1
  48. package/dist/Legend/CompactLegend.js.map +1 -1
  49. package/dist/Legend/Legend.js +3 -3
  50. package/dist/Legend/Legend.js.map +1 -1
  51. package/dist/Legend/LegendColorBadge.js.map +1 -1
  52. package/dist/Legend/ListLegend.js.map +1 -1
  53. package/dist/Legend/ListLegendItem.js +2 -2
  54. package/dist/Legend/ListLegendItem.js.map +1 -1
  55. package/dist/Legend/TableLegend.js.map +1 -1
  56. package/dist/Legend/index.js.map +1 -1
  57. package/dist/Legend/legend-model.js.map +1 -1
  58. package/dist/LineChart/LineChart.d.ts +2 -2
  59. package/dist/LineChart/LineChart.d.ts.map +1 -1
  60. package/dist/LineChart/LineChart.js +12 -12
  61. package/dist/LineChart/LineChart.js.map +1 -1
  62. package/dist/LineChart/index.js.map +1 -1
  63. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  64. package/dist/ModeSelector/index.js.map +1 -1
  65. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  66. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  67. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  68. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  69. package/dist/OptionsEditorLayout/index.js.map +1 -1
  70. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  71. package/dist/RefreshIntervalPicker/index.js.map +1 -1
  72. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +2 -2
  73. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  74. package/dist/SettingsAutocomplete/index.js.map +1 -1
  75. package/dist/SortSelector/SortSelector.js.map +1 -1
  76. package/dist/SortSelector/index.js.map +1 -1
  77. package/dist/StatChart/StatChart.d.ts +2 -2
  78. package/dist/StatChart/StatChart.d.ts.map +1 -1
  79. package/dist/StatChart/StatChart.js +7 -7
  80. package/dist/StatChart/StatChart.js.map +1 -1
  81. package/dist/StatChart/calculateFontSize.js +4 -4
  82. package/dist/StatChart/calculateFontSize.js.map +1 -1
  83. package/dist/StatChart/index.js.map +1 -1
  84. package/dist/Table/InnerTable.js.map +1 -1
  85. package/dist/Table/Table.js.map +1 -1
  86. package/dist/Table/TableBody.js.map +1 -1
  87. package/dist/Table/TableCell.js +2 -2
  88. package/dist/Table/TableCell.js.map +1 -1
  89. package/dist/Table/TableCheckbox.js.map +1 -1
  90. package/dist/Table/TableHead.js.map +1 -1
  91. package/dist/Table/TableHeaderCell.js.map +1 -1
  92. package/dist/Table/TableRow.js.map +1 -1
  93. package/dist/Table/VirtualizedTable.js +6 -6
  94. package/dist/Table/VirtualizedTable.js.map +1 -1
  95. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  96. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  97. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +20 -20
  98. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  99. package/dist/Table/index.js.map +1 -1
  100. package/dist/Table/model/table-model.js +9 -9
  101. package/dist/Table/model/table-model.js.map +1 -1
  102. package/dist/ThresholdsEditor/ThresholdColorPicker.js +1 -1
  103. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -1
  104. package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
  105. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  106. package/dist/ThresholdsEditor/ThresholdsEditor.js +17 -17
  107. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  108. package/dist/ThresholdsEditor/index.js.map +1 -1
  109. package/dist/TimeChart/TimeChart.d.ts +2 -2
  110. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  111. package/dist/TimeChart/TimeChart.js +12 -12
  112. package/dist/TimeChart/TimeChart.js.map +1 -1
  113. package/dist/TimeChart/index.js.map +1 -1
  114. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
  115. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  116. package/dist/TimeSeriesTooltip/LineChartTooltip.js +7 -7
  117. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  118. package/dist/TimeSeriesTooltip/SeriesInfo.js +2 -2
  119. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  120. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  121. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  122. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  123. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  124. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +4 -4
  125. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  126. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  127. package/dist/TimeSeriesTooltip/TooltipHeader.js +6 -6
  128. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  129. package/dist/TimeSeriesTooltip/index.js.map +1 -1
  130. package/dist/TimeSeriesTooltip/nearby-series.d.ts +7 -7
  131. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  132. package/dist/TimeSeriesTooltip/nearby-series.js +29 -29
  133. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  134. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  135. package/dist/TimeSeriesTooltip/utils.js +3 -3
  136. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  137. package/dist/YAxisLabel.js.map +1 -1
  138. package/dist/cjs/BarChart/BarChart.js +17 -15
  139. package/dist/cjs/BarChart/index.js +10 -8
  140. package/dist/cjs/ColorPicker/ColorPicker.js +15 -13
  141. package/dist/cjs/ColorPicker/index.js +10 -8
  142. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +12 -10
  143. package/dist/cjs/ContentWithLegend/index.js +10 -8
  144. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +27 -23
  145. package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +29 -43
  146. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +12 -10
  147. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +13 -11
  148. package/dist/cjs/DateTimeRangePicker/index.js +12 -10
  149. package/dist/cjs/DateTimeRangePicker/utils.js +9 -5
  150. package/dist/cjs/Dialog/Dialog.js +15 -13
  151. package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +11 -9
  152. package/dist/cjs/Dialog/index.js +11 -9
  153. package/dist/cjs/Drawer/Drawer.js +5 -3
  154. package/dist/cjs/Drawer/index.js +10 -8
  155. package/dist/cjs/EChart/EChart.js +12 -10
  156. package/dist/cjs/EChart/index.js +10 -8
  157. package/dist/cjs/ErrorAlert.js +5 -3
  158. package/dist/cjs/ErrorBoundary.js +4 -2
  159. package/dist/cjs/FontSizeSelector/FontSizeSelector.js +8 -6
  160. package/dist/cjs/FontSizeSelector/index.js +10 -8
  161. package/dist/cjs/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +38 -36
  162. package/dist/cjs/{UnitSelector → FormatControls}/index.js +10 -8
  163. package/dist/cjs/GaugeChart/GaugeChart.js +22 -18
  164. package/dist/cjs/GaugeChart/index.js +10 -8
  165. package/dist/cjs/InfoTooltip/InfoTooltip.js +13 -11
  166. package/dist/cjs/InfoTooltip/index.js +10 -8
  167. package/dist/cjs/JSONEditor.js +10 -8
  168. package/dist/cjs/Legend/CompactLegend.js +9 -7
  169. package/dist/cjs/Legend/Legend.js +15 -13
  170. package/dist/cjs/Legend/LegendColorBadge.js +7 -5
  171. package/dist/cjs/Legend/ListLegend.js +10 -8
  172. package/dist/cjs/Legend/ListLegendItem.js +12 -10
  173. package/dist/cjs/Legend/TableLegend.js +7 -5
  174. package/dist/cjs/Legend/index.js +11 -9
  175. package/dist/cjs/Legend/legend-model.js +3 -1
  176. package/dist/cjs/LineChart/LineChart.js +24 -22
  177. package/dist/cjs/LineChart/index.js +10 -8
  178. package/dist/cjs/ModeSelector/ModeSelector.js +8 -6
  179. package/dist/cjs/ModeSelector/index.js +10 -8
  180. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +6 -4
  181. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +16 -14
  182. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +5 -3
  183. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +11 -9
  184. package/dist/cjs/OptionsEditorLayout/index.js +13 -11
  185. package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +8 -6
  186. package/dist/cjs/RefreshIntervalPicker/index.js +10 -8
  187. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +12 -10
  188. package/dist/cjs/SettingsAutocomplete/index.js +10 -8
  189. package/dist/cjs/SortSelector/SortSelector.js +8 -6
  190. package/dist/cjs/SortSelector/index.js +10 -8
  191. package/dist/cjs/StatChart/StatChart.js +20 -18
  192. package/dist/cjs/StatChart/calculateFontSize.js +9 -7
  193. package/dist/cjs/StatChart/index.js +10 -8
  194. package/dist/cjs/Table/InnerTable.js +5 -3
  195. package/dist/cjs/Table/Table.js +15 -13
  196. package/dist/cjs/Table/TableBody.js +5 -3
  197. package/dist/cjs/Table/TableCell.js +10 -8
  198. package/dist/cjs/Table/TableCheckbox.js +5 -3
  199. package/dist/cjs/Table/TableHead.js +5 -3
  200. package/dist/cjs/Table/TableHeaderCell.js +8 -6
  201. package/dist/cjs/Table/TableRow.js +5 -3
  202. package/dist/cjs/Table/VirtualizedTable.js +32 -30
  203. package/dist/cjs/Table/VirtualizedTableContainer.js +5 -3
  204. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +3 -1
  205. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +23 -21
  206. package/dist/cjs/Table/index.js +14 -10
  207. package/dist/cjs/Table/model/table-model.js +15 -11
  208. package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +15 -13
  209. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +14 -12
  210. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +44 -42
  211. package/dist/cjs/ThresholdsEditor/index.js +10 -8
  212. package/dist/cjs/TimeChart/TimeChart.js +31 -29
  213. package/dist/cjs/TimeChart/index.js +10 -8
  214. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +28 -26
  215. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +17 -15
  216. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +15 -13
  217. package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +5 -3
  218. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +22 -20
  219. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +7 -5
  220. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +34 -32
  221. package/dist/cjs/TimeSeriesTooltip/index.js +19 -17
  222. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +56 -38
  223. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +51 -17
  224. package/dist/cjs/TimeSeriesTooltip/utils.js +17 -13
  225. package/dist/cjs/YAxisLabel.js +6 -4
  226. package/dist/cjs/context/ChartsProvider.js +16 -8
  227. package/dist/cjs/context/SnackbarProvider.js +6 -2
  228. package/dist/cjs/context/TimeZoneProvider.js +13 -7
  229. package/dist/cjs/context/index.js +12 -10
  230. package/dist/cjs/index.js +41 -39
  231. package/dist/cjs/model/graph.js +9 -3
  232. package/dist/cjs/model/index.js +12 -10
  233. package/dist/cjs/test/index.js +10 -8
  234. package/dist/cjs/test/render.js +7 -5
  235. package/dist/cjs/test-utils/index.js +10 -8
  236. package/dist/cjs/test-utils/theme.js +6 -2
  237. package/dist/cjs/theme/component-overrides/alert.js +3 -1
  238. package/dist/cjs/theme/component-overrides/paper.js +3 -1
  239. package/dist/cjs/theme/index.js +10 -8
  240. package/dist/cjs/theme/palette/background.js +6 -2
  241. package/dist/cjs/theme/palette/colors/blue.js +3 -1
  242. package/dist/cjs/theme/palette/colors/common.js +6 -2
  243. package/dist/cjs/theme/palette/colors/green.js +3 -1
  244. package/dist/cjs/theme/palette/colors/grey.js +3 -1
  245. package/dist/cjs/theme/palette/colors/index.js +17 -15
  246. package/dist/cjs/theme/palette/colors/orange.js +3 -1
  247. package/dist/cjs/theme/palette/colors/purple.js +3 -1
  248. package/dist/cjs/theme/palette/colors/red.js +3 -1
  249. package/dist/cjs/theme/palette/error.js +3 -1
  250. package/dist/cjs/theme/palette/grey.js +3 -1
  251. package/dist/cjs/theme/palette/index.js +10 -8
  252. package/dist/cjs/theme/palette/palette-options.js +3 -1
  253. package/dist/cjs/theme/palette/primary.js +3 -1
  254. package/dist/cjs/theme/palette/secondary.js +3 -1
  255. package/dist/cjs/theme/palette/success.js +3 -1
  256. package/dist/cjs/theme/palette/text.js +3 -1
  257. package/dist/cjs/theme/palette/warning.js +3 -1
  258. package/dist/cjs/theme/theme.js +5 -3
  259. package/dist/cjs/theme/typography.js +3 -1
  260. package/dist/cjs/utils/axis.js +8 -4
  261. package/dist/cjs/utils/chart-actions.js +26 -10
  262. package/dist/cjs/utils/combine-sx.js +3 -1
  263. package/dist/cjs/utils/component-ids.js +3 -1
  264. package/dist/cjs/utils/format.js +16 -8
  265. package/dist/cjs/utils/index.js +15 -13
  266. package/dist/cjs/utils/mathjs.js +3 -1
  267. package/dist/cjs/utils/theme-gen.js +12 -10
  268. package/dist/context/ChartsProvider.js.map +1 -1
  269. package/dist/context/SnackbarProvider.js.map +1 -1
  270. package/dist/context/TimeZoneProvider.js.map +1 -1
  271. package/dist/context/index.js.map +1 -1
  272. package/dist/index.d.ts +1 -1
  273. package/dist/index.d.ts.map +1 -1
  274. package/dist/index.js +1 -1
  275. package/dist/index.js.map +1 -1
  276. package/dist/model/graph.js.map +1 -1
  277. package/dist/model/index.js.map +1 -1
  278. package/dist/test/index.js.map +1 -1
  279. package/dist/test/render.js.map +1 -1
  280. package/dist/test/setup-tests.js.map +1 -1
  281. package/dist/test-utils/index.js.map +1 -1
  282. package/dist/test-utils/theme.js.map +1 -1
  283. package/dist/theme/component-overrides/alert.js.map +1 -1
  284. package/dist/theme/component-overrides/paper.js.map +1 -1
  285. package/dist/theme/index.d.ts +1 -0
  286. package/dist/theme/index.d.ts.map +1 -1
  287. package/dist/theme/index.js.map +1 -1
  288. package/dist/theme/palette/background.d.ts.map +1 -1
  289. package/dist/theme/palette/background.js +3 -1
  290. package/dist/theme/palette/background.js.map +1 -1
  291. package/dist/theme/palette/colors/blue.js.map +1 -1
  292. package/dist/theme/palette/colors/common.js.map +1 -1
  293. package/dist/theme/palette/colors/green.js.map +1 -1
  294. package/dist/theme/palette/colors/grey.js.map +1 -1
  295. package/dist/theme/palette/colors/index.js.map +1 -1
  296. package/dist/theme/palette/colors/orange.js.map +1 -1
  297. package/dist/theme/palette/colors/purple.js.map +1 -1
  298. package/dist/theme/palette/colors/red.js.map +1 -1
  299. package/dist/theme/palette/error.js.map +1 -1
  300. package/dist/theme/palette/grey.js.map +1 -1
  301. package/dist/theme/palette/index.js.map +1 -1
  302. package/dist/theme/palette/palette-options.js.map +1 -1
  303. package/dist/theme/palette/primary.js.map +1 -1
  304. package/dist/theme/palette/secondary.js.map +1 -1
  305. package/dist/theme/palette/success.js.map +1 -1
  306. package/dist/theme/palette/text.js.map +1 -1
  307. package/dist/theme/palette/warning.js.map +1 -1
  308. package/dist/theme/theme.js.map +1 -1
  309. package/dist/theme/typography.js.map +1 -1
  310. package/dist/utils/axis.d.ts +2 -2
  311. package/dist/utils/axis.d.ts.map +1 -1
  312. package/dist/utils/axis.js.map +1 -1
  313. package/dist/utils/chart-actions.js +2 -2
  314. package/dist/utils/chart-actions.js.map +1 -1
  315. package/dist/utils/combine-sx.js.map +1 -1
  316. package/dist/utils/component-ids.js.map +1 -1
  317. package/dist/utils/format.js.map +1 -1
  318. package/dist/utils/index.js.map +1 -1
  319. package/dist/utils/mathjs.js.map +1 -1
  320. package/dist/utils/theme-gen.js +7 -7
  321. package/dist/utils/theme-gen.js.map +1 -1
  322. package/package.json +7 -6
  323. package/dist/UnitSelector/UnitSelector.d.ts +0 -9
  324. package/dist/UnitSelector/UnitSelector.d.ts.map +0 -1
  325. package/dist/UnitSelector/UnitSelector.js.map +0 -1
  326. package/dist/UnitSelector/index.d.ts +0 -2
  327. package/dist/UnitSelector/index.d.ts.map +0 -1
  328. package/dist/UnitSelector/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/DateTimeRangePicker/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 './DateTimeRangePicker';\nexport * from './TimeRangeSelector';\nexport * from './AbsoluteTimePicker';\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,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"sources":["../../src/DateTimeRangePicker/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 './DateTimeRangePicker';\nexport * from './TimeRangeSelector';\nexport * from './AbsoluteTimePicker';\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,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,uBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/DateTimeRangePicker/utils.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 { isBefore, isValid } from 'date-fns';\nimport { AbsoluteTimeRange } from '@perses-dev/core';\nimport { formatWithTimeZone } from '../utils';\n\n/*\n * Date validation and check if end is after start\n */\nexport function validateDateRange(startDate: Date, endDate: Date) {\n // TODO: display error as helperText\n if (!isValid(startDate) || !isValid(endDate)) {\n console.error('Invalid Date');\n return false;\n }\n if (!isBefore(startDate, endDate)) {\n console.error('End Time is before Start Time');\n return false;\n }\n return true;\n}\n\n/**\n * Format start and end time based on provided date format\n */\nexport function formatAbsoluteRange(timeRange: AbsoluteTimeRange, dateFormat: string, timeZone?: string) {\n const formattedStart = formatWithTimeZone(timeRange.start, dateFormat, timeZone);\n const formattedEnd = formatWithTimeZone(timeRange.end, dateFormat, timeZone);\n return `${formattedStart} - ${formattedEnd}`;\n}\n"],"names":["isBefore","isValid","formatWithTimeZone","validateDateRange","startDate","endDate","console","error","formatAbsoluteRange","timeRange","dateFormat","timeZone","formattedStart","start","formattedEnd","end"],"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,QAAQ,EAAEC,OAAO,QAAQ,UAAU,CAAC;AAE7C,SAASC,kBAAkB,QAAQ,UAAU,CAAC;AAE9C;;CAEC,GACD,OAAO,SAASC,iBAAiB,CAACC,SAAe,EAAEC,OAAa,EAAE;IAChE,oCAAoC;IACpC,IAAI,CAACJ,OAAO,CAACG,SAAS,CAAC,IAAI,CAACH,OAAO,CAACI,OAAO,CAAC,EAAE;QAC5CC,OAAO,CAACC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAACP,QAAQ,CAACI,SAAS,EAAEC,OAAO,CAAC,EAAE;QACjCC,OAAO,CAACC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC/C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;CAEC,GACD,OAAO,SAASC,mBAAmB,CAACC,SAA4B,EAAEC,UAAkB,EAAEC,QAAiB,EAAE;IACvG,MAAMC,cAAc,GAAGV,kBAAkB,CAACO,SAAS,CAACI,KAAK,EAAEH,UAAU,EAAEC,QAAQ,CAAC,AAAC;IACjF,MAAMG,YAAY,GAAGZ,kBAAkB,CAACO,SAAS,CAACM,GAAG,EAAEL,UAAU,EAAEC,QAAQ,CAAC,AAAC;IAC7E,OAAO,CAAC,EAAEC,cAAc,CAAC,GAAG,EAAEE,YAAY,CAAC,CAAC,CAAC;AAC/C,CAAC"}
1
+ {"version":3,"sources":["../../src/DateTimeRangePicker/utils.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 { isBefore, isValid } from 'date-fns';\nimport { AbsoluteTimeRange } from '@perses-dev/core';\nimport { formatWithTimeZone } from '../utils';\n\n/*\n * Date validation and check if end is after start\n */\nexport function validateDateRange(startDate: Date, endDate: Date) {\n // TODO: display error as helperText\n if (!isValid(startDate) || !isValid(endDate)) {\n console.error('Invalid Date');\n return false;\n }\n if (!isBefore(startDate, endDate)) {\n console.error('End Time is before Start Time');\n return false;\n }\n return true;\n}\n\n/**\n * Format start and end time based on provided date format\n */\nexport function formatAbsoluteRange(timeRange: AbsoluteTimeRange, dateFormat: string, timeZone?: string) {\n const formattedStart = formatWithTimeZone(timeRange.start, dateFormat, timeZone);\n const formattedEnd = formatWithTimeZone(timeRange.end, dateFormat, timeZone);\n return `${formattedStart} - ${formattedEnd}`;\n}\n"],"names":["isBefore","isValid","formatWithTimeZone","validateDateRange","startDate","endDate","console","error","formatAbsoluteRange","timeRange","dateFormat","timeZone","formattedStart","start","formattedEnd","end"],"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,QAAQ,EAAEC,OAAO,QAAQ,WAAW;AAE7C,SAASC,kBAAkB,QAAQ,WAAW;AAE9C;;CAEC,GACD,OAAO,SAASC,kBAAkBC,SAAe,EAAEC,OAAa;IAC9D,oCAAoC;IACpC,IAAI,CAACJ,QAAQG,cAAc,CAACH,QAAQI,UAAU;QAC5CC,QAAQC,MAAM;QACd,OAAO;IACT;IACA,IAAI,CAACP,SAASI,WAAWC,UAAU;QACjCC,QAAQC,MAAM;QACd,OAAO;IACT;IACA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,SAASC,oBAAoBC,SAA4B,EAAEC,UAAkB,EAAEC,QAAiB;IACrG,MAAMC,iBAAiBV,mBAAmBO,UAAUI,OAAOH,YAAYC;IACvE,MAAMG,eAAeZ,mBAAmBO,UAAUM,KAAKL,YAAYC;IACnE,OAAO,CAAC,EAAEC,eAAe,GAAG,EAAEE,aAAa,CAAC;AAC9C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Dialog/Dialog.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 from 'react';\nimport {\n Button,\n ButtonProps,\n Dialog as MuiDialog,\n DialogActions,\n DialogContent,\n DialogContentProps as MuiDialogContentProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n IconButton,\n styled,\n Theme,\n} from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { combineSx } from '../utils';\n\nexport interface DialogHeaderProps extends DialogTitleProps {\n /**\n * Callback fired when close button is clicked. If undefined, close button will not appear in header.\n */\n onClose?: (e: React.MouseEvent<HTMLElement>) => void;\n}\n\nexport type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;\n\nexport interface DialogContentProps extends MuiDialogContentProps {\n /**\n * @default 500\n */\n width?: number;\n}\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps) => {\n return (\n <>\n <DialogTitle {...props}>{children}</DialogTitle>\n {onClose && (\n <IconButton aria-label=\"Close\" onClick={onClose} sx={dialogCloseIconButtonStyle}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\nconst Content = ({ children, width = 500, sx, ...props }: DialogContentProps) => (\n <DialogContent dividers {...props} sx={combineSx({ width: `${width}px` }, sx)}>\n {children}\n </DialogContent>\n);\n\nconst PrimaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"contained\" type=\"submit\" {...props}>\n {children}\n </Button>\n);\n\nconst SecondaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"outlined\" color=\"secondary\" {...props}>\n {children}\n </Button>\n);\n\n/*\n * Material-ui has a prop \"scroll=paper\" that is specifically for dialog header and actions to be sticky and body to scroll,\n * but that doesn't work when dialog content is wrapped in form.\n * https://github.com/mui-org/material-ui/issues/13253\n * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog\n */\nconst Form = styled('form')({\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n});\n\n/**\n * Render the CSS of the dialog's close button, according to the given material theme.\n * @param theme material theme\n */\nconst dialogCloseIconButtonStyle = (theme: Theme) => {\n return { position: 'absolute', top: theme.spacing(0.5), right: theme.spacing(0.5) };\n};\n\nexport const Dialog = ({ children, ...props }: DialogProps) => <MuiDialog {...props}>{children}</MuiDialog>;\n\nDialog.Header = Header;\nDialog.Form = Form;\nDialog.Content = Content;\nDialog.PrimaryButton = PrimaryButton;\nDialog.SecondaryButton = SecondaryButton;\nDialog.Actions = DialogActions;\n"],"names":["React","Button","Dialog","MuiDialog","DialogActions","DialogContent","DialogTitle","IconButton","styled","CloseIcon","combineSx","Header","children","onClose","props","aria-label","onClick","sx","dialogCloseIconButtonStyle","Content","width","dividers","PrimaryButton","variant","type","SecondaryButton","color","Form","overflowY","display","flexDirection","theme","position","top","spacing","right","Actions"],"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,MAAM,OAAO,CAAC;AAC1B,SACEC,MAAM,EAENC,MAAM,IAAIC,SAAS,EACnBC,aAAa,EACbC,aAAa,EAGbC,WAAW,EAEXC,UAAU,EACVC,MAAM,QAED,eAAe,CAAC;AACvB,OAAOC,SAAS,MAAM,uBAAuB,CAAC;AAC9C,SAASC,SAAS,QAAQ,UAAU,CAAC;AAkBrC,MAAMC,MAAM,GAAG,CAAC,EAAEC,QAAQ,CAAA,EAAEC,OAAO,CAAA,EAAE,GAAGC,KAAK,EAAqB,GAAK;IACrE,qBACE;;0BACE,KAACR,WAAW;gBAAE,GAAGQ,KAAK;0BAAGF,QAAQ;cAAe;YAC/CC,OAAO,kBACN,KAACN,UAAU;gBAACQ,YAAU,EAAC,OAAO;gBAACC,OAAO,EAAEH,OAAO;gBAAEI,EAAE,EAAEC,0BAA0B;0BAC7E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,GAAG,CAAC,EAAEU,QAAQ,CAAA,EAAE,GAAGE,KAAK,EAAe,iBAAK,KAACX,SAAS;QAAE,GAAGW,KAAK;kBAAGF,QAAQ;MAAa,CAAC;AAE5GV,MAAM,CAACS,MAAM,GAAGA,MAAM,CAAC;AACvBT,MAAM,CAACyB,IAAI,GAAGA,IAAI,CAAC;AACnBzB,MAAM,CAACiB,OAAO,GAAGA,OAAO,CAAC;AACzBjB,MAAM,CAACoB,aAAa,GAAGA,aAAa,CAAC;AACrCpB,MAAM,CAACuB,eAAe,GAAGA,eAAe,CAAC;AACzCvB,MAAM,CAACkC,OAAO,GAAGhC,aAAa,CAAC"}
1
+ {"version":3,"sources":["../../src/Dialog/Dialog.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 from 'react';\nimport {\n Button,\n ButtonProps,\n Dialog as MuiDialog,\n DialogActions,\n DialogContent,\n DialogContentProps as MuiDialogContentProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n IconButton,\n styled,\n Theme,\n} from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { combineSx } from '../utils';\n\nexport interface DialogHeaderProps extends DialogTitleProps {\n /**\n * Callback fired when close button is clicked. If undefined, close button will not appear in header.\n */\n onClose?: (e: React.MouseEvent<HTMLElement>) => void;\n}\n\nexport type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;\n\nexport interface DialogContentProps extends MuiDialogContentProps {\n /**\n * @default 500\n */\n width?: number;\n}\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps) => {\n return (\n <>\n <DialogTitle {...props}>{children}</DialogTitle>\n {onClose && (\n <IconButton aria-label=\"Close\" onClick={onClose} sx={dialogCloseIconButtonStyle}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\nconst Content = ({ children, width = 500, sx, ...props }: DialogContentProps) => (\n <DialogContent dividers {...props} sx={combineSx({ width: `${width}px` }, sx)}>\n {children}\n </DialogContent>\n);\n\nconst PrimaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"contained\" type=\"submit\" {...props}>\n {children}\n </Button>\n);\n\nconst SecondaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"outlined\" color=\"secondary\" {...props}>\n {children}\n </Button>\n);\n\n/*\n * Material-ui has a prop \"scroll=paper\" that is specifically for dialog header and actions to be sticky and body to scroll,\n * but that doesn't work when dialog content is wrapped in form.\n * https://github.com/mui-org/material-ui/issues/13253\n * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog\n */\nconst Form = styled('form')({\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n});\n\n/**\n * Render the CSS of the dialog's close button, according to the given material theme.\n * @param theme material theme\n */\nconst dialogCloseIconButtonStyle = (theme: Theme) => {\n return { position: 'absolute', top: theme.spacing(0.5), right: theme.spacing(0.5) };\n};\n\nexport const Dialog = ({ children, ...props }: DialogProps) => <MuiDialog {...props}>{children}</MuiDialog>;\n\nDialog.Header = Header;\nDialog.Form = Form;\nDialog.Content = Content;\nDialog.PrimaryButton = PrimaryButton;\nDialog.SecondaryButton = SecondaryButton;\nDialog.Actions = DialogActions;\n"],"names":["React","Button","Dialog","MuiDialog","DialogActions","DialogContent","DialogTitle","IconButton","styled","CloseIcon","combineSx","Header","children","onClose","props","aria-label","onClick","sx","dialogCloseIconButtonStyle","Content","width","dividers","PrimaryButton","variant","type","SecondaryButton","color","Form","overflowY","display","flexDirection","theme","position","top","spacing","right","Actions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE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AAMG,QAAQ;QAAMC,OAAOJ,MAAMG,QAAQ;IAAK;AACpF;AAEA,OAAO,MAAMhC,SAAS,CAAC,EAAEU,SAAQ,EAAE,GAAGE,OAAoB,iBAAK,KAACX;QAAW,GAAGW,KAAK;kBAAGF;OAAsB;AAE5GV,OAAOS,SAASA;AAChBT,OAAOyB,OAAOA;AACdzB,OAAOiB,UAAUA;AACjBjB,OAAOoB,gBAAgBA;AACvBpB,OAAOuB,kBAAkBA;AACzBvB,OAAOkC,UAAUhC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Dialog/DiscardChangesConfirmationDialog.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 { Button } from '@mui/material';\nimport { Dialog } from './Dialog';\n\ninterface DiscardChangesConfirmationDialogProps {\n description: string;\n isOpen: boolean;\n onCancel: () => void;\n onDiscardChanges: () => void;\n}\n\nexport const DiscardChangesConfirmationDialog = (props: DiscardChangesConfirmationDialogProps) => {\n const { description, isOpen, onCancel, onDiscardChanges } = props;\n\n return (\n <Dialog open={isOpen} aria-labelledby=\"discard-dialog\">\n <Dialog.Header>Discard Changes</Dialog.Header>\n <Dialog.Content>{description}</Dialog.Content>\n <Dialog.Actions>\n <Button variant=\"contained\" onClick={onDiscardChanges}>\n Discard Changes\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={onCancel}>\n Cancel\n </Button>\n </Dialog.Actions>\n </Dialog>\n );\n};\n"],"names":["Button","Dialog","DiscardChangesConfirmationDialog","props","description","isOpen","onCancel","onDiscardChanges","open","aria-labelledby","Header","Content","Actions","variant","onClick","color"],"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,SAASA,MAAM,QAAQ,eAAe,CAAC;AACvC,SAASC,MAAM,QAAQ,UAAU,CAAC;AASlC,OAAO,MAAMC,gCAAgC,GAAG,CAACC,KAA4C,GAAK;IAChG,MAAM,EAAEC,WAAW,CAAA,EAAEC,MAAM,CAAA,EAAEC,QAAQ,CAAA,EAAEC,gBAAgB,CAAA,EAAE,GAAGJ,KAAK,AAAC;IAElE,qBACE,MAACF,MAAM;QAACO,IAAI,EAAEH,MAAM;QAAEI,iBAAe,EAAC,gBAAgB;;0BACpD,KAACR,MAAM,CAACS,MAAM;0BAAC,iBAAe;cAAgB;0BAC9C,KAACT,MAAM,CAACU,OAAO;0BAAEP,WAAW;cAAkB;0BAC9C,MAACH,MAAM,CAACW,OAAO;;kCACb,KAACZ,MAAM;wBAACa,OAAO,EAAC,WAAW;wBAACC,OAAO,EAAEP,gBAAgB;kCAAE,iBAEvD;sBAAS;kCACT,KAACP,MAAM;wBAACa,OAAO,EAAC,UAAU;wBAACE,KAAK,EAAC,WAAW;wBAACD,OAAO,EAAER,QAAQ;kCAAE,QAEhE;sBAAS;;cACM;;MACV,CACT;AACJ,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/Dialog/DiscardChangesConfirmationDialog.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 { Button } from '@mui/material';\nimport { Dialog } from './Dialog';\n\ninterface DiscardChangesConfirmationDialogProps {\n description: string;\n isOpen: boolean;\n onCancel: () => void;\n onDiscardChanges: () => void;\n}\n\nexport const DiscardChangesConfirmationDialog = (props: DiscardChangesConfirmationDialogProps) => {\n const { description, isOpen, onCancel, onDiscardChanges } = props;\n\n return (\n <Dialog open={isOpen} aria-labelledby=\"discard-dialog\">\n <Dialog.Header>Discard Changes</Dialog.Header>\n <Dialog.Content>{description}</Dialog.Content>\n <Dialog.Actions>\n <Button variant=\"contained\" onClick={onDiscardChanges}>\n Discard Changes\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={onCancel}>\n Cancel\n </Button>\n </Dialog.Actions>\n </Dialog>\n );\n};\n"],"names":["Button","Dialog","DiscardChangesConfirmationDialog","props","description","isOpen","onCancel","onDiscardChanges","open","aria-labelledby","Header","Content","Actions","variant","onClick","color"],"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,gBAAgB;AACvC,SAASC,MAAM,QAAQ,WAAW;AASlC,OAAO,MAAMC,mCAAmC,CAACC;IAC/C,MAAM,EAAEC,YAAW,EAAEC,OAAM,EAAEC,SAAQ,EAAEC,iBAAgB,EAAE,GAAGJ;IAE5D,qBACE,MAACF;QAAOO,MAAMH;QAAQI,mBAAgB;;0BACpC,KAACR,OAAOS;0BAAO;;0BACf,KAACT,OAAOU;0BAASP;;0BACjB,MAACH,OAAOW;;kCACN,KAACZ;wBAAOa,SAAQ;wBAAYC,SAASP;kCAAkB;;kCAGvD,KAACP;wBAAOa,SAAQ;wBAAWE,OAAM;wBAAYD,SAASR;kCAAU;;;;;;AAMxE,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Dialog/index.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\nexport * from './Dialog';\nexport * from './DiscardChangesConfirmationDialog';\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,UAAU,CAAC;AACzB,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"sources":["../../src/Dialog/index.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\nexport * from './Dialog';\nexport * from './DiscardChangesConfirmationDialog';\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,WAAW;AACzB,cAAc,qCAAqC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Drawer/Drawer.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 { Drawer as MuiDrawer, DrawerProps as MuiDrawerProps } from '@mui/material';\nimport { combineSx } from '../utils';\n\nexport interface DrawerProps extends MuiDrawerProps {\n isOpen: boolean;\n onClose: () => void;\n anchor?: 'left' | 'right';\n}\n\nconst DRAWER_DEFAULT_WIDTH = 1080;\n\nexport const Drawer = ({ anchor = 'right', isOpen, onClose, PaperProps, children, ...rest }: DrawerProps) => {\n return (\n <MuiDrawer\n {...rest}\n open={isOpen}\n onClose={onClose}\n anchor={anchor}\n PaperProps={{\n ...PaperProps,\n sx: combineSx(\n {\n width: `${DRAWER_DEFAULT_WIDTH}px`,\n overflow: 'hidden',\n },\n PaperProps?.sx\n ),\n }}\n >\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["Drawer","MuiDrawer","combineSx","DRAWER_DEFAULT_WIDTH","anchor","isOpen","onClose","PaperProps","children","rest","open","sx","width","overflow"],"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,SAASA,MAAM,IAAIC,SAAS,QAAuC,eAAe,CAAC;AACnF,SAASC,SAAS,QAAQ,UAAU,CAAC;AAQrC,MAAMC,oBAAoB,GAAG,IAAI,AAAC;AAElC,OAAO,MAAMH,MAAM,GAAG,CAAC,EAAEI,MAAM,EAAG,OAAO,CAAA,EAAEC,MAAM,CAAA,EAAEC,OAAO,CAAA,EAAEC,UAAU,CAAA,EAAEC,QAAQ,CAAA,EAAE,GAAGC,IAAI,EAAe,GAAK;IAC3G,qBACE,KAACR,SAAS;QACP,GAAGQ,IAAI;QACRC,IAAI,EAAEL,MAAM;QACZC,OAAO,EAAEA,OAAO;QAChBF,MAAM,EAAEA,MAAM;QACdG,UAAU,EAAE;YACV,GAAGA,UAAU;YACbI,EAAE,EAAET,SAAS,CACX;gBACEU,KAAK,EAAE,CAAC,EAAET,oBAAoB,CAAC,EAAE,CAAC;gBAClCU,QAAQ,EAAE,QAAQ;aACnB,EACDN,UAAU,aAAVA,UAAU,WAAI,GAAdA,KAAAA,CAAc,GAAdA,UAAU,CAAEI,EAAE,CACf;SACF;kBAEAH,QAAQ;MACC,CACZ;AACJ,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/Drawer/Drawer.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 { Drawer as MuiDrawer, DrawerProps as MuiDrawerProps } from '@mui/material';\nimport { combineSx } from '../utils';\n\nexport interface DrawerProps extends MuiDrawerProps {\n isOpen: boolean;\n onClose: () => void;\n anchor?: 'left' | 'right';\n}\n\nconst DRAWER_DEFAULT_WIDTH = 1080;\n\nexport const Drawer = ({ anchor = 'right', isOpen, onClose, PaperProps, children, ...rest }: DrawerProps) => {\n return (\n <MuiDrawer\n {...rest}\n open={isOpen}\n onClose={onClose}\n anchor={anchor}\n PaperProps={{\n ...PaperProps,\n sx: combineSx(\n {\n width: `${DRAWER_DEFAULT_WIDTH}px`,\n overflow: 'hidden',\n },\n PaperProps?.sx\n ),\n }}\n >\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["Drawer","MuiDrawer","combineSx","DRAWER_DEFAULT_WIDTH","anchor","isOpen","onClose","PaperProps","children","rest","open","sx","width","overflow"],"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,UAAUC,SAAS,QAAuC,gBAAgB;AACnF,SAASC,SAAS,QAAQ,WAAW;AAQrC,MAAMC,uBAAuB;AAE7B,OAAO,MAAMH,SAAS,CAAC,EAAEI,QAAS,QAAO,EAAEC,OAAM,EAAEC,QAAO,EAAEC,WAAU,EAAEC,SAAQ,EAAE,GAAGC,MAAmB;IACtG,qBACE,KAACR;QACE,GAAGQ,IAAI;QACRC,MAAML;QACNC,SAASA;QACTF,QAAQA;QACRG,YAAY;YACV,GAAGA,UAAU;YACbI,IAAIT,UACF;gBACEU,OAAO,CAAC,EAAET,qBAAqB,EAAE,CAAC;gBAClCU,UAAU;YACZ,GACAN,uBAAAA,wBAAAA,KAAAA,IAAAA,WAAYI;QAEhB;kBAECH;;AAGP,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Drawer/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 './Drawer';\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,UAAU,CAAC"}
1
+ {"version":3,"sources":["../../src/Drawer/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 './Drawer';\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,WAAW"}
@@ -145,8 +145,8 @@ function bindEvents(instance, events) {
145
145
  }
146
146
  for(const eventName in events){
147
147
  if (Object.prototype.hasOwnProperty.call(events, eventName)) {
148
- var _eventName;
149
- const customEvent = (_eventName = events[eventName]) !== null && _eventName !== void 0 ? _eventName : null;
148
+ var _events_eventName;
149
+ const customEvent = (_events_eventName = events[eventName]) !== null && _events_eventName !== void 0 ? _events_eventName : null;
150
150
  if (customEvent) {
151
151
  bindEvent(eventName, customEvent);
152
152
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/EChart/EChart.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, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { ECharts, EChartsCoreOption, init, connect } from 'echarts/core';\nimport { Box, SxProps, Theme } from '@mui/material';\nimport isEqual from 'lodash/isEqual';\nimport debounce from 'lodash/debounce';\nimport { EChartsTheme } from '../model';\n\n// see docs for info about each property: https://echarts.apache.org/en/api.html#events\nexport interface MouseEventsParameters<T> {\n componentType: string;\n seriesType: string;\n seriesIndex: number;\n seriesName: string;\n name: string;\n dataIndex: number;\n data: Record<string, unknown> & T;\n dataType: string;\n value: number | number[];\n color: string;\n info: Record<string, unknown>;\n}\n\ntype OnEventFunction<T> = (\n params: MouseEventsParameters<T>,\n // This is potentially undefined for testing purposes\n instance?: ECharts\n) => void;\n\nconst mouseEvents = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mousemove',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'globalout',\n 'contextmenu',\n] as const;\n\nexport type MouseEventName = (typeof mouseEvents)[number];\n\n// batch event types\nexport interface DataZoomPayloadBatchItem {\n dataZoomId: string;\n // start and end not returned unless dataZoom is based on percentProp,\n // which is for cases when a dataZoom component controls multiple axes\n start?: number;\n end?: number;\n // startValue and endValue return data index for 'category' axes,\n // for axis types 'value' and 'time', actual values are returned\n startValue?: number;\n endValue?: number;\n}\n\nexport interface HighlightPayloadBatchItem {\n dataIndex: number;\n dataIndexInside: number;\n seriesIndex: number;\n // highlight action can effect multiple connected charts\n escapeConnect?: boolean;\n // whether blur state was triggered\n notBlur?: boolean;\n}\n\nexport interface BatchEventsParameters {\n type: BatchEventName;\n batch: DataZoomPayloadBatchItem[] & HighlightPayloadBatchItem[];\n}\n\ntype OnBatchEventFunction = (params: BatchEventsParameters) => void;\n\nconst batchEvents = ['datazoom', 'downplay', 'highlight'] as const;\n\nexport type BatchEventName = (typeof batchEvents)[number];\n\ntype ChartEventName = 'finished';\n\ntype EventName = MouseEventName | ChartEventName | BatchEventName;\n\nexport type OnEventsType<T> = {\n [mouseEventName in MouseEventName]?: OnEventFunction<T>;\n} & {\n [batchEventName in BatchEventName]?: OnBatchEventFunction;\n} & {\n [eventName in ChartEventName]?: () => void;\n};\n\nexport interface EChartsProps<T> {\n option: EChartsCoreOption;\n theme?: string | EChartsTheme;\n renderer?: 'canvas' | 'svg';\n sx?: SxProps<Theme>;\n onEvents?: OnEventsType<T>;\n _instance?: React.MutableRefObject<ECharts | undefined>;\n syncGroup?: string;\n onChartInitialized?: (instance: ECharts) => void;\n}\n\nexport const EChart = React.memo(function EChart<T>({\n option,\n theme,\n renderer,\n sx,\n onEvents,\n _instance,\n syncGroup,\n onChartInitialized,\n}: EChartsProps<T>) {\n const initialOption = useRef<EChartsCoreOption>(option);\n const prevOption = useRef<EChartsCoreOption>(option);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const chartElement = useRef<ECharts | null>(null);\n\n // Initialize chart, dispose on unmount\n useLayoutEffect(() => {\n if (containerRef.current === null || chartElement.current !== null) return;\n chartElement.current = init(containerRef.current, theme, { renderer: renderer ?? 'canvas' });\n if (chartElement.current === undefined) return;\n chartElement.current.setOption(initialOption.current, true);\n onChartInitialized?.(chartElement.current);\n if (_instance !== undefined) {\n _instance.current = chartElement.current;\n }\n return () => {\n if (chartElement.current === null) return;\n chartElement.current.dispose();\n chartElement.current = null;\n };\n }, [_instance, onChartInitialized, theme, renderer]);\n\n // When syncGroup is explicitly set, charts within same group share interactions such as crosshair\n useEffect(() => {\n if (!chartElement.current || !syncGroup) return;\n chartElement.current.group = syncGroup;\n connect([chartElement.current]); // more info: https://echarts.apache.org/en/api.html#echarts.connect\n }, [syncGroup, chartElement]);\n\n // Update chart data when option changes\n useEffect(() => {\n if (prevOption.current === undefined || isEqual(prevOption.current, option)) return;\n if (!chartElement.current) return;\n chartElement.current.setOption(option, true);\n prevOption.current = option;\n }, [option]);\n\n // Resize chart, cleanup listener on unmount\n useLayoutEffect(() => {\n const updateSize = debounce(() => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n }, 200);\n window.addEventListener('resize', updateSize);\n updateSize();\n return () => {\n window.removeEventListener('resize', updateSize);\n };\n }, []);\n\n // Bind and unbind chart events passed as prop\n useEffect(() => {\n const chart = chartElement.current;\n if (!chart || onEvents === undefined) return;\n bindEvents(chart, onEvents);\n return () => {\n if (chart === undefined) return;\n if (chart.isDisposed() === true) return;\n for (const event in onEvents) {\n chart.off(event);\n }\n };\n }, [onEvents]);\n\n // TODO: re-evaluate how this is triggered. It's technically working right\n // now because the sx prop is an object that gets re-created, but that also\n // means it runs unnecessarily some of the time and theoretically might\n // not run in some other cases. Maybe it should use a resize observer?\n useEffect(() => {\n // TODO: fix this debouncing. This likely isn't working as intended because\n // the debounced function is re-created every time this useEffect is called.\n const updateSize = debounce(\n () => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n },\n 200,\n {\n leading: true,\n }\n );\n updateSize();\n }, [sx]);\n\n return <Box ref={containerRef} sx={sx}></Box>;\n});\n\n// Validate event config and bind custom events\nfunction bindEvents<T>(instance: ECharts, events?: OnEventsType<T>) {\n if (events === undefined) return;\n\n function bindEvent(eventName: EventName, OnEventFunction: unknown) {\n if (typeof OnEventFunction === 'function') {\n if (isMouseEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params, instance));\n } else if (isBatchEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params));\n } else {\n instance.on(eventName, () => OnEventFunction(null, instance));\n }\n }\n }\n\n for (const eventName in events) {\n if (Object.prototype.hasOwnProperty.call(events, eventName)) {\n const customEvent = events[eventName as EventName] ?? null;\n if (customEvent) {\n bindEvent(eventName as EventName, customEvent);\n }\n }\n }\n}\n\nfunction isMouseEvent(eventName: EventName): eventName is MouseEventName {\n return (mouseEvents as readonly string[]).includes(eventName);\n}\n\nfunction isBatchEvent(eventName: EventName): eventName is BatchEventName {\n return (batchEvents as readonly string[]).includes(eventName);\n}\n"],"names":["React","useEffect","useLayoutEffect","useRef","init","connect","Box","isEqual","debounce","mouseEvents","batchEvents","EChart","memo","option","theme","renderer","sx","onEvents","_instance","syncGroup","onChartInitialized","initialOption","prevOption","containerRef","chartElement","current","undefined","setOption","dispose","group","updateSize","resize","window","addEventListener","removeEventListener","chart","bindEvents","isDisposed","event","off","leading","ref","instance","events","bindEvent","eventName","OnEventFunction","isMouseEvent","on","params","isBatchEvent","Object","prototype","hasOwnProperty","call","customEvent","includes"],"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,SAAS,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO,CAAC;AAClE,SAAqCC,IAAI,EAAEC,OAAO,QAAQ,cAAc,CAAC;AACzE,SAASC,GAAG,QAAwB,eAAe,CAAC;AACpD,OAAOC,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAOC,QAAQ,MAAM,iBAAiB,CAAC;AAwBvC,MAAMC,WAAW,GAAG;IAClB,OAAO;IACP,UAAU;IACV,WAAW;IACX,WAAW;IACX,SAAS;IACT,WAAW;IACX,UAAU;IACV,WAAW;IACX,aAAa;CACd,AAAS,AAAC;AAkCX,MAAMC,WAAW,GAAG;IAAC,UAAU;IAAE,UAAU;IAAE,WAAW;CAAC,AAAS,AAAC;AA2BnE,OAAO,MAAMC,MAAM,iBAAGX,KAAK,CAACY,IAAI,CAAC,SAASD,MAAM,CAAI,EAClDE,MAAM,CAAA,EACNC,KAAK,CAAA,EACLC,QAAQ,CAAA,EACRC,EAAE,CAAA,EACFC,QAAQ,CAAA,EACRC,SAAS,CAAA,EACTC,SAAS,CAAA,EACTC,kBAAkB,CAAA,EAC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AAM,EAAEP,QAAQ,CAAC,CAAC,CAAC;YACxE,OAAO,IAAIQ,YAAY,CAACL,SAAS,CAAC,EAAE;gBAClCH,QAAQ,CAACM,EAAE,CAACH,SAAS,EAAE,CAACI,MAAM,GAAKH,eAAe,CAACG,MAAM,CAAC,CAAC,CAAC;YAC9D,OAAO;gBACLP,QAAQ,CAACM,EAAE,CAACH,SAAS,EAAE,IAAMC,eAAe,CAAC,IAAI,EAAEJ,QAAQ,CAAC,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAK,MAAMG,SAAS,IAAIF,MAAM,CAAE;QAC9B,IAAIQ,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACX,MAAM,EAAEE,SAAS,CAAC,EAAE;gBACvCF,UAA8B;YAAlD,MAAMY,WAAW,GAAGZ,CAAAA,UAA8B,GAA9BA,MAAM,CAACE,SAAS,CAAc,cAA9BF,UAA8B,cAA9BA,UAA8B,GAAI,IAAI,AAAC;YAC3D,IAAIY,WAAW,EAAE;gBACfX,SAAS,CAACC,SAAS,EAAeU,WAAW,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAASR,YAAY,CAACF,SAAoB,EAA+B;IACvE,OAAO,AAACpC,WAAW,CAAuB+C,QAAQ,CAACX,SAAS,CAAC,CAAC;AAChE,CAAC;AAED,SAASK,YAAY,CAACL,SAAoB,EAA+B;IACvE,OAAO,AAACnC,WAAW,CAAuB8C,QAAQ,CAACX,SAAS,CAAC,CAAC;AAChE,CAAC"}
1
+ {"version":3,"sources":["../../src/EChart/EChart.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, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { ECharts, EChartsCoreOption, init, connect } from 'echarts/core';\nimport { Box, SxProps, Theme } from '@mui/material';\nimport isEqual from 'lodash/isEqual';\nimport debounce from 'lodash/debounce';\nimport { EChartsTheme } from '../model';\n\n// see docs for info about each property: https://echarts.apache.org/en/api.html#events\nexport interface MouseEventsParameters<T> {\n componentType: string;\n seriesType: string;\n seriesIndex: number;\n seriesName: string;\n name: string;\n dataIndex: number;\n data: Record<string, unknown> & T;\n dataType: string;\n value: number | number[];\n color: string;\n info: Record<string, unknown>;\n}\n\ntype OnEventFunction<T> = (\n params: MouseEventsParameters<T>,\n // This is potentially undefined for testing purposes\n instance?: ECharts\n) => void;\n\nconst mouseEvents = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mousemove',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'globalout',\n 'contextmenu',\n] as const;\n\nexport type MouseEventName = (typeof mouseEvents)[number];\n\n// batch event types\nexport interface DataZoomPayloadBatchItem {\n dataZoomId: string;\n // start and end not returned unless dataZoom is based on percentProp,\n // which is for cases when a dataZoom component controls multiple axes\n start?: number;\n end?: number;\n // startValue and endValue return data index for 'category' axes,\n // for axis types 'value' and 'time', actual values are returned\n startValue?: number;\n endValue?: number;\n}\n\nexport interface HighlightPayloadBatchItem {\n dataIndex: number;\n dataIndexInside: number;\n seriesIndex: number;\n // highlight action can effect multiple connected charts\n escapeConnect?: boolean;\n // whether blur state was triggered\n notBlur?: boolean;\n}\n\nexport interface BatchEventsParameters {\n type: BatchEventName;\n batch: DataZoomPayloadBatchItem[] & HighlightPayloadBatchItem[];\n}\n\ntype OnBatchEventFunction = (params: BatchEventsParameters) => void;\n\nconst batchEvents = ['datazoom', 'downplay', 'highlight'] as const;\n\nexport type BatchEventName = (typeof batchEvents)[number];\n\ntype ChartEventName = 'finished';\n\ntype EventName = MouseEventName | ChartEventName | BatchEventName;\n\nexport type OnEventsType<T> = {\n [mouseEventName in MouseEventName]?: OnEventFunction<T>;\n} & {\n [batchEventName in BatchEventName]?: OnBatchEventFunction;\n} & {\n [eventName in ChartEventName]?: () => void;\n};\n\nexport interface EChartsProps<T> {\n option: EChartsCoreOption;\n theme?: string | EChartsTheme;\n renderer?: 'canvas' | 'svg';\n sx?: SxProps<Theme>;\n onEvents?: OnEventsType<T>;\n _instance?: React.MutableRefObject<ECharts | undefined>;\n syncGroup?: string;\n onChartInitialized?: (instance: ECharts) => void;\n}\n\nexport const EChart = React.memo(function EChart<T>({\n option,\n theme,\n renderer,\n sx,\n onEvents,\n _instance,\n syncGroup,\n onChartInitialized,\n}: EChartsProps<T>) {\n const initialOption = useRef<EChartsCoreOption>(option);\n const prevOption = useRef<EChartsCoreOption>(option);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const chartElement = useRef<ECharts | null>(null);\n\n // Initialize chart, dispose on unmount\n useLayoutEffect(() => {\n if (containerRef.current === null || chartElement.current !== null) return;\n chartElement.current = init(containerRef.current, theme, { renderer: renderer ?? 'canvas' });\n if (chartElement.current === undefined) return;\n chartElement.current.setOption(initialOption.current, true);\n onChartInitialized?.(chartElement.current);\n if (_instance !== undefined) {\n _instance.current = chartElement.current;\n }\n return () => {\n if (chartElement.current === null) return;\n chartElement.current.dispose();\n chartElement.current = null;\n };\n }, [_instance, onChartInitialized, theme, renderer]);\n\n // When syncGroup is explicitly set, charts within same group share interactions such as crosshair\n useEffect(() => {\n if (!chartElement.current || !syncGroup) return;\n chartElement.current.group = syncGroup;\n connect([chartElement.current]); // more info: https://echarts.apache.org/en/api.html#echarts.connect\n }, [syncGroup, chartElement]);\n\n // Update chart data when option changes\n useEffect(() => {\n if (prevOption.current === undefined || isEqual(prevOption.current, option)) return;\n if (!chartElement.current) return;\n chartElement.current.setOption(option, true);\n prevOption.current = option;\n }, [option]);\n\n // Resize chart, cleanup listener on unmount\n useLayoutEffect(() => {\n const updateSize = debounce(() => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n }, 200);\n window.addEventListener('resize', updateSize);\n updateSize();\n return () => {\n window.removeEventListener('resize', updateSize);\n };\n }, []);\n\n // Bind and unbind chart events passed as prop\n useEffect(() => {\n const chart = chartElement.current;\n if (!chart || onEvents === undefined) return;\n bindEvents(chart, onEvents);\n return () => {\n if (chart === undefined) return;\n if (chart.isDisposed() === true) return;\n for (const event in onEvents) {\n chart.off(event);\n }\n };\n }, [onEvents]);\n\n // TODO: re-evaluate how this is triggered. It's technically working right\n // now because the sx prop is an object that gets re-created, but that also\n // means it runs unnecessarily some of the time and theoretically might\n // not run in some other cases. Maybe it should use a resize observer?\n useEffect(() => {\n // TODO: fix this debouncing. This likely isn't working as intended because\n // the debounced function is re-created every time this useEffect is called.\n const updateSize = debounce(\n () => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n },\n 200,\n {\n leading: true,\n }\n );\n updateSize();\n }, [sx]);\n\n return <Box ref={containerRef} sx={sx}></Box>;\n});\n\n// Validate event config and bind custom events\nfunction bindEvents<T>(instance: ECharts, events?: OnEventsType<T>) {\n if (events === undefined) return;\n\n function bindEvent(eventName: EventName, OnEventFunction: unknown) {\n if (typeof OnEventFunction === 'function') {\n if (isMouseEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params, instance));\n } else if (isBatchEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params));\n } else {\n instance.on(eventName, () => OnEventFunction(null, instance));\n }\n }\n }\n\n for (const eventName in events) {\n if (Object.prototype.hasOwnProperty.call(events, eventName)) {\n const customEvent = events[eventName as EventName] ?? null;\n if (customEvent) {\n bindEvent(eventName as EventName, customEvent);\n }\n }\n }\n}\n\nfunction isMouseEvent(eventName: EventName): eventName is MouseEventName {\n return (mouseEvents as readonly string[]).includes(eventName);\n}\n\nfunction isBatchEvent(eventName: EventName): eventName is BatchEventName {\n return (batchEvents as readonly string[]).includes(eventName);\n}\n"],"names":["React","useEffect","useLayoutEffect","useRef","init","connect","Box","isEqual","debounce","mouseEvents","batchEvents","EChart","memo","option","theme","renderer","sx","onEvents","_instance","syncGroup","onChartInitialized","initialOption","prevOption","containerRef","chartElement","current","undefined","setOption","dispose","group","updateSize","resize","window","addEventListener","removeEventListener","chart","bindEvents","isDisposed","event","off","leading","ref","instance","events","bindEvent","eventName","OnEventFunction","isMouseEvent","on","params","isBatchEvent","Object","prototype","hasOwnProperty","call","customEvent","includes"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,SAAS,EAAEC,eAAe,EAAEC,MAAM,QAAQ,QAAQ;AAClE,SAAqCC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAwB,gBAAgB;AACpD,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,cAAc,kBAAkB;AAwBvC,MAAMC,cAAc;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAkCD,MAAMC,cAAc;IAAC;IAAY;IAAY;CAAY;AA2BzD,OAAO,MAAMC,uBAASX,MAAMY,KAAK,SAASD,OAAU,EAClDE,OAAM,EACNC,MAAK,EACLC,SAAQ,EACRC,GAAE,EACFC,SAAQ,EACRC,UAAS,EACTC,UAAS,EACTC,mBAAkB,EACF;IAChB,MAAMC,gBAAgBlB,OAA0BU;IAChD,MAAMS,aAAanB,OAA0BU;IAC7C,MAAMU,eAAepB,OAA8B;IACnD,MAAMqB,eAAerB,OAAuB;IAE5C,uCAAuC;IACvCD,gBAAgB;QACd,IAAIqB,aAAaE,YAAY,QAAQD,aAAaC,YAAY,MAAM;QACpED,aAAaC,UAAUrB,KAAKmB,aAAaE,SAASX,OAAO;YAAEC,UAAUA,qBAAAA,sBAAAA,WAA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QAACrB;KAAS;IAEb,0EAA0E;IAC1E,2EAA2E;IAC3E,uEAAuE;IACvE,sEAAsE;IACtEhB,UAAU;QACR,2EAA2E;QAC3E,4EAA4E;QAC5E,MAAM6B,aAAatB,SACjB;YACE,IAAI,CAACgB,aAAaC,SAAS;YAC3BD,aAAaC,QAAQM;QACvB,GACA,KACA;YACES,SAAS;QACX;QAEFV;IACF,GAAG;QAACd;KAAG;IAEP,qBAAO,KAACV;QAAImC,KAAKlB;QAAcP,IAAIA;;AACrC,GAAG;AAEH,+CAA+C;AAC/C,SAASoB,WAAcM,QAAiB,EAAEC,MAAwB;IAChE,IAAIA,WAAWjB,WAAW;IAE1B,SAASkB,UAAUC,SAAoB,EAAEC,eAAwB;QAC/D,IAAI,OAAOA,oBAAoB,YAAY;YACzC,IAAIC,aAAaF,YAAY;gBAC3BH,SAASM,GAAGH,WAAW,CAACI,SAAWH,gBAAgBG,QAAQP;YAC7D,OAAO,IAAIQ,aAAaL,YAAY;gBAClCH,SAASM,GAAGH,WAAW,CAACI,SAAWH,gBAAgBG;YACrD,OAAO;gBACLP,SAASM,GAAGH,WAAW,IAAMC,gBAAgB,MAAMJ;YACrD;QACF;IACF;IAEA,IAAK,MAAMG,aAAaF,OAAQ;QAC9B,IAAIQ,OAAOC,UAAUC,eAAeC,KAAKX,QAAQE,YAAY;gBACvCF;YAApB,MAAMY,cAAcZ,CAAAA,oBAAAA,MAAM,CAACE,UAAuB,cAA9BF,+BAAAA,oBAAkC;YACtD,IAAIY,aAAa;gBACfX,UAAUC,WAAwBU;YACpC;QACF;IACF;AACF;AAEA,SAASR,aAAaF,SAAoB;IACxC,OAAO,AAACpC,YAAkC+C,SAASX;AACrD;AAEA,SAASK,aAAaL,SAAoB;IACxC,OAAO,AAACnC,YAAkC8C,SAASX;AACrD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/EChart/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 './EChart';\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,UAAU,CAAC"}
1
+ {"version":3,"sources":["../../src/EChart/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 './EChart';\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,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ErrorAlert.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 { Alert } from '@mui/material';\n\nexport interface ErrorAlertProps {\n error: Error;\n}\n\n/**\n * Shows an MUI Alert with the `Error.message` as its contents.\n */\nexport function ErrorAlert(props: ErrorAlertProps) {\n const { error } = props;\n return <Alert severity=\"error\">{error.message}</Alert>;\n}\n"],"names":["Alert","ErrorAlert","props","error","severity","message"],"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,SAASA,KAAK,QAAQ,eAAe,CAAC;AAMtC;;CAEC,GACD,OAAO,SAASC,UAAU,CAACC,KAAsB,EAAE;IACjD,MAAM,EAAEC,KAAK,CAAA,EAAE,GAAGD,KAAK,AAAC;IACxB,qBAAO,KAACF,KAAK;QAACI,QAAQ,EAAC,OAAO;kBAAED,KAAK,CAACE,OAAO;MAAS,CAAC;AACzD,CAAC"}
1
+ {"version":3,"sources":["../src/ErrorAlert.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 { Alert } from '@mui/material';\n\nexport interface ErrorAlertProps {\n error: Error;\n}\n\n/**\n * Shows an MUI Alert with the `Error.message` as its contents.\n */\nexport function ErrorAlert(props: ErrorAlertProps) {\n const { error } = props;\n return <Alert severity=\"error\">{error.message}</Alert>;\n}\n"],"names":["Alert","ErrorAlert","props","error","severity","message"],"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,KAAK,QAAQ,gBAAgB;AAMtC;;CAEC,GACD,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,MAAK,EAAE,GAAGD;IAClB,qBAAO,KAACF;QAAMI,UAAS;kBAASD,MAAME;;AACxC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ErrorBoundary.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\n// Just use react-error-boundary as-is for now\nexport { ErrorBoundary } from 'react-error-boundary';\nexport type { ErrorBoundaryProps } from 'react-error-boundary';\n"],"names":["ErrorBoundary"],"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,8CAA8C;AAC9C,SAASA,aAAa,QAAQ,sBAAsB,CAAC"}
1
+ {"version":3,"sources":["../src/ErrorBoundary.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\n// Just use react-error-boundary as-is for now\nexport { ErrorBoundary } from 'react-error-boundary';\nexport type { ErrorBoundaryProps } from 'react-error-boundary';\n"],"names":["ErrorBoundary"],"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,8CAA8C;AAC9C,SAASA,aAAa,QAAQ,uBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/FontSizeSelector/FontSizeSelector.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 { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst FONT_SIZE_OPTIONS = [\n { id: 'default', label: 'Default', value: undefined },\n { id: '12', label: '12', value: 12 },\n { id: '14', label: '14', value: 14 },\n { id: '16', label: '16', value: 16 },\n { id: '20', label: '20', value: 20 },\n { id: '24', label: '24', value: 24 },\n { id: '28', label: '28', value: 28 },\n { id: '32', label: '32', value: 32 },\n { id: '36', label: '36', value: 36 },\n { id: '40', label: '40', value: 40 },\n { id: '48', label: '48', value: 48 },\n { id: '56', label: '56', value: 56 },\n { id: '64', label: '64', value: 64 },\n { id: '72', label: '72', value: 72 },\n { id: '96', label: '96', value: 96 },\n { id: '128', label: '128', value: 128 },\n { id: '160', label: '160', value: 160 },\n { id: '192', label: '192', value: 192 },\n];\n\nexport type FontSizeOption = number | undefined;\n\nexport interface FontSizeSelectorProps {\n value: FontSizeOption;\n onChange: (fontSize: FontSizeOption) => void;\n}\n\nexport function FontSizeSelector({ value, onChange }: FontSizeSelectorProps) {\n const handleFontSizeChange = (_: unknown, { value }: { value: FontSizeOption }) => {\n onChange(value);\n };\n\n return (\n <OptionsEditorControl\n label=\"Font Size\"\n control={\n <SettingsAutocomplete\n value={FONT_SIZE_OPTIONS.find((o) => o.value === value)}\n options={FONT_SIZE_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleFontSizeChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","FONT_SIZE_OPTIONS","id","label","value","undefined","FontSizeSelector","onChange","handleFontSizeChange","_","control","find","o","options","getOptionLabel","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,oBAAoB,QAAQ,wBAAwB,CAAC;AAC9D,SAASC,oBAAoB,QAAQ,yBAAyB,CAAC;AAE/D,MAAMC,iBAAiB,GAAG;IACxB;QAAEC,EAAE,EAAE,SAAS;QAAEC,KAAK,EAAE,SAAS;QAAEC,KAAK,EAAEC,SAAS;KAAE;IACrD;QAAEH,EAAE,EAAE,IAAI;QAAEC,KAAK,EAAE,IAAI;QAAEC,KAAK,EAAE,EAAE;KAAE;IACpC;QAAEF,EAAE,EAAE,IAAI;QAAEC,KAAK,EAAE,IAAI;QAAEC,KAAK,EAAE,EAAE;KAAE;IACpC;QAAEF,EAAE,EAAE,IAAI;Q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EC,KAAK,EAAE,KAAK;QAAEC,KAAK,EAAE,GAAG;KAAE;CACxC,AAAC;AASF,OAAO,SAASE,gBAAgB,CAAC,EAAEF,KAAK,CAAA,EAAEG,QAAQ,CAAA,EAAyB,EAAE;IAC3E,MAAMC,oBAAoB,GAAG,CAACC,CAAU,EAAE,EAAEL,KAAK,CAAA,EAA6B,GAAK;QACjFG,QAAQ,CAACH,KAAK,CAAC,CAAC;IAClB,CAAC,AAAC;IAEF,qBACE,KAACL,oBAAoB;QACnBI,KAAK,EAAC,WAAW;QACjBO,OAAO,gBACL,KAACV,oBAAoB;YACnBI,KAAK,EAAEH,iBAAiB,CAACU,IAAI,CAAC,CAACC,CAAC,GAAKA,CAAC,CAACR,KAAK,KAAKA,KAAK,CAAC;YACvDS,OAAO,EAAEZ,iBAAiB;YAC1Ba,cAAc,EAAE,CAACF,CAAC,GAAKA,CAAC,CAACT,KAAK;YAC9BI,QAAQ,EAAEC,oBAAoB;YAC9BO,gBAAgB;UAChB;MAEJ,CACF;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/FontSizeSelector/FontSizeSelector.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 { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst FONT_SIZE_OPTIONS = [\n { id: 'default', label: 'Default', value: undefined },\n { id: '12', label: '12', value: 12 },\n { id: '14', label: '14', value: 14 },\n { id: '16', label: '16', value: 16 },\n { id: '20', label: '20', value: 20 },\n { id: '24', label: '24', value: 24 },\n { id: '28', label: '28', value: 28 },\n { id: '32', label: '32', value: 32 },\n { id: '36', label: '36', value: 36 },\n { id: '40', label: '40', value: 40 },\n { id: '48', label: '48', value: 48 },\n { id: '56', label: '56', value: 56 },\n { id: '64', label: '64', value: 64 },\n { id: '72', label: '72', value: 72 },\n { id: '96', label: '96', value: 96 },\n { id: '128', label: '128', value: 128 },\n { id: '160', label: '160', value: 160 },\n { id: '192', label: '192', value: 192 },\n];\n\nexport type FontSizeOption = number | undefined;\n\nexport interface FontSizeSelectorProps {\n value: FontSizeOption;\n onChange: (fontSize: FontSizeOption) => void;\n}\n\nexport function FontSizeSelector({ value, onChange }: FontSizeSelectorProps) {\n const handleFontSizeChange = (_: unknown, { value }: { value: FontSizeOption }) => {\n onChange(value);\n };\n\n return (\n <OptionsEditorControl\n label=\"Font Size\"\n control={\n <SettingsAutocomplete\n value={FONT_SIZE_OPTIONS.find((o) => o.value === value)}\n options={FONT_SIZE_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleFontSizeChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","FONT_SIZE_OPTIONS","id","label","value","undefined","FontSizeSelector","onChange","handleFontSizeChange","_","control","find","o","options","getOptionLabel","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,oBAAoB,QAAQ,0BAA0B;AAE/D,MAAMC,oBAAoB;IACxB;QAAEC,IAAI;QAAWC,OAAO;QAAWC,OAAOC;IAAU;IACpD;QAAEH,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAMC,OAAO;QAAMC,OAAO;IAAG;IACnC;QAAEF,IAAI;QAAOC,OAAO;QAAOC,OAAO;IAAI;IACtC;QAAEF,IAAI;QAAOC,OAAO;QAAOC,OAAO;IAAI;IACtC;QAAEF,IAAI;QAAOC,OAAO;QAAOC,OAAO;IAAI;CACvC;AASD,OAAO,SAASE,iBAAiB,EAAEF,MAAK,EAAEG,SAAQ,EAAyB;IACzE,MAAMC,uBAAuB,CAACC,GAAY,EAAEL,MAAK,EAA6B;QAC5EG,SAASH;IACX;IAEA,qBACE,KAACL;QACCI,OAAM;QACNO,uBACE,KAACV;YACCI,OAAOH,kBAAkBU,KAAK,CAACC,IAAMA,EAAER,UAAUA;YACjDS,SAASZ;YACTa,gBAAgB,CAACF,IAAMA,EAAET;YACzBI,UAAUC;YACVO,gBAAgB;;;AAK1B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/FontSizeSelector/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 './FontSizeSelector';\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,oBAAoB,CAAC"}
1
+ {"version":3,"sources":["../../src/FontSizeSelector/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 './FontSizeSelector';\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,qBAAqB"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { FormatOptions } from '@perses-dev/core';
3
+ export interface FormatControlsProps {
4
+ value: FormatOptions;
5
+ onChange: (unit: FormatOptions) => void;
6
+ disabled?: boolean;
7
+ }
8
+ export declare function FormatControls({ value, onChange, disabled }: FormatControlsProps): JSX.Element;
9
+ //# sourceMappingURL=FormatControls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormatControls.d.ts","sourceRoot":"","sources":["../../src/FormatControls/FormatControls.tsx"],"names":[],"mappings":";AAaA,OAAO,EAEL,aAAa,EAKd,MAAM,kBAAkB,CAAC;AAI1B,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA0BD,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAgB,EAAE,EAAE,mBAAmB,eAsExF"}
@@ -12,7 +12,7 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import { Switch } from '@mui/material';
15
- import { shouldAbbreviate, UNIT_CONFIG, isUnitWithDecimalPlaces, isUnitWithAbbreviate } from '@perses-dev/core';
15
+ import { shouldShortenValues, UNIT_CONFIG, isUnitWithDecimalPlaces, isUnitWithShortValues } from '@perses-dev/core';
16
16
  import { OptionsEditorControl } from '../OptionsEditorLayout';
17
17
  import { SettingsAutocomplete } from '../SettingsAutocomplete';
18
18
  const KIND_OPTIONS = Object.entries(UNIT_CONFIG).map(([id, config])=>{
@@ -25,78 +25,78 @@ const DECIMAL_PLACES_OPTIONS = [
25
25
  {
26
26
  id: 'default',
27
27
  label: 'Default',
28
- decimal_places: undefined
28
+ decimalPlaces: undefined
29
29
  },
30
30
  {
31
31
  id: '0',
32
32
  label: '0',
33
- decimal_places: 0
33
+ decimalPlaces: 0
34
34
  },
35
35
  {
36
36
  id: '1',
37
37
  label: '1',
38
- decimal_places: 1
38
+ decimalPlaces: 1
39
39
  },
40
40
  {
41
41
  id: '2',
42
42
  label: '2',
43
- decimal_places: 2
43
+ decimalPlaces: 2
44
44
  },
45
45
  {
46
46
  id: '3',
47
47
  label: '3',
48
- decimal_places: 3
48
+ decimalPlaces: 3
49
49
  },
50
50
  {
51
51
  id: '4',
52
52
  label: '4',
53
- decimal_places: 4
53
+ decimalPlaces: 4
54
54
  }
55
55
  ];
56
- function getOptionByDecimalPlaces(decimal_places) {
57
- return DECIMAL_PLACES_OPTIONS.find((o)=>o.decimal_places === decimal_places);
56
+ function getOptionByDecimalPlaces(decimalPlaces) {
57
+ return DECIMAL_PLACES_OPTIONS.find((o)=>o.decimalPlaces === decimalPlaces);
58
58
  }
59
- export function UnitSelector({ value , onChange , disabled =false }) {
59
+ export function FormatControls({ value , onChange , disabled =false }) {
60
60
  const hasDecimalPlaces = isUnitWithDecimalPlaces(value);
61
- const hasAbbreviate = isUnitWithAbbreviate(value);
61
+ const hasShortValues = isUnitWithShortValues(value);
62
62
  const handleKindChange = (_, newValue)=>{
63
63
  onChange({
64
- kind: newValue.id
64
+ unit: newValue.id
65
65
  });
66
66
  };
67
- const handleDecimalPlacesChange = (_, { decimal_places })=>{
67
+ const handleDecimalPlacesChange = (_, { decimalPlaces })=>{
68
68
  if (hasDecimalPlaces) {
69
69
  onChange({
70
70
  ...value,
71
- decimal_places: decimal_places
71
+ decimalPlaces: decimalPlaces
72
72
  });
73
73
  }
74
74
  };
75
- const handleAbbreviateChange = (_, checked)=>{
76
- if (hasAbbreviate) {
75
+ const handleShortValuesChange = (_, checked)=>{
76
+ if (hasShortValues) {
77
77
  onChange({
78
78
  ...value,
79
- abbreviate: checked
79
+ shortValues: checked
80
80
  });
81
81
  }
82
82
  };
83
- const kindConfig = UNIT_CONFIG[value.kind];
83
+ const unitConfig = UNIT_CONFIG[value.unit];
84
84
  return /*#__PURE__*/ _jsxs(_Fragment, {
85
85
  children: [
86
86
  /*#__PURE__*/ _jsx(OptionsEditorControl, {
87
- label: "Abbreviate",
87
+ label: "Short values",
88
88
  control: /*#__PURE__*/ _jsx(Switch, {
89
- checked: hasAbbreviate ? shouldAbbreviate(value.abbreviate) : false,
90
- onChange: handleAbbreviateChange,
91
- disabled: !hasAbbreviate
89
+ checked: hasShortValues ? shouldShortenValues(value.shortValues) : false,
90
+ onChange: handleShortValuesChange,
91
+ disabled: !hasShortValues
92
92
  })
93
93
  }),
94
94
  /*#__PURE__*/ _jsx(OptionsEditorControl, {
95
95
  label: "Unit",
96
96
  control: /*#__PURE__*/ _jsx(SettingsAutocomplete, {
97
97
  value: {
98
- id: value.kind,
99
- ...kindConfig
98
+ id: value.unit,
99
+ ...unitConfig
100
100
  },
101
101
  options: KIND_OPTIONS,
102
102
  groupBy: (option)=>option.group,
@@ -108,7 +108,7 @@ export function UnitSelector({ value , onChange , disabled =false }) {
108
108
  /*#__PURE__*/ _jsx(OptionsEditorControl, {
109
109
  label: "Decimals",
110
110
  control: /*#__PURE__*/ _jsx(SettingsAutocomplete, {
111
- value: getOptionByDecimalPlaces(value.decimal_places),
111
+ value: getOptionByDecimalPlaces(value.decimalPlaces),
112
112
  options: DECIMAL_PLACES_OPTIONS,
113
113
  getOptionLabel: (o)=>o.label,
114
114
  onChange: handleDecimalPlacesChange,
@@ -120,4 +120,4 @@ export function UnitSelector({ value , onChange , disabled =false }) {
120
120
  });
121
121
  }
122
122
 
123
- //# sourceMappingURL=UnitSelector.js.map
123
+ //# sourceMappingURL=FormatControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/FormatControls/FormatControls.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 shouldShortenValues,\n FormatOptions,\n UNIT_CONFIG,\n UnitConfig,\n isUnitWithDecimalPlaces,\n isUnitWithShortValues,\n} from '@perses-dev/core';\nimport { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nexport interface FormatControlsProps {\n value: FormatOptions;\n onChange: (unit: FormatOptions) => void;\n disabled?: boolean;\n}\n\ntype AutocompleteUnitOption = UnitConfig & { id: FormatOptions['unit'] };\n\nconst KIND_OPTIONS: AutocompleteUnitOption[] = Object.entries(UNIT_CONFIG)\n .map(([id, config]) => {\n return {\n id: id as FormatOptions['unit'],\n ...config,\n };\n })\n .filter((config) => !config.disableSelectorOption);\n\nconst DECIMAL_PLACES_OPTIONS = [\n { id: 'default', label: 'Default', decimalPlaces: undefined },\n { id: '0', label: '0', decimalPlaces: 0 },\n { id: '1', label: '1', decimalPlaces: 1 },\n { id: '2', label: '2', decimalPlaces: 2 },\n { id: '3', label: '3', decimalPlaces: 3 },\n { id: '4', label: '4', decimalPlaces: 4 },\n];\n\nfunction getOptionByDecimalPlaces(decimalPlaces?: number) {\n return DECIMAL_PLACES_OPTIONS.find((o) => o.decimalPlaces === decimalPlaces);\n}\n\nexport function FormatControls({ value, onChange, disabled = false }: FormatControlsProps) {\n const hasDecimalPlaces = isUnitWithDecimalPlaces(value);\n const hasShortValues = isUnitWithShortValues(value);\n\n const handleKindChange = (_: unknown, newValue: AutocompleteUnitOption) => {\n onChange({\n unit: newValue.id,\n });\n };\n\n const handleDecimalPlacesChange = (_: unknown, { decimalPlaces }: { decimalPlaces: number | undefined }) => {\n if (hasDecimalPlaces) {\n onChange({\n ...value,\n decimalPlaces: decimalPlaces,\n });\n }\n };\n\n const handleShortValuesChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n if (hasShortValues) {\n onChange({\n ...value,\n shortValues: checked,\n });\n }\n };\n\n const unitConfig = UNIT_CONFIG[value.unit];\n\n return (\n <>\n <OptionsEditorControl\n label=\"Short values\"\n control={\n <Switch\n checked={hasShortValues ? shouldShortenValues(value.shortValues) : false}\n onChange={handleShortValuesChange}\n disabled={!hasShortValues}\n />\n }\n />\n <OptionsEditorControl\n label=\"Unit\"\n control={\n <SettingsAutocomplete\n value={{ id: value.unit, ...unitConfig }}\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.decimalPlaces)}\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","shouldShortenValues","UNIT_CONFIG","isUnitWithDecimalPlaces","isUnitWithShortValues","OptionsEditorControl","SettingsAutocomplete","KIND_OPTIONS","Object","entries","map","id","config","filter","disableSelectorOption","DECIMAL_PLACES_OPTIONS","label","decimalPlaces","undefined","getOptionByDecimalPlaces","find","o","FormatControls","value","onChange","disabled","hasDecimalPlaces","hasShortValues","handleKindChange","_","newValue","unit","handleDecimalPlacesChange","handleShortValuesChange","checked","shortValues","unitConfig","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,SAASA,MAAM,QAAqB,gBAAgB;AACpD,SACEC,mBAAmB,EAEnBC,WAAW,EAEXC,uBAAuB,EACvBC,qBAAqB,QAChB,mBAAmB;AAC1B,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,oBAAoB,QAAQ,0BAA0B;AAU/D,MAAMC,eAAyCC,OAAOC,QAAQP,aAC3DQ,IAAI,CAAC,CAACC,IAAIC,OAAO;IAChB,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF,GACCC,OAA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IY,MAAMQ;wBAAM,GAAGK,UAAU;oBAAC;oBACvCE,SAAS/B;oBACTgC,SAAS,CAACC,SAAWA,OAAOC;oBAC5BjB,UAAUI;oBACVc,gBAAgB;oBAChBjB,UAAUA;;;0BAIhB,KAACpB;gBACCW,OAAM;gBACNqB,uBACE,KAAC/B;oBACCiB,OAAOJ,yBAAyBI,MAAMN;oBACtCqB,SAASvB;oBACT4B,gBAAgB,CAACtB,IAAMA,EAAEL;oBACzBQ,UAAUQ;oBACVP,UAAU,CAACC;oBACXgB,gBAAgB;;;;;AAM5B"}
@@ -0,0 +1,2 @@
1
+ export * from './FormatControls';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormatControls/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
@@ -10,6 +10,6 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './UnitSelector';
13
+ export * from './FormatControls';
14
14
 
15
15
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/FormatControls/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 './FormatControls';\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,mBAAmB"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { UnitOptions } from '@perses-dev/core';
2
+ import { FormatOptions } from '@perses-dev/core';
3
3
  import { GaugeSeriesOption } from 'echarts/charts';
4
4
  export declare type GaugeChartValue = number | null | undefined;
5
5
  export declare type GaugeSeries = {
@@ -10,7 +10,7 @@ export interface GaugeChartProps {
10
10
  width: number;
11
11
  height: number;
12
12
  data: GaugeSeries;
13
- unit: UnitOptions;
13
+ format: FormatOptions;
14
14
  axisLine: GaugeSeriesOption['axisLine'];
15
15
  max?: number;
16
16
  }
@@ -19,5 +19,5 @@ export declare function GaugeChart(props: GaugeChartProps): JSX.Element;
19
19
  * Responsive font size depending on number of characters, clamp used
20
20
  * to ensure size stays within given range
21
21
  */
22
- export declare function getResponsiveValueSize(value: number | null, unit: UnitOptions, width: number, height: number): string;
22
+ export declare function getResponsiveValueSize(value: number | null, format: FormatOptions, width: number, height: number): string;
23
23
  //# sourceMappingURL=GaugeChart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GaugeChart.d.ts","sourceRoot":"","sources":["../../src/GaugeChart/GaugeChart.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA4B,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAmC,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAapF,oBAAY,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAExD,oBAAY,WAAW,GAAG;IACxB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAuJhD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAQ5G"}
1
+ {"version":3,"file":"GaugeChart.d.ts","sourceRoot":"","sources":["../../src/GaugeChart/GaugeChart.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA4B,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAmC,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAapF,oBAAY,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAExD,oBAAY,WAAW,GAAG;IACxB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAuJhD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAQhH"}
@@ -29,15 +29,15 @@ const PROGRESS_WIDTH = 16;
29
29
  // adjusts when to show pointer icon
30
30
  const GAUGE_SMALL_BREAKPOINT = 170;
31
31
  export function GaugeChart(props) {
32
- const { width , height , data , unit , axisLine , max } = props;
32
+ const { width , height , data , format , axisLine , max } = props;
33
33
  const chartsTheme = useChartsTheme();
34
34
  // useDeepMemo ensures value size util does not rerun everytime you hover on the chart
35
35
  const option = useDeepMemo(()=>{
36
- var ref;
36
+ var _chartsTheme_echartsTheme_textStyle;
37
37
  if (data.value === undefined) return chartsTheme.noDataOption;
38
38
  // adjusts fontSize depending on number of characters
39
- const valueSizeClamp = getResponsiveValueSize(data.value, unit, width, height);
40
- var ref1;
39
+ const valueSizeClamp = getResponsiveValueSize(data.value, format, width, height);
40
+ var _chartsTheme_echartsTheme_textStyle_color;
41
41
  return {
42
42
  title: {
43
43
  show: false
@@ -156,7 +156,7 @@ export function GaugeChart(props) {
156
156
  // when the value is `null`, making it difficult to differentiate
157
157
  // `null` from a true `NaN` case.
158
158
  ()=>'null' : (value)=>{
159
- return formatValue(value, unit);
159
+ return formatValue(value, format);
160
160
  }
161
161
  },
162
162
  data: [
@@ -167,7 +167,7 @@ export function GaugeChart(props) {
167
167
  // https://echarts.apache.org/en/option.html#series-gauge.data.title
168
168
  title: {
169
169
  show: true,
170
- color: (ref1 = (ref = chartsTheme.echartsTheme.textStyle) === null || ref === void 0 ? void 0 : ref.color) !== null && ref1 !== void 0 ? ref1 : 'inherit',
170
+ color: (_chartsTheme_echartsTheme_textStyle_color = (_chartsTheme_echartsTheme_textStyle = chartsTheme.echartsTheme.textStyle) === null || _chartsTheme_echartsTheme_textStyle === void 0 ? void 0 : _chartsTheme_echartsTheme_textStyle.color) !== null && _chartsTheme_echartsTheme_textStyle_color !== void 0 ? _chartsTheme_echartsTheme_textStyle_color : 'inherit',
171
171
  offsetCenter: [
172
172
  0,
173
173
  '55%'
@@ -186,7 +186,7 @@ export function GaugeChart(props) {
186
186
  width,
187
187
  height,
188
188
  chartsTheme,
189
- unit,
189
+ format,
190
190
  axisLine,
191
191
  max
192
192
  ]);
@@ -203,13 +203,13 @@ export function GaugeChart(props) {
203
203
  /**
204
204
  * Responsive font size depending on number of characters, clamp used
205
205
  * to ensure size stays within given range
206
- */ export function getResponsiveValueSize(value, unit, width, height) {
206
+ */ export function getResponsiveValueSize(value, format, width, height) {
207
207
  const MIN_SIZE = 3;
208
208
  const MAX_SIZE = 24;
209
209
  const SIZE_MULTIPLIER = 0.7;
210
- const formattedValue = typeof value === 'number' ? formatValue(value, unit) : `${value}`;
211
- var _length;
212
- const valueCharacters = (_length = formattedValue.length) !== null && _length !== void 0 ? _length : 2;
210
+ const formattedValue = typeof value === 'number' ? formatValue(value, format) : `${value}`;
211
+ var _formattedValue_length;
212
+ const valueCharacters = (_formattedValue_length = formattedValue.length) !== null && _formattedValue_length !== void 0 ? _formattedValue_length : 2;
213
213
  const valueSize = Math.min(width, height) / valueCharacters * SIZE_MULTIPLIER;
214
214
  return `clamp(${MIN_SIZE}px, ${valueSize}px, ${MAX_SIZE}px)`;
215
215
  }