@perses-dev/components 0.21.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (399) hide show
  1. package/README.md +2 -3
  2. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +2 -1
  3. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
  4. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +88 -51
  5. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
  6. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  7. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +3 -2
  8. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
  9. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
  10. package/dist/DateTimeRangePicker/TimeRangeSelector.js +4 -1
  11. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
  12. package/dist/DateTimeRangePicker/index.js +1 -1
  13. package/dist/DateTimeRangePicker/index.js.map +1 -1
  14. package/dist/DateTimeRangePicker/utils.js +1 -1
  15. package/dist/DateTimeRangePicker/utils.js.map +1 -1
  16. package/dist/Dialog/Dialog.d.ts +24 -0
  17. package/dist/Dialog/Dialog.d.ts.map +1 -0
  18. package/dist/Dialog/Dialog.js +74 -0
  19. package/dist/Dialog/Dialog.js.map +1 -0
  20. package/dist/Dialog/index.d.ts +2 -0
  21. package/dist/Dialog/index.d.ts.map +1 -0
  22. package/dist/{Tooltip → Dialog}/index.js +2 -3
  23. package/dist/{Tooltip → Dialog}/index.js.map +1 -1
  24. package/dist/Drawer/Drawer.js +1 -1
  25. package/dist/Drawer/Drawer.js.map +1 -1
  26. package/dist/Drawer/index.js +1 -1
  27. package/dist/Drawer/index.js.map +1 -1
  28. package/dist/EChart.js +1 -1
  29. package/dist/EChart.js.map +1 -1
  30. package/dist/ErrorAlert.js +1 -1
  31. package/dist/ErrorAlert.js.map +1 -1
  32. package/dist/ErrorBoundary.js +1 -1
  33. package/dist/ErrorBoundary.js.map +1 -1
  34. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  35. package/dist/GaugeChart/GaugeChart.js +5 -10
  36. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  37. package/dist/GaugeChart/index.js +1 -1
  38. package/dist/GaugeChart/index.js.map +1 -1
  39. package/dist/InfoTooltip/InfoTooltip.d.ts +1 -6
  40. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  41. package/dist/InfoTooltip/InfoTooltip.js +2 -9
  42. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  43. package/dist/InfoTooltip/InfoTooltip.test.js +1 -1
  44. package/dist/InfoTooltip/InfoTooltip.test.js.map +1 -1
  45. package/dist/InfoTooltip/index.js +1 -1
  46. package/dist/InfoTooltip/index.js.map +1 -1
  47. package/dist/JSONEditor.d.ts +5 -4
  48. package/dist/JSONEditor.d.ts.map +1 -1
  49. package/dist/JSONEditor.js +21 -16
  50. package/dist/JSONEditor.js.map +1 -1
  51. package/dist/Legend/CompactLegend.js +1 -1
  52. package/dist/Legend/CompactLegend.js.map +1 -1
  53. package/dist/Legend/Legend.d.ts.map +1 -1
  54. package/dist/Legend/Legend.js +18 -6
  55. package/dist/Legend/Legend.js.map +1 -1
  56. package/dist/Legend/LegendColorBadge.js +1 -1
  57. package/dist/Legend/LegendColorBadge.js.map +1 -1
  58. package/dist/Legend/ListLegend.js +1 -1
  59. package/dist/Legend/ListLegend.js.map +1 -1
  60. package/dist/Legend/ListLegendItem.js +1 -1
  61. package/dist/Legend/ListLegendItem.js.map +1 -1
  62. package/dist/Legend/index.js +1 -1
  63. package/dist/Legend/index.js.map +1 -1
  64. package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  65. package/dist/LegendOptionsEditor/LegendOptionsEditor.js +13 -18
  66. package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  67. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js +23 -2
  68. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js.map +1 -1
  69. package/dist/LegendOptionsEditor/index.js +1 -1
  70. package/dist/LegendOptionsEditor/index.js.map +1 -1
  71. package/dist/LineChart/LineChart.js +3 -3
  72. package/dist/LineChart/LineChart.js.map +1 -1
  73. package/dist/LineChart/index.js +1 -1
  74. package/dist/LineChart/index.js.map +1 -1
  75. package/dist/LineChart/utils.js +1 -1
  76. package/dist/LineChart/utils.js.map +1 -1
  77. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  78. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  79. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  80. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  81. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  82. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  83. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  84. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  85. package/dist/OptionsEditorLayout/index.js +1 -1
  86. package/dist/OptionsEditorLayout/index.js.map +1 -1
  87. package/dist/StatChart/StatChart.d.ts.map +1 -1
  88. package/dist/StatChart/StatChart.js +21 -12
  89. package/dist/StatChart/StatChart.js.map +1 -1
  90. package/dist/StatChart/StatChart.test.js +1 -1
  91. package/dist/StatChart/StatChart.test.js.map +1 -1
  92. package/dist/StatChart/index.js +1 -1
  93. package/dist/StatChart/index.js.map +1 -1
  94. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesInfo.d.ts +1 -2
  95. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -0
  96. package/dist/TimeSeriesTooltip/SeriesInfo.js +89 -0
  97. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -0
  98. package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts +2 -0
  99. package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts.map +1 -0
  100. package/dist/TimeSeriesTooltip/SeriesInfo.test.js +52 -0
  101. package/dist/TimeSeriesTooltip/SeriesInfo.test.js.map +1 -0
  102. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +9 -0
  103. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -0
  104. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +99 -0
  105. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -0
  106. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesMarker.d.ts +2 -1
  107. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -0
  108. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesMarker.js +7 -7
  109. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -0
  110. package/dist/{Tooltip/Tooltip.d.ts → TimeSeriesTooltip/TimeSeriesTooltip.d.ts} +4 -4
  111. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +1 -0
  112. package/dist/{Tooltip/Tooltip.js → TimeSeriesTooltip/TimeSeriesTooltip.js} +3 -4
  113. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +1 -0
  114. package/dist/{Tooltip → TimeSeriesTooltip}/TooltipContent.d.ts +1 -2
  115. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -0
  116. package/dist/{Tooltip → TimeSeriesTooltip}/TooltipContent.js +1 -1
  117. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -0
  118. package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts +2 -0
  119. package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts.map +1 -0
  120. package/dist/TimeSeriesTooltip/TooltipContent.test.js +78 -0
  121. package/dist/TimeSeriesTooltip/TooltipContent.test.js.map +1 -0
  122. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.d.ts +0 -0
  123. package/dist/TimeSeriesTooltip/focused-series.d.ts.map +1 -0
  124. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.js +3 -3
  125. package/dist/TimeSeriesTooltip/focused-series.js.map +1 -0
  126. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.test.d.ts +0 -0
  127. package/dist/TimeSeriesTooltip/focused-series.test.d.ts.map +1 -0
  128. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.test.js +1 -1
  129. package/dist/TimeSeriesTooltip/focused-series.test.js.map +1 -0
  130. package/dist/TimeSeriesTooltip/index.d.ts +9 -0
  131. package/dist/TimeSeriesTooltip/index.d.ts.map +1 -0
  132. package/dist/TimeSeriesTooltip/index.js +22 -0
  133. package/dist/TimeSeriesTooltip/index.js.map +1 -0
  134. package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.d.ts +0 -0
  135. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -0
  136. package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.js +1 -1
  137. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -0
  138. package/dist/{Tooltip → TimeSeriesTooltip}/utils.d.ts +0 -0
  139. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -0
  140. package/dist/{Tooltip → TimeSeriesTooltip}/utils.js +1 -1
  141. package/dist/TimeSeriesTooltip/utils.js.map +1 -0
  142. package/dist/UnitSelector/UnitSelector.js +1 -1
  143. package/dist/UnitSelector/UnitSelector.js.map +1 -1
  144. package/dist/UnitSelector/UnitSelector.test.js +1 -1
  145. package/dist/UnitSelector/UnitSelector.test.js.map +1 -1
  146. package/dist/UnitSelector/index.js +1 -1
  147. package/dist/UnitSelector/index.js.map +1 -1
  148. package/dist/YAxisLabel.js +1 -1
  149. package/dist/YAxisLabel.js.map +1 -1
  150. package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +87 -50
  151. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +3 -2
  152. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +4 -1
  153. package/dist/cjs/DateTimeRangePicker/index.js +1 -1
  154. package/dist/cjs/DateTimeRangePicker/utils.js +1 -1
  155. package/dist/cjs/Dialog/Dialog.js +85 -0
  156. package/dist/cjs/{Tooltip → Dialog}/index.js +2 -3
  157. package/dist/cjs/Drawer/Drawer.js +1 -1
  158. package/dist/cjs/Drawer/index.js +1 -1
  159. package/dist/cjs/EChart.js +1 -1
  160. package/dist/cjs/ErrorAlert.js +1 -1
  161. package/dist/cjs/ErrorBoundary.js +1 -1
  162. package/dist/cjs/GaugeChart/GaugeChart.js +5 -10
  163. package/dist/cjs/GaugeChart/index.js +1 -1
  164. package/dist/cjs/InfoTooltip/InfoTooltip.js +5 -18
  165. package/dist/cjs/InfoTooltip/InfoTooltip.test.js +1 -1
  166. package/dist/cjs/InfoTooltip/index.js +1 -1
  167. package/dist/cjs/JSONEditor.js +25 -15
  168. package/dist/cjs/Legend/CompactLegend.js +1 -1
  169. package/dist/cjs/Legend/Legend.js +17 -5
  170. package/dist/cjs/Legend/LegendColorBadge.js +1 -1
  171. package/dist/cjs/Legend/ListLegend.js +1 -1
  172. package/dist/cjs/Legend/ListLegendItem.js +1 -1
  173. package/dist/cjs/Legend/index.js +1 -1
  174. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +13 -18
  175. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.test.js +23 -2
  176. package/dist/cjs/LegendOptionsEditor/index.js +1 -1
  177. package/dist/cjs/LineChart/LineChart.js +3 -3
  178. package/dist/cjs/LineChart/index.js +1 -1
  179. package/dist/cjs/LineChart/utils.js +1 -1
  180. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  181. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  182. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  183. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  184. package/dist/cjs/OptionsEditorLayout/index.js +1 -1
  185. package/dist/cjs/StatChart/StatChart.js +21 -12
  186. package/dist/cjs/StatChart/StatChart.test.js +1 -1
  187. package/dist/cjs/StatChart/index.js +1 -1
  188. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +95 -0
  189. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.test.js +54 -0
  190. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +105 -0
  191. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/SeriesMarker.js +7 -7
  192. package/dist/cjs/{Tooltip/Tooltip.js → TimeSeriesTooltip/TimeSeriesTooltip.js} +4 -4
  193. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/TooltipContent.js +1 -1
  194. package/dist/cjs/TimeSeriesTooltip/TooltipContent.test.js +80 -0
  195. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/focused-series.js +3 -3
  196. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/focused-series.test.js +1 -1
  197. package/dist/cjs/TimeSeriesTooltip/index.js +35 -0
  198. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/tooltip-model.js +1 -1
  199. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/utils.js +1 -1
  200. package/dist/cjs/UnitSelector/UnitSelector.js +1 -1
  201. package/dist/cjs/UnitSelector/UnitSelector.test.js +1 -1
  202. package/dist/cjs/UnitSelector/index.js +1 -1
  203. package/dist/cjs/YAxisLabel.js +1 -1
  204. package/dist/cjs/context/ChartsThemeProvider.js +1 -1
  205. package/dist/cjs/context/TimeZoneProvider.js +1 -1
  206. package/dist/cjs/index.js +3 -1
  207. package/dist/cjs/model/graph.js +4 -15
  208. package/dist/cjs/model/index.js +2 -1
  209. package/dist/cjs/model/legend.js +67 -0
  210. package/dist/cjs/model/legend.test.js +29 -0
  211. package/dist/cjs/model/theme.js +1 -1
  212. package/dist/cjs/model/units/bytes.js +1 -1
  213. package/dist/cjs/model/units/constants.js +1 -1
  214. package/dist/cjs/model/units/decimal.js +5 -2
  215. package/dist/cjs/model/units/index.js +1 -1
  216. package/dist/cjs/model/units/percent.js +1 -1
  217. package/dist/cjs/model/units/time.js +1 -1
  218. package/dist/cjs/model/units/types.js +1 -1
  219. package/dist/cjs/model/units/units.js +1 -1
  220. package/dist/cjs/model/units/units.test.js +59 -6
  221. package/dist/cjs/test/index.js +1 -1
  222. package/dist/cjs/test/render.js +1 -1
  223. package/dist/cjs/test/setup-tests.js +1 -1
  224. package/dist/cjs/test-utils/index.js +1 -1
  225. package/dist/cjs/test-utils/theme.js +6 -1
  226. package/dist/cjs/theme/index.js +1 -1
  227. package/dist/cjs/theme/palette/background.js +1 -1
  228. package/dist/cjs/theme/palette/colors/blue.js +1 -1
  229. package/dist/cjs/theme/palette/colors/common.js +1 -1
  230. package/dist/cjs/theme/palette/colors/green.js +1 -1
  231. package/dist/cjs/theme/palette/colors/grey.js +1 -1
  232. package/dist/cjs/theme/palette/colors/index.js +1 -1
  233. package/dist/cjs/theme/palette/colors/orange.js +1 -1
  234. package/dist/cjs/theme/palette/colors/purple.js +1 -1
  235. package/dist/cjs/theme/palette/colors/red.js +1 -1
  236. package/dist/cjs/theme/palette/colors/types.js +1 -1
  237. package/dist/cjs/theme/palette/error.js +1 -1
  238. package/dist/cjs/theme/palette/grey.js +1 -1
  239. package/dist/cjs/theme/palette/index.js +1 -1
  240. package/dist/cjs/theme/palette/palette-options.js +1 -1
  241. package/dist/cjs/theme/palette/primary.js +1 -1
  242. package/dist/cjs/theme/palette/secondary.js +1 -1
  243. package/dist/cjs/theme/palette/success.js +1 -1
  244. package/dist/cjs/theme/palette/text.js +1 -1
  245. package/dist/cjs/theme/palette/warning.js +1 -1
  246. package/dist/cjs/theme/theme.js +12 -1
  247. package/dist/cjs/theme/types/ThemeExtension.d.js +1 -1
  248. package/dist/cjs/theme/typography.js +1 -1
  249. package/dist/cjs/utils/combine-sx.js +1 -1
  250. package/dist/cjs/utils/component-ids.js +1 -1
  251. package/dist/cjs/utils/format.js +1 -1
  252. package/dist/cjs/utils/format.test.js +1 -1
  253. package/dist/cjs/utils/index.js +1 -1
  254. package/dist/cjs/utils/mathjs.js +1 -1
  255. package/dist/cjs/utils/theme-gen.js +6 -1
  256. package/dist/cjs/utils/theme-gen.test.js +6 -1
  257. package/dist/context/ChartsThemeProvider.js +1 -1
  258. package/dist/context/ChartsThemeProvider.js.map +1 -1
  259. package/dist/context/TimeZoneProvider.js +1 -1
  260. package/dist/context/TimeZoneProvider.js.map +1 -1
  261. package/dist/index.d.ts +2 -0
  262. package/dist/index.d.ts.map +1 -1
  263. package/dist/index.js +3 -1
  264. package/dist/index.js.map +1 -1
  265. package/dist/model/graph.d.ts +1 -16
  266. package/dist/model/graph.d.ts.map +1 -1
  267. package/dist/model/graph.js +1 -5
  268. package/dist/model/graph.js.map +1 -1
  269. package/dist/model/index.d.ts +1 -0
  270. package/dist/model/index.d.ts.map +1 -1
  271. package/dist/model/index.js +2 -1
  272. package/dist/model/index.js.map +1 -1
  273. package/dist/model/legend.d.ts +22 -0
  274. package/dist/model/legend.d.ts.map +1 -0
  275. package/dist/model/legend.js +51 -0
  276. package/dist/model/legend.js.map +1 -0
  277. package/dist/model/legend.test.d.ts +2 -0
  278. package/dist/model/legend.test.d.ts.map +1 -0
  279. package/dist/model/legend.test.js +27 -0
  280. package/dist/model/legend.test.js.map +1 -0
  281. package/dist/model/theme.d.ts +11 -0
  282. package/dist/model/theme.d.ts.map +1 -1
  283. package/dist/model/theme.js +1 -1
  284. package/dist/model/theme.js.map +1 -1
  285. package/dist/model/units/bytes.js +1 -1
  286. package/dist/model/units/bytes.js.map +1 -1
  287. package/dist/model/units/constants.js +1 -1
  288. package/dist/model/units/constants.js.map +1 -1
  289. package/dist/model/units/decimal.d.ts.map +1 -1
  290. package/dist/model/units/decimal.js +5 -2
  291. package/dist/model/units/decimal.js.map +1 -1
  292. package/dist/model/units/index.js +1 -1
  293. package/dist/model/units/index.js.map +1 -1
  294. package/dist/model/units/percent.js +1 -1
  295. package/dist/model/units/percent.js.map +1 -1
  296. package/dist/model/units/time.js +1 -1
  297. package/dist/model/units/time.js.map +1 -1
  298. package/dist/model/units/types.js +1 -1
  299. package/dist/model/units/types.js.map +1 -1
  300. package/dist/model/units/units.js +1 -1
  301. package/dist/model/units/units.js.map +1 -1
  302. package/dist/model/units/units.test.js +59 -6
  303. package/dist/model/units/units.test.js.map +1 -1
  304. package/dist/test/index.js +1 -1
  305. package/dist/test/index.js.map +1 -1
  306. package/dist/test/render.js +1 -1
  307. package/dist/test/render.js.map +1 -1
  308. package/dist/test/setup-tests.js +1 -1
  309. package/dist/test/setup-tests.js.map +1 -1
  310. package/dist/test-utils/index.js +1 -1
  311. package/dist/test-utils/index.js.map +1 -1
  312. package/dist/test-utils/theme.d.ts.map +1 -1
  313. package/dist/test-utils/theme.js +6 -1
  314. package/dist/test-utils/theme.js.map +1 -1
  315. package/dist/theme/index.js +1 -1
  316. package/dist/theme/index.js.map +1 -1
  317. package/dist/theme/palette/background.js +1 -1
  318. package/dist/theme/palette/background.js.map +1 -1
  319. package/dist/theme/palette/colors/blue.js +1 -1
  320. package/dist/theme/palette/colors/blue.js.map +1 -1
  321. package/dist/theme/palette/colors/common.js +1 -1
  322. package/dist/theme/palette/colors/common.js.map +1 -1
  323. package/dist/theme/palette/colors/green.js +1 -1
  324. package/dist/theme/palette/colors/green.js.map +1 -1
  325. package/dist/theme/palette/colors/grey.js +1 -1
  326. package/dist/theme/palette/colors/grey.js.map +1 -1
  327. package/dist/theme/palette/colors/index.js +1 -1
  328. package/dist/theme/palette/colors/index.js.map +1 -1
  329. package/dist/theme/palette/colors/orange.js +1 -1
  330. package/dist/theme/palette/colors/orange.js.map +1 -1
  331. package/dist/theme/palette/colors/purple.js +1 -1
  332. package/dist/theme/palette/colors/purple.js.map +1 -1
  333. package/dist/theme/palette/colors/red.js +1 -1
  334. package/dist/theme/palette/colors/red.js.map +1 -1
  335. package/dist/theme/palette/colors/types.js +1 -1
  336. package/dist/theme/palette/colors/types.js.map +1 -1
  337. package/dist/theme/palette/error.js +1 -1
  338. package/dist/theme/palette/error.js.map +1 -1
  339. package/dist/theme/palette/grey.js +1 -1
  340. package/dist/theme/palette/grey.js.map +1 -1
  341. package/dist/theme/palette/index.js +1 -1
  342. package/dist/theme/palette/index.js.map +1 -1
  343. package/dist/theme/palette/palette-options.js +1 -1
  344. package/dist/theme/palette/palette-options.js.map +1 -1
  345. package/dist/theme/palette/primary.js +1 -1
  346. package/dist/theme/palette/primary.js.map +1 -1
  347. package/dist/theme/palette/secondary.js +1 -1
  348. package/dist/theme/palette/secondary.js.map +1 -1
  349. package/dist/theme/palette/success.js +1 -1
  350. package/dist/theme/palette/success.js.map +1 -1
  351. package/dist/theme/palette/text.js +1 -1
  352. package/dist/theme/palette/text.js.map +1 -1
  353. package/dist/theme/palette/warning.js +1 -1
  354. package/dist/theme/palette/warning.js.map +1 -1
  355. package/dist/theme/theme.d.ts.map +1 -1
  356. package/dist/theme/theme.js +13 -2
  357. package/dist/theme/theme.js.map +1 -1
  358. package/dist/theme/types/ThemeExtension.d.js +1 -1
  359. package/dist/theme/types/ThemeExtension.d.js.map +1 -1
  360. package/dist/theme/typography.js +1 -1
  361. package/dist/theme/typography.js.map +1 -1
  362. package/dist/utils/combine-sx.js +1 -1
  363. package/dist/utils/combine-sx.js.map +1 -1
  364. package/dist/utils/component-ids.js +1 -1
  365. package/dist/utils/component-ids.js.map +1 -1
  366. package/dist/utils/format.js +1 -1
  367. package/dist/utils/format.js.map +1 -1
  368. package/dist/utils/format.test.js +1 -1
  369. package/dist/utils/format.test.js.map +1 -1
  370. package/dist/utils/index.js +1 -1
  371. package/dist/utils/index.js.map +1 -1
  372. package/dist/utils/mathjs.js +1 -1
  373. package/dist/utils/mathjs.js.map +1 -1
  374. package/dist/utils/theme-gen.d.ts.map +1 -1
  375. package/dist/utils/theme-gen.js +6 -1
  376. package/dist/utils/theme-gen.js.map +1 -1
  377. package/dist/utils/theme-gen.test.js +6 -1
  378. package/dist/utils/theme-gen.test.js.map +1 -1
  379. package/package.json +5 -3
  380. package/dist/Tooltip/SeriesInfo.d.ts.map +0 -1
  381. package/dist/Tooltip/SeriesInfo.js +0 -143
  382. package/dist/Tooltip/SeriesInfo.js.map +0 -1
  383. package/dist/Tooltip/SeriesMarker.d.ts.map +0 -1
  384. package/dist/Tooltip/SeriesMarker.js.map +0 -1
  385. package/dist/Tooltip/Tooltip.d.ts.map +0 -1
  386. package/dist/Tooltip/Tooltip.js.map +0 -1
  387. package/dist/Tooltip/TooltipContent.d.ts.map +0 -1
  388. package/dist/Tooltip/TooltipContent.js.map +0 -1
  389. package/dist/Tooltip/focused-series.d.ts.map +0 -1
  390. package/dist/Tooltip/focused-series.js.map +0 -1
  391. package/dist/Tooltip/focused-series.test.d.ts.map +0 -1
  392. package/dist/Tooltip/focused-series.test.js.map +0 -1
  393. package/dist/Tooltip/index.d.ts +0 -3
  394. package/dist/Tooltip/index.d.ts.map +0 -1
  395. package/dist/Tooltip/tooltip-model.d.ts.map +0 -1
  396. package/dist/Tooltip/tooltip-model.js.map +0 -1
  397. package/dist/Tooltip/utils.d.ts.map +0 -1
  398. package/dist/Tooltip/utils.js.map +0 -1
  399. package/dist/cjs/Tooltip/SeriesInfo.js +0 -149
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -26,37 +26,60 @@ const _adapterDateFns = require("@mui/x-date-pickers/AdapterDateFns");
26
26
  const _timeZoneProvider = require("../context/TimeZoneProvider");
