@perses-dev/dashboards 0.52.0 → 0.53.0-beta.1

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 (178) hide show
  1. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +0 -2
  2. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -20
  3. package/dist/cjs/components/GridLayout/GridItemContent.js +9 -67
  4. package/dist/cjs/components/GridLayout/GridLayout.js +1 -1
  5. package/dist/cjs/components/LeaveDialog/LeaveDialog.js +10 -1
  6. package/dist/cjs/components/Panel/Panel.js +4 -3
  7. package/dist/cjs/components/Panel/PanelHeader.js +1 -9
  8. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +186 -183
  9. package/dist/cjs/components/PanelDrawer/PanelPreview.js +3 -0
  10. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +6 -21
  11. package/dist/cjs/components/QueryViewerDialog/QueryViewerDialog.js +121 -0
  12. package/dist/cjs/components/QueryViewerDialog/index.js +30 -0
  13. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +18 -6
  14. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +11 -6
  15. package/dist/cjs/components/Variables/ListVariableListBox.js +201 -0
  16. package/dist/cjs/components/Variables/Variable.js +164 -72
  17. package/dist/cjs/components/Variables/VariableList.js +2 -2
  18. package/dist/cjs/components/Variables/index.js +1 -0
  19. package/dist/cjs/components/index.js +2 -1
  20. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +1 -1
  21. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -1
  22. package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +1 -1
  23. package/dist/cjs/context/DashboardProvider/index.js +1 -1
  24. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +1 -1
  25. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +1 -7
  26. package/dist/cjs/context/DashboardProvider/view-panel-slice.js +1 -1
  27. package/dist/cjs/context/DatasourceStoreProvider.js +3 -4
  28. package/dist/cjs/context/PanelEditorProvider/PanelEditorProvider.js +49 -0
  29. package/dist/cjs/context/PanelEditorProvider/index.js +23 -0
  30. package/dist/cjs/context/VariableProvider/VariableProvider.js +1 -1
  31. package/dist/cjs/context/VariableProvider/hydrationUtils.js +1 -1
  32. package/dist/cjs/context/VariableProvider/index.js +1 -1
  33. package/dist/cjs/context/VariableProvider/utils.js +1 -1
  34. package/dist/cjs/context/index.js +1 -0
  35. package/dist/cjs/context/useDashboard.js +1 -1
  36. package/dist/cjs/utils/panelUtils.js +1 -1
  37. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
  38. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +0 -2
  39. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  40. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
  41. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -15
  42. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  43. package/dist/components/GridLayout/GridItemContent.d.ts +1 -1
  44. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  45. package/dist/components/GridLayout/GridItemContent.js +10 -68
  46. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  47. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  48. package/dist/components/GridLayout/GridLayout.js +1 -1
  49. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  50. package/dist/components/GridLayout/Row.d.ts +2 -2
  51. package/dist/components/GridLayout/Row.d.ts.map +1 -1
  52. package/dist/components/GridLayout/Row.js.map +1 -1
  53. package/dist/components/LeaveDialog/LeaveDialog.d.ts +2 -1
  54. package/dist/components/LeaveDialog/LeaveDialog.d.ts.map +1 -1
  55. package/dist/components/LeaveDialog/LeaveDialog.js +10 -1
  56. package/dist/components/LeaveDialog/LeaveDialog.js.map +1 -1
  57. package/dist/components/Panel/Panel.d.ts +1 -2
  58. package/dist/components/Panel/Panel.d.ts.map +1 -1
  59. package/dist/components/Panel/Panel.js +5 -4
  60. package/dist/components/Panel/Panel.js.map +1 -1
  61. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  62. package/dist/components/Panel/PanelHeader.js +2 -10
  63. package/dist/components/Panel/PanelHeader.js.map +1 -1
  64. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  65. package/dist/components/PanelDrawer/PanelEditorForm.js +186 -183
  66. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  67. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  68. package/dist/components/PanelDrawer/PanelPreview.js +4 -1
  69. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  70. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  71. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +5 -15
  72. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  73. package/dist/components/QueryViewerDialog/QueryViewerDialog.d.ts +9 -0
  74. package/dist/components/QueryViewerDialog/QueryViewerDialog.d.ts.map +1 -0
  75. package/dist/components/QueryViewerDialog/QueryViewerDialog.js +72 -0
  76. package/dist/components/QueryViewerDialog/QueryViewerDialog.js.map +1 -0
  77. package/dist/components/QueryViewerDialog/index.d.ts +2 -0
  78. package/dist/components/QueryViewerDialog/index.d.ts.map +1 -0
  79. package/dist/components/QueryViewerDialog/index.js +15 -0
  80. package/dist/components/QueryViewerDialog/index.js.map +1 -0
  81. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
  82. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +19 -7
  83. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  84. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
  85. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +11 -6
  86. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  87. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  88. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  89. package/dist/components/Variables/ListVariableListBox.d.ts +16 -0
  90. package/dist/components/Variables/ListVariableListBox.d.ts.map +1 -0
  91. package/dist/components/Variables/ListVariableListBox.js +141 -0
  92. package/dist/components/Variables/ListVariableListBox.js.map +1 -0
  93. package/dist/components/Variables/Variable.d.ts.map +1 -1
  94. package/dist/components/Variables/Variable.js +168 -75
  95. package/dist/components/Variables/Variable.js.map +1 -1
  96. package/dist/components/Variables/VariableEditor.d.ts +1 -2
  97. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  98. package/dist/components/Variables/VariableEditor.js.map +1 -1
  99. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  100. package/dist/components/Variables/VariableList.js +2 -2
  101. package/dist/components/Variables/VariableList.js.map +1 -1
  102. package/dist/components/Variables/index.d.ts +1 -0
  103. package/dist/components/Variables/index.d.ts.map +1 -1
  104. package/dist/components/Variables/index.js +1 -0
  105. package/dist/components/Variables/index.js.map +1 -1
  106. package/dist/components/index.d.ts +2 -1
  107. package/dist/components/index.d.ts.map +1 -1
  108. package/dist/components/index.js +2 -1
  109. package/dist/components/index.js.map +1 -1
  110. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +1 -2
  111. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  112. package/dist/context/DashboardProvider/dashboard-provider-api.js +1 -1
  113. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  114. package/dist/context/DashboardProvider/delete-panel-slice.d.ts +2 -1
  115. package/dist/context/DashboardProvider/delete-panel-slice.d.ts.map +1 -1
  116. package/dist/context/DashboardProvider/delete-panel-slice.js +1 -1
  117. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  118. package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts +2 -1
  119. package/dist/context/DashboardProvider/duplicate-panel-slice.d.ts.map +1 -1
  120. package/dist/context/DashboardProvider/duplicate-panel-slice.js +1 -1
  121. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  122. package/dist/context/DashboardProvider/index.d.ts +0 -1
  123. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  124. package/dist/context/DashboardProvider/index.js +1 -1
  125. package/dist/context/DashboardProvider/index.js.map +1 -1
  126. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -2
  127. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  128. package/dist/context/DashboardProvider/panel-editor-slice.js +1 -1
  129. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  130. package/dist/context/DashboardProvider/panel-group-slice.d.ts +1 -24
  131. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  132. package/dist/context/DashboardProvider/panel-group-slice.js +1 -6
  133. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  134. package/dist/context/DashboardProvider/save-changes-dialog-slice.d.ts +2 -1
  135. package/dist/context/DashboardProvider/save-changes-dialog-slice.d.ts.map +1 -1
  136. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
  137. package/dist/context/DashboardProvider/view-panel-slice.d.ts +1 -1
  138. package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -1
  139. package/dist/context/DashboardProvider/view-panel-slice.js +1 -1
  140. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
  141. package/dist/context/DatasourceStoreProvider.d.ts +1 -17
  142. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  143. package/dist/context/DatasourceStoreProvider.js +2 -3
  144. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  145. package/dist/context/PanelEditorProvider/PanelEditorProvider.d.ts +13 -0
  146. package/dist/context/PanelEditorProvider/PanelEditorProvider.d.ts.map +1 -0
  147. package/dist/context/PanelEditorProvider/PanelEditorProvider.js +33 -0
  148. package/dist/context/PanelEditorProvider/PanelEditorProvider.js.map +1 -0
  149. package/dist/context/PanelEditorProvider/index.d.ts +3 -0
  150. package/dist/context/PanelEditorProvider/index.d.ts.map +1 -0
  151. package/dist/context/PanelEditorProvider/index.js +16 -0
  152. package/dist/context/PanelEditorProvider/index.js.map +1 -0
  153. package/dist/context/VariableProvider/VariableProvider.d.ts +1 -10
  154. package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -1
  155. package/dist/context/VariableProvider/VariableProvider.js +1 -1
  156. package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
  157. package/dist/context/VariableProvider/hydrationUtils.d.ts +1 -2
  158. package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -1
  159. package/dist/context/VariableProvider/hydrationUtils.js +1 -1
  160. package/dist/context/VariableProvider/hydrationUtils.js.map +1 -1
  161. package/dist/context/VariableProvider/index.js +1 -1
  162. package/dist/context/VariableProvider/index.js.map +1 -1
  163. package/dist/context/VariableProvider/utils.d.ts +1 -2
  164. package/dist/context/VariableProvider/utils.d.ts.map +1 -1
  165. package/dist/context/VariableProvider/utils.js +1 -1
  166. package/dist/context/VariableProvider/utils.js.map +1 -1
  167. package/dist/context/index.d.ts +1 -0
  168. package/dist/context/index.d.ts.map +1 -1
  169. package/dist/context/index.js +1 -0
  170. package/dist/context/index.js.map +1 -1
  171. package/dist/context/useDashboard.d.ts.map +1 -1
  172. package/dist/context/useDashboard.js +1 -1
  173. package/dist/context/useDashboard.js.map +1 -1
  174. package/dist/utils/panelUtils.d.ts +1 -2
  175. package/dist/utils/panelUtils.d.ts.map +1 -1
  176. package/dist/utils/panelUtils.js +1 -1
  177. package/dist/utils/panelUtils.js.map +1 -1
  178. package/package.json +5 -5
