@gfazioli/mantine-clock 2.1.16 → 3.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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/Clock.cjs +611 -446
  3. package/dist/cjs/Clock.cjs.map +1 -1
  4. package/dist/cjs/Clock.module.css.cjs +1 -1
  5. package/dist/cjs/ClockDigital.cjs +125 -0
  6. package/dist/cjs/ClockDigital.cjs.map +1 -0
  7. package/dist/cjs/ClockDigital.module.css.cjs +7 -0
  8. package/dist/cjs/ClockDigital.module.css.cjs.map +1 -0
  9. package/dist/cjs/geometry.cjs +217 -0
  10. package/dist/cjs/geometry.cjs.map +1 -0
  11. package/dist/cjs/hooks/use-clock-count-down.cjs +90 -122
  12. package/dist/cjs/hooks/use-clock-count-down.cjs.map +1 -1
  13. package/dist/cjs/hooks/use-clock.cjs +25 -36
  14. package/dist/cjs/hooks/use-clock.cjs.map +1 -1
  15. package/dist/cjs/index.cjs +6 -0
  16. package/dist/cjs/index.cjs.map +1 -1
  17. package/dist/esm/Clock.mjs +613 -448
  18. package/dist/esm/Clock.mjs.map +1 -1
  19. package/dist/esm/Clock.module.css.mjs +1 -1
  20. package/dist/esm/ClockDigital.mjs +123 -0
  21. package/dist/esm/ClockDigital.mjs.map +1 -0
  22. package/dist/esm/ClockDigital.module.css.mjs +5 -0
  23. package/dist/esm/ClockDigital.module.css.mjs.map +1 -0
  24. package/dist/esm/geometry.mjs +208 -0
  25. package/dist/esm/geometry.mjs.map +1 -0
  26. package/dist/esm/hooks/use-clock-count-down.mjs +90 -122
  27. package/dist/esm/hooks/use-clock-count-down.mjs.map +1 -1
  28. package/dist/esm/hooks/use-clock.mjs +25 -36
  29. package/dist/esm/hooks/use-clock.mjs.map +1 -1
  30. package/dist/esm/index.mjs +2 -0
  31. package/dist/esm/index.mjs.map +1 -1
  32. package/dist/styles.css +2 -2
  33. package/dist/styles.layer.css +2 -2
  34. package/dist/types/Clock.d.ts +70 -1
  35. package/dist/types/ClockDigital.d.ts +50 -0
  36. package/dist/types/geometry.d.ts +92 -0
  37. package/dist/types/hooks/use-clock-count-down.d.ts +25 -28
  38. package/dist/types/hooks/use-clock.d.ts +14 -10
  39. package/dist/types/index.d.mts +5 -1
  40. package/dist/types/index.d.ts +5 -1
  41. package/package.json +5 -3
