@perses-dev/components 0.55.0 → 0.56.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 (201) hide show
  1. package/dist/AlignSelector/AlignSelector.js +115 -25
  2. package/dist/AlignSelector/AlignSelector.js.map +1 -1
  3. package/dist/CodeEditor/CodeEditor.d.ts +19 -0
  4. package/dist/CodeEditor/CodeEditor.d.ts.map +1 -0
  5. package/dist/CodeEditor/CodeEditor.js +122 -0
  6. package/dist/CodeEditor/CodeEditor.js.map +1 -0
  7. package/dist/ColorPicker/ColorPicker.js +153 -61
  8. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  9. package/dist/ColorPicker/OptionsColorPicker.js +147 -52
  10. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
  11. package/dist/ContentWithLegend/ContentWithLegend.js +144 -41
  12. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  13. package/dist/DensitySelector/DensitySelector.js +53 -20
  14. package/dist/DensitySelector/DensitySelector.js.map +1 -1
  15. package/dist/Dialog/Dialog.d.ts +3 -2
  16. package/dist/Dialog/Dialog.d.ts.map +1 -1
  17. package/dist/Dialog/Dialog.js +202 -49
  18. package/dist/Dialog/Dialog.js.map +1 -1
  19. package/dist/Dialog/DiscardChangesConfirmationDialog.js +79 -27
  20. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  21. package/dist/DragAndDrop/DragAndDropList.js +184 -113
  22. package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
  23. package/dist/DragAndDrop/DragButton.js +131 -52
  24. package/dist/DragAndDrop/DragButton.js.map +1 -1
  25. package/dist/DragAndDrop/DropIndicator.js +51 -26
  26. package/dist/DragAndDrop/DropIndicator.js.map +1 -1
  27. package/dist/Drawer/Drawer.js +75 -15
  28. package/dist/Drawer/Drawer.js.map +1 -1
  29. package/dist/EChart/EChart.js +179 -90
  30. package/dist/EChart/EChart.js.map +1 -1
  31. package/dist/ErrorAlert.js +14 -4
  32. package/dist/ErrorAlert.js.map +1 -1
  33. package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js +463 -190
  34. package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js.map +1 -1
  35. package/dist/FontSizeSelector/FontSizeSelector.js +82 -50
  36. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  37. package/dist/FormEditor/FormActions.js +88 -14
  38. package/dist/FormEditor/FormActions.js.map +1 -1
  39. package/dist/FormatControls/FormatControls.js +246 -99
  40. package/dist/FormatControls/FormatControls.js.map +1 -1
  41. package/dist/FormatControls/UnitSelector.js +90 -25
  42. package/dist/FormatControls/UnitSelector.js.map +1 -1
  43. package/dist/InfoTooltip/InfoTooltip.js +105 -42
  44. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  45. package/dist/JSONEditor.d.ts +2 -6
  46. package/dist/JSONEditor.d.ts.map +1 -1
  47. package/dist/JSONEditor.js +24 -37
  48. package/dist/JSONEditor.js.map +1 -1
  49. package/dist/Legend/CompactLegend.js +77 -27
  50. package/dist/Legend/CompactLegend.js.map +1 -1
  51. package/dist/Legend/Legend.js +184 -82
  52. package/dist/Legend/Legend.js.map +1 -1
  53. package/dist/Legend/LegendColorBadge.js +54 -9
  54. package/dist/Legend/LegendColorBadge.js.map +1 -1
  55. package/dist/Legend/ListLegend.js +46 -16
  56. package/dist/Legend/ListLegend.js.map +1 -1
  57. package/dist/Legend/ListLegendItem.js +184 -48
  58. package/dist/Legend/ListLegendItem.js.map +1 -1
  59. package/dist/Legend/TableLegend.d.ts.map +1 -1
  60. package/dist/Legend/TableLegend.js +90 -48
  61. package/dist/Legend/TableLegend.js.map +1 -1
  62. package/dist/Legend/legend-model.d.ts +2 -2
  63. package/dist/Legend/legend-model.d.ts.map +1 -1
  64. package/dist/Legend/legend-model.js.map +1 -1
  65. package/dist/LinksEditor/LinkEditorForm.js +148 -67
  66. package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
  67. package/dist/ModeSelector/ModeSelector.js +61 -19
  68. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  69. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +20 -9
  70. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  71. package/dist/OptionsEditorLayout/OptionsEditorControl.js +130 -54
  72. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  73. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +17 -6
  74. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  75. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +76 -28
  76. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  77. package/dist/Overlay/Overlay.js +71 -27
  78. package/dist/Overlay/Overlay.js.map +1 -1
  79. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +96 -38
  80. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  81. package/dist/RepeatGrid/RepeatGrid.js +117 -45
  82. package/dist/RepeatGrid/RepeatGrid.js.map +1 -1
  83. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +99 -38
  84. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  85. package/dist/SortSelector/SortSelector.js +51 -18
  86. package/dist/SortSelector/SortSelector.js.map +1 -1
  87. package/dist/SortSelector/SortSelectorButtons.js +109 -25
  88. package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
  89. package/dist/Table/InnerTable.js +46 -15
  90. package/dist/Table/InnerTable.js.map +1 -1
  91. package/dist/Table/Table.d.ts +3 -1
  92. package/dist/Table/Table.d.ts.map +1 -1
  93. package/dist/Table/Table.js +410 -158
  94. package/dist/Table/Table.js.map +1 -1
  95. package/dist/Table/TableBody.js +15 -4
  96. package/dist/Table/TableBody.js.map +1 -1
  97. package/dist/Table/TableCell.js +284 -107
  98. package/dist/Table/TableCell.js.map +1 -1
  99. package/dist/Table/TableCheckbox.js +101 -32
  100. package/dist/Table/TableCheckbox.js.map +1 -1
  101. package/dist/Table/TableFoot.js +15 -4
  102. package/dist/Table/TableFoot.js.map +1 -1
  103. package/dist/Table/TableHead.js +15 -4
  104. package/dist/Table/TableHead.js.map +1 -1
  105. package/dist/Table/TableHeaderCell.js +119 -62
  106. package/dist/Table/TableHeaderCell.js.map +1 -1
  107. package/dist/Table/TableRow.js +33 -9
  108. package/dist/Table/TableRow.js.map +1 -1
  109. package/dist/Table/TableToolbar.d.ts +5 -4
  110. package/dist/Table/TableToolbar.d.ts.map +1 -1
  111. package/dist/Table/TableToolbar.js +172 -100
  112. package/dist/Table/TableToolbar.js.map +1 -1
  113. package/dist/Table/VirtualizedTable.d.ts +11 -11
  114. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  115. package/dist/Table/VirtualizedTable.js +387 -219
  116. package/dist/Table/VirtualizedTable.js.map +1 -1
  117. package/dist/Table/VirtualizedTableContainer.js +27 -7
  118. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  119. package/dist/Table/hooks/useFuzzySearch.d.ts +6 -5
  120. package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -1
  121. package/dist/Table/hooks/useFuzzySearch.js +57 -32
  122. package/dist/Table/hooks/useFuzzySearch.js.map +1 -1
  123. package/dist/Table/hooks/useTableKeyboardNav.js +115 -74
  124. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  125. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +1 -1
  126. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
  127. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +74 -53
  128. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  129. package/dist/Table/model/table-model.d.ts +44 -15
  130. package/dist/Table/model/table-model.d.ts.map +1 -1
  131. package/dist/Table/model/table-model.js +33 -1
  132. package/dist/Table/model/table-model.js.map +1 -1
  133. package/dist/ThresholdsEditor/ThresholdInput.js +137 -47
  134. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  135. package/dist/ThresholdsEditor/ThresholdsEditor.js +341 -174
  136. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  137. package/dist/TimeRangeSelector/DateTimeRangePicker.js +368 -162
  138. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  139. package/dist/TimeRangeSelector/TimeRangeSelector.js +580 -209
  140. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  141. package/dist/TimeSeriesTooltip/SeriesInfo.js +189 -65
  142. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  143. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +168 -78
  144. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  145. package/dist/TimeSeriesTooltip/SeriesMarker.js +38 -11
  146. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  147. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +229 -72
  148. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  149. package/dist/TimeSeriesTooltip/TooltipContent.js +73 -27
  150. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  151. package/dist/TimeSeriesTooltip/TooltipHeader.js +221 -121
  152. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  153. package/dist/TimeSeriesTooltip/tooltip-model.js +44 -38
  154. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  155. package/dist/TimeZoneSelector.js +131 -36
  156. package/dist/TimeZoneSelector.js.map +1 -1
  157. package/dist/ToolbarIconButton/ToolbarIconButton.js +18 -7
  158. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  159. package/dist/TransformsEditor/TransformEditor.js +830 -334
  160. package/dist/TransformsEditor/TransformEditor.js.map +1 -1
  161. package/dist/TransformsEditor/TransformEditorContainer.js +252 -90
  162. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  163. package/dist/TransformsEditor/TransformsEditor.js +170 -59
  164. package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
  165. package/dist/ValueMappingEditor/ValueMappingEditor.js +800 -322
  166. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
  167. package/dist/ValueMappingEditor/ValueMappingsEditor.js +218 -91
  168. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
  169. package/dist/YAMLEditor/YAMLEditor.d.ts +12 -0
  170. package/dist/YAMLEditor/YAMLEditor.d.ts.map +1 -0
  171. package/dist/YAMLEditor/YAMLEditor.js +41 -0
  172. package/dist/YAMLEditor/YAMLEditor.js.map +1 -0
  173. package/dist/YAMLEditor/index.d.ts +2 -0
  174. package/dist/YAMLEditor/index.d.ts.map +1 -0
  175. package/dist/YAMLEditor/index.js +15 -0
  176. package/dist/YAMLEditor/index.js.map +1 -0
  177. package/dist/YAMLEditor/yaml-utils.d.ts +11 -0
  178. package/dist/YAMLEditor/yaml-utils.d.ts.map +1 -0
  179. package/dist/YAMLEditor/yaml-utils.js +52 -0
  180. package/dist/YAMLEditor/yaml-utils.js.map +1 -0
  181. package/dist/YAxisLabel.js +64 -20
  182. package/dist/YAxisLabel.js.map +1 -1
  183. package/dist/context/ChartsProvider.js +32 -16
  184. package/dist/context/ChartsProvider.js.map +1 -1
  185. package/dist/context/ItemActionsProvider.js +110 -61
  186. package/dist/context/ItemActionsProvider.js.map +1 -1
  187. package/dist/context/SelectionProvider.js +170 -66
  188. package/dist/context/SelectionProvider.js.map +1 -1
  189. package/dist/context/SnackbarProvider.js +101 -44
  190. package/dist/context/SnackbarProvider.js.map +1 -1
  191. package/dist/context/TimeZoneProvider.js +35 -14
  192. package/dist/context/TimeZoneProvider.js.map +1 -1
  193. package/dist/controls/TextField.js +86 -25
  194. package/dist/controls/TextField.js.map +1 -1
  195. package/dist/index.d.ts +1 -0
  196. package/dist/index.d.ts.map +1 -1
  197. package/dist/index.js +1 -0
  198. package/dist/index.js.map +1 -1
  199. package/dist/utils/browser-storage.js +64 -34
  200. package/dist/utils/browser-storage.js.map +1 -1
  201. package/package.json +12 -6
