@hjmds/react 1.14.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/asset.d.ts.map +1 -1
  2. package/dist/asset.js +4 -1
  3. package/dist/asset.js.map +1 -1
  4. package/dist/clipboard.d.ts.map +1 -1
  5. package/dist/clipboard.js +39 -5
  6. package/dist/clipboard.js.map +1 -1
  7. package/dist/code-block.d.ts.map +1 -1
  8. package/dist/code-block.js +3 -1
  9. package/dist/code-block.js.map +1 -1
  10. package/dist/collapsible.d.ts +4 -0
  11. package/dist/collapsible.d.ts.map +1 -1
  12. package/dist/collapsible.js +4 -4
  13. package/dist/collapsible.js.map +1 -1
  14. package/dist/command-palette.d.ts.map +1 -1
  15. package/dist/command-palette.js +3 -1
  16. package/dist/command-palette.js.map +1 -1
  17. package/dist/content-transition.d.ts +1 -1
  18. package/dist/content-transition.d.ts.map +1 -1
  19. package/dist/content-transition.js +3 -2
  20. package/dist/content-transition.js.map +1 -1
  21. package/dist/context-menu.d.ts.map +1 -1
  22. package/dist/context-menu.js +3 -1
  23. package/dist/context-menu.js.map +1 -1
  24. package/dist/design-profile.d.ts +18 -0
  25. package/dist/design-profile.d.ts.map +1 -0
  26. package/dist/design-profile.js +27 -0
  27. package/dist/design-profile.js.map +1 -0
  28. package/dist/evidence.d.ts +1 -1
  29. package/dist/evidence.js +1 -1
  30. package/dist/evidence.js.map +1 -1
  31. package/dist/floating-action-button.d.ts +1 -1
  32. package/dist/heading.d.ts.map +1 -1
  33. package/dist/heading.js +3 -1
  34. package/dist/heading.js.map +1 -1
  35. package/dist/internal.d.ts +54 -0
  36. package/dist/internal.d.ts.map +1 -1
  37. package/dist/internal.js +7 -1
  38. package/dist/internal.js.map +1 -1
  39. package/dist/layout.d.ts.map +1 -1
  40. package/dist/layout.js +6 -3
  41. package/dist/layout.js.map +1 -1
  42. package/dist/menubar.d.ts.map +1 -1
  43. package/dist/menubar.js +3 -1
  44. package/dist/menubar.js.map +1 -1
  45. package/dist/navigation.d.ts.map +1 -1
  46. package/dist/navigation.js +30 -9
  47. package/dist/navigation.js.map +1 -1
  48. package/dist/popover.d.ts.map +1 -1
  49. package/dist/popover.js +3 -1
  50. package/dist/popover.js.map +1 -1
  51. package/dist/provider.d.ts +4 -0
  52. package/dist/provider.d.ts.map +1 -1
  53. package/dist/provider.js +5 -2
  54. package/dist/provider.js.map +1 -1
  55. package/dist/screens.d.ts +7 -2
  56. package/dist/screens.d.ts.map +1 -1
  57. package/dist/screens.js +20 -7
  58. package/dist/screens.js.map +1 -1
  59. package/dist/selection.d.ts.map +1 -1
  60. package/dist/selection.js +4 -1
  61. package/dist/selection.js.map +1 -1
  62. package/dist/styles.css +28 -5
  63. package/dist/styles.layered.css +28 -5
  64. package/dist/theme.d.ts.map +1 -1
  65. package/dist/theme.js +28 -7
  66. package/dist/theme.js.map +1 -1
  67. package/package.json +8 -3
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","sourceRoot":"","sources":["../src/popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAsD,MAAM,OAAO,CAAC;AACvM,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,aAAa,EAAE,wBAAwB,EAAE,wBAAwB,EAA0J,MAAM,4CAA4C,CAAC;AACtV,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB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CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAO,IACpK,GAA6B,GACpB,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC/B,CAAC,CAAC,CAAC","sourcesContent":["import { cloneElement, createContext, forwardRef, useCallback, useContext, useEffect, useId, useRef, useState, useSyncExternalStore, type CSSProperties, type ReactNode, type RefObject } from \"react\";\nimport { canDismissPopover, popoverBehaviorDefaults, popoverHoverDelay, popoverRecipe, resolvePopoverDescriptor, validatePopoverOpenState, type PopoverDescriptor, type PopoverDismissPolicy, type PopoverDismissReason, type PopoverOpenChangeDetails, type PopoverOpenOn, type PopoverOpenState } from \"@hjmds/design-contracts/components/popover\";\nimport { easing, layer } from \"@hjmds/design-contracts/foundations\";\nimport type { TransitionRect } from \"@hjmds/design-contracts/content-transition\";\nimport { useOverlayOriginMotion } from \"./internal/overlay-origin-motion.js\";\nimport { Button } from \"./actions.js\";\nimport { classNames, composeRefs } from \"./internal.js\";\nimport { AnchoredPortal, getPopoverOwner, useAnchoredPopup } from \"./portal.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\nimport type { OverlayTrigger } from \"./overlays.js\";\n\nexport type PopoverContentActions = Readonly<{ close(): void }>;\n// No `layoutStyle`: renders the caller's trigger plus an anchored portal; place the trigger instead.\nexport type PopoverProps = PopoverOpenState & Readonly<{\n trigger: OverlayTrigger;\n title: string;\n closeLabel: string;\n description?: string;\n descriptor?: PopoverDescriptor;\n children?: ReactNode | ((actions: PopoverContentActions) => ReactNode);\n dismissPolicy?: Partial<PopoverDismissPolicy>;\n /**\n * `\"hover\"` adds pointer enter/leave on top of the click path; it never\n * replaces it, because hover does not exist on touch or for a keyboard.\n */\n openOn?: PopoverOpenOn;\n /** Optional trigger bounds in viewport coordinates; state and focus remain non-modal. */\n motionOrigin?: TransitionRect;\n initialFocusRef?: RefObject<HTMLElement | null>;\n portalContainer?: HTMLElement;\n className?: string;\n}>;\nconst ParentPopoverOpen = createContext(true);\nconst motionQuery = \"(prefers-reduced-motion: reduce)\";\nfunction subscribeSystemMotion(notify: () => void) {\n const media = window.matchMedia(motionQuery); media.addEventListener(\"change\", notify);\n return () => media.removeEventListener(\"change\", notify);\n}\nconst readSystemMotion = () => window.matchMedia(motionQuery).matches;\nconst readServerMotion = () => false;\nconst focusable = 'a[href],button,input,select,textarea,[tabindex]';\nfunction tabStops(container: HTMLElement): HTMLElement[] {\n return [...container.querySelectorAll<HTMLElement>(focusable)].filter((node) =>\n node.tabIndex >= 0 && !node.matches(\":disabled\") && !node.closest('[inert],[hidden],[aria-hidden=\"true\"]') && node.getClientRects().length > 0 && getComputedStyle(node).visibility !== \"hidden\",\n ).sort((a, b) => (a.tabIndex > 0 ? a.tabIndex : Infinity) - (b.tabIndex > 0 ? b.tabIndex : Infinity));\n}\nfunction contains(content: HTMLElement, target: Node): boolean {\n if (content.contains(target)) return true;\n const visited = new Set<HTMLElement>(); let owner = getPopoverOwner(target);\n while (owner && !visited.has(owner)) {\n if (owner === content) return true;\n visited.add(owner); owner = getPopoverOwner(owner.parentElement);\n }\n return false;\n}\n\nexport const Popover = forwardRef<HTMLDivElement, PopoverProps>(function Popover({ trigger, title, closeLabel,\n description, descriptor = {}, children, dismissPolicy, openOn = popoverBehaviorDefaults.openOn, initialFocusRef, portalContainer, className, motionOrigin,\n open: controlledOpen, defaultOpen, onOpenChange }, ref) {\n if (!title.trim() || !closeLabel.trim()) throw new TypeError(\"Popover title and closeLabel must not be empty\");\n const resolved = resolvePopoverDescriptor(descriptor);\n validatePopoverOpenState({ ...(controlledOpen === undefined ? {} : { open: controlledOpen }), ...(defaultOpen === undefined ? {} : { defaultOpen }), ...(onOpenChange ? { onOpenChange } : {}) } as PopoverOpenState);\n const policy = { ...popoverBehaviorDefaults, ...dismissPolicy };\n const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false);\n const parentOpen = useContext(ParentPopoverOpen);\n const open = parentOpen && (controlledOpen ?? internalOpen);\n const previousParentOpen = useRef(parentOpen);\n useEffect(() => {\n if (!parentOpen && previousParentOpen.current && (controlledOpen ?? internalOpen)) {\n // A closed parent ends the child's session; reopening it must not resurrect\n // a stale uncontrolled submenu or leave a controlled owner uninformed.\n if (controlledOpen === undefined) setInternalOpen(false);\n onOpenChange?.(false, { reason: \"programmatic\" });\n }\n previousParentOpen.current = parentOpen;\n }, [parentOpen, controlledOpen, internalOpen, onOpenChange]);\n const theme = useOptionalHjmTheme();\n const systemReduced = useSyncExternalStore(subscribeSystemMotion, readSystemMotion, readServerMotion);\n const reduced = theme?.environment.reducedMotion ?? systemReduced;\n const [present, setPresent] = useState(open);\n const [node, setNode] = useState<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLElement>(null);\n const closeReason = useRef<PopoverDismissReason | undefined>(undefined);\n const focusWasInside = useRef(false);\n const didFocus = useRef(false);\n const requestPending = useRef(false);\n const id = `${useId().replaceAll(\":\", \"\")}-popover`;\n const state = useRef({ open, policy, onOpenChange, controlledOpen }); state.current = { open, policy, onOpenChange, controlledOpen };\n const change = useCallback((next: boolean, reason: PopoverOpenChangeDetails[\"reason\"]) => {\n const current = state.current;\n if (next === current.open || requestPending.current) return;\n if (!next && !canDismissPopover(reason as PopoverDismissReason, current.policy)) return;\n requestPending.current = true;\n // Deduplicate one interaction, but let a controlled owner reject it and receive a later attempt.\n queueMicrotask(() => { requestPending.current = false; });\n closeReason.current = next ? undefined : reason as PopoverDismissReason;\n if (current.controlledOpen === undefined) setInternalOpen(next);\n current.onOpenChange?.(next, { reason });\n }, []);\n useEffect(() => {\n if (open) { setPresent(true); return; }\n if (!present) return;\n // Keep only the exit surface briefly; inert/aria-hidden exclude it immediately.\n // A parent context closes nested popovers in the same render, including their portals.\n if (reduced) { setPresent(false); return; }\n const timeout = setTimeout(() => setPresent(false), popoverRecipe.transition.exit.duration);\n return () => clearTimeout(timeout);\n }, [open, present, reduced]);\n const position = useAnchoredPopup(triggerRef, open || present ? node : null, {\n placement: resolved.placement, align: resolved.align, gap: popoverRecipe.sideOffset,\n // Contextual forms share the dropdown tier with menus (DOM order puts a popover opened\n // from a menu above it) and stay below tooltips; a modal owner supplies its own layer\n // through the shared positioning helper.\n viewportPadding: popoverRecipe.collisionPadding, zIndex: layer.dropdown, fallbackAxis: true, layoutDimensions: motionOrigin !== undefined,\n });\n const motion = useOverlayOriginMotion(open, motionOrigin, reduced, {\n ready: position.style.visibility === \"visible\", transition: popoverRecipe.transition,\n });\n const setContent = useCallback((value: HTMLDivElement | null) => { setNode(value); }, []);\n const contentRef = useCallback(composeRefs(setContent, ref, motion.setNode), [setContent, ref, motion.setNode]);\n useEffect(() => {\n if (!open) {\n if (didFocus.current) {\n didFocus.current = false;\n const reason = closeReason.current;\n if ((reason === undefined || reason === \"programmatic\" || reason === \"escape\" || reason === \"close-action\") && focusWasInside.current) {\n queueMicrotask(() => {\n const active = document.activeElement;\n if (active === document.body || (node && active instanceof Node && contains(node, active))) triggerRef.current?.focus({ preventScroll: true });\n });\n }\n }\n closeReason.current = undefined; return;\n }\n if (!node || position.style.visibility !== \"visible\" || didFocus.current) return;\n didFocus.current = true;\n const initial = initialFocusRef?.current;\n const target = initial && contains(node, initial) ? initial : tabStops(node.querySelector<HTMLElement>(\"[data-hjm-popover-body]\")!)[0] ?? node;\n target.focus({ preventScroll: true }); focusWasInside.current = true;\n }, [open, node, position.style.visibility, initialFocusRef]);\n useEffect(() => {\n if (!open || !node) return;\n let pointerOutside = false;\n const inside = (target: EventTarget | null): target is Node => target instanceof Node && (contains(node, target) || triggerRef.current?.contains(target) === true);\n const pointer = (event: PointerEvent) => {\n pointerOutside = !inside(event.target);\n if (pointerOutside) change(false, \"outside-pointer\");\n };\n const pointerEnd = () => { pointerOutside = false; };\n const focus = (event: FocusEvent) => {\n focusWasInside.current = event.target instanceof Node && contains(node, event.target);\n if (!inside(event.target) && !pointerOutside) change(false, \"outside-focus\");\n };\n const keyboard = (event: KeyboardEvent) => {\n if (event.defaultPrevented || !inside(event.target)) return;\n const owner = getPopoverOwner(event.target instanceof Node ? event.target : null);\n if (owner && owner !== node) return;\n if (event.key === \"Escape\") { event.preventDefault(); event.stopPropagation(); change(false, \"escape\"); }\n if (event.key !== \"Tab\" || !(event.target instanceof Node) || !contains(node, event.target)) return;\n const stops = tabStops(node); const first = stops[0]; const last = stops.at(-1);\n if (event.shiftKey && (document.activeElement === first || document.activeElement === node)) {\n event.preventDefault(); triggerRef.current?.focus(); change(false, \"outside-focus\");\n } else if (!event.shiftKey && (document.activeElement === last || stops.length === 0)) {\n const all = tabStops(document.body).filter((item) => !contains(node, item));\n const index = all.indexOf(triggerRef.current!); const next = index >= 0 ? all[index + 1] : undefined;\n // Portals sit at the end of body; continue after the trigger's logical position.\n if (next) { event.preventDefault(); next.focus(); change(false, \"outside-focus\"); }\n }\n };\n document.addEventListener(\"pointerdown\", pointer); document.addEventListener(\"pointerup\", pointerEnd); document.addEventListener(\"pointercancel\", pointerEnd);\n document.addEventListener(\"focusin\", focus); document.addEventListener(\"keydown\", keyboard);\n return () => { document.removeEventListener(\"pointerdown\", pointer); document.removeEventListener(\"pointerup\", pointerEnd); document.removeEventListener(\"pointercancel\", pointerEnd); document.removeEventListener(\"focusin\", focus); document.removeEventListener(\"keydown\", keyboard); };\n }, [open, node, change]);\n const hoverTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const cancelHover = useCallback(() => { if (hoverTimer.current !== undefined) { clearTimeout(hoverTimer.current); hoverTimer.current = undefined; } }, []);\n useEffect(() => cancelHover, [cancelHover]);\n const scheduleHover = useCallback((next: boolean) => {\n cancelHover();\n // Delays on both edges: opening instantly turns a pass-through into a flash,\n // and closing instantly makes the gap between trigger and panel untraversable.\n hoverTimer.current = setTimeout(\n () => change(next, next ? \"trigger\" : \"outside-pointer\"),\n next ? popoverHoverDelay.open : popoverHoverDelay.close,\n );\n }, [cancelHover, change]);\n const hoverHandlers = openOn === \"hover\"\n ? {\n onPointerEnter: (event: { pointerType?: string }) => { if (event.pointerType !== \"touch\") scheduleHover(true); },\n onPointerLeave: (event: { pointerType?: string }) => { if (event.pointerType !== \"touch\") scheduleHover(false); },\n }\n : {};\n const triggerProps = trigger.props;\n const renderedTrigger = cloneElement(trigger, {\n ref: composeRefs(triggerProps.ref, triggerRef), \"aria-haspopup\": \"dialog\", \"aria-expanded\": open, \"aria-controls\": id,\n ...hoverHandlers,\n onClick: (event) => {\n triggerProps.onClick?.(event);\n if (event.defaultPrevented || triggerProps.disabled || triggerProps[\"aria-disabled\"] === true || triggerProps[\"aria-disabled\"] === \"true\") return;\n change(!open, open ? \"close-action\" : \"trigger\");\n },\n });\n const style = { ...position.style, \"--hjm-popover-max-width\": `${popoverRecipe.maxWidth}px`,\n \"--hjm-popover-duration\": `${open ? popoverRecipe.transition.enter.duration : reduced ? 0 : popoverRecipe.transition.exit.duration}ms`,\n \"--hjm-popover-easing\": `cubic-bezier(${easing[open ? popoverRecipe.transition.enter.easing : popoverRecipe.transition.exit.easing].join(\", \")})`,\n minWidth: Math.min(popoverRecipe.minWidth, Number(position.style.maxWidth ?? popoverRecipe.minWidth)),\n boxShadow: `0 ${popoverRecipe.surface.shadow.offsetY}px ${popoverRecipe.surface.shadow.radius}px ${popoverRecipe.surface.shadow.color}${Math.round(popoverRecipe.surface.shadow.opacity * 255).toString(16).padStart(2, \"0\")}`,\n\n } as CSSProperties;\n return <>{renderedTrigger}{open || present || motion.visible ? <AnchoredPortal anchorRef={triggerRef} ssrFallback=\"inline\" {...(portalContainer ? { container: portalContainer } : {})}>\n <ParentPopoverOpen.Provider value={open}><div ref={contentRef} id={id} role=\"dialog\" tabIndex={-1} data-hjm-popover-content=\"\" data-state={open ? \"open\" : \"closed\"}\n aria-hidden={!open || undefined} inert={!open || undefined} aria-label={resolved.accessibilityLabel} aria-labelledby={resolved.accessibilityLabel ? undefined : `${id}-title`} aria-describedby={description ? `${id}-description` : undefined}\n className={classNames(\"hjm-popover\", className)} style={style} data-placement={position.placement} data-align={position.align} {...hoverHandlers}\n onAnimationEnd={(event) => { if (!open && event.target === event.currentTarget) setPresent(false); }}>\n <div className=\"hjm-popover__header\"><h2 id={`${id}-title`} className=\"hjm-popover__title\">{title}</h2><Button tone=\"ghost\" onClick={() => change(false, \"close-action\")}>{closeLabel}</Button></div>\n {description ? <p id={`${id}-description`} className=\"hjm-popover__description\">{description}</p> : null}\n <div data-hjm-popover-body=\"\" className=\"hjm-popover__body\">{typeof children === \"function\" ? children({ close: () => change(false, \"close-action\") }) : children}</div>\n </div></ParentPopoverOpen.Provider>\n </AnchoredPortal> : null}</>;\n});\n"]}
1
+ {"version":3,"file":"popover.js","sourceRoot":"","sources":["../src/popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAsD,MAAM,OAAO,CAAC;AACvM,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,aAAa,EAAE,wBAAwB,EAAE,wBAAwB,EAA0J,MAAM,4CAA4C,CAAC;AACtV,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAwBpD,MAAM,iBAAiB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;AAC9C,MAAM,WAAW,GAAG,kCAAkC,CAAC;AACvD,SAAS,qBAAqB,CAAC,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C,QAAQ,GAAO,IACpK,GAA6B,GACpB,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC/B,CAAC,CAAC,CAAC","sourcesContent":["import { cloneElement, createContext, forwardRef, useCallback, useContext, useEffect, useId, useRef, useState, useSyncExternalStore, type CSSProperties, type ReactNode, type RefObject } from \"react\";\nimport { canDismissPopover, popoverBehaviorDefaults, popoverHoverDelay, popoverRecipe, resolvePopoverDescriptor, validatePopoverOpenState, type PopoverDescriptor, type PopoverDismissPolicy, type PopoverDismissReason, type PopoverOpenChangeDetails, type PopoverOpenOn, type PopoverOpenState } from \"@hjmds/design-contracts/components/popover\";\nimport { easing, layer } from \"@hjmds/design-contracts/foundations\";\nimport type { TransitionRect } from \"@hjmds/design-contracts/content-transition\";\nimport { useOverlayOriginMotion } from \"./internal/overlay-origin-motion.js\";\nimport { Button } from \"./actions.js\";\nimport { classNames, composeRefs } from \"./internal.js\";\nimport { AnchoredPortal, getPopoverOwner, useAnchoredPopup } from \"./portal.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\nimport type { OverlayTrigger } from \"./overlays.js\";\n\nexport type PopoverContentActions = Readonly<{ close(): void }>;\n// No `layoutStyle`: renders the caller's trigger plus an anchored portal; place the trigger instead.\nexport type PopoverProps = PopoverOpenState & Readonly<{\n trigger: OverlayTrigger;\n title: string;\n closeLabel: string;\n description?: string;\n descriptor?: PopoverDescriptor;\n children?: ReactNode | ((actions: PopoverContentActions) => ReactNode);\n dismissPolicy?: Partial<PopoverDismissPolicy>;\n /**\n * `\"hover\"` adds pointer enter/leave on top of the click path; it never\n * replaces it, because hover does not exist on touch or for a keyboard.\n */\n openOn?: PopoverOpenOn;\n /** Optional trigger bounds in viewport coordinates; state and focus remain non-modal. */\n motionOrigin?: TransitionRect;\n initialFocusRef?: RefObject<HTMLElement | null>;\n portalContainer?: HTMLElement;\n className?: string;\n}>;\nconst ParentPopoverOpen = createContext(true);\nconst motionQuery = \"(prefers-reduced-motion: reduce)\";\nfunction subscribeSystemMotion(notify: () => void) {\n const media = window.matchMedia(motionQuery); media.addEventListener(\"change\", notify);\n return () => media.removeEventListener(\"change\", notify);\n}\nconst readSystemMotion = () => window.matchMedia(motionQuery).matches;\nconst readServerMotion = () => false;\nconst focusable = 'a[href],button,input,select,textarea,[tabindex]';\nfunction tabStops(container: HTMLElement): HTMLElement[] {\n return [...container.querySelectorAll<HTMLElement>(focusable)].filter((node) =>\n node.tabIndex >= 0 && !node.matches(\":disabled\") && !node.closest('[inert],[hidden],[aria-hidden=\"true\"]') && node.getClientRects().length > 0 && getComputedStyle(node).visibility !== \"hidden\",\n ).sort((a, b) => (a.tabIndex > 0 ? a.tabIndex : Infinity) - (b.tabIndex > 0 ? b.tabIndex : Infinity));\n}\nfunction contains(content: HTMLElement, target: Node): boolean {\n if (content.contains(target)) return true;\n const visited = new Set<HTMLElement>(); let owner = getPopoverOwner(target);\n while (owner && !visited.has(owner)) {\n if (owner === content) return true;\n visited.add(owner); owner = getPopoverOwner(owner.parentElement);\n }\n return false;\n}\n\nexport const Popover = forwardRef<HTMLDivElement, PopoverProps>(function Popover({ trigger, title, closeLabel,\n description, descriptor = {}, children, dismissPolicy, openOn = popoverBehaviorDefaults.openOn, initialFocusRef, portalContainer, className, motionOrigin,\n open: controlledOpen, defaultOpen, onOpenChange }, ref) {\n if (!title.trim() || !closeLabel.trim()) throw new TypeError(\"Popover title and closeLabel must not be empty\");\n const resolved = resolvePopoverDescriptor(descriptor);\n validatePopoverOpenState({ ...(controlledOpen === undefined ? {} : { open: controlledOpen }), ...(defaultOpen === undefined ? {} : { defaultOpen }), ...(onOpenChange ? { onOpenChange } : {}) } as PopoverOpenState);\n const policy = { ...popoverBehaviorDefaults, ...dismissPolicy };\n const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false);\n const parentOpen = useContext(ParentPopoverOpen);\n const open = parentOpen && (controlledOpen ?? internalOpen);\n const previousParentOpen = useRef(parentOpen);\n useEffect(() => {\n if (!parentOpen && previousParentOpen.current && (controlledOpen ?? internalOpen)) {\n // A closed parent ends the child's session; reopening it must not resurrect\n // a stale uncontrolled submenu or leave a controlled owner uninformed.\n if (controlledOpen === undefined) setInternalOpen(false);\n onOpenChange?.(false, { reason: \"programmatic\" });\n }\n previousParentOpen.current = parentOpen;\n }, [parentOpen, controlledOpen, internalOpen, onOpenChange]);\n const theme = useOptionalHjmTheme();\n const systemReduced = useSyncExternalStore(subscribeSystemMotion, readSystemMotion, readServerMotion);\n const reduced = theme?.environment.reducedMotion ?? systemReduced;\n const [present, setPresent] = useState(open);\n const [node, setNode] = useState<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLElement>(null);\n const closeReason = useRef<PopoverDismissReason | undefined>(undefined);\n const focusWasInside = useRef(false);\n const didFocus = useRef(false);\n const requestPending = useRef(false);\n const id = `${useId().replaceAll(\":\", \"\")}-popover`;\n const state = useRef({ open, policy, onOpenChange, controlledOpen }); state.current = { open, policy, onOpenChange, controlledOpen };\n const change = useCallback((next: boolean, reason: PopoverOpenChangeDetails[\"reason\"]) => {\n const current = state.current;\n if (next === current.open || requestPending.current) return;\n if (!next && !canDismissPopover(reason as PopoverDismissReason, current.policy)) return;\n requestPending.current = true;\n // Deduplicate one interaction, but let a controlled owner reject it and receive a later attempt.\n queueMicrotask(() => { requestPending.current = false; });\n closeReason.current = next ? undefined : reason as PopoverDismissReason;\n if (current.controlledOpen === undefined) setInternalOpen(next);\n current.onOpenChange?.(next, { reason });\n }, []);\n useEffect(() => {\n if (open) { setPresent(true); return; }\n if (!present) return;\n // Keep only the exit surface briefly; inert/aria-hidden exclude it immediately.\n // A parent context closes nested popovers in the same render, including their portals.\n if (reduced) { setPresent(false); return; }\n const timeout = setTimeout(() => setPresent(false), popoverRecipe.transition.exit.duration);\n return () => clearTimeout(timeout);\n }, [open, present, reduced]);\n const position = useAnchoredPopup(triggerRef, open || present ? node : null, {\n placement: resolved.placement, align: resolved.align, gap: popoverRecipe.sideOffset,\n // Contextual forms share the dropdown tier with menus (DOM order puts a popover opened\n // from a menu above it) and stay below tooltips; a modal owner supplies its own layer\n // through the shared positioning helper.\n viewportPadding: popoverRecipe.collisionPadding, zIndex: layer.dropdown, fallbackAxis: true, layoutDimensions: motionOrigin !== undefined,\n });\n const motion = useOverlayOriginMotion(open, motionOrigin, reduced, {\n ready: position.style.visibility === \"visible\", transition: popoverRecipe.transition,\n });\n const setContent = useCallback((value: HTMLDivElement | null) => { setNode(value); }, []);\n const contentRef = useCallback(composeRefs(setContent, ref, motion.setNode), [setContent, ref, motion.setNode]);\n useEffect(() => {\n if (!open) {\n if (didFocus.current) {\n didFocus.current = false;\n const reason = closeReason.current;\n if ((reason === undefined || reason === \"programmatic\" || reason === \"escape\" || reason === \"close-action\") && focusWasInside.current) {\n queueMicrotask(() => {\n const active = document.activeElement;\n if (active === document.body || (node && active instanceof Node && contains(node, active))) triggerRef.current?.focus({ preventScroll: true });\n });\n }\n }\n closeReason.current = undefined; return;\n }\n if (!node || position.style.visibility !== \"visible\" || didFocus.current) return;\n didFocus.current = true;\n const initial = initialFocusRef?.current;\n const target = initial && contains(node, initial) ? initial : tabStops(node.querySelector<HTMLElement>(\"[data-hjm-popover-body]\")!)[0] ?? node;\n target.focus({ preventScroll: true }); focusWasInside.current = true;\n }, [open, node, position.style.visibility, initialFocusRef]);\n useEffect(() => {\n if (!open || !node) return;\n let pointerOutside = false;\n const inside = (target: EventTarget | null): target is Node => target instanceof Node && (contains(node, target) || triggerRef.current?.contains(target) === true);\n const pointer = (event: PointerEvent) => {\n pointerOutside = !inside(event.target);\n if (pointerOutside) change(false, \"outside-pointer\");\n };\n const pointerEnd = () => { pointerOutside = false; };\n const focus = (event: FocusEvent) => {\n focusWasInside.current = event.target instanceof Node && contains(node, event.target);\n if (!inside(event.target) && !pointerOutside) change(false, \"outside-focus\");\n };\n const keyboard = (event: KeyboardEvent) => {\n if (event.defaultPrevented || !inside(event.target)) return;\n const owner = getPopoverOwner(event.target instanceof Node ? event.target : null);\n if (owner && owner !== node) return;\n if (event.key === \"Escape\") { event.preventDefault(); event.stopPropagation(); change(false, \"escape\"); }\n if (event.key !== \"Tab\" || !(event.target instanceof Node) || !contains(node, event.target)) return;\n const stops = tabStops(node); const first = stops[0]; const last = stops.at(-1);\n if (event.shiftKey && (document.activeElement === first || document.activeElement === node)) {\n event.preventDefault(); triggerRef.current?.focus(); change(false, \"outside-focus\");\n } else if (!event.shiftKey && (document.activeElement === last || stops.length === 0)) {\n const all = tabStops(document.body).filter((item) => !contains(node, item));\n const index = all.indexOf(triggerRef.current!); const next = index >= 0 ? all[index + 1] : undefined;\n // Portals sit at the end of body; continue after the trigger's logical position.\n if (next) { event.preventDefault(); next.focus(); change(false, \"outside-focus\"); }\n }\n };\n document.addEventListener(\"pointerdown\", pointer); document.addEventListener(\"pointerup\", pointerEnd); document.addEventListener(\"pointercancel\", pointerEnd);\n document.addEventListener(\"focusin\", focus); document.addEventListener(\"keydown\", keyboard);\n return () => { document.removeEventListener(\"pointerdown\", pointer); document.removeEventListener(\"pointerup\", pointerEnd); document.removeEventListener(\"pointercancel\", pointerEnd); document.removeEventListener(\"focusin\", focus); document.removeEventListener(\"keydown\", keyboard); };\n }, [open, node, change]);\n const hoverTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const cancelHover = useCallback(() => { if (hoverTimer.current !== undefined) { clearTimeout(hoverTimer.current); hoverTimer.current = undefined; } }, []);\n useEffect(() => cancelHover, [cancelHover]);\n const scheduleHover = useCallback((next: boolean) => {\n cancelHover();\n // Delays on both edges: opening instantly turns a pass-through into a flash,\n // and closing instantly makes the gap between trigger and panel untraversable.\n hoverTimer.current = setTimeout(\n () => change(next, next ? \"trigger\" : \"outside-pointer\"),\n next ? popoverHoverDelay.open : popoverHoverDelay.close,\n );\n }, [cancelHover, change]);\n const hoverHandlers = openOn === \"hover\"\n ? {\n onPointerEnter: (event: { pointerType?: string }) => { if (event.pointerType !== \"touch\") scheduleHover(true); },\n onPointerLeave: (event: { pointerType?: string }) => { if (event.pointerType !== \"touch\") scheduleHover(false); },\n }\n : {};\n const triggerProps = trigger.props;\n const renderedTrigger = cloneElement(trigger, {\n ref: composeRefs(triggerProps.ref, triggerRef), \"aria-haspopup\": \"dialog\", \"aria-expanded\": open, \"aria-controls\": id,\n ...hoverHandlers,\n onClick: (event) => {\n triggerProps.onClick?.(event);\n if (event.defaultPrevented || triggerProps.disabled || triggerProps[\"aria-disabled\"] === true || triggerProps[\"aria-disabled\"] === \"true\") return;\n change(!open, open ? \"close-action\" : \"trigger\");\n },\n });\n const style = { ...position.style, \"--hjm-popover-max-width\": `${popoverRecipe.maxWidth}px`,\n \"--hjm-popover-duration\": `${open ? popoverRecipe.transition.enter.duration : reduced ? 0 : popoverRecipe.transition.exit.duration}ms`,\n \"--hjm-popover-easing\": `cubic-bezier(${easing[open ? popoverRecipe.transition.enter.easing : popoverRecipe.transition.exit.easing].join(\", \")})`,\n minWidth: Math.min(popoverRecipe.minWidth, Number(position.style.maxWidth ?? popoverRecipe.minWidth)),\n // Keep the legacy recipe without a profile; portal context variables follow\n // the nearest provider so an open editor cannot retain neutral elevation.\n boxShadow: theme?.designProfile ? \"var(--hjm-shadow-floating)\" : `0 ${popoverRecipe.surface.shadow.offsetY}px ${popoverRecipe.surface.shadow.radius}px ${popoverRecipe.surface.shadow.color}${Math.round(popoverRecipe.surface.shadow.opacity * 255).toString(16).padStart(2, \"0\")}`,\n\n } as CSSProperties;\n return <>{renderedTrigger}{open || present || motion.visible ? <AnchoredPortal anchorRef={triggerRef} ssrFallback=\"inline\" {...(portalContainer ? { container: portalContainer } : {})}>\n <ParentPopoverOpen.Provider value={open}><div ref={contentRef} id={id} role=\"dialog\" tabIndex={-1} data-hjm-popover-content=\"\" data-state={open ? \"open\" : \"closed\"}\n aria-hidden={!open || undefined} inert={!open || undefined} aria-label={resolved.accessibilityLabel} aria-labelledby={resolved.accessibilityLabel ? undefined : `${id}-title`} aria-describedby={description ? `${id}-description` : undefined}\n className={classNames(\"hjm-popover\", className)} style={style} data-placement={position.placement} data-align={position.align} {...hoverHandlers}\n onAnimationEnd={(event) => { if (!open && event.target === event.currentTarget) setPresent(false); }}>\n <div className=\"hjm-popover__header\"><h2 id={`${id}-title`} className=\"hjm-popover__title\">{title}</h2><Button tone=\"ghost\" onClick={() => change(false, \"close-action\")}>{closeLabel}</Button></div>\n {description ? <p id={`${id}-description`} className=\"hjm-popover__description\">{description}</p> : null}\n <div data-hjm-popover-body=\"\" className=\"hjm-popover__body\">{typeof children === \"function\" ? children({ close: () => change(false, \"close-action\") }) : children}</div>\n </div></ParentPopoverOpen.Provider>\n </AnchoredPortal> : null}</>;\n});\n"]}
@@ -1,3 +1,4 @@
1
+ import type { HjmDesignProfile } from "@hjmds/design-contracts/design-profile";
1
2
  import { type DesignSystemDensity, type DesignSystemDirection, type DesignSystemProviderValue, type DesignSystemTextScale, type ResolveDesignSystemEnvironmentOptions } from "@hjmds/design-contracts/components/design-system-provider";
2
3
  import type { ResolvedTheme, ThemePreference } from "@hjmds/design-contracts/colors";
3
4
  import { type HTMLAttributes, type ReactNode } from "react";
@@ -26,6 +27,8 @@ type HjmProviderEnvironmentProps = Readonly<{
26
27
  * following the OS theme and reduced-motion settings.
27
28
  */
28
29
  brandPalette?: HjmBrandPalette;
30
+ /** Appearance and interaction defaults defined once by the product. Explicit props win. */
31
+ designProfile?: HjmDesignProfile;
29
32
  }>;
30
33
  type HjmProviderValueProps = Readonly<{
31
34
  /** Complete, validated environment and semantic product palette. */
@@ -38,6 +41,7 @@ type HjmProviderValueProps = Readonly<{
38
41
  density?: never;
39
42
  systemTheme?: never;
40
43
  brandPalette?: never;
44
+ designProfile?: never;
41
45
  }>;
42
46
  /**
43
47
  * How the provider's own host element participates in layout and painting.
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAA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AK,CAAC;IAChB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,CAAC;AAGrD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,GAAG,KAAK,CACnB,GACC,QAAQ,CAAC;IACP,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB,CAAC,GAAG,CAAC,2BAA2B,GAAG,qBAAqB,CAAC,CAAC;AAE7D,eAAO,MAAM,WAAW,6GAuHvB,CAAC;AAEF,wBAAgB,WAAW,IAAI,yBAAyB,CAMvD;AAED,yFAAyF;AACzF,wBAAgB,mBAAmB,IAAI,yBAAyB,GAAG,IAAI,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EACrF,UAAU,EAAE,QAAQ,CAAC;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,GACnE,WAAW,GAAG,OAAO,CAMvB;AAED,uEAAuE;AACvE,wBAAgB,qBAAqB,IAAI,kBAAkB,GAAG,IAAI,CAEjE"}
package/dist/provider.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { DesignProfileContext } from "./internal.js";
2
3
  import { designSystemEnvironmentDefaults, isLargeTextScale, resolveDensityDefault, resolveDesignSystemProviderValue, validateDesignSystemProviderValue, } from "@hjmds/design-contracts/components/design-system-provider";
3
4
  import { tooltipBehaviorDefaults } from "@hjmds/design-contracts/components/tooltip";
4
5
  import { createContext, forwardRef, useCallback, useContext, useRef, useState, useSyncExternalStore, } from "react";
@@ -21,8 +22,9 @@ function subscribeMedia(query, callback) {
21
22
  function useMediaQuery(query, observe = true) {
22
23
  return useSyncExternalStore((callback) => observe ? subscribeMedia(query, callback) : () => undefined, () => observe && window.matchMedia(query).matches, () => false);
23
24
  }
24
- export const HjmProvider = forwardRef(function HjmProvider({ children, theme, direction, textScale, reducedMotion, minimumVisualTarget, density, systemTheme, brandPalette: suppliedBrandPalette, host = "surface", value: suppliedValue, className, style, ...rest }, ref) {
25
+ export const HjmProvider = forwardRef(function HjmProvider({ children, theme, direction, textScale, reducedMotion, minimumVisualTarget, density, systemTheme, brandPalette: suppliedBrandPalette, designProfile: suppliedDesignProfile, host = "surface", value: suppliedValue, className, style, ...rest }, ref) {
25
26
  const parent = useContext(HjmThemeContext);
27
+ const designProfile = suppliedDesignProfile ?? parent?.designProfile;
26
28
  const inheritedBrandPalette = useContext(HjmBrandPaletteContext);
27
29
  const brandPalette = suppliedBrandPalette ?? inheritedBrandPalette;
28
30
  const observesSystem = suppliedValue === undefined;
@@ -40,6 +42,7 @@ export const HjmProvider = forwardRef(function HjmProvider({ children, theme, di
40
42
  const value = suppliedValue ?? resolveDesignSystemProviderValue(input, {
41
43
  systemTheme: resolvedSystemTheme,
42
44
  ...(brandPalette === undefined ? {} : { brandPalette }),
45
+ ...(designProfile === undefined ? {} : { designProfile }),
43
46
  ...(parent === null ? {} : { parent: parent.environment }),
44
47
  ...(reducedMotion === undefined && parent === null
45
48
  ? { systemReducedMotion: prefersReducedMotion }
@@ -85,7 +88,7 @@ export const HjmProvider = forwardRef(function HjmProvider({ children, theme, di
85
88
  // module into granular entries like ./selection and blow their gzip budgets.
86
89
  // See issue #20.
87
90
  const largeText = isLargeTextScale(environment.textScale) ? "true" : undefined;
88
- return (_jsx(HjmThemeContext.Provider, { value: value, children: _jsx(HjmBrandPaletteContext.Provider, { value: suppliedValue === undefined ? brandPalette : undefined, children: _jsx(TooltipCoordinatorContext.Provider, { value: tooltipCoordinator, children: _jsx("div", { ...rest, ref: ref, className: classNames("hjm-root", className), "data-hjm-provider": "", "data-host": host, "data-motion": environment.reducedMotion ? "reduced" : "full", "data-theme": environment.theme, "data-text-scale": environment.textScale, "data-large-text": largeText, dir: environment.direction, style: { ...createHjmThemeStyle(value), ...style }, children: children }) }) }) }));
91
+ return (_jsx(HjmThemeContext.Provider, { value: value, children: _jsx(DesignProfileContext.Provider, { value: value.designProfile, children: _jsx(HjmBrandPaletteContext.Provider, { value: suppliedValue === undefined ? brandPalette : undefined, children: _jsx(TooltipCoordinatorContext.Provider, { value: tooltipCoordinator, children: _jsx("div", { ...rest, ref: ref, className: classNames("hjm-root", className), "data-hjm-provider": "", "data-host": host, "data-motion": environment.reducedMotion ? "reduced" : "full", "data-theme": environment.theme, "data-design-profile": value.designProfile?.id, "data-text-scale": environment.textScale, "data-large-text": largeText, dir: environment.direction, style: { ...createHjmThemeStyle(value), ...style }, children: children }) }) }) }) }));
89
92
  });
90
93
  export function useHjmTheme() {
91
94
  const value = useContext(HjmThemeContext);
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,+BAA+B,EAC/B,gBAAgB,EAChB,qBAAqB,EACrB,gCAAgC,EAChC,iCAAiC,GAMlC,MAAM,2DAA2D,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EACL,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,oBAAoB,GAGrB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,eAAe,GAAG,aAAa,CAAmC,IAAI,CAAC,CAAC;AAK9E;;;;;GAKG;AACH,MAAM,sBAAsB,GAAG,aAAa,CAA8B,SAAS,CAAC,CAAC;AASrF,MAAM,yBAAyB,GAAG,a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;IAC1C,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,mBAAmB;IACjC,OAAO,UAAU,CAAC,eAAe,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAoE;IAEpE,MAAM,KAAK,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAC1C,OAAO,qBAAqB,CAC1B,KAAK,EAAE,WAAW,CAAC,OAAO,IAAI,+BAA+B,CAAC,OAAO,EACrE,UAAU,CACX,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,qBAAqB;IACnC,OAAO,UAAU,CAAC,yBAAyB,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import {\n designSystemEnvironmentDefaults,\n isLargeTextScale,\n resolveDensityDefault,\n resolveDesignSystemProviderValue,\n validateDesignSystemProviderValue,\n type DesignSystemDensity,\n type DesignSystemDirection,\n type DesignSystemProviderValue,\n type DesignSystemTextScale,\n type ResolveDesignSystemEnvironmentOptions,\n} from \"@hjmds/design-contracts/components/design-system-provider\";\nimport type { ResolvedTheme, ThemePreference } from \"@hjmds/design-contracts/colors\";\nimport { tooltipBehaviorDefaults } from \"@hjmds/design-contracts/components/tooltip\";\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useRef,\n useState,\n useSyncExternalStore,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { classNames } from \"./internal.js\";\nimport { createHjmThemeStyle } from \"./theme.js\";\n\nconst HjmThemeContext = createContext<DesignSystemProviderValue | null>(null);\n\n/** Per-theme partial palette merged over the HJM defaults; see docs/brand-boundary.md. */\nexport type HjmBrandPalette = NonNullable<ResolveDesignSystemEnvironmentOptions[\"brandPalette\"]>;\n\n/**\n * The nearest ancestor's brand palette. A nested provider (for example one that\n * only changes density) keeps the product brand instead of falling back to the\n * HJM defaults, because the resolved palette alone cannot be split back into\n * defaults and overrides.\n */\nconst HjmBrandPaletteContext = createContext<HjmBrandPalette | undefined>(undefined);\n\nexport type TooltipCoordinator = Readonly<{\n activeId: string | null;\n activate(id: string): void;\n deactivate(id: string): void;\n shouldSkipDelay(): boolean;\n}>;\n\nconst TooltipCoordinatorContext = createContext<TooltipCoordinator | null>(null);\n\nfunction subscribeMedia(query: string, callback: () => void): () => void {\n const media = window.matchMedia(query);\n media.addEventListener(\"change\", callback);\n return () => media.removeEventListener(\"change\", callback);\n}\n\nfunction useMediaQuery(query: string, observe = true): boolean {\n return useSyncExternalStore(\n (callback) => observe ? subscribeMedia(query, callback) : () => undefined,\n () => observe && window.matchMedia(query).matches,\n () => false,\n );\n}\n\ntype HjmProviderEnvironmentProps = Readonly<{\n value?: never;\n theme?: ThemePreference;\n direction?: DesignSystemDirection;\n textScale?: DesignSystemTextScale;\n reducedMotion?: boolean;\n minimumVisualTarget?: boolean;\n /** Default row/menu/table density below this provider; each component's prop wins. */\n density?: DesignSystemDensity;\n /** Deterministic SSR/test override; otherwise prefers-color-scheme is observed. */\n systemTheme?: ResolvedTheme;\n /**\n * The supported brand route (docs/brand-boundary.md). Before 1.5.0 the only way\n * to brand was a hand-built `value`, which also stopped the provider from\n * following the OS theme and reduced-motion settings.\n */\n brandPalette?: HjmBrandPalette;\n}>;\n\ntype HjmProviderValueProps = Readonly<{\n /** Complete, validated environment and semantic product palette. */\n value: DesignSystemProviderValue;\n theme?: never;\n direction?: never;\n textScale?: never;\n reducedMotion?: never;\n minimumVisualTarget?: never;\n density?: never;\n systemTheme?: never;\n brandPalette?: never;\n}>;\n\n/**\n * How the provider's own host element participates in layout and painting.\n *\n * `surface` (default) paints the HJM background, text color and UI typography,\n * which is what a page whose root *is* the provider needs. A product whose\n * document root already paints its surface previously had to neutralise the\n * host with an inline `display: contents` style, re-entering product code into\n * the renderer boundary; `contents` is that intent as a supported axis — the\n * element still carries the CSS variables, `dir` and data attributes.\n */\nexport type HjmProviderHost = \"surface\" | \"contents\";\n\n// No `layoutStyle`: a theme/context provider, not a placed component; place its children.\nexport type HjmProviderProps = Omit<\n HTMLAttributes<HTMLDivElement>,\n \"children\" | \"dir\"\n> &\n Readonly<{\n children: ReactNode;\n host?: HjmProviderHost;\n }> & (HjmProviderEnvironmentProps | HjmProviderValueProps);\n\nexport const HjmProvider = forwardRef<HTMLDivElement, HjmProviderProps>(\n function HjmProvider(\n {\n children,\n theme,\n direction,\n textScale,\n reducedMotion,\n minimumVisualTarget,\n density,\n systemTheme,\n brandPalette: suppliedBrandPalette,\n host = \"surface\",\n value: suppliedValue,\n className,\n style,\n ...rest\n },\n ref,\n ) {\n const parent = useContext(HjmThemeContext);\n const inheritedBrandPalette = useContext(HjmBrandPaletteContext);\n const brandPalette = suppliedBrandPalette ?? inheritedBrandPalette;\n const observesSystem = suppliedValue === undefined;\n const prefersDark = useMediaQuery(\"(prefers-color-scheme: dark)\", observesSystem);\n const prefersReducedMotion = useMediaQuery(\n \"(prefers-reduced-motion: reduce)\",\n observesSystem,\n );\n const resolvedSystemTheme = systemTheme ?? (prefersDark ? \"dark\" : \"light\");\n const input = {\n ...(theme === undefined ? {} : { theme }),\n ...(direction === undefined ? {} : { direction }),\n ...(textScale === undefined ? {} : { textScale }),\n ...(reducedMotion === undefined ? {} : { reducedMotion }),\n ...(minimumVisualTarget === undefined ? {} : { minimumVisualTarget }),\n ...(density === undefined ? {} : { density }),\n };\n const value = suppliedValue ?? resolveDesignSystemProviderValue(input, {\n systemTheme: resolvedSystemTheme,\n ...(brandPalette === undefined ? {} : { brandPalette }),\n ...(parent === null ? {} : { parent: parent.environment }),\n ...(reducedMotion === undefined && parent === null\n ? { systemReducedMotion: prefersReducedMotion }\n : {}),\n });\n validateDesignSystemProviderValue(value);\n const environment = value.environment;\n const [activeTooltipId, setActiveTooltipId] = useState<string | null>(null);\n const activeTooltipIdRef = useRef<string | null>(null);\n const lastTooltipTransitionAtRef = useRef(Number.NEGATIVE_INFINITY);\n activeTooltipIdRef.current = activeTooltipId;\n const activateTooltip = useCallback((id: string) => {\n setActiveTooltipId((current) => {\n if (current === id) return current;\n if (current !== null) lastTooltipTransitionAtRef.current = Date.now();\n activeTooltipIdRef.current = id;\n return id;\n });\n }, []);\n const deactivateTooltip = useCallback((id: string) => {\n setActiveTooltipId((current) => {\n if (current !== id) return current;\n lastTooltipTransitionAtRef.current = Date.now();\n activeTooltipIdRef.current = null;\n return null;\n });\n }, []);\n const shouldSkipTooltipDelay = useCallback(\n () =>\n activeTooltipIdRef.current !== null ||\n Date.now() - lastTooltipTransitionAtRef.current <\n tooltipBehaviorDefaults.skipDelayMs,\n [],\n );\n const tooltipCoordinator: TooltipCoordinator = {\n activeId: activeTooltipId,\n activate: activateTooltip,\n deactivate: deactivateTooltip,\n shouldSkipDelay: shouldSkipTooltipDelay,\n };\n\n // `data-text-scale` is a number, so a stylesheet cannot ask whether it crossed\n // `largeTextThreshold`. The provider resolves that comparison once and publishes\n // the answer; letting each renderer read the environment instead would pull this\n // module into granular entries like ./selection and blow their gzip budgets.\n // See issue #20.\n const largeText = isLargeTextScale(environment.textScale) ? \"true\" : undefined;\n\n return (\n <HjmThemeContext.Provider value={value}>\n <HjmBrandPaletteContext.Provider value={suppliedValue === undefined ? brandPalette : undefined}>\n <TooltipCoordinatorContext.Provider value={tooltipCoordinator}>\n <div\n {...rest}\n ref={ref}\n className={classNames(\"hjm-root\", className)}\n data-hjm-provider=\"\"\n data-host={host}\n data-motion={environment.reducedMotion ? \"reduced\" : \"full\"}\n data-theme={environment.theme}\n data-text-scale={environment.textScale}\n data-large-text={largeText}\n dir={environment.direction}\n style={{ ...createHjmThemeStyle(value), ...style }}\n >\n {children}\n </div>\n </TooltipCoordinatorContext.Provider>\n </HjmBrandPaletteContext.Provider>\n </HjmThemeContext.Provider>\n );\n },\n);\n\nexport function useHjmTheme(): DesignSystemProviderValue {\n const value = useContext(HjmThemeContext);\n if (value === null) {\n throw new Error(\"useHjmTheme must be used inside HjmProvider\");\n }\n return value;\n}\n\n/** Renderer components use the browser default direction when no provider is present. */\nexport function useOptionalHjmTheme(): DesignSystemProviderValue | null {\n return useContext(HjmThemeContext);\n}\n\n/**\n * Resolves the provider's density onto one component's own density vocabulary.\n * Outside a provider the component's recipe default stands — a global axis must\n * not make an unwrapped renderer behave differently from a wrapped one at rest.\n */\nexport function useHjmDensityDefault<Comfortable extends string, Compact extends string>(\n vocabulary: Readonly<{ comfortable: Comfortable; compact: Compact }>,\n): Comfortable | Compact {\n const theme = useContext(HjmThemeContext);\n return resolveDensityDefault(\n theme?.environment.density ?? designSystemEnvironmentDefaults.density,\n vocabulary,\n );\n}\n\n/** Internal provider-scoped coordination used by Tooltip renderers. */\nexport function useTooltipCoordinator(): TooltipCoordinator | null {\n return useContext(TooltipCoordinatorContext);\n}\n"]}
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EACL,+BAA+B,EAC/B,gBAAgB,EAChB,qBAAqB,EACrB,gCAAgC,EAChC,iCAAiC,GAMlC,MAAM,2DAA2D,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EACL,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,oBAAoB,GAGrB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,eAAe,GAAG,aAAa,CAAmC,IAAI,CAAC,CAAC;AAK9E;;;;;GAKG;AACH,MAAM,sBAAsB,GAAG,aAAa,CAA8B,SAAS,CAAC,CAAC;AASrF,MAAM,yBAAyB,GAAG,aAAa,CAA4B,IAAI,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BACrB,SAAS,EAC1B,GAAG,EAAE,WAAW,CAAC,SAAS,EAC1B,KAAK,EAAE,EAAE,GAAG,mBAAmB,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,YAEjD,QAAQ,GACL,GAC6B,GACL,GACJ,GACP,CAC5B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,UAAU,WAAW;IACzB,MAAM,KAAK,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAC1C,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,mBAAmB;IACjC,OAAO,UAAU,CAAC,eAAe,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAoE;IAEpE,MAAM,KAAK,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAC1C,OAAO,qBAAqB,CAC1B,KAAK,EAAE,WAAW,CAAC,OAAO,IAAI,+BAA+B,CAAC,OAAO,EACrE,UAAU,CACX,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,qBAAqB;IACnC,OAAO,UAAU,CAAC,yBAAyB,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import { DesignProfileContext } from \"./internal.js\";\nimport type { HjmDesignProfile } from \"@hjmds/design-contracts/design-profile\";\nimport {\n designSystemEnvironmentDefaults,\n isLargeTextScale,\n resolveDensityDefault,\n resolveDesignSystemProviderValue,\n validateDesignSystemProviderValue,\n type DesignSystemDensity,\n type DesignSystemDirection,\n type DesignSystemProviderValue,\n type DesignSystemTextScale,\n type ResolveDesignSystemEnvironmentOptions,\n} from \"@hjmds/design-contracts/components/design-system-provider\";\nimport type { ResolvedTheme, ThemePreference } from \"@hjmds/design-contracts/colors\";\nimport { tooltipBehaviorDefaults } from \"@hjmds/design-contracts/components/tooltip\";\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useRef,\n useState,\n useSyncExternalStore,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { classNames } from \"./internal.js\";\nimport { createHjmThemeStyle } from \"./theme.js\";\n\nconst HjmThemeContext = createContext<DesignSystemProviderValue | null>(null);\n\n/** Per-theme partial palette merged over the HJM defaults; see docs/brand-boundary.md. */\nexport type HjmBrandPalette = NonNullable<ResolveDesignSystemEnvironmentOptions[\"brandPalette\"]>;\n\n/**\n * The nearest ancestor's brand palette. A nested provider (for example one that\n * only changes density) keeps the product brand instead of falling back to the\n * HJM defaults, because the resolved palette alone cannot be split back into\n * defaults and overrides.\n */\nconst HjmBrandPaletteContext = createContext<HjmBrandPalette | undefined>(undefined);\n\nexport type TooltipCoordinator = Readonly<{\n activeId: string | null;\n activate(id: string): void;\n deactivate(id: string): void;\n shouldSkipDelay(): boolean;\n}>;\n\nconst TooltipCoordinatorContext = createContext<TooltipCoordinator | null>(null);\n\nfunction subscribeMedia(query: string, callback: () => void): () => void {\n const media = window.matchMedia(query);\n media.addEventListener(\"change\", callback);\n return () => media.removeEventListener(\"change\", callback);\n}\n\nfunction useMediaQuery(query: string, observe = true): boolean {\n return useSyncExternalStore(\n (callback) => observe ? subscribeMedia(query, callback) : () => undefined,\n () => observe && window.matchMedia(query).matches,\n () => false,\n );\n}\n\ntype HjmProviderEnvironmentProps = Readonly<{\n value?: never;\n theme?: ThemePreference;\n direction?: DesignSystemDirection;\n textScale?: DesignSystemTextScale;\n reducedMotion?: boolean;\n minimumVisualTarget?: boolean;\n /** Default row/menu/table density below this provider; each component's prop wins. */\n density?: DesignSystemDensity;\n /** Deterministic SSR/test override; otherwise prefers-color-scheme is observed. */\n systemTheme?: ResolvedTheme;\n /**\n * The supported brand route (docs/brand-boundary.md). Before 1.5.0 the only way\n * to brand was a hand-built `value`, which also stopped the provider from\n * following the OS theme and reduced-motion settings.\n */\n brandPalette?: HjmBrandPalette;\n /** Appearance and interaction defaults defined once by the product. Explicit props win. */\n designProfile?: HjmDesignProfile;\n}>;\n\ntype HjmProviderValueProps = Readonly<{\n /** Complete, validated environment and semantic product palette. */\n value: DesignSystemProviderValue;\n theme?: never;\n direction?: never;\n textScale?: never;\n reducedMotion?: never;\n minimumVisualTarget?: never;\n density?: never;\n systemTheme?: never;\n brandPalette?: never;\n designProfile?: never;\n}>;\n\n/**\n * How the provider's own host element participates in layout and painting.\n *\n * `surface` (default) paints the HJM background, text color and UI typography,\n * which is what a page whose root *is* the provider needs. A product whose\n * document root already paints its surface previously had to neutralise the\n * host with an inline `display: contents` style, re-entering product code into\n * the renderer boundary; `contents` is that intent as a supported axis — the\n * element still carries the CSS variables, `dir` and data attributes.\n */\nexport type HjmProviderHost = \"surface\" | \"contents\";\n\n// No `layoutStyle`: a theme/context provider, not a placed component; place its children.\nexport type HjmProviderProps = Omit<\n HTMLAttributes<HTMLDivElement>,\n \"children\" | \"dir\"\n> &\n Readonly<{\n children: ReactNode;\n host?: HjmProviderHost;\n }> & (HjmProviderEnvironmentProps | HjmProviderValueProps);\n\nexport const HjmProvider = forwardRef<HTMLDivElement, HjmProviderProps>(\n function HjmProvider(\n {\n children,\n theme,\n direction,\n textScale,\n reducedMotion,\n minimumVisualTarget,\n density,\n systemTheme,\n brandPalette: suppliedBrandPalette,\n designProfile: suppliedDesignProfile,\n host = \"surface\",\n value: suppliedValue,\n className,\n style,\n ...rest\n },\n ref,\n ) {\n const parent = useContext(HjmThemeContext);\n const designProfile = suppliedDesignProfile ?? parent?.designProfile;\n const inheritedBrandPalette = useContext(HjmBrandPaletteContext);\n const brandPalette = suppliedBrandPalette ?? inheritedBrandPalette;\n const observesSystem = suppliedValue === undefined;\n const prefersDark = useMediaQuery(\"(prefers-color-scheme: dark)\", observesSystem);\n const prefersReducedMotion = useMediaQuery(\n \"(prefers-reduced-motion: reduce)\",\n observesSystem,\n );\n const resolvedSystemTheme = systemTheme ?? (prefersDark ? \"dark\" : \"light\");\n const input = {\n ...(theme === undefined ? {} : { theme }),\n ...(direction === undefined ? {} : { direction }),\n ...(textScale === undefined ? {} : { textScale }),\n ...(reducedMotion === undefined ? {} : { reducedMotion }),\n ...(minimumVisualTarget === undefined ? {} : { minimumVisualTarget }),\n ...(density === undefined ? {} : { density }),\n };\n const value = suppliedValue ?? resolveDesignSystemProviderValue(input, {\n systemTheme: resolvedSystemTheme,\n ...(brandPalette === undefined ? {} : { brandPalette }),\n ...(designProfile === undefined ? {} : { designProfile }),\n ...(parent === null ? {} : { parent: parent.environment }),\n ...(reducedMotion === undefined && parent === null\n ? { systemReducedMotion: prefersReducedMotion }\n : {}),\n });\n validateDesignSystemProviderValue(value);\n const environment = value.environment;\n const [activeTooltipId, setActiveTooltipId] = useState<string | null>(null);\n const activeTooltipIdRef = useRef<string | null>(null);\n const lastTooltipTransitionAtRef = useRef(Number.NEGATIVE_INFINITY);\n activeTooltipIdRef.current = activeTooltipId;\n const activateTooltip = useCallback((id: string) => {\n setActiveTooltipId((current) => {\n if (current === id) return current;\n if (current !== null) lastTooltipTransitionAtRef.current = Date.now();\n activeTooltipIdRef.current = id;\n return id;\n });\n }, []);\n const deactivateTooltip = useCallback((id: string) => {\n setActiveTooltipId((current) => {\n if (current !== id) return current;\n lastTooltipTransitionAtRef.current = Date.now();\n activeTooltipIdRef.current = null;\n return null;\n });\n }, []);\n const shouldSkipTooltipDelay = useCallback(\n () =>\n activeTooltipIdRef.current !== null ||\n Date.now() - lastTooltipTransitionAtRef.current <\n tooltipBehaviorDefaults.skipDelayMs,\n [],\n );\n const tooltipCoordinator: TooltipCoordinator = {\n activeId: activeTooltipId,\n activate: activateTooltip,\n deactivate: deactivateTooltip,\n shouldSkipDelay: shouldSkipTooltipDelay,\n };\n\n // `data-text-scale` is a number, so a stylesheet cannot ask whether it crossed\n // `largeTextThreshold`. The provider resolves that comparison once and publishes\n // the answer; letting each renderer read the environment instead would pull this\n // module into granular entries like ./selection and blow their gzip budgets.\n // See issue #20.\n const largeText = isLargeTextScale(environment.textScale) ? \"true\" : undefined;\n\n return (\n <HjmThemeContext.Provider value={value}>\n <DesignProfileContext.Provider value={value.designProfile}>\n <HjmBrandPaletteContext.Provider value={suppliedValue === undefined ? brandPalette : undefined}>\n <TooltipCoordinatorContext.Provider value={tooltipCoordinator}>\n <div\n {...rest}\n ref={ref}\n className={classNames(\"hjm-root\", className)}\n data-hjm-provider=\"\"\n data-host={host}\n data-motion={environment.reducedMotion ? \"reduced\" : \"full\"}\n data-theme={environment.theme}\n data-design-profile={value.designProfile?.id}\n data-text-scale={environment.textScale}\n data-large-text={largeText}\n dir={environment.direction}\n style={{ ...createHjmThemeStyle(value), ...style }}\n >\n {children}\n </div>\n </TooltipCoordinatorContext.Provider>\n </HjmBrandPaletteContext.Provider>\n </DesignProfileContext.Provider>\n </HjmThemeContext.Provider>\n );\n },\n);\n\nexport function useHjmTheme(): DesignSystemProviderValue {\n const value = useContext(HjmThemeContext);\n if (value === null) {\n throw new Error(\"useHjmTheme must be used inside HjmProvider\");\n }\n return value;\n}\n\n/** Renderer components use the browser default direction when no provider is present. */\nexport function useOptionalHjmTheme(): DesignSystemProviderValue | null {\n return useContext(HjmThemeContext);\n}\n\n/**\n * Resolves the provider's density onto one component's own density vocabulary.\n * Outside a provider the component's recipe default stands — a global axis must\n * not make an unwrapped renderer behave differently from a wrapped one at rest.\n */\nexport function useHjmDensityDefault<Comfortable extends string, Compact extends string>(\n vocabulary: Readonly<{ comfortable: Comfortable; compact: Compact }>,\n): Comfortable | Compact {\n const theme = useContext(HjmThemeContext);\n return resolveDensityDefault(\n theme?.environment.density ?? designSystemEnvironmentDefaults.density,\n vocabulary,\n );\n}\n\n/** Internal provider-scoped coordination used by Tooltip renderers. */\nexport function useTooltipCoordinator(): TooltipCoordinator | null {\n return useContext(TooltipCoordinatorContext);\n}\n"]}
package/dist/screens.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type DesignProfileScreenPresentation } from "@hjmds/design-contracts/design-profile-layout";
1
2
  import type { ReactionPickerProps } from "./reaction-picker.js";