@@ -1 +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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CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA;AACT,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA;AACX,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA;AACX,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA;AAChB,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAI,CAAA;AACR,CAAA,CAAA,CAAA,CAAI,CAAA,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;;"}
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. Minimum 16ms. */\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 (always a number). */\n hours: number;\n /** The current minute (always a number). */\n minutes: number;\n /** The current second (always a number). */\n seconds: number;\n /** The current millisecond. */\n milliseconds: number;\n /** The formatted hour string (with padding if enabled). */\n formattedHours: string;\n /** The formatted minute string (with padding if enabled). */\n formattedMinutes: string;\n /** The formatted second string (with padding if enabled). */\n formattedSeconds: string;\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 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, formattedHours } = 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 // Clamp updateFrequency to minimum 16ms, fallback to 1000ms for non-finite values\n const effectiveUpdateFrequency = Number.isFinite(updateFrequency)\n ? Math.max(16, updateFrequency)\n : 1000;\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, effectiveUpdateFrequency);\n\n return () => {\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n };\n }, [mounted, isRunning, timezone, effectiveUpdateFrequency]);\n\n // Control functions\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 return {\n year: 0,\n month: 1,\n day: 1,\n week: 1,\n isLeap: false,\n hours: 0,\n minutes: 0,\n seconds: 0,\n milliseconds: 0,\n formattedHours: padHours ? '00' : '0',\n formattedMinutes: padMinutes ? '00' : '0',\n formattedSeconds: padSeconds ? '00' : '0',\n amPm: use24Hours ? undefined : 'AM',\n isRunning: false,\n pause: () => {},\n resume: () => {},\n reset: () => {},\n };\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 const rawHours = time.hour();\n const rawMinutes = time.minute();\n const rawSeconds = time.second();\n const milliseconds = time.millisecond();\n\n let displayHours = rawHours;\n let amPm: 'AM' | 'PM' | undefined;\n if (!use24Hours) {\n amPm = rawHours >= 12 ? 'PM' : 'AM';\n displayHours = rawHours % 12 || 12; // Convert to 12-hour format\n }\n\n const formattedHours = padHours\n ? displayHours.toString().padStart(2, '0')\n : displayHours.toString();\n const formattedMinutes = padMinutes\n ? rawMinutes.toString().padStart(2, '0')\n : rawMinutes.toString();\n const formattedSeconds = padSeconds\n ? rawSeconds.toString().padStart(2, '0')\n : rawSeconds.toString();\n\n return {\n year,\n month,\n day,\n week,\n isLeap,\n hours: displayHours,\n minutes: rawMinutes,\n seconds: rawSeconds,\n milliseconds,\n formattedHours,\n formattedMinutes,\n formattedSeconds,\n amPm,\n isRunning,\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,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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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,CAAA,CAAM,CAAA;AACV,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA;AACJ,CAAA,CAAA,CAAG,CAAA;AACH,CAAA;;"}
@@ -1,4 +1,6 @@
1
1
  export { Clock } from './Clock.mjs';
2
+ export { ClockDigital } from './ClockDigital.mjs';
3
+ export { CircularGeometry, RoundedRectGeometry, createGeometry } from './geometry.mjs';
2
4
  export { useClock } from './hooks/use-clock.mjs';
3
5
  export { useClockCountDown } from './hooks/use-clock-count-down.mjs';
