@perses-dev/components 0.0.0-snapshot-time-zone-selector-946f408 → 0.0.0-snapshot-timeseries-panel-actions-e28c1fe

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 (54) hide show
  1. package/dist/EChart/EChart.d.ts.map +1 -1
  2. package/dist/EChart/EChart.js +2 -1
  3. package/dist/EChart/EChart.js.map +1 -1
  4. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  5. package/dist/FormatControls/FormatControls.js +8 -7
  6. package/dist/FormatControls/FormatControls.js.map +1 -1
  7. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +1 -2
  8. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
  9. package/dist/TimeRangeSelector/DateTimeRangePicker.js +6 -5
  10. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  11. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +1 -5
  12. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
  13. package/dist/TimeRangeSelector/TimeRangeSelector.js +10 -14
  14. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  15. package/dist/cjs/EChart/EChart.js +1 -0
  16. package/dist/cjs/FormatControls/FormatControls.js +7 -6
  17. package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +6 -5
  18. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +8 -12
  19. package/dist/cjs/context/TimeZoneProvider.js +98 -0
  20. package/dist/cjs/context/index.js +1 -0
  21. package/dist/cjs/index.js +0 -1
  22. package/dist/cjs/model/index.js +0 -1
  23. package/dist/context/TimeZoneProvider.d.ts +13 -0
  24. package/dist/context/TimeZoneProvider.d.ts.map +1 -0
  25. package/dist/context/TimeZoneProvider.js +38 -0
  26. package/dist/context/TimeZoneProvider.js.map +1 -0
  27. package/dist/context/index.d.ts +1 -0
  28. package/dist/context/index.d.ts.map +1 -1
  29. package/dist/context/index.js +1 -0
  30. package/dist/context/index.js.map +1 -1
  31. package/dist/index.d.ts +0 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +0 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/model/index.d.ts +0 -1
  36. package/dist/model/index.d.ts.map +1 -1
  37. package/dist/model/index.js +0 -1
  38. package/dist/model/index.js.map +1 -1
  39. package/package.json +2 -2
  40. package/dist/TimeZoneSelector/TimeZoneSelector.d.ts +0 -10
  41. package/dist/TimeZoneSelector/TimeZoneSelector.d.ts.map +0 -1
  42. package/dist/TimeZoneSelector/TimeZoneSelector.js +0 -143
  43. package/dist/TimeZoneSelector/TimeZoneSelector.js.map +0 -1
  44. package/dist/TimeZoneSelector/index.d.ts +0 -2
  45. package/dist/TimeZoneSelector/index.d.ts.map +0 -1
  46. package/dist/TimeZoneSelector/index.js +0 -15
  47. package/dist/TimeZoneSelector/index.js.map +0 -1
  48. package/dist/cjs/TimeZoneSelector/TimeZoneSelector.js +0 -156
  49. package/dist/cjs/TimeZoneSelector/index.js +0 -30
  50. package/dist/cjs/model/timeZoneOption.js +0 -100
  51. package/dist/model/timeZoneOption.d.ts +0 -10
  52. package/dist/model/timeZoneOption.d.ts.map +0 -1
  53. package/dist/model/timeZoneOption.js +0 -79
  54. package/dist/model/timeZoneOption.js.map +0 -1
@@ -22,9 +22,10 @@ Object.defineProperty(exports, "TimeRangeSelector", {
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
24
24
  const _material = require("@mui/material");
25
- const _ClockTimeFiveOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ClockTimeFiveOutline"));
25
+ const _Calendar = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Calendar"));
26
26
  const _core = require("@perses-dev/core");
27
27
  const _react = require("react");
28
+ const _context = require("../context");
28
29
  const _DateTimeRangePicker = require("./DateTimeRangePicker");
29
30
  const _utils = require("./utils");
30
31
  function _interop_require_default(obj) {
@@ -32,8 +33,8 @@ function _interop_require_default(obj) {
32
33
  default: obj
33
34
  };
34
35
  }
35
- function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTimeRange = true, timeZone = _core.DEFAULT_DASHBOARD_TIMEZONE }) {
36
- const isMobile = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.down('md'));
36
+ function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTimeRange = true }) {
37
+ const { timeZone } = (0, _context.useTimeZone)();
37
38
  const anchorEl = (0, _react.useRef)(); // Used to position the absolute time range picker
38
39
  // Control the open state of the absolute time range picker
39
40
  const [showCustomDateSelector, setShowCustomDateSelector] = (0, _react.useState)(false);
@@ -77,8 +78,7 @@ function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTim
77
78
  setShowCustomDateSelector(false);
78
79
  setOpen(false);
79
80
  },
