@perses-dev/components 0.46.0 → 0.47.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 (136) hide show
  1. package/dist/AlignSelector/AlignSelector.d.ts +8 -0
  2. package/dist/AlignSelector/AlignSelector.d.ts.map +1 -0
  3. package/dist/AlignSelector/AlignSelector.js +45 -0
  4. package/dist/AlignSelector/AlignSelector.js.map +1 -0
  5. package/dist/AlignSelector/index.d.ts +2 -0
  6. package/dist/AlignSelector/index.d.ts.map +1 -0
  7. package/dist/AlignSelector/index.js +15 -0
  8. package/dist/AlignSelector/index.js.map +1 -0
  9. package/dist/ColorPicker/OptionsColorPicker.d.ts +7 -0
  10. package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -0
  11. package/dist/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +5 -5
  12. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -0
  13. package/dist/ColorPicker/index.d.ts +1 -0
  14. package/dist/ColorPicker/index.d.ts.map +1 -1
  15. package/dist/ColorPicker/index.js +1 -0
  16. package/dist/ColorPicker/index.js.map +1 -1
  17. package/dist/DensitySelector/DensitySelector.d.ts +7 -0
  18. package/dist/DensitySelector/DensitySelector.d.ts.map +1 -0
  19. package/dist/DensitySelector/DensitySelector.js +46 -0
  20. package/dist/DensitySelector/DensitySelector.js.map +1 -0
  21. package/dist/DensitySelector/index.d.ts +2 -0
  22. package/dist/DensitySelector/index.d.ts.map +1 -0
  23. package/dist/DensitySelector/index.js +15 -0
  24. package/dist/DensitySelector/index.js.map +1 -0
  25. package/dist/Dialog/Dialog.d.ts +2 -7
  26. package/dist/Dialog/Dialog.d.ts.map +1 -1
  27. package/dist/Dialog/Dialog.js +7 -2
  28. package/dist/Dialog/Dialog.js.map +1 -1
  29. package/dist/LinksEditor/LinksEditor.d.ts +6 -1
  30. package/dist/LinksEditor/LinksEditor.d.ts.map +1 -1
  31. package/dist/LinksEditor/LinksEditor.js +15 -8
  32. package/dist/LinksEditor/LinksEditor.js.map +1 -1
  33. package/dist/Overlay/Overlay.d.ts +15 -0
  34. package/dist/Overlay/Overlay.d.ts.map +1 -0
  35. package/dist/Overlay/Overlay.js +52 -0
  36. package/dist/Overlay/Overlay.js.map +1 -0
  37. package/dist/Overlay/index.d.ts +2 -0
  38. package/dist/Overlay/index.d.ts.map +1 -0
  39. package/dist/Overlay/index.js +15 -0
  40. package/dist/Overlay/index.js.map +1 -0
  41. package/dist/SortSelector/SortSelectorButtons.d.ts +8 -0
  42. package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -0
  43. package/dist/SortSelector/SortSelectorButtons.js +45 -0
  44. package/dist/SortSelector/SortSelectorButtons.js.map +1 -0
  45. package/dist/SortSelector/index.d.ts +1 -0
  46. package/dist/SortSelector/index.d.ts.map +1 -1
  47. package/dist/SortSelector/index.js +2 -1
  48. package/dist/SortSelector/index.js.map +1 -1
  49. package/dist/Table/InnerTable.d.ts.map +1 -1
  50. package/dist/Table/InnerTable.js +2 -1
  51. package/dist/Table/InnerTable.js.map +1 -1
  52. package/dist/Table/TableCell.d.ts +1 -1
  53. package/dist/Table/TableCell.d.ts.map +1 -1
  54. package/dist/Table/TableCell.js +3 -1
  55. package/dist/Table/TableCell.js.map +1 -1
  56. package/dist/Table/TableHeaderCell.d.ts +1 -1
  57. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  58. package/dist/Table/TableHeaderCell.js.map +1 -1
  59. package/dist/Table/model/table-model.d.ts +1 -1
  60. package/dist/Table/model/table-model.d.ts.map +1 -1
  61. package/dist/Table/model/table-model.js +25 -20
  62. package/dist/Table/model/table-model.js.map +1 -1
  63. package/dist/ThresholdsEditor/ThresholdInput.js +2 -2
  64. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  65. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  66. package/dist/ThresholdsEditor/ThresholdsEditor.js +2 -2
  67. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  68. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +18 -0
  69. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -0
  70. package/dist/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +45 -28
  71. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -0
  72. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +35 -0
  73. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -0
  74. package/dist/TimeRangeSelector/TimeRangeSelector.js +119 -0
  75. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -0
  76. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.d.ts +1 -2
  77. package/dist/TimeRangeSelector/index.d.ts.map +1 -0
  78. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  79. package/dist/TimeRangeSelector/index.js.map +1 -0
  80. package/dist/TimeRangeSelector/utils.d.ts +25 -0
  81. package/dist/TimeRangeSelector/utils.d.ts.map +1 -0
  82. package/dist/{DateTimeRangePicker → TimeRangeSelector}/utils.js +23 -2
  83. package/dist/TimeRangeSelector/utils.js.map +1 -0
  84. package/dist/cjs/AlignSelector/AlignSelector.js +53 -0
  85. package/dist/cjs/AlignSelector/index.js +30 -0
  86. package/dist/cjs/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +6 -6
  87. package/dist/cjs/ColorPicker/index.js +1 -0
  88. package/dist/cjs/DensitySelector/DensitySelector.js +54 -0
  89. package/dist/cjs/DensitySelector/index.js +30 -0
  90. package/dist/cjs/Dialog/Dialog.js +7 -2
  91. package/dist/cjs/LinksEditor/LinksEditor.js +15 -8
  92. package/dist/cjs/Overlay/Overlay.js +71 -0
  93. package/dist/cjs/Overlay/index.js +30 -0
  94. package/dist/cjs/SortSelector/SortSelectorButtons.js +53 -0
  95. package/dist/cjs/SortSelector/index.js +2 -1
  96. package/dist/cjs/Table/InnerTable.js +2 -1
  97. package/dist/cjs/Table/TableCell.js +3 -1
  98. package/dist/cjs/Table/model/table-model.js +25 -20
  99. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +2 -2
  100. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +2 -2
  101. package/dist/cjs/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +39 -30
  102. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +127 -0
  103. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  104. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/utils.js +24 -1
  105. package/dist/cjs/index.js +4 -1
  106. package/dist/cjs/model/timeOption.js +19 -1
  107. package/dist/index.d.ts +4 -1
  108. package/dist/index.d.ts.map +1 -1
  109. package/dist/index.js +4 -1
  110. package/dist/index.js.map +1 -1
  111. package/dist/model/timeOption.d.ts +2 -1
  112. package/dist/model/timeOption.d.ts.map +1 -1
  113. package/dist/model/timeOption.js +13 -2
  114. package/dist/model/timeOption.js.map +1 -1
  115. package/package.json +7 -6
  116. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +0 -9
  117. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +0 -1
  118. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +0 -1
  119. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +0 -11
  120. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +0 -1
  121. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +0 -80
  122. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +0 -1
  123. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +0 -13
  124. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +0 -1
  125. package/dist/DateTimeRangePicker/TimeRangeSelector.js +0 -67
  126. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +0 -1
  127. package/dist/DateTimeRangePicker/index.d.ts.map +0 -1
  128. package/dist/DateTimeRangePicker/index.js.map +0 -1
  129. package/dist/DateTimeRangePicker/utils.d.ts +0 -7
  130. package/dist/DateTimeRangePicker/utils.d.ts.map +0 -1
  131. package/dist/DateTimeRangePicker/utils.js.map +0 -1
  132. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +0 -3
  133. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +0 -1
  134. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +0 -1
  135. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +0 -88
  136. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +0 -80
