react-timezone-range-picker 0.1.0 → 0.1.1

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 (56) hide show
  1. package/README.md +8 -4
  2. package/dist/AroundTimePanel/index.d.ts +8 -0
  3. package/dist/AroundTimePanel/index.d.ts.map +1 -0
  4. package/dist/AroundTimePanel/util.d.ts +16 -0
  5. package/dist/AroundTimePanel/util.d.ts.map +1 -0
  6. package/dist/Footer/index.d.ts +2 -0
  7. package/dist/Footer/index.d.ts.map +1 -0
  8. package/dist/Provider/PopoverProvider.d.ts +12 -0
  9. package/dist/Provider/PopoverProvider.d.ts.map +1 -0
  10. package/dist/RelativeTimePanel/index.d.ts +7 -0
  11. package/dist/RelativeTimePanel/index.d.ts.map +1 -0
  12. package/dist/RelativeTimePanel/timeOptions.d.ts +9 -0
  13. package/dist/RelativeTimePanel/timeOptions.d.ts.map +1 -0
  14. package/dist/Sidebar/index.d.ts +10 -0
  15. package/dist/Sidebar/index.d.ts.map +1 -0
  16. package/dist/StartEndTimePanel/index.d.ts +8 -0
  17. package/dist/StartEndTimePanel/index.d.ts.map +1 -0
  18. package/dist/TimezonePanel/components/TimezoneList/index.d.ts +14 -0
  19. package/dist/TimezonePanel/components/TimezoneList/index.d.ts.map +1 -0
  20. package/dist/TimezonePanel/components/TimezoneSearch/index.d.ts +8 -0
  21. package/dist/TimezonePanel/components/TimezoneSearch/index.d.ts.map +1 -0
  22. package/dist/TimezonePanel/index.d.ts +8 -0
  23. package/dist/TimezonePanel/index.d.ts.map +1 -0
  24. package/dist/TimezonePanel/util/getBrowserTimezone.d.ts +8 -0
  25. package/dist/TimezonePanel/util/getBrowserTimezone.d.ts.map +1 -0
  26. package/dist/TimezonePanel/util/getTimezones.d.ts +8 -0
  27. package/dist/TimezonePanel/util/getTimezones.d.ts.map +1 -0
  28. package/dist/TimezonePanel/util/longTzName.d.ts +2 -0
  29. package/dist/TimezonePanel/util/longTzName.d.ts.map +1 -0
  30. package/dist/TimezonePanel/util/parseOffest.d.ts +2 -0
  31. package/dist/TimezonePanel/util/parseOffest.d.ts.map +1 -0
  32. package/dist/TimezoneRangePicker/index.d.ts +9 -0
  33. package/dist/TimezoneRangePicker/index.d.ts.map +1 -0
  34. package/dist/hooks/useAppTheme.d.ts +5 -0
  35. package/dist/hooks/useAppTheme.d.ts.map +1 -0
  36. package/dist/index.cjs.js +63 -0
  37. package/dist/index.cjs.js.map +1 -0
  38. package/dist/index.d.ts +4 -36
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.es.js +2301 -0
  41. package/dist/index.es.js.map +1 -0
  42. package/dist/interfaces/index.d.ts +21 -0
  43. package/dist/interfaces/index.d.ts.map +1 -0
  44. package/dist/style.css +1 -0
  45. package/dist/test.setup.d.ts +2 -0
  46. package/dist/test.setup.d.ts.map +1 -0
  47. package/dist/util/dateTime.d.ts +23 -0
  48. package/dist/util/dateTime.d.ts.map +1 -0
  49. package/package.json +11 -10
  50. package/dist/index.css +0 -80
  51. package/dist/index.css.map +0 -1
  52. package/dist/index.d.mts +0 -36
  53. package/dist/index.js +0 -1007
  54. package/dist/index.js.map +0 -1
  55. package/dist/index.mjs +0 -997
  56. package/dist/index.mjs.map +0 -1