2
3
  import { type Ref, type ReactNode } from "react";
3
4
  import { type MessageAttachmentDescriptor, type ChatMessageDescriptor, type MessageComposerDescriptor, type ScreenContentState } from "@hjmds/design-contracts/screen-patterns";
@@ -8,6 +9,8 @@ export type ScreenLayoutProps = Readonly<{
8
9
  /** Preserve host navigation while the shared shell owns content and state. */
9
10
  header?: ReactNode;
10
11
  contentInset?: "default" | "none";
12
+ /** Explicit layout wins over the nearest design profile. */
13
+ presentation?: DesignProfileScreenPresentation;
11
14
  description?: string;
12
15
  leading?: ReactNode;
13
16
  actions?: ReactNode;
@@ -27,7 +30,7 @@ export type ScreenLayoutProps = Readonly<{
27
30
  layoutStyle?: HjmCompositionStyleProp;
28
31
  }>;
29
32
  /** Shared screen shell. Routing, data, permission checks and mutation state remain product-owned. */
30
- export declare function ScreenLayout({ title, header, contentInset, description, leading, actions, notice, footer, state, stateAction, children, scroll, as: Element, className, layoutStyle }: ScreenLayoutProps): import("react").JSX.Element;
33
+ export declare function ScreenLayout({ title, header, contentInset, presentation: suppliedPresentation, description, leading, actions, notice, footer, state, stateAction, children, scroll, as: Element, className, layoutStyle }: ScreenLayoutProps): import("react").JSX.Element;
31
34
  export type SettingsScreenSection = Readonly<{
32
35
  id: string;
33
36
  title: string;
@@ -63,6 +66,8 @@ export type MessageComposerProps = Omit<MessageComposerDescriptor, "attachmentCo
63
66
  additionalContent?: boolean;
64
67
  leadingAction?: ReactNode;
65
68
  inputRef?: Ref<HTMLTextAreaElement>;
69
+ /** Release typing presence when the host input loses focus. */
70
+ onBlur?: () => void;
66
71
  onValueChange(value: string): void;
67
72
  onSend(value: string): void;
68
73
  context?: ReactNode;
@@ -89,7 +94,7 @@ export type MessageComposerProps = Omit<MessageComposerDescriptor, "attachmentCo
89
94
  /** Canonical layout-only placement on the composer root. Controlled visual keys are excluded. */
90
95
  layoutStyle?: HjmCompositionStyleProp;
91
96
  }>;
92
- export declare function MessageComposer({ value, label, sendLabel, disabled, pending, onValueChange, onSend, maxLength, sendDisabled, additionalContent, leadingAction, inputRef, context, replyTo, sendIcon, sendPresentation, attachmentAction, attachments, onRemoveAttachment, layoutStyle }: MessageComposerProps): import("react").JSX.Element;
97
+ export declare function MessageComposer({ value, label, sendLabel, placeholder, description, error, invalid, submitMode, onBlur, disabled, pending, onValueChange, onSend, maxLength, sendDisabled, additionalContent, leadingAction, inputRef, context, replyTo, sendIcon, sendPresentation, attachmentAction, attachments, onRemoveAttachment, layoutStyle }: MessageComposerProps): import("react").JSX.Element;
93
98
  export type ChatMessageProps = ChatMessageDescriptor & Readonly<{
94
99
  children: ReactNode;
95
100
  interactiveContent?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"screens.d.ts","sourceRoot":"","sources":["../src/screens.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,OAAO,EAA2B,KAAK,GAAG,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAA8D,KAAK,2BAA2B,EAAkD,KAAK,qBAAqB,EAAE,KAAK,yBAAyB,EAAE,KAAK,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAI5R,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SA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,MAAM,CAAC;YAAC,OAAO,IAAI,IAAI,CAAC;YAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,CAAC;IAClc,mGAAmG;IACnG,WAAW,CAAC,EAAE,uBAAuB,CAAA;CAAE,CAAC,CAAC;AAC3C,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAwB,EAAE,WAAW,EAAE,EAAE,gBAAgB,+BAkBxM"}
package/dist/screens.js CHANGED
@@ -1,23 +1,29 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { resolveDesignProfileScreen } from "@hjmds/design-contracts/design-profile-layout";
2
3
  import { MessageReactions } from "./internal/message-reactions.js";
3
4
  import { Button, IconButton } from "./actions.js";
4
5
  import { TextArea } from "./forms.js";
5
6
  import { useId, useRef, useState } from "react";
6
- import { isReplySwipe, canSubmitMessage, validateMessageAttachments, resolveScreenContentState, screenPatternRecipe } from "@hjmds/design-contracts/screen-patterns";
7
+ import { isReplySwipe, shouldSubmitMessageKey, canSubmitMessage, validateMessageAttachments, resolveScreenContentState, screenPatternRecipe } from "@hjmds/design-contracts/screen-patterns";
7
8
  import { Heading } from "./heading.js";
8
9
  import { Spinner } from "./internal/spinner.js";
9
10
  import { Section, Stack, Text } from "./layout.js";
10
11
  import { ListRow } from "./display.js";
11
- import { classNames } from "./internal.js";
12
+ import { classNames, useDesignProfileDefaults } from "./internal.js";
12
13
  /** Shared screen shell. Routing, data, permission checks and mutation state remain product-owned. */
13
- export function ScreenLayout({ title, header, contentInset = "default", description, leading, actions, notice, footer, state = { kind: "ready" }, stateAction, children, scroll = "screen", as: Element = "main", className, layoutStyle }) {
14
+ export function ScreenLayout({ title, header, contentInset = "default", presentation: suppliedPresentation, description, leading, actions, notice, footer, state = { kind: "ready" }, stateAction, children, scroll = "screen", as: Element = "main", className, layoutStyle }) {
14
15
  const id = useId();
16
+ // Screens historically work with the stylesheet alone. Optional context keeps
17
+ // that path while inheriting profiles from an enclosing Provider when present.
18
+ const designProfile = useDesignProfileDefaults();
19
+ const presentation = suppliedPresentation ?? designProfile?.screens.overview;
20
+ const profileLayout = presentation === undefined ? undefined : resolveDesignProfileScreen(presentation);
15
21
  const resolved = resolveScreenContentState(state);
16
22
  // Replacement text owns scrolling even when the ready state delegates it to
17
23
  // a virtual list. Use the rendered mode for keyboard access as well as CSS.
18
24
  const bodyScroll = resolved.replacesContent ? "screen" : scroll;
19
25
  const recipe = screenPatternRecipe;
20
- return _jsxs(Element, { "aria-labelledby": header ? undefined : id, "aria-label": header ? title : undefined, "data-content-inset": contentInset, className: classNames("hjm-screen", className), style: { "--hjm-screen-width": `${recipe.maxWidth}px`, "--hjm-screen-padding": `${contentInset === "none" ? 0 : recipe.padding}px`, "--hjm-screen-gap": `${recipe.sectionGap}px`, "--hjm-screen-item-gap": `${recipe.itemGap}px`, "--hjm-screen-state-gap": `${recipe.stateGap}px`, "--hjm-screen-header-min": `${recipe.headerMinWidth}px`, ...layoutStyle }, children: [header ?? _jsxs("header", { className: "hjm-screen__header", children: [leading, _jsxs("div", { className: "hjm-screen__heading", children: [_jsx(Heading, { level: "level3", semanticLevel: 1, id: id, children: title }), description ? _jsx(Text, { as: "p", tone: "muted", children: description }) : null] }), actions] }), notice ? _jsx("div", { className: "hjm-screen__notice", children: notice }) : null, _jsx("div", { tabIndex: bodyScroll === "content" ? undefined : 0, className: "hjm-screen__body", "data-scroll": bodyScroll, "data-replacement": resolved.replacesContent || undefined, "aria-busy": resolved.busy || undefined, children: state.kind === "ready" ? children : _jsxs("div", { className: "hjm-screen__state", children: [resolved.busy ? _jsx(Spinner, { label: [state.title, state.description].filter(Boolean).join(". ") }) : _jsx("div", { role: state.kind === "error" ? "alert" : "status", children: _jsxs(Stack, { gap: "sm", align: "center", children: [_jsx(Text, { variant: "title", children: state.title }), state.description ? _jsx(Text, { tone: "muted", children: state.description }) : null] }) }), stateAction] }) }), footer ? _jsx("footer", { className: "hjm-screen__footer", children: footer }) : null] });
26
+ return _jsxs(Element, { "aria-labelledby": header ? undefined : id, "aria-label": header ? title : undefined, "data-content-inset": contentInset, "data-presentation": presentation, className: classNames("hjm-screen", className), style: { backgroundColor: designProfile?.material.canvas ? "transparent" : undefined, "--hjm-screen-width": `${profileLayout?.maxWidth ?? recipe.maxWidth}px`, "--hjm-screen-padding": `${contentInset === "none" ? 0 : recipe.padding}px`, "--hjm-screen-gap": `${profileLayout?.gap ?? recipe.sectionGap}px`, "--hjm-screen-item-gap": `${recipe.itemGap}px`, "--hjm-screen-state-gap": `${recipe.stateGap}px`, "--hjm-screen-header-min": `${recipe.headerMinWidth}px`, ...layoutStyle }, children: [header ?? _jsxs("header", { className: "hjm-screen__header", style: profileLayout ? { flexDirection: profileLayout.headerAxis, alignItems: profileLayout.centered ? "center" : undefined, textAlign: profileLayout.centered ? "center" : undefined } : undefined, children: [leading, _jsxs("div", { className: "hjm-screen__heading", children: [_jsx(Heading, { level: "level3", semanticLevel: 1, id: id, children: title }), description ? _jsx(Text, { as: "p", tone: "muted", children: description }) : null] }), actions] }), notice ? _jsx("div", { className: "hjm-screen__notice", children: notice }) : null, _jsx("div", { tabIndex: bodyScroll === "content" ? undefined : 0, className: "hjm-screen__body", "data-scroll": bodyScroll, "data-replacement": resolved.replacesContent || undefined, "aria-busy": resolved.busy || undefined, children: state.kind === "ready" ? children : _jsxs("div", { className: "hjm-screen__state", children: [resolved.busy ? _jsx(Spinner, { label: [state.title, state.description].filter(Boolean).join(". ") }) : _jsx("div", { role: state.kind === "error" ? "alert" : "status", children: _jsxs(Stack, { gap: "sm", align: "center", children: [_jsx(Text, { variant: "title", children: state.title }), state.description ? _jsx(Text, { tone: "muted", children: state.description }) : null] }) }), stateAction] }) }), footer ? _jsx("footer", { className: "hjm-screen__footer", children: footer }) : null] });
21
27
  }
22
28
  export function SettingsScreen({ profile, sections, ...props }) {
23
29
  return _jsx(ScreenLayout, { ...props, children: _jsxs(Stack, { gap: "xl", children: [profile, sections.map(section => _jsx(Section, { className: "hjm-settings-section", title: section.title, description: section.description, children: section.children }, section.id))] }) });
@@ -32,7 +38,7 @@ export function NotificationItem({ read, statusLabel, timestamp, description, ti
32
38
  export function ChatScreen({ composer, scroll = "content", ...props }) {
33
39
  return _jsx(ScreenLayout, { ...props, scroll: scroll, footer: !props.state || props.state.kind === "ready" ? composer : null });
34
40
  }
35
- export function MessageComposer({ value, label, sendLabel, disabled = false, pending = false, onValueChange, onSend, maxLength, sendDisabled = false, additionalContent = false, leadingAction, inputRef, context, replyTo, sendIcon, sendPresentation = "inline", attachmentAction, attachments = [], onRemoveAttachment, layoutStyle }) {
41
+ export function MessageComposer({ value, label, sendLabel, placeholder = label, description, error, invalid = false, submitMode = "newline", onBlur, disabled = false, pending = false, onValueChange, onSend, maxLength, sendDisabled = false, additionalContent = false, leadingAction, inputRef, context, replyTo, sendIcon, sendPresentation = "inline", attachmentAction, attachments = [], onRemoveAttachment, layoutStyle }) {
36
42
  validateMessageAttachments(attachments);
37
43
  if (attachments.length && !onRemoveAttachment)
38
44
  throw new TypeError("Attachments require a removal callback");
@@ -44,8 +50,15 @@ export function MessageComposer({ value, label, sendLabel, disabled = false, pen
44
50
  const send = sendIcon ? _jsx(IconButton, { label: sendLabel, size: sendPresentation === "circle" ? "small" : "medium", shape: "circle", tone: sendPresentation === "circle" ? "primary" : "ghost", disabled: !canSend, loading: pending, onClick: () => { if (canSend)
45
51
  onSend(value); }, children: sendIcon }) : _jsx(Button, { disabled: !canSend, loading: pending, onClick: () => { if (canSend)
46
52
  onSend(value); }, children: sendLabel });
47
- // Enter stays a newline for IME; receipt-driven clearing and failed-send recovery belong to the host.
48
- return _jsxs("div", { className: "hjm-message-composer", "data-send-presentation": sendPresentation, style: { "--hjm-message-composer-gap": `${screenPatternRecipe.itemGap}px`, "--hjm-attachment-size": `${screenPatternRecipe.attachmentSize}px`, "--hjm-attachment-remove-size": `${screenPatternRecipe.attachmentRemoveSize}px`, ...layoutStyle }, children: [context, replyTo ? _jsxs(Stack, { axis: "inline", gap: "sm", align: "center", children: [_jsxs(Stack, { gap: "xxs", children: [_jsx(Text, { variant: "caption", emphasis: "strong", children: replyTo.author }), _jsx(Text, { variant: "caption", tone: "muted", children: replyTo.excerpt })] }), _jsx(IconButton, { label: replyTo.cancelLabel, tone: "ghost", disabled: locked, onClick: replyTo.onCancel, children: _jsx(Text, { children: "\u00D7" }) })] }) : null, attachments.length ? _jsxs("div", { className: "hjm-message-composer__attachments", children: [attachments.map(item => _jsxs("div", { className: "hjm-message-composer__attachment", children: [_jsx("div", { className: "hjm-message-composer__preview", children: item.preview }), _jsx("span", { className: "hjm-message-composer__remove", children: _jsx(IconButton, { label: item.removeLabel, tone: "ghost", size: "small", disabled: locked, onClick: () => onRemoveAttachment?.(item.id), children: _jsx("span", { className: "hjm-message-composer__remove-glyph", "aria-hidden": "true", children: "\u00D7" }) }) })] }, item.id)), attach] }) : null, _jsxs("div", { className: "hjm-message-composer__row", children: [_jsx(TextArea, { ref: inputRef, maxLength: maxLength, leadingAction: leadingAction, shape: "large", rows: screenPatternRecipe.composerMinLines, "aria-label": label, placeholder: label, value: value, disabled: locked, onChange: event => onValueChange(event.currentTarget.value), minVisibleLines: screenPatternRecipe.composerMinLines, maxVisibleLines: screenPatternRecipe.composerMaxLines, ...(sendIcon ? { trailing: hasContent || pending ? send : attach } : {}) }), sendIcon ? null : send] })] });
53
+ // Readonly pending input preserves the keyboard/focus for receipt failure recovery; disabling it would blur desktop chat.
54
+ // Enter is opt-in and IME-safe; receipt-driven clearing and failed-send recovery belong to the host.
55
+ return _jsxs("div", { className: "hjm-message-composer", "data-send-presentation": sendPresentation, style: { "--hjm-message-composer-gap": `${screenPatternRecipe.itemGap}px`, "--hjm-attachment-size": `${screenPatternRecipe.attachmentSize}px`, "--hjm-attachment-remove-size": `${screenPatternRecipe.attachmentRemoveSize}px`, ...layoutStyle }, children: [context, replyTo ? _jsxs(Stack, { axis: "inline", gap: "sm", align: "center", children: [_jsxs(Stack, { gap: "xxs", children: [_jsx(Text, { variant: "caption", emphasis: "strong", children: replyTo.author }), _jsx(Text, { variant: "caption", tone: "muted", children: replyTo.excerpt })] }), _jsx(IconButton, { label: replyTo.cancelLabel, tone: "ghost", disabled: locked, onClick: replyTo.onCancel, children: _jsx(Text, { children: "\u00D7" }) })] }) : null, attachments.length ? _jsxs("div", { className: "hjm-message-composer__attachments", children: [attachments.map(item => _jsxs("div", { className: "hjm-message-composer__attachment", children: [_jsx("div", { className: "hjm-message-composer__preview", children: item.preview }), _jsx("span", { className: "hjm-message-composer__remove", children: _jsx(IconButton, { label: item.removeLabel, tone: "ghost", size: "small", disabled: locked || item.disabled, onClick: () => { if (!locked && !item.disabled)
56
+ onRemoveAttachment?.(item.id); }, children: _jsx("span", { className: "hjm-message-composer__remove-glyph", "aria-hidden": "true", children: "\u00D7" }) }) })] }, item.id)), attach] }) : null, _jsxs("div", { className: "hjm-message-composer__row", children: [_jsx(TextArea, { ref: inputRef, maxLength: maxLength, leadingAction: leadingAction, shape: "large", rows: screenPatternRecipe.composerMinLines, "aria-label": label, placeholder: placeholder, description: description, error: error, "aria-invalid": invalid || undefined, onBlur: onBlur, value: value, disabled: disabled, readOnly: pending, "aria-busy": pending || undefined, onKeyDown: event => { if (shouldSubmitMessageKey({ key: event.key, shiftKey: event.shiftKey, isComposing: event.nativeEvent.isComposing, keyCode: event.nativeEvent.keyCode }, submitMode)) {
57
+ event.preventDefault();
58
+ if (canSend)
59
+ onSend(value);
60
+ } }, onChange: event => { if (!locked)
61
+ onValueChange(event.currentTarget.value); }, minVisibleLines: screenPatternRecipe.composerMinLines, maxVisibleLines: screenPatternRecipe.composerMaxLines, ...(sendIcon ? { trailing: hasContent || pending ? send : attach } : {}) }), sendIcon ? null : send] })] });
49
62
  }
50
63
  export function ChatMessage({ direction, author, timestamp, deliveryLabel, avatar, reply, actions, replyAction, replyLink, reactions, children, interactiveContent = false, layoutStyle }) {
51
64
  const start = useRef(null);
@@ -1 +1 @@
1
- {"version":3,"file":"screens.js","sourceRoot":"","sources":["../src/screens.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAA4B,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAoC,yBAAyB,EAAE,mBAAmB,EAAuF,MAAM,yCAAyC,CAAC;AAC5R,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA2B3C,qGAAqG;AACrG,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,GAAG,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,EAAE,EAAE,OAAO,GAAG,MAAM,EAAE,SAAS,EAAE,WAAW,EAAqB;IAC3P,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,MAAM,QAAQ,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAC;IAClD,4EAA4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AK,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,aAAG,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,yBAAyB,YAAE,KAAK,GAAO,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,IAAoB,CAAC,CAAC,CAAC,eAAK,SAAS,EAAC,0BAA0B,aAAE,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,yBAAyB,YAAE,KAAK,GAAO,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,IAAO,EACzV,SAAS,IAAE,aAAa,IAAE,OAAO,CAAA,CAAC,CAAA,eAAK,SAAS,EAAC,wBAAwB,aAAE,SAAS,IAAE,aAAa,CAAA,CAAC,CAAA,MAAC,IAAI,IAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,OAAO,aAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,IAAQ,CAAA,CAAC,CAAA,IAAI,EAAE,OAAO,IAAO,CAAA,CAAC,CAAA,IAAI,IAC9N,IACE,CAAC;AACb,CAAC","sourcesContent":["import { MessageReactions } from \"./internal/message-reactions.js\";\nimport type { ReactionPickerProps } from \"./reaction-picker.js\";\nimport { Button, IconButton } from \"./actions.js\";\nimport { TextArea } from \"./forms.js\";\nimport { useId, useRef, useState, type Ref, type ReactNode } from \"react\";\nimport { isReplySwipe, canSubmitMessage, validateMessageAttachments, type MessageAttachmentDescriptor, resolveScreenContentState, screenPatternRecipe, type ChatMessageDescriptor, type MessageComposerDescriptor, type ScreenContentState } from \"@hjmds/design-contracts/screen-patterns\";\nimport { Heading } from \"./heading.js\";\nimport { Spinner } from \"./internal/spinner.js\";\nimport { Section, Stack, Text } from \"./layout.js\";\nimport { ListRow, type ListRowProps } from \"./display.js\";\nimport { classNames } from \"./internal.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type ScreenLayoutProps = Readonly<{\n title: string;\n /** Preserve host navigation while the shared shell owns content and state. */\n header?: ReactNode;\n contentInset?: \"default\" | \"none\";\n description?: string;\n leading?: ReactNode;\n actions?: ReactNode;\n notice?: ReactNode;\n footer?: ReactNode;\n state?: ScreenContentState;\n stateAction?: ReactNode;\n children?: ReactNode;\n /** A virtualized list must own scrolling; never nest it inside a second scroll container. */\n scroll?: \"screen\" | \"content\";\n as?: \"main\" | \"section\";\n className?: string;\n /**\n * Canonical layout-only placement on the screen root (for example `flex` or `width` in a split\n * view), matching Native ScreenLayout. Every screen built on ScreenLayout forwards it.\n */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\n/** Shared screen shell. Routing, data, permission checks and mutation state remain product-owned. */\nexport function ScreenLayout({ title, header, contentInset = \"default\", description, leading, actions, notice, footer, state = { kind: \"ready\" }, stateAction, children, scroll = \"screen\", as: Element = \"main\", className, layoutStyle }: ScreenLayoutProps) {\n const id = useId();\n const resolved = resolveScreenContentState(state);\n // Replacement text owns scrolling even when the ready state delegates it to\n // a virtual list. Use the rendered mode for keyboard access as well as CSS.\n const bodyScroll = resolved.replacesContent ? \"screen\" : scroll;\n const recipe = screenPatternRecipe;\n return <Element aria-labelledby={header ? undefined : id} aria-label={header ? title : undefined} data-content-inset={contentInset} className={classNames(\"hjm-screen\", className)}\n style={{ \"--hjm-screen-width\": `${recipe.maxWidth}px`, \"--hjm-screen-padding\": `${contentInset === \"none\" ? 0 : recipe.padding}px`, \"--hjm-screen-gap\": `${recipe.sectionGap}px`, \"--hjm-screen-item-gap\": `${recipe.itemGap}px`, \"--hjm-screen-state-gap\": `${recipe.stateGap}px`, \"--hjm-screen-header-min\": `${recipe.headerMinWidth}px`, ...layoutStyle } as React.CSSProperties}>\n {header ?? <header className=\"hjm-screen__header\">\n {leading}<div className=\"hjm-screen__heading\"><Heading level=\"level3\" semanticLevel={1} id={id}>{title}</Heading>\n {description ? <Text as=\"p\" tone=\"muted\">{description}</Text> : null}</div>{actions}\n </header>}\n {notice ? <div className=\"hjm-screen__notice\">{notice}</div> : null}\n {/* Scrollable read-only screens still need a keyboard entry point. */}\n <div tabIndex={bodyScroll === \"content\" ? undefined : 0} className=\"hjm-screen__body\" data-scroll={bodyScroll} data-replacement={resolved.replacesContent || undefined} aria-busy={resolved.busy || undefined}>\n {state.kind === \"ready\" ? children : <div className=\"hjm-screen__state\">\n {/* Loading copy is an accessible name; visible copy beside the spinner\n contradicts the shared spinner-only loading contract. */}\n {resolved.busy ? <Spinner label={[state.title, state.description].filter(Boolean).join(\". \")} /> : <div role={state.kind === \"error\" ? \"alert\" : \"status\"}>\n <Stack gap=\"sm\" align=\"center\"><Text variant=\"title\">{state.title}</Text>\n {state.description ? <Text tone=\"muted\">{state.description}</Text> : null}</Stack>\n </div>}\n {stateAction}\n </div>}\n </div>\n {footer ? <footer className=\"hjm-screen__footer\">{footer}</footer> : null}\n </Element>;\n}\n\nexport type SettingsScreenSection = Readonly<{ id: string; title: string; description?: string; children: ReactNode }>;\nexport type SettingsScreenProps = Omit<ScreenLayoutProps, \"children\" | \"scroll\"> & Readonly<{ profile?: ReactNode; sections: readonly SettingsScreenSection[] }>;\nexport function SettingsScreen({ profile, sections, ...props }: SettingsScreenProps) {\n return <ScreenLayout {...props}><Stack gap=\"xl\">{profile}{sections.map(section =>\n <Section className=\"hjm-settings-section\" key={section.id} title={section.title} description={section.description}>{section.children}</Section>)}</Stack></ScreenLayout>;\n}\n\nexport type NotificationInboxScreenProps = Omit<ScreenLayoutProps, \"children\"> & Readonly<{\n filters?: ReactNode;\n children: ReactNode;\n}>;\nexport function NotificationInboxScreen({ filters, children, notice, ...props }: NotificationInboxScreenProps) {\n return <ScreenLayout {...props} notice={<Stack gap=\"sm\">{notice}{filters}</Stack>}>{children}</ScreenLayout>;\n}\n\n/** Read/unread is announced in localized copy as well as emphasis; rendering never marks an item read. */\nexport type NotificationItemProps = Omit<ListRowProps, \"description\" | \"selected\"> & Readonly<{\n read: boolean;\n statusLabel: string;\n timestamp: string;\n description?: ReactNode;\n}>;\nexport function NotificationItem({ read, statusLabel, timestamp, description, title, className, ...props }: NotificationItemProps) {\n return <ListRow {...props} className={classNames(\"hjm-notification-item\", className)} data-unread={!read || undefined} title={<Text emphasis={read ? \"regular\" : \"strong\"}>{title}</Text>}\n description={<Stack gap=\"xxs\">{description}<Text variant=\"caption\" tone=\"muted\">{statusLabel} · {timestamp}</Text></Stack>} />;\n}\n\nexport type ChatScreenProps = Omit<ScreenLayoutProps, \"footer\"> & Readonly<{ composer: ReactNode }>;\n/** Caller supplies a virtualized timeline and keyboard-aware composer; no implicit auto-scroll or send. */\nexport function ChatScreen({ composer, scroll = \"content\", ...props }: ChatScreenProps) {\n return <ScreenLayout {...props} scroll={scroll} footer={!props.state || props.state.kind === \"ready\" ? composer : null} />;\n}\n\nexport type MessageComposerProps = Omit<MessageComposerDescriptor, \"attachmentCount\"> & Readonly<{\n maxLength?: number;\n sendDisabled?: boolean;\n additionalContent?: boolean;\n leadingAction?: ReactNode;\n inputRef?: Ref<HTMLTextAreaElement>;\n onValueChange(value: string): void;\n onSend(value: string): void;\n context?: ReactNode;\n replyTo?: Readonly<{ author: string; excerpt: string; cancelLabel: string; onCancel(): void }>;\n /** Icon mode puts the send/attachment action inside the growing field. */\n sendIcon?: ReactNode;\n /** Reference comment layout: a filled circular send action inside the field. */\n sendPresentation?: \"inline\" | \"circle\";\n attachmentAction?: Readonly<{ label: string; icon: ReactNode; onPress(): void; disabled?: boolean }>;\n attachments?: readonly (MessageAttachmentDescriptor & Readonly<{ preview: ReactNode }>)[];\n onRemoveAttachment?: (id: string) => void;\n /** Canonical layout-only placement on the composer root. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\nexport function MessageComposer({ value, label, sendLabel, disabled = false, pending = false, onValueChange, onSend, maxLength, sendDisabled = false, additionalContent = false, leadingAction, inputRef, context, replyTo, sendIcon, sendPresentation = \"inline\", attachmentAction, attachments = [], onRemoveAttachment, layoutStyle }: MessageComposerProps) {\n validateMessageAttachments(attachments);\n if (attachments.length && !onRemoveAttachment) throw new TypeError(\"Attachments require a removal callback\");\n const canSend = !sendDisabled && canSubmitMessage({ value, label, sendLabel, disabled, pending, attachmentCount: attachments.length + (additionalContent ? 1 : 0) });\n const locked = disabled || pending;\n // A bounded corner radius keeps multiline/large-text content inside the field instead of a tall pill.\n const hasContent = !!value.trim() || attachments.length > 0 || additionalContent;\n const attach = attachmentAction ? <IconButton label={attachmentAction.label} tone=\"ghost\" disabled={locked || attachmentAction.disabled} onClick={attachmentAction.onPress}>{attachmentAction.icon}</IconButton> : null;\n const send = sendIcon ? <IconButton label={sendLabel} size={sendPresentation === \"circle\" ? \"small\" : \"medium\"} shape=\"circle\" tone={sendPresentation === \"circle\" ? \"primary\" : \"ghost\"} disabled={!canSend} loading={pending} onClick={() => { if (canSend) onSend(value); }}>{sendIcon}</IconButton> : <Button disabled={!canSend} loading={pending} onClick={() => { if (canSend) onSend(value); }}>{sendLabel}</Button>;\n // Enter stays a newline for IME; receipt-driven clearing and failed-send recovery belong to the host.\n return <div className=\"hjm-message-composer\" data-send-presentation={sendPresentation} style={{\"--hjm-message-composer-gap\": `${screenPatternRecipe.itemGap}px`, \"--hjm-attachment-size\": `${screenPatternRecipe.attachmentSize}px`, \"--hjm-attachment-remove-size\": `${screenPatternRecipe.attachmentRemoveSize}px`, ...layoutStyle} as React.CSSProperties}>{context}{replyTo ? <Stack axis=\"inline\" gap=\"sm\" align=\"center\"><Stack gap=\"xxs\"><Text variant=\"caption\" emphasis=\"strong\">{replyTo.author}</Text><Text variant=\"caption\" tone=\"muted\">{replyTo.excerpt}</Text></Stack><IconButton label={replyTo.cancelLabel} tone=\"ghost\" disabled={locked} onClick={replyTo.onCancel}><Text>×</Text></IconButton></Stack> : null}\n {attachments.length ? <div className=\"hjm-message-composer__attachments\">{attachments.map(item => <div key={item.id} className=\"hjm-message-composer__attachment\"><div className=\"hjm-message-composer__preview\">{item.preview}</div><span className=\"hjm-message-composer__remove\"><IconButton label={item.removeLabel} tone=\"ghost\" size=\"small\" disabled={locked} onClick={() => onRemoveAttachment?.(item.id)}><span className=\"hjm-message-composer__remove-glyph\" aria-hidden=\"true\">×</span></IconButton></span></div>)}{attach}</div> : null}\n <div className=\"hjm-message-composer__row\"><TextArea ref={inputRef} maxLength={maxLength} leadingAction={leadingAction} shape=\"large\" rows={screenPatternRecipe.composerMinLines} aria-label={label} placeholder={label} value={value} disabled={locked}\n onChange={event => onValueChange(event.currentTarget.value)} minVisibleLines={screenPatternRecipe.composerMinLines} maxVisibleLines={screenPatternRecipe.composerMaxLines}\n {...(sendIcon ? { trailing: hasContent || pending ? send : attach } : {})} />\n {sendIcon ? null : send}\n </div></div>;\n}\n\nexport type ChatMessageProps = ChatMessageDescriptor & Readonly<{ children: ReactNode; interactiveContent?: boolean; avatar?: ReactNode; reply?: ReactNode; actions?: ReactNode; replyAction?: Readonly<{label:string; onPress():void; disabled?:boolean}>; replyLink?: Readonly<{label:string; onPress():void}>; reactions?: ReactionPickerProps & Readonly<{ closeLabel: string; menuAction?: Readonly<{ label: string; onPress(): void; disabled?: boolean }> }>;\n /** Canonical layout-only placement on the message row. The swipe offset still owns `transform`. */\n layoutStyle?: HjmCompositionStyleProp }>;\nexport function ChatMessage({ direction, author, timestamp, deliveryLabel, avatar, reply, actions, replyAction, replyLink, reactions, children, interactiveContent=false, layoutStyle }: ChatMessageProps) {\n const start = useRef<{x:number;y:number} | null>(null);\n const [offset, setOffset] = useState(0);\n const finish = () => { start.current = null; setOffset(0); };\n return <article tabIndex={replyAction && !replyAction.disabled ? 0 : undefined}\n aria-keyshortcuts={replyAction ? \"Alt+ArrowLeft Alt+ArrowRight\" : undefined} aria-description={replyAction?.label}\n onKeyDown={event => { if (event.target === event.currentTarget && event.altKey && (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") && replyAction && !replyAction.disabled) { event.preventDefault(); replyAction.onPress(); } }}\n onPointerDown={event => { if (!replyAction || replyAction.disabled || event.button !== 0 || (event.target as HTMLElement).closest(\"button,a,input,textarea\")) return; start.current = {x:event.clientX,y:event.clientY}; }}\n onPointerMove={event => { if (!start.current) return; const dx=event.clientX-start.current.x,dy=event.clientY-start.current.y; if (Math.abs(dy)>10 && Math.abs(dy)>Math.abs(dx)) {finish();return;} if (Math.abs(dx)>Math.abs(dy)*2) setOffset(Math.max(-72,Math.min(72,dx))); }}\n onPointerUp={event => { if (start.current && replyAction && !replyAction.disabled && isReplySwipe(event.clientX-start.current.x,event.clientY-start.current.y)) replyAction.onPress(); finish(); }} onPointerCancel={finish} onPointerLeave={finish}\n className=\"hjm-chat-message\" style={{ ...layoutStyle, transform: `translateX(${offset}px)`, touchAction: replyAction ? \"pan-y\" : undefined, \"--hjm-message-max-width\": screenPatternRecipe.messageMaxWidth } as React.CSSProperties} data-direction={direction} aria-label={author}>\n {avatar ? <div className=\"hjm-chat-message__avatar\">{avatar}</div> : null}\n <div className=\"hjm-chat-message__content\">{author?<Text variant=\"caption\" tone=\"muted\">{author}</Text>:null}\n {reply && replyLink ? <Button tone=\"ghost\" aria-label={replyLink.label} onClick={replyLink.onPress}>{reply}</Button> : null}\n {reactions ? <MessageReactions {...reactions} interactiveContent={interactiveContent}>{reply && !replyLink ? <div className=\"hjm-chat-message__reply\">{reply}</div> : null}{children}</MessageReactions> : <div className=\"hjm-chat-message__bubble\">{reply && !replyLink ? <div className=\"hjm-chat-message__reply\">{reply}</div> : null}{children}</div>}\n {timestamp||deliveryLabel||actions?<div className=\"hjm-chat-message__meta\">{timestamp||deliveryLabel?<Text variant=\"caption\" tone=\"muted\">{timestamp}{deliveryLabel ? ` · ${deliveryLabel}` : \"\"}</Text>:null}{actions}</div>:null}\n </div>\n </article>;\n}\n"]}
1
+ {"version":3,"file":"screens.js","sourceRoot":"","sources":["../src/screens.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,0BAA0B,EAAwC,MAAM,+CAA+C,CAAC;AACjI,OAAO,EAAE,gBAAgB,EAAE,MAA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EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,YAAG,KAAK,GAAU,CAAC,CAAC,CAAC,IAAI,EAC1H,SAAS,CAAC,CAAC,CAAC,MAAC,gBAAgB,OAAK,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,aAAG,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,yBAAyB,YAAE,KAAK,GAAO,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,IAAoB,CAAC,CAAC,CAAC,eAAK,SAAS,EAAC,0BAA0B,aAAE,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,yBAAyB,YAAE,KAAK,GAAO,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,IAAO,EACzV,SAAS,IAAE,aAAa,IAAE,OAAO,CAAA,CAAC,CAAA,eAAK,SAAS,EAAC,wBAAwB,aAAE,SAAS,IAAE,aAAa,CAAA,CAAC,CAAA,MAAC,IAAI,IAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,OAAO,aAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,IAAQ,CAAA,CAAC,CAAA,IAAI,EAAE,OAAO,IAAO,CAAA,CAAC,CAAA,IAAI,IAC9N,IACE,CAAC;AACb,CAAC","sourcesContent":["import { resolveDesignProfileScreen, type DesignProfileScreenPresentation } from \"@hjmds/design-contracts/design-profile-layout\";\nimport { MessageReactions } from \"./internal/message-reactions.js\";\nimport type { ReactionPickerProps } from \"./reaction-picker.js\";\nimport { Button, IconButton } from \"./actions.js\";\nimport { TextArea } from \"./forms.js\";\nimport { useId, useRef, useState, type Ref, type ReactNode } from \"react\";\nimport { isReplySwipe, shouldSubmitMessageKey, canSubmitMessage, validateMessageAttachments, type MessageAttachmentDescriptor, resolveScreenContentState, screenPatternRecipe, type ChatMessageDescriptor, type MessageComposerDescriptor, type ScreenContentState } from \"@hjmds/design-contracts/screen-patterns\";\nimport { Heading } from \"./heading.js\";\nimport { Spinner } from \"./internal/spinner.js\";\nimport { Section, Stack, Text } from \"./layout.js\";\nimport { ListRow, type ListRowProps } from \"./display.js\";\nimport { classNames, useDesignProfileDefaults } from \"./internal.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type ScreenLayoutProps = Readonly<{\n title: string;\n /** Preserve host navigation while the shared shell owns content and state. */\n header?: ReactNode;\n contentInset?: \"default\" | \"none\";\n /** Explicit layout wins over the nearest design profile. */\n presentation?: DesignProfileScreenPresentation;\n description?: string;\n leading?: ReactNode;\n actions?: ReactNode;\n notice?: ReactNode;\n footer?: ReactNode;\n state?: ScreenContentState;\n stateAction?: ReactNode;\n children?: ReactNode;\n /** A virtualized list must own scrolling; never nest it inside a second scroll container. */\n scroll?: \"screen\" | \"content\";\n as?: \"main\" | \"section\";\n className?: string;\n /**\n * Canonical layout-only placement on the screen root (for example `flex` or `width` in a split\n * view), matching Native ScreenLayout. Every screen built on ScreenLayout forwards it.\n */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\n/** Shared screen shell. Routing, data, permission checks and mutation state remain product-owned. */\nexport function ScreenLayout({ title, header, contentInset = \"default\", presentation: suppliedPresentation, description, leading, actions, notice, footer, state = { kind: \"ready\" }, stateAction, children, scroll = \"screen\", as: Element = \"main\", className, layoutStyle }: ScreenLayoutProps) {\n const id = useId();\n // Screens historically work with the stylesheet alone. Optional context keeps\n // that path while inheriting profiles from an enclosing Provider when present.\n const designProfile = useDesignProfileDefaults();\n const presentation = suppliedPresentation ?? designProfile?.screens.overview;\n const profileLayout = presentation === undefined ? undefined : resolveDesignProfileScreen(presentation);\n const resolved = resolveScreenContentState(state);\n // Replacement text owns scrolling even when the ready state delegates it to\n // a virtual list. Use the rendered mode for keyboard access as well as CSS.\n const bodyScroll = resolved.replacesContent ? \"screen\" : scroll;\n const recipe = screenPatternRecipe;\n return <Element aria-labelledby={header ? undefined : id} aria-label={header ? title : undefined} data-content-inset={contentInset} data-presentation={presentation} className={classNames(\"hjm-screen\", className)}\n style={{ backgroundColor: designProfile?.material.canvas ? \"transparent\" : undefined, \"--hjm-screen-width\": `${profileLayout?.maxWidth ?? recipe.maxWidth}px`, \"--hjm-screen-padding\": `${contentInset === \"none\" ? 0 : recipe.padding}px`, \"--hjm-screen-gap\": `${profileLayout?.gap ?? recipe.sectionGap}px`, \"--hjm-screen-item-gap\": `${recipe.itemGap}px`, \"--hjm-screen-state-gap\": `${recipe.stateGap}px`, \"--hjm-screen-header-min\": `${recipe.headerMinWidth}px`, ...layoutStyle } as React.CSSProperties}>\n {header ?? <header className=\"hjm-screen__header\" style={profileLayout ? { flexDirection: profileLayout.headerAxis, alignItems: profileLayout.centered ? \"center\" : undefined, textAlign: profileLayout.centered ? \"center\" : undefined } : undefined}>\n {leading}<div className=\"hjm-screen__heading\"><Heading level=\"level3\" semanticLevel={1} id={id}>{title}</Heading>\n {description ? <Text as=\"p\" tone=\"muted\">{description}</Text> : null}</div>{actions}\n </header>}\n {notice ? <div className=\"hjm-screen__notice\">{notice}</div> : null}\n {/* Scrollable read-only screens still need a keyboard entry point. */}\n <div tabIndex={bodyScroll === \"content\" ? undefined : 0} className=\"hjm-screen__body\" data-scroll={bodyScroll} data-replacement={resolved.replacesContent || undefined} aria-busy={resolved.busy || undefined}>\n {state.kind === \"ready\" ? children : <div className=\"hjm-screen__state\">\n {/* Loading copy is an accessible name; visible copy beside the spinner\n contradicts the shared spinner-only loading contract. */}\n {resolved.busy ? <Spinner label={[state.title, state.description].filter(Boolean).join(\". \")} /> : <div role={state.kind === \"error\" ? \"alert\" : \"status\"}>\n <Stack gap=\"sm\" align=\"center\"><Text variant=\"title\">{state.title}</Text>\n {state.description ? <Text tone=\"muted\">{state.description}</Text> : null}</Stack>\n </div>}\n {stateAction}\n </div>}\n </div>\n {footer ? <footer className=\"hjm-screen__footer\">{footer}</footer> : null}\n </Element>;\n}\n\nexport type SettingsScreenSection = Readonly<{ id: string; title: string; description?: string; children: ReactNode }>;\nexport type SettingsScreenProps = Omit<ScreenLayoutProps, \"children\" | \"scroll\"> & Readonly<{ profile?: ReactNode; sections: readonly SettingsScreenSection[] }>;\nexport function SettingsScreen({ profile, sections, ...props }: SettingsScreenProps) {\n return <ScreenLayout {...props}><Stack gap=\"xl\">{profile}{sections.map(section =>\n <Section className=\"hjm-settings-section\" key={section.id} title={section.title} description={section.description}>{section.children}</Section>)}</Stack></ScreenLayout>;\n}\n\nexport type NotificationInboxScreenProps = Omit<ScreenLayoutProps, \"children\"> & Readonly<{\n filters?: ReactNode;\n children: ReactNode;\n}>;\nexport function NotificationInboxScreen({ filters, children, notice, ...props }: NotificationInboxScreenProps) {\n return <ScreenLayout {...props} notice={<Stack gap=\"sm\">{notice}{filters}</Stack>}>{children}</ScreenLayout>;\n}\n\n/** Read/unread is announced in localized copy as well as emphasis; rendering never marks an item read. */\nexport type NotificationItemProps = Omit<ListRowProps, \"description\" | \"selected\"> & Readonly<{\n read: boolean;\n statusLabel: string;\n timestamp: string;\n description?: ReactNode;\n}>;\nexport function NotificationItem({ read, statusLabel, timestamp, description, title, className, ...props }: NotificationItemProps) {\n return <ListRow {...props} className={classNames(\"hjm-notification-item\", className)} data-unread={!read || undefined} title={<Text emphasis={read ? \"regular\" : \"strong\"}>{title}</Text>}\n description={<Stack gap=\"xxs\">{description}<Text variant=\"caption\" tone=\"muted\">{statusLabel} · {timestamp}</Text></Stack>} />;\n}\n\nexport type ChatScreenProps = Omit<ScreenLayoutProps, \"footer\"> & Readonly<{ composer: ReactNode }>;\n/** Caller supplies a virtualized timeline and keyboard-aware composer; no implicit auto-scroll or send. */\nexport function ChatScreen({ composer, scroll = \"content\", ...props }: ChatScreenProps) {\n return <ScreenLayout {...props} scroll={scroll} footer={!props.state || props.state.kind === \"ready\" ? composer : null} />;\n}\n\nexport type MessageComposerProps = Omit<MessageComposerDescriptor, \"attachmentCount\"> & Readonly<{\n maxLength?: number;\n sendDisabled?: boolean;\n additionalContent?: boolean;\n leadingAction?: ReactNode;\n inputRef?: Ref<HTMLTextAreaElement>;\n /** Release typing presence when the host input loses focus. */\n onBlur?: () => void;\n onValueChange(value: string): void;\n onSend(value: string): void;\n context?: ReactNode;\n replyTo?: Readonly<{ author: string; excerpt: string; cancelLabel: string; onCancel(): void }>;\n /** Icon mode puts the send/attachment action inside the growing field. */\n sendIcon?: ReactNode;\n /** Reference comment layout: a filled circular send action inside the field. */\n sendPresentation?: \"inline\" | \"circle\";\n attachmentAction?: Readonly<{ label: string; icon: ReactNode; onPress(): void; disabled?: boolean }>;\n attachments?: readonly (MessageAttachmentDescriptor & Readonly<{ preview: ReactNode }>)[];\n onRemoveAttachment?: (id: string) => void;\n /** Canonical layout-only placement on the composer root. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\nexport function MessageComposer({ value, label, sendLabel, placeholder = label, description, error, invalid = false, submitMode = \"newline\", onBlur, disabled = false, pending = false, onValueChange, onSend, maxLength, sendDisabled = false, additionalContent = false, leadingAction, inputRef, context, replyTo, sendIcon, sendPresentation = \"inline\", attachmentAction, attachments = [], onRemoveAttachment, layoutStyle }: MessageComposerProps) {\n validateMessageAttachments(attachments);\n if (attachments.length && !onRemoveAttachment) throw new TypeError(\"Attachments require a removal callback\");\n const canSend = !sendDisabled && canSubmitMessage({ value, label, sendLabel, disabled, pending, attachmentCount: attachments.length + (additionalContent ? 1 : 0) });\n const locked = disabled || pending;\n // A bounded corner radius keeps multiline/large-text content inside the field instead of a tall pill.\n const hasContent = !!value.trim() || attachments.length > 0 || additionalContent;\n const attach = attachmentAction ? <IconButton label={attachmentAction.label} tone=\"ghost\" disabled={locked || attachmentAction.disabled} onClick={attachmentAction.onPress}>{attachmentAction.icon}</IconButton> : null;\n const send = sendIcon ? <IconButton label={sendLabel} size={sendPresentation === \"circle\" ? \"small\" : \"medium\"} shape=\"circle\" tone={sendPresentation === \"circle\" ? \"primary\" : \"ghost\"} disabled={!canSend} loading={pending} onClick={() => { if (canSend) onSend(value); }}>{sendIcon}</IconButton> : <Button disabled={!canSend} loading={pending} onClick={() => { if (canSend) onSend(value); }}>{sendLabel}</Button>;\n // Readonly pending input preserves the keyboard/focus for receipt failure recovery; disabling it would blur desktop chat.\n // Enter is opt-in and IME-safe; receipt-driven clearing and failed-send recovery belong to the host.\n return <div className=\"hjm-message-composer\" data-send-presentation={sendPresentation} style={{\"--hjm-message-composer-gap\": `${screenPatternRecipe.itemGap}px`, \"--hjm-attachment-size\": `${screenPatternRecipe.attachmentSize}px`, \"--hjm-attachment-remove-size\": `${screenPatternRecipe.attachmentRemoveSize}px`, ...layoutStyle} as React.CSSProperties}>{context}{replyTo ? <Stack axis=\"inline\" gap=\"sm\" align=\"center\"><Stack gap=\"xxs\"><Text variant=\"caption\" emphasis=\"strong\">{replyTo.author}</Text><Text variant=\"caption\" tone=\"muted\">{replyTo.excerpt}</Text></Stack><IconButton label={replyTo.cancelLabel} tone=\"ghost\" disabled={locked} onClick={replyTo.onCancel}><Text>×</Text></IconButton></Stack> : null}\n {attachments.length ? <div className=\"hjm-message-composer__attachments\">{attachments.map(item => <div key={item.id} className=\"hjm-message-composer__attachment\"><div className=\"hjm-message-composer__preview\">{item.preview}</div><span className=\"hjm-message-composer__remove\"><IconButton label={item.removeLabel} tone=\"ghost\" size=\"small\" disabled={locked || item.disabled} onClick={() => { if (!locked && !item.disabled) onRemoveAttachment?.(item.id); }}><span className=\"hjm-message-composer__remove-glyph\" aria-hidden=\"true\">×</span></IconButton></span></div>)}{attach}</div> : null}\n <div className=\"hjm-message-composer__row\"><TextArea ref={inputRef} maxLength={maxLength} leadingAction={leadingAction} shape=\"large\" rows={screenPatternRecipe.composerMinLines} aria-label={label} placeholder={placeholder} description={description} error={error} aria-invalid={invalid || undefined} onBlur={onBlur} value={value} disabled={disabled} readOnly={pending} aria-busy={pending || undefined}\n onKeyDown={event => { if (shouldSubmitMessageKey({key:event.key, shiftKey:event.shiftKey, isComposing:event.nativeEvent.isComposing, keyCode:event.nativeEvent.keyCode}, submitMode)) { event.preventDefault(); if (canSend) onSend(value); } }}\n onChange={event => { if (!locked) onValueChange(event.currentTarget.value); }} minVisibleLines={screenPatternRecipe.composerMinLines} maxVisibleLines={screenPatternRecipe.composerMaxLines}\n {...(sendIcon ? { trailing: hasContent || pending ? send : attach } : {})} />\n {sendIcon ? null : send}\n </div></div>;\n}\n\nexport type ChatMessageProps = ChatMessageDescriptor & Readonly<{ children: ReactNode; interactiveContent?: boolean; avatar?: ReactNode; reply?: ReactNode; actions?: ReactNode; replyAction?: Readonly<{label:string; onPress():void; disabled?:boolean}>; replyLink?: Readonly<{label:string; onPress():void}>; reactions?: ReactionPickerProps & Readonly<{ closeLabel: string; menuAction?: Readonly<{ label: string; onPress(): void; disabled?: boolean }> }>;\n /** Canonical layout-only placement on the message row. The swipe offset still owns `transform`. */\n layoutStyle?: HjmCompositionStyleProp }>;\nexport function ChatMessage({ direction, author, timestamp, deliveryLabel, avatar, reply, actions, replyAction, replyLink, reactions, children, interactiveContent=false, layoutStyle }: ChatMessageProps) {\n const start = useRef<{x:number;y:number} | null>(null);\n const [offset, setOffset] = useState(0);\n const finish = () => { start.current = null; setOffset(0); };\n return <article tabIndex={replyAction && !replyAction.disabled ? 0 : undefined}\n aria-keyshortcuts={replyAction ? \"Alt+ArrowLeft Alt+ArrowRight\" : undefined} aria-description={replyAction?.label}\n onKeyDown={event => { if (event.target === event.currentTarget && event.altKey && (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") && replyAction && !replyAction.disabled) { event.preventDefault(); replyAction.onPress(); } }}\n onPointerDown={event => { if (!replyAction || replyAction.disabled || event.button !== 0 || (event.target as HTMLElement).closest(\"button,a,input,textarea\")) return; start.current = {x:event.clientX,y:event.clientY}; }}\n onPointerMove={event => { if (!start.current) return; const dx=event.clientX-start.current.x,dy=event.clientY-start.current.y; if (Math.abs(dy)>10 && Math.abs(dy)>Math.abs(dx)) {finish();return;} if (Math.abs(dx)>Math.abs(dy)*2) setOffset(Math.max(-72,Math.min(72,dx))); }}\n onPointerUp={event => { if (start.current && replyAction && !replyAction.disabled && isReplySwipe(event.clientX-start.current.x,event.clientY-start.current.y)) replyAction.onPress(); finish(); }} onPointerCancel={finish} onPointerLeave={finish}\n className=\"hjm-chat-message\" style={{ ...layoutStyle, transform: `translateX(${offset}px)`, touchAction: replyAction ? \"pan-y\" : undefined, \"--hjm-message-max-width\": screenPatternRecipe.messageMaxWidth } as React.CSSProperties} data-direction={direction} aria-label={author}>\n {avatar ? <div className=\"hjm-chat-message__avatar\">{avatar}</div> : null}\n <div className=\"hjm-chat-message__content\">{author?<Text variant=\"caption\" tone=\"muted\">{author}</Text>:null}\n {reply && replyLink ? <Button tone=\"ghost\" aria-label={replyLink.label} onClick={replyLink.onPress}>{reply}</Button> : null}\n {reactions ? <MessageReactions {...reactions} interactiveContent={interactiveContent}>{reply && !replyLink ? <div className=\"hjm-chat-message__reply\">{reply}</div> : null}{children}</MessageReactions> : <div className=\"hjm-chat-message__bubble\">{reply && !replyLink ? <div className=\"hjm-chat-message__reply\">{reply}</div> : null}{children}</div>}\n {timestamp||deliveryLabel||actions?<div className=\"hjm-chat-message__meta\">{timestamp||deliveryLabel?<Text variant=\"caption\" tone=\"muted\">{timestamp}{deliveryLabel ? ` · ${deliveryLabel}` : \"\"}</Text>:null}{actions}</div>:null}\n </div>\n </article>;\n}\n"]}