se-design 1.0.95 → 1.0.96

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 (116) hide show
  1. package/dist/assets/icons/zoom-in.svg +3 -0
  2. package/dist/assets/icons/zoom-out.svg +3 -0
  3. package/dist/index12.js +2 -2
  4. package/dist/index13.js +2 -2
  5. package/dist/index16.js +1 -1
  6. package/dist/index19.js +1 -1
  7. package/dist/index210.js +2 -149
  8. package/dist/index210.js.map +1 -1
  9. package/dist/index211.js +2 -9
  10. package/dist/index211.js.map +1 -1
  11. package/dist/index212.js +149 -6
  12. package/dist/index212.js.map +1 -1
  13. package/dist/index213.js +8 -42
  14. package/dist/index213.js.map +1 -1
  15. package/dist/index214.js +5 -20
  16. package/dist/index214.js.map +1 -1
  17. package/dist/index215.js +46 -0
  18. package/dist/index215.js.map +1 -0
  19. package/dist/index216.js +24 -0
  20. package/dist/index216.js.map +1 -0
  21. package/dist/{index221.js → index223.js} +1 -1
  22. package/dist/{index221.js.map → index223.js.map} +1 -1
  23. package/dist/{index222.js → index224.js} +1 -1
  24. package/dist/{index222.js.map → index224.js.map} +1 -1
  25. package/dist/index231.js +4 -11
  26. package/dist/index231.js.map +1 -1
  27. package/dist/index233.js +15 -0
  28. package/dist/index233.js.map +1 -0
  29. package/dist/index24.js +1 -1
  30. package/dist/{index239.js → index241.js} +1 -1
  31. package/dist/{index239.js.map → index241.js.map} +1 -1
  32. package/dist/{index242.js → index244.js} +1 -1
  33. package/dist/{index242.js.map → index244.js.map} +1 -1
  34. package/dist/{index251.js → index253.js} +1 -1
  35. package/dist/{index251.js.map → index253.js.map} +1 -1
  36. package/dist/index254.js +3 -18
  37. package/dist/index254.js.map +1 -1
  38. package/dist/index256.js +18 -9
  39. package/dist/index256.js.map +1 -1
  40. package/dist/index257.js +9 -4
  41. package/dist/index257.js.map +1 -1
  42. package/dist/index258.js +10 -170
  43. package/dist/index258.js.map +1 -1
  44. package/dist/index259.js +5 -11
  45. package/dist/index259.js.map +1 -1
  46. package/dist/index26.js +1 -1
  47. package/dist/index260.js +170 -6
  48. package/dist/index260.js.map +1 -1
  49. package/dist/index261.js +11 -6
  50. package/dist/index261.js.map +1 -1
  51. package/dist/index262.js +5 -37
  52. package/dist/index262.js.map +1 -1
  53. package/dist/index263.js +6 -2
  54. package/dist/index263.js.map +1 -1
  55. package/dist/index264.js +37 -7
  56. package/dist/index264.js.map +1 -1
  57. package/dist/index265.js +2 -327
  58. package/dist/index265.js.map +1 -1
  59. package/dist/index266.js +7 -49
  60. package/dist/index266.js.map +1 -1
  61. package/dist/index267.js +327 -2
  62. package/dist/index267.js.map +1 -1
  63. package/dist/index268.js +45 -71
  64. package/dist/index268.js.map +1 -1
  65. package/dist/index269.js +2 -93
  66. package/dist/index269.js.map +1 -1
  67. package/dist/index270.js +72 -48
  68. package/dist/index270.js.map +1 -1
  69. package/dist/index271.js +92 -7
  70. package/dist/index271.js.map +1 -1
  71. package/dist/index272.js +51 -4
  72. package/dist/index272.js.map +1 -1
  73. package/dist/index273.js +7 -51
  74. package/dist/index273.js.map +1 -1
  75. package/dist/index274.js +5 -2
  76. package/dist/index274.js.map +1 -1
  77. package/dist/index275.js +52 -2
  78. package/dist/index275.js.map +1 -1
  79. package/dist/index276.js +5 -0
  80. package/dist/index276.js.map +1 -0
  81. package/dist/index277.js +5 -0
  82. package/dist/index277.js.map +1 -0
  83. package/dist/index29.js +2 -2
  84. package/dist/index30.js +1 -1
  85. package/dist/index31.js +1 -1
  86. package/dist/index34.js +1 -1
  87. package/dist/index36.js +1 -1
  88. package/dist/index37.js +1 -1
  89. package/dist/index38.js +1 -1
  90. package/dist/index39.js +1 -1
  91. package/dist/index40.js +2 -2
  92. package/dist/index41.js +1 -1
  93. package/dist/index44.js +1 -1
  94. package/dist/index46.js +1 -1
  95. package/dist/index51.js +2 -2
  96. package/dist/index54.js +1 -1
  97. package/dist/index56.js +1 -1
  98. package/dist/index57.js +1 -1
  99. package/dist/index58.js +1 -1
  100. package/dist/index6.js +67 -63
  101. package/dist/index6.js.map +1 -1
  102. package/dist/index62.js +1 -1
  103. package/dist/index66.js +1 -1
  104. package/dist/index68.js +1 -1
  105. package/dist/index7.js +1 -1
  106. package/dist/index70.js +1 -1
  107. package/dist/index84.js +1 -1
  108. package/dist/index86.js +1 -1
  109. package/dist/index9.js +1 -1
  110. package/package.json +1 -1
  111. package/dist/index229.js +0 -8
  112. package/dist/index229.js.map +0 -1
  113. package/dist/index252.js +0 -7
  114. package/dist/index252.js.map +0 -1
  115. package/dist/index255.js +0 -13
  116. package/dist/index255.js.map +0 -1
