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

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 (46) hide show
  1. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +1 -2
  2. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
  3. package/dist/TimeRangeSelector/DateTimeRangePicker.js +6 -5
  4. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  5. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +1 -5
  6. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
  7. package/dist/TimeRangeSelector/TimeRangeSelector.js +10 -14
  8. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  9. package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +6 -5
  10. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +8 -12
  11. package/dist/cjs/context/TimeZoneProvider.js +98 -0
  12. package/dist/cjs/context/index.js +1 -0
  13. package/dist/cjs/index.js +0 -1
  14. package/dist/cjs/model/index.js +0 -1
  15. package/dist/context/TimeZoneProvider.d.ts +13 -0
  16. package/dist/context/TimeZoneProvider.d.ts.map +1 -0
  17. package/dist/context/TimeZoneProvider.js +38 -0
  18. package/dist/context/TimeZoneProvider.js.map +1 -0
  19. package/dist/context/index.d.ts +1 -0
  20. package/dist/context/index.d.ts.map +1 -1
  21. package/dist/context/index.js +1 -0
  22. package/dist/context/index.js.map +1 -1
  23. package/dist/index.d.ts +0 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +0 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/model/index.d.ts +0 -1
  28. package/dist/model/index.d.ts.map +1 -1
  29. package/dist/model/index.js +0 -1
  30. package/dist/model/index.js.map +1 -1
  31. package/package.json +2 -2
  32. package/dist/TimeZoneSelector/TimeZoneSelector.d.ts +0 -10
  33. package/dist/TimeZoneSelector/TimeZoneSelector.d.ts.map +0 -1
  34. package/dist/TimeZoneSelector/TimeZoneSelector.js +0 -143
  35. package/dist/TimeZoneSelector/TimeZoneSelector.js.map +0 -1
  36. package/dist/TimeZoneSelector/index.d.ts +0 -2
  37. package/dist/TimeZoneSelector/index.d.ts.map +0 -1
  38. package/dist/TimeZoneSelector/index.js +0 -15
  39. package/dist/TimeZoneSelector/index.js.map +0 -1
  40. package/dist/cjs/TimeZoneSelector/TimeZoneSelector.js +0 -156
  41. package/dist/cjs/TimeZoneSelector/index.js +0 -30
  42. package/dist/cjs/model/timeZoneOption.js +0 -100
  43. package/dist/model/timeZoneOption.d.ts +0 -10
  44. package/dist/model/timeZoneOption.d.ts.map +0 -1
  45. package/dist/model/timeZoneOption.js +0 -79
  46. package/dist/model/timeZoneOption.js.map +0 -1
@@ -4,7 +4,6 @@ interface AbsoluteTimeFormProps {
4
4
  initialTimeRange: AbsoluteTimeRange;
5
5
  onChange: (timeRange: AbsoluteTimeRange) => void;
6
6
  onCancel: () => void;
7
- timeZone: string;
8
7
  }
9
8
  /**
10
9
  * Start and End datetime picker, allowing use to select a specific time range selecting two absolute dates and times.
@@ -15,6 +14,6 @@ interface AbsoluteTimeFormProps {
15
14
  * @param onCancel event received when user click on cancel
16
15
  * @constructor
17
16
  */
18
- export declare const DateTimeRangePicker: ({ initialTimeRange, onChange, onCancel, timeZone, }: AbsoluteTimeFormProps) => ReactElement;
17
+ export declare const DateTimeRangePicker: ({ initialTimeRange, onChange, onCancel }: AbsoluteTimeFormProps) => ReactElement;
19
18
  export {};
20
19
  //# sourceMappingURL=DateTimeRangePicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeRangePicker.d.ts","sourceRoot":"","sources":["../../src/TimeRangeSelector/DateTimeRangePicker.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAI/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAMrD,UAAU,qBAAqB;IAC7B,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,QAAQ,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAMD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,wDAK7B,qBAAqB,KAAG,YAwK1B,CAAC"}