27
27
  const _utils = require("./utils");
28
28
  const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
29
- const AbsoluteTimePicker = ({ initialTimeRange , onChange })=>{
29
+ const AbsoluteTimePicker = ({ initialTimeRange , onChange , onCancel })=>{
30
+ const { formatWithUserTimeZone } = (0, _timeZoneProvider.useTimeZone)();
31
+ // Time range values as dates that can be used as a time range.
30
32
  const [timeRange, setTimeRange] = (0, _react.useState)(initialTimeRange);
33
+ // Time range values as strings used to populate the text inputs. May not
34
+ // be valid as dates when the user is typing.
35
+ const [timeRangeInputs, setTimeRangeInputs] = (0, _react.useState)({
36
+ start: formatWithUserTimeZone(initialTimeRange.start, DATE_TIME_FORMAT),
37
+ end: formatWithUserTimeZone(initialTimeRange.end, DATE_TIME_FORMAT)
38
+ });
31
39
  const [showStartCalendar, setShowStartCalendar] = (0, _react.useState)(true);
32
- const { formatWithUserTimeZone } = (0, _timeZoneProvider.useTimeZone)();
33
- // validate start and end time, propagate changes
34
- const updateDateRange = (input, isStartDate)=>{
35
- const newDate = new Date(input);
36
- if (isStartDate === true) {
37
- const isValidDateRange = (0, _utils.validateDateRange)(newDate, timeRange.end);
38
- if (isValidDateRange === true) {
39
- setTimeRange((current)=>{
40
- const updatedRange = {
41
- start: newDate,
42
- end: current.end
43
- };
44
- onChange(updatedRange);
45
- return updatedRange;
46
- });
47
- }
48
- } else {
49
- const isValidDateRange1 = (0, _utils.validateDateRange)(timeRange.start, newDate);
50
- if (isValidDateRange1 === true) {
51
- setTimeRange((current)=>{
52
- const updatedRange = {
53
- start: current.start,
54
- end: newDate
55
- };
56
- onChange(updatedRange);
57
- return updatedRange;
58
- });
59
- }
40
+ const changeTimeRange = (newTime, segment)=>{
41
+ const isInputChange = typeof newTime === 'string';
42
+ const newInputTime = isInputChange ? newTime : formatWithUserTimeZone(newTime, DATE_TIME_FORMAT);
43
+ setTimeRangeInputs((prevTimeRangeInputs)=>{
44
+ return {
45
+ ...prevTimeRangeInputs,
46
+ [segment]: newInputTime
47
+ };
48
+ });
49
+ // When the change is a string from an input, do not try to convert it to
50
+ // a date because there are likely to be interim stages of editing where it
51
+ // is not valid as a date. When the change is a Date from the calendar/clock
52
+ // interface, we can be sure it is a date.
53
+ if (!isInputChange) {
54
+ setTimeRange((prevTimeRange)=>{
55
+ return {
56
+ ...prevTimeRange,
57
+ [segment]: newTime
58
+ };
59
+ });
60
+ }
61
+ };
62
+ const onChangeStartTime = (newStartTime)=>{
63
+ changeTimeRange(newStartTime, 'start');
64
+ };
65
+ const onChangeEndTime = (newEndTime)=>{
66
+ changeTimeRange(newEndTime, 'end');
67
+ };
68
+ const updateDateRange = ()=>{
69
+ const newDates = {
70
+ start: new Date(timeRangeInputs.start),
71
+ end: new Date(timeRangeInputs.end)
72
+ };
73
+ const isValidDateRange = (0, _utils.validateDateRange)(newDates.start, newDates.end);
74
+ if (isValidDateRange) {
75
+ setTimeRange(newDates);
76
+ return newDates;
77
+ }
78
+ };
79
+ const onApply = ()=>{
80
+ const newDates = updateDateRange();
81
+ if (newDates) {
82
+ onChange(newDates);
60
83
  }
61
84
  };
62
85
  return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_xDatePickers.LocalizationProvider, {
@@ -93,12 +116,7 @@ const AbsoluteTimePicker = ({ initialTimeRange , onChange })=>{
93
116
  value: initialTimeRange.start,
94
117
  onChange: (newValue)=>{
95
118
  if (newValue === null) return;
96
- setTimeRange((current)=>{
97
- return {
98
- start: newValue,
99
- end: current.end
100
- };
101
- });
119
+ onChangeStartTime(newValue);
102
120
  },
103
121
  onAccept: ()=>{
104
122
  setShowStartCalendar(false);
@@ -135,16 +153,12 @@ const AbsoluteTimePicker = ({ initialTimeRange , onChange })=>{
135
153
  minDateTime: timeRange.start,
136
154
  onChange: (newValue)=>{
137
155
  if (newValue === null) return;
138
- setTimeRange((current)=>{
139
- return {
140
- start: current.start,
141
- end: newValue
142
- };
143
- });
156
+ onChangeEndTime(newValue);
144
157
  },
145
- onAccept: ()=>{
158
+ onAccept: (newValue)=>{
159
+ if (newValue === null) return;
146
160
  setShowStartCalendar(true);
147
- onChange(timeRange);
161
+ onChangeEndTime(newValue);
148
162
  },
149
163
  renderInput: (params)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
150
164
  ...params
@@ -162,24 +176,47 @@ const AbsoluteTimePicker = ({ initialTimeRange , onChange })=>{
162
176
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
163
177
  onChange: (event)=>{
164
178
  // TODO: add helperText, fix validation after we decide on form state solution
165
- updateDateRange(event.target.value, true);
179
+ onChangeStartTime(event.target.value);
166
180
  },
167
- value: formatWithUserTimeZone(timeRange.start, DATE_TIME_FORMAT),
181
+ onBlur: ()=>updateDateRange(),
182
+ value: timeRangeInputs.start,
168
183
  label: "Start Time",
169
- placeholder: "mm/dd/yyyy hh:mm",
184
+ placeholder: DATE_TIME_FORMAT,
170
185
  // tel used to match MUI DateTimePicker, may change in future: https://github.com/mui/material-ui/issues/27590
171
186
  type: "tel"
172
187
  }),
173
188
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
174
189
  onChange: (event)=>{
175
- updateDateRange(event.target.value, false);
190
+ onChangeEndTime(event.target.value);
176
191
  },
177
- value: formatWithUserTimeZone(timeRange.end, DATE_TIME_FORMAT),
192
+ onBlur: ()=>updateDateRange(),
193
+ value: timeRangeInputs.end,
178
194
  label: "End Time",
179
- placeholder: "mm/dd/yyyy hh:mm",
195
+ placeholder: DATE_TIME_FORMAT,
180
196
  type: "tel"
181
197
  })
182
198
  ]
199
+ }),
200
+ /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
201
+ direction: "row",
202
+ sx: {
203
+ padding: (theme)=>theme.spacing(0, 1)
204
+ },
205
+ gap: 1,
206
+ children: [
207
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
208
+ variant: "contained",
209
+ onClick: ()=>onApply(),
210
+ fullWidth: true,
211
+ children: "Apply"
212
+ }),
213
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
214
+ variant: "outlined",
215
+ onClick: ()=>onCancel(),
216
+ fullWidth: true,
217
+ children: "Cancel"
218
+ })
219
+ ]
183
220
  })