80
- onCancel: ()=>setShowCustomDateSelector(false),
81
- timeZone: timeZone
81
+ onCancel: ()=>setShowCustomDateSelector(false)
82
82
  })
83
83
  }),
84
84
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
@@ -87,22 +87,18 @@ function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTim
87
87
  open: open,
88
88
  value: (0, _utils.formatTimeRange)(value, timeZone),
89
89
  onClick: ()=>setOpen(!open),
90
- IconComponent: _ClockTimeFiveOutline.default,
90
+ IconComponent: _Calendar.default,
91
91
  inputProps: {
92
92
  'aria-label': `Select time range. Currently set to ${value}`
93
93
  },
94
94
  sx: {
95
95
  // `transform: none` prevents calendar icon from flipping over when menu is open
96
96
  '.MuiSelect-icon': {
97
+ marginTop: '1px',
97
98
  transform: 'none'
98
99
  },
99
100
  // paddingRight creates more space for the calendar icon (it's a bigger icon)
100
- '.MuiSelect-select.MuiSelect-outlined.MuiInputBase-input': isMobile ? {
101
- paddingRight: '25px',
102
- textIndent: '-9999px',
103
- whiteSpace: 'nowrap',
104
- overflow: 'hidden'
105
- } : {
101
+ '.MuiSelect-select.MuiSelect-outlined.MuiInputBase-input': {
106
102
  paddingRight: '36px'
107
103
  },
108
104
  '.MuiSelect-select': height ? {
@@ -0,0 +1,98 @@
1
+ // Copyright 2023 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
+ TimeZoneContext: function() {
25
+ return TimeZoneContext;
26
+ },
27
+ TimeZoneProvider: function() {
28
+ return TimeZoneProvider;
29
+ },
30
+ useTimeZone: function() {
31
+ return useTimeZone;
32
+ }
33
+ });
34
+ const _jsxruntime = require("react/jsx-runtime");
35
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
36
+ const _utils = require("../utils");
37
+ function _getRequireWildcardCache(nodeInterop) {
38
+ if (typeof WeakMap !== "function") return null;
39
+ var cacheBabelInterop = new WeakMap();
40
+ var cacheNodeInterop = new WeakMap();
41
+ return (_getRequireWildcardCache = function(nodeInterop) {
42
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
43
+ })(nodeInterop);
44
+ }
45
+ function _interop_require_wildcard(obj, nodeInterop) {
46
+ if (!nodeInterop && obj && obj.__esModule) {
47
+ return obj;
48
+ }
49
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
50
+ return {
51
+ default: obj
52
+ };
53
+ }
54
+ var cache = _getRequireWildcardCache(nodeInterop);
55
+ if (cache && cache.has(obj)) {
56
+ return cache.get(obj);
57
+ }
58
+ var newObj = {
59
+ __proto__: null
60
+ };
61
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
62
+ for(var key in obj){
63
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
64
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
65
+ if (desc && (desc.get || desc.set)) {
66
+ Object.defineProperty(newObj, key, desc);
67
+ } else {
68
+ newObj[key] = obj[key];
69
+ }
70
+ }
71
+ }
72
+ newObj.default = obj;
73
+ if (cache) {
74
+ cache.set(obj, newObj);
75
+ }
76
+ return newObj;
77
+ }
78
+ const TimeZoneContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
79
+ function TimeZoneProvider(props) {
80
+ const { children, timeZone } = props;
81
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(TimeZoneContext.Provider, {
82
+ value: timeZone,
83
+ children: children
84
+ });
85
+ }
86
+ function useTimeZone() {
87
+ const timeZone = (0, _react.useContext)(TimeZoneContext);
88
+ return {
89
+ // fallback to "local" timezone if TimeZoneProvider is not present in the React tree
90
+ timeZone: timeZone ?? 'local',
91
+ formatWithUserTimeZone (date, formatString) {
92
+ return (0, _utils.formatWithTimeZone)(date, formatString, timeZone);
93
+ },
94
+ dateFormatOptionsWithUserTimeZone (dateFormatOptions) {
95
+ return (0, _utils.dateFormatOptionsWithTimeZone)(dateFormatOptions, timeZone);
96
+ }
97
+ };
98
+ }
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", {
16
16
  });