@@ -0,0 +1,54 @@
1
+ // Copyright 2024 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, "DensitySelector", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return DensitySelector;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _OptionsEditorLayout = require("../OptionsEditorLayout");
25
+ const _SettingsAutocomplete = require("../SettingsAutocomplete");
26
+ const DENSITY_OPTIONS = [
27
+ {
28
+ id: 'compact',
29
+ label: 'Compact'
30
+ },
31
+ {
32
+ id: 'standard',
33
+ label: 'Standard'
34
+ },
35
+ {
36
+ id: 'comfortable',
37
+ label: 'Comfortable'
38
+ }
39
+ ];
40
+ function DensitySelector({ onChange, value = 'standard' }) {
41
+ const handleSortChange = (_, { id })=>{
42
+ onChange(id);
43
+ };
44
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsEditorLayout.OptionsEditorControl, {
45
+ label: "Density",
46
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_SettingsAutocomplete.SettingsAutocomplete, {
47
+ value: DENSITY_OPTIONS.find((o)=>o.id === value),
48
+ options: DENSITY_OPTIONS,
49
+ getOptionLabel: (o)=>o.label,
50
+ onChange: handleSortChange,
51
+ disableClearable: true
52
+ })
53
+ });
54
+ }
@@ -0,0 +1,30 @@
1
+ // Copyright 2024 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
+ _export_star(require("./DensitySelector"), exports);
18
+ function _export_star(from, to) {
19
+ Object.keys(from).forEach(function(k) {
20
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
21
+ Object.defineProperty(to, k, {
22
+ enumerable: true,
23
+ get: function() {
24
+ return from[k];
25
+ }
26
+ });
27
+ }
28
+ });
29
+ return from;
30
+ }
@@ -34,6 +34,10 @@ const Header = ({ children, onClose, ...props })=>{
34
34
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
35
35
  children: [
36
36
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.DialogTitle, {
37
+ style: {
38
+ textOverflow: 'ellipsis',
39
+ overflow: 'hidden'
40
+ },
37
41
  ...props,
38
42
  children: children
39
43
  }),
@@ -46,11 +50,12 @@ const Header = ({ children, onClose, ...props })=>{
46
50
  ]
47
51
  });