184
221
  ]
185
222
  })
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -54,7 +54,8 @@ function DateTimeRangePicker(props) {
54
54
  onChange: (value)=>{
55
55
  onChange(value);
56
56
  setShowCustomDateSelector(false);
57
- }
57
+ },
58
+ onCancel: ()=>setShowCustomDateSelector(false)
58
59
  })
59
60
  }),
60
61
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.FormControl, {
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -38,6 +38,9 @@ function TimeRangeSelector(props) {
38
38
  value: formattedValue,
39
39
  onChange: onSelectChange,
40
40
  IconComponent: _calendar.default,
41
+ inputProps: {
42
+ 'aria-label': `Select time range. Currently set to ${formattedValue}`
43
+ },
41
44
  sx: {
42
45
  '.MuiSelect-icon': {
43
46
  marginTop: '1px'
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -0,0 +1,85 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "Dialog", {
18
+ enumerable: true,
19
+ get: ()=>Dialog
20
+ });
21
+ const _jsxRuntime = require("react/jsx-runtime");
22
+ const _react = /*#__PURE__*/ _interopRequireDefault(require("react"));
23
+ const _material = require("@mui/material");
24
+ const _close = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Close"));
25
+ const _utils = require("../utils");
26
+ function _interopRequireDefault(obj) {
27
+ return obj && obj.__esModule ? obj : {
28
+ default: obj
29
+ };
30
+ }
31
+ const Header = ({ children , onClose , ...props })=>{
32
+ return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
33
+ children: [
34
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.DialogTitle, {
35
+ ...props,
36
+ children: children
37
+ }),
38
+ onClose && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
39
+ "aria-label": "Close",
40
+ onClick: onClose,
41
+ sx: dialogCloseIconButtonStyle,
42
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_close.default, {})
43
+ })
44
+ ]
45
+ });
46
+ };
47
+ const Content = ({ children , width =500 , sx , ...props })=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.DialogContent, {
48
+ dividers: true,
49
+ ...props,
50
+ sx: (0, _utils.combineSx)({
51
+ width: `${width}px`
52
+ }, sx),
53
+ children: children
54
+ });
55
+ const PrimaryButton = ({ children , ...props })=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
56
+ variant: "contained",
57
+ type: "submit",
58
+ ...props,
59
+ children: children
60
+ });
61
+ const SecondaryButton = ({ children , ...props })=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
62
+ variant: "outlined",
63
+ color: "secondary",
64
+ ...props,
65
+ children: children
66
+ });
67
+ /**
68
+ * Render the CSS of the dialog's close button, according to the given material theme.
69
+ * @param theme material theme
70
+ */ const dialogCloseIconButtonStyle = (theme)=>{
71
+ return {
72
+ position: 'absolute',
73
+ top: theme.spacing(0.5),
74
+ right: theme.spacing(0.5)
75
+ };
76
+ };
77
+ const Dialog = ({ children , ...props })=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Dialog, {
78
+ ...props,
79
+ children: children
80
+ });
81
+ Dialog.Header = Header;
82
+ Dialog.Content = Content;
83
+ Dialog.PrimaryButton = PrimaryButton;
84
+ Dialog.SecondaryButton = SecondaryButton;
85
+ Dialog.Actions = _material.DialogActions;
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -14,8 +14,7 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- _exportStar(require("./Tooltip"), exports);
18
- _exportStar(require("./SeriesMarker"), exports);
17
+ _exportStar(require("./Dialog"), exports);
19
18
  function _exportStar(from, to) {
20
19
  Object.keys(from).forEach(function(k) {
21
20
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -168,10 +168,7 @@ function GaugeChart(props) {
168
168
  color: 'inherit',
169
169
  fontSize: valueSizeClamp,
170
170
  formatter: (value)=>{
171
- return (0, _units.formatValue)(value, {
172
- kind: unit.kind,
173
- decimal_places: 0
174
- });
171
+ return (0, _units.formatValue)(value, unit);
175
172
  }
176
173
  },
177
174
  data: [
@@ -208,7 +205,8 @@ function GaugeChart(props) {
208
205
  return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_echart.EChart, {
209
206
  sx: {
210
207
  width: width,
211
- height: height
208
+ height: height,
209
+ padding: `${chartsTheme.container.padding.default}px`
212
210
  },
213
211
  option: option,
214
212
  theme: chartsTheme.echartsTheme
@@ -218,10 +216,7 @@ function getResponsiveValueSize(value, unit, width, height) {
218
216
  const MIN_SIZE = 3;
219
217
  const MAX_SIZE = 24;
220
218
  const SIZE_MULTIPLIER = 0.7;
221
- const formattedValue = (0, _units.formatValue)(value, {
222
- kind: unit.kind,
223
- decimal_places: 0
224
- });
219
+ const formattedValue = (0, _units.formatValue)(value, unit);
225
220
  var _length;
226
221
  const valueCharacters = (_length = formattedValue.length) !== null && _length !== void 0 ? _length : 2;
227
222
  const valueSize = Math.min(width, height) / valueCharacters * SIZE_MULTIPLIER;
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -14,15 +14,9 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- function _export(target, all) {
18
- for(var name in all)Object.defineProperty(target, name, {
19
- enumerable: true,
20
- get: all[name]
21
- });
22
- }
23
- _export(exports, {
24
- TooltipPlacement: ()=>TooltipPlacement,
25
- InfoTooltip: ()=>InfoTooltip
17
+ Object.defineProperty(exports, "InfoTooltip", {
18
+ enumerable: true,
19
+ get: ()=>InfoTooltip
26
20
  });
27
21
  const _jsxRuntime = require("react/jsx-runtime");
28
22
  const _react = /*#__PURE__*/ _interopRequireDefault(require("react"));
@@ -32,18 +26,11 @@ function _interopRequireDefault(obj) {
32
26
  default: obj
33
27
  };
34
28
  }
35
- var TooltipPlacement;
36
- (function(TooltipPlacement) {
37
- TooltipPlacement["Top"] = 'top';
38
- TooltipPlacement["Left"] = 'left';
39
- TooltipPlacement["Right"] = 'right';
40
- TooltipPlacement["Bottom"] = 'bottom';
41
- })(TooltipPlacement || (TooltipPlacement = {}));
42
29
  const InfoTooltip = ({ id , title , description , placement , children , enterDelay , enterNextDelay })=>{
43
30
  return /*#__PURE__*/ (0, _jsxRuntime.jsx)(StyledTooltip, {
44
31
  arrow: true,
45
32
  id: id,
46
- placement: placement !== null && placement !== void 0 ? placement : TooltipPlacement.Top,
33
+ placement: placement !== null && placement !== void 0 ? placement : 'top',
47
34
  title: /*#__PURE__*/ (0, _jsxRuntime.jsx)(TooltipContent, {
48
35
  title: title,
49
36
  description: description
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -20,37 +20,47 @@ Object.defineProperty(exports, "JSONEditor", {
20
20
  });
21
21
  const _jsxRuntime = require("react/jsx-runtime");
22
22
  const _react = require("react");
23
+ const _reactCodemirror = /*#__PURE__*/ _interopRequireDefault(require("@uiw/react-codemirror"));
24
+ const _langJson = require("@codemirror/lang-json");
25
+ const _lint = require("@codemirror/lint");
23
26
  const _material = require("@mui/material");
27
+ function _interopRequireDefault(obj) {
28
+ return obj && obj.__esModule ? obj : {
29
+ default: obj
30
+ };
31
+ }
24
32
  function JSONEditor(props) {
33
+ const theme = (0, _material.useTheme)();
34
+ const isDarkMode = theme.palette.mode === 'dark';
25
35
  const [value, setValue] = (0, _react.useState)(()=>JSON.stringify(props.value, null, 2));
26
- const [invalidJSON, setInvalidJSON] = (0, _react.useState)(false);
27
36
  (0, _react.useEffect)(()=>{
28
37
  setValue(JSON.stringify(props.value, null, 2));
29
- setInvalidJSON(false);
30
38
  }, [
31
39
  props.value
32
40
  ]);
33
- // TODO: replace with CodeMirror editor
34
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
35
- label: "JSON",
36
- error: invalidJSON,
37
- helperText: invalidJSON ? 'Invalid JSON' : '',
38
- multiline: true,
39
- fullWidth: true,
41
+ return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_reactCodemirror.default, {
42
+ ...props,
43
+ style: {
44
+ border: `1px solid ${theme.palette.divider}`
45
+ },
46
+ theme: isDarkMode ? 'dark' : 'light',
47
+ extensions: [
48
+ (0, _langJson.json)(),
49
+ (0, _lint.linter)((0, _langJson.jsonParseLinter)()),
50
+ (0, _lint.lintGutter)()
51
+ ],
40
52
  value: value,
41
- onChange: (event)=>{
42
- setValue(event.target.value);
53
+ onChange: (newValue)=>{
54
+ setValue(newValue);
43
55
  },
44
- maxRows: 20,
45
56
  onBlur: ()=>{
46
57
  try {
47
58
  const json = JSON.parse(value !== null && value !== void 0 ? value : '{}');
48
- setInvalidJSON(false);
49
59
  if (props.onChange !== undefined) {
50
60
  props.onChange(json);
51
61
  }
52
62
  } catch (e) {
53
- setInvalidJSON(true);
63
+ // ignore this error
54
64
  }
55
65
  }
56
66
  });
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -23,7 +23,7 @@ const _material = require("@mui/material");
23
23
  const _listLegend = require("./ListLegend");
24
24
  const _compactLegend = require("./CompactLegend");
25
25
  function Legend({ width , height , options , data }) {
26
- if (options.position === 'right') {
26
+ if (options.position === 'Right') {
27
27
  return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
28
28
  sx: {
29
29
  width: width,
@@ -31,6 +31,7 @@ function Legend({ width , height , options , data }) {
31
31
  position: 'absolute',
32
32
  top: 0,
33
33
  right: 0,
34
+ overflowX: 'hidden',
34
35
  overflowY: 'scroll'
35
36
  },
36
37
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_listLegend.ListLegend, {
@@ -38,8 +39,19 @@ function Legend({ width , height , options , data }) {
38
39
  })
39
40
  });
40
41
  }
41
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_compactLegend.CompactLegend, {
42
- items: data,
43
- height: height
42
+ return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
43
+ sx: {
44
+ width: width,
45
+ height: height,
46
+ position: 'absolute',
47
+ bottom: 0
48
+ },
49
+ children: [
50
+ /*#__PURE__*/ (0, _jsxRuntime.jsx)(_compactLegend.CompactLegend, {
51
+ items: data,
52
+ height: height
53
+ }),
54
+ ";"
55
+ ]
44
56
  });
45
57
  }
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at