@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.
- package/dist/AlignSelector/AlignSelector.js +115 -25
- package/dist/AlignSelector/AlignSelector.js.map +1 -1
- package/dist/CodeEditor/CodeEditor.d.ts +19 -0
- package/dist/CodeEditor/CodeEditor.d.ts.map +1 -0
- package/dist/CodeEditor/CodeEditor.js +122 -0
- package/dist/CodeEditor/CodeEditor.js.map +1 -0
- package/dist/ColorPicker/ColorPicker.js +153 -61
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js +147 -52
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js +144 -41
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/DensitySelector/DensitySelector.js +53 -20
- package/dist/DensitySelector/DensitySelector.js.map +1 -1
- package/dist/Dialog/Dialog.d.ts +3 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +202 -49
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js +79 -27
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/DragAndDrop/DragAndDropList.js +184 -113
- package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
- package/dist/DragAndDrop/DragButton.js +131 -52
- package/dist/DragAndDrop/DragButton.js.map +1 -1
- package/dist/DragAndDrop/DropIndicator.js +51 -26
- package/dist/DragAndDrop/DropIndicator.js.map +1 -1
- package/dist/Drawer/Drawer.js +75 -15
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/EChart/EChart.js +179 -90
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/ErrorAlert.js +14 -4
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js +463 -190
- package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.js +82 -50
- package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
- package/dist/FormEditor/FormActions.js +88 -14
- package/dist/FormEditor/FormActions.js.map +1 -1
- package/dist/FormatControls/FormatControls.js +246 -99
- package/dist/FormatControls/FormatControls.js.map +1 -1
- package/dist/FormatControls/UnitSelector.js +90 -25
- package/dist/FormatControls/UnitSelector.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js +105 -42
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/JSONEditor.d.ts +2 -6
- package/dist/JSONEditor.d.ts.map +1 -1
- package/dist/JSONEditor.js +24 -37
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.js +77 -27
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.js +184 -82
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.js +54 -9
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.js +46 -16
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.js +184 -48
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.d.ts.map +1 -1
- package/dist/Legend/TableLegend.js +90 -48
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/legend-model.d.ts +2 -2
- package/dist/Legend/legend-model.d.ts.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LinksEditor/LinkEditorForm.js +148 -67
- package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
- package/dist/ModeSelector/ModeSelector.js +61 -19
- package/dist/ModeSelector/ModeSelector.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js +20 -9
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +130 -54
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +17 -6
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +76 -28
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/Overlay/Overlay.js +71 -27
- package/dist/Overlay/Overlay.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +96 -38
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/RepeatGrid/RepeatGrid.js +117 -45
- package/dist/RepeatGrid/RepeatGrid.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +99 -38
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/SortSelector/SortSelector.js +51 -18
- package/dist/SortSelector/SortSelector.js.map +1 -1
- package/dist/SortSelector/SortSelectorButtons.js +109 -25
- package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
- package/dist/Table/InnerTable.js +46 -15
- package/dist/Table/InnerTable.js.map +1 -1
- package/dist/Table/Table.d.ts +3 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +410 -158
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.js +15 -4
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableCell.js +284 -107
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.js +101 -32
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableFoot.js +15 -4
- package/dist/Table/TableFoot.js.map +1 -1
- package/dist/Table/TableHead.js +15 -4
- package/dist/Table/TableHead.js.map +1 -1
- package/dist/Table/TableHeaderCell.js +119 -62
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/TableRow.js +33 -9
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/TableToolbar.d.ts +5 -4
- package/dist/Table/TableToolbar.d.ts.map +1 -1
- package/dist/Table/TableToolbar.js +172 -100
- package/dist/Table/TableToolbar.js.map +1 -1
- package/dist/Table/VirtualizedTable.d.ts +11 -11
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +387 -219
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js +27 -7
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.d.ts +6 -5
- package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.js +57 -32
- package/dist/Table/hooks/useFuzzySearch.js.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js +115 -74
- package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +74 -53
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +44 -15
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +33 -1
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +137 -47
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +341 -174
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js +368 -162
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js +580 -209
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +189 -65
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +168 -78
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js +38 -11
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +229 -72
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js +73 -27
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +221 -121
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +44 -38
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeZoneSelector.js +131 -36
- package/dist/TimeZoneSelector.js.map +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.js +18 -7
- package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/TransformsEditor/TransformEditor.js +830 -334
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js +252 -90
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.js +170 -59
- package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js +800 -322
- package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js +218 -91
- package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
- package/dist/YAMLEditor/YAMLEditor.d.ts +12 -0
- package/dist/YAMLEditor/YAMLEditor.d.ts.map +1 -0
- package/dist/YAMLEditor/YAMLEditor.js +41 -0
- package/dist/YAMLEditor/YAMLEditor.js.map +1 -0
- package/dist/YAMLEditor/index.d.ts +2 -0
- package/dist/YAMLEditor/index.d.ts.map +1 -0
- package/dist/YAMLEditor/index.js +15 -0
- package/dist/YAMLEditor/index.js.map +1 -0
- package/dist/YAMLEditor/yaml-utils.d.ts +11 -0
- package/dist/YAMLEditor/yaml-utils.d.ts.map +1 -0
- package/dist/YAMLEditor/yaml-utils.js +52 -0
- package/dist/YAMLEditor/yaml-utils.js.map +1 -0
- package/dist/YAxisLabel.js +64 -20
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/context/ChartsProvider.js +32 -16
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/context/ItemActionsProvider.js +110 -61
- package/dist/context/ItemActionsProvider.js.map +1 -1
- package/dist/context/SelectionProvider.js +170 -66
- package/dist/context/SelectionProvider.js.map +1 -1
- package/dist/context/SnackbarProvider.js +101 -44
- package/dist/context/SnackbarProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.js +35 -14
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/controls/TextField.js +86 -25
- package/dist/controls/TextField.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/browser-storage.js +64 -34
- package/dist/utils/browser-storage.js.map +1 -1
- package/dist/utils/time-series-data.d.ts.map +1 -1
- package/dist/utils/time-series-data.js +5 -2
- package/dist/utils/time-series-data.js.map +1 -1
- package/package.json +13 -7
package/dist/TimeZoneSelector.js
CHANGED
|
@@ -11,51 +11,146 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { c as _c } from "react-compiler-runtime";
|
|
14
15
|
import { Select, MenuItem } from "@mui/material";
|
|
15
|
-
import { useMemo } from "react";
|
|
16
16
|
import { getTimeZoneOptions } from "./model/timeZoneOption.js";
|
|
17
17
|
/**
|
|
18
18
|
* Timezone selector component
|
|
19
19
|
* Allows users to select a timezone from a dropdown list
|
|
20
|
-
*/ export function TimeZoneSelector(
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
*/ export function TimeZoneSelector(t0) {
|
|
21
|
+
const $ = _c(31);
|
|
22
|
+
let heightPx;
|
|
23
|
+
let onChange;
|
|
24
|
+
let selectProps;
|
|
25
|
+
let t1;
|
|
26
|
+
let timeZoneOptions;
|
|
27
|
+
let value;
|
|
28
|
+
if ($[0] !== t0) {
|
|
29
|
+
({ value, onChange, timeZoneOptions, variant: t1, heightPx, ...selectProps } = t0);
|
|
30
|
+
$[0] = t0;
|
|
31
|
+
$[1] = heightPx;
|
|
32
|
+
$[2] = onChange;
|
|
33
|
+
$[3] = selectProps;
|
|
34
|
+
$[4] = t1;
|
|
35
|
+
$[5] = timeZoneOptions;
|
|
36
|
+
$[6] = value;
|
|
37
|
+
} else {
|
|
38
|
+
heightPx = $[1];
|
|
39
|
+
onChange = $[2];
|
|
40
|
+
selectProps = $[3];
|
|
41
|
+
t1 = $[4];
|
|
42
|
+
timeZoneOptions = $[5];
|
|
43
|
+
value = $[6];
|
|
44
|
+
}
|
|
45
|
+
const variant = t1 === undefined ? "standard" : t1;
|
|
46
|
+
let t2;
|
|
47
|
+
if ($[7] !== timeZoneOptions) {
|
|
48
|
+
t2 = timeZoneOptions ?? getTimeZoneOptions();
|
|
49
|
+
$[7] = timeZoneOptions;
|
|
50
|
+
$[8] = t2;
|
|
51
|
+
} else {
|
|
52
|
+
t2 = $[8];
|
|
27
53
|
}
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
54
|
+
const options = t2;
|
|
55
|
+
let height;
|
|
56
|
+
if ($[9] !== heightPx) {
|
|
57
|
+
if (heightPx) {
|
|
58
|
+
height = typeof heightPx === "number" ? `${heightPx}px` : heightPx;
|
|
32
59
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
60
|
+
$[9] = heightPx;
|
|
61
|
+
$[10] = height;
|
|
62
|
+
} else {
|
|
63
|
+
height = $[10];
|
|
64
|
+
}
|
|
65
|
+
let t3;
|
|
66
|
+
if ($[11] !== onChange || $[12] !== options) {
|
|
67
|
+
t3 = (selectedValue)=>{
|
|
68
|
+
const selectedOption = options.find((opt)=>opt.value === selectedValue);
|
|
69
|
+
if (selectedOption && onChange) {
|
|
70
|
+
onChange(selectedOption);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
$[11] = onChange;
|
|
74
|
+
$[12] = options;
|
|
75
|
+
$[13] = t3;
|
|
76
|
+
} else {
|
|
77
|
+
t3 = $[13];
|
|
78
|
+
}
|
|
79
|
+
const handleChange = t3;
|
|
80
|
+
height;
|
|
81
|
+
const t4 = variant === "compact" ? "80px" : "150px";
|
|
82
|
+
let t5;
|
|
83
|
+
if ($[14] !== height) {
|
|
84
|
+
t5 = height && {
|
|
85
|
+
lineHeight: height,
|
|
86
|
+
paddingY: 0
|
|
87
|
+
};
|
|
88
|
+
$[14] = height;
|
|
89
|
+
$[15] = t5;
|
|
90
|
+
} else {
|
|
91
|
+
t5 = $[15];
|
|
92
|
+
}
|
|
93
|
+
let t6;
|
|
94
|
+
if ($[16] !== selectProps.sx || $[17] !== t4 || $[18] !== t5) {
|
|
95
|
+
t6 = {
|
|
96
|
+
minWidth: t4,
|
|
97
|
+
...t5,
|
|
40
98
|
...selectProps.sx
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
99
|
+
};
|
|
100
|
+
$[16] = selectProps.sx;
|
|
101
|
+
$[17] = t4;
|
|
102
|
+
$[18] = t5;
|
|
103
|
+
$[19] = t6;
|
|
104
|
+
} else {
|
|
105
|
+
t6 = $[19];
|
|
106
|
+
}
|
|
107
|
+
const sxStyles = t6;
|
|
108
|
+
let t7;
|
|
109
|
+
if ($[20] !== handleChange) {
|
|
110
|
+
t7 = (event, _child)=>{
|
|
50
111
|
handleChange(event.target.value);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
112
|
+
};
|
|
113
|
+
$[20] = handleChange;
|
|
114
|
+
$[21] = t7;
|
|
115
|
+
} else {
|
|
116
|
+
t7 = $[21];
|
|
117
|
+
}
|
|
118
|
+
const t8 = variant === "compact" ? "small" : "medium";
|
|
119
|
+
let t9;
|
|
120
|
+
if ($[22] !== options) {
|
|
121
|
+
t9 = options.map(_temp);
|
|
122
|
+
$[22] = options;
|
|
123
|
+
$[23] = t9;
|
|
124
|
+
} else {
|
|
125
|
+
t9 = $[23];
|
|
126
|
+
}
|
|
127
|
+
let t10;
|
|
128
|
+
if ($[24] !== selectProps || $[25] !== sxStyles || $[26] !== t7 || $[27] !== t8 || $[28] !== t9 || $[29] !== value) {
|
|
129
|
+
t10 = /*#__PURE__*/ _jsx(Select, {
|
|
130
|
+
...selectProps,
|
|
131
|
+
value: value,
|
|
132
|
+
onChange: t7,
|
|
133
|
+
sx: sxStyles,
|
|
134
|
+
size: t8,
|
|
135
|
+
children: t9
|
|
136
|
+
});
|
|
137
|
+
$[24] = selectProps;
|
|
138
|
+
$[25] = sxStyles;
|
|
139
|
+
$[26] = t7;
|
|
140
|
+
$[27] = t8;
|
|
141
|
+
$[28] = t9;
|
|
142
|
+
$[29] = value;
|
|
143
|
+
$[30] = t10;
|
|
144
|
+
} else {
|
|
145
|
+
t10 = $[30];
|
|
146
|
+
}
|
|
147
|
+
return t10;
|
|
148
|
+
}
|
|
149
|
+
function _temp(option) {
|
|
150
|
+
return /*#__PURE__*/ _jsx(MenuItem, {
|
|
151
|
+
value: option.value,
|
|
152
|
+
children: option.display
|
|
153
|
+
}, option.value);
|
|
59
154
|
}
|
|
60
155
|
|
|
61
156
|
//# sourceMappingURL=TimeZoneSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TimeZoneSelector.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 { SelectProps, SelectChangeEvent } from '@mui/material';\nimport { Select, MenuItem } from '@mui/material';\nimport type { ReactElement, ReactNode } from 'react';\nimport { useMemo } from 'react';\n\nimport type { TimeZoneOption } from './model/timeZoneOption';\nimport { getTimeZoneOptions } from './model/timeZoneOption';\n\nexport interface TimeZoneSelectorProps extends Omit<SelectProps, 'onChange' | 'variant' | 'value'> {\n value: string;\n onChange?: (timeZoneOption: TimeZoneOption) => void;\n timeZoneOptions?: TimeZoneOption[];\n variant?: 'standard' | 'compact';\n heightPx?: string | number;\n}\n\n/**\n * Timezone selector component\n * Allows users to select a timezone from a dropdown list\n */\nexport function TimeZoneSelector({\n value,\n onChange,\n timeZoneOptions,\n variant = 'standard',\n heightPx,\n ...selectProps\n}: TimeZoneSelectorProps): ReactElement {\n const options = useMemo(() => timeZoneOptions ?? getTimeZoneOptions(), [timeZoneOptions]);\n\n let height: string | undefined;\n if (heightPx) {\n height = typeof heightPx === 'number' ? `${heightPx}px` : heightPx;\n }\n\n const handleChange = (selectedValue: string): void => {\n const selectedOption = options.find((opt: TimeZoneOption) => opt.value === selectedValue);\n if (selectedOption && onChange) {\n onChange(selectedOption);\n }\n };\n\n const sxStyles = useMemo(\n () => ({\n minWidth: variant === 'compact' ? '80px' : '150px',\n ...(height && { lineHeight: height, paddingY: 0 }),\n ...selectProps.sx,\n }),\n [variant, height, selectProps.sx],\n );\n\n return (\n <Select\n {...selectProps}\n value={value}\n onChange={(event: SelectChangeEvent<unknown>, _child: ReactNode) => {\n handleChange(event.target.value as string);\n }}\n sx={sxStyles}\n size={variant === 'compact' ? 'small' : 'medium'}\n >\n {options.map((option: TimeZoneOption) => (\n <MenuItem key={option.value} value={option.value}>\n {option.display}\n </MenuItem>\n ))}\n </Select>\n );\n}\n"],"names":["Select","MenuItem","
|
|
1
|
+
{"version":3,"sources":["../src/TimeZoneSelector.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 { SelectProps, SelectChangeEvent } from '@mui/material';\nimport { Select, MenuItem } from '@mui/material';\nimport type { ReactElement, ReactNode } from 'react';\nimport { useMemo } from 'react';\n\nimport type { TimeZoneOption } from './model/timeZoneOption';\nimport { getTimeZoneOptions } from './model/timeZoneOption';\n\nexport interface TimeZoneSelectorProps extends Omit<SelectProps, 'onChange' | 'variant' | 'value'> {\n value: string;\n onChange?: (timeZoneOption: TimeZoneOption) => void;\n timeZoneOptions?: TimeZoneOption[];\n variant?: 'standard' | 'compact';\n heightPx?: string | number;\n}\n\n/**\n * Timezone selector component\n * Allows users to select a timezone from a dropdown list\n */\nexport function TimeZoneSelector({\n value,\n onChange,\n timeZoneOptions,\n variant = 'standard',\n heightPx,\n ...selectProps\n}: TimeZoneSelectorProps): ReactElement {\n const options = useMemo(() => timeZoneOptions ?? getTimeZoneOptions(), [timeZoneOptions]);\n\n let height: string | undefined;\n if (heightPx) {\n height = typeof heightPx === 'number' ? `${heightPx}px` : heightPx;\n }\n\n const handleChange = (selectedValue: string): void => {\n const selectedOption = options.find((opt: TimeZoneOption) => opt.value === selectedValue);\n if (selectedOption && onChange) {\n onChange(selectedOption);\n }\n };\n\n const sxStyles = useMemo(\n () => ({\n minWidth: variant === 'compact' ? '80px' : '150px',\n ...(height && { lineHeight: height, paddingY: 0 }),\n ...selectProps.sx,\n }),\n [variant, height, selectProps.sx],\n );\n\n return (\n <Select\n {...selectProps}\n value={value}\n onChange={(event: SelectChangeEvent<unknown>, _child: ReactNode) => {\n handleChange(event.target.value as string);\n }}\n sx={sxStyles}\n size={variant === 'compact' ? 'small' : 'medium'}\n >\n {options.map((option: TimeZoneOption) => (\n <MenuItem key={option.value} value={option.value}>\n {option.display}\n </MenuItem>\n ))}\n </Select>\n );\n}\n"],"names":["Select","MenuItem","getTimeZoneOptions"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAGjC,SAASA,MAAM,EAAEC,QAAQ,QAAQ,gBAAgB;AAKjD,SAASC,kBAAkB,QAAQ,4BAAyB;AAU5D;;;CAGC,GACD,OAAO"}
|
|
@@ -11,21 +11,32 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { c as _c } from "react-compiler-runtime";
|
|
14
15
|
import { Button, styled } from "@mui/material";
|
|
15
16
|
import { forwardRef } from "react";
|
|
16
17
|
function IconButton(props, ref) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const $ = _c(3);
|
|
19
|
+
let t0;
|
|
20
|
+
if ($[0] !== props || $[1] !== ref) {
|
|
21
|
+
t0 = /*#__PURE__*/ _jsx(StyledIconButton, {
|
|
22
|
+
ref: ref,
|
|
23
|
+
variant: "outlined",
|
|
24
|
+
color: "secondary",
|
|
25
|
+
...props
|
|
26
|
+
});
|
|
27
|
+
$[0] = props;
|
|
28
|
+
$[1] = ref;
|
|
29
|
+
$[2] = t0;
|
|
30
|
+
} else {
|
|
31
|
+
t0 = $[2];
|
|
32
|
+
}
|
|
33
|
+
return t0;
|
|
23
34
|
}
|
|
24
35
|
const StyledIconButton = styled(Button)(({ theme })=>({
|
|
25
36
|
// Using a button with some adjusted styles because it is easier to inherit
|
|
26
37
|
// styling and variants from themes than with an IconButton.
|
|
27
38
|
padding: theme.spacing(0.5),
|
|
28
|
-
minWidth:
|
|
39
|
+
minWidth: "auto"
|
|
29
40
|
}));
|
|
30
41
|
export const ToolbarIconButton = /*#__PURE__*/ forwardRef(IconButton);
|
|
31
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ToolbarIconButton/ToolbarIconButton.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 { ButtonProps } from '@mui/material';\nimport { Button, styled } from '@mui/material';\nimport type { ForwardedRef, ReactElement } from 'react';\nimport { forwardRef } from 'react';\n\ntype ToolbarIconButtonProps = ButtonProps;\n\nfunction IconButton(props: ToolbarIconButtonProps, ref: ForwardedRef<HTMLButtonElement>): ReactElement {\n return <StyledIconButton ref={ref} variant=\"outlined\" color=\"secondary\" {...props} />;\n}\n\nconst StyledIconButton = styled(Button)(({ theme }) => ({\n // Using a button with some adjusted styles because it is easier to inherit\n // styling and variants from themes than with an IconButton.\n padding: theme.spacing(0.5),\n minWidth: 'auto',\n}));\n\nexport const ToolbarIconButton = forwardRef(IconButton);\n"],"names":["Button","styled","forwardRef","
|
|
1
|
+
{"version":3,"sources":["../../src/ToolbarIconButton/ToolbarIconButton.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 { ButtonProps } from '@mui/material';\nimport { Button, styled } from '@mui/material';\nimport type { ForwardedRef, ReactElement } from 'react';\nimport { forwardRef } from 'react';\n\ntype ToolbarIconButtonProps = ButtonProps;\n\nfunction IconButton(props: ToolbarIconButtonProps, ref: ForwardedRef<HTMLButtonElement>): ReactElement {\n return <StyledIconButton ref={ref} variant=\"outlined\" color=\"secondary\" {...props} />;\n}\n\nconst StyledIconButton = styled(Button)(({ theme }) => ({\n // Using a button with some adjusted styles because it is easier to inherit\n // styling and variants from themes than with an IconButton.\n padding: theme.spacing(0.5),\n minWidth: 'auto',\n}));\n\nexport const ToolbarIconButton = forwardRef(IconButton);\n"],"names":["Button","styled","forwardRef","StyledIconButton","theme","padding","spacing","minWidth","ToolbarIconButton","IconButton"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAGjC,SAASA,MAAM,EAAEC,MAAM,QAAQ,gBAAgB;AAE/C,SAASC,UAAU,QAAQ,QAAQ;AAInC;;;;;;;;;;;;;;;;;;AAIA,MAAMC,mBAAmBF,OAAOD,QAAQ,CAAC,EAAEI,KAAK,EAAE,GAAM,CAAA;QACtD,2EAA2E;QAC3E,4DAA4D;QAC5DC,SAASD,MAAME,OAAO,CAAC;QACvBC,UAAU;IACZ,CAAA;AAEA,OAAO,MAAMC,kCAAoBN,WAAWO,YAAY"}
|