1
+ {"version":3,"file":"DateTimeRangePicker.d.ts","sourceRoot":"","sources":["../../src/TimeRangeSelector/DateTimeRangePicker.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAI/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAMrD,UAAU,qBAAqB;IAC7B,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,QAAQ,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAMD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,6CAA8C,qBAAqB,KAAG,YA0KrG,CAAC"}
@@ -15,9 +15,9 @@ import { useState } from 'react';
15
15
  import { Box, Stack, Typography, Button } from '@mui/material';
16
16
  import { DateTimeField, LocalizationProvider, StaticDateTimePicker } from '@mui/x-date-pickers';
17
17
  import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
18
+ import { useTimeZone } from '../context';
18
19
  import { ErrorBoundary } from '../ErrorBoundary';
19
20
  import { ErrorAlert } from '../ErrorAlert';
20
- import { formatWithTimeZone } from '../utils/format';
21
21
  import { DATE_TIME_FORMAT, validateDateRange } from './utils';
22
22
  /**
23
23
  * Start and End datetime picker, allowing use to select a specific time range selecting two absolute dates and times.
@@ -27,19 +27,20 @@ import { DATE_TIME_FORMAT, validateDateRange } from './utils';
27
27
  * @param onChange event received when start and end has been selected (click on apply)
28
28
  * @param onCancel event received when user click on cancel
29
29
  * @constructor
30
- */ export const DateTimeRangePicker = ({ initialTimeRange, onChange, onCancel, timeZone })=>{
30
+ */ export const DateTimeRangePicker = ({ initialTimeRange, onChange, onCancel })=>{
31
+ const { formatWithUserTimeZone } = useTimeZone();
31
32
  // Time range values as dates that can be used as a time range.
32
33
  const [timeRange, setTimeRange] = useState(initialTimeRange);
33
34
  // Time range values as strings used to populate the text inputs. May not
34
35
  // be valid as dates when the user is typing.
35
36
  const [timeRangeInputs, setTimeRangeInputs] = useState({
36
- start: formatWithTimeZone(initialTimeRange.start, DATE_TIME_FORMAT, timeZone),
37
- end: formatWithTimeZone(initialTimeRange.end, DATE_TIME_FORMAT, timeZone)
37
+ start: formatWithUserTimeZone(initialTimeRange.start, DATE_TIME_FORMAT),
38
+ end: formatWithUserTimeZone(initialTimeRange.end, DATE_TIME_FORMAT)
38
39
  });
39
40
  const [showStartCalendar, setShowStartCalendar] = useState(true);
40
41
  const changeTimeRange = (newTime, segment)=>{
41
42
  const isInputChange = typeof newTime === 'string';
42
- const newInputTime = isInputChange ? newTime : formatWithTimeZone(newTime, DATE_TIME_FORMAT, timeZone);
43
+ const newInputTime = isInputChange ? newTime : formatWithUserTimeZone(newTime, DATE_TIME_FORMAT);
43
44
  setTimeRangeInputs((prevTimeRangeInputs)=>{
44
45
  return {
45
46
  ...prevTimeRangeInputs,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeRangeSelector/DateTimeRangePicker.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState } from 'react';\nimport { Box, Stack, Typography, Button } from '@mui/material';\nimport { DateTimeField, LocalizationProvider, StaticDateTimePicker } from '@mui/x-date-pickers';\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';\nimport { AbsoluteTimeRange } from '@perses-dev/core';\nimport { ErrorBoundary } from '../ErrorBoundary';\nimport { ErrorAlert } from '../ErrorAlert';\nimport { formatWithTimeZone } from '../utils/format';\nimport { DATE_TIME_FORMAT, validateDateRange } from './utils';\n\ninterface AbsoluteTimeFormProps {\n initialTimeRange: AbsoluteTimeRange;\n onChange: (timeRange: AbsoluteTimeRange) => void;\n onCancel: () => void;\n timeZone: string;\n}\n\ntype AbsoluteTimeRangeInputValue = {\n [Property in keyof AbsoluteTimeRange]: string;\n};\n\n/**\n * Start and End datetime picker, allowing use to select a specific time range selecting two absolute dates and times.\n * TODO: Use directly the MUI X ``DateTimePicker`` for datetime selection which is better. https://next.mui.com/x/react-date-pickers/date-time-picker/\n * Use ``DateTimeRangePicker`` directly would be cool but paid https://next.mui.com/x/react-date-pickers/date-time-range-picker/\n * @param initialTimeRange initial time range to pre-select.\n * @param onChange event received when start and end has been selected (click on apply)\n * @param onCancel event received when user click on cancel\n * @constructor\n */\nexport const DateTimeRangePicker = ({\n initialTimeRange,\n onChange,\n onCancel,\n timeZone,\n}: AbsoluteTimeFormProps): ReactElement => {\n // Time range values as dates that can be used as a time range.\n const [timeRange, setTimeRange] = useState<AbsoluteTimeRange>(initialTimeRange);\n\n // Time range values as strings used to populate the text inputs. May not\n // be valid as dates when the user is typing.\n const [timeRangeInputs, setTimeRangeInputs] = useState<AbsoluteTimeRangeInputValue>({\n start: formatWithTimeZone(initialTimeRange.start, DATE_TIME_FORMAT, timeZone),\n end: formatWithTimeZone(initialTimeRange.end, DATE_TIME_FORMAT, timeZone),\n });\n\n const [showStartCalendar, setShowStartCalendar] = useState<boolean>(true);\n\n const changeTimeRange = (newTime: string | Date, segment: keyof AbsoluteTimeRange): void => {\n const isInputChange = typeof newTime === 'string';\n const newInputTime = isInputChange ? newTime : formatWithTimeZone(newTime, DATE_TIME_FORMAT, timeZone);\n\n setTimeRangeInputs((prevTimeRangeInputs) => {\n return {\n ...prevTimeRangeInputs,\n [segment]: newInputTime,\n };\n });\n\n // When the change is a string from an input, do not try to convert it to\n // a date because there are likely to be interim stages of editing where it\n // is not valid as a date. When the change is a Date from the calendar/clock\n // interface, we can be sure it is a date.\n if (!isInputChange) {\n setTimeRange((prevTimeRange) => {\n return {\n ...prevTimeRange,\n [segment]: newTime,\n };\n });\n }\n };\n\n const onChangeStartTime = (newStartTime: string | Date): void => {\n changeTimeRange(newStartTime, 'start');\n };\n\n const onChangeEndTime = (newEndTime: string | Date): void => {\n changeTimeRange(newEndTime, 'end');\n };\n\n const updateDateRange = (): { start: Date; end: Date } | undefined => {\n const newDates = {\n start: new Date(timeRangeInputs.start),\n end: new Date(timeRangeInputs.end),\n };\n const isValidDateRange = validateDateRange(newDates.start, newDates.end);\n if (isValidDateRange) {\n setTimeRange(newDates);\n return newDates;\n }\n };\n\n const onApply = (): void => {\n const newDates = updateDateRange();\n if (newDates) {\n onChange(newDates);\n }\n };\n\n return (\n <LocalizationProvider dateAdapter={AdapterDateFns}>\n <Stack\n spacing={2}\n sx={(theme) => ({\n padding: theme.spacing(1, 0, 2),\n })}\n >\n {showStartCalendar && (\n <Box\n sx={(theme) => ({\n // TODO: create separate reusable calendar component\n '.MuiPickersLayout-contentWrapper': {\n backgroundColor: theme.palette.background.default,\n },\n })}\n >\n <Typography variant=\"h3\" padding={1} paddingLeft={2}>\n Select Start Time\n </Typography>\n <StaticDateTimePicker\n displayStaticWrapperAs=\"desktop\"\n openTo=\"day\"\n disableHighlightToday={true}\n value={initialTimeRange.start}\n onChange={(newValue) => {\n if (newValue === null) return;\n onChangeStartTime(newValue);\n }}\n onAccept={() => {\n setShowStartCalendar(false);\n }}\n />\n </Box>\n )}\n {!showStartCalendar && (\n <Box\n sx={(theme) => ({\n '.MuiPickersLayout-contentWrapper': {\n backgroundColor: theme.palette.background.default,\n },\n })}\n >\n <Typography variant=\"h3\" padding={1} paddingLeft={2}>\n Select End Time\n </Typography>\n <StaticDateTimePicker\n displayStaticWrapperAs=\"desktop\"\n openTo=\"day\"\n disableHighlightToday={true}\n value={initialTimeRange.end}\n minDateTime={timeRange.start}\n onChange={(newValue) => {\n if (newValue === null) return;\n onChangeEndTime(newValue);\n }}\n onAccept={(newValue) => {\n if (newValue === null) return;\n setShowStartCalendar(true);\n onChangeEndTime(newValue);\n }}\n />\n </Box>\n )}\n <Stack direction=\"row\" alignItems=\"center\" gap={1} pl={1} pr={1}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DateTimeField\n label=\"Start Time\"\n value={new Date(timeRangeInputs.start)}\n onChange={(event: Date | null) => {\n if (event) {\n onChangeStartTime(event);\n }\n }}\n onBlur={() => updateDateRange()}\n format={DATE_TIME_FORMAT}\n />\n </ErrorBoundary>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DateTimeField\n label=\"End Time\"\n value={new Date(timeRangeInputs.end)}\n onChange={(event: Date | null) => {\n if (event) {\n onChangeEndTime(event);\n }\n }}\n onBlur={() => updateDateRange()}\n format={DATE_TIME_FORMAT}\n />\n </ErrorBoundary>\n </Stack>\n <Stack direction=\"row\" sx={{ padding: (theme) => theme.spacing(0, 1) }} gap={1}>\n <Button variant=\"contained\" onClick={() => onApply()} fullWidth>\n Apply\n </Button>\n <Button variant=\"outlined\" onClick={() => onCancel()} fullWidth>\n Cancel\n </Button>\n </Stack>\n </Stack>\n </LocalizationProvider>\n );\n};\n"],"names":["useState","Box","Stack","Typography","Button","DateTimeField","LocalizationProvider","StaticDateTimePicker","AdapterDateFns","ErrorBoundary","ErrorAlert","formatWithTimeZone","DATE_TIME_FORMAT","validateDateRange","DateTimeRangePicker","initialTimeRange","onChange","onCancel","timeZone","timeRange","setTimeRange","timeRangeInputs","setTimeRangeInputs","start","end","showStartCalendar","setShowStartCalendar","changeTimeRange","newTime","segment","isInputChange","newInputTime","prevTimeRangeInputs","prevTimeRange","onChangeStartTime","newStartTime","onChangeEndTime","newEndTime","updateDateRange","newDates","Date","isValidDateRange","onApply","dateAdapter","spacing","sx","theme","padding","backgroundColor","palette","background","default","variant","paddingLeft","displayStaticWrapperAs","openTo","disableHighlightToday","value","newValue","onAccept","minDateTime","direction","alignItems","gap","pl","pr","FallbackComponent","label","event","onBlur","format","onClick","fullWidth"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,QAAQ,QAAQ,QAAQ;AAC/C,SAASC,GAAG,EAAEC,KAAK,EAAEC,UAAU,EAAEC,MAAM,QAAQ,gBAAgB;AAC/D,SAASC,aAAa,EAAEC,oBAAoB,EAAEC,oBAAoB,QAAQ,sBAAsB;AAChG,SAASC,cAAc,QAAQ,uCAAuC;AAEtE,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,UAAU;AAa9D;;;;;;;;CAQC,GACD,OAAO,MAAMC,sBAAsB,CAAC,EAClCC,gBAAgB,EAChBC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACc;IACtB,+DAA+D;IAC/D,MAAM,CAACC,WAAWC,aAAa,GAAGpB,SAA4Be;IAE9D,yEAAyE;IACzE,6CAA6C;IAC7C,MAAM,CAACM,iBAAiBC,mBAAmB,GAAGtB,SAAsC;QAClFuB,OAAOZ,mBAAmBI,iBAAiBQ,KAAK,EAAEX,kBAAkBM;QACpEM,KAAKb,mBAAmBI,iBAAiBS,GAAG,EAAEZ,kBAAkBM;IAClE;IAEA,MAAM,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AgBG,GAAG;gCACnCR,UAAU,CAACoD;oCACT,IAAIA,OAAO;wCACThC,gBAAgBgC;oCAClB;gCACF;gCACAC,QAAQ,IAAM/B;gCACdgC,QAAQ1D;;;;;8BAId,MAACV;oBAAM2D,WAAU;oBAAMhB,IAAI;wBAAEE,SAAS,CAACD,QAAUA,MAAMF,OAAO,CAAC,GAAG;oBAAG;oBAAGmB,KAAK;;sCAC3E,KAAC3D;4BAAOgD,SAAQ;4BAAYmB,SAAS,IAAM7B;4BAAW8B,SAAS;sCAAC;;sCAGhE,KAACpE;4BAAOgD,SAAQ;4BAAWmB,SAAS,IAAMtD;4BAAYuD,SAAS;sCAAC;;;;;;;AAO1E,EAAE"}
1
+ {"version":3,"sources":["../../src/TimeRangeSelector/DateTimeRangePicker.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState } from 'react';\nimport { Box, Stack, Typography, Button } from '@mui/material';\nimport { DateTimeField, LocalizationProvider, StaticDateTimePicker } from '@mui/x-date-pickers';\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';\nimport { AbsoluteTimeRange } from '@perses-dev/core';\nimport { useTimeZone } from '../context';\nimport { ErrorBoundary } from '../ErrorBoundary';\nimport { ErrorAlert } from '../ErrorAlert';\nimport { DATE_TIME_FORMAT, validateDateRange } from './utils';\n\ninterface AbsoluteTimeFormProps {\n initialTimeRange: AbsoluteTimeRange;\n onChange: (timeRange: AbsoluteTimeRange) => void;\n onCancel: () => void;\n}\n\ntype AbsoluteTimeRangeInputValue = {\n [Property in keyof AbsoluteTimeRange]: string;\n};\n\n/**\n * Start and End datetime picker, allowing use to select a specific time range selecting two absolute dates and times.\n * TODO: Use directly the MUI X ``DateTimePicker`` for datetime selection which is better. https://next.mui.com/x/react-date-pickers/date-time-picker/\n * Use ``DateTimeRangePicker`` directly would be cool but paid https://next.mui.com/x/react-date-pickers/date-time-range-picker/\n * @param initialTimeRange initial time range to pre-select.\n * @param onChange event received when start and end has been selected (click on apply)\n * @param onCancel event received when user click on cancel\n * @constructor\n */\nexport const DateTimeRangePicker = ({ initialTimeRange, onChange, onCancel }: AbsoluteTimeFormProps): ReactElement => {\n const { formatWithUserTimeZone } = useTimeZone();\n\n // Time range values as dates that can be used as a time range.\n const [timeRange, setTimeRange] = useState<AbsoluteTimeRange>(initialTimeRange);\n\n // Time range values as strings used to populate the text inputs. May not\n // be valid as dates when the user is typing.\n const [timeRangeInputs, setTimeRangeInputs] = useState<AbsoluteTimeRangeInputValue>({\n start: formatWithUserTimeZone(initialTimeRange.start, DATE_TIME_FORMAT),\n end: formatWithUserTimeZone(initialTimeRange.end, DATE_TIME_FORMAT),\n });\n\n const [showStartCalendar, setShowStartCalendar] = useState<boolean>(true);\n\n const changeTimeRange = (newTime: string | Date, segment: keyof AbsoluteTimeRange): void => {\n const isInputChange = typeof newTime === 'string';\n const newInputTime = isInputChange ? newTime : formatWithUserTimeZone(newTime, DATE_TIME_FORMAT);\n\n setTimeRangeInputs((prevTimeRangeInputs) => {\n return {\n ...prevTimeRangeInputs,\n [segment]: newInputTime,\n };\n });\n\n // When the change is a string from an input, do not try to convert it to\n // a date because there are likely to be interim stages of editing where it\n // is not valid as a date. When the change is a Date from the calendar/clock\n // interface, we can be sure it is a date.\n if (!isInputChange) {\n setTimeRange((prevTimeRange) => {\n return {\n ...prevTimeRange,\n [segment]: newTime,\n };\n });\n }\n };\n\n const onChangeStartTime = (newStartTime: string | Date): void => {\n changeTimeRange(newStartTime, 'start');\n };\n\n const onChangeEndTime = (newEndTime: string | Date): void => {\n changeTimeRange(newEndTime, 'end');\n };\n\n const updateDateRange = (): { start: Date; end: Date } | undefined => {\n const newDates = {\n start: new Date(timeRangeInputs.start),\n end: new Date(timeRangeInputs.end),\n };\n const isValidDateRange = validateDateRange(newDates.start, newDates.end);\n if (isValidDateRange) {\n setTimeRange(newDates);\n return newDates;\n }\n };\n\n const onApply = (): void => {\n const newDates = updateDateRange();\n if (newDates) {\n onChange(newDates);\n }\n };\n\n return (\n <LocalizationProvider dateAdapter={AdapterDateFns}>\n <Stack\n spacing={2}\n sx={(theme) => ({\n padding: theme.spacing(1, 0, 2),\n })}\n >\n {showStartCalendar && (\n <Box\n sx={(theme) => ({\n // TODO: create separate reusable calendar component\n '.MuiPickersLayout-contentWrapper': {\n backgroundColor: theme.palette.background.default,\n },\n })}\n >\n <Typography variant=\"h3\" padding={1} paddingLeft={2}>\n Select Start Time\n </Typography>\n <StaticDateTimePicker\n displayStaticWrapperAs=\"desktop\"\n openTo=\"day\"\n disableHighlightToday={true}\n value={initialTimeRange.start}\n onChange={(newValue) => {\n if (newValue === null) return;\n onChangeStartTime(newValue);\n }}\n onAccept={() => {\n setShowStartCalendar(false);\n }}\n />\n </Box>\n )}\n {!showStartCalendar && (\n <Box\n sx={(theme) => ({\n '.MuiPickersLayout-contentWrapper': {\n backgroundColor: theme.palette.background.default,\n },\n })}\n >\n <Typography variant=\"h3\" padding={1} paddingLeft={2}>\n Select End Time\n </Typography>\n <StaticDateTimePicker\n displayStaticWrapperAs=\"desktop\"\n openTo=\"day\"\n disableHighlightToday={true}\n value={initialTimeRange.end}\n minDateTime={timeRange.start}\n onChange={(newValue) => {\n if (newValue === null) return;\n onChangeEndTime(newValue);\n }}\n onAccept={(newValue) => {\n if (newValue === null) return;\n setShowStartCalendar(true);\n onChangeEndTime(newValue);\n }}\n />\n </Box>\n )}\n <Stack direction=\"row\" alignItems=\"center\" gap={1} pl={1} pr={1}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DateTimeField\n label=\"Start Time\"\n value={new Date(timeRangeInputs.start)}\n onChange={(event: Date | null) => {\n if (event) {\n onChangeStartTime(event);\n }\n }}\n onBlur={() => updateDateRange()}\n format={DATE_TIME_FORMAT}\n />\n </ErrorBoundary>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DateTimeField\n label=\"End Time\"\n value={new Date(timeRangeInputs.end)}\n onChange={(event: Date | null) => {\n if (event) {\n onChangeEndTime(event);\n }\n }}\n onBlur={() => updateDateRange()}\n format={DATE_TIME_FORMAT}\n />\n </ErrorBoundary>\n </Stack>\n <Stack direction=\"row\" sx={{ padding: (theme) => theme.spacing(0, 1) }} gap={1}>\n <Button variant=\"contained\" onClick={() => onApply()} fullWidth>\n Apply\n </Button>\n <Button variant=\"outlined\" onClick={() => onCancel()} fullWidth>\n Cancel\n </Button>\n </Stack>\n </Stack>\n </LocalizationProvider>\n );\n};\n"],"names":["useState","Box","Stack","Typography","Button","DateTimeField","LocalizationProvider","StaticDateTimePicker","AdapterDateFns","useTimeZone","ErrorBoundary","ErrorAlert","DATE_TIME_FORMAT","validateDateRange","DateTimeRangePicker","initialTimeRange","onChange","onCancel","formatWithUserTimeZone","timeRange","setTimeRange","timeRangeInputs","setTimeRangeInputs","start","end","showStartCalendar","setShowStartCalendar","changeTimeRange","newTime","segment","isInputChange","newInputTime","prevTimeRangeInputs","prevTimeRange","onChangeStartTime","newStartTime","onChangeEndTime","newEndTime","updateDateRange","newDates","Date","isValidDateRange","onApply","dateAdapter","spacing","sx","theme","padding","backgroundColor","palette","background","default","variant","paddingLeft","displayStaticWrapperAs","openTo","disableHighlightToday","value","newValue","onAccept","minDateTime","direction","alignItems","gap","pl","pr","FallbackComponent","label","event","onBlur","format","onClick","fullWidth"],"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;;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
24
24
  * Defaults to true.
25
25
  */
26
26
  showCustomTimeRange?: boolean;
27
- /**
28
- * The time zone to use for the time range selector.
29
- */
30
- timeZone?: string;
31
27
  }
32
28
  /**
33
29
  * Date & time selection component to customize what data renders on dashboard.
@@ -35,6 +31,6 @@ interface TimeRangeSelectorProps {
35
31
  * @param props
36
32
  * @constructor
37
33
  */
38
- export declare function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTimeRange, timeZone, }: TimeRangeSelectorProps): ReactElement;
34
+ export declare function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTimeRange, }: TimeRangeSelectorProps): ReactElement;
39
35
  export {};
40
36
  //# sourceMappingURL=TimeRangeSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimeRangeSelector.d.ts","sourceRoot":"","sources":["../../src/TimeRangeSelector/TimeRangeSelector.tsx"],"names":[],"mappings":"AAeA,OAAO,EACL,cAAc,EAKf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAA6B,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,UAAU,sBAAsB;IAC9B;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;;OAGG;IACH,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,mBAA0B,EAC1B,QAAqC,GACtC,EAAE,sBAAsB,GAAG,YAAY,CAyGvC"}
1
+ {"version":3,"file":"TimeRangeSelector.d.ts","sourceRoot":"","sources":["../../src/TimeRangeSelector/TimeRangeSelector.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAA+D,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,YAAY,EAA6B,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,UAAU,sBAAsB;IAC9B;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;;OAGG;IACH,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,mBAA0B,GAC3B,EAAE,sBAAsB,GAAG,YAAY,CAkGvC"}
@@ -11,10 +11,11 @@
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 { Box, MenuItem, Popover, Select, useMediaQuery, useTheme } from '@mui/material';
15
- import ClockTimeFiveOutline from 'mdi-material-ui/ClockTimeFiveOutline';
16
- import { isRelativeTimeRange, toAbsoluteTimeRange, DEFAULT_DASHBOARD_TIMEZONE } from '@perses-dev/core';
14
+ import { Box, MenuItem, Popover, Select } from '@mui/material';
15
+ import Calendar from 'mdi-material-ui/Calendar';
16
+ import { isRelativeTimeRange, toAbsoluteTimeRange } from '@perses-dev/core';
17
17
  import { useMemo, useRef, useState } from 'react';
18
+ import { useTimeZone } from '../context';
18
19
  import { DateTimeRangePicker } from './DateTimeRangePicker';
19
20
  import { buildCustomTimeOption, formatTimeRange } from './utils';
20
21
  /**
@@ -22,8 +23,8 @@ import { buildCustomTimeOption, formatTimeRange } from './utils';
22
23
  * This includes relative shortcuts and the ability to pick absolute start and end times.
23
24
  * @param props
24
25
  * @constructor
25
- */ export function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTimeRange = true, timeZone = DEFAULT_DASHBOARD_TIMEZONE }) {
26
- const isMobile = useMediaQuery(useTheme().breakpoints.down('md'));
26
+ */ export function TimeRangeSelector({ value, timeOptions, onChange, height, showCustomTimeRange = true }) {
27
+ const { timeZone } = useTimeZone();
27
28
  const anchorEl = useRef(); // Used to position the absolute time range picker
28
29
  // Control the open state of the absolute time range picker
29
30
  const [showCustomDateSelector, setShowCustomDateSelector] = useState(false);
@@ -67,8 +68,7 @@ import { buildCustomTimeOption, formatTimeRange } from './utils';
67
68
  setShowCustomDateSelector(false);
68
69
  setOpen(false);
69
70
  },
70
- onCancel: ()=>setShowCustomDateSelector(false),
71
- timeZone: timeZone
71
+ onCancel: ()=>setShowCustomDateSelector(false)
72
72
  })
