@allxsmith/bestax-bulma 5.67.3 → 5.67.5
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/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/components/Dropdown.js +24 -5
- package/dist/esm/components/Dropdown.js.map +1 -1
- package/dist/esm/components/HoverCard.js +4 -1
- package/dist/esm/components/HoverCard.js.map +1 -1
- package/dist/esm/components/Tabs.js.map +1 -1
- package/dist/esm/elements/Notification.js.map +1 -1
- package/dist/esm/form/Combobox.js +7 -2
- package/dist/esm/form/Combobox.js.map +1 -1
- package/dist/esm/form/Control.js.map +1 -1
- package/dist/esm/form/DateInputBase.js.map +1 -1
- package/dist/esm/form/DateRangeInputBase.js.map +1 -1
- package/dist/esm/form/DateTimeInputBase.js +23 -3
- package/dist/esm/form/DateTimeInputBase.js.map +1 -1
- package/dist/esm/form/TimeInputBase.js +6 -2
- package/dist/esm/form/TimeInputBase.js.map +1 -1
- package/dist/esm/form/_pickerInternals/Calendar.js +19 -12
- package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -1
- package/dist/esm/form/_pickerInternals/TimeWheels.js +19 -16
- package/dist/esm/form/_pickerInternals/TimeWheels.js.map +1 -1
- package/dist/esm/helpers/useFocusTrap.js +84 -10
- package/dist/esm/helpers/useFocusTrap.js.map +1 -1
- package/dist/esm/helpers/useOtherClasses.js.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +2783 -2649
- package/dist/index.cjs.map +1 -1
- package/dist/types/components/HoverCard.d.ts +5 -1
- package/dist/types/components/Tabs.d.ts +5 -1
- package/dist/types/elements/Notification.d.ts +18 -2
- package/dist/types/form/Combobox.d.ts +4 -1
- package/dist/types/form/Control.d.ts +18 -4
- package/dist/types/form/DateInputBase.d.ts +4 -1
- package/dist/types/form/DateRangeInputBase.d.ts +4 -1
- package/dist/types/form/DateTimeInputBase.d.ts +7 -1
- package/dist/types/form/TimeInputBase.d.ts +5 -1
- package/dist/types/form/_pickerInternals/TimeWheels.d.ts +6 -0
- package/dist/types/helpers/useFocusTrap.d.ts +14 -4
- package/dist/types/helpers/useOtherClasses.d.ts +6 -1
- package/dist/types-cjs/components/HoverCard.d.ts +5 -1
- package/dist/types-cjs/components/Tabs.d.ts +5 -1
- package/dist/types-cjs/elements/Notification.d.ts +18 -2
- package/dist/types-cjs/form/Combobox.d.ts +4 -1
- package/dist/types-cjs/form/Control.d.ts +18 -4
- package/dist/types-cjs/form/DateInputBase.d.ts +4 -1
- package/dist/types-cjs/form/DateRangeInputBase.d.ts +4 -1
- package/dist/types-cjs/form/DateTimeInputBase.d.ts +7 -1
- package/dist/types-cjs/form/TimeInputBase.d.ts +5 -1
- package/dist/types-cjs/form/_pickerInternals/TimeWheels.d.ts +6 -0
- package/dist/types-cjs/helpers/useFocusTrap.d.ts +14 -4
- package/dist/types-cjs/helpers/useOtherClasses.d.ts +6 -1
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/CLAUDE.md +4 -1
- package/src/scss/_color-classes.scss +27 -0
- package/src/scss/_selected-row.scss +2 -10
- package/src/scss/components/_hovercard.scss +11 -0
- package/src/scss/components/_sidebar.scss +8 -5
- package/src/scss/components/_tabs.scss +16 -17
- package/src/scss/elements/_notification.scss +30 -1
- package/src/scss/form/_combobox.scss +12 -0
- package/src/scss/form/_dateinput.scss +1 -1
- package/src/scss/form/_slider.scss +18 -0
- package/src/scss/form/_timeinput.scss +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeWheels.js","sources":["../../../../src/form/_pickerInternals/TimeWheels.tsx"],"sourcesContent":["/* eslint-disable react-hooks/refs --\n * This wheel/momentum picker intentionally accesses refs during render:\n * - state is mirrored into refs (positionRef, audioTickEnabledRef) so the\n * RAF/drag/tick callbacks read the latest values in lockstep with rendering\n * (refactoring to effect-synced refs would desync drag from the frame);\n * - a MediaQueryList is lazily cached in a ref (reducedMotionMqlRef);\n * - per-column Wheel handle refs build the keyboard focus order.\n * These are deliberate, established patterns; behavior is covered by unit tests\n * and certified interactively in-browser (drag, ticks, keyboard focus nav).\n */\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../../helpers/classNames';\nimport { useConfig } from '../../helpers/Config';\nimport {\n HourFormat,\n PickerLabels,\n isPopoverToggleKey,\n mergeLabels,\n} from './pickerTypes';\nimport { setTimeOfDay } from './dateUtils';\nimport { tickHaptic as fireTickHaptic } from './haptics';\nimport { playAudioTick, unlockAudioTick } from './audioTick';\n\nexport interface TimeWheelsValue {\n hours: number;\n minutes: number;\n seconds?: number;\n}\n\nexport interface TimeWheelsProps {\n value: TimeWheelsValue;\n onChange: (v: TimeWheelsValue) => void;\n hourFormat?: HourFormat;\n enableSeconds?: boolean;\n /** Step between visible values in the wheel. Default `1`. */\n incrementHours?: number;\n incrementMinutes?: number;\n incrementSeconds?: number;\n unselectableTimes?: (d: Date) => boolean;\n size?: 'small' | 'medium' | 'large';\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n disabled?: boolean;\n className?: string;\n id?: string;\n labels?: PickerLabels;\n /** Number of items visible at once (must be odd). Default 5. */\n visibleCount?: number;\n /** Item height in px. Default 32. */\n itemHeight?: number;\n /**\n * Play a short audible tick on each item crossing. Useful as a fallback on\n * iOS Safari, where there is no web-accessible haptic API. Off by default\n * to avoid surprising users with sound; flip on for iOS-targeted UIs.\n */\n audioTick?: boolean;\n /**\n * Fired when the user presses Enter on a wheel column. The current value is\n * already committed (each wheel-tick calls onChange), so this typically just\n * needs to close the surrounding popover.\n */\n onCommit?: () => void;\n}\n\nconst wrap = (n: number, max: number): number => ((n % max) + max) % max;\n\n/**\n * Walk forward (or backward) from `start` in `step` steps until `test` returns\n * true or we've cycled all `max` candidates. Used to skip past unselectable\n * values without freezing the wheel.\n */\nfunction nextValid(\n start: number,\n step: number,\n max: number,\n test: (n: number) => boolean\n): number {\n let candidate = wrap(start, max);\n for (let i = 0; i < max; i++) {\n if (test(candidate)) return candidate;\n candidate = wrap(candidate + step, max);\n }\n return start;\n}\n\nconst pad2 = (n: number): string => String(n).padStart(2, '0');\n\ninterface WheelHandle {\n focus: () => void;\n /**\n * Begin a drag externally — used by the parent's empty-space forwarder so\n * the user can grab the wheel by touching anywhere in the wheels row, not\n * just on the column itself (matches iOS native picker behavior).\n *\n * The pointer must already be active (i.e., a real `pointerdown` is in\n * flight). We immediately capture the pointer on the wheel root so the\n * existing `onPointerMove` / `onPointerUp` handlers will fire here.\n */\n startDrag: (pointerId: number, clientY: number) => void;\n}\n\ninterface WheelProps<T> {\n values: T[];\n index: number;\n onChange: (nextIndex: number) => void;\n formatLabel: (v: T) => string;\n formatAriaText?: (v: T) => string;\n ariaLabel: string;\n visibleCount: number;\n itemHeight: number;\n disabled?: boolean;\n size?: 'small' | 'medium' | 'large';\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n onFocusPrev?: () => void;\n onFocusNext?: () => void;\n /** Fired when Enter is pressed (current value is already committed live). */\n onCommit?: () => void;\n /**\n * Whether the wheel wraps at the edges. When true, scrolling past the last\n * value rolls back to the first (and vice versa) and neighbouring values\n * are visible above the first / below the last item.\n */\n wrap?: boolean;\n /**\n * Optional predicate. Items for which it returns `true` are rendered with\n * the `disabled` attribute (and visually dimmed via the `:disabled` SCSS\n * rule), giving users a clear cue that the value is blocked. Keyboard /\n * wheel navigation may still pass over these positions, but `onChange`\n * callers (`TimeWheels`) skip them via `nextValid`.\n */\n disabledFor?: (v: T) => boolean;\n /**\n * Play an audible tick on each item crossing. Used as the iOS substitute\n * for haptic feedback; threaded from `TimeWheels.audioTick`.\n */\n audioTick?: boolean;\n}\n\nconst WheelInner = <T,>(\n {\n values,\n index,\n onChange,\n formatLabel,\n formatAriaText,\n ariaLabel,\n visibleCount,\n itemHeight,\n disabled,\n size,\n color,\n onFocusPrev,\n onFocusNext,\n onCommit,\n wrap = false,\n disabledFor,\n audioTick = false,\n }: WheelProps<T>,\n ref: React.Ref<WheelHandle>\n) => {\n const { classPrefix } = useConfig();\n const N = values.length;\n const half = Math.floor(visibleCount / 2);\n const containerHeight = visibleCount * itemHeight;\n // Buffer around the visible window so adjacent items animate in/out smoothly.\n const BUFFER = half + 2;\n\n // Continuous wheel position in units of items. Math.round(position) is the\n // \"active\" virtual index; the fractional part is the drag/momentum offset\n // within an item slot. Using a single float (rather than virtualIdx +\n // dragOffset) keeps drag and tick-update in lockstep so items move with the\n // finger without a 40px overshoot when crossing item boundaries.\n const [position, setPosition] = useState<number>(index);\n const positionRef = useRef<number>(index);\n positionRef.current = position;\n const [isDragging, setIsDragging] = useState(false);\n const rootRef = useRef<HTMLDivElement>(null);\n // Ref to the stationary selection band — populated by the JSX below. The\n // band briefly scales + brightens on each item tick so users perceive a\n // body-felt \"thunk\" even on iOS where no haptic API exists.\n const bandRef = useRef<HTMLDivElement>(null);\n // Cached MediaQueryList for `prefers-reduced-motion`. We read this on\n // every tick to decide whether to fire the band pulse; caching the MQL\n // saves a `matchMedia` call per tick (which can fire at ~20Hz during a\n // momentum flick).\n const reducedMotionMqlRef = useRef<MediaQueryList | null>(null);\n if (\n reducedMotionMqlRef.current === null &&\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function'\n ) {\n reducedMotionMqlRef.current = window.matchMedia(\n '(prefers-reduced-motion: reduce)'\n );\n }\n // In-flight band pulse animation (Web Animations API). Tracked so we can\n // cancel on unmount; the WAI's `composite: 'replace'` semantics handle\n // re-trigger automatically without us needing to cancel between ticks.\n const pulseAnimRef = useRef<Animation | null>(null);\n // True while the external `index` prop sync useEffect runs, so we don't\n // fire a haptic blip when the parent updates the value programmatically.\n const isSyncingRef = useRef<boolean>(false);\n\n // Tiny haptic/audio/visual blip per item tick. Haptic uses\n // `navigator.vibrate` where available (Android Chrome / Firefox Android /\n // Samsung Internet); iOS has no web-accessible haptic path as of May\n // 2026, so the optional `audioTick` plays a low-frequency thunk as the\n // closest UX substitute. The visual band-pulse fires on every tick on\n // every platform (gated only by `prefers-reduced-motion`) so the\n // selection band feels reactive — visual reinforcement of the tactile\n // feedback. We skip all three during programmatic prop sync so a parent\n // re-render doesn't blip.\n const audioTickEnabledRef = useRef<boolean>(audioTick);\n audioTickEnabledRef.current = audioTick;\n const playBandPulse = useCallback(() => {\n const el = bandRef.current;\n if (!el || typeof el.animate !== 'function') return;\n if (reducedMotionMqlRef.current?.matches) return;\n // Compound scale + brightness pulse, peaking at 40% through the 110ms\n // duration. `composite: 'replace'` means a re-trigger mid-pulse cleanly\n // restarts rather than queueing — important at fling rates where ticks\n // can fire every ~50ms.\n pulseAnimRef.current = el.animate(\n [\n { transform: 'scale(1)', filter: 'brightness(1)' },\n {\n transform: 'scale(1.04)',\n filter: 'brightness(1.15)',\n offset: 0.4,\n },\n { transform: 'scale(1)', filter: 'brightness(1)' },\n ],\n { duration: 110, easing: 'ease-out', composite: 'replace' }\n );\n }, []);\n const tickFeedback = useCallback(() => {\n /* istanbul ignore next: the sync flag is only true synchronously inside the prop-sync effect, which sets position directly and never routes through commitPosition */\n if (isSyncingRef.current) return;\n fireTickHaptic();\n if (audioTickEnabledRef.current) playAudioTick();\n playBandPulse();\n }, [playBandPulse]);\n const dragStateRef = useRef<{\n pointerId: number | null;\n startY: number;\n startPosition: number;\n captured: boolean;\n samples: { t: number; y: number }[];\n }>({\n pointerId: null,\n startY: 0,\n startPosition: 0,\n captured: false,\n samples: [],\n });\n // RAF id for the in-flight momentum / snap animation, so we can cancel when\n // the user grabs the wheel again or the component unmounts.\n const rafIdRef = useRef<number | null>(null);\n\n const virtualIdx = Math.round(position);\n\n const cancelRaf = useCallback(() => {\n if (rafIdRef.current !== null) {\n cancelAnimationFrame(rafIdRef.current);\n rafIdRef.current = null;\n }\n }, []);\n\n useEffect(\n () => () => {\n cancelRaf();\n // Cancel any in-flight band pulse so it doesn't keep a reference to\n // a detached DOM node. WAI Animation.cancel() is safe to call even\n // if the animation has already finished.\n pulseAnimRef.current?.cancel();\n pulseAnimRef.current = null;\n },\n [cancelRaf]\n );\n\n React.useImperativeHandle(\n ref,\n () => ({\n focus: () => rootRef.current?.focus(),\n startDrag: (pointerId: number, clientY: number) => {\n /* istanbul ignore next: the empty-space forwarder (sole caller) already returns on the same disabled prop */\n if (disabled) return;\n cancelRaf();\n if (audioTickEnabledRef.current) unlockAudioTick();\n const now =\n typeof performance !== 'undefined' ? performance.now() : Date.now();\n dragStateRef.current = {\n pointerId,\n startY: clientY,\n startPosition: positionRef.current,\n // Skip the drag-threshold gate: the parent forwarder has already\n // decided this is a drag (a pointerdown landed on empty space,\n // which has no click target).\n captured: true,\n samples: [{ t: now, y: clientY }],\n };\n try {\n rootRef.current?.setPointerCapture(pointerId);\n } catch {\n // setPointerCapture can throw if the pointer isn't currently\n // active for this element; the existing onPointerMove handler\n // still matches on pointerId so the drag will work either way.\n }\n setIsDragging(true);\n },\n }),\n [disabled, cancelRaf]\n );\n\n // Resolve a virtualIdx into an actual values[] index (modulo wrap if `wrap`).\n const toActual = useCallback(\n (v: number) => {\n if (wrap) return ((v % N) + N) % N;\n return Math.max(0, Math.min(N - 1, v));\n },\n [wrap, N]\n );\n\n const clampPosition = useCallback(\n (p: number) => {\n if (wrap) return p;\n return Math.max(0, Math.min(N - 1, p));\n },\n [wrap, N]\n );\n\n // Update position and fire onChange if the rounded value changed.\n const commitPosition = useCallback(\n (next: number) => {\n const clamped = clampPosition(next);\n const prevRound = Math.round(positionRef.current);\n const nextRound = Math.round(clamped);\n positionRef.current = clamped;\n setPosition(clamped);\n if (nextRound !== prevRound) {\n onChange(toActual(nextRound));\n tickFeedback();\n }\n },\n [clampPosition, onChange, toActual, tickFeedback]\n );\n\n // When the external `index` changes (e.g. from typed input), re-sync\n // position to the closest virtual position that maps to it.\n //\n // Crucial subtlety: this effect re-runs every time the parent value\n // changes — including the round-trip case where the user's own scroll\n // commits a tick → fires onChange → parent re-renders with the new\n // index → here. If we cancelled the in-flight momentum/snap RAF on\n // every such echo, the snap would never get to land on an integer\n // (the user's wheel would stop wherever the last tick fired). So we\n // bail out early when the rounded position already matches the\n // incoming index — the echo case — and only cancel + apply an actual\n // jump when the parent has moved us somewhere we don't already round\n // to.\n useEffect(() => {\n const prev = positionRef.current;\n const wrappedRoundPrev = ((Math.round(prev) % N) + N) % N;\n if (wrappedRoundPrev === index) return;\n cancelRaf();\n isSyncingRef.current = true;\n setPosition(prevPos => {\n if (!wrap) {\n positionRef.current = index;\n return index;\n }\n const wrappedPrev = ((prevPos % N) + N) % N;\n const forward = (index - wrappedPrev + N) % N;\n const backward = forward - N;\n const delta =\n Math.abs(forward) <= Math.abs(backward) ? forward : backward;\n const next = prevPos + delta;\n positionRef.current = next;\n return next;\n });\n isSyncingRef.current = false;\n }, [index, N, wrap, cancelRaf]);\n\n const moveBy = useCallback(\n (delta: number) => {\n if (disabled) return;\n cancelRaf();\n commitPosition(Math.round(positionRef.current) + delta);\n },\n [disabled, cancelRaf, commitPosition]\n );\n\n // The keys are a spinbutton's: up raises the value and down lowers it. The\n // values run down the wheel, so up brings the one below the band into it,\n // the way a drag or a scroll that moves the items up does.\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (isPopoverToggleKey(e)) return;\n switch (e.key) {\n case 'ArrowUp':\n e.preventDefault();\n moveBy(1);\n break;\n case 'ArrowDown':\n e.preventDefault();\n moveBy(-1);\n break;\n case 'PageUp':\n e.preventDefault();\n moveBy(5);\n break;\n case 'PageDown':\n e.preventDefault();\n moveBy(-5);\n break;\n case 'Home':\n e.preventDefault();\n if (disabled) break;\n cancelRaf();\n commitPosition(0);\n break;\n case 'End':\n e.preventDefault();\n if (disabled) break;\n cancelRaf();\n commitPosition(N - 1);\n break;\n case 'ArrowLeft':\n e.preventDefault();\n onFocusPrev?.();\n break;\n case 'ArrowRight':\n e.preventDefault();\n onFocusNext?.();\n break;\n case 'Enter':\n e.preventDefault();\n onCommit?.();\n break;\n }\n },\n [\n moveBy,\n disabled,\n commitPosition,\n cancelRaf,\n N,\n onFocusPrev,\n onFocusNext,\n onCommit,\n ]\n );\n\n // Animate position to the nearest integer with ease-out cubic. Used after a\n // drag / momentum settles, so the wheel always rests aligned to an item.\n const animateSnap = useCallback(() => {\n cancelRaf();\n const start = positionRef.current;\n const target = Math.round(start);\n if (start === target) return;\n const duration = 180;\n const startTime =\n typeof performance !== 'undefined' ? performance.now() : Date.now();\n const tick = (now: number) => {\n const t = Math.min(1, (now - startTime) / duration);\n const eased = 1 - Math.pow(1 - t, 3);\n const next = start + (target - start) * eased;\n commitPosition(next);\n if (t < 1) {\n rafIdRef.current = requestAnimationFrame(tick);\n } else {\n rafIdRef.current = null;\n }\n };\n rafIdRef.current = requestAnimationFrame(tick);\n }, [cancelRaf, commitPosition]);\n\n // Kinetic momentum after a flick. Uses exponential friction so the velocity\n // tapers smoothly. Updates `position` in items/ms; commitPosition handles\n // the onChange ticks as virtualIdx crosses integers.\n const startMomentum = useCallback(\n (initialPxPerMs: number) => {\n cancelRaf();\n // Drag-up (negative dy/dt in screen coords) should INCREASE position\n // (later values come into view), so flip the sign.\n let velocity = -initialPxPerMs / itemHeight; // items / ms\n // Cap initial velocity so a frantic swipe doesn't blast through the\n // whole list. Empirically tuned to match iOS feel.\n const MAX_VEL = 0.05; // items/ms (≈ 50 items/sec)\n if (velocity > MAX_VEL) velocity = MAX_VEL;\n if (velocity < -MAX_VEL) velocity = -MAX_VEL;\n const STOP_VEL = 0.0015; // items/ms (≈ 1.5 items/sec)\n // Friction coefficient per millisecond — chosen so velocity halves\n // every ~120ms.\n const FRICTION_PER_MS = Math.pow(0.5, 1 / 120);\n let lastTime =\n typeof performance !== 'undefined' ? performance.now() : Date.now();\n const tick = (now: number) => {\n const dt = Math.max(1, now - lastTime);\n lastTime = now;\n let next = positionRef.current + velocity * dt;\n // Boundary handling for non-wrapping wheels: clamp and zero the\n // velocity so we don't keep ticking against the wall.\n if (!wrap) {\n if (next <= 0) {\n next = 0;\n velocity = 0;\n } else if (next >= N - 1) {\n next = N - 1;\n velocity = 0;\n }\n }\n commitPosition(next);\n velocity *= Math.pow(FRICTION_PER_MS, dt);\n if (Math.abs(velocity) < STOP_VEL) {\n animateSnap();\n return;\n }\n rafIdRef.current = requestAnimationFrame(tick);\n };\n rafIdRef.current = requestAnimationFrame(tick);\n },\n [cancelRaf, commitPosition, itemHeight, wrap, N, animateSnap]\n );\n\n // Mouse wheel: accumulate deltaY across events and step when the\n // accumulator crosses SCROLL_STEP_PX. Trackpads emit dozens of small\n // events per swipe; without accumulation a single gesture flies the wheel.\n useEffect(() => {\n const el = rootRef.current;\n if (!el || disabled) return undefined;\n const SCROLL_STEP_PX = 60;\n const QUIET_MS = 250;\n let accumulated = 0;\n let resetTimer: ReturnType<typeof setTimeout> | null = null;\n const resetAccumulator = () => {\n accumulated = 0;\n };\n const onWheel = (e: WheelEvent) => {\n e.preventDefault();\n // Reset accumulator if scroll direction reversed mid-gesture.\n if (accumulated !== 0 && Math.sign(accumulated) !== Math.sign(e.deltaY)) {\n accumulated = 0;\n }\n accumulated += e.deltaY;\n while (Math.abs(accumulated) >= SCROLL_STEP_PX) {\n if (accumulated > 0) {\n moveBy(1);\n accumulated -= SCROLL_STEP_PX;\n } else {\n moveBy(-1);\n accumulated += SCROLL_STEP_PX;\n }\n }\n if (resetTimer) clearTimeout(resetTimer);\n resetTimer = setTimeout(resetAccumulator, QUIET_MS);\n };\n el.addEventListener('wheel', onWheel, { passive: false });\n return () => {\n el.removeEventListener('wheel', onWheel);\n if (resetTimer) clearTimeout(resetTimer);\n };\n }, [moveBy, disabled]);\n\n // Pointer drag.\n // We DELAY capturing the pointer until the user moves more than\n // DRAG_THRESHOLD_PX. Without this, capturing on pointerdown would redirect\n // mouseup → wheel root, which suppresses the click event on the item button\n // the user pressed (so single-clicks on neighbouring items would no-op).\n const DRAG_THRESHOLD_PX = 4;\n const onPointerDown = (e: React.PointerEvent<HTMLDivElement>) => {\n if (disabled) return;\n cancelRaf();\n if (audioTickEnabledRef.current) {\n // Resume the AudioContext from inside the user gesture so the first\n // tick of this drag can play (iOS Safari requires this; other browsers\n // are forgiving but it's a cheap idempotent call).\n unlockAudioTick();\n }\n const now =\n typeof performance !== 'undefined' ? performance.now() : Date.now();\n dragStateRef.current = {\n pointerId: e.pointerId,\n startY: e.clientY,\n startPosition: positionRef.current,\n captured: false,\n samples: [{ t: now, y: e.clientY }],\n };\n };\n const onPointerMove = (e: React.PointerEvent<HTMLDivElement>) => {\n const s = dragStateRef.current;\n if (s.pointerId !== e.pointerId) return;\n const dy = e.clientY - s.startY;\n if (!s.captured) {\n if (Math.abs(dy) < DRAG_THRESHOLD_PX) return;\n rootRef.current?.setPointerCapture(e.pointerId);\n s.captured = true;\n setIsDragging(true);\n }\n const now =\n typeof performance !== 'undefined' ? performance.now() : Date.now();\n s.samples.push({ t: now, y: e.clientY });\n // Keep the velocity sample window short so the post-flick velocity\n // reflects the *recent* finger speed, not the whole-drag average.\n const VELOCITY_WINDOW_MS = 100;\n while (s.samples.length > 2 && now - s.samples[0].t > VELOCITY_WINDOW_MS) {\n s.samples.shift();\n }\n // Continuous position: every itemHeight worth of finger drag advances\n // the wheel by 1 unit. Pulling the finger DOWN (positive dy) shows\n // EARLIER values, which means position decreases.\n commitPosition(s.startPosition - dy / itemHeight);\n };\n const onPointerUp = (e: React.PointerEvent<HTMLDivElement>) => {\n const s = dragStateRef.current;\n if (s.pointerId !== e.pointerId) return;\n if (s.captured) {\n rootRef.current?.releasePointerCapture(e.pointerId);\n // Drags don't fire click → focus would be left on whichever child\n // received pointerdown. Pull it back to the wheel root so :focus\n // emphasis still reads correctly after a drag.\n rootRef.current?.focus();\n // Compute fling velocity from the recent sample window.\n const samples = s.samples;\n let pxPerMs = 0;\n if (samples.length >= 2) {\n const first = samples[0];\n const last = samples[samples.length - 1];\n const dt = last.t - first.t;\n if (dt > 0) pxPerMs = (last.y - first.y) / dt;\n }\n // Threshold below which we just snap to the nearest item; above which\n // we kick off momentum.\n const FLING_THRESHOLD = 0.25; // px/ms ≈ 250 px/sec\n if (Math.abs(pxPerMs) > FLING_THRESHOLD) {\n startMomentum(pxPerMs);\n } else {\n animateSnap();\n }\n }\n s.pointerId = null;\n s.captured = false;\n s.samples = [];\n setIsDragging(false);\n };\n\n const rootClass = prefixedClassNames(classPrefix, 'timeinput-wheel', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-disabled': disabled,\n 'is-dragging': isDragging,\n });\n const itemClass = (selected: boolean) =>\n prefixedClassNames(classPrefix, 'timeinput-wheel-item', {\n 'is-selected': selected,\n [`is-${color}`]: selected && !!color,\n });\n const bandClass = prefixedClassNames(classPrefix, 'timeinput-wheel-band', {\n [`is-${color}`]: !!color,\n });\n\n // Build the buffered window of items to render around the current position.\n const items: { vIdx: number; aIdx: number }[] = [];\n for (let off = -BUFFER; off <= BUFFER; off++) {\n const vIdx = virtualIdx + off;\n if (!wrap && (vIdx < 0 || vIdx >= N)) continue;\n const aIdx = toActual(vIdx);\n items.push({ vIdx, aIdx });\n }\n\n const ariaText = formatAriaText\n ? formatAriaText(values[toActual(virtualIdx)])\n : formatLabel(values[toActual(virtualIdx)]);\n\n // Center of the wheel viewport, in px from the top.\n const centreTop = containerHeight / 2 - itemHeight / 2;\n\n return (\n <div\n ref={rootRef}\n role=\"spinbutton\"\n aria-label={ariaLabel}\n aria-valuemin={0}\n aria-valuemax={N - 1}\n aria-valuenow={toActual(virtualIdx)}\n aria-valuetext={ariaText}\n tabIndex={disabled ? -1 : 0}\n className={rootClass}\n style={{ height: containerHeight }}\n onKeyDown={onKeyDown}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n >\n {/* Stationary selection band — sits at the centre of the viewport while\n items slide through it, like the iOS native picker. The ref lets\n `playBandPulse` animate scale + brightness on each item tick. */}\n <div\n ref={bandRef}\n className={bandClass}\n aria-hidden=\"true\"\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n top: centreTop,\n height: itemHeight,\n pointerEvents: 'none',\n }}\n />\n {items.map(({ vIdx, aIdx }) => {\n // Continuous offset in items: items at the centre have offset ≈ 0;\n // top of viewport is negative, bottom positive.\n const offCentreItems = vIdx - position;\n const top = centreTop + offCentreItems * itemHeight;\n const selected = vIdx === virtualIdx;\n const itemDisabled =\n disabled || (disabledFor ? disabledFor(values[aIdx]) : false);\n return (\n <button\n key={vIdx}\n type=\"button\"\n // A spinbutton owns no options: it states its value through\n // aria-valuetext, so the items are pointer targets only.\n aria-hidden=\"true\"\n tabIndex={-1}\n className={itemClass(selected)}\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n height: itemHeight,\n top: `${top}px`,\n }}\n disabled={itemDisabled}\n // Keep a press from focusing the item, which assistive technology\n // can't see; the click below hands focus to the wheel instead.\n onMouseDown={e => e.preventDefault()}\n onClick={() => {\n moveBy(vIdx - virtualIdx);\n // Click focuses the <button> child by default; pull focus back\n // to the wheel root so the column emphasis (:focus rules) match.\n rootRef.current?.focus();\n }}\n >\n {formatLabel(values[aIdx])}\n </button>\n );\n })}\n </div>\n );\n};\n\nconst Wheel = React.forwardRef(WheelInner) as <T>(\n props: WheelProps<T> & { ref?: React.Ref<WheelHandle> }\n) => React.ReactElement;\n\nexport const TimeWheels: React.FC<TimeWheelsProps> = ({\n value,\n onChange,\n hourFormat = '24',\n enableSeconds = false,\n incrementHours = 1,\n incrementMinutes = 1,\n incrementSeconds = 1,\n unselectableTimes,\n size,\n color,\n disabled,\n className,\n id,\n labels,\n visibleCount = 5,\n itemHeight = 32,\n audioTick = false,\n onCommit,\n}) => {\n const t = mergeLabels(labels);\n\n const rootClass = usePrefixedClassNames('timeinput', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-disabled': disabled,\n });\n const wheelsClass = usePrefixedClassNames('timeinput-wheels');\n const sepClass = usePrefixedClassNames('timeinput-separator');\n // Use the prefixed class through the same helper the wheels themselves do,\n // so the selector matches the actual rendered class regardless of whether\n // the consumer configured `classPrefix` via ConfigProvider. Building the\n // selector with `${classPrefix}timeinput-wheel` is wrong when classPrefix\n // is undefined (defaults to the empty prefix) — it would stringify to\n // \"undefinedtimeinput-wheel\".\n const wheelSingleClass = usePrefixedClassNames('timeinput-wheel');\n const wheelsContainerRef = useRef<HTMLDivElement>(null);\n\n const isPm = value.hours >= 12;\n\n const isTimeAllowed = useCallback(\n (h: number, m: number, s: number) => {\n if (!unselectableTimes) return true;\n const probe = setTimeOfDay(new Date(), {\n hours: h,\n minutes: m,\n seconds: s,\n milliseconds: 0,\n });\n return !unselectableTimes(probe);\n },\n [unselectableTimes]\n );\n\n // Per-column \"is this value disabled?\" predicates. We compute them against\n // the current value's other parts, so e.g. a predicate that only blocks\n // 12:00–12:59 leaves all minutes selectable when the user moves the hour\n // off 12. Returning `undefined` (rather than a function) when there is no\n // unselectableTimes lets the Wheel skip the disabled-attribute branch.\n const isHourDisabled = useCallback(\n (display: number) => {\n let h24 = display;\n if (hourFormat === '12') {\n const base = display % 12;\n h24 = isPm ? base + 12 : base;\n }\n return !isTimeAllowed(h24, value.minutes, value.seconds ?? 0);\n },\n [hourFormat, isPm, isTimeAllowed, value.minutes, value.seconds]\n );\n const isMinuteDisabled = useCallback(\n (m: number) => !isTimeAllowed(value.hours, m, value.seconds ?? 0),\n [isTimeAllowed, value.hours, value.seconds]\n );\n const isSecondDisabled = useCallback(\n (s: number) => !isTimeAllowed(value.hours, value.minutes, s),\n [isTimeAllowed, value.hours, value.minutes]\n );\n const hourDisabledFor = unselectableTimes ? isHourDisabled : undefined;\n const minuteDisabledFor = unselectableTimes ? isMinuteDisabled : undefined;\n const secondDisabledFor = unselectableTimes ? isSecondDisabled : undefined;\n\n const commit = useCallback(\n (next: Partial<TimeWheelsValue>) => {\n const merged: TimeWheelsValue = {\n hours: next.hours ?? value.hours,\n minutes: next.minutes ?? value.minutes,\n seconds: enableSeconds\n ? (next.seconds ?? value.seconds ?? 0)\n : undefined,\n };\n if (!isTimeAllowed(merged.hours, merged.minutes, merged.seconds ?? 0)) {\n return;\n }\n onChange(merged);\n },\n [value, enableSeconds, isTimeAllowed, onChange]\n );\n\n // Build the value lists per column.\n const hourValues = useMemo<number[]>(() => {\n const step = Math.max(1, incrementHours);\n if (hourFormat === '12') {\n const out: number[] = [];\n for (let h = 1; h <= 12; h += step) out.push(h);\n return out;\n }\n const out: number[] = [];\n for (let h = 0; h < 24; h += step) out.push(h);\n return out;\n }, [hourFormat, incrementHours]);\n\n const minuteValues = useMemo<number[]>(() => {\n const step = Math.max(1, incrementMinutes);\n const out: number[] = [];\n for (let m = 0; m < 60; m += step) out.push(m);\n return out;\n }, [incrementMinutes]);\n\n const secondValues = useMemo<number[]>(() => {\n const step = Math.max(1, incrementSeconds);\n const out: number[] = [];\n for (let s = 0; s < 60; s += step) out.push(s);\n return out;\n }, [incrementSeconds]);\n\n // Map current value → wheel index.\n const displayedHours =\n hourFormat === '12'\n ? value.hours % 12 === 0\n ? 12\n : value.hours % 12\n : value.hours;\n const hourIndex = Math.max(0, hourValues.indexOf(displayedHours));\n const minuteIndex = Math.max(0, minuteValues.indexOf(value.minutes));\n const secondIndex = Math.max(0, secondValues.indexOf(value.seconds ?? 0));\n const ampmIndex = isPm ? 1 : 0;\n\n // Refs for column focus management.\n const hoursRef = useRef<WheelHandle>(null);\n const minutesRef = useRef<WheelHandle>(null);\n const secondsRef = useRef<WheelHandle>(null);\n const ampmRef = useRef<WheelHandle>(null);\n\n // Build the focus order at runtime.\n const columnOrder: React.RefObject<WheelHandle | null>[] = [];\n columnOrder.push(hoursRef);\n columnOrder.push(minutesRef);\n if (enableSeconds) columnOrder.push(secondsRef);\n if (hourFormat === '12') columnOrder.push(ampmRef);\n const focusAt = (i: number) => columnOrder[i]?.current?.focus();\n const indexOf = (r: React.RefObject<WheelHandle | null>): number =>\n columnOrder.indexOf(r);\n const focusPrevOf = (r: React.RefObject<WheelHandle | null>) => () =>\n focusAt(indexOf(r) - 1);\n const focusNextOf = (r: React.RefObject<WheelHandle | null>) => () =>\n focusAt(indexOf(r) + 1);\n\n // Hour change — translate displayed value back into 24h.\n const onHourIndex = (next: number) => {\n const display =\n hourValues[Math.max(0, Math.min(hourValues.length - 1, next))];\n let next24 = display;\n if (hourFormat === '12') {\n const baseHour = display % 12;\n next24 = isPm ? baseHour + 12 : baseHour;\n }\n // Skip past any blocked hour using nextValid.\n const allowed = nextValid(next24, next24 >= value.hours ? 1 : -1, 24, h =>\n isTimeAllowed(h, value.minutes, value.seconds ?? 0)\n );\n commit({ hours: allowed });\n };\n\n const onMinuteIndex = (next: number) => {\n const m =\n minuteValues[Math.max(0, Math.min(minuteValues.length - 1, next))];\n const allowed = nextValid(m, m >= value.minutes ? 1 : -1, 60, mm =>\n isTimeAllowed(value.hours, mm, value.seconds ?? 0)\n );\n commit({ minutes: allowed });\n };\n\n const onSecondIndex = (next: number) => {\n const s =\n secondValues[Math.max(0, Math.min(secondValues.length - 1, next))];\n const allowed = nextValid(s, s >= (value.seconds ?? 0) ? 1 : -1, 60, ss =>\n isTimeAllowed(value.hours, value.minutes, ss)\n );\n commit({ seconds: allowed });\n };\n\n const onAmpmIndex = (next: number) => {\n if (next === ampmIndex) return;\n commit({ hours: (value.hours + 12) % 24 });\n };\n\n // Forward drags that originate on the empty space inside the wheels row\n // (left of the leftmost wheel, right of the rightmost wheel, on the\n // separator) to whichever wheel column is nearest to the pointer X — so\n // the picker behaves like the iOS native one, where the whole picker\n // surface is grabbable, not just the column itself.\n const onWheelsContainerPointerDown = (\n e: React.PointerEvent<HTMLDivElement>\n ) => {\n if (disabled) return;\n // If the pointerdown landed on a real wheel column, the wheel's own\n // handler takes over — don't double-dispatch.\n if ((e.target as HTMLElement).closest(`.${wheelSingleClass}`)) return;\n const container = wheelsContainerRef.current;\n /* istanbul ignore next: the handler is attached to the very element this ref points to, so it can't be null while events fire */\n if (!container) return;\n const wheels = container.querySelectorAll<HTMLElement>(\n `.${wheelSingleClass}`\n );\n if (wheels.length === 0) return;\n let nearestIdx = 0;\n let nearestDist = Infinity;\n const x = e.clientX;\n wheels.forEach((el, i) => {\n const r = el.getBoundingClientRect();\n const cx = (r.left + r.right) / 2;\n const d = Math.abs(x - cx);\n if (d < nearestDist) {\n nearestDist = d;\n nearestIdx = i;\n }\n });\n columnOrder[nearestIdx]?.current?.startDrag(e.pointerId, e.clientY);\n };\n\n return (\n // A time reads left to right in the locales that mirror the page, the\n // same as PinInput's boxes. Otherwise the wheels reverse and 10:30\n // reads 30 : 10.\n <div\n id={id}\n className={classNames(rootClass, className)}\n dir=\"ltr\"\n aria-disabled={disabled}\n >\n <div\n className={wheelsClass}\n ref={wheelsContainerRef}\n onPointerDown={onWheelsContainerPointerDown}\n >\n <Wheel\n ref={hoursRef}\n values={hourValues}\n index={hourIndex}\n onChange={onHourIndex}\n formatLabel={pad2}\n ariaLabel={t.hours}\n visibleCount={visibleCount}\n itemHeight={itemHeight}\n disabled={disabled}\n size={size}\n color={color}\n wrap\n onCommit={onCommit}\n onFocusPrev={focusPrevOf(hoursRef)}\n onFocusNext={focusNextOf(hoursRef)}\n disabledFor={hourDisabledFor}\n audioTick={audioTick}\n />\n <div className={sepClass} aria-hidden=\"true\">\n :\n </div>\n <Wheel\n ref={minutesRef}\n values={minuteValues}\n index={minuteIndex}\n onChange={onMinuteIndex}\n formatLabel={pad2}\n ariaLabel={t.minutes}\n visibleCount={visibleCount}\n itemHeight={itemHeight}\n disabled={disabled}\n size={size}\n color={color}\n wrap\n onCommit={onCommit}\n onFocusPrev={focusPrevOf(minutesRef)}\n onFocusNext={focusNextOf(minutesRef)}\n disabledFor={minuteDisabledFor}\n audioTick={audioTick}\n />\n {enableSeconds && (\n <>\n <div className={sepClass} aria-hidden=\"true\">\n :\n </div>\n <Wheel\n ref={secondsRef}\n values={secondValues}\n index={secondIndex}\n onChange={onSecondIndex}\n formatLabel={pad2}\n ariaLabel={t.seconds}\n visibleCount={visibleCount}\n itemHeight={itemHeight}\n disabled={disabled}\n size={size}\n color={color}\n wrap\n onCommit={onCommit}\n onFocusPrev={focusPrevOf(secondsRef)}\n onFocusNext={focusNextOf(secondsRef)}\n disabledFor={secondDisabledFor}\n audioTick={audioTick}\n />\n </>\n )}\n {hourFormat === '12' && (\n <Wheel\n ref={ampmRef}\n values={['AM', 'PM']}\n index={ampmIndex}\n onChange={onAmpmIndex}\n formatLabel={v => v}\n ariaLabel={t.ampm}\n visibleCount={visibleCount}\n itemHeight={itemHeight}\n disabled={disabled}\n size={size}\n color={color}\n onCommit={onCommit}\n onFocusPrev={focusPrevOf(ampmRef)}\n onFocusNext={focusNextOf(ampmRef)}\n audioTick={audioTick}\n />\n )}\n </div>\n </div>\n );\n};\n\nTimeWheels.displayName = 'TimeWheels';\n\nexport default TimeWheels;\n"],"names":["fireTickHaptic","_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;AAyEA,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,GAAW,KAAa,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG;AAExE;;;;AAIG;AACH,SAAS,SAAS,CAChB,KAAa,EACb,IAAY,EACZ,GAAW,EACX,IAA4B,EAAA;IAE5B,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC;AAChC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QAC5B,IAAI,IAAI,CAAC,SAAS,CAAC;AAAE,YAAA,OAA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ACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,IAAI,QACJ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,CAAC,UAAU,CAAC,EACpC,WAAW,EAAE,WAAW,CAAC,UAAU,CAAC,EACpC,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,SAAS,EAAA,CACpB,IACD,CACJ,EACA,UAAU,KAAK,IAAI,KAClBA,GAAA,CAAC,KAAK,EAAA,EACJ,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EACpB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,WAAW,EACrB,WAAW,EAAE,CAAC,IAAI,CAAC,EACnB,SAAS,EAAE,CAAC,CAAC,IAAI,EACjB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,EACjC,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,EACjC,SAAS,EAAE,SAAS,EAAA,CACpB,CACH,CAAA,EAAA,CACG,EAAA,CACF;AAEV;AAEA,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
|
|
1
|
+
{"version":3,"file":"TimeWheels.js","sources":["../../../../src/form/_pickerInternals/TimeWheels.tsx"],"sourcesContent":["/* eslint-disable react-hooks/refs --\n * This wheel/momentum picker intentionally accesses refs during render:\n * - state is mirrored into refs (positionRef, audioTickEnabledRef) so the\n * RAF/drag/tick callbacks read the latest values in lockstep with rendering\n * (refactoring to effect-synced refs would desync drag from the frame);\n * - a MediaQueryList is lazily cached in a ref (reducedMotionMqlRef);\n * - per-column Wheel handle refs build the keyboard focus order.\n * These are deliberate, established patterns; behavior is covered by unit tests\n * and certified interactively in-browser (drag, ticks, keyboard focus nav).\n */\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../../helpers/classNames';\nimport { useConfig } from '../../helpers/Config';\nimport {\n HourFormat,\n PickerLabels,\n isPopoverToggleKey,\n mergeLabels,\n} from './pickerTypes';\nimport { setTimeOfDay } from './dateUtils';\nimport { tickHaptic as fireTickHaptic } from './haptics';\nimport { playAudioTick, unlockAudioTick } from './audioTick';\n\nexport interface TimeWheelsValue {\n hours: number;\n minutes: number;\n seconds?: number;\n}\n\nexport interface TimeWheelsProps {\n value: TimeWheelsValue;\n onChange: (v: TimeWheelsValue) => void;\n hourFormat?: HourFormat;\n enableSeconds?: boolean;\n /** Step between visible values in the wheel. Default `1`. */\n incrementHours?: number;\n incrementMinutes?: number;\n incrementSeconds?: number;\n unselectableTimes?: (d: Date) => boolean;\n size?: 'small' | 'medium' | 'large';\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n disabled?: boolean;\n /**\n * Show the value and take no input that changes it. Each wheel keeps its\n * tab stop and carries `aria-readonly`, and the arrow keys between columns\n * still move focus, but no key, scroll, drag or click turns a wheel.\n */\n readOnly?: boolean;\n className?: string;\n id?: string;\n labels?: PickerLabels;\n /** Number of items visible at once (must be odd). Default 5. */\n visibleCount?: number;\n /** Item height in px. Default 32. */\n itemHeight?: number;\n /**\n * Play a short audible tick on each item crossing. Useful as a fallback on\n * iOS Safari, where there is no web-accessible haptic API. Off by default\n * to avoid surprising users with sound; flip on for iOS-targeted UIs.\n */\n audioTick?: boolean;\n /**\n * Fired when the user presses Enter on a wheel column. The current value is\n * already committed (each wheel-tick calls onChange), so this typically just\n * needs to close the surrounding popover.\n */\n onCommit?: () => void;\n}\n\nconst wrap = (n: number, max: number): number => ((n % max) + max) % max;\n\n/**\n * Walk forward (or backward) from `start` in `step` steps until `test` returns\n * true or we've cycled all `max` candidates. Used to skip past unselectable\n * values without freezing the wheel.\n */\nfunction nextValid(\n start: number,\n step: number,\n max: number,\n test: (n: number) => boolean\n): number {\n let candidate = wrap(start, max);\n for (let i = 0; i < max; i++) {\n if (test(candidate)) return candidate;\n candidate = wrap(candidate + step, max);\n }\n return start;\n}\n\nconst pad2 = (n: number): string => String(n).padStart(2, '0');\n\ninterface WheelHandle {\n focus: () => void;\n /**\n * Begin a drag externally — used by the parent's empty-space forwarder so\n * the user can grab the wheel by touching anywhere in the wheels row, not\n * just on the column itself (matches iOS native picker behavior).\n *\n * The pointer must already be active (i.e., a real `pointerdown` is in\n * flight). We immediately capture the pointer on the wheel root so the\n * existing `onPointerMove` / `onPointerUp` handlers will fire here.\n */\n startDrag: (pointerId: number, clientY: number) => void;\n}\n\ninterface WheelProps<T> {\n values: T[];\n index: number;\n onChange: (nextIndex: number) => void;\n formatLabel: (v: T) => string;\n formatAriaText?: (v: T) => string;\n ariaLabel: string;\n visibleCount: number;\n itemHeight: number;\n disabled?: boolean;\n /** Keep the tab stop but take no input that turns the wheel. */\n readOnly?: boolean;\n size?: 'small' | 'medium' | 'large';\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n onFocusPrev?: () => void;\n onFocusNext?: () => void;\n /** Fired when Enter is pressed (current value is already committed live). */\n onCommit?: () => void;\n /**\n * Whether the wheel wraps at the edges. When true, scrolling past the last\n * value rolls back to the first (and vice versa) and neighbouring values\n * are visible above the first / below the last item.\n */\n wrap?: boolean;\n /**\n * Optional predicate. Items for which it returns `true` are rendered with\n * the `disabled` attribute (and visually dimmed via the `:disabled` SCSS\n * rule), giving users a clear cue that the value is blocked. Keyboard /\n * wheel navigation may still pass over these positions, but `onChange`\n * callers (`TimeWheels`) skip them via `nextValid`.\n */\n disabledFor?: (v: T) => boolean;\n /**\n * Play an audible tick on each item crossing. Used as the iOS substitute\n * for haptic feedback; threaded from `TimeWheels.audioTick`.\n */\n audioTick?: boolean;\n}\n\nconst WheelInner = <T,>(\n {\n values,\n index,\n onChange,\n formatLabel,\n formatAriaText,\n ariaLabel,\n visibleCount,\n itemHeight,\n disabled,\n readOnly,\n size,\n color,\n onFocusPrev,\n onFocusNext,\n onCommit,\n wrap = false,\n disabledFor,\n audioTick = false,\n }: WheelProps<T>,\n ref: React.Ref<WheelHandle>\n) => {\n const { classPrefix } = useConfig();\n // Disabled or read-only, nothing the user does turns the wheel. Only\n // disabled takes it out of the tab order and dims it.\n const locked = disabled || readOnly;\n const N = values.length;\n const half = Math.floor(visibleCount / 2);\n const containerHeight = visibleCount * itemHeight;\n // Buffer around the visible window so adjacent items animate in/out smoothly.\n const BUFFER = half + 2;\n\n // Continuous wheel position in units of items. Math.round(position) is the\n // \"active\" virtual index; the fractional part is the drag/momentum offset\n // within an item slot. Using a single float (rather than virtualIdx +\n // dragOffset) keeps drag and tick-update in lockstep so items move with the\n // finger without a 40px overshoot when crossing item boundaries.\n const [position, setPosition] = useState<number>(index);\n const positionRef = useRef<number>(index);\n positionRef.current = position;\n const [isDragging, setIsDragging] = useState(false);\n const rootRef = useRef<HTMLDivElement>(null);\n // Ref to the stationary selection band — populated by the JSX below. The\n // band briefly scales + brightens on each item tick so users perceive a\n // body-felt \"thunk\" even on iOS where no haptic API exists.\n const bandRef = useRef<HTMLDivElement>(null);\n // Cached MediaQueryList for `prefers-reduced-motion`. We read this on\n // every tick to decide whether to fire the band pulse; caching the MQL\n // saves a `matchMedia` call per tick (which can fire at ~20Hz during a\n // momentum flick).\n const reducedMotionMqlRef = useRef<MediaQueryList | null>(null);\n if (\n reducedMotionMqlRef.current === null &&\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function'\n ) {\n reducedMotionMqlRef.current = window.matchMedia(\n '(prefers-reduced-motion: reduce)'\n );\n }\n // In-flight band pulse animation (Web Animations API). Tracked so we can\n // cancel on unmount; the WAI's `composite: 'replace'` semantics handle\n // re-trigger automatically without us needing to cancel between ticks.\n const pulseAnimRef = useRef<Animation | null>(null);\n // True while the external `index` prop sync useEffect runs, so we don't\n // fire a haptic blip when the parent updates the value programmatically.\n const isSyncingRef = useRef<boolean>(false);\n\n // Tiny haptic/audio/visual blip per item tick. Haptic uses\n // `navigator.vibrate` where available (Android Chrome / Firefox Android /\n // Samsung Internet); iOS has no web-accessible haptic path as of May\n // 2026, so the optional `audioTick` plays a low-frequency thunk as the\n // closest UX substitute. The visual band-pulse fires on every tick on\n // every platform (gated only by `prefers-reduced-motion`) so the\n // selection band feels reactive — visual reinforcement of the tactile\n // feedback. We skip all three during programmatic prop sync so a parent\n // re-render doesn't blip.\n const audioTickEnabledRef = useRef<boolean>(audioTick);\n audioTickEnabledRef.current = audioTick;\n const playBandPulse = useCallback(() => {\n const el = bandRef.current;\n if (!el || typeof el.animate !== 'function') return;\n if (reducedMotionMqlRef.current?.matches) return;\n // Compound scale + brightness pulse, peaking at 40% through the 110ms\n // duration. `composite: 'replace'` means a re-trigger mid-pulse cleanly\n // restarts rather than queueing — important at fling rates where ticks\n // can fire every ~50ms.\n pulseAnimRef.current = el.animate(\n [\n { transform: 'scale(1)', filter: 'brightness(1)' },\n {\n transform: 'scale(1.04)',\n filter: 'brightness(1.15)',\n offset: 0.4,\n },\n { transform: 'scale(1)', filter: 'brightness(1)' },\n ],\n { duration: 110, easing: 'ease-out', composite: 'replace' }\n );\n }, []);\n const tickFeedback = useCallback(() => {\n /* istanbul ignore next: the sync flag is only true synchronously inside the prop-sync effect, which sets position directly and never routes through commitPosition */\n if (isSyncingRef.current) return;\n fireTickHaptic();\n if (audioTickEnabledRef.current) playAudioTick();\n playBandPulse();\n }, [playBandPulse]);\n const dragStateRef = useRef<{\n pointerId: number | null;\n startY: number;\n startPosition: number;\n captured: boolean;\n samples: { t: number; y: number }[];\n }>({\n pointerId: null,\n startY: 0,\n startPosition: 0,\n captured: false,\n samples: [],\n });\n // RAF id for the in-flight momentum / snap animation, so we can cancel when\n // the user grabs the wheel again or the component unmounts.\n const rafIdRef = useRef<number | null>(null);\n\n const virtualIdx = Math.round(position);\n\n const cancelRaf = useCallback(() => {\n if (rafIdRef.current !== null) {\n cancelAnimationFrame(rafIdRef.current);\n rafIdRef.current = null;\n }\n }, []);\n\n useEffect(\n () => () => {\n cancelRaf();\n // Cancel any in-flight band pulse so it doesn't keep a reference to\n // a detached DOM node. WAI Animation.cancel() is safe to call even\n // if the animation has already finished.\n pulseAnimRef.current?.cancel();\n pulseAnimRef.current = null;\n },\n [cancelRaf]\n );\n\n React.useImperativeHandle(\n ref,\n () => ({\n focus: () => rootRef.current?.focus(),\n startDrag: (pointerId: number, clientY: number) => {\n /* istanbul ignore next: the empty-space forwarder (sole caller) already returns on the same flags */\n if (locked) return;\n cancelRaf();\n if (audioTickEnabledRef.current) unlockAudioTick();\n const now =\n typeof performance !== 'undefined' ? performance.now() : Date.now();\n dragStateRef.current = {\n pointerId,\n startY: clientY,\n startPosition: positionRef.current,\n // Skip the drag-threshold gate: the parent forwarder has already\n // decided this is a drag (a pointerdown landed on empty space,\n // which has no click target).\n captured: true,\n samples: [{ t: now, y: clientY }],\n };\n try {\n rootRef.current?.setPointerCapture(pointerId);\n } catch {\n // setPointerCapture can throw if the pointer isn't currently\n // active for this element; the existing onPointerMove handler\n // still matches on pointerId so the drag will work either way.\n }\n setIsDragging(true);\n },\n }),\n [locked, cancelRaf]\n );\n\n // Resolve a virtualIdx into an actual values[] index (modulo wrap if `wrap`).\n const toActual = useCallback(\n (v: number) => {\n if (wrap) return ((v % N) + N) % N;\n return Math.max(0, Math.min(N - 1, v));\n },\n [wrap, N]\n );\n\n const clampPosition = useCallback(\n (p: number) => {\n if (wrap) return p;\n return Math.max(0, Math.min(N - 1, p));\n },\n [wrap, N]\n );\n\n // Update position and fire onChange if the rounded value changed.\n const commitPosition = useCallback(\n (next: number) => {\n const clamped = clampPosition(next);\n const prevRound = Math.round(positionRef.current);\n const nextRound = Math.round(clamped);\n positionRef.current = clamped;\n setPosition(clamped);\n if (nextRound !== prevRound) {\n onChange(toActual(nextRound));\n tickFeedback();\n }\n },\n [clampPosition, onChange, toActual, tickFeedback]\n );\n\n // When the external `index` changes (e.g. from typed input), re-sync\n // position to the closest virtual position that maps to it.\n //\n // Crucial subtlety: this effect re-runs every time the parent value\n // changes — including the round-trip case where the user's own scroll\n // commits a tick → fires onChange → parent re-renders with the new\n // index → here. If we cancelled the in-flight momentum/snap RAF on\n // every such echo, the snap would never get to land on an integer\n // (the user's wheel would stop wherever the last tick fired). So we\n // bail out early when the rounded position already matches the\n // incoming index — the echo case — and only cancel + apply an actual\n // jump when the parent has moved us somewhere we don't already round\n // to.\n useEffect(() => {\n const prev = positionRef.current;\n const wrappedRoundPrev = ((Math.round(prev) % N) + N) % N;\n if (wrappedRoundPrev === index) return;\n cancelRaf();\n isSyncingRef.current = true;\n setPosition(prevPos => {\n if (!wrap) {\n positionRef.current = index;\n return index;\n }\n const wrappedPrev = ((prevPos % N) + N) % N;\n const forward = (index - wrappedPrev + N) % N;\n const backward = forward - N;\n const delta =\n Math.abs(forward) <= Math.abs(backward) ? forward : backward;\n const next = prevPos + delta;\n positionRef.current = next;\n return next;\n });\n isSyncingRef.current = false;\n }, [index, N, wrap, cancelRaf]);\n\n const moveBy = useCallback(\n (delta: number) => {\n if (locked) return;\n cancelRaf();\n commitPosition(Math.round(positionRef.current) + delta);\n },\n [locked, cancelRaf, commitPosition]\n );\n\n // The keys are a spinbutton's: up raises the value and down lowers it. The\n // values run down the wheel, so up brings the one below the band into it,\n // the way a drag or a scroll that moves the items up does.\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (isPopoverToggleKey(e)) return;\n switch (e.key) {\n case 'ArrowUp':\n e.preventDefault();\n moveBy(1);\n break;\n case 'ArrowDown':\n e.preventDefault();\n moveBy(-1);\n break;\n case 'PageUp':\n e.preventDefault();\n moveBy(5);\n break;\n case 'PageDown':\n e.preventDefault();\n moveBy(-5);\n break;\n case 'Home':\n e.preventDefault();\n if (locked) break;\n cancelRaf();\n commitPosition(0);\n break;\n case 'End':\n e.preventDefault();\n if (locked) break;\n cancelRaf();\n commitPosition(N - 1);\n break;\n case 'ArrowLeft':\n e.preventDefault();\n onFocusPrev?.();\n break;\n case 'ArrowRight':\n e.preventDefault();\n onFocusNext?.();\n break;\n case 'Enter':\n e.preventDefault();\n onCommit?.();\n break;\n }\n },\n [\n moveBy,\n locked,\n commitPosition,\n cancelRaf,\n N,\n onFocusPrev,\n onFocusNext,\n onCommit,\n ]\n );\n\n // Animate position to the nearest integer with ease-out cubic. Used after a\n // drag / momentum settles, so the wheel always rests aligned to an item.\n const animateSnap = useCallback(() => {\n cancelRaf();\n const start = positionRef.current;\n const target = Math.round(start);\n if (start === target) return;\n const duration = 180;\n const startTime =\n typeof performance !== 'undefined' ? performance.now() : Date.now();\n const tick = (now: number) => {\n const t = Math.min(1, (now - startTime) / duration);\n const eased = 1 - Math.pow(1 - t, 3);\n const next = start + (target - start) * eased;\n commitPosition(next);\n if (t < 1) {\n rafIdRef.current = requestAnimationFrame(tick);\n } else {\n rafIdRef.current = null;\n }\n };\n rafIdRef.current = requestAnimationFrame(tick);\n }, [cancelRaf, commitPosition]);\n\n // Kinetic momentum after a flick. Uses exponential friction so the velocity\n // tapers smoothly. Updates `position` in items/ms; commitPosition handles\n // the onChange ticks as virtualIdx crosses integers.\n const startMomentum = useCallback(\n (initialPxPerMs: number) => {\n cancelRaf();\n // Drag-up (negative dy/dt in screen coords) should INCREASE position\n // (later values come into view), so flip the sign.\n let velocity = -initialPxPerMs / itemHeight; // items / ms\n // Cap initial velocity so a frantic swipe doesn't blast through the\n // whole list. Empirically tuned to match iOS feel.\n const MAX_VEL = 0.05; // items/ms (≈ 50 items/sec)\n if (velocity > MAX_VEL) velocity = MAX_VEL;\n if (velocity < -MAX_VEL) velocity = -MAX_VEL;\n const STOP_VEL = 0.0015; // items/ms (≈ 1.5 items/sec)\n // Friction coefficient per millisecond — chosen so velocity halves\n // every ~120ms.\n const FRICTION_PER_MS = Math.pow(0.5, 1 / 120);\n let lastTime =\n typeof performance !== 'undefined' ? performance.now() : Date.now();\n const tick = (now: number) => {\n const dt = Math.max(1, now - lastTime);\n lastTime = now;\n let next = positionRef.current + velocity * dt;\n // Boundary handling for non-wrapping wheels: clamp and zero the\n // velocity so we don't keep ticking against the wall.\n if (!wrap) {\n if (next <= 0) {\n next = 0;\n velocity = 0;\n } else if (next >= N - 1) {\n next = N - 1;\n velocity = 0;\n }\n }\n commitPosition(next);\n velocity *= Math.pow(FRICTION_PER_MS, dt);\n if (Math.abs(velocity) < STOP_VEL) {\n animateSnap();\n return;\n }\n rafIdRef.current = requestAnimationFrame(tick);\n };\n rafIdRef.current = requestAnimationFrame(tick);\n },\n [cancelRaf, commitPosition, itemHeight, wrap, N, animateSnap]\n );\n\n // Mouse wheel: accumulate deltaY across events and step when the\n // accumulator crosses SCROLL_STEP_PX. Trackpads emit dozens of small\n // events per swipe; without accumulation a single gesture flies the wheel.\n useEffect(() => {\n const el = rootRef.current;\n if (!el || locked) return undefined;\n const SCROLL_STEP_PX = 60;\n const QUIET_MS = 250;\n let accumulated = 0;\n let resetTimer: ReturnType<typeof setTimeout> | null = null;\n const resetAccumulator = () => {\n accumulated = 0;\n };\n const onWheel = (e: WheelEvent) => {\n e.preventDefault();\n // Reset accumulator if scroll direction reversed mid-gesture.\n if (accumulated !== 0 && Math.sign(accumulated) !== Math.sign(e.deltaY)) {\n accumulated = 0;\n }\n accumulated += e.deltaY;\n while (Math.abs(accumulated) >= SCROLL_STEP_PX) {\n if (accumulated > 0) {\n moveBy(1);\n accumulated -= SCROLL_STEP_PX;\n } else {\n moveBy(-1);\n accumulated += SCROLL_STEP_PX;\n }\n }\n if (resetTimer) clearTimeout(resetTimer);\n resetTimer = setTimeout(resetAccumulator, QUIET_MS);\n };\n el.addEventListener('wheel', onWheel, { passive: false });\n return () => {\n el.removeEventListener('wheel', onWheel);\n if (resetTimer) clearTimeout(resetTimer);\n };\n }, [moveBy, locked]);\n\n // Pointer drag.\n // We DELAY capturing the pointer until the user moves more than\n // DRAG_THRESHOLD_PX. Without this, capturing on pointerdown would redirect\n // mouseup → wheel root, which suppresses the click event on the item button\n // the user pressed (so single-clicks on neighbouring items would no-op).\n const DRAG_THRESHOLD_PX = 4;\n const onPointerDown = (e: React.PointerEvent<HTMLDivElement>) => {\n if (locked) return;\n cancelRaf();\n if (audioTickEnabledRef.current) {\n // Resume the AudioContext from inside the user gesture so the first\n // tick of this drag can play (iOS Safari requires this; other browsers\n // are forgiving but it's a cheap idempotent call).\n unlockAudioTick();\n }\n const now =\n typeof performance !== 'undefined' ? performance.now() : Date.now();\n dragStateRef.current = {\n pointerId: e.pointerId,\n startY: e.clientY,\n startPosition: positionRef.current,\n captured: false,\n samples: [{ t: now, y: e.clientY }],\n };\n };\n const onPointerMove = (e: React.PointerEvent<HTMLDivElement>) => {\n const s = dragStateRef.current;\n if (s.pointerId !== e.pointerId) return;\n const dy = e.clientY - s.startY;\n if (!s.captured) {\n if (Math.abs(dy) < DRAG_THRESHOLD_PX) return;\n rootRef.current?.setPointerCapture(e.pointerId);\n s.captured = true;\n setIsDragging(true);\n }\n const now =\n typeof performance !== 'undefined' ? performance.now() : Date.now();\n s.samples.push({ t: now, y: e.clientY });\n // Keep the velocity sample window short so the post-flick velocity\n // reflects the *recent* finger speed, not the whole-drag average.\n const VELOCITY_WINDOW_MS = 100;\n while (s.samples.length > 2 && now - s.samples[0].t > VELOCITY_WINDOW_MS) {\n s.samples.shift();\n }\n // Continuous position: every itemHeight worth of finger drag advances\n // the wheel by 1 unit. Pulling the finger DOWN (positive dy) shows\n // EARLIER values, which means position decreases.\n commitPosition(s.startPosition - dy / itemHeight);\n };\n const onPointerUp = (e: React.PointerEvent<HTMLDivElement>) => {\n const s = dragStateRef.current;\n if (s.pointerId !== e.pointerId) return;\n if (s.captured) {\n rootRef.current?.releasePointerCapture(e.pointerId);\n // Drags don't fire click → focus would be left on whichever child\n // received pointerdown. Pull it back to the wheel root so :focus\n // emphasis still reads correctly after a drag.\n rootRef.current?.focus();\n // Compute fling velocity from the recent sample window.\n const samples = s.samples;\n let pxPerMs = 0;\n if (samples.length >= 2) {\n const first = samples[0];\n const last = samples[samples.length - 1];\n const dt = last.t - first.t;\n if (dt > 0) pxPerMs = (last.y - first.y) / dt;\n }\n // Threshold below which we just snap to the nearest item; above which\n // we kick off momentum.\n const FLING_THRESHOLD = 0.25; // px/ms ≈ 250 px/sec\n if (Math.abs(pxPerMs) > FLING_THRESHOLD) {\n startMomentum(pxPerMs);\n } else {\n animateSnap();\n }\n }\n s.pointerId = null;\n s.captured = false;\n s.samples = [];\n setIsDragging(false);\n };\n\n const rootClass = prefixedClassNames(classPrefix, 'timeinput-wheel', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-disabled': disabled,\n 'is-dragging': isDragging,\n });\n const itemClass = (selected: boolean) =>\n prefixedClassNames(classPrefix, 'timeinput-wheel-item', {\n 'is-selected': selected,\n [`is-${color}`]: selected && !!color,\n });\n const bandClass = prefixedClassNames(classPrefix, 'timeinput-wheel-band', {\n [`is-${color}`]: !!color,\n });\n\n // Build the buffered window of items to render around the current position.\n const items: { vIdx: number; aIdx: number }[] = [];\n for (let off = -BUFFER; off <= BUFFER; off++) {\n const vIdx = virtualIdx + off;\n if (!wrap && (vIdx < 0 || vIdx >= N)) continue;\n const aIdx = toActual(vIdx);\n items.push({ vIdx, aIdx });\n }\n\n const ariaText = formatAriaText\n ? formatAriaText(values[toActual(virtualIdx)])\n : formatLabel(values[toActual(virtualIdx)]);\n\n // Center of the wheel viewport, in px from the top.\n const centreTop = containerHeight / 2 - itemHeight / 2;\n\n return (\n <div\n ref={rootRef}\n role=\"spinbutton\"\n aria-label={ariaLabel}\n aria-valuemin={0}\n aria-valuemax={N - 1}\n aria-valuenow={toActual(virtualIdx)}\n aria-valuetext={ariaText}\n aria-readonly={readOnly || undefined}\n tabIndex={disabled ? -1 : 0}\n className={rootClass}\n style={{ height: containerHeight }}\n onKeyDown={onKeyDown}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n >\n {/* Stationary selection band — sits at the centre of the viewport while\n items slide through it, like the iOS native picker. The ref lets\n `playBandPulse` animate scale + brightness on each item tick. */}\n <div\n ref={bandRef}\n className={bandClass}\n aria-hidden=\"true\"\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n top: centreTop,\n height: itemHeight,\n pointerEvents: 'none',\n }}\n />\n {items.map(({ vIdx, aIdx }) => {\n // Continuous offset in items: items at the centre have offset ≈ 0;\n // top of viewport is negative, bottom positive.\n const offCentreItems = vIdx - position;\n const top = centreTop + offCentreItems * itemHeight;\n const selected = vIdx === virtualIdx;\n const itemDisabled =\n disabled || (disabledFor ? disabledFor(values[aIdx]) : false);\n return (\n <button\n key={vIdx}\n type=\"button\"\n // A spinbutton owns no options: it states its value through\n // aria-valuetext, so the items are pointer targets only.\n aria-hidden=\"true\"\n tabIndex={-1}\n className={itemClass(selected)}\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n height: itemHeight,\n top: `${top}px`,\n }}\n disabled={itemDisabled}\n // Keep a press from focusing the item, which assistive technology\n // can't see; the click below hands focus to the wheel instead.\n onMouseDown={e => e.preventDefault()}\n onClick={() => {\n moveBy(vIdx - virtualIdx);\n // Click focuses the <button> child by default; pull focus back\n // to the wheel root so the column emphasis (:focus rules) match.\n rootRef.current?.focus();\n }}\n >\n {formatLabel(values[aIdx])}\n </button>\n );\n })}\n </div>\n );\n};\n\nconst Wheel = React.forwardRef(WheelInner) as <T>(\n props: WheelProps<T> & { ref?: React.Ref<WheelHandle> }\n) => React.ReactElement;\n\nexport const TimeWheels: React.FC<TimeWheelsProps> = ({\n value,\n onChange,\n hourFormat = '24',\n enableSeconds = false,\n incrementHours = 1,\n incrementMinutes = 1,\n incrementSeconds = 1,\n unselectableTimes,\n size,\n color,\n disabled,\n readOnly,\n className,\n id,\n labels,\n visibleCount = 5,\n itemHeight = 32,\n audioTick = false,\n onCommit,\n}) => {\n const t = mergeLabels(labels);\n\n const rootClass = usePrefixedClassNames('timeinput', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-disabled': disabled,\n });\n const wheelsClass = usePrefixedClassNames('timeinput-wheels');\n const sepClass = usePrefixedClassNames('timeinput-separator');\n // Use the prefixed class through the same helper the wheels themselves do,\n // so the selector matches the actual rendered class regardless of whether\n // the consumer configured `classPrefix` via ConfigProvider. Building the\n // selector with `${classPrefix}timeinput-wheel` is wrong when classPrefix\n // is undefined (defaults to the empty prefix) — it would stringify to\n // \"undefinedtimeinput-wheel\".\n const wheelSingleClass = usePrefixedClassNames('timeinput-wheel');\n const wheelsContainerRef = useRef<HTMLDivElement>(null);\n\n const isPm = value.hours >= 12;\n\n const isTimeAllowed = useCallback(\n (h: number, m: number, s: number) => {\n if (!unselectableTimes) return true;\n const probe = setTimeOfDay(new Date(), {\n hours: h,\n minutes: m,\n seconds: s,\n milliseconds: 0,\n });\n return !unselectableTimes(probe);\n },\n [unselectableTimes]\n );\n\n // Per-column \"is this value disabled?\" predicates. We compute them against\n // the current value's other parts, so e.g. a predicate that only blocks\n // 12:00–12:59 leaves all minutes selectable when the user moves the hour\n // off 12. Returning `undefined` (rather than a function) when there is no\n // unselectableTimes lets the Wheel skip the disabled-attribute branch.\n const isHourDisabled = useCallback(\n (display: number) => {\n let h24 = display;\n if (hourFormat === '12') {\n const base = display % 12;\n h24 = isPm ? base + 12 : base;\n }\n return !isTimeAllowed(h24, value.minutes, value.seconds ?? 0);\n },\n [hourFormat, isPm, isTimeAllowed, value.minutes, value.seconds]\n );\n const isMinuteDisabled = useCallback(\n (m: number) => !isTimeAllowed(value.hours, m, value.seconds ?? 0),\n [isTimeAllowed, value.hours, value.seconds]\n );\n const isSecondDisabled = useCallback(\n (s: number) => !isTimeAllowed(value.hours, value.minutes, s),\n [isTimeAllowed, value.hours, value.minutes]\n );\n const hourDisabledFor = unselectableTimes ? isHourDisabled : undefined;\n const minuteDisabledFor = unselectableTimes ? isMinuteDisabled : undefined;\n const secondDisabledFor = unselectableTimes ? isSecondDisabled : undefined;\n\n const commit = useCallback(\n (next: Partial<TimeWheelsValue>) => {\n const merged: TimeWheelsValue = {\n hours: next.hours ?? value.hours,\n minutes: next.minutes ?? value.minutes,\n seconds: enableSeconds\n ? (next.seconds ?? value.seconds ?? 0)\n : undefined,\n };\n if (!isTimeAllowed(merged.hours, merged.minutes, merged.seconds ?? 0)) {\n return;\n }\n onChange(merged);\n },\n [value, enableSeconds, isTimeAllowed, onChange]\n );\n\n // Build the value lists per column.\n const hourValues = useMemo<number[]>(() => {\n const step = Math.max(1, incrementHours);\n if (hourFormat === '12') {\n const out: number[] = [];\n for (let h = 1; h <= 12; h += step) out.push(h);\n return out;\n }\n const out: number[] = [];\n for (let h = 0; h < 24; h += step) out.push(h);\n return out;\n }, [hourFormat, incrementHours]);\n\n const minuteValues = useMemo<number[]>(() => {\n const step = Math.max(1, incrementMinutes);\n const out: number[] = [];\n for (let m = 0; m < 60; m += step) out.push(m);\n return out;\n }, [incrementMinutes]);\n\n const secondValues = useMemo<number[]>(() => {\n const step = Math.max(1, incrementSeconds);\n const out: number[] = [];\n for (let s = 0; s < 60; s += step) out.push(s);\n return out;\n }, [incrementSeconds]);\n\n // Map current value → wheel index.\n const displayedHours =\n hourFormat === '12'\n ? value.hours % 12 === 0\n ? 12\n : value.hours % 12\n : value.hours;\n const hourIndex = Math.max(0, hourValues.indexOf(displayedHours));\n const minuteIndex = Math.max(0, minuteValues.indexOf(value.minutes));\n const secondIndex = Math.max(0, secondValues.indexOf(value.seconds ?? 0));\n const ampmIndex = isPm ? 1 : 0;\n\n // Refs for column focus management.\n const hoursRef = useRef<WheelHandle>(null);\n const minutesRef = useRef<WheelHandle>(null);\n const secondsRef = useRef<WheelHandle>(null);\n const ampmRef = useRef<WheelHandle>(null);\n\n // Build the focus order at runtime.\n const columnOrder: React.RefObject<WheelHandle | null>[] = [];\n columnOrder.push(hoursRef);\n columnOrder.push(minutesRef);\n if (enableSeconds) columnOrder.push(secondsRef);\n if (hourFormat === '12') columnOrder.push(ampmRef);\n const focusAt = (i: number) => columnOrder[i]?.current?.focus();\n const indexOf = (r: React.RefObject<WheelHandle | null>): number =>\n columnOrder.indexOf(r);\n const focusPrevOf = (r: React.RefObject<WheelHandle | null>) => () =>\n focusAt(indexOf(r) - 1);\n const focusNextOf = (r: React.RefObject<WheelHandle | null>) => () =>\n focusAt(indexOf(r) + 1);\n\n // Hour change — translate displayed value back into 24h.\n const onHourIndex = (next: number) => {\n const display =\n hourValues[Math.max(0, Math.min(hourValues.length - 1, next))];\n let next24 = display;\n if (hourFormat === '12') {\n const baseHour = display % 12;\n next24 = isPm ? baseHour + 12 : baseHour;\n }\n // Skip past any blocked hour using nextValid.\n const allowed = nextValid(next24, next24 >= value.hours ? 1 : -1, 24, h =>\n isTimeAllowed(h, value.minutes, value.seconds ?? 0)\n );\n commit({ hours: allowed });\n };\n\n const onMinuteIndex = (next: number) => {\n const m =\n minuteValues[Math.max(0, Math.min(minuteValues.length - 1, next))];\n const allowed = nextValid(m, m >= value.minutes ? 1 : -1, 60, mm =>\n isTimeAllowed(value.hours, mm, value.seconds ?? 0)\n );\n commit({ minutes: allowed });\n };\n\n const onSecondIndex = (next: number) => {\n const s =\n secondValues[Math.max(0, Math.min(secondValues.length - 1, next))];\n const allowed = nextValid(s, s >= (value.seconds ?? 0) ? 1 : -1, 60, ss =>\n isTimeAllowed(value.hours, value.minutes, ss)\n );\n commit({ seconds: allowed });\n };\n\n const onAmpmIndex = (next: number) => {\n if (next === ampmIndex) return;\n commit({ hours: (value.hours + 12) % 24 });\n };\n\n // Forward drags that originate on the empty space inside the wheels row\n // (left of the leftmost wheel, right of the rightmost wheel, on the\n // separator) to whichever wheel column is nearest to the pointer X — so\n // the picker behaves like the iOS native one, where the whole picker\n // surface is grabbable, not just the column itself.\n const onWheelsContainerPointerDown = (\n e: React.PointerEvent<HTMLDivElement>\n ) => {\n if (disabled || readOnly) return;\n // If the pointerdown landed on a real wheel column, the wheel's own\n // handler takes over — don't double-dispatch.\n if ((e.target as HTMLElement).closest(`.${wheelSingleClass}`)) return;\n const container = wheelsContainerRef.current;\n /* istanbul ignore next: the handler is attached to the very element this ref points to, so it can't be null while events fire */\n if (!container) return;\n const wheels = container.querySelectorAll<HTMLElement>(\n `.${wheelSingleClass}`\n );\n if (wheels.length === 0) return;\n let nearestIdx = 0;\n let nearestDist = Infinity;\n const x = e.clientX;\n wheels.forEach((el, i) => {\n const r = el.getBoundingClientRect();\n const cx = (r.left + r.right) / 2;\n const d = Math.abs(x - cx);\n if (d < nearestDist) {\n nearestDist = d;\n nearestIdx = i;\n }\n });\n columnOrder[nearestIdx]?.current?.startDrag(e.pointerId, e.clientY);\n };\n\n return (\n // A time reads left to right in the locales that mirror the page, the\n // same as PinInput's boxes. Otherwise the wheels reverse and 10:30\n // reads 30 : 10.\n <div\n id={id}\n className={classNames(rootClass, className)}\n dir=\"ltr\"\n aria-disabled={disabled}\n >\n <div\n className={wheelsClass}\n ref={wheelsContainerRef}\n onPointerDown={onWheelsContainerPointerDown}\n >\n <Wheel\n ref={hoursRef}\n values={hourValues}\n index={hourIndex}\n onChange={onHourIndex}\n formatLabel={pad2}\n ariaLabel={t.hours}\n visibleCount={visibleCount}\n itemHeight={itemHeight}\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n color={color}\n wrap\n onCommit={onCommit}\n onFocusPrev={focusPrevOf(hoursRef)}\n onFocusNext={focusNextOf(hoursRef)}\n disabledFor={hourDisabledFor}\n audioTick={audioTick}\n />\n <div className={sepClass} aria-hidden=\"true\">\n :\n </div>\n <Wheel\n ref={minutesRef}\n values={minuteValues}\n index={minuteIndex}\n onChange={onMinuteIndex}\n formatLabel={pad2}\n ariaLabel={t.minutes}\n visibleCount={visibleCount}\n itemHeight={itemHeight}\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n color={color}\n wrap\n onCommit={onCommit}\n onFocusPrev={focusPrevOf(minutesRef)}\n onFocusNext={focusNextOf(minutesRef)}\n disabledFor={minuteDisabledFor}\n audioTick={audioTick}\n />\n {enableSeconds && (\n <>\n <div className={sepClass} aria-hidden=\"true\">\n :\n </div>\n <Wheel\n ref={secondsRef}\n values={secondValues}\n index={secondIndex}\n onChange={onSecondIndex}\n formatLabel={pad2}\n ariaLabel={t.seconds}\n visibleCount={visibleCount}\n itemHeight={itemHeight}\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n color={color}\n wrap\n onCommit={onCommit}\n onFocusPrev={focusPrevOf(secondsRef)}\n onFocusNext={focusNextOf(secondsRef)}\n disabledFor={secondDisabledFor}\n audioTick={audioTick}\n />\n </>\n )}\n {hourFormat === '12' && (\n <Wheel\n ref={ampmRef}\n values={['AM', 'PM']}\n index={ampmIndex}\n onChange={onAmpmIndex}\n formatLabel={v => v}\n ariaLabel={t.ampm}\n visibleCount={visibleCount}\n itemHeight={itemHeight}\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n color={color}\n onCommit={onCommit}\n onFocusPrev={focusPrevOf(ampmRef)}\n onFocusNext={focusNextOf(ampmRef)}\n audioTick={audioTick}\n />\n )}\n </div>\n </div>\n );\n};\n\nTimeWheels.displayName = 'TimeWheels';\n\nexport default TimeWheels;\n"],"names":["fireTickHaptic","_jsxs","_jsx"],"mappings":";;;;;;;;;;;AA+EA,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,GAAW,KAAa,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG;AAExE;;;;AAIG;AACH,SAAS,SAAS,CAChB,KAAa,EACb,IAAY,EACZ,GAAW,EACX,IAA4B,EAAA;IAE5B,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC;AAChC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QAC5B,IAAI,IAAI,CAAC,SAAS,CAAC;AAAE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EACf,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,aAAa,EACvB,WAAW,EAAE,IAAI,EACjB,SAAS,EAAE,CAAC,CAAC,OAAO,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,IAAI,EAAA,IAAA,EACJ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,CAAC,UAAU,CAAC,EACpC,WAAW,EAAE,WAAW,CAAC,UAAU,CAAC,EACpC,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,SAAS,EAAA,CACpB,IACD,CACJ,EACA,UAAU,KAAK,IAAI,KAClBA,GAAA,CAAC,KAAK,EAAA,EACJ,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EACpB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,WAAW,EACrB,WAAW,EAAE,CAAC,IAAI,CAAC,EACnB,SAAS,EAAE,CAAC,CAAC,IAAI,EACjB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,EACjC,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,EACjC,SAAS,EAAE,SAAS,GACpB,CACH,CAAA,EAAA,CACG,EAAA,CACF;AAEV;AAEA,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
|
|
@@ -279,6 +279,17 @@ function findTabStops(container) {
|
|
|
279
279
|
yield el;
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
+
// Only the candidates past `node` get the style checks.
|
|
283
|
+
function* after(node) {
|
|
284
|
+
for (const el of candidates) {
|
|
285
|
+
if (el.tabIndex <= 0 &&
|
|
286
|
+
!inside(node, el) &&
|
|
287
|
+
follows(container, node, el) &&
|
|
288
|
+
isStop(el)) {
|
|
289
|
+
yield el;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
282
293
|
const first = from(false).next().value;
|
|
283
294
|
if (!first)
|
|
284
295
|
return null;
|
|
@@ -287,6 +298,7 @@ function findTabStops(container) {
|
|
|
287
298
|
last: from(true).next().value,
|
|
288
299
|
stopFor: node => (isGroupedRadio(node) && groupStop(node)) || node,
|
|
289
300
|
from,
|
|
301
|
+
after,
|
|
290
302
|
};
|
|
291
303
|
}
|
|
292
304
|
/**
|
|
@@ -307,22 +319,81 @@ const focusedElement = (doc) => getDeepestActiveElement(doc) ?? doc.body;
|
|
|
307
319
|
* A stop that doesn't take focus is passed over for the next one in. An
|
|
308
320
|
* `<object>` or `<embed>` with nothing to show is one: it counts as a stop by
|
|
309
321
|
* its kind, but browsers refuse to focus it, and which ones they refuse
|
|
310
|
-
* depends on the browser and on what has loaded, so only trying tells.
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* this module, so this one stays internal.
|
|
322
|
+
* depends on the browser and on what has loaded, so only trying tells.
|
|
323
|
+
* `src/index.ts` names its exports from this module, so this one stays
|
|
324
|
+
* internal.
|
|
314
325
|
*/
|
|
315
326
|
function focusTabStop(container, fromLast = false) {
|
|
316
|
-
const doc = container.ownerDocument;
|
|
317
327
|
for (const stop of findTabStops(container)?.from(fromLast) ?? []) {
|
|
318
|
-
|
|
319
|
-
stop.focus();
|
|
320
|
-
const now = focusedElement(doc);
|
|
321
|
-
if (now !== before || inside(stop, now))
|
|
328
|
+
if (tookFocus(stop))
|
|
322
329
|
return;
|
|
323
330
|
}
|
|
324
331
|
container.focus();
|
|
325
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Focuses `stop` and says whether it took focus: focus moved, wherever it
|
|
335
|
+
* went (a stop can hand focus on), or was on it already.
|
|
336
|
+
*/
|
|
337
|
+
function tookFocus(stop) {
|
|
338
|
+
const doc = stop.ownerDocument;
|
|
339
|
+
const before = focusedElement(doc);
|
|
340
|
+
stop.focus();
|
|
341
|
+
const now = focusedElement(doc);
|
|
342
|
+
return now !== before || inside(stop, now);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* The traps holding Tab right now, each as the container it reads and whether
|
|
346
|
+
* it holds the key. `focusTabStopAfter` wraps at a trap's edge itself rather
|
|
347
|
+
* than leave the Tab to the trap, because the trap may still see the popup
|
|
348
|
+
* showing: one on its container hears the key before a React handler inside
|
|
349
|
+
* it, and in Firefox one on `window`, as Modal's is, found the popup still
|
|
350
|
+
* showing too. The trap then lets the key through from an item that isn't
|
|
351
|
+
* its last stop, and Firefox drops focus to the page as the item hides.
|
|
352
|
+
* Nothing in the DOM marks a trap's container, so `trapTab` adds each trap
|
|
353
|
+
* here as it starts and removes it when it stops.
|
|
354
|
+
*/
|
|
355
|
+
const traps = new Set();
|
|
356
|
+
/**
|
|
357
|
+
* The element Tab stays inside around `node`: the nearest container of a
|
|
358
|
+
* trap that holds Tab, or of a modal dialog (`aria-modal="true"`), and
|
|
359
|
+
* `null` when there's neither.
|
|
360
|
+
*/
|
|
361
|
+
function tabBoundary(node) {
|
|
362
|
+
const held = new Set();
|
|
363
|
+
for (const trap of traps) {
|
|
364
|
+
const box = trap.container();
|
|
365
|
+
if (box && trap.holds())
|
|
366
|
+
held.add(box);
|
|
367
|
+
}
|
|
368
|
+
for (let el = flatParent(node); el; el = flatParent(el)) {
|
|
369
|
+
if (held.has(el) || el.getAttribute('aria-modal') === 'true') {
|
|
370
|
+
return el;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Moves focus where Tab goes from `element` when nothing inside it can take
|
|
377
|
+
* focus: to the first tab stop after it and outside it. Inside a trap that
|
|
378
|
+
* holds Tab, or a modal dialog, it looks no further than that container, and
|
|
379
|
+
* with nothing after `element` there, focus wraps to the container's first
|
|
380
|
+
* stop, as the trap's own Tab does. Returns whether it moved focus, which it
|
|
381
|
+
* doesn't at the end of the page, where the browser takes the key. It's for
|
|
382
|
+
* a popup that hides as a Tab inside it arrives, before the browser moves
|
|
383
|
+
* focus. Internal like `focusTabStop`.
|
|
384
|
+
*/
|
|
385
|
+
function focusTabStopAfter(element) {
|
|
386
|
+
const boundary = tabBoundary(element);
|
|
387
|
+
const top = boundary ?? element.ownerDocument.documentElement;
|
|
388
|
+
for (const stop of findTabStops(top)?.after(element) ?? []) {
|
|
389
|
+
if (tookFocus(stop))
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
if (!boundary)
|
|
393
|
+
return false;
|
|
394
|
+
focusTabStop(boundary);
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
326
397
|
/**
|
|
327
398
|
* Handles a Tab for a trap on `container`. When the browser has no tab stop
|
|
328
399
|
* left in that direction inside the container, focus goes to the stop at the
|
|
@@ -406,9 +477,12 @@ function trapTab(container, keyTarget, holds = () => true) {
|
|
|
406
477
|
wrapFromLast = null;
|
|
407
478
|
focusTabStop(box, fromLast);
|
|
408
479
|
};
|
|
480
|
+
const trap = { container, holds };
|
|
481
|
+
traps.add(trap);
|
|
409
482
|
keys.addEventListener('keydown', handleKeyDown);
|
|
410
483
|
doc.addEventListener('focusin', handleFocusIn, true);
|
|
411
484
|
return () => {
|
|
485
|
+
traps.delete(trap);
|
|
412
486
|
keys.removeEventListener('keydown', handleKeyDown);
|
|
413
487
|
doc.removeEventListener('focusin', handleFocusIn, true);
|
|
414
488
|
clearTimeout(wrapTimer);
|
|
@@ -534,5 +608,5 @@ function useFocusTrap(containerRef, options = {}) {
|
|
|
534
608
|
});
|
|
535
609
|
}
|
|
536
610
|
|
|
537
|
-
export { focusTabStop, isTabbableKind, trapTab, useFocusTrap };
|
|
611
|
+
export { focusTabStop, focusTabStopAfter, isTabbableKind, trapTab, useFocusTrap };
|
|
538
612
|
//# sourceMappingURL=useFocusTrap.js.map
|