@@ -35,6 +35,7 @@ const _core = require("@perses-dev/core");
35
35
  const _pluginsystem = require("@perses-dev/plugin-system");
36
36
  const _context = require("../../context");
37
37
  const _constants = require("../../constants");
38
+ const _ListVariableListBox = require("./ListVariableListBox");
38
39
  function variableOptionToVariableValue(options) {
39
40
  if (options === null) {
40
41
  return null;
@@ -91,22 +92,8 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
91
92
  ...options
92
93
  ] : [];
93
94
  if (!sort || sort === 'none') return opts;
94
- switch(sort){
95
- case 'alphabetical-asc':
96
- return opts.sort((a, b)=>a.label > b.label ? 1 : -1);
97
- case 'alphabetical-desc':
98
- return opts.sort((a, b)=>a.label > b.label ? -1 : 1);
99
- case 'numerical-asc':
100
- return opts.sort((a, b)=>parseInt(a.label) > parseInt(b.label) ? 1 : -1);
101
- case 'numerical-desc':
102
- return opts.sort((a, b)=>parseInt(a.label) < parseInt(b.label) ? 1 : -1);
103
- case 'alphabetical-ci-asc':
104
- return opts.sort((a, b)=>a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1);
105
- case 'alphabetical-ci-desc':
106
- return opts.sort((a, b)=>a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1);
107
- default:
108
- return opts;
109
- }
95
+ const sortMethod = _pluginsystem.SORT_METHODS[sort];
96
+ return !sortMethod ? opts : sortMethod.sort(opts);
110
97
  }, [
111
98
  options,
112
99
  sort
@@ -214,6 +201,15 @@ function ListVariable({ name, source }) {
214
201
  const title = definition?.spec.display?.name ?? name;
215
202
  const allowMultiple = definition?.spec.allowMultiple === true;
216
203
  const allowAllValue = definition?.spec.allowAllValue === true;
204
+ const filterOptions = (0, _material.createFilterOptions)({});
205
+ const filteredOptions = (0, _react.useMemo)(()=>filterOptions(viewOptions, {
206
+ inputValue,
207
+ getOptionLabel: (o)=>o.label
208
+ }), [
209
+ inputValue,
210
+ viewOptions,
211
+ filterOptions
212
+ ]);
217
213
  // Update value when changed
218
214
  (0, _react.useEffect)(()=>{
219
215
  if (value) {
@@ -245,64 +241,160 @@ function ListVariable({ name, source }) {
245
241
  options,
246
242
  source
247
243
  ]);
248
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
249
- children: [
250
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Autocomplete, {
251
- disablePortal: true,
252
- disableCloseOnSelect: allowMultiple,
253
- multiple: allowMultiple,
254
- fullWidth: true,
255
- limitTags: 3,
256
- size: "small",
257
- disableClearable: true,
258
- slots: {
259
- popper: StyledPopper
260
- },
261
- renderInput: (params)=>{
262
- return allowMultiple ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
263
- ...params,
264
- label: title,
265
- onChange: (e)=>setInputValue(e.target.value)
266
- }) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
267
- ...params,
268
- label: title,
269
- style: {
270
- width: `${inputWidth}px`
271
- }
272
- });
273
- },
274
- sx: {
275
- '& .MuiInputBase-root': {
276
- minHeight: '38px'
277
- },
278
- '& .MuiAutocomplete-tag': {
279
- margin: '1px 2px'
280
- }
281
- },
282
- value: selectedOptions,
283
- onChange: (_, value)=>{
284
- if ((value === null || Array.isArray(value) && value.length === 0) && allowAllValue) {
285
- setVariableValue(name, _core.DEFAULT_ALL_VALUE, source);
286
- } else {
287
- setVariableValue(name, variableOptionToVariableValue(value), source);
288
- }
289
- },
290
- inputValue: allowMultiple ? inputValue : undefined,
291
- onInputChange: (_, newInputValue)=>{
292
- if (!allowMultiple) {
293
- setInputWidth(getWidthPx(newInputValue, 'list'));
294
- }
244
+ const handleGlobalSelect = (0, _react.useCallback)((options)=>{
245
+ setVariableValue(name, variableOptionToVariableValue(options), source);
246
+ }, [
247
+ name,
248
+ setVariableValue,
249
+ source
250
+ ]);
251
+ const listBoxProviderValue = (0, _react.useMemo)(()=>({
252
+ options: viewOptions,
253
+ selectedOptions: selectedOptions,
254
+ filteredOptions: filteredOptions,
255
+ allowAllValue,
256
+ onChange: handleGlobalSelect
257
+ }), [
258
+ allowAllValue,
259
+ filteredOptions,
260
+ handleGlobalSelect,
261
+ selectedOptions,
262
+ viewOptions
263
+ ]);
264
+ const autocompleteComponent = (0, _react.useMemo)(()=>{
265
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Autocomplete, {
266
+ disablePortal: true,
267
+ loading: loading,
268
+ disableCloseOnSelect: allowMultiple,
269
+ multiple: allowMultiple,
270
+ fullWidth: true,
271
+ limitTags: 3,
272
+ size: "small",
273
+ disableClearable: true,
274
+ slotProps: {
275
+ listbox: {
276
+ component: allowMultiple ? _ListVariableListBox.ListVariableListBox : undefined
277
+ }
278
+ },
279
+ slots: {
280
+ popper: StyledPopper
281
+ },
282
+ sx: {
283
+ '& .MuiInputBase-root': {
284
+ minHeight: '38px'
295
285
  },
296
- onBlur: ()=>{
297
- if (allowMultiple) {
298
- setInputValue('');
286
+ '& .MuiAutocomplete-tag': {
287
+ margin: '1px 2px'
288
+ }
289
+ },
290
+ filterOptions: filterOptions,
291
+ options: viewOptions,
292
+ value: selectedOptions,
293
+ onChange: (_, value)=>{
294
+ if ((value === null || Array.isArray(value) && value.length === 0) && allowAllValue) {
295
+ setVariableValue(name, _core.DEFAULT_ALL_VALUE, source);
296
+ } else {
297
+ setVariableValue(name, variableOptionToVariableValue(value), source);
298
+ }
299
+ },
300
+ inputValue: allowMultiple ? inputValue : undefined,
301
+ onInputChange: (_, newInputValue)=>{
302
+ if (!allowMultiple) {
303
+ setInputWidth(getWidthPx(newInputValue, 'list'));
304
+ }
305
+ },
306
+ onBlur: ()=>{
307
+ if (allowMultiple) {
308
+ setInputValue('');
309
+ }
310
+ },
311
+ renderInput: (params)=>{
312
+ return allowMultiple ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
313
+ ...params,
314
+ label: title,
315
+ onChange: (e)=>setInputValue(e.target.value)
316
+ }) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
317
+ ...params,
318
+ label: title,
319
+ style: {
320
+ width: `${inputWidth}px`
299
321
  }
300
- },
301
- options: viewOptions
302
- }),
303
- loading && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.LinearProgress, {})
304
- ]
305
- });
322
+ });
323
+ },
324
+ renderOption: (props, option, { selected })=>{
325
+ const { key, ...optionProps } = props;
326
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
327
+ ...optionProps,
328
+ style: {
329
+ padding: 0
330
+ },
331
+ children: [
332
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
333
+ style: {
334
+ marginRight: 8
335
+ },
336
+ checked: selected
337
+ }),
338
+ option.label
339
+ ]
340
+ }, key);
341
+ },
342
+ renderTags: (value, getTagProps, ownerState)=>{
343
+ // When focused, if there are too much value selected, it will use all screen place. Putting limit to 200px (~6 lines of chips)
344
+ if (ownerState.focused) {
345
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
346
+ sx: {
347
+ maxHeight: 200,
348
+ overflowY: 'auto'
349
+ },
350
+ children: value.map((option, index)=>/*#__PURE__*/ (0, _react.createElement)(_material.Chip, {
351
+ ...getTagProps({
352
+ index
353
+ }),
354
+ key: index,
355
+ label: option.label,
356
+ size: "small"
357
+ }))
358
+ });
359
+ }
360
+ const limitTags = ownerState.limitTags;
361
+ const numTags = value.length;
362
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
363
+ children: [
364
+ value.slice(0, limitTags).map((option, index)=>/*#__PURE__*/ (0, _react.createElement)(_material.Chip, {
365
+ ...getTagProps({
366
+ index
367
+ }),
368
+ key: index,
369
+ label: option.label,
370
+ size: "small"
371
+ })),
372
+ limitTags && numTags > limitTags && ` +${numTags - limitTags}`
373
+ ]
374
+ });
375
+ }
376
+ });
377
+ }, [
378
+ allowAllValue,
379
+ allowMultiple,
380
+ filterOptions,
381
+ inputValue,
382
+ inputWidth,
383
+ loading,
384
+ name,
385
+ selectedOptions,
386
+ setVariableValue,
387
+ source,
388
+ title,
389
+ viewOptions
390
+ ]);
391
+ if (allowMultiple) {
392
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ListVariableListBox.ListVariableListBoxProvider, {
393
+ value: listBoxProviderValue,
394
+ children: autocompleteComponent
395
+ });
396
+ }
397
+ return autocompleteComponent;
306
398
  }
