@perses-dev/components 0.55.0-rc.1 → 0.56.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/dist/AlignSelector/AlignSelector.js +115 -25
  2. package/dist/AlignSelector/AlignSelector.js.map +1 -1
  3. package/dist/CodeEditor/CodeEditor.d.ts +19 -0
  4. package/dist/CodeEditor/CodeEditor.d.ts.map +1 -0
  5. package/dist/CodeEditor/CodeEditor.js +122 -0
  6. package/dist/CodeEditor/CodeEditor.js.map +1 -0
  7. package/dist/ColorPicker/ColorPicker.js +153 -61
  8. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  9. package/dist/ColorPicker/OptionsColorPicker.js +147 -52
  10. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
  11. package/dist/ContentWithLegend/ContentWithLegend.js +144 -41
  12. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  13. package/dist/DensitySelector/DensitySelector.js +53 -20
  14. package/dist/DensitySelector/DensitySelector.js.map +1 -1
  15. package/dist/Dialog/Dialog.d.ts +3 -2
  16. package/dist/Dialog/Dialog.d.ts.map +1 -1
  17. package/dist/Dialog/Dialog.js +202 -49
  18. package/dist/Dialog/Dialog.js.map +1 -1
  19. package/dist/Dialog/DiscardChangesConfirmationDialog.js +79 -27
  20. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  21. package/dist/DragAndDrop/DragAndDropList.js +184 -113
  22. package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
  23. package/dist/DragAndDrop/DragButton.js +131 -52
  24. package/dist/DragAndDrop/DragButton.js.map +1 -1
  25. package/dist/DragAndDrop/DropIndicator.js +51 -26
  26. package/dist/DragAndDrop/DropIndicator.js.map +1 -1
  27. package/dist/Drawer/Drawer.js +75 -15
  28. package/dist/Drawer/Drawer.js.map +1 -1
  29. package/dist/EChart/EChart.js +179 -90
  30. package/dist/EChart/EChart.js.map +1 -1
  31. package/dist/ErrorAlert.js +14 -4
  32. package/dist/ErrorAlert.js.map +1 -1
  33. package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js +463 -190
  34. package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js.map +1 -1
  35. package/dist/FontSizeSelector/FontSizeSelector.js +82 -50
  36. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  37. package/dist/FormEditor/FormActions.js +88 -14
  38. package/dist/FormEditor/FormActions.js.map +1 -1
  39. package/dist/FormatControls/FormatControls.js +246 -99
  40. package/dist/FormatControls/FormatControls.js.map +1 -1
  41. package/dist/FormatControls/UnitSelector.js +90 -25
  42. package/dist/FormatControls/UnitSelector.js.map +1 -1
  43. package/dist/InfoTooltip/InfoTooltip.js +105 -42
  44. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  45. package/dist/JSONEditor.d.ts +2 -6
  46. package/dist/JSONEditor.d.ts.map +1 -1
  47. package/dist/JSONEditor.js +24 -37
  48. package/dist/JSONEditor.js.map +1 -1
  49. package/dist/Legend/CompactLegend.js +77 -27
  50. package/dist/Legend/CompactLegend.js.map +1 -1
  51. package/dist/Legend/Legend.js +184 -82
  52. package/dist/Legend/Legend.js.map +1 -1
  53. package/dist/Legend/LegendColorBadge.js +54 -9
  54. package/dist/Legend/LegendColorBadge.js.map +1 -1
  55. package/dist/Legend/ListLegend.js +46 -16
  56. package/dist/Legend/ListLegend.js.map +1 -1
  57. package/dist/Legend/ListLegendItem.js +184 -48
  58. package/dist/Legend/ListLegendItem.js.map +1 -1
  59. package/dist/Legend/TableLegend.d.ts.map +1 -1
  60. package/dist/Legend/TableLegend.js +90 -48
  61. package/dist/Legend/TableLegend.js.map +1 -1
  62. package/dist/Legend/legend-model.d.ts +2 -2
  63. package/dist/Legend/legend-model.d.ts.map +1 -1
  64. package/dist/Legend/legend-model.js.map +1 -1
  65. package/dist/LinksEditor/LinkEditorForm.js +148 -67
  66. package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
  67. package/dist/ModeSelector/ModeSelector.js +61 -19
  68. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  69. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +20 -9
  70. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  71. package/dist/OptionsEditorLayout/OptionsEditorControl.js +130 -54
  72. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  73. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +17 -6
  74. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  75. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +76 -28
  76. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  77. package/dist/Overlay/Overlay.js +71 -27
  78. package/dist/Overlay/Overlay.js.map +1 -1
  79. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +96 -38
  80. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  81. package/dist/RepeatGrid/RepeatGrid.js +117 -45
  82. package/dist/RepeatGrid/RepeatGrid.js.map +1 -1
  83. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +99 -38
  84. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  85. package/dist/SortSelector/SortSelector.js +51 -18
  86. package/dist/SortSelector/SortSelector.js.map +1 -1
  87. package/dist/SortSelector/SortSelectorButtons.js +109 -25
  88. package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
  89. package/dist/Table/InnerTable.js +46 -15
  90. package/dist/Table/InnerTable.js.map +1 -1
  91. package/dist/Table/Table.d.ts +3 -1
  92. package/dist/Table/Table.d.ts.map +1 -1
  93. package/dist/Table/Table.js +410 -158
  94. package/dist/Table/Table.js.map +1 -1
  95. package/dist/Table/TableBody.js +15 -4
  96. package/dist/Table/TableBody.js.map +1 -1
  97. package/dist/Table/TableCell.js +284 -107
  98. package/dist/Table/TableCell.js.map +1 -1
  99. package/dist/Table/TableCheckbox.js +101 -32
  100. package/dist/Table/TableCheckbox.js.map +1 -1
  101. package/dist/Table/TableFoot.js +15 -4
  102. package/dist/Table/TableFoot.js.map +1 -1
  103. package/dist/Table/TableHead.js +15 -4
  104. package/dist/Table/TableHead.js.map +1 -1
  105. package/dist/Table/TableHeaderCell.js +119 -62
  106. package/dist/Table/TableHeaderCell.js.map +1 -1
  107. package/dist/Table/TableRow.js +33 -9
  108. package/dist/Table/TableRow.js.map +1 -1
  109. package/dist/Table/TableToolbar.d.ts +5 -4
  110. package/dist/Table/TableToolbar.d.ts.map +1 -1
  111. package/dist/Table/TableToolbar.js +172 -100
  112. package/dist/Table/TableToolbar.js.map +1 -1
  113. package/dist/Table/VirtualizedTable.d.ts +11 -11
  114. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  115. package/dist/Table/VirtualizedTable.js +387 -219
  116. package/dist/Table/VirtualizedTable.js.map +1 -1
  117. package/dist/Table/VirtualizedTableContainer.js +27 -7
  118. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  119. package/dist/Table/hooks/useFuzzySearch.d.ts +6 -5
  120. package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -1
  121. package/dist/Table/hooks/useFuzzySearch.js +57 -32
  122. package/dist/Table/hooks/useFuzzySearch.js.map +1 -1
  123. package/dist/Table/hooks/useTableKeyboardNav.js +115 -74
  124. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  125. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +1 -1
  126. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
  127. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +74 -53
  128. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  129. package/dist/Table/model/table-model.d.ts +44 -15
  130. package/dist/Table/model/table-model.d.ts.map +1 -1
  131. package/dist/Table/model/table-model.js +33 -1
  132. package/dist/Table/model/table-model.js.map +1 -1
  133. package/dist/ThresholdsEditor/ThresholdInput.js +137 -47
  134. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  135. package/dist/ThresholdsEditor/ThresholdsEditor.js +341 -174
  136. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  137. package/dist/TimeRangeSelector/DateTimeRangePicker.js +368 -162
  138. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  139. package/dist/TimeRangeSelector/TimeRangeSelector.js +580 -209
  140. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  141. package/dist/TimeSeriesTooltip/SeriesInfo.js +189 -65
  142. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  143. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +168 -78
  144. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  145. package/dist/TimeSeriesTooltip/SeriesMarker.js +38 -11
  146. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  147. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +229 -72
  148. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  149. package/dist/TimeSeriesTooltip/TooltipContent.js +73 -27
  150. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  151. package/dist/TimeSeriesTooltip/TooltipHeader.js +221 -121
  152. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  153. package/dist/TimeSeriesTooltip/tooltip-model.js +44 -38
  154. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  155. package/dist/TimeZoneSelector.js +131 -36
  156. package/dist/TimeZoneSelector.js.map +1 -1
  157. package/dist/ToolbarIconButton/ToolbarIconButton.js +18 -7
  158. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  159. package/dist/TransformsEditor/TransformEditor.js +830 -334
  160. package/dist/TransformsEditor/TransformEditor.js.map +1 -1
  161. package/dist/TransformsEditor/TransformEditorContainer.js +252 -90
  162. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  163. package/dist/TransformsEditor/TransformsEditor.js +170 -59
  164. package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
  165. package/dist/ValueMappingEditor/ValueMappingEditor.js +800 -322
  166. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
  167. package/dist/ValueMappingEditor/ValueMappingsEditor.js +218 -91
  168. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
  169. package/dist/YAMLEditor/YAMLEditor.d.ts +12 -0
  170. package/dist/YAMLEditor/YAMLEditor.d.ts.map +1 -0
  171. package/dist/YAMLEditor/YAMLEditor.js +41 -0
  172. package/dist/YAMLEditor/YAMLEditor.js.map +1 -0
  173. package/dist/YAMLEditor/index.d.ts +2 -0
  174. package/dist/YAMLEditor/index.d.ts.map +1 -0
  175. package/dist/YAMLEditor/index.js +15 -0
  176. package/dist/YAMLEditor/index.js.map +1 -0
  177. package/dist/YAMLEditor/yaml-utils.d.ts +11 -0
  178. package/dist/YAMLEditor/yaml-utils.d.ts.map +1 -0
  179. package/dist/YAMLEditor/yaml-utils.js +52 -0
  180. package/dist/YAMLEditor/yaml-utils.js.map +1 -0
  181. package/dist/YAxisLabel.js +64 -20
  182. package/dist/YAxisLabel.js.map +1 -1
  183. package/dist/context/ChartsProvider.js +32 -16
  184. package/dist/context/ChartsProvider.js.map +1 -1
  185. package/dist/context/ItemActionsProvider.js +110 -61
  186. package/dist/context/ItemActionsProvider.js.map +1 -1
  187. package/dist/context/SelectionProvider.js +170 -66
  188. package/dist/context/SelectionProvider.js.map +1 -1
  189. package/dist/context/SnackbarProvider.js +101 -44
  190. package/dist/context/SnackbarProvider.js.map +1 -1
  191. package/dist/context/TimeZoneProvider.js +35 -14
  192. package/dist/context/TimeZoneProvider.js.map +1 -1
  193. package/dist/controls/TextField.js +86 -25
  194. package/dist/controls/TextField.js.map +1 -1
  195. package/dist/index.d.ts +1 -0
  196. package/dist/index.d.ts.map +1 -1
  197. package/dist/index.js +1 -0
  198. package/dist/index.js.map +1 -1
  199. package/dist/utils/browser-storage.js +64 -34
  200. package/dist/utils/browser-storage.js.map +1 -1
  201. package/dist/utils/time-series-data.d.ts.map +1 -1
  202. package/dist/utils/time-series-data.js +5 -2
  203. package/dist/utils/time-series-data.js.map +1 -1
  204. package/package.json +13 -7
