@parca/profile 0.19.139 → 0.19.142

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 (170) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/GraphTooltipArrow/Content.js +224 -30
  3. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
  4. package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
  5. package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
  6. package/dist/GraphTooltipArrow/index.js +86 -56
  7. package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
  8. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +103 -73
  9. package/dist/MatchersInput/SuggestionItem.js +91 -12
  10. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  11. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  12. package/dist/MatchersInput/SuggestionsList.js +371 -157
  13. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  15. package/dist/MatchersInput/index.js +308 -115
  16. package/dist/MetricsCircle/index.js +39 -3
  17. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  18. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  19. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  20. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  21. package/dist/MetricsGraph/index.js +552 -203
  22. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  23. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  24. package/dist/MetricsSeries/index.js +70 -7
  25. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  26. package/dist/PreSelectedMatchers/index.js +249 -102
  27. package/dist/ProfileExplorer/ProfileExplorerCompare.js +240 -49
  28. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  29. package/dist/ProfileExplorer/index.js +183 -32
  30. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  31. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  32. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  33. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  34. package/dist/ProfileFlameChart/index.js +266 -134
  35. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +287 -88
  36. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  37. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  38. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  39. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +71 -45
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  55. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  56. package/dist/ProfileFlameGraph/index.js +324 -148
  57. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  58. package/dist/ProfileMetricsGraph/index.js +518 -259
  59. package/dist/ProfileSelector/CompareButton.js +132 -12
  60. package/dist/ProfileSelector/MetricsGraphSection.js +234 -67
  61. package/dist/ProfileSelector/index.d.ts.map +1 -1
  62. package/dist/ProfileSelector/index.js +730 -142
  63. package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
  64. package/dist/ProfileSource.js +230 -163
  65. package/dist/ProfileTypeSelector/index.js +214 -125
  66. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  67. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +139 -33
  68. package/dist/ProfileView/components/ColorStackLegend.js +184 -55
  69. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  70. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  71. package/dist/ProfileView/components/DiffLegend.js +172 -29
  72. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  73. package/dist/ProfileView/components/InvertCallStack/index.js +99 -10
  74. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  75. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  76. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  77. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -120
  78. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  79. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  80. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  81. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  82. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +675 -195
  83. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  84. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +198 -157
  85. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  86. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  87. package/dist/ProfileView/components/ViewSelector/index.js +211 -91
  88. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  89. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  90. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  91. package/dist/ProfileView/context/DashboardContext.js +84 -28
  92. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  93. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  94. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  95. package/dist/ProfileView/hooks/useResetFlameGraphState.js +31 -10
  96. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +72 -29
  97. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +39 -13
  98. package/dist/ProfileView/hooks/useVisualizationState.js +262 -87
  99. package/dist/ProfileView/index.js +383 -45
  100. package/dist/ProfileView/types/visualization.js +1 -13
  101. package/dist/ProfileView/utils/colorUtils.js +8 -7
  102. package/dist/ProfileViewWithData.js +332 -237
  103. package/dist/QueryControls/index.js +418 -47
  104. package/dist/Sandwich/components/CalleesSection.js +54 -4
  105. package/dist/Sandwich/components/CallersSection.js +97 -27
  106. package/dist/Sandwich/components/TableSection.js +77 -4
  107. package/dist/Sandwich/index.js +125 -12
  108. package/dist/Sandwich/utils/processRowData.js +48 -39
  109. package/dist/SelectWithRefresh/index.js +102 -28
  110. package/dist/SimpleMatchers/Select.js +520 -187
  111. package/dist/SimpleMatchers/index.js +590 -288
  112. package/dist/SourceView/Highlighter.js +230 -70
  113. package/dist/SourceView/LineNo.js +72 -17
  114. package/dist/SourceView/index.js +177 -101
  115. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  116. package/dist/SourceView/lang-detector/index.js +28 -14
  117. package/dist/SourceView/useSelectedLineRange.js +97 -16
  118. package/dist/Table/ColorCell.js +42 -1
  119. package/dist/Table/ColumnsVisibility.js +114 -6
  120. package/dist/Table/MoreDropdown.js +121 -27
  121. package/dist/Table/TableContextMenu.js +150 -139
  122. package/dist/Table/TableContextMenuWrapper.js +59 -14
  123. package/dist/Table/hooks/useColorManagement.js +58 -16
  124. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  125. package/dist/Table/hooks/useTableConfiguration.js +331 -168
  126. package/dist/Table/index.js +222 -126
  127. package/dist/Table/utils/functions.js +169 -144
  128. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  129. package/dist/TimelineGuide/index.js +209 -16
  130. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  131. package/dist/TopTable/index.js +340 -122
  132. package/dist/contexts/LabelsQueryProvider.js +94 -32
  133. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  134. package/dist/contexts/utils.js +37 -15
  135. package/dist/hooks/useCompareModeMeta.js +157 -94
  136. package/dist/hooks/useLabels.js +295 -52
  137. package/dist/hooks/useQueryState.js +371 -330
  138. package/dist/index.js +21 -16
  139. package/dist/testdata/fg-diff.json +3750 -0
  140. package/dist/testdata/fg-simple.json +1879 -0
  141. package/dist/testdata/link_data.json +56 -0
  142. package/dist/testdata/tabular.json +30 -0
  143. package/dist/testdata/test_flamegraph.json +26846 -0
  144. package/dist/testdata/test_graph.json +53 -0
  145. package/dist/useDelayedLoader.js +32 -18
  146. package/dist/useGrpcQuery/index.js +71 -11
  147. package/dist/useHasProfileData.js +90 -12
  148. package/dist/useQuery.js +205 -64
  149. package/dist/useSumBy.d.ts.map +1 -1
  150. package/dist/useSumBy.js +294 -138
  151. package/dist/utils.js +62 -30
  152. package/package.json +9 -9
  153. package/src/GraphTooltipArrow/index.tsx +3 -0
  154. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  155. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  156. package/src/MatchersInput/index.tsx +1 -1
  157. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  158. package/src/PreSelectedMatchers/index.tsx +3 -0
  159. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +3 -0
  160. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  161. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  162. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  163. package/src/ProfileSelector/index.tsx +30 -7
  164. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +3 -0
  165. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  166. package/src/Table/hooks/useTableConfiguration.tsx +7 -13
  167. package/src/useDelayedLoader.ts +10 -10
  168. package/src/useSumBy.ts +12 -18
  169. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -541
  170. package/dist/hooks/useQueryState.test.js +0 -984