307
399
  function TextVariable({ name, source }) {
308
400
  const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
@@ -63,6 +63,6 @@ function VariableListItem({ spec, source }) {
63
63
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Variable.Variable, {
64
64
  name: spec.name,
65
65
  source: source
66
- }, (spec.name + source) ?? '')
67
- }, (spec.name + source) ?? '');
66
+ }, spec.name + (source ?? ''))
67
+ }, spec.name + (source ?? ''));
68
68
  }
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", {
16
16
  });
17
17
  _export_star(require("./BuiltinVariableAccordions"), exports);
18
18
  _export_star(require("./EditVariablesButton"), exports);
19
+ _export_star(require("./ListVariableListBox"), exports);
19
20
  _export_star(require("./Variable"), exports);
20
21
  _export_star(require("./VariableEditor"), exports);
21
22
  _export_star(require("./VariableList"), exports);
@@ -24,8 +24,8 @@ _export_star(require("./DeletePanelDialog"), exports);
24
24
  _export_star(require("./DeletePanelGroupDialog"), exports);
25
25
  _export_star(require("./DiscardChangesConfirmationDialog"), exports);
26
26
  _export_star(require("./DownloadButton"), exports);
27
- _export_star(require("./EditJsonButton"), exports);
28
27
  _export_star(require("./EditJsonDialog"), exports);
