@particle-academy/react-fancy 4.17.0 → 4.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10251,6 +10251,29 @@ var TimePicker = forwardRef(
10251
10251
  const { hours: h24, minutes } = parseTime(value);
10252
10252
  const isPM = h24 >= 12;
10253
10253
  const displayHour = format === "12h" ? h24 % 12 || 12 : h24;
10254
+ const updateTime = useCallback(
10255
+ (hours, mins) => {
10256
+ setValue(`${pad(hours)}:${pad(mins)}`);
10257
+ },
10258
+ [setValue]
10259
+ );
10260
+ const changeHour = useCallback(
10261
+ (delta) => {
10262
+ const newHour = (h24 + delta + 24) % 24;
10263
+ updateTime(newHour, minutes);
10264
+ },
10265
+ [h24, minutes, updateTime]
10266
+ );
10267
+ const changeMinute = useCallback(
10268
+ (delta) => {
10269
+ const newMin = (minutes + delta + 60) % 60;
10270
+ updateTime(h24, newMin);
10271
+ },
10272
+ [h24, minutes, updateTime]
10273
+ );
10274
+ const toggleAmPm = useCallback(() => {
10275
+ updateTime((h24 + 12) % 24, minutes);
10276
+ }, [h24, minutes, updateTime]);
10254
10277
  if (!showControl) {
10255
10278
  const formatted = format === "12h" ? `${pad(displayHour)}:${pad(minutes)} ${isPM ? "PM" : "AM"}` : `${pad(displayHour)}:${pad(minutes)}`;
10256
10279
  return /* @__PURE__ */ jsx(
@@ -10278,29 +10301,6 @@ var TimePicker = forwardRef(
10278
10301
  }
10279
10302
  );
10280
10303
  }
10281
- const updateTime = useCallback(
10282
- (hours, mins) => {
10283
- setValue(`${pad(hours)}:${pad(mins)}`);
10284
- },
10285
- [setValue]
10286
- );
10287
- const changeHour = useCallback(
10288
- (delta) => {
10289
- const newHour = (h24 + delta + 24) % 24;
10290
- updateTime(newHour, minutes);
10291
- },
10292
- [h24, minutes, updateTime]
10293
- );
10294
- const changeMinute = useCallback(
10295
- (delta) => {
10296
- const newMin = (minutes + delta + 60) % 60;
10297
- updateTime(h24, newMin);
10298
- },
10299
- [h24, minutes, updateTime]
10300
- );
10301
- const toggleAmPm = useCallback(() => {
10302
- updateTime((h24 + 12) % 24, minutes);
10303
- }, [h24, minutes, updateTime]);
10304
10304
  const spinBtnClass = "flex h-7 w-full items-center justify-center rounded text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-600 dark:hover:bg-zinc-800 dark:hover:text-zinc-300 disabled:opacity-50";
10305
10305
  const displayClass = "flex h-10 w-12 items-center justify-center text-lg font-medium tabular-nums";
10306
10306
  return /* @__PURE__ */ jsxs(