@@ -11,74 +11,227 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { c as _c } from "react-compiler-runtime";
14
15
  import { Button, DialogActions, DialogContent, DialogTitle, IconButton, Dialog as MuiDialog, styled } from "@mui/material";
15
16
  import CloseIcon from "mdi-material-ui/Close";
16
17
  import { combineSx } from "../utils/index.js";
17
- const Header = ({ children, onClose, ...props })=>{
18
- return /*#__PURE__*/ _jsxs(_Fragment, {
19
- children: [
20
- /*#__PURE__*/ _jsx(DialogTitle, {
21
- style: {
22
- textOverflow: 'ellipsis',
23
- overflow: 'hidden'
24
- },
25
- ...props,
26
- children: children
27
- }),
28
- onClose && /*#__PURE__*/ _jsx(IconButton, {
29
- "aria-label": "Close",
30
- onClick: onClose,
31
- sx: dialogCloseIconButtonStyle,
32
- children: /*#__PURE__*/ _jsx(CloseIcon, {})
33
- })
34
- ]
35
- });
18
+ const Header = (t0)=>{
19
+ const $ = _c(13);
20
+ let children;
21
+ let onClose;
22
+ let props;
23
+ if ($[0] !== t0) {
24
+ ({ children, onClose, ...props } = t0);
25
+ $[0] = t0;
26
+ $[1] = children;
27
+ $[2] = onClose;
28
+ $[3] = props;
29
+ } else {
30
+ children = $[1];
31
+ onClose = $[2];
32
+ props = $[3];
33
+ }
34
+ let t1;
35
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
36
+ t1 = {
37
+ textOverflow: "ellipsis",
38
+ overflow: "hidden"
39
+ };
40
+ $[4] = t1;
41
+ } else {
42
+ t1 = $[4];
43
+ }
44
+ let t2;
45
+ if ($[5] !== children || $[6] !== props) {
46
+ t2 = /*#__PURE__*/ _jsx(DialogTitle, {
47
+ style: t1,
48
+ ...props,
49
+ children: children
50
+ });
51
+ $[5] = children;
52
+ $[6] = props;
53
+ $[7] = t2;
54
+ } else {
55
+ t2 = $[7];
56
+ }
57
+ let t3;
58
+ if ($[8] !== onClose) {
59
+ t3 = onClose && /*#__PURE__*/ _jsx(IconButton, {
60
+ "aria-label": "Close",
61
+ onClick: onClose,
62
+ sx: dialogCloseIconButtonStyle,
63
+ children: /*#__PURE__*/ _jsx(CloseIcon, {})
64
+ });
65
+ $[8] = onClose;
66
+ $[9] = t3;
67
+ } else {
68
+ t3 = $[9];
69
+ }
70
+ let t4;
71
+ if ($[10] !== t2 || $[11] !== t3) {
72
+ t4 = /*#__PURE__*/ _jsxs(_Fragment, {
73
+ children: [
74
+ t2,
75
+ t3
76
+ ]
77
+ });
78
+ $[10] = t2;
79
+ $[11] = t3;
80
+ $[12] = t4;
81
+ } else {
82
+ t4 = $[12];
83
+ }
84
+ return t4;
85
+ };
86
+ const Content = (t0)=>{
87
+ const $ = _c(10);
88
+ let children;
89
+ let props;
90
+ let sx;
91
+ if ($[0] !== t0) {
92
+ ({ children, sx, ...props } = t0);
93
+ $[0] = t0;
94
+ $[1] = children;
95
+ $[2] = props;
96
+ $[3] = sx;
97
+ } else {
98
+ children = $[1];
99
+ props = $[2];
100
+ sx = $[3];
101
+ }
102
+ let t1;
103
+ if ($[4] !== sx) {
104
+ t1 = combineSx({
105
+ minWidth: "500px",
106
+ textWrap: "balance"
107
+ }, sx);
108
+ $[4] = sx;
109
+ $[5] = t1;
110
+ } else {
111
+ t1 = $[5];
112
+ }
113
+ let t2;
114
+ if ($[6] !== children || $[7] !== props || $[8] !== t1) {
115
+ t2 = /*#__PURE__*/ _jsx(DialogContent, {
116
+ dividers: true,
117
+ ...props,
118
+ sx: t1,
119
+ children: children
120
+ });
121
+ $[6] = children;
122
+ $[7] = props;
123
+ $[8] = t1;
124
+ $[9] = t2;
125
+ } else {
126
+ t2 = $[9];
127
+ }
128
+ return t2;
129
+ };
130
+ const PrimaryButton = (t0)=>{
131
+ const $ = _c(6);
132
+ let children;
133
+ let props;
134
+ if ($[0] !== t0) {
135
+ ({ children, ...props } = t0);
136
+ $[0] = t0;
137
+ $[1] = children;
138
+ $[2] = props;
139
+ } else {
140
+ children = $[1];
141
+ props = $[2];
142
+ }
143
+ let t1;
144
+ if ($[3] !== children || $[4] !== props) {
145
+ t1 = /*#__PURE__*/ _jsx(Button, {
146
+ variant: "contained",
147
+ type: "submit",
148
+ ...props,
149
+ children: children
150
+ });
151
+ $[3] = children;
152
+ $[4] = props;
153
+ $[5] = t1;
154
+ } else {
155
+ t1 = $[5];
156
+ }
157
+ return t1;
158
+ };
159
+ const SecondaryButton = (t0)=>{
160
+ const $ = _c(6);
161
+ let children;
162
+ let props;
163
+ if ($[0] !== t0) {
164
+ ({ children, ...props } = t0);
165
+ $[0] = t0;
166
+ $[1] = children;
167
+ $[2] = props;
168
+ } else {
169
+ children = $[1];
170
+ props = $[2];
171
+ }
172
+ let t1;
173
+ if ($[3] !== children || $[4] !== props) {
174
+ t1 = /*#__PURE__*/ _jsx(Button, {
175
+ variant: "outlined",
176
+ color: "secondary",
177
+ ...props,
178
+ children: children
179
+ });
180
+ $[3] = children;
181
+ $[4] = props;
182
+ $[5] = t1;
183
+ } else {
184
+ t1 = $[5];
185
+ }
186
+ return t1;
36
187
  };
