@perses-dev/components 0.55.0-rc.1 → 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 (204) 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/dist/utils/time-series-data.d.ts.map +1 -1
  202. package/dist/utils/time-series-data.js +5 -2
  203. package/dist/utils/time-series-data.js.map +1 -1
  204. package/package.json +13 -7
@@ -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.
@@ -23,101 +24,202 @@ import { TableLegend } from "./TableLegend.js";
23
24
  // Set this number based on testing, but it may need to be tuned a bit on the
24
25
  // future as people test this out on different machines.
25
26
  const NEED_VIRTUALIZATION_LIMIT = 500;
26
- export function Legend({ width, height, options, data, selectedItems, onSelectedItemsChange, onItemMouseOver, onItemMouseOut, tableProps }) {
27
- const onLegendItemClick = (e, seriesId)=>{
28
- const isModifiedClick = e.metaKey || e.shiftKey;
29
- const newSelected = produce(selectedItems, (draft)=>{
30
- if (draft === 'ALL') {
27
+ export function Legend(t0) {
28
+ const $ = _c(36);
29
+ const { width, height, options, data, selectedItems, onSelectedItemsChange, onItemMouseOver, onItemMouseOut, tableProps } = t0;
30
+ let t1;
31
+ if ($[0] !== onSelectedItemsChange || $[1] !== selectedItems) {
32
+ t1 = (e, seriesId)=>{
33
+ const isModifiedClick = e.metaKey || e.shiftKey;
34
+ const newSelected = produce(selectedItems, (draft)=>{
35
+ if (draft === "ALL") {
36
+ return {
37
+ [seriesId]: true
38
+ };
39
+ }
40
+ const isSelected = !!draft[seriesId];
41
+ if (isModifiedClick) {
42
+ if (isSelected) {
43
+ delete draft[seriesId];
44
+ } else {
45
+ draft[seriesId] = true;
46
+ }
47
+ return draft;
48
+ }
49
+ if (isSelected) {
50
+ return "ALL";
51
+ }
31
52
  return {
32
53
  [seriesId]: true
33
54
  };
34
- }
35
- const isSelected = !!draft[seriesId];
36
- // Clicks with modifier key can select multiple items.
37
- if (isModifiedClick) {
38
- if (isSelected) {
39
- // Modified click on already selected item. Remove that item.
40
- delete draft[seriesId];
41
- } else {
42
- // Modified click on not-selected item. Add it.
43
- draft[seriesId] = true;
44
- }
45
- return draft;
46
- }
47
- if (isSelected) {
48
- // Clicked item was already selected. Unselect it and return to
49
- // ALL state.
50
- return 'ALL';
51
- }
52
- // Select clicked item.
53
- return {
54
- [seriesId]: true
55
- };
56
- });
57
- onSelectedItemsChange(newSelected);
58
- };
55
+ });
56
+ onSelectedItemsChange(newSelected);
57
+ };
58
+ $[0] = onSelectedItemsChange;
59
+ $[1] = selectedItems;
60
+ $[2] = t1;
61
+ } else {
62
+ t1 = $[2];
63
+ }
64
+ const onLegendItemClick = t1;
59
65
  const mode = getLegendMode(options.mode);
60
- // The bottom legend is displayed as a list when the number of items is too
61
- // large and requires virtualization. Otherwise, it is rendered more compactly.
62
- // We do not need this check for the right-side legend because it is always
63
- // a virtualized list.
64
66
  const needsVirtualization = data.length >= NEED_VIRTUALIZATION_LIMIT;
65
- const commonLegendProps = {
66
- height,
67
- items: data,
68
- selectedItems,
69
- onLegendItemClick,
70
- onItemMouseOver,
71
- onItemMouseOut
72
- };
73
- let legendContent;
74
- if (mode === 'table') {
75
- legendContent = /*#__PURE__*/ _jsx(TableLegend, {
76
- ...commonLegendProps,
77
- onSelectedItemsChange: onSelectedItemsChange,
78
- width: width,
79
- ...tableProps
80
- });
81
- } else if (options.position === 'right' || needsVirtualization) {
82
- legendContent = /*#__PURE__*/ _jsx(ListLegend, {
83
- ...commonLegendProps,
84
- width: width,
85
- onLegendItemClick: onLegendItemClick
86
- });
67
+ let t2;
68
+ if ($[3] !== data || $[4] !== height || $[5] !== onItemMouseOut || $[6] !== onItemMouseOver || $[7] !== onLegendItemClick || $[8] !== selectedItems) {
69
+ t2 = {
70
+ height,
71
+ items: data,
72
+ selectedItems,
73
+ onLegendItemClick,
74
+ onItemMouseOver,
75
+ onItemMouseOut
76
+ };
77
+ $[3] = data;
78
+ $[4] = height;
79
+ $[5] = onItemMouseOut;
80
+ $[6] = onItemMouseOver;
81
+ $[7] = onLegendItemClick;
82
+ $[8] = selectedItems;
83
+ $[9] = t2;
87
84
  } else {
88
- legendContent = /*#__PURE__*/ _jsx(CompactLegend, {
89
- ...commonLegendProps,
90
- onLegendItemClick: onLegendItemClick
91
- });
85
+ t2 = $[9];
92
86
  }
93
- if (options.position === 'right') {
94
- return /*#__PURE__*/ _jsx(Box, {
95
- style: {
87
+ const commonLegendProps = t2;
88
+ let legendContent;
89
+ if (mode === "table") {
90
+ let t3;
91
+ if ($[10] !== commonLegendProps || $[11] !== onSelectedItemsChange || $[12] !== tableProps || $[13] !== width) {
92
+ t3 = /*#__PURE__*/ _jsx(TableLegend, {
93
+ ...commonLegendProps,
94
+ onSelectedItemsChange: onSelectedItemsChange,
96
95
  width: width,
97
- height: height
98
- },
99
- sx: {
100
- position: 'absolute',
96
+ ...tableProps
97
+ });
98
+ $[10] = commonLegendProps;
99
+ $[11] = onSelectedItemsChange;
100
+ $[12] = tableProps;
101
+ $[13] = width;
102
+ $[14] = t3;
103
+ } else {
104
+ t3 = $[14];
105
+ }
106
+ legendContent = t3;
107
+ } else {
108
+ if (options.position === "right" || needsVirtualization) {
109
+ let t3;
110
+ if ($[15] !== commonLegendProps || $[16] !== onLegendItemClick || $[17] !== width) {
111
+ t3 = /*#__PURE__*/ _jsx(ListLegend, {
112
+ ...commonLegendProps,
113
+ width: width,
114
+ onLegendItemClick: onLegendItemClick
115
+ });
116
+ $[15] = commonLegendProps;
117
+ $[16] = onLegendItemClick;
118
+ $[17] = width;
119
+ $[18] = t3;
120
+ } else {
121
+ t3 = $[18];
122
+ }
123
+ legendContent = t3;
124
+ } else {
125
+ let t3;
126
+ if ($[19] !== commonLegendProps || $[20] !== onLegendItemClick) {
127
+ t3 = /*#__PURE__*/ _jsx(CompactLegend, {
128
+ ...commonLegendProps,
129
+ onLegendItemClick: onLegendItemClick
130
+ });
131
+ $[19] = commonLegendProps;
132
+ $[20] = onLegendItemClick;
133
+ $[21] = t3;
134
+ } else {
135
+ t3 = $[21];
136
+ }
137
+ legendContent = t3;
138
+ }
139
+ }
140
+ if (options.position === "right") {
141
+ let t3;
142
+ if ($[22] !== height || $[23] !== width) {
143
+ t3 = {
144
+ width,
145
+ height
146
+ };
147
+ $[22] = height;
148
+ $[23] = width;
149
+ $[24] = t3;
150
+ } else {
151
+ t3 = $[24];
152
+ }
153
+ let t4;
154
+ if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
155
+ t4 = {
156
+ position: "absolute",
101
157
  top: 0,
102
158
  right: 0,
103
- backgroundColor: (theme)=>`${theme.palette.background.default}`
104
- },
159
+ backgroundColor: _temp
160
+ };
161
+ $[25] = t4;
162
+ } else {
163
+ t4 = $[25];
164
+ }
165
+ let t5;
166
+ if ($[26] !== legendContent || $[27] !== t3) {
167
+ t5 = /*#__PURE__*/ _jsx(Box, {
168
+ style: t3,
169
+ sx: t4,
170
+ children: legendContent
171
+ });
172
+ $[26] = legendContent;
173
+ $[27] = t3;
174
+ $[28] = t5;
175
+ } else {
176
+ t5 = $[28];
177
+ }
178
+ return t5;
179
+ }
180
+ let t3;
181
+ if ($[29] !== height || $[30] !== width) {
182
+ t3 = {
183
+ width,
184
+ height
185
+ };
186
+ $[29] = height;
187
+ $[30] = width;
188
+ $[31] = t3;
189
+ } else {
190
+ t3 = $[31];
191
+ }
192
+ let t4;
193
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
194
+ t4 = {
195
+ position: "absolute",
196
+ bottom: 0,
197
+ backgroundColor: _temp2
198
+ };
199
+ $[32] = t4;
200
+ } else {
201
+ t4 = $[32];
202
+ }
203
+ let t5;
204
+ if ($[33] !== legendContent || $[34] !== t3) {
205
+ t5 = /*#__PURE__*/ _jsx(Box, {
206
+ style: t3,
207
+ sx: t4,
105
208
  children: legendContent
106
209
  });
210
+ $[33] = legendContent;
211
+ $[34] = t3;
212
+ $[35] = t5;
213
+ } else {
214
+ t5 = $[35];
107
215
  }
108
- // Position bottom
109
- return /*#__PURE__*/ _jsx(Box, {
110
- style: {
111
- width: width,
112
- height: height
113
- },
114
- sx: {
115
- position: 'absolute',
116
- bottom: 0,
117
- backgroundColor: (theme)=>`${theme.palette.background.default}`
118
- },
119
- children: legendContent
120
- });
216
+ return t5;
217
+ }
218
+ function _temp2(theme_0) {
219
+ return `${theme_0.palette.background.default}`;
220
+ }
221
+ function _temp(theme) {
222
+ return `${theme.palette.background.default}`;
121
223
  }
122
224
 
123
225
  //# sourceMappingURL=Legend.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Legend/Legend.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 { produce } from 'immer';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { getLegendMode } from '../model';\nimport { CompactLegend } from './CompactLegend';\nimport type { LegendItem, LegendComponentOptions, SelectedLegendItemState } from './legend-model';\nimport { ListLegend } from './ListLegend';\nimport type { ListLegendItemProps } from './ListLegendItem';\nimport type { TableLegendProps } from './TableLegend';\nimport { TableLegend } from './TableLegend';\n\nexport interface LegendProps {\n width: number;\n height: number;\n data: LegendItem[];\n options: LegendComponentOptions;\n\n /**\n * State of selected items in the legend.\n *\n * Selected legend item state is a controlled value that should be managed using a\n * combination of this prop and `onSelectedChange`.\n */\n selectedItems: SelectedLegendItemState;\n\n /**\n * Callback fired when the selected items in the legend changes.\n */\n onSelectedItemsChange: (newSelected: SelectedLegendItemState) => void;\n\n /**\n * Callback fired when the mouse is moved over a legend item.\n */\n onItemMouseOver?: ListLegendItemProps['onMouseOver'];\n\n /**\n * Callback fired when the mouse is moved out of a legend item.\n */\n onItemMouseOut?: ListLegendItemProps['onMouseOut'];\n\n /**\n * Props specific to legend with `mode` set to `table`.\n */\n tableProps?: Pick<TableLegendProps, 'columns' | 'onSortingChange' | 'sorting'>;\n}\n\n// When the number of items to display is above this number, it is likely to\n// cause performance issues in the browser. The legend will be displayed in a\n// format (list) that allows for virtualization to minimize the performance impact.\n// Set this number based on testing, but it may need to be tuned a bit on the\n// future as people test this out on different machines.\nconst NEED_VIRTUALIZATION_LIMIT = 500;\n\nexport function Legend({\n width,\n height,\n options,\n data,\n selectedItems,\n onSelectedItemsChange,\n onItemMouseOver,\n onItemMouseOut,\n tableProps,\n}: LegendProps): ReactElement {\n const onLegendItemClick = (e: React.MouseEvent<HTMLElement, MouseEvent>, seriesId: string): void => {\n const isModifiedClick = e.metaKey || e.shiftKey;\n\n const newSelected = produce(selectedItems, (draft) => {\n if (draft === 'ALL') {\n return {\n [seriesId]: true,\n };\n }\n\n const isSelected = !!draft[seriesId];\n\n // Clicks with modifier key can select multiple items.\n if (isModifiedClick) {\n if (isSelected) {\n // Modified click on already selected item. Remove that item.\n delete draft[seriesId];\n } else {\n // Modified click on not-selected item. Add it.\n draft[seriesId] = true;\n }\n return draft;\n }\n\n if (isSelected) {\n // Clicked item was already selected. Unselect it and return to\n // ALL state.\n return 'ALL' as const;\n }\n\n // Select clicked item.\n return { [seriesId]: true };\n });\n onSelectedItemsChange(newSelected);\n };\n\n const mode = getLegendMode(options.mode);\n\n // The bottom legend is displayed as a list when the number of items is too\n // large and requires virtualization. Otherwise, it is rendered more compactly.\n // We do not need this check for the right-side legend because it is always\n // a virtualized list.\n const needsVirtualization = data.length >= NEED_VIRTUALIZATION_LIMIT;\n\n const commonLegendProps = {\n height,\n items: data,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n };\n\n let legendContent: ReactNode;\n if (mode === 'table') {\n legendContent = (\n <TableLegend {...commonLegendProps} onSelectedItemsChange={onSelectedItemsChange} width={width} {...tableProps} />\n );\n } else if (options.position === 'right' || needsVirtualization) {\n legendContent = <ListLegend {...commonLegendProps} width={width} onLegendItemClick={onLegendItemClick} />;\n } else {\n legendContent = <CompactLegend {...commonLegendProps} onLegendItemClick={onLegendItemClick} />;\n }\n\n if (options.position === 'right') {\n return (\n <Box\n style={{\n width: width,\n height: height,\n }}\n sx={{\n position: 'absolute',\n top: 0,\n right: 0,\n backgroundColor: (theme) => `${theme.palette.background.default}`,\n }}\n >\n {legendContent}\n </Box>\n );\n }\n\n // Position bottom\n return (\n <Box\n style={{\n width: width,\n height: height,\n }}\n sx={{\n position: 'absolute',\n bottom: 0,\n backgroundColor: (theme) => `${theme.palette.background.default}`,\n }}\n >\n {legendContent}\n </Box>\n );\n}\n"],"names":["Box","produce","getLegendMode","CompactLegend","ListLegend","TableLegend","NEED_VIRTUALIZATION_LIMIT","Legend","width","height","options","data","selectedItems","onSelectedItemsChange","onItemMouseOver","onItemMouseOut","tableProps","onLegendItemClick","e","seriesId","isModifiedClick","metaKey","shiftKey","newSelected","draft","isSelected","mode","needsVirtualization","length","commonLegendProps","items","legendContent","position","style","sx","top","right","backgroundColor","theme","palette","background","default","bottom"],"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;AACpC,SAASC,OAAO,QAAQ,QAAQ;AAGhC,SAASC,aAAa,QAAQ,oBAAW;AACzC,SAASC,aAAa,QAAQ,qBAAkB;AAEhD,SAASC,UAAU,QAAQ,kBAAe;AAG1C,SAASC,WAAW,QAAQ,mBAAgB;AAqC5C,4EAA4E;AAC5E,6EAA6E;AAC7E,mFAAmF;AACnF,6EAA6E;AAC7E,wDAAwD;AACxD,MAAMC,4BAA4B;AAElC,OAAO,SAASC,OAAO,EACrBC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,eAAe,EACfC,cAAc,EACdC,UAAU,EACE;IACZ,MAAMC,oBAAoB,CAACC,GAA8CC;QACvE,MAAMC,kBAAkBF,EAAEG,OAAO,IAAIH,EAAEI,QAAQ;QAE/C,MAAMC,cAActB,QAAQW,eAAe,CAACY;YAC1C,IAAIA,UAAU,OAAO;gBACnB,OAAO;oBACL,CAACL,SAAS,EAAE;gBACd;YACF;YAEA,MAAMM,aAAa,CAAC,CAACD,KAAK,CAACL,SAAS;YAEpC,sDAAsD;YACtD,IAAIC,iBAAiB;gBACnB,IAAIK,YAAY;oBACd,6DAA6D;oBAC7D,OAAOD,KAAK,CAACL,SAAS;gBACxB,OAAO;oBACL,+CAA+C;oBAC/CK,KAAK,CAACL,SAAS,GAAG;gBACpB;gBACA,OAAOK;YACT;YAEA,IAAIC,YAAY;gBACd,+DAA+D;gBAC/D,aAAa;gBACb,OAAO;YACT;YAEA,uBAAuB;YACvB,OAAO;gBAAE,CAACN,SAAS,EAAE;YAAK;QAC5B;QACAN,sBAAsBU;IACxB;IAEA,MAAMG,OAAOxB,cAAcQ,QAAQgB,IAAI;IAEvC,2EAA2E;IAC3E,+EAA+E;IAC/E,2EAA2E;IAC3E,sBAAsB;IACtB,MAAMC,sBAAsBhB,KAAKiB,MAAM,IAAItB;IAE3C,MAAMuB,oBAAoB;QACxBpB;QACAqB,OAAOnB;QACPC;QACAK;QACAH;QACAC;IACF;IAEA,IAAIgB;IACJ,IAAIL,SAAS,SAAS;QACpBK,8BACE,KAAC1B;YAAa,GAAGwB,iBAAiB;YAAEhB,uBAAuBA;YAAuBL,OAAOA;YAAQ,GAAGQ,UAAU;;IAElH,OAAO,IAAIN,QAAQsB,QAAQ,KAAK,WAAWL,qBAAqB;QAC9DI,8BAAgB,KAAC3B;YAAY,GAAGyB,iBAAiB;YAAErB,OAAOA;YAAOS,mBAAmBA;;IACtF,OAAO;QACLc,8BAAgB,KAAC5B;YAAe,GAAG0B,iBAAiB;YAAEZ,mBAAmBA;;IAC3E;IAEA,IAAIP,QAAQsB,QAAQ,KAAK,SAAS;QAChC,qBACE,KAAChC;YACCiC,OAAO;gBACLzB,OAAOA;gBACPC,QAAQA;YACV;YACAyB,IAAI;gBACFF,UAAU;gBACVG,KAAK;gBACLC,OAAO;gBACPC,iBAAiB,CAACC,QAAU,GAAGA,MAAMC,OAAO,CAACC,UAAU,CAACC,OAAO,EAAE;YACnE;sBAECV;;IAGP;IAEA,kBAAkB;IAClB,qBACE,KAAC/B;QACCiC,OAAO;YACLzB,OAAOA;YACPC,QAAQA;QACV;QACAyB,IAAI;YACFF,UAAU;YACVU,QAAQ;YACRL,iBAAiB,CAACC,QAAU,GAAGA,MAAMC,OAAO,CAACC,UAAU,CAACC,OAAO,EAAE;QACnE;kBAECV;;AAGP"}
1
+ {"version":3,"sources":["../../src/Legend/Legend.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 { produce } from 'immer';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { getLegendMode } from '../model';\nimport { CompactLegend } from './CompactLegend';\nimport type { LegendItem, LegendComponentOptions, SelectedLegendItemState } from './legend-model';\nimport { ListLegend } from './ListLegend';\nimport type { ListLegendItemProps } from './ListLegendItem';\nimport type { TableLegendProps } from './TableLegend';\nimport { TableLegend } from './TableLegend';\n\nexport interface LegendProps {\n width: number;\n height: number;\n data: LegendItem[];\n options: LegendComponentOptions;\n\n /**\n * State of selected items in the legend.\n *\n * Selected legend item state is a controlled value that should be managed using a\n * combination of this prop and `onSelectedChange`.\n */\n selectedItems: SelectedLegendItemState;\n\n /**\n * Callback fired when the selected items in the legend changes.\n */\n onSelectedItemsChange: (newSelected: SelectedLegendItemState) => void;\n\n /**\n * Callback fired when the mouse is moved over a legend item.\n */\n onItemMouseOver?: ListLegendItemProps['onMouseOver'];\n\n /**\n * Callback fired when the mouse is moved out of a legend item.\n */\n onItemMouseOut?: ListLegendItemProps['onMouseOut'];\n\n /**\n * Props specific to legend with `mode` set to `table`.\n */\n tableProps?: Pick<TableLegendProps, 'columns' | 'onSortingChange' | 'sorting'>;\n}\n\n// When the number of items to display is above this number, it is likely to\n// cause performance issues in the browser. The legend will be displayed in a\n// format (list) that allows for virtualization to minimize the performance impact.\n// Set this number based on testing, but it may need to be tuned a bit on the\n// future as people test this out on different machines.\nconst NEED_VIRTUALIZATION_LIMIT = 500;\n\nexport function Legend({\n width,\n height,\n options,\n data,\n selectedItems,\n onSelectedItemsChange,\n onItemMouseOver,\n onItemMouseOut,\n tableProps,\n}: LegendProps): ReactElement {\n const onLegendItemClick = (e: React.MouseEvent<HTMLElement, MouseEvent>, seriesId: string): void => {\n const isModifiedClick = e.metaKey || e.shiftKey;\n\n const newSelected = produce<SelectedLegendItemState>(selectedItems, (draft) => {\n if (draft === 'ALL') {\n return {\n [seriesId]: true,\n };\n }\n\n const isSelected = !!draft[seriesId];\n\n // Clicks with modifier key can select multiple items.\n if (isModifiedClick) {\n if (isSelected) {\n // Modified click on already selected item. Remove that item.\n delete draft[seriesId];\n } else {\n // Modified click on not-selected item. Add it.\n draft[seriesId] = true;\n }\n return draft;\n }\n\n if (isSelected) {\n // Clicked item was already selected. Unselect it and return to\n // ALL state.\n return 'ALL' as const;\n }\n\n // Select clicked item.\n return { [seriesId]: true };\n });\n onSelectedItemsChange(newSelected);\n };\n\n const mode = getLegendMode(options.mode);\n\n // The bottom legend is displayed as a list when the number of items is too\n // large and requires virtualization. Otherwise, it is rendered more compactly.\n // We do not need this check for the right-side legend because it is always\n // a virtualized list.\n const needsVirtualization = data.length >= NEED_VIRTUALIZATION_LIMIT;\n\n const commonLegendProps = {\n height,\n items: data,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n };\n\n let legendContent: ReactNode;\n if (mode === 'table') {\n legendContent = (\n <TableLegend {...commonLegendProps} onSelectedItemsChange={onSelectedItemsChange} width={width} {...tableProps} />\n );\n } else if (options.position === 'right' || needsVirtualization) {\n legendContent = <ListLegend {...commonLegendProps} width={width} onLegendItemClick={onLegendItemClick} />;\n } else {\n legendContent = <CompactLegend {...commonLegendProps} onLegendItemClick={onLegendItemClick} />;\n }\n\n if (options.position === 'right') {\n return (\n <Box\n style={{\n width: width,\n height: height,\n }}\n sx={{\n position: 'absolute',\n top: 0,\n right: 0,\n backgroundColor: (theme) => `${theme.palette.background.default}`,\n }}\n >\n {legendContent}\n </Box>\n );\n }\n\n // Position bottom\n return (\n <Box\n style={{\n width: width,\n height: height,\n }}\n sx={{\n position: 'absolute',\n bottom: 0,\n backgroundColor: (theme) => `${theme.palette.background.default}`,\n }}\n >\n {legendContent}\n </Box>\n );\n}\n"],"names":["Box","produce","getLegendMode","CompactLegend","ListLegend","TableLegend","NEED_VIRTUALIZATION_LIMIT"],"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;AACpC,SAASC,OAAO,QAAQ,QAAQ;AAGhC,SAASC,aAAa,QAAQ,oBAAW;AACzC,SAASC,aAAa,QAAQ,qBAAkB;AAEhD,SAASC,UAAU,QAAQ,kBAAe;AAG1C,SAASC,WAAW,QAAQ,mBAAgB;AAqC5C,4EAA4E;AAC5E,6EAA6E;AAC7E,mFAAmF;AACnF,6EAA6E;AAC7E,wDAAwD;AACxD,MAAMC,4BAA4B;AAElC,OAAO"}
@@ -11,21 +11,66 @@
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 { c as _c } from "react-compiler-runtime";
14
15
  import { Box } from "@mui/material";
15
16
  import { memo } from "react";
16
17
  import { combineSx } from "../utils/index.js";
17
- export const LegendColorBadge = /*#__PURE__*/ memo(function LegendColorBadge({ color, sx, ...others }) {
18
- return /*#__PURE__*/ _jsx(Box, {
19
- ...others,
20
- sx: combineSx({
18
+ export const LegendColorBadge = /*#__PURE__*/ memo(function LegendColorBadge(t0) {
19
+ const $ = _c(12);
20
+ let color;
21
+ let others;
22
+ let sx;
23
+ if ($[0] !== t0) {
24
+ ({ color, sx, ...others } = t0);
25
+ $[0] = t0;
26
+ $[1] = color;
27
+ $[2] = others;
28
+ $[3] = sx;
29
+ } else {
30
+ color = $[1];
31
+ others = $[2];
32
+ sx = $[3];
33
+ }
34
+ let t1;
35
+ if ($[4] !== sx) {
36
+ t1 = combineSx({
21
37
  height: 4,
22
38
  width: 16,
23
- margin: (theme)=>theme.spacing(0.5)
24
- }, sx),
25
- style: {
39
+ margin: _temp
40
+ }, sx);
41
+ $[4] = sx;
42
+ $[5] = t1;
43
+ } else {
44
+ t1 = $[5];
45
+ }
46
+ let t2;
47
+ if ($[6] !== color) {
48
+ t2 = {
26
49
  backgroundColor: color
27
- }
28
- });
50
+ };
51
+ $[6] = color;
52
+ $[7] = t2;
53
+ } else {
54
+ t2 = $[7];
55
+ }
56
+ let t3;
57
+ if ($[8] !== others || $[9] !== t1 || $[10] !== t2) {
58
+ t3 = /*#__PURE__*/ _jsx(Box, {
59
+ ...others,
60
+ sx: t1,
61
+ style: t2
62
+ });
63
+ $[8] = others;
64
+ $[9] = t1;
65
+ $[10] = t2;
66
+ $[11] = t3;
67
+ } else {
68
+ t3 = $[11];
69
+ }
70
+ return t3;
29
71
  });
72
+ function _temp(theme) {
73
+ return theme.spacing(0.5);
74
+ }
30
75
 
31
76
  //# sourceMappingURL=LegendColorBadge.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Legend/LegendColorBadge.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 { BoxProps } from '@mui/material';\nimport { Box } from '@mui/material';\nimport type { ReactElement } from 'react';\nimport { memo } from 'react';\n\nimport { combineSx } from '../utils';\n\nexport interface LegendColorBadgeProps extends BoxProps<'div'> {\n color: string;\n}\n\nexport const LegendColorBadge = memo(function LegendColorBadge({\n color,\n sx,\n ...others\n}: LegendColorBadgeProps): ReactElement {\n return (\n <Box\n {...others}\n sx={combineSx(\n {\n height: 4,\n width: 16,\n margin: (theme) => theme.spacing(0.5),\n },\n sx,\n )}\n style={{ backgroundColor: color }}\n />\n );\n});\n"],"names":["Box","memo","combineSx","LegendColorBadge","color","sx","others","height","width","margin","theme","spacing","style","backgroundColor"],"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,GAAG,QAAQ,gBAAgB;AAEpC,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,SAAS,QAAQ,oBAAW;AAMrC,OAAO,MAAMC,iCAAmBF,KAAK,SAASE,iBAAiB,EAC7DC,KAAK,EACLC,EAAE,EACF,GAAGC,QACmB;IACtB,qBACE,KAACN;QACE,GAAGM,MAAM;QACVD,IAAIH,UACF;YACEK,QAAQ;YACRC,OAAO;YACPC,QAAQ,CAACC,QAAUA,MAAMC,OAAO,CAAC;QACnC,GACAN;QAEFO,OAAO;YAAEC,iBAAiBT;QAAM;;AAGtC,GAAG"}
1
+ {"version":3,"sources":["../../src/Legend/LegendColorBadge.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 { BoxProps } from '@mui/material';\nimport { Box } from '@mui/material';\nimport type { ReactElement } from 'react';\nimport { memo } from 'react';\n\nimport { combineSx } from '../utils';\n\nexport interface LegendColorBadgeProps extends BoxProps<'div'> {\n color: string;\n}\n\nexport const LegendColorBadge = memo(function LegendColorBadge({\n color,\n sx,\n ...others\n}: LegendColorBadgeProps): ReactElement {\n return (\n <Box\n {...others}\n sx={combineSx(\n {\n height: 4,\n width: 16,\n margin: (theme) => theme.spacing(0.5),\n },\n sx,\n )}\n style={{ backgroundColor: color }}\n />\n );\n});\n"],"names":["Box","memo","combineSx","LegendColorBadge"],"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,GAAG,QAAQ,gBAAgB;AAEpC,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,SAAS,QAAQ,oBAAW;AAMrC,OAAO,MAAMC,iCAAmBF,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmBlC"}
@@ -11,6 +11,7 @@
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 { c as _c } from "react-compiler-runtime";
14
15
  import { Virtuoso } from "react-virtuoso";
15
16
  import { isLegendItemVisuallySelected } from "./legend-model.js";
16
17
  import { ListLegendItem } from "./ListLegendItem.js";
@@ -19,18 +20,25 @@ import { ListLegendItem } from "./ListLegendItem.js";
19
20
  * stacked. It is also used for `bottom` positioned legends when there are a
20
21
  * large number of items because it is virtualized and easier to visually scan
21
22
  * large numbers of items when there is a single item per row.
22
- */ export function ListLegend({ items, height, width, selectedItems, onLegendItemClick, onItemMouseOver, onItemMouseOut }) {
23
- // show full labels on hover when there are many total series
23
+ */ export function ListLegend(t0) {
24
+ const $ = _c(13);
25
+ const { items, height, width, selectedItems, onLegendItemClick, onItemMouseOver, onItemMouseOut } = t0;
24
26
  const truncateLabels = items.length > 5;
25
- // Virtuoso requires its scroll container to remain a div, so native ul semantics cannot be used here.
26
- /* oxlint-disable jsx-a11y/prefer-tag-over-role */ return /*#__PURE__*/ _jsx(Virtuoso, {
27
- style: {
27
+ let t1;
28
+ if ($[0] !== height || $[1] !== width) {
29
+ t1 = {
28
30
  height,
29
31
  width
30
- },
31
- data: items,
32
- itemContent: (index, item)=>{
33
- return /*#__PURE__*/ _jsx(ListLegendItem, {
32
+ };
33
+ $[0] = height;
34
+ $[1] = width;
35
+ $[2] = t1;
36
+ } else {
37
+ t1 = $[2];
38
+ }
39
+ let t2;
40
+ if ($[3] !== onItemMouseOut || $[4] !== onItemMouseOver || $[5] !== onLegendItemClick || $[6] !== selectedItems || $[7] !== truncateLabels) {
41
+ t2 = (index, item)=>/*#__PURE__*/ _jsx(ListLegendItem, {
34
42
  item: item,
35
43
  index: index,
36
44
  truncateLabel: truncateLabels,
@@ -39,14 +47,36 @@ import { ListLegendItem } from "./ListLegendItem.js";
39
47
  onMouseOver: onItemMouseOver,
40
48
  onMouseOut: onItemMouseOut,
41
49
  sx: {
42
- width: '100%',
43
- wordBreak: 'break-word',
44
- overflow: 'hidden'
50
+ width: "100%",
51
+ wordBreak: "break-word",
52
+ overflow: "hidden"
45
53
  }
46
54
  }, item.id);
47
- },
48
- role: "list"
49
- });
50
- /* oxlint-enable jsx-a11y/prefer-tag-over-role */ }
55
+ $[3] = onItemMouseOut;
56
+ $[4] = onItemMouseOver;
57
+ $[5] = onLegendItemClick;
58
+ $[6] = selectedItems;
59
+ $[7] = truncateLabels;
60
+ $[8] = t2;
61
+ } else {
62
+ t2 = $[8];
63
+ }
64
+ let t3;
65
+ if ($[9] !== items || $[10] !== t1 || $[11] !== t2) {
66
+ t3 = /*#__PURE__*/ _jsx(Virtuoso, {
67
+ style: t1,
68
+ data: items,
69
+ itemContent: t2,
70
+ role: "list"
71
+ });
72
+ $[9] = items;
73
+ $[10] = t1;
74
+ $[11] = t2;
75
+ $[12] = t3;
76
+ } else {
77
+ t3 = $[12];
78
+ }
79
+ return t3;
80
+ }
51
81
 
52
82
  //# sourceMappingURL=ListLegend.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Legend/ListLegend.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 { ReactElement } from 'react';\nimport { Virtuoso } from 'react-virtuoso';\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 ListLegendProps {\n items: LegendItem[];\n height: number;\n width: number;\n selectedItems: SelectedLegendItemState;\n onLegendItemClick: ListLegendItemProps['onClick'];\n onItemMouseOver: ListLegendItemProps['onMouseOver'];\n onItemMouseOut: ListLegendItemProps['onMouseOut'];\n}\n\n/**\n * ListLegend is used when legend.position is 'right' since legend items are\n * stacked. It is also used for `bottom` positioned legends when there are a\n * large number of items because it is virtualized and easier to visually scan\n * large numbers of items when there is a single item per row.\n */\nexport function ListLegend({\n items,\n height,\n width,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n}: ListLegendProps): ReactElement {\n // show full labels on hover when there are many total series\n const truncateLabels = items.length > 5;\n // Virtuoso requires its scroll container to remain a div, so native ul semantics cannot be used here.\n /* oxlint-disable jsx-a11y/prefer-tag-over-role */\n return (\n <Virtuoso\n style={{ height, width }}\n data={items}\n itemContent={(index, item) => {\n return (\n <ListLegendItem\n key={item.id}\n item={item}\n index={index}\n truncateLabel={truncateLabels}\n isVisuallySelected={isLegendItemVisuallySelected(item, selectedItems)}\n onClick={onLegendItemClick}\n onMouseOver={onItemMouseOver}\n onMouseOut={onItemMouseOut}\n sx={{\n width: '100%',\n wordBreak: 'break-word',\n overflow: 'hidden',\n }}\n />\n );\n }}\n role=\"list\"\n />\n );\n /* oxlint-enable jsx-a11y/prefer-tag-over-role */\n}\n"],"names":["Virtuoso","isLegendItemVisuallySelected","ListLegendItem","ListLegend","items","height","width","selectedItems","onLegendItemClick","onItemMouseOver","onItemMouseOut","truncateLabels","length","style","data","itemContent","index","item","truncateLabel","isVisuallySelected","onClick","onMouseOver","onMouseOut","sx","wordBreak","overflow","id","role"],"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,QAAQ,QAAQ,iBAAiB;AAG1C,SAASC,4BAA4B,QAAQ,oBAAiB;AAE9D,SAASC,cAAc,QAAQ,sBAAmB;AAYlD;;;;;CAKC,GACD,OAAO,SAASC,WAAW,EACzBC,KAAK,EACLC,MAAM,EACNC,KAAK,EACLC,aAAa,EACbC,iBAAiB,EACjBC,eAAe,EACfC,cAAc,EACE;IAChB,6DAA6D;IAC7D,MAAMC,iBAAiBP,MAAMQ,MAAM,GAAG;IACtC,sGAAsG;IACtG,gDAAgD,GAChD,qBACE,KAACZ;QACCa,OAAO;YAAER;YAAQC;QAAM;QACvBQ,MAAMV;QACNW,aAAa,CAACC,OAAOC;YACnB,qBACE,KAACf;gBAECe,MAAMA;gBACND,OAAOA;gBACPE,eAAeP;gBACfQ,oBAAoBlB,6BAA6BgB,MAAMV;gBACvDa,SAASZ;gBACTa,aAAaZ;gBACba,YAAYZ;gBACZa,IAAI;oBACFjB,OAAO;oBACPkB,WAAW;oBACXC,UAAU;gBACZ;eAZKR,KAAKS,EAAE;QAelB;QACAC,MAAK;;AAGT,+CAA+C,GACjD"}
1
+ {"version":3,"sources":["../../src/Legend/ListLegend.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 { ReactElement } from 'react';\nimport { Virtuoso } from 'react-virtuoso';\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 ListLegendProps {\n items: LegendItem[];\n height: number;\n width: number;\n selectedItems: SelectedLegendItemState;\n onLegendItemClick: ListLegendItemProps['onClick'];\n onItemMouseOver: ListLegendItemProps['onMouseOver'];\n onItemMouseOut: ListLegendItemProps['onMouseOut'];\n}\n\n/**\n * ListLegend is used when legend.position is 'right' since legend items are\n * stacked. It is also used for `bottom` positioned legends when there are a\n * large number of items because it is virtualized and easier to visually scan\n * large numbers of items when there is a single item per row.\n */\nexport function ListLegend({\n items,\n height,\n width,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n}: ListLegendProps): ReactElement {\n // show full labels on hover when there are many total series\n const truncateLabels = items.length > 5;\n // Virtuoso requires its scroll container to remain a div, so native ul semantics cannot be used here.\n /* oxlint-disable jsx-a11y/prefer-tag-over-role */\n return (\n <Virtuoso\n style={{ height, width }}\n data={items}\n itemContent={(index, item) => {\n return (\n <ListLegendItem\n key={item.id}\n item={item}\n index={index}\n truncateLabel={truncateLabels}\n isVisuallySelected={isLegendItemVisuallySelected(item, selectedItems)}\n onClick={onLegendItemClick}\n onMouseOver={onItemMouseOver}\n onMouseOut={onItemMouseOut}\n sx={{\n width: '100%',\n wordBreak: 'break-word',\n overflow: 'hidden',\n }}\n />\n );\n }}\n role=\"list\"\n />\n );\n /* oxlint-enable jsx-a11y/prefer-tag-over-role */\n}\n"],"names":["Virtuoso","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;;;AAGjC,SAASA,QAAQ,QAAQ,iBAAiB;AAG1C,SAASC,4BAA4B,QAAQ,oBAAiB;AAE9D,SAASC,cAAc,QAAQ,sBAAmB;AAYlD;;;;;CAKC,GACD,OAAO"}