@hjmds/react 1.27.1 → 1.27.2
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/actions.d.ts +26 -4
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +4 -4
- package/dist/actions.js.map +1 -1
- package/dist/collection-editing.d.ts.map +1 -1
- package/dist/collection-editing.js +5 -4
- package/dist/collection-editing.js.map +1 -1
- package/dist/display.d.ts.map +1 -1
- package/dist/display.js +5 -2
- package/dist/display.js.map +1 -1
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.js +1 -1
- package/dist/evidence.js.map +1 -1
- package/dist/internal/screen-exit.d.ts.map +1 -1
- package/dist/internal/screen-exit.js +2 -1
- package/dist/internal/screen-exit.js.map +1 -1
- package/dist/saved-items.js +1 -1
- package/dist/saved-items.js.map +1 -1
- package/dist/screen-flows.d.ts.map +1 -1
- package/dist/screen-flows.js +13 -12
- package/dist/screen-flows.js.map +1 -1
- package/dist/screens.d.ts.map +1 -1
- package/dist/screens.js +2 -2
- package/dist/screens.js.map +1 -1
- package/dist/styles.css +92 -21
- package/dist/styles.layered.css +92 -21
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +27 -2
- package/dist/theme.js.map +1 -1
- package/dist/toast.d.ts.map +1 -1
- package/dist/toast.js +4 -1
- package/dist/toast.js.map +1 -1
- package/dist/upload-item.d.ts.map +1 -1
- package/dist/upload-item.js +1 -1
- package/dist/upload-item.js.map +1 -1
- package/dist/virtual-list.d.ts.map +1 -1
- package/dist/virtual-list.js +5 -1
- package/dist/virtual-list.js.map +1 -1
- package/package.json +2 -2
package/dist/toast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../src/toast.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EACl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,CAAC,CAC/C,CAAC,IACA,GACM,CACf,CAAC,CAAC,CAAC,IAAI,IACc,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import { isLargeTextScale } from \"@hjmds/design-contracts/components/design-system-provider\";\nimport {\n createToastStore,\n createToastSession,\n resolveToastDescriptor,\n type ResolvedToastDescriptor,\n type ToastDescriptor,\n type ToastDismissReason,\n type ToastDuplicatePolicy,\n type ToastId,\n type ToastOverflowPolicy,\n type ToastProgressDescriptor,\n type ToastPublishOptions,\n type ToastPublishResult,\n type ToastSessionSnapshot,\n type ToastStore,\n type ToastTimerUpdatePolicy,\n} from \"@hjmds/design-contracts/components/toast\";\nimport {\n toastRecipe,\n type ToastPlacement,\n} from \"@hjmds/design-contracts/recipes\";\nimport {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type CSSProperties,\n type FocusEvent,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { classNames } from \"./internal.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\nimport { createHjmThemeStyle } from \"./theme.js\";\n\n// 1.10.0: stroked SVG glyphs inside a tinted badge (toastRecipe.icon). Text glyphs (\"●\", \"i\", \"!\") rendered at\n// font metrics, so neutral read as a stray grey dot and info/danger looked like typos. currentColor = tone accent.\nconst toneGlyphPaths = {\n notifications: \"M6 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.94 1.94 0 0 0 3.4 0\",\n info: \"M12 16v-4M12 8h.01M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0Z\",\n success: \"M20 6 9 17l-5-5\",\n warning: \"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0ZM12 9v4M12 17h.01\",\n alert: \"M12 8v4M12 16h.01M7.86 2h8.28L22 7.86v8.28L16.14 22H7.86L2 16.14V7.86Z\",\n} as const;\n\nfunction ToneGlyph({ tone }: { tone: keyof typeof toastRecipe.tones }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n width=\"18\"\n height=\"18\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n focusable=\"false\"\n >\n <path d={toneGlyphPaths[toastRecipe.tones[tone].mark]} />\n </svg>\n );\n}\n\n// Steps read as an ordered list with `aria-current=\"step\"`; the dots are decoration beside each label,\n// so state never depends on colour alone (WCAG 1.4.1).\nfunction ToastProgress({ progress }: { progress: ToastProgressDescriptor }) {\n return (\n <ol className=\"hjm-toast__progress\">\n {progress.steps.map((step, index) => {\n const state = index < progress.current ? \"done\" : index === progress.current ? \"current\" : \"upcoming\";\n return (\n <li\n key={`${index}-${step}`}\n className=\"hjm-toast__progress-step\"\n data-state={state}\n aria-current={state === \"current\" ? \"step\" : undefined}\n >\n <span className=\"hjm-toast__progress-dot\" aria-hidden=\"true\" />\n <span className=\"hjm-toast__progress-label\">{step}</span>\n </li>\n );\n })}\n </ol>\n );\n}\n\ntype ToastCardProps = Readonly<{\n descriptor: ResolvedToastDescriptor;\n phase: \"visible\" | \"closing\";\n onAction(): void;\n onPress(): void;\n onDismiss(reason: ToastDismissReason): void;\n onPointerPause?(): void;\n onPointerResume?(): void;\n onFocusPause?(): void;\n onFocusResume?(): void;\n locale?: string;\n className?: string;\n /**\n * Remaining HTML attributes of the public controlled `Toast` (id, data-*, style, handlers).\n * Spread first so the card's role, labelling, tone and state attributes always win;\n * handlers the card also needs are composed rather than replaced.\n */\n htmlProps?: Omit<HTMLAttributes<HTMLDivElement>, \"children\" | \"title\" | \"className\">;\n}>;\n\nconst ToastCard = forwardRef<HTMLDivElement, ToastCardProps>(function ToastCard(\n {\n descriptor,\n phase,\n onAction,\n onPress,\n onDismiss,\n onPointerPause,\n onPointerResume,\n onFocusPause,\n onFocusResume,\n locale,\n className,\n htmlProps,\n },\n ref,\n) {\n const baseId = useId().replaceAll(\":\", \"\");\n const titleId = `${baseId}-toast-title`;\n const descriptionId = `${baseId}-toast-description`;\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n htmlProps?.onKeyDown?.(event);\n if (event.key === \"Escape\") {\n event.preventDefault();\n onDismiss(\"escape\");\n }\n };\n return (\n <div\n {...htmlProps}\n ref={ref}\n className={classNames(\"hjm-toast\", className)}\n data-tone={descriptor.tone}\n data-state={phase}\n lang={locale ?? htmlProps?.lang}\n role=\"group\"\n aria-labelledby={descriptor.title ? titleId : undefined}\n aria-describedby={descriptionId}\n onPointerEnter={(event) => { htmlProps?.onPointerEnter?.(event); onPointerPause?.(); }}\n onPointerLeave={(event) => { htmlProps?.onPointerLeave?.(event); onPointerResume?.(); }}\n onFocusCapture={(event) => { htmlProps?.onFocusCapture?.(event); onFocusPause?.(); }}\n onBlurCapture={(event) => {\n htmlProps?.onBlurCapture?.(event);\n if (!event.currentTarget.contains(event.relatedTarget)) onFocusResume?.();\n }}\n onKeyDown={handleKeyDown}\n >\n <span\n className=\"hjm-visually-hidden\"\n role={descriptor.priority === \"high\" ? \"alert\" : \"status\"}\n >\n {descriptor.announcement}\n </span>\n {descriptor.press ? (\n // A sibling button covers the card without nesting action/close buttons in a button.\n <button\n type=\"button\"\n className=\"hjm-toast__press\"\n aria-label={descriptor.press.accessibilityLabel}\n aria-describedby={descriptionId}\n disabled={phase !== \"visible\"}\n onClick={onPress}\n />\n ) : null}\n <span className=\"hjm-toast__tone-mark\" aria-hidden=\"true\" />\n {descriptor.media === null ? (\n <span className=\"hjm-toast__icon\" aria-hidden=\"true\">\n <ToneGlyph tone={descriptor.tone} />\n </span>\n ) : (\n // Product media (mascot, avatar) takes the badge column; it is decorative, the copy carries meaning.\n <span className=\"hjm-toast__media\" aria-hidden=\"true\">{descriptor.media as ReactNode}</span>\n )}\n <span className=\"hjm-toast__content\">\n {descriptor.title ? (\n <strong id={titleId} className=\"hjm-toast__title\">{descriptor.title}</strong>\n ) : null}\n <span id={descriptionId} className=\"hjm-toast__description\">\n {descriptor.description}\n </span>\n {descriptor.progress ? <ToastProgress progress={descriptor.progress} /> : null}\n </span>\n {descriptor.action ? (\n <button\n type=\"button\"\n className=\"hjm-toast__action\"\n aria-label={descriptor.action.accessibilityLabel}\n onClick={onAction}\n >\n {descriptor.action.label}\n </button>\n ) : null}\n <button\n type=\"button\"\n className=\"hjm-toast__close\"\n aria-label={descriptor.closeLabel}\n onClick={() => onDismiss(\"close-action\")}\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" focusable=\"false\">\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n </button>\n </div>\n );\n});\n\n// No `layoutStyle`: toasts are stacked inside the provider's fixed region, which owns their position.\nexport type ToastProps = Omit<HTMLAttributes<HTMLDivElement>, \"children\" | \"title\"> &\n Readonly<{\n descriptor: ToastDescriptor;\n onDismissRequest: (reason: ToastDismissReason) => void;\n }>;\n\n/** Controlled single-toast renderer; ToastProvider supplies the full FIFO lifecycle. */\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(\n // Until 2026-10-06 only `className` reached the DOM although the type accepts every div attribute,\n // so `id`, `data-*` and handlers were dropped silently. Narrowing the type instead would break\n // consumers that already pass them, so the rest is forwarded (the card keeps its own role/labelling).\n { descriptor, onDismissRequest, className, ...htmlProps },\n ref,\n) {\n const resolved = resolveToastDescriptor(descriptor);\n // Controlled rendering leaves timing/removal to the host, but shares the store's\n // once-per-revision invocation and callback-then-dismiss semantics.\n const session = useMemo(() => {\n const next = createToastSession(descriptor);\n next.show();\n return next;\n }, [descriptor]);\n const invoke = (kind: \"action\" | \"press\") => {\n if (session.getSnapshot().phase !== \"visible\") return;\n try {\n if (kind === \"press\") session.invokePress();\n else session.invokeAction();\n } finally {\n const snapshot = session.getSnapshot();\n if (snapshot.phase === \"closing\" && snapshot.dismissReason) {\n onDismissRequest(snapshot.dismissReason);\n }\n }\n };\n return (\n <ToastCard\n ref={ref}\n descriptor={resolved}\n phase=\"visible\"\n {...(className === undefined ? {} : { className })}\n htmlProps={htmlProps}\n onDismiss={(reason) => { session.dismiss(reason); onDismissRequest(reason); }}\n onAction={() => invoke(\"action\")}\n onPress={() => invoke(\"press\")}\n />\n );\n});\n\nexport type ToastApi = Readonly<{\n publish(descriptor: ToastDescriptor, options?: ToastPublishOptions): ToastPublishResult;\n dismiss(id: ToastId, reason: ToastDismissReason): boolean;\n close(id: ToastId): boolean;\n}>;\n\nconst ToastContext = createContext<ToastApi | null>(null);\n\nexport function useToast(): ToastApi {\n const value = useContext(ToastContext);\n if (value === null) throw new Error(\"useToast must be used inside ToastProvider\");\n return value;\n}\n\n// No `layoutStyle`: the toast region is a fixed viewport layer owned by the provider recipe.\nexport type ToastProviderProps = Readonly<{\n children: ReactNode;\n label: string;\n placement?: ToastPlacement;\n store?: ToastStore;\n initialToasts?: readonly ToastDescriptor[];\n maxVisible?: number;\n maxQueued?: number;\n duplicatePolicy?: ToastDuplicatePolicy;\n timerUpdatePolicy?: ToastTimerUpdatePolicy;\n overflowPolicy?: ToastOverflowPolicy;\n portalContainer?: HTMLElement;\n /** Captured per publication so already-visible localized copy keeps its language. */\n locale?: string;\n /** Extra space above a fixed product dock, in pixels or any CSS length. */\n bottomOffset?: number | string;\n /** Optional discoverable keyboard shortcut, for example `F8`. */\n hotkey?: string;\n /** Screen-reader help associated with the viewport when `hotkey` is supplied. */\n hotkeyHelp?: string;\n}>;\n\ntype ToastPortalProps = Readonly<{\n children: ReactNode;\n container?: HTMLElement;\n}>;\n\nfunction ToastPortal({ children, container }: ToastPortalProps) {\n const [mounted, setMounted] = useState(false);\n const theme = useOptionalHjmTheme();\n useEffect(() => setMounted(true), []);\n if (!mounted) return null;\n return createPortal(\n theme ? (\n <div\n className=\"hjm-root hjm-portal\"\n data-hjm-portal=\"toast\"\n data-motion={theme.environment.reducedMotion ? \"reduced\" : \"full\"}\n data-theme={theme.environment.theme}\n data-text-scale={theme.environment.textScale}\n data-large-text={isLargeTextScale(theme.environment.textScale) ? \"true\" : undefined}\n dir={theme.environment.direction}\n style={createHjmThemeStyle(theme)}\n >\n {children}\n </div>\n ) : children,\n container ?? document.body,\n );\n}\n\nfunction renderStoreToast(\n snapshot: ToastSessionSnapshot,\n store: ToastStore,\n locale?: string,\n): ReactNode {\n if (snapshot.phase !== \"visible\" && snapshot.phase !== \"closing\") return null;\n const id = snapshot.descriptor.id;\n return (\n <ToastCard\n key={id}\n descriptor={snapshot.descriptor}\n phase={snapshot.phase}\n {...(locale === undefined ? {} : { locale })}\n onAction={() => store.invokeAction(id)}\n onPress={() => store.invokePress(id)}\n onDismiss={(reason) => store.dismiss(id, reason)}\n onPointerPause={() => store.pause(id, \"pointer\")}\n onPointerResume={() => store.resume(id, \"pointer\")}\n onFocusPause={() => store.pause(id, \"focus\")}\n onFocusResume={() => store.resume(id, \"focus\")}\n />\n );\n}\n\nexport function ToastProvider({\n children,\n label,\n placement = toastRecipe.defaults.placement,\n store,\n initialToasts = [],\n maxVisible,\n maxQueued,\n duplicatePolicy,\n timerUpdatePolicy,\n overflowPolicy,\n portalContainer,\n locale,\n bottomOffset = 0,\n hotkey,\n hotkeyHelp,\n}: ToastProviderProps) {\n if (label.trim().length === 0) throw new TypeError(\"ToastProvider label must not be empty\");\n if ((hotkey === undefined) !== (hotkeyHelp === undefined)) {\n throw new TypeError(\"ToastProvider hotkey and hotkeyHelp must be supplied together\");\n }\n if (hotkey !== undefined && !hotkey.trim()) {\n throw new TypeError(\"ToastProvider hotkey must not be empty\");\n }\n if (hotkeyHelp !== undefined && !hotkeyHelp.trim()) {\n throw new TypeError(\"ToastProvider hotkeyHelp must not be empty\");\n }\n if (typeof bottomOffset === \"number\" && (!Number.isFinite(bottomOffset) || bottomOffset < 0)) {\n throw new RangeError(\"ToastProvider bottomOffset must be a non-negative finite number\");\n }\n if (typeof bottomOffset === \"string\" && !bottomOffset.trim()) {\n throw new TypeError(\"ToastProvider bottomOffset must not be empty\");\n }\n const internalStoreRef = useRef<ToastStore | null>(null);\n const localeByIdRef = useRef(new Map<ToastId, string>());\n if (store === undefined && internalStoreRef.current === null) {\n internalStoreRef.current = createToastStore({\n ...(maxVisible === undefined ? {} : { maxVisible }),\n ...(maxQueued === undefined ? {} : { maxQueued }),\n ...(duplicatePolicy === undefined ? {} : { duplicatePolicy }),\n ...(timerUpdatePolicy === undefined ? {} : { timerUpdatePolicy }),\n ...(overflowPolicy === undefined ? {} : { overflowPolicy }),\n });\n for (const descriptor of initialToasts) {\n const result = internalStoreRef.current.publish(descriptor);\n if (\n locale !== undefined &&\n (result.outcome === \"added\" || result.outcome === \"updated\")\n ) {\n localeByIdRef.current.set(descriptor.id, locale);\n }\n }\n }\n const activeStore = store ?? internalStoreRef.current;\n if (activeStore === null) throw new Error(\"ToastProvider could not create a store\");\n const snapshot = useSyncExternalStore(\n activeStore.subscribe,\n activeStore.getSnapshot,\n activeStore.getSnapshot,\n );\n const theme = useOptionalHjmTheme();\n const viewportRef = useRef<HTMLDivElement>(null);\n const previousFocusRef = useRef<HTMLElement | null>(null);\n const viewportFocusedRef = useRef(false);\n const hotkeyHelpId = useId().replaceAll(\":\", \"\");\n const api = useMemo<ToastApi>(\n () => ({\n publish: (descriptor, options) => {\n const previousLocale = localeByIdRef.current.get(descriptor.id);\n if (locale === undefined) localeByIdRef.current.delete(descriptor.id);\n else localeByIdRef.current.set(descriptor.id, locale);\n try {\n const result = activeStore.publish(descriptor, options);\n if (result.outcome === \"ignored\" || result.outcome === \"discarded\") {\n if (previousLocale === undefined) localeByIdRef.current.delete(descriptor.id);\n else localeByIdRef.current.set(descriptor.id, previousLocale);\n }\n return result;\n } catch (error) {\n if (previousLocale === undefined) localeByIdRef.current.delete(descriptor.id);\n else localeByIdRef.current.set(descriptor.id, previousLocale);\n throw error;\n }\n },\n dismiss: (id, reason) => activeStore.dismiss(id, reason),\n close: (id) => activeStore.close(id),\n }),\n [activeStore, locale],\n );\n\n const disposalTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(() => {\n if (disposalTimerRef.current !== null) {\n clearTimeout(disposalTimerRef.current);\n disposalTimerRef.current = null;\n }\n const ownedStore = internalStoreRef.current;\n return () => {\n if (ownedStore) {\n disposalTimerRef.current = setTimeout(() => ownedStore.dispose(), 0);\n }\n };\n }, []);\n\n useEffect(() => {\n const activeIds = new Set(\n [...snapshot.visible, ...snapshot.queued].map((entry) => entry.descriptor.id),\n );\n for (const id of localeByIdRef.current.keys()) {\n if (!activeIds.has(id)) localeByIdRef.current.delete(id);\n }\n }, [snapshot]);\n\n const hasRunningTimer = snapshot.visible.some(\n (entry) => entry.timer.status === \"running\",\n );\n useEffect(() => {\n if (!hasRunningTimer) return;\n let previousTime = performance.now();\n const timer = setInterval(() => {\n const currentTime = performance.now();\n activeStore.advanceTime(currentTime - previousTime);\n previousTime = currentTime;\n }, 100);\n return () => clearInterval(timer);\n }, [activeStore, hasRunningTimer]);\n\n const closingIds = snapshot.visible\n .filter((entry) => entry.phase === \"closing\")\n .map((entry) => entry.descriptor.id)\n .join(\"\\u0000\");\n useEffect(() => {\n if (closingIds.length === 0) return;\n const ids = closingIds.split(\"\\u0000\");\n const timer = setTimeout(\n () => ids.forEach((id) => activeStore.completeExit(id)),\n theme?.environment.reducedMotion ? 0 : 160,\n );\n return () => clearTimeout(timer);\n }, [activeStore, closingIds, theme?.environment.reducedMotion]);\n\n useEffect(() => {\n const pause = () => activeStore.pauseAll(\"window\");\n const resume = () => {\n if (!document.hidden) activeStore.resumeAll(\"window\");\n };\n const handleVisibility = () => (document.hidden ? pause() : resume());\n window.addEventListener(\"blur\", pause);\n window.addEventListener(\"focus\", resume);\n window.addEventListener(\"pagehide\", pause);\n window.addEventListener(\"pageshow\", resume);\n document.addEventListener(\"visibilitychange\", handleVisibility);\n // A provider may mount while its tab is already hidden, before any change event.\n handleVisibility();\n return () => {\n window.removeEventListener(\"blur\", pause);\n window.removeEventListener(\"focus\", resume);\n window.removeEventListener(\"pagehide\", pause);\n window.removeEventListener(\"pageshow\", resume);\n document.removeEventListener(\"visibilitychange\", handleVisibility);\n };\n }, [activeStore]);\n\n useEffect(() => {\n if (hotkey === undefined || snapshot.visible.length === 0) return;\n const handleKeyDown = (event: globalThis.KeyboardEvent) => {\n if (event.key !== hotkey) return;\n const viewport = viewportRef.current;\n if (!viewport) return;\n if (!viewport.contains(document.activeElement)) {\n previousFocusRef.current = document.activeElement as HTMLElement | null;\n }\n event.preventDefault();\n viewport.focus();\n };\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => document.removeEventListener(\"keydown\", handleKeyDown);\n }, [hotkey, snapshot.visible.length]);\n\n useEffect(() => {\n if (snapshot.visible.length > 0 || !viewportFocusedRef.current) return;\n viewportFocusedRef.current = false;\n previousFocusRef.current?.focus();\n previousFocusRef.current = null;\n }, [snapshot.visible.length]);\n\n const handleViewportFocus = (event: FocusEvent<HTMLDivElement>) => {\n const previous = event.relatedTarget;\n if (previous instanceof HTMLElement && !event.currentTarget.contains(previous)) {\n previousFocusRef.current = previous;\n }\n viewportFocusedRef.current = true;\n activeStore.pauseAll(\"focus\");\n };\n const handleViewportBlur = (event: FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget;\n if (!(next instanceof Node) || !event.currentTarget.contains(next)) {\n viewportFocusedRef.current = false;\n activeStore.resumeAll(\"focus\");\n }\n };\n const viewportStyle = {\n \"--hjm-toast-bottom-offset\":\n typeof bottomOffset === \"number\" ? `${bottomOffset}px` : bottomOffset,\n } as CSSProperties;\n\n return (\n <ToastContext.Provider value={api}>\n {children}\n {snapshot.visible.length > 0 ? (\n <ToastPortal {...(portalContainer === undefined ? {} : { container: portalContainer })}>\n <div\n ref={viewportRef}\n className=\"hjm-toast-viewport\"\n data-placement={placement}\n role=\"region\"\n aria-label={label}\n aria-describedby={hotkeyHelp === undefined ? undefined : hotkeyHelpId}\n aria-keyshortcuts={hotkey}\n tabIndex={hotkey === undefined ? undefined : -1}\n onFocusCapture={handleViewportFocus}\n onBlurCapture={handleViewportBlur}\n style={viewportStyle}\n >\n {hotkeyHelp === undefined ? null : (\n <span id={hotkeyHelpId} className=\"hjm-visually-hidden\">{hotkeyHelp}</span>\n )}\n {snapshot.visible.map((entry) =>\n renderStoreToast(\n entry,\n activeStore,\n localeByIdRef.current.get(entry.descriptor.id),\n ))}\n </div>\n </ToastPortal>\n ) : null}\n </ToastContext.Provider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../src/toast.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,GAavB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,WAAW,GAEZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,oBAAoB,GAMrB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,+GAA+G;AAC/G,mHAAmH;AACnH,+GAA+G;AAC/G,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAEtD,MAAM,cAAc,GAAG;IACrB,aAAa,EAAE,yEAAyE;IACxF,IAAI,EAAE,6DAA6D;IACnE,OAAO,EAAE,iBAAiB;IAC1B,OAAO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WAAW,EAChB,SAAS,EAAC,oBAAoB,oBACd,SAAS,EACzB,IAAI,EAAC,QAAQ,gBACD,KAAK,sBACC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,uBAClD,MAAM,EACzB,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/C,cAAc,EAAE,mBAAmB,EACnC,aAAa,EAAE,kBAAkB,EACjC,KAAK,EAAE,aAAa,aAEnB,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACjC,eAAM,EAAE,EAAE,YAAY,EAAE,SAAS,EAAC,qBAAqB,YAAE,UAAU,GAAQ,CAC5E,EACA,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC9B,gBAAgB,CACd,KAAK,EACL,WAAW,EACX,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAC/C,CAAC,IACA,GACM,CACf,CAAC,CAAC,CAAC,IAAI,IACc,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import { isLargeTextScale } from \"@hjmds/design-contracts/components/design-system-provider\";\nimport {\n createToastStore,\n createToastSession,\n resolveToastDescriptor,\n type ResolvedToastDescriptor,\n type ToastDescriptor,\n type ToastDismissReason,\n type ToastDuplicatePolicy,\n type ToastId,\n type ToastOverflowPolicy,\n type ToastProgressDescriptor,\n type ToastPublishOptions,\n type ToastPublishResult,\n type ToastSessionSnapshot,\n type ToastStore,\n type ToastTimerUpdatePolicy,\n} from \"@hjmds/design-contracts/components/toast\";\nimport {\n toastRecipe,\n type ToastPlacement,\n} from \"@hjmds/design-contracts/recipes\";\nimport { glyph } from \"@hjmds/design-contracts/foundations\";\nimport {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type CSSProperties,\n type FocusEvent,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { classNames } from \"./internal.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\nimport { createHjmThemeStyle } from \"./theme.js\";\n\n// 1.10.0: stroked SVG glyphs inside a tinted badge (toastRecipe.icon). Text glyphs (\"●\", \"i\", \"!\") rendered at\n// font metrics, so neutral read as a stray grey dot and info/danger looked like typos. currentColor = tone accent.\n// The close glyph box is the size toastRecipe.close.inlineOverhang is derived from (2026-10-17 alignment fix).\nconst closeGlyphSize = glyph[toastRecipe.close.glyph];\n\nconst toneGlyphPaths = {\n notifications: \"M6 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.94 1.94 0 0 0 3.4 0\",\n info: \"M12 16v-4M12 8h.01M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0Z\",\n success: \"M20 6 9 17l-5-5\",\n warning: \"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0ZM12 9v4M12 17h.01\",\n alert: \"M12 8v4M12 16h.01M7.86 2h8.28L22 7.86v8.28L16.14 22H7.86L2 16.14V7.86Z\",\n} as const;\n\nfunction ToneGlyph({ tone }: { tone: keyof typeof toastRecipe.tones }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n width=\"18\"\n height=\"18\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n focusable=\"false\"\n >\n <path d={toneGlyphPaths[toastRecipe.tones[tone].mark]} />\n </svg>\n );\n}\n\n// Steps read as an ordered list with `aria-current=\"step\"`; the dots are decoration beside each label,\n// so state never depends on colour alone (WCAG 1.4.1).\nfunction ToastProgress({ progress }: { progress: ToastProgressDescriptor }) {\n return (\n <ol className=\"hjm-toast__progress\">\n {progress.steps.map((step, index) => {\n const state = index < progress.current ? \"done\" : index === progress.current ? \"current\" : \"upcoming\";\n return (\n <li\n key={`${index}-${step}`}\n className=\"hjm-toast__progress-step\"\n data-state={state}\n aria-current={state === \"current\" ? \"step\" : undefined}\n >\n <span className=\"hjm-toast__progress-dot\" aria-hidden=\"true\" />\n <span className=\"hjm-toast__progress-label\">{step}</span>\n </li>\n );\n })}\n </ol>\n );\n}\n\ntype ToastCardProps = Readonly<{\n descriptor: ResolvedToastDescriptor;\n phase: \"visible\" | \"closing\";\n onAction(): void;\n onPress(): void;\n onDismiss(reason: ToastDismissReason): void;\n onPointerPause?(): void;\n onPointerResume?(): void;\n onFocusPause?(): void;\n onFocusResume?(): void;\n locale?: string;\n className?: string;\n /**\n * Remaining HTML attributes of the public controlled `Toast` (id, data-*, style, handlers).\n * Spread first so the card's role, labelling, tone and state attributes always win;\n * handlers the card also needs are composed rather than replaced.\n */\n htmlProps?: Omit<HTMLAttributes<HTMLDivElement>, \"children\" | \"title\" | \"className\">;\n}>;\n\nconst ToastCard = forwardRef<HTMLDivElement, ToastCardProps>(function ToastCard(\n {\n descriptor,\n phase,\n onAction,\n onPress,\n onDismiss,\n onPointerPause,\n onPointerResume,\n onFocusPause,\n onFocusResume,\n locale,\n className,\n htmlProps,\n },\n ref,\n) {\n const baseId = useId().replaceAll(\":\", \"\");\n const titleId = `${baseId}-toast-title`;\n const descriptionId = `${baseId}-toast-description`;\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n htmlProps?.onKeyDown?.(event);\n if (event.key === \"Escape\") {\n event.preventDefault();\n onDismiss(\"escape\");\n }\n };\n return (\n <div\n {...htmlProps}\n ref={ref}\n className={classNames(\"hjm-toast\", className)}\n data-tone={descriptor.tone}\n data-state={phase}\n lang={locale ?? htmlProps?.lang}\n role=\"group\"\n aria-labelledby={descriptor.title ? titleId : undefined}\n aria-describedby={descriptionId}\n onPointerEnter={(event) => { htmlProps?.onPointerEnter?.(event); onPointerPause?.(); }}\n onPointerLeave={(event) => { htmlProps?.onPointerLeave?.(event); onPointerResume?.(); }}\n onFocusCapture={(event) => { htmlProps?.onFocusCapture?.(event); onFocusPause?.(); }}\n onBlurCapture={(event) => {\n htmlProps?.onBlurCapture?.(event);\n if (!event.currentTarget.contains(event.relatedTarget)) onFocusResume?.();\n }}\n onKeyDown={handleKeyDown}\n >\n <span\n className=\"hjm-visually-hidden\"\n role={descriptor.priority === \"high\" ? \"alert\" : \"status\"}\n >\n {descriptor.announcement}\n </span>\n {descriptor.press ? (\n // A sibling button covers the card without nesting action/close buttons in a button.\n <button\n type=\"button\"\n className=\"hjm-toast__press\"\n aria-label={descriptor.press.accessibilityLabel}\n aria-describedby={descriptionId}\n disabled={phase !== \"visible\"}\n onClick={onPress}\n />\n ) : null}\n <span className=\"hjm-toast__tone-mark\" aria-hidden=\"true\" />\n {descriptor.media === null ? (\n <span className=\"hjm-toast__icon\" aria-hidden=\"true\">\n <ToneGlyph tone={descriptor.tone} />\n </span>\n ) : (\n // Product media (mascot, avatar) takes the badge column; it is decorative, the copy carries meaning.\n <span className=\"hjm-toast__media\" aria-hidden=\"true\">{descriptor.media as ReactNode}</span>\n )}\n <span className=\"hjm-toast__content\">\n {descriptor.title ? (\n <strong id={titleId} className=\"hjm-toast__title\">{descriptor.title}</strong>\n ) : null}\n <span id={descriptionId} className=\"hjm-toast__description\">\n {descriptor.description}\n </span>\n {descriptor.progress ? <ToastProgress progress={descriptor.progress} /> : null}\n </span>\n {descriptor.action ? (\n <button\n type=\"button\"\n className=\"hjm-toast__action\"\n aria-label={descriptor.action.accessibilityLabel}\n onClick={onAction}\n >\n {descriptor.action.label}\n </button>\n ) : null}\n <button\n type=\"button\"\n className=\"hjm-toast__close\"\n aria-label={descriptor.closeLabel}\n onClick={() => onDismiss(\"close-action\")}\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" width={closeGlyphSize} height={closeGlyphSize} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" focusable=\"false\">\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n </button>\n </div>\n );\n});\n\n// No `layoutStyle`: toasts are stacked inside the provider's fixed region, which owns their position.\nexport type ToastProps = Omit<HTMLAttributes<HTMLDivElement>, \"children\" | \"title\"> &\n Readonly<{\n descriptor: ToastDescriptor;\n onDismissRequest: (reason: ToastDismissReason) => void;\n }>;\n\n/** Controlled single-toast renderer; ToastProvider supplies the full FIFO lifecycle. */\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(\n // Until 2026-10-06 only `className` reached the DOM although the type accepts every div attribute,\n // so `id`, `data-*` and handlers were dropped silently. Narrowing the type instead would break\n // consumers that already pass them, so the rest is forwarded (the card keeps its own role/labelling).\n { descriptor, onDismissRequest, className, ...htmlProps },\n ref,\n) {\n const resolved = resolveToastDescriptor(descriptor);\n // Controlled rendering leaves timing/removal to the host, but shares the store's\n // once-per-revision invocation and callback-then-dismiss semantics.\n const session = useMemo(() => {\n const next = createToastSession(descriptor);\n next.show();\n return next;\n }, [descriptor]);\n const invoke = (kind: \"action\" | \"press\") => {\n if (session.getSnapshot().phase !== \"visible\") return;\n try {\n if (kind === \"press\") session.invokePress();\n else session.invokeAction();\n } finally {\n const snapshot = session.getSnapshot();\n if (snapshot.phase === \"closing\" && snapshot.dismissReason) {\n onDismissRequest(snapshot.dismissReason);\n }\n }\n };\n return (\n <ToastCard\n ref={ref}\n descriptor={resolved}\n phase=\"visible\"\n {...(className === undefined ? {} : { className })}\n htmlProps={htmlProps}\n onDismiss={(reason) => { session.dismiss(reason); onDismissRequest(reason); }}\n onAction={() => invoke(\"action\")}\n onPress={() => invoke(\"press\")}\n />\n );\n});\n\nexport type ToastApi = Readonly<{\n publish(descriptor: ToastDescriptor, options?: ToastPublishOptions): ToastPublishResult;\n dismiss(id: ToastId, reason: ToastDismissReason): boolean;\n close(id: ToastId): boolean;\n}>;\n\nconst ToastContext = createContext<ToastApi | null>(null);\n\nexport function useToast(): ToastApi {\n const value = useContext(ToastContext);\n if (value === null) throw new Error(\"useToast must be used inside ToastProvider\");\n return value;\n}\n\n// No `layoutStyle`: the toast region is a fixed viewport layer owned by the provider recipe.\nexport type ToastProviderProps = Readonly<{\n children: ReactNode;\n label: string;\n placement?: ToastPlacement;\n store?: ToastStore;\n initialToasts?: readonly ToastDescriptor[];\n maxVisible?: number;\n maxQueued?: number;\n duplicatePolicy?: ToastDuplicatePolicy;\n timerUpdatePolicy?: ToastTimerUpdatePolicy;\n overflowPolicy?: ToastOverflowPolicy;\n portalContainer?: HTMLElement;\n /** Captured per publication so already-visible localized copy keeps its language. */\n locale?: string;\n /** Extra space above a fixed product dock, in pixels or any CSS length. */\n bottomOffset?: number | string;\n /** Optional discoverable keyboard shortcut, for example `F8`. */\n hotkey?: string;\n /** Screen-reader help associated with the viewport when `hotkey` is supplied. */\n hotkeyHelp?: string;\n}>;\n\ntype ToastPortalProps = Readonly<{\n children: ReactNode;\n container?: HTMLElement;\n}>;\n\nfunction ToastPortal({ children, container }: ToastPortalProps) {\n const [mounted, setMounted] = useState(false);\n const theme = useOptionalHjmTheme();\n useEffect(() => setMounted(true), []);\n if (!mounted) return null;\n return createPortal(\n theme ? (\n <div\n className=\"hjm-root hjm-portal\"\n data-hjm-portal=\"toast\"\n data-motion={theme.environment.reducedMotion ? \"reduced\" : \"full\"}\n data-theme={theme.environment.theme}\n data-text-scale={theme.environment.textScale}\n data-large-text={isLargeTextScale(theme.environment.textScale) ? \"true\" : undefined}\n dir={theme.environment.direction}\n style={createHjmThemeStyle(theme)}\n >\n {children}\n </div>\n ) : children,\n container ?? document.body,\n );\n}\n\nfunction renderStoreToast(\n snapshot: ToastSessionSnapshot,\n store: ToastStore,\n locale?: string,\n): ReactNode {\n if (snapshot.phase !== \"visible\" && snapshot.phase !== \"closing\") return null;\n const id = snapshot.descriptor.id;\n return (\n <ToastCard\n key={id}\n descriptor={snapshot.descriptor}\n phase={snapshot.phase}\n {...(locale === undefined ? {} : { locale })}\n onAction={() => store.invokeAction(id)}\n onPress={() => store.invokePress(id)}\n onDismiss={(reason) => store.dismiss(id, reason)}\n onPointerPause={() => store.pause(id, \"pointer\")}\n onPointerResume={() => store.resume(id, \"pointer\")}\n onFocusPause={() => store.pause(id, \"focus\")}\n onFocusResume={() => store.resume(id, \"focus\")}\n />\n );\n}\n\nexport function ToastProvider({\n children,\n label,\n placement = toastRecipe.defaults.placement,\n store,\n initialToasts = [],\n maxVisible,\n maxQueued,\n duplicatePolicy,\n timerUpdatePolicy,\n overflowPolicy,\n portalContainer,\n locale,\n bottomOffset = 0,\n hotkey,\n hotkeyHelp,\n}: ToastProviderProps) {\n if (label.trim().length === 0) throw new TypeError(\"ToastProvider label must not be empty\");\n if ((hotkey === undefined) !== (hotkeyHelp === undefined)) {\n throw new TypeError(\"ToastProvider hotkey and hotkeyHelp must be supplied together\");\n }\n if (hotkey !== undefined && !hotkey.trim()) {\n throw new TypeError(\"ToastProvider hotkey must not be empty\");\n }\n if (hotkeyHelp !== undefined && !hotkeyHelp.trim()) {\n throw new TypeError(\"ToastProvider hotkeyHelp must not be empty\");\n }\n if (typeof bottomOffset === \"number\" && (!Number.isFinite(bottomOffset) || bottomOffset < 0)) {\n throw new RangeError(\"ToastProvider bottomOffset must be a non-negative finite number\");\n }\n if (typeof bottomOffset === \"string\" && !bottomOffset.trim()) {\n throw new TypeError(\"ToastProvider bottomOffset must not be empty\");\n }\n const internalStoreRef = useRef<ToastStore | null>(null);\n const localeByIdRef = useRef(new Map<ToastId, string>());\n if (store === undefined && internalStoreRef.current === null) {\n internalStoreRef.current = createToastStore({\n ...(maxVisible === undefined ? {} : { maxVisible }),\n ...(maxQueued === undefined ? {} : { maxQueued }),\n ...(duplicatePolicy === undefined ? {} : { duplicatePolicy }),\n ...(timerUpdatePolicy === undefined ? {} : { timerUpdatePolicy }),\n ...(overflowPolicy === undefined ? {} : { overflowPolicy }),\n });\n for (const descriptor of initialToasts) {\n const result = internalStoreRef.current.publish(descriptor);\n if (\n locale !== undefined &&\n (result.outcome === \"added\" || result.outcome === \"updated\")\n ) {\n localeByIdRef.current.set(descriptor.id, locale);\n }\n }\n }\n const activeStore = store ?? internalStoreRef.current;\n if (activeStore === null) throw new Error(\"ToastProvider could not create a store\");\n const snapshot = useSyncExternalStore(\n activeStore.subscribe,\n activeStore.getSnapshot,\n activeStore.getSnapshot,\n );\n const theme = useOptionalHjmTheme();\n const viewportRef = useRef<HTMLDivElement>(null);\n const previousFocusRef = useRef<HTMLElement | null>(null);\n const viewportFocusedRef = useRef(false);\n const hotkeyHelpId = useId().replaceAll(\":\", \"\");\n const api = useMemo<ToastApi>(\n () => ({\n publish: (descriptor, options) => {\n const previousLocale = localeByIdRef.current.get(descriptor.id);\n if (locale === undefined) localeByIdRef.current.delete(descriptor.id);\n else localeByIdRef.current.set(descriptor.id, locale);\n try {\n const result = activeStore.publish(descriptor, options);\n if (result.outcome === \"ignored\" || result.outcome === \"discarded\") {\n if (previousLocale === undefined) localeByIdRef.current.delete(descriptor.id);\n else localeByIdRef.current.set(descriptor.id, previousLocale);\n }\n return result;\n } catch (error) {\n if (previousLocale === undefined) localeByIdRef.current.delete(descriptor.id);\n else localeByIdRef.current.set(descriptor.id, previousLocale);\n throw error;\n }\n },\n dismiss: (id, reason) => activeStore.dismiss(id, reason),\n close: (id) => activeStore.close(id),\n }),\n [activeStore, locale],\n );\n\n const disposalTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(() => {\n if (disposalTimerRef.current !== null) {\n clearTimeout(disposalTimerRef.current);\n disposalTimerRef.current = null;\n }\n const ownedStore = internalStoreRef.current;\n return () => {\n if (ownedStore) {\n disposalTimerRef.current = setTimeout(() => ownedStore.dispose(), 0);\n }\n };\n }, []);\n\n useEffect(() => {\n const activeIds = new Set(\n [...snapshot.visible, ...snapshot.queued].map((entry) => entry.descriptor.id),\n );\n for (const id of localeByIdRef.current.keys()) {\n if (!activeIds.has(id)) localeByIdRef.current.delete(id);\n }\n }, [snapshot]);\n\n const hasRunningTimer = snapshot.visible.some(\n (entry) => entry.timer.status === \"running\",\n );\n useEffect(() => {\n if (!hasRunningTimer) return;\n let previousTime = performance.now();\n const timer = setInterval(() => {\n const currentTime = performance.now();\n activeStore.advanceTime(currentTime - previousTime);\n previousTime = currentTime;\n }, 100);\n return () => clearInterval(timer);\n }, [activeStore, hasRunningTimer]);\n\n const closingIds = snapshot.visible\n .filter((entry) => entry.phase === \"closing\")\n .map((entry) => entry.descriptor.id)\n .join(\"\\u0000\");\n useEffect(() => {\n if (closingIds.length === 0) return;\n const ids = closingIds.split(\"\\u0000\");\n const timer = setTimeout(\n () => ids.forEach((id) => activeStore.completeExit(id)),\n theme?.environment.reducedMotion ? 0 : 160,\n );\n return () => clearTimeout(timer);\n }, [activeStore, closingIds, theme?.environment.reducedMotion]);\n\n useEffect(() => {\n const pause = () => activeStore.pauseAll(\"window\");\n const resume = () => {\n if (!document.hidden) activeStore.resumeAll(\"window\");\n };\n const handleVisibility = () => (document.hidden ? pause() : resume());\n window.addEventListener(\"blur\", pause);\n window.addEventListener(\"focus\", resume);\n window.addEventListener(\"pagehide\", pause);\n window.addEventListener(\"pageshow\", resume);\n document.addEventListener(\"visibilitychange\", handleVisibility);\n // A provider may mount while its tab is already hidden, before any change event.\n handleVisibility();\n return () => {\n window.removeEventListener(\"blur\", pause);\n window.removeEventListener(\"focus\", resume);\n window.removeEventListener(\"pagehide\", pause);\n window.removeEventListener(\"pageshow\", resume);\n document.removeEventListener(\"visibilitychange\", handleVisibility);\n };\n }, [activeStore]);\n\n useEffect(() => {\n if (hotkey === undefined || snapshot.visible.length === 0) return;\n const handleKeyDown = (event: globalThis.KeyboardEvent) => {\n if (event.key !== hotkey) return;\n const viewport = viewportRef.current;\n if (!viewport) return;\n if (!viewport.contains(document.activeElement)) {\n previousFocusRef.current = document.activeElement as HTMLElement | null;\n }\n event.preventDefault();\n viewport.focus();\n };\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => document.removeEventListener(\"keydown\", handleKeyDown);\n }, [hotkey, snapshot.visible.length]);\n\n useEffect(() => {\n if (snapshot.visible.length > 0 || !viewportFocusedRef.current) return;\n viewportFocusedRef.current = false;\n previousFocusRef.current?.focus();\n previousFocusRef.current = null;\n }, [snapshot.visible.length]);\n\n const handleViewportFocus = (event: FocusEvent<HTMLDivElement>) => {\n const previous = event.relatedTarget;\n if (previous instanceof HTMLElement && !event.currentTarget.contains(previous)) {\n previousFocusRef.current = previous;\n }\n viewportFocusedRef.current = true;\n activeStore.pauseAll(\"focus\");\n };\n const handleViewportBlur = (event: FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget;\n if (!(next instanceof Node) || !event.currentTarget.contains(next)) {\n viewportFocusedRef.current = false;\n activeStore.resumeAll(\"focus\");\n }\n };\n const viewportStyle = {\n \"--hjm-toast-bottom-offset\":\n typeof bottomOffset === \"number\" ? `${bottomOffset}px` : bottomOffset,\n } as CSSProperties;\n\n return (\n <ToastContext.Provider value={api}>\n {children}\n {snapshot.visible.length > 0 ? (\n <ToastPortal {...(portalContainer === undefined ? {} : { container: portalContainer })}>\n <div\n ref={viewportRef}\n className=\"hjm-toast-viewport\"\n data-placement={placement}\n role=\"region\"\n aria-label={label}\n aria-describedby={hotkeyHelp === undefined ? undefined : hotkeyHelpId}\n aria-keyshortcuts={hotkey}\n tabIndex={hotkey === undefined ? undefined : -1}\n onFocusCapture={handleViewportFocus}\n onBlurCapture={handleViewportBlur}\n style={viewportStyle}\n >\n {hotkeyHelp === undefined ? null : (\n <span id={hotkeyHelpId} className=\"hjm-visually-hidden\">{hotkeyHelp}</span>\n )}\n {snapshot.visible.map((entry) =>\n renderStoreToast(\n entry,\n activeStore,\n localeByIdRef.current.get(entry.descriptor.id),\n ))}\n </div>\n </ToastPortal>\n ) : null}\n </ToastContext.Provider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-item.d.ts","sourceRoot":"","sources":["../src/upload-item.tsx"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ACxF,UAAU,EAAE,oBAAoB,CAAC;IACjC,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gGAAgG;IAChG,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,UAAU;gBAVT,oBAAoB;YACxB,gBAAgB;eACb,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI;cACrB,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI;cACpB,SAAS;IACnB,gGAAgG;kBAClF,uBAAuB;mDAkErC,CAAC"}
|
package/dist/upload-item.js
CHANGED
|
@@ -20,6 +20,6 @@ export const UploadItem = forwardRef(function UploadItem({ descriptor, labels, o
|
|
|
20
20
|
const progressValueText = isUploading && announcement.description !== labels.uploading
|
|
21
21
|
? announcement.description
|
|
22
22
|
: undefined;
|
|
23
|
-
return (_jsxs("div", { ...props, style: { ...props.style, ...layoutStyle }, ref: ref, "aria-label": announcement.label, className: classNames("hjm-upload-item", className), "data-status": descriptor.state.status, role: "group", children: [leading === undefined ? null : _jsx("span", { "aria-hidden": "true", className: "hjm-upload-item__leading", children: leading }), _jsxs("div", { className: "hjm-upload-item__body", children: [_jsx("span", { className: "hjm-upload-item__name", children: descriptor.name }), descriptor.sizeLabel === undefined ? null : _jsx("span", { className: "hjm-upload-item__meta", children: descriptor.sizeLabel }), isUploading ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-atomic": "true", "aria-live": "polite", className: "hjm-upload-item__status hjm-visually-hidden", children: labels.uploading }), _jsx(Progress, { "aria-label": labels.uploading, label: labels.uploading, ...(progress === null || progress === undefined ? {} : { value: progress * 100 }), ...(progressValueText === undefined ? {} : { valueText: progressValueText }) })] })) : (_jsx("span", { className: "hjm-upload-item__status", "aria-live": "polite", children: announcement.description }))] }), action === "cancel" ? (_jsx(IconButton, { className: "hjm-upload-item__action", "data-action": "cancel", label: labels.cancel, onClick: () => onCancel?.(descriptor.id), tone: "ghost", children: _jsx(Icon, { name: "close" }) })) : action === "retry" ? (_jsx(IconButton, { className: "hjm-upload-item__action", "data-action": "retry", label: labels.retry, onClick: () => onRetry?.(descriptor.id), tone: "ghost", children: _jsx(Icon, { name: "refresh" }) })) : null] }));
|
|
23
|
+
return (_jsxs("div", { ...props, style: { ...props.style, ...layoutStyle }, ref: ref, "aria-label": announcement.label, className: classNames("hjm-upload-item", className), "data-status": descriptor.state.status, role: "group", children: [leading === undefined ? null : _jsx("span", { "aria-hidden": "true", className: "hjm-upload-item__leading", children: leading }), _jsxs("div", { className: "hjm-upload-item__body", children: [_jsx("span", { className: "hjm-upload-item__name", children: descriptor.name }), descriptor.sizeLabel === undefined ? null : _jsx("span", { className: "hjm-upload-item__meta", children: descriptor.sizeLabel }), isUploading ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-atomic": "true", "aria-live": "polite", className: "hjm-upload-item__status hjm-visually-hidden", children: labels.uploading }), _jsx(Progress, { "aria-label": labels.uploading, label: labels.uploading, ...(progress === null || progress === undefined ? {} : { value: progress * 100 }), ...(progressValueText === undefined ? {} : { valueText: progressValueText }) })] })) : (_jsx("span", { className: "hjm-upload-item__status", "aria-live": "polite", children: announcement.description }))] }), action === "cancel" ? (_jsx(IconButton, { className: "hjm-upload-item__action", edge: "end", "data-action": "cancel", label: labels.cancel, onClick: () => onCancel?.(descriptor.id), tone: "ghost", children: _jsx(Icon, { name: "close" }) })) : action === "retry" ? (_jsx(IconButton, { className: "hjm-upload-item__action", edge: "end", "data-action": "retry", label: labels.retry, onClick: () => onRetry?.(descriptor.id), tone: "ghost", children: _jsx(Icon, { name: "refresh" }) })) : null] }));
|
|
24
24
|
});
|
|
25
25
|
//# sourceMappingURL=upload-item.js.map
|
package/dist/upload-item.js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CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC,GAC7E,IACD,CACJ,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,yBAAyB,eAAW,QAAQ,YAAE,YAAY,CAAC,WAAW,GAAQ,CAC/F,IACG,EAIL,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CACrB,KAAC,UAAU,IAAC,SAAS,EAAC,yBAAyB,EAAC,IAAI,EAAC,KAAK,iBAAa,QAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,IAAI,EAAC,OAAO,YAAC,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GAAa,CAChM,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CACvB,KAAC,UAAU,IAAC,SAAS,EAAC,yBAAyB,EAAC,IAAI,EAAC,KAAK,iBAAa,OAAO,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,IAAI,EAAC,OAAO,YAAC,KAAC,IAAI,IAAC,IAAI,EAAC,SAAS,GAAG,GAAa,CAC/L,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import {\n getUploadItemAvailableAction,\n resolveUploadItemAnnouncement,\n type UploadItemDescriptor,\n type UploadItemLabels,\n} from \"@hjmds/design-contracts/components/upload-item\";\nimport { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { IconButton } from \"./actions.js\";\nimport { Progress } from \"./feedback.js\";\nimport { Icon } from \"./supplemental-display.js\";\nimport { classNames } from \"./internal.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type UploadItemProps = Omit<HTMLAttributes<HTMLDivElement>, \"children\"> & Readonly<{\n descriptor: UploadItemDescriptor;\n labels: UploadItemLabels;\n onCancel?: (id: string) => void;\n onRetry?: (id: string) => void;\n leading?: ReactNode;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\n/** One upload row whose available action is derived entirely from status. */\nexport const UploadItem = forwardRef<HTMLDivElement, UploadItemProps>(function UploadItem(\n { descriptor, labels, onCancel, onRetry, leading, className, layoutStyle, ...props },\n ref,\n) {\n const announcement = resolveUploadItemAnnouncement(descriptor, labels);\n const action = getUploadItemAvailableAction(descriptor.state);\n if (action === \"cancel\" && onCancel === undefined) {\n throw new TypeError(\"UploadItem requires onCancel while status is uploading\");\n }\n if (action === \"retry\" && onRetry === undefined) {\n throw new TypeError(\"UploadItem requires onRetry while status is error\");\n }\n const isUploading = descriptor.state.status === \"uploading\";\n const progress = isUploading ? descriptor.state.progress : undefined;\n const progressValueText =\n isUploading && announcement.description !== labels.uploading\n ? announcement.description\n : undefined;\n return (\n <div\n {...props}\n style={{ ...props.style, ...layoutStyle }}\n ref={ref}\n aria-label={announcement.label}\n className={classNames(\"hjm-upload-item\", className)}\n data-status={descriptor.state.status}\n role=\"group\"\n >\n {leading === undefined ? null : <span aria-hidden=\"true\" className=\"hjm-upload-item__leading\">{leading}</span>}\n <div className=\"hjm-upload-item__body\">\n <span className=\"hjm-upload-item__name\">{descriptor.name}</span>\n {descriptor.sizeLabel === undefined ? null : <span className=\"hjm-upload-item__meta\">{descriptor.sizeLabel}</span>}\n {isUploading ? (\n <>\n <span\n aria-atomic=\"true\"\n aria-live=\"polite\"\n className=\"hjm-upload-item__status hjm-visually-hidden\"\n >\n {labels.uploading}\n </span>\n <Progress\n aria-label={labels.uploading}\n label={labels.uploading}\n {...(progress === null || progress === undefined ? {} : { value: progress * 100 })}\n {...(progressValueText === undefined ? {} : { valueText: progressValueText })}\n />\n </>\n ) : (\n <span className=\"hjm-upload-item__status\" aria-live=\"polite\">{announcement.description}</span>\n )}\n </div>\n {/* Row tool actions are icon buttons named by the localized label. Cancelling an upload is not destructive, so\n it stays neutral instead of the danger text it used to be (2026-10-17 review). edge=\"end\" ends the glyph slot on\n the row's md inset, mirroring the file text's start inset (2026-10-17 measured audit: 26 vs 16). */}\n {action === \"cancel\" ? (\n <IconButton className=\"hjm-upload-item__action\" edge=\"end\" data-action=\"cancel\" label={labels.cancel} onClick={() => onCancel?.(descriptor.id)} tone=\"ghost\"><Icon name=\"close\" /></IconButton>\n ) : action === \"retry\" ? (\n <IconButton className=\"hjm-upload-item__action\" edge=\"end\" data-action=\"retry\" label={labels.retry} onClick={() => onRetry?.(descriptor.id)} tone=\"ghost\"><Icon name=\"refresh\" /></IconButton>\n ) : null}\n </div>\n );\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-list.d.ts","sourceRoot":"","sources":["../src/virtual-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"virtual-list.d.ts","sourceRoot":"","sources":["../src/virtual-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG1F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAAE,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IAAC,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAAC,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IACpO,mHAAmH;IACnH,WAAW,CAAC,EAAE,uBAAuB,CAAA;CAAE,CAAC;AAC1C,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAY,EAAE,WAAW,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC,+BA2DlJ"}
|
package/dist/virtual-list.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { resolveVirtualWindow, validateListKeys } from "@hjmds/design-contracts/components/virtual-list";
|
|
4
|
+
import { listRowRecipe } from "@hjmds/design-contracts/recipes";
|
|
4
5
|
/** Fixed-height rows are an explicit host contract; use List for unconstrained flowing copy. */
|
|
5
6
|
export function VirtualList({ items, keyExtractor, renderItem, rowHeight, height, label, empty, overscan = 3, layoutStyle }) {
|
|
6
7
|
const keys = useMemo(() => items.map(keyExtractor), [items, keyExtractor]);
|
|
@@ -58,7 +59,10 @@ export function VirtualList({ items, keyExtractor, renderItem, rowHeight, height
|
|
|
58
59
|
// Keep keyboard/descendant focus mounted when wheel scrolling moves it outside the window.
|
|
59
60
|
const indices = [...new Set([...Array.from({ length: range.end - range.start }, (_, i) => i + range.start), ...(items.length ? [selected] : []), ...(focused >= 0 ? [focused] : [])])].sort((a, b) => a - b);
|
|
60
61
|
// Pointer or programmatic focus must become the keyboard origin too.
|
|
61
|
-
return _jsx("div", { "data-hjm-virtual-list": true, className: "hjm-virtual-list", ref: host, role: "list", "aria-label": label, tabIndex: 0,
|
|
62
|
+
return _jsx("div", { "data-hjm-virtual-list": true, className: "hjm-virtual-list", ref: host, role: "list", "aria-label": label, tabIndex: 0,
|
|
63
|
+
// The viewport clips, so it leaves room for the ListRow surface bleed and bleeds itself by the same amount: row text
|
|
64
|
+
// stays on the host's content edge and the row fill is not cut or turned into horizontal scroll (2026-10-17).
|
|
65
|
+
style: { marginInline: -listRowRecipe.surfaceBleed, paddingInline: listRowRecipe.surfaceBleed, ...layoutStyle, overflowY: "auto", height, position: "relative" }, onScroll: event => setScrollTop(event.currentTarget.scrollTop), onKeyDown: event => {
|
|
62
66
|
if (!items.length || !(event.target instanceof HTMLElement) || (event.target !== event.currentTarget && !event.target.hasAttribute("data-virtual-row")))
|
|
63
67
|
return;
|
|
64
68
|
const next = event.key === "ArrowDown" ? Math.min(selected + 1, items.length - 1) : event.key === "ArrowUp" ? Math.max(0, selected - 1) : event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : null;
|
package/dist/virtual-list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-list.js","sourceRoot":"","sources":["../src/virtual-list.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AAKzG,gGAAgG;AAChG,MAAM,UAAU,WAAW,CAAI,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,GAAG,CAAC,EAAE,WAAW,EAAuB;IACjJ,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;IAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1G,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9C,MAAM,CAAC,MAAM,EA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AuB,EAAE,EAAE,GAAG,EAAE,IAAI,KAAK,EAAE,EAAE,IAAI,EAAC,UAAU,4BAAkB,SAAS,EAAC,uBAAuB,EAAC,QAAQ,EAAE,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAgB,KAAK,CAAC,MAAM,mBAAiB,KAAK,GAAG,CAAC,EAC/N,cAAc,EAAE,GAAG,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC;oBAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EACzM,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,GAAG,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAE,EAAE,KAAK,CAAC,IAF9F,IAAI,CAAC,KAAK,CAAC,CAE0F,CAAC,GAClI,GACF,CAAC;AACT,CAAC","sourcesContent":["import { useId, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { resolveVirtualWindow, validateListKeys } from \"@hjmds/design-contracts/components/virtual-list\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nexport type VirtualListProps<T> = { items: readonly T[]; keyExtractor: (item: T) => string; renderItem: (item: T, index: number) => ReactNode; rowHeight: number; height: number; label: string; empty?: ReactNode; overscan?: number;\n /** Canonical layout-only placement on the scroll viewport. `height` stays the prop's: the window math reads it. */\n layoutStyle?: HjmCompositionStyleProp };\n/** Fixed-height rows are an explicit host contract; use List for unconstrained flowing copy. */\nexport function VirtualList<T>({ items, keyExtractor, renderItem, rowHeight, height, label, empty, overscan = 3, layoutStyle }: VirtualListProps<T>) {\n const keys = useMemo(() => items.map(keyExtractor), [items, keyExtractor]); validateListKeys(keys, label);\n const [scrollTop, setScrollTop] = useState(0);\n const [active, setActive] = useState<{ key: string | null; index: number }>({ key: null, index: 0 });\n const [focusedKey, setFocusedKey] = useState<string | null>(null);\n const host = useRef<HTMLDivElement>(null); const moveFocus = useRef(false); const id = useId();\n const range = resolveVirtualWindow(items.length, rowHeight, height, scrollTop, overscan);\n // Stable keys preserve the focused item when filtering/reordering moves it outside the window.\n const activeIndex = active.key === null ? -1 : keys.indexOf(active.key);\n const selected = activeIndex >= 0 ? activeIndex : Math.min(active.index, Math.max(0, items.length - 1));\n const focused = focusedKey === null ? -1 : keys.indexOf(focusedKey);\n useLayoutEffect(() => { if (host.current && host.current.scrollTop !== range.offset) host.current.scrollTop = range.offset; }, [range.offset]);\n useLayoutEffect(() => { if (moveFocus.current) { document.getElementById(`${id}-${selected}`)?.focus({ preventScroll: true }); moveFocus.current = false; } }, [selected, id]);\n const previousKeys = useRef(keys);\n useLayoutEffect(() => {\n const previous = previousKeys.current;\n previousKeys.current = keys;\n if (focusedKey === null || keys.includes(focusedKey) || document.activeElement !== document.body) return;\n // Removing a focused DOM subtree sends focus to body without a blur event.\n // Continue at its former position (or the previous last row), never steal\n // focus from a control the user deliberately reached outside this list.\n const index = Math.min(Math.max(0, previous.indexOf(focusedKey)), Math.max(0, keys.length - 1));\n setFocusedKey(null);\n setActive({ key: keys[index] ?? null, index });\n const viewport = host.current;\n if (!viewport) return;\n if (!keys.length) { moveFocus.current = false; viewport.focus({ preventScroll: true }); return; }\n const top = index * rowHeight;\n if (top < viewport.scrollTop) viewport.scrollTop = top;\n else if (top + rowHeight > viewport.scrollTop + height) viewport.scrollTop = top + rowHeight - height;\n setScrollTop(viewport.scrollTop);\n moveFocus.current = true;\n const row = document.getElementById(`${id}-${index}`);\n if (row) { row.focus({ preventScroll: true }); moveFocus.current = false; }\n }, [keys, focusedKey, id, rowHeight, height]);\n // Keep keyboard/descendant focus mounted when wheel scrolling moves it outside the window.\n const indices = [...new Set([...Array.from({ length: range.end - range.start }, (_, i) => i + range.start), ...(items.length ? [selected] : []), ...(focused >= 0 ? [focused] : [])])].sort((a,b) => a-b);\n // Pointer or programmatic focus must become the keyboard origin too.\n return <div data-hjm-virtual-list className=\"hjm-virtual-list\" ref={host} role=\"list\" aria-label={label} tabIndex={0}\n style={{ ...layoutStyle, overflowY: \"auto\", height, position: \"relative\" }} onScroll={event => setScrollTop(event.currentTarget.scrollTop)}\n onKeyDown={event => {\n if (!items.length || !(event.target instanceof HTMLElement) || (event.target !== event.currentTarget && !event.target.hasAttribute(\"data-virtual-row\"))) return;\n const next = event.key === \"ArrowDown\" ? Math.min(selected + 1, items.length - 1) : event.key === \"ArrowUp\" ? Math.max(0, selected - 1) : event.key === \"Home\" ? 0 : event.key === \"End\" ? items.length - 1 : null;\n if (next === null) return; event.preventDefault(); moveFocus.current = true; setActive({ key: keys[next]!, index: next });\n const top = next * rowHeight; const viewport = event.currentTarget;\n if (top < viewport.scrollTop) viewport.scrollTop = top;\n else if (top + rowHeight > viewport.scrollTop + height) viewport.scrollTop = top + rowHeight - height;\n setScrollTop(viewport.scrollTop);\n const rendered = document.getElementById(`${id}-${next}`);\n if (rendered) { rendered.focus({ preventScroll: true }); moveFocus.current = false; }\n }}>\n {!items.length ? <div style={{ minHeight: \"100%\", display: \"flex\", flexDirection: \"column\", alignItems: \"center\", justifyContent: \"center\", textAlign: \"center\" }}>{empty}</div> : <div style={{ position: \"relative\", height: range.totalHeight }}>\n {indices.map(index => <div key={keys[index]} id={`${id}-${index}`} role=\"listitem\" data-virtual-row className=\"hjm-virtual-list__row\" tabIndex={index === selected ? 0 : -1} aria-setsize={items.length} aria-posinset={index + 1}\n onFocusCapture={() => { setFocusedKey(keys[index]!); setActive({ key: keys[index]!, index }); }} onBlurCapture={event => { if (!event.currentTarget.contains(event.relatedTarget)) setFocusedKey(null); }}\n style={{ position: \"absolute\", top: index * rowHeight, height: rowHeight, width: \"100%\" }}>{renderItem(items[index]!, index)}</div>)}\n </div>}\n </div>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"virtual-list.js","sourceRoot":"","sources":["../src/virtual-list.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAKhE,gGAAgG;AAChG,MAAM,UAAU,WAAW,CAAI,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,GAAG,CAAC,EAAE,WAAW,EAAuB;IACjJ,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;IAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1G,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAwC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IACrG,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAClE,MAAM,IAAI,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAAC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAAC,MAAM,EAA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KAAK,CAAC,MAAM,mBAAiB,KAAK,GAAG,CAAC,EAC/N,cAAc,EAAE,GAAG,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC;oBAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EACzM,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,GAAG,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAE,EAAE,KAAK,CAAC,IAF9F,IAAI,CAAC,KAAK,CAAC,CAE0F,CAAC,GAClI,GACF,CAAC;AACT,CAAC","sourcesContent":["import { useId, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { resolveVirtualWindow, validateListKeys } from \"@hjmds/design-contracts/components/virtual-list\";\nimport { listRowRecipe } from \"@hjmds/design-contracts/recipes\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nexport type VirtualListProps<T> = { items: readonly T[]; keyExtractor: (item: T) => string; renderItem: (item: T, index: number) => ReactNode; rowHeight: number; height: number; label: string; empty?: ReactNode; overscan?: number;\n /** Canonical layout-only placement on the scroll viewport. `height` stays the prop's: the window math reads it. */\n layoutStyle?: HjmCompositionStyleProp };\n/** Fixed-height rows are an explicit host contract; use List for unconstrained flowing copy. */\nexport function VirtualList<T>({ items, keyExtractor, renderItem, rowHeight, height, label, empty, overscan = 3, layoutStyle }: VirtualListProps<T>) {\n const keys = useMemo(() => items.map(keyExtractor), [items, keyExtractor]); validateListKeys(keys, label);\n const [scrollTop, setScrollTop] = useState(0);\n const [active, setActive] = useState<{ key: string | null; index: number }>({ key: null, index: 0 });\n const [focusedKey, setFocusedKey] = useState<string | null>(null);\n const host = useRef<HTMLDivElement>(null); const moveFocus = useRef(false); const id = useId();\n const range = resolveVirtualWindow(items.length, rowHeight, height, scrollTop, overscan);\n // Stable keys preserve the focused item when filtering/reordering moves it outside the window.\n const activeIndex = active.key === null ? -1 : keys.indexOf(active.key);\n const selected = activeIndex >= 0 ? activeIndex : Math.min(active.index, Math.max(0, items.length - 1));\n const focused = focusedKey === null ? -1 : keys.indexOf(focusedKey);\n useLayoutEffect(() => { if (host.current && host.current.scrollTop !== range.offset) host.current.scrollTop = range.offset; }, [range.offset]);\n useLayoutEffect(() => { if (moveFocus.current) { document.getElementById(`${id}-${selected}`)?.focus({ preventScroll: true }); moveFocus.current = false; } }, [selected, id]);\n const previousKeys = useRef(keys);\n useLayoutEffect(() => {\n const previous = previousKeys.current;\n previousKeys.current = keys;\n if (focusedKey === null || keys.includes(focusedKey) || document.activeElement !== document.body) return;\n // Removing a focused DOM subtree sends focus to body without a blur event.\n // Continue at its former position (or the previous last row), never steal\n // focus from a control the user deliberately reached outside this list.\n const index = Math.min(Math.max(0, previous.indexOf(focusedKey)), Math.max(0, keys.length - 1));\n setFocusedKey(null);\n setActive({ key: keys[index] ?? null, index });\n const viewport = host.current;\n if (!viewport) return;\n if (!keys.length) { moveFocus.current = false; viewport.focus({ preventScroll: true }); return; }\n const top = index * rowHeight;\n if (top < viewport.scrollTop) viewport.scrollTop = top;\n else if (top + rowHeight > viewport.scrollTop + height) viewport.scrollTop = top + rowHeight - height;\n setScrollTop(viewport.scrollTop);\n moveFocus.current = true;\n const row = document.getElementById(`${id}-${index}`);\n if (row) { row.focus({ preventScroll: true }); moveFocus.current = false; }\n }, [keys, focusedKey, id, rowHeight, height]);\n // Keep keyboard/descendant focus mounted when wheel scrolling moves it outside the window.\n const indices = [...new Set([...Array.from({ length: range.end - range.start }, (_, i) => i + range.start), ...(items.length ? [selected] : []), ...(focused >= 0 ? [focused] : [])])].sort((a,b) => a-b);\n // Pointer or programmatic focus must become the keyboard origin too.\n return <div data-hjm-virtual-list className=\"hjm-virtual-list\" ref={host} role=\"list\" aria-label={label} tabIndex={0}\n // The viewport clips, so it leaves room for the ListRow surface bleed and bleeds itself by the same amount: row text\n // stays on the host's content edge and the row fill is not cut or turned into horizontal scroll (2026-10-17).\n style={{ marginInline: -listRowRecipe.surfaceBleed, paddingInline: listRowRecipe.surfaceBleed, ...layoutStyle, overflowY: \"auto\", height, position: \"relative\" }} onScroll={event => setScrollTop(event.currentTarget.scrollTop)}\n onKeyDown={event => {\n if (!items.length || !(event.target instanceof HTMLElement) || (event.target !== event.currentTarget && !event.target.hasAttribute(\"data-virtual-row\"))) return;\n const next = event.key === \"ArrowDown\" ? Math.min(selected + 1, items.length - 1) : event.key === \"ArrowUp\" ? Math.max(0, selected - 1) : event.key === \"Home\" ? 0 : event.key === \"End\" ? items.length - 1 : null;\n if (next === null) return; event.preventDefault(); moveFocus.current = true; setActive({ key: keys[next]!, index: next });\n const top = next * rowHeight; const viewport = event.currentTarget;\n if (top < viewport.scrollTop) viewport.scrollTop = top;\n else if (top + rowHeight > viewport.scrollTop + height) viewport.scrollTop = top + rowHeight - height;\n setScrollTop(viewport.scrollTop);\n const rendered = document.getElementById(`${id}-${next}`);\n if (rendered) { rendered.focus({ preventScroll: true }); moveFocus.current = false; }\n }}>\n {!items.length ? <div style={{ minHeight: \"100%\", display: \"flex\", flexDirection: \"column\", alignItems: \"center\", justifyContent: \"center\", textAlign: \"center\" }}>{empty}</div> : <div style={{ position: \"relative\", height: range.totalHeight }}>\n {indices.map(index => <div key={keys[index]} id={`${id}-${index}`} role=\"listitem\" data-virtual-row className=\"hjm-virtual-list__row\" tabIndex={index === selected ? 0 : -1} aria-setsize={items.length} aria-posinset={index + 1}\n onFocusCapture={() => { setFocusedKey(keys[index]!); setActive({ key: keys[index]!, index }); }} onBlurCapture={event => { if (!event.currentTarget.contains(event.relatedTarget)) setFocusedKey(null); }}\n style={{ position: \"absolute\", top: index * rowHeight, height: rowHeight, width: \"100%\" }}>{renderItem(items[index]!, index)}</div>)}\n </div>}\n </div>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hjmds/react",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.2",
|
|
4
4
|
"description": "Accessible React 19 renderers for HJM design contracts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -635,7 +635,7 @@
|
|
|
635
635
|
"blobatar": "2.7.0",
|
|
636
636
|
"@blobatar/react": "2.7.0",
|
|
637
637
|
"lucide-react": "1.49.0",
|
|
638
|
-
"@hjmds/design-contracts": "1.27.
|
|
638
|
+
"@hjmds/design-contracts": "1.27.2"
|
|
639
639
|
},
|
|
640
640
|
"peerDependenciesMeta": {
|
|
641
641
|
"@number-flow/react": {
|