@perses-dev/components 0.53.1 → 0.54.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/ContentWithLegend/ContentWithLegend.js +1 -1
  2. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  3. package/dist/ContentWithLegend/model/content-with-legend-model.js +1 -1
  4. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  5. package/dist/FormEditor/FormActions.js.map +1 -1
  6. package/dist/FormatControls/FormatControls.js +1 -1
  7. package/dist/FormatControls/FormatControls.js.map +1 -1
  8. package/dist/FormatControls/UnitSelector.js +1 -1
  9. package/dist/FormatControls/UnitSelector.js.map +1 -1
  10. package/dist/Legend/Legend.js +1 -1
  11. package/dist/Legend/Legend.js.map +1 -1
  12. package/dist/Legend/legend-model.js.map +1 -1
  13. package/dist/LinksEditor/LinksEditor.d.ts +1 -1
  14. package/dist/LinksEditor/LinksEditor.js.map +1 -1
  15. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +1 -1
  16. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  17. package/dist/Table/model/table-model.d.ts +1 -1
  18. package/dist/Table/model/table-model.js.map +1 -1
  19. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  20. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  21. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +2 -3
  22. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
  23. package/dist/TimeRangeSelector/DateTimeRangePicker.js +2 -0
  24. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  25. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +1 -1
  26. package/dist/TimeRangeSelector/TimeRangeSelector.js +1 -1
  27. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  28. package/dist/TimeRangeSelector/utils.d.ts +1 -1
  29. package/dist/TimeRangeSelector/utils.js +1 -1
  30. package/dist/TimeRangeSelector/utils.js.map +1 -1
  31. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -1
  32. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  33. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  34. package/dist/TimeSeriesTooltip/nearby-series.js +1 -1
  35. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  36. package/dist/TransformsEditor/TransformEditor.js.map +1 -1
  37. package/dist/TransformsEditor/TransformEditorContainer.js +1 -1
  38. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  39. package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
  40. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
  41. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -1
  42. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
  43. package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +2 -0
  44. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +3 -3
  45. package/dist/cjs/TimeRangeSelector/utils.js +2 -2
  46. package/dist/cjs/model/timeOption.js +2 -2
  47. package/dist/cjs/theme/theme.js +44 -29
  48. package/dist/cjs/theme/typography.js +8 -7
  49. package/dist/model/graph.d.ts +1 -1
  50. package/dist/model/graph.js.map +1 -1
  51. package/dist/model/theme.js.map +1 -1
  52. package/dist/model/timeOption.d.ts +1 -1
  53. package/dist/model/timeOption.js +1 -1
  54. package/dist/model/timeOption.js.map +1 -1
  55. package/dist/theme/theme.d.ts +3 -1
  56. package/dist/theme/theme.d.ts.map +1 -1
  57. package/dist/theme/theme.js +46 -29
  58. package/dist/theme/theme.js.map +1 -1
  59. package/dist/theme/typography.d.ts +6 -4
  60. package/dist/theme/typography.d.ts.map +1 -1
  61. package/dist/theme/typography.js +8 -7
  62. package/dist/theme/typography.js.map +1 -1
  63. package/dist/utils/axis.js +1 -1
  64. package/dist/utils/axis.js.map +1 -1
  65. package/dist/utils/chart-actions.d.ts +1 -1
  66. package/dist/utils/chart-actions.js.map +1 -1
  67. package/dist/utils/variable-interpolation.d.ts +1 -1
  68. package/dist/utils/variable-interpolation.js.map +1 -1
  69. package/package.json +5 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ValueMappingEditor/ValueMappingEditor.tsx"],"sourcesContent":["// Copyright 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 {\n Grid2Props as GridProps,\n IconButton,\n MenuItem,\n Stack,\n StackProps,\n TextField,\n Tooltip,\n Typography,\n Grid2 as Grid,\n} from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport { ValueMapping } from '@perses-dev/core';\nimport { FC } from 'react';\nimport { OptionsColorPicker } from '../ColorPicker/OptionsColorPicker';\n\ninterface ValueMappingConditionEditorProps extends Omit<StackProps, 'onChange'> {\n mapping: ValueMapping;\n onChange: (condition: ValueMapping) => void;\n}\n\nconst ConditionEditor: FC<ValueMappingConditionEditorProps> = ({ mapping, onChange, ...props }) => {\n switch (mapping.kind) {\n case 'Value':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"Value\"\n placeholder=\"Exact value\"\n value={mapping.spec?.value ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: { ...mapping.spec, value: e.target.value },\n })\n }\n fullWidth\n />\n </Stack>\n );\n case 'Range':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"From\"\n placeholder=\"Start of range\"\n value={mapping.spec?.from ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: { ...mapping.spec, from: e.target.value === '' ? undefined : +e.target.value },\n })\n }\n fullWidth\n />\n <TextField\n label=\"To\"\n placeholder=\"End of range (inclusive)\"\n value={mapping.spec?.to ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: { ...mapping.spec, to: e.target.value === '' ? undefined : +e.target.value },\n })\n }\n fullWidth\n />\n </Stack>\n );\n case 'Regex':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"Regular Expression\"\n placeholder=\"JavaScript regular expression\"\n value={mapping.spec?.pattern ?? ''}\n onChange={(e) => onChange({ ...mapping, spec: { ...mapping.spec, pattern: e.target.value } })}\n fullWidth\n />\n </Stack>\n );\n case 'Misc':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n select\n label=\"Value\"\n value={mapping.spec?.value ?? ''}\n onChange={(e) => onChange({ ...mapping, spec: { value: e.target.value } } as ValueMapping)}\n SelectProps={{\n renderValue: (selected) => {\n switch (selected) {\n case 'empty':\n return 'Empty';\n case 'null':\n return 'Null';\n case 'NaN':\n return 'NaN';\n case 'true':\n return 'True';\n case 'false':\n return 'False';\n default:\n return String(selected);\n }\n },\n }}\n fullWidth\n >\n <MenuItem value=\"empty\">\n <Stack>\n <Typography>Empty</Typography>\n <Typography variant=\"caption\">Matches empty string</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"null\">\n <Stack>\n <Typography>Null</Typography>\n <Typography variant=\"caption\">Matches null or undefined</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"NaN\">\n <Stack>\n <Typography>NaN</Typography>\n <Typography variant=\"caption\">Matches Not a Number value</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"true\">\n <Stack>\n <Typography>True</Typography>\n <Typography variant=\"caption\">Matches true boolean</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"false\">\n <Stack>\n <Typography>False</Typography>\n <Typography variant=\"caption\">Matches false boolean</Typography>\n </Stack>\n </MenuItem>\n </TextField>\n </Stack>\n );\n default:\n return null;\n }\n};\nexport interface ValueMappingEditorProps extends Omit<GridProps, 'onChange'> {\n mapping: ValueMapping;\n onChange: (mapping: ValueMapping) => void;\n onDelete: () => void;\n}\n\nexport const ValueMappingEditor: FC<ValueMappingEditorProps> = ({ mapping, onChange, onDelete, ...props }) => {\n const handleColorChange = (color?: string): void => {\n onChange({\n ...mapping,\n spec: {\n ...mapping.spec,\n result: {\n ...mapping.spec.result,\n color,\n },\n },\n } as ValueMapping);\n };\n return (\n <Grid container spacing={2} {...props}>\n <Grid size={{ xs: 5 }}>\n <Stack direction=\"row\" gap={1} width=\"100%\">\n <TextField\n select\n label=\"Type\"\n value={mapping.kind}\n onChange={(e) => onChange({ ...mapping, kind: e.target.value } as ValueMapping)}\n required\n sx={{ width: '120px' }}\n >\n <MenuItem value=\"Value\">\n <Stack>\n <Typography>Value</Typography>\n {mapping.kind !== 'Value' && <Typography variant=\"caption\">Matches an exact text value</Typography>}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Range\">\n <Stack>\n <Typography>Range</Typography>\n {mapping.kind !== 'Range' && (\n <Typography variant=\"caption\">Matches against a numerical range</Typography>\n )}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Regex\">\n <Stack>\n <Typography>Regex</Typography>\n {mapping.kind !== 'Regex' && (\n <Typography variant=\"caption\">Matches against a regular expression</Typography>\n )}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Misc\">\n <Stack>\n <Typography>Misc</Typography>\n {mapping.kind !== 'Misc' && (\n <Typography variant=\"caption\">Matches against empty, null and NaN values</Typography>\n )}\n </Stack>\n </MenuItem>\n </TextField>\n <ConditionEditor\n width=\"100%\"\n mapping={mapping}\n onChange={(updatedMapping) => onChange({ ...mapping, ...updatedMapping })}\n />\n </Stack>\n </Grid>\n <Grid size={{ xs: 4 }}>\n <TextField\n label=\"Display text\"\n value={mapping.spec?.result?.value ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: {\n ...mapping.spec,\n result: {\n ...mapping.spec?.result,\n value: e.target.value,\n },\n },\n } as ValueMapping)\n }\n fullWidth\n />\n </Grid>\n <Grid size={{ xs: 1 }}>\n <Stack direction=\"row\" justifyContent=\"center\" gap={1}>\n {mapping.spec?.result?.color ? (\n <OptionsColorPicker\n label=\"Color\"\n color={mapping.spec.result.color ?? '#000'}\n onColorChange={handleColorChange}\n onClear={() => handleColorChange(undefined)}\n />\n ) : (\n <IconButton onClick={() => handleColorChange('#000')}>\n <PlusIcon />\n </IconButton>\n )}\n </Stack>\n </Grid>\n <Grid size={{ xs: 1 }} textAlign=\"end\">\n <Tooltip title=\"Remove mapping settings\" placement=\"top\">\n <IconButton size=\"small\" sx={{ marginLeft: 'auto' }} onClick={onDelete}>\n <DeleteIcon />\n </IconButton>\n </Tooltip>\n </Grid>\n </Grid>\n );\n};\n"],"names":["IconButton","MenuItem","Stack","TextField","Tooltip","Typography","Grid2","Grid","DeleteIcon","PlusIcon","OptionsColorPicker","ConditionEditor","mapping","onChange","props","kind","gap","direction","label","placeholder","value","spec","e","target","fullWidth","from","undefined","to","pattern","select","SelectProps","renderValue","selected","String","variant","ValueMappingEditor","onDelete","handleColorChange","color","result","container","spacing","size","xs","width","required","sx","updatedMapping","justifyContent","onColorChange","onClear","onClick","textAlign","title","placement","marginLeft"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAEEA,UAAU,EACVC,QAAQ,EACRC,KAAK,EAELC,SAAS,EACTC,OAAO,EACPC,UAAU,EACVC,SAASC,IAAI,QACR,gBAAgB;AACvB,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,cAAc,uBAAuB;AAG5C,SA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5D,cAAA,KAAC5B;;;;;;AAMb,EAAE"}