37
- const Content = ({ children, sx, ...props })=>/*#__PURE__*/ _jsx(DialogContent, {
38
- dividers: true,
39
- ...props,
40
- sx: combineSx({
41
- minWidth: `500px`,
42
- textWrap: 'balance'
43
- }, sx),
44
- children: children
45
- });
46
- const PrimaryButton = ({ children, ...props })=>/*#__PURE__*/ _jsx(Button, {
47
- variant: "contained",
48
- type: "submit",
49
- ...props,
50
- children: children
51
- });
52
- const SecondaryButton = ({ children, ...props })=>/*#__PURE__*/ _jsx(Button, {
53
- variant: "outlined",
54
- color: "secondary",
55
- ...props,
56
- children: children
57
- });
58
188
  /*
59
189
  * Material-ui has a prop "scroll=paper" that is specifically for dialog header and actions to be sticky and body to scroll,
60
190
  * but that doesn't work when dialog content is wrapped in form.
61
191
  * https://github.com/mui-org/material-ui/issues/13253
62
192
  * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog
63
- */ const Form = styled('form')({
64
- overflowY: 'auto',
65
- display: 'flex',
66
- flexDirection: 'column'
193
+ */ const Form = styled("form")({
194
+ overflowY: "auto",
195
+ display: "flex",
196
+ flexDirection: "column"
67
197
  });
68
198
  /**
69
199
  * Render the CSS of the dialog's close button, according to the given material theme.
70
200
  * @param theme material theme
71
201
  */ const dialogCloseIconButtonStyle = (theme)=>{
72
202
  return {
73
- position: 'absolute',
203
+ position: "absolute",
74
204
  top: theme.spacing(0.5),
75
205
  right: theme.spacing(0.5)
76
206
  };
77
207
  };
78
- export const Dialog = ({ children, ...props })=>/*#__PURE__*/ _jsx(MuiDialog, {
79
- ...props,
80
- children: children
81
- });
208
+ export const Dialog = (t0)=>{
209
+ const $ = _c(6);
210
+ let children;
211
+ let props;
212
+ if ($[0] !== t0) {
213
+ ({ children, ...props } = t0);
214
+ $[0] = t0;
215
+ $[1] = children;
216
+ $[2] = props;
217
+ } else {
218
+ children = $[1];
219
+ props = $[2];
220
+ }
221
+ let t1;
222
+ if ($[3] !== children || $[4] !== props) {
223
+ t1 = /*#__PURE__*/ _jsx(MuiDialog, {
224
+ ...props,
225
+ children: children
226
+ });
227
+ $[3] = children;
228
+ $[4] = props;
229
+ $[5] = t1;
230
+ } else {
231
+ t1 = $[5];
232
+ }
233
+ return t1;
234
+ };
82
235
  Dialog.Header = Header;
83
236
  Dialog.Form = Form;
84
237
  Dialog.Content = Content;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Dialog/Dialog.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { StyledComponent } from '@emotion/styled';\nimport type {\n ButtonProps,\n DialogProps,\n DialogTitleProps,\n DialogContentProps as MuiDialogContentProps,\n Theme,\n} from '@mui/material';\nimport {\n Button,\n DialogActions,\n DialogContent,\n DialogTitle,\n IconButton,\n Dialog as MuiDialog,\n styled,\n} from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport type { MouseEvent, ReactElement } from 'react';\n\nimport { combineSx } from '../utils';\n\nexport interface DialogHeaderProps extends DialogTitleProps {\n /**\n * Callback fired when close button is clicked. If undefined, close button will not appear in header.\n */\n onClose?: (e: MouseEvent<HTMLElement>) => void;\n}\n\nexport type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;\n\nexport type DialogContentProps = MuiDialogContentProps;\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps): ReactElement => {\n return (\n <>\n <DialogTitle style={{ textOverflow: 'ellipsis', overflow: 'hidden' }} {...props}>\n {children}\n </DialogTitle>\n {onClose && (\n <IconButton aria-label=\"Close\" onClick={onClose} sx={dialogCloseIconButtonStyle}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\nconst Content = ({ children, sx, ...props }: DialogContentProps): ReactElement => (\n <DialogContent dividers {...props} sx={combineSx({ minWidth: `500px`, textWrap: 'balance' }, sx)}>\n {children}\n </DialogContent>\n);\n\nconst PrimaryButton = ({ children, ...props }: DialogButtonProps): ReactElement => (\n <Button variant=\"contained\" type=\"submit\" {...props}>\n {children}\n </Button>\n);\n\nconst SecondaryButton = ({ children, ...props }: DialogButtonProps): ReactElement => (\n <Button variant=\"outlined\" color=\"secondary\" {...props}>\n {children}\n </Button>\n);\n\n/*\n * Material-ui has a prop \"scroll=paper\" that is specifically for dialog header and actions to be sticky and body to scroll,\n * but that doesn't work when dialog content is wrapped in form.\n * https://github.com/mui-org/material-ui/issues/13253\n * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog\n */\nconst Form: StyledComponent<React.ComponentProps<'form'>> = styled('form')({\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n});\n\n/**\n * Render the CSS of the dialog's close button, according to the given material theme.\n * @param theme material theme\n */\nconst dialogCloseIconButtonStyle = (theme: Theme): Record<string, unknown> => {\n return { position: 'absolute', top: theme.spacing(0.5), right: theme.spacing(0.5) };\n};\n\nexport const Dialog: React.FC<DialogProps> & {\n Header: typeof Header;\n Form: typeof Form;\n Content: typeof Content;\n PrimaryButton: typeof PrimaryButton;\n SecondaryButton: typeof SecondaryButton;\n Actions: typeof DialogActions;\n} = ({ children, ...props }) => <MuiDialog {...props}>{children}</MuiDialog>;\n\nDialog.Header = Header;\nDialog.Form = Form;\nDialog.Content = Content;\nDialog.PrimaryButton = PrimaryButton;\nDialog.SecondaryButton = SecondaryButton;\nDialog.Actions = DialogActions;\n"],"names":["Button","DialogActions","DialogContent","DialogTitle","IconButton","Dialog","MuiDialog","styled","CloseIcon","combineSx","Header","children","onClose","props","style","textOverflow","overflow","aria-label","onClick","sx","dialogCloseIconButtonStyle","Content","dividers","minWidth","textWrap","PrimaryButton","variant","type","SecondaryButton","color","Form","overflowY","display","flexDirection","theme","position","top","spacing","right","Actions"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAUjC,SACEA,MAAM,EACNC,aAAa,EACbC,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,UAAUC,SAAS,EACnBC,MAAM,QACD,gBAAgB;AACvB,OAAOC,eAAe,wBAAwB;AAG9C,SAASC,SAAS,QAAQ,oBAAW;AAarC,MAAMC,SAAS,CAAC,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGC,OAA0B;IAChE,qBACE;;0BACE,KAACV;gBAAYW,OAAO;oBAAEC,cAAc;oBAAYC,UAAU;gBAAS;gBAAI,GAAGH,KAAK;0BAC5EF;;YAEFC,yBACC,KAACR;gBAAWa,cAAW;gBAAQC,SAASN;gBAASO,IAAIC;0BACnD,cAAA,KAACZ;;;;AAKX;AAEA,MAAMa,UAAU,CAAC,EAAEV,QAAQ,EAAEQ,EAAE,EAAE,GAAGN,OAA2B,iBAC7D,KAACX;QAAcoB,QAAQ;QAAE,GAAGT,KAAK;QAAEM,IAAIV,UAAU;YAAEc,UAAU,CAAC,KAAK,CAAC;YAAEC,UAAU;QAAU,GAAGL;kBAC1FR;;AAIL,MAAMc,gBAAgB,CAAC,EAAEd,QAAQ,EAAE,GAAGE,OAA0B,iBAC9D,KAACb;QAAO0B,SAAQ;QAAYC,MAAK;QAAU,GAAGd,KAAK;kBAChDF;;AAIL,MAAMiB,kBAAkB,CAAC,EAAEjB,QAAQ,EAAE,GAAGE,OAA0B,iBAChE,KAACb;QAAO0B,SAAQ;QAAWG,OAAM;QAAa,GAAGhB,KAAK;kBACnDF;;AAIL;;;;;CAKC,GACD,MAAMmB,OAAsDvB,OAAO,QAAQ;IACzEwB,WAAW;IACXC,SAAS;IACTC,eAAe;AACjB;AAEA;;;CAGC,GACD,MAAMb,6BAA6B,CAACc;IAClC,OAAO;QAAEC,UAAU;QAAYC,KAAKF,MAAMG,OAAO,CAAC;QAAMC,OAAOJ,MAAMG,OAAO,CAAC;IAAK;AACpF;AAEA,OAAO,MAAMhC,SAOT,CAAC,EAAEM,QAAQ,EAAE,GAAGE,OAAO,iBAAK,KAACP;QAAW,GAAGO,KAAK;kBAAGF;OAAsB;AAE7EN,OAAOK,MAAM,GAAGA;AAChBL,OAAOyB,IAAI,GAAGA;AACdzB,OAAOgB,OAAO,GAAGA;AACjBhB,OAAOoB,aAAa,GAAGA;AACvBpB,OAAOuB,eAAe,GAAGA;AACzBvB,OAAOkC,OAAO,GAAGtC"}
1
+ {"version":3,"sources":["../../src/Dialog/Dialog.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { StyledComponent } from '@emotion/styled';\nimport type {\n ButtonProps,\n DialogProps,\n DialogTitleProps,\n DialogContentProps as MuiDialogContentProps,\n Theme,\n} from '@mui/material';\nimport {\n Button,\n DialogActions,\n DialogContent,\n DialogTitle,\n IconButton,\n Dialog as MuiDialog,\n styled,\n} from '@mui/material';\nimport type { MUIStyledCommonProps } from '@mui/system';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport type { MouseEvent, ReactElement } from 'react';\n\nimport { combineSx } from '../utils';\n\nexport interface DialogHeaderProps extends DialogTitleProps {\n /**\n * Callback fired when close button is clicked. If undefined, close button will not appear in header.\n */\n onClose?: (e: MouseEvent<HTMLElement>) => void;\n}\n\nexport type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;\n\nexport type DialogContentProps = MuiDialogContentProps;\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps): ReactElement => {\n return (\n <>\n <DialogTitle style={{ textOverflow: 'ellipsis', overflow: 'hidden' }} {...props}>\n {children}\n </DialogTitle>\n {onClose && (\n <IconButton aria-label=\"Close\" onClick={onClose} sx={dialogCloseIconButtonStyle}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\nconst Content = ({ children, sx, ...props }: DialogContentProps): ReactElement => (\n <DialogContent dividers {...props} sx={combineSx({ minWidth: `500px`, textWrap: 'balance' }, sx)}>\n {children}\n </DialogContent>\n);\n\nconst PrimaryButton = ({ children, ...props }: DialogButtonProps): ReactElement => (\n <Button variant=\"contained\" type=\"submit\" {...props}>\n {children}\n </Button>\n);\n\nconst SecondaryButton = ({ children, ...props }: DialogButtonProps): ReactElement => (\n <Button variant=\"outlined\" color=\"secondary\" {...props}>\n {children}\n </Button>\n);\n\n/*\n * Material-ui has a prop \"scroll=paper\" that is specifically for dialog header and actions to be sticky and body to scroll,\n * but that doesn't work when dialog content is wrapped in form.\n * https://github.com/mui-org/material-ui/issues/13253\n * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog\n */\nconst Form: StyledComponent<MUIStyledCommonProps<Theme>, React.ComponentProps<'form'>> = styled('form')({\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n});\n\n/**\n * Render the CSS of the dialog's close button, according to the given material theme.\n * @param theme material theme\n */\nconst dialogCloseIconButtonStyle = (theme: Theme): Record<string, unknown> => {\n return { position: 'absolute', top: theme.spacing(0.5), right: theme.spacing(0.5) };\n};\n\nexport const Dialog: React.FC<DialogProps> & {\n Header: typeof Header;\n Form: typeof Form;\n Content: typeof Content;\n PrimaryButton: typeof PrimaryButton;\n SecondaryButton: typeof SecondaryButton;\n Actions: typeof DialogActions;\n} = ({ children, ...props }) => <MuiDialog {...props}>{children}</MuiDialog>;\n\nDialog.Header = Header;\nDialog.Form = Form;\nDialog.Content = Content;\nDialog.PrimaryButton = PrimaryButton;\nDialog.SecondaryButton = SecondaryButton;\nDialog.Actions = DialogActions;\n"],"names":["Button","DialogActions","DialogContent","DialogTitle","IconButton","Dialog","MuiDialog","styled","CloseIcon","combineSx","Header","Content","PrimaryButton","SecondaryButton","Form","overflowY","display","flexDirection","dialogCloseIconButtonStyle","theme","position","top","spacing","right","Actions"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAUjC,SACEA,MAAM,EACNC,aAAa,EACbC,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,UAAUC,SAAS,EACnBC,MAAM,QACD,gBAAgB;AAEvB,OAAOC,eAAe,wBAAwB;AAG9C,SAASC,SAAS,QAAQ,oBAAW;AAarC,MAAMC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAef,MAAMC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMhB,MAAMC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMtB,MAAMC,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMxB;;;;;CAKC,GACD,MAAMC,OAAmFP,OAAO,QAAQ;IACtGQ,WAAW;IACXC,SAAS;IACTC,eAAe;AACjB;AAEA;;;CAGC,GACD,MAAMC,6BAA6B,CAACC;IAClC,OAAO;QAAEC,UAAU;QAAYC,KAAKF,MAAMG,OAAO,CAAC;QAAMC,OAAOJ,MAAMG,OAAO,CAAC;IAAK;AACpF;AAEA,OAAO,MAAMjB,SAOT;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyE;AAE7EA,OAAOK,MAAM,GAAGA;AAChBL,OAAOS,IAAI,GAAGA;AACdT,OAAOM,OAAO,GAAGA;AACjBN,OAAOO,aAAa,GAAGA;AACvBP,OAAOQ,eAAe,GAAGA;AACzBR,OAAOmB,OAAO,GAAGvB"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { c as _c } from "react-compiler-runtime";
2
3
  // Copyright The Perses Authors
3
4
  // Licensed under the Apache License, Version 2.0 (the "License");
4
5
  // you may not use this file except in compliance with the License.
@@ -14,34 +15,85 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
15
  import { Button } from "@mui/material";
15
16
  import { Dialog } from "./Dialog.js";
16
17
  export const DiscardChangesConfirmationDialog = (props)=>{
18
+ const $ = _c(14);
17
19
  const { description, isOpen, onCancel, onDiscardChanges } = props;
18
- return /*#__PURE__*/ _jsxs(Dialog, {
19
- open: isOpen,
20
- "aria-labelledby": "discard-dialog",
21
- children: [
22
- /*#__PURE__*/ _jsx(Dialog.Header, {
23
- children: "Discard Changes"
24
- }),
25
- /*#__PURE__*/ _jsx(Dialog.Content, {
26
- children: description
27
- }),
28
- /*#__PURE__*/ _jsxs(Dialog.Actions, {
29
- children: [
30
- /*#__PURE__*/ _jsx(Button, {
31
- variant: "contained",
32
- onClick: onDiscardChanges,
33
- children: "Discard Changes"
34
- }),
35
- /*#__PURE__*/ _jsx(Button, {
36
- variant: "outlined",
37
- color: "secondary",
38
- onClick: onCancel,
39
- children: "Cancel"
40
- })
41
- ]
42
- })
43
- ]
44
- });
20
+ let t0;
21
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22
+ t0 = /*#__PURE__*/ _jsx(Dialog.Header, {
23
+ children: "Discard Changes"
24
+ });
25
+ $[0] = t0;
26
+ } else {
27
+ t0 = $[0];
28
+ }
29
+ let t1;
30
+ if ($[1] !== description) {
31
+ t1 = /*#__PURE__*/ _jsx(Dialog.Content, {
32
+ children: description
33
+ });
34
+ $[1] = description;
35
+ $[2] = t1;
36
+ } else {
37
+ t1 = $[2];
38
+ }
39
+ let t2;
40
+ if ($[3] !== onDiscardChanges) {
41
+ t2 = /*#__PURE__*/ _jsx(Button, {
42
+ variant: "contained",
43
+ onClick: onDiscardChanges,
44
+ children: "Discard Changes"
45
+ });
46
+ $[3] = onDiscardChanges;
47
+ $[4] = t2;
48
+ } else {
49
+ t2 = $[4];
50
+ }
51
+ let t3;
52
+ if ($[5] !== onCancel) {
53
+ t3 = /*#__PURE__*/ _jsx(Button, {
54
+ variant: "outlined",
55
+ color: "secondary",
56
+ onClick: onCancel,
57
+ children: "Cancel"
58
+ });
59
+ $[5] = onCancel;
60
+ $[6] = t3;
61
+ } else {
62
+ t3 = $[6];
63
+ }
64
+ let t4;
65
+ if ($[7] !== t2 || $[8] !== t3) {
66
+ t4 = /*#__PURE__*/ _jsxs(Dialog.Actions, {
67
+ children: [
68
+ t2,
69
+ t3
70
+ ]
71
+ });
72
+ $[7] = t2;
73
+ $[8] = t3;
74
+ $[9] = t4;
75
+ } else {
76
+ t4 = $[9];
77
+ }
78
+ let t5;
79
+ if ($[10] !== isOpen || $[11] !== t1 || $[12] !== t4) {
80
+ t5 = /*#__PURE__*/ _jsxs(Dialog, {
81
+ open: isOpen,
82
+ "aria-labelledby": "discard-dialog",
83
+ children: [
84
+ t0,
85
+ t1,
86
+ t4
87
+ ]
88
+ });
89
+ $[10] = isOpen;
90
+ $[11] = t1;
91
+ $[12] = t4;
92
+ $[13] = t5;
93
+ } else {
94
+ t5 = $[13];
95
+ }
96
+ return t5;
45
97
  };
46
98
 
47
99
  //# sourceMappingURL=DiscardChangesConfirmationDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Dialog/DiscardChangesConfirmationDialog.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport type { ReactElement } from 'react';\n\nimport { Dialog } from './Dialog';\n\ninterface DiscardChangesConfirmationDialogProps {\n description: string;\n isOpen: boolean;\n onCancel: () => void;\n onDiscardChanges: () => void;\n}\n\nexport const DiscardChangesConfirmationDialog = (props: DiscardChangesConfirmationDialogProps): ReactElement => {\n const { description, isOpen, onCancel, onDiscardChanges } = props;\n\n return (\n <Dialog open={isOpen} aria-labelledby=\"discard-dialog\">\n <Dialog.Header>Discard Changes</Dialog.Header>\n <Dialog.Content>{description}</Dialog.Content>\n <Dialog.Actions>\n <Button variant=\"contained\" onClick={onDiscardChanges}>\n Discard Changes\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={onCancel}>\n Cancel\n </Button>\n </Dialog.Actions>\n </Dialog>\n );\n};\n"],"names":["Button","Dialog","DiscardChangesConfirmationDialog","props","description","isOpen","onCancel","onDiscardChanges","open","aria-labelledby","Header","Content","Actions","variant","onClick","color"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAQ,gBAAgB;AAGvC,SAASC,MAAM,QAAQ,cAAW;AASlC,OAAO,MAAMC,mCAAmC,CAACC;IAC/C,MAAM,EAAEC,WAAW,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAAGJ;IAE5D,qBACE,MAACF;QAAOO,MAAMH;QAAQI,mBAAgB;;0BACpC,KAACR,OAAOS,MAAM;0BAAC;;0BACf,KAACT,OAAOU,OAAO;0BAAEP;;0BACjB,MAACH,OAAOW,OAAO;;kCACb,KAACZ;wBAAOa,SAAQ;wBAAYC,SAASP;kCAAkB;;kCAGvD,KAACP;wBAAOa,SAAQ;wBAAWE,OAAM;wBAAYD,SAASR;kCAAU;;;;;;AAMxE,EAAE"}
1
+ {"version":3,"sources":["../../src/Dialog/DiscardChangesConfirmationDialog.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport type { ReactElement } from 'react';\n\nimport { Dialog } from './Dialog';\n\ninterface DiscardChangesConfirmationDialogProps {\n description: string;\n isOpen: boolean;\n onCancel: () => void;\n onDiscardChanges: () => void;\n}\n\nexport const DiscardChangesConfirmationDialog = (props: DiscardChangesConfirmationDialogProps): ReactElement => {\n const { description, isOpen, onCancel, onDiscardChanges } = props;\n\n return (\n <Dialog open={isOpen} aria-labelledby=\"discard-dialog\">\n <Dialog.Header>Discard Changes</Dialog.Header>\n <Dialog.Content>{description}</Dialog.Content>\n <Dialog.Actions>\n <Button variant=\"contained\" onClick={onDiscardChanges}>\n Discard Changes\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={onCancel}>\n Cancel\n </Button>\n </Dialog.Actions>\n </Dialog>\n );\n};\n"],"names":["Button","Dialog","DiscardChangesConfirmationDialog"],"mappings":";;AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAQ,gBAAgB;AAGvC,SAASC,MAAM,QAAQ,cAAW;AASlC,OAAO,MAAMC,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB9C"}