@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,205 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { render, screen } from '@testing-library/react';
|
|
15
|
+
import userEvent from '@testing-library/user-event';
|
|
16
|
+
import { UnitSelector } from './UnitSelector';
|
|
17
|
+
describe('UnitSelector', ()=>{
|
|
18
|
+
const renderUnitSelector = (value, onChange = jest.fn())=>{
|
|
19
|
+
render(/*#__PURE__*/ _jsx("div", {
|
|
20
|
+
children: /*#__PURE__*/ _jsx(UnitSelector, {
|
|
21
|
+
value: value,
|
|
22
|
+
onChange: onChange
|
|
23
|
+
})
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
const getUnitSelector = ()=>{
|
|
27
|
+
return screen.getByRole('combobox', {
|
|
28
|
+
name: 'Units'
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const getDecimalSelector = ()=>{
|
|
32
|
+
return screen.getByRole('combobox', {
|
|
33
|
+
name: 'Decimal'
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const getAbbreviateSwitch = ()=>{
|
|
37
|
+
return screen.getByRole('checkbox', {
|
|
38
|
+
name: 'Abbreviate'
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
it('can change the unit kind by clicking', ()=>{
|
|
42
|
+
const onChange = jest.fn();
|
|
43
|
+
renderUnitSelector({
|
|
44
|
+
kind: 'Minutes'
|
|
45
|
+
}, onChange);
|
|
46
|
+
const unitSelector = getUnitSelector();
|
|
47
|
+
userEvent.click(unitSelector);
|
|
48
|
+
const decimalOption = screen.getByRole('option', {
|
|
49
|
+
name: 'Decimal'
|
|
50
|
+
});
|
|
51
|
+
userEvent.click(decimalOption);
|
|
52
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
53
|
+
kind: 'Decimal'
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
it('can change the unit kind using a keyboard', ()=>{
|
|
57
|
+
const onChange = jest.fn();
|
|
58
|
+
renderUnitSelector({
|
|
59
|
+
kind: 'Bytes'
|
|
60
|
+
}, onChange);
|
|
61
|
+
const unitSelector = getUnitSelector();
|
|
62
|
+
// Note that this tab order can change depending on the type because the
|
|
63
|
+
// abbreviate comes first and is disabled in some cases.
|
|
64
|
+
userEvent.tab();
|
|
65
|
+
expect(unitSelector).toHaveFocus();
|
|
66
|
+
userEvent.clear(unitSelector);
|
|
67
|
+
userEvent.keyboard('years');
|
|
68
|
+
screen.getByRole('option', {
|
|
69
|
+
name: 'Years'
|
|
70
|
+
});
|
|
71
|
+
userEvent.keyboard('{arrowup}{enter}');
|
|
72
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
73
|
+
kind: 'Years'
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
it('can change the decimal places by clicking', ()=>{
|
|
77
|
+
const onChange = jest.fn();
|
|
78
|
+
renderUnitSelector({
|
|
79
|
+
kind: 'Decimal',
|
|
80
|
+
decimal_places: 0,
|
|
81
|
+
abbreviate: true
|
|
82
|
+
}, onChange);
|
|
83
|
+
userEvent.click(getDecimalSelector());
|
|
84
|
+
const decimalOption = screen.getByRole('option', {
|
|
85
|
+
name: '1'
|
|
86
|
+
});
|
|
87
|
+
userEvent.click(decimalOption);
|
|
88
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
89
|
+
kind: 'Decimal',
|
|
90
|
+
decimal_places: 1,
|
|
91
|
+
abbreviate: true
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
it('can change the decimal places using a keyboard', ()=>{
|
|
95
|
+
const onChange = jest.fn();
|
|
96
|
+
renderUnitSelector({
|
|
97
|
+
kind: 'Percent'
|
|
98
|
+
}, onChange);
|
|
99
|
+
const decimalSelector = getDecimalSelector();
|
|
100
|
+
userEvent.tab();
|
|
101
|
+
userEvent.tab();
|
|
102
|
+
expect(decimalSelector).toHaveFocus();
|
|
103
|
+
userEvent.clear(decimalSelector);
|
|
104
|
+
userEvent.keyboard('3');
|
|
105
|
+
screen.getByRole('option', {
|
|
106
|
+
name: '3'
|
|
107
|
+
});
|
|
108
|
+
userEvent.keyboard('{arrowup}{enter}');
|
|
109
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
110
|
+
kind: 'Percent',
|
|
111
|
+
decimal_places: 3
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
it('can change abbreviate by clicking', ()=>{
|
|
115
|
+
const onChange = jest.fn();
|
|
116
|
+
renderUnitSelector({
|
|
117
|
+
kind: 'Decimal',
|
|
118
|
+
decimal_places: 3,
|
|
119
|
+
abbreviate: true
|
|
120
|
+
}, onChange);
|
|
121
|
+
userEvent.click(getAbbreviateSwitch());
|
|
122
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
123
|
+
kind: 'Decimal',
|
|
124
|
+
decimal_places: 3,
|
|
125
|
+
abbreviate: false
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
it('can change abbreviate using a keyboard', ()=>{
|
|
129
|
+
const onChange = jest.fn();
|
|
130
|
+
renderUnitSelector({
|
|
131
|
+
kind: 'Decimal',
|
|
132
|
+
decimal_places: 0
|
|
133
|
+
}, onChange);
|
|
134
|
+
userEvent.tab();
|
|
135
|
+
userEvent.keyboard('{space}');
|
|
136
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
137
|
+
kind: 'Decimal',
|
|
138
|
+
decimal_places: 0,
|
|
139
|
+
abbreviate: true
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
describe('with a time unit selected', ()=>{
|
|
143
|
+
it('does not allow the user to set abbreviate', ()=>{
|
|
144
|
+
renderUnitSelector({
|
|
145
|
+
kind: 'Minutes'
|
|
146
|
+
});
|
|
147
|
+
expect(getAbbreviateSwitch()).toBeDisabled();
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
describe('with a percent unit selected', ()=>{
|
|
151
|
+
it('allows the user to modify the decimal places', ()=>{
|
|
152
|
+
renderUnitSelector({
|
|
153
|
+
kind: 'Percent'
|
|
154
|
+
});
|
|
155
|
+
expect(getDecimalSelector()).toBeEnabled();
|
|
156
|
+
});
|
|
157
|
+
it('does not allow the user to set abbreviate', ()=>{
|
|
158
|
+
renderUnitSelector({
|
|
159
|
+
kind: 'PercentDecimal'
|
|
160
|
+
});
|
|
161
|
+
expect(getAbbreviateSwitch()).toBeDisabled();
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
describe('with a decimal unit selected', ()=>{
|
|
165
|
+
it('allows the user to modify the decimal places', ()=>{
|
|
166
|
+
renderUnitSelector({
|
|
167
|
+
kind: 'Decimal'
|
|
168
|
+
});
|
|
169
|
+
expect(getDecimalSelector()).toBeEnabled();
|
|
170
|
+
});
|
|
171
|
+
it('allows the user to set abbreviate', ()=>{
|
|
172
|
+
renderUnitSelector({
|
|
173
|
+
kind: 'Decimal'
|
|
174
|
+
});
|
|
175
|
+
expect(getAbbreviateSwitch()).toBeEnabled();
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
describe('with a bytes unit selected', ()=>{
|
|
179
|
+
it('allows the user to modify the decimal places', ()=>{
|
|
180
|
+
renderUnitSelector({
|
|
181
|
+
kind: 'Bytes'
|
|
182
|
+
});
|
|
183
|
+
expect(getDecimalSelector()).toBeEnabled();
|
|
184
|
+
});
|
|
185
|
+
it('does not allow the user to set abbreviate', ()=>{
|
|
186
|
+
renderUnitSelector({
|
|
187
|
+
kind: 'Bytes'
|
|
188
|
+
});
|
|
189
|
+
expect(getAbbreviateSwitch()).toBeDisabled();
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
it('should not show an option for disabled units', ()=>{
|
|
193
|
+
const onChange = jest.fn();
|
|
194
|
+
renderUnitSelector({
|
|
195
|
+
kind: 'Decimal'
|
|
196
|
+
}, onChange);
|
|
197
|
+
userEvent.click(getUnitSelector());
|
|
198
|
+
const percentShorthandOption = screen.queryByRole('option', {
|
|
199
|
+
name: '%'
|
|
200
|
+
});
|
|
201
|
+
expect(percentShorthandOption).not.toBeInTheDocument();
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
//# sourceMappingURL=UnitSelector.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/UnitSelector/UnitSelector.test.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { render, screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { UnitOptions } from '../model';\nimport { UnitSelector } from './UnitSelector';\n\ndescribe('UnitSelector', () => {\n const renderUnitSelector = (value: UnitOptions, onChange = jest.fn()) => {\n render(\n <div>\n <UnitSelector value={value} onChange={onChange} />\n </div>\n );\n };\n\n const getUnitSelector = () => {\n return screen.getByRole('combobox', { name: 'Units' });\n };\n\n const getDecimalSelector = () => {\n return screen.getByRole('combobox', { name: 'Decimal' });\n };\n\n const getAbbreviateSwitch = () => {\n return screen.getByRole('checkbox', { name: 'Abbreviate' });\n };\n\n it('can change the unit kind by clicking', () => {\n const onChange = jest.fn();\n renderUnitSelector({ kind: 'Minutes' }, onChange);\n\n const unitSelector = getUnitSelector();\n userEvent.click(unitSelector);\n const decimalOption = screen.getByRole('option', {\n name: 'Decimal',\n });\n userEvent.click(decimalOption);\n\n expect(onChange).toHaveBeenCalledWith({\n kind: 'Decimal',\n });\n });\n\n it('can change the unit kind using a keyboard', () => {\n const onChange = jest.fn();\n renderUnitSelector({ kind: 'Bytes' }, onChange);\n\n const unitSelector = getUnitSelector();\n // Note that this tab order can change depending on the type because the\n // abbreviate comes first and is disabled in some cases.\n userEvent.tab();\n expect(unitSelector).toHaveFocus();\n\n userEvent.clear(unitSelector);\n userEvent.keyboard('years');\n screen.getByRole('option', {\n name: 'Years',\n });\n\n userEvent.keyboard('{arrowup}{enter}');\n\n expect(onChange).toHaveBeenCalledWith({\n kind: 'Years',\n });\n });\n\n it('can change the decimal places by clicking', () => {\n const onChange = jest.fn();\n renderUnitSelector({ kind: 'Decimal', decimal_places: 0, abbreviate: true }, onChange);\n\n userEvent.click(getDecimalSelector());\n const decimalOption = screen.getByRole('option', {\n name: '1',\n });\n userEvent.click(decimalOption);\n\n expect(onChange).toHaveBeenCalledWith({\n kind: 'Decimal',\n decimal_places: 1,\n abbreviate: true,\n });\n });\n\n it('can change the decimal places using a keyboard', () => {\n const onChange = jest.fn();\n renderUnitSelector({ kind: 'Percent' }, onChange);\n\n const decimalSelector = getDecimalSelector();\n userEvent.tab();\n userEvent.tab();\n expect(decimalSelector).toHaveFocus();\n\n userEvent.clear(decimalSelector);\n userEvent.keyboard('3');\n screen.getByRole('option', {\n name: '3',\n });\n\n userEvent.keyboard('{arrowup}{enter}');\n\n expect(onChange).toHaveBeenCalledWith({\n kind: 'Percent',\n decimal_places: 3,\n });\n });\n\n it('can change abbreviate by clicking', () => {\n const onChange = jest.fn();\n renderUnitSelector({ kind: 'Decimal', decimal_places: 3, abbreviate: true }, onChange);\n\n userEvent.click(getAbbreviateSwitch());\n\n expect(onChange).toHaveBeenCalledWith({\n kind: 'Decimal',\n decimal_places: 3,\n abbreviate: false,\n });\n });\n\n it('can change abbreviate using a keyboard', () => {\n const onChange = jest.fn();\n renderUnitSelector({ kind: 'Decimal', decimal_places: 0 }, onChange);\n\n userEvent.tab();\n userEvent.keyboard('{space}');\n\n expect(onChange).toHaveBeenCalledWith({\n kind: 'Decimal',\n decimal_places: 0,\n abbreviate: true,\n });\n });\n\n describe('with a time unit selected', () => {\n it('does not allow the user to set abbreviate', () => {\n renderUnitSelector({ kind: 'Minutes' });\n expect(getAbbreviateSwitch()).toBeDisabled();\n });\n });\n\n describe('with a percent unit selected', () => {\n it('allows the user to modify the decimal places', () => {\n renderUnitSelector({ kind: 'Percent' });\n expect(getDecimalSelector()).toBeEnabled();\n });\n\n it('does not allow the user to set abbreviate', () => {\n renderUnitSelector({ kind: 'PercentDecimal' });\n expect(getAbbreviateSwitch()).toBeDisabled();\n });\n });\n\n describe('with a decimal unit selected', () => {\n it('allows the user to modify the decimal places', () => {\n renderUnitSelector({ kind: 'Decimal' });\n expect(getDecimalSelector()).toBeEnabled();\n });\n\n it('allows the user to set abbreviate', () => {\n renderUnitSelector({ kind: 'Decimal' });\n expect(getAbbreviateSwitch()).toBeEnabled();\n });\n });\n\n describe('with a bytes unit selected', () => {\n it('allows the user to modify the decimal places', () => {\n renderUnitSelector({ kind: 'Bytes' });\n expect(getDecimalSelector()).toBeEnabled();\n });\n\n it('does not allow the user to set abbreviate', () => {\n renderUnitSelector({ kind: 'Bytes' });\n expect(getAbbreviateSwitch()).toBeDisabled();\n });\n });\n\n it('should not show an option for disabled units', () => {\n const onChange = jest.fn();\n renderUnitSelector({ kind: 'Decimal' }, onChange);\n\n userEvent.click(getUnitSelector());\n const percentShorthandOption = screen.queryByRole('option', {\n name: '%',\n });\n expect(percentShorthandOption).not.toBeInTheDocument();\n });\n});\n"],"names":["render","screen","userEvent","UnitSelector","describe","renderUnitSelector","value","onChange","jest","fn","div","getUnitSelector","getByRole","name","getDecimalSelector","getAbbreviateSwitch","it","kind","unitSelector","click","decimalOption","expect","toHaveBeenCalledWith","tab","toHaveFocus","clear","keyboard","decimal_places","abbreviate","decimalSelector","toBeDisabled","toBeEnabled","percentShorthandOption","queryByRole","not","toBeInTheDocument"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,MAAM,EAAEC,MAAM,QAAQ,wBAAwB,CAAC;AACxD,OAAOC,SAAS,MAAM,6BAA6B,CAAC;AAEpD,SAASC,YAAY,QAAQ,gBAAgB,CAAC;AAE9CC,QAAQ,CAAC,cAAc,EAAE,IAAM;IAC7B,MAAMC,kBAAkB,GAAG,CAACC,KAAkB,EAAEC,QAAQ,GAAGC,IAAI,CAACC,EAAE,EAAE,GAAK;QACvET,MAAM,eACJ,KAACU,KAAG;sBACF,cAAA,KAACP,YAAY;gBAACG,KAAK,EAAEA,KAAK;gBAAEC,QAAQ,EAAEA,QAAQ;cAAI;UAC9C,CACP,CAAC;IACJ,CAAC,AAAC;IAEF,MAAMI,eAAe,GAAG,IAAM;QAC5B,OAAOV,MAAM,CAACW,SAAS,CAAC,UAAU,EAAE;YAAEC,IAAI,EAAE,OAAO;SAAE,CAAC,CAA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|
|
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
|
+
export * from './UnitSelector';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/UnitSelector/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './UnitSelector';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YAxisLabel.d.ts","sourceRoot":"","sources":["../src/YAxisLabel.tsx"],"names":[],"mappings":";AAeA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,eAAe,eA0B3D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { Box, Typography } from '@mui/material';
|
|
15
|
+
export function YAxisLabel({ name , height }) {
|
|
16
|
+
return /*#__PURE__*/ _jsx(Box, {
|
|
17
|
+
sx: {
|
|
18
|
+
display: 'inline-block',
|
|
19
|
+
maxWidth: height,
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: '45%',
|
|
22
|
+
transform: 'translateX(-50%) rotate(-90deg)',
|
|
23
|
+
transformOrigin: 'top',
|
|
24
|
+
textAlign: 'center',
|
|
25
|
+
zIndex: 1
|
|
26
|
+
},
|
|
27
|
+
children: /*#__PURE__*/ _jsx(Typography, {
|
|
28
|
+
variant: "body1",
|
|
29
|
+
sx: {
|
|
30
|
+
whiteSpace: 'nowrap',
|
|
31
|
+
overflow: 'hidden',
|
|
32
|
+
textOverflow: 'ellipsis'
|
|
33
|
+
},
|
|
34
|
+
children: name
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=YAxisLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/YAxisLabel.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Typography } from '@mui/material';\n\ninterface YAxisLabelProps {\n name: string;\n height: number;\n}\n\nexport function YAxisLabel({ name, height }: YAxisLabelProps) {\n return (\n <Box\n sx={{\n display: 'inline-block',\n maxWidth: height, // allows rotated text to truncate instead of causing overlap\n position: 'absolute',\n top: '45%',\n transform: 'translateX(-50%) rotate(-90deg)',\n transformOrigin: 'top',\n textAlign: 'center',\n zIndex: 1,\n }}\n >\n <Typography\n variant=\"body1\"\n sx={{\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {name}\n </Typography>\n </Box>\n );\n}\n"],"names":["Box","Typography","YAxisLabel","name","height","sx","display","maxWidth","position","top","transform","transformOrigin","textAlign","zIndex","variant","whiteSpace","overflow","textOverflow"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,GAAG,EAAEC,UAAU,QAAQ,eAAe,CAAC;AAOhD,OAAO,SAASC,UAAU,CAAC,EAAEC,IAAI,CAAA,EAAEC,MAAM,CAAA,EAAmB,EAAE;IAC5D,qBACE,KAACJ,GAAG;QACFK,EAAE,EAAE;YACFC,OAAO,EAAE,cAAc;YACvBC,QAAQ,EAAEH,MAAM;YAChBI,QAAQ,EAAE,UAAU;YACpBC,GAAG,EAAE,KAAK;YACVC,SAAS,EAAE,iCAAiC;YAC5CC,eAAe,EAAE,KAAK;YACtBC,SAAS,EAAE,QAAQ;YACnBC,MAAM,EAAE,CAAC;SACV;kBAED,cAAA,KAACZ,UAAU;YACTa,OAAO,EAAC,OAAO;YACfT,EAAE,EAAE;gBACFU,UAAU,EAAE,QAAQ;gBACpBC,QAAQ,EAAE,QAAQ;gBAClBC,YAAY,EAAE,UAAU;aACzB;sBAEAd,IAAI;UACM;MACT,CACN;AACJ,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
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, "AbsoluteTimePicker", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>AbsoluteTimePicker
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _react = require("react");
|
|
23
|
+
const _material = require("@mui/material");
|
|
24
|
+
const _xDatePickers = require("@mui/x-date-pickers");
|
|
25
|
+
const _adapterDateFns = require("@mui/x-date-pickers/AdapterDateFns");
|
|
26
|
+
const _timeZoneProvider = require("../context/TimeZoneProvider");
|
|
27
|
+
const _utils = require("./utils");
|
|
28
|
+
const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
|
|
29
|
+
const AbsoluteTimePicker = ({ initialTimeRange , onChange })=>{
|
|
30
|
+
const [timeRange, setTimeRange] = (0, _react.useState)(initialTimeRange);
|
|
31
|
+
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
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_xDatePickers.LocalizationProvider, {
|
|
63
|
+
dateAdapter: _adapterDateFns.AdapterDateFns,
|
|
64
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
65
|
+
spacing: 2,
|
|
66
|
+
sx: (theme)=>({
|
|
67
|
+
padding: theme.spacing(1, 0, 2)
|
|
68
|
+
}),
|
|
69
|
+
children: [
|
|
70
|
+
showStartCalendar && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
71
|
+
sx: (theme)=>({
|
|
72
|
+
// TODO: create separate reusable calendar component
|
|
73
|
+
'.MuiPickerStaticWrapper-content': {
|
|
74
|
+
backgroundColor: theme.palette.background.default
|
|
75
|
+
},
|
|
76
|
+
// reposition AM and PM buttons
|
|
77
|
+
'.MuiIconButton-sizeMedium': {
|
|
78
|
+
top: 80,
|
|
79
|
+
bottom: 'auto',
|
|
80
|
+
margin: theme.spacing(0, 3)
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
children: [
|
|
84
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
85
|
+
variant: "h3",
|
|
86
|
+
padding: 1,
|
|
87
|
+
children: "Select Start Time"
|
|
88
|
+
}),
|
|
89
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_xDatePickers.StaticDateTimePicker, {
|
|
90
|
+
displayStaticWrapperAs: "desktop",
|
|
91
|
+
openTo: "day",
|
|
92
|
+
disableHighlightToday: true,
|
|
93
|
+
value: initialTimeRange.start,
|
|
94
|
+
onChange: (newValue)=>{
|
|
95
|
+
if (newValue === null) return;
|
|
96
|
+
setTimeRange((current)=>{
|
|
97
|
+
return {
|
|
98
|
+
start: newValue,
|
|
99
|
+
end: current.end
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
onAccept: ()=>{
|
|
104
|
+
setShowStartCalendar(false);
|
|
105
|
+
},
|
|
106
|
+
renderInput: (params)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
107
|
+
...params
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
}),
|
|
112
|
+
!showStartCalendar && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
113
|
+
sx: (theme)=>({
|
|
114
|
+
'.MuiPickerStaticWrapper-content': {
|
|
115
|
+
backgroundColor: theme.palette.background.default
|
|
116
|
+
},
|
|
117
|
+
// reposition AM and PM buttons
|
|
118
|
+
'.MuiIconButton-sizeMedium': {
|
|
119
|
+
top: 80,
|
|
120
|
+
bottom: 'auto',
|
|
121
|
+
margin: theme.spacing(0, 3)
|
|
122
|
+
}
|
|
123
|
+
}),
|
|
124
|
+
children: [
|
|
125
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
126
|
+
variant: "h3",
|
|
127
|
+
padding: 1,
|
|
128
|
+
children: "Select End Time"
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_xDatePickers.StaticDateTimePicker, {
|
|
131
|
+
displayStaticWrapperAs: "desktop",
|
|
132
|
+
openTo: "day",
|
|
133
|
+
disableHighlightToday: true,
|
|
134
|
+
value: initialTimeRange.end,
|
|
135
|
+
minDateTime: timeRange.start,
|
|
136
|
+
onChange: (newValue)=>{
|
|
137
|
+
if (newValue === null) return;
|
|
138
|
+
setTimeRange((current)=>{
|
|
139
|
+
return {
|
|
140
|
+
start: current.start,
|
|
141
|
+
end: newValue
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
onAccept: ()=>{
|
|
146
|
+
setShowStartCalendar(true);
|
|
147
|
+
onChange(timeRange);
|
|
148
|
+
},
|
|
149
|
+
renderInput: (params)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
150
|
+
...params
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
}),
|
|
155
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
156
|
+
direction: "row",
|
|
157
|
+
alignItems: "center",
|
|
158
|
+
gap: 1,
|
|
159
|
+
pl: 1,
|
|
160
|
+
pr: 1,
|
|
161
|
+
children: [
|
|
162
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
163
|
+
onChange: (event)=>{
|
|
164
|
+
// TODO: add helperText, fix validation after we decide on form state solution
|
|
165
|
+
updateDateRange(event.target.value, true);
|
|
166
|
+
},
|
|
167
|
+
value: formatWithUserTimeZone(timeRange.start, DATE_TIME_FORMAT),
|
|
168
|
+
label: "Start Time",
|
|
169
|
+
placeholder: "mm/dd/yyyy hh:mm",
|
|
170
|
+
// tel used to match MUI DateTimePicker, may change in future: https://github.com/mui/material-ui/issues/27590
|
|
171
|
+
type: "tel"
|
|
172
|
+
}),
|
|
173
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
174
|
+
onChange: (event)=>{
|
|
175
|
+
updateDateRange(event.target.value, false);
|
|
176
|
+
},
|
|
177
|
+
value: formatWithUserTimeZone(timeRange.end, DATE_TIME_FORMAT),
|
|
178
|
+
label: "End Time",
|
|
179
|
+
placeholder: "mm/dd/yyyy hh:mm",
|
|
180
|
+
type: "tel"
|
|
181
|
+
})
|
|
182
|
+
]
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
})
|
|
186
|
+
});
|
|
187
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
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, "DateTimeRangePicker", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>DateTimeRangePicker
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _react = require("react");
|
|
23
|
+
const _material = require("@mui/material");
|
|
24
|
+
const _core = require("@perses-dev/core");
|
|
25
|
+
const _absoluteTimePicker = require("./AbsoluteTimePicker");
|
|
26
|
+
const _timeRangeSelector = require("./TimeRangeSelector");
|
|
27
|
+
function DateTimeRangePicker(props) {
|
|
28
|
+
const { value , onChange , timeOptions , height } = props;
|
|
29
|
+
const [showCustomDateSelector, setShowCustomDateSelector] = (0, _react.useState)(false);
|
|
30
|
+
const anchorEl = (0, _react.useRef)();
|
|
31
|
+
const convertedTimeRange = (0, _react.useMemo)(()=>{
|
|
32
|
+
return (0, _core.isRelativeTimeRange)(value) ? (0, _core.toAbsoluteTimeRange)(value) : value;
|
|
33
|
+
}, [
|
|
34
|
+
value
|
|
35
|
+
]);
|
|
36
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
37
|
+
direction: "row",
|
|
38
|
+
spacing: 1,
|
|
39
|
+
height: height,
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Popover, {
|
|
42
|
+
anchorEl: anchorEl.current,
|
|
43
|
+
anchorOrigin: {
|
|
44
|
+
vertical: 'bottom',
|
|
45
|
+
horizontal: 'center'
|
|
46
|
+
},
|
|
47
|
+
open: showCustomDateSelector,
|
|
48
|
+
onClose: ()=>setShowCustomDateSelector(false),
|
|
49
|
+
sx: (theme)=>({
|
|
50
|
+
padding: theme.spacing(2)
|
|
51
|
+
}),
|
|
52
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_absoluteTimePicker.AbsoluteTimePicker, {
|
|
53
|
+
initialTimeRange: convertedTimeRange,
|
|
54
|
+
onChange: (value)=>{
|
|
55
|
+
onChange(value);
|
|
56
|
+
setShowCustomDateSelector(false);
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
61
|
+
fullWidth: true,
|
|
62
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
63
|
+
ref: anchorEl,
|
|
64
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeRangeSelector.TimeRangeSelector, {
|
|
65
|
+
timeOptions: timeOptions,
|
|
66
|
+
value: value,
|
|
67
|
+
height: height,
|
|
68
|
+
onSelectChange: (event)=>{
|
|
69
|
+
const duration = event.target.value;
|
|
70
|
+
const relativeTimeInput = {
|
|
71
|
+
pastDuration: duration,
|
|
72
|
+
end: new Date()
|
|
73
|
+
};
|
|
74
|
+
onChange(relativeTimeInput);
|
|
75
|
+
setShowCustomDateSelector(false);
|
|
76
|
+
},
|
|
77
|
+
onCustomClick: ()=>{
|
|
78
|
+
setShowCustomDateSelector(true);
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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, "TimeRangeSelector", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>TimeRangeSelector
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _material = require("@mui/material");
|
|
23
|
+
const _calendar = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Calendar"));
|
|
24
|
+
const _core = require("@perses-dev/core");
|
|
25
|
+
const _timeZoneProvider = require("../context/TimeZoneProvider");
|
|
26
|
+
const _utils = require("./utils");
|
|
27
|
+
function _interopRequireDefault(obj) {
|
|
28
|
+
return obj && obj.__esModule ? obj : {
|
|
29
|
+
default: obj
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
|
|
33
|
+
function TimeRangeSelector(props) {
|
|
34
|
+
const { value , timeOptions , onSelectChange , onCustomClick , height } = props;
|
|
35
|
+
const { timeZone } = (0, _timeZoneProvider.useTimeZone)();
|
|
36
|
+
const formattedValue = !(0, _core.isRelativeTimeRange)(value) ? (0, _utils.formatAbsoluteRange)(value, DATE_TIME_FORMAT, timeZone) : value.pastDuration;
|
|
37
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Select, {
|
|
38
|
+
value: formattedValue,
|
|
39
|
+
onChange: onSelectChange,
|
|
40
|
+
IconComponent: _calendar.default,
|
|
41
|
+
sx: {
|
|
42
|
+
'.MuiSelect-icon': {
|
|
43
|
+
marginTop: '1px'
|
|
44
|
+
},
|
|
45
|
+
'.MuiSelect-select': height ? {
|
|
46
|
+
lineHeight: height,
|
|
47
|
+
paddingY: 0
|
|
48
|
+
} : {}
|
|
49
|
+
},
|
|
50
|
+
children: [
|
|
51
|
+
timeOptions.map((item, idx)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
52
|
+
value: item.value.pastDuration,
|
|
53
|
+
children: item.display
|
|
54
|
+
}, idx)),
|
|
55
|
+
(0, _core.isRelativeTimeRange)(value) ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
56
|
+
onClick: ()=>{
|
|
57
|
+
onCustomClick();
|
|
58
|
+
},
|
|
59
|
+
children: "Custom time range"
|
|
60
|
+
}) : /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
61
|
+
value: formattedValue,
|
|
62
|
+
onClick: ()=>{
|
|
63
|
+
onCustomClick();
|
|
64
|
+
},
|
|
65
|
+
children: formattedValue
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
}
|