73
73
  }),
74
74
  /*#__PURE__*/ _jsx(Box, {
@@ -77,22 +77,18 @@ import { buildCustomTimeOption, formatTimeRange } from './utils';
77
77
  open: open,
78
78
  value: formatTimeRange(value, timeZone),
79
79
  onClick: ()=>setOpen(!open),
80
- IconComponent: ClockTimeFiveOutline,
80
+ IconComponent: Calendar,
81
81
  inputProps: {
82
82
  'aria-label': `Select time range. Currently set to ${value}`
83
83
  },
84
84
  sx: {
85
85
  // `transform: none` prevents calendar icon from flipping over when menu is open
86
86
  '.MuiSelect-icon': {
87
+ marginTop: '1px',
87
88
  transform: 'none'
88
89
  },
89
90
  // paddingRight creates more space for the calendar icon (it's a bigger icon)
90
- '.MuiSelect-select.MuiSelect-outlined.MuiInputBase-input': isMobile ? {
91
- paddingRight: '25px',
92
- textIndent: '-9999px',
93
- whiteSpace: 'nowrap',
94
- overflow: 'hidden'
95
- } : {
91
+ '.MuiSelect-select.MuiSelect-outlined.MuiInputBase-input': {
96
92
  paddingRight: '36px'
97
93
  },
98
94
  '.MuiSelect-select': height ? {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeRangeSelector/TimeRangeSelector.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, MenuItem, Popover, Select, useMediaQuery, useTheme } from '@mui/material';\nimport ClockTimeFiveOutline from 'mdi-material-ui/ClockTimeFiveOutline';\nimport {\n TimeRangeValue,\n isRelativeTimeRange,\n AbsoluteTimeRange,\n toAbsoluteTimeRange,\n DEFAULT_DASHBOARD_TIMEZONE,\n} from '@perses-dev/core';\nimport { ReactElement, useMemo, useRef, useState } from 'react';\nimport { TimeOption } from '../model';\nimport { DateTimeRangePicker } from './DateTimeRangePicker';\nimport { buildCustomTimeOption, formatTimeRange } from './utils';\n\ninterface TimeRangeSelectorProps {\n /**\n * The current value of the time range.\n */\n value: TimeRangeValue;\n /**\n * The list of time options to display in the dropdown.\n * The component will automatically add the last two options as a zoom out x2 and a custom absolute time range.\n */\n timeOptions: TimeOption[];\n /**\n * The callback to call when the time range changes.\n */\n onChange: (value: TimeRangeValue) => void;\n /**\n * Custom line height for the select component.\n */\n height?: string;\n /**\n * Whether to show the custom time range option.\n * Defaults to true.\n */\n showCustomTimeRange?: boolean;\n /**\n * The time zone to use for the time range selector.\n */\n timeZone?: string;\n}\n\n/**\n * Date & time selection component to customize what data renders on dashboard.\n * This includes relative shortcuts and the ability to pick absolute start and end times.\n * @param props\n * @constructor\n */\nexport function TimeRangeSelector({\n value,\n timeOptions,\n onChange,\n height,\n showCustomTimeRange = true,\n timeZone = DEFAULT_DASHBOARD_TIMEZONE,\n}: TimeRangeSelectorProps): ReactElement {\n const isMobile = useMediaQuery(useTheme().breakpoints.down('md'));\n\n const anchorEl = useRef(); // Used to position the absolute time range picker\n\n // Control the open state of the absolute time range picker\n const [showCustomDateSelector, setShowCustomDateSelector] = useState(false);\n\n // Build the initial value of the absolute time range picker\n const convertedTimeRange = useMemo(() => {\n return isRelativeTimeRange(value) ? toAbsoluteTimeRange(value) : value;\n }, [value]);\n\n // Last option is the absolute time range option (custom)\n // If the value is an absolute time range, we display this time range\n // If the value is a relative time range, we make a default CustomTimeOption built from undefined value\n const lastOption = useMemo(\n () => buildCustomTimeOption(isRelativeTimeRange(value) ? undefined : value, timeZone),\n [value, timeZone]\n );\n\n // Control the open state of the select component to prevent the menu from closing when the custom date picker is\n // opened.\n //\n // Note that the value state of the select is here for display only. The real value (the one from props) is managed\n // by click events on each menu item.\n // This is a trick to get around the limitation of select with menu item that doesn't support objects as value...\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <Popover\n anchorEl={anchorEl.current}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n open={showCustomDateSelector}\n onClose={() => setShowCustomDateSelector(false)}\n sx={(theme) => ({\n padding: theme.spacing(2),\n })}\n >\n <DateTimeRangePicker\n initialTimeRange={convertedTimeRange}\n onChange={(value: AbsoluteTimeRange) => {\n onChange(value);\n setShowCustomDateSelector(false);\n setOpen(false);\n }}\n onCancel={() => setShowCustomDateSelector(false)}\n timeZone={timeZone}\n />\n </Popover>\n <Box ref={anchorEl}>\n <Select\n open={open}\n value={formatTimeRange(value, timeZone)}\n onClick={() => setOpen(!open)}\n IconComponent={ClockTimeFiveOutline}\n inputProps={{\n 'aria-label': `Select time range. Currently set to ${value}`,\n }}\n sx={{\n // `transform: none` prevents calendar icon from flipping over when menu is open\n '.MuiSelect-icon': {\n transform: 'none',\n },\n // paddingRight creates more space for the calendar icon (it's a bigger icon)\n '.MuiSelect-select.MuiSelect-outlined.MuiInputBase-input': isMobile\n ? {\n paddingRight: '25px',\n textIndent: '-9999px', // Hide text by moving it far off screen\n whiteSpace: 'nowrap', // Prevent text from wrapping\n overflow: 'hidden', // Hide any overflow\n }\n : {\n paddingRight: '36px',\n },\n '.MuiSelect-select': height ? { lineHeight: height, paddingY: 0 } : {},\n }}\n >\n {timeOptions.map((item, idx) => (\n <MenuItem\n key={idx}\n value={formatTimeRange(item.value, timeZone)}\n onClick={() => {\n onChange(item.value);\n }}\n >\n {item.display}\n </MenuItem>\n ))}\n {showCustomTimeRange && (\n <MenuItem\n value={formatTimeRange(lastOption.value, timeZone)}\n onClick={() => setShowCustomDateSelector(true)}\n >\n {lastOption.display}\n </MenuItem>\n )}\n </Select>\n </Box>\n </>\n );\n}\n"],"names":["Box","MenuItem","Popover","Select","useMediaQuery","useTheme","ClockTimeFiveOutline","isRelativeTimeRange","toAbsoluteTimeRange","DEFAULT_DASHBOARD_TIMEZONE","useMemo","useRef","useState","DateTimeRangePicker","buildCustomTimeOption","formatTimeRange","TimeRangeSelector","value","timeOptions","onChange","height","showCustomTimeRange","timeZone","isMobile","breakpoints","down","anchorEl","showCustomDateSelector","setShowCustomDateSelector","convertedTimeRange","lastOption","undefined","open","setOpen","current","anchorOrigin","vertical","horizontal","onClose","sx","theme","padding","spacing","initialTimeRange","onCancel","ref","onClick","IconComponent","inputProps","transform","paddingRight","textIndent","whiteSpace","overflow","lineHeight","paddingY","map","item","idx","display"],"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,SAASA,GAAG,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,MAAM,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,gBAAgB;AACxF,OAAOC,0BAA0B,uCAAuC;AACxE,SAEEC,mBAAmB,EAEnBC,mBAAmB,EAC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BAA0B;oBAC1CN,UAAUA;;;0BAGd,KAACtB;gBAAI6C,KAAKnB;0BACR,cAAA,MAACvB;oBACC6B,MAAMA;oBACNf,OAAOF,gBAAgBE,OAAOK;oBAC9BwB,SAAS,IAAMb,QAAQ,CAACD;oBACxBe,eAAezC;oBACf0C,YAAY;wBACV,cAAc,CAAC,oCAAoC,EAAE/B,OAAO;oBAC9D;oBACAsB,IAAI;wBACF,gFAAgF;wBAChF,mBAAmB;4BACjBU,WAAW;wBACb;wBACA,6EAA6E;wBAC7E,2DAA2D1B,WACvD;4BACE2B,cAAc;4BACdC,YAAY;4BACZC,YAAY;4BACZC,UAAU;wBACZ,IACA;4BACEH,cAAc;wBAChB;wBACJ,qBAAqB9B,SAAS;4BAAEkC,YAAYlC;4BAAQmC,UAAU;wBAAE,IAAI,CAAC;oBACvE;;wBAECrC,YAAYsC,GAAG,CAAC,CAACC,MAAMC,oBACtB,KAACzD;gCAECgB,OAAOF,gBAAgB0C,KAAKxC,KAAK,EAAEK;gCACnCwB,SAAS;oCACP3B,SAASsC,KAAKxC,KAAK;gCACrB;0CAECwC,KAAKE,OAAO;+BANRD;wBASRrC,qCACC,KAACpB;4BACCgB,OAAOF,gBAAgBe,WAAWb,KAAK,EAAEK;4BACzCwB,SAAS,IAAMlB,0BAA0B;sCAExCE,WAAW6B,OAAO;;;;;;;AAOjC"}
1
+ {"version":3,"sources":["../../src/TimeRangeSelector/TimeRangeSelector.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, MenuItem, Popover, Select } from '@mui/material';\nimport Calendar from 'mdi-material-ui/Calendar';\nimport { TimeRangeValue, isRelativeTimeRange, AbsoluteTimeRange, toAbsoluteTimeRange } from '@perses-dev/core';\nimport { ReactElement, useMemo, useRef, useState } from 'react';\nimport { useTimeZone } from '../context';\nimport { TimeOption } from '../model';\nimport { DateTimeRangePicker } from './DateTimeRangePicker';\nimport { buildCustomTimeOption, formatTimeRange } from './utils';\n\ninterface TimeRangeSelectorProps {\n /**\n * The current value of the time range.\n */\n value: TimeRangeValue;\n /**\n * The list of time options to display in the dropdown.\n * The component will automatically add the last two options as a zoom out x2 and a custom absolute time range.\n */\n timeOptions: TimeOption[];\n /**\n * The callback to call when the time range changes.\n */\n onChange: (value: TimeRangeValue) => void;\n /**\n * Custom line height for the select component.\n */\n height?: string;\n /**\n * Whether to show the custom time range option.\n * Defaults to true.\n */\n showCustomTimeRange?: boolean;\n}\n\n/**\n * Date & time selection component to customize what data renders on dashboard.\n * This includes relative shortcuts and the ability to pick absolute start and end times.\n * @param props\n * @constructor\n */\nexport function TimeRangeSelector({\n value,\n timeOptions,\n onChange,\n height,\n showCustomTimeRange = true,\n}: TimeRangeSelectorProps): ReactElement {\n const { timeZone } = useTimeZone();\n\n const anchorEl = useRef(); // Used to position the absolute time range picker\n\n // Control the open state of the absolute time range picker\n const [showCustomDateSelector, setShowCustomDateSelector] = useState(false);\n\n // Build the initial value of the absolute time range picker\n const convertedTimeRange = useMemo(() => {\n return isRelativeTimeRange(value) ? toAbsoluteTimeRange(value) : value;\n }, [value]);\n\n // Last option is the absolute time range option (custom)\n // If the value is an absolute time range, we display this time range\n // If the value is a relative time range, we make a default CustomTimeOption built from undefined value\n const lastOption = useMemo(\n () => buildCustomTimeOption(isRelativeTimeRange(value) ? undefined : value, timeZone),\n [value, timeZone]\n );\n\n // Control the open state of the select component to prevent the menu from closing when the custom date picker is\n // opened.\n //\n // Note that the value state of the select is here for display only. The real value (the one from props) is managed\n // by click events on each menu item.\n // This is a trick to get around the limitation of select with menu item that doesn't support objects as value...\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <Popover\n anchorEl={anchorEl.current}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n open={showCustomDateSelector}\n onClose={() => setShowCustomDateSelector(false)}\n sx={(theme) => ({\n padding: theme.spacing(2),\n })}\n >\n <DateTimeRangePicker\n initialTimeRange={convertedTimeRange}\n onChange={(value: AbsoluteTimeRange) => {\n onChange(value);\n setShowCustomDateSelector(false);\n setOpen(false);\n }}\n onCancel={() => setShowCustomDateSelector(false)}\n />\n </Popover>\n <Box ref={anchorEl}>\n <Select\n open={open}\n value={formatTimeRange(value, timeZone)}\n onClick={() => setOpen(!open)}\n IconComponent={Calendar}\n inputProps={{\n 'aria-label': `Select time range. Currently set to ${value}`,\n }}\n sx={{\n // `transform: none` prevents calendar icon from flipping over when menu is open\n '.MuiSelect-icon': {\n marginTop: '1px',\n transform: 'none',\n },\n // paddingRight creates more space for the calendar icon (it's a bigger icon)\n '.MuiSelect-select.MuiSelect-outlined.MuiInputBase-input': {\n paddingRight: '36px',\n },\n '.MuiSelect-select': height ? { lineHeight: height, paddingY: 0 } : {},\n }}\n >\n {timeOptions.map((item, idx) => (\n <MenuItem\n key={idx}\n value={formatTimeRange(item.value, timeZone)}\n onClick={() => {\n onChange(item.value);\n }}\n >\n {item.display}\n </MenuItem>\n ))}\n {showCustomTimeRange && (\n <MenuItem\n value={formatTimeRange(lastOption.value, timeZone)}\n onClick={() => setShowCustomDateSelector(true)}\n >\n {lastOption.display}\n </MenuItem>\n )}\n </Select>\n </Box>\n </>\n );\n}\n"],"names":["Box","MenuItem","Popover","Select","Calendar","isRelativeTimeRange","toAbsoluteTimeRange","useMemo","useRef","useState","useTimeZone","DateTimeRangePicker","buildCustomTimeOption","formatTimeRange","TimeRangeSelector","value","timeOptions","onChange","height","showCustomTimeRange","timeZone","anchorEl","showCustomDateSelector","setShowCustomDateSelector","convertedTimeRange","lastOption","undefined","open","setOpen","current","anchorOrigin","vertical","horizontal","onClose","sx","theme","padding","spacing","initialTimeRange","onCancel","ref","onClick","IconComponent","inputProps","marginTop","transform","paddingRight","lineHeight","paddingY","map","item","idx","display"],"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,SAASA,GAAG,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,MAAM,QAAQ,gBAAgB;AAC/D,OAAOC,cAAc,2BAA2B;AAChD,SAAyBC,mBAAmB,EAAqBC,mBAAmB,QAAQ,mBAAmB;AAC/G,SAAuBC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,mBAAmB,QAAQ,wBAAwB;AAC5D,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,UAAU;AA2BjE;;;;;CAKC,GACD,OAAO,SAASC,kBAAkB,EAChCC,KAAK,EACLC,WAAW,EACXC,QAAQ,EACRC,MAAM,EACNC,sBAAsB,IAAI,EACH;IACvB,MAAM,EAAEC,QAAQ,EAAE,GAAGV;IAErB,MAAMW,WAAWb,UAAU,kDAAkD;IAE7E,2DAA2D;IAC3D,MAAM,CAACc,wBAAwBC,0BAA0B,GAAGd,SAAS;IAErE,4DAA4D;IAC5D,MAAMe,qBAAqBjB,QAAQ;QACjC,OAAOF,oBAAoBU,SAAST,oBAAoBS,SAASA;IACnE,GAAG;QAACA;KAAM;IAEV,yDAAyD;IACzD,qEAAqE;IACrE,uGAAuG;IACvG,MAAMU,aAAalB,QACjB,IAAMK,sBAAsBP,oBAAoBU,SAASW,YAAYX,OAAOK,WAC5E;QAACL;QAAOK;KAAS;IAGnB,iHAAiH;IACjH,UAAU;IACV,EAAE;IACF,mHAAmH;IACnH,qCAAqC;IACrC,iHAAiH;IACjH,MAAM,CAACO,MAAMC,QAAQ,GAAGnB,SAAS;IAEjC,qBACE;;0BACE,KAACP;gBACCmB,UAAUA,SAASQ,OAAO;gBAC1BC,cAAc;oBACZC,UAAU;oBACVC,YAAY;gBACd;gBACAL,MAAML;gBACNW,SAAS,IAAMV,0BAA0B;gBACzCW,IAAI,CAACC,QAAW,CAAA;wBACdC,SAASD,MAAME,OAAO,CAAC;oBACzB,CAAA;0BAEA,cAAA,KAAC1B;oBACC2B,kBAAkBd;oBAClBP,UAAU,CAACF;wBACTE,SAASF;wBACTQ,0BAA0B;wBAC1BK,QAAQ;oBACV;oBACAW,UAAU,IAAMhB,0BAA0B;;;0BAG9C,KAACvB;gBAAIwC,KAAKnB;0BACR,cAAA,MAAClB;oBACCwB,MAAMA;oBACNZ,OAAOF,gBAAgBE,OAAOK;oBAC9BqB,SAAS,IAAMb,QAAQ,CAACD;oBACxBe,eAAetC;oBACfuC,YAAY;wBACV,cAAc,CAAC,oCAAoC,EAAE5B,OAAO;oBAC9D;oBACAmB,IAAI;wBACF,gFAAgF;wBAChF,mBAAmB;4BACjBU,WAAW;4BACXC,WAAW;wBACb;wBACA,6EAA6E;wBAC7E,2DAA2D;4BACzDC,cAAc;wBAChB;wBACA,qBAAqB5B,SAAS;4BAAE6B,YAAY7B;4BAAQ8B,UAAU;wBAAE,IAAI,CAAC;oBACvE;;wBAEChC,YAAYiC,GAAG,CAAC,CAACC,MAAMC,oBACtB,KAAClD;gCAECc,OAAOF,gBAAgBqC,KAAKnC,KAAK,EAAEK;gCACnCqB,SAAS;oCACPxB,SAASiC,KAAKnC,KAAK;gCACrB;0CAECmC,KAAKE,OAAO;+BANRD;wBASRhC,qCACC,KAAClB;4BACCc,OAAOF,gBAAgBY,WAAWV,KAAK,EAAEK;4BACzCqB,SAAS,IAAMlB,0BAA0B;sCAExCE,WAAW2B,OAAO;;;;;;;AAOjC"}
@@ -25,23 +25,24 @@ const _react = require("react");
25
25
  const _material = require("@mui/material");
26
26
  const _xdatepickers = require("@mui/x-date-pickers");
27
27
  const _AdapterDateFnsV3 = require("@mui/x-date-pickers/AdapterDateFnsV3");
28
+ const _context = require("../context");
28
29
  const _ErrorBoundary = require("../ErrorBoundary");
29
30
  const _ErrorAlert = require("../ErrorAlert");
30
- const _format = require("../utils/format");
31
31
  const _utils = require("./utils");
32
- const DateTimeRangePicker = ({ initialTimeRange, onChange, onCancel, timeZone })=>{
32
+ const DateTimeRangePicker = ({ initialTimeRange, onChange, onCancel })=>{
33
+ const { formatWithUserTimeZone } = (0, _context.useTimeZone)();
33
34
  // Time range values as dates that can be used as a time range.
34
35
  const [timeRange, setTimeRange] = (0, _react.useState)(initialTimeRange);
35
36
  // Time range values as strings used to populate the text inputs. May not
36
37
  // be valid as dates when the user is typing.
37
38
  const [timeRangeInputs, setTimeRangeInputs] = (0, _react.useState)({
38
- start: (0, _format.formatWithTimeZone)(initialTimeRange.start, _utils.DATE_TIME_FORMAT, timeZone),
39
- end: (0, _format.formatWithTimeZone)(initialTimeRange.end, _utils.DATE_TIME_FORMAT, timeZone)
39
+ start: formatWithUserTimeZone(initialTimeRange.start, _utils.DATE_TIME_FORMAT),
40
+ end: formatWithUserTimeZone(initialTimeRange.end, _utils.DATE_TIME_FORMAT)
40
41
  });
41
42
  const [showStartCalendar, setShowStartCalendar] = (0, _react.useState)(true);
42
43
  const changeTimeRange = (newTime, segment)=>{
43
44
  const isInputChange = typeof newTime === 'string';
44
- const newInputTime = isInputChange ? newTime : (0, _format.formatWithTimeZone)(newTime, _utils.DATE_TIME_FORMAT, timeZone);
45
+ const newInputTime = isInputChange ? newTime : formatWithUserTimeZone(newTime, _utils.DATE_TIME_FORMAT);
45
46
  setTimeRangeInputs((prevTimeRangeInputs)=>{
46
47
  return {
47
48
  ...prevTimeRangeInputs,
@@ -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,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AAC;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';