@@ -1,3 +1,4 @@
1
+ import { c as _c } from "react-compiler-runtime";
1
2
  // Copyright 2022 The Parca Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,32 +11,52 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
14
+
13
15
  import { useWindowSize } from 'react-use';
14
16
  import { useParcaContext } from '@parca/components';
15
- const margin = 50;
16
- export const useMetricsGraphDimensions = (comparing, maxHeight = 402) => {
17
- let { width } = useWindowSize();
18
- const { profileExplorer } = useParcaContext();
19
- if (profileExplorer == null) {
20
- return {
21
- width: 0,
22
- height: 0,
23
- heightStyle: '0',
24
- margin: 0,
25
- };
17
+ var margin = 50;
18
+ export var useMetricsGraphDimensions = function useMetricsGraphDimensions(comparing, t0) {
19
+ var $ = _c(5);
20
+ var maxHeight = t0 === undefined ? 402 : t0;
21
+ var _useWindowSize = useWindowSize(),
22
+ width = _useWindowSize.width;
23
+ var _useParcaContext = useParcaContext(),
24
+ profileExplorer = _useParcaContext.profileExplorer;
25
+ if (profileExplorer == null) {
26
+ var _t;
27
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
28
+ _t = {
29
+ width: 0,
30
+ height: 0,
31
+ heightStyle: "0",
32
+ margin: 0
33
+ };
34
+ $[0] = _t;
35
+ } else {
36
+ _t = $[0];
26
37
  }
27
- width = width - profileExplorer.PaddingX;
28
- if (comparing) {
29
- width = width / 2 - 32;
30
- }
31
- const height = Math.min(width / 2.5, maxHeight);
32
- const heightStyle = `min(${maxHeight + margin}px, ${comparing
33
- ? profileExplorer.metricsGraph.maxHeightStyle.compareMode
34
- : profileExplorer.metricsGraph.maxHeightStyle.default})`;
35
- return {
36
- width,
37
- height,
38
- heightStyle,
39
- margin,
38
+ return _t;
39
+ }
40
+ width = width - profileExplorer.PaddingX;
41
+ if (comparing) {
42
+ width = width / 2 - 32;
43
+ }
44
+ var height = Math.min(width / 2.5, maxHeight);
45
+ var heightStyle = "min(".concat(maxHeight + margin, "px, ").concat(comparing ? profileExplorer.metricsGraph.maxHeightStyle.compareMode : profileExplorer.metricsGraph.maxHeightStyle["default"], ")");
46
+ var t1;
47
+ if ($[1] !== height || $[2] !== heightStyle || $[3] !== width) {
48
+ t1 = {
49
+ width: width,
50
+ height: height,
51
+ heightStyle: heightStyle,
52
+ margin: margin
40
53
  };
41
- };
54
+ $[1] = height;
55
+ $[2] = heightStyle;
56
+ $[3] = width;
57
+ $[4] = t1;
58
+ } else {
59
+ t1 = $[4];
60
+ }
61
+ return t1;
62
+ };
@@ -10,27 +10,34 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
+
13
14
  import * as d3 from 'd3';
15
+
14
16
  // Cache to store color mappings
15
- const colorCache = new Map();
17
+ var colorCache = new Map();
18
+
16
19
  // Create a color scale using d3's category10 scheme
17
- const colorScale = d3.scaleOrdinal(d3.schemeCategory10);
20
+ var colorScale = d3.scaleOrdinal(d3.schemeCategory10);
21
+
18
22
  /**
19
23
  * Generates a consistent color for a series based on its identifying properties
20
24
  */
21
25
  export function getSeriesColor(labels) {
22
- // Create a key from all labels to ensure unique identification
23
- const key = labels
24
- .filter(l => l.name !== '__type__' && l.name !== 'limit') // ignore injected virtual labels
25
- .map(l => `${l.name}=${l.value}`)
26
- .sort()
27
- .join(',');
28
- // Return cached color if exists
29
- if (colorCache.has(key)) {
30
- return colorCache.get(key);
31
- }
32
- // Generate new color and cache it
33
- const color = colorScale(key);
34
- colorCache.set(key, color);
35
- return color;
36
- }
26
+ // Create a key from all labels to ensure unique identification
27
+ var key = labels.filter(function (l) {
28
+ return l.name !== '__type__' && l.name !== 'limit';
29
+ }) // ignore injected virtual labels
30
+ .map(function (l) {
31
+ return "".concat(l.name, "=").concat(l.value);
32
+ }).sort().join(',');
33
+
34
+ // Return cached color if exists
35
+ if (colorCache.has(key)) {
36
+ return colorCache.get(key);
37
+ }
38
+
39
+ // Generate new color and cache it
40
+ var color = colorScale(key);
41
+ colorCache.set(key, color);
42
+ return color;
43
+ }
@@ -1,8 +1,71 @@
1
+ import { c as _c } from "react-compiler-runtime"; // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { jsx as _jsx } from "react/jsx-runtime";
2
- const MetricsSeries = ({ data, line, color, strokeWidth, strokeDasharray = '', strokeLinecap = 'round', onClick, }) => (_jsx("g", { className: "line-group", children: _jsx("path", { className: "line", d: line(data.values) ?? undefined, style: {
3
- stroke: color,
4
- strokeWidth,
5
- strokeDasharray,
6
- strokeLinecap,
7
- }, onClick: onClick }) }));
8
- export default MetricsSeries;
14
+ var MetricsSeries = function MetricsSeries(t0) {
15
+ var $ = _c(12);
16
+ var data = t0.data,
17
+ line = t0.line,
18
+ color = t0.color,
19
+ strokeWidth = t0.strokeWidth,
20
+ t1 = t0.strokeDasharray,
21
+ t2 = t0.strokeLinecap,
22
+ onClick = t0.onClick;
23
+ var strokeDasharray = t1 === undefined ? "" : t1;
24
+ var strokeLinecap = t2 === undefined ? "round" : t2;
25
+ var t3;
26
+ if ($[0] !== data.values || $[1] !== line) {
27
+ var _line;
28
+ t3 = (_line = line(data.values)) !== null && _line !== void 0 ? _line : undefined;
29
+ $[0] = data.values;
30
+ $[1] = line;
31
+ $[2] = t3;
32
+ } else {
33
+ t3 = $[2];
34
+ }
35
+ var t4;
36
+ if ($[3] !== color || $[4] !== strokeDasharray || $[5] !== strokeLinecap || $[6] !== strokeWidth) {
37
+ t4 = {
38
+ stroke: color,
39
+ strokeWidth: strokeWidth,
40
+ strokeDasharray: strokeDasharray,
41
+ strokeLinecap: strokeLinecap
42
+ };
43
+ $[3] = color;
44
+ $[4] = strokeDasharray;
45
+ $[5] = strokeLinecap;
46
+ $[6] = strokeWidth;
47
+ $[7] = t4;
48
+ } else {
49
+ t4 = $[7];
50
+ }
51
+ var t5;
52
+ if ($[8] !== onClick || $[9] !== t3 || $[10] !== t4) {
53
+ t5 = /*#__PURE__*/_jsx("g", {
54
+ className: "line-group",
55
+ children: /*#__PURE__*/_jsx("path", {
56
+ className: "line",
57
+ d: t3,
58
+ style: t4,
59
+ onClick: onClick
60
+ })
61
+ });
62
+ $[8] = onClick;
63
+ $[9] = t3;
64
+ $[10] = t4;
65
+ $[11] = t5;
66
+ } else {
67
+ t5 = $[11];
68
+ }
69
+ return t5;
70
+ };
71
+ export default MetricsSeries;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PreSelectedMatchers/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAatE,UAAU,KAAK;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAwKxC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PreSelectedMatchers/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAatE,UAAU,KAAK;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAyKxC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -1,4 +1,21 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
3
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
4
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
5
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
10
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
12
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
13
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
14
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
16
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
17
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
18
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
2
19
  // Copyright 2022 The Parca Authors