4
6
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/dist/styles.css CHANGED
@@ -1,4 +1,4 @@
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(
1
+ .me_d4858e85{align-items:baseline;display:inline-flex;font-family:var(--clock-digital-font-family,"Menlo","Monaco","Courier New",monospace);font-size:var(--clock-digital-size,32px);font-variant-numeric:tabular-nums;gap:var(--clock-digital-gap,.1em);line-height:1;user-select:none}.me_d4858e85,[data-mantine-color-scheme=dark] .me_d4858e85{color:var(--clock-digital-color,var(--mantine-color-text))}.me_85878ab0{display:inline-block}.me_4f5c085c,.me_855035fc,.me_bb9f6dcc{font-weight:700}.me_a1ee322{font-weight:300;opacity:.6}.me_d47dc8ec{align-self:flex-end;font-size:.5em;font-weight:500;margin-left:.2em;opacity:.7}.me_d47efd51{display:block;font-size:.4em;margin-top:.2em;opacity:.5;text-align:center;width:100%}.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
2
  --clock-primary-numbers-color,var(--mantine-color-dark-9)
3
3
  );--clock-secondary-numbers-color-resolved:var(
4
4
  --clock-secondary-numbers-color,var(--mantine-color-dark-6)
@@ -20,4 +20,4 @@
20
20
  --clock-minutes-arc-color,var(--clock-minute-hand-color-resolved)
21
21
  );--clock-hours-arc-color-resolved:var(
22
22
  --clock-hours-arc-color,var(--clock-hour-hand-color-resolved)
23
- )}.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_8cd76651{shape-rendering:geometricPrecision;height:100%;image-rendering:-webkit-optimize-contrast;left:0;text-rendering:geometricPrecision;top:0;width:100%;z-index:13}.me_46419d9b,.me_8cd76651{pointer-events:none;position:absolute}.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%;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)}
23
+ )}.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;pointer-events:none;z-index:2}.me_5cac7cf6,.me_a73eac6c{backface-visibility:hidden;border-radius:50%;position:relative}.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);z-index:3}.me_f1150bfd{align-items:center;display:flex;justify-content:center;overflow:hidden;z-index:1}.me_8cd76651,.me_f1150bfd{height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.me_8cd76651{shape-rendering:geometricPrecision;z-index:13}.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{font-weight:500;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;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;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)}
@@ -1,4 +1,4 @@
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(
1
+ @layer mantine-clock {.me_d4858e85{align-items:baseline;display:inline-flex;font-family:var(--clock-digital-font-family,"Menlo","Monaco","Courier New",monospace);font-size:var(--clock-digital-size,32px);font-variant-numeric:tabular-nums;gap:var(--clock-digital-gap,.1em);line-height:1;user-select:none}.me_d4858e85,[data-mantine-color-scheme=dark] .me_d4858e85{color:var(--clock-digital-color,var(--mantine-color-text))}.me_85878ab0{display:inline-block}.me_4f5c085c,.me_855035fc,.me_bb9f6dcc{font-weight:700}.me_a1ee322{font-weight:300;opacity:.6}.me_d47dc8ec{align-self:flex-end;font-size:.5em;font-weight:500;margin-left:.2em;opacity:.7}.me_d47efd51{display:block;font-size:.4em;margin-top:.2em;opacity:.5;text-align:center;width:100%}.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
2
  --clock-primary-numbers-color,var(--mantine-color-dark-9)
3
3
  );--clock-secondary-numbers-color-resolved:var(
4
4
  --clock-secondary-numbers-color,var(--mantine-color-dark-6)
@@ -20,4 +20,4 @@
20
20
  --clock-minutes-arc-color,var(--clock-minute-hand-color-resolved)
21
21
  );--clock-hours-arc-color-resolved:var(
22
22
  --clock-hours-arc-color,var(--clock-hour-hand-color-resolved)
23
- )}.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_8cd76651{shape-rendering:geometricPrecision;height:100%;image-rendering:-webkit-optimize-contrast;left:0;text-rendering:geometricPrecision;top:0;width:100%;z-index:13}.me_46419d9b,.me_8cd76651{pointer-events:none;position:absolute}.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%;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)}}
23
+ )}.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;pointer-events:none;z-index:2}.me_5cac7cf6,.me_a73eac6c{backface-visibility:hidden;border-radius:50%;position:relative}.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);z-index:3}.me_f1150bfd{align-items:center;display:flex;justify-content:center;overflow:hidden;z-index:1}.me_8cd76651,.me_f1150bfd{height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.me_8cd76651{shape-rendering:geometricPrecision;z-index:13}.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{font-weight:500;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;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;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)}}
@@ -1,7 +1,9 @@
1
1
  import dayjs from 'dayjs';
2
+ import React from 'react';
2
3
  import { BoxProps, Factory, MantineColor, MantineSize, StylesApiProps, TextProps } from '@mantine/core';
4
+ import { ClockDigital } from './ClockDigital';
3
5
  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' | 'arcsLayer' | 'hand' | 'hourHand' | 'minuteHand' | 'secondHandContainer' | 'secondHand' | 'secondHandCounterweight' | 'centerBlur' | 'centerDot';
6
+ export type ClockStylesNames = 'root' | 'clockContainer' | 'glassWrapper' | 'clockFace' | 'faceContent' | 'hourMarks' | 'hourTick' | 'minuteTick' | 'number' | 'primaryNumber' | 'secondaryNumber' | 'arcsLayer' | 'hand' | 'hourHand' | 'minuteHand' | 'secondHandContainer' | 'secondHand' | 'secondHandCounterweight' | 'centerBlur' | 'centerDot';
5
7
  export type ClockCssVariables = {
6
8
  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-seconds-arc-color' | '--clock-minutes-arc-color' | '--clock-hours-arc-color' | '--clock-primary-numbers-color' | '--clock-primary-numbers-opacity' | '--clock-secondary-numbers-color' | '--clock-secondary-numbers-opacity';
7
9
  };