17
17
  _export_star(require("./ChartsProvider"), exports);
18
18
  _export_star(require("./SnackbarProvider"), exports);
19
+ _export_star(require("./TimeZoneProvider"), exports);
19
20
  function _export_star(from, to) {
20
21
  Object.keys(from).forEach(function(k) {
21
22
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
package/dist/cjs/index.js CHANGED
@@ -39,7 +39,6 @@ _export_star(require("./SortSelector"), exports);
39
39
  _export_star(require("./Table"), exports);
40
40
  _export_star(require("./ThresholdsEditor"), exports);
41
41
  _export_star(require("./TimeRangeSelector"), exports);
42
- _export_star(require("./TimeZoneSelector"), exports);
43
42
  _export_star(require("./TimeSeriesTooltip"), exports);
44
43
  _export_star(require("./ToolbarIconButton"), exports);
45
44
  _export_star(require("./FormatControls"), exports);
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", {
17
17
  _export_star(require("./graph"), exports);
18
18
  _export_star(require("./theme"), exports);
19
19
  _export_star(require("./timeOption"), exports);
20
- _export_star(require("./timeZoneOption"), exports);
21
20
  function _export_star(from, to) {
22
21
  Object.keys(from).forEach(function(k) {
23
22
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -0,0 +1,13 @@
1
+ import React, { ReactElement } from 'react';
2
+ export declare const TimeZoneContext: React.Context<string | undefined>;
3
+ export interface TimeZoneProviderProps {
4
+ timeZone?: string;
5
+ children?: React.ReactNode;
6
+ }
7
+ export declare function TimeZoneProvider(props: TimeZoneProviderProps): ReactElement;
8
+ export declare function useTimeZone(): {
9
+ timeZone: string;
10
+ formatWithUserTimeZone: (date: Date, formatString: string) => string;
11
+ dateFormatOptionsWithUserTimeZone: (dateFormatOptions: Intl.DateTimeFormatOptions) => Intl.DateTimeFormatOptions;
12
+ };
13
+ //# sourceMappingURL=TimeZoneProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeZoneProvider.d.ts","sourceRoot":"","sources":["../../src/context/TimeZoneProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAiB,YAAY,EAAc,MAAM,OAAO,CAAC;AAGvE,eAAO,MAAM,eAAe,mCAA+C,CAAC;AAE5E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAG3E;AAED,wBAAgB,WAAW,IAAI;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IACrE,iCAAiC,EAAE,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,KAAK,IAAI,CAAC,qBAAqB,CAAC;CAClH,CAYA"}
@@ -0,0 +1,38 @@
1
+ // Copyright 2023 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
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import React, { createContext, useContext } from 'react';
15
+ import { formatWithTimeZone, dateFormatOptionsWithTimeZone } from '../utils';
16
+ export const TimeZoneContext = /*#__PURE__*/ createContext(undefined);
17
+ export function TimeZoneProvider(props) {
18
+ const { children, timeZone } = props;
19
+ return /*#__PURE__*/ _jsx(TimeZoneContext.Provider, {
20
+ value: timeZone,
21
+ children: children
22
+ });
23
+ }
24
+ export function useTimeZone() {
25
+ const timeZone = useContext(TimeZoneContext);
26
+ return {
27
+ // fallback to "local" timezone if TimeZoneProvider is not present in the React tree
28
+ timeZone: timeZone ?? 'local',
29
+ formatWithUserTimeZone (date, formatString) {
30
+ return formatWithTimeZone(date, formatString, timeZone);
31
+ },
32
+ dateFormatOptionsWithUserTimeZone (dateFormatOptions) {
33
+ return dateFormatOptionsWithTimeZone(dateFormatOptions, timeZone);
34
+ }
35
+ };
36
+ }
37
+
38
+ //# sourceMappingURL=TimeZoneProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/TimeZoneProvider.tsx"],"sourcesContent":["// Copyright 2023 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 React, { createContext, ReactElement, useContext } from 'react';\nimport { formatWithTimeZone, dateFormatOptionsWithTimeZone } from '../utils';\n\nexport const TimeZoneContext = createContext<string | undefined>(undefined);\n\nexport interface TimeZoneProviderProps {\n timeZone?: string;\n children?: React.ReactNode;\n}\n\nexport function TimeZoneProvider(props: TimeZoneProviderProps): ReactElement {\n const { children, timeZone } = props;\n return <TimeZoneContext.Provider value={timeZone}>{children}</TimeZoneContext.Provider>;\n}\n\nexport function useTimeZone(): {\n timeZone: string;\n formatWithUserTimeZone: (date: Date, formatString: string) => string;\n dateFormatOptionsWithUserTimeZone: (dateFormatOptions: Intl.DateTimeFormatOptions) => Intl.DateTimeFormatOptions;\n} {\n const timeZone = useContext(TimeZoneContext);\n return {\n // fallback to \"local\" timezone if TimeZoneProvider is not present in the React tree\n timeZone: timeZone ?? 'local',\n formatWithUserTimeZone(date: Date, formatString: string): string {\n return formatWithTimeZone(date, formatString, timeZone);\n },\n dateFormatOptionsWithUserTimeZone(dateFormatOptions: Intl.DateTimeFormatOptions): Intl.DateTimeFormatOptions {\n return dateFormatOptionsWithTimeZone(dateFormatOptions, timeZone);\n },\n };\n}\n"],"names":["React","createContext","useContext","formatWithTimeZone","dateFormatOptionsWithTimeZone","TimeZoneContext","undefined","TimeZoneProvider","props","children","timeZone","Provider","value","useTimeZone","formatWithUserTimeZone","date","formatString","dateFormatOptionsWithUserTimeZone","dateFormatOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,aAAa,EAAgBC,UAAU,QAAQ,QAAQ;AACvE,SAASC,kBAAkB,EAAEC,6BAA6B,QAAQ,WAAW;AAE7E,OAAO,MAAMC,gCAAkBJ,cAAkCK,WAAW;AAO5E,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGF;IAC/B,qBAAO,KAACH,gBAAgBM,QAAQ;QAACC,OAAOF;kBAAWD;;AACrD;AAEA,OAAO,SAASI;IAKd,MAAMH,WAAWR,WAAWG;IAC5B,OAAO;QACL,oFAAoF;QACpFK,UAAUA,YAAY;QACtBI,wBAAuBC,IAAU,EAAEC,YAAoB;YACrD,OAAOb,mBAAmBY,MAAMC,cAAcN;QAChD;QACAO,mCAAkCC,iBAA6C;YAC7E,OAAOd,8BAA8Bc,mBAAmBR;QAC1D;IACF;AACF"}
@@ -1,3 +1,4 @@
1
1
  export * from './ChartsProvider';
2
2
  export * from './SnackbarProvider';
3
+ export * from './TimeZoneProvider';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
@@ -12,5 +12,6 @@
12
12
  // limitations under the License.
13
13
  export * from './ChartsProvider';
14
14
  export * from './SnackbarProvider';
15
+ export * from './TimeZoneProvider';
15
16
 
16
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context/index.ts"],"sourcesContent":["// Copyright 2023 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\nexport * from './ChartsProvider';\nexport * from './SnackbarProvider';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB"}
1
+ {"version":3,"sources":["../../src/context/index.ts"],"sourcesContent":["// Copyright 2023 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\nexport * from './ChartsProvider';\nexport * from './SnackbarProvider';\nexport * from './TimeZoneProvider';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,qBAAqB"}
package/dist/index.d.ts CHANGED
@@ -23,7 +23,6 @@ export * from './SortSelector';
23
23
  export * from './Table';
24
24
  export * from './ThresholdsEditor';
25
25
  export * from './TimeRangeSelector';
26
- export * from './TimeZoneSelector';
27
26
  export * from './TimeSeriesTooltip';
28
27
  export * from './ToolbarIconButton';
29
28
  export * from './FormatControls';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -35,7 +35,6 @@ export * from './SortSelector';
35
35
  export * from './Table';
36
36
  export * from './ThresholdsEditor';
37
37
  export * from './TimeRangeSelector';
38
- export * from './TimeZoneSelector';
39
38
  export * from './TimeSeriesTooltip';
40
39
  export * from './ToolbarIconButton';
41
40
  export * from './FormatControls';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 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\nexport * from './AlignSelector';\nexport * from './ColorPicker';\nexport * from './ContentWithLegend';\nexport * from './controls';\nexport * from './Dialog';\nexport * from './DensitySelector';\nexport * from './DragAndDrop';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './FontSizeSelector';\nexport * from './FormEditor';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LinksEditor';\nexport * from './ModeSelector';\nexport * from './OptionsEditorLayout';\nexport * from './Overlay';\nexport * from './SettingsAutocomplete';\nexport * from './SortSelector';\nexport * from './Table';\nexport * from './ThresholdsEditor';\nexport * from './TimeRangeSelector';\nexport * from './TimeZoneSelector';\nexport * from './TimeSeriesTooltip';\nexport * from './ToolbarIconButton';\nexport * from './FormatControls';\nexport * from './YAxisLabel';\nexport * from './context';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\nexport * from './TransformsEditor';\nexport * from './RefreshIntervalPicker';\nexport * from './ValueMappingEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,qBAAqB;AACnC,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,YAAY;AAC1B,cAAc,yBAAyB;AACvC,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,0BAA0B;AACxC,cAAc,uBAAuB"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 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\nexport * from './AlignSelector';\nexport * from './ColorPicker';\nexport * from './ContentWithLegend';\nexport * from './controls';\nexport * from './Dialog';\nexport * from './DensitySelector';\nexport * from './DragAndDrop';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './FontSizeSelector';\nexport * from './FormEditor';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LinksEditor';\nexport * from './ModeSelector';\nexport * from './OptionsEditorLayout';\nexport * from './Overlay';\nexport * from './SettingsAutocomplete';\nexport * from './SortSelector';\nexport * from './Table';\nexport * from './ThresholdsEditor';\nexport * from './TimeRangeSelector';\nexport * from './TimeSeriesTooltip';\nexport * from './ToolbarIconButton';\nexport * from './FormatControls';\nexport * from './YAxisLabel';\nexport * from './context';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\nexport * from './TransformsEditor';\nexport * from './RefreshIntervalPicker';\nexport * from './ValueMappingEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,qBAAqB;AACnC,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,YAAY;AAC1B,cAAc,yBAAyB;AACvC,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,0BAA0B;AACxC,cAAc,uBAAuB"}
@@ -1,5 +1,4 @@
1
1
  export * from './graph';
2
2
  export * from './theme';
3
3
  export * from './timeOption';
4
- export * from './timeZoneOption';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
@@ -13,6 +13,5 @@
13
13
  export * from './graph';
14
14
  export * from './theme';
15
15
  export * from './timeOption';
16
- export * from './timeZoneOption';
17
16
 
18
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 2023 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\nexport * from './graph';\nexport * from './theme';\nexport * from './timeOption';\nexport * from './timeZoneOption';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,mBAAmB"}
1
+ {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 2023 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\nexport * from './graph';\nexport * from './theme';\nexport * from './timeOption';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,eAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/components",
3
- "version": "0.0.0-snapshot-time-zone-selector-946f408",
3
+ "version": "0.0.0-snapshot-timeseries-panel-actions-e28c1fe",
4
4
  "description": "Common UI components used across Perses features",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -33,7 +33,7 @@
33
33
  "@codemirror/lang-json": "^6.0.1",
34
34
  "@fontsource/lato": "^4.5.10",
35
35
  "@mui/x-date-pickers": "^7.23.1",
36
- "@perses-dev/core": "0.0.0-snapshot-time-zone-selector-946f408",
36
+ "@perses-dev/core": "0.0.0-snapshot-timeseries-panel-actions-e28c1fe",
37
37
  "@tanstack/react-table": "^8.20.5",
38
38
  "@uiw/react-codemirror": "^4.19.1",
39
39
  "date-fns": "^4.1.0",
@@ -1,10 +0,0 @@
1
- import { ReactElement } from 'react';
2
- import { TimeZoneOption } from '../model/timeZoneOption';
3
- export interface TimeZoneSelectorProps {
4
- heightPx?: string;
5
- timeZoneOptions: TimeZoneOption[];
6
- value: string;
7
- onChange?: (timeZone: TimeZoneOption) => void;
8
- }
9
- export declare function TimeZoneSelector({ heightPx, timeZoneOptions: defaultTimeZoneOptions, onChange, value, }: TimeZoneSelectorProps): ReactElement;
10
- //# sourceMappingURL=TimeZoneSelector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TimeZoneSelector.d.ts","sourceRoot":"","sources":["../../src/TimeZoneSelector/TimeZoneSelector.tsx"],"names":[],"mappings":"AA6BA,OAAO,EAAe,YAAY,EAAY,MAAM,OAAO,CAAC;AAI5D,OAAO,EAAqB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE5E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;CAC/C;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAiB,EACjB,eAAe,EAAE,sBAAsB,EACvC,QAAQ,EACR,KAAkC,GACnC,EAAE,qBAAqB,GAAG,YAAY,CA2GtC"}
@@ -1,143 +0,0 @@
1
- // Copyright 2025 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { MenuItem, Box, Paper, ListItemText, Typography, MenuList, Input, InputAdornment, Divider, useTheme, useMediaQuery } from '@mui/material';
15
- import ClickAwayListener from '@mui/material/ClickAwayListener';
16
- import EarthIcon from 'mdi-material-ui/Earth';
17
- import MagnifyIcon from 'mdi-material-ui/Magnify';
18
- import { useState } from 'react';
19
- import { DEFAULT_DASHBOARD_TIMEZONE } from '@perses-dev/core';
20
- import { ToolbarIconButton } from '../ToolbarIconButton';
21
- import { InfoTooltip } from '../InfoTooltip';
22
- import { getTimeZoneOffset } from '../model/timeZoneOption';
23
- export function TimeZoneSelector({ heightPx = '34px', timeZoneOptions: defaultTimeZoneOptions, onChange, value = DEFAULT_DASHBOARD_TIMEZONE }) {
24
- const isMobile = useMediaQuery(useTheme().breakpoints.down('md'));
25
- const [open, setOpen] = useState(false);
26
- const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
27
- const [searchValue, setSearchValue] = useState('');
28
- const [timeZoneOptions, setTimeZoneOptions] = useState(defaultTimeZoneOptions);
29
- function handleSearchChange(event) {
30
- setSearchValue(event.target.value);
31
- if (event.target.value === '') {
32
- setTimeZoneOptions(defaultTimeZoneOptions);
33
- } else {
34
- setTimeZoneOptions(defaultTimeZoneOptions.filter((option)=>option.label.toLowerCase().includes(event.target.value.toLowerCase())));
35
- }
36
- }
37
- function handleTimeZoneSelection(timeZone) {
38
- setOpen(false);
39
- setTimeZoneOptions(defaultTimeZoneOptions);
40
- setSearchValue('');
41
- onChange?.(timeZone);
42
- }
43
- function handleOnClickAway() {
44
- setOpen(false);
45
- setSearchValue('');
46
- setTimeZoneOptions(defaultTimeZoneOptions);
47
- }
48
- return /*#__PURE__*/ _jsx(ClickAwayListener, {
49
- onClickAway: handleOnClickAway,
50
- children: /*#__PURE__*/ _jsxs(Box, {
51
- children: [
52
- /*#__PURE__*/ _jsx(Box, {
53
- sx: {
54
- position: 'relative'
55
- },
56
- children: /*#__PURE__*/ _jsx(InfoTooltip, {
57
- description: value === DEFAULT_DASHBOARD_TIMEZONE ? localTimeZone : value,
58
- children: /*#__PURE__*/ _jsxs(ToolbarIconButton, {
59
- "data-testid": "current-timezone",
60
- "aria-label": "Timezone",
61
- onClick: ()=>setOpen(!open),
62
- sx: (theme)=>({
63
- height: heightPx,
64
- paddingLeft: isMobile ? 0 : theme.spacing(1),
65
- // Hide the timezone text on mobile
66
- '& .timezone-text': {
67
- display: isMobile ? 'none' : 'inline'
68
- }
69
- }),
70
- children: [
71
- /*#__PURE__*/ _jsx("span", {
72
- className: "timezone-text",
73
- children: value === DEFAULT_DASHBOARD_TIMEZONE ? getTimeZoneOffset(localTimeZone)?.value : getTimeZoneOffset(value)?.value
74
- }),
75
- /*#__PURE__*/ _jsx(EarthIcon, {
76
- sx: (theme)=>({
77
- marginLeft: theme.spacing(0.5)
78
- })
79
- })
80
- ]
81
- })
82
- })
83
- }),
84
- /*#__PURE__*/ _jsxs(Paper, {
85
- sx: (theme)=>({
86
- width: 350,
87
- height: 355,
88
- position: 'absolute',
89
- top: isMobile ? 160 : 110,
90
- right: 10,
91
- zIndex: 1,
92
- boxShadow: 3,
93
- backgroundColor: theme.palette.background.paper,
94
- display: open ? 'block' : 'none'
95
- }),
96
- children: [
97
- /*#__PURE__*/ _jsx(Input, {
98
- "data-testid": "search-timezone",
99
- sx: (theme)=>({
100
- height: 45,
101
- padding: theme.spacing(1)
102
- }),
103
- value: searchValue,
104
- fullWidth: true,
105
- placeholder: "Search timezone",
106
- startAdornment: /*#__PURE__*/ _jsx(InputAdornment, {
107
- position: "start",
108
- children: /*#__PURE__*/ _jsx(MagnifyIcon, {})
109
- }),
110
- onChange: handleSearchChange
111
- }),
112
- /*#__PURE__*/ _jsx(MenuList, {
113
- sx: {
114
- height: 305,
115
- overflowX: 'auto'
116
- },
117
- children: timeZoneOptions.map((timeZoneOption)=>/*#__PURE__*/ _jsxs(Box, {
118
- children: [
119
- /*#__PURE__*/ _jsxs(MenuItem, {
120
- onClick: ()=>handleTimeZoneSelection(timeZoneOption),
121
- selected: timeZoneOption.value === value,
122
- children: [
123
- /*#__PURE__*/ _jsx(ListItemText, {
124
- children: timeZoneOption.label
125
- }),
126
- /*#__PURE__*/ _jsx(Typography, {
127
- variant: "body2",
128
- children: timeZoneOption.longOffset
129
- })
130
- ]
131
- }, timeZoneOption.value),
132
- timeZoneOption.value === DEFAULT_DASHBOARD_TIMEZONE && /*#__PURE__*/ _jsx(Divider, {})
133
- ]
134
- }, timeZoneOption.value))
135
- })
136
- ]
137
- })
138
- ]
139
- })
140
- });
141
- }
142
-
143
- //# sourceMappingURL=TimeZoneSelector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/TimeZoneSelector/TimeZoneSelector.tsx"],"sourcesContent":["// Copyright 2025 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 {\n MenuItem,\n Box,\n Paper,\n ListItemText,\n Typography,\n MenuList,\n Input,\n InputAdornment,\n Divider,\n useTheme,\n useMediaQuery,\n} from '@mui/material';\nimport ClickAwayListener from '@mui/material/ClickAwayListener';\nimport EarthIcon from 'mdi-material-ui/Earth';\nimport MagnifyIcon from 'mdi-material-ui/Magnify';\nimport { ChangeEvent, ReactElement, useState } from 'react';\nimport { DEFAULT_DASHBOARD_TIMEZONE } from '@perses-dev/core';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\nimport { InfoTooltip } from '../InfoTooltip';\nimport { getTimeZoneOffset, TimeZoneOption } from '../model/timeZoneOption';\n\nexport interface TimeZoneSelectorProps {\n heightPx?: string;\n timeZoneOptions: TimeZoneOption[];\n value: string;\n onChange?: (timeZone: TimeZoneOption) => void;\n}\n\nexport function TimeZoneSelector({\n heightPx = '34px',\n timeZoneOptions: defaultTimeZoneOptions,\n onChange,\n value = DEFAULT_DASHBOARD_TIMEZONE,\n}: TimeZoneSelectorProps): ReactElement {\n const isMobile = useMediaQuery(useTheme().breakpoints.down('md'));\n const [open, setOpen] = useState(false);\n const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n const [searchValue, setSearchValue] = useState('');\n\n const [timeZoneOptions, setTimeZoneOptions] = useState(defaultTimeZoneOptions);\n\n function handleSearchChange(event: ChangeEvent<HTMLInputElement>): void {\n setSearchValue(event.target.value);\n if (event.target.value === '') {\n setTimeZoneOptions(defaultTimeZoneOptions);\n } else {\n setTimeZoneOptions(\n defaultTimeZoneOptions.filter((option) => option.label.toLowerCase().includes(event.target.value.toLowerCase()))\n );\n }\n }\n\n function handleTimeZoneSelection(timeZone: TimeZoneOption): void {\n setOpen(false);\n setTimeZoneOptions(defaultTimeZoneOptions);\n setSearchValue('');\n onChange?.(timeZone);\n }\n\n function handleOnClickAway(): void {\n setOpen(false);\n setSearchValue('');\n setTimeZoneOptions(defaultTimeZoneOptions);\n }\n\n return (\n <ClickAwayListener onClickAway={handleOnClickAway}>\n <Box>\n <Box sx={{ position: 'relative' }}>\n <InfoTooltip description={value === DEFAULT_DASHBOARD_TIMEZONE ? localTimeZone : value}>\n <ToolbarIconButton\n data-testid=\"current-timezone\"\n aria-label=\"Timezone\"\n onClick={() => setOpen(!open)}\n sx={(theme) => ({\n height: heightPx,\n paddingLeft: isMobile ? 0 : theme.spacing(1),\n // Hide the timezone text on mobile\n '& .timezone-text': {\n display: isMobile ? 'none' : 'inline',\n },\n })}\n >\n <span className=\"timezone-text\">\n {value === DEFAULT_DASHBOARD_TIMEZONE\n ? getTimeZoneOffset(localTimeZone)?.value\n : getTimeZoneOffset(value)?.value}\n </span>\n <EarthIcon sx={(theme) => ({ marginLeft: theme.spacing(0.5) })} />\n </ToolbarIconButton>\n </InfoTooltip>\n </Box>\n <Paper\n sx={(theme) => ({\n width: 350,\n height: 355,\n position: 'absolute',\n top: isMobile ? 160 : 110,\n right: 10,\n zIndex: 1,\n boxShadow: 3,\n backgroundColor: theme.palette.background.paper,\n display: open ? 'block' : 'none',\n })}\n >\n <Input\n data-testid=\"search-timezone\"\n sx={(theme) => ({\n height: 45,\n padding: theme.spacing(1),\n })}\n value={searchValue}\n fullWidth\n placeholder=\"Search timezone\"\n startAdornment={\n <InputAdornment position=\"start\">\n <MagnifyIcon />\n </InputAdornment>\n }\n onChange={handleSearchChange}\n />\n <MenuList sx={{ height: 305, overflowX: 'auto' }}>\n {timeZoneOptions.map((timeZoneOption) => (\n <Box key={timeZoneOption.value}>\n <MenuItem\n key={timeZoneOption.value}\n onClick={() => handleTimeZoneSelection(timeZoneOption)}\n selected={timeZoneOption.value === value}\n >\n <ListItemText>{timeZoneOption.label}</ListItemText>\n <Typography variant=\"body2\">{timeZoneOption.longOffset}</Typography>\n </MenuItem>\n {timeZoneOption.value === DEFAULT_DASHBOARD_TIMEZONE && <Divider />}\n </Box>\n ))}\n </MenuList>\n </Paper>\n </Box>\n </ClickAwayListener>\n );\n}\n"],"names":["MenuItem","Box","Paper","ListItemText","Typography","MenuList","Input","InputAdornment","Divider","useTheme","useMediaQuery","ClickAwayListener","EarthIcon","MagnifyIcon","useState","DEFAULT_DASHBOARD_TIMEZONE","ToolbarIconButton","InfoTooltip","getTimeZoneOffset","TimeZoneSelector","heightPx","timeZoneOptions","defaultTimeZoneOptions","onChange","value","isMobile","breakpoints","down","open","setOpen","localTimeZone","Intl","DateTimeFormat","resolvedOptions","timeZone","searchValue","setSearchValue","setTimeZoneOptions","handleSearchChange","event","target","filter","option","label","toLowerCase","includes","handleTimeZoneSelection","handleOnClickAway","onClickAway","sx","position","description","data-testid","aria-label","onClick","theme","height","paddingLeft","spacing","display","span","className","marginLeft","width","top","right","zIndex","boxShadow","backgroundColor","palette","background","paper","padding","fullWidth","placeholder","startAdornment","overflowX","map","timeZoneOption","selected","variant","longOffset"],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- export * from './TimeZoneSelector';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TimeZoneSelector/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC"}
@@ -1,15 +0,0 @@
1
- // Copyright 2025 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- export * from './TimeZoneSelector';
14
-
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/TimeZoneSelector/index.ts"],"sourcesContent":["// Copyright 2025 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\nexport * from './TimeZoneSelector';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}