react-timezone-range-picker 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Your Name or Your Company
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # 🕓 React Timezone Range Picker
2
+
3
+ **Flexible, Mantine-powered UI components for building timezone-aware date and time range pickers.**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/react-timezone-range-picker?color=blue&label=npm)](https://www.npmjs.com/package/react-timezone-range-picker)
6
+ [![license](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
+ [![React](https://img.shields.io/badge/react-18%2B-61dafb?logo=react)](https://react.dev)
8
+
9
+ ---
10
+
11
+ ## ✨ Features
12
+
13
+ - 📅 **Start–End & Around-time panels** for absolute and relative time selection
14
+ - 🌍 **Timezone-aware** display and conversion (via `dayjs`)
15
+ - 🎨 **Mantine 8** components for accessibility and theming
16
+ - ⚡️ **TypeScript** support with generated definitions
17
+ - 🪶 **Lightweight** build via `tsup`, tree-shakeable ESM + CJS outputs
18
+
19
+ ---
20
+
21
+ ## 📦 Installation
22
+
23
+ ```bash
24
+ # npm
25
+ npm install react-timezone-range-picker
26
+
27
+ # yarn
28
+ yarn add react-timezone-range-picker
29
+
30
+ # pnpm
31
+ pnpm add react-timezone-range-picker
32
+ ```
33
+
34
+ **Peer dependencies:**
35
+ You must install these in your project:
36
+
37
+ - `react` (>=18)
38
+ - `react-dom` (>=18)
39
+ - `@mantine/core` (>=8.3.1)
40
+ - `@mantine/dates` (>=8.3.1)
41
+ - `@mantine/form` (>=8.3.4)
42
+ - `@mantine/hooks` (>=8.3.1)
43
+ - `dayjs` (>=1.11.18)
44
+
45
+ ---
46
+
47
+ ## Usage
48
+
49
+ ```tsx
50
+ import { TimezoneRangePicker, OnApplyParams, TimezoneData } from "react-timezone-range-picker";
51
+
52
+ const DEFAULT_TIMEZONE = {
53
+ name: "Asia/Tokyo",
54
+ longName: "Japan Standard Time",
55
+ utcOffset: "+09:00",
56
+ };
57
+
58
+ const DEFAULT_RANGE = {
59
+ startDate: "2025-06-10",
60
+ startTime: "09:00:00",
61
+ endDate: "2025-06-11",
62
+ endTime: "18:00:00",
63
+ timezone: DEFAULT_TIMEZONE,
64
+ };
65
+
66
+ function App() {
67
+ const [range, setRange] = useState<TzRange>(DEFAULT_RANGE);
68
+
69
+ const handleTimeRangeApply = ({
70
+ startDate,
71
+ startTime,
72
+ endDate,
73
+ endTime,
74
+ timezone,
75
+ }: OnApplyParams) => {
76
+ setRange({ startDate, startTime, endDate, endTime, timezone });
77
+ };
78
+
79
+ return <TimezoneRangePicker {...range} onApply={handleTimeRangeApply} />;
80
+ }
81
+ ```
package/dist/index.css ADDED
@@ -0,0 +1,80 @@
1
+ /* src/TimezonePanel/components/TimezoneList/index.module.css */
2
+ .row {
3
+ padding: 0.4rem;
4
+ }
5
+ .row-dark {
6
+ cursor: pointer;
7
+ &:hover {
8
+ background-color: #3a3a3a;
9
+ }
10
+ }
11
+ .row-light {
12
+ cursor: pointer;
13
+ &:hover {
14
+ background-color: #f3f4f6;
15
+ }
16
+ }
17
+ .row-selected-dark {
18
+ background-color: #5a5a5a;
19
+ font-weight: 600;
20
+ &:hover {
21
+ background-color: #5a5a5a;
22
+ }
23
+ }
24
+ .row-selected-light {
25
+ background-color: #f3f4f6;
26
+ font-weight: 600;
27
+ &:hover {
28
+ background-color: #f3f4f6;
29
+ }
30
+ }
31
+
32
+ /* src/TimezonePanel/index.module.css */
33
+ .timezone-panel-container {
34
+ height: 100%;
35
+ }
36
+ .list-container {
37
+ overflow-y: auto;
38
+ height: inherit;
39
+ margin-top: 0.5rem;
40
+ }
41
+
42
+ /* src/styles/index.module.css */
43
+ .form-container {
44
+ display: flex;
45
+ flex: 2;
46
+ flex-direction: column;
47
+ justify-content: space-between;
48
+ height: 100%;
49
+ }
50
+
51
+ /* src/Sidebar/index.module.css */
52
+ .sidebar-container {
53
+ border-right: 1px solid #ddd;
54
+ }
55
+ .sidebar-row {
56
+ cursor: pointer;
57
+ & > div > svg {
58
+ margin-right: 0.5rem;
59
+ }
60
+ }
61
+
62
+ /* src/RelativeTimePanel/index.module.css */
63
+ .relative-time-panel-container {
64
+ height: calc(100% - 120px - 36px);
65
+ overflow-y: auto;
66
+ }
67
+ .time-row {
68
+ cursor: pointer;
69
+ }
70
+ .time-row-dark {
71
+ &:hover {
72
+ background-color: #3a3a3a;
73
+ }
74
+ }
75
+ .time-row-light {
76
+ &:hover {
77
+ background-color: #f3f4f6;
78
+ }
79
+ }
80
+ /*# sourceMappingURL=index.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/TimezonePanel/components/TimezoneList/index.module.css","../src/TimezonePanel/index.module.css","../src/styles/index.module.css","../src/Sidebar/index.module.css","../src/RelativeTimePanel/index.module.css"],"sourcesContent":[".row {\n padding: 0.4rem;\n}\n\n.row-dark {\n cursor: pointer;\n &:hover {\n background-color: #3a3a3a;\n }\n}\n\n.row-light {\n cursor: pointer;\n &:hover {\n background-color: #f3f4f6;\n }\n}\n\n.row-selected-dark {\n background-color: #5a5a5a;\n font-weight: 600;\n &:hover {\n background-color: #5a5a5a;\n }\n}\n\n.row-selected-light {\n background-color: #f3f4f6;\n font-weight: 600;\n &:hover {\n background-color: #f3f4f6;\n }\n}\n",".timezone-panel-container {\n height: 100%;\n}\n\n.list-container {\n overflow-y: auto;\n height: inherit;\n margin-top: 0.5rem;\n}\n",".form-container {\n display: flex;\n flex: 2;\n flex-direction: column;\n justify-content: space-between;\n height: 100%;\n}\n",".sidebar-container {\n border-right: 1px solid #ddd;\n}\n\n.sidebar-row {\n cursor: pointer;\n\n & > div > svg {\n margin-right: 0.5rem;\n }\n}\n",".relative-time-panel-container {\n height: calc(100% - 120px - 36px);\n overflow-y: auto;\n}\n\n.time-row {\n cursor: pointer;\n}\n\n.time-row-dark {\n &:hover {\n background-color: #3a3a3a;\n }\n}\n\n.time-row-light {\n &:hover {\n background-color: #f3f4f6;\n }\n}\n"],"mappings":";AAAA,CAAC;AACC,WAAS;AACX;AAEA,CAAC;AACC,UAAQ;AACR,GAAC;AACC,sBAAkB;AACpB;AACF;AAEA,CAAC;AACC,UAAQ;AACR,GAAC;AACC,sBAAkB;AACpB;AACF;AAEA,CAAC;AACC,oBAAkB;AAClB,eAAa;AACb,GAAC;AACC,sBAAkB;AACpB;AACF;AAEA,CAAC;AACC,oBAAkB;AAClB,eAAa;AACb,GAAC;AACC,sBAAkB;AACpB;AACF;;;AChCA,CAAC;AACC,UAAQ;AACV;AAEA,CAAC;AACC,cAAY;AACZ,UAAQ;AACR,cAAY;AACd;;;ACRA,CAAC;AACC,WAAS;AACT,QAAM;AACN,kBAAgB;AAChB,mBAAiB;AACjB,UAAQ;AACV;;;ACNA,CAAC;AACC,gBAAc,IAAI,MAAM;AAC1B;AAEA,CAAC;AACC,UAAQ;AAER,IAAE,EAAE,IAAI,EAAE;AACR,kBAAc;AAChB;AACF;;;ACVA,CAAC;AACC,UAAQ,KAAK,KAAK,EAAE,MAAM,EAAE;AAC5B,cAAY;AACd;AAEA,CAAC;AACC,UAAQ;AACV;AAEA,CAAC;AACC,GAAC;AACC,sBAAkB;AACpB;AACF;AAEA,CAAC;AACC,GAAC;AACC,sBAAkB;AACpB;AACF;","names":[]}
@@ -0,0 +1,36 @@
1
+ import { FC } from 'react';
2
+
3
+ interface TimezoneData {
4
+ name: string | null;
5
+ longName: string | null;
6
+ utcOffset: string | null;
7
+ }
8
+ interface OnApplyParams {
9
+ startDate: string | null;
10
+ startTime: string | null;
11
+ endDate: string | null;
12
+ endTime: string | null;
13
+ timezone: TimezoneData;
14
+ }
15
+ interface TzRange {
16
+ startDate: string | null;
17
+ startTime: string | null;
18
+ endDate: string | null;
19
+ endTime: string | null;
20
+ timezone: TimezoneData;
21
+ onApply: ({ startDate, startTime, endDate, endTime, timezone }: OnApplyParams) => void;
22
+ }
23
+
24
+ interface ITimezonePanel {
25
+ tzRange: TzRange;
26
+ }
27
+ declare const TimezonePanel: FC<ITimezonePanel>;
28
+
29
+ declare enum Panel {
30
+ START_END_TIME = "Start and end times",
31
+ AROUND_TIME = "Around a time",
32
+ TIMEZONE = "Time zone"
33
+ }
34
+ declare const TimezoneRangePicker: FC<TzRange>;
35
+
36
+ export { type OnApplyParams, Panel, type TimezoneData, TimezonePanel, TimezoneRangePicker, type TzRange };
@@ -0,0 +1,36 @@
1
+ import { FC } from 'react';
2
+
3
+ interface TimezoneData {
4
+ name: string | null;
5
+ longName: string | null;
6
+ utcOffset: string | null;
7
+ }
8
+ interface OnApplyParams {
9
+ startDate: string | null;
10
+ startTime: string | null;
11
+ endDate: string | null;
12
+ endTime: string | null;
13
+ timezone: TimezoneData;
14
+ }
15
+ interface TzRange {
16
+ startDate: string | null;
17
+ startTime: string | null;
18
+ endDate: string | null;
19
+ endTime: string | null;
20
+ timezone: TimezoneData;
21
+ onApply: ({ startDate, startTime, endDate, endTime, timezone }: OnApplyParams) => void;
22
+ }
23
+
24
+ interface ITimezonePanel {
25
+ tzRange: TzRange;
26
+ }
27
+ declare const TimezonePanel: FC<ITimezonePanel>;
28
+
29
+ declare enum Panel {
30
+ START_END_TIME = "Start and end times",
31
+ AROUND_TIME = "Around a time",
32
+ TIMEZONE = "Time zone"
33
+ }
34
+ declare const TimezoneRangePicker: FC<TzRange>;
35
+
36
+ export { type OnApplyParams, Panel, type TimezoneData, TimezonePanel, TimezoneRangePicker, type TzRange };