@@ -64,6 +66,67 @@ export interface ClockBaseProps {
64
66
  running?: boolean;
65
67
  /** 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
68
  value?: string | Date | dayjs.Dayjs;
69
+ /** Custom aria-label for the clock. If not provided, a default label with the current time will be used. */
70
+ ariaLabel?: string;
71
+ /** Shape of the clock face (default: 'circle') */
72
+ shape?: 'circle' | 'rounded-rect';
73
+ /** Aspect ratio for rounded-rect shape (default: 1, range: 0.6-1.5). Values > 1 = taller, < 1 = wider */
74
+ aspectRatio?: number;
75
+ /** Border radius in pixels for rounded-rect shape. Default: 20% of shorter side */
76
+ borderRadius?: number;
77
+ /** Callback fired on each time update with the current time data */
78
+ onTimeChange?: (time: {
79
+ hours: number;
80
+ minutes: number;
81
+ seconds: number;
82
+ milliseconds: number;
83
+ }) => void;
84
+ /** Custom render function for the hour hand */
85
+ renderHourHand?: (props: HandRenderProps) => React.ReactNode;
86
+ /** Custom render function for the minute hand */
87
+ renderMinuteHand?: (props: HandRenderProps) => React.ReactNode;
88
+ /** Custom render function for the second hand (including counterweight) */
89
+ renderSecondHand?: (props: HandRenderProps) => React.ReactNode;
90
+ /** Array of time sectors to display on the clock face */
91
+ sectors?: ClockSector[];
92
+ /** Custom content rendered on the clock face, between the background and ticks/hands */
93
+ faceContent?: React.ReactNode;
94
+ /** Animate hands from 12:00 to current time on mount (default: false) */
95
+ animateOnMount?: boolean;
96
+ /** Duration of mount animation in ms (default: 1000) */
97
+ animateOnMountDuration?: number;
98
+ }
99
+ export interface HandRenderProps {
100
+ /** Rotation angle in degrees (0 = 12 o'clock) */
101
+ angle: number;
102
+ /** Hand length in pixels */
103
+ length: number;
104
+ /** Hand width/thickness in pixels */
105
+ width: number;
106
+ /** Center X coordinate */
107
+ centerX: number;
108
+ /** Center Y coordinate */
109
+ centerY: number;
110
+ /** Total clock size in pixels */
111
+ clockSize: number;
112
+ }
113
+ export interface ClockSector {
114
+ /** Start time (e.g., "09:00" or "09:00:00") */
115
+ from: string;
116
+ /** End time (e.g., "10:30") */
117
+ to: string;
118
+ /** Sector color (CSS color string, e.g., "#ff0000", "rgb(255,0,0)") */
119
+ color?: string;
120
+ /** Sector opacity (0-1) */
121
+ opacity?: number;
122
+ /** Label for tooltip/accessibility */
123
+ label?: string;
124
+ /** Enable click/hover interactivity */
125
+ interactive?: boolean;
126
+ /** Click handler */
127
+ onClick?: (sector: ClockSector) => void;
128
+ /** Hover handler */
129
+ onHover?: (sector: ClockSector, entering: boolean) => void;
67
130
  }