28
+ _export_star(require("./EditJsonButton"), exports);
29
29
  _export_star(require("./EmptyDashboard"), exports);
30
30
  _export_star(require("./GridLayout"), exports);
31
31
  _export_star(require("./LeaveDialog"), exports);
@@ -33,6 +33,7 @@ _export_star(require("./Panel"), exports);
33
33
  _export_star(require("./PanelDrawer"), exports);
34
34
  _export_star(require("./PanelGroupDialog"), exports);
35
35
  _export_star(require("./QuerySummaryTable"), exports);
36
+ _export_star(require("./QueryViewerDialog"), exports);
36
37
  _export_star(require("./SaveChangesConfirmationDialog"), exports);
37
38
  _export_star(require("./SaveDashboardButton"), exports);
38
39
  _export_star(require("./Variables"), exports);
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -32,16 +32,10 @@ _export(exports, {
32
32
  },
33
33
  createPanelGroupSlice: function() {
34
34
  return createPanelGroupSlice;
35
- },
36
- isPanelGroupItemIdEqual: function() {
37
- return isPanelGroupItemIdEqual;
38
35
  }
39
36
  });
40
37
  const _core = require("@perses-dev/core");
41
38
  const _common = require("./common");
42
- function isPanelGroupItemIdEqual(a, b) {
43
- return a?.panelGroupId === b?.panelGroupId && a?.panelGroupItemLayoutId === b?.panelGroupItemLayoutId;
44
- }
45
39
  function createPanelGroupSlice(layouts) {
46
40
  const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);