3
20
  // Licensed under the Apache License, Version 2.0 (the "License");
4
21
  // you may not use this file except in compliance with the License.
@@ -11,7 +28,10 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
11
28
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
29
  // See the License for the specific language governing permissions and
13
30
  // limitations under the License.
14
- import { useCallback, useEffect, useRef, useState } from 'react';
31
+
32
+ /* eslint-disable react-hooks/refs */
33
+
34
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
15
35
  import { Icon } from '@iconify/react';
16
36
  import cx from 'classnames';
17
37
  import { useGrpcMetadata, useParcaContext } from '@parca/components';
@@ -20,106 +40,233 @@ import { millisToProtoTimestamp, sanitizeLabelValue } from '@parca/utilities';
20
40
  import CustomSelect from '../SimpleMatchers/Select';
21
41
  import { useUnifiedLabels } from '../contexts/UnifiedLabelsContext';
22
42
  import { useQueryState } from '../hooks/useQueryState';
23
- const PreSelectedMatchers = ({ labelNames }) => {
24
- const [labelValuesMap, setLabelValuesMap] = useState({});
25
- const [isLoading, setIsLoading] = useState({});
26
- const metadata = useGrpcMetadata();
27
- const { queryServiceClient: parcaQueryClient } = useParcaContext();
28
- const { suffix } = useUnifiedLabels();
29
- const { draftSelection, setDraftMatchers, commitDraft, draftParsedQuery } = useQueryState({ suffix });
30
- const currentMatchers = draftParsedQuery?.matchersString();
31
- const profileType = draftParsedQuery?.profileType().toString();
32
- const start = draftSelection.from;
33
- const end = draftSelection.to;
34
- const parseCurrentMatchers = useCallback((matchersString) => {
35
- const matches = matchersString.match(/(\w+)="([^"]+)"/g);
36
- if (matches === null)
37
- return {};
38
- return matches.reduce((acc, match) => {
39
- const [label, value] = match.split('=');
40
- if (label !== undefined) {
41
- acc[label] = value.replace(/"/g, '');
42
- }
43
- return acc;
44
- },
45
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
46
- {});
47
- }, []);
48
- const initialSelections = parseCurrentMatchers(currentMatchers ?? '');
49
- const selectionsRef = useRef(initialSelections);
50
- const commitDraftRef = useRef(commitDraft);
51
- const timeoutRef = useRef(null);
52
- useEffect(() => {
53
- commitDraftRef.current = commitDraft;
54
- }, [commitDraft]);
55
- useEffect(() => {
56
- selectionsRef.current = initialSelections;
57
- }, [initialSelections]);
58
- const fetchLabelValues = useCallback(async (labelName) => {
59
- try {
60
- const response = await parcaQueryClient.values({
61
- labelName,
62
- match: [],
63
- profileType,
64
- ...(start !== undefined && end !== undefined
65
- ? {
66
- start: millisToProtoTimestamp(start),
67
- end: millisToProtoTimestamp(end),
68
- }
69
- : {}),
70
- }, { meta: metadata }).response;
71
- return sanitizeLabelValue(response.labelValues);
72
- }
73
- catch (error) {
74
- console.error('Error fetching label values:', error);
75
- return [];
76
- }
77
- }, [parcaQueryClient, metadata, profileType, start, end]);
78
- const fetchAllLabelValues = useCallback(async () => {
79
- const newLabelValuesMap = {};
80
- const newIsLoading = {};
81
- for (const labelName of labelNames) {
82
- newIsLoading[labelName] = true;
83
- setIsLoading(prev => ({ ...prev, [labelName]: true }));
84
- const values = await fetchLabelValues(labelName);
85
- newLabelValuesMap[labelName] = values;
86
- newIsLoading[labelName] = false;
43
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
44
+ var PreSelectedMatchers = function PreSelectedMatchers(_ref) {
45
+ 'use no memo';
46
+
47
+ var labelNames = _ref.labelNames;
48
+ var _useState = useState({}),
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ labelValuesMap = _useState2[0],
51
+ setLabelValuesMap = _useState2[1];
52
+ var _useState3 = useState({}),
53
+ _useState4 = _slicedToArray(_useState3, 2),
54
+ isLoading = _useState4[0],
55
+ setIsLoading = _useState4[1];
56
+ var metadata = useGrpcMetadata();
57
+ var _useParcaContext = useParcaContext(),
58
+ parcaQueryClient = _useParcaContext.queryServiceClient;
59
+ var _useUnifiedLabels = useUnifiedLabels(),
60
+ suffix = _useUnifiedLabels.suffix;
61
+ var _useQueryState = useQueryState({
62
+ suffix: suffix
63
+ }),
64
+ draftSelection = _useQueryState.draftSelection,
65
+ setDraftMatchers = _useQueryState.setDraftMatchers,
66
+ commitDraft = _useQueryState.commitDraft,
67
+ draftParsedQuery = _useQueryState.draftParsedQuery;
68
+ var currentMatchers = draftParsedQuery === null || draftParsedQuery === void 0 ? void 0 : draftParsedQuery.matchersString();
69
+ var profileType = draftParsedQuery === null || draftParsedQuery === void 0 ? void 0 : draftParsedQuery.profileType().toString();
70
+ var start = draftSelection.from;
71
+ var end = draftSelection.to;
72
+ var parseCurrentMatchers = useCallback(function (matchersString) {
73
+ var matches = matchersString.match(/(\w+)="([^"]+)"/g);
74
+ if (matches === null) return {};
75
+ return matches.reduce(function (acc, match) {
76
+ var _match$split = match.split('='),
77
+ _match$split2 = _slicedToArray(_match$split, 2),
78
+ label = _match$split2[0],
79
+ value = _match$split2[1];
80
+ if (label !== undefined) {
81
+ acc[label] = value.replace(/"/g, '');
82
+ }
83
+ return acc;
84
+ },
85
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
86
+ {});
87
+ }, []);
88
+ var initialSelections = parseCurrentMatchers(currentMatchers !== null && currentMatchers !== void 0 ? currentMatchers : '');
89
+ var selectionsRef = useRef(initialSelections);
90
+ var commitDraftRef = useRef(commitDraft);
91
+ var timeoutRef = useRef(null);
92
+ useEffect(function () {
93
+ commitDraftRef.current = commitDraft;
94
+ }, [commitDraft]);
95
+ useEffect(function () {
96
+ selectionsRef.current = initialSelections;
97
+ }, [initialSelections]);
98
+ var fetchLabelValues = useCallback(/*#__PURE__*/function () {
99
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(labelName) {
100
+ var response, _t;
101
+ return _regenerator().w(function (_context) {
102
+ while (1) switch (_context.p = _context.n) {
103
+ case 0:
104
+ _context.p = 0;
105
+ _context.n = 1;
106
+ return parcaQueryClient.values(_objectSpread({
107
+ labelName: labelName,
108
+ match: [],
109
+ profileType: profileType
110
+ }, start !== undefined && end !== undefined ? {
111
+ start: millisToProtoTimestamp(start),
112
+ end: millisToProtoTimestamp(end)
113
+ } : {}), {
114
+ meta: metadata
115
+ }).response;
116
+ case 1:
117
+ response = _context.v;
118
+ return _context.a(2, sanitizeLabelValue(response.labelValues));
119
+ case 2:
120
+ _context.p = 2;
121
+ _t = _context.v;
122
+ console.error('Error fetching label values:', _t);
123
+ return _context.a(2, []);
87
124
  }
88
- setLabelValuesMap(newLabelValuesMap);
89
- setIsLoading(newIsLoading);
90
- }, [labelNames, fetchLabelValues]);
91
- useEffect(() => {
92
- void fetchAllLabelValues();
93
- }, [fetchAllLabelValues]);
94
- const updateMatcherString = useCallback(() => {
95
- const matcherParts = Object.entries(selectionsRef.current)
96
- .filter(([_, v]) => v !== null && v !== '')
97
- .map(([ln, v]) => `${ln}="${v}"`);
98
- const matcherString = matcherParts.join(',');
99
- setDraftMatchers(matcherString);
100
- if (timeoutRef.current !== null) {
101
- clearTimeout(timeoutRef.current);
125
+ }, _callee, null, [[0, 2]]);
126
+ }));
127
+ return function (_x) {
128
+ return _ref2.apply(this, arguments);
129
+ };
130
+ }(), [parcaQueryClient, metadata, profileType, start, end]);
131
+ var fetchAllLabelValues = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
132
+ var newLabelValuesMap, newIsLoading, _iterator, _step, _loop, _t2;
133
+ return _regenerator().w(function (_context3) {
134
+ while (1) switch (_context3.p = _context3.n) {
135
+ case 0:
136
+ newLabelValuesMap = {};
137
+ newIsLoading = {};
138
+ _iterator = _createForOfIteratorHelper(labelNames);
139
+ _context3.p = 1;
140
+ _loop = /*#__PURE__*/_regenerator().m(function _loop() {
141
+ var labelName_0, values;
142
+ return _regenerator().w(function (_context2) {
143
+ while (1) switch (_context2.n) {
144
+ case 0:
145
+ labelName_0 = _step.value;
146
+ newIsLoading[labelName_0] = true;
147
+ setIsLoading(function (prev) {
148
+ return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, labelName_0, true));
149
+ });
150
+ _context2.n = 1;
151
+ return fetchLabelValues(labelName_0);
152
+ case 1:
153
+ values = _context2.v;
154
+ newLabelValuesMap[labelName_0] = values;
155
+ newIsLoading[labelName_0] = false;
156
+ case 2:
157
+ return _context2.a(2);
158
+ }
159
+ }, _loop);
160
+ });
161
+ _iterator.s();
162
+ case 2:
163
+ if ((_step = _iterator.n()).done) {
164
+ _context3.n = 4;
165
+ break;
166
+ }
167
+ return _context3.d(_regeneratorValues(_loop()), 3);
168
+ case 3:
169
+ _context3.n = 2;
170
+ break;
171
+ case 4:
172
+ _context3.n = 6;
173
+ break;
174
+ case 5:
175
+ _context3.p = 5;
176
+ _t2 = _context3.v;
177
+ _iterator.e(_t2);
178
+ case 6:
179
+ _context3.p = 6;
180
+ _iterator.f();
181
+ return _context3.f(6);
182
+ case 7:
183
+ setLabelValuesMap(newLabelValuesMap);
184
+ setIsLoading(newIsLoading);
185
+ case 8:
186
+ return _context3.a(2);
187
+ }
188
+ }, _callee2, null, [[1, 5, 6, 7]]);
189
+ })), [labelNames, fetchLabelValues]);
190
+ useEffect(function () {
191
+ void fetchAllLabelValues();
192
+ }, [fetchAllLabelValues]);
193
+ var updateMatcherString = useCallback(function () {
194
+ var matcherParts = Object.entries(selectionsRef.current).filter(function (_ref4) {
195
+ var _ref5 = _slicedToArray(_ref4, 2),
196
+ _ = _ref5[0],
197
+ v = _ref5[1];
198
+ return v !== null && v !== '';
199
+ }).map(function (_ref6) {
200
+ var _ref7 = _slicedToArray(_ref6, 2),
201
+ ln = _ref7[0],
202
+ v_0 = _ref7[1];
203
+ return "".concat(ln, "=\"").concat(v_0, "\"");
204
+ });
205
+ var matcherString = matcherParts.join(',');
206
+ setDraftMatchers(matcherString);
207
+ if (timeoutRef.current !== null) {
208
+ clearTimeout(timeoutRef.current);
209
+ }
210
+ timeoutRef.current = setTimeout(function () {
211
+ commitDraftRef.current();
212
+ }, 300);
213
+ }, [setDraftMatchers]);
214
+ var handleSelection = useCallback(function (labelName_1, value_0) {
215
+ selectionsRef.current = _objectSpread(_objectSpread({}, selectionsRef.current), {}, _defineProperty({}, labelName_1, value_0));
216
+ updateMatcherString();
217
+ }, [updateMatcherString]);
218
+ var handleReset = useCallback(function (labelName_2) {
219
+ handleSelection(labelName_2, null);
220
+ }, [handleSelection]);
221
+ var transformValuesForSelect = useCallback(function (values_0) {
222
+ return values_0.map(function (value_1) {
223
+ return {
224
+ key: value_1,
225
+ element: {
226
+ active: /*#__PURE__*/_jsx(_Fragment, {
227
+ children: value_1
228
+ }),
229
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
230
+ children: value_1
231
+ })
102
232
  }
103
- timeoutRef.current = setTimeout(() => {
104
- commitDraftRef.current();
105
- }, 300);
106
- }, [setDraftMatchers]);
107
- const handleSelection = useCallback((labelName, value) => {
108
- selectionsRef.current = {
109
- ...selectionsRef.current,
110
- [labelName]: value,
111
- };
112
- updateMatcherString();
113
- }, [updateMatcherString]);
114
- const handleReset = useCallback((labelName) => {
115
- handleSelection(labelName, null);
116
- }, [handleSelection]);
117
- const transformValuesForSelect = useCallback((values) => {
118
- return values.map(value => ({
119
- key: value,
120
- element: { active: _jsx(_Fragment, { children: value }), expanded: _jsx(_Fragment, { children: value }) },
121
- }));
122
- }, []);
123
- return (_jsx("div", { className: "flex flex-wrap gap-2", ...testId(TEST_IDS.VIEW_MATCHERS_CONTAINER), children: labelNames.map(labelName => (_jsxs("div", { className: "flex items-center", children: [_jsx("div", { className: "relative border shadow-sm px-4 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 text-sm flex gap-2 items-center justify-between bg-gray-100 dark:bg-gray-700 rounded-l-md border-gray-300 dark:border-gray-600", children: labelName }), _jsx(CustomSelect, { searchable: true, placeholder: "Select value", items: transformValuesForSelect(labelValuesMap[labelName] ?? []), onSelection: (value) => handleSelection(labelName, value), selectedKey: selectionsRef.current[labelName] ?? undefined, className: cx('rounded-l-none border-l-0', selectionsRef.current[labelName] != null && 'border-r-0 rounded-r-none'), loading: isLoading[labelName] ?? false }), selectionsRef.current[labelName] != null && (_jsx("button", { onClick: () => handleReset(labelName), className: "p-2 border-gray-200 bg-white dark:bg-gray-900 dark:border-gray-600 border rounded-r-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500", "aria-label": `Reset ${labelName} selection`, children: _jsx(Icon, { icon: "mdi:close", className: "h-5 w-5 text-gray-400", "aria-hidden": "true" }) }))] }, labelName))) }));
233
+ };
234
+ });
235
+ }, []);
236
+ return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
237
+ className: "flex flex-wrap gap-2"
238
+ }, testId(TEST_IDS.VIEW_MATCHERS_CONTAINER)), {}, {
239
+ children: labelNames.map(function (labelName_3) {
240
+ var _labelValuesMap$label, _selectionsRef$curren, _isLoading$labelName_;
241
+ return /*#__PURE__*/_jsxs("div", {
242
+ className: "flex items-center",
243
+ children: [/*#__PURE__*/_jsx("div", {
244
+ className: "relative border shadow-sm px-4 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 text-sm flex gap-2 items-center justify-between bg-gray-100 dark:bg-gray-700 rounded-l-md border-gray-300 dark:border-gray-600",
245
+ children: labelName_3
246
+ }), /*#__PURE__*/_jsx(CustomSelect, {
247
+ searchable: true,
248
+ placeholder: "Select value",
249
+ items: transformValuesForSelect((_labelValuesMap$label = labelValuesMap[labelName_3]) !== null && _labelValuesMap$label !== void 0 ? _labelValuesMap$label : []),
250
+ onSelection: function onSelection(value_2) {
251
+ return handleSelection(labelName_3, value_2);
252
+ },
253
+ selectedKey: (_selectionsRef$curren = selectionsRef.current[labelName_3]) !== null && _selectionsRef$curren !== void 0 ? _selectionsRef$curren : undefined,
254
+ className: cx('rounded-l-none border-l-0', selectionsRef.current[labelName_3] != null && 'border-r-0 rounded-r-none'),
255
+ loading: (_isLoading$labelName_ = isLoading[labelName_3]) !== null && _isLoading$labelName_ !== void 0 ? _isLoading$labelName_ : false
256
+ }), selectionsRef.current[labelName_3] != null && /*#__PURE__*/_jsx("button", {
257
+ onClick: function onClick() {
258
+ return handleReset(labelName_3);
259
+ },
260
+ className: "p-2 border-gray-200 bg-white dark:bg-gray-900 dark:border-gray-600 border rounded-r-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",
261
+ "aria-label": "Reset ".concat(labelName_3, " selection"),
262
+ children: /*#__PURE__*/_jsx(Icon, {
263
+ icon: "mdi:close",
264
+ className: "h-5 w-5 text-gray-400",
265
+ "aria-hidden": "true"
266
+ })
267
+ })]
268
+ }, labelName_3);
269
+ })
270
+ }));
124
271
  };
125
- export default PreSelectedMatchers;
272
+ export default PreSelectedMatchers;