68
131
  export interface ClockArcsProps {
69
132
  /** Toggle seconds arc visibility (preferred) */
@@ -104,6 +167,9 @@ export type ClockFactory = Factory<{
104
167
  ref: HTMLDivElement;
105
168
  stylesNames: ClockStylesNames;
106
169
  vars: ClockCssVariables;
170
+ staticComponents: {
171
+ Digital: typeof ClockDigital;
172
+ };
107
173
  }>;
108
174
  export declare const defaultProps: Partial<ClockProps>;
109
175
  export declare const Clock: import("@mantine/core").MantineComponent<{
@@ -111,4 +177,7 @@ export declare const Clock: import("@mantine/core").MantineComponent<{
111
177
  ref: HTMLDivElement;
112
178
  stylesNames: ClockStylesNames;
113
179
  vars: ClockCssVariables;
180
+ staticComponents: {
181
+ Digital: typeof ClockDigital;
182
+ };
114
183
  }>;
@@ -0,0 +1,50 @@
1
+ import { BoxProps, Factory, MantineColor, MantineSize, StylesApiProps } from '@mantine/core';
2
+ import { Timezone } from './Clock';
3
+ export type ClockDigitalStylesNames = 'root' | 'segment' | 'hours' | 'separator' | 'minutes' | 'seconds' | 'amPm' | 'date';
4
+ export type ClockDigitalCssVariables = {
5
+ root: '--clock-digital-size' | '--clock-digital-color' | '--clock-digital-font-family' | '--clock-digital-gap';
6
+ };
7
+ export interface ClockDigitalProps extends BoxProps, StylesApiProps<ClockDigitalFactory> {
8
+ /** Size preset or pixel value */
9
+ size?: MantineSize | number | (string & {});
10
+ /** Text color */
11
+ color?: MantineColor;
12
+ /** Font family (default: monospace) */
13
+ fontFamily?: string;
14
+ /** Gap between segments */
15
+ gap?: number | string;
16
+ /** Timezone */
17
+ timezone?: Timezone;
18
+ /** 24-hour format (default: true) */
19
+ use24Hours?: boolean;
20
+ /** Show seconds (default: true) */
21
+ showSeconds?: boolean;
22
+ /** Show date below time (default: false) */
23
+ showDate?: boolean;
24
+ /** Show AM/PM indicator when use24Hours is false */
25
+ showAmPm?: boolean;
26
+ /** Separator character (default: ":") */
27
+ separator?: string;
28
+ /** Whether the clock is running (default: true) */
29
+ running?: boolean;
30
+ /** Update frequency in ms (default: 1000) */
31
+ updateFrequency?: number;
32
+ /** Pad hours with leading zero */
33
+ padHours?: boolean;
34
+ /** Pad minutes with leading zero (default: true) */
35
+ padMinutes?: boolean;
36
+ /** Pad seconds with leading zero (default: true) */
37
+ padSeconds?: boolean;
38
+ }
39
+ export type ClockDigitalFactory = Factory<{
40
+ props: ClockDigitalProps;
41
+ ref: HTMLDivElement;
42
+ stylesNames: ClockDigitalStylesNames;
43
+ vars: ClockDigitalCssVariables;
44
+ }>;
45
+ export declare const ClockDigital: import("@mantine/core").MantineComponent<{
46
+ props: ClockDigitalProps;
47
+ ref: HTMLDivElement;
48
+ stylesNames: ClockDigitalStylesNames;
49
+ vars: ClockDigitalCssVariables;
50
+ }>;
@@ -0,0 +1,92 @@
1
+ /** Normalize angle to [0, 360) */
2
+ export declare const normalizeAngle: (deg: number) => number;
3
+ /** Compute second hand angle from a Date, respecting timezone */
4
+ export declare function secondAngleFromDate(d: Date | null | undefined, tz?: string): number;
5
+ /** Compute minute hand angle from a Date, respecting timezone */
6
+ export declare function minuteAngleFromDate(d: Date | null | undefined, tz?: string): number;
7
+ /** Compute hour hand angle from a Date, respecting timezone */
8
+ export declare function hourAngleFromDate(d: Date | null | undefined, tz?: string): number;
9
+ /** Build an SVG sector path from center to arc */
10
+ export declare function describeSectorPath(cx: number, cy: number, r: number, startDeg: number, endDeg: number, direction: 'clockwise' | 'counterClockwise'): string;
11
+ export interface TickPosition {
12
+ x: number;
13
+ y: number;
14
+ angle: number;
15
+ transformOrigin: string;
16
+ /** 'rotation' = circular CSS rotate pattern, 'absolute' = positioned at x,y with angle rotation */
17
+ positioning: 'rotation' | 'absolute';
18
+ }
19
+ export interface NumberPosition {
20
+ x: number;
21
+ y: number;
22
+ }
23
+ export interface HandAnchor {
24
+ x: number;
25
+ y: number;
26
+ }
27
+ export interface ClockGeometry {
28
+ /** The width and height of the clock container */
29
+ readonly width: number;
30
+ readonly height: number;
31
+ /** Center coordinates */
32
+ readonly centerX: number;
33
+ readonly centerY: number;
34
+ /** CSS clip-path for the clock face shape */
35
+ clipPath: () => string | undefined;
36
+ /** CSS border-radius for the clock face shape */
37
+ borderRadius: () => string;
38
+ /** Position of a tick mark (hour or minute) */
39
+ tickPosition: (index: number, total: number, tickOffset: number) => TickPosition;
40
+ /** Position of an hour number */
41
+ numberPosition: (hourIndex: number, numberRadius: number) => NumberPosition;
42
+ /** Hand anchor point (where hands rotate from) */
43
+ handAnchor: () => HandAnchor;
44
+ /** Hand length given a ratio (0-1) relative to the "radius" */
45
+ handLength: (ratio: number) => number;
46
+ /** SVG sector path for arcs */
47
+ sectorPath: (startDeg: number, endDeg: number, radius: number, direction: 'clockwise' | 'counterClockwise') => string;
48
+ }
49
+ export declare class CircularGeometry implements ClockGeometry {
50
+ readonly width: number;
51
+ readonly height: number;
52
+ readonly centerX: number;
53
+ readonly centerY: number;
54
+ private readonly radius;
55
+ constructor(size: number);
56
+ clipPath(): string | undefined;
57
+ borderRadius(): string;
58
+ tickPosition(index: number, total: number, tickOffset: number): TickPosition;
59
+ numberPosition(hourIndex: number, numberRadius: number): NumberPosition;
60
+ handAnchor(): HandAnchor;
61
+ handLength(ratio: number): number;
62
+ sectorPath(startDeg: number, endDeg: number, radius: number, direction: 'clockwise' | 'counterClockwise'): string;
63
+ }
64
+ export declare class RoundedRectGeometry implements ClockGeometry {
65
+ readonly width: number;
66
+ readonly height: number;
67
+ readonly centerX: number;
68
+ readonly centerY: number;
69
+ private readonly borderRadiusValue;
70
+ private readonly radius;
71
+ private readonly hw;
72
+ private readonly hh;
73
+ constructor(width: number, height: number, borderRadius: number);
74
+ clipPath(): string;
75
+ borderRadius(): string;
76
+ tickPosition(index: number, total: number, tickOffset: number): TickPosition;
77
+ numberPosition(hourIndex: number, numberRadius: number): NumberPosition;
78
+ handAnchor(): HandAnchor;
79
+ handLength(ratio: number): number;
80
+ sectorPath(startDeg: number, endDeg: number, radius: number, direction: 'clockwise' | 'counterClockwise'): string;
81
+ /**
82
+ * Distance from center to the edge of the rounded rectangle at a given math angle.
83
+ * Accounts for the corner arcs: if the ray hits a corner region, it intersects
84
+ * the quarter-circle arc instead of the straight edge.
85
+ */
86
+ private distanceToEdge;
87
+ }
88
+ /** Create the appropriate geometry for the given shape */
89
+ export declare function createGeometry(size: number, shape?: 'circle' | 'rounded-rect', options?: {
90
+ aspectRatio?: number;
91
+ borderRadius?: number;
92
+ }): ClockGeometry;
@@ -6,16 +6,16 @@ export interface UseClockCountDownOptions {
6
6
  enabled?: boolean;
7
7
  /** The timezone to use for the countdown calculations. */
8
8
  timezone?: string;
9
- /** The frequency (in milliseconds) at which the countdown updates. */
9
+ /** The frequency (in milliseconds) at which the countdown updates. Minimum 16ms. */
10
10
  updateFrequency?: number;
11
- /** Whether to use 24-hour format or 12-hour format. */
12
- use24Hours?: boolean;
13
11
  /** Whether to pad single-digit seconds with a leading zero. */
14
12
  padSeconds?: boolean;
15
13
  /** Whether to pad single-digit minutes with a leading zero. */
16
14
  padMinutes?: boolean;
17
15
  /** Whether to pad single-digit hours with a leading zero. */
18
16
  padHours?: boolean;
17
+ /** Whether to pad single-digit days with a leading zero. */
18
+ padDays?: boolean;
19
19
  /** Target date for the countdown (Date object or ISO string). */
20
20
  targetDate?: Date | string;
21
21
  /** Number of hours to count down from current time. */
@@ -31,48 +31,46 @@ export interface UseClockCountDownOptions {
31
31
  * Data returned by the `useClockCountDown` hook.
32
32
  */
33
33
  export interface ClockCountDownData {
34
- /** The remaining years. */
35
- year: number;
36
- /** The remaining months (1-12). */
37
- month: number;
38
34
  /** 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;
35
+ days: number;
36
+ /** The remaining hours. */
37
+ hours: number;
46
38
  /** The remaining minutes. */
47
- minutes: number | string;
39
+ minutes: number;
48
40
  /** The remaining seconds. */
49
- seconds: number | string;
41
+ seconds: number;
50
42
  /** The remaining milliseconds. */
51
43
  milliseconds: number;
52
- /** Whether the time is AM or PM (only relevant if use24Hours is false). */
53
- amPm?: 'AM' | 'PM';
44
+ /** Total remaining time in milliseconds. */
45
+ totalMilliseconds: number;
54
46
  /** Whether the countdown has completed (reached zero). */
55
47
  isCompleted: boolean;
56
48
  /** Whether the countdown is currently running. */
57
49
  isRunning: boolean;
58
- /** Total remaining time in milliseconds. */
59
- totalMilliseconds: number;
60
- /** Start the countdown */
61
- start: () => void;
50
+ /** The formatted days string (with padding if enabled). */
51
+ formattedDays: string;
52
+ /** The formatted hours string (with padding if enabled). */
53
+ formattedHours: string;
54
+ /** The formatted minutes string (with padding if enabled). */
55
+ formattedMinutes: string;
56
+ /** The formatted seconds string (with padding if enabled). */
57
+ formattedSeconds: string;
62
58
  /** Pause/stop the countdown */
63
59
  pause: () => void;
64
- /** Reset the countdown to initial values */
65
- reset: () => void;
66
60
  /** Resume the countdown from current position */
67
61
  resume: () => void;
62
+ /** Start the countdown (alias for resume) */
63
+ start: () => void;
64
+ /** Reset the countdown to initial values */
65
+ reset: () => void;
68
66
  }
69
67
  /**
70
68
  * `useClockCountDown` is a React hook that provides real-time countdown data.
71
69
  *
72
70
  * This hook allows you to create a countdown timer to a specific date or time duration.
73
71
  * 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.
72
+ * The hook returns an object containing detailed countdown information and supports timezone
73
+ * and update frequency options.
76
74
  *
77
75
  * @param {UseClockCountDownOptions} options - Configuration options for the countdown.
78
76
  * @returns {ClockCountDownData} An object containing the current countdown data.
@@ -90,7 +88,6 @@ export interface ClockCountDownData {
90
88
  * const { hours, minutes, seconds } = useClockCountDown({
91
89
  * hours: 12,
92
90
  * updateFrequency: 1000,
93
- * use24Hours: false,
94
91
  * });
95
92
  *
96
93
  * @example
@@ -103,4 +100,4 @@ export interface ClockCountDownData {
103
100
  * padSeconds: true,
104
101
  * });
105
102
  */
106
- export declare function useClockCountDown({ enabled, timezone, updateFrequency, use24Hours, padSeconds, padMinutes, padHours, targetDate, hours, minutes, seconds, onCountDownCompleted, }: UseClockCountDownOptions): ClockCountDownData;
103
+ export declare function useClockCountDown({ enabled, timezone, updateFrequency, padSeconds, padMinutes, padHours, padDays, targetDate, hours, minutes, seconds, onCountDownCompleted, }: UseClockCountDownOptions): ClockCountDownData;
@@ -6,7 +6,7 @@ export interface UseClockOptions {
6
6
  enabled?: boolean;
7
7
  /** The timezone to use for the clock. */
8
8
  timezone?: string;
9
- /** The frequency (in milliseconds) at which the clock updates. */
9
+ /** The frequency (in milliseconds) at which the clock updates. Minimum 16ms. */
10
10
  updateFrequency?: number;
11
11
  /** Whether to use 24-hour format or 12-hour format. */
12
12
  use24Hours?: boolean;
@@ -31,20 +31,24 @@ export interface ClockData {
31
31
  week: number;
32
32
  /** Whether the current year is a leap year. */
33
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;
34
+ /** The current hour (always a number). */
35
+ hours: number;
36
+ /** The current minute (always a number). */
37
+ minutes: number;
38
+ /** The current second (always a number). */
39
+ seconds: number;
40
40
  /** The current millisecond. */
41
41
  milliseconds: number;
42
+ /** The formatted hour string (with padding if enabled). */
43
+ formattedHours: string;
44
+ /** The formatted minute string (with padding if enabled). */
45
+ formattedMinutes: string;
46
+ /** The formatted second string (with padding if enabled). */
47
+ formattedSeconds: string;
42
48
  /** Whether the time is AM or PM (only relevant if use24Hours is false). */
43
49
  amPm?: 'AM' | 'PM';
44
50
  /** Whether the clock is currently running and updating. */
45
51
  isRunning: boolean;
46
- /** Function to start the clock. */
47
- start: () => void;
48
52
  /** Function to pause the clock. */
49
53
  pause: () => void;
50
54
  /** Function to resume the clock. */
@@ -63,7 +67,7 @@ export interface ClockData {
63
67
  * @returns {ClockData} An object containing the current time data.
64
68
  *
65
69
  * @example
66
- * const { year, month, day, hours, minutes, seconds } = useClock({
70
+ * const { year, month, day, hours, minutes, seconds, formattedHours } = useClock({
67
71
  * timezone: 'America/New_York',
68
72
  * updateFrequency: 1000,
69
73
  * use24Hours: false,
@@ -1,5 +1,9 @@
1
1
  export { Clock } from './Clock';
2
- export type { ClockArcsProps, ClockBaseProps, ClockCssVariables, ClockFactory, ClockProps, ClockStylesNames, } from './Clock';
2
+ export type { ClockArcsProps, ClockBaseProps, ClockCssVariables, ClockFactory, ClockProps, ClockSector, ClockStylesNames, HandRenderProps, Timezone, } from './Clock';
3
+ export { ClockDigital } from './ClockDigital';
4
+ export type { ClockDigitalCssVariables, ClockDigitalFactory, ClockDigitalProps, ClockDigitalStylesNames, } from './ClockDigital';
5
+ export type { ClockGeometry } from './geometry';
6
+ export { CircularGeometry, RoundedRectGeometry, createGeometry } from './geometry';
3
7
  export { useClock } from './hooks/use-clock';
4
8
  export type { ClockData, UseClockOptions } from './hooks/use-clock';
5
9
  export { useClockCountDown } from './hooks/use-clock-count-down';
@@ -1,5 +1,9 @@
1
1
  export { Clock } from './Clock';
2
- export type { ClockArcsProps, ClockBaseProps, ClockCssVariables, ClockFactory, ClockProps, ClockStylesNames, } from './Clock';
2
+ export type { ClockArcsProps, ClockBaseProps, ClockCssVariables, ClockFactory, ClockProps, ClockSector, ClockStylesNames, HandRenderProps, Timezone, } from './Clock';
3
+ export { ClockDigital } from './ClockDigital';
4
+ export type { ClockDigitalCssVariables, ClockDigitalFactory, ClockDigitalProps, ClockDigitalStylesNames, } from './ClockDigital';
5
+ export type { ClockGeometry } from './geometry';
6
+ export { CircularGeometry, RoundedRectGeometry, createGeometry } from './geometry';
3
7
  export { useClock } from './hooks/use-clock';
4
8
  export type { ClockData, UseClockOptions } from './hooks/use-clock';
5
9
  export { useClockCountDown } from './hooks/use-clock-count-down';
package/package.json CHANGED
@@ -1,20 +1,22 @@
1
1
  {
2
2
  "name": "@gfazioli/mantine-clock",
3
- "version": "2.1.16",
3
+ "version": "3.0.0",
4
4
  "description": "React Clock components and hooks for Mantine with timezone support, countdown timers, customization options, and real-time updates.",
5
5
  "homepage": "https://gfazioli.github.io/mantine-clock/",
6
6
  "packageManager": "yarn@4.0.1",
7
7
  "license": "MIT",
8
8
  "author": "Giovambattista Fazioli <giovambattista.fazioli@gmail.com>",
9
9
  "keywords": [
10
+ "analog",
10
11
  "animation",
11
- "branding",
12
12
  "clock",
13
+ "countdown",
13
14
  "extension",
15
+ "hooks",
14
16
  "mantine",
15
17
  "react",
16
18
  "react-component",
17
- "scroll",
19
+ "timezone",
18
20
  "typescript"
19
21
  ],
20
22
  "main": "./dist/cjs/index.cjs",