@gfazioli/mantine-clock 1.0.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/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +18 -0
- package/LICENSE +21 -0
- package/README.md +228 -0
- package/dist/cjs/Clock.cjs +574 -0
- package/dist/cjs/Clock.cjs.map +1 -0
- package/dist/cjs/Clock.module.css.cjs +7 -0
- package/dist/cjs/Clock.module.css.cjs.map +1 -0
- package/dist/cjs/hooks/use-clock-count-down.cjs +238 -0
- package/dist/cjs/hooks/use-clock-count-down.cjs.map +1 -0
- package/dist/cjs/hooks/use-clock.cjs +156 -0
- package/dist/cjs/hooks/use-clock.cjs.map +1 -0
- package/dist/cjs/index.cjs +13 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/Clock.mjs +571 -0
- package/dist/esm/Clock.mjs.map +1 -0
- package/dist/esm/Clock.module.css.mjs +5 -0
- package/dist/esm/Clock.module.css.mjs.map +1 -0
- package/dist/esm/hooks/use-clock-count-down.mjs +236 -0
- package/dist/esm/hooks/use-clock-count-down.mjs.map +1 -0
- package/dist/esm/hooks/use-clock.mjs +154 -0
- package/dist/esm/hooks/use-clock.mjs.map +1 -0
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/styles.css +11 -0
- package/dist/styles.layer.css +11 -0
- package/dist/types/Clock.d.ts +82 -0
- package/dist/types/hooks/use-clock-count-down.d.ts +106 -0
- package/dist/types/hooks/use-clock.d.ts +72 -0
- package/dist/types/index.d.mts +6 -0
- package/dist/types/index.d.ts +6 -0
- package/package.json +46 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import isLeapYear from 'dayjs/plugin/isLeapYear';
|
|
4
|
+
import timezonePlugin from 'dayjs/plugin/timezone';
|
|
5
|
+
import utc from 'dayjs/plugin/utc';
|
|
6
|
+
import weekOfYear from 'dayjs/plugin/weekOfYear';
|
|
7
|
+
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
8
|
+
import { useMounted } from '@mantine/hooks';
|
|
9
|
+
|
|
10
|
+
dayjs.extend(utc);
|
|
11
|
+
dayjs.extend(timezonePlugin);
|
|
12
|
+
dayjs.extend(weekOfYear);
|
|
13
|
+
dayjs.extend(isLeapYear);
|
|
14
|
+
function useClock({
|
|
15
|
+
enabled = true,
|
|
16
|
+
timezone = "UTC",
|
|
17
|
+
updateFrequency = 1e3,
|
|
18
|
+
use24Hours = true,
|
|
19
|
+
padSeconds = false,
|
|
20
|
+
padMinutes = false,
|
|
21
|
+
padHours = false
|
|
22
|
+
}) {
|
|
23
|
+
const mounted = useMounted();
|
|
24
|
+
const [time, setTime] = useState(null);
|
|
25
|
+
const [isRunning, setIsRunning] = useState(false);
|
|
26
|
+
const intervalRef = useRef(null);
|
|
27
|
+
const initialEnabledRef = useRef(enabled);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!mounted) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setTime(dayjs().tz(timezone));
|
|
33
|
+
if (enabled) {
|
|
34
|
+
setIsRunning(true);
|
|
35
|
+
} else {
|
|
36
|
+
setIsRunning(false);
|
|
37
|
+
}
|
|
38
|
+
}, [mounted, enabled, timezone]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!mounted || !isRunning) {
|
|
41
|
+
if (intervalRef.current) {
|
|
42
|
+
clearInterval(intervalRef.current);
|
|
43
|
+
intervalRef.current = null;
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const updateClock = () => {
|
|
48
|
+
setTime(dayjs().tz(timezone));
|
|
49
|
+
};
|
|
50
|
+
updateClock();
|
|
51
|
+
intervalRef.current = setInterval(updateClock, updateFrequency);
|
|
52
|
+
return () => {
|
|
53
|
+
if (intervalRef.current) {
|
|
54
|
+
clearInterval(intervalRef.current);
|
|
55
|
+
intervalRef.current = null;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}, [mounted, isRunning, timezone, updateFrequency]);
|
|
59
|
+
const start = useCallback(() => {
|
|
60
|
+
if (!mounted) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
setTime(dayjs().tz(timezone));
|
|
64
|
+
setIsRunning(true);
|
|
65
|
+
}, [mounted, timezone]);
|
|
66
|
+
const pause = useCallback(() => {
|
|
67
|
+
setIsRunning(false);
|
|
68
|
+
}, []);
|
|
69
|
+
const resume = useCallback(() => {
|
|
70
|
+
if (!mounted) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
setTime(dayjs().tz(timezone));
|
|
74
|
+
setIsRunning(true);
|
|
75
|
+
}, [mounted, timezone]);
|
|
76
|
+
const reset = useCallback(() => {
|
|
77
|
+
setIsRunning(false);
|
|
78
|
+
if (initialEnabledRef.current) {
|
|
79
|
+
setTime(dayjs().tz(timezone));
|
|
80
|
+
setIsRunning(true);
|
|
81
|
+
} else {
|
|
82
|
+
setTime(dayjs().tz(timezone));
|
|
83
|
+
}
|
|
84
|
+
}, [timezone]);
|
|
85
|
+
if (!mounted || !time) {
|
|
86
|
+
const staticHours = padHours ? "00" : 0;
|
|
87
|
+
const staticMinutes = padMinutes ? "00" : 0;
|
|
88
|
+
const staticSeconds = padSeconds ? "00" : 0;
|
|
89
|
+
return {
|
|
90
|
+
year: 2024,
|
|
91
|
+
month: 1,
|
|
92
|
+
day: 1,
|
|
93
|
+
week: 1,
|
|
94
|
+
isLeap: false,
|
|
95
|
+
hours: staticHours,
|
|
96
|
+
minutes: staticMinutes,
|
|
97
|
+
seconds: staticSeconds,
|
|
98
|
+
milliseconds: 0,
|
|
99
|
+
amPm: use24Hours ? void 0 : "AM",
|
|
100
|
+
isRunning: false,
|
|
101
|
+
start: () => {
|
|
102
|
+
},
|
|
103
|
+
pause: () => {
|
|
104
|
+
},
|
|
105
|
+
resume: () => {
|
|
106
|
+
},
|
|
107
|
+
reset: () => {
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const year = time.year();
|
|
112
|
+
const month = time.month() + 1;
|
|
113
|
+
const day = time.date();
|
|
114
|
+
const week = time.week();
|
|
115
|
+
const isLeap = time.isLeapYear();
|
|
116
|
+
let hours = time.hour();
|
|
117
|
+
let minutes = time.minute();
|
|
118
|
+
let seconds = time.second();
|
|
119
|
+
const milliseconds = time.millisecond();
|
|
120
|
+
let amPm;
|
|
121
|
+
if (!use24Hours) {
|
|
122
|
+
amPm = Number(hours) >= 12 ? "PM" : "AM";
|
|
123
|
+
hours = Number(hours) % 12 || 12;
|
|
124
|
+
}
|
|
125
|
+
if (padHours) {
|
|
126
|
+
hours = hours.toString().padStart(2, "0");
|
|
127
|
+
}
|
|
128
|
+
if (padMinutes) {
|
|
129
|
+
minutes = minutes.toString().padStart(2, "0");
|
|
130
|
+
}
|
|
131
|
+
if (padSeconds) {
|
|
132
|
+
seconds = seconds.toString().padStart(2, "0");
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
year,
|
|
136
|
+
month,
|
|
137
|
+
day,
|
|
138
|
+
week,
|
|
139
|
+
isLeap,
|
|
140
|
+
hours,
|
|
141
|
+
minutes,
|
|
142
|
+
seconds,
|
|
143
|
+
milliseconds,
|
|
144
|
+
amPm,
|
|
145
|
+
isRunning,
|
|
146
|
+
start,
|
|
147
|
+
pause,
|
|
148
|
+
resume,
|
|
149
|
+
reset
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export { useClock };
|
|
154
|
+
//# sourceMappingURL=use-clock.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-clock.mjs","sources":["../../../src/hooks/use-clock.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport isLeapYear from 'dayjs/plugin/isLeapYear';\nimport timezonePlugin from 'dayjs/plugin/timezone';\nimport utc from 'dayjs/plugin/utc';\nimport weekOfYear from 'dayjs/plugin/weekOfYear';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useMounted } from '@mantine/hooks';\n\ndayjs.extend(utc);\ndayjs.extend(timezonePlugin);\ndayjs.extend(weekOfYear);\ndayjs.extend(isLeapYear);\n\n/**\n * Options for configuring the `useClock` hook.\n */\nexport interface UseClockOptions {\n /** Whether the clock is active and updating. */\n enabled?: boolean;\n /** The timezone to use for the clock. */\n timezone?: string;\n /** The frequency (in milliseconds) at which the clock updates. */\n updateFrequency?: number;\n /** Whether to use 24-hour format or 12-hour format. */\n use24Hours?: boolean;\n /** Whether to pad single-digit seconds with a leading zero. */\n padSeconds?: boolean;\n /** Whether to pad single-digit minutes with a leading zero. */\n padMinutes?: boolean;\n /** Whether to pad single-digit hours with a leading zero. */\n padHours?: boolean;\n}\n\n/**\n * Data returned by the `useClock` hook.\n */\nexport interface ClockData {\n /** The current year. */\n year: number;\n /** The current month (1-12). */\n month: number;\n /** The current day of the month. */\n day: number;\n /** The current week of the year. */\n week: number;\n /** Whether the current year is a leap year. */\n isLeap: boolean;\n /** The current hour (adjusted for 12/24-hour format). */\n hours: number | string;\n /** The current minute. */\n minutes: number | string;\n /** The current second. */\n seconds: number | string;\n /** The current millisecond. */\n milliseconds: number;\n /** Whether the time is AM or PM (only relevant if use24Hours is false). */\n amPm?: 'AM' | 'PM';\n /** Whether the clock is currently running and updating. */\n isRunning: boolean;\n /** Function to start the clock. */\n start: () => void;\n /** Function to pause the clock. */\n pause: () => void;\n /** Function to resume the clock. */\n resume: () => void;\n /** Function to reset the clock to its initial state. */\n reset: () => void;\n}\n\n/**\n * `useClock` is a React hook that provides real-time clock data.\n *\n * This hook allows you to track the current time with options for timezone,\n * update frequency, and 12/24-hour format. It returns an object containing\n * detailed time information such as year, month, day, week, and more.\n *\n * @param {UseClockOptions} options - Configuration options for the clock.\n * @returns {ClockData} An object containing the current time data.\n *\n * @example\n * const { year, month, day, hours, minutes, seconds } = useClock({\n * timezone: 'America/New_York',\n * updateFrequency: 1000,\n * use24Hours: false,\n * });\n */\nexport function useClock({\n enabled = true,\n timezone = 'UTC',\n updateFrequency = 1000,\n use24Hours = true,\n padSeconds = false,\n padMinutes = false,\n padHours = false,\n}: UseClockOptions): ClockData {\n const mounted = useMounted();\n const [time, setTime] = useState<dayjs.Dayjs | null>(null);\n const [isRunning, setIsRunning] = useState(false);\n\n // Refs\n const intervalRef = useRef<NodeJS.Timeout | null>(null);\n const initialEnabledRef = useRef(enabled); // Store initial enabled state - set once\n\n // Initialize running state based on enabled when mounted\n useEffect(() => {\n if (!mounted) {\n return;\n }\n\n // Initialize time immediately when mounted, regardless of running state\n setTime(dayjs().tz(timezone));\n\n if (enabled) {\n setIsRunning(true);\n } else {\n setIsRunning(false);\n }\n }, [mounted, enabled, timezone]);\n\n // Clock update logic\n useEffect(() => {\n if (!mounted || !isRunning) {\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n return;\n }\n\n const updateClock = () => {\n setTime(dayjs().tz(timezone));\n };\n\n updateClock();\n intervalRef.current = setInterval(updateClock, updateFrequency);\n\n return () => {\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n };\n }, [mounted, isRunning, timezone, updateFrequency]);\n\n // Control functions\n const start = useCallback(() => {\n if (!mounted) {\n return;\n }\n // Update time immediately when starting\n setTime(dayjs().tz(timezone));\n setIsRunning(true);\n }, [mounted, timezone]);\n\n const pause = useCallback(() => {\n setIsRunning(false);\n }, []);\n\n const resume = useCallback(() => {\n if (!mounted) {\n return;\n }\n // Update time immediately when resuming\n setTime(dayjs().tz(timezone));\n setIsRunning(true);\n }, [mounted, timezone]);\n\n const reset = useCallback(() => {\n setIsRunning(false);\n\n // Restore initial enabled state\n if (initialEnabledRef.current) {\n // If initially enabled, restart immediately with current time\n setTime(dayjs().tz(timezone));\n setIsRunning(true);\n } else {\n // If initially disabled, set to current time but stay paused\n setTime(dayjs().tz(timezone));\n }\n }, [timezone]);\n\n // Return static values when disabled or during SSR\n if (!mounted || !time) {\n const staticHours = padHours ? '00' : 0;\n const staticMinutes = padMinutes ? '00' : 0;\n const staticSeconds = padSeconds ? '00' : 0;\n\n return {\n year: 2024,\n month: 1,\n day: 1,\n week: 1,\n isLeap: false,\n hours: staticHours,\n minutes: staticMinutes,\n seconds: staticSeconds,\n milliseconds: 0,\n amPm: use24Hours ? undefined : 'AM',\n isRunning: false,\n start: () => {},\n pause: () => {},\n resume: () => {},\n reset: () => {},\n };\n }\n const year = time.year();\n const month = time.month() + 1; // Months are 0-indexed in dayjs\n const day = time.date();\n const week = time.week();\n const isLeap = time.isLeapYear();\n let hours: number | string = time.hour();\n let minutes: number | string = time.minute();\n let seconds: number | string = time.second();\n const milliseconds = time.millisecond();\n\n let amPm: 'AM' | 'PM' | undefined;\n if (!use24Hours) {\n amPm = Number(hours) >= 12 ? 'PM' : 'AM';\n hours = Number(hours) % 12 || 12; // Convert to 12-hour format\n }\n\n if (padHours) {\n hours = hours.toString().padStart(2, '0');\n }\n if (padMinutes) {\n minutes = minutes.toString().padStart(2, '0');\n }\n if (padSeconds) {\n seconds = seconds.toString().padStart(2, '0');\n }\n\n return {\n year,\n month,\n day,\n week,\n isLeap,\n hours,\n minutes,\n seconds,\n milliseconds,\n amPm,\n isRunning,\n start,\n pause,\n resume,\n reset,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;AAOA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAG,CAAC,CAAA;AACjB,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,CAAC,CAAA;AAC5B,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA,CAAA,CAAA,CAAA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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA;AACb,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA;AACT,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA;AACT,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA;AACV,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA;AACJ,CAAA,CAAA,CAAG,CAAA;AACH,CAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
.me_3508fb61{--clock-background-color:var(--clock-color,var(--mantine-color-gray-1));--clock-hour-ticks-color-resolved:var(--clock-hour-ticks-color,var(--mantine-color-gray-9));--clock-minute-ticks-color-resolved:var(--clock-minute-ticks-color,var(--mantine-color-gray-5));--clock-primary-numbers-color-resolved:var(
|
|
2
|
+
--clock-primary-numbers-color,var(--mantine-color-dark-9)
|
|
3
|
+
);--clock-secondary-numbers-color-resolved:var(
|
|
4
|
+
--clock-secondary-numbers-color,var(--mantine-color-dark-6)
|
|
5
|
+
);--clock-minute-hand-color-resolved:var(--clock-minute-hand-color,var(--mantine-color-dark-6));--clock-hour-hand-color-resolved:var(--clock-hour-hand-color,var(--mantine-color-dark-6));--clock-second-hand-color-resolved:var(--clock-second-hand-color,var(--mantine-color-red-6))}[data-mantine-color-scheme=dark] .me_3508fb61{--clock-background-color:var(--clock-color,var(--mantine-color-dark-8));--clock-hour-ticks-color-resolved:var(--clock-hour-ticks-color,var(--mantine-color-gray-0));--clock-minute-ticks-color-resolved:var(
|
|
6
|
+
--clock-minute-ticks-color,var(--mantine-color-gray-8)
|
|
7
|
+
);--clock-primary-numbers-color-resolved:var(
|
|
8
|
+
--clock-primary-numbers-color,var(--mantine-color-gray-0)
|
|
9
|
+
);--clock-secondary-numbers-color-resolved:var(
|
|
10
|
+
--clock-secondary-numbers-color,var(--mantine-color-gray-4)
|
|
11
|
+
);--clock-minute-hand-color-resolved:var(--clock-minute-hand-color,var(--mantine-color-dark-5));--clock-hour-hand-color-resolved:var(--clock-hour-hand-color,var(--mantine-color-dark-5))}.me_3508fb61{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.me_3508fb61,.me_bfe0e7d2{align-items:center;display:flex;height:var(--clock-size,400px);justify-content:center;position:relative;width:var(--clock-size,400px)}.me_bfe0e7d2{z-index:2}.me_5cac7cf6{background:transparent;perspective:1000px;pointer-events:none;will-change:transform;z-index:2}.me_5cac7cf6,.me_a73eac6c{backface-visibility:hidden;border-radius:50%;position:relative;transform-style:preserve-3d}.me_a73eac6c{--clock-border-width:clamp(2px,0.0625em,4px);background-color:var(--clock-background-color);height:var(--clock-size,400px);overflow:hidden;user-select:none;width:var(--clock-size,400px);will-change:transform,box-shadow;z-index:3}.me_46419d9b{backdrop-filter:blur(1px);background-color:hsla(0,0%,100%,.35);border:1px solid rgba(0,0,0,.03);border-radius:50%;box-shadow:0 0 20px hsla(0,0%,100%,.4),inset 0 0 8px hsla(0,0%,100%,.6);height:calc(var(--clock-size, 400px)*.09);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);width:calc(var(--clock-size, 400px)*.09);z-index:16}[data-mantine-color-scheme=dark] .me_46419d9b{background-color:rgba(0,0,0,.35);border:1px solid rgba(0,0,0,.03);box-shadow:0 0 20px rgba(0,0,0,.4),inset 0 0 8px rgba(0,0,0,.6)}.me_b7f1a195{background:var(--clock-second-hand-color-resolved);border-radius:50%;box-shadow:0 0 8px var(--clock-second-hand-color-resolved);position:absolute;z-index:17}.me_199c38a3{height:100%;left:0;position:absolute;top:0;width:100%;z-index:14}.me_7001a110{background-color:var(--clock-minute-ticks-color-resolved);height:calc(var(--clock-size, 400px)*.025);opacity:var(--clock-minute-ticks-opacity,1);width:calc(var(--clock-size, 400px)*.0025)}.me_42e74ca0,.me_7001a110{box-shadow:0 0 2px hsla(0,0%,100%,.3);position:absolute}.me_42e74ca0{background-color:var(--clock-hour-ticks-color-resolved);height:calc(var(--clock-size, 400px)*.0375);opacity:var(--clock-hour-ticks-opacity,1);width:calc(var(--clock-size, 400px)*.005)}.me_1037b208{color:var(--clock-hour-number-color);font-weight:500;opacity:var(--clock-hour-number-opacity,1);pointer-events:none;position:absolute;text-align:center;transform:translate(-50%,-50%);user-select:none;z-index:15}.me_9129b04c{color:var(--clock-primary-numbers-color-resolved);opacity:var(--clock-primary-numbers-opacity,1)}.me_83b9a1fe{color:var(--clock-secondary-numbers-color-resolved);opacity:var(--clock-secondary-numbers-opacity,1)}.me_35043aee{position:absolute;transform-origin:center bottom;will-change:transform;z-index:15}.me_42e1bb72{background-color:var(--clock-hour-hand-color-resolved);box-shadow:0 0 3px var(--clock-hour-hand-color-resolved)}.me_6ffc0fe2{background-color:var(--clock-minute-hand-color-resolved);box-shadow:0 0 3px var(--clock-minute-hand-color-resolved)}.me_22ead85f{position:absolute;will-change:transform;z-index:17}.me_1a457e42{bottom:0;left:0}.me_1a457e42,.me_32db9852{background-color:var(--clock-second-hand-color-resolved);border-radius:calc(var(--clock-size, 400px)*.04);box-shadow:0 0 5px var(--clock-second-hand-color-resolved);position:absolute}.me_32db9852{bottom:calc(var(--clock-size, 400px)*-.035);height:calc(var(--clock-size, 400px)*.035)}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@layer mantine-clock {.me_3508fb61{--clock-background-color:var(--clock-color,var(--mantine-color-gray-1));--clock-hour-ticks-color-resolved:var(--clock-hour-ticks-color,var(--mantine-color-gray-9));--clock-minute-ticks-color-resolved:var(--clock-minute-ticks-color,var(--mantine-color-gray-5));--clock-primary-numbers-color-resolved:var(
|
|
2
|
+
--clock-primary-numbers-color,var(--mantine-color-dark-9)
|
|
3
|
+
);--clock-secondary-numbers-color-resolved:var(
|
|
4
|
+
--clock-secondary-numbers-color,var(--mantine-color-dark-6)
|
|
5
|
+
);--clock-minute-hand-color-resolved:var(--clock-minute-hand-color,var(--mantine-color-dark-6));--clock-hour-hand-color-resolved:var(--clock-hour-hand-color,var(--mantine-color-dark-6));--clock-second-hand-color-resolved:var(--clock-second-hand-color,var(--mantine-color-red-6))}[data-mantine-color-scheme=dark] .me_3508fb61{--clock-background-color:var(--clock-color,var(--mantine-color-dark-8));--clock-hour-ticks-color-resolved:var(--clock-hour-ticks-color,var(--mantine-color-gray-0));--clock-minute-ticks-color-resolved:var(
|
|
6
|
+
--clock-minute-ticks-color,var(--mantine-color-gray-8)
|
|
7
|
+
);--clock-primary-numbers-color-resolved:var(
|
|
8
|
+
--clock-primary-numbers-color,var(--mantine-color-gray-0)
|
|
9
|
+
);--clock-secondary-numbers-color-resolved:var(
|
|
10
|
+
--clock-secondary-numbers-color,var(--mantine-color-gray-4)
|
|
11
|
+
);--clock-minute-hand-color-resolved:var(--clock-minute-hand-color,var(--mantine-color-dark-5));--clock-hour-hand-color-resolved:var(--clock-hour-hand-color,var(--mantine-color-dark-5))}.me_3508fb61{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.me_3508fb61,.me_bfe0e7d2{align-items:center;display:flex;height:var(--clock-size,400px);justify-content:center;position:relative;width:var(--clock-size,400px)}.me_bfe0e7d2{z-index:2}.me_5cac7cf6{background:transparent;perspective:1000px;pointer-events:none;will-change:transform;z-index:2}.me_5cac7cf6,.me_a73eac6c{backface-visibility:hidden;border-radius:50%;position:relative;transform-style:preserve-3d}.me_a73eac6c{--clock-border-width:clamp(2px,0.0625em,4px);background-color:var(--clock-background-color);height:var(--clock-size,400px);overflow:hidden;user-select:none;width:var(--clock-size,400px);will-change:transform,box-shadow;z-index:3}.me_46419d9b{backdrop-filter:blur(1px);background-color:hsla(0,0%,100%,.35);border:1px solid rgba(0,0,0,.03);border-radius:50%;box-shadow:0 0 20px hsla(0,0%,100%,.4),inset 0 0 8px hsla(0,0%,100%,.6);height:calc(var(--clock-size, 400px)*.09);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);width:calc(var(--clock-size, 400px)*.09);z-index:16}[data-mantine-color-scheme=dark] .me_46419d9b{background-color:rgba(0,0,0,.35);border:1px solid rgba(0,0,0,.03);box-shadow:0 0 20px rgba(0,0,0,.4),inset 0 0 8px rgba(0,0,0,.6)}.me_b7f1a195{background:var(--clock-second-hand-color-resolved);border-radius:50%;box-shadow:0 0 8px var(--clock-second-hand-color-resolved);position:absolute;z-index:17}.me_199c38a3{height:100%;left:0;position:absolute;top:0;width:100%;z-index:14}.me_7001a110{background-color:var(--clock-minute-ticks-color-resolved);height:calc(var(--clock-size, 400px)*.025);opacity:var(--clock-minute-ticks-opacity,1);width:calc(var(--clock-size, 400px)*.0025)}.me_42e74ca0,.me_7001a110{box-shadow:0 0 2px hsla(0,0%,100%,.3);position:absolute}.me_42e74ca0{background-color:var(--clock-hour-ticks-color-resolved);height:calc(var(--clock-size, 400px)*.0375);opacity:var(--clock-hour-ticks-opacity,1);width:calc(var(--clock-size, 400px)*.005)}.me_1037b208{color:var(--clock-hour-number-color);font-weight:500;opacity:var(--clock-hour-number-opacity,1);pointer-events:none;position:absolute;text-align:center;transform:translate(-50%,-50%);user-select:none;z-index:15}.me_9129b04c{color:var(--clock-primary-numbers-color-resolved);opacity:var(--clock-primary-numbers-opacity,1)}.me_83b9a1fe{color:var(--clock-secondary-numbers-color-resolved);opacity:var(--clock-secondary-numbers-opacity,1)}.me_35043aee{position:absolute;transform-origin:center bottom;will-change:transform;z-index:15}.me_42e1bb72{background-color:var(--clock-hour-hand-color-resolved);box-shadow:0 0 3px var(--clock-hour-hand-color-resolved)}.me_6ffc0fe2{background-color:var(--clock-minute-hand-color-resolved);box-shadow:0 0 3px var(--clock-minute-hand-color-resolved)}.me_22ead85f{position:absolute;will-change:transform;z-index:17}.me_1a457e42{bottom:0;left:0}.me_1a457e42,.me_32db9852{background-color:var(--clock-second-hand-color-resolved);border-radius:calc(var(--clock-size, 400px)*.04);box-shadow:0 0 5px var(--clock-second-hand-color-resolved);position:absolute}.me_32db9852{bottom:calc(var(--clock-size, 400px)*-.035);height:calc(var(--clock-size, 400px)*.035)}}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { BoxProps, Factory, MantineColor, MantineSize, StylesApiProps, TextProps } from '@mantine/core';
|
|
3
|
+
export type Timezone = 'UTC' | 'America/New_York' | 'America/Los_Angeles' | 'America/Chicago' | 'America/Denver' | 'America/Toronto' | 'America/Vancouver' | 'America/Sao_Paulo' | 'America/Mexico_City' | 'Europe/London' | 'Europe/Berlin' | 'Europe/Paris' | 'Europe/Rome' | 'Europe/Madrid' | 'Europe/Amsterdam' | 'Europe/Stockholm' | 'Europe/Moscow' | 'Asia/Tokyo' | 'Asia/Shanghai' | 'Asia/Singapore' | 'Asia/Hong_Kong' | 'Asia/Seoul' | 'Asia/Kolkata' | 'Asia/Dubai' | 'Australia/Sydney' | 'Australia/Melbourne' | 'Pacific/Auckland' | string;
|
|
4
|
+
export type ClockStylesNames = 'root' | 'clockContainer' | 'glassWrapper' | 'clockFace' | 'hourMarks' | 'hourTick' | 'minuteTick' | 'number' | 'primaryNumber' | 'secondaryNumber' | 'hand' | 'hourHand' | 'minuteHand' | 'secondHandContainer' | 'secondHand' | 'secondHandCounterweight' | 'centerBlur' | 'centerDot';
|
|
5
|
+
export type ClockCssVariables = {
|
|
6
|
+
root: '--clock-size' | '--clock-color' | '--clock-hour-ticks-color' | '--clock-hour-ticks-opacity' | '--clock-minute-ticks-color' | '--clock-minute-ticks-opacity' | '--clock-second-hand-color' | '--clock-minute-hand-color' | '--clock-hour-hand-color' | '--clock-primary-numbers-color' | '--clock-primary-numbers-opacity' | '--clock-secondary-numbers-color' | '--clock-secondary-numbers-opacity';
|
|
7
|
+
};
|
|
8
|
+
export interface ClockBaseProps {
|
|
9
|
+
/** Color of the clock face (MantineColor or CSS color) */
|
|
10
|
+
color?: MantineColor;
|
|
11
|
+
/** Mantine color for the hour ticks */
|
|
12
|
+
hourTicksColor?: MantineColor;
|
|
13
|
+
/** Opacity for the hour ticks (0 = hidden, 1 = fully visible) */
|
|
14
|
+
hourTicksOpacity?: number;
|
|
15
|
+
/** Mantine color for the minute ticks */
|
|
16
|
+
minuteTicksColor?: MantineColor;
|
|
17
|
+
/** Opacity for the minute ticks (0 = hidden, 1 = fully visible) */
|
|
18
|
+
minuteTicksOpacity?: number;
|
|
19
|
+
/** Mantine color for the primary hour numbers (12, 3, 6, 9) */
|
|
20
|
+
primaryNumbersColor?: MantineColor;
|
|
21
|
+
/** Opacity for the primary hour numbers (0 = hidden, 1 = fully visible) */
|
|
22
|
+
primaryNumbersOpacity?: number;
|
|
23
|
+
/** Mantine color for the secondary hour numbers (1, 2, 4, 5, 7, 8, 10, 11) */
|
|
24
|
+
secondaryNumbersColor?: MantineColor;
|
|
25
|
+
/** Opacity for the secondary hour numbers (0 = hidden, 1 = fully visible) */
|
|
26
|
+
secondaryNumbersOpacity?: number;
|
|
27
|
+
/** Second hand movement behavior */
|
|
28
|
+
secondHandBehavior?: 'tick' | 'smooth' | 'tick-half' | 'tick-high-freq';
|
|
29
|
+
/** Mantine color for the seconds hand */
|
|
30
|
+
secondHandColor?: MantineColor;
|
|
31
|
+
/** Opacity for the seconds hand (0 = hidden, 1 = fully visible) */
|
|
32
|
+
secondHandOpacity?: number;
|
|
33
|
+
/** Length of the second hand as a percentage of clock radius (0.2 to 0.8) */
|
|
34
|
+
secondHandLength?: number;
|
|
35
|
+
/** Thickness of the second hand as a percentage of clock size (0.005 to 0.05) */
|
|
36
|
+
secondHandSize?: number;
|
|
37
|
+
/** Mantine color for the minutes hand */
|
|
38
|
+
minuteHandColor?: MantineColor;
|
|
39
|
+
/** Opacity for the minutes hand (0 = hidden, 1 = fully visible) */
|
|
40
|
+
minuteHandOpacity?: number;
|
|
41
|
+
/** Thickness of the minute hand as a percentage of clock size (0.01 to 0.1) */
|
|
42
|
+
minuteHandSize?: number;
|
|
43
|
+
/** Length of the minute hand as a percentage of clock radius (0.2 to 0.8) */
|
|
44
|
+
minuteHandLength?: number;
|
|
45
|
+
/** Size of the clock in pixels (default: 400px) */
|
|
46
|
+
size?: MantineSize | number | (string & {});
|
|
47
|
+
/** Thickness of the hour hand as a percentage of clock size (0.01 to 0.1) */
|
|
48
|
+
hourHandSize?: number;
|
|
49
|
+
/** Length of the hour hand as a percentage of clock radius (0.2 to 0.8) */
|
|
50
|
+
hourHandLength?: number;
|
|
51
|
+
/** Mantine color for the hours hand */
|
|
52
|
+
hourHandColor?: MantineColor;
|
|
53
|
+
/** Opacity for the hours hand (0 = hidden, 1 = fully visible) */
|
|
54
|
+
hourHandOpacity?: number;
|
|
55
|
+
/** Distance of the hour numbers from the center as a percentage of the radius (0.5 = 50%, 0.83 = default) */
|
|
56
|
+
hourNumbersDistance?: number;
|
|
57
|
+
/** Props for primary hour numbers (12, 3, 6, 9) Text component */
|
|
58
|
+
primaryNumbersProps?: TextProps;
|
|
59
|
+
/** Props for secondary hour numbers (1, 2, 4, 5, 7, 8, 10, 11) Text component */
|
|
60
|
+
secondaryNumbersProps?: TextProps;
|
|
61
|
+
/** Timezone for displaying time in different countries (e.g., 'America/New_York', 'Europe/London', 'Asia/Tokyo') */
|
|
62
|
+
timezone?: Timezone;
|
|
63
|
+
/** Whether the clock should update in real time (default: `true`) */
|
|
64
|
+
running?: boolean;
|
|
65
|
+
/** Time value to display. Can be a string ("10:30", "18:15:07"), Date, or dayjs object. When running=true, this sets the starting time. When running=false and no value is provided, displays the current time. */
|
|
66
|
+
value?: string | Date | dayjs.Dayjs;
|
|
67
|
+
}
|
|
68
|
+
export interface ClockProps extends BoxProps, ClockBaseProps, StylesApiProps<ClockFactory> {
|
|
69
|
+
}
|
|
70
|
+
export type ClockFactory = Factory<{
|
|
71
|
+
props: ClockProps;
|
|
72
|
+
ref: HTMLDivElement;
|
|
73
|
+
stylesNames: ClockStylesNames;
|
|
74
|
+
vars: ClockCssVariables;
|
|
75
|
+
}>;
|
|
76
|
+
export declare const defaultProps: Partial<ClockProps>;
|
|
77
|
+
export declare const Clock: import("@mantine/core").MantineComponent<{
|
|
78
|
+
props: ClockProps;
|
|
79
|
+
ref: HTMLDivElement;
|
|
80
|
+
stylesNames: ClockStylesNames;
|
|
81
|
+
vars: ClockCssVariables;
|
|
82
|
+
}>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for configuring the `useClockCountDown` hook.
|
|
3
|
+
*/
|
|
4
|
+
export interface UseClockCountDownOptions {
|
|
5
|
+
/** Whether the countdown is active and updating. */
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/** The timezone to use for the countdown calculations. */
|
|
8
|
+
timezone?: string;
|
|
9
|
+
/** The frequency (in milliseconds) at which the countdown updates. */
|
|
10
|
+
updateFrequency?: number;
|
|
11
|
+
/** Whether to use 24-hour format or 12-hour format. */
|
|
12
|
+
use24Hours?: boolean;
|
|
13
|
+
/** Whether to pad single-digit seconds with a leading zero. */
|
|
14
|
+
padSeconds?: boolean;
|
|
15
|
+
/** Whether to pad single-digit minutes with a leading zero. */
|
|
16
|
+
padMinutes?: boolean;
|
|
17
|
+
/** Whether to pad single-digit hours with a leading zero. */
|
|
18
|
+
padHours?: boolean;
|
|
19
|
+
/** Target date for the countdown (Date object or ISO string). */
|
|
20
|
+
targetDate?: Date | string;
|
|
21
|
+
/** Number of hours to count down from current time. */
|
|
22
|
+
hours?: number;
|
|
23
|
+
/** Number of minutes to count down from current time. */
|
|
24
|
+
minutes?: number;
|
|
25
|
+
/** Number of seconds to count down from current time. */
|
|
26
|
+
seconds?: number;
|
|
27
|
+
/** Callback function called when countdown reaches zero. */
|
|
28
|
+
onCountDownCompleted?: () => void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Data returned by the `useClockCountDown` hook.
|
|
32
|
+
*/
|
|
33
|
+
export interface ClockCountDownData {
|
|
34
|
+
/** The remaining years. */
|
|
35
|
+
year: number;
|
|
36
|
+
/** The remaining months (1-12). */
|
|
37
|
+
month: number;
|
|
38
|
+
/** The remaining days. */
|
|
39
|
+
day: number;
|
|
40
|
+
/** The remaining weeks. */
|
|
41
|
+
week: number;
|
|
42
|
+
/** Whether the current year is a leap year (based on target date). */
|
|
43
|
+
isLeap: boolean;
|
|
44
|
+
/** The remaining hours (adjusted for 12/24-hour format). */
|
|
45
|
+
hours: number | string;
|
|
46
|
+
/** The remaining minutes. */
|
|
47
|
+
minutes: number | string;
|
|
48
|
+
/** The remaining seconds. */
|
|
49
|
+
seconds: number | string;
|
|
50
|
+
/** The remaining milliseconds. */
|
|
51
|
+
milliseconds: number;
|
|
52
|
+
/** Whether the time is AM or PM (only relevant if use24Hours is false). */
|
|
53
|
+
amPm?: 'AM' | 'PM';
|
|
54
|
+
/** Whether the countdown has completed (reached zero). */
|
|
55
|
+
isCompleted: boolean;
|
|
56
|
+
/** Whether the countdown is currently running. */
|
|
57
|
+
isRunning: boolean;
|
|
58
|
+
/** Total remaining time in milliseconds. */
|
|
59
|
+
totalMilliseconds: number;
|
|
60
|
+
/** Start the countdown */
|
|
61
|
+
start: () => void;
|
|
62
|
+
/** Pause/stop the countdown */
|
|
63
|
+
pause: () => void;
|
|
64
|
+
/** Reset the countdown to initial values */
|
|
65
|
+
reset: () => void;
|
|
66
|
+
/** Resume the countdown from current position */
|
|
67
|
+
resume: () => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* `useClockCountDown` is a React hook that provides real-time countdown data.
|
|
71
|
+
*
|
|
72
|
+
* This hook allows you to create a countdown timer to a specific date or time duration.
|
|
73
|
+
* You can specify either a target date or a duration (hours, minutes, seconds) from the current time.
|
|
74
|
+
* The hook returns an object containing detailed countdown information and supports timezone,
|
|
75
|
+
* update frequency, and 12/24-hour format options.
|
|
76
|
+
*
|
|
77
|
+
* @param {UseClockCountDownOptions} options - Configuration options for the countdown.
|
|
78
|
+
* @returns {ClockCountDownData} An object containing the current countdown data.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // Countdown to a specific date
|
|
82
|
+
* const { hours, minutes, seconds, isCompleted } = useClockCountDown({
|
|
83
|
+
* targetDate: '2024-12-31T23:59:59Z',
|
|
84
|
+
* timezone: 'America/New_York',
|
|
85
|
+
* onCountDownCompleted: () => console.log('Happy New Year!'),
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* // Countdown for 12 hours from now
|
|
90
|
+
* const { hours, minutes, seconds } = useClockCountDown({
|
|
91
|
+
* hours: 12,
|
|
92
|
+
* updateFrequency: 1000,
|
|
93
|
+
* use24Hours: false,
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Countdown for 30 minutes and 45 seconds
|
|
98
|
+
* const countdown = useClockCountDown({
|
|
99
|
+
* minutes: 30,
|
|
100
|
+
* seconds: 45,
|
|
101
|
+
* padHours: true,
|
|
102
|
+
* padMinutes: true,
|
|
103
|
+
* padSeconds: true,
|
|
104
|
+
* });
|
|
105
|
+
*/
|
|
106
|
+
export declare function useClockCountDown({ enabled, timezone, updateFrequency, use24Hours, padSeconds, padMinutes, padHours, targetDate, hours, minutes, seconds, onCountDownCompleted, }: UseClockCountDownOptions): ClockCountDownData;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for configuring the `useClock` hook.
|
|
3
|
+
*/
|
|
4
|
+
export interface UseClockOptions {
|
|
5
|
+
/** Whether the clock is active and updating. */
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/** The timezone to use for the clock. */
|
|
8
|
+
timezone?: string;
|
|
9
|
+
/** The frequency (in milliseconds) at which the clock updates. */
|
|
10
|
+
updateFrequency?: number;
|
|
11
|
+
/** Whether to use 24-hour format or 12-hour format. */
|
|
12
|
+
use24Hours?: boolean;
|
|
13
|
+
/** Whether to pad single-digit seconds with a leading zero. */
|
|
14
|
+
padSeconds?: boolean;
|
|
15
|
+
/** Whether to pad single-digit minutes with a leading zero. */
|
|
16
|
+
padMinutes?: boolean;
|
|
17
|
+
/** Whether to pad single-digit hours with a leading zero. */
|
|
18
|
+
padHours?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Data returned by the `useClock` hook.
|
|
22
|
+
*/
|
|
23
|
+
export interface ClockData {
|
|
24
|
+
/** The current year. */
|
|
25
|
+
year: number;
|
|
26
|
+
/** The current month (1-12). */
|
|
27
|
+
month: number;
|
|
28
|
+
/** The current day of the month. */
|
|
29
|
+
day: number;
|
|
30
|
+
/** The current week of the year. */
|
|
31
|
+
week: number;
|
|
32
|
+
/** Whether the current year is a leap year. */
|
|
33
|
+
isLeap: boolean;
|
|
34
|
+
/** The current hour (adjusted for 12/24-hour format). */
|
|
35
|
+
hours: number | string;
|
|
36
|
+
/** The current minute. */
|
|
37
|
+
minutes: number | string;
|
|
38
|
+
/** The current second. */
|
|
39
|
+
seconds: number | string;
|
|
40
|
+
/** The current millisecond. */
|
|
41
|
+
milliseconds: number;
|
|
42
|
+
/** Whether the time is AM or PM (only relevant if use24Hours is false). */
|
|
43
|
+
amPm?: 'AM' | 'PM';
|
|
44
|
+
/** Whether the clock is currently running and updating. */
|
|
45
|
+
isRunning: boolean;
|
|
46
|
+
/** Function to start the clock. */
|
|
47
|
+
start: () => void;
|
|
48
|
+
/** Function to pause the clock. */
|
|
49
|
+
pause: () => void;
|
|
50
|
+
/** Function to resume the clock. */
|
|
51
|
+
resume: () => void;
|
|
52
|
+
/** Function to reset the clock to its initial state. */
|
|
53
|
+
reset: () => void;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* `useClock` is a React hook that provides real-time clock data.
|
|
57
|
+
*
|
|
58
|
+
* This hook allows you to track the current time with options for timezone,
|
|
59
|
+
* update frequency, and 12/24-hour format. It returns an object containing
|
|
60
|
+
* detailed time information such as year, month, day, week, and more.
|
|
61
|
+
*
|
|
62
|
+
* @param {UseClockOptions} options - Configuration options for the clock.
|
|
63
|
+
* @returns {ClockData} An object containing the current time data.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* const { year, month, day, hours, minutes, seconds } = useClock({
|
|
67
|
+
* timezone: 'America/New_York',
|
|
68
|
+
* updateFrequency: 1000,
|
|
69
|
+
* use24Hours: false,
|
|
70
|
+
* });
|
|
71
|
+
*/
|
|
72
|
+
export declare function useClock({ enabled, timezone, updateFrequency, use24Hours, padSeconds, padMinutes, padHours, }: UseClockOptions): ClockData;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Clock } from './Clock';
|
|
2
|
+
export type { ClockBaseProps, ClockCssVariables, ClockFactory, ClockProps, ClockStylesNames, } from './Clock';
|
|
3
|
+
export { useClock } from './hooks/use-clock';
|
|
4
|
+
export type { ClockData, UseClockOptions } from './hooks/use-clock';
|
|
5
|
+
export { useClockCountDown } from './hooks/use-clock-count-down';
|
|
6
|
+
export type { ClockCountDownData, UseClockCountDownOptions } from './hooks/use-clock-count-down';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Clock } from './Clock';
|
|
2
|
+
export type { ClockBaseProps, ClockCssVariables, ClockFactory, ClockProps, ClockStylesNames, } from './Clock';
|
|
3
|
+
export { useClock } from './hooks/use-clock';
|
|
4
|
+
export type { ClockData, UseClockOptions } from './hooks/use-clock';
|
|
5
|
+
export { useClockCountDown } from './hooks/use-clock-count-down';
|
|
6
|
+
export type { ClockCountDownData, UseClockCountDownOptions } from './hooks/use-clock-count-down';
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gfazioli/mantine-clock",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React Clock components and hooks for Mantine with timezone support, countdown timers, customization options, and real-time updates.",
|
|
5
|
+
"homepage": "https://gfazioli.github.io/mantine-clock/",
|
|
6
|
+
"packageManager": "yarn@4.0.1",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Giovambattista Fazioli <giovambattista.fazioli@gmail.com>",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"animation",
|
|
11
|
+
"branding",
|
|
12
|
+
"clock",
|
|
13
|
+
"extension",
|
|
14
|
+
"mantine",
|
|
15
|
+
"react",
|
|
16
|
+
"react-component",
|
|
17
|
+
"scroll",
|
|
18
|
+
"typescript"
|
|
19
|
+
],
|
|
20
|
+
"main": "./dist/cjs/index.cjs",
|
|
21
|
+
"module": "./dist/esm/index.mjs",
|
|
22
|
+
"types": "./dist/types/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/types/index.d.mts",
|
|
27
|
+
"default": "./dist/esm/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./dist/types/index.d.ts",
|
|
31
|
+
"default": "./dist/cjs/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"./styles.css": "./dist/styles.css",
|
|
35
|
+
"./styles.layer.css": "./dist/styles.layer.css"
|
|
36
|
+
},
|
|
37
|
+
"repository": "https://github.com/gfazioli/mantine-clock.git",
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@mantine/core": ">=7.0.0",
|
|
40
|
+
"@mantine/hooks": ">=7.0.0",
|
|
41
|
+
"dayjs": "^1.11.13",
|
|
42
|
+
"react": "^18.x || ^19.x",
|
|
43
|
+
"react-dom": "^18.x || ^19.x"
|
|
44
|
+
},
|
|
45
|
+
"bugs": "https://github.com/gfazioli/mantine-clock/issues"
|
|
46
|
+
}
|