@hjmds/react 1.13.1 → 1.14.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 (76) hide show
  1. package/dist/agreement.d.ts.map +1 -1
  2. package/dist/agreement.js +5 -3
  3. package/dist/agreement.js.map +1 -1
  4. package/dist/content-transition.d.ts +7 -3
  5. package/dist/content-transition.d.ts.map +1 -1
  6. package/dist/content-transition.js +45 -2
  7. package/dist/content-transition.js.map +1 -1
  8. package/dist/date-entry.d.ts +9 -0
  9. package/dist/date-entry.d.ts.map +1 -0
  10. package/dist/date-entry.js +13 -0
  11. package/dist/date-entry.js.map +1 -0
  12. package/dist/document-resource.d.ts +3 -0
  13. package/dist/document-resource.d.ts.map +1 -0
  14. package/dist/document-resource.js +2 -0
  15. package/dist/document-resource.js.map +1 -0
  16. package/dist/effect-surface.d.ts.map +1 -1
  17. package/dist/effect-surface.js +2 -2
  18. package/dist/effect-surface.js.map +1 -1
  19. package/dist/evidence.d.ts +1 -1
  20. package/dist/evidence.js +1 -1
  21. package/dist/evidence.js.map +1 -1
  22. package/dist/field-group.d.ts +22 -0
  23. package/dist/field-group.d.ts.map +1 -0
  24. package/dist/field-group.js +20 -0
  25. package/dist/field-group.js.map +1 -0
  26. package/dist/forms.d.ts +1 -0
  27. package/dist/forms.d.ts.map +1 -1
  28. package/dist/forms.js +5 -3
  29. package/dist/forms.js.map +1 -1
  30. package/dist/image-comparison.d.ts +12 -0
  31. package/dist/image-comparison.d.ts.map +1 -0
  32. package/dist/image-comparison.js +14 -0
  33. package/dist/image-comparison.js.map +1 -0
  34. package/dist/internal/document-resource.d.ts +9 -0
  35. package/dist/internal/document-resource.d.ts.map +1 -0
  36. package/dist/internal/document-resource.js +37 -0
  37. package/dist/internal/document-resource.js.map +1 -0
  38. package/dist/internal/overlay-origin-motion.d.ts +13 -0
  39. package/dist/internal/overlay-origin-motion.d.ts.map +1 -0
  40. package/dist/internal/overlay-origin-motion.js +76 -0
  41. package/dist/internal/overlay-origin-motion.js.map +1 -0
  42. package/dist/overlays.d.ts +3 -0
  43. package/dist/overlays.d.ts.map +1 -1
  44. package/dist/overlays.js +16 -12
  45. package/dist/overlays.js.map +1 -1
  46. package/dist/popover.d.ts +3 -0
  47. package/dist/popover.d.ts.map +1 -1
  48. package/dist/popover.js +8 -4
  49. package/dist/popover.js.map +1 -1
  50. package/dist/portal.d.ts +3 -1
  51. package/dist/portal.d.ts.map +1 -1
  52. package/dist/portal.js +5 -2
  53. package/dist/portal.js.map +1 -1
  54. package/dist/progressive-blur.d.ts +7 -0
  55. package/dist/progressive-blur.d.ts.map +1 -0
  56. package/dist/progressive-blur.js +20 -0
  57. package/dist/progressive-blur.js.map +1 -0
  58. package/dist/rating.d.ts +19 -0
  59. package/dist/rating.d.ts.map +1 -0
  60. package/dist/rating.js +34 -0
  61. package/dist/rating.js.map +1 -0
  62. package/dist/selection.d.ts +4 -0
  63. package/dist/selection.d.ts.map +1 -1
  64. package/dist/selection.js +45 -3
  65. package/dist/selection.js.map +1 -1
  66. package/dist/styles.css +41 -4
  67. package/dist/styles.layered.css +41 -4
  68. package/dist/task-list.d.ts +6 -1
  69. package/dist/task-list.d.ts.map +1 -1
  70. package/dist/task-list.js +8 -3
  71. package/dist/task-list.js.map +1 -1
  72. package/dist/text-annotation.d.ts +10 -0
  73. package/dist/text-annotation.d.ts.map +1 -0
  74. package/dist/text-annotation.js +107 -0
  75. package/dist/text-annotation.js.map +1 -0
  76. package/package.json +33 -3
package/dist/popover.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode, type RefObject } from "react";
2
2
  import { type PopoverDescriptor, type PopoverDismissPolicy, type PopoverOpenOn, type PopoverOpenState } from "@hjmds/design-contracts/components/popover";
3
+ import type { TransitionRect } from "@hjmds/design-contracts/content-transition";
3
4
  import type { OverlayTrigger } from "./overlays.js";