48
52
  };
49
- const Content = ({ children, width = 500, sx, ...props })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.DialogContent, {
53
+ const Content = ({ children, sx, ...props })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.DialogContent, {
50
54
  dividers: true,
51
55
  ...props,
52
56
  sx: (0, _utils.combineSx)({
53
- width: `${width}px`
57
+ minWidth: `500px`,
58
+ textWrap: 'balance'
54
59
  }, sx),
55
60
  children: children
56
61
  });
@@ -72,9 +72,10 @@ function _interop_require_wildcard(obj, nodeInterop) {
72
72
  }
73
73
  return newObj;
74
74
  }
75
- function LinksEditor({ ...props }) {
75
+ function LinksEditor({ control, ...props }) {
76
76
  const { fields, append, remove } = (0, _reacthookform.useFieldArray)({
77
- name: 'links'
77
+ control: control,
78
+ name: 'panelDefinition.spec.links'
78
79
  });
79
80
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
80
81
  ...props,
@@ -88,6 +89,7 @@ function LinksEditor({ ...props }) {
88
89
  alignItems: "center",
89
90
  children: [
90
91
  /*#__PURE__*/ (0, _jsxruntime.jsx)(LinkControl, {
92
+ control: control,
91
93
  index: index
92
94
  }),
93
95
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
@@ -121,7 +123,7 @@ function LinksEditor({ ...props }) {
121
123
  ]
122
124
  });
123
125
  }
124
- function LinkControl({ index }) {
126
+ function LinkControl({ control, index }) {
125
127
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
126
128
  gap: 2,
127
129
  flexGrow: 1,
@@ -131,7 +133,8 @@ function LinkControl({ index }) {
131
133
  gap: 2,
132
134
  children: [
133
135
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
134
- name: `links.${index}.url`,
136
+ control: control,
137
+ name: `panelDefinition.spec.links.${index}.url`,
135
138
  render: ({ field, fieldState })=>{
136
139
  var _fieldState_error;
137
140
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
@@ -148,7 +151,8 @@ function LinkControl({ index }) {
148
151
  }
149
152
  }),
150
153
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
151
- name: `links.${index}.name`,
154
+ control: control,
155
+ name: `panelDefinition.spec.links.${index}.name`,
152
156
  render: ({ field, fieldState })=>{
153
157
  var _fieldState_error;
154
158
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
@@ -165,7 +169,8 @@ function LinkControl({ index }) {
165
169
  }
166
170
  }),
167
171
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
168
- name: `links.${index}.tooltip`,
172
+ control: control,
173
+ name: `panelDefinition.spec.links.${index}.tooltip`,
169
174
  render: ({ field, fieldState })=>{
170
175
  var _fieldState_error;
171
176
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
@@ -189,7 +194,8 @@ function LinkControl({ index }) {
189
194
  alignItems: "center",
190
195
  children: [
191
196
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
192
- name: `links.${index}.renderVariables`,
197
+ control: control,
198
+ name: `panelDefinition.spec.links.${index}.renderVariables`,
193
199
  render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
194
200
  label: "Render Variables",
195
201
  control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
@@ -200,7 +206,8 @@ function LinkControl({ index }) {
200
206
  })
201
207
  }),
202
208
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
203
- name: `links.${index}.targetBlank`,
209
+ control: control,
210
+ name: `panelDefinition.spec.links.${index}.targetBlank`,
204
211
  render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
205
212
  label: "Open in new tab",
206
213
  control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
@@ -0,0 +1,71 @@
1
+ // Copyright 2024 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
+ LoadingOverlay: function() {
25
+ return LoadingOverlay;
26
+ },
27
+ NoDataOverlay: function() {
28
+ return NoDataOverlay;
29
+ },
30
+ TextOverlay: function() {
31
+ return TextOverlay;
32
+ }
33
+ });
34
+ const _jsxruntime = require("react/jsx-runtime");
35
+ const _material = require("@mui/material");
36
+ function TextOverlay(props) {
37
+ const { message } = props;
38
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
39
+ sx: {
40
+ height: '100%',
41
+ alignItems: 'center',
42
+ justifyContent: 'center'
43
+ },
44
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
45
+ children: message
46
+ })
47
+ });
48
+ }
49
+ function NoDataOverlay(props) {
50
+ const { resource } = props;
51
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(TextOverlay, {
52
+ message: `No ${resource}`
53
+ });
54
+ }
55
+ function LoadingOverlay(props) {
56
+ const { variant = 'rounded' } = props;
57
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
58
+ sx: {
59
+ height: '100%',
60
+ alignItems: 'center',
61
+ justifyContent: 'center',
62
+ padding: '0 10px'
63
+ },
64
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Skeleton, {
65
+ variant: variant,
66
+ width: "100%",
67
+ height: "30%",
68
+ "aria-label": "Loading..."
69
+ })
70
+ });
71
+ }
@@ -0,0 +1,30 @@
1
+ // Copyright 2024 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
+ _export_star(require("./Overlay"), exports);
18
+ function _export_star(from, to) {
19
+ Object.keys(from).forEach(function(k) {
20
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
21
+ Object.defineProperty(to, k, {
22
+ enumerable: true,
23
+ get: function() {
24
+ return from[k];
25
+ }
26
+ });
27
+ }
28
+ });
29
+ return from;
30
+ }
@@ -0,0 +1,53 @@
1
+ // Copyright 2024 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, "SortSelectorButtons", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return SortSelectorButtons;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ function SortSelectorButtons({ onChange, value, ...props }) {
26
+ const handleSortChange = (sort)=>{
27
+ onChange(sort);
28
+ };
29
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.ButtonGroup, {
30
+ "aria-label": "Sort",
31
+ sx: {
32
+ margin: 1
33
+ },
34
+ ...props,
35
+ children: [
36
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
37
+ onClick: ()=>handleSortChange(undefined),
38
+ variant: value === undefined ? 'contained' : 'outlined',
39
+ children: "None"
40
+ }),
41
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
42
+ onClick: ()=>handleSortChange('asc'),
43
+ variant: value === 'asc' ? 'contained' : 'outlined',
44
+ children: "Ascending"
45
+ }),
46
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
47
+ onClick: ()=>handleSortChange('desc'),
48
+ variant: value === 'desc' ? 'contained' : 'outlined',
49
+ children: "Descending"
50
+ })
51
+ ]
52
+ });
53
+ }
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 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
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
17
  _export_star(require("./SortSelector"), exports);
