@perses-dev/components 0.31.0 → 0.33.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 (111) hide show
  1. package/dist/ContentWithLegend/ContentWithLegend.d.ts +11 -0
  2. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -0
  3. package/dist/ContentWithLegend/ContentWithLegend.js +65 -0
  4. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -0
  5. package/dist/ContentWithLegend/index.d.ts +2 -0
  6. package/dist/ContentWithLegend/index.d.ts.map +1 -0
  7. package/dist/ContentWithLegend/index.js +15 -0
  8. package/dist/ContentWithLegend/index.js.map +1 -0
  9. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +68 -0
  10. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -0
  11. package/dist/ContentWithLegend/model/content-with-legend-model.js +90 -0
  12. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -0
  13. package/dist/EChart/EChart.d.ts.map +1 -1
  14. package/dist/EChart/EChart.js +9 -1
  15. package/dist/EChart/EChart.js.map +1 -1
  16. package/dist/Legend/Legend.d.ts.map +1 -1
  17. package/dist/Legend/Legend.js +30 -15
  18. package/dist/Legend/Legend.js.map +1 -1
  19. package/dist/Legend/ListLegend.d.ts.map +1 -1
  20. package/dist/Legend/ListLegend.js +2 -23
  21. package/dist/Legend/ListLegend.js.map +1 -1
  22. package/dist/Legend/ListLegendItem.d.ts +1 -1
  23. package/dist/Legend/TableLegend.d.ts +12 -0
  24. package/dist/Legend/TableLegend.d.ts.map +1 -0
  25. package/dist/Legend/TableLegend.js +61 -0
  26. package/dist/Legend/TableLegend.js.map +1 -0
  27. package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  28. package/dist/LegendOptionsEditor/LegendOptionsEditor.js +35 -3
  29. package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  30. package/dist/LineChart/LineChart.d.ts.map +1 -1
  31. package/dist/LineChart/LineChart.js +60 -22
  32. package/dist/LineChart/LineChart.js.map +1 -1
  33. package/dist/StatChart/StatChart.d.ts.map +1 -1
  34. package/dist/StatChart/StatChart.js +8 -1
  35. package/dist/StatChart/StatChart.js.map +1 -1
  36. package/dist/Table/InnerTable.js +1 -1
  37. package/dist/Table/InnerTable.js.map +1 -1
  38. package/dist/Table/TableCell.js +1 -1
  39. package/dist/Table/TableCell.js.map +1 -1
  40. package/dist/Table/TableRow.d.ts.map +1 -1
  41. package/dist/Table/TableRow.js +3 -3
  42. package/dist/Table/TableRow.js.map +1 -1
  43. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts +5 -5
  44. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +1 -1
  45. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js +36 -54
  46. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +1 -1
  47. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +0 -2
  48. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  49. package/dist/TimeSeriesTooltip/TooltipContent.js +21 -97
  50. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  51. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +12 -0
  52. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -0
  53. package/dist/TimeSeriesTooltip/TooltipHeader.js +163 -0
  54. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -0
  55. package/dist/TimeSeriesTooltip/index.d.ts +1 -0
  56. package/dist/TimeSeriesTooltip/index.d.ts.map +1 -1
  57. package/dist/TimeSeriesTooltip/index.js +1 -0
  58. package/dist/TimeSeriesTooltip/index.js.map +1 -1
  59. package/dist/TimeSeriesTooltip/nearby-series.d.ts +2 -2
  60. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  61. package/dist/TimeSeriesTooltip/nearby-series.js +2 -2
  62. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  63. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +10 -14
  64. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  65. package/dist/TimeSeriesTooltip/tooltip-model.js +2 -1
  66. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  67. package/dist/TimeSeriesTooltip/utils.js +2 -2
  68. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  69. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +70 -0
  70. package/dist/cjs/ContentWithLegend/index.js +28 -0
  71. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +100 -0
  72. package/dist/cjs/EChart/EChart.js +9 -1
  73. package/dist/cjs/Legend/Legend.js +30 -15
  74. package/dist/cjs/Legend/ListLegend.js +2 -23
  75. package/dist/cjs/Legend/TableLegend.js +67 -0
  76. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +34 -2
  77. package/dist/cjs/LineChart/LineChart.js +60 -22
  78. package/dist/cjs/StatChart/StatChart.js +8 -1
  79. package/dist/cjs/Table/InnerTable.js +1 -1
  80. package/dist/cjs/Table/TableCell.js +1 -1
  81. package/dist/cjs/Table/TableRow.js +2 -2
  82. package/dist/cjs/TimeSeriesTooltip/TimeSeriesTooltip.js +34 -91
  83. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +19 -100
  84. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +174 -0
  85. package/dist/cjs/TimeSeriesTooltip/index.js +1 -0
  86. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +2 -2
  87. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +3 -1
  88. package/dist/cjs/TimeSeriesTooltip/utils.js +2 -2
  89. package/dist/cjs/index.js +1 -0
  90. package/dist/cjs/model/legend.js +30 -1
  91. package/dist/cjs/theme/component-overrides/paper.js +27 -0
  92. package/dist/cjs/theme/palette/background.js +2 -2
  93. package/dist/cjs/theme/theme.js +2 -0
  94. package/dist/index.d.ts +1 -0
  95. package/dist/index.d.ts.map +1 -1
  96. package/dist/index.js +1 -0
  97. package/dist/index.js.map +1 -1
  98. package/dist/model/legend.d.ts +9 -3
  99. package/dist/model/legend.d.ts.map +1 -1
  100. package/dist/model/legend.js +26 -1
  101. package/dist/model/legend.js.map +1 -1
  102. package/dist/theme/component-overrides/paper.d.ts +3 -0
  103. package/dist/theme/component-overrides/paper.d.ts.map +1 -0
  104. package/dist/theme/component-overrides/paper.js +21 -0
  105. package/dist/theme/component-overrides/paper.js.map +1 -0
  106. package/dist/theme/palette/background.js +2 -2
  107. package/dist/theme/palette/background.js.map +1 -1
  108. package/dist/theme/theme.d.ts.map +1 -1
  109. package/dist/theme/theme.js +2 -0
  110. package/dist/theme/theme.js.map +1 -1
  111. package/package.json +4 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/TableCell.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TableCell as MuiTableCell, styled, TableCellProps as MuiTableCellProps, Box, useTheme } from '@mui/material';\nimport { useEffect, useRef } from 'react';\nimport { TableDensity, getTableCellLayout } from './model/table-model';\n\nconst StyledMuiTableCell = styled(MuiTableCell)(({ theme }) => ({\n padding: 0,\n backgroundColor: 'inherit',\n\n '&.MuiTableCell-head': {\n // Important to avoid scrolling behind the header showing through.\n backgroundColor: theme.palette.background.paper,\n },\n '&:focus-visible': {\n outline: `solid 1px ${theme.palette.primary.main}`,\n // Move inward a little to avoid getting cut off when focusing on items\n // at the edge of the table.\n outlineOffset: '-1px',\n borderRadius: 0,\n },\n}));\n\nexport interface TableCellProps extends Omit<MuiTableCellProps, 'tabIndex'> {\n density: TableDensity;\n\n /**\n * How the cell should behave related to focus.\n * - `trigger-focus`: the cell should be auto-focused when it renders.\n * - `focus-next`: the cell should have tabindex=\"0\", so that it will be\n * focused the next time someone tabs with a keyboard.\n * - `none`: the cell should have tabindex=\"-1\", so it is not focused by\n * keyboard interactions at this time.\n */\n focusState?: 'trigger-focus' | 'focus-next' | 'none';\n onFocusTrigger?: (e: React.MouseEvent<HTMLTableCellElement> | React.KeyboardEvent<HTMLTableCellElement>) => void;\n}\n\nexport function TableCell({\n children,\n density,\n variant,\n width,\n focusState = 'none',\n onFocusTrigger,\n ...otherProps\n}: TableCellProps) {\n const theme = useTheme();\n\n const elRef = useRef<HTMLTableCellElement>();\n\n const isHeader = variant === 'head';\n\n useEffect(() => {\n if (focusState === 'trigger-focus' && elRef.current) {\n elRef.current.focus();\n }\n }, [focusState]);\n\n const handleFocus: React.FocusEventHandler<HTMLTableCellElement> = (e) => {\n // From https://zellwk.com/blog/keyboard-focusable-elements/\n const nestedFocusTarget = e.currentTarget?.querySelector<HTMLElement>(\n 'a[href], button, input, textarea, select, details'\n );\n if (nestedFocusTarget) {\n // If the cell has a focusable child, focus it instead. Mostly used for\n // checkbox cells, but could have other uses.\n nestedFocusTarget.focus();\n }\n };\n\n const handleInteractionFocusTrigger: TableCellProps['onFocusTrigger'] = (e) => {\n // We use `onClick` and `onKeyUp` events instead of `onFocus` because of\n // some ordering issues with when the browser calls events and how this\n // plays with the triggering of focus with keyboard interactions.\n // These report that a focus event happened, so we can adjust the current\n // tabindex and focuses to the right cell.\n onFocusTrigger?.(e);\n };\n\n return (\n <StyledMuiTableCell\n {...otherProps}\n // Modify the tab index based on the currently focused cell. It's important\n // to avoid having tabindex 0 on everything because it essentially traps\n // a keyboard user in the table until they hit \"tab\" for every single\n // cell.\n tabIndex={focusState !== 'none' ? 0 : -1}\n onFocus={handleFocus}\n onClick={handleInteractionFocusTrigger}\n onKeyUp={handleInteractionFocusTrigger}\n sx={{\n width: width,\n borderBottom: isHeader\n ? (theme) => `solid 1px ${theme.palette.grey[100]}`\n : `solid 1px ${theme.palette.grey[50]}`,\n }}\n ref={elRef}\n >\n <Box\n sx={{\n ...getTableCellLayout(theme, density),\n position: 'relative',\n\n // Text truncation. Currently enforced on all cells. We may control\n // this with a prop on column config in the future.\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {children}\n </Box>\n </StyledMuiTableCell>\n );\n}\n"],"names":["TableCell","MuiTableCell","styled","Box","useTheme","useEffect","useRef","getTableCellLayout","StyledMuiTableCell","theme","padding","backgroundColor","palette","background","paper","outline","primary","main","outlineOffset","borderRadius","children","density","variant","width","focusState","onFocusTrigger","otherProps","elRef","isHeader","current","focus","handleFocus","e","nestedFocusTarget","currentTarget","querySelector","handleInteractionFocusTrigger","tabIndex","onFocus","onClick","onKeyUp","sx","borderBottom","grey","ref","position","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,SAAS,IAAIC,YAAY,EAAEC,MAAM,EAAuCC,GAAG,EAAEC,QAAQ,QAAQ,eAAe,CAAC;AACtH,SAASC,SAAS,EAAEC,MAAM,QAAQ,OAAO,CAAC;AAC1C,SAAuBC,kBAAkB,QAAQ,qBAAqB,CAAC;AAEvE,MAAMC,kBAAkB,GAAGN,MAAM,CAACD,YAAY,CAAC,CAAC,CAAC,EAAEQ,KAAK,CAAA,EAAE,GAAM,CAAA;QAC9DC,OAAO,EAAE,CAAC;QACVC,eAAe,EAAE,SAAS;QAE1B,qBAAqB,EAAE;YACrB,kEAAkE;YAClEA,eAAe,EAAEF,KAAK,CAACG,OAAO,CAACC,UAAU,CA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AiE;QACjE,yEAAyE;QACzE,0CAA0C;QAC1CP,cAAc,aAAdA,cAAc,WAAK,GAAnBA,KAAAA,CAAmB,GAAnBA,cAAc,CAAGO,CAAC,CAAC,CAAC;IACtB,CAAC,AAAC;IAEF,qBACE,KAACxB,kBAAkB;QAChB,GAAGkB,UAAU;QACd,2EAA2E;QAC3E,wEAAwE;QACxE,qEAAqE;QACrE,QAAQ;QACRW,QAAQ,EAAEb,UAAU,KAAK,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;QACxCc,OAAO,EAAEP,WAAW;QACpBQ,OAAO,EAAEH,6BAA6B;QACtCI,OAAO,EAAEJ,6BAA6B;QACtCK,EAAE,EAAE;YACFlB,KAAK,EAAEA,KAAK;YACZmB,YAAY,EAAEd,QAAQ,GAClB,CAACnB,KAAK,GAAK,CAAC,UAAU,EAAEA,KAAK,CAACG,OAAO,CAAC+B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GACjD,CAAC,UAAU,EAAElC,KAAK,CAACG,OAAO,CAAC+B,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;SAC1C;QACDC,GAAG,EAAEjB,KAAK;kBAEV,cAAA,KAACxB,GAAG;YACFsC,EAAE,EAAE;gBACF,GAAGlC,kBAAkB,CAACE,KAAK,EAAEY,OAAO,CAAC;gBACrCwB,QAAQ,EAAE,UAAU;gBAEpB,mEAAmE;gBACnE,mDAAmD;gBACnDC,UAAU,EAAE,QAAQ;gBACpBC,QAAQ,EAAE,QAAQ;gBAClBC,YAAY,EAAE,UAAU;aACzB;sBAEA5B,QAAQ;UACL;MACa,CACrB;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/Table/TableCell.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TableCell as MuiTableCell, styled, TableCellProps as MuiTableCellProps, Box, useTheme } from '@mui/material';\nimport { useEffect, useRef } from 'react';\nimport { TableDensity, getTableCellLayout } from './model/table-model';\n\nconst StyledMuiTableCell = styled(MuiTableCell)(({ theme }) => ({\n padding: 0,\n backgroundColor: 'inherit',\n\n '&.MuiTableCell-head': {\n // Important to avoid scrolling behind the header showing through.\n backgroundColor: theme.palette.background.default,\n },\n '&:focus-visible': {\n outline: `solid 1px ${theme.palette.primary.main}`,\n // Move inward a little to avoid getting cut off when focusing on items\n // at the edge of the table.\n outlineOffset: '-1px',\n borderRadius: 0,\n },\n}));\n\nexport interface TableCellProps extends Omit<MuiTableCellProps, 'tabIndex'> {\n density: TableDensity;\n\n /**\n * How the cell should behave related to focus.\n * - `trigger-focus`: the cell should be auto-focused when it renders.\n * - `focus-next`: the cell should have tabindex=\"0\", so that it will be\n * focused the next time someone tabs with a keyboard.\n * - `none`: the cell should have tabindex=\"-1\", so it is not focused by\n * keyboard interactions at this time.\n */\n focusState?: 'trigger-focus' | 'focus-next' | 'none';\n onFocusTrigger?: (e: React.MouseEvent<HTMLTableCellElement> | React.KeyboardEvent<HTMLTableCellElement>) => void;\n}\n\nexport function TableCell({\n children,\n density,\n variant,\n width,\n focusState = 'none',\n onFocusTrigger,\n ...otherProps\n}: TableCellProps) {\n const theme = useTheme();\n\n const elRef = useRef<HTMLTableCellElement>();\n\n const isHeader = variant === 'head';\n\n useEffect(() => {\n if (focusState === 'trigger-focus' && elRef.current) {\n elRef.current.focus();\n }\n }, [focusState]);\n\n const handleFocus: React.FocusEventHandler<HTMLTableCellElement> = (e) => {\n // From https://zellwk.com/blog/keyboard-focusable-elements/\n const nestedFocusTarget = e.currentTarget?.querySelector<HTMLElement>(\n 'a[href], button, input, textarea, select, details'\n );\n if (nestedFocusTarget) {\n // If the cell has a focusable child, focus it instead. Mostly used for\n // checkbox cells, but could have other uses.\n nestedFocusTarget.focus();\n }\n };\n\n const handleInteractionFocusTrigger: TableCellProps['onFocusTrigger'] = (e) => {\n // We use `onClick` and `onKeyUp` events instead of `onFocus` because of\n // some ordering issues with when the browser calls events and how this\n // plays with the triggering of focus with keyboard interactions.\n // These report that a focus event happened, so we can adjust the current\n // tabindex and focuses to the right cell.\n onFocusTrigger?.(e);\n };\n\n return (\n <StyledMuiTableCell\n {...otherProps}\n // Modify the tab index based on the currently focused cell. It's important\n // to avoid having tabindex 0 on everything because it essentially traps\n // a keyboard user in the table until they hit \"tab\" for every single\n // cell.\n tabIndex={focusState !== 'none' ? 0 : -1}\n onFocus={handleFocus}\n onClick={handleInteractionFocusTrigger}\n onKeyUp={handleInteractionFocusTrigger}\n sx={{\n width: width,\n borderBottom: isHeader\n ? (theme) => `solid 1px ${theme.palette.grey[100]}`\n : `solid 1px ${theme.palette.grey[50]}`,\n }}\n ref={elRef}\n >\n <Box\n sx={{\n ...getTableCellLayout(theme, density),\n position: 'relative',\n\n // Text truncation. Currently enforced on all cells. We may control\n // this with a prop on column config in the future.\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {children}\n </Box>\n </StyledMuiTableCell>\n );\n}\n"],"names":["TableCell","MuiTableCell","styled","Box","useTheme","useEffect","useRef","getTableCellLayout","StyledMuiTableCell","theme","padding","backgroundColor","palette","background","default","outline","primary","main","outlineOffset","borderRadius","children","density","variant","width","focusState","onFocusTrigger","otherProps","elRef","isHeader","current","focus","handleFocus","e","nestedFocusTarget","currentTarget","querySelector","handleInteractionFocusTrigger","tabIndex","onFocus","onClick","onKeyUp","sx","borderBottom","grey","ref","position","whiteSpace","overflow","textOverflow"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACt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YACFsC,EAAE,EAAE;gBACF,GAAGlC,kBAAkB,CAACE,KAAK,EAAEY,OAAO,CAAC;gBACrCwB,QAAQ,EAAE,UAAU;gBAEpB,mEAAmE;gBACnE,mDAAmD;gBACnDC,UAAU,EAAE,QAAQ;gBACpBC,QAAQ,EAAE,QAAQ;gBAClBC,YAAY,EAAE,UAAU;aACzB;sBAEA5B,QAAQ;UACL;MACa,CACrB;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../src/Table/TableRow.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA2B,aAAa,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE3F,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,UAAU,aAAc,SAAQ,gBAAgB,CAAC,KAAK,CAAC;IACrD,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,eAAO,MAAM,QAAQ,iqJAanB,CAAC"}
1
+ {"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../src/Table/TableRow.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA2B,aAAa,IAAI,gBAAgB,EAAS,MAAM,eAAe,CAAC;AAElG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,UAAU,aAAc,SAAQ,gBAAgB,CAAC,KAAK,CAAC;IACrD,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,eAAO,MAAM,QAAQ,iqJAanB,CAAC"}
@@ -11,16 +11,16 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
- import { TableRow as MuiTableRow } from '@mui/material';
14
+ import { TableRow as MuiTableRow, alpha } from '@mui/material';
15
15
  import { forwardRef } from 'react';
16
16
  export const TableRow = /*#__PURE__*/ forwardRef(function TableRow(props, ref) {
17
17
  return /*#__PURE__*/ _jsx(MuiTableRow, {
18
18
  ...props,
19
19
  ref: ref,
20
20
  sx: {
21
- backgroundColor: (theme)=>theme.palette.background.paper,
21
+ backgroundColor: (theme)=>theme.palette.background.default,
22
22
  '&:hover': {
23
- backgroundColor: (theme)=>theme.palette.primary.light
23
+ backgroundColor: (theme)=>alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity)
24
24
  }
25
25
  }
26
26
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/TableRow.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TableRow as MuiTableRow, TableRowProps as MuiTableRowProps } from '@mui/material';\nimport { forwardRef } from 'react';\nimport { TableDensity } from './model/table-model';\n\ninterface TableRowProps extends MuiTableRowProps<'div'> {\n density: TableDensity;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(props, ref) {\n return (\n <MuiTableRow\n {...props}\n ref={ref}\n sx={{\n backgroundColor: (theme) => theme.palette.background.paper,\n '&:hover': {\n backgroundColor: (theme) => theme.palette.primary.light,\n },\n }}\n />\n );\n});\n"],"names":["TableRow","MuiTableRow","forwardRef","props","ref","sx","backgroundColor","theme","palette","background","paper","primary","light"],"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,QAAQ,IAAIC,WAAW,QAA2C,eAAe,CAAC;AAC3F,SAASC,UAAU,QAAQ,OAAO,CAAC;AAOnC,OAAO,MAAMF,QAAQ,iBAAGE,UAAU,CAAqC,SAASF,QAAQ,CAACG,KAAK,EAAEC,GAAG,EAAE;IACnG,qBACE,KAACH,WAAW;QACT,GAAGE,KAAK;QACTC,GAAG,EAAEA,GAAG;QACRC,EAAE,EAAE;YACFC,eAAe,EAAE,CAACC,KAAK,GAAKA,KAAK,CAACC,OAAO,CAACC,UAAU,CAACC,KAAK;YAC1D,SAAS,EAAE;gBACTJ,eAAe,EAAE,CAACC,KAAK,GAAKA,KAAK,CAACC,OAAO,CAACG,OAAO,CAACC,KAAK;aACxD;SACF;MACD,CACF;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/Table/TableRow.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TableRow as MuiTableRow, TableRowProps as MuiTableRowProps, alpha } from '@mui/material';\nimport { forwardRef } from 'react';\nimport { TableDensity } from './model/table-model';\n\ninterface TableRowProps extends MuiTableRowProps<'div'> {\n density: TableDensity;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(props, ref) {\n return (\n <MuiTableRow\n {...props}\n ref={ref}\n sx={{\n backgroundColor: (theme) => theme.palette.background.default,\n '&:hover': {\n backgroundColor: (theme) => alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),\n },\n }}\n />\n );\n});\n"],"names":["TableRow","MuiTableRow","alpha","forwardRef","props","ref","sx","backgroundColor","theme","palette","background","default","primary","main","action","hoverOpacity"],"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,QAAQ,IAAIC,WAAW,EAAqCC,KAAK,QAAQ,eAAe,CAAC;AAClG,SAASC,UAAU,QAAQ,OAAO,CAAC;AAOnC,OAAO,MAAMH,QAAQ,iBAAGG,UAAU,CAAqC,SAASH,QAAQ,CAACI,KAAK,EAAEC,GAAG,EAAE;IACnG,qBACE,KAACJ,WAAW;QACT,GAAGG,KAAK;QACTC,GAAG,EAAEA,GAAG;QACRC,EAAE,EAAE;YACFC,eAAe,EAAE,CAACC,KAAK,GAAKA,KAAK,CAACC,OAAO,CAACC,UAAU,CAACC,OAAO;YAC5D,SAAS,EAAE;gBACTJ,eAAe,EAAE,CAACC,KAAK,GAAKN,KAAK,CAACM,KAAK,CAACC,OAAO,CAACG,OAAO,CAACC,IAAI,EAAEL,KAAK,CAACC,OAAO,CAACK,MAAM,CAACC,YAAY,CAAC;aACjG;SACF;MACD,CACF;AACJ,CAAC,CAAC,CAAC"}
@@ -1,14 +1,14 @@
1
+ /// <reference types="react" />
1
2
  import { ECharts as EChartsInstance } from 'echarts/core';
2
- import React from 'react';
3
3
  import { EChartsDataFormat, UnitOptions } from '../model';
4
- interface TimeSeriesTooltipProps {
4
+ import { CursorCoordinates } from './tooltip-model';
5
+ export interface TimeSeriesTooltipProps {
5
6
  chartRef: React.MutableRefObject<EChartsInstance | undefined>;
6
7
  chartData: EChartsDataFormat;
7
- isTooltipPinned: boolean;
8
8
  wrapLabels?: boolean;
9
9
  unit?: UnitOptions;
10
10
  onUnpinClick?: () => void;
11
+ pinnedPos: CursorCoordinates | null;
11
12
  }
12
- export declare const TimeSeriesTooltip: React.NamedExoticComponent<TimeSeriesTooltipProps>;
13
- export {};
13
+ export declare const TimeSeriesTooltip: import("react").NamedExoticComponent<TimeSeriesTooltipProps>;
14
14
  //# sourceMappingURL=TimeSeriesTooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimeSeriesTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TimeSeriesTooltip.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAa1D,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAC9D,SAAS,EAAE,iBAAiB,CAAC;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,oDAwG5B,CAAC"}
1
+ {"version":3,"file":"TimeSeriesTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TimeSeriesTooltip.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAG1D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI1D,OAAO,EACL,iBAAiB,EAOlB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAC9D,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,iBAAiB,8DAiF5B,CAAC"}
@@ -11,27 +11,28 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { Box, Portal, Typography, Stack, Switch } from '@mui/material';
15
- import React, { useState } from 'react';
14
+ import { Box, Portal, Stack } from '@mui/material';
15
+ import { memo, useState } from 'react';
16
16
  import useResizeObserver from 'use-resize-observer';
17
17
  import { TooltipContent } from './TooltipContent';
18
+ import { TooltipHeader } from './TooltipHeader';
18
19
  import { getNearbySeriesData } from './nearby-series';
19
- import { FALLBACK_CHART_WIDTH, TOOLTIP_MAX_HEIGHT, TOOLTIP_MIN_WIDTH, TOOLTIP_MAX_WIDTH, useMousePosition } from './tooltip-model';
20
+ import { FALLBACK_CHART_WIDTH, TOOLTIP_BG_COLOR_FALLBACK, TOOLTIP_MAX_HEIGHT, TOOLTIP_MAX_WIDTH, TOOLTIP_MIN_WIDTH, useMousePosition } from './tooltip-model';
20
21
  import { assembleTransform } from './utils';
21
- export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels , isTooltipPinned , unit , onUnpinClick }) {
22
+ export const TimeSeriesTooltip = /*#__PURE__*/ memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels , unit , onUnpinClick , pinnedPos }) {
22
23
  const [showAllSeries, setShowAllSeries] = useState(false);
23
- const [pinnedPos, setPinnedPos] = useState(null);
24
24
  const mousePos = useMousePosition();
25
25
  const { height , width , ref: tooltipRef } = useResizeObserver();
26
+ const isTooltipPinned = pinnedPos !== null;
26
27
  if (mousePos === null || mousePos.target === null) return null;
27
28
  // Ensure user is hovering over a chart before checking for nearby series.
28
29
  if (pinnedPos === null && mousePos.target.tagName !== 'CANVAS') return null;
29
30
  const chart = chartRef.current;
30
31
  var ref;
31
- const chartWidth = (ref = chart === null || chart === void 0 ? void 0 : chart.getWidth()) !== null && ref !== void 0 ? ref : FALLBACK_CHART_WIDTH; // Fallback width not likely to every be needed.
32
+ const chartWidth = (ref = chart === null || chart === void 0 ? void 0 : chart.getWidth()) !== null && ref !== void 0 ? ref : FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
32
33
  const cursorTransform = assembleTransform(mousePos, chartWidth, pinnedPos, height !== null && height !== void 0 ? height : 0, width !== null && width !== void 0 ? width : 0);
33
34
  // Get series nearby the cursor and pass into tooltip content children.
34
- const focusedSeries = getNearbySeriesData({
35
+ const nearbySeries = getNearbySeriesData({
35
36
  mousePos,
36
37
  chartData,
37
38
  pinnedPos,
@@ -39,27 +40,25 @@ export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesToo
39
40
  unit,
40
41
  showAllSeries
41
42
  });
42
- if (focusedSeries.length === 0) {
43
+ if (nearbySeries.length === 0) {
43
44
  return null;
44
45
  }
45
- if (isTooltipPinned === true && pinnedPos === null) {
46
- setPinnedPos(mousePos);
47
- }
48
- // Option for user to see all series instead of only the nearby focused series.
49
- // Only relevant when there are more total series than are visible.
50
- const showAllSeriesToggle = isTooltipPinned === true && showAllSeries === false && chartData.timeSeries.length > 1 && focusedSeries.length !== chartData.timeSeries.length;
46
+ const totalSeries = chartData.timeSeries.length;
47
+ var ref1;
51
48
  return /*#__PURE__*/ _jsx(Portal, {
52
- children: /*#__PURE__*/ _jsxs(Box, {
49
+ children: /*#__PURE__*/ _jsx(Box, {
53
50
  ref: tooltipRef,
54
- sx: (theme)=>({
51
+ sx: (theme)=>{
52
+ var ref;
53
+ return {
55
54
  minWidth: TOOLTIP_MIN_WIDTH,
56
55
  maxWidth: TOOLTIP_MAX_WIDTH,
57
56
  maxHeight: TOOLTIP_MAX_HEIGHT,
58
- padding: theme.spacing(0.5, 2),
57
+ padding: 0,
59
58
  position: 'absolute',
60
59
  top: 0,
61
60
  left: 0,
62
- backgroundColor: '#2E313E',
61
+ backgroundColor: (ref1 = (ref = theme.palette.designSystem) === null || ref === void 0 ? void 0 : ref.grey[800]) !== null && ref1 !== void 0 ? ref1 : TOOLTIP_BG_COLOR_FALLBACK,
63
62
  borderRadius: '6px',
64
63
  color: '#fff',
65
64
  fontSize: '11px',
@@ -71,45 +70,28 @@ export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesToo
71
70
  '&:hover': {
72
71
  overflowY: 'auto'
73
72
  }
74
- }),
73
+ };
74
+ },
75
75
  style: {
76
76
  transform: cursorTransform
77
77
  },
78
- children: [
79
- /*#__PURE__*/ _jsx(TooltipContent, {
80
- series: focusedSeries,
81
- wrapLabels: wrapLabels,
82
- isTooltipPinned: isTooltipPinned,
83
- onUnpinClick: ()=>{
84
- setPinnedPos(null);
85
- if (onUnpinClick !== undefined) {
86
- onUnpinClick();
87
- }
88
- }
89
- }),
90
- showAllSeriesToggle && /*#__PURE__*/ _jsxs(Stack, {
91
- direction: "row",
92
- gap: 1,
93
- alignItems: "center",
94
- sx: {
95
- textAlign: 'right'
96
- },
97
- children: [
98
- /*#__PURE__*/ _jsx(Typography, {
99
- children: "Show All?"
100
- }),
101
- /*#__PURE__*/ _jsx(Switch, {
102
- checked: showAllSeries,
103
- onChange: (_, checked)=>setShowAllSeries(checked),
104
- sx: (theme)=>({
105
- '& .MuiSwitch-switchBase': {
106
- color: theme.palette.common.white
107
- }
108
- })
109
- })
110
- ]
111
- })
112
- ]
78
+ children: /*#__PURE__*/ _jsxs(Stack, {
79
+ spacing: 0.5,
80
+ children: [
81
+ /*#__PURE__*/ _jsx(TooltipHeader, {
82
+ nearbySeries: nearbySeries,
83
+ totalSeries: totalSeries,
84
+ isTooltipPinned: isTooltipPinned,
85
+ showAllSeries: showAllSeries,
86
+ onShowAllClick: (checked)=>setShowAllSeries(checked),
87
+ onUnpinClick: onUnpinClick
88
+ }),
89
+ /*#__PURE__*/ _jsx(TooltipContent, {
90
+ series: nearbySeries,
91
+ wrapLabels: wrapLabels
92
+ })
93
+ ]
94
+ })
113
95
  })
114
96
  });
115
97
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/TimeSeriesTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Portal, Typography, Stack, Switch } from '@mui/material';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport React, { useState } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nimport { EChartsDataFormat, UnitOptions } from '../model';\nimport { TooltipContent } from './TooltipContent';\nimport { getNearbySeriesData } from './nearby-series';\nimport {\n CursorCoordinates,\n FALLBACK_CHART_WIDTH,\n TOOLTIP_MAX_HEIGHT,\n TOOLTIP_MIN_WIDTH,\n TOOLTIP_MAX_WIDTH,\n useMousePosition,\n} from './tooltip-model';\nimport { assembleTransform } from './utils';\n\ninterface TimeSeriesTooltipProps {\n chartRef: React.MutableRefObject<EChartsInstance | undefined>;\n chartData: EChartsDataFormat;\n isTooltipPinned: boolean;\n wrapLabels?: boolean;\n unit?: UnitOptions;\n onUnpinClick?: () => void;\n}\n\nexport const TimeSeriesTooltip = React.memo(function TimeSeriesTooltip({\n chartRef,\n chartData,\n wrapLabels,\n isTooltipPinned,\n unit,\n onUnpinClick,\n}: TimeSeriesTooltipProps) {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const [pinnedPos, setPinnedPos] = useState<CursorCoordinates | null>(null);\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n\n if (mousePos === null || mousePos.target === null) return null;\n\n // Ensure user is hovering over a chart before checking for nearby series.\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to every be needed.\n const cursorTransform = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0);\n\n // Get series nearby the cursor and pass into tooltip content children.\n const focusedSeries = getNearbySeriesData({\n mousePos,\n chartData,\n pinnedPos,\n chart,\n unit,\n showAllSeries,\n });\n if (focusedSeries.length === 0) {\n return null;\n }\n\n if (isTooltipPinned === true && pinnedPos === null) {\n setPinnedPos(mousePos);\n }\n\n // Option for user to see all series instead of only the nearby focused series.\n // Only relevant when there are more total series than are visible.\n const showAllSeriesToggle =\n isTooltipPinned === true &&\n showAllSeries === false &&\n chartData.timeSeries.length > 1 &&\n focusedSeries.length !== chartData.timeSeries.length;\n\n return (\n <Portal>\n <Box\n ref={tooltipRef}\n sx={(theme) => ({\n minWidth: TOOLTIP_MIN_WIDTH,\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: TOOLTIP_MAX_HEIGHT,\n padding: theme.spacing(0.5, 2),\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: '#2E313E', // TODO: use colors from theme, separate styles for dark mode\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n zIndex: theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n })}\n style={{\n transform: cursorTransform,\n }}\n >\n <TooltipContent\n series={focusedSeries}\n wrapLabels={wrapLabels}\n isTooltipPinned={isTooltipPinned}\n onUnpinClick={() => {\n setPinnedPos(null);\n if (onUnpinClick !== undefined) {\n onUnpinClick();\n }\n }}\n />\n {showAllSeriesToggle && (\n <Stack direction=\"row\" gap={1} alignItems=\"center\" sx={{ textAlign: 'right' }}>\n <Typography>Show All?</Typography>\n <Switch\n checked={showAllSeries}\n onChange={(_, checked) => setShowAllSeries(checked)}\n sx={(theme) => ({\n '& .MuiSwitch-switchBase': {\n color: theme.palette.common.white,\n },\n })}\n />\n </Stack>\n )}\n </Box>\n </Portal>\n );\n});\n"],"names":["Box","Portal","Typography","Stack","Switch","React","useState","useResizeObserver","TooltipContent","getNearbySeriesData","FALLBACK_CHART_WIDTH","TOOLTIP_MAX_HEIGHT","TOOLTIP_MIN_WIDTH","TOOLTIP_MAX_WIDTH","useMousePosition","assembleTransform","TimeSeriesTooltip","memo","chartRef","chartData","wrapLabels","isTooltipPinned","unit","onUnpinClick","showAllSeries","setShowAllSeries","pinnedPos","setPinnedPos","mousePos","height","width","ref","tooltipRef","target","tagName","chart","current","chartWidth","getWidth","cursorTransform","focusedSeries","length","showAllSeriesToggle","timeSeries","sx","theme","minWidth","maxWidth","maxHeight","padding","spacing","position","top","left","backgroundColor","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY","style","transform","series","undefined","direction","gap","alignItems","textAlign","checked","onChange","_","palette","common","white"],"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,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,QAAQ,eAAe,CAAC;AAEvE,OAAOC,KAAK,IAAIC,QAAQ,QAAQ,OAAO,CAAC;AACxC,OAAOC,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,SAASC,cAAc,QAAQ,kBAAkB,CAAC;AAClD,SAASC,mBAAmB,QAAQ,iBAAiB,CAAC;AACtD,SAEEC,oBAAoB,EACpBC,kBAAkB,EAClBC,iBAAiB,EACjBC,iBAAiB,EACjBC,gBAAgB,QACX,iBAAiB,CAAC;AACzB,SAASC,iBAAiB,QAAQ,SAAS,CAAC;AAW5C,OAAO,MAAMC,iBAAiB,iBAAGX,K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AAAC;YACFC,KAAK,EAAE;gBACLC,SAAS,EAAE3B,eAAe;aAC3B;;8BAED,KAAC/B,cAAc;oBACb2D,MAAM,EAAE3B,aAAa;oBACrBpB,UAAU,EAAEA,UAAU;oBACtBC,eAAe,EAAEA,eAAe;oBAChCE,YAAY,EAAE,IAAM;wBAClBI,YAAY,CAAC,IAAI,CAAC,CAAC;wBACnB,IAAIJ,YAAY,KAAK6C,SAAS,EAAE;4BAC9B7C,YAAY,EAAE,CAAC;wBACjB,CAAC;oBACH,CAAC;kBACD;gBACDmB,mBAAmB,kBAClB,MAACvC,KAAK;oBAACkE,SAAS,EAAC,KAAK;oBAACC,GAAG,EAAE,CAAC;oBAAEC,UAAU,EAAC,QAAQ;oBAAC3B,EAAE,EAAE;wBAAE4B,SAAS,EAAE,OAAO;qBAAE;;sCAC3E,KAACtE,UAAU;sCAAC,WAAS;0BAAa;sCAClC,KAACE,MAAM;4BACLqE,OAAO,EAAEjD,aAAa;4BACtBkD,QAAQ,EAAE,CAACC,CAAC,EAAEF,OAAO,GAAKhD,gBAAgB,CAACgD,OAAO,CAAC;4BACnD7B,EAAE,EAAE,CAACC,KAAK,GAAM,CAAA;oCACd,yBAAyB,EAAE;wCACzBW,KAAK,EAAEX,KAAK,CAAC+B,OAAO,CAACC,MAAM,CAACC,KAAK;qCAClC;iCACF,CAAA,AAAC;0BACF;;kBACI,AACT;;UACG;MACC,CACT;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/TimeSeriesTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Portal, Stack } from '@mui/material';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { memo, useState } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nimport { EChartsDataFormat, UnitOptions } from '../model';\nimport { TooltipContent } from './TooltipContent';\nimport { TooltipHeader } from './TooltipHeader';\nimport { getNearbySeriesData } from './nearby-series';\nimport {\n CursorCoordinates,\n FALLBACK_CHART_WIDTH,\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_MAX_HEIGHT,\n TOOLTIP_MAX_WIDTH,\n TOOLTIP_MIN_WIDTH,\n useMousePosition,\n} from './tooltip-model';\nimport { assembleTransform } from './utils';\n\nexport interface TimeSeriesTooltipProps {\n chartRef: React.MutableRefObject<EChartsInstance | undefined>;\n chartData: EChartsDataFormat;\n wrapLabels?: boolean;\n unit?: UnitOptions;\n onUnpinClick?: () => void;\n pinnedPos: CursorCoordinates | null;\n}\n\nexport const TimeSeriesTooltip = memo(function TimeSeriesTooltip({\n chartRef,\n chartData,\n wrapLabels,\n unit,\n onUnpinClick,\n pinnedPos,\n}: TimeSeriesTooltipProps) {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n\n const isTooltipPinned = pinnedPos !== null;\n\n if (mousePos === null || mousePos.target === null) return null;\n\n // Ensure user is hovering over a chart before checking for nearby series.\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.\n const cursorTransform = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0);\n\n // Get series nearby the cursor and pass into tooltip content children.\n const nearbySeries = getNearbySeriesData({\n mousePos,\n chartData,\n pinnedPos,\n chart,\n unit,\n showAllSeries,\n });\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = chartData.timeSeries.length;\n\n return (\n <Portal>\n <Box\n ref={tooltipRef}\n sx={(theme) => ({\n minWidth: TOOLTIP_MIN_WIDTH,\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: TOOLTIP_MAX_HEIGHT,\n padding: 0,\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n zIndex: theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n })}\n style={{\n transform: cursorTransform,\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["Box","Portal","Stack","memo","useState","useResizeObserver","TooltipContent","TooltipHeader","getNearbySeriesData","FALLBACK_CHART_WIDTH","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_HEIGHT","TOOLTIP_MAX_WIDTH","TOOLTIP_MIN_WIDTH","useMousePosition","assembleTransform","TimeSeriesTooltip","chartRef","chartData","wrapLabels","unit","onUnpinClick","pinnedPos","showAllSeries","setShowAllSeries","mousePos","height","width","ref","tooltipRef","isTooltipPinned","target","tagName","chart","current","chartWidth","getWidth","cursorTransform","nearbySeries","length","totalSeries","timeSeries","theme","sx","minWidth","maxWidth","maxHeight","padding","position","top","left","backgroundColor","palette","designSystem","grey","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY","style","transform","spacing","onShowAllClick","checked","series"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE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A0B,GAA1BA,KAAK,CAACU,OAAO,CAACC,YAAY,cAA1BX,GAA0B,WAAM,GAAhCA,KAAAA,CAAgC,GAAhCA,GAA0B,CAAEY,IAAI,CAAC,GAAG,CAAC,cAArCZ,IAAqC,cAArCA,IAAqC,GAAIhC,yBAAyB;oBACnF6C,YAAY,EAAE,KAAK;oBACnBC,KAAK,EAAE,MAAM;oBACbC,QAAQ,EAAE,MAAM;oBAChBC,UAAU,EAAE,SAAS;oBACrBC,OAAO,EAAE,CAAC;oBACVC,UAAU,EAAE,mBAAmB;oBAC/BC,MAAM,EAAEnB,KAAK,CAACmB,MAAM,CAACC,OAAO;oBAC5BC,QAAQ,EAAE,QAAQ;oBAClB,SAAS,EAAE;wBACTC,SAAS,EAAE,MAAM;qBAClB;iBACF,CAAA;aAAC;YACFC,KAAK,EAAE;gBACLC,SAAS,EAAE7B,eAAe;aAC3B;sBAED,cAAA,MAACnC,KAAK;gBAACiE,OAAO,EAAE,GAAG;;kCACjB,KAAC5D,aAAa;wBACZ+B,YAAY,EAAEA,YAAY;wBAC1BE,WAAW,EAAEA,WAAW;wBACxBV,eAAe,EAAEA,eAAe;wBAChCP,aAAa,EAAEA,aAAa;wBAC5B6C,cAAc,EAAE,CAACC,OAAO,GAAK7C,gBAAgB,CAAC6C,OAAO,CAAC;wBACtDhD,YAAY,EAAEA,YAAY;sBAC1B;kCACF,KAACf,cAAc;wBAACgE,MAAM,EAAEhC,YAAY;wBAAEnB,UAAU,EAAEA,UAAU;sBAAI;;cAC1D;UACJ;MACC,CACT;AACJ,CAAC,CAAC,CAAC"}
@@ -2,9 +2,7 @@
2
2
  import { NearbySeriesArray } from './nearby-series';
3
3
  export interface TooltipContentProps {
4
4
  series: NearbySeriesArray | null;
5
- isTooltipPinned: boolean;
6
5
  wrapLabels?: boolean;
7
- onUnpinClick: () => void;
8
6
  }
9
7
  export declare function TooltipContent(props: TooltipContentProps): JSX.Element | null;
10
8
  //# sourceMappingURL=TooltipContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,sBAyFxD"}
1
+ {"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,sBAsCxD"}
@@ -10,116 +10,40 @@
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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { useMemo } from 'react';
15
- import PinOutline from 'mdi-material-ui/PinOutline';
16
- import Pin from 'mdi-material-ui/Pin';
17
- import { Box, Divider, Stack, Typography } from '@mui/material';
18
- import { useTimeZone } from '../context/TimeZoneProvider';
15
+ import { Box } from '@mui/material';
19
16
  import { SeriesInfo } from './SeriesInfo';
20
17
  export function TooltipContent(props) {
21
- const { series , wrapLabels , isTooltipPinned , onUnpinClick } = props;
22
- const { formatWithUserTimeZone } = useTimeZone();
23
- const seriesTime = series && series[0] && series[0].date ? series[0].date : null;
24
- const formatTimeSeriesHeader = (timeMs)=>{
25
- const date = new Date(timeMs);
26
- const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');
27
- const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');
28
- return /*#__PURE__*/ _jsxs(Box, {
29
- children: [
30
- /*#__PURE__*/ _jsx(Typography, {
31
- variant: "caption",
32
- sx: (theme)=>({
33
- color: theme.palette.common.white
34
- }),
35
- children: formattedDate
36
- }),
37
- /*#__PURE__*/ _jsx(Typography, {
38
- variant: "caption",
39
- children: /*#__PURE__*/ _jsx("strong", {
40
- children: formattedTime
41
- })
42
- })
43
- ]
44
- });
45
- };
18
+ const { series , wrapLabels } = props;
46
19
  const sortedFocusedSeries = useMemo(()=>{
47
20
  if (series === null) return null;
48
21
  return series.sort((a, b)=>a.y > b.y ? -1 : 1);
49
22
  }, [
50
23
  series
51
24
  ]);
52
- if (sortedFocusedSeries === null || seriesTime === null) {
25
+ if (series === null || sortedFocusedSeries === null) {
53
26
  return null;
54
27
  }
55
28
  // TODO: use react-virtuoso to improve performance
56
- return /*#__PURE__*/ _jsxs(Stack, {
57
- py: 1,
58
- spacing: 0.5,
59
- children: [
60
- /*#__PURE__*/ _jsxs(Box, {
61
- sx: {
62
- display: 'flex',
63
- justifyContent: 'start',
64
- alignItems: 'center'
65
- },
66
- children: [
67
- formatTimeSeriesHeader(seriesTime),
68
- /*#__PURE__*/ _jsxs(Stack, {
69
- direction: "row",
70
- gap: 1,
71
- sx: {
72
- marginLeft: 'auto'
73
- },
74
- children: [
75
- /*#__PURE__*/ _jsxs(Typography, {
76
- sx: {
77
- fontSize: 11
78
- },
79
- children: [
80
- "Click to ",
81
- isTooltipPinned ? 'Unpin' : 'Pin'
82
- ]
83
- }),
84
- isTooltipPinned ? /*#__PURE__*/ _jsx(Pin, {
85
- onClick: onUnpinClick,
86
- sx: {
87
- fontSize: 16,
88
- cursor: 'pointer'
89
- }
90
- }) : /*#__PURE__*/ _jsx(PinOutline, {
91
- sx: {
92
- fontSize: 16
93
- }
94
- })
95
- ]
96
- })
97
- ]
29
+ return /*#__PURE__*/ _jsx(Box, {
30
+ sx: (theme)=>({
31
+ display: 'table',
32
+ padding: theme.spacing(0.5, 2)
98
33
  }),
99
- /*#__PURE__*/ _jsx(Divider, {
100
- sx: (theme)=>({
101
- borderColor: theme.palette.grey['500']
102
- })
103
- }),
104
- /*#__PURE__*/ _jsx(Box, {
105
- sx: {
106
- display: 'table'
107
- },
108
- children: sortedFocusedSeries.map(({ datumIdx , seriesIdx , seriesName , y , formattedY , markerColor , isClosestToCursor })=>{
109
- if (datumIdx === null || seriesIdx === null) return null;
110
- const key = seriesIdx.toString() + datumIdx.toString();
111
- return /*#__PURE__*/ _jsx(SeriesInfo, {
112
- seriesName: seriesName,
113
- y: y,
114
- formattedY: formattedY,
115
- markerColor: markerColor,
116
- totalSeries: sortedFocusedSeries.length,
117
- wrapLabels: wrapLabels,
118
- emphasizeText: isClosestToCursor
119
- }, key);
120
- })
121
- })
122
- ]
34
+ children: sortedFocusedSeries.map(({ datumIdx , seriesIdx , seriesName , y , formattedY , markerColor , isClosestToCursor })=>{
35
+ if (datumIdx === null || seriesIdx === null) return null;
36
+ const key = seriesIdx.toString() + datumIdx.toString();
37
+ return /*#__PURE__*/ _jsx(SeriesInfo, {
38
+ seriesName: seriesName,
39
+ y: y,
40
+ formattedY: formattedY,
41
+ markerColor: markerColor,
42
+ totalSeries: sortedFocusedSeries.length,
43
+ wrapLabels: wrapLabels,
44
+ emphasizeText: isClosestToCursor
45
+ }, key);
46
+ })
123
47
  });
124
48
  }
125
49
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useMemo } from 'react';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport Pin from 'mdi-material-ui/Pin';\nimport { Box, Divider, Stack, Typography } from '@mui/material';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport { NearbySeriesArray } from './nearby-series';\nimport { SeriesInfo } from './SeriesInfo';\n\nexport interface TooltipContentProps {\n series: NearbySeriesArray | null;\n isTooltipPinned: boolean;\n wrapLabels?: boolean;\n onUnpinClick: () => void;\n}\n\nexport function TooltipContent(props: TooltipContentProps) {\n const { series, wrapLabels, isTooltipPinned, onUnpinClick } = props;\n const { formatWithUserTimeZone } = useTimeZone();\n\n const seriesTime = series && series[0] && series[0].date ? series[0].date : null;\n\n const formatTimeSeriesHeader = (timeMs: number) => {\n const date = new Date(timeMs);\n const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');\n const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');\n return (\n <Box>\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {formattedDate}\n </Typography>\n <Typography variant=\"caption\">\n <strong>{formattedTime}</strong>\n </Typography>\n </Box>\n );\n };\n\n const sortedFocusedSeries = useMemo(() => {\n if (series === null) return null;\n return series.sort((a, b) => (a.y > b.y ? -1 : 1));\n }, [series]);\n\n if (sortedFocusedSeries === null || seriesTime === null) {\n return null;\n }\n\n // TODO: use react-virtuoso to improve performance\n return (\n <Stack py={1} spacing={0.5}>\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'start',\n alignItems: 'center',\n }}\n >\n {formatTimeSeriesHeader(seriesTime)}\n <Stack direction=\"row\" gap={1} sx={{ marginLeft: 'auto' }}>\n <Typography sx={{ fontSize: 11 }}>Click to {isTooltipPinned ? 'Unpin' : 'Pin'}</Typography>\n {isTooltipPinned ? (\n <Pin onClick={onUnpinClick} sx={{ fontSize: 16, cursor: 'pointer' }} />\n ) : (\n <PinOutline sx={{ fontSize: 16 }} />\n )}\n </Stack>\n </Box>\n\n <Divider\n sx={(theme) => ({\n borderColor: theme.palette.grey['500'],\n })}\n />\n <Box\n sx={{\n display: 'table',\n }}\n >\n {sortedFocusedSeries.map(\n ({ datumIdx, seriesIdx, seriesName, y, formattedY, markerColor, isClosestToCursor }) => {\n if (datumIdx === null || seriesIdx === null) return null;\n const key = seriesIdx.toString() + datumIdx.toString();\n\n return (\n <SeriesInfo\n key={key}\n seriesName={seriesName}\n y={y}\n formattedY={formattedY}\n markerColor={markerColor}\n totalSeries={sortedFocusedSeries.length}\n wrapLabels={wrapLabels}\n emphasizeText={isClosestToCursor}\n />\n );\n }\n )}\n </Box>\n </Stack>\n );\n}\n"],"names":["useMemo","PinOutline","Pin","Box","Divider","Stack","Typography","useTimeZone","SeriesInfo","TooltipContent","props","series","wrapLabels","isTooltipPinned","onUnpinClick","formatWithUserTimeZone","seriesTime","date","formatTimeSeriesHeader","timeMs","Date","formattedDate","formattedTime","variant","sx","theme","color","palette","common","white","strong","sortedFocusedSeries","sort","a","b","y","py","spacing","display","justifyContent","alignItems","direction","gap","marginLeft","fontSize","onClick","cursor","borderColor","grey","map","datumIdx","seriesIdx","seriesName","formattedY","markerColor","isClosestToCursor","key","toString","totalSeries","length","emphasizeText"],"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,OAAO,QAAQ,OAAO,CAAC;AAChC,OAAOC,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAOC,GAAG,MAAM,qBAAqB,CAAC;AACtC,SAASC,GAAG,EAAEC,OAAO,EAAEC,KAA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;0BACF,KAAC7C,GAAG;gBACFqB,EAAE,EAAE;oBACFc,OAAO,EAAE,OAAO;iBACjB;0BAEAP,mBAAmB,CAACkB,GAAG,CACtB,CAAC,EAAEC,QAAQ,CAAA,EAAEC,SAAS,CAAA,EAAEC,UAAU,CAAA,EAAEjB,CAAC,CAAA,EAAEkB,UAAU,CAAA,EAAEC,WAAW,CAAA,EAAEC,iBAAiB,CAAA,EAAE,GAAK;oBACtF,IAAIL,QAAQ,KAAK,IAAI,IAAIC,SAAS,KAAK,IAAI,EAAE,OAAO,IAAI,CAAC;oBACzD,MAAMK,GAAG,GAAGL,SAAS,CAACM,QAAQ,EAAE,GAAGP,QAAQ,CAACO,QAAQ,EAAE,AAAC;oBAEvD,qBACE,KAACjD,UAAU;wBAET4C,UAAU,EAAEA,UAAU;wBACtBjB,CAAC,EAAEA,CAAC;wBACJkB,UAAU,EAAEA,UAAU;wBACtBC,WAAW,EAAEA,WAAW;wBACxBI,WAAW,EAAE3B,mBAAmB,CAAC4B,MAAM;wBACvC/C,UAAU,EAAEA,UAAU;wBACtBgD,aAAa,EAAEL,iBAAiB;uBAP3BC,GAAG,CAQR,CACF;gBACJ,CAAC,CACF;cACG;;MACA,CACR;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useMemo } from 'react';\nimport { Box } from '@mui/material';\nimport { NearbySeriesArray } from './nearby-series';\nimport { SeriesInfo } from './SeriesInfo';\n\nexport interface TooltipContentProps {\n series: NearbySeriesArray | null;\n wrapLabels?: boolean;\n}\n\nexport function TooltipContent(props: TooltipContentProps) {\n const { series, wrapLabels } = props;\n\n const sortedFocusedSeries = useMemo(() => {\n if (series === null) return null;\n return series.sort((a, b) => (a.y > b.y ? -1 : 1));\n }, [series]);\n\n if (series === null || sortedFocusedSeries === null) {\n return null;\n }\n // TODO: use react-virtuoso to improve performance\n return (\n <Box\n sx={(theme) => ({\n display: 'table',\n padding: theme.spacing(0.5, 2),\n })}\n >\n {sortedFocusedSeries.map(({ datumIdx, seriesIdx, seriesName, y, formattedY, markerColor, isClosestToCursor }) => {\n if (datumIdx === null || seriesIdx === null) return null;\n const key = seriesIdx.toString() + datumIdx.toString();\n\n return (\n <SeriesInfo\n key={key}\n seriesName={seriesName}\n y={y}\n formattedY={formattedY}\n markerColor={markerColor}\n totalSeries={sortedFocusedSeries.length}\n wrapLabels={wrapLabels}\n emphasizeText={isClosestToCursor}\n />\n );\n })}\n </Box>\n );\n}\n"],"names":["useMemo","Box","SeriesInfo","TooltipContent","props","series","wrapLabels","sortedFocusedSeries","sort","a","b","y","sx","theme","display","padding","spacing","map","datumIdx","seriesIdx","seriesName","formattedY","markerColor","isClosestToCursor","key","toString","totalSeries","length","emphasizeText"],"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,OAAO,QAAQ,OAAO,CAAC;AAChC,SAASC,GAAG,QAAQ,eAAe,CAAC;AAEpC,SAASC,UAAU,QAAQ,cAAc,CAAC;AAO1C,OAAO,SAASC,cAAc,CAACC,KAA0B,EAAE;IACzD,MAAM,EAAEC,MAAM,CAAA,EAAEC,UAAU,CAAA,EAAE,GAAGF,KAAK,AAAC;IAErC,MAAMG,mBAAmB,GAAGP,OAAO,CAAC,IAAM;QACxC,IAAIK,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 @@
1
+ /// <reference types="react" />
2
+ import { NearbySeriesArray } from './nearby-series';
3
+ export interface TooltipHeaderProps {
4
+ nearbySeries: NearbySeriesArray;
5
+ totalSeries: number;
6
+ isTooltipPinned: boolean;
7
+ showAllSeries: boolean;
8
+ onShowAllClick?: (checked: boolean) => void;
9
+ onUnpinClick?: () => void;
10
+ }
11
+ export declare const TooltipHeader: import("react").NamedExoticComponent<TooltipHeaderProps>;
12
+ //# sourceMappingURL=TooltipHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipHeader.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipHeader.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,iBAAiB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,0DAwHxB,CAAC"}