@@ -11,51 +11,102 @@
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, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { c as _c } from "react-compiler-runtime";
14
15
  import { styled, Tooltip as MuiTooltip, tooltipClasses, Typography } from "@mui/material";
15
- export const InfoTooltip = ({ id, title, description, placement, children, enterDelay, enterNextDelay })=>{
16
- // Wrap children in a span to cover the following use cases:
17
- // - Disabled buttons. MUI console.errors on putting these inside a tooltip.
18
- // - Non-element tooltip children (e.g. text). The tooltip needs something that
19
- // can have a ref as a child.
20
- // We wrap in a `span` and not a `div` to minimize the impact on page layout
21
- // and styles.
22
- const wrappedChildren = /*#__PURE__*/ _jsx("span", {
23
- children: children
24
- });
25
- return /*#__PURE__*/ _jsx(StyledTooltip, {
26
- arrow: true,
27
- id: id,
28
- placement: placement ?? 'top',
29
- title: /*#__PURE__*/ _jsx(TooltipContent, {
16
+ export const InfoTooltip = (t0)=>{
17
+ const $ = _c(12);
18
+ const { id, title, description, placement, children, enterDelay, enterNextDelay } = t0;
19
+ let t1;
20
+ if ($[0] !== children) {
21
+ t1 = /*#__PURE__*/ _jsx("span", {
22
+ children: children
23
+ });
24
+ $[0] = children;
25
+ $[1] = t1;
26
+ } else {
27
+ t1 = $[1];
28
+ }
29
+ const wrappedChildren = t1;
30
+ const t2 = placement ?? "top";
31
+ let t3;
32
+ if ($[2] !== description || $[3] !== title) {
33
+ t3 = /*#__PURE__*/ _jsx(TooltipContent, {
30
34
  title: title,
31
35
  description: description
32
- }),
33
- enterDelay: enterDelay ?? 500,
34
- enterNextDelay: enterNextDelay ?? 500,
35
- children: wrappedChildren
36
- });
36
+ });
37
+ $[2] = description;
38
+ $[3] = title;
39
+ $[4] = t3;
40
+ } else {
41
+ t3 = $[4];
42
+ }
43
+ const t4 = enterDelay ?? 500;
44
+ const t5 = enterNextDelay ?? 500;
45
+ let t6;
46
+ if ($[5] !== id || $[6] !== t2 || $[7] !== t3 || $[8] !== t4 || $[9] !== t5 || $[10] !== wrappedChildren) {
47
+ t6 = /*#__PURE__*/ _jsx(StyledTooltip, {
48
+ arrow: true,
49
+ id: id,
50
+ placement: t2,
51
+ title: t3,
52
+ enterDelay: t4,
53
+ enterNextDelay: t5,
54
+ children: wrappedChildren
55
+ });
56
+ $[5] = id;
57
+ $[6] = t2;
58
+ $[7] = t3;
59
+ $[8] = t4;
60
+ $[9] = t5;
61
+ $[10] = wrappedChildren;
62
+ $[11] = t6;
63
+ } else {
64
+ t6 = $[11];
65
+ }
66
+ return t6;
37
67
  };
38
- const TooltipContent = ({ title, description })=>{
39
- return /*#__PURE__*/ _jsxs(_Fragment, {
40
- children: [
41
- title && /*#__PURE__*/ _jsx(Typography, {
42
- variant: "body2",
43
- sx: (theme)=>({
44
- color: theme.palette.text.primary,
45
- fontWeight: theme.typography.fontWeightMedium
46
- }),
47
- children: title
48
- }),
49
- /*#__PURE__*/ _jsx(Typography, {
50
- variant: "caption",
51
- sx: (theme)=>({
52
- color: theme.palette.text.primary,
53
- whiteSpace: 'pre-line'
54
- }),
55
- children: description
56
- })
57
- ]
58
- });
68
+ const TooltipContent = (t0)=>{
69
+ const $ = _c(7);
70
+ const { title, description } = t0;
71
+ let t1;
72
+ if ($[0] !== title) {
73
+ t1 = title && /*#__PURE__*/ _jsx(Typography, {
74
+ variant: "body2",
75
+ sx: _temp,
76
+ children: title
77
+ });
78
+ $[0] = title;
79
+ $[1] = t1;
80
+ } else {
81
+ t1 = $[1];
82
+ }
83
+ let t2;
84
+ if ($[2] !== description) {
85
+ t2 = /*#__PURE__*/ _jsx(Typography, {
86
+ variant: "caption",
87
+ sx: _temp2,
88
+ children: description
89
+ });
90
+ $[2] = description;
91
+ $[3] = t2;
92
+ } else {
93
+ t2 = $[3];
94
+ }
95
+ let t3;
96
+ if ($[4] !== t1 || $[5] !== t2) {
97
+ t3 = /*#__PURE__*/ _jsxs(_Fragment, {
98
+ children: [
99
+ t1,
100
+ t2
101
+ ]
102
+ });
103
+ $[4] = t1;
104
+ $[5] = t2;
105
+ $[6] = t3;
106
+ } else {
107
+ t3 = $[6];
108
+ }
109
+ return t3;
59
110
  };
60
111
  const StyledTooltip = styled(({ className, ...props })=>/*#__PURE__*/ _jsx(MuiTooltip, {
61
112
  ...props,
@@ -66,7 +117,7 @@ const StyledTooltip = styled(({ className, ...props })=>/*#__PURE__*/ _jsx(MuiTo
66
117
  [`& .${tooltipClasses.tooltip}`]: {
67
118
  backgroundColor: theme.palette.background.tooltip,
68
119
  color: theme.palette.text.primary,
69
- maxWidth: '300px',
120
+ maxWidth: "300px",
70
121
  padding: theme.spacing(1),
71
122
  boxShadow: theme.shadows[1]
72
123
  },
@@ -74,5 +125,17 @@ const StyledTooltip = styled(({ className, ...props })=>/*#__PURE__*/ _jsx(MuiTo
74
125
  color: theme.palette.background.tooltip
75
126
  }
76
127
  }));
128
+ function _temp(theme) {
129
+ return {
130
+ color: theme.palette.text.primary,
131
+ fontWeight: theme.typography.fontWeightMedium
132
+ };
133
+ }
134
+ function _temp2(theme_0) {
135
+ return {
136
+ color: theme_0.palette.text.primary,
137
+ whiteSpace: "pre-line"
138
+ };
139
+ }
77
140
 
78
141
  //# sourceMappingURL=InfoTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/InfoTooltip/InfoTooltip.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 type { TooltipProps as MuiTooltipProps } from '@mui/material';\nimport { styled, Tooltip as MuiTooltip, tooltipClasses, Typography } from '@mui/material';\nimport type { ReactElement, ReactNode } from 'react';\n\nexport type TooltipPlacement = 'top' | 'left' | 'right' | 'bottom';\n\ninterface InfoTooltipProps {\n description: string;\n children: ReactNode;\n id?: string;\n title?: string;\n placement?: TooltipPlacement;\n enterDelay?: number; // default is 500ms\n enterNextDelay?: number; // default is 500ms\n}\n\nexport const InfoTooltip = ({\n id,\n title,\n description,\n placement,\n children,\n enterDelay,\n enterNextDelay,\n}: InfoTooltipProps): ReactElement => {\n // Wrap children in a span to cover the following use cases:\n // - Disabled buttons. MUI console.errors on putting these inside a tooltip.\n // - Non-element tooltip children (e.g. text). The tooltip needs something that\n // can have a ref as a child.\n // We wrap in a `span` and not a `div` to minimize the impact on page layout\n // and styles.\n const wrappedChildren = <span>{children}</span>;\n\n return (\n <StyledTooltip\n arrow\n id={id}\n placement={placement ?? 'top'}\n title={<TooltipContent title={title} description={description} />}\n enterDelay={enterDelay ?? 500}\n enterNextDelay={enterNextDelay ?? 500}\n >\n {wrappedChildren}\n </StyledTooltip>\n );\n};\n\nconst TooltipContent = ({ title, description }: Pick<InfoTooltipProps, 'title' | 'description'>): ReactElement => {\n return (\n <>\n {title && (\n <Typography\n variant=\"body2\"\n sx={(theme) => ({\n color: theme.palette.text.primary,\n fontWeight: theme.typography.fontWeightMedium,\n })}\n >\n {title}\n </Typography>\n )}\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.text.primary,\n whiteSpace: 'pre-line',\n })}\n >\n {description}\n </Typography>\n </>\n );\n};\n\nconst StyledTooltip = styled(({ className, ...props }: MuiTooltipProps) => (\n <MuiTooltip {...props} classes={{ popper: className }} />\n))(({ theme }) => ({\n [`& .${tooltipClasses.tooltip}`]: {\n backgroundColor: theme.palette.background.tooltip,\n color: theme.palette.text.primary,\n maxWidth: '300px',\n padding: theme.spacing(1),\n boxShadow: theme.shadows[1],\n },\n [`& .${tooltipClasses.arrow}`]: {\n color: theme.palette.background.tooltip,\n },\n}));\n"],"names":["styled","Tooltip","MuiTooltip","tooltipClasses","Typography","InfoTooltip","id","title","description","placement","children","enterDelay","enterNextDelay","wrappedChildren","span","StyledTooltip","arrow","TooltipContent","variant","sx","theme","color","palette","text","primary","fontWeight","typography","fontWeightMedium","whiteSpace","className","props","classes","popper","tooltip","backgroundColor","background","maxWidth","padding","spacing","boxShadow","shadows"],"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;;AAGjC,SAASA,MAAM,EAAEC,WAAWC,UAAU,EAAEC,cAAc,EAAEC,UAAU,QAAQ,gBAAgB;AAe1F,OAAO,MAAMC,cAAc,CAAC,EAC1BC,EAAE,EACFC,KAAK,EACLC,WAAW,EACXC,SAAS,EACTC,QAAQ,EACRC,UAAU,EACVC,cAAc,EACG;IACjB,4DAA4D;IAC5D,6EAA6E;IAC7E,gFAAgF;IAChF,+BAA+B;IAC/B,4EAA4E;IAC5E,cAAc;IACd,MAAMC,gCAAkB,KAACC;kBAAMJ;;IAE/B,qBACE,KAACK;QACCC,KAAK;QACLV,IAAIA;QACJG,WAAWA,aAAa;QACxBF,qBAAO,KAACU;YAAeV,OAAOA;YAAOC,aAAaA;;QAClDG,YAAYA,cAAc;QAC1BC,gBAAgBA,kBAAkB;kBAEjCC;;AAGP,EAAE;AAEF,MAAMI,iBAAiB,CAAC,EAAEV,KAAK,EAAEC,WAAW,EAAmD;IAC7F,qBACE;;YACGD,uBACC,KAACH;gBACCc,SAAQ;gBACRC,IAAI,CAACC,QAAW,CAAA;wBACdC,OAAOD,MAAME,OAAO,CAACC,IAAI,CAACC,OAAO;wBACjCC,YAAYL,MAAMM,UAAU,CAACC,gBAAgB;oBAC/C,CAAA;0BAECpB;;0BAGL,KAACH;gBACCc,SAAQ;gBACRC,IAAI,CAACC,QAAW,CAAA;wBACdC,OAAOD,MAAME,OAAO,CAACC,IAAI,CAACC,OAAO;wBACjCI,YAAY;oBACd,CAAA;0BAECpB;;;;AAIT;AAEA,MAAMO,gBAAgBf,OAAO,CAAC,EAAE6B,SAAS,EAAE,GAAGC,OAAwB,iBACpE,KAAC5B;QAAY,GAAG4B,KAAK;QAAEC,SAAS;YAAEC,QAAQH;QAAU;QACnD,CAAC,EAAET,KAAK,EAAE,GAAM,CAAA;QACjB,CAAC,CAAC,GAAG,EAAEjB,eAAe8B,OAAO,EAAE,CAAC,EAAE;YAChCC,iBAAiBd,MAAME,OAAO,CAACa,UAAU,CAACF,OAAO;YACjDZ,OAAOD,MAAME,OAAO,CAACC,IAAI,CAACC,OAAO;YACjCY,UAAU;YACVC,SAASjB,MAAMkB,OAAO,CAAC;YACvBC,WAAWnB,MAAMoB,OAAO,CAAC,EAAE;QAC7B;QACA,CAAC,CAAC,GAAG,EAAErC,eAAea,KAAK,EAAE,CAAC,EAAE;YAC9BK,OAAOD,MAAME,OAAO,CAACa,UAAU,CAACF,OAAO;QACzC;IACF,CAAA"}
1
+ {"version":3,"sources":["../../src/InfoTooltip/InfoTooltip.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 type { TooltipProps as MuiTooltipProps } from '@mui/material';\nimport { styled, Tooltip as MuiTooltip, tooltipClasses, Typography } from '@mui/material';\nimport type { ReactElement, ReactNode } from 'react';\n\nexport type TooltipPlacement = 'top' | 'left' | 'right' | 'bottom';\n\ninterface InfoTooltipProps {\n description: string;\n children: ReactNode;\n id?: string;\n title?: string;\n placement?: TooltipPlacement;\n enterDelay?: number; // default is 500ms\n enterNextDelay?: number; // default is 500ms\n}\n\nexport const InfoTooltip = ({\n id,\n title,\n description,\n placement,\n children,\n enterDelay,\n enterNextDelay,\n}: InfoTooltipProps): ReactElement => {\n // Wrap children in a span to cover the following use cases:\n // - Disabled buttons. MUI console.errors on putting these inside a tooltip.\n // - Non-element tooltip children (e.g. text). The tooltip needs something that\n // can have a ref as a child.\n // We wrap in a `span` and not a `div` to minimize the impact on page layout\n // and styles.\n const wrappedChildren = <span>{children}</span>;\n\n return (\n <StyledTooltip\n arrow\n id={id}\n placement={placement ?? 'top'}\n title={<TooltipContent title={title} description={description} />}\n enterDelay={enterDelay ?? 500}\n enterNextDelay={enterNextDelay ?? 500}\n >\n {wrappedChildren}\n </StyledTooltip>\n );\n};\n\nconst TooltipContent = ({ title, description }: Pick<InfoTooltipProps, 'title' | 'description'>): ReactElement => {\n return (\n <>\n {title && (\n <Typography\n variant=\"body2\"\n sx={(theme) => ({\n color: theme.palette.text.primary,\n fontWeight: theme.typography.fontWeightMedium,\n })}\n >\n {title}\n </Typography>\n )}\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.text.primary,\n whiteSpace: 'pre-line',\n })}\n >\n {description}\n </Typography>\n </>\n );\n};\n\nconst StyledTooltip = styled(({ className, ...props }: MuiTooltipProps) => (\n <MuiTooltip {...props} classes={{ popper: className }} />\n))(({ theme }) => ({\n [`& .${tooltipClasses.tooltip}`]: {\n backgroundColor: theme.palette.background.tooltip,\n color: theme.palette.text.primary,\n maxWidth: '300px',\n padding: theme.spacing(1),\n boxShadow: theme.shadows[1],\n },\n [`& .${tooltipClasses.arrow}`]: {\n color: theme.palette.background.tooltip,\n },\n}));\n"],"names":["styled","Tooltip","MuiTooltip","tooltipClasses","Typography","InfoTooltip","TooltipContent","StyledTooltip","className","props","classes","popper","theme","tooltip","backgroundColor","palette","background","color","text","primary","maxWidth","padding","spacing","boxShadow","shadows","arrow"],"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;;;AAGjC,SAASA,MAAM,EAAEC,WAAWC,UAAU,EAAEC,cAAc,EAAEC,UAAU,QAAQ,gBAAgB;AAe1F,OAAO,MAAMC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BzB;AAEF,MAAMC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BvB,MAAMC,gBAAgBP,OAAO,CAAC,EAAEQ,SAAS,EAAE,GAAQ,AAALC,OAAwB,iBACpE,KAACP;QAAY,GAAGO,KAAK;QAAEC,SAAS;YAAEC,QAAQH;QAAU;QACnD,CAAC,EAAEI,KAAK,EAAE,GAAM,CAAA;QAChB,CAAA,CAAC,GAAG,EAAET,eAAeU,OAAO,EAAE,CAAA,EAAG;YAChCC,iBAAiBF,MAAMG,OAAO,CAACC,UAAU,CAACH,OAAO;YACjDI,OAAOL,MAAMG,OAAO,CAACG,IAAI,CAACC,OAAO;YACjCC,UAAU;YACVC,SAAST,MAAMU,OAAO,CAAC;YACvBC,WAAWX,MAAMY,OAAO,AAAC,CAAA,EAAC,AAAC;QAC7B;QACC,CAAA,CAAC,GAAG,EAAErB,eAAesB,KAAK,EAAE,CAAA,EAAG;YAC9BR,OAAOL,MAAMG,OAAO,CAACC,UAAU,CAACH,OAAO;QACzC;IACF,CAAA"}
@@ -1,10 +1,6 @@
1
- import type { ReactCodeMirrorProps } from '@uiw/react-codemirror';
2
1
  import type { ReactElement } from 'react';
3
- type JSONEditorProps<T> = Omit<ReactCodeMirrorProps, 'onBlur' | 'theme' | 'extensions' | 'onChange' | 'value'> & {
4
- value: T;
5
- placeholder?: string;
6
- onChange?: (next: string) => void;
7
- };
2
+ import type { CodeEditorProps } from './CodeEditor/CodeEditor';
3
+ type JSONEditorProps<T> = CodeEditorProps<T>;
8
4
  export declare function JSONEditor<T>(props: JSONEditorProps<T>): ReactElement;
9
5
  export {};
10
6
  //# sourceMappingURL=JSONEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"JSONEditor.d.ts","sourceRoot":"","sources":["../src/JSONEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,KAAK,eAAe,CAAC,CAAC,IAAI,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IAC/G,KAAK,EAAE,CAAC,CAAC;IACT,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,YAAY,CAiCrE"}
1
+ {"version":3,"file":"JSONEditor.d.ts","sourceRoot":"","sources":["../src/JSONEditor.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAS/D,KAAK,eAAe,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;AAE7C,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,YAAY,CAErE"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { c as _c } from "react-compiler-runtime";
2
3
  // Copyright The Perses Authors
3
4
  // Licensed under the Apache License, Version 2.0 (the "License");
4
5
  // you may not use this file except in compliance with the License.
@@ -13,44 +14,30 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
14
  // limitations under the License.
14
15
  import { json, jsonParseLinter } from "@codemirror/lang-json";
15
16
  import { linter, lintGutter } from "@codemirror/lint";
16
- import { useTheme } from "@mui/material";
17
- import CodeMirror from "@uiw/react-codemirror";
18
- import { useState } from "react";
17
+ import { CodeEditor } from "./CodeEditor/CodeEditor.js";
18
+ const JSON_EXTENSIONS = [
19
+ json(),
20
+ linter(jsonParseLinter()),
21
+ lintGutter()
22
+ ];
23
+ function toJSONText(value) {
24
+ return JSON.stringify(value, null, 2);
25
+ }
19
26
  export function JSONEditor(props) {
20
- const theme = useTheme();
21
- const isDarkMode = theme.palette.mode === 'dark';
22
- const [value, setValue] = useState(()=>JSON.stringify(props.value, null, 2));
23
- const [lastProcessedValue, setLastProcessedValue] = useState(value);
24
- return /*#__PURE__*/ _jsx(CodeMirror, {
25
- ...props,
26
- style: {
27
- border: `1px solid ${theme.palette.divider}`
28
- },
29
- theme: isDarkMode ? 'dark' : 'light',
30
- extensions: [
31
- json(),
32
- linter(jsonParseLinter()),
33
- lintGutter()
34
- ],
35
- value: value,
36
- onChange: (newValue)=>{
37
- setValue(newValue);
38
- // Trigger the provided onChange callback in real-time
39
- if (props.onChange) {
40
- props.onChange(newValue);
41
- }
42
- },
43
- onBlur: ()=>{
44
- // Don't trigger the provided onChange if the last processed value is equal to the current value.
45
- // This prevents e.g CTRL+F to trigger value refresh downstream, which would cause the embedded
46
- // find & replace interface to close immediately.
47
- if (lastProcessedValue !== value && props.onChange !== undefined) {
48
- props.onChange(value);
49
- setLastProcessedValue(value);
50
- }
51
- },
52
- placeholder: props.placeholder
53
- });
27
+ const $ = _c(2);
28
+ let t0;
29
+ if ($[0] !== props) {
30
+ t0 = /*#__PURE__*/ _jsx(CodeEditor, {
31
+ ...props,
32
+ extensions: JSON_EXTENSIONS,
33
+ serialize: toJSONText
34
+ });
35
+ $[0] = props;
36
+ $[1] = t0;
37
+ } else {
38
+ t0 = $[1];
39
+ }
40
+ return t0;
54
41
  }
55
42
 
56
43
  //# sourceMappingURL=JSONEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/JSONEditor.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 { json, jsonParseLinter } from '@codemirror/lang-json';\nimport { linter, lintGutter } from '@codemirror/lint';\nimport { useTheme } from '@mui/material';\nimport type { ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport CodeMirror from '@uiw/react-codemirror';\nimport type { ReactElement } from 'react';\nimport { useState } from 'react';\n\ntype JSONEditorProps<T> = Omit<ReactCodeMirrorProps, 'onBlur' | 'theme' | 'extensions' | 'onChange' | 'value'> & {\n value: T;\n placeholder?: string;\n onChange?: (next: string) => void;\n};\n\nexport function JSONEditor<T>(props: JSONEditorProps<T>): ReactElement {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const [value, setValue] = useState(() => JSON.stringify(props.value, null, 2));\n const [lastProcessedValue, setLastProcessedValue] = useState<string>(value);\n\n return (\n <CodeMirror\n {...props}\n style={{ border: `1px solid ${theme.palette.divider}` }}\n theme={isDarkMode ? 'dark' : 'light'}\n extensions={[json(), linter(jsonParseLinter()), lintGutter()]}\n value={value}\n onChange={(newValue) => {\n setValue(newValue);\n // Trigger the provided onChange callback in real-time\n if (props.onChange) {\n props.onChange(newValue);\n }\n }}\n onBlur={() => {\n // Don't trigger the provided onChange if the last processed value is equal to the current value.\n // This prevents e.g CTRL+F to trigger value refresh downstream, which would cause the embedded\n // find & replace interface to close immediately.\n if (lastProcessedValue !== value && props.onChange !== undefined) {\n props.onChange(value);\n setLastProcessedValue(value);\n }\n }}\n placeholder={props.placeholder}\n />\n );\n}\n"],"names":["json","jsonParseLinter","linter","lintGutter","useTheme","CodeMirror","useState","JSONEditor","props","theme","isDarkMode","palette","mode","value","setValue","JSON","stringify","lastProcessedValue","setLastProcessedValue","style","border","divider","extensions","onChange","newValue","onBlur","undefined","placeholder"],"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,IAAI,EAAEC,eAAe,QAAQ,wBAAwB;AAC9D,SAASC,MAAM,EAAEC,UAAU,QAAQ,mBAAmB;AACtD,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,OAAOC,gBAAgB,wBAAwB;AAE/C,SAASC,QAAQ,QAAQ,QAAQ;AAQjC,OAAO,SAASC,WAAcC,KAAyB;IACrD,MAAMC,QAAQL;IACd,MAAMM,aAAaD,MAAME,OAAO,CAACC,IAAI,KAAK;IAE1C,MAAM,CAACC,OAAOC,SAAS,GAAGR,SAAS,IAAMS,KAAKC,SAAS,CAACR,MAAMK,KAAK,EAAE,MAAM;IAC3E,MAAM,CAACI,oBAAoBC,sBAAsB,GAAGZ,SAAiBO;IAErE,qBACE,KAACR;QACE,GAAGG,KAAK;QACTW,OAAO;YAAEC,QAAQ,CAAC,UAAU,EAAEX,MAAME,OAAO,CAACU,OAAO,EAAE;QAAC;QACtDZ,OAAOC,aAAa,SAAS;QAC7BY,YAAY;YAACtB;YAAQE,OAAOD;YAAoBE;SAAa;QAC7DU,OAAOA;QACPU,UAAU,CAACC;YACTV,SAASU;YACT,sDAAsD;YACtD,IAAIhB,MAAMe,QAAQ,EAAE;gBAClBf,MAAMe,QAAQ,CAACC;YACjB;QACF;QACAC,QAAQ;YACN,iGAAiG;YACjG,+FAA+F;YAC/F,iDAAiD;YACjD,IAAIR,uBAAuBJ,SAASL,MAAMe,QAAQ,KAAKG,WAAW;gBAChElB,MAAMe,QAAQ,CAACV;gBACfK,sBAAsBL;YACxB;QACF;QACAc,aAAanB,MAAMmB,WAAW;;AAGpC"}
1
+ {"version":3,"sources":["../src/JSONEditor.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 { json, jsonParseLinter } from '@codemirror/lang-json';\nimport { linter, lintGutter } from '@codemirror/lint';\nimport type { ReactElement } from 'react';\n\nimport type { CodeEditorProps } from './CodeEditor/CodeEditor';\nimport { CodeEditor } from './CodeEditor/CodeEditor';\n\nconst JSON_EXTENSIONS = [json(), linter(jsonParseLinter()), lintGutter()];\n\nfunction toJSONText(value: unknown): string {\n return JSON.stringify(value, null, 2);\n}\n\ntype JSONEditorProps<T> = CodeEditorProps<T>;\n\nexport function JSONEditor<T>(props: JSONEditorProps<T>): ReactElement {\n return <CodeEditor {...props} extensions={JSON_EXTENSIONS} serialize={toJSONText} />;\n}\n"],"names":["json","jsonParseLinter","linter","lintGutter","CodeEditor","JSON_EXTENSIONS","toJSONText","value","JSON","stringify"],"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,IAAI,EAAEC,eAAe,QAAQ,wBAAwB;AAC9D,SAASC,MAAM,EAAEC,UAAU,QAAQ,mBAAmB;AAItD,SAASC,UAAU,QAAQ,6BAA0B;AAErD,MAAMC,kBAAkB;IAACL;IAAQE,OAAOD;IAAoBE;CAAa;AAEzE,SAASG,WAAWC,KAAK;IACvB,OAAOC,KAAKC,SAAS,CAACF,OAAO,MAAM;AACrC;AAIA,OAAO"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { c as _c } from "react-compiler-runtime";
2
3
  // Copyright The Perses Authors
3
4
  // Licensed under the Apache License, Version 2.0 (the "License");
4
5
  // you may not use this file except in compliance with the License.
@@ -19,35 +20,84 @@ import { ListLegendItem } from "./ListLegendItem.js";
19
20
  * which corresponds to when legend.position is `bottom` with a relatively small
20
21
  * number of items. The `ListLegend` is used for cases with large numbers of items
21
22
  * because it is virtualized.
22
- */ export function CompactLegend({ height, items, selectedItems, onLegendItemClick, onItemMouseOver, onItemMouseOut }) {
23
- return /*#__PURE__*/ _jsx(Box, {
24
- component: "ul",
25
- sx: {
26
- width: '100%',
23
+ */ export function CompactLegend(t0) {
24
+ const $ = _c(17);
25
+ const { height, items, selectedItems, onLegendItemClick, onItemMouseOver, onItemMouseOut } = t0;
26
+ let t1;
27
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
28
+ t1 = [
29
+ 0,
30
+ 1,
31
+ 0,
32
+ 0
33
+ ];
34
+ $[0] = t1;
35
+ } else {
36
+ t1 = $[0];
37
+ }
38
+ let t2;
39
+ if ($[1] !== height) {
40
+ t2 = {
41
+ width: "100%",
27
42
  height,
28
- padding: [
29
- 0,
30
- 1,
31
- 0,
32
- 0
33
- ],
34
- overflowY: 'scroll',
43
+ padding: t1,
44
+ overflowY: "scroll",
35
45
  margin: 0
36
- },
37
- children: items.map((item, index)=>/*#__PURE__*/ _jsx(ListLegendItem, {
38
- item: item,
39
- index: index,
40
- isVisuallySelected: isLegendItemVisuallySelected(item, selectedItems),
41
- onMouseOver: onItemMouseOver,
42
- onMouseOut: onItemMouseOut,
43
- onClick: onLegendItemClick,
44
- sx: {
45
- width: 'auto',
46
- float: 'left',
47
- paddingRight: 1.5
48
- }
49
- }, item.id))
50
- });
46
+ };
47
+ $[1] = height;
48
+ $[2] = t2;
49
+ } else {
50
+ t2 = $[2];
51
+ }
52
+ let t3;
53
+ if ($[3] !== items || $[4] !== onItemMouseOut || $[5] !== onItemMouseOver || $[6] !== onLegendItemClick || $[7] !== selectedItems) {
54
+ let t4;
55
+ if ($[9] !== onItemMouseOut || $[10] !== onItemMouseOver || $[11] !== onLegendItemClick || $[12] !== selectedItems) {
56
+ t4 = (item, index)=>/*#__PURE__*/ _jsx(ListLegendItem, {
57
+ item: item,
58
+ index: index,
59
+ isVisuallySelected: isLegendItemVisuallySelected(item, selectedItems),
60
+ onMouseOver: onItemMouseOver,
61
+ onMouseOut: onItemMouseOut,
62
+ onClick: onLegendItemClick,
63
+ sx: {
64
+ width: "auto",
65
+ float: "left",
66
+ paddingRight: 1.5
67
+ }
68
+ }, item.id);
69
+ $[9] = onItemMouseOut;
70
+ $[10] = onItemMouseOver;
71
+ $[11] = onLegendItemClick;
72
+ $[12] = selectedItems;
73
+ $[13] = t4;
74
+ } else {
75
+ t4 = $[13];
76
+ }
77
+ t3 = items.map(t4);
78
+ $[3] = items;
79
+ $[4] = onItemMouseOut;
80
+ $[5] = onItemMouseOver;
81
+ $[6] = onLegendItemClick;
82
+ $[7] = selectedItems;
83
+ $[8] = t3;
84
+ } else {
85
+ t3 = $[8];
86
+ }
87
+ let t4;
88
+ if ($[14] !== t2 || $[15] !== t3) {
89
+ t4 = /*#__PURE__*/ _jsx(Box, {
90
+ component: "ul",
91
+ sx: t2,
92
+ children: t3
93
+ });
94
+ $[14] = t2;
95
+ $[15] = t3;
96
+ $[16] = t4;
97
+ } else {
98
+ t4 = $[16];
99
+ }
100
+ return t4;
51
101
  }
52
102
 
53
103
  //# sourceMappingURL=CompactLegend.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Legend/CompactLegend.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 { Box } from '@mui/material';\nimport type { ReactElement } from 'react';\n\nimport type { LegendItem, SelectedLegendItemState } from './legend-model';\nimport { isLegendItemVisuallySelected } from './legend-model';\nimport type { ListLegendItemProps } from './ListLegendItem';\nimport { ListLegendItem } from './ListLegendItem';\n\nexport interface CompactLegendProps {\n height: number;\n items: LegendItem[];\n selectedItems: SelectedLegendItemState;\n onLegendItemClick: ListLegendItemProps['onClick'];\n onItemMouseOver: ListLegendItemProps['onMouseOver'];\n onItemMouseOut: ListLegendItemProps['onMouseOut'];\n}\n\n/**\n * CompactLegend is default and used when legend items need to show side by side\n * which corresponds to when legend.position is `bottom` with a relatively small\n * number of items. The `ListLegend` is used for cases with large numbers of items\n * because it is virtualized.\n */\nexport function CompactLegend({\n height,\n items,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n}: CompactLegendProps): ReactElement {\n return (\n <Box component=\"ul\" sx={{ width: '100%', height, padding: [0, 1, 0, 0], overflowY: 'scroll', margin: 0 }}>\n {items.map((item, index) => (\n <ListLegendItem\n key={item.id}\n item={item}\n index={index}\n isVisuallySelected={isLegendItemVisuallySelected(item, selectedItems)}\n onMouseOver={onItemMouseOver}\n onMouseOut={onItemMouseOut}\n onClick={onLegendItemClick}\n sx={{\n width: 'auto',\n float: 'left',\n paddingRight: 1.5,\n }}\n />\n ))}\n </Box>\n );\n}\n"],"names":["Box","isLegendItemVisuallySelected","ListLegendItem","CompactLegend","height","items","selectedItems","onLegendItemClick","onItemMouseOver","onItemMouseOut","component","sx","width","padding","overflowY","margin","map","item","index","isVisuallySelected","onMouseOver","onMouseOut","onClick","float","paddingRight","id"],"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,GAAG,QAAQ,gBAAgB;AAIpC,SAASC,4BAA4B,QAAQ,oBAAiB;AAE9D,SAASC,cAAc,QAAQ,sBAAmB;AAWlD;;;;;CAKC,GACD,OAAO,SAASC,cAAc,EAC5BC,MAAM,EACNC,KAAK,EACLC,aAAa,EACbC,iBAAiB,EACjBC,eAAe,EACfC,cAAc,EACK;IACnB,qBACE,KAACT;QAAIU,WAAU;QAAKC,IAAI;YAAEC,OAAO;YAAQR;YAAQS,SAAS;gBAAC;gBAAG;gBAAG;gBAAG;aAAE;YAAEC,WAAW;YAAUC,QAAQ;QAAE;kBACpGV,MAAMW,GAAG,CAAC,CAACC,MAAMC,sBAChB,KAAChB;gBAECe,MAAMA;gBACNC,OAAOA;gBACPC,oBAAoBlB,6BAA6BgB,MAAMX;gBACvDc,aAAaZ;gBACba,YAAYZ;gBACZa,SAASf;gBACTI,IAAI;oBACFC,OAAO;oBACPW,OAAO;oBACPC,cAAc;gBAChB;eAXKP,KAAKQ,EAAE;;AAgBtB"}
1
+ {"version":3,"sources":["../../src/Legend/CompactLegend.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 { Box } from '@mui/material';\nimport type { ReactElement } from 'react';\n\nimport type { LegendItem, SelectedLegendItemState } from './legend-model';\nimport { isLegendItemVisuallySelected } from './legend-model';\nimport type { ListLegendItemProps } from './ListLegendItem';\nimport { ListLegendItem } from './ListLegendItem';\n\nexport interface CompactLegendProps {\n height: number;\n items: LegendItem[];\n selectedItems: SelectedLegendItemState;\n onLegendItemClick: ListLegendItemProps['onClick'];\n onItemMouseOver: ListLegendItemProps['onMouseOver'];\n onItemMouseOut: ListLegendItemProps['onMouseOut'];\n}\n\n/**\n * CompactLegend is default and used when legend items need to show side by side\n * which corresponds to when legend.position is `bottom` with a relatively small\n * number of items. The `ListLegend` is used for cases with large numbers of items\n * because it is virtualized.\n */\nexport function CompactLegend({\n height,\n items,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n}: CompactLegendProps): ReactElement {\n return (\n <Box component=\"ul\" sx={{ width: '100%', height, padding: [0, 1, 0, 0], overflowY: 'scroll', margin: 0 }}>\n {items.map((item, index) => (\n <ListLegendItem\n key={item.id}\n item={item}\n index={index}\n isVisuallySelected={isLegendItemVisuallySelected(item, selectedItems)}\n onMouseOver={onItemMouseOver}\n onMouseOut={onItemMouseOut}\n onClick={onLegendItemClick}\n sx={{\n width: 'auto',\n float: 'left',\n paddingRight: 1.5,\n }}\n />\n ))}\n </Box>\n );\n}\n"],"names":["Box","isLegendItemVisuallySelected","ListLegendItem"],"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,GAAG,QAAQ,gBAAgB;AAIpC,SAASC,4BAA4B,QAAQ,oBAAiB;AAE9D,SAASC,cAAc,QAAQ,sBAAmB;AAWlD;;;;;CAKC,GACD,OAAO"}