18
+ _export_star(require("./SortSelectorButtons"), exports);
18
19
  function _export_star(from, to) {
19
20
  Object.keys(from).forEach(function(k) {
20
21
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -31,7 +31,8 @@ const StyledMuiTable = (0, _material.styled)(_material.Table)(({ theme })=>({
31
31
  }));
32
32
  const TABLE_DENSITY_CONFIG = {
33
33
  compact: 'small',
34
- standard: 'medium'
34
+ standard: 'medium',
35
+ comfortable: 'medium'
35
36
  };
36
37
  const InnerTable = /*#__PURE__*/ (0, _react.forwardRef)(function InnerTable({ density, ...otherProps }, ref) {
37
38
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(StyledMuiTable, {
@@ -39,7 +39,7 @@ const StyledMuiTableCell = (0, _material.styled)(_material.TableCell)(({ theme }
39
39
  borderRadius: 0
40
40
  }
41
41
  }));
42
- function TableCell({ children, density, variant, width, focusState = 'none', onFocusTrigger, isFirstColumn, isLastColumn, description, ...otherProps }) {
42
+ function TableCell({ children, density, variant, width, focusState = 'none', onFocusTrigger, isFirstColumn, isLastColumn, description, align, ...otherProps }) {
43
43
  const theme = (0, _material.useTheme)();
44
44
  const elRef = (0, _react.useRef)();
45
45
  const isHeader = variant === 'head';
@@ -101,6 +101,8 @@ function TableCell({ children, density, variant, width, focusState = 'none', onF
101
101
  flexDirection: 'inherit'
102
102
  },
103
103
  title: description,
104
+ "aria-label": description,
105
+ textAlign: align,
104
106
  children: children
105
107
  })
106
108
  });
@@ -36,31 +36,36 @@ function calculateTableCellHeight(lineHeight, paddingY) {
36
36
  return lineHeightNum + verticalPaddingNum * 2;
37
37
  }
38
38
  function getTableCellLayout(theme, density, { isLastColumn, isFirstColumn } = {}) {
39
+ // Density Standard
40
+ let paddingY = theme.spacing(1);
41
+ let basePaddingX = theme.spacing(1.25);
42
+ let edgePaddingX = theme.spacing(2);
43
+ let paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;
44
+ let paddingRight = isLastColumn ? edgePaddingX : basePaddingX;
45
+ let lineHeight = theme.typography.body1.lineHeight;
46
+ let fontSize = theme.typography.body1.fontSize;
39
47
  if (density === 'compact') {
40
- const paddingY = theme.spacing(0.5);
41
- const basePaddingX = theme.spacing(0.5);
42
- const edgePaddingX = theme.spacing(1);
43
- const paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;
44
- const paddingRight = isLastColumn ? edgePaddingX : basePaddingX;
45
- const lineHeight = theme.typography.body2.lineHeight;
46
- return {
47
- padding: `${paddingY} ${paddingRight} ${paddingY} ${paddingLeft}`,
48
- height: calculateTableCellHeight(lineHeight, paddingY),
49
- fontSize: theme.typography.body2.fontSize,
50
- lineHeight: lineHeight
51
- };
48
+ paddingY = theme.spacing(0.5);
49
+ basePaddingX = theme.spacing(0.5);
50
+ edgePaddingX = theme.spacing(1);
51
+ paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;
52
+ paddingRight = isLastColumn ? edgePaddingX : basePaddingX;
53
+ lineHeight = theme.typography.body2.lineHeight;
54
+ fontSize = theme.typography.body2.fontSize;
55
+ }
56
+ if (density === 'comfortable') {
57
+ paddingY = theme.spacing(2);
58
+ basePaddingX = theme.spacing(1.5);
59
+ edgePaddingX = theme.spacing(2);
60
+ paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;
61
+ paddingRight = isLastColumn ? edgePaddingX : basePaddingX;
62
+ lineHeight = theme.typography.body1.lineHeight;
63
+ fontSize = theme.typography.body1.fontSize;
52
64
  }
53
- // standard density
54
- const paddingY = theme.spacing(1);
55
- const basePaddingX = theme.spacing(1.25);
56
- const edgePaddingX = theme.spacing(2);
57
- const paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;
58
- const paddingRight = isLastColumn ? edgePaddingX : basePaddingX;
59
- const lineHeight = theme.typography.body1.lineHeight;
60
65
  return {
61
66
  padding: `${paddingY} ${paddingRight} ${paddingY} ${paddingLeft}`,
62
67
  height: calculateTableCellHeight(lineHeight, paddingY),
63
- fontSize: theme.typography.body1.fontSize,
68
+ fontSize: fontSize,
64
69
  lineHeight: lineHeight
65
70
  };
66
71
  }
@@ -24,7 +24,7 @@ const _jsxruntime = require("react/jsx-runtime");
24
24
  const _react = require("react");
25
25
  const _material = require("@mui/material");
26
26
  const _DeleteOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DeleteOutline"));
27
- const _ThresholdColorPicker = require("./ThresholdColorPicker");
27
+ const _OptionsColorPicker = require("../ColorPicker/OptionsColorPicker");
28
28
  function _interop_require_default(obj) {
29
29
  return obj && obj.__esModule ? obj : {
30
30
  default: obj
@@ -39,7 +39,7 @@ function ThresholdInput({ inputRef, label, color, value, mode, onChange, onColor
39
39
  justifyContent: "space-between",
40
40
  spacing: 1,
41
41
  children: [
42
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_ThresholdColorPicker.ThresholdColorPicker, {
42
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsColorPicker.OptionsColorPicker, {
43
43
  label: label,
44
44
  color: color,
45
45
  onColorChange: onColorChange
@@ -29,7 +29,7 @@ const _system = require("@mui/system");
29
29
  const _ChartsProvider = require("../context/ChartsProvider");
30
30
  const _OptionsEditorLayout = require("../OptionsEditorLayout");
31
31
  const _InfoTooltip = require("../InfoTooltip");
32
- const _ThresholdColorPicker = require("./ThresholdColorPicker");
32
+ const _OptionsColorPicker = require("../ColorPicker/OptionsColorPicker");
33
33
  const _ThresholdInput = require("./ThresholdInput");
34
34
  function _interop_require_default(obj) {
35
35
  return obj && obj.__esModule ? obj : {
@@ -274,7 +274,7 @@ function ThresholdsEditor({ thresholds, onChange, hideDefault, disablePercentMod
274
274
  alignItems: "center",
275
275
  spacing: 1,
276
276
  children: [
277
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_ThresholdColorPicker.ThresholdColorPicker, {
277
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsColorPicker.OptionsColorPicker, {
278
278
  label: "default",
279
279
  color: defaultThresholdColor,
280
280
  onColorChange: handleDefaultColorChange
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 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
@@ -14,10 +14,10 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- Object.defineProperty(exports, "AbsoluteTimePicker", {
17
+ Object.defineProperty(exports, "DateTimeRangePicker", {
18
18
  enumerable: true,
19
19
  get: function() {
20
- return AbsoluteTimePicker;
20
+ return DateTimeRangePicker;
21
21
  }
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
@@ -25,23 +25,24 @@ const _react = require("react");
25
25
  const _material = require("@mui/material");
26
26
  const _xdatepickers = require("@mui/x-date-pickers");
27
27
  const _AdapterDateFns = require("@mui/x-date-pickers/AdapterDateFns");
28
- const _TimeZoneProvider = require("../context/TimeZoneProvider");
28
+ const _context = require("../context");
29
+ const _ErrorBoundary = require("../ErrorBoundary");
30
+ const _ErrorAlert = require("../ErrorAlert");
29
31
  const _utils = require("./utils");
30
- const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
31
- const AbsoluteTimePicker = ({ initialTimeRange, onChange, onCancel })=>{
32
- const { formatWithUserTimeZone } = (0, _TimeZoneProvider.useTimeZone)();
32
+ const DateTimeRangePicker = ({ initialTimeRange, onChange, onCancel })=>{
33
+ const { formatWithUserTimeZone } = (0, _context.useTimeZone)();
33
34
  // Time range values as dates that can be used as a time range.
34
35
  const [timeRange, setTimeRange] = (0, _react.useState)(initialTimeRange);
35
36
  // Time range values as strings used to populate the text inputs. May not
36
37
  // be valid as dates when the user is typing.
37
38
  const [timeRangeInputs, setTimeRangeInputs] = (0, _react.useState)({
38
- start: formatWithUserTimeZone(initialTimeRange.start, DATE_TIME_FORMAT),
39
- end: formatWithUserTimeZone(initialTimeRange.end, DATE_TIME_FORMAT)
39
+ start: formatWithUserTimeZone(initialTimeRange.start, _utils.DATE_TIME_FORMAT),
40
+ end: formatWithUserTimeZone(initialTimeRange.end, _utils.DATE_TIME_FORMAT)
40
41
  });
41
42
  const [showStartCalendar, setShowStartCalendar] = (0, _react.useState)(true);
42
43
  const changeTimeRange = (newTime, segment)=>{
43
44
  const isInputChange = typeof newTime === 'string';
44
- const newInputTime = isInputChange ? newTime : formatWithUserTimeZone(newTime, DATE_TIME_FORMAT);
45
+ const newInputTime = isInputChange ? newTime : formatWithUserTimeZone(newTime, _utils.DATE_TIME_FORMAT);
45
46
  setTimeRangeInputs((prevTimeRangeInputs)=>{
46
47
  return {
47
48
  ...prevTimeRangeInputs,
@@ -159,27 +160,35 @@ const AbsoluteTimePicker = ({ initialTimeRange, onChange, onCancel })=>{
159
160
  pl: 1,
160
161
  pr: 1,
161
162
  children: [
162
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
163
- onChange: (event)=>{
164
- // TODO: add helperText, fix validation after we decide on form state solution
165
- onChangeStartTime(event.target.value);
166
- },
167
- onBlur: ()=>updateDateRange(),
168
- value: timeRangeInputs.start,
169
- label: "Start Time",
170
- placeholder: DATE_TIME_FORMAT,
171
- // tel used to match MUI DateTimePicker, may change in future: https://github.com/mui/material-ui/issues/27590
172
- type: "tel"
163
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_ErrorBoundary.ErrorBoundary, {
164
+ FallbackComponent: _ErrorAlert.ErrorAlert,
165
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_xdatepickers.DateTimeField, {
166
+ label: "Start Time",
167
+ // @ts-expect-error: because the value is a Date, but the component expects a string
168
+ value: new Date(timeRangeInputs.start),
169
+ onChange: (event)=>{
170
+ if (event) {
171
+ onChangeStartTime(event);
172
+ }
173
+ },
174
+ onBlur: ()=>updateDateRange(),
175
+ format: _utils.DATE_TIME_FORMAT
176
+ })
173
177
  }),
174
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
175
- onChange: (event)=>{
176
- onChangeEndTime(event.target.value);
177
- },
178
- onBlur: ()=>updateDateRange(),
179
- value: timeRangeInputs.end,
180
- label: "End Time",
181
- placeholder: DATE_TIME_FORMAT,
182
- type: "tel"
178
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_ErrorBoundary.ErrorBoundary, {
179
+ FallbackComponent: _ErrorAlert.ErrorAlert,
180
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_xdatepickers.DateTimeField, {
181
+ label: "End Time",
182
+ // @ts-expect-error: because the value is a Date, but the component expects a string
183
+ value: new Date(timeRangeInputs.end),
184
+ onChange: (event)=>{
185
+ if (event) {
186
+ onChangeEndTime(event);
187
+ }
188
+ },
189
+ onBlur: ()=>updateDateRange(),
190
+ format: _utils.DATE_TIME_FORMAT
191
+ })
183
192
  })
184
193
  ]
185
194
  }),