1
+ {"version":3,"sources":["../../src/ValueMappingEditor/ValueMappingEditor.tsx"],"sourcesContent":["// Copyright 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 {\n Grid2Props as GridProps,\n IconButton,\n MenuItem,\n Stack,\n StackProps,\n TextField,\n Tooltip,\n Typography,\n Grid2 as Grid,\n} from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport { ValueMapping } from '@perses-dev/core'; // TODO\nimport { FC } from 'react';\nimport { OptionsColorPicker } from '../ColorPicker/OptionsColorPicker';\n\ninterface ValueMappingConditionEditorProps extends Omit<StackProps, 'onChange'> {\n mapping: ValueMapping;\n onChange: (condition: ValueMapping) => void;\n}\n\nconst ConditionEditor: FC<ValueMappingConditionEditorProps> = ({ mapping, onChange, ...props }) => {\n switch (mapping.kind) {\n case 'Value':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"Value\"\n placeholder=\"Exact value\"\n value={mapping.spec?.value ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: { ...mapping.spec, value: e.target.value },\n })\n }\n fullWidth\n />\n </Stack>\n );\n case 'Range':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"From\"\n placeholder=\"Start of range\"\n value={mapping.spec?.from ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: { ...mapping.spec, from: e.target.value === '' ? undefined : +e.target.value },\n })\n }\n fullWidth\n />\n <TextField\n label=\"To\"\n placeholder=\"End of range (inclusive)\"\n value={mapping.spec?.to ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: { ...mapping.spec, to: e.target.value === '' ? undefined : +e.target.value },\n })\n }\n fullWidth\n />\n </Stack>\n );\n case 'Regex':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"Regular Expression\"\n placeholder=\"JavaScript regular expression\"\n value={mapping.spec?.pattern ?? ''}\n onChange={(e) => onChange({ ...mapping, spec: { ...mapping.spec, pattern: e.target.value } })}\n fullWidth\n />\n </Stack>\n );\n case 'Misc':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n select\n label=\"Value\"\n value={mapping.spec?.value ?? ''}\n onChange={(e) => onChange({ ...mapping, spec: { value: e.target.value } } as ValueMapping)}\n SelectProps={{\n renderValue: (selected) => {\n switch (selected) {\n case 'empty':\n return 'Empty';\n case 'null':\n return 'Null';\n case 'NaN':\n return 'NaN';\n case 'true':\n return 'True';\n case 'false':\n return 'False';\n default:\n return String(selected);\n }\n },\n }}\n fullWidth\n >\n <MenuItem value=\"empty\">\n <Stack>\n <Typography>Empty</Typography>\n <Typography variant=\"caption\">Matches empty string</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"null\">\n <Stack>\n <Typography>Null</Typography>\n <Typography variant=\"caption\">Matches null or undefined</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"NaN\">\n <Stack>\n <Typography>NaN</Typography>\n <Typography variant=\"caption\">Matches Not a Number value</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"true\">\n <Stack>\n <Typography>True</Typography>\n <Typography variant=\"caption\">Matches true boolean</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"false\">\n <Stack>\n <Typography>False</Typography>\n <Typography variant=\"caption\">Matches false boolean</Typography>\n </Stack>\n </MenuItem>\n </TextField>\n </Stack>\n );\n default:\n return null;\n }\n};\nexport interface ValueMappingEditorProps extends Omit<GridProps, 'onChange'> {\n mapping: ValueMapping;\n onChange: (mapping: ValueMapping) => void;\n onDelete: () => void;\n}\n\nexport const ValueMappingEditor: FC<ValueMappingEditorProps> = ({ mapping, onChange, onDelete, ...props }) => {\n const handleColorChange = (color?: string): void => {\n onChange({\n ...mapping,\n spec: {\n ...mapping.spec,\n result: {\n ...mapping.spec.result,\n color,\n },\n },\n } as ValueMapping);\n };\n return (\n <Grid container spacing={2} {...props}>\n <Grid size={{ xs: 5 }}>\n <Stack direction=\"row\" gap={1} width=\"100%\">\n <TextField\n select\n label=\"Type\"\n value={mapping.kind}\n onChange={(e) => onChange({ ...mapping, kind: e.target.value } as ValueMapping)}\n required\n sx={{ width: '120px' }}\n >\n <MenuItem value=\"Value\">\n <Stack>\n <Typography>Value</Typography>\n {mapping.kind !== 'Value' && <Typography variant=\"caption\">Matches an exact text value</Typography>}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Range\">\n <Stack>\n <Typography>Range</Typography>\n {mapping.kind !== 'Range' && (\n <Typography variant=\"caption\">Matches against a numerical range</Typography>\n )}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Regex\">\n <Stack>\n <Typography>Regex</Typography>\n {mapping.kind !== 'Regex' && (\n <Typography variant=\"caption\">Matches against a regular expression</Typography>\n )}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Misc\">\n <Stack>\n <Typography>Misc</Typography>\n {mapping.kind !== 'Misc' && (\n <Typography variant=\"caption\">Matches against empty, null and NaN values</Typography>\n )}\n </Stack>\n </MenuItem>\n </TextField>\n <ConditionEditor\n width=\"100%\"\n mapping={mapping}\n onChange={(updatedMapping) => onChange({ ...mapping, ...updatedMapping })}\n />\n </Stack>\n </Grid>\n <Grid size={{ xs: 4 }}>\n <TextField\n label=\"Display text\"\n value={mapping.spec?.result?.value ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: {\n ...mapping.spec,\n result: {\n ...mapping.spec?.result,\n value: e.target.value,\n },\n },\n } as ValueMapping)\n }\n fullWidth\n />\n </Grid>\n <Grid size={{ xs: 1 }}>\n <Stack direction=\"row\" justifyContent=\"center\" gap={1}>\n {mapping.spec?.result?.color ? (\n <OptionsColorPicker\n label=\"Color\"\n color={mapping.spec.result.color ?? '#000'}\n onColorChange={handleColorChange}\n onClear={() => handleColorChange(undefined)}\n />\n ) : (\n <IconButton onClick={() => handleColorChange('#000')}>\n <PlusIcon />\n </IconButton>\n )}\n </Stack>\n </Grid>\n <Grid size={{ xs: 1 }} textAlign=\"end\">\n <Tooltip title=\"Remove mapping settings\" placement=\"top\">\n <IconButton size=\"small\" sx={{ marginLeft: 'auto' }} onClick={onDelete}>\n <DeleteIcon />\n </IconButton>\n </Tooltip>\n </Grid>\n </Grid>\n );\n};\n"],"names":["IconButton","MenuItem","Stack","TextField","Tooltip","Typography","Grid2","Grid","DeleteIcon","PlusIcon","OptionsColorPicker","ConditionEditor","mapping","onChange","props","kind","gap","direction","label","placeholder","value","spec","e","target","fullWidth","from","undefined","to","pattern","select","SelectProps","renderValue","selected","String","variant","ValueMappingEditor","onDelete","handleColorChange","color","result","container","spacing","size","xs","width","required","sx","updatedMapping","justifyContent","onColorChange","onClear","onClick","textAlign","title","placement","marginLeft"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAEEA,UAAU,EACVC,QAAQ,EACRC,KAAK,EAELC,SAAS,EACTC,OAAO,EACPC,UAAU,EACVC,SAASC,IAAI,QACR,gBAAgB;AACvB,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,cAAc,uBAAuB;AAG5C,SAASC,kBAAkB,QAAQ,oCAAoC;AAOvE,MAAMC,kBAAwD,CAAC,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGC,OAAO;IAC5F,OAAQF,QAAQG,IAAI;QAClB,KAAK;YACH,qBACE,KAACb;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KAACvB;4BACCiC,OAAM;4BACNhC,SAASA;4BACTC,UAAU,CAACkC,iBAAmBlC,SAAS;oCAAE,GAAGD,OAAO;oCAAE,GAAGmC,cAAc;gCAAC;;;;;0BAI7E,KAACxC;gBAAKmC,MAAM;oBAAEC,IAAI;gBAAE;0BAClB,cAAA,KAACxC;oBACCe,OAAM;oBACNE,OAAOR,QAAQS,IAAI,EAAEkB,QAAQnB,SAAS;oBACtCP,UAAU,CAACS,IACTT,SAAS;4BACP,GAAGD,OAAO;4BACVS,MAAM;gCACJ,GAAGT,QAAQS,IAAI;gCACfkB,QAAQ;oCACN,GAAG3B,QAAQS,IAAI,EAAEkB,MAAM;oCACvBnB,OAAOE,EAAEC,MAAM,CAACH,KAAK;gCACvB;4BACF;wBACF;oBAEFI,SAAS;;;0BAGb,KAACjB;gBAAKmC,MAAM;oBAAEC,IAAI;gBAAE;0BAClB,cAAA,KAACzC;oBAAMe,WAAU;oBAAM+B,gBAAe;oBAAShC,KAAK;8BACjDJ,QAAQS,IAAI,EAAEkB,QAAQD,sBACrB,KAAC5B;wBACCQ,OAAM;wBACNoB,OAAO1B,QAAQS,IAAI,CAACkB,MAAM,CAACD,KAAK,IAAI;wBACpCW,eAAeZ;wBACfa,SAAS,IAAMb,kBAAkBX;uCAGnC,KAAC1B;wBAAWmD,SAAS,IAAMd,kBAAkB;kCAC3C,cAAA,KAAC5B;;;;0BAKT,KAACF;gBAAKmC,MAAM;oBAAEC,IAAI;gBAAE;gBAAGS,WAAU;0BAC/B,cAAA,KAAChD;oBAAQiD,OAAM;oBAA0BC,WAAU;8BACjD,cAAA,KAACtD;wBAAW0C,MAAK;wBAAQI,IAAI;4BAAES,YAAY;wBAAO;wBAAGJ,SAASf;kCAC5D,cAAA,KAAC5B;;;;;;AAMb,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"ValueMappingsEditor.d.ts","sourceRoot":"","sources":["../../src/ValueMappingEditor/ValueMappingsEditor.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,EAAE,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;CACnD;AAED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAsD5D,CAAC"}
1
+ {"version":3,"file":"ValueMappingsEditor.d.ts","sourceRoot":"","sources":["../../src/ValueMappingEditor/ValueMappingsEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,EAAE,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;CACnD;AAED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAsD5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ValueMappingEditor/ValueMappingsEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button, Divider, Stack, Typography, Grid2 as Grid } from '@mui/material';\n\nimport { FC, useState } from 'react';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { ValueMapping } from '@perses-dev/core';\nimport { ValueMappingEditor } from './ValueMappingEditor';\n\nexport interface ValueMappingsEditorProps {\n mappings: ValueMapping[];\n onChange: (valueMappings: ValueMapping[]) => void;\n}\n\nexport const ValueMappingsEditor: FC<ValueMappingsEditorProps> = ({ mappings, onChange }) => {\n const [valueMappings, setValueMappings] = useState<ValueMapping[]>(mappings);\n\n function handleValueMappingChange(index: number, mapping: ValueMapping): void {\n const updatedValueMapings = [...valueMappings];\n updatedValueMapings[index] = mapping;\n setValueMappings(updatedValueMapings);\n onChange(updatedValueMapings);\n }\n\n function handleAddValueMappingEditor(): void {\n const updatedValueMapings = [...valueMappings];\n updatedValueMapings.push({ kind: 'Value', spec: { result: { value: '' } } } as ValueMapping);\n setValueMappings(updatedValueMapings);\n onChange(updatedValueMapings);\n }\n\n function handleValueMappingDelete(index: number): void {\n const updatedValueMapings = [...valueMappings];\n updatedValueMapings.splice(index, 1);\n setValueMappings(updatedValueMapings);\n onChange(updatedValueMapings);\n }\n\n return (\n <Stack spacing={1}>\n <Grid container spacing={2}>\n <Grid size={{ xs: 5 }}>\n <Typography variant=\"subtitle1\">Condition</Typography>\n </Grid>\n <Grid size={{ xs: 4 }}>\n <Typography variant=\"subtitle1\">Display Text</Typography>\n </Grid>\n <Grid size={{ xs: 1 }} textAlign=\"center\">\n <Typography variant=\"subtitle1\">Color</Typography>\n </Grid>\n <Grid size={{ xs: 1 }}></Grid>\n </Grid>\n <Stack gap={1.5} divider={<Divider flexItem orientation=\"horizontal\" />}>\n {valueMappings.map((mapping, i) => (\n <ValueMappingEditor\n key={i}\n mapping={mapping}\n onChange={(updatedMapping: ValueMapping) => handleValueMappingChange(i, updatedMapping)}\n onDelete={() => handleValueMappingDelete(i)}\n />\n ))}\n </Stack>\n\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginTop: 1 }} onClick={handleAddValueMappingEditor}>\n Add value mappings\n </Button>\n </Stack>\n );\n};\n"],"names":["Button","Divider","Stack","Typography","Grid2","Grid","useState","AddIcon","ValueMappingEditor","ValueMappingsEditor","mappings","onChange","valueMappings","setValueMappings","handleValueMappingChange","index","mapping","updatedValueMapings","handleAddValueMappingEditor","push","kind","spec","result","value","handleValueMappingDelete","splice","spacing","container","size","xs","variant","textAlign","gap","divider","flexItem","orientation","map","i","updatedMapping","onDelete","startIcon","sx","marginTop","onClick"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,EAAEC,SAASC,IAAI,QAAQ,gBAAgB;AAElF,SAAaC,QAAQ,QAAQ,QAAQ;AACrC,OAAOC,aAAa,uBAAuB;AAE3C,SAASC,kBAAkB,QAAQ,uBAAuB;AAO1D,OAAO,MAAMC,sBAAoD,CAAC,EAAEC,QAAQ,EAAEC,QAAQ,EAAE;IACtF,MAAM,CAACC,eAAeC,iBAAiB,GAAGP,SAAyBI;IAEnE,SAASI,yBAAyBC,KAAa,EAAEC,OAAqB;QACpE,MAAMC,sBAAsB;eAAIL;SAAc;QAC9CK,mBAAmB,CAACF,MAAM,GAAGC;QAC7BH,iBAAiBI;QACjBN,SAASM;IACX;IAEA,SAASC;QACP,MAAMD,sBAAsB;eAAIL;SAAc;QAC9CK,oBAAoBE,IAAI,CAAC;YAAEC,MAAM;YAASC,MAAM;gBAAEC,QAAQ;oBAAEC,OAAO;gBAAG;YAAE;QAAE;QAC1EV,iBAAiBI;QACjBN,SAASM;IACX;IAEA,SAASO,yBAAyBT,KAAa;QAC7C,MAAME,sBAAsB;eAAIL;SAAc;QAC9CK,oBAAoBQ,MAAM,CAACV,OAAO;QAClCF,iBAAiBI;QACjBN,SAASM;IACX;IAEA,qBACE,MAACf;QAAMwB,SAAS;;0BACd,MAACrB;gBAAKsB,SAAS;gBAACD,SAAS;;kCACvB,KAACrB;wBAAKuB,MAAM;4BAAEC,IAAI;wBAAE;kCAClB,cAAA,KAAC1B;4BAAW2B,SAAQ;sCAAY;;;kCAElC,KAACzB;wBAAKuB,MAAM;4BAAEC,IAAI;wBAAE;kCAClB,cAAA,KAAC1B;4BAAW2B,SAAQ;sCAAY;;;kCAElC,KAACzB;wBAAKuB,MAAM;4BAAEC,IAAI;wBAAE;wBAAGE,WAAU;kCAC/B,cAAA,KAAC5B;4BAAW2B,SAAQ;sCAAY;;;kCAElC,KAACzB;wBAAKuB,MAAM;4BAAEC,IAAI;wBAAE;;;;0BAEtB,KAAC3B;gBAAM8B,KAAK;gBAAKC,uBAAS,KAAChC;oBAAQiC,QAAQ;oBAACC,aAAY;;0BACrDvB,cAAcwB,GAAG,CAAC,CAACpB,SAASqB,kBAC3B,KAAC7B;wBAECQ,SAASA;wBACTL,UAAU,CAAC2B,iBAAiCxB,yBAAyBuB,GAAGC;wBACxEC,UAAU,IAAMf,yBAAyBa;uBAHpCA;;0BAQX,KAACrC;gBAAO8B,SAAQ;gBAAYU,yBAAW,KAACjC;gBAAYkC,IAAI;oBAAEC,WAAW;gBAAE;gBAAGC,SAASzB;0BAA6B;;;;AAKtH,EAAE"}
1
+ {"version":3,"sources":["../../src/ValueMappingEditor/ValueMappingsEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button, Divider, Stack, Typography, Grid2 as Grid } from '@mui/material';\nimport { FC, useState } from 'react';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { ValueMapping } from '@perses-dev/core'; // TODO\nimport { ValueMappingEditor } from './ValueMappingEditor';\n\nexport interface ValueMappingsEditorProps {\n mappings: ValueMapping[];\n onChange: (valueMappings: ValueMapping[]) => void;\n}\n\nexport const ValueMappingsEditor: FC<ValueMappingsEditorProps> = ({ mappings, onChange }) => {\n const [valueMappings, setValueMappings] = useState<ValueMapping[]>(mappings);\n\n function handleValueMappingChange(index: number, mapping: ValueMapping): void {\n const updatedValueMapings = [...valueMappings];\n updatedValueMapings[index] = mapping;\n setValueMappings(updatedValueMapings);\n onChange(updatedValueMapings);\n }\n\n function handleAddValueMappingEditor(): void {\n const updatedValueMapings = [...valueMappings];\n updatedValueMapings.push({ kind: 'Value', spec: { result: { value: '' } } } as ValueMapping);\n setValueMappings(updatedValueMapings);\n onChange(updatedValueMapings);\n }\n\n function handleValueMappingDelete(index: number): void {\n const updatedValueMapings = [...valueMappings];\n updatedValueMapings.splice(index, 1);\n setValueMappings(updatedValueMapings);\n onChange(updatedValueMapings);\n }\n\n return (\n <Stack spacing={1}>\n <Grid container spacing={2}>\n <Grid size={{ xs: 5 }}>\n <Typography variant=\"subtitle1\">Condition</Typography>\n </Grid>\n <Grid size={{ xs: 4 }}>\n <Typography variant=\"subtitle1\">Display Text</Typography>\n </Grid>\n <Grid size={{ xs: 1 }} textAlign=\"center\">\n <Typography variant=\"subtitle1\">Color</Typography>\n </Grid>\n <Grid size={{ xs: 1 }}></Grid>\n </Grid>\n <Stack gap={1.5} divider={<Divider flexItem orientation=\"horizontal\" />}>\n {valueMappings.map((mapping, i) => (\n <ValueMappingEditor\n key={i}\n mapping={mapping}\n onChange={(updatedMapping: ValueMapping) => handleValueMappingChange(i, updatedMapping)}\n onDelete={() => handleValueMappingDelete(i)}\n />\n ))}\n </Stack>\n\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginTop: 1 }} onClick={handleAddValueMappingEditor}>\n Add value mappings\n </Button>\n </Stack>\n );\n};\n"],"names":["Button","Divider","Stack","Typography","Grid2","Grid","useState","AddIcon","ValueMappingEditor","ValueMappingsEditor","mappings","onChange","valueMappings","setValueMappings","handleValueMappingChange","index","mapping","updatedValueMapings","handleAddValueMappingEditor","push","kind","spec","result","value","handleValueMappingDelete","splice","spacing","container","size","xs","variant","textAlign","gap","divider","flexItem","orientation","map","i","updatedMapping","onDelete","startIcon","sx","marginTop","onClick"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,EAAEC,SAASC,IAAI,QAAQ,gBAAgB;AAClF,SAAaC,QAAQ,QAAQ,QAAQ;AACrC,OAAOC,aAAa,uBAAuB;AAE3C,SAASC,kBAAkB,QAAQ,uBAAuB;AAO1D,OAAO,MAAMC,sBAAoD,CAAC,EAAEC,QAAQ,EAAEC,QAAQ,EAAE;IACtF,MAAM,CAACC,eAAeC,iBAAiB,GAAGP,SAAyBI;IAEnE,SAASI,yBAAyBC,KAAa,EAAEC,OAAqB;QACpE,MAAMC,sBAAsB;eAAIL;SAAc;QAC9CK,mBAAmB,CAACF,MAAM,GAAGC;QAC7BH,iBAAiBI;QACjBN,SAASM;IACX;IAEA,SAASC;QACP,MAAMD,sBAAsB;eAAIL;SAAc;QAC9CK,oBAAoBE,IAAI,CAAC;YAAEC,MAAM;YAASC,MAAM;gBAAEC,QAAQ;oBAAEC,OAAO;gBAAG;YAAE;QAAE;QAC1EV,iBAAiBI;QACjBN,SAASM;IACX;IAEA,SAASO,yBAAyBT,KAAa;QAC7C,MAAME,sBAAsB;eAAIL;SAAc;QAC9CK,oBAAoBQ,MAAM,CAACV,OAAO;QAClCF,iBAAiBI;QACjBN,SAASM;IACX;IAEA,qBACE,MAACf;QAAMwB,SAAS;;0BACd,MAACrB;gBAAKsB,SAAS;gBAACD,SAAS;;kCACvB,KAACrB;wBAAKuB,MAAM;4BAAEC,IAAI;wBAAE;kCAClB,cAAA,KAAC1B;4BAAW2B,SAAQ;sCAAY;;;kCAElC,KAACzB;wBAAKuB,MAAM;4BAAEC,IAAI;wBAAE;kCAClB,cAAA,KAAC1B;4BAAW2B,SAAQ;sCAAY;;;kCAElC,KAACzB;wBAAKuB,MAAM;4BAAEC,IAAI;wBAAE;wBAAGE,WAAU;kCAC/B,cAAA,KAAC5B;4BAAW2B,SAAQ;sCAAY;;;kCAElC,KAACzB;wBAAKuB,MAAM;4BAAEC,IAAI;wBAAE;;;;0BAEtB,KAAC3B;gBAAM8B,KAAK;gBAAKC,uBAAS,KAAChC;oBAAQiC,QAAQ;oBAACC,aAAY;;0BACrDvB,cAAcwB,GAAG,CAAC,CAACpB,SAASqB,kBAC3B,KAAC7B;wBAECQ,SAASA;wBACTL,UAAU,CAAC2B,iBAAiCxB,yBAAyBuB,GAAGC;wBACxEC,UAAU,IAAMf,yBAAyBa;uBAHpCA;;0BAQX,KAACrC;gBAAO8B,SAAQ;gBAAYU,yBAAW,KAACjC;gBAAYkC,IAAI;oBAAEC,WAAW;gBAAE;gBAAGC,SAASzB;0BAA6B;;;;AAKtH,EAAE"}
@@ -146,6 +146,7 @@ const DateTimeRangePicker = ({ initialTimeRange, onChange, onCancel, timeZone })
146
146
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_ErrorBoundary.ErrorBoundary, {
147
147
  FallbackComponent: _ErrorAlert.ErrorAlert,
148
148
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_xdatepickers.DateTimeField, {
149
+ "data-testid": "start_time_input",
149
150
  timezone: stdTimeZone,
150
151
  label: "Start Time",
151
152
  value: new _tz.TZDate(timeRange.start, stdTimeZone),
@@ -161,6 +162,7 @@ const DateTimeRangePicker = ({ initialTimeRange, onChange, onCancel, timeZone })
161
162
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_ErrorBoundary.ErrorBoundary, {
162
163
  FallbackComponent: _ErrorAlert.ErrorAlert,
163
164
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_xdatepickers.DateTimeField, {
165
+ "data-testid": "end_time_input",
164
166
  timezone: stdTimeZone,
165
167
  label: "End Time",
166
168
  value: new _tz.TZDate(timeRange.end, stdTimeZone),
@@ -24,7 +24,7 @@ const _jsxruntime = require("react/jsx-runtime");
24
24
  const _material = require("@mui/material");
25
25
  const _Calendar = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Calendar"));
26
26
  const _Earth = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Earth"));
27
- const _core = require("@perses-dev/core");
27
+ const _spec = require("@perses-dev/spec");
28
28
  const _react = require("react");
29
29
  const _context = require("../context");
30
30
  const _timeZoneOption = require("../model/timeZoneOption");
@@ -42,11 +42,11 @@ function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTim
42
42
  const anchorEl = (0, _react.useRef)();
43
43
  const [showCustomDateSelector, setShowCustomDateSelector] = (0, _react.useState)(false);
44
44
  const convertedTimeRange = (0, _react.useMemo)(()=>{
45
- return (0, _core.isRelativeTimeRange)(value) ? (0, _core.toAbsoluteTimeRange)(value) : value;
45
+ return (0, _spec.isRelativeTimeRange)(value) ? (0, _spec.toAbsoluteTimeRange)(value) : value;
46
46
  }, [
47
47
  value
48
48
  ]);
49
- const lastOption = (0, _react.useMemo)(()=>(0, _utils.buildCustomTimeOption)((0, _core.isRelativeTimeRange)(value) ? undefined : value, timeZone), [
49
+ const lastOption = (0, _react.useMemo)(()=>(0, _utils.buildCustomTimeOption)((0, _spec.isRelativeTimeRange)(value) ? undefined : value, timeZone), [
50
50
  value,
51
51
  timeZone
52
52
  ]);
@@ -38,7 +38,7 @@ _export(exports, {
38
38
  }
39
39
  });
40
40
  const _datefns = require("date-fns");
41
- const _core = require("@perses-dev/core");
41
+ const _spec = require("@perses-dev/spec");
42
42
  const _utils = require("../utils");
43
43
  const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
44
44
  function buildCustomTimeOption(value, timeZone) {
@@ -68,5 +68,5 @@ function formatTimeRange(value, timeZone) {
68
68
  if (!value) {
69
69
  return 'Custom Time Range';
70
70
  }
71
- return !(0, _core.isRelativeTimeRange)(value) ? formatAbsoluteRange(value, DATE_TIME_FORMAT, timeZone) : value.pastDuration;
71
+ return !(0, _spec.isRelativeTimeRange)(value) ? formatAbsoluteRange(value, DATE_TIME_FORMAT, timeZone) : value.pastDuration;
72
72
  }
@@ -20,14 +20,14 @@ Object.defineProperty(exports, "buildRelativeTimeOption", {
20
20
  return buildRelativeTimeOption;
21
21
  }
22
22
  });
23
- const _core = require("@perses-dev/core");
23
+ const _spec = require("@perses-dev/spec");
24
24
  const _datefns = require("date-fns");
25
25
  function buildRelativeTimeOption(duration) {
26
26
  return {
27
27
  value: {
28
28
  pastDuration: duration
29
29
  },
30
- display: `Last ${(0, _datefns.formatDuration)((0, _core.parseDurationString)(duration), {
30
+ display: `Last ${(0, _datefns.formatDuration)((0, _spec.parseDurationString)(duration), {
31
31
  delimiter: ', '
32
32
  })}`
33
33
  };
@@ -34,42 +34,57 @@ const getModalBackgroundStyle = ({ theme })=>{
34
34
  ...backgroundStyle
35
35
  };
36
36
  };
37
- function getTheme(mode, options = {}) {
37
+ function getTheme(mode, options = {}, disableBodyOverride = false) {
38
38
  return (0, _material.createTheme)({
39
39
  palette: (0, _palette.getPaletteOptions)(mode),
40
40
  typography: _typography.typography,
41
41
  mixins: {},
42
- components,
42
+ components: getComponents(mode, disableBodyOverride),
43
43
  ...options
44
44
  });
45
45
  }
46
46
  // Overrides for component default prop values and styles go here
47
- const components = {
48
- MuiAlert: _alert.MuiAlert,
49
- MuiFormControl: {
50
- defaultProps: {
51
- size: 'small'
52
- }
53
- },
54
- MuiPaper: _paper.MuiPaper,
55
- MuiTextField: {
56
- defaultProps: {
57
- size: 'small'
58
- }
59
- },
60
- MuiDrawer: {
61
- styleOverrides: {
62
- paper: getModalBackgroundStyle
63
- }
64
- },
65
- MuiDialog: {
66
- styleOverrides: {
67
- paper: getModalBackgroundStyle
68
- }
69
- },
70
- MuiPopover: {
71
- styleOverrides: {
72
- paper: getModalBackgroundStyle
47
+ function getComponents(mode, disableBodyOverride) {
48
+ const components = {
49
+ MuiAlert: _alert.MuiAlert,
50
+ MuiFormControl: {
51
+ defaultProps: {
52
+ size: 'small'
53
+ }
54
+ },
55
+ MuiPaper: _paper.MuiPaper,
56
+ MuiTextField: {
57
+ defaultProps: {
58
+ size: 'small'
59
+ }
60
+ },
61
+ MuiDrawer: {
62
+ styleOverrides: {
63
+ paper: getModalBackgroundStyle
64
+ }
65
+ },
66
+ MuiDialog: {
67
+ styleOverrides: {
68
+ paper: getModalBackgroundStyle
69
+ }
70
+ },
71
+ MuiPopover: {
72
+ styleOverrides: {
73
+ paper: getModalBackgroundStyle
74
+ }
73
75
  }
76
+ };
77
+ if (disableBodyOverride) {
78
+ return components;
74
79
  }
75
- };
80
+ return {
81
+ MuiCssBaseline: {
82
+ styleOverrides: {
83
+ body: {
84
+ colorScheme: mode
85
+ }
86
+ }
87
+ },
88
+ ...components
89
+ };
90
+ }
@@ -20,18 +20,19 @@ Object.defineProperty(exports, "typography", {
20
20
  return typography;
21
21
  }
22
22
  });
23
- require("@fontsource/lato/300.css");
24
- require("@fontsource/lato/400.css");
25
- require("@fontsource/lato/700.css");
26
- require("@fontsource/lato/900.css");
23
+ require("@fontsource/inter/300.css");
24
+ require("@fontsource/inter/400.css");
25
+ require("@fontsource/inter/500.css");
26
+ require("@fontsource/inter/600.css");
27
+ require("@fontsource/inter/700.css");
28
+ require("@fontsource/inter/900.css");
27
29
  // Font weights need to correspond with the imports at the top of the file
28
- // (Lato supports 100, 300, 400, 700, 900)
29
30
  const fontWeightLight = 300;
30
31
  const fontWeightRegular = 400;
31
- const fontWeightMedium = 700;
32
+ const fontWeightMedium = 600;
32
33
  const fontWeightBold = 900;
33
34
  const typography = {
34
- fontFamily: '"Lato", sans-serif',
35
+ fontFamily: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
35
36
  fontWeightLight,
36
37
  fontWeightRegular,
37
38
  fontWeightMedium,
@@ -1,4 +1,4 @@
1
- import { TimeSeriesValueTuple } from '@perses-dev/core';
1
+ import { TimeSeriesValueTuple } from '@perses-dev/spec';
2
2
  import { LineSeriesOption, BarSeriesOption } from 'echarts/charts';
3
3
  import { LegendItem } from '../Legend';
4
4
  export declare const OPTIMIZED_MODE_SERIES_LIMIT = 1000;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/graph.ts"],"sourcesContent":["// Copyright 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 { TimeSeriesValueTuple } from '@perses-dev/core';\nimport { LineSeriesOption, BarSeriesOption } from 'echarts/charts';\nimport { LegendItem } from '../Legend';\n\n// adjust display when there are many time series to help with performance\nexport const OPTIMIZED_MODE_SERIES_LIMIT = 1000;\n\nexport type UnixTimeMs = number;\n\nexport interface GraphSeries {\n name: string;\n values: TimeSeriesValueTuple[];\n id?: string;\n}\n\nexport type EChartsValues = number | null | '-';\n\nexport interface LegacyTimeSeries extends Omit<LineSeriesOption, 'data'> {\n data: EChartsValues[];\n}\n\n// Used for TimeChart dataset support, each time series returned is mapped to series options using datasetIndex\n// - https://apache.github.io/echarts-handbook/en/concepts/dataset/#how-to-reference-several-datasets\nexport type TimeChartSeriesMapping = TimeSeriesOption[];\nexport type TimeChartLegendItems = LegendItem[];\n\nexport type TimeSeriesOption = LineSeriesOption | BarSeriesOption;\n\nexport type EChartsDataFormat = {\n timeSeries: LegacyTimeSeries[];\n xAxis: number[];\n legendItems?: LegendItem[];\n xAxisMax?: number | string;\n rangeMs?: number;\n};\n\n// Intentionally making this an object to start because it is plausible we will\n// want to support focusing by other attributes (e.g. index, name) in the future,\n// and starting with an object will make adding them a non-breaking change.\nexport type ChartInstanceFocusOpts = {\n name?: string; // e.g the TimeSeriesChart plugin uses name\n};\n\nexport type ChartInstance = {\n /**\n * Highlight the series associated with the specified options.\n */\n highlightSeries: (opts: ChartInstanceFocusOpts) => void;\n\n /**\n * Clear all highlighted series.\n */\n clearHighlightedSeries: () => void;\n};\n\nexport const PINNED_CROSSHAIR_SERIES_NAME = 'Pinned Crosshair';\n\nexport const DEFAULT_PINNED_CROSSHAIR: LineSeriesOption = {\n name: PINNED_CROSSHAIR_SERIES_NAME,\n type: 'line',\n // https://echarts.apache.org/en/option.html#series-line.markLine\n markLine: {\n data: [],\n lineStyle: {\n type: 'dashed',\n width: 2,\n },\n emphasis: {\n lineStyle: {\n width: 2,\n opacity: 1,\n },\n },\n blur: {\n lineStyle: {\n width: 2,\n opacity: 1,\n },\n },\n },\n};\n\nexport interface DatapointInfo {\n dataIndex: number;\n seriesIndex: number;\n seriesName: string;\n yValue: number;\n}\n"],"names":["OPTIMIZED_MODE_SERIES_LIMIT","PINNED_CROSSHAIR_SERIES_NAME","DEFAULT_PINNED_CROSSHAIR","name","type","markLine","data","lineStyle","width","emphasis","opacity","blur"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC,0EAA0E;AAC1E,OAAO,MAAMA,8BAA8B,KAAK;AAkDhD,OAAO,MAAMC,+BAA+B,mBAAmB;AAE/D,OAAO,MAAMC,2BAA6C;IACxDC,MAAMF;IACNG,MAAM;IACN,iEAAiE;IACjEC,UAAU;QACRC,MAAM,EAAE;QACRC,WAAW;YACTH,MAAM;YACNI,OAAO;QACT;QACAC,UAAU;YACRF,WAAW;gBACTC,OAAO;gBACPE,SAAS;YACX;QACF;QACAC,MAAM;YACJJ,WAAW;gBACTC,OAAO;gBACPE,SAAS;YACX;QACF;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../src/model/graph.ts"],"sourcesContent":["// Copyright 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 { TimeSeriesValueTuple } from '@perses-dev/spec';\nimport { LineSeriesOption, BarSeriesOption } from 'echarts/charts';\nimport { LegendItem } from '../Legend';\n\n// adjust display when there are many time series to help with performance\nexport const OPTIMIZED_MODE_SERIES_LIMIT = 1000;\n\nexport type UnixTimeMs = number;\n\nexport interface GraphSeries {\n name: string;\n values: TimeSeriesValueTuple[];\n id?: string;\n}\n\nexport type EChartsValues = number | null | '-';\n\nexport interface LegacyTimeSeries extends Omit<LineSeriesOption, 'data'> {\n data: EChartsValues[];\n}\n\n// Used for TimeChart dataset support, each time series returned is mapped to series options using datasetIndex\n// - https://apache.github.io/echarts-handbook/en/concepts/dataset/#how-to-reference-several-datasets\nexport type TimeChartSeriesMapping = TimeSeriesOption[];\nexport type TimeChartLegendItems = LegendItem[];\n\nexport type TimeSeriesOption = LineSeriesOption | BarSeriesOption;\n\nexport type EChartsDataFormat = {\n timeSeries: LegacyTimeSeries[];\n xAxis: number[];\n legendItems?: LegendItem[];\n xAxisMax?: number | string;\n rangeMs?: number;\n};\n\n// Intentionally making this an object to start because it is plausible we will\n// want to support focusing by other attributes (e.g. index, name) in the future,\n// and starting with an object will make adding them a non-breaking change.\nexport type ChartInstanceFocusOpts = {\n name?: string; // e.g the TimeSeriesChart plugin uses name\n};\n\nexport type ChartInstance = {\n /**\n * Highlight the series associated with the specified options.\n */\n highlightSeries: (opts: ChartInstanceFocusOpts) => void;\n\n /**\n * Clear all highlighted series.\n */\n clearHighlightedSeries: () => void;\n};\n\nexport const PINNED_CROSSHAIR_SERIES_NAME = 'Pinned Crosshair';\n\nexport const DEFAULT_PINNED_CROSSHAIR: LineSeriesOption = {\n name: PINNED_CROSSHAIR_SERIES_NAME,\n type: 'line',\n // https://echarts.apache.org/en/option.html#series-line.markLine\n markLine: {\n data: [],\n lineStyle: {\n type: 'dashed',\n width: 2,\n },\n emphasis: {\n lineStyle: {\n width: 2,\n opacity: 1,\n },\n },\n blur: {\n lineStyle: {\n width: 2,\n opacity: 1,\n },\n },\n },\n};\n\nexport interface DatapointInfo {\n dataIndex: number;\n seriesIndex: number;\n seriesName: string;\n yValue: number;\n}\n"],"names":["OPTIMIZED_MODE_SERIES_LIMIT","PINNED_CROSSHAIR_SERIES_NAME","DEFAULT_PINNED_CROSSHAIR","name","type","markLine","data","lineStyle","width","emphasis","opacity","blur"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC,0EAA0E;AAC1E,OAAO,MAAMA,8BAA8B,KAAK;AAkDhD,OAAO,MAAMC,+BAA+B,mBAAmB;AAE/D,OAAO,MAAMC,2BAA6C;IACxDC,MAAMF;IACNG,MAAM;IACN,iEAAiE;IACjEC,UAAU;QACRC,MAAM,EAAE;QACRC,WAAW;YACTH,MAAM;YACNI,OAAO;QACT;QACAC,UAAU;YACRF,WAAW;gBACTC,OAAO;gBACPE,SAAS;YACX;QACF;QACAC,MAAM;YACJJ,WAAW;gBACTC,OAAO;gBACPE,SAAS;YACX;QACF;IACF;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/theme.ts"],"sourcesContent":["// Copyright 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 { ThresholdColorPalette } from '@perses-dev/core';\nimport type {\n EChartsOption,\n BarSeriesOption,\n LineSeriesOption,\n GaugeSeriesOption,\n TitleComponentOption,\n ComposeOption,\n XAXisComponentOption,\n YAXisComponentOption,\n} from 'echarts';\n\nexport interface PersesChartsTheme {\n echartsTheme: EChartsTheme;\n noDataOption: NoDataOption;\n sparkline: {\n width: number;\n color: string;\n areaOpacity: number;\n };\n /**\n * Theming for the container that wraps a chart.\n */\n container: {\n /**\n * Padding in pixels.\n */\n padding: {\n default: number;\n };\n };\n thresholds: ThresholdColorPalette;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, chart tooltip uses the body of the top-level document object.\n */\n tooltipPortalContainerId?: string;\n}\n\n// https://github.com/apache/echarts/issues/12489#issuecomment-643185207\nexport interface EChartsTheme extends EChartsOption {\n bar?: BarSeriesOption;\n line?: LineSeriesOption;\n gauge?: GaugeSeriesOption;\n}\n\nexport type NoDataOption = ComposeOption<TitleComponentOption | XAXisComponentOption | YAXisComponentOption>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAgDjC,WAA6G"}
1
+ {"version":3,"sources":["../../src/model/theme.ts"],"sourcesContent":["// Copyright 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 { ThresholdColorPalette } from '@perses-dev/core'; // TODO\nimport type {\n EChartsOption,\n BarSeriesOption,\n LineSeriesOption,\n GaugeSeriesOption,\n TitleComponentOption,\n ComposeOption,\n XAXisComponentOption,\n YAXisComponentOption,\n} from 'echarts';\n\nexport interface PersesChartsTheme {\n echartsTheme: EChartsTheme;\n noDataOption: NoDataOption;\n sparkline: {\n width: number;\n color: string;\n areaOpacity: number;\n };\n /**\n * Theming for the container that wraps a chart.\n */\n container: {\n /**\n * Padding in pixels.\n */\n padding: {\n default: number;\n };\n };\n thresholds: ThresholdColorPalette;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, chart tooltip uses the body of the top-level document object.\n */\n tooltipPortalContainerId?: string;\n}\n\n// https://github.com/apache/echarts/issues/12489#issuecomment-643185207\nexport interface EChartsTheme extends EChartsOption {\n bar?: BarSeriesOption;\n line?: LineSeriesOption;\n gauge?: GaugeSeriesOption;\n}\n\nexport type NoDataOption = ComposeOption<TitleComponentOption | XAXisComponentOption | YAXisComponentOption>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAgDjC,WAA6G"}
@@ -1,4 +1,4 @@
1
- import { DurationString, RelativeTimeRange } from '@perses-dev/core';
1
+ import { DurationString, RelativeTimeRange } from '@perses-dev/spec';
2
2
  export interface TimeOption {
3
3
  value: RelativeTimeRange;
4
4
  display: string;
@@ -10,7 +10,7 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { parseDurationString } from '@perses-dev/core';
13
+ import { parseDurationString } from '@perses-dev/spec';
14
14
  import { formatDuration } from 'date-fns';
15
15
  export function buildRelativeTimeOption(duration) {
16
16
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/timeOption.ts"],"sourcesContent":["// Copyright 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 { DurationString, parseDurationString, RelativeTimeRange } from '@perses-dev/core';\nimport { formatDuration } from 'date-fns';\n\nexport interface TimeOption {\n value: RelativeTimeRange;\n display: string;\n}\n\nexport function buildRelativeTimeOption(duration: DurationString): TimeOption {\n return {\n value: { pastDuration: duration },\n display: `Last ${formatDuration(parseDurationString(duration), { delimiter: ', ' })}`,\n };\n}\n"],"names":["parseDurationString","formatDuration","buildRelativeTimeOption","duration","value","pastDuration","display","delimiter"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAyBA,mBAAmB,QAA2B,mBAAmB;AAC1F,SAASC,cAAc,QAAQ,WAAW;AAO1C,OAAO,SAASC,wBAAwBC,QAAwB;IAC9D,OAAO;QACLC,OAAO;YAAEC,cAAcF;QAAS;QAChCG,SAAS,CAAC,KAAK,EAAEL,eAAeD,oBAAoBG,WAAW;YAAEI,WAAW;QAAK,IAAI;IACvF;AACF"}
1
+ {"version":3,"sources":["../../src/model/timeOption.ts"],"sourcesContent":["// Copyright 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 { DurationString, parseDurationString, RelativeTimeRange } from '@perses-dev/spec';\nimport { formatDuration } from 'date-fns';\n\nexport interface TimeOption {\n value: RelativeTimeRange;\n display: string;\n}\n\nexport function buildRelativeTimeOption(duration: DurationString): TimeOption {\n return {\n value: { pastDuration: duration },\n display: `Last ${formatDuration(parseDurationString(duration), { delimiter: ', ' })}`,\n };\n}\n"],"names":["parseDurationString","formatDuration","buildRelativeTimeOption","duration","value","pastDuration","display","delimiter"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAyBA,mBAAmB,QAA2B,mBAAmB;AAC1F,SAASC,cAAc,QAAQ,WAAW;AAO1C,OAAO,SAASC,wBAAwBC,QAAwB;IAC9D,OAAO;QACLC,OAAO;YAAEC,cAAcF;QAAS;QAChCG,SAAS,CAAC,KAAK,EAAEL,eAAeD,oBAAoBG,WAAW;YAAEI,WAAW;QAAK,IAAI;IACvF;AACF"}
@@ -8,6 +8,8 @@ import { createTheme, PaletteMode, Theme } from '@mui/material';
8
8
  *
9
9
  * Need to reinstantiate the theme everytime to support switching between light and dark themes
10
10
  * https://github.com/mui-org/material-ui/issues/18831
11
+ *
12
+ * Enable disableBodyOverride to prevent the theme from applying color scheme to the body element.
11
13
  */
12
- export declare function getTheme(mode: PaletteMode, options?: Parameters<typeof createTheme>[0]): Theme;
14
+ export declare function getTheme(mode: PaletteMode, options?: Parameters<typeof createTheme>[0], disableBodyOverride?: boolean): Theme;
13
15
  //# sourceMappingURL=theme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AAuB9E;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,GAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAM,GAAG,KAAK,CAQlG"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AAuB9E;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAM,EAC/C,mBAAmB,GAAE,OAAe,GACnC,KAAK,CAQP"}
@@ -33,44 +33,61 @@ const getModalBackgroundStyle = ({ theme })=>{
33
33
  *
34
34
  * Need to reinstantiate the theme everytime to support switching between light and dark themes
35
35
  * https://github.com/mui-org/material-ui/issues/18831
36
- */ export function getTheme(mode, options = {}) {
36
+ *
37
+ * Enable disableBodyOverride to prevent the theme from applying color scheme to the body element.
38
+ */ export function getTheme(mode, options = {}, disableBodyOverride = false) {
37
39
  return createTheme({
38
40
  palette: getPaletteOptions(mode),
39
41
  typography,
40
42
  mixins: {},
41
- components,
43
+ components: getComponents(mode, disableBodyOverride),
42
44
  ...options
43
45
  });
44
46
  }
45
47
  // Overrides for component default prop values and styles go here
46
- const components = {
47
- MuiAlert,
48
- MuiFormControl: {
49
- defaultProps: {
50
- size: 'small'
51
- }
52
- },
53
- MuiPaper,
54
- MuiTextField: {
55
- defaultProps: {
56
- size: 'small'
57
- }
58
- },
59
- MuiDrawer: {
60
- styleOverrides: {
61
- paper: getModalBackgroundStyle
62
- }
63
- },
64
- MuiDialog: {
65
- styleOverrides: {
66
- paper: getModalBackgroundStyle
67
- }
68
- },
69
- MuiPopover: {
70
- styleOverrides: {
71
- paper: getModalBackgroundStyle
48
+ function getComponents(mode, disableBodyOverride) {
49
+ const components = {
50
+ MuiAlert,
51
+ MuiFormControl: {
52
+ defaultProps: {
53
+ size: 'small'
54
+ }
55
+ },
56
+ MuiPaper,
57
+ MuiTextField: {
58
+ defaultProps: {
59
+ size: 'small'
60
+ }
61
+ },
62
+ MuiDrawer: {
63
+ styleOverrides: {
64
+ paper: getModalBackgroundStyle
65
+ }
66
+ },
67
+ MuiDialog: {
68
+ styleOverrides: {
69
+ paper: getModalBackgroundStyle
70
+ }
71
+ },
72
+ MuiPopover: {
73
+ styleOverrides: {
74
+ paper: getModalBackgroundStyle
75
+ }
72
76
  }
77
+ };
78
+ if (disableBodyOverride) {
79
+ return components;
73
80
  }
74
- };
81
+ return {
82
+ MuiCssBaseline: {
83
+ styleOverrides: {
84
+ body: {
85
+ colorScheme: mode
86
+ }
87
+ }
88
+ },
89
+ ...components
90
+ };
91
+ }
75
92
 
76
93
  //# sourceMappingURL=theme.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/theme/theme.ts"],"sourcesContent":["// Copyright 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 { createTheme, PaletteMode, ThemeOptions, Theme } from '@mui/material';\nimport { MuiAlert } from './component-overrides/alert';\nimport { MuiPaper } from './component-overrides/paper';\nimport { getPaletteOptions } from './palette';\nimport { typography } from './typography';\n\nconst getModalBackgroundStyle = ({\n theme,\n}: {\n theme: Omit<Theme, 'components'>;\n}): { backgroundImage?: string; backgroundColor?: string } => {\n const backgroundStyle =\n theme.palette.mode === 'light'\n ? {}\n : {\n backgroundImage: 'unset',\n backgroundColor: theme.palette.designSystem.grey[800],\n };\n return {\n ...backgroundStyle,\n };\n};\n\n/**\n * Gets theme used by all components for the provided mode. For more details, see:\n * - Base colors, typography, sizing - go/chrono-ui-theme\n * - Material UI defaults: https://material-ui.com/customization/default-theme/\n * - Material UI variables: https://material-ui.com/customization/theming/#theme-configuration-variables\n * - Material UI global overrides and default props: https://material-ui.com/customization/globals/#css\n *\n * Need to reinstantiate the theme everytime to support switching between light and dark themes\n * https://github.com/mui-org/material-ui/issues/18831\n */\nexport function getTheme(mode: PaletteMode, options: Parameters<typeof createTheme>[0] = {}): Theme {\n return createTheme({\n palette: getPaletteOptions(mode),\n typography,\n mixins: {},\n components,\n ...options,\n });\n}\n\n// Overrides for component default prop values and styles go here\nconst components: ThemeOptions['components'] = {\n MuiAlert,\n MuiFormControl: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiPaper,\n MuiTextField: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiDrawer: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiDialog: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiPopover: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n};\n"],"names":["createTheme","MuiAlert","MuiPaper","getPaletteOptions","typography","getModalBackgroundStyle","theme","backgroundStyle","palette","mode","backgroundImage","backgroundColor","designSystem","grey","getTheme","options","mixins","components","MuiFormControl","defaultProps","size","MuiTextField","MuiDrawer","styleOverrides","paper","MuiDialog","MuiPopover"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAA0C,gBAAgB;AAC9E,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,UAAU,QAAQ,eAAe;AAE1C,MAAMC,0BAA0B,CAAC,EAC/BC,KAAK,EAGN;IACC,MAAMC,kBACJD,MAAME,OAAO,CAACC,IAAI,KAAK,UACnB,CAAC,IACD;QACEC,iBAAiB;QACjBC,iBAAiBL,MAAME,OAAO,CAACI,YAAY,CAACC,IAAI,CAAC,IAAI;IACvD;IACN,OAAO;QACL,GAAGN,eAAe;IACpB;AACF;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASO,SAASL,IAAiB,EAAEM,UAA6C,CAAC,CAAC;IACzF,OAAOf,YAAY;QACjBQ,SAASL,kBAAkBM;QAC3BL;QACAY,QAAQ,CAAC;QACTC;QACA,GAAGF,OAAO;IACZ;AACF;AAEA,iEAAiE;AACjE,MAAME,aAAyC;IAC7ChB;IACAiB,gBAAgB;QACdC,cAAc;YACZC,MAAM;QACR;IACF;IACAlB;IACAmB,cAAc;QACZF,cAAc;YACZC,MAAM;QACR;IACF;IACAE,WAAW;QACTC,gBAAgB;YACdC,OAAOnB;QACT;IACF;IACAoB,WAAW;QACTF,gBAAgB;YACdC,OAAOnB;QACT;IACF;IACAqB,YAAY;QACVH,gBAAgB;YACdC,OAAOnB;QACT;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/theme/theme.ts"],"sourcesContent":["// Copyright 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 { createTheme, PaletteMode, ThemeOptions, Theme } from '@mui/material';\nimport { MuiAlert } from './component-overrides/alert';\nimport { MuiPaper } from './component-overrides/paper';\nimport { getPaletteOptions } from './palette';\nimport { typography } from './typography';\n\nconst getModalBackgroundStyle = ({\n theme,\n}: {\n theme: Omit<Theme, 'components'>;\n}): { backgroundImage?: string; backgroundColor?: string } => {\n const backgroundStyle =\n theme.palette.mode === 'light'\n ? {}\n : {\n backgroundImage: 'unset',\n backgroundColor: theme.palette.designSystem.grey[800],\n };\n return {\n ...backgroundStyle,\n };\n};\n\n/**\n * Gets theme used by all components for the provided mode. For more details, see:\n * - Base colors, typography, sizing - go/chrono-ui-theme\n * - Material UI defaults: https://material-ui.com/customization/default-theme/\n * - Material UI variables: https://material-ui.com/customization/theming/#theme-configuration-variables\n * - Material UI global overrides and default props: https://material-ui.com/customization/globals/#css\n *\n * Need to reinstantiate the theme everytime to support switching between light and dark themes\n * https://github.com/mui-org/material-ui/issues/18831\n *\n * Enable disableBodyOverride to prevent the theme from applying color scheme to the body element.\n */\nexport function getTheme(\n mode: PaletteMode,\n options: Parameters<typeof createTheme>[0] = {},\n disableBodyOverride: boolean = false\n): Theme {\n return createTheme({\n palette: getPaletteOptions(mode),\n typography,\n mixins: {},\n components: getComponents(mode, disableBodyOverride),\n ...options,\n });\n}\n\n// Overrides for component default prop values and styles go here\nfunction getComponents(mode: PaletteMode, disableBodyOverride: boolean): ThemeOptions['components'] {\n const components: ThemeOptions['components'] = {\n MuiAlert,\n MuiFormControl: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiPaper,\n MuiTextField: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiDrawer: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiDialog: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiPopover: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n };\n\n if (disableBodyOverride) {\n return components;\n }\n\n return {\n MuiCssBaseline: {\n styleOverrides: {\n body: {\n colorScheme: mode,\n },\n },\n },\n ...components,\n };\n}\n"],"names":["createTheme","MuiAlert","MuiPaper","getPaletteOptions","typography","getModalBackgroundStyle","theme","backgroundStyle","palette","mode","backgroundImage","backgroundColor","designSystem","grey","getTheme","options","disableBodyOverride","mixins","components","getComponents","MuiFormControl","defaultProps","size","MuiTextField","MuiDrawer","styleOverrides","paper","MuiDialog","MuiPopover","MuiCssBaseline","body","colorScheme"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAA0C,gBAAgB;AAC9E,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,UAAU,QAAQ,eAAe;AAE1C,MAAMC,0BAA0B,CAAC,EAC/BC,KAAK,EAGN;IACC,MAAMC,kBACJD,MAAME,OAAO,CAACC,IAAI,KAAK,UACnB,CAAC,IACD;QACEC,iBAAiB;QACjBC,iBAAiBL,MAAME,OAAO,CAACI,YAAY,CAACC,IAAI,CAAC,IAAI;IACvD;IACN,OAAO;QACL,GAAGN,eAAe;IACpB;AACF;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASO,SACdL,IAAiB,EACjBM,UAA6C,CAAC,CAAC,EAC/CC,sBAA+B,KAAK;IAEpC,OAAOhB,YAAY;QACjBQ,SAASL,kBAAkBM;QAC3BL;QACAa,QAAQ,CAAC;QACTC,YAAYC,cAAcV,MAAMO;QAChC,GAAGD,OAAO;IACZ;AACF;AAEA,iEAAiE;AACjE,SAASI,cAAcV,IAAiB,EAAEO,mBAA4B;IACpE,MAAME,aAAyC;QAC7CjB;QACAmB,gBAAgB;YACdC,cAAc;gBACZC,MAAM;YACR;QACF;QACApB;QACAqB,cAAc;YACZF,cAAc;gBACZC,MAAM;YACR;QACF;QACAE,WAAW;YACTC,gBAAgB;gBACdC,OAAOrB;YACT;QACF;QACAsB,WAAW;YACTF,gBAAgB;gBACdC,OAAOrB;YACT;QACF;QACAuB,YAAY;YACVH,gBAAgB;gBACdC,OAAOrB;YACT;QACF;IACF;IAEA,IAAIW,qBAAqB;QACvB,OAAOE;IACT;IAEA,OAAO;QACLW,gBAAgB;YACdJ,gBAAgB;gBACdK,MAAM;oBACJC,aAAatB;gBACf;YACF;QACF;QACA,GAAGS,UAAU;IACf;AACF"}
@@ -1,7 +1,9 @@
1
- import '@fontsource/lato/300.css';
2
- import '@fontsource/lato/400.css';
3
- import '@fontsource/lato/700.css';
4
- import '@fontsource/lato/900.css';
1
+ import '@fontsource/inter/300.css';
2
+ import '@fontsource/inter/400.css';
3
+ import '@fontsource/inter/500.css';
4
+ import '@fontsource/inter/600.css';
5
+ import '@fontsource/inter/700.css';
6
+ import '@fontsource/inter/900.css';
5
7
  import { ThemeOptions } from '@mui/material';
6
8
  /**
7
9
  * Theme typography options that are the same across both the dark and light themes.
@@ -1 +1 @@
1
- {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/theme/typography.ts"],"names":[],"mappings":"AAaA,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAS7C;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,YAAY,CAqEjD,CAAC"}
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/theme/typography.ts"],"names":[],"mappings":"AAaA,OAAO,2BAA2B,CAAC;AACnC,OAAO,2BAA2B,CAAC;AACnC,OAAO,2BAA2B,CAAC;AACnC,OAAO,2BAA2B,CAAC;AACnC,OAAO,2BAA2B,CAAC;AACnC,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAQ7C;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,YAAY,CAsEjD,CAAC"}
@@ -10,20 +10,21 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import '@fontsource/lato/300.css';
14
- import '@fontsource/lato/400.css';
15
- import '@fontsource/lato/700.css';
16
- import '@fontsource/lato/900.css';
13
+ import '@fontsource/inter/300.css';
14
+ import '@fontsource/inter/400.css';
15
+ import '@fontsource/inter/500.css';
16
+ import '@fontsource/inter/600.css';
17
+ import '@fontsource/inter/700.css';
18
+ import '@fontsource/inter/900.css';
17
19
  // Font weights need to correspond with the imports at the top of the file
18
- // (Lato supports 100, 300, 400, 700, 900)
19
20
  const fontWeightLight = 300;
20
21
  const fontWeightRegular = 400;
21
- const fontWeightMedium = 700;
22
+ const fontWeightMedium = 600;
22
23
  const fontWeightBold = 900;
23
24
  /**
24
25
  * Theme typography options that are the same across both the dark and light themes.
25
26
  */ export const typography = {
26
- fontFamily: '"Lato", sans-serif',
27
+ fontFamily: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
27
28
  fontWeightLight,
28
29
  fontWeightRegular,
29
30
  fontWeightMedium,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/theme/typography.ts"],"sourcesContent":["// Copyright 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 '@fontsource/lato/300.css';\nimport '@fontsource/lato/400.css';\nimport '@fontsource/lato/700.css';\nimport '@fontsource/lato/900.css';\nimport { ThemeOptions } from '@mui/material';\n\n// Font weights need to correspond with the imports at the top of the file\n// (Lato supports 100, 300, 400, 700, 900)\nconst fontWeightLight = 300;\nconst fontWeightRegular = 400;\nconst fontWeightMedium = 700;\nconst fontWeightBold = 900;\n\n/**\n * Theme typography options that are the same across both the dark and light themes.\n */\nexport const typography: ThemeOptions['typography'] = {\n fontFamily: '\"Lato\", sans-serif',\n\n fontWeightLight,\n fontWeightRegular,\n fontWeightMedium,\n fontWeightBold,\n\n h1: {\n fontSize: '1.5rem', // 24px\n fontWeight: fontWeightMedium,\n lineHeight: '32px',\n },\n h2: {\n fontSize: '1.25rem', // 20px\n fontWeight: fontWeightMedium,\n lineHeight: '28px',\n },\n h3: {\n fontSize: '1rem', // 16px\n fontWeight: fontWeightMedium,\n lineHeight: '24px',\n },\n h4: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightMedium,\n lineHeight: '22px',\n },\n h5: undefined,\n h6: undefined,\n\n body1: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightRegular,\n lineHeight: '20px',\n },\n body2: {\n fontSize: '0.75rem', // 12px\n fontWeight: fontWeightRegular,\n lineHeight: '18px',\n },\n subtitle1: {\n fontSize: '1rem', // 16px\n fontWeight: fontWeightRegular,\n lineHeight: '24px',\n letterSpacing: '0.02rem',\n },\n subtitle2: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightMedium,\n lineHeight: '22px',\n letterSpacing: '0.03rem',\n textTransform: 'uppercase',\n },\n\n button: {\n // 14px\n fontSize: '0.875rem',\n fontWeight: fontWeightMedium,\n // 20 px\n lineHeight: '1.25rem',\n textTransform: 'none',\n letterSpacing: '0.03rem',\n },\n caption: {\n fontSize: '0.6875rem', // 11px\n fontWeight: fontWeightRegular,\n lineHeight: '16px',\n },\n};\n"],"names":["fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","typography","fontFamily","h1","fontSize","fontWeight","lineHeight","h2","h3","h4","h5","undefined","h6","body1","body2","subtitle1","letterSpacing","subtitle2","textTransform","button","caption"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,2BAA2B;AAClC,OAAO,2BAA2B;AAClC,OAAO,2BAA2B;AAClC,OAAO,2BAA2B;AAGlC,0EAA0E;AAC1E,0CAA0C;AAC1C,MAAMA,kBAAkB;AACxB,MAAMC,oBAAoB;AAC1B,MAAMC,mBAAmB;AACzB,MAAMC,iBAAiB;AAEvB;;CAEC,GACD,OAAO,MAAMC,aAAyC;IACpDC,YAAY;IAEZL;IACAC;IACAC;IACAC;IAEAG,IAAI;QACFC,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAC,IAAI;QACFH,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAE,IAAI;QACFJ,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAG,IAAI;QACFL,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAI,IAAIC;IACJC,IAAID;IAEJE,OAAO;QACLT,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;IACAQ,OAAO;QACLV,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;IACAS,WAAW;QACTX,UAAU;QACVC,YAAYP;QACZQ,YAAY;QACZU,eAAe;IACjB;IACAC,WAAW;QACTb,UAAU;QACVC,YAAYN;QACZO,YAAY;QACZU,eAAe;QACfE,eAAe;IACjB;IAEAC,QAAQ;QACN,OAAO;QACPf,UAAU;QACVC,YAAYN;QACZ,QAAQ;QACRO,YAAY;QACZY,eAAe;QACfF,eAAe;IACjB;IACAI,SAAS;QACPhB,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;AACF,EAAE"}
1
+ {"version":3,"sources":["../../src/theme/typography.ts"],"sourcesContent":["// Copyright 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 '@fontsource/inter/300.css';\nimport '@fontsource/inter/400.css';\nimport '@fontsource/inter/500.css';\nimport '@fontsource/inter/600.css';\nimport '@fontsource/inter/700.css';\nimport '@fontsource/inter/900.css';\nimport { ThemeOptions } from '@mui/material';\n\n// Font weights need to correspond with the imports at the top of the file\nconst fontWeightLight = 300;\nconst fontWeightRegular = 400;\nconst fontWeightMedium = 600;\nconst fontWeightBold = 900;\n\n/**\n * Theme typography options that are the same across both the dark and light themes.\n */\nexport const typography: ThemeOptions['typography'] = {\n fontFamily:\n 'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"',\n\n fontWeightLight,\n fontWeightRegular,\n fontWeightMedium,\n fontWeightBold,\n\n h1: {\n fontSize: '1.5rem', // 24px\n fontWeight: fontWeightMedium,\n lineHeight: '32px',\n },\n h2: {\n fontSize: '1.25rem', // 20px\n fontWeight: fontWeightMedium,\n lineHeight: '28px',\n },\n h3: {\n fontSize: '1rem', // 16px\n fontWeight: fontWeightMedium,\n lineHeight: '24px',\n },\n h4: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightMedium,\n lineHeight: '22px',\n },\n h5: undefined,\n h6: undefined,\n\n body1: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightRegular,\n lineHeight: '20px',\n },\n body2: {\n fontSize: '0.75rem', // 12px\n fontWeight: fontWeightRegular,\n lineHeight: '18px',\n },\n subtitle1: {\n fontSize: '1rem', // 16px\n fontWeight: fontWeightRegular,\n lineHeight: '24px',\n letterSpacing: '0.02rem',\n },\n subtitle2: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightMedium,\n lineHeight: '22px',\n letterSpacing: '0.03rem',\n textTransform: 'uppercase',\n },\n\n button: {\n // 14px\n fontSize: '0.875rem',\n fontWeight: fontWeightMedium,\n // 20 px\n lineHeight: '1.25rem',\n textTransform: 'none',\n letterSpacing: '0.03rem',\n },\n caption: {\n fontSize: '0.6875rem', // 11px\n fontWeight: fontWeightRegular,\n lineHeight: '16px',\n },\n};\n"],"names":["fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","typography","fontFamily","h1","fontSize","fontWeight","lineHeight","h2","h3","h4","h5","undefined","h6","body1","body2","subtitle1","letterSpacing","subtitle2","textTransform","button","caption"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,4BAA4B;AACnC,OAAO,4BAA4B;AACnC,OAAO,4BAA4B;AACnC,OAAO,4BAA4B;AACnC,OAAO,4BAA4B;AACnC,OAAO,4BAA4B;AAGnC,0EAA0E;AAC1E,MAAMA,kBAAkB;AACxB,MAAMC,oBAAoB;AAC1B,MAAMC,mBAAmB;AACzB,MAAMC,iBAAiB;AAEvB;;CAEC,GACD,OAAO,MAAMC,aAAyC;IACpDC,YACE;IAEFL;IACAC;IACAC;IACAC;IAEAG,IAAI;QACFC,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAC,IAAI;QACFH,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAE,IAAI;QACFJ,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAG,IAAI;QACFL,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAI,IAAIC;IACJC,IAAID;IAEJE,OAAO;QACLT,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;IACAQ,OAAO;QACLV,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;IACAS,WAAW;QACTX,UAAU;QACVC,YAAYP;QACZQ,YAAY;QACZU,eAAe;IACjB;IACAC,WAAW;QACTb,UAAU;QACVC,YAAYN;QACZO,YAAY;QACZU,eAAe;QACfE,eAAe;IACjB;IAEAC,QAAQ;QACN,OAAO;QACPf,UAAU;QACVC,YAAYN;QACZ,QAAQ;QACRO,YAAY;QACZY,eAAe;QACfF,eAAe;IACjB;IACAI,SAAS;QACPhB,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;AACF,EAAE"}
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import merge from 'lodash/merge';
14
- import { formatValue } from '@perses-dev/core';
14
+ import { formatValue } from '@perses-dev/core'; // TODO
15
15
  // Character width multipliers (approximate for typical UI fonts)
16
16
  const CHAR_WIDTH_BASE = 6;
17
17
  const AXIS_LABEL_PADDING = 10; // Extra padding to avoid label clipping