package/dist/index.js DELETED
@@ -1,1007 +0,0 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
- var core = require('@mantine/core');
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var dayjs4 = require('dayjs');
7
- var utc = require('dayjs/plugin/utc');
8
- var timezone = require('dayjs/plugin/timezone');
9
- var dates = require('@mantine/dates');
10
- var form = require('@mantine/form');
11
-
12
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
-
14
- var dayjs4__default = /*#__PURE__*/_interopDefault(dayjs4);
15
- var utc__default = /*#__PURE__*/_interopDefault(utc);
16
- var timezone__default = /*#__PURE__*/_interopDefault(timezone);
17
-
18
- // src/TimezonePanel/index.tsx
19
- function useTimeoutFn(fn, ms) {
20
- var ready = react.useRef(false);
21
- var timeout = react.useRef();
22
- var callback = react.useRef(fn);
23
- var isReady = react.useCallback(function() {
24
- return ready.current;
25
- }, []);
26
- var set = react.useCallback(function() {
27
- ready.current = false;
28
- timeout.current && clearTimeout(timeout.current);
29
- timeout.current = setTimeout(function() {
30
- ready.current = true;
31
- callback.current();
32
- }, ms);
33
- }, [ms]);
34
- var clear = react.useCallback(function() {
35
- ready.current = null;
36
- timeout.current && clearTimeout(timeout.current);
37
- }, []);
38
- react.useEffect(function() {
39
- callback.current = fn;
40
- }, [fn]);
41
- react.useEffect(function() {
42
- set();
43
- return clear;
44
- }, [ms]);
45
- return [isReady, clear, set];
46
- }
47
-
48
- // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@19.1.1_react@19.1.1__react@19.1.1/node_modules/react-use/esm/useDebounce.js
49
- function useDebounce(fn, ms, deps) {
50
- if (deps === void 0) {
51
- deps = [];
52
- }
53
- var _a = useTimeoutFn(fn, ms), isReady = _a[0], cancel = _a[1], reset = _a[2];
54
- react.useEffect(reset, deps);
55
- return [isReady, cancel];
56
- }
57
-
58
- // ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
59
- function r(e) {
60
- var t, f, n = "";
61
- if ("string" == typeof e || "number" == typeof e) n += e;
62
- else if ("object" == typeof e) if (Array.isArray(e)) {
63
- var o = e.length;
64
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
65
- } else for (f in e) e[f] && (n && (n += " "), n += f);
66
- return n;
67
- }
68
- function clsx() {
69
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
70
- return n;
71
- }
72
- var clsx_default = clsx;
73
-
74
- // src/TimezonePanel/components/TimezoneList/index.module.css
75
- var TimezoneList_default = {};
76
- var useAppTheme = () => {
77
- const { colorScheme } = core.useMantineColorScheme();
78
- const theme = core.useMantineTheme();
79
- return { colorScheme, theme, appTheme: theme.other.appTheme[colorScheme] };
80
- };
81
- var TimezoneList = ({
82
- name,
83
- longName,
84
- currentTime,
85
- utcOffset,
86
- selectedTimezone,
87
- isBrowserTimezone = false,
88
- handleTimezoneMouseClick = void 0
89
- }) => {
90
- const { colorScheme } = useAppTheme();
91
- const onClick = () => {
92
- if (isBrowserTimezone) return;
93
- handleTimezoneMouseClick({
94
- name,
95
- longName,
96
- utcOffset
97
- });
98
- };
99
- return /* @__PURE__ */ jsxRuntime.jsxs(
100
- core.Flex,
101
- {
102
- direction: "column",
103
- className: clsx_default(
104
- TimezoneList_default.row,
105
- isBrowserTimezone ? void 0 : colorScheme === "dark" ? TimezoneList_default["row-dark"] : TimezoneList_default["row-light"],
106
- selectedTimezone?.name === name ? colorScheme === "dark" ? TimezoneList_default["row-selected-dark"] : TimezoneList_default["row-selected-light"] : void 0
107
- ),
108
- onClick,
109
- children: [
110
- /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { justify: "space-between", children: [
111
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "sm", children: name }),
112
- /* @__PURE__ */ jsxRuntime.jsxs(core.Text, { size: "sm", children: [
113
- currentTime,
114
- " \u2022 UTC",
115
- utcOffset
116
- ] })
117
- ] }),
118
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "sm", children: longName })
119
- ]
120
- }
121
- );
122
- };
123
-
124
- // ../../node_modules/.pnpm/@tabler+icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs
125
- var defaultAttributes = {
126
- outline: {
127
- xmlns: "http://www.w3.org/2000/svg",
128
- width: 24,
129
- height: 24,
130
- viewBox: "0 0 24 24",
131
- fill: "none",
132
- stroke: "currentColor",
133
- strokeWidth: 2,
134
- strokeLinecap: "round",
135
- strokeLinejoin: "round"
136
- },
137
- filled: {
138
- xmlns: "http://www.w3.org/2000/svg",
139
- width: 24,
140
- height: 24,
141
- viewBox: "0 0 24 24",
142
- fill: "currentColor",
143
- stroke: "none"
144
- }
145
- };
146
-
147
- // ../../node_modules/.pnpm/@tabler+icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs
148
- var createReactComponent = (type, iconName, iconNamePascal, iconNode) => {
149
- const Component = react.forwardRef(
150
- ({ color = "currentColor", size = 24, stroke = 2, title, className, children, ...rest }, ref) => react.createElement(
151
- "svg",
152
- {
153
- ref,
154
- ...defaultAttributes[type],
155
- width: size,
156
- height: size,
157
- className: [`tabler-icon`, `tabler-icon-${iconName}`, className].join(" "),
158
- ...type === "filled" ? {
159
- fill: color
160
- } : {
161
- strokeWidth: stroke,
162
- stroke: color
163
- },
164
- ...rest
165
- },
166
- [
167
- title && react.createElement("title", { key: "svg-title" }, title),
168
- ...iconNode.map(([tag, attrs]) => react.createElement(tag, attrs)),
169
- ...Array.isArray(children) ? children : [children]
170
- ]
171
- )
172
- );
173
- Component.displayName = `${iconNamePascal}`;
174
- return Component;
175
- };
176
-
177
- // ../../node_modules/.pnpm/@tabler+icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendar.mjs
178
- var __iconNode = [["path", { "d": "M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z", "key": "svg-0" }], ["path", { "d": "M16 3v4", "key": "svg-1" }], ["path", { "d": "M8 3v4", "key": "svg-2" }], ["path", { "d": "M4 11h16", "key": "svg-3" }], ["path", { "d": "M11 15h1", "key": "svg-4" }], ["path", { "d": "M12 15v3", "key": "svg-5" }]];
179
- var IconCalendar = createReactComponent("outline", "calendar", "Calendar", __iconNode);
180
-
181
- // ../../node_modules/.pnpm/@tabler+icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.mjs
182
- var __iconNode2 = [["path", { "d": "M9 6l6 6l-6 6", "key": "svg-0" }]];
183
- var IconChevronRight = createReactComponent("outline", "chevron-right", "ChevronRight", __iconNode2);
184
-
185
- // ../../node_modules/.pnpm/@tabler+icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconClock.mjs
186
- var __iconNode3 = [["path", { "d": "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", "key": "svg-0" }], ["path", { "d": "M12 7v5l3 3", "key": "svg-1" }]];
187
- var IconClock = createReactComponent("outline", "clock", "Clock", __iconNode3);
188
-
189
- // ../../node_modules/.pnpm/@tabler+icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconFilter2.mjs
190
- var __iconNode4 = [["path", { "d": "M4 6h16", "key": "svg-0" }], ["path", { "d": "M6 12h12", "key": "svg-1" }], ["path", { "d": "M9 18h6", "key": "svg-2" }]];
191
- var IconFilter2 = createReactComponent("outline", "filter-2", "Filter2", __iconNode4);
192
-
193
- // ../../node_modules/.pnpm/@tabler+icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconWorld.mjs
194
- var __iconNode5 = [["path", { "d": "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", "key": "svg-0" }], ["path", { "d": "M3.6 9h16.8", "key": "svg-1" }], ["path", { "d": "M3.6 15h16.8", "key": "svg-2" }], ["path", { "d": "M11.5 3a17 17 0 0 0 0 18", "key": "svg-3" }], ["path", { "d": "M12.5 3a17 17 0 0 1 0 18", "key": "svg-4" }]];
195
- var IconWorld = createReactComponent("outline", "world", "World", __iconNode5);
196
-
197
- // ../../node_modules/.pnpm/@tabler+icons-react@3.35.0_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendarWeekFilled.mjs
198
- var __iconNode6 = [["path", { "d": "M16 2c.183 0 .355 .05 .502 .135l.033 .02c.28 .177 .465 .49 .465 .845v1h1a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h1v-1a1 1 0 0 1 .514 -.874l.093 -.046l.066 -.025l.1 -.029l.107 -.019l.12 -.007q .083 0 .161 .013l.122 .029l.04 .012l.06 .023c.328 .135 .568 .44 .61 .806l.007 .117v1h6v-1a1 1 0 0 1 1 -1m3 7h-14v9.625c0 .705 .386 1.286 .883 1.366l.117 .009h12c.513 0 .936 -.53 .993 -1.215l.007 -.16z", "key": "svg-0" }], ["path", { "d": "M9.015 13a1 1 0 0 1 -1 1a1.001 1.001 0 1 1 -.005 -2c.557 0 1.005 .448 1.005 1", "key": "svg-1" }], ["path", { "d": "M13.015 13a1 1 0 0 1 -1 1a1.001 1.001 0 1 1 -.005 -2c.557 0 1.005 .448 1.005 1", "key": "svg-2" }], ["path", { "d": "M17.02 13a1 1 0 0 1 -1 1a1.001 1.001 0 1 1 -.005 -2c.557 0 1.005 .448 1.005 1", "key": "svg-3" }], ["path", { "d": "M12.02 15a1 1 0 0 1 0 2a1.001 1.001 0 1 1 -.005 -2z", "key": "svg-4" }], ["path", { "d": "M9.015 16a1 1 0 0 1 -1 1a1.001 1.001 0 1 1 -.005 -2c.557 0 1.005 .448 1.005 1", "key": "svg-5" }]];
199
- var IconCalendarWeekFilled = createReactComponent("filled", "calendar-week-filled", "CalendarWeekFilled", __iconNode6);
200
- var TimezoneSearch = ({ searchText, setSearchText }) => {
201
- return /* @__PURE__ */ jsxRuntime.jsx(
202
- core.Input,
203
- {
204
- placeholder: "Timezone search (Asia, Tokyo, +09:00, etc)",
205
- leftSection: /* @__PURE__ */ jsxRuntime.jsx(IconFilter2, { stroke: 2 }),
206
- value: searchText,
207
- onChange: (e) => setSearchText(e.currentTarget.value)
208
- }
209
- );
210
- };
211
-
212
- // src/TimezonePanel/util/longTzName.ts
213
- var longTzName = (timezone3, locale = "en-US") => {
214
- return new Intl.DateTimeFormat(locale, {
215
- timeZone: timezone3,
216
- timeZoneName: "long"
217
- }).formatToParts(/* @__PURE__ */ new Date()).find((p) => p.type === "timeZoneName")?.value || "";
218
- };
219
-
220
- // src/TimezonePanel/util/parseOffest.ts
221
- var parseOffset = (offsetUtc) => {
222
- const sign = offsetUtc[0] === "-" ? -1 : 1;
223
- const [hours, minutes] = offsetUtc.slice(1).split(":").map(Number);
224
- return sign * (hours * 60 + minutes);
225
- };
226
-
227
- // src/TimezonePanel/util/getTimezones.ts
228
- dayjs4__default.default.extend(utc__default.default);
229
- dayjs4__default.default.extend(timezone__default.default);
230
- var getTimezones = () => {
231
- const timezones = Intl.supportedValuesOf("timeZone");
232
- return timezones.map((timezone3) => {
233
- const offset = dayjs4__default.default().tz(timezone3).format("Z");
234
- return {
235
- name: timezone3,
236
- longName: longTzName(timezone3),
237
- currentTime: dayjs4__default.default().tz(timezone3).format("h:mm A"),
238
- utcOffset: offset,
239
- offsetMinutes: parseOffset(offset)
240
- };
241
- }).sort((a, b) => a.offsetMinutes - b.offsetMinutes);
242
- };
243
-
244
- // src/TimezonePanel/index.module.css
245
- var TimezonePanel_default = {};
246
-
247
- // src/styles/index.module.css
248
- var styles_default = {};
249
- dayjs4__default.default.extend(utc__default.default);
250
- dayjs4__default.default.extend(timezone__default.default);
251
- var getBrowserTimezone = () => {
252
- const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
253
- const offset = dayjs4__default.default().tz(tz).format("Z");
254
- return {
255
- name: tz,
256
- longName: longTzName(tz),
257
- currentTime: dayjs4__default.default().tz(tz).format("h:mm A"),
258
- utcOffset: offset,
259
- offsetMinutes: parseOffset(offset)
260
- };
261
- };
262
- var Footer = ({ handleCancelClick }) => {
263
- const { theme } = useAppTheme();
264
- return /* @__PURE__ */ jsxRuntime.jsx(core.Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { columnGap: 16, children: [
265
- /* @__PURE__ */ jsxRuntime.jsx(core.Button, { size: "xs", variant: "subtle", color: theme.primaryColor, onClick: handleCancelClick, children: "Cancel" }),
266
- /* @__PURE__ */ jsxRuntime.jsx(core.Button, { type: "submit", size: "xs", color: theme.primaryColor, children: "Apply" })
267
- ] }) });
268
- };
269
- var TimezonePanel = ({ tzRange }) => {
270
- const [selectedTimezone, setSelectedTimezone] = react.useState(tzRange.timezone);
271
- const [filteredTimezones, setFilteredTimezones] = react.useState([]);
272
- const [searchText, setSearchText] = react.useState("");
273
- const timezones = react.useMemo(() => getTimezones(), []);
274
- react.useEffect(() => {
275
- setFilteredTimezones(timezones);
276
- }, []);
277
- useDebounce(
278
- () => {
279
- if (searchText === "") {
280
- setFilteredTimezones(timezones);
281
- return;
282
- }
283
- setFilteredTimezones(
284
- timezones.filter(
285
- (timezone3) => timezone3.name.toLowerCase().includes(searchText.toLocaleLowerCase()) || timezone3.longName.toLowerCase().includes(searchText.toLocaleLowerCase()) || timezone3.currentTime.toLowerCase().includes(searchText.toLocaleLowerCase()) || timezone3.utcOffset.toLowerCase().includes(searchText.toLocaleLowerCase())
286
- )
287
- );
288
- },
289
- 250,
290
- [searchText]
291
- );
292
- react.useMemo(() => getBrowserTimezone(), []);
293
- const handleTimezoneMouseClick = (selectedTimezone2) => {
294
- setSelectedTimezone(selectedTimezone2);
295
- };
296
- const handleApply = (e) => {
297
- e.preventDefault();
298
- tzRange.onApply({
299
- startDate: tzRange.startDate,
300
- startTime: tzRange.startTime,
301
- endDate: tzRange.endDate,
302
- endTime: tzRange.endTime,
303
- timezone: selectedTimezone || {
304
- name: null,
305
- longName: null,
306
- utcOffset: null
307
- }
308
- });
309
- };
310
- const getCurrentTimeInTz = (tzName) => {
311
- if (!tzName) return "";
312
- return dayjs4__default.default().tz(tzName).format("h:mm A");
313
- };
314
- return /* @__PURE__ */ jsxRuntime.jsxs("form", { className: styles_default["form-container"], onSubmit: handleApply, children: [
315
- /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", style: { height: "calc(100% - 40px)" }, children: [
316
- /* @__PURE__ */ jsxRuntime.jsx(core.Box, { style: { width: "95%" }, mx: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(TimezoneSearch, { searchText, setSearchText }) }),
317
- /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { style: { overflowY: "scroll" }, children: [
318
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { fw: 600, px: 12, children: "My Location" }),
319
- /* @__PURE__ */ jsxRuntime.jsx(core.Flex, { direction: "column", children: /* @__PURE__ */ jsxRuntime.jsx(
320
- TimezoneList,
321
- {
322
- isBrowserTimezone: true,
323
- name: tzRange.timezone?.name,
324
- longName: tzRange.timezone?.longName,
325
- currentTime: getCurrentTimeInTz(tzRange.timezone?.name),
326
- utcOffset: tzRange.timezone?.utcOffset,
327
- selectedTimezone
328
- }
329
- ) }),
330
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { fw: 600, px: 12, children: "Locations" }),
331
- /* @__PURE__ */ jsxRuntime.jsx(core.Flex, { direction: "column", className: TimezonePanel_default["list-container"], children: filteredTimezones.map((tz, idx) => /* @__PURE__ */ jsxRuntime.jsx(
332
- TimezoneList,
333
- {
334
- name: tz.name,
335
- longName: tz.longName,
336
- currentTime: tz.currentTime,
337
- utcOffset: tz.utcOffset,
338
- selectedTimezone,
339
- handleTimezoneMouseClick
340
- },
341
- idx
342
- )) })
343
- ] })
344
- ] }),
345
- /* @__PURE__ */ jsxRuntime.jsx(core.Box, { px: 12, children: /* @__PURE__ */ jsxRuntime.jsx(Footer, {}) })
346
- ] });
347
- };
348
-
349
- // src/Sidebar/index.module.css
350
- var Sidebar_default = {};
351
- var getTimeOptions = (timezoneName) => [
352
- {
353
- label: "Today",
354
- searchKey: "today",
355
- startTime: dayjs4__default.default().tz(timezoneName).startOf("day").format(),
356
- endTime: dayjs4__default.default().tz(timezoneName).endOf("day").format()
357
- },
358
- {
359
- label: "Tomorrow",
360
- searchKey: "tomorrow",
361
- startTime: dayjs4__default.default().tz(timezoneName).add(1, "day").startOf("day").format(),
362
- endTime: dayjs4__default.default().tz(timezoneName).add(1, "day").endOf("day").format()
363
- },
364
- {
365
- label: "Yesterday",
366
- searchKey: "yesterday",
367
- startTime: dayjs4__default.default().tz(timezoneName).subtract(1, "day").startOf("day").format(),
368
- endTime: dayjs4__default.default().tz(timezoneName).subtract(1, "day").endOf("day").format(),
369
- lineBreak: true
370
- },
371
- {
372
- label: "Last 15 seconds",
373
- searchKey: "-15s",
374
- startTime: dayjs4__default.default().tz(timezoneName).subtract(15, "second").format(),
375
- endTime: dayjs4__default.default().tz(timezoneName).format()
376
- },
377
- {
378
- label: "Last 30 seconds",
379
- searchKey: "-30s",
380
- startTime: dayjs4__default.default().tz(timezoneName).subtract(30, "second").format(),
381
- endTime: dayjs4__default.default().tz(timezoneName).format()
382
- },
383
- {
384
- label: "Next 15 seconds",
385
- searchKey: "+15s",
386
- startTime: dayjs4__default.default().tz(timezoneName).format(),
387
- endTime: dayjs4__default.default().tz(timezoneName).add(15, "second").format()
388
- },
389
- {
390
- label: "Next 30 seconds",
391
- searchKey: "+30s",
392
- startTime: dayjs4__default.default().tz(timezoneName).format(),
393
- endTime: dayjs4__default.default().tz(timezoneName).add(30, "second").format(),
394
- lineBreak: true
395
- },
396
- {
397
- label: "Last 5 minutes",
398
- searchKey: "-5m",
399
- startTime: dayjs4__default.default().tz(timezoneName).subtract(5, "minute").format(),
400
- endTime: dayjs4__default.default().tz(timezoneName).format()
401
- },
402
- {
403
- label: "Last 10 minutes",
404
- searchKey: "-10m",
405
- startTime: dayjs4__default.default().tz(timezoneName).subtract(10, "minute").format(),
406
- endTime: dayjs4__default.default().tz(timezoneName).format()
407
- },
408
- {
409
- label: "Last 15 minutes",
410
- searchKey: "-15m",
411
- startTime: dayjs4__default.default().tz(timezoneName).subtract(15, "minute").format(),
412
- endTime: dayjs4__default.default().tz(timezoneName).format()
413
- },
414
- {
415
- label: "Last 30 minutes",
416
- searchKey: "-30m",
417
- startTime: dayjs4__default.default().tz(timezoneName).subtract(30, "minute").format(),
418
- endTime: dayjs4__default.default().tz(timezoneName).format()
419
- },
420
- {
421
- label: "Last 45 minutes",
422
- searchKey: "-45m",
423
- startTime: dayjs4__default.default().tz(timezoneName).subtract(45, "minute").format(),
424
- endTime: dayjs4__default.default().tz(timezoneName).format()
425
- },
426
- {
427
- label: "Next 5 minutes",
428
- searchKey: "+5m",
429
- startTime: dayjs4__default.default().tz(timezoneName).format(),
430
- endTime: dayjs4__default.default().tz(timezoneName).add(5, "minute").format()
431
- },
432
- {
433
- label: "Next 10 minutes",
434
- searchKey: "+10m",
435
- startTime: dayjs4__default.default().tz(timezoneName).format(),
436
- endTime: dayjs4__default.default().tz(timezoneName).add(10, "minute").format()
437
- },
438
- {
439
- label: "Next 15 minutes",
440
- searchKey: "+15m",
441
- startTime: dayjs4__default.default().tz(timezoneName).format(),
442
- endTime: dayjs4__default.default().tz(timezoneName).add(15, "minute").format()
443
- },
444
- {
445
- label: "Next 30 minutes",
446
- searchKey: "+30m",
447
- startTime: dayjs4__default.default().tz(timezoneName).format(),
448
- endTime: dayjs4__default.default().tz(timezoneName).add(30, "minute").format()
449
- },
450
- {
451
- label: "Next 45 minutes",
452
- searchKey: "+45m",
453
- startTime: dayjs4__default.default().tz(timezoneName).format(),
454
- endTime: dayjs4__default.default().tz(timezoneName).add(45, "minute").format(),
455
- lineBreak: true
456
- },
457
- {
458
- label: "Last 1 hour",
459
- searchKey: "-1h",
460
- startTime: dayjs4__default.default().tz(timezoneName).subtract(1, "hour").format(),
461
- endTime: dayjs4__default.default().tz(timezoneName).format()
462
- },
463
- {
464
- label: "Last 3 hours",
465
- searchKey: "-3h",
466
- startTime: dayjs4__default.default().tz(timezoneName).subtract(3, "hour").format(),
467
- endTime: dayjs4__default.default().tz(timezoneName).format()
468
- },
469
- {
470
- label: "Last 6 hours",
471
- searchKey: "-6h",
472
- startTime: dayjs4__default.default().tz(timezoneName).subtract(6, "hour").format(),
473
- endTime: dayjs4__default.default().tz(timezoneName).format()
474
- },
475
- {
476
- label: "Last 12 hours",
477
- searchKey: "-12h",
478
- startTime: dayjs4__default.default().tz(timezoneName).subtract(12, "hour").format(),
479
- endTime: dayjs4__default.default().tz(timezoneName).format()
480
- },
481
- {
482
- label: "Next 1 hour",
483
- searchKey: "+1h",
484
- startTime: dayjs4__default.default().tz(timezoneName).format(),
485
- endTime: dayjs4__default.default().tz(timezoneName).add(1, "hour").format()
486
- },
487
- {
488
- label: "Next 3 hours",
489
- searchKey: "+3h",
490
- startTime: dayjs4__default.default().tz(timezoneName).format(),
491
- endTime: dayjs4__default.default().tz(timezoneName).add(3, "hour").format()
492
- },
493
- {
494
- label: "Next 6 hours",
495
- searchKey: "+6h",
496
- startTime: dayjs4__default.default().tz(timezoneName).format(),
497
- endTime: dayjs4__default.default().tz(timezoneName).add(6, "hour").format()
498
- },
499
- {
500
- label: "Next 12 hours",
501
- searchKey: "+12h",
502
- startTime: dayjs4__default.default().tz(timezoneName).format(),
503
- endTime: dayjs4__default.default().tz(timezoneName).add(12, "hour").format(),
504
- lineBreak: true
505
- },
506
- {
507
- label: "Last 1 day",
508
- searchKey: "-1d",
509
- startTime: dayjs4__default.default().tz(timezoneName).subtract(1, "day").format(),
510
- endTime: dayjs4__default.default().tz(timezoneName).format()
511
- },
512
- {
513
- label: "Last 2 days",
514
- searchKey: "-2d",
515
- startTime: dayjs4__default.default().tz(timezoneName).subtract(2, "day").format(),
516
- endTime: dayjs4__default.default().tz(timezoneName).format()
517
- },
518
- {
519
- label: "Last 7 days",
520
- searchKey: "-7d",
521
- startTime: dayjs4__default.default().tz(timezoneName).subtract(7, "day").format(),
522
- endTime: dayjs4__default.default().tz(timezoneName).format()
523
- },
524
- {
525
- label: "Last 14 days",
526
- searchKey: "-14d",
527
- startTime: dayjs4__default.default().tz(timezoneName).subtract(14, "day").format(),
528
- endTime: dayjs4__default.default().tz(timezoneName).format()
529
- },
530
- {
531
- label: "Last 30 days",
532
- searchKey: "-30d",
533
- startTime: dayjs4__default.default().tz(timezoneName).subtract(30, "day").format(),
534
- endTime: dayjs4__default.default().tz(timezoneName).format()
535
- },
536
- {
537
- label: "Next 1 day",
538
- searchKey: "+1d",
539
- startTime: dayjs4__default.default().tz(timezoneName).format(),
540
- endTime: dayjs4__default.default().tz(timezoneName).add(1, "day").format()
541
- },
542
- {
543
- label: "Next 2 days",
544
- searchKey: "+2d",
545
- startTime: dayjs4__default.default().tz(timezoneName).format(),
546
- endTime: dayjs4__default.default().tz(timezoneName).add(2, "day").format()
547
- },
548
- {
549
- label: "Next 7 days",
550
- searchKey: "+7d",
551
- startTime: dayjs4__default.default().tz(timezoneName).format(),
552
- endTime: dayjs4__default.default().tz(timezoneName).add(7, "day").format()
553
- },
554
- {
555
- label: "Next 14 days",
556
- searchKey: "+14d",
557
- startTime: dayjs4__default.default().tz(timezoneName).format(),
558
- endTime: dayjs4__default.default().tz(timezoneName).add(14, "day").format()
559
- },
560
- {
561
- label: "Next 30 days",
562
- searchKey: "+30d",
563
- startTime: dayjs4__default.default().tz(timezoneName).format(),
564
- endTime: dayjs4__default.default().tz(timezoneName).add(30, "day").format()
565
- }
566
- ];
567
-
568
- // src/RelativeTimePanel/index.module.css
569
- var RelativeTimePanel_default = {};
570
- var RelativeTimePanel = ({ tzRange }) => {
571
- const [filteredOptions, setFilteredOptions] = react.useState([]);
572
- const [searchText, setSearchText] = react.useState("");
573
- const { colorScheme } = useAppTheme();
574
- react.useEffect(() => {
575
- if (tzRange.timezone.name !== null) {
576
- const timeOptions = getTimeOptions(tzRange.timezone.name);
577
- setFilteredOptions(timeOptions);
578
- }
579
- }, [tzRange.timezone]);
580
- useDebounce(
581
- () => {
582
- if (searchText === "") {
583
- setFilteredOptions(getTimeOptions(tzRange.timezone.name));
584
- return;
585
- }
586
- const newTimeOptions = filteredOptions.filter(
587
- (value) => value.searchKey.includes(searchText)
588
- );
589
- setFilteredOptions(newTimeOptions);
590
- },
591
- 250,
592
- [searchText]
593
- );
594
- const handleRowClick = (option) => {
595
- const [startDate, startTime] = option.startTime.split("T");
596
- const [endDate, endTime] = option.endTime.split("T");
597
- tzRange.onApply({
598
- startDate,
599
- startTime: startTime.slice(0, 8),
600
- endDate,
601
- endTime: endTime.slice(0, 8),
602
- timezone: tzRange.timezone
603
- });
604
- };
605
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
606
- /* @__PURE__ */ jsxRuntime.jsx(core.Box, { style: { width: "90%" }, mx: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(
607
- core.Input,
608
- {
609
- placeholder: "Relative time (15m, 1h, 1d, 1w)",
610
- value: searchText,
611
- onChange: (e) => setSearchText(e.currentTarget.value)
612
- }
613
- ) }),
614
- /* @__PURE__ */ jsxRuntime.jsx(core.Flex, { direction: "column", className: RelativeTimePanel_default["relative-time-panel-container"], children: filteredOptions.map((op) => /* @__PURE__ */ jsxRuntime.jsxs(
615
- core.Flex,
616
- {
617
- align: "center",
618
- justify: "space-between",
619
- className: clsx_default(
620
- colorScheme === "dark" ? RelativeTimePanel_default["time-row-dark"] : RelativeTimePanel_default["time-row-light"],
621
- RelativeTimePanel_default["time-row"]
622
- ),
623
- py: 4,
624
- px: 12,
625
- mb: op.lineBreak ? 8 : 0,
626
- onClick: () => handleRowClick(op),
627
- children: [
628
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "sm", children: op.label }),
629
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "#5f6368", children: op.searchKey })
630
- ]
631
- },
632
- op.label
633
- )) })
634
- ] });
635
- };
636
- var Sidebar = ({ setSelectedPanel, tzRange }) => {
637
- return /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { className: Sidebar_default["sidebar-container"], flex: 1, children: [
638
- /* @__PURE__ */ jsxRuntime.jsx(RelativeTimePanel, { tzRange }),
639
- /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", rowGap: 16, py: 8, style: { borderTop: "1px solid #ddd" }, children: [
640
- /* @__PURE__ */ jsxRuntime.jsxs(
641
- core.Flex,
642
- {
643
- className: Sidebar_default["sidebar-row"],
644
- justify: "space-between",
645
- align: "center",
646
- px: 12,
647
- onClick: () => setSelectedPanel("Start and end times" /* START_END_TIME */),
648
- children: [
649
- /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", children: [
650
- /* @__PURE__ */ jsxRuntime.jsx(IconCalendarWeekFilled, { stroke: 1.5 }),
651
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "sm", children: "Start and end times" })
652
- ] }),
653
- /* @__PURE__ */ jsxRuntime.jsx(IconChevronRight, { stroke: 1.5 })
654
- ]
655
- }
656
- ),
657
- /* @__PURE__ */ jsxRuntime.jsxs(
658
- core.Flex,
659
- {
660
- className: Sidebar_default["sidebar-row"],
661
- justify: "space-between",
662
- align: "center",
663
- px: 12,
664
- onClick: () => setSelectedPanel("Around a time" /* AROUND_TIME */),
665
- children: [
666
- /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", children: [
667
- /* @__PURE__ */ jsxRuntime.jsx(IconClock, { stroke: 1.5 }),
668
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "sm", children: "Around a time" })
669
- ] }),
670
- /* @__PURE__ */ jsxRuntime.jsx(IconChevronRight, { stroke: 1.5 })
671
- ]
672
- }
673
- ),
674
- /* @__PURE__ */ jsxRuntime.jsxs(
675
- core.Flex,
676
- {
677
- className: Sidebar_default["sidebar-row"],
678
- justify: "space-between",
679
- align: "center",
680
- px: 12,
681
- onClick: () => setSelectedPanel("Time zone" /* TIMEZONE */),
682
- children: [
683
- /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", children: [
684
- /* @__PURE__ */ jsxRuntime.jsx(IconWorld, { stroke: 1.5 }),
685
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "sm", children: "Time zone" })
686
- ] }),
687
- /* @__PURE__ */ jsxRuntime.jsx(IconChevronRight, { stroke: 1.5 })
688
- ]
689
- }
690
- )
691
- ] })
692
- ] });
693
- };
694
- var getCurrentTime = () => dayjs4__default.default().format("HH:mm:ss");
695
- var getCurrentDate = () => dayjs4__default.default().format("YYYY-MM-DD");
696
- var getCurrentPlusDate = (amount) => dayjs4__default.default().add(amount, "day").format("YYYY-MM-DD");
697
- var getShortTimezoneName = (tz) => {
698
- if (!tz) return tz;
699
- return dayjs4__default.default().tz(tz).format("Z");
700
- };
701
- var getPopoverButtonText = (tzRange) => {
702
- return `${dayjs4__default.default(tzRange.startDate).format("YYYY/MM/DD")} ${tzRange.startTime} - ${dayjs4__default.default(
703
- tzRange.endDate
704
- ).format("YYYY/MM/DD")} ${tzRange.endTime} (${getShortTimezoneName(tzRange.timezone.name)})`;
705
- };
706
- var getPastDateTime = (date, time, amount, unit) => {
707
- const d = dayjs4__default.default(`${date} ${time}`).subtract(amount, unit);
708
- return {
709
- date: d.format("YYYY-MM-DD"),
710
- time: d.format("HH:mm:ss")
711
- };
712
- };
713
- var getFutureDateTime = (date, time, amount, unit) => {
714
- const d = dayjs4__default.default(`${date} ${time}`).add(amount, unit);
715
- return {
716
- date: d.format("YYYY-MM-DD"),
717
- time: d.format("HH:mm:ss")
718
- };
719
- };
720
-
721
- // src/AroundTimePanel/util.ts
722
- var TIME_OPTIONS = [
723
- "\xB1 30 seconds" /* ThirtySeconds */,
724
- "\xB1 1 minute" /* OneMinute */,
725
- "\xB1 15 minutes" /* FifteenMinutes */,
726
- "\xB1 30 minutes" /* ThirtyMinutes */,
727
- "\xB1 1 hour" /* OneHour */,
728
- "\xB1 1 day" /* OneDay */
729
- ];
730
- var getStartEndDateTime = (date, time, timeOption) => {
731
- switch (timeOption) {
732
- case "\xB1 30 seconds" /* ThirtySeconds */:
733
- const startDateTime = getPastDateTime(date, time, 30, "second");
734
- const endDateTime = getFutureDateTime(date, time, 30, "second");
735
- return {
736
- startDate: startDateTime.date,
737
- startTime: startDateTime.time,
738
- endDate: endDateTime.date,
739
- endTime: endDateTime.time
740
- };
741
- case "\xB1 1 minute" /* OneMinute */:
742
- const startDateTime1 = getPastDateTime(date, time, 1, "minute");
743
- const endDateTime1 = getFutureDateTime(date, time, 1, "minute");
744
- return {
745
- startDate: startDateTime1.date,
746
- startTime: startDateTime1.time,
747
- endDate: endDateTime1.date,
748
- endTime: endDateTime1.time
749
- };
750
- case "\xB1 15 minutes" /* FifteenMinutes */:
751
- const startDateTime15 = getPastDateTime(date, time, 15, "minute");
752
- const endDateTime15 = getFutureDateTime(date, time, 15, "minute");
753
- return {
754
- startDate: startDateTime15.date,
755
- startTime: startDateTime15.time,
756
- endDate: endDateTime15.date,
757
- endTime: endDateTime15.time
758
- };
759
- case "\xB1 30 minutes" /* ThirtyMinutes */:
760
- const startDateTime30 = getPastDateTime(date, time, 30, "minute");
761
- const endDateTime30 = getFutureDateTime(date, time, 30, "minute");
762
- return {
763
- startDate: startDateTime30.date,
764
- startTime: startDateTime30.time,
765
- endDate: endDateTime30.date,
766
- endTime: endDateTime30.time
767
- };
768
- case "\xB1 1 hour" /* OneHour */:
769
- const startDateTime60 = getPastDateTime(date, time, 1, "hour");
770
- const endDateTime60 = getFutureDateTime(date, time, 1, "hour");
771
- return {
772
- startDate: startDateTime60.date,
773
- startTime: startDateTime60.time,
774
- endDate: endDateTime60.date,
775
- endTime: endDateTime60.time
776
- };
777
- case "\xB1 1 day" /* OneDay */:
778
- const startDateTimeDay = getPastDateTime(date, time, 1, "day");
779
- const endDateTimeDay = getFutureDateTime(date, time, 1, "day");
780
- return {
781
- startDate: startDateTimeDay.date,
782
- startTime: startDateTimeDay.time,
783
- endDate: endDateTimeDay.date,
784
- endTime: endDateTimeDay.time
785
- };
786
- default:
787
- return {
788
- startDate: date,
789
- startTime: time,
790
- endDate: date,
791
- endTime: time
792
- };
793
- }
794
- };
795
- var AroundTimePanel = ({ tzRange }) => {
796
- const form$1 = form.useForm({
797
- initialValues: {
798
- date: getCurrentDate(),
799
- time: getCurrentTime(),
800
- duration: "\xB1 1 day" /* OneDay */
801
- }
802
- });
803
- const onSubmit = (values) => {
804
- const { startDate, startTime, endDate, endTime } = getStartEndDateTime(
805
- values.date,
806
- values.time,
807
- values.duration
808
- );
809
- tzRange.onApply({
810
- startDate,
811
- startTime,
812
- endDate,
813
- endTime,
814
- timezone: tzRange.timezone
815
- });
816
- };
817
- return /* @__PURE__ */ jsxRuntime.jsx(core.Flex, { direction: "column", flex: 2, justify: "space-between", style: { height: "100%" }, px: 12, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: styles_default["form-container"], onSubmit: form$1.onSubmit(onSubmit), children: [
818
- /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { children: [
819
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { fw: 600, children: "Around a time" }),
820
- /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: 8, mt: 12, children: [
821
- /* @__PURE__ */ jsxRuntime.jsx(
822
- dates.DatePickerInput,
823
- {
824
- label: "Pick date",
825
- placeholder: "Pick date",
826
- ...form$1.getInputProps("date"),
827
- popoverProps: { withinPortal: false },
828
- valueFormat: "YYYY/MM/DD",
829
- leftSection: /* @__PURE__ */ jsxRuntime.jsx(IconCalendar, { stroke: 1.5 })
830
- },
831
- form$1.key("date")
832
- ),
833
- /* @__PURE__ */ jsxRuntime.jsx(
834
- dates.TimeInput,
835
- {
836
- label: "Pick time",
837
- placeholder: "Pick time",
838
- withSeconds: true,
839
- defaultValue: getCurrentTime(),
840
- ...form$1.getInputProps("time"),
841
- leftSection: /* @__PURE__ */ jsxRuntime.jsx(IconClock, { stroke: 1.5 }),
842
- rightSection: /* @__PURE__ */ jsxRuntime.jsx(core.Text, { style: { fontSize: 12, fontStyle: "italic", textAlign: "right" }, children: tzRange.timezone?.longName }),
843
- rightSectionWidth: 180,
844
- rightSectionProps: {
845
- style: {
846
- paddingRight: 1
847
- }
848
- }
849
- },
850
- form$1.key("time")
851
- ),
852
- /* @__PURE__ */ jsxRuntime.jsx(
853
- core.Select,
854
- {
855
- label: "Duration",
856
- placeholder: "Pick value",
857
- data: TIME_OPTIONS,
858
- ...form$1.getInputProps("duration"),
859
- comboboxProps: { withinPortal: false }
860
- },
861
- form$1.key("duration")
862
- )
863
- ] })
864
- ] }),
865
- /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
866
- ] }) });
867
- };
868
- var StartEndTimePanel = ({ tzRange }) => {
869
- const form$1 = form.useForm({
870
- mode: "uncontrolled",
871
- initialValues: {
872
- startDate: getCurrentDate(),
873
- startTime: getCurrentTime(),
874
- endDate: getCurrentPlusDate(30),
875
- endTime: getCurrentTime()
876
- }
877
- });
878
- const onSubmit = (values) => {
879
- tzRange.onApply({
880
- startDate: values.startDate,
881
- startTime: values.startTime,
882
- endDate: values.endDate,
883
- endTime: values.endTime,
884
- timezone: tzRange.timezone
885
- });
886
- };
887
- return /* @__PURE__ */ jsxRuntime.jsx(core.Flex, { direction: "column", flex: 2, style: { height: "100%" }, px: 12, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: styles_default["form-container"], onSubmit: form$1.onSubmit(onSubmit), children: [
888
- /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { children: [
889
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { fw: 600, children: "Start and end times" }),
890
- /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: 8, mt: 12, children: [
891
- /* @__PURE__ */ jsxRuntime.jsx(
892
- dates.DatePickerInput,
893
- {
894
- label: "Start time",
895
- ...form$1.getInputProps("startDate"),
896
- popoverProps: { withinPortal: false },
897
- valueFormat: "YYYY/MM/DD",
898
- leftSection: /* @__PURE__ */ jsxRuntime.jsx(IconCalendar, { stroke: 1.5 })
899
- },
900
- form$1.key("startDate")
901
- ),
902
- /* @__PURE__ */ jsxRuntime.jsx(
903
- dates.TimeInput,
904
- {
905
- withSeconds: true,
906
- defaultValue: getCurrentTime(),
907
- ...form$1.getInputProps("startTime"),
908
- leftSection: /* @__PURE__ */ jsxRuntime.jsx(IconClock, { stroke: 1.5 }),
909
- rightSection: /* @__PURE__ */ jsxRuntime.jsx(core.Text, { style: { fontSize: 12, fontStyle: "italic" }, children: tzRange.timezone?.longName }),
910
- rightSectionWidth: 180,
911
- rightSectionProps: {
912
- style: {
913
- paddingRight: 1
914
- }
915
- }
916
- },
917
- form$1.key("startTime")
918
- ),
919
- /* @__PURE__ */ jsxRuntime.jsx(
920
- dates.DatePickerInput,
921
- {
922
- label: "End time",
923
- ...form$1.getInputProps("endDate"),
924
- popoverProps: { withinPortal: false },
925
- valueFormat: "YYYY/MM/DD",
926
- leftSection: /* @__PURE__ */ jsxRuntime.jsx(IconCalendar, { stroke: 1.5 })
927
- },
928
- form$1.key("endDate")
929
- ),
930
- /* @__PURE__ */ jsxRuntime.jsx(
931
- dates.TimeInput,
932
- {
933
- withSeconds: true,
934
- defaultValue: getCurrentTime(),
935
- ...form$1.getInputProps("endTime"),
936
- leftSection: /* @__PURE__ */ jsxRuntime.jsx(IconClock, { stroke: 1.5 }),
937
- rightSection: /* @__PURE__ */ jsxRuntime.jsx(core.Text, { style: { fontSize: 12, fontStyle: "italic" }, children: tzRange.timezone?.longName }),
938
- rightSectionWidth: 180,
939
- rightSectionProps: {
940
- style: {
941
- paddingRight: 1
942
- }
943
- }
944
- },
945
- form$1.key("endTime")
946
- )
947
- ] })
948
- ] }),
949
- /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
950
- ] }) });
951
- };
952
- var Panel = /* @__PURE__ */ ((Panel2) => {
953
- Panel2["START_END_TIME"] = "Start and end times";
954
- Panel2["AROUND_TIME"] = "Around a time";
955
- Panel2["TIMEZONE"] = "Time zone";
956
- return Panel2;
957
- })(Panel || {});
958
- var TimezoneRangePicker = (tzRange) => {
959
- const [selectedPanel, setSelectedPanel] = react.useState("Start and end times" /* START_END_TIME */);
960
- const renderPanel = () => {
961
- switch (selectedPanel) {
962
- case "Start and end times" /* START_END_TIME */:
963
- return /* @__PURE__ */ jsxRuntime.jsx(StartEndTimePanel, { tzRange });
964
- case "Around a time" /* AROUND_TIME */:
965
- return /* @__PURE__ */ jsxRuntime.jsx(AroundTimePanel, { tzRange });
966
- case "Time zone" /* TIMEZONE */:
967
- return /* @__PURE__ */ jsxRuntime.jsx(TimezonePanel, { tzRange });
968
- default:
969
- return null;
970
- }
971
- };
972
- const getButtonText = react.useMemo(
973
- () => getPopoverButtonText(tzRange),
974
- [tzRange.startDate, tzRange.startTime, tzRange.endDate, tzRange.endTime, tzRange.timezone]
975
- );
976
- return /* @__PURE__ */ jsxRuntime.jsxs(core.Popover, { position: "bottom", shadow: "md", children: [
977
- /* @__PURE__ */ jsxRuntime.jsx(core.Popover.Target, { children: /* @__PURE__ */ jsxRuntime.jsx(core.Button, { children: getButtonText }) }),
978
- /* @__PURE__ */ jsxRuntime.jsx(core.Popover.Dropdown, { style: { width: 700, height: 400, padding: 0 }, py: 8, children: /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { style: { height: "100%" }, children: [
979
- /* @__PURE__ */ jsxRuntime.jsx(Sidebar, { tzRange, setSelectedPanel }),
980
- renderPanel()
981
- ] }) })
982
- ] });
983
- };
984
- /*! Bundled license information:
985
-
986
- @tabler/icons-react/dist/esm/defaultAttributes.mjs:
987
- @tabler/icons-react/dist/esm/createReactComponent.mjs:
988
- @tabler/icons-react/dist/esm/icons/IconCalendar.mjs:
989
- @tabler/icons-react/dist/esm/icons/IconChevronRight.mjs:
990
- @tabler/icons-react/dist/esm/icons/IconClock.mjs:
991
- @tabler/icons-react/dist/esm/icons/IconFilter2.mjs:
992
- @tabler/icons-react/dist/esm/icons/IconWorld.mjs:
993
- @tabler/icons-react/dist/esm/icons/IconCalendarWeekFilled.mjs:
994
- @tabler/icons-react/dist/esm/tabler-icons-react.mjs:
995
- (**
996
- * @license @tabler/icons-react v3.35.0 - MIT
997
- *
998
- * This source code is licensed under the MIT license.
999
- * See the LICENSE file in the root directory of this source tree.
1000
- *)
1001
- */
1002
-
1003
- exports.Panel = Panel;
1004
- exports.TimezonePanel = TimezonePanel;
1005
- exports.TimezoneRangePicker = TimezoneRangePicker;
1006
- //# sourceMappingURL=index.js.map
1007
- //# sourceMappingURL=index.js.map