@perses-dev/components 0.0.0-snapshot-time-range-height-80d08fc
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.
- package/LICENSE +201 -0
- package/README.md +18 -0
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +9 -0
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -0
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +181 -0
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -0
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +12 -0
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -0
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js +79 -0
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -0
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +17 -0
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -0
- package/dist/DateTimeRangePicker/TimeRangeSelector.js +58 -0
- package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -0
- package/dist/DateTimeRangePicker/index.d.ts +4 -0
- package/dist/DateTimeRangePicker/index.d.ts.map +1 -0
- package/dist/DateTimeRangePicker/index.js +17 -0
- package/dist/DateTimeRangePicker/index.js.map +1 -0
- package/dist/DateTimeRangePicker/utils.d.ts +7 -0
- package/dist/DateTimeRangePicker/utils.d.ts.map +1 -0
- package/dist/DateTimeRangePicker/utils.js +37 -0
- package/dist/DateTimeRangePicker/utils.js.map +1 -0
- package/dist/Drawer/Drawer.d.ts +9 -0
- package/dist/Drawer/Drawer.d.ts.map +1 -0
- package/dist/Drawer/Drawer.js +34 -0
- package/dist/Drawer/Drawer.js.map +1 -0
- package/dist/Drawer/index.d.ts +2 -0
- package/dist/Drawer/index.d.ts.map +1 -0
- package/dist/Drawer/index.js +15 -0
- package/dist/Drawer/index.js.map +1 -0
- package/dist/EChart.d.ts +61 -0
- package/dist/EChart.d.ts.map +1 -0
- package/dist/EChart.js +143 -0
- package/dist/EChart.js.map +1 -0
- package/dist/ErrorAlert.d.ts +9 -0
- package/dist/ErrorAlert.d.ts.map +1 -0
- package/dist/ErrorAlert.js +25 -0
- package/dist/ErrorAlert.js.map +1 -0
- package/dist/ErrorBoundary.d.ts +3 -0
- package/dist/ErrorBoundary.d.ts.map +1 -0
- package/dist/ErrorBoundary.js +16 -0
- package/dist/ErrorBoundary.js.map +1 -0
- package/dist/GaugeChart/GaugeChart.d.ts +15 -0
- package/dist/GaugeChart/GaugeChart.d.ts.map +1 -0
- package/dist/GaugeChart/GaugeChart.js +172 -0
- package/dist/GaugeChart/GaugeChart.js.map +1 -0
- package/dist/GaugeChart/index.d.ts +2 -0
- package/dist/GaugeChart/index.d.ts.map +1 -0
- package/dist/GaugeChart/index.js +15 -0
- package/dist/GaugeChart/index.js.map +1 -0
- package/dist/InfoTooltip/InfoTooltip.d.ts +17 -0
- package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -0
- package/dist/InfoTooltip/InfoTooltip.js +76 -0
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -0
- package/dist/InfoTooltip/InfoTooltip.test.d.ts +2 -0
- package/dist/InfoTooltip/InfoTooltip.test.d.ts.map +1 -0
- package/dist/InfoTooltip/InfoTooltip.test.js +36 -0
- package/dist/InfoTooltip/InfoTooltip.test.js.map +1 -0
- package/dist/InfoTooltip/index.d.ts +2 -0
- package/dist/InfoTooltip/index.d.ts.map +1 -0
- package/dist/InfoTooltip/index.js +15 -0
- package/dist/InfoTooltip/index.js.map +1 -0
- package/dist/JSONEditor.d.ts +8 -0
- package/dist/JSONEditor.d.ts.map +1 -0
- package/dist/JSONEditor.js +51 -0
- package/dist/JSONEditor.js.map +1 -0
- package/dist/Legend/CompactLegend.d.ts +13 -0
- package/dist/Legend/CompactLegend.d.ts.map +1 -0
- package/dist/Legend/CompactLegend.js +45 -0
- package/dist/Legend/CompactLegend.js.map +1 -0
- package/dist/Legend/Legend.d.ts +11 -0
- package/dist/Legend/Legend.d.ts.map +1 -0
- package/dist/Legend/Legend.js +39 -0
- package/dist/Legend/Legend.js.map +1 -0
- package/dist/Legend/LegendColorBadge.d.ts +7 -0
- package/dist/Legend/LegendColorBadge.d.ts.map +1 -0
- package/dist/Legend/LegendColorBadge.js +31 -0
- package/dist/Legend/LegendColorBadge.js.map +1 -0
- package/dist/Legend/ListLegend.d.ts +11 -0
- package/dist/Legend/ListLegend.d.ts.map +1 -0
- package/dist/Legend/ListLegend.js +40 -0
- package/dist/Legend/ListLegend.js.map +1 -0
- package/dist/Legend/ListLegendItem.d.ts +9 -0
- package/dist/Legend/ListLegendItem.d.ts.map +1 -0
- package/dist/Legend/ListLegendItem.js +47 -0
- package/dist/Legend/ListLegendItem.js.map +1 -0
- package/dist/Legend/index.d.ts +2 -0
- package/dist/Legend/index.d.ts.map +1 -0
- package/dist/Legend/index.js +15 -0
- package/dist/Legend/index.js.map +1 -0
- package/dist/LineChart/LineChart.d.ts +19 -0
- package/dist/LineChart/LineChart.d.ts.map +1 -0
- package/dist/LineChart/LineChart.js +189 -0
- package/dist/LineChart/LineChart.js.map +1 -0
- package/dist/LineChart/index.d.ts +3 -0
- package/dist/LineChart/index.d.ts.map +1 -0
- package/dist/LineChart/index.js +15 -0
- package/dist/LineChart/index.js.map +1 -0
- package/dist/LineChart/utils.d.ts +30 -0
- package/dist/LineChart/utils.d.ts.map +1 -0
- package/dist/LineChart/utils.js +90 -0
- package/dist/LineChart/utils.js.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +13 -0
- package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js +28 -0
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +5 -0
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +50 -0
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +13 -0
- package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +26 -0
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +13 -0
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +36 -0
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -0
- package/dist/OptionsEditorLayout/index.d.ts +5 -0
- package/dist/OptionsEditorLayout/index.d.ts.map +1 -0
- package/dist/OptionsEditorLayout/index.js +18 -0
- package/dist/OptionsEditorLayout/index.js.map +1 -0
- package/dist/StatChart/StatChart.d.ts +19 -0
- package/dist/StatChart/StatChart.d.ts.map +1 -0
- package/dist/StatChart/StatChart.js +121 -0
- package/dist/StatChart/StatChart.js.map +1 -0
- package/dist/StatChart/StatChart.test.d.ts +2 -0
- package/dist/StatChart/StatChart.test.d.ts.map +1 -0
- package/dist/StatChart/StatChart.test.js +87 -0
- package/dist/StatChart/StatChart.test.js.map +1 -0
- package/dist/StatChart/index.d.ts +2 -0
- package/dist/StatChart/index.d.ts.map +1 -0
- package/dist/StatChart/index.js +15 -0
- package/dist/StatChart/index.js.map +1 -0
- package/dist/Tooltip/SeriesInfo.d.ts +12 -0
- package/dist/Tooltip/SeriesInfo.d.ts.map +1 -0
- package/dist/Tooltip/SeriesInfo.js +143 -0
- package/dist/Tooltip/SeriesInfo.js.map +1 -0
- package/dist/Tooltip/SeriesMarker.d.ts +7 -0
- package/dist/Tooltip/SeriesMarker.d.ts.map +1 -0
- package/dist/Tooltip/SeriesMarker.js +33 -0
- package/dist/Tooltip/SeriesMarker.js.map +1 -0
- package/dist/Tooltip/Tooltip.d.ts +13 -0
- package/dist/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/Tooltip/Tooltip.js +72 -0
- package/dist/Tooltip/Tooltip.js.map +1 -0
- package/dist/Tooltip/TooltipContent.d.ts +9 -0
- package/dist/Tooltip/TooltipContent.d.ts.map +1 -0
- package/dist/Tooltip/TooltipContent.js +89 -0
- package/dist/Tooltip/TooltipContent.js.map +1 -0
- package/dist/Tooltip/focused-series.d.ts +25 -0
- package/dist/Tooltip/focused-series.d.ts.map +1 -0
- package/dist/Tooltip/focused-series.js +111 -0
- package/dist/Tooltip/focused-series.js.map +1 -0
- package/dist/Tooltip/focused-series.test.d.ts +2 -0
- package/dist/Tooltip/focused-series.test.d.ts.map +1 -0
- package/dist/Tooltip/focused-series.test.js +93 -0
- package/dist/Tooltip/focused-series.test.js.map +1 -0
- package/dist/Tooltip/index.d.ts +3 -0
- package/dist/Tooltip/index.d.ts.map +1 -0
- package/dist/Tooltip/index.js +16 -0
- package/dist/Tooltip/index.js.map +1 -0
- package/dist/Tooltip/tooltip-model.d.ts +79 -0
- package/dist/Tooltip/tooltip-model.d.ts.map +1 -0
- package/dist/Tooltip/tooltip-model.js +80 -0
- package/dist/Tooltip/tooltip-model.js.map +1 -0
- package/dist/Tooltip/utils.d.ts +6 -0
- package/dist/Tooltip/utils.d.ts.map +1 -0
- package/dist/Tooltip/utils.js +46 -0
- package/dist/Tooltip/utils.js.map +1 -0
- package/dist/UnitSelector/UnitSelector.d.ts +8 -0
- package/dist/UnitSelector/UnitSelector.d.ts.map +1 -0
- package/dist/UnitSelector/UnitSelector.js +112 -0
- package/dist/UnitSelector/UnitSelector.js.map +1 -0
- package/dist/UnitSelector/UnitSelector.test.d.ts +2 -0
- package/dist/UnitSelector/UnitSelector.test.d.ts.map +1 -0
- package/dist/UnitSelector/UnitSelector.test.js +205 -0
- package/dist/UnitSelector/UnitSelector.test.js.map +1 -0
- package/dist/UnitSelector/index.d.ts +2 -0
- package/dist/UnitSelector/index.d.ts.map +1 -0
- package/dist/UnitSelector/index.js +15 -0
- package/dist/UnitSelector/index.js.map +1 -0
- package/dist/YAxisLabel.d.ts +8 -0
- package/dist/YAxisLabel.d.ts.map +1 -0
- package/dist/YAxisLabel.js +39 -0
- package/dist/YAxisLabel.js.map +1 -0
- package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +187 -0
- package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +85 -0
- package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +69 -0
- package/dist/cjs/DateTimeRangePicker/index.js +30 -0
- package/dist/cjs/DateTimeRangePicker/utils.js +45 -0
- package/dist/cjs/Drawer/Drawer.js +40 -0
- package/dist/cjs/Drawer/index.js +28 -0
- package/dist/cjs/EChart.js +188 -0
- package/dist/cjs/ErrorAlert.js +29 -0
- package/dist/cjs/ErrorBoundary.js +22 -0
- package/dist/cjs/GaugeChart/GaugeChart.js +178 -0
- package/dist/cjs/GaugeChart/index.js +28 -0
- package/dist/cjs/InfoTooltip/InfoTooltip.js +93 -0
- package/dist/cjs/InfoTooltip/InfoTooltip.test.js +43 -0
- package/dist/cjs/InfoTooltip/index.js +28 -0
- package/dist/cjs/JSONEditor.js +57 -0
- package/dist/cjs/Legend/CompactLegend.js +48 -0
- package/dist/cjs/Legend/Legend.js +45 -0
- package/dist/cjs/Legend/LegendColorBadge.js +42 -0
- package/dist/cjs/Legend/ListLegend.js +44 -0
- package/dist/cjs/Legend/ListLegendItem.js +91 -0
- package/dist/cjs/Legend/index.js +28 -0
- package/dist/cjs/LineChart/LineChart.js +195 -0
- package/dist/cjs/LineChart/index.js +28 -0
- package/dist/cjs/LineChart/utils.js +95 -0
- package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +32 -0
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +61 -0
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +29 -0
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +40 -0
- package/dist/cjs/OptionsEditorLayout/index.js +31 -0
- package/dist/cjs/StatChart/StatChart.js +165 -0
- package/dist/cjs/StatChart/StatChart.test.js +89 -0
- package/dist/cjs/StatChart/index.js +28 -0
- package/dist/cjs/Tooltip/SeriesInfo.js +149 -0
- package/dist/cjs/Tooltip/SeriesMarker.js +39 -0
- package/dist/cjs/Tooltip/Tooltip.js +116 -0
- package/dist/cjs/Tooltip/TooltipContent.js +95 -0
- package/dist/cjs/Tooltip/focused-series.js +117 -0
- package/dist/cjs/Tooltip/focused-series.test.js +95 -0
- package/dist/cjs/Tooltip/index.js +29 -0
- package/dist/cjs/Tooltip/tooltip-model.js +98 -0
- package/dist/cjs/Tooltip/utils.js +50 -0
- package/dist/cjs/UnitSelector/UnitSelector.js +118 -0
- package/dist/cjs/UnitSelector/UnitSelector.test.js +212 -0
- package/dist/cjs/UnitSelector/index.js +28 -0
- package/dist/cjs/YAxisLabel.js +45 -0
- package/dist/cjs/context/ChartsThemeProvider.js +83 -0
- package/dist/cjs/context/TimeZoneProvider.js +90 -0
- package/dist/cjs/index.js +47 -0
- package/dist/cjs/model/graph.js +21 -0
- package/dist/cjs/model/index.js +30 -0
- package/dist/cjs/model/theme.js +16 -0
- package/dist/cjs/model/units/bytes.js +60 -0
- package/dist/cjs/model/units/constants.js +23 -0
- package/dist/cjs/model/units/decimal.js +67 -0
- package/dist/cjs/model/units/index.js +30 -0
- package/dist/cjs/model/units/percent.js +64 -0
- package/dist/cjs/model/units/time.js +102 -0
- package/dist/cjs/model/units/types.js +28 -0
- package/dist/cjs/model/units/units.js +104 -0
- package/dist/cjs/test/index.js +28 -0
- package/dist/cjs/test/render.js +36 -0
- package/dist/cjs/test/setup-tests.js +20 -0
- package/dist/cjs/test-utils/index.js +28 -0
- package/dist/cjs/test-utils/theme.js +28 -0
- package/dist/cjs/theme/index.js +28 -0
- package/dist/cjs/theme/palette/background.js +40 -0
- package/dist/cjs/theme/palette/colors/blue.js +35 -0
- package/dist/cjs/theme/palette/colors/common.js +28 -0
- package/dist/cjs/theme/palette/colors/green.js +35 -0
- package/dist/cjs/theme/palette/colors/grey.js +35 -0
- package/dist/cjs/theme/palette/colors/index.js +35 -0
- package/dist/cjs/theme/palette/colors/orange.js +35 -0
- package/dist/cjs/theme/palette/colors/purple.js +35 -0
- package/dist/cjs/theme/palette/colors/red.js +35 -0
- package/dist/cjs/theme/palette/colors/types.js +16 -0
- package/dist/cjs/theme/palette/error.js +32 -0
- package/dist/cjs/theme/palette/grey.js +44 -0
- package/dist/cjs/theme/palette/index.js +28 -0
- package/dist/cjs/theme/palette/palette-options.js +59 -0
- package/dist/cjs/theme/palette/primary.js +32 -0
- package/dist/cjs/theme/palette/secondary.js +32 -0
- package/dist/cjs/theme/palette/success.js +32 -0
- package/dist/cjs/theme/palette/text.js +42 -0
- package/dist/cjs/theme/palette/warning.js +32 -0
- package/dist/cjs/theme/theme.js +64 -0
- package/dist/cjs/theme/types/ThemeExtension.d.js +17 -0
- package/dist/cjs/theme/typography.js +96 -0
- package/dist/cjs/utils/combine-sx.js +29 -0
- package/dist/cjs/utils/component-ids.js +31 -0
- package/dist/cjs/utils/format.js +56 -0
- package/dist/cjs/utils/format.test.js +47 -0
- package/dist/cjs/utils/index.js +31 -0
- package/dist/cjs/utils/mathjs.js +25 -0
- package/dist/cjs/utils/theme-gen.js +188 -0
- package/dist/cjs/utils/theme-gen.test.js +197 -0
- package/dist/context/ChartsThemeProvider.d.ts +10 -0
- package/dist/context/ChartsThemeProvider.d.ts.map +1 -0
- package/dist/context/ChartsThemeProvider.js +31 -0
- package/dist/context/ChartsThemeProvider.js.map +1 -0
- package/dist/context/TimeZoneProvider.d.ts +13 -0
- package/dist/context/TimeZoneProvider.d.ts.map +1 -0
- package/dist/context/TimeZoneProvider.js +38 -0
- package/dist/context/TimeZoneProvider.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/model/graph.d.ts +34 -0
- package/dist/model/graph.d.ts.map +1 -0
- package/dist/model/graph.js +16 -0
- package/dist/model/graph.js.map +1 -0
- package/dist/model/index.d.ts +4 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +17 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/theme.d.ts +15 -0
- package/dist/model/theme.d.ts.map +1 -0
- package/dist/model/theme.js +15 -0
- package/dist/model/theme.js.map +1 -0
- package/dist/model/units/bytes.d.ts +12 -0
- package/dist/model/units/bytes.d.ts.map +1 -0
- package/dist/model/units/bytes.js +48 -0
- package/dist/model/units/bytes.js.map +1 -0
- package/dist/model/units/constants.d.ts +2 -0
- package/dist/model/units/constants.d.ts.map +1 -0
- package/dist/model/units/constants.js +17 -0
- package/dist/model/units/constants.js.map +1 -0
- package/dist/model/units/decimal.d.ts +24 -0
- package/dist/model/units/decimal.d.ts.map +1 -0
- package/dist/model/units/decimal.js +59 -0
- package/dist/model/units/decimal.js.map +1 -0
- package/dist/model/units/index.d.ts +4 -0
- package/dist/model/units/index.d.ts.map +1 -0
- package/dist/model/units/index.js +17 -0
- package/dist/model/units/index.js.map +1 -0
- package/dist/model/units/percent.d.ts +12 -0
- package/dist/model/units/percent.d.ts.map +1 -0
- package/dist/model/units/percent.js +51 -0
- package/dist/model/units/percent.js.map +1 -0
- package/dist/model/units/time.d.ts +22 -0
- package/dist/model/units/time.d.ts.map +1 -0
- package/dist/model/units/time.js +88 -0
- package/dist/model/units/time.js.map +1 -0
- package/dist/model/units/types.d.ts +38 -0
- package/dist/model/units/types.d.ts.map +1 -0
- package/dist/model/units/types.js +22 -0
- package/dist/model/units/types.js.map +1 -0
- package/dist/model/units/units.d.ts +40 -0
- package/dist/model/units/units.d.ts.map +1 -0
- package/dist/model/units/units.js +83 -0
- package/dist/model/units/units.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +15 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/render.d.ts +7 -0
- package/dist/test/render.d.ts.map +1 -0
- package/dist/test/render.js +32 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.d.ts +2 -0
- package/dist/test/setup-tests.d.ts.map +1 -0
- package/dist/test/setup-tests.js +18 -0
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/test-utils/index.d.ts +2 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +15 -0
- package/dist/test-utils/index.js.map +1 -0
- package/dist/test-utils/theme.d.ts +3 -0
- package/dist/test-utils/theme.d.ts.map +1 -0
- package/dist/test-utils/theme.js +22 -0
- package/dist/test-utils/theme.js.map +1 -0
- package/dist/theme/index.d.ts +37 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +15 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/palette/background.d.ts +3 -0
- package/dist/theme/palette/background.d.ts.map +1 -0
- package/dist/theme/palette/background.js +34 -0
- package/dist/theme/palette/background.js.map +1 -0
- package/dist/theme/palette/colors/blue.d.ts +3 -0
- package/dist/theme/palette/colors/blue.d.ts.map +1 -0
- package/dist/theme/palette/colors/blue.js +29 -0
- package/dist/theme/palette/colors/blue.js.map +1 -0
- package/dist/theme/palette/colors/common.d.ts +3 -0
- package/dist/theme/palette/colors/common.d.ts.map +1 -0
- package/dist/theme/palette/colors/common.js +16 -0
- package/dist/theme/palette/colors/common.js.map +1 -0
- package/dist/theme/palette/colors/green.d.ts +3 -0
- package/dist/theme/palette/colors/green.d.ts.map +1 -0
- package/dist/theme/palette/colors/green.js +29 -0
- package/dist/theme/palette/colors/green.js.map +1 -0
- package/dist/theme/palette/colors/grey.d.ts +3 -0
- package/dist/theme/palette/colors/grey.d.ts.map +1 -0
- package/dist/theme/palette/colors/grey.js +29 -0
- package/dist/theme/palette/colors/grey.js.map +1 -0
- package/dist/theme/palette/colors/index.d.ts +9 -0
- package/dist/theme/palette/colors/index.d.ts.map +1 -0
- package/dist/theme/palette/colors/index.js +22 -0
- package/dist/theme/palette/colors/index.js.map +1 -0
- package/dist/theme/palette/colors/orange.d.ts +3 -0
- package/dist/theme/palette/colors/orange.d.ts.map +1 -0
- package/dist/theme/palette/colors/orange.js +29 -0
- package/dist/theme/palette/colors/orange.js.map +1 -0
- package/dist/theme/palette/colors/purple.d.ts +3 -0
- package/dist/theme/palette/colors/purple.d.ts.map +1 -0
- package/dist/theme/palette/colors/purple.js +29 -0
- package/dist/theme/palette/colors/purple.js.map +1 -0
- package/dist/theme/palette/colors/red.d.ts +3 -0
- package/dist/theme/palette/colors/red.d.ts.map +1 -0
- package/dist/theme/palette/colors/red.js +29 -0
- package/dist/theme/palette/colors/red.js.map +1 -0
- package/dist/theme/palette/colors/types.d.ts +17 -0
- package/dist/theme/palette/colors/types.d.ts.map +1 -0
- package/dist/theme/palette/colors/types.js +15 -0
- package/dist/theme/palette/colors/types.js.map +1 -0
- package/dist/theme/palette/error.d.ts +3 -0
- package/dist/theme/palette/error.d.ts.map +1 -0
- package/dist/theme/palette/error.js +26 -0
- package/dist/theme/palette/error.js.map +1 -0
- package/dist/theme/palette/grey.d.ts +3 -0
- package/dist/theme/palette/grey.d.ts.map +1 -0
- package/dist/theme/palette/grey.js +38 -0
- package/dist/theme/palette/grey.js.map +1 -0
- package/dist/theme/palette/index.d.ts +3 -0
- package/dist/theme/palette/index.d.ts.map +1 -0
- package/dist/theme/palette/index.js +15 -0
- package/dist/theme/palette/index.js.map +1 -0
- package/dist/theme/palette/palette-options.d.ts +6 -0
- package/dist/theme/palette/palette-options.d.ts.map +1 -0
- package/dist/theme/palette/palette-options.js +55 -0
- package/dist/theme/palette/palette-options.js.map +1 -0
- package/dist/theme/palette/primary.d.ts +3 -0
- package/dist/theme/palette/primary.d.ts.map +1 -0
- package/dist/theme/palette/primary.js +26 -0
- package/dist/theme/palette/primary.js.map +1 -0
- package/dist/theme/palette/secondary.d.ts +3 -0
- package/dist/theme/palette/secondary.d.ts.map +1 -0
- package/dist/theme/palette/secondary.js +26 -0
- package/dist/theme/palette/secondary.js.map +1 -0
- package/dist/theme/palette/success.d.ts +3 -0
- package/dist/theme/palette/success.d.ts.map +1 -0
- package/dist/theme/palette/success.js +26 -0
- package/dist/theme/palette/success.js.map +1 -0
- package/dist/theme/palette/text.d.ts +3 -0
- package/dist/theme/palette/text.d.ts.map +1 -0
- package/dist/theme/palette/text.js +36 -0
- package/dist/theme/palette/text.js.map +1 -0
- package/dist/theme/palette/warning.d.ts +3 -0
- package/dist/theme/palette/warning.d.ts.map +1 -0
- package/dist/theme/palette/warning.js +26 -0
- package/dist/theme/palette/warning.js.map +1 -0
- package/dist/theme/theme.d.ts +13 -0
- package/dist/theme/theme.d.ts.map +1 -0
- package/dist/theme/theme.js +67 -0
- package/dist/theme/theme.js.map +1 -0
- package/dist/theme/types/ThemeExtension.d.js +16 -0
- package/dist/theme/types/ThemeExtension.d.js.map +1 -0
- package/dist/theme/typography.d.ts +10 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/dist/theme/typography.js +92 -0
- package/dist/theme/typography.js.map +1 -0
- package/dist/utils/combine-sx.d.ts +8 -0
- package/dist/utils/combine-sx.d.ts.map +1 -0
- package/dist/utils/combine-sx.js +27 -0
- package/dist/utils/combine-sx.js.map +1 -0
- package/dist/utils/component-ids.d.ts +8 -0
- package/dist/utils/component-ids.d.ts.map +1 -0
- package/dist/utils/component-ids.js +27 -0
- package/dist/utils/component-ids.js.map +1 -0
- package/dist/utils/format.d.ts +3 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +44 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/format.test.d.ts +2 -0
- package/dist/utils/format.test.d.ts.map +1 -0
- package/dist/utils/format.test.js +45 -0
- package/dist/utils/format.test.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/mathjs.d.ts +6 -0
- package/dist/utils/mathjs.d.ts.map +1 -0
- package/dist/utils/mathjs.js +20 -0
- package/dist/utils/mathjs.js.map +1 -0
- package/dist/utils/theme-gen.d.ts +6 -0
- package/dist/utils/theme-gen.d.ts.map +1 -0
- package/dist/utils/theme-gen.js +182 -0
- package/dist/utils/theme-gen.js.map +1 -0
- package/dist/utils/theme-gen.test.d.ts +2 -0
- package/dist/utils/theme-gen.test.d.ts.map +1 -0
- package/dist/utils/theme-gen.test.js +195 -0
- package/dist/utils/theme-gen.test.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
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
|
+
TOOLTIP_MAX_WIDTH: ()=>TOOLTIP_MAX_WIDTH,
|
|
25
|
+
TOOLTIP_MAX_HEIGHT: ()=>TOOLTIP_MAX_HEIGHT,
|
|
26
|
+
TOOLTIP_LABELS_MAX_WIDTH: ()=>TOOLTIP_LABELS_MAX_WIDTH,
|
|
27
|
+
TOOLTIP_MAX_ITEMS: ()=>TOOLTIP_MAX_ITEMS,
|
|
28
|
+
TOOLTIP_DATE_FORMAT: ()=>TOOLTIP_DATE_FORMAT,
|
|
29
|
+
defaultCursorData: ()=>defaultCursorData,
|
|
30
|
+
emptyTooltipData: ()=>emptyTooltipData,
|
|
31
|
+
useMousePosition: ()=>useMousePosition
|
|
32
|
+
});
|
|
33
|
+
const _react = require("react");
|
|
34
|
+
const TOOLTIP_MAX_WIDTH = 650;
|
|
35
|
+
const TOOLTIP_MAX_HEIGHT = 230;
|
|
36
|
+
const TOOLTIP_LABELS_MAX_WIDTH = TOOLTIP_MAX_WIDTH - 150;
|
|
37
|
+
const TOOLTIP_MAX_ITEMS = 50;
|
|
38
|
+
const TOOLTIP_DATE_FORMAT = new Intl.DateTimeFormat(undefined, {
|
|
39
|
+
year: 'numeric',
|
|
40
|
+
month: 'short',
|
|
41
|
+
day: 'numeric',
|
|
42
|
+
hour: 'numeric',
|
|
43
|
+
minute: 'numeric',
|
|
44
|
+
second: 'numeric',
|
|
45
|
+
hour12: true
|
|
46
|
+
});
|
|
47
|
+
const defaultCursorData = {
|
|
48
|
+
coords: {
|
|
49
|
+
viewport: {
|
|
50
|
+
x: 0,
|
|
51
|
+
y: 0
|
|
52
|
+
},
|
|
53
|
+
plotCanvas: {
|
|
54
|
+
x: 0,
|
|
55
|
+
y: 0
|
|
56
|
+
},
|
|
57
|
+
zrender: {
|
|
58
|
+
x: 0,
|
|
59
|
+
y: 0
|
|
60
|
+
},
|
|
61
|
+
target: null
|
|
62
|
+
},
|
|
63
|
+
chartWidth: 0
|
|
64
|
+
};
|
|
65
|
+
const emptyTooltipData = {
|
|
66
|
+
cursor: defaultCursorData,
|
|
67
|
+
focusedSeries: null
|
|
68
|
+
};
|
|
69
|
+
const useMousePosition = ()=>{
|
|
70
|
+
const [coords, setCoords] = (0, _react.useState)(null);
|
|
71
|
+
(0, _react.useEffect)(()=>{
|
|
72
|
+
const setFromEvent = (e)=>{
|
|
73
|
+
return setCoords({
|
|
74
|
+
viewport: {
|
|
75
|
+
x: e.clientX,
|
|
76
|
+
y: e.clientY
|
|
77
|
+
},
|
|
78
|
+
plotCanvas: {
|
|
79
|
+
x: e.offsetX,
|
|
80
|
+
y: e.offsetY
|
|
81
|
+
},
|
|
82
|
+
zrender: {
|
|
83
|
+
// echarts canvas coordinates added automatically by zrender
|
|
84
|
+
// zrX and zrY are similar to offsetX and offsetY but they return undefined when not hovering over a chart canvas
|
|
85
|
+
x: e.zrX,
|
|
86
|
+
y: e.zrY
|
|
87
|
+
},
|
|
88
|
+
// necessary to check whether cursor target matches correct chart canvas (since each chart has its own mousemove listener)
|
|
89
|
+
target: e.target
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
window.addEventListener('mousemove', setFromEvent);
|
|
93
|
+
return ()=>{
|
|
94
|
+
window.removeEventListener('mousemove', setFromEvent);
|
|
95
|
+
};
|
|
96
|
+
}, []);
|
|
97
|
+
return coords;
|
|
98
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright 2022 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, "assembleTransform", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>assembleTransform
|
|
20
|
+
});
|
|
21
|
+
const _tooltipModel = require("./tooltip-model");
|
|
22
|
+
function assembleTransform(mousePos, seriesNum, chartWidth, chartHeight, pinnedPos) {
|
|
23
|
+
if (mousePos === null) {
|
|
24
|
+
return 'translate3d(0, 0)';
|
|
25
|
+
}
|
|
26
|
+
if (pinnedPos !== null) {
|
|
27
|
+
mousePos = pinnedPos;
|
|
28
|
+
}
|
|
29
|
+
const cursorPaddingX = 32;
|
|
30
|
+
const cursorPaddingY = 16;
|
|
31
|
+
const x = mousePos.viewport.x;
|
|
32
|
+
let y = mousePos.viewport.y + cursorPaddingY;
|
|
33
|
+
const isCloseToBottom = mousePos.viewport.y > window.innerHeight * 0.8;
|
|
34
|
+
const yPosAdjustThreshold = chartHeight * 0.75;
|
|
35
|
+
// adjust so tooltip does not get cut off at bottom of chart, reduce multiplier to move up
|
|
36
|
+
if (isCloseToBottom === true) {
|
|
37
|
+
if (seriesNum > 6) {
|
|
38
|
+
y = mousePos.viewport.y * 0.65;
|
|
39
|
+
} else {
|
|
40
|
+
y = mousePos.viewport.y * 0.75;
|
|
41
|
+
}
|
|
42
|
+
} else if (mousePos.plotCanvas.y > yPosAdjustThreshold) {
|
|
43
|
+
y = mousePos.viewport.y * 0.85;
|
|
44
|
+
}
|
|
45
|
+
// use tooltip width to determine when to repos from right to left (width is narrower when only 1 focused series since labels wrap)
|
|
46
|
+
const tooltipWidth = seriesNum > 1 ? _tooltipModel.TOOLTIP_MAX_WIDTH : _tooltipModel.TOOLTIP_MAX_WIDTH / 2;
|
|
47
|
+
const xPosAdjustThreshold = chartWidth - tooltipWidth * 0.9;
|
|
48
|
+
// reposition so tooltip is never too close to right side of chart or left side of browser window
|
|
49
|
+
return mousePos.plotCanvas.x > xPosAdjustThreshold && x > _tooltipModel.TOOLTIP_MAX_WIDTH ? `translate3d(${x - cursorPaddingX}px, ${y}px, 0) translateX(-100%)` : `translate3d(${x + cursorPaddingX}px, ${y}px, 0)`;
|
|
50
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Copyright 2022 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, "UnitSelector", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>UnitSelector
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _material = require("@mui/material");
|
|
23
|
+
const _model = require("../model");
|
|
24
|
+
const _optionsEditorLayout = require("../OptionsEditorLayout");
|
|
25
|
+
const KIND_OPTIONS = Object.entries(_model.UNIT_CONFIG).map(([id, config])=>{
|
|
26
|
+
return {
|
|
27
|
+
id: id,
|
|
28
|
+
...config
|
|
29
|
+
};
|
|
30
|
+
}).filter((config)=>!config.disableSelectorOption);
|
|
31
|
+
const DECIMAL_OPTIONS = [
|
|
32
|
+
0,
|
|
33
|
+
1,
|
|
34
|
+
2,
|
|
35
|
+
3,
|
|
36
|
+
4
|
|
37
|
+
];
|
|
38
|
+
function UnitSelector({ value , onChange }) {
|
|
39
|
+
const hasDecimalPlaces = (0, _model.isUnitWithDecimalPlaces)(value);
|
|
40
|
+
const hasAbbreviate = (0, _model.isUnitWithAbbreviate)(value);
|
|
41
|
+
const handleKindChange = (_, newValue)=>{
|
|
42
|
+
onChange({
|
|
43
|
+
kind: newValue.id
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const handleDecimalChange = (_, newValue)=>{
|
|
47
|
+
if (hasDecimalPlaces) {
|
|
48
|
+
onChange({
|
|
49
|
+
...value,
|
|
50
|
+
decimal_places: newValue
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const handleAbbreviateChange = (_, checked)=>{
|
|
55
|
+
if (hasAbbreviate) {
|
|
56
|
+
onChange({
|
|
57
|
+
...value,
|
|
58
|
+
abbreviate: checked
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const kindConfig = _model.UNIT_CONFIG[value.kind];
|
|
63
|
+
var _decimal_places;
|
|
64
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
65
|
+
children: [
|
|
66
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_optionsEditorLayout.OptionsEditorControl, {
|
|
67
|
+
label: "Abbreviate",
|
|
68
|
+
control: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Switch, {
|
|
69
|
+
checked: hasAbbreviate ? !!value.abbreviate : false,
|
|
70
|
+
onChange: handleAbbreviateChange,
|
|
71
|
+
disabled: !hasAbbreviate
|
|
72
|
+
})
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_optionsEditorLayout.OptionsEditorControl, {
|
|
75
|
+
label: "Units",
|
|
76
|
+
control: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Autocomplete, {
|
|
77
|
+
value: {
|
|
78
|
+
id: value.kind,
|
|
79
|
+
...kindConfig
|
|
80
|
+
},
|
|
81
|
+
options: KIND_OPTIONS,
|
|
82
|
+
isOptionEqualToValue: (option, value)=>option.id === value.id,
|
|
83
|
+
groupBy: (option)=>option.group,
|
|
84
|
+
renderInput: (params)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
85
|
+
...params
|
|
86
|
+
}),
|
|
87
|
+
renderOption: (renderOptsProps, option)=>{
|
|
88
|
+
// Custom option needed to get some increased left padding to make
|
|
89
|
+
// the items more distinct from the group label.
|
|
90
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)("li", {
|
|
91
|
+
...renderOptsProps,
|
|
92
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
93
|
+
paddingLeft: (theme)=>theme.spacing(1),
|
|
94
|
+
children: option.label
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
onChange: handleKindChange,
|
|
99
|
+
disableClearable: true
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_optionsEditorLayout.OptionsEditorControl, {
|
|
103
|
+
label: "Decimal",
|
|
104
|
+
control: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Autocomplete, {
|
|
105
|
+
value: hasDecimalPlaces ? (_decimal_places = value.decimal_places) !== null && _decimal_places !== void 0 ? _decimal_places : _model.DEFAULT_DECIMAL_PLACES : 0,
|
|
106
|
+
options: DECIMAL_OPTIONS,
|
|
107
|
+
getOptionLabel: (option)=>`${option}`,
|
|
108
|
+
renderInput: (params)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
109
|
+
...params
|
|
110
|
+
}),
|
|
111
|
+
onChange: handleDecimalChange,
|
|
112
|
+
disabled: !hasDecimalPlaces,
|
|
113
|
+
disableClearable: true
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
]
|
|
117
|
+
});
|
|
118
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
const _react = require("@testing-library/react");
|
|
19
|
+
const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
|
|
20
|
+
const _unitSelector = require("./UnitSelector");
|
|
21
|
+
function _interopRequireDefault(obj) {
|
|
22
|
+
return obj && obj.__esModule ? obj : {
|
|
23
|
+
default: obj
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
describe('UnitSelector', ()=>{
|
|
27
|
+
const renderUnitSelector = (value, onChange = jest.fn())=>{
|
|
28
|
+
(0, _react.render)(/*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
|
|
29
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_unitSelector.UnitSelector, {
|
|
30
|
+
value: value,
|
|
31
|
+
onChange: onChange
|
|
32
|
+
})
|
|
33
|
+
}));
|
|
34
|
+
};
|
|
35
|
+
const getUnitSelector = ()=>{
|
|
36
|
+
return _react.screen.getByRole('combobox', {
|
|
37
|
+
name: 'Units'
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const getDecimalSelector = ()=>{
|
|
41
|
+
return _react.screen.getByRole('combobox', {
|
|
42
|
+
name: 'Decimal'
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const getAbbreviateSwitch = ()=>{
|
|
46
|
+
return _react.screen.getByRole('checkbox', {
|
|
47
|
+
name: 'Abbreviate'
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
it('can change the unit kind by clicking', ()=>{
|
|
51
|
+
const onChange = jest.fn();
|
|
52
|
+
renderUnitSelector({
|
|
53
|
+
kind: 'Minutes'
|
|
54
|
+
}, onChange);
|
|
55
|
+
const unitSelector = getUnitSelector();
|
|
56
|
+
_userEvent.default.click(unitSelector);
|
|
57
|
+
const decimalOption = _react.screen.getByRole('option', {
|
|
58
|
+
name: 'Decimal'
|
|
59
|
+
});
|
|
60
|
+
_userEvent.default.click(decimalOption);
|
|
61
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
62
|
+
kind: 'Decimal'
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
it('can change the unit kind using a keyboard', ()=>{
|
|
66
|
+
const onChange = jest.fn();
|
|
67
|
+
renderUnitSelector({
|
|
68
|
+
kind: 'Bytes'
|
|
69
|
+
}, onChange);
|
|
70
|
+
const unitSelector = getUnitSelector();
|
|
71
|
+
// Note that this tab order can change depending on the type because the
|
|
72
|
+
// abbreviate comes first and is disabled in some cases.
|
|
73
|
+
_userEvent.default.tab();
|
|
74
|
+
expect(unitSelector).toHaveFocus();
|
|
75
|
+
_userEvent.default.clear(unitSelector);
|
|
76
|
+
_userEvent.default.keyboard('years');
|
|
77
|
+
_react.screen.getByRole('option', {
|
|
78
|
+
name: 'Years'
|
|
79
|
+
});
|
|
80
|
+
_userEvent.default.keyboard('{arrowup}{enter}');
|
|
81
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
82
|
+
kind: 'Years'
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
it('can change the decimal places by clicking', ()=>{
|
|
86
|
+
const onChange = jest.fn();
|
|
87
|
+
renderUnitSelector({
|
|
88
|
+
kind: 'Decimal',
|
|
89
|
+
decimal_places: 0,
|
|
90
|
+
abbreviate: true
|
|
91
|
+
}, onChange);
|
|
92
|
+
_userEvent.default.click(getDecimalSelector());
|
|
93
|
+
const decimalOption = _react.screen.getByRole('option', {
|
|
94
|
+
name: '1'
|
|
95
|
+
});
|
|
96
|
+
_userEvent.default.click(decimalOption);
|
|
97
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
98
|
+
kind: 'Decimal',
|
|
99
|
+
decimal_places: 1,
|
|
100
|
+
abbreviate: true
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
it('can change the decimal places using a keyboard', ()=>{
|
|
104
|
+
const onChange = jest.fn();
|
|
105
|
+
renderUnitSelector({
|
|
106
|
+
kind: 'Percent'
|
|
107
|
+
}, onChange);
|
|
108
|
+
const decimalSelector = getDecimalSelector();
|
|
109
|
+
_userEvent.default.tab();
|
|
110
|
+
_userEvent.default.tab();
|
|
111
|
+
expect(decimalSelector).toHaveFocus();
|
|
112
|
+
_userEvent.default.clear(decimalSelector);
|
|
113
|
+
_userEvent.default.keyboard('3');
|
|
114
|
+
_react.screen.getByRole('option', {
|
|
115
|
+
name: '3'
|
|
116
|
+
});
|
|
117
|
+
_userEvent.default.keyboard('{arrowup}{enter}');
|
|
118
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
119
|
+
kind: 'Percent',
|
|
120
|
+
decimal_places: 3
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
it('can change abbreviate by clicking', ()=>{
|
|
124
|
+
const onChange = jest.fn();
|
|
125
|
+
renderUnitSelector({
|
|
126
|
+
kind: 'Decimal',
|
|
127
|
+
decimal_places: 3,
|
|
128
|
+
abbreviate: true
|
|
129
|
+
}, onChange);
|
|
130
|
+
_userEvent.default.click(getAbbreviateSwitch());
|
|
131
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
132
|
+
kind: 'Decimal',
|
|
133
|
+
decimal_places: 3,
|
|
134
|
+
abbreviate: false
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
it('can change abbreviate using a keyboard', ()=>{
|
|
138
|
+
const onChange = jest.fn();
|
|
139
|
+
renderUnitSelector({
|
|
140
|
+
kind: 'Decimal',
|
|
141
|
+
decimal_places: 0
|
|
142
|
+
}, onChange);
|
|
143
|
+
_userEvent.default.tab();
|
|
144
|
+
_userEvent.default.keyboard('{space}');
|
|
145
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
146
|
+
kind: 'Decimal',
|
|
147
|
+
decimal_places: 0,
|
|
148
|
+
abbreviate: true
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
describe('with a time unit selected', ()=>{
|
|
152
|
+
it('does not allow the user to set abbreviate', ()=>{
|
|
153
|
+
renderUnitSelector({
|
|
154
|
+
kind: 'Minutes'
|
|
155
|
+
});
|
|
156
|
+
expect(getAbbreviateSwitch()).toBeDisabled();
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
describe('with a percent unit selected', ()=>{
|
|
160
|
+
it('allows the user to modify the decimal places', ()=>{
|
|
161
|
+
renderUnitSelector({
|
|
162
|
+
kind: 'Percent'
|
|
163
|
+
});
|
|
164
|
+
expect(getDecimalSelector()).toBeEnabled();
|
|
165
|
+
});
|
|
166
|
+
it('does not allow the user to set abbreviate', ()=>{
|
|
167
|
+
renderUnitSelector({
|
|
168
|
+
kind: 'PercentDecimal'
|
|
169
|
+
});
|
|
170
|
+
expect(getAbbreviateSwitch()).toBeDisabled();
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
describe('with a decimal unit selected', ()=>{
|
|
174
|
+
it('allows the user to modify the decimal places', ()=>{
|
|
175
|
+
renderUnitSelector({
|
|
176
|
+
kind: 'Decimal'
|
|
177
|
+
});
|
|
178
|
+
expect(getDecimalSelector()).toBeEnabled();
|
|
179
|
+
});
|
|
180
|
+
it('allows the user to set abbreviate', ()=>{
|
|
181
|
+
renderUnitSelector({
|
|
182
|
+
kind: 'Decimal'
|
|
183
|
+
});
|
|
184
|
+
expect(getAbbreviateSwitch()).toBeEnabled();
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
describe('with a bytes unit selected', ()=>{
|
|
188
|
+
it('allows the user to modify the decimal places', ()=>{
|
|
189
|
+
renderUnitSelector({
|
|
190
|
+
kind: 'Bytes'
|
|
191
|
+
});
|
|
192
|
+
expect(getDecimalSelector()).toBeEnabled();
|
|
193
|
+
});
|
|
194
|
+
it('does not allow the user to set abbreviate', ()=>{
|
|
195
|
+
renderUnitSelector({
|
|
196
|
+
kind: 'Bytes'
|
|
197
|
+
});
|
|
198
|
+
expect(getAbbreviateSwitch()).toBeDisabled();
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
it('should not show an option for disabled units', ()=>{
|
|
202
|
+
const onChange = jest.fn();
|
|
203
|
+
renderUnitSelector({
|
|
204
|
+
kind: 'Decimal'
|
|
205
|
+
}, onChange);
|
|
206
|
+
_userEvent.default.click(getUnitSelector());
|
|
207
|
+
const percentShorthandOption = _react.screen.queryByRole('option', {
|
|
208
|
+
name: '%'
|
|
209
|
+
});
|
|
210
|
+
expect(percentShorthandOption).not.toBeInTheDocument();
|
|
211
|
+
});
|
|
212
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
_exportStar(require("./UnitSelector"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright 2022 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, "YAxisLabel", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>YAxisLabel
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _material = require("@mui/material");
|
|
23
|
+
function YAxisLabel({ name , height }) {
|
|
24
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
25
|
+
sx: {
|
|
26
|
+
display: 'inline-block',
|
|
27
|
+
maxWidth: height,
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
top: '45%',
|
|
30
|
+
transform: 'translateX(-50%) rotate(-90deg)',
|
|
31
|
+
transformOrigin: 'top',
|
|
32
|
+
textAlign: 'center',
|
|
33
|
+
zIndex: 1
|
|
34
|
+
},
|
|
35
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
36
|
+
variant: "body1",
|
|
37
|
+
sx: {
|
|
38
|
+
whiteSpace: 'nowrap',
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
textOverflow: 'ellipsis'
|
|
41
|
+
},
|
|
42
|
+
children: name
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
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
|
+
ChartsThemeProvider: ()=>ChartsThemeProvider,
|
|
25
|
+
ChartsThemeContext: ()=>ChartsThemeContext,
|
|
26
|
+
useChartsTheme: ()=>useChartsTheme
|
|
27
|
+
});
|
|
28
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
31
|
+
if (typeof WeakMap !== "function") return null;
|
|
32
|
+
var cacheBabelInterop = new WeakMap();
|
|
33
|
+
var cacheNodeInterop = new WeakMap();
|
|
34
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
35
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
36
|
+
})(nodeInterop);
|
|
37
|
+
}
|
|
38
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
39
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
40
|
+
return obj;
|
|
41
|
+
}
|
|
42
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
43
|
+
return {
|
|
44
|
+
default: obj
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
48
|
+
if (cache && cache.has(obj)) {
|
|
49
|
+
return cache.get(obj);
|
|
50
|
+
}
|
|
51
|
+
var newObj = {};
|
|
52
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
53
|
+
for(var key in obj){
|
|
54
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
55
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
56
|
+
if (desc && (desc.get || desc.set)) {
|
|
57
|
+
Object.defineProperty(newObj, key, desc);
|
|
58
|
+
} else {
|
|
59
|
+
newObj[key] = obj[key];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
newObj.default = obj;
|
|
64
|
+
if (cache) {
|
|
65
|
+
cache.set(obj, newObj);
|
|
66
|
+
}
|
|
67
|
+
return newObj;
|
|
68
|
+
}
|
|
69
|
+
function ChartsThemeProvider(props) {
|
|
70
|
+
const { children , chartsTheme } = props;
|
|
71
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(ChartsThemeContext.Provider, {
|
|
72
|
+
value: chartsTheme,
|
|
73
|
+
children: children
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const ChartsThemeContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
77
|
+
function useChartsTheme() {
|
|
78
|
+
const ctx = (0, _react.useContext)(ChartsThemeContext);
|
|
79
|
+
if (ctx === undefined) {
|
|
80
|
+
throw new Error('No ChartsThemeContext found. Did you forget a Provider?');
|
|
81
|
+
}
|
|
82
|
+
return ctx;
|
|
83
|
+
}
|