4
5
  export type PopoverContentActions = Readonly<{
5
6
  close(): void;
@@ -17,6 +18,8 @@ export type PopoverProps = PopoverOpenState & Readonly<{
17
18
  * replaces it, because hover does not exist on touch or for a keyboard.
18
19
  */
19
20
  openOn?: PopoverOpenOn;
21
+ /** Optional trigger bounds in viewport coordinates; state and focus remain non-modal. */
22
+ motionOrigin?: TransitionRect;
20
23
  initialFocusRef?: RefObject<HTMLElement | null>;
21
24
  portalContainer?: HTMLElement;
22
25
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../src/popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkJ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvM,OAAO,EAAoI,KAAK,iBAAiB,EAAE,KAAK,oBAAoB,EAA4D,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAMtV,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAAE,KAAK,IAAI,IAAI,CAAA;CAAE,CAAC,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,QAAQ,CAAC;IACrD,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,OAAO,EAAE,qBAAqB,KAAK,SAAS,CAAC,CAAC;IACvE,aAAa,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9C;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,eAAe,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAChD,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,C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2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { cloneElement, createContext, forwardRef, useCallback, useContext, useEffect, useId, useRef, useState, useSyncExternalStore } from "react";
3
3
  import { canDismissPopover, popoverBehaviorDefaults, popoverHoverDelay, popoverRecipe, resolvePopoverDescriptor, validatePopoverOpenState } from "@hjmds/design-contracts/components/popover";
4
4
  import { easing, layer } from "@hjmds/design-contracts/foundations";
5
+ import { useOverlayOriginMotion } from "./internal/overlay-origin-motion.js";
5
6
  import { Button } from "./actions.js";
6
7
  import { classNames, composeRefs } from "./internal.js";
7
8
  import { AnchoredPortal, getPopoverOwner, useAnchoredPopup } from "./portal.js";
@@ -32,7 +33,7 @@ function contains(content, target) {
32
33
  }
33
34
  return false;
34
35
  }
35
- export const Popover = forwardRef(function Popover({ trigger, title, closeLabel, description, descriptor = {}, children, dismissPolicy, openOn = popoverBehaviorDefaults.openOn, initialFocusRef, portalContainer, className, open: controlledOpen, defaultOpen, onOpenChange }, ref) {
36
+ export const Popover = forwardRef(function Popover({ trigger, title, closeLabel, description, descriptor = {}, children, dismissPolicy, openOn = popoverBehaviorDefaults.openOn, initialFocusRef, portalContainer, className, motionOrigin, open: controlledOpen, defaultOpen, onOpenChange }, ref) {
36
37
  if (!title.trim() || !closeLabel.trim())
37
38
  throw new TypeError("Popover title and closeLabel must not be empty");
38
39
  const resolved = resolvePopoverDescriptor(descriptor);
@@ -100,10 +101,13 @@ export const Popover = forwardRef(function Popover({ trigger, title, closeLabel,
100
101
  // Contextual forms share the dropdown tier with menus (DOM order puts a popover opened
101
102
  // from a menu above it) and stay below tooltips; a modal owner supplies its own layer
102
103
  // through the shared positioning helper.
103
- viewportPadding: popoverRecipe.collisionPadding, zIndex: layer.dropdown, fallbackAxis: true,
104
+ viewportPadding: popoverRecipe.collisionPadding, zIndex: layer.dropdown, fallbackAxis: true, layoutDimensions: motionOrigin !== undefined,
105
+ });
106
+ const motion = useOverlayOriginMotion(open, motionOrigin, reduced, {
107
+ ready: position.style.visibility === "visible", transition: popoverRecipe.transition,
104
108
  });
105
109
  const setContent = useCallback((value) => { setNode(value); }, []);
106
- const contentRef = useCallback(composeRefs(setContent, ref), [setContent, ref]);
110
+ const contentRef = useCallback(composeRefs(setContent, ref, motion.setNode), [setContent, ref, motion.setNode]);
107
111
  useEffect(() => {
108
112
  if (!open) {
109
113
  if (didFocus.current) {
@@ -221,7 +225,7 @@ export const Popover = forwardRef(function Popover({ trigger, title, closeLabel,
221
225
  minWidth: Math.min(popoverRecipe.minWidth, Number(position.style.maxWidth ?? popoverRecipe.minWidth)),
222
226
  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")}`,
223
227
  };
224
- return _jsxs(_Fragment, { children: [renderedTrigger, open || present ? _jsx(AnchoredPortal, { anchorRef: triggerRef, ssrFallback: "inline", ...(portalContainer ? { container: portalContainer } : {}), children: _jsx(ParentPopoverOpen.Provider, { value: open, children: _jsxs("div", { ref: contentRef, id: id, role: "dialog", tabIndex: -1, "data-hjm-popover-content": "", "data-state": open ? "open" : "closed", "aria-hidden": !open || undefined, inert: !open || undefined, "aria-label": resolved.accessibilityLabel, "aria-labelledby": resolved.accessibilityLabel ? undefined : `${id}-title`, "aria-describedby": description ? `${id}-description` : undefined, className: classNames("hjm-popover", className), style: style, "data-placement": position.placement, "data-align": position.align, ...hoverHandlers, onAnimationEnd: (event) => { if (!open && event.target === event.currentTarget)
228
+ return _jsxs(_Fragment, { children: [renderedTrigger, open || present || motion.visible ? _jsx(AnchoredPortal, { anchorRef: triggerRef, ssrFallback: "inline", ...(portalContainer ? { container: portalContainer } : {}), children: _jsx(ParentPopoverOpen.Provider, { value: open, children: _jsxs("div", { ref: contentRef, id: id, role: "dialog", tabIndex: -1, "data-hjm-popover-content": "", "data-state": open ? "open" : "closed", "aria-hidden": !open || undefined, inert: !open || undefined, "aria-label": resolved.accessibilityLabel, "aria-labelledby": resolved.accessibilityLabel ? undefined : `${id}-title`, "aria-describedby": description ? `${id}-description` : undefined, className: classNames("hjm-popover", className), style: style, "data-placement": position.placement, "data-align": position.align, ...hoverHandlers, onAnimationEnd: (event) => { if (!open && event.target === event.currentTarget)
225
229
  setPresent(false); }, children: [_jsxs("div", { className: "hjm-popover__header", children: [_jsx("h2", { id: `${id}-title`, className: "hjm-popover__title", children: title }), _jsx(Button, { tone: "ghost", onClick: () => change(false, "close-action"), children: closeLabel })] }), description ? _jsx("p", { id: `${id}-description`, className: "hjm-popover__description", children: description }) : null, _jsx("div", { "data-hjm-popover-body": "", className: "hjm-popover__body", children: typeof children === "function" ? children({ close: () => change(false, "close-action") }) : children })] }) }) }) : null] });
226
230
  });
227
231
  //# sourceMappingURL=popover.js.map
@@ -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;AACpE,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;AAsBpD,MAAM,iBAAiB,GAAG,aAAa,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S,EAC9O,SAAS,EAAE,UAAU,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,oBAAkB,QAAQ,CAAC,SAAS,gBAAc,QAAQ,CAAC,KAAK,KAAM,aAAa,EAChJ,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,aAAa;4BAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aACpG,eAAK,SAAS,EAAC,qBAAqB,aAAC,aAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,oBAAoB,YAAE,KAAK,GAAM,EAAA,KAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,YAAG,UAAU,GAAU,IAAM,EACpM,WAAW,CAAC,CAAC,CAAC,YAAG,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,SAAS,EAAC,0BAA0B,YAAE,WAAW,GAAK,CAAC,CAAC,CAAC,IAAI,EACxG,uCAA2B,EAAE,EAAC,SAAS,EAAC,mBAAmB,YAAE,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,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 { 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 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,\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,\n });\n const setContent = useCallback((value: HTMLDivElement | null) => { setNode(value); }, []);\n const contentRef = useCallback(composeRefs(setContent, ref), [setContent, ref]);\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 ? <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,wB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,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,YAAG,UAAU,GAAU,IAAM,EACpM,WAAW,CAAC,CAAC,CAAC,YAAG,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,SAAS,EAAC,0BAA0B,YAAE,WAAW,GAAK,CAAC,CAAC,CAAC,IAAI,EACxG,uCAA2B,EAAE,EAAC,SAAS,EAAC,mBAAmB,YAAE,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,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"]}
package/dist/portal.d.ts CHANGED
@@ -25,12 +25,14 @@ type AnchoredPopupOptions = Readonly<{
25
25
  zIndex?: number;
26
26
  /** Wide contextual content may switch to the block axis in a narrow viewport. */
27
27
  fallbackAxis?: boolean;
28
+ /** Ignore presentation transforms when sizing an animated surface. */
29
+ layoutDimensions?: boolean;
28
30
  }>;
29
31
  /**
30
32
  * Positions a fixed portal popup against its anchor using logical alignment.
31
33
  * The popup flips vertically and shifts horizontally to stay inside the visual
32
34
  * viewport, then follows every scroll/resize source that can move either node.
33
35
  */
34
- export declare function useAnchoredPopup(anchorRef: RefObject<HTMLElement | null>, popup: HTMLElement | null, { align, fallbackAxis, gap, matchAnchorWidth, placement: preferredPlacement, viewportPadding, zIndex, }?: AnchoredPopupOptions): AnchoredPopupPosition;
36
+ export declare function useAnchoredPopup(anchorRef: RefObject<HTMLElement | null>, popup: HTMLElement | null, { align, fallbackAxis, layoutDimensions, gap, matchAnchorWidth, placement: preferredPlacement, viewportPadding, zIndex, }?: AnchoredPopupOptions): AnchoredPopupPosition;
35
37
  export {};
36
38
  //# sourceMappingURL=portal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../src/portal.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACjC,CAAC,CAAC;AAEH,0FAA0F;AAC1F,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CAMrE;AAyDD,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAoB,GACrB,EAAE,WAAW,aA8Bb;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAC5D,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC;AAExE,KAAK,qBAAqB,GAAG,QAAQ,CAAC;IACpC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,SAAS,EAAE,sBAAsB,CAAC;IAClC,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC,CAAC;AAEH,KAAK,oBAAoB,GAAG,QAAQ,CAAC;IACnC,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CA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AG,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC;AAExE,KAAK,qBAAqB,GAAG,QAAQ,CAAC;IACpC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,SAAS,EAAE,sBAAsB,CAAC;IAClC,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC,CAAC;AAEH,KAAK,oBAAoB,GAAG,QAAQ,CAAC;IACnC,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC,CAAC;AA6BH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACxC,KAAK,EAAE,WAAW,GAAG,IAAI,EACzB,EACE,KAAe,EACf,YAAoB,EACpB,gBAAwB,EACxB,GAAO,EACP,gBAAwB,EACxB,SAAS,EAAE,kBAA6B,EACxC,eAAoB,EACpB,MAAuB,GACxB,GAAE,oBAAyB,GAC3B,qBAAqB,CAkMvB"}
package/dist/portal.js CHANGED
@@ -119,7 +119,7 @@ function samePosition(previous, next) {
119
119
  * The popup flips vertically and shifts horizontally to stay inside the visual
120
120
  * viewport, then follows every scroll/resize source that can move either node.
121
121
  */
122
- export function useAnchoredPopup(anchorRef, popup, { align = "start", fallbackAxis = false, gap = 8, matchAnchorWidth = false, placement: preferredPlacement = "bottom", viewportPadding = 16, zIndex = layer.dropdown, } = {}) {
122
+ export function useAnchoredPopup(anchorRef, popup, { align = "start", fallbackAxis = false, layoutDimensions = false, gap = 8, matchAnchorWidth = false, placement: preferredPlacement = "bottom", viewportPadding = 16, zIndex = layer.dropdown, } = {}) {
123
123
  const [position, setPosition] = useState(() => ({
124
124
  ...hiddenPopupPosition,
125
125
  align,
@@ -129,7 +129,9 @@ export function useAnchoredPopup(anchorRef, popup, { align = "start", fallbackAx
129
129
  if (!anchor || !popup || !anchor.isConnected || !popup.isConnected)
130
130
  return;
131
131
  const anchorRect = anchor.getBoundingClientRect();
132
- const popupRect = popup.getBoundingClientRect();
132
+ // Origin transitions may temporarily shrink/enlarge the surface. Collision
133
+ // placement needs its final layout size, otherwise resize/scroll makes it drift.
134
+ const popupRect = layoutDimensions ? { width: popup.offsetWidth, height: popup.offsetHeight } : popup.getBoundingClientRect();
133
135
  const visualViewport = window.visualViewport;
134
136
  const viewportLeft = visualViewport?.offsetLeft ?? 0;
135
137
  const viewportTop = visualViewport?.offsetTop ?? 0;
@@ -250,6 +252,7 @@ export function useAnchoredPopup(anchorRef, popup, { align = "start", fallbackAx
250
252
  align,
251
253
  anchorRef,
252
254
  fallbackAxis,
255
+ layoutDimensions,
253
256
  gap,
254
257
  matchAnchorWidth,
255
258
  popup,
@@ -1 +1 @@
1
- {"version":3,"file":"portal.js","sourceRoot":"","sources":["../src/portal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EACL,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAUzC,0FAA0F;AAC1F,MAAM,UAAU,eAAe,CAAC,IAAiB;IAC/C,MAAM,OAAO,GAAG,IAAI,YAAY,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC;IACrE,MAAM,MAAM,GAAG,OAAO,EAAE,OAAO,CAAc,4BAA4B,CAAC,CAAC;IAC3E,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,O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,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;YAC3D,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,IAAI,CAAC,CAAC;YACjE,MAAM,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;YAC3E,MAAM,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;YAC3E,cAAc,EAAE,UAAU,EAAE,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAEtC,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { layer } from \"@hjmds/design-contracts/foundations\";\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nexport type PortalProps = Readonly<{\n anchorRef: RefObject<HTMLElement | null>;\n children: ReactNode;\n container?: HTMLElement;\n /** Anchored non-modal popups may render inline until hydration moves them. */\n ssrFallback?: \"none\" | \"inline\";\n}>;\n\n/** Nearest interactive popover, including descendants rendered through another portal. */\nexport function getPopoverOwner(node: Node | null): HTMLElement | null {\n const element = node instanceof Element ? node : node?.parentElement;\n const direct = element?.closest<HTMLElement>(\"[data-hjm-popover-content]\");\n if (direct) return direct;\n const ownerId = element?.closest<HTMLElement>(\"[data-hjm-popover-owner]\")?.getAttribute(\"data-hjm-popover-owner\");\n return ownerId ? document.getElementById(ownerId) : null;\n}\n\n/**\n * Copies the closest provider DOM boundary instead of importing provider\n * runtime code, keeping granular form/overlay entry points lightweight.\n */\nfunction synchronizePortalEnvironment(host: HTMLDivElement, anchor: HTMLElement | null): void {\n // Modal ownership and non-modal ownership are separate: nested selects/menus\n // must belong to both, so outside focus does not close their parent popover.\n const popoverOwner = getPopoverOwner(anchor);\n if (popoverOwner?.id) host.setAttribute(\"data-hjm-popover-owner\", popoverOwner.id);\n else host.removeAttribute(\"data-hjm-popover-owner\");\n const source = anchor?.closest<HTMLElement>(\"[data-hjm-provider], [data-hjm-portal]\") ?? null;\n const directModalOwner = anchor?.closest<HTMLElement>(\"[data-hjm-modal-content]\") ?? null;\n const inheritedOwnerId = anchor\n ?.closest<HTMLElement>(\"[data-hjm-popup-owner]\")\n ?.getAttribute(\"data-hjm-popup-owner\") ?? null;\n const modalOwner = directModalOwner ??\n (inheritedOwnerId === null ? null : document.getElementById(inheritedOwnerId));\n if (modalOwner?.id) host.setAttribute(\"data-hjm-popup-owner\", modalOwner.id);\n else host.removeAttribute(\"data-hjm-popup-owner\");\n if (source) {\n host.removeAttribute(\"style\");\n for (let index = 0; index < source.style.length; index += 1) {\n const property = source.style.item(index);\n if (\n property.startsWith(\"--hjm-\") ||\n property === \"background-color\" ||\n property === \"color\" ||\n property === \"color-scheme\" ||\n property === \"font-family\" ||\n property === \"font-size\" ||\n property === \"line-height\"\n ) {\n host.style.setProperty(\n property,\n source.style.getPropertyValue(property),\n source.style.getPropertyPriority(property),\n );\n }\n }\n for (const attribute of [\"data-motion\", \"data-theme\", \"data-text-scale\", \"data-large-text\"] as const) {\n const value = source.getAttribute(attribute);\n if (value === null) host.removeAttribute(attribute);\n else host.setAttribute(attribute, value);\n }\n host.dir = source.dir;\n return;\n }\n host.removeAttribute(\"style\");\n host.removeAttribute(\"data-motion\");\n host.removeAttribute(\"data-theme\");\n host.removeAttribute(\"data-text-scale\");\n host.removeAttribute(\"data-large-text\");\n host.dir = anchor?.closest<HTMLElement>(\"[dir]\")?.dir ?? \"\";\n}\n\nexport function AnchoredPortal({\n anchorRef,\n children,\n container,\n ssrFallback = \"none\",\n}: PortalProps) {\n const [mounted, setMounted] = useState(false);\n const hostRef = useRef<HTMLDivElement | null>(null);\n const setHostRef = useCallback((host: HTMLDivElement | null) => {\n hostRef.current = host;\n if (host) synchronizePortalEnvironment(host, anchorRef.current);\n }, [anchorRef]);\n useEffect(() => setMounted(true), []);\n useEffect(() => {\n const host = hostRef.current;\n const source = anchorRef.current?.closest<HTMLElement>(\n \"[data-hjm-provider], [data-hjm-portal]\",\n ) ?? null;\n if (!host || !source || typeof MutationObserver === \"undefined\") return;\n const observer = new MutationObserver(() => {\n synchronizePortalEnvironment(host, anchorRef.current);\n });\n observer.observe(source, {\n attributes: true,\n attributeFilter: [\"data-motion\", \"data-theme\", \"data-text-scale\", \"data-large-text\", \"dir\", \"style\"],\n });\n return () => observer.disconnect();\n }, [anchorRef, mounted]);\n if (!mounted) return ssrFallback === \"inline\" ? children : null;\n return createPortal(\n <div ref={setHostRef} className=\"hjm-root hjm-portal\" data-hjm-portal=\"\">\n {children}\n </div>,\n container ?? document.body,\n );\n}\n\nexport type AnchoredPopupAlign = \"start\" | \"center\" | \"end\";\nexport type AnchoredPopupPlacement = \"bottom\" | \"top\" | \"start\" | \"end\";\n\ntype AnchoredPopupPosition = Readonly<{\n align: AnchoredPopupAlign;\n placement: AnchoredPopupPlacement;\n style: CSSProperties;\n}>;\n\ntype AnchoredPopupOptions = Readonly<{\n align?: AnchoredPopupAlign;\n gap?: number;\n matchAnchorWidth?: boolean;\n placement?: AnchoredPopupPlacement;\n viewportPadding?: number;\n zIndex?: number;\n /** Wide contextual content may switch to the block axis in a narrow viewport. */\n fallbackAxis?: boolean;\n}>;\n\nconst hiddenPopupPosition: AnchoredPopupPosition = {\n align: \"start\",\n placement: \"bottom\",\n style: {\n position: \"fixed\",\n inset: \"auto\",\n left: 0,\n top: 0,\n visibility: \"hidden\",\n },\n};\n\nfunction samePosition(\n previous: AnchoredPopupPosition,\n next: AnchoredPopupPosition,\n): boolean {\n return previous.align === next.align &&\n previous.placement === next.placement &&\n previous.style.left === next.style.left &&\n previous.style.top === next.style.top &&\n previous.style.minWidth === next.style.minWidth &&\n previous.style.maxWidth === next.style.maxWidth &&\n previous.style.maxHeight === next.style.maxHeight &&\n previous.style.zIndex === next.style.zIndex &&\n previous.style.visibility === next.style.visibility;\n}\n\n/**\n * Positions a fixed portal popup against its anchor using logical alignment.\n * The popup flips vertically and shifts horizontally to stay inside the visual\n * viewport, then follows every scroll/resize source that can move either node.\n */\nexport function useAnchoredPopup(\n anchorRef: RefObject<HTMLElement | null>,\n popup: HTMLElement | null,\n {\n align = \"start\",\n fallbackAxis = false,\n gap = 8,\n matchAnchorWidth = false,\n placement: preferredPlacement = \"bottom\",\n viewportPadding = 16,\n zIndex = layer.dropdown,\n }: AnchoredPopupOptions = {},\n): AnchoredPopupPosition {\n const [position, setPosition] = useState<AnchoredPopupPosition>(() => ({\n ...hiddenPopupPosition,\n align,\n }));\n\n const update = useCallback(() => {\n const anchor = anchorRef.current;\n if (!anchor || !popup || !anchor.isConnected || !popup.isConnected) return;\n\n const anchorRect = anchor.getBoundingClientRect();\n const popupRect = popup.getBoundingClientRect();\n const visualViewport = window.visualViewport;\n const viewportLeft = visualViewport?.offsetLeft ?? 0;\n const viewportTop = visualViewport?.offsetTop ?? 0;\n const viewportWidth = visualViewport?.width ?? window.innerWidth;\n const viewportHeight = visualViewport?.height ?? window.innerHeight;\n const viewportRight = viewportLeft + viewportWidth;\n const viewportBottom = viewportTop + viewportHeight;\n const availableBottom = Math.max(0, viewportBottom - viewportPadding - anchorRect.bottom - gap);\n const availableTop = Math.max(0, anchorRect.top - viewportTop - viewportPadding - gap);\n const availableLeft = Math.max(0, anchorRect.left - viewportLeft - viewportPadding - gap);\n const availableRight = Math.max(0, viewportRight - viewportPadding - anchorRect.right - gap);\n const maximumPopupHeight = Math.max(0, viewportHeight - (2 * viewportPadding));\n const maximumPopupWidth = Math.max(0, viewportWidth - (2 * viewportPadding));\n const desiredPopupHeight = Math.min(\n Math.max(popupRect.height, popup.scrollHeight),\n maximumPopupHeight,\n );\n const desiredPopupWidth = Math.min(\n Math.max(popupRect.width, popup.scrollWidth, matchAnchorWidth ? anchorRect.width : 0),\n maximumPopupWidth,\n );\n const direction = getComputedStyle(anchor).direction;\n const directModalOwner = anchor.closest<HTMLElement>(\"[data-hjm-modal-content]\");\n const inheritedOwnerId = anchor\n .closest<HTMLElement>(\"[data-hjm-popup-owner]\")\n ?.getAttribute(\"data-hjm-popup-owner\") ?? null;\n const modalOwner = directModalOwner ??\n (inheritedOwnerId === null ? null : document.getElementById(inheritedOwnerId));\n const modalLayerValue = modalOwner\n ?.closest<HTMLElement>(\".hjm-overlay\")\n ?.style.zIndex ?? \"\";\n const modalLayer = Number.parseInt(modalLayerValue, 10);\n const resolvedZIndex = Number.isFinite(modalLayer) ? modalLayer + 1 : zIndex;\n const logicalStartAtLeft = direction !== \"rtl\";\n const preferredPhysicalPlacement = preferredPlacement === \"start\"\n ? (logicalStartAtLeft ? \"left\" : \"right\")\n : preferredPlacement === \"end\"\n ? (logicalStartAtLeft ? \"right\" : \"left\")\n : preferredPlacement;\n let physicalPlacement: \"bottom\" | \"top\" | \"left\" | \"right\" =\n preferredPhysicalPlacement;\n if (\n physicalPlacement === \"bottom\" &&\n desiredPopupHeight > availableBottom &&\n availableTop > availableBottom\n ) physicalPlacement = \"top\";\n else if (\n physicalPlacement === \"top\" &&\n desiredPopupHeight > availableTop &&\n availableBottom > availableTop\n ) physicalPlacement = \"bottom\";\n else if (\n physicalPlacement === \"left\" &&\n desiredPopupWidth > availableLeft &&\n availableRight > availableLeft\n ) physicalPlacement = \"right\";\n else if (\n physicalPlacement === \"right\" &&\n desiredPopupWidth > availableRight &&\n availableLeft > availableRight\n ) physicalPlacement = \"left\";\n // A wide form cannot fit beside a centered mobile trigger. Preserve readable\n // content by trying the block axis; existing compact popup defaults stay unchanged.\n if (fallbackAxis && (physicalPlacement === \"left\" || physicalPlacement === \"right\") &&\n Math.max(availableLeft, availableRight) < desiredPopupWidth) {\n physicalPlacement = availableBottom >= availableTop ? \"bottom\" : \"top\";\n }\n const placement: AnchoredPopupPlacement = physicalPlacement === \"left\"\n ? (logicalStartAtLeft ? \"start\" : \"end\")\n : physicalPlacement === \"right\"\n ? (logicalStartAtLeft ? \"end\" : \"start\")\n : physicalPlacement;\n const availableHeight = physicalPlacement === \"bottom\"\n ? availableBottom\n : physicalPlacement === \"top\"\n ? availableTop\n : maximumPopupHeight;\n const availableWidth = physicalPlacement === \"left\"\n ? availableLeft\n : physicalPlacement === \"right\"\n ? availableRight\n : maximumPopupWidth;\n const popupHeight = Math.min(desiredPopupHeight, Math.max(0, availableHeight));\n const popupWidth = Math.min(desiredPopupWidth, Math.max(0, availableWidth));\n const alignLeftEdge = align === \"start\" ? logicalStartAtLeft : !logicalStartAtLeft;\n const inlineAlignedLeft = align === \"center\"\n ? anchorRect.left + ((anchorRect.width - popupWidth) / 2)\n : alignLeftEdge\n ? anchorRect.left\n : anchorRect.right - popupWidth;\n const blockAlignedTop = align === \"center\"\n ? anchorRect.top + ((anchorRect.height - popupHeight) / 2)\n : align === \"start\"\n ? anchorRect.top\n : anchorRect.bottom - popupHeight;\n const desiredLeft = physicalPlacement === \"left\"\n ? anchorRect.left - gap - popupWidth\n : physicalPlacement === \"right\"\n ? anchorRect.right + gap\n : inlineAlignedLeft;\n const maximumLeft = Math.max(\n viewportLeft + viewportPadding,\n viewportRight - viewportPadding - popupWidth,\n );\n const left = Math.min(\n Math.max(desiredLeft, viewportLeft + viewportPadding),\n maximumLeft,\n );\n const desiredTop = physicalPlacement === \"bottom\"\n ? anchorRect.bottom + gap\n : physicalPlacement === \"top\"\n ? anchorRect.top - gap - popupHeight\n : blockAlignedTop;\n const maximumTop = Math.max(\n viewportTop + viewportPadding,\n viewportBottom - viewportPadding - popupHeight,\n );\n const top = Math.min(\n Math.max(desiredTop, viewportTop + viewportPadding),\n maximumTop,\n );\n const next: AnchoredPopupPosition = {\n align,\n placement,\n style: {\n position: \"fixed\",\n inset: \"auto\",\n left: Math.round(left),\n top: Math.round(top),\n minWidth: matchAnchorWidth\n ? Math.round(Math.min(anchorRect.width, availableWidth, maximumPopupWidth))\n : undefined,\n maxWidth: Math.max(0, availableWidth),\n maxHeight: Math.max(0, availableHeight),\n visibility: \"visible\",\n zIndex: resolvedZIndex,\n },\n };\n setPosition((previous) => samePosition(previous, next) ? previous : next);\n }, [\n align,\n anchorRef,\n fallbackAxis,\n gap,\n matchAnchorWidth,\n popup,\n preferredPlacement,\n viewportPadding,\n zIndex,\n ]);\n\n useEffect(() => {\n if (!popup) {\n setPosition({ ...hiddenPopupPosition, align });\n return;\n }\n update();\n const frame = requestAnimationFrame(update);\n const handleViewportChange = () => update();\n window.addEventListener(\"resize\", handleViewportChange);\n window.addEventListener(\"scroll\", handleViewportChange, true);\n window.visualViewport?.addEventListener(\"resize\", handleViewportChange);\n window.visualViewport?.addEventListener(\"scroll\", handleViewportChange);\n const resizeObserver = typeof ResizeObserver === \"undefined\"\n ? null\n : new ResizeObserver(update);\n if (anchorRef.current) resizeObserver?.observe(anchorRef.current);\n resizeObserver?.observe(popup);\n return () => {\n cancelAnimationFrame(frame);\n window.removeEventListener(\"resize\", handleViewportChange);\n window.removeEventListener(\"scroll\", handleViewportChange, true);\n window.visualViewport?.removeEventListener(\"resize\", handleViewportChange);\n window.visualViewport?.removeEventListener(\"scroll\", handleViewportChange);\n resizeObserver?.disconnect();\n };\n }, [align, anchorRef, popup, update]);\n\n return position;\n}\n"]}
1
+ {"version":3,"file":"portal.js","sourceRoot":"","sources":["../src/portal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EACL,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAUzC,0FAA0F;AAC1F,MAAM,UAAU,eAAe,CAAC,IAAiB;IAC/C,MAAM,OAAO,GAAG,IAAI,YAAY,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC;IACrE,MAAM,MAAM,GAAG,OAAO,EAAE,OAAO,CAAc,4BAA4B,CAA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I,cAAc,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,SAAS,CAAC,OAAO;YAAE,cAAc,EAAE,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAClE,cAAc,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,GAAG,EAAE;YACV,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAC5B,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;YAC3D,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,IAAI,CAAC,CAAC;YACjE,MAAM,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;YAC3E,MAAM,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;YAC3E,cAAc,EAAE,UAAU,EAAE,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAEtC,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { layer } from \"@hjmds/design-contracts/foundations\";\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nexport type PortalProps = Readonly<{\n anchorRef: RefObject<HTMLElement | null>;\n children: ReactNode;\n container?: HTMLElement;\n /** Anchored non-modal popups may render inline until hydration moves them. */\n ssrFallback?: \"none\" | \"inline\";\n}>;\n\n/** Nearest interactive popover, including descendants rendered through another portal. */\nexport function getPopoverOwner(node: Node | null): HTMLElement | null {\n const element = node instanceof Element ? node : node?.parentElement;\n const direct = element?.closest<HTMLElement>(\"[data-hjm-popover-content]\");\n if (direct) return direct;\n const ownerId = element?.closest<HTMLElement>(\"[data-hjm-popover-owner]\")?.getAttribute(\"data-hjm-popover-owner\");\n return ownerId ? document.getElementById(ownerId) : null;\n}\n\n/**\n * Copies the closest provider DOM boundary instead of importing provider\n * runtime code, keeping granular form/overlay entry points lightweight.\n */\nfunction synchronizePortalEnvironment(host: HTMLDivElement, anchor: HTMLElement | null): void {\n // Modal ownership and non-modal ownership are separate: nested selects/menus\n // must belong to both, so outside focus does not close their parent popover.\n const popoverOwner = getPopoverOwner(anchor);\n if (popoverOwner?.id) host.setAttribute(\"data-hjm-popover-owner\", popoverOwner.id);\n else host.removeAttribute(\"data-hjm-popover-owner\");\n const source = anchor?.closest<HTMLElement>(\"[data-hjm-provider], [data-hjm-portal]\") ?? null;\n const directModalOwner = anchor?.closest<HTMLElement>(\"[data-hjm-modal-content]\") ?? null;\n const inheritedOwnerId = anchor\n ?.closest<HTMLElement>(\"[data-hjm-popup-owner]\")\n ?.getAttribute(\"data-hjm-popup-owner\") ?? null;\n const modalOwner = directModalOwner ??\n (inheritedOwnerId === null ? null : document.getElementById(inheritedOwnerId));\n if (modalOwner?.id) host.setAttribute(\"data-hjm-popup-owner\", modalOwner.id);\n else host.removeAttribute(\"data-hjm-popup-owner\");\n if (source) {\n host.removeAttribute(\"style\");\n for (let index = 0; index < source.style.length; index += 1) {\n const property = source.style.item(index);\n if (\n property.startsWith(\"--hjm-\") ||\n property === \"background-color\" ||\n property === \"color\" ||\n property === \"color-scheme\" ||\n property === \"font-family\" ||\n property === \"font-size\" ||\n property === \"line-height\"\n ) {\n host.style.setProperty(\n property,\n source.style.getPropertyValue(property),\n source.style.getPropertyPriority(property),\n );\n }\n }\n for (const attribute of [\"data-motion\", \"data-theme\", \"data-text-scale\", \"data-large-text\"] as const) {\n const value = source.getAttribute(attribute);\n if (value === null) host.removeAttribute(attribute);\n else host.setAttribute(attribute, value);\n }\n host.dir = source.dir;\n return;\n }\n host.removeAttribute(\"style\");\n host.removeAttribute(\"data-motion\");\n host.removeAttribute(\"data-theme\");\n host.removeAttribute(\"data-text-scale\");\n host.removeAttribute(\"data-large-text\");\n host.dir = anchor?.closest<HTMLElement>(\"[dir]\")?.dir ?? \"\";\n}\n\nexport function AnchoredPortal({\n anchorRef,\n children,\n container,\n ssrFallback = \"none\",\n}: PortalProps) {\n const [mounted, setMounted] = useState(false);\n const hostRef = useRef<HTMLDivElement | null>(null);\n const setHostRef = useCallback((host: HTMLDivElement | null) => {\n hostRef.current = host;\n if (host) synchronizePortalEnvironment(host, anchorRef.current);\n }, [anchorRef]);\n useEffect(() => setMounted(true), []);\n useEffect(() => {\n const host = hostRef.current;\n const source = anchorRef.current?.closest<HTMLElement>(\n \"[data-hjm-provider], [data-hjm-portal]\",\n ) ?? null;\n if (!host || !source || typeof MutationObserver === \"undefined\") return;\n const observer = new MutationObserver(() => {\n synchronizePortalEnvironment(host, anchorRef.current);\n });\n observer.observe(source, {\n attributes: true,\n attributeFilter: [\"data-motion\", \"data-theme\", \"data-text-scale\", \"data-large-text\", \"dir\", \"style\"],\n });\n return () => observer.disconnect();\n }, [anchorRef, mounted]);\n if (!mounted) return ssrFallback === \"inline\" ? children : null;\n return createPortal(\n <div ref={setHostRef} className=\"hjm-root hjm-portal\" data-hjm-portal=\"\">\n {children}\n </div>,\n container ?? document.body,\n );\n}\n\nexport type AnchoredPopupAlign = \"start\" | \"center\" | \"end\";\nexport type AnchoredPopupPlacement = \"bottom\" | \"top\" | \"start\" | \"end\";\n\ntype AnchoredPopupPosition = Readonly<{\n align: AnchoredPopupAlign;\n placement: AnchoredPopupPlacement;\n style: CSSProperties;\n}>;\n\ntype AnchoredPopupOptions = Readonly<{\n align?: AnchoredPopupAlign;\n gap?: number;\n matchAnchorWidth?: boolean;\n placement?: AnchoredPopupPlacement;\n viewportPadding?: number;\n zIndex?: number;\n /** Wide contextual content may switch to the block axis in a narrow viewport. */\n fallbackAxis?: boolean;\n /** Ignore presentation transforms when sizing an animated surface. */\n layoutDimensions?: boolean;\n}>;\n\nconst hiddenPopupPosition: AnchoredPopupPosition = {\n align: \"start\",\n placement: \"bottom\",\n style: {\n position: \"fixed\",\n inset: \"auto\",\n left: 0,\n top: 0,\n visibility: \"hidden\",\n },\n};\n\nfunction samePosition(\n previous: AnchoredPopupPosition,\n next: AnchoredPopupPosition,\n): boolean {\n return previous.align === next.align &&\n previous.placement === next.placement &&\n previous.style.left === next.style.left &&\n previous.style.top === next.style.top &&\n previous.style.minWidth === next.style.minWidth &&\n previous.style.maxWidth === next.style.maxWidth &&\n previous.style.maxHeight === next.style.maxHeight &&\n previous.style.zIndex === next.style.zIndex &&\n previous.style.visibility === next.style.visibility;\n}\n\n/**\n * Positions a fixed portal popup against its anchor using logical alignment.\n * The popup flips vertically and shifts horizontally to stay inside the visual\n * viewport, then follows every scroll/resize source that can move either node.\n */\nexport function useAnchoredPopup(\n anchorRef: RefObject<HTMLElement | null>,\n popup: HTMLElement | null,\n {\n align = \"start\",\n fallbackAxis = false,\n layoutDimensions = false,\n gap = 8,\n matchAnchorWidth = false,\n placement: preferredPlacement = \"bottom\",\n viewportPadding = 16,\n zIndex = layer.dropdown,\n }: AnchoredPopupOptions = {},\n): AnchoredPopupPosition {\n const [position, setPosition] = useState<AnchoredPopupPosition>(() => ({\n ...hiddenPopupPosition,\n align,\n }));\n\n const update = useCallback(() => {\n const anchor = anchorRef.current;\n if (!anchor || !popup || !anchor.isConnected || !popup.isConnected) return;\n\n const anchorRect = anchor.getBoundingClientRect();\n // Origin transitions may temporarily shrink/enlarge the surface. Collision\n // placement needs its final layout size, otherwise resize/scroll makes it drift.\n const popupRect = layoutDimensions ? { width: popup.offsetWidth, height: popup.offsetHeight } : popup.getBoundingClientRect();\n const visualViewport = window.visualViewport;\n const viewportLeft = visualViewport?.offsetLeft ?? 0;\n const viewportTop = visualViewport?.offsetTop ?? 0;\n const viewportWidth = visualViewport?.width ?? window.innerWidth;\n const viewportHeight = visualViewport?.height ?? window.innerHeight;\n const viewportRight = viewportLeft + viewportWidth;\n const viewportBottom = viewportTop + viewportHeight;\n const availableBottom = Math.max(0, viewportBottom - viewportPadding - anchorRect.bottom - gap);\n const availableTop = Math.max(0, anchorRect.top - viewportTop - viewportPadding - gap);\n const availableLeft = Math.max(0, anchorRect.left - viewportLeft - viewportPadding - gap);\n const availableRight = Math.max(0, viewportRight - viewportPadding - anchorRect.right - gap);\n const maximumPopupHeight = Math.max(0, viewportHeight - (2 * viewportPadding));\n const maximumPopupWidth = Math.max(0, viewportWidth - (2 * viewportPadding));\n const desiredPopupHeight = Math.min(\n Math.max(popupRect.height, popup.scrollHeight),\n maximumPopupHeight,\n );\n const desiredPopupWidth = Math.min(\n Math.max(popupRect.width, popup.scrollWidth, matchAnchorWidth ? anchorRect.width : 0),\n maximumPopupWidth,\n );\n const direction = getComputedStyle(anchor).direction;\n const directModalOwner = anchor.closest<HTMLElement>(\"[data-hjm-modal-content]\");\n const inheritedOwnerId = anchor\n .closest<HTMLElement>(\"[data-hjm-popup-owner]\")\n ?.getAttribute(\"data-hjm-popup-owner\") ?? null;\n const modalOwner = directModalOwner ??\n (inheritedOwnerId === null ? null : document.getElementById(inheritedOwnerId));\n const modalLayerValue = modalOwner\n ?.closest<HTMLElement>(\".hjm-overlay\")\n ?.style.zIndex ?? \"\";\n const modalLayer = Number.parseInt(modalLayerValue, 10);\n const resolvedZIndex = Number.isFinite(modalLayer) ? modalLayer + 1 : zIndex;\n const logicalStartAtLeft = direction !== \"rtl\";\n const preferredPhysicalPlacement = preferredPlacement === \"start\"\n ? (logicalStartAtLeft ? \"left\" : \"right\")\n : preferredPlacement === \"end\"\n ? (logicalStartAtLeft ? \"right\" : \"left\")\n : preferredPlacement;\n let physicalPlacement: \"bottom\" | \"top\" | \"left\" | \"right\" =\n preferredPhysicalPlacement;\n if (\n physicalPlacement === \"bottom\" &&\n desiredPopupHeight > availableBottom &&\n availableTop > availableBottom\n ) physicalPlacement = \"top\";\n else if (\n physicalPlacement === \"top\" &&\n desiredPopupHeight > availableTop &&\n availableBottom > availableTop\n ) physicalPlacement = \"bottom\";\n else if (\n physicalPlacement === \"left\" &&\n desiredPopupWidth > availableLeft &&\n availableRight > availableLeft\n ) physicalPlacement = \"right\";\n else if (\n physicalPlacement === \"right\" &&\n desiredPopupWidth > availableRight &&\n availableLeft > availableRight\n ) physicalPlacement = \"left\";\n // A wide form cannot fit beside a centered mobile trigger. Preserve readable\n // content by trying the block axis; existing compact popup defaults stay unchanged.\n if (fallbackAxis && (physicalPlacement === \"left\" || physicalPlacement === \"right\") &&\n Math.max(availableLeft, availableRight) < desiredPopupWidth) {\n physicalPlacement = availableBottom >= availableTop ? \"bottom\" : \"top\";\n }\n const placement: AnchoredPopupPlacement = physicalPlacement === \"left\"\n ? (logicalStartAtLeft ? \"start\" : \"end\")\n : physicalPlacement === \"right\"\n ? (logicalStartAtLeft ? \"end\" : \"start\")\n : physicalPlacement;\n const availableHeight = physicalPlacement === \"bottom\"\n ? availableBottom\n : physicalPlacement === \"top\"\n ? availableTop\n : maximumPopupHeight;\n const availableWidth = physicalPlacement === \"left\"\n ? availableLeft\n : physicalPlacement === \"right\"\n ? availableRight\n : maximumPopupWidth;\n const popupHeight = Math.min(desiredPopupHeight, Math.max(0, availableHeight));\n const popupWidth = Math.min(desiredPopupWidth, Math.max(0, availableWidth));\n const alignLeftEdge = align === \"start\" ? logicalStartAtLeft : !logicalStartAtLeft;\n const inlineAlignedLeft = align === \"center\"\n ? anchorRect.left + ((anchorRect.width - popupWidth) / 2)\n : alignLeftEdge\n ? anchorRect.left\n : anchorRect.right - popupWidth;\n const blockAlignedTop = align === \"center\"\n ? anchorRect.top + ((anchorRect.height - popupHeight) / 2)\n : align === \"start\"\n ? anchorRect.top\n : anchorRect.bottom - popupHeight;\n const desiredLeft = physicalPlacement === \"left\"\n ? anchorRect.left - gap - popupWidth\n : physicalPlacement === \"right\"\n ? anchorRect.right + gap\n : inlineAlignedLeft;\n const maximumLeft = Math.max(\n viewportLeft + viewportPadding,\n viewportRight - viewportPadding - popupWidth,\n );\n const left = Math.min(\n Math.max(desiredLeft, viewportLeft + viewportPadding),\n maximumLeft,\n );\n const desiredTop = physicalPlacement === \"bottom\"\n ? anchorRect.bottom + gap\n : physicalPlacement === \"top\"\n ? anchorRect.top - gap - popupHeight\n : blockAlignedTop;\n const maximumTop = Math.max(\n viewportTop + viewportPadding,\n viewportBottom - viewportPadding - popupHeight,\n );\n const top = Math.min(\n Math.max(desiredTop, viewportTop + viewportPadding),\n maximumTop,\n );\n const next: AnchoredPopupPosition = {\n align,\n placement,\n style: {\n position: \"fixed\",\n inset: \"auto\",\n left: Math.round(left),\n top: Math.round(top),\n minWidth: matchAnchorWidth\n ? Math.round(Math.min(anchorRect.width, availableWidth, maximumPopupWidth))\n : undefined,\n maxWidth: Math.max(0, availableWidth),\n maxHeight: Math.max(0, availableHeight),\n visibility: \"visible\",\n zIndex: resolvedZIndex,\n },\n };\n setPosition((previous) => samePosition(previous, next) ? previous : next);\n }, [\n align,\n anchorRef,\n fallbackAxis,\n layoutDimensions,\n gap,\n matchAnchorWidth,\n popup,\n preferredPlacement,\n viewportPadding,\n zIndex,\n ]);\n\n useEffect(() => {\n if (!popup) {\n setPosition({ ...hiddenPopupPosition, align });\n return;\n }\n update();\n const frame = requestAnimationFrame(update);\n const handleViewportChange = () => update();\n window.addEventListener(\"resize\", handleViewportChange);\n window.addEventListener(\"scroll\", handleViewportChange, true);\n window.visualViewport?.addEventListener(\"resize\", handleViewportChange);\n window.visualViewport?.addEventListener(\"scroll\", handleViewportChange);\n const resizeObserver = typeof ResizeObserver === \"undefined\"\n ? null\n : new ResizeObserver(update);\n if (anchorRef.current) resizeObserver?.observe(anchorRef.current);\n resizeObserver?.observe(popup);\n return () => {\n cancelAnimationFrame(frame);\n window.removeEventListener(\"resize\", handleViewportChange);\n window.removeEventListener(\"scroll\", handleViewportChange, true);\n window.visualViewport?.removeEventListener(\"resize\", handleViewportChange);\n window.visualViewport?.removeEventListener(\"scroll\", handleViewportChange);\n resizeObserver?.disconnect();\n };\n }, [align, anchorRef, popup, update]);\n\n return position;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { type ProgressiveBlurDescriptor } from '@hjmds/design-contracts/progressive-blur';
2
+ export type ProgressiveBlurProps = Readonly<{
3
+ descriptor: ProgressiveBlurDescriptor;
4
+ }>;
5
+ /** Place after the content inside a positioned, clipped host. Never wrap content. */
6
+ export declare function ProgressiveBlur({ descriptor }: ProgressiveBlurProps): import("react").JSX.Element | null;
7
+ //# sourceMappingURL=progressive-blur.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progressive-blur.d.ts","sourceRoot":"","sources":["../src/progressive-blur.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAElH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAAE,UAAU,EAAE,yBAAyB,CAAA;CAAE,CAAC,CAAC;AACvF,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE,oBAAoB,sCAenE"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { resolveProgressiveBlur } from '@hjmds/design-contracts/progressive-blur';
3
+ import { useHjmTheme } from './provider.js';
4
+ /** Place after the content inside a positioned, clipped host. Never wrap content. */
5
+ export function ProgressiveBlur({ descriptor }) {
6
+ const { environment } = useHjmTheme();
7
+ const effect = resolveProgressiveBlur(descriptor, environment.direction);
8
+ if (!effect.visible)
9
+ return null;
10
+ const vertical = effect.side === 'top' || effect.side === 'bottom';
11
+ const toward = { top: 'top', bottom: 'bottom', left: 'left', right: 'right' }[effect.side];
12
+ return _jsx("div", { "aria-hidden": "true", "data-hjm-progressive-blur": effect.side, style: { position: 'absolute', pointerEvents: 'none', [effect.side]: 0, ...(vertical ? { left: 0, right: 0, height: effect.extent } : { top: 0, bottom: 0, width: effect.extent }) }, children: effect.layers.map((layer, index) => {
13
+ const mask = `linear-gradient(to ${toward}, transparent ${layer.start * 100}%, black ${layer.end * 100}%)`;
14
+ // Pixel mapping is Web-only. Native hosts calibrate their own intensity;
15
+ // a CSS radius is not portable to platform blur engines.
16
+ const blur = `blur(${layer.strength * 16}px)`;
17
+ return _jsx("div", { style: { position: 'absolute', inset: 0, pointerEvents: 'none', backdropFilter: blur, WebkitBackdropFilter: blur, maskImage: mask, WebkitMaskImage: mask } }, index);
18
+ }) });
19
+ }
20
+ //# sourceMappingURL=progressive-blur.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progressive-blur.js","sourceRoot":"","sources":["../src/progressive-blur.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAkC,MAAM,0CAA0C,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qFAAqF;AACrF,MAAM,UAAU,eAAe,CAAC,EAAE,UAAU,EAAwB;IAClE,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,sBAAsB,CAAC,UAAU,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACzE,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IACjC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;IACnE,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3F,OAAO,6BAAiB,MAAM,+BAA4B,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,YACxP,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAClC,MAAM,IAAI,GAAG,sBAAsB,MAAM,iBAAiB,KAAK,CAAC,KAAK,GAAG,GAAG,YAAY,KAAK,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;YAC3G,yEAAyE;YACzE,yDAAyD;YACzD,MAAM,IAAI,GAAG,QAAQ,KAAK,CAAC,QAAQ,GAAG,EAAE,KAAK,CAAC;YAC9C,OAAO,cAAiB,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,IAAjK,KAAK,CAAgK,CAAC;QACzL,CAAC,CAAC,GACE,CAAC;AACT,CAAC","sourcesContent":["import { resolveProgressiveBlur, type ProgressiveBlurDescriptor } from '@hjmds/design-contracts/progressive-blur';\nimport { useHjmTheme } from './provider.js';\nexport type ProgressiveBlurProps = Readonly<{ descriptor: ProgressiveBlurDescriptor }>;\n/** Place after the content inside a positioned, clipped host. Never wrap content. */\nexport function ProgressiveBlur({ descriptor }: ProgressiveBlurProps) {\n const { environment } = useHjmTheme();\n const effect = resolveProgressiveBlur(descriptor, environment.direction);\n if (!effect.visible) return null;\n const vertical = effect.side === 'top' || effect.side === 'bottom';\n const toward = { top: 'top', bottom: 'bottom', left: 'left', right: 'right' }[effect.side];\n return <div aria-hidden=\"true\" data-hjm-progressive-blur={effect.side} style={{ position: 'absolute', pointerEvents: 'none', [effect.side]: 0, ...(vertical ? { left: 0, right: 0, height: effect.extent } : { top: 0, bottom: 0, width: effect.extent }) }}>\n {effect.layers.map((layer, index) => {\n const mask = `linear-gradient(to ${toward}, transparent ${layer.start * 100}%, black ${layer.end * 100}%)`;\n // Pixel mapping is Web-only. Native hosts calibrate their own intensity;\n // a CSS radius is not portable to platform blur engines.\n const blur = `blur(${layer.strength * 16}px)`;\n return <div key={index} style={{ position: 'absolute', inset: 0, pointerEvents: 'none', backdropFilter: blur, WebkitBackdropFilter: blur, maskImage: mask, WebkitMaskImage: mask }} />;\n })}\n </div>;\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import type { HjmCompositionStyleProp } from "./composition-style.js";
2
+ import { type RatingDescriptor } from "@hjmds/design-contracts/reference-controls";
3
+ export type RatingProps = RatingDescriptor & Readonly<{
4
+ /** Product-localized score and unrated text, also used as the radio name. */
5
+ getValueLabel: (value: number | null) => string;
6
+ disabled?: boolean;
7
+ layoutStyle?: HjmCompositionStyleProp;
8
+ clearLabel?: string;
9
+ name?: string;
10
+ }> & (Readonly<{
11
+ readOnly: true;
12
+ onValueChange?: never;
13
+ }> | Readonly<{
14
+ readOnly?: false;
15
+ onValueChange: (value: number | null) => void;
16
+ }>);
17
+ /** Controlled score input, with a distinct non-interactive average representation. */
18
+ export declare function Rating(props: RatingProps): import("react").JSX.Element;
19
+ //# sourceMappingURL=rating.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rating.d.ts","sourceRoot":"","sources":["../src/rating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAGlG,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,QAAQ,CAAC;IACpD,6EAA6E;IAC7E,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,GAAG,CAAC,QAAQ,CAAC;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,aAAa,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,GAAG,QAAQ,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC;IAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;CAAE,CAAC,CAAC,CAAC;AAM3I,sFAAsF;AACtF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BA4BxC"}
package/dist/rating.js ADDED
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId, useRef } from "react";
3
+ import { resolveRating } from "@hjmds/design-contracts/reference-controls";
4
+ import { Button } from "./actions.js";
5
+ function Star({ fraction }) {
6
+ return _jsxs("span", { "aria-hidden": "true", style: { pointerEvents: "none", position: "relative", display: "inline-block", fontSize: "1.75em", lineHeight: 1, color: "var(--hjm-color-content-brand, currentColor)" }, children: [_jsx("span", { children: "\u2606" }), _jsx("span", { style: { position: "absolute", inset: 0, width: `${fraction * 100}%`, overflow: "hidden" }, children: "\u2605" })] });
7
+ }
8
+ /** Controlled score input, with a distinct non-interactive average representation. */
9
+ export function Rating(props) {
10
+ const { label, value, readOnly = false, disabled = false, getValueLabel, clearLabel, name, layoutStyle } = props;
11
+ const { max, fractions } = resolveRating(props);
12
+ const id = useId();
13
+ const firstOption = useRef(null);
14
+ const valueLabel = getValueLabel(value);
15
+ if (!valueLabel.trim() || (clearLabel !== undefined && !clearLabel.trim()))
16
+ throw new TypeError("Rating text must not be empty");
17
+ const row = { display: "flex", flexWrap: "wrap", gap: "var(--hjm-space-xs)" };
18
+ if (readOnly)
19
+ return _jsxs("div", { role: "img", "aria-label": `${label}: ${valueLabel}`, style: { ...row, ...layoutStyle }, children: [fractions.map((fraction, index) => _jsx(Star, { fraction: fraction }, index)), _jsx("span", { "aria-hidden": "true", children: valueLabel })] });
20
+ return _jsxs("fieldset", { className: "hjm-rating-control", disabled: disabled, style: { border: 0, margin: 0, padding: 0, minWidth: 0, ...layoutStyle }, children: [_jsx("legend", { children: label }), _jsx("div", { style: row, children: Array.from({ length: max }, (_, index) => {
21
+ const score = index + 1;
22
+ const optionLabel = getValueLabel(score);
23
+ if (!optionLabel.trim())
24
+ throw new TypeError("Rating option text must not be empty");
25
+ return _jsxs("label", { className: "hjm-rating__option", children: [_jsx("input", { ref: index === 0 ? firstOption : undefined, type: "radio", name: name ?? id, value: score, checked: value === score, "aria-label": optionLabel, onChange: () => { if (!disabled)
26
+ props.onValueChange?.(score); } }), _jsx(Star, { fraction: fractions[index] })] }, score);
27
+ }) }), _jsx("div", { role: "status", children: valueLabel }), clearLabel ? _jsx(Button, { tone: "ghost", disabled: disabled || value === null, onClick: () => {
28
+ // Clearing disables this button. Move focus before the controlled update so
29
+ // keyboard users can choose again instead of losing their place to body.
30
+ firstOption.current?.focus();
31
+ props.onValueChange?.(null);
32
+ }, children: clearLabel }) : null] });
33
+ }
34
+ //# sourceMappingURL=rating.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rating.js","sourceRoot":"","sources":["../src/rating.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAsB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAyB,MAAM,4CAA4C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAUtC,SAAS,IAAI,CAAC,EAAE,QAAQ,EAAwB;IAC9C,OAAO,+BAAkB,MAAM,EAAC,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,EAAE,KAA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EAAC,OAAO,EAAC,QAAQ,EAAE,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE;oBACrF,4EAA4E;oBAC5E,yEAAyE;oBACzE,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;oBAC7B,KAAK,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC;gBAC9B,CAAC,YAAG,UAAU,GAAU,CAAC,CAAC,CAAC,IAAI,IACtB,CAAC;AACd,CAAC","sourcesContent":["import type { HjmCompositionStyleProp } from \"./composition-style.js\";\nimport { useId, useRef, type CSSProperties } from \"react\";\nimport { resolveRating, type RatingDescriptor } from \"@hjmds/design-contracts/reference-controls\";\nimport { Button } from \"./actions.js\";\n\nexport type RatingProps = RatingDescriptor & Readonly<{\n /** Product-localized score and unrated text, also used as the radio name. */\n getValueLabel: (value: number | null) => string;\n disabled?: boolean;\n layoutStyle?: HjmCompositionStyleProp;\n clearLabel?: string;\n name?: string;\n}> & (Readonly<{ readOnly: true; onValueChange?: never }> | Readonly<{ readOnly?: false; onValueChange: (value: number | null) => void }>);\nfunction Star({ fraction }: { fraction: number }) {\n return <span aria-hidden=\"true\" style={{ pointerEvents: \"none\", position: \"relative\", display: \"inline-block\", fontSize: \"1.75em\", lineHeight: 1, color: \"var(--hjm-color-content-brand, currentColor)\" }}>\n <span>☆</span><span style={{ position: \"absolute\", inset: 0, width: `${fraction * 100}%`, overflow: \"hidden\" }}>★</span>\n </span>;\n}\n/** Controlled score input, with a distinct non-interactive average representation. */\nexport function Rating(props: RatingProps) {\n const { label, value, readOnly = false, disabled = false, getValueLabel, clearLabel, name, layoutStyle } = props;\n const { max, fractions } = resolveRating(props);\n const id = useId();\n const firstOption = useRef<HTMLInputElement>(null);\n const valueLabel = getValueLabel(value);\n if (!valueLabel.trim() || (clearLabel !== undefined && !clearLabel.trim())) throw new TypeError(\"Rating text must not be empty\");\n const row: CSSProperties = { display: \"flex\", flexWrap: \"wrap\", gap: \"var(--hjm-space-xs)\" };\n if (readOnly) return <div role=\"img\" aria-label={`${label}: ${valueLabel}`} style={{ ...row, ...layoutStyle }}>{fractions.map((fraction, index) => <Star key={index} fraction={fraction} />)}<span aria-hidden=\"true\">{valueLabel}</span></div>;\n return <fieldset className=\"hjm-rating-control\" disabled={disabled} style={{ border: 0, margin: 0, padding: 0, minWidth: 0, ...layoutStyle }}>\n <legend>{label}</legend>\n <div style={row}>{Array.from({ length: max }, (_, index) => {\n const score = index + 1;\n const optionLabel = getValueLabel(score);\n if (!optionLabel.trim()) throw new TypeError(\"Rating option text must not be empty\");\n return <label key={score} className=\"hjm-rating__option\">\n <input ref={index === 0 ? firstOption : undefined} type=\"radio\" name={name ?? id} value={score} checked={value === score} aria-label={optionLabel} onChange={() => { if (!disabled) props.onValueChange?.(score); }} />\n <Star fraction={fractions[index]!} />\n </label>;\n })}</div>\n <div role=\"status\">{valueLabel}</div>\n {clearLabel ? <Button tone=\"ghost\" disabled={disabled || value === null} onClick={() => {\n // Clearing disables this button. Move focus before the controlled update so\n // keyboard users can choose again instead of losing their place to body.\n firstOption.current?.focus();\n props.onValueChange?.(null);\n }}>{clearLabel}</Button> : null}\n </fieldset>;\n}\n"]}
@@ -187,6 +187,8 @@ export type SegmentedControlProps = Omit<FieldsetHTMLAttributes<HTMLFieldSetElem
187
187
  onValueChange?: (value: string) => void;
188
188
  size?: SegmentedControlSize;
189
189
  presentation?: "connected" | "pills";
190
+ /** Move only the selection artwork; radio semantics and hit targets stay fixed. */
191
+ selectionMotion?: "none" | "slide";
190
192
  name?: string;
191
193
  /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
192
194
  layoutStyle?: HjmCompositionStyleProp;
@@ -199,6 +201,8 @@ export declare const SegmentedControl: import("react").ForwardRefExoticComponent
199
201
  onValueChange?: (value: string) => void;
200
202
  size?: SegmentedControlSize;
201
203
  presentation?: "connected" | "pills";
204
+ /** Move only the selection artwork; radio semantics and hit targets stay fixed. */
205
+ selectionMotion?: "none" | "slide";
202
206
  name?: string;
203
207
  /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
204
208
  layoutStyle?: HjmCompositionStyleProp;
@@ -1 +1 @@
1
- {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../src/selection.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAMV,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,UAAU,EACf,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC;AAC/C,OAAO,EAQL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,KAAK,aAAa,GAAG,IAAI,CACvB,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAC7C,GACC,QAAQ,CAAC;IACP,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,OAAO,UAAU,CAAC,KAAK,CAAC;IACrC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,wBAAwB,CAAC,EAA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