@@ -0,0 +1,46 @@
1
+ import { useRef as l } from "react";
2
+ import { useFocusTrap as d } from "./index77.js";
3
+ import { useDismissOnEscape as c } from "./index223.js";
4
+ import { getA11yNameAttributes as f } from "./index86.js";
5
+ import { useStableId as p } from "./index214.js";
6
+ function x({
7
+ isOpen: t,
8
+ onDismiss: s,
9
+ ariaLabel: o,
10
+ ariaLabelledBy: i,
11
+ titleIdPrefix: a = "modal-title",
12
+ initialFocus: m = "first",
13
+ portalContainerRefs: n
14
+ }) {
15
+ const e = l(null), r = p(void 0, a);
16
+ d({
17
+ enabled: t,
18
+ containerRef: e,
19
+ restoreFocus: !0,
20
+ initialFocus: m,
21
+ portalContainerRefs: n
22
+ }), c({
23
+ containerRef: e,
24
+ onDismiss: s,
25
+ enabled: t,
26
+ useDocumentListener: !0
27
+ });
28
+ const u = {
29
+ role: "dialog",
30
+ "aria-modal": !0,
31
+ tabIndex: -1,
32
+ ...f({
33
+ ariaLabelledBy: i ?? (o ? void 0 : r),
34
+ ariaLabel: o
35
+ })
36
+ };
37
+ return {
38
+ containerRef: e,
39
+ titleId: r,
40
+ dialogProps: u
41
+ };
42
+ }
43
+ export {
44
+ x as useModalA11y
45
+ };
46
+ //# sourceMappingURL=index215.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index215.js","sources":["../src/utils/a11y/useModalA11y.ts"],"sourcesContent":["import { useRef } from 'react';\nimport type { MutableRefObject, RefObject } from 'react';\nimport { useFocusTrap } from './useFocusTrap';\nimport { useDismissOnEscape } from './useDismissOnEscape';\nimport { getA11yNameAttributes } from './accessibleName';\nimport { useStableId } from 'src/utils/useStableId';\n\nexport interface UseModalA11yOptions {\n /**\n * Whether the modal is open. Controls focus trap and Escape handler activation.\n */\n isOpen: boolean;\n /**\n * Called when Escape is pressed while focus is within the modal.\n * If undefined, Escape dismissal is disabled.\n */\n onDismiss?: () => void;\n /**\n * aria-label for modals without a visible title heading.\n * Only used when `ariaLabelledBy` is not provided.\n */\n ariaLabel?: string;\n /**\n * ID of an existing visible element (e.g. an h2 inside the modal content) that labels\n * the dialog. Preferred over ariaLabel when a visible heading already exists in the content.\n * Only used when `title` is not provided.\n */\n ariaLabelledBy?: string;\n /**\n * Prefix for the auto-generated title element id. Default: 'modal-title'.\n */\n titleIdPrefix?: string;\n /**\n * Initial focus target when the modal opens. Forwarded to useFocusTrap.\n * - 'first': Focus first focusable element (default)\n * - 'container': Focus the dialog container itself\n * - 'none': Skip — browser handles it (e.g. autofocus attribute on inner element)\n * - CSS selector string: Focus matching element\n * - HTMLElement: Focus specific element\n */\n initialFocus?: 'first' | 'container' | 'none' | string | HTMLElement;\n /**\n * Additional container refs for portal content that is logically part of this modal.\n * Passed through to useFocusTrap and useDismissOnEscape so their safety nets\n * allow focus to move into portal-rendered content (e.g., Dropdown with isWithPortal).\n */\n portalContainerRefs?: MutableRefObject<RefObject<HTMLElement | null>[]>;\n}\n\nexport interface UseModalA11yReturn {\n /**\n * Ref to attach to the dialog container element.\n */\n containerRef: React.RefObject<HTMLDivElement | null>;\n /**\n * Stable ID to set on the visible title element: `<h2 id={titleId}>`.\n * Only relevant when `title` is provided.\n */\n titleId: string;\n /**\n * Spread onto the dialog container element.\n * Includes: role=\"dialog\", aria-modal, tabIndex, aria-labelledby or aria-label.\n */\n dialogProps: {\n role: 'dialog';\n 'aria-modal': true;\n tabIndex: number;\n [key: string]: unknown;\n };\n}\n\n/**\n * Bundles all WCAG dialog semantics into a single hook.\n *\n * Handles:\n * - Stable ID for title element (aria-labelledby association)\n * - Focus trap: moves focus into modal on open, wraps Tab, restores focus on close\n * - Escape dismissal: calls onDismiss when Escape is pressed within the modal\n * - dialogProps: role=\"dialog\", aria-modal, tabIndex, aria-labelledby / aria-label\n *\n * @example Modal with a visible title (most common)\n * ```tsx\n * const MyModal = ({ isOpen, onClose }) => {\n * const { containerRef, titleId, dialogProps } = useModalA11y({\n * isOpen,\n * onDismiss: onClose,\n * });\n *\n * return (\n * <div ref={containerRef} {...dialogProps} className=\"modal-content\">\n * <h2 id={titleId}>My Title</h2>\n * ...\n * </div>\n * );\n * };\n * ```\n *\n * @example Modal without a visible title\n * ```tsx\n * const { containerRef, dialogProps } = useModalA11y({\n * isOpen,\n * onDismiss: onClose,\n * ariaLabel: 'Upload document',\n * });\n * ```\n *\n * @example Custom initial focus (specific button) or skip (autofocus)\n * ```tsx\n * useModalA11y({ isOpen, onDismiss, initialFocus: '.my-cta-btn' });\n * useModalA11y({ isOpen, onDismiss, initialFocus: 'none' }); // autofocus on inner element\n * ```\n */\nexport function useModalA11y({\n isOpen,\n onDismiss,\n ariaLabel,\n ariaLabelledBy,\n titleIdPrefix = 'modal-title',\n initialFocus = 'first',\n portalContainerRefs,\n}: UseModalA11yOptions): UseModalA11yReturn {\n const containerRef = useRef<HTMLDivElement>(null);\n const titleId = useStableId(undefined, titleIdPrefix);\n\n useFocusTrap({\n enabled: isOpen,\n containerRef,\n restoreFocus: true,\n initialFocus,\n portalContainerRefs,\n });\n\n useDismissOnEscape({\n containerRef,\n onDismiss,\n enabled: isOpen,\n useDocumentListener: true,\n });\n\n const nameAttrs = getA11yNameAttributes({\n ariaLabelledBy: ariaLabelledBy ?? (ariaLabel ? undefined : titleId),\n ariaLabel: ariaLabel,\n });\n\n const dialogProps = {\n role: 'dialog' as const,\n 'aria-modal': true as const,\n tabIndex: -1,\n ...nameAttrs,\n };\n\n return { containerRef, titleId, dialogProps };\n}\n"],"names":["useRef","useFocusTrap","useDismissOnEscape","getA11yNameAttributes","useStableId","useModalA11y","isOpen","onDismiss","ariaLabel","ariaLabelledBy","titleIdPrefix","initialFocus","portalContainerRefs","containerRef","titleId","undefined","enabled","restoreFocus","useDocumentListener","dialogProps","role","tabIndex","nameAttrs"],"mappings":"AAgHO,SAAA,UAAAA,SAAA;AAAA,SAAA,gBAAAC,SAAA;AAAA,SAAA,sBAAAC,SAAA;AAAA,SAAA,yBAAAC,SAAA;AAAA,SAAA,eAAAC,SAAA;AAAA,SAASC,EAAa;AAAA,EAC3BC,QAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,eAAAA,IAAgB;AAAA,EAChBC,cAAAA,IAAe;AAAA,EACfC,qBAAAA;AACmB,GAAuB;AAC1C,QAAMC,IAAeb,EAAuB,IAAI,GAC1Cc,IAAUV,EAAYW,QAAWL,CAAa;AAEpDT,EAAAA,EAAa;AAAA,IACXe,SAASV;AAAAA,IACTO,cAAAA;AAAAA,IACAI,cAAc;AAAA,IACdN,cAAAA;AAAAA,IACAC,qBAAAA;AAAAA,EAAAA,CACD,GAEDV,EAAmB;AAAA,IACjBW,cAAAA;AAAAA,IACAN,WAAAA;AAAAA,IACAS,SAASV;AAAAA,IACTY,qBAAqB;AAAA,EAAA,CACtB;AAOD,QAAMC,IAAc;AAAA,IAClBC,MAAM;AAAA,IACN,cAAc;AAAA,IACdC,UAAU;AAAA,IACV,GATgBlB,EAAsB;AAAA,MACtCM,gBAAgBA,MAAmBD,IAAYO,SAAYD;AAAAA,MAC3DN,WAAAA;AAAAA,IAAAA,CACD;AAAA,EAMIc;AAGL,SAAO;AAAA,IAAET,cAAAA;AAAAA,IAAcC,SAAAA;AAAAA,IAASK,aAAAA;AAAAA,EAAAA;AAClC;"}
@@ -0,0 +1,24 @@
1
+ import { useRef as o, useCallback as u, createContext as s, useContext as c, useEffect as a } from "react";
2
+ const f = /* @__PURE__ */ s(null);
3
+ function l() {
4
+ const r = o(/* @__PURE__ */ new Set()), t = o([]);
5
+ return {
6
+ register: u((n) => (r.current.add(n), t.current = Array.from(r.current), () => {
7
+ r.current.delete(n), t.current = Array.from(r.current);
8
+ }), []),
9
+ portalContainerRefs: t
10
+ };
11
+ }
12
+ function p(r, t) {
13
+ const e = c(f);
14
+ a(() => {
15
+ if (!(!e || !t))
16
+ return e(r);
17
+ }, [e, t, r]);
18
+ }
19
+ export {
20
+ f as FocusTrapPortalContext,
21
+ l as useFocusTrapPortalRegistry,
22
+ p as useRegisterPortalWithFocusTrap
23
+ };
24
+ //# sourceMappingURL=index216.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index216.js","sources":["../src/utils/a11y/FocusTrapPortalContext.tsx"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useRef } from 'react';\n\ntype RegisterPortal = (ref: React.RefObject<HTMLElement | null>) => () => void;\n\n/**\n * Context for portal content to register with the nearest focus trap.\n * When a Modal (or any focus trap owner) provides this context, portal-rendered\n * content (e.g., Popover with isWithPortal) can register its container ref so\n * the focus trap's safety net allows focus to move into it.\n */\nexport const FocusTrapPortalContext = createContext<RegisterPortal | null>(null);\n\n/**\n * Hook for the focus trap owner (Modal) to create a portal registration function\n * and a stable ref to the current list of portal container refs.\n *\n * Usage in Modal:\n * ```tsx\n * const { register, portalContainerRefs } = useFocusTrapPortalRegistry();\n * // Pass portalContainerRefs.current to useModalA11y\n * // Wrap children with <FocusTrapPortalContext.Provider value={register}>\n * ```\n */\nexport function useFocusTrapPortalRegistry() {\n const portalRefsSet = useRef<Set<React.RefObject<HTMLElement | null>>>(new Set());\n const portalContainerRefs = useRef<React.RefObject<HTMLElement | null>[]>([]);\n\n const register: RegisterPortal = useCallback((ref) => {\n portalRefsSet.current.add(ref);\n portalContainerRefs.current = Array.from(portalRefsSet.current);\n return () => {\n portalRefsSet.current.delete(ref);\n portalContainerRefs.current = Array.from(portalRefsSet.current);\n };\n }, []);\n\n return { register, portalContainerRefs };\n}\n\n/**\n * Hook for portal content (Popover) to register its container ref with the\n * nearest ancestor focus trap. No-op if there is no focus trap ancestor.\n *\n * @param portalRef - Ref to the portal's root DOM element\n * @param isActive - Whether the portal is currently mounted and should be registered\n */\nexport function useRegisterPortalWithFocusTrap(\n portalRef: React.RefObject<HTMLElement | null>,\n isActive: boolean\n) {\n const register = useContext(FocusTrapPortalContext);\n\n useEffect(() => {\n if (!register || !isActive) return;\n return register(portalRef);\n }, [register, isActive, portalRef]);\n}\n"],"names":["useRef","useCallback","createContext","useContext","useEffect","FocusTrapPortalContext","useFocusTrapPortalRegistry","portalRefsSet","Set","portalContainerRefs","register","ref","current","add","Array","from","delete","useRegisterPortalWithFocusTrap","portalRef","isActive"],"mappings":"AAUO,SAAA,UAAAA,GAAA,eAAAC,GAAA,iBAAAC,GAAA,cAAAC,GAAA,aAAAC,SAAA;AAAA,MAAMC,sBAA8D,IAAI;AAaxE,SAASC,IAA6B;AAC3C,QAAMC,IAAgBP,EAAiD,oBAAIQ,KAAK,GAC1EC,IAAsBT,EAA8C,EAAE;AAW5E,SAAO;AAAA,IAAEU,UATwBT,EAAaU,CAAAA,OAC5CJ,EAAcK,QAAQC,IAAIF,CAAG,GAC7BF,EAAoBG,UAAUE,MAAMC,KAAKR,EAAcK,OAAO,GACvD,MAAM;AACXL,MAAAA,EAAcK,QAAQI,OAAOL,CAAG,GAChCF,EAAoBG,UAAUE,MAAMC,KAAKR,EAAcK,OAAO;AAAA,IAChE,IACC,CAAA,CAAE;AAAA,IAEcH,qBAAAA;AAAAA,EAAAA;AACrB;AASO,SAASQ,EACdC,GACAC,GACA;AACA,QAAMT,IAAWP,EAAWE,CAAsB;AAElDD,EAAAA,EAAU,MAAM;AACd,QAAI,GAACM,KAAY,CAACS;AAClB,aAAOT,EAASQ,CAAS;AAAA,EAC3B,GAAG,CAACR,GAAUS,GAAUD,CAAS,CAAC;AACpC;"}
@@ -28,4 +28,4 @@ function p({
28
28
  export {
29
29
  p as useDismissOnEscape
30
30
  };
31
- //# sourceMappingURL=index221.js.map
31
+ //# sourceMappingURL=index223.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index221.js","sources":["../src/utils/a11y/useDismissOnEscape.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nexport interface UseDismissOnEscapeOptions<T extends HTMLElement = HTMLElement> {\n /**\n * Container element ref — used for focus-check in document-level mode,\n * and for the returned onKeyDown in React-event mode.\n */\n containerRef?: RefObject<T | null>;\n /**\n * Callback when Escape key is pressed.\n */\n onDismiss?: () => void;\n /**\n * Whether the Escape handler is active.\n * Default: true\n */\n enabled?: boolean;\n /**\n * Use a native document-level capture listener instead of React's event system.\n * Only use this when React events can't reach the container (e.g. portals outside\n * the container's DOM tree). Prefer the default (false) for layered dismiss support.\n * Default: false\n */\n useDocumentListener?: boolean;\n /**\n * Whether to call e.preventDefault() on Escape.\n * Default: true\n */\n preventDefault?: boolean;\n /**\n * Whether to call e.stopPropagation() on Escape.\n * In React-event mode this is the layered-dismiss mechanism — set false only if\n * you want the event to continue bubbling to a parent dismiss handler.\n * Default: true\n */\n stopPropagation?: boolean;\n}\n\nexport interface UseDismissOnEscapeReturn {\n /**\n * Spread on the container element. In document-listener mode this is a no-op object.\n */\n onKeyDown: (e: React.KeyboardEvent) => void;\n}\n\n/**\n * Hook to handle Escape key dismissal.\n *\n * Default mode: returns an onKeyDown handler for the container element.\n * Uses React's synthetic events so child stopPropagation() is respected,\n * enabling layered dismiss (e.g. dropdown closes before sidebar).\n *\n * Document-listener mode (useDocumentListener: true): registers a native\n * capture listener on document. Use only when focus may be in a portal\n * outside the container's DOM tree.\n */\nexport function useDismissOnEscape<T extends HTMLElement = HTMLElement>({\n containerRef,\n onDismiss,\n enabled = true,\n useDocumentListener = false,\n preventDefault = true,\n stopPropagation = true,\n}: UseDismissOnEscapeOptions<T>): UseDismissOnEscapeReturn {\n // React-event mode: return handler to spread on container\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (!enabled || !onDismiss || e.key !== 'Escape') return;\n preventDefault && e.preventDefault();\n stopPropagation && e.stopPropagation();\n onDismiss();\n },\n [enabled, onDismiss, preventDefault, stopPropagation]\n );\n\n // Document-listener mode: native capture handler\n useEffect(() => {\n if (!useDocumentListener || !enabled || !onDismiss) return;\n\n const container = containerRef?.current;\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return;\n // Only fire if focus is within the container (if provided)\n if (container && !container.contains(document.activeElement)) return;\n preventDefault && e.preventDefault();\n stopPropagation && e.stopPropagation();\n onDismiss();\n };\n\n document.addEventListener('keydown', handleEscape, { capture: true });\n return () => document.removeEventListener('keydown', handleEscape, { capture: true });\n }, [useDocumentListener, enabled, onDismiss, containerRef, preventDefault, stopPropagation]);\n\n return { onKeyDown: useDocumentListener ? (() => {}) : onKeyDown };\n}\n"],"names":["useCallback","useEffect","useDismissOnEscape","containerRef","onDismiss","enabled","useDocumentListener","preventDefault","stopPropagation","onKeyDown","e","key","container","current","handleEscape","contains","document","activeElement","addEventListener","capture","removeEventListener"],"mappings":"AAyDO,SAAA,eAAAA,GAAA,aAAAC,SAAA;AAAA,SAASC,EAAwD;AAAA,EACtEC,cAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,SAAAA,IAAU;AAAA,EACVC,qBAAAA,IAAsB;AAAA,EACtBC,gBAAAA,IAAiB;AAAA,EACjBC,iBAAAA,IAAkB;AACU,GAA6B;AAEzD,QAAMC,IAAYT,EAChB,CAACU,MAA2B;AAC1B,IAAI,CAACL,KAAW,CAACD,KAAaM,EAAEC,QAAQ,aACxCJ,KAAkBG,EAAEH,eAAAA,GACpBC,KAAmBE,EAAEF,gBAAAA,GACrBJ,EAAAA;AAAAA,EACF,GACA,CAACC,GAASD,GAAWG,GAAgBC,CAAe,CACtD;AAGAP,SAAAA,EAAU,MAAM;AACd,QAAI,CAACK,KAAuB,CAACD,KAAW,CAACD,EAAW;AAEpD,UAAMQ,IAAYT,GAAcU,SAE1BC,IAAeA,CAACJ,MAAqB;AACzC,MAAIA,EAAEC,QAAQ,aAEVC,KAAa,CAACA,EAAUG,SAASC,SAASC,aAAa,MAC3DV,KAAkBG,EAAEH,eAAAA,GACpBC,KAAmBE,EAAEF,gBAAAA,GACrBJ,EAAAA;AAAAA,IACF;AAEAY,oBAASE,iBAAiB,WAAWJ,GAAc;AAAA,MAAEK,SAAS;AAAA,IAAA,CAAM,GAC7D,MAAMH,SAASI,oBAAoB,WAAWN,GAAc;AAAA,MAAEK,SAAS;AAAA,IAAA,CAAM;AAAA,EACtF,GAAG,CAACb,GAAqBD,GAASD,GAAWD,GAAcI,GAAgBC,CAAe,CAAC,GAEpF;AAAA,IAAEC,WAAWH,IAAuB,MAAM;AAAA,IAAC,IAAKG;AAAAA,EAAAA;AACzD;"}
1
+ {"version":3,"file":"index223.js","sources":["../src/utils/a11y/useDismissOnEscape.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nexport interface UseDismissOnEscapeOptions<T extends HTMLElement = HTMLElement> {\n /**\n * Container element ref — used for focus-check in document-level mode,\n * and for the returned onKeyDown in React-event mode.\n */\n containerRef?: RefObject<T | null>;\n /**\n * Callback when Escape key is pressed.\n */\n onDismiss?: () => void;\n /**\n * Whether the Escape handler is active.\n * Default: true\n */\n enabled?: boolean;\n /**\n * Use a native document-level capture listener instead of React's event system.\n * Only use this when React events can't reach the container (e.g. portals outside\n * the container's DOM tree). Prefer the default (false) for layered dismiss support.\n * Default: false\n */\n useDocumentListener?: boolean;\n /**\n * Whether to call e.preventDefault() on Escape.\n * Default: true\n */\n preventDefault?: boolean;\n /**\n * Whether to call e.stopPropagation() on Escape.\n * In React-event mode this is the layered-dismiss mechanism — set false only if\n * you want the event to continue bubbling to a parent dismiss handler.\n * Default: true\n */\n stopPropagation?: boolean;\n}\n\nexport interface UseDismissOnEscapeReturn {\n /**\n * Spread on the container element. In document-listener mode this is a no-op object.\n */\n onKeyDown: (e: React.KeyboardEvent) => void;\n}\n\n/**\n * Hook to handle Escape key dismissal.\n *\n * Default mode: returns an onKeyDown handler for the container element.\n * Uses React's synthetic events so child stopPropagation() is respected,\n * enabling layered dismiss (e.g. dropdown closes before sidebar).\n *\n * Document-listener mode (useDocumentListener: true): registers a native\n * capture listener on document. Use only when focus may be in a portal\n * outside the container's DOM tree.\n */\nexport function useDismissOnEscape<T extends HTMLElement = HTMLElement>({\n containerRef,\n onDismiss,\n enabled = true,\n useDocumentListener = false,\n preventDefault = true,\n stopPropagation = true,\n}: UseDismissOnEscapeOptions<T>): UseDismissOnEscapeReturn {\n // React-event mode: return handler to spread on container\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (!enabled || !onDismiss || e.key !== 'Escape') return;\n preventDefault && e.preventDefault();\n stopPropagation && e.stopPropagation();\n onDismiss();\n },\n [enabled, onDismiss, preventDefault, stopPropagation]\n );\n\n // Document-listener mode: native capture handler\n useEffect(() => {\n if (!useDocumentListener || !enabled || !onDismiss) return;\n\n const container = containerRef?.current;\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return;\n // Only fire if focus is within the container (if provided)\n if (container && !container.contains(document.activeElement)) return;\n preventDefault && e.preventDefault();\n stopPropagation && e.stopPropagation();\n onDismiss();\n };\n\n document.addEventListener('keydown', handleEscape, { capture: true });\n return () => document.removeEventListener('keydown', handleEscape, { capture: true });\n }, [useDocumentListener, enabled, onDismiss, containerRef, preventDefault, stopPropagation]);\n\n return { onKeyDown: useDocumentListener ? (() => {}) : onKeyDown };\n}\n"],"names":["useCallback","useEffect","useDismissOnEscape","containerRef","onDismiss","enabled","useDocumentListener","preventDefault","stopPropagation","onKeyDown","e","key","container","current","handleEscape","contains","document","activeElement","addEventListener","capture","removeEventListener"],"mappings":"AAyDO,SAAA,eAAAA,GAAA,aAAAC,SAAA;AAAA,SAASC,EAAwD;AAAA,EACtEC,cAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,SAAAA,IAAU;AAAA,EACVC,qBAAAA,IAAsB;AAAA,EACtBC,gBAAAA,IAAiB;AAAA,EACjBC,iBAAAA,IAAkB;AACU,GAA6B;AAEzD,QAAMC,IAAYT,EAChB,CAACU,MAA2B;AAC1B,IAAI,CAACL,KAAW,CAACD,KAAaM,EAAEC,QAAQ,aACxCJ,KAAkBG,EAAEH,eAAAA,GACpBC,KAAmBE,EAAEF,gBAAAA,GACrBJ,EAAAA;AAAAA,EACF,GACA,CAACC,GAASD,GAAWG,GAAgBC,CAAe,CACtD;AAGAP,SAAAA,EAAU,MAAM;AACd,QAAI,CAACK,KAAuB,CAACD,KAAW,CAACD,EAAW;AAEpD,UAAMQ,IAAYT,GAAcU,SAE1BC,IAAeA,CAACJ,MAAqB;AACzC,MAAIA,EAAEC,QAAQ,aAEVC,KAAa,CAACA,EAAUG,SAASC,SAASC,aAAa,MAC3DV,KAAkBG,EAAEH,eAAAA,GACpBC,KAAmBE,EAAEF,gBAAAA,GACrBJ,EAAAA;AAAAA,IACF;AAEAY,oBAASE,iBAAiB,WAAWJ,GAAc;AAAA,MAAEK,SAAS;AAAA,IAAA,CAAM,GAC7D,MAAMH,SAASI,oBAAoB,WAAWN,GAAc;AAAA,MAAEK,SAAS;AAAA,IAAA,CAAM;AAAA,EACtF,GAAG,CAACb,GAAqBD,GAASD,GAAWD,GAAcI,GAAgBC,CAAe,CAAC,GAEpF;AAAA,IAAEC,WAAWH,IAAuB,MAAM;AAAA,IAAC,IAAKG;AAAAA,EAAAA;AACzD;"}
@@ -72,4 +72,4 @@ function T({
72
72
  export {
73
73
  T as useFocusSentinel
74
74
  };
75
- //# sourceMappingURL=index222.js.map
75
+ //# sourceMappingURL=index224.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index222.js","sources":["../src/utils/a11y/useFocusSentinel.ts"],"sourcesContent":["import { useRef, useEffect, useLayoutEffect } from 'react';\n\nimport { getFirstFocusableElement, getLastFocusableElement } from './focusableElements';\nimport { consumeLastInteractedElement, consumeFocusAnchor } from './useFocusTrap';\n\nconst SENTINEL_STYLE: React.CSSProperties = {\n position: 'absolute',\n opacity: 0,\n pointerEvents: 'none',\n width: 0,\n height: 0,\n};\n\nexport interface UseFocusSentinelOptions {\n /** Whether the panel is currently open. */\n isOpen: boolean | undefined;\n /**\n * When true the hook is a no-op — dialog mode (focus trap) handles focus management instead.\n */\n isModal: boolean;\n /** Ref to the panel container element. */\n containerRef: React.RefObject<HTMLElement | null>;\n /**\n * Explicit element to restore focus to on close.\n * Overrides the automatic trigger capture.\n */\n returnFocusRef?: React.RefObject<HTMLElement | null>;\n}\n\nexport interface SentinelProps {\n ref: React.RefObject<HTMLDivElement | null>;\n tabIndex: number;\n style: React.CSSProperties;\n 'aria-hidden': true;\n 'data-focus-sentinel': 'start' | 'end';\n onFocus: (e: React.FocusEvent) => void;\n}\n\nexport interface UseFocusSentinelReturn {\n /** Spread onto an invisible div placed before the panel content. */\n startSentinelProps: SentinelProps;\n /** Spread onto an invisible div placed after the panel content. */\n endSentinelProps: SentinelProps;\n}\n\n/**\n * Focus management for complementary (non-modal) side panels.\n *\n * Moves focus into the panel on open, restores it to the trigger on close,\n * and wraps Tab / Shift+Tab back to the trigger when focus reaches either end.\n *\n * Sentinel tabIndex values are mutated imperatively (no state) to avoid\n * re-renders. React does not touch a DOM attribute unless the JSX prop value\n * changes, so the initial tabIndex={-1} in the returned props is safe.\n */\nexport function useFocusSentinel({\n isOpen,\n isModal,\n containerRef,\n returnFocusRef,\n}: UseFocusSentinelOptions): UseFocusSentinelReturn {\n const triggerRef = useRef<HTMLElement | null>(null);\n const startSentinelRef = useRef<HTMLDivElement>(null);\n const endSentinelRef = useRef<HTMLDivElement>(null);\n\n // Capture trigger before React commits (document.activeElement is still the opener).\n // Body focus = page-load open → skip so sentinels stay inert.\n useLayoutEffect(() => {\n if (isModal || !isOpen) return;\n const trigger =\n returnFocusRef?.current ??\n consumeFocusAnchor() ??\n consumeLastInteractedElement() ??\n (document.activeElement as HTMLElement);\n if (!trigger || trigger === document.body) return;\n // iframes manage their own internal focus. The parent doc only sees the\n // <iframe> element. Calling .focus() on any parent-doc element while the\n // user is inside an iframe forcibly blurs the iframe content (kills caret\n // on textareas, cancels native <select> dropdowns). Skip capture so the\n // auto-focus on open and focus-restore on close don't run.\n if (trigger.tagName === 'IFRAME') return;\n triggerRef.current = trigger;\n if (endSentinelRef.current) endSentinelRef.current.tabIndex = 0;\n return () => {\n if (endSentinelRef.current) endSentinelRef.current.tabIndex = -1;\n };\n }, [isOpen, isModal]);\n\n // Move focus into panel on open; restore to trigger on close.\n useEffect(() => {\n if (isModal || !isOpen || !triggerRef.current) return;\n\n const rafId = requestAnimationFrame(() => {\n const first = getFirstFocusableElement({ container: containerRef.current });\n (first ?? containerRef.current)?.focus();\n // Activate start sentinel so Shift+Tab from first content returns to trigger.\n if (startSentinelRef.current) startSentinelRef.current.tabIndex = 0;\n });\n\n return () => {\n cancelAnimationFrame(rafId);\n if (startSentinelRef.current) startSentinelRef.current.tabIndex = -1;\n const trigger = triggerRef.current;\n triggerRef.current = null;\n if (trigger?.isConnected) {\n requestAnimationFrame(() => trigger.focus());\n }\n };\n }, [isOpen, isModal]);\n\n const handleStartFocus = (e: React.FocusEvent) => {\n const fromInside =\n containerRef.current?.contains(e.relatedTarget as Node) &&\n e.relatedTarget !== containerRef.current;\n if (fromInside) {\n // Shift+Tab from first content → restore trigger\n const trigger = triggerRef.current;\n if (trigger?.isConnected) trigger.focus();\n } else {\n // Natural Tab entry from outside → forward to first content,\n // deactivate so next Shift+Tab exits naturally.\n if (startSentinelRef.current) startSentinelRef.current.tabIndex = -1;\n const first = getFirstFocusableElement({ container: containerRef.current });\n (first ?? containerRef.current)?.focus();\n }\n };\n\n const handleEndFocus = (e: React.FocusEvent) => {\n const fromInside =\n containerRef.current?.contains(e.relatedTarget as Node) &&\n e.relatedTarget !== containerRef.current;\n if (fromInside) {\n // Tab from last content → restore trigger\n const trigger = triggerRef.current;\n if (trigger?.isConnected) trigger.focus();\n } else {\n // Shift+Tab entry from outside → back to last content\n const last = getLastFocusableElement({ container: containerRef.current });\n (last ?? containerRef.current)?.focus();\n }\n };\n\n return {\n startSentinelProps: {\n ref: startSentinelRef,\n tabIndex: -1,\n style: SENTINEL_STYLE,\n 'aria-hidden': true as const,\n 'data-focus-sentinel': 'start' as const,\n onFocus: handleStartFocus,\n },\n endSentinelProps: {\n ref: endSentinelRef,\n tabIndex: -1,\n style: SENTINEL_STYLE,\n 'aria-hidden': true as const,\n 'data-focus-sentinel': 'end' as const,\n onFocus: handleEndFocus,\n },\n };\n}\n"],"names":["useRef","useLayoutEffect","useEffect","getFirstFocusableElement","getLastFocusableElement","consumeFocusAnchor","consumeLastInteractedElement","SENTINEL_STYLE","position","opacity","pointerEvents","width","height","useFocusSentinel","isOpen","isModal","containerRef","returnFocusRef","triggerRef","startSentinelRef","endSentinelRef","trigger","current","document","activeElement","body","tagName","tabIndex","rafId","requestAnimationFrame","container","focus","cancelAnimationFrame","isConnected","startSentinelProps","ref","style","onFocus","handleStartFocus","e","contains","relatedTarget","endSentinelProps","handleEndFocus"],"mappings":"AAKA,SAAA,UAAAA,GAAA,mBAAAC,GAAA,aAAAC,SAAA;AAAA,SAAA,4BAAAC,GAAA,2BAAAC,SAAA;AAAA,SAAA,sBAAAC,GAAA,gCAAAC,SAAA;AAAA,MAAMC,IAAsC;AAAA,EAC1CC,UAAU;AAAA,EACVC,SAAS;AAAA,EACTC,eAAe;AAAA,EACfC,OAAO;AAAA,EACPC,QAAQ;AACV;AA4CO,SAASC,EAAiB;AAAA,EAC/BC,QAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAC,gBAAAA;AACuB,GAA2B;AAClD,QAAMC,IAAalB,EAA2B,IAAI,GAC5CmB,IAAmBnB,EAAuB,IAAI,GAC9CoB,IAAiBpB,EAAuB,IAAI;AAIlDC,SAAAA,EAAgB,MAAM;AACpB,QAAIc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MACpDxB,EAAyB;AAAA,YAAE2B,WAAWd,EAAaM;AAAAA,UAAAA,CAAS,KAChEN,EAAaM,UAAUS,MAAAA;AAAAA,MAErC;AAAA,IAwBaO;AAAAA,IAEXI,kBAAkB;AAAA,MAChBP,KAAKf;AAAAA,MACLO,UAAU;AAAA,MACVS,OAAO7B;AAAAA,MACP,eAAe;AAAA,MACf,uBAAuB;AAAA,MACvB8B,SA9BmBM,CAACJ,MAAwB;AAI9C,YAFEvB,EAAaM,SAASkB,SAASD,EAAEE,aAAqB,KACtDF,EAAEE,kBAAkBzB,EAAaM,SACnB;AAEd,gBAAMD,IAAUH,EAAWI;AAC3B,UAAID,GAASY,eAAaZ,EAAQU,MAAAA;AAAAA,QACpC;AAGE,WADa3B,EAAwB;AAAA,YAAE0B,WAAWd,EAAaM;AAAAA,UAAAA,CAAS,KAC/DN,EAAaM,UAAUS,MAAAA;AAAAA,MAEpC;AAAA,IAiBaY;AAAAA,EACX;AAEJ;"}
1
+ {"version":3,"file":"index224.js","sources":["../src/utils/a11y/useFocusSentinel.ts"],"sourcesContent":["import { useRef, useEffect, useLayoutEffect } from 'react';\n\nimport { getFirstFocusableElement, getLastFocusableElement } from './focusableElements';\nimport { consumeLastInteractedElement, consumeFocusAnchor } from './useFocusTrap';\n\nconst SENTINEL_STYLE: React.CSSProperties = {\n position: 'absolute',\n opacity: 0,\n pointerEvents: 'none',\n width: 0,\n height: 0,\n};\n\nexport interface UseFocusSentinelOptions {\n /** Whether the panel is currently open. */\n isOpen: boolean | undefined;\n /**\n * When true the hook is a no-op — dialog mode (focus trap) handles focus management instead.\n */\n isModal: boolean;\n /** Ref to the panel container element. */\n containerRef: React.RefObject<HTMLElement | null>;\n /**\n * Explicit element to restore focus to on close.\n * Overrides the automatic trigger capture.\n */\n returnFocusRef?: React.RefObject<HTMLElement | null>;\n}\n\nexport interface SentinelProps {\n ref: React.RefObject<HTMLDivElement | null>;\n tabIndex: number;\n style: React.CSSProperties;\n 'aria-hidden': true;\n 'data-focus-sentinel': 'start' | 'end';\n onFocus: (e: React.FocusEvent) => void;\n}\n\nexport interface UseFocusSentinelReturn {\n /** Spread onto an invisible div placed before the panel content. */\n startSentinelProps: SentinelProps;\n /** Spread onto an invisible div placed after the panel content. */\n endSentinelProps: SentinelProps;\n}\n\n/**\n * Focus management for complementary (non-modal) side panels.\n *\n * Moves focus into the panel on open, restores it to the trigger on close,\n * and wraps Tab / Shift+Tab back to the trigger when focus reaches either end.\n *\n * Sentinel tabIndex values are mutated imperatively (no state) to avoid\n * re-renders. React does not touch a DOM attribute unless the JSX prop value\n * changes, so the initial tabIndex={-1} in the returned props is safe.\n */\nexport function useFocusSentinel({\n isOpen,\n isModal,\n containerRef,\n returnFocusRef,\n}: UseFocusSentinelOptions): UseFocusSentinelReturn {\n const triggerRef = useRef<HTMLElement | null>(null);\n const startSentinelRef = useRef<HTMLDivElement>(null);\n const endSentinelRef = useRef<HTMLDivElement>(null);\n\n // Capture trigger before React commits (document.activeElement is still the opener).\n // Body focus = page-load open → skip so sentinels stay inert.\n useLayoutEffect(() => {\n if (isModal || !isOpen) return;\n const trigger =\n returnFocusRef?.current ??\n consumeFocusAnchor() ??\n consumeLastInteractedElement() ??\n (document.activeElement as HTMLElement);\n if (!trigger || trigger === document.body) return;\n // iframes manage their own internal focus. The parent doc only sees the\n // <iframe> element. Calling .focus() on any parent-doc element while the\n // user is inside an iframe forcibly blurs the iframe content (kills caret\n // on textareas, cancels native <select> dropdowns). Skip capture so the\n // auto-focus on open and focus-restore on close don't run.\n if (trigger.tagName === 'IFRAME') return;\n triggerRef.current = trigger;\n if (endSentinelRef.current) endSentinelRef.current.tabIndex = 0;\n return () => {\n if (endSentinelRef.current) endSentinelRef.current.tabIndex = -1;\n };\n }, [isOpen, isModal]);\n\n // Move focus into panel on open; restore to trigger on close.\n useEffect(() => {\n if (isModal || !isOpen || !triggerRef.current) return;\n\n const rafId = requestAnimationFrame(() => {\n const first = getFirstFocusableElement({ container: containerRef.current });\n (first ?? containerRef.current)?.focus();\n // Activate start sentinel so Shift+Tab from first content returns to trigger.\n if (startSentinelRef.current) startSentinelRef.current.tabIndex = 0;\n });\n\n return () => {\n cancelAnimationFrame(rafId);\n if (startSentinelRef.current) startSentinelRef.current.tabIndex = -1;\n const trigger = triggerRef.current;\n triggerRef.current = null;\n if (trigger?.isConnected) {\n requestAnimationFrame(() => trigger.focus());\n }\n };\n }, [isOpen, isModal]);\n\n const handleStartFocus = (e: React.FocusEvent) => {\n const fromInside =\n containerRef.current?.contains(e.relatedTarget as Node) &&\n e.relatedTarget !== containerRef.current;\n if (fromInside) {\n // Shift+Tab from first content → restore trigger\n const trigger = triggerRef.current;\n if (trigger?.isConnected) trigger.focus();\n } else {\n // Natural Tab entry from outside → forward to first content,\n // deactivate so next Shift+Tab exits naturally.\n if (startSentinelRef.current) startSentinelRef.current.tabIndex = -1;\n const first = getFirstFocusableElement({ container: containerRef.current });\n (first ?? containerRef.current)?.focus();\n }\n };\n\n const handleEndFocus = (e: React.FocusEvent) => {\n const fromInside =\n containerRef.current?.contains(e.relatedTarget as Node) &&\n e.relatedTarget !== containerRef.current;\n if (fromInside) {\n // Tab from last content → restore trigger\n const trigger = triggerRef.current;\n if (trigger?.isConnected) trigger.focus();\n } else {\n // Shift+Tab entry from outside → back to last content\n const last = getLastFocusableElement({ container: containerRef.current });\n (last ?? containerRef.current)?.focus();\n }\n };\n\n return {\n startSentinelProps: {\n ref: startSentinelRef,\n tabIndex: -1,\n style: SENTINEL_STYLE,\n 'aria-hidden': true as const,\n 'data-focus-sentinel': 'start' as const,\n onFocus: handleStartFocus,\n },\n endSentinelProps: {\n ref: endSentinelRef,\n tabIndex: -1,\n style: SENTINEL_STYLE,\n 'aria-hidden': true as const,\n 'data-focus-sentinel': 'end' as const,\n onFocus: handleEndFocus,\n },\n };\n}\n"],"names":["useRef","useLayoutEffect","useEffect","getFirstFocusableElement","getLastFocusableElement","consumeFocusAnchor","consumeLastInteractedElement","SENTINEL_STYLE","position","opacity","pointerEvents","width","height","useFocusSentinel","isOpen","isModal","containerRef","returnFocusRef","triggerRef","startSentinelRef","endSentinelRef","trigger","current","document","activeElement","body","tagName","tabIndex","rafId","requestAnimationFrame","container","focus","cancelAnimationFrame","isConnected","startSentinelProps","ref","style","onFocus","handleStartFocus","e","contains","relatedTarget","endSentinelProps","handleEndFocus"],"mappings":"AAKA,SAAA,UAAAA,GAAA,mBAAAC,GAAA,aAAAC,SAAA;AAAA,SAAA,4BAAAC,GAAA,2BAAAC,SAAA;AAAA,SAAA,sBAAAC,GAAA,gCAAAC,SAAA;AAAA,MAAMC,IAAsC;AAAA,EAC1CC,UAAU;AAAA,EACVC,SAAS;AAAA,EACTC,eAAe;AAAA,EACfC,OAAO;AAAA,EACPC,QAAQ;AACV;AA4CO,SAASC,EAAiB;AAAA,EAC/BC,QAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAC,gBAAAA;AACuB,GAA2B;AAClD,QAAMC,IAAalB,EAA2B,IAAI,GAC5CmB,IAAmBnB,EAAuB,IAAI,GAC9CoB,IAAiBpB,EAAuB,IAAI;AAIlDC,SAAAA,EAAgB,MAAM;AACpB,QAAIc,KAAW,CAACD,EAAQ;AACxB,UAAMO,IACJJ,GAAgBK,WAChBjB,OACAC,EAAAA,KACCiB,SAASC;AACZ,QAAI,GAACH,KAAWA,MAAYE,SAASE,SAMjCJ,EAAQK,YAAY;AACxBR,aAAAA,EAAWI,UAAUD,GACjBD,EAAeE,YAASF,EAAeE,QAAQK,WAAW,IACvD,MAAM;AACX,QAAIP,EAAeE,YAASF,EAAeE,QAAQK,WAAW;AAAA,MAChE;AAAA,EACF,GAAG,CAACb,GAAQC,CAAO,CAAC,GAGpBb,EAAU,MAAM;AACd,QAAIa,KAAW,CAACD,KAAU,CAACI,EAAWI,QAAS;AAE/C,UAAMM,IAAQC,sBAAsB,MAAM;AAExC,OADc1B,EAAyB;AAAA,QAAE2B,WAAWd,EAAaM;AAAAA,MAAAA,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AAaM;AAAAA,UAAAA,CAAS,KAC/DN,EAAaM,UAAUS,MAAAA;AAAAA,MAEpC;AAAA,IAiBaY;AAAAA,EACX;AAEJ;"}
package/dist/index231.js CHANGED
@@ -1,15 +1,8 @@
1
- function n(o, u) {
2
- let e;
3
- const t = (...c) => {
4
- e && clearTimeout(e), e = setTimeout(() => {
5
- o(...c);
6
- }, u);
7
- };
8
- return t.cancel = () => {
9
- e && clearTimeout(e), e = null;
10
- }, t;
1
+ function o(...n) {
2
+ const t = [...new Set(n.filter((e) => !!e).flatMap((e) => e.trim().split(/\s+/)).filter(Boolean))];
3
+ return t.length > 0 ? t.join(" ") : void 0;
11
4
  }
12
5
  export {
13
- n as debounce
6
+ o as mergeIds
14
7
  };
15
8
  //# sourceMappingURL=index231.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index231.js","sources":["../src/utils/debounce.ts"],"sourcesContent":["export function debounce<T extends (...args: any[]) => void>(func: T, wait: number) {\n let timeout: ReturnType<typeof setTimeout> | null;\n const debounced = (...args: Parameters<T>) => {\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(() => {\n func(...args);\n }, wait);\n };\n debounced.cancel = () => {\n if (timeout) clearTimeout(timeout);\n timeout = null;\n };\n return debounced as T & { cancel: () => void };\n }"],"names":["debounce","func","wait","timeout","debounced","args","setTimeout","cancel"],"mappings":"AAAO,SAASA,EAA6CC,GAASC,GAAc;AAChF,MAAIC;AACJ,QAAMC,IAAYA,IAAIC,MAAwB;AAC5C,IAAIF,kBAAsBA,CAAO,GACjCA,IAAUG,WAAW,MAAM;AACzBL,MAAAA,EAAK,GAAGI,CAAI;AAAA,IACd,GAAGH,CAAI;AAAA,EACT;AACAE,SAAAA,EAAUG,SAAS,MAAM;AACvB,IAAIJ,kBAAsBA,CAAO,GACjCA,IAAU;AAAA,EACZ,GACOC;AACT;"}
1
+ {"version":3,"file":"index231.js","sources":["../src/utils/mergeIds.ts"],"sourcesContent":["/**\n * Merges multiple ID strings into a single space-separated string.\n * Filters out falsy values and deduplicates IDs while preserving order.\n * \n * Useful for ARIA attributes (aria-describedby, aria-labelledby) and class names.\n * \n * @param ids - Array of id strings (or undefined/null)\n * @returns Merged space-separated id string, or undefined if no valid ids\n * \n * @example\n * mergeIds('error-1', undefined, 'helper-1', 'error-1')\n * // Returns: 'error-1 helper-1'\n */\nexport function mergeIds(...ids: (string | undefined | null)[]): string | undefined {\n const uniqueIds = [\n ...new Set(\n ids\n .filter((id): id is string => Boolean(id))\n .flatMap(id => id.trim().split(/\\s+/))\n .filter(Boolean)\n )\n ];\n \n return uniqueIds.length > 0 ? uniqueIds.join(' ') : undefined;\n}\n"],"names":["mergeIds","ids","uniqueIds","Set","filter","id","Boolean","flatMap","trim","split","length","join","undefined"],"mappings":"AAaO,SAASA,KAAYC,GAAwD;AAClF,QAAMC,IAAY,CAChB,GAAG,IAAIC,IACLF,EACGG,OAAO,CAACC,MAAqBC,EAAQD,CAAG,EACxCE,QAAQF,CAAAA,MAAMA,EAAGG,OAAOC,MAAM,KAAK,CAAC,EACpCL,OAAOE,OAAO,CACnB,CAAC;AAGH,SAAOJ,EAAUQ,SAAS,IAAIR,EAAUS,KAAK,GAAG,IAAIC;AACtD;"}
@@ -0,0 +1,15 @@
1
+ function n(o, u) {
2
+ let e;
3
+ const t = (...c) => {
4
+ e && clearTimeout(e), e = setTimeout(() => {
5
+ o(...c);
6
+ }, u);
7
+ };
8
+ return t.cancel = () => {
9
+ e && clearTimeout(e), e = null;
10
+ }, t;
11
+ }
12
+ export {
13
+ n as debounce
14
+ };
15
+ //# sourceMappingURL=index233.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index233.js","sources":["../src/utils/debounce.ts"],"sourcesContent":["export function debounce<T extends (...args: any[]) => void>(func: T, wait: number) {\n let timeout: ReturnType<typeof setTimeout> | null;\n const debounced = (...args: Parameters<T>) => {\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(() => {\n func(...args);\n }, wait);\n };\n debounced.cancel = () => {\n if (timeout) clearTimeout(timeout);\n timeout = null;\n };\n return debounced as T & { cancel: () => void };\n }"],"names":["debounce","func","wait","timeout","debounced","args","setTimeout","cancel"],"mappings":"AAAO,SAASA,EAA6CC,GAASC,GAAc;AAChF,MAAIC;AACJ,QAAMC,IAAYA,IAAIC,MAAwB;AAC5C,IAAIF,kBAAsBA,CAAO,GACjCA,IAAUG,WAAW,MAAM;AACzBL,MAAAA,EAAK,GAAGI,CAAI;AAAA,IACd,GAAGH,CAAI;AAAA,EACT;AACAE,SAAAA,EAAUG,SAAS,MAAM;AACvB,IAAIJ,kBAAsBA,CAAO,GACjCA,IAAU;AAAA,EACZ,GACOC;AACT;"}
package/dist/index24.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import s, { useState as j, useEffect as K } from "react";
2
- import { useStableId as L } from "./index212.js";
2
+ import { useStableId as L } from "./index214.js";
3
3
  import { getA11yNameAttributes as q } from "./index86.js";
4
4
  import "./index77.js";
5
5
  /* empty css */
@@ -1233,4 +1233,4 @@ const e = [
1233
1233
  export {
1234
1234
  e as default
1235
1235
  };
1236
- //# sourceMappingURL=index239.js.map
1236
+ //# sourceMappingURL=index241.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index239.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -43,4 +43,4 @@ g.displayName = "TabButton";
43
43
  export {
44
44
  g as TabButton
45
45
  };
46
- //# sourceMappingURL=index242.js.map
46
+ //# sourceMappingURL=index244.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index242.js","sources":["../src/components/NavigationBar/TabButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { Button } from '../Button';\n\nexport interface TabButtonProps {\n id: string;\n label: string;\n isSelected: boolean;\n isDisabled?: boolean;\n panelId?: string;\n tabIndex: number;\n className?: string;\n automationId?: string;\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;\n onFocus: () => void;\n onKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>) => void;\n}\n\n/**\n * Internal TabButton component for NavigationBar.\n * Uses Button (unstyled) internally for consistent activation handling.\n * Supports forwardRef for focus management (roving tabindex).\n */\nexport const TabButton = forwardRef<HTMLButtonElement, TabButtonProps>(\n (\n {\n id,\n label,\n isSelected,\n isDisabled = false,\n panelId,\n tabIndex,\n className = '',\n automationId,\n onClick,\n onFocus,\n onKeyDown\n },\n ref\n ) => {\n return (\n <Button\n ref={ref}\n type=\"unstyled\"\n label={label}\n disabled={isDisabled}\n onClick={onClick}\n className={className}\n automationId={automationId}\n role=\"tab\"\n id={id}\n aria-selected={isSelected}\n {...(panelId ? { 'aria-controls': panelId } : {})}\n tabIndex={tabIndex}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n />\n );\n }\n);\n\nTabButton.displayName = 'TabButton';\n"],"names":["TabButton","id","label","isSelected","isDisabled","panelId","tabIndex","className","automationId","onClick","onFocus","onKeyDown","ref","React","createElement","Button","_extends","type","disabled","role","displayName"],"mappings":";;;;;;;;;;;AAsBO,MAAMA,sBACX,CACE;AAAA,EACEC,IAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,YAAAA;AAAAA,EACAC,YAAAA,IAAa;AAAA,EACbC,SAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,WAAAA,IAAY;AAAA,EACZC,cAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,WAAAA;AACF,GACAC,MAGEC,gBAAAA,EAAAC,cAACC,GAAMC,EAAA;AAAA,EACLJ,KAAAA;AAAAA,EACAK,MAAK;AAAA,EACLf,OAAAA;AAAAA,EACAgB,UAAUd;AAAAA,EACVK,SAAAA;AAAAA,EACAF,WAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAW,MAAK;AAAA,EACLlB,IAAAA;AAAAA,EACA,iBAAeE;AAAAA,GACVE,IAAU;AAAA,EAAE,iBAAiBA;AAAAA,IAAY,IAAE;AAAA,EAChDC,UAAAA;AAAAA,EACAI,SAAAA;AAAAA,EACAC,WAAAA;AAAAA,CAAqB,CACtB,CAGP;AAEAX,EAAUoB,cAAc;"}
1
+ {"version":3,"file":"index244.js","sources":["../src/components/NavigationBar/TabButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { Button } from '../Button';\n\nexport interface TabButtonProps {\n id: string;\n label: string;\n isSelected: boolean;\n isDisabled?: boolean;\n panelId?: string;\n tabIndex: number;\n className?: string;\n automationId?: string;\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;\n onFocus: () => void;\n onKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>) => void;\n}\n\n/**\n * Internal TabButton component for NavigationBar.\n * Uses Button (unstyled) internally for consistent activation handling.\n * Supports forwardRef for focus management (roving tabindex).\n */\nexport const TabButton = forwardRef<HTMLButtonElement, TabButtonProps>(\n (\n {\n id,\n label,\n isSelected,\n isDisabled = false,\n panelId,\n tabIndex,\n className = '',\n automationId,\n onClick,\n onFocus,\n onKeyDown\n },\n ref\n ) => {\n return (\n <Button\n ref={ref}\n type=\"unstyled\"\n label={label}\n disabled={isDisabled}\n onClick={onClick}\n className={className}\n automationId={automationId}\n role=\"tab\"\n id={id}\n aria-selected={isSelected}\n {...(panelId ? { 'aria-controls': panelId } : {})}\n tabIndex={tabIndex}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n />\n );\n }\n);\n\nTabButton.displayName = 'TabButton';\n"],"names":["TabButton","id","label","isSelected","isDisabled","panelId","tabIndex","className","automationId","onClick","onFocus","onKeyDown","ref","React","createElement","Button","_extends","type","disabled","role","displayName"],"mappings":";;;;;;;;;;;AAsBO,MAAMA,sBACX,CACE;AAAA,EACEC,IAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,YAAAA;AAAAA,EACAC,YAAAA,IAAa;AAAA,EACbC,SAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,WAAAA,IAAY;AAAA,EACZC,cAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,WAAAA;AACF,GACAC,MAGEC,gBAAAA,EAAAC,cAACC,GAAMC,EAAA;AAAA,EACLJ,KAAAA;AAAAA,EACAK,MAAK;AAAA,EACLf,OAAAA;AAAAA,EACAgB,UAAUd;AAAAA,EACVK,SAAAA;AAAAA,EACAF,WAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAW,MAAK;AAAA,EACLlB,IAAAA;AAAAA,EACA,iBAAeE;AAAAA,GACVE,IAAU;AAAA,EAAE,iBAAiBA;AAAAA,IAAY,IAAE;AAAA,EAChDC,UAAAA;AAAAA,EACAI,SAAAA;AAAAA,EACAC,WAAAA;AAAAA,CAAqB,CACtB,CAGP;AAEAX,EAAUoB,cAAc;"}
@@ -170,4 +170,4 @@ export {
170
170
  z as getCellAriaLabel,
171
171
  B as useDatePickerA11y
172
172
  };
173
- //# sourceMappingURL=index251.js.map
173
+ //# sourceMappingURL=index253.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index251.js","sources":["../src/components/DatePicker/useDatePickerA11y.ts"],"sourcesContent":["import React, { useState, useCallback, useEffect, useMemo } from 'react';\n\nimport { useRovingFocus, RovingItemProps, RovingContainerProps, AccessibleNameInput } from '../../utils/a11y/useRovingFocus';\nimport type { DateRange } from './index';\n\nexport const getCellAriaLabel = (\n date: Date,\n isStart: boolean,\n isEnd: boolean,\n isSameStartEnd: boolean,\n singleDateSelection: boolean,\n inRange: boolean = false\n): string => {\n const base = date.toLocaleDateString('en-US', {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric'\n });\n if (singleDateSelection) return base;\n if (isSameStartEnd) return `${base}, start and end of range`;\n if (isStart) return `${base}, start of range`;\n if (isEnd) return `${base}, end of range`;\n if (inRange) return `${base}, in range`;\n return base;\n};\n\nexport const formatDateId = (d: Date) => {\n const y = d.getFullYear();\n const m = String(d.getMonth() + 1).padStart(2, '0');\n const dd = String(d.getDate()).padStart(2, '0');\n return `date-${y}-${m}-${dd}`;\n};\n\nconst getDaysInMonth = (year: number, month: number) => new Date(year, month + 1, 0).getDate();\n\nconst getPanelItemIds = (panelDate: Date): string[] => {\n const year = panelDate.getFullYear();\n const month = panelDate.getMonth();\n return Array.from({ length: getDaysInMonth(year, month) }, (_, i) =>\n formatDateId(new Date(year, month, i + 1))\n );\n};\n\nconst getPanelDefaultFocusId = (panelDate: Date, itemIds: string[], selectedRange: DateRange): string => {\n const year = panelDate.getFullYear();\n const month = panelDate.getMonth();\n const isInPanel = (d: Date) => d.getFullYear() === year && d.getMonth() === month;\n\n // Prefer startDate if it falls in this panel\n if (selectedRange.startDate && isInPanel(selectedRange.startDate)) {\n const d = new Date(selectedRange.startDate);\n d.setHours(0, 0, 0, 0);\n const id = formatDateId(d);\n if (itemIds.includes(id)) return id;\n }\n // Fall back to endDate if it falls in this panel (e.g. right panel when start is in left panel)\n if (selectedRange.endDate && isInPanel(selectedRange.endDate)) {\n const d = new Date(selectedRange.endDate);\n d.setHours(0, 0, 0, 0);\n const id = formatDateId(d);\n if (itemIds.includes(id)) return id;\n }\n const today = new Date();\n if (isInPanel(today)) {\n const id = formatDateId(today);\n if (itemIds.includes(id)) return id;\n }\n return itemIds[0] || '';\n};\n\ninterface UseDatePickerA11yOptions {\n leftMonth: Date;\n rightMonth: Date;\n showSingleMonth: boolean;\n selectedRange: DateRange;\n onMonthChange: (date: Date, isLeft: boolean) => void;\n}\n\ninterface CellKeyDownOptions {\n isLeftCalendar: boolean;\n isDateDisabled: (date: Date) => boolean;\n handleDateClick: (date: Date) => void;\n}\n\ninterface GridCellItemInput {\n cellId: string;\n cellDate: Date;\n disabled: boolean;\n ariaLabel: string;\n ariaCurrent: 'date' | undefined;\n ariaDisabled: true | undefined;\n}\n\nexport interface GridCellElementProps {\n id: string;\n ref: (el: HTMLElement | null) => void;\n tabIndex: number;\n onFocus: () => void;\n 'aria-label': string;\n 'aria-current': 'date' | undefined;\n 'aria-disabled': true | undefined;\n onKeyDown: (e: React.KeyboardEvent) => void;\n onClick: () => void;\n}\n\ninterface UseDatePickerA11yReturn {\n getGridCellProps: (options: CellKeyDownOptions) => (item: GridCellItemInput) => GridCellElementProps;\n getLeftRovingItemProps: (id: string) => RovingItemProps;\n getRightRovingItemProps: (id: string) => RovingItemProps;\n getLeftContainerProps: (nameInput?: AccessibleNameInput) => RovingContainerProps;\n getRightContainerProps: (nameInput?: AccessibleNameInput) => RovingContainerProps;\n focusLeftItem: (id: string) => void;\n focusRightItem: (id: string) => void;\n}\n\nexport function useDatePickerA11y({\n leftMonth,\n rightMonth,\n showSingleMonth,\n selectedRange,\n onMonthChange\n}: UseDatePickerA11yOptions): UseDatePickerA11yReturn {\n const [keyboardFocusDate, setKeyboardFocusDate] = useState<Date | null>(null);\n\n const leftItemIds = useMemo(() => getPanelItemIds(leftMonth), [leftMonth]);\n const rightItemIds = useMemo(() => getPanelItemIds(rightMonth), [rightMonth]);\n\n const leftDefaultFocusId = useMemo(\n () => getPanelDefaultFocusId(leftMonth, leftItemIds, selectedRange),\n [leftMonth, leftItemIds, selectedRange]\n );\n const rightDefaultFocusId = useMemo(\n () => getPanelDefaultFocusId(rightMonth, rightItemIds, selectedRange),\n [rightMonth, rightItemIds, selectedRange]\n );\n\n const { getRovingItemProps: getLeftRovingItemProps, focusItem: focusLeftItem, getContainerProps: getLeftContainerProps } = useRovingFocus({\n itemIds: leftItemIds,\n defaultFocusedId: leftDefaultFocusId,\n orientation: 'grid',\n cols: 7,\n loop: false,\n role: 'grid'\n });\n\n const { getRovingItemProps: getRightRovingItemProps, focusItem: focusRightItem, getContainerProps: getRightContainerProps } = useRovingFocus({\n itemIds: rightItemIds,\n defaultFocusedId: rightDefaultFocusId,\n orientation: 'grid',\n cols: 7,\n loop: false,\n role: 'grid'\n });\n\n // After keyboard navigation shifts a panel to a new month, focus the target cell via roving focus refs\n useEffect(() => {\n if (!keyboardFocusDate) return;\n const id = formatDateId(keyboardFocusDate);\n if (leftItemIds.includes(id)) {\n focusLeftItem(id);\n setKeyboardFocusDate(null);\n } else if (rightItemIds.includes(id)) {\n focusRightItem(id);\n setKeyboardFocusDate(null);\n }\n }, [keyboardFocusDate, leftItemIds, rightItemIds, focusLeftItem, focusRightItem]);\n\n // Navigate the keyboard focus to a date that may be in a different month.\n // Each panel advances completely independently — never touches the other panel.\n const handleKeyboardNavigate = useCallback(\n (targetDate: Date, sourcePanel: 'left' | 'right') => {\n const isLeft = showSingleMonth || sourcePanel === 'left';\n onMonthChange(new Date(targetDate.getFullYear(), targetDate.getMonth(), 1), isLeft);\n setKeyboardFocusDate(new Date(targetDate));\n },\n [showSingleMonth, onMonthChange]\n );\n\n const getGridCellProps = useCallback(\n ({ isLeftCalendar, isDateDisabled, handleDateClick }: CellKeyDownOptions) => {\n const panel: 'left' | 'right' = isLeftCalendar ? 'left' : 'right';\n const focusPanelItem = isLeftCalendar ? focusLeftItem : focusRightItem;\n const getRovingItemProps = isLeftCalendar ? getLeftRovingItemProps : getRightRovingItemProps;\n\n const handleKeyDown = (e: React.KeyboardEvent, cellDate: Date) => {\n const cellYear = cellDate.getFullYear();\n const cellMonth = cellDate.getMonth();\n const cellDay = cellDate.getDate();\n\n const navigateTo = (targetDate: Date) => {\n if (targetDate.getFullYear() !== cellYear || targetDate.getMonth() !== cellMonth) {\n handleKeyboardNavigate(targetDate, panel);\n return;\n }\n focusPanelItem(formatDateId(targetDate));\n };\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay - 1));\n break;\n case 'ArrowRight':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay + 1));\n break;\n case 'ArrowUp':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay - 7));\n break;\n case 'ArrowDown':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay + 7));\n break;\n case 'Home': {\n // First day of the current week row (Sunday), clamped to month start\n e.preventDefault(); e.stopPropagation();\n const dayOfWeek = cellDate.getDay();\n const homeDate = new Date(cellYear, cellMonth, cellDay - dayOfWeek);\n const clamped = homeDate.getMonth() !== cellMonth ? new Date(cellYear, cellMonth, 1) : homeDate;\n focusPanelItem(formatDateId(clamped));\n break;\n }\n case 'End': {\n // Last day of the current week row (Saturday), clamped to month end\n e.preventDefault(); e.stopPropagation();\n const dayOfWeek = cellDate.getDay();\n const endDate = new Date(cellYear, cellMonth, cellDay + (6 - dayOfWeek));\n const daysInThisMonth = getDaysInMonth(cellYear, cellMonth);\n const clamped =\n endDate.getMonth() !== cellMonth ? new Date(cellYear, cellMonth, daysInThisMonth) : endDate;\n focusPanelItem(formatDateId(clamped));\n break;\n }\n case 'PageUp': {\n // Shift+PageUp = previous year, PageUp = previous month\n e.preventDefault(); e.stopPropagation();\n const tYear = e.shiftKey ? cellYear - 1 : cellYear;\n const tMonth = e.shiftKey ? cellMonth : cellMonth - 1;\n const tDay = Math.min(cellDay, getDaysInMonth(tYear, tMonth));\n handleKeyboardNavigate(new Date(tYear, tMonth, tDay), panel);\n break;\n }\n case 'PageDown': {\n // Shift+PageDown = next year, PageDown = next month\n e.preventDefault(); e.stopPropagation();\n const tYear = e.shiftKey ? cellYear + 1 : cellYear;\n const tMonth = e.shiftKey ? cellMonth : cellMonth + 1;\n const tDay = Math.min(cellDay, getDaysInMonth(tYear, tMonth));\n handleKeyboardNavigate(new Date(tYear, tMonth, tDay), panel);\n break;\n }\n case 'Enter':\n case ' ':\n e.preventDefault();\n if (!isDateDisabled(cellDate)) {\n handleDateClick(cellDate);\n }\n break;\n }\n };\n\n return ({ cellId, cellDate, disabled, ariaLabel, ariaCurrent, ariaDisabled }: GridCellItemInput): GridCellElementProps => {\n const rovingProps = getRovingItemProps(cellId);\n return {\n id: cellId,\n ref: rovingProps.ref,\n tabIndex: rovingProps.tabIndex,\n onFocus: rovingProps.onFocus,\n 'aria-label': ariaLabel,\n 'aria-current': ariaCurrent,\n 'aria-disabled': ariaDisabled,\n onKeyDown: (e: React.KeyboardEvent) => handleKeyDown(e, cellDate),\n onClick: () => { if (!disabled) handleDateClick(cellDate); }\n };\n };\n },\n [handleKeyboardNavigate, focusLeftItem, focusRightItem, getLeftRovingItemProps, getRightRovingItemProps]\n );\n\n return {\n getGridCellProps,\n getLeftRovingItemProps,\n getRightRovingItemProps,\n getLeftContainerProps,\n getRightContainerProps,\n focusLeftItem,\n focusRightItem\n };\n}\n"],"names":["useState","useMemo","useEffect","useCallback","useRovingFocus","getCellAriaLabel","date","isStart","isEnd","isSameStartEnd","singleDateSelection","inRange","base","toLocaleDateString","weekday","month","day","year","formatDateId","d","y","getFullYear","m","String","getMonth","padStart","dd","getDate","getDaysInMonth","Date","getPanelItemIds","panelDate","Array","from","length","_","i","getPanelDefaultFocusId","itemIds","selectedRange","isInPanel","startDate","setHours","id","includes","endDate","today","useDatePickerA11y","leftMonth","rightMonth","showSingleMonth","onMonthChange","keyboardFocusDate","setKeyboardFocusDate","leftItemIds","rightItemIds","leftDefaultFocusId","rightDefaultFocusId","getRovingItemProps","getLeftRovingItemProps","focusItem","focusLeftItem","getContainerProps","getLeftContainerProps","defaultFocusedId","orientation","cols","loop","role","getRightRovingItemProps","focusRightItem","getRightContainerProps","handleKeyboardNavigate","targetDate","sourcePanel","isLeft","getGridCellProps","isLeftCalendar","isDateDisabled","handleDateClick","panel","focusPanelItem","handleKeyDown","e","cellDate","cellYear","cellMonth","cellDay","navigateTo","key","preventDefault","stopPropagation","dayOfWeek","getDay","homeDate","clamped","daysInThisMonth","tYear","shiftKey","tMonth","tDay","Math","min","cellId","disabled","ariaLabel","ariaCurrent","ariaDisabled","rovingProps","ref","tabIndex","onFocus","onKeyDown","onClick"],"mappings":"AAKO,SAAA,YAAAA,GAAA,WAAAC,GAAA,aAAAC,GAAA,eAAAC,SAAA;AAAA,SAAA,kBAAAC,SAAA;AAAA,MAAMC,IAAmBA,CAC9BC,GACAC,GACAC,GACAC,GACAC,GACAC,IAAmB,OACR;AACX,QAAMC,IAAON,EAAKO,mBAAmB,SAAS;AAAA,IAC5CC,SAAS;AAAA,IACTC,OAAO;AAAA,IACPC,KAAK;AAAA,IACLC,MAAM;AAAA,EAAA,CACP;AACD,SAAIP,IAA4BE,IAC5BH,IAAuB,GAAGG,CAAI,6BAC9BL,IAAgB,GAAGK,CAAI,qBACvBJ,IAAc,GAAGI,CAAI,mBACrBD,IAAgB,GAAGC,CAAI,eACpBA;AACT,GAEaM,IAAeA,CAACC,MAAY;AACvC,QAAMC,IAAID,EAAEE,YAAAA,GACNC,IAAIC,OAAOJ,EAAEK,SAAAA,IAAa,CAAC,EAAEC,SAAS,GAAG,GAAG,GAC5CC,IAAKH,OAAOJ,EAAEQ,QAAAA,CAAS,EAAEF,SAAS,GAAG,GAAG;AAC9C,SAAO,QAAQL,CAAC,IAAIE,CAAC,IAAII,CAAE;AAC7B,GAEME,IAAiBA,CAACX,GAAcF,MAAkB,IAAIc,KAAKZ,GAAMF,IAAQ,GAAG,CAAC,EAAEY,QAAAA,GAE/EG,IAAkBA,CAACC,MAA8B;AACrD,QAAMd,IAAOc,EAAUV,YAAAA,G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"version":3,"file":"index253.js","sources":["../src/components/DatePicker/useDatePickerA11y.ts"],"sourcesContent":["import React, { useState, useCallback, useEffect, useMemo } from 'react';\n\nimport { useRovingFocus, RovingItemProps, RovingContainerProps, AccessibleNameInput } from '../../utils/a11y/useRovingFocus';\nimport type { DateRange } from './index';\n\nexport const getCellAriaLabel = (\n date: Date,\n isStart: boolean,\n isEnd: boolean,\n isSameStartEnd: boolean,\n singleDateSelection: boolean,\n inRange: boolean = false\n): string => {\n const base = date.toLocaleDateString('en-US', {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric'\n });\n if (singleDateSelection) return base;\n if (isSameStartEnd) return `${base}, start and end of range`;\n if (isStart) return `${base}, start of range`;\n if (isEnd) return `${base}, end of range`;\n if (inRange) return `${base}, in range`;\n return base;\n};\n\nexport const formatDateId = (d: Date) => {\n const y = d.getFullYear();\n const m = String(d.getMonth() + 1).padStart(2, '0');\n const dd = String(d.getDate()).padStart(2, '0');\n return `date-${y}-${m}-${dd}`;\n};\n\nconst getDaysInMonth = (year: number, month: number) => new Date(year, month + 1, 0).getDate();\n\nconst getPanelItemIds = (panelDate: Date): string[] => {\n const year = panelDate.getFullYear();\n const month = panelDate.getMonth();\n return Array.from({ length: getDaysInMonth(year, month) }, (_, i) =>\n formatDateId(new Date(year, month, i + 1))\n );\n};\n\nconst getPanelDefaultFocusId = (panelDate: Date, itemIds: string[], selectedRange: DateRange): string => {\n const year = panelDate.getFullYear();\n const month = panelDate.getMonth();\n const isInPanel = (d: Date) => d.getFullYear() === year && d.getMonth() === month;\n\n // Prefer startDate if it falls in this panel\n if (selectedRange.startDate && isInPanel(selectedRange.startDate)) {\n const d = new Date(selectedRange.startDate);\n d.setHours(0, 0, 0, 0);\n const id = formatDateId(d);\n if (itemIds.includes(id)) return id;\n }\n // Fall back to endDate if it falls in this panel (e.g. right panel when start is in left panel)\n if (selectedRange.endDate && isInPanel(selectedRange.endDate)) {\n const d = new Date(selectedRange.endDate);\n d.setHours(0, 0, 0, 0);\n const id = formatDateId(d);\n if (itemIds.includes(id)) return id;\n }\n const today = new Date();\n if (isInPanel(today)) {\n const id = formatDateId(today);\n if (itemIds.includes(id)) return id;\n }\n return itemIds[0] || '';\n};\n\ninterface UseDatePickerA11yOptions {\n leftMonth: Date;\n rightMonth: Date;\n showSingleMonth: boolean;\n selectedRange: DateRange;\n onMonthChange: (date: Date, isLeft: boolean) => void;\n}\n\ninterface CellKeyDownOptions {\n isLeftCalendar: boolean;\n isDateDisabled: (date: Date) => boolean;\n handleDateClick: (date: Date) => void;\n}\n\ninterface GridCellItemInput {\n cellId: string;\n cellDate: Date;\n disabled: boolean;\n ariaLabel: string;\n ariaCurrent: 'date' | undefined;\n ariaDisabled: true | undefined;\n}\n\nexport interface GridCellElementProps {\n id: string;\n ref: (el: HTMLElement | null) => void;\n tabIndex: number;\n onFocus: () => void;\n 'aria-label': string;\n 'aria-current': 'date' | undefined;\n 'aria-disabled': true | undefined;\n onKeyDown: (e: React.KeyboardEvent) => void;\n onClick: () => void;\n}\n\ninterface UseDatePickerA11yReturn {\n getGridCellProps: (options: CellKeyDownOptions) => (item: GridCellItemInput) => GridCellElementProps;\n getLeftRovingItemProps: (id: string) => RovingItemProps;\n getRightRovingItemProps: (id: string) => RovingItemProps;\n getLeftContainerProps: (nameInput?: AccessibleNameInput) => RovingContainerProps;\n getRightContainerProps: (nameInput?: AccessibleNameInput) => RovingContainerProps;\n focusLeftItem: (id: string) => void;\n focusRightItem: (id: string) => void;\n}\n\nexport function useDatePickerA11y({\n leftMonth,\n rightMonth,\n showSingleMonth,\n selectedRange,\n onMonthChange\n}: UseDatePickerA11yOptions): UseDatePickerA11yReturn {\n const [keyboardFocusDate, setKeyboardFocusDate] = useState<Date | null>(null);\n\n const leftItemIds = useMemo(() => getPanelItemIds(leftMonth), [leftMonth]);\n const rightItemIds = useMemo(() => getPanelItemIds(rightMonth), [rightMonth]);\n\n const leftDefaultFocusId = useMemo(\n () => getPanelDefaultFocusId(leftMonth, leftItemIds, selectedRange),\n [leftMonth, leftItemIds, selectedRange]\n );\n const rightDefaultFocusId = useMemo(\n () => getPanelDefaultFocusId(rightMonth, rightItemIds, selectedRange),\n [rightMonth, rightItemIds, selectedRange]\n );\n\n const { getRovingItemProps: getLeftRovingItemProps, focusItem: focusLeftItem, getContainerProps: getLeftContainerProps } = useRovingFocus({\n itemIds: leftItemIds,\n defaultFocusedId: leftDefaultFocusId,\n orientation: 'grid',\n cols: 7,\n loop: false,\n role: 'grid'\n });\n\n const { getRovingItemProps: getRightRovingItemProps, focusItem: focusRightItem, getContainerProps: getRightContainerProps } = useRovingFocus({\n itemIds: rightItemIds,\n defaultFocusedId: rightDefaultFocusId,\n orientation: 'grid',\n cols: 7,\n loop: false,\n role: 'grid'\n });\n\n // After keyboard navigation shifts a panel to a new month, focus the target cell via roving focus refs\n useEffect(() => {\n if (!keyboardFocusDate) return;\n const id = formatDateId(keyboardFocusDate);\n if (leftItemIds.includes(id)) {\n focusLeftItem(id);\n setKeyboardFocusDate(null);\n } else if (rightItemIds.includes(id)) {\n focusRightItem(id);\n setKeyboardFocusDate(null);\n }\n }, [keyboardFocusDate, leftItemIds, rightItemIds, focusLeftItem, focusRightItem]);\n\n // Navigate the keyboard focus to a date that may be in a different month.\n // Each panel advances completely independently — never touches the other panel.\n const handleKeyboardNavigate = useCallback(\n (targetDate: Date, sourcePanel: 'left' | 'right') => {\n const isLeft = showSingleMonth || sourcePanel === 'left';\n onMonthChange(new Date(targetDate.getFullYear(), targetDate.getMonth(), 1), isLeft);\n setKeyboardFocusDate(new Date(targetDate));\n },\n [showSingleMonth, onMonthChange]\n );\n\n const getGridCellProps = useCallback(\n ({ isLeftCalendar, isDateDisabled, handleDateClick }: CellKeyDownOptions) => {\n const panel: 'left' | 'right' = isLeftCalendar ? 'left' : 'right';\n const focusPanelItem = isLeftCalendar ? focusLeftItem : focusRightItem;\n const getRovingItemProps = isLeftCalendar ? getLeftRovingItemProps : getRightRovingItemProps;\n\n const handleKeyDown = (e: React.KeyboardEvent, cellDate: Date) => {\n const cellYear = cellDate.getFullYear();\n const cellMonth = cellDate.getMonth();\n const cellDay = cellDate.getDate();\n\n const navigateTo = (targetDate: Date) => {\n if (targetDate.getFullYear() !== cellYear || targetDate.getMonth() !== cellMonth) {\n handleKeyboardNavigate(targetDate, panel);\n return;\n }\n focusPanelItem(formatDateId(targetDate));\n };\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay - 1));\n break;\n case 'ArrowRight':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay + 1));\n break;\n case 'ArrowUp':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay - 7));\n break;\n case 'ArrowDown':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay + 7));\n break;\n case 'Home': {\n // First day of the current week row (Sunday), clamped to month start\n e.preventDefault(); e.stopPropagation();\n const dayOfWeek = cellDate.getDay();\n const homeDate = new Date(cellYear, cellMonth, cellDay - dayOfWeek);\n const clamped = homeDate.getMonth() !== cellMonth ? new Date(cellYear, cellMonth, 1) : homeDate;\n focusPanelItem(formatDateId(clamped));\n break;\n }\n case 'End': {\n // Last day of the current week row (Saturday), clamped to month end\n e.preventDefault(); e.stopPropagation();\n const dayOfWeek = cellDate.getDay();\n const endDate = new Date(cellYear, cellMonth, cellDay + (6 - dayOfWeek));\n const daysInThisMonth = getDaysInMonth(cellYear, cellMonth);\n const clamped =\n endDate.getMonth() !== cellMonth ? new Date(cellYear, cellMonth, daysInThisMonth) : endDate;\n focusPanelItem(formatDateId(clamped));\n break;\n }\n case 'PageUp': {\n // Shift+PageUp = previous year, PageUp = previous month\n e.preventDefault(); e.stopPropagation();\n const tYear = e.shiftKey ? cellYear - 1 : cellYear;\n const tMonth = e.shiftKey ? cellMonth : cellMonth - 1;\n const tDay = Math.min(cellDay, getDaysInMonth(tYear, tMonth));\n handleKeyboardNavigate(new Date(tYear, tMonth, tDay), panel);\n break;\n }\n case 'PageDown': {\n // Shift+PageDown = next year, PageDown = next month\n e.preventDefault(); e.stopPropagation();\n const tYear = e.shiftKey ? cellYear + 1 : cellYear;\n const tMonth = e.shiftKey ? cellMonth : cellMonth + 1;\n const tDay = Math.min(cellDay, getDaysInMonth(tYear, tMonth));\n handleKeyboardNavigate(new Date(tYear, tMonth, tDay), panel);\n break;\n }\n case 'Enter':\n case ' ':\n e.preventDefault();\n if (!isDateDisabled(cellDate)) {\n handleDateClick(cellDate);\n }\n break;\n }\n };\n\n return ({ cellId, cellDate, disabled, ariaLabel, ariaCurrent, ariaDisabled }: GridCellItemInput): GridCellElementProps => {\n const rovingProps = getRovingItemProps(cellId);\n return {\n id: cellId,\n ref: rovingProps.ref,\n tabIndex: rovingProps.tabIndex,\n onFocus: rovingProps.onFocus,\n 'aria-label': ariaLabel,\n 'aria-current': ariaCurrent,\n 'aria-disabled': ariaDisabled,\n onKeyDown: (e: React.KeyboardEvent) => handleKeyDown(e, cellDate),\n onClick: () => { if (!disabled) handleDateClick(cellDate); }\n };\n };\n },\n [handleKeyboardNavigate, focusLeftItem, focusRightItem, getLeftRovingItemProps, getRightRovingItemProps]\n );\n\n return {\n getGridCellProps,\n getLeftRovingItemProps,\n getRightRovingItemProps,\n getLeftContainerProps,\n getRightContainerProps,\n focusLeftItem,\n focusRightItem\n };\n}\n"],"names":["useState","useMemo","useEffect","useCallback","useRovingFocus","getCellAriaLabel","date","isStart","isEnd","isSameStartEnd","singleDateSelection","inRange","base","toLocaleDateString","weekday","month","day","year","formatDateId","d","y","getFullYear","m","String","getMonth","padStart","dd","getDate","getDaysInMonth","Date","getPanelItemIds","panelDate","Array","from","length","_","i","getPanelDefaultFocusId","itemIds","selectedRange","isInPanel","startDate","setHours","id","includes","endDate","today","useDatePickerA11y","leftMonth","rightMonth","showSingleMonth","onMonthChange","keyboardFocusDate","setKeyboardFocusDate","leftItemIds","rightItemIds","leftDefaultFocusId","rightDefaultFocusId","getRovingItemProps","getLeftRovingItemProps","focusItem","focusLeftItem","getContainerProps","getLeftContainerProps","defaultFocusedId","orientation","cols","loop","role","getRightRovingItemProps","focusRightItem","getRightContainerProps","handleKeyboardNavigate","targetDate","sourcePanel","isLeft","getGridCellProps","isLeftCalendar","isDateDisabled","handleDateClick","panel","focusPanelItem","handleKeyDown","e","cellDate","cellYear","cellMonth","cellDay","navigateTo","key","preventDefault","stopPropagation","dayOfWeek","getDay","homeDate","clamped","daysInThisMonth","tYear","shiftKey","tMonth","tDay","Math","min","cellId","disabled","ariaLabel","ariaCurrent","ariaDisabled","rovingProps","ref","tabIndex","onFocus","onKeyDown","onClick"],"mappings":"AAKO,SAAA,YAAAA,GAAA,WAAAC,GAAA,aAAAC,GAAA,eAAAC,SAAA;AAAA,SAAA,kBAAAC,SAAA;AAAA,MAAMC,IAAmBA,CAC9BC,GACAC,GACAC,GACAC,GACAC,GACAC,IAAmB,OACR;AACX,QAAMC,IAAON,EAAKO,mBAAmB,SAAS;AAAA,IAC5CC,SAAS;AAAA,IACTC,OAAO;AAAA,IACPC,KAAK;AAAA,IACLC,MAAM;AAAA,EAAA,CACP;AACD,SAAIP,IAA4BE,IAC5BH,IAAuB,GAAGG,CAAI,6BAC9BL,IAAgB,GAAGK,CAAI,qBACvBJ,IAAc,GAAGI,CAAI,mBACrBD,IAAgB,GAAGC,CAAI,eACpBA;AACT,GAEaM,IAAeA,CAACC,MAAY;AACvC,QAAMC,IAAID,EAAEE,YAAAA,GACNC,IAAIC,OAAOJ,EAAEK,SAAAA,IAAa,CAAC,EAAEC,SAAS,GAAG,GAAG,GAC5CC,IAAKH,OAAOJ,EAAEQ,QAAAA,CAAS,EAAEF,SAAS,GAAG,GAAG;AAC9C,SAAO,QAAQL,CAAC,IAAIE,CAAC,IAAII,CAAE;AAC7B,GAEME,IAAiBA,CAACX,GAAcF,MAAkB,IAAIc,KAAKZ,GAAMF,IAAQ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AAAA,IACAQ,wBAAAA;AAAAA,IACAV,eAAAA;AAAAA,IACAS,gBAAAA;AAAAA,EAAAA;AAEJ;"}
package/dist/index254.js CHANGED
@@ -1,22 +1,7 @@
1
- import { useEffect as s } from "react";
2
- const u = {
3
- block: "nearest"
4
- };
5
- function m({
6
- containerRef: t,
7
- activeIndex: o,
8
- itemSelector: r = '[role="option"]',
9
- enabled: c = !0,
10
- scrollOptions: e = u
11
- }) {
12
- s(() => {
13
- if (!c || o < 0 || !t?.current)
14
- return;
15
- const n = t.current.querySelectorAll(r)[o];
16
- n && n.scrollIntoView(e);
17
- }, [o, t, r, c, e]);
1
+ function n(e) {
2
+ return new Promise((t) => setTimeout(t, e));
18
3
  }
19
4
  export {
20
- m as useScrollActiveIntoView
5
+ n as delay
21
6
  };
22
7
  //# sourceMappingURL=index254.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index254.js","sources":["../src/utils/a11y/useScrollActiveIntoView.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nconst DEFAULT_SCROLL_OPTIONS: ScrollIntoViewOptions = { block: 'nearest' };\n\nexport interface UseScrollActiveIntoViewOptions {\n /**\n * Ref to the container element\n */\n containerRef?: RefObject<HTMLElement | null>;\n \n /**\n * Index of the currently active/highlighted item (-1 if none)\n */\n activeIndex: number;\n \n /**\n * CSS selector for item elements\n * Default: '[role=\"option\"]'\n */\n itemSelector?: string;\n \n /**\n * Whether scrolling is enabled\n * Default: true\n */\n enabled?: boolean;\n \n /**\n * ScrollIntoView options\n * Default: { block: 'nearest' }\n */\n scrollOptions?: ScrollIntoViewOptions;\n}\n\n/**\n * Hook to automatically scroll the active item into view.\n * \n * Useful for aria-activedescendant patterns where DOM focus stays\n * on the container (e.g., input field) but we need to visually show\n * which descendant option is logically active.\n * \n * Common use cases:\n * - Combobox dropdown options\n * - Menu items with virtual focus\n * - Grid cells with keyboard navigation\n * - Tree view items\n * - Listbox options\n * \n * @example\n * ```tsx\n * const [highlightedIndex, setHighlightedIndex] = useState(-1);\n * const listboxRef = useRef<HTMLDivElement>(null);\n * \n * useScrollActiveIntoView({\n * containerRef: listboxRef,\n * activeIndex: highlightedIndex,\n * itemSelector: '[role=\"option\"]'\n * });\n * \n * // Now when highlightedIndex changes, the item scrolls into view\n * ```\n * \n * @example Custom scroll behavior\n * ```tsx\n * useScrollActiveIntoView({\n * containerRef: menuRef,\n * activeIndex: activeMenuIndex,\n * itemSelector: '[role=\"menuitem\"]',\n * scrollOptions: { block: 'center', behavior: 'smooth' }\n * });\n * ```\n */\nexport function useScrollActiveIntoView({\n containerRef,\n activeIndex,\n itemSelector = '[role=\"option\"]',\n enabled = true,\n scrollOptions = DEFAULT_SCROLL_OPTIONS\n}: UseScrollActiveIntoViewOptions): void {\n useEffect(() => {\n // Early returns for disabled states\n if (!enabled || activeIndex < 0 || !containerRef?.current) {\n return;\n }\n \n const container = containerRef.current;\n const items = container.querySelectorAll(itemSelector);\n const activeItem = items[activeIndex] as HTMLElement;\n \n if (activeItem) {\n activeItem.scrollIntoView(scrollOptions);\n }\n }, [activeIndex, containerRef, itemSelector, enabled, scrollOptions]);\n}\n"],"names":["useEffect","DEFAULT_SCROLL_OPTIONS","block","useScrollActiveIntoView","containerRef","activeIndex","itemSelector","enabled","scrollOptions","current","activeItem","querySelectorAll","scrollIntoView"],"mappings":"AAGA,SAAA,aAAAA,SAAA;AAAA,MAAMC,IAAgD;AAAA,EAAEC,OAAO;AAAU;AAsElE,SAASC,EAAwB;AAAA,EACtCC,cAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,cAAAA,IAAe;AAAA,EACfC,SAAAA,IAAU;AAAA,EACVC,eAAAA,IAAgBP;AACc,GAAS;AACvCD,EAAAA,EAAU,MAAM;AAEd,QAAI,CAACO,KAAWF,IAAc,KAAK,CAACD,GAAcK;AAChD;AAKF,UAAMC,IAFYN,EAAaK,QACPE,iBAAiBL,CAAY,EAC5BD,CAAW;AAEpC,IAAIK,KACFA,EAAWE,eAAeJ,CAAa;AAAA,EAE3C,GAAG,CAACH,GAAaD,GAAcE,GAAcC,GAASC,CAAa,CAAC;AACtE;"}
1
+ {"version":3,"file":"index254.js","sources":["../src/utils/delay.ts"],"sourcesContent":["/**\n * Delays execution by the specified number of milliseconds\n * @param ms - The number of milliseconds to delay\n * @returns A Promise that resolves after the specified delay\n */\nexport function delay(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n} "],"names":["delay","ms","Promise","resolve","setTimeout"],"mappings":"AAKO,SAASA,EAAMC,GAA2B;AAC7C,SAAO,IAAIC,QAAQC,CAAAA,MAAWC,WAAWD,GAASF,CAAE,CAAC;AACzD;"}
package/dist/index256.js CHANGED
@@ -1,13 +1,22 @@
1
- function e() {
2
- return e = Object.assign ? Object.assign.bind() : function(t) {
3
- for (var n = 1; n < arguments.length; n++) {
4
- var a = arguments[n];
5
- for (var r in a) ({}).hasOwnProperty.call(a, r) && (t[r] = a[r]);
6
- }
7
- return t;
8
- }, e.apply(null, arguments);
1
+ import { useEffect as s } from "react";
2
+ const u = {
3
+ block: "nearest"
4
+ };
5
+ function m({
6
+ containerRef: t,
7
+ activeIndex: o,
8
+ itemSelector: r = '[role="option"]',
9
+ enabled: c = !0,
10
+ scrollOptions: e = u
11
+ }) {
12
+ s(() => {
13
+ if (!c || o < 0 || !t?.current)
14
+ return;
15
+ const n = t.current.querySelectorAll(r)[o];
16
+ n && n.scrollIntoView(e);
17
+ }, [o, t, r, c, e]);
9
18
  }
10
19
  export {
11
- e as default
20
+ m as useScrollActiveIntoView
12
21
  };
13
22
  //# sourceMappingURL=index256.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index256.js","sources":["../node_modules/@babel/runtime/helpers/esm/extends.js"],"sourcesContent":["function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };"],"names":["_extends","n","e","t"],"mappings":"AAAA,SAASA,IAAW;AAClB,SAAOA,IAAW,OAAO,SAAS,OAAO,OAAO,KAAI,IAAK,SAAUC,GAAG;AACpE,aAASC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AACzC,UAAIC,IAAI,UAAUD,CAAC;AACnB,eAAS,KAAKC,EAAG,EAAC,CAAA,GAAI,eAAe,KAAKA,GAAG,CAAC,MAAMF,EAAE,CAAC,IAAIE,EAAE,CAAC;AAAA,IAChE;AACA,WAAOF;AAAA,EACT,GAAGD,EAAS,MAAM,MAAM,SAAS;AACnC;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index256.js","sources":["../src/utils/a11y/useScrollActiveIntoView.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nconst DEFAULT_SCROLL_OPTIONS: ScrollIntoViewOptions = { block: 'nearest' };\n\nexport interface UseScrollActiveIntoViewOptions {\n /**\n * Ref to the container element\n */\n containerRef?: RefObject<HTMLElement | null>;\n \n /**\n * Index of the currently active/highlighted item (-1 if none)\n */\n activeIndex: number;\n \n /**\n * CSS selector for item elements\n * Default: '[role=\"option\"]'\n */\n itemSelector?: string;\n \n /**\n * Whether scrolling is enabled\n * Default: true\n */\n enabled?: boolean;\n \n /**\n * ScrollIntoView options\n * Default: { block: 'nearest' }\n */\n scrollOptions?: ScrollIntoViewOptions;\n}\n\n/**\n * Hook to automatically scroll the active item into view.\n * \n * Useful for aria-activedescendant patterns where DOM focus stays\n * on the container (e.g., input field) but we need to visually show\n * which descendant option is logically active.\n * \n * Common use cases:\n * - Combobox dropdown options\n * - Menu items with virtual focus\n * - Grid cells with keyboard navigation\n * - Tree view items\n * - Listbox options\n * \n * @example\n * ```tsx\n * const [highlightedIndex, setHighlightedIndex] = useState(-1);\n * const listboxRef = useRef<HTMLDivElement>(null);\n * \n * useScrollActiveIntoView({\n * containerRef: listboxRef,\n * activeIndex: highlightedIndex,\n * itemSelector: '[role=\"option\"]'\n * });\n * \n * // Now when highlightedIndex changes, the item scrolls into view\n * ```\n * \n * @example Custom scroll behavior\n * ```tsx\n * useScrollActiveIntoView({\n * containerRef: menuRef,\n * activeIndex: activeMenuIndex,\n * itemSelector: '[role=\"menuitem\"]',\n * scrollOptions: { block: 'center', behavior: 'smooth' }\n * });\n * ```\n */\nexport function useScrollActiveIntoView({\n containerRef,\n activeIndex,\n itemSelector = '[role=\"option\"]',\n enabled = true,\n scrollOptions = DEFAULT_SCROLL_OPTIONS\n}: UseScrollActiveIntoViewOptions): void {\n useEffect(() => {\n // Early returns for disabled states\n if (!enabled || activeIndex < 0 || !containerRef?.current) {\n return;\n }\n \n const container = containerRef.current;\n const items = container.querySelectorAll(itemSelector);\n const activeItem = items[activeIndex] as HTMLElement;\n \n if (activeItem) {\n activeItem.scrollIntoView(scrollOptions);\n }\n }, [activeIndex, containerRef, itemSelector, enabled, scrollOptions]);\n}\n"],"names":["useEffect","DEFAULT_SCROLL_OPTIONS","block","useScrollActiveIntoView","containerRef","activeIndex","itemSelector","enabled","scrollOptions","current","activeItem","querySelectorAll","scrollIntoView"],"mappings":"AAGA,SAAA,aAAAA,SAAA;AAAA,MAAMC,IAAgD;AAAA,EAAEC,OAAO;AAAU;AAsElE,SAASC,EAAwB;AAAA,EACtCC,cAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,cAAAA,IAAe;AAAA,EACfC,SAAAA,IAAU;AAAA,EACVC,eAAAA,IAAgBP;AACc,GAAS;AACvCD,EAAAA,EAAU,MAAM;AAEd,QAAI,CAACO,KAAWF,IAAc,KAAK,CAACD,GAAcK;AAChD;AAKF,UAAMC,IAFYN,EAAaK,QACPE,iBAAiBL,CAAY,EAC5BD,CAAW;AAEpC,IAAIK,KACFA,EAAWE,eAAeJ,CAAa;AAAA,EAE3C,GAAG,CAACH,GAAaD,GAAcE,GAAcC,GAASC,CAAa,CAAC;AACtE;"}
package/dist/index257.js CHANGED
@@ -1,8 +1,13 @@
1
- import e from "./index260.js";
2
- function p(o, t) {
3
- o.prototype = Object.create(t.prototype), o.prototype.constructor = o, e(o, t);
1
+ function r(t, i) {
2
+ if (t == null) return {};
3
+ var o = {};
4
+ for (var e in t) if ({}.hasOwnProperty.call(t, e)) {
5
+ if (i.indexOf(e) !== -1) continue;
6
+ o[e] = t[e];
7
+ }
8
+ return o;
4
9
  }
5
10
  export {
6
- p as default
11
+ r as default
7
12
  };
8
13
  //# sourceMappingURL=index257.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index257.js","sources":["../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"],"sourcesContent":["import setPrototypeOf from \"./setPrototypeOf.js\";\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, setPrototypeOf(t, o);\n}\nexport { _inheritsLoose as default };"],"names":["_setPrototypeOf","_inheritsLoose","t","o","setPrototypeOf"],"mappings":"AACA,OAAAA,OAAA;AAAA,SAASC,EAAeC,GAAGC,GAAG;AAC5B,EAAAD,EAAE,YAAY,OAAO,OAAOC,EAAE,SAAS,GAAGD,EAAE,UAAU,cAAcA,GAAGE,EAAeF,GAAGC,CAAC;AAC5F;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index257.js","sources":["../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js"],"sourcesContent":["function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nexport { _objectWithoutPropertiesLoose as default };"],"names":["_objectWithoutPropertiesLoose","r","e","t","n"],"mappings":"AAAA,SAASA,EAA8BC,GAAGC,GAAG;AAC3C,MAAYD,KAAR,KAAW,QAAO,CAAA;AACtB,MAAIE,IAAI,CAAA;AACR,WAASC,KAAKH,EAAG,KAAI,CAAA,EAAG,eAAe,KAAKA,GAAGG,CAAC,GAAG;AACjD,QAAWF,EAAE,QAAQE,CAAC,MAAlB,GAAqB;AACzB,IAAAD,EAAEC,CAAC,IAAIH,EAAEG,CAAC;AAAA,EACZ;AACA,SAAOD;AACT;","x_google_ignoreList":[0]}