47
41
  // Return the state creator function for Zustand
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -22,7 +22,6 @@ Object.defineProperty(exports, "DatasourceStoreProvider", {
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
24
24
  const _react = require("react");
25
- const _core = require("@perses-dev/core");
26
25
  const _pluginsystem = require("@perses-dev/plugin-system");
27
26
  function DatasourceStoreProvider(props) {
28
27
  const { projectName, datasourceApi, onCreate, children } = props;
@@ -30,7 +29,7 @@ function DatasourceStoreProvider(props) {
30
29
  const [savedDatasources, setSavedDatasources] = (0, _react.useState)(props.savedDatasources ?? {});
31
30
  const project = projectName ?? dashboardResource?.metadata.project;
32
31
  const { getPlugin, listPluginMetadata } = (0, _pluginsystem.usePluginRegistry)();
33
- const findDatasource = (0, _core.useEvent)(async (selector)=>{
32
+ const findDatasource = (0, _pluginsystem.useEvent)(async (selector)=>{
34
33
  // Try to find it in dashboard spec
35
34
  if (dashboardResource) {
36
35
  const { datasources } = dashboardResource.spec;
@@ -98,7 +97,7 @@ function DatasourceStoreProvider(props) {
98
97
  getPlugin,
99
98
  onCreate
100
99
  ]);
101
- const listDatasourceSelectItems = (0, _core.useEvent)(async (datasourcePluginName)=>{
100
+ const listDatasourceSelectItems = (0, _pluginsystem.useEvent)(async (datasourcePluginName)=>{
102
101
  const [pluginMetadata, datasources, globalDatasources] = await Promise.all([
103
102
  listPluginMetadata([
104
103
  'Datasource'
@@ -0,0 +1,49 @@
1
+ // Copyright 2025 The Perses 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ PanelEditorContext: function() {
25
+ return PanelEditorContext;
26
+ },
27
+ PanelEditorProvider: function() {
28
+ return PanelEditorProvider;
29
+ }
30
+ });
31
+ const _jsxruntime = require("react/jsx-runtime");
32
+ const _react = require("react");
33
+ const PanelEditorContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
34
+ const PanelEditorProvider = ({ children })=>{
35
+ const [previewPanelWidth, setPreviewPanelWidth] = (0, _react.useState)(undefined);
36
+ const ctx = (0, _react.useMemo)(()=>({
37
+ preview: {
38
+ previewPanelWidth,
39
+ setPreviewPanelWidth
40
+ }
41
+ }), [
42
+ previewPanelWidth,
43
+ setPreviewPanelWidth
44
+ ]);
45
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(PanelEditorContext.Provider, {
46
+ value: ctx,
47
+ children: children
48
+ });
49
+ };
@@ -0,0 +1,23 @@
1
+ // Copyright 2025 The Perses 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.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "PanelEditorContext", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return _PanelEditorProvider.PanelEditorContext;
21
+ }
22
+ });
23
+ const _PanelEditorProvider = require("./PanelEditorProvider");
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -18,6 +18,7 @@ _export_star(require("./DashboardProvider"), exports);
18
18
  _export_star(require("./DatasourceStoreProvider"), exports);
19
19
  _export_star(require("./VariableProvider"), exports);
20
20
  _export_star(require("./useDashboard"), exports);
21
+ _export_star(require("./PanelEditorProvider"), exports);
21
22
  function _export_star(from, to) {
22
23
  Object.keys(from).forEach(function(k) {
23
24
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardStickyToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardStickyToolbar/DashboardStickyToolbar.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAC/C,OAAO,EAKL,OAAO,EACP,KAAK,EAIN,MAAM,eAAe,CAAC;AAMvB,UAAU,2BAA2B;IACnC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,YAAY,CAuEvF"}
1
+ {"version":3,"file":"DashboardStickyToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DashboardStickyToolbar/DashboardStickyToolbar.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAC/C,OAAO,EAKL,OAAO,EACP,KAAK,EAIN,MAAM,eAAe,CAAC;AAMvB,UAAU,2BAA2B;IACnC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,YAAY,CAsEvF"}
@@ -48,8 +48,6 @@ export function DashboardStickyToolbar(props) {
48
48
  display: "flex",
49
49
  flexWrap: !isSticky && isBiggerThanMd ? 'wrap' : 'nowrap',
50
50
  maxWidth: isSticky || !isBiggerThanMd ? '100vw' : '100%',
51
- maxHeight: "150px" // Limit the vertical space used to ~3 rows of variables
52
- ,
53
51
  pt: 1,
54
52
  pl: isSticky ? 1 : 0,
55
53
  mt: isSticky && isBiggerThanMd ? 0.5 : 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DashboardStickyToolbar/DashboardStickyToolbar.tsx"],"sourcesContent":["// Copyright 2024 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 { ReactElement, useState } from 'react';\nimport {\n AppBar,\n Box,\n IconButton,\n Stack,\n SxProps,\n Theme,\n useMediaQuery,\n useScrollTrigger,\n useTheme,\n} from '@mui/material';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport PinOffOutline from 'mdi-material-ui/PinOffOutline';\nimport { TimeRangeControls } from '@perses-dev/plugin-system';\nimport { VariableList } from '../Variables';\n\ninterface DashboardStickyToolbarProps {\n initialVariableIsSticky?: boolean;\n sx?: SxProps<Theme>;\n}\n\nexport function DashboardStickyToolbar(props: DashboardStickyToolbarProps): ReactElement {\n const [isPin, setIsPin] = useState(props.initialVariableIsSticky);\n\n const scrollTrigger = useScrollTrigger({ disableHysteresis: true });\n const isSticky = scrollTrigger && props.initialVariableIsSticky && isPin;\n\n const isBiggerThanMd = useMediaQuery(useTheme().breakpoints.up('md'));\n\n return (\n // marginBottom={-1} counteracts the marginBottom={1} on every variable input.\n // The margin on the inputs is for spacing between inputs, but is not meant to add space to bottom of the container.\n <Box marginBottom={-1} data-testid=\"variable-list\">\n <AppBar\n color=\"inherit\"\n position={isSticky ? 'fixed' : 'static'}\n elevation={isSticky ? 4 : 0}\n sx={{ backgroundColor: 'inherit', ...props.sx }}\n >\n <Box\n display=\"flex\"\n justifyContent=\"space-between\"\n sx={{\n flexDirection: isBiggerThanMd ? 'row' : 'column',\n }}\n >\n <Box\n display=\"flex\"\n flexWrap={!isSticky && isBiggerThanMd ? 'wrap' : 'nowrap'}\n maxWidth={isSticky || !isBiggerThanMd ? '100vw' : '100%'}\n maxHeight=\"150px\" // Limit the vertical space used to ~3 rows of variables\n pt={1}\n pl={isSticky ? 1 : 0}\n mt={isSticky && isBiggerThanMd ? 0.5 : 0}\n ml={isSticky && isBiggerThanMd ? 0.5 : 0}\n sx={{\n overflowX: !isSticky && isBiggerThanMd ? 'hidden' : 'auto',\n // Firefox:\n scrollbarWidth: 'thin',\n // Safari and Chrome:\n '&::-webkit-scrollbar': {\n height: '8px',\n backgroundColor: (theme) => theme.palette.grey['300'],\n },\n '&::-webkit-scrollbar-thumb': {\n background: (theme) => theme.palette.grey['600'],\n },\n }}\n gap={1}\n >\n <VariableList />\n {props.initialVariableIsSticky && (\n <IconButton style={{ width: 'fit-content', height: 'fit-content' }} onClick={() => setIsPin(!isPin)}>\n {isPin ? <PinOutline /> : <PinOffOutline />}\n </IconButton>\n )}\n </Box>\n {isSticky && (\n <Stack\n m={isBiggerThanMd ? 1.5 : 1}\n mt={isBiggerThanMd ? 1.5 : 0}\n ml={isBiggerThanMd ? 1.5 : 'auto'}\n direction=\"row\"\n justifyContent=\"end\"\n >\n <TimeRangeControls />\n </Stack>\n )}\n </Box>\n </AppBar>\n </Box>\n );\n}\n"],"names":["useState","AppBar","Box","IconButton","Stack","useMediaQuery","useScrollTrigger","useTheme","PinOutline","PinOffOutline","TimeRangeControls","VariableList","DashboardStickyToolbar","props","isPin","setIsPin","initialVariableIsSticky","scrollTrigger","disableHysteresis","isSticky","isBiggerThanMd","breakpoints","up","marginBottom","data-testid","color","position","elevation","sx","backgroundColor","display","justifyContent","flexDirection","flexWrap","maxWidth","maxHeight","pt","pl","mt","ml","overflowX","scrollbarWidth","height","theme","palette","grey","background","gap","style","width","onClick","m","direction"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,QAAQ,QAAQ,QAAQ;AAC/C,SACEC,MAAM,EACNC,GAAG,EACHC,UAAU,EACVC,KAAK,EAGLC,aAAa,EACbC,gBAAgB,EAChBC,QAAQ,QACH,gBAAgB;AACvB,OAAOC,gBAAgB,6BAA6B;AACpD,OAAOC,mBAAmB,gCAAgC;AAC1D,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,YAAY,QAAQ,eAAe;AAO5C,OAAO,SAASC,uBAAuBC,KAAkC;IACvE,MAAM,CAACC,OAAOC,SAAS,GAAGf,SAASa,MAAMG,uBAAuB;IAEhE,MAAMC,gBAAgBX,iBAAiB;QAAEY,mBAAmB;IAAK;IACjE,MAAMC,WAAWF,iBAAiBJ,MAAMG,uBAAuB,IAAIF;IAEnE,MAAMM,iBAAiBf,cAAcE,WAAWc,WAAW,CAACC,EAAE,CAAC;IAE/D,OACE,8EAA8E;IAC9E,oHAAoH;kBACpH,KAACpB;QAAIqB,cAAc,CAAC;QAAGC,eAAY;kBACjC,cAAA,KAACvB;YACCwB,OAAM;YACNC,UAAUP,WAAW,UAAU;YAC/BQ,WAAWR,WAAW,IAAI;YAC1BS,IAAI;gBAAEC,iBAAiB;gBAAW,GAAGhB,MAAMe,EAAE;YAAC;sBAE9C,cAAA,MAAC1B;gBACC4B,SAAQ;gBACRC,gBAAe;gBACfH,IAAI;oBACFI,eAAeZ,iBAAiB,QAAQ;gBAC1C;;kCAEA,MAAClB;wBACC4B,SAAQ;wBACRG,UAAU,CAACd,YAAYC,iBAAiB,SAAS;wBACjDc,UAAUf,YAAY,CAACC,iBAAiB,UAAU;wBAClDe,WAAU,QAAQ,wDAAwD;;wBAC1EC,IAAI;wBACJC,IAAIlB,WAAW,IAAI;wBACnBmB,IAAInB,YAAYC,iBAAiB,MAAM;wBACvCmB,IAAIpB,YAAYC,iBAAiB,MAAM;wBACvCQ,IAAI;4BACFY,WAAW,CAACrB,YAAYC,iBAAiB,WAAW;4BACpD,WAAW;4BACXqB,gBAAgB;4BAChB,qBAAqB;4BACrB,wBAAwB;gCACtBC,QAAQ;gCACRb,iBAAiB,CAACc,QAAUA,MAAMC,OAAO,CAACC,IAAI,CAAC,MAAM;4BACvD;4BACA,8BAA8B;gCAC5BC,YAAY,CAACH,QAAUA,MAAMC,OAAO,CAACC,IAAI,CAAC,MAAM;4BAClD;wBACF;wBACAE,KAAK;;0CAEL,KAACpC;4BACAE,MAAMG,uBAAuB,kBAC5B,KAACb;gCAAW6C,OAAO;oCAAEC,OAAO;oCAAeP,QAAQ;gCAAc;gCAAGQ,SAAS,IAAMnC,SAAS,CAACD;0CAC1FA,sBAAQ,KAACN,gCAAgB,KAACC;;;;oBAIhCU,0BACC,KAACf;wBACC+C,GAAG/B,iBAAiB,MAAM;wBAC1BkB,IAAIlB,iBAAiB,MAAM;wBAC3BmB,IAAInB,iBAAiB,MAAM;wBAC3BgC,WAAU;wBACVrB,gBAAe;kCAEf,cAAA,KAACrB;;;;;;AAOf"}
1
+ {"version":3,"sources":["../../../src/components/DashboardStickyToolbar/DashboardStickyToolbar.tsx"],"sourcesContent":["// Copyright 2024 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 { ReactElement, useState } from 'react';\nimport {\n AppBar,\n Box,\n IconButton,\n Stack,\n SxProps,\n Theme,\n useMediaQuery,\n useScrollTrigger,\n useTheme,\n} from '@mui/material';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport PinOffOutline from 'mdi-material-ui/PinOffOutline';\nimport { TimeRangeControls } from '@perses-dev/plugin-system';\nimport { VariableList } from '../Variables';\n\ninterface DashboardStickyToolbarProps {\n initialVariableIsSticky?: boolean;\n sx?: SxProps<Theme>;\n}\n\nexport function DashboardStickyToolbar(props: DashboardStickyToolbarProps): ReactElement {\n const [isPin, setIsPin] = useState(props.initialVariableIsSticky);\n\n const scrollTrigger = useScrollTrigger({ disableHysteresis: true });\n const isSticky = scrollTrigger && props.initialVariableIsSticky && isPin;\n\n const isBiggerThanMd = useMediaQuery(useTheme().breakpoints.up('md'));\n\n return (\n // marginBottom={-1} counteracts the marginBottom={1} on every variable input.\n // The margin on the inputs is for spacing between inputs, but is not meant to add space to bottom of the container.\n <Box marginBottom={-1} data-testid=\"variable-list\">\n <AppBar\n color=\"inherit\"\n position={isSticky ? 'fixed' : 'static'}\n elevation={isSticky ? 4 : 0}\n sx={{ backgroundColor: 'inherit', ...props.sx }}\n >\n <Box\n display=\"flex\"\n justifyContent=\"space-between\"\n sx={{\n flexDirection: isBiggerThanMd ? 'row' : 'column',\n }}\n >\n <Box\n display=\"flex\"\n flexWrap={!isSticky && isBiggerThanMd ? 'wrap' : 'nowrap'}\n maxWidth={isSticky || !isBiggerThanMd ? '100vw' : '100%'}\n pt={1}\n pl={isSticky ? 1 : 0}\n mt={isSticky && isBiggerThanMd ? 0.5 : 0}\n ml={isSticky && isBiggerThanMd ? 0.5 : 0}\n sx={{\n overflowX: !isSticky && isBiggerThanMd ? 'hidden' : 'auto',\n // Firefox:\n scrollbarWidth: 'thin',\n // Safari and Chrome:\n '&::-webkit-scrollbar': {\n height: '8px',\n backgroundColor: (theme) => theme.palette.grey['300'],\n },\n '&::-webkit-scrollbar-thumb': {\n background: (theme) => theme.palette.grey['600'],\n },\n }}\n gap={1}\n >\n <VariableList />\n {props.initialVariableIsSticky && (\n <IconButton style={{ width: 'fit-content', height: 'fit-content' }} onClick={() => setIsPin(!isPin)}>\n {isPin ? <PinOutline /> : <PinOffOutline />}\n </IconButton>\n )}\n </Box>\n {isSticky && (\n <Stack\n m={isBiggerThanMd ? 1.5 : 1}\n mt={isBiggerThanMd ? 1.5 : 0}\n ml={isBiggerThanMd ? 1.5 : 'auto'}\n direction=\"row\"\n justifyContent=\"end\"\n >\n <TimeRangeControls />\n </Stack>\n )}\n </Box>\n </AppBar>\n </Box>\n );\n}\n"],"names":["useState","AppBar","Box","IconButton","Stack","useMediaQuery","useScrollTrigger","useTheme","PinOutline","PinOffOutline","TimeRangeControls","VariableList","DashboardStickyToolbar","props","isPin","setIsPin","initialVariableIsSticky","scrollTrigger","disableHysteresis","isSticky","isBiggerThanMd","breakpoints","up","marginBottom","data-testid","color","position","elevation","sx","backgroundColor","display","justifyContent","flexDirection","flexWrap","maxWidth","pt","pl","mt","ml","overflowX","scrollbarWidth","height","theme","palette","grey","background","gap","style","width","onClick","m","direction"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,QAAQ,QAAQ,QAAQ;AAC/C,SACEC,MAAM,EACNC,GAAG,EACHC,UAAU,EACVC,KAAK,EAGLC,aAAa,EACbC,gBAAgB,EAChBC,QAAQ,QACH,gBAAgB;AACvB,OAAOC,gBAAgB,6BAA6B;AACpD,OAAOC,mBAAmB,gCAAgC;AAC1D,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,YAAY,QAAQ,eAAe;AAO5C,OAAO,SAASC,uBAAuBC,KAAkC;IACvE,MAAM,CAACC,OAAOC,SAAS,GAAGf,SAASa,MAAMG,uBAAuB;IAEhE,MAAMC,gBAAgBX,iBAAiB;QAAEY,mBAAmB;IAAK;IACjE,MAAMC,WAAWF,iBAAiBJ,MAAMG,uBAAuB,IAAIF;IAEnE,MAAMM,iBAAiBf,cAAcE,WAAWc,WAAW,CAACC,EAAE,CAAC;IAE/D,OACE,8EAA8E;IAC9E,oHAAoH;kBACpH,KAACpB;QAAIqB,cAAc,CAAC;QAAGC,eAAY;kBACjC,cAAA,KAACvB;YACCwB,OAAM;YACNC,UAAUP,WAAW,UAAU;YAC/BQ,WAAWR,WAAW,IAAI;YAC1BS,IAAI;gBAAEC,iBAAiB;gBAAW,GAAGhB,MAAMe,EAAE;YAAC;sBAE9C,cAAA,MAAC1B;gBACC4B,SAAQ;gBACRC,gBAAe;gBACfH,IAAI;oBACFI,eAAeZ,iBAAiB,QAAQ;gBAC1C;;kCAEA,MAAClB;wBACC4B,SAAQ;wBACRG,UAAU,CAACd,YAAYC,iBAAiB,SAAS;wBACjDc,UAAUf,YAAY,CAACC,iBAAiB,UAAU;wBAClDe,IAAI;wBACJC,IAAIjB,WAAW,IAAI;wBACnBkB,IAAIlB,YAAYC,iBAAiB,MAAM;wBACvCkB,IAAInB,YAAYC,iBAAiB,MAAM;wBACvCQ,IAAI;4BACFW,WAAW,CAACpB,YAAYC,iBAAiB,WAAW;4BACpD,WAAW;4BACXoB,gBAAgB;4BAChB,qBAAqB;4BACrB,wBAAwB;gCACtBC,QAAQ;gCACRZ,iBAAiB,CAACa,QAAUA,MAAMC,OAAO,CAACC,IAAI,CAAC,MAAM;4BACvD;4BACA,8BAA8B;gCAC5BC,YAAY,CAACH,QAAUA,MAAMC,OAAO,CAACC,IAAI,CAAC,MAAM;4BAClD;wBACF;wBACAE,KAAK;;0CAEL,KAACnC;4BACAE,MAAMG,uBAAuB,kBAC5B,KAACb;gCAAW4C,OAAO;oCAAEC,OAAO;oCAAeP,QAAQ;gCAAc;gCAAGQ,SAAS,IAAMlC,SAAS,CAACD;0CAC1FA,sBAAQ,KAACN,gCAAgB,KAACC;;;;oBAIhCU,0BACC,KAACf;wBACC8C,GAAG9B,iBAAiB,MAAM;wBAC1BiB,IAAIjB,iBAAiB,MAAM;wBAC3BkB,IAAIlB,iBAAiB,MAAM;wBAC3B+B,WAAU;wBACVpB,gBAAe;kCAEf,cAAA,KAACrB;;;;;;AAOf"}
@@ -1 +1 @@
1
- {"version":3,"file":"DeletePanelGroupDialog.d.ts","sourceRoot":"","sources":["../../../src/components/DeletePanelGroupDialog/DeletePanelGroupDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAa,YAAY,EAAE,MAAM,OAAO,CAAC;AAKhD,eAAO,MAAM,sBAAsB,QAAO,YA6CzC,CAAC"}
1
+ {"version":3,"file":"DeletePanelGroupDialog.d.ts","sourceRoot":"","sources":["../../../src/components/DeletePanelGroupDialog/DeletePanelGroupDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAa,YAAY,EAAE,MAAM,OAAO,CAAC;AAKhD,eAAO,MAAM,sBAAsB,QAAO,YAmCzC,CAAC"}
@@ -11,8 +11,8 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@mui/material';
15
- import CloseIcon from 'mdi-material-ui/Close';
14
+ import { Dialog } from '@perses-dev/components';
15
+ import { Button } from '@mui/material';
16
16
  import { useDeletePanelGroupDialog, useViewPanel } from '../../context';
17
17
  export const DeletePanelGroupDialog = ()=>{
18
18
  const { deletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } = useDeletePanelGroupDialog();
@@ -30,23 +30,13 @@ export const DeletePanelGroupDialog = ()=>{
30
30
  return /*#__PURE__*/ _jsxs(Dialog, {
31
31
  open: deletePanelGroupDialog !== undefined,
32
32
  children: [
33
- /*#__PURE__*/ _jsx(DialogTitle, {
33
+ /*#__PURE__*/ _jsx(Dialog.Header, {
34
34
  children: "Delete Panel Group"
35
35
  }),
36
- /*#__PURE__*/ _jsx(IconButton, {
37
- "aria-label": "Close",
38
- onClick: ()=>closeDeletePanelGroupDialog(),
39
- sx: (theme)=>({
40
- position: 'absolute',
41
- top: theme.spacing(0.5),
42
- right: theme.spacing(0.5)
43
- }),
44
- children: /*#__PURE__*/ _jsx(CloseIcon, {})
45
- }),
46
36
  /*#__PURE__*/ _jsxs("form", {
47
37
  onSubmit: handleDelete,
48
38
  children: [
49
- /*#__PURE__*/ _jsxs(DialogContent, {
39
+ /*#__PURE__*/ _jsxs(Dialog.Content, {
50
40
  dividers: true,
51
41
  sx: {
52
42
  width: '500px'
@@ -57,7 +47,7 @@ export const DeletePanelGroupDialog = ()=>{
57
47
  "? This will delete all the panels within the group."
58
48
  ]
59
49
  }),
60
- /*#__PURE__*/ _jsxs(DialogActions, {
50
+ /*#__PURE__*/ _jsxs(Dialog.Actions, {
61
51
  children: [
62
52
  /*#__PURE__*/ _jsx(Button, {
63
53
  variant: "contained",