@elliemae/ds-global-header 3.70.0-next.61 → 3.70.0-next.63

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 (138) hide show
  1. package/dist/cjs/DSGlobalHeader.js +16 -2
  2. package/dist/cjs/DSGlobalHeader.js.map +2 -2
  3. package/dist/cjs/DSGlobalHeaderContext.js.map +2 -2
  4. package/dist/cjs/config/useGlobalHeader.js +13 -2
  5. package/dist/cjs/config/useGlobalHeader.js.map +2 -2
  6. package/dist/cjs/constants/index.js +4 -3
  7. package/dist/cjs/constants/index.js.map +2 -2
  8. package/dist/cjs/index.js +3 -6
  9. package/dist/cjs/index.js.map +3 -3
  10. package/dist/cjs/parts/Breadcrumb/useGlobalHeaderBreadcrumb.js +33 -1
  11. package/dist/cjs/parts/Breadcrumb/useGlobalHeaderBreadcrumb.js.map +2 -2
  12. package/dist/cjs/parts/Logo/GlobalHeaderLogo.js +16 -2
  13. package/dist/cjs/parts/Logo/GlobalHeaderLogo.js.map +2 -2
  14. package/dist/cjs/parts/Toolbar/GlobalHeaderToolbar.js +54 -16
  15. package/dist/cjs/parts/Toolbar/GlobalHeaderToolbar.js.map +2 -2
  16. package/dist/cjs/{utils/useCallbackAfterRender.js → parts/Toolbar/outOfTheBox/AppPicker/AppPickerCTX.js} +7 -16
  17. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/AppPickerCTX.js.map +7 -0
  18. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/AppPickerCTXRenderer.js +43 -0
  19. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/AppPickerCTXRenderer.js.map +7 -0
  20. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/AppPickerRenderer.js +52 -0
  21. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/AppPickerRenderer.js.map +7 -0
  22. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/TriggerDefaultComponent.js +84 -0
  23. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/TriggerDefaultComponent.js.map +7 -0
  24. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/react-desc-prop-types.js +50 -0
  25. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/react-desc-prop-types.js.map +7 -0
  26. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/useAppPickerCTX.js +64 -0
  27. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/useAppPickerCTX.js.map +7 -0
  28. package/dist/cjs/parts/Toolbar/outOfTheBox/PopupMenu/PopupMenu.js +106 -55
  29. package/dist/cjs/parts/Toolbar/outOfTheBox/PopupMenu/PopupMenu.js.map +3 -3
  30. package/dist/cjs/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/PopupMenuContent.js +27 -11
  31. package/dist/cjs/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/PopupMenuContent.js.map +2 -2
  32. package/dist/cjs/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/react-desc-prop-types.js +52 -0
  33. package/dist/cjs/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/react-desc-prop-types.js.map +7 -0
  34. package/dist/cjs/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/usePopupMenuContent.js +23 -15
  35. package/dist/cjs/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/usePopupMenuContent.js.map +2 -2
  36. package/dist/cjs/parts/Toolbar/outOfTheBox/PopupMenu/react-desc-prop-types.js +54 -0
  37. package/dist/cjs/parts/Toolbar/outOfTheBox/PopupMenu/react-desc-prop-types.js.map +7 -0
  38. package/dist/cjs/parts/Toolbar/outOfTheBox/SearchToggle/SearchToggle.js +26 -16
  39. package/dist/cjs/parts/Toolbar/outOfTheBox/SearchToggle/SearchToggle.js.map +2 -2
  40. package/dist/cjs/parts/Toolbar/outOfTheBox/SearchToggle/SearchToggleSpinButton.js +60 -50
  41. package/dist/cjs/parts/Toolbar/outOfTheBox/SearchToggle/SearchToggleSpinButton.js.map +2 -2
  42. package/dist/cjs/parts/Toolbar/outOfTheBox/SearchToggle/react-desc-prop-types.js +58 -0
  43. package/dist/cjs/parts/Toolbar/outOfTheBox/SearchToggle/react-desc-prop-types.js.map +7 -0
  44. package/dist/cjs/parts/Toolbar/outOfTheBox/SearchToggle/useSearchToggle.js +33 -25
  45. package/dist/cjs/parts/Toolbar/outOfTheBox/SearchToggle/useSearchToggle.js.map +2 -2
  46. package/dist/cjs/parts/Toolbar/outOfTheBox/index.js +12 -4
  47. package/dist/cjs/parts/Toolbar/outOfTheBox/index.js.map +2 -2
  48. package/dist/cjs/parts/Toolbar/styles.js +6 -1
  49. package/dist/cjs/parts/Toolbar/styles.js.map +2 -2
  50. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  51. package/dist/cjs/sharedTypes.js.map +1 -1
  52. package/dist/cjs/typescript-testing/typescript-global-header-toolbar-types.js +52 -0
  53. package/dist/cjs/typescript-testing/typescript-global-header-toolbar-types.js.map +2 -2
  54. package/dist/esm/DSGlobalHeader.js +16 -2
  55. package/dist/esm/DSGlobalHeader.js.map +2 -2
  56. package/dist/esm/DSGlobalHeaderContext.js.map +2 -2
  57. package/dist/esm/config/useGlobalHeader.js +13 -2
  58. package/dist/esm/config/useGlobalHeader.js.map +2 -2
  59. package/dist/esm/constants/index.js +4 -3
  60. package/dist/esm/constants/index.js.map +2 -2
  61. package/dist/esm/index.js +3 -6
  62. package/dist/esm/index.js.map +3 -3
  63. package/dist/esm/parts/Breadcrumb/useGlobalHeaderBreadcrumb.js +34 -2
  64. package/dist/esm/parts/Breadcrumb/useGlobalHeaderBreadcrumb.js.map +2 -2
  65. package/dist/esm/parts/Logo/GlobalHeaderLogo.js +16 -2
  66. package/dist/esm/parts/Logo/GlobalHeaderLogo.js.map +2 -2
  67. package/dist/esm/parts/Toolbar/GlobalHeaderToolbar.js +55 -17
  68. package/dist/esm/parts/Toolbar/GlobalHeaderToolbar.js.map +2 -2
  69. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/AppPickerCTX.js +8 -0
  70. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/AppPickerCTX.js.map +7 -0
  71. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/AppPickerCTXRenderer.js +13 -0
  72. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/AppPickerCTXRenderer.js.map +7 -0
  73. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/AppPickerRenderer.js +22 -0
  74. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/AppPickerRenderer.js.map +7 -0
  75. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/TriggerDefaultComponent.js +54 -0
  76. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/TriggerDefaultComponent.js.map +7 -0
  77. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/react-desc-prop-types.js +20 -0
  78. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/react-desc-prop-types.js.map +7 -0
  79. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/useAppPickerCTX.js +34 -0
  80. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/useAppPickerCTX.js.map +7 -0
  81. package/dist/esm/parts/Toolbar/outOfTheBox/PopupMenu/PopupMenu.js +108 -57
  82. package/dist/esm/parts/Toolbar/outOfTheBox/PopupMenu/PopupMenu.js.map +2 -2
  83. package/dist/esm/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/PopupMenuContent.js +28 -12
  84. package/dist/esm/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/PopupMenuContent.js.map +2 -2
  85. package/dist/esm/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/react-desc-prop-types.js +22 -0
  86. package/dist/esm/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/react-desc-prop-types.js.map +7 -0
  87. package/dist/esm/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/usePopupMenuContent.js +24 -16
  88. package/dist/esm/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/usePopupMenuContent.js.map +2 -2
  89. package/dist/esm/parts/Toolbar/outOfTheBox/PopupMenu/react-desc-prop-types.js +24 -0
  90. package/dist/esm/parts/Toolbar/outOfTheBox/PopupMenu/react-desc-prop-types.js.map +7 -0
  91. package/dist/esm/parts/Toolbar/outOfTheBox/SearchToggle/SearchToggle.js +26 -16
  92. package/dist/esm/parts/Toolbar/outOfTheBox/SearchToggle/SearchToggle.js.map +2 -2
  93. package/dist/esm/parts/Toolbar/outOfTheBox/SearchToggle/SearchToggleSpinButton.js +60 -50
  94. package/dist/esm/parts/Toolbar/outOfTheBox/SearchToggle/SearchToggleSpinButton.js.map +2 -2
  95. package/dist/esm/parts/Toolbar/outOfTheBox/SearchToggle/react-desc-prop-types.js +28 -0
  96. package/dist/esm/parts/Toolbar/outOfTheBox/SearchToggle/react-desc-prop-types.js.map +7 -0
  97. package/dist/esm/parts/Toolbar/outOfTheBox/SearchToggle/useSearchToggle.js +33 -25
  98. package/dist/esm/parts/Toolbar/outOfTheBox/SearchToggle/useSearchToggle.js.map +2 -2
  99. package/dist/esm/parts/Toolbar/outOfTheBox/index.js +8 -3
  100. package/dist/esm/parts/Toolbar/outOfTheBox/index.js.map +2 -2
  101. package/dist/esm/parts/Toolbar/styles.js +6 -1
  102. package/dist/esm/parts/Toolbar/styles.js.map +2 -2
  103. package/dist/esm/react-desc-prop-types.js.map +2 -2
  104. package/dist/esm/typescript-testing/typescript-global-header-toolbar-types.js +52 -0
  105. package/dist/esm/typescript-testing/typescript-global-header-toolbar-types.js.map +2 -2
  106. package/dist/types/DSGlobalHeaderContext.d.ts +10 -2
  107. package/dist/types/config/useGlobalHeader.d.ts +3 -4
  108. package/dist/types/constants/index.d.ts +3 -3
  109. package/dist/types/index.d.ts +0 -2
  110. package/dist/types/parts/Toolbar/outOfTheBox/AppPicker/AppPickerCTX.d.ts +4 -0
  111. package/dist/types/parts/Toolbar/outOfTheBox/AppPicker/AppPickerCTXRenderer.d.ts +2 -0
  112. package/dist/types/parts/Toolbar/outOfTheBox/AppPicker/AppPickerRenderer.d.ts +1 -0
  113. package/dist/types/parts/Toolbar/outOfTheBox/AppPicker/TriggerDefaultComponent.d.ts +2 -0
  114. package/dist/types/parts/Toolbar/outOfTheBox/AppPicker/react-desc-prop-types.d.ts +23 -0
  115. package/dist/types/parts/Toolbar/outOfTheBox/AppPicker/useAppPickerCTX.d.ts +456 -0
  116. package/dist/types/parts/Toolbar/outOfTheBox/PopupMenu/PopupMenu.d.ts +2 -2
  117. package/dist/types/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/PopupMenuContent.d.ts +2 -2
  118. package/dist/types/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/react-desc-prop-types.d.ts +28 -0
  119. package/dist/types/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/usePopupMenuContent.d.ts +9 -1
  120. package/dist/types/parts/Toolbar/outOfTheBox/PopupMenu/react-desc-prop-types.d.ts +26 -0
  121. package/dist/types/parts/Toolbar/outOfTheBox/SearchToggle/SearchToggle.d.ts +2 -2
  122. package/dist/types/parts/Toolbar/outOfTheBox/SearchToggle/SearchToggleSpinButton.d.ts +2 -0
  123. package/dist/types/parts/Toolbar/outOfTheBox/SearchToggle/react-desc-prop-types.d.ts +26 -0
  124. package/dist/types/parts/Toolbar/outOfTheBox/SearchToggle/useSearchToggle.d.ts +2 -3
  125. package/dist/types/parts/Toolbar/outOfTheBox/index.d.ts +3 -3
  126. package/dist/types/parts/Toolbar/styles.d.ts +1 -0
  127. package/dist/types/react-desc-prop-types.d.ts +63 -72
  128. package/dist/types/sharedTypes.d.ts +16 -6
  129. package/package.json +16 -13
  130. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/AppPicker.js +0 -127
  131. package/dist/cjs/parts/Toolbar/outOfTheBox/AppPicker/AppPicker.js.map +0 -7
  132. package/dist/cjs/utils/useCallbackAfterRender.js.map +0 -7
  133. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/AppPicker.js +0 -97
  134. package/dist/esm/parts/Toolbar/outOfTheBox/AppPicker/AppPicker.js.map +0 -7
  135. package/dist/esm/utils/useCallbackAfterRender.js +0 -17
  136. package/dist/esm/utils/useCallbackAfterRender.js.map +0 -7
  137. package/dist/types/parts/Toolbar/outOfTheBox/AppPicker/AppPicker.d.ts +0 -6
  138. package/dist/types/utils/useCallbackAfterRender.d.ts +0 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/parts/Toolbar/outOfTheBox/PopupMenu/PopupMenu.tsx", "../../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { useFloatingContext, PopoverArrow, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes } from '@elliemae/ds-props-helpers';\nimport React, { useCallback } from 'react';\nimport { GLOBAL_HEADER_DATA_TESTID } from '../../../../constants/index.js';\nimport type { DSGlobalHeaderT } from '../../../../react-desc-prop-types.js';\nimport { StyledButton } from '../../../styles.js';\nimport { PopupMenuContent } from './menuContent/PopupMenuContent.js';\n\nexport const PopupMenu = ({\n Icon,\n onClick,\n setRef,\n componentProps,\n ownerProps,\n ...otherProps\n}: DSGlobalHeaderT.PopupProps): JSX.Element => {\n const {\n onClickOutside = () => null,\n onKeyPress,\n popupOnKeyPress,\n isOpen: userIsOpen,\n options,\n closeOnClick,\n } = componentProps;\n\n // We need to declare the floating context before we can reference its hideTooltip in\n // handleOutside; but handleOutside is passed into the same hook call. We resolve this by\n // pulling hideTooltip / refs.reference via the latest-ref pattern of the hook itself \u2014\n // see comments on `onClickOutside` below.\n const { arrowStyles, floatingStyles, isOpen, refs, context, showTooltip, hideTooltip } = useFloatingContext({\n externallyControlledIsOpen: componentProps.isOpen,\n placement: 'bottom',\n withoutAnimation: true,\n withoutPortal: true,\n // The hook auto-excludes clicks inside the floating element and the reference, so the\n // outside boundary is now { reference, floating } \u2014 no boundary <div> needed.\n // Gated internally on `isOpen`, so it only fires while open.\n onClickOutside: (event) => {\n onClickOutside(event);\n if (userIsOpen === undefined) {\n hideTooltip();\n (refs.reference as HTMLElement)?.focus();\n }\n },\n });\n\n const handleOnKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.code === 'ArrowDown') {\n showTooltip();\n }\n if (onKeyPress) onKeyPress(e);\n },\n [onKeyPress, showTooltip],\n );\n\n const handleOnClose = useCallback(() => {\n if (userIsOpen === undefined) {\n hideTooltip();\n }\n (refs.reference as HTMLElement)?.focus();\n }, [hideTooltip, refs.reference, userIsOpen]);\n\n const handleTriggerOnClick = useCallback(\n (e: React.MouseEvent) => {\n if (userIsOpen === undefined) showTooltip(e);\n if (onClick) onClick(e);\n },\n [onClick, userIsOpen, showTooltip],\n );\n\n const handleItemClick = useCallback(() => {\n if (closeOnClick && userIsOpen === undefined) handleOnClose();\n }, [closeOnClick, handleOnClose, userIsOpen]);\n\n const handleRefs = useCallback(\n (ref: HTMLButtonElement) => {\n setRef(ref);\n refs.setReference(ref);\n },\n [refs, setRef],\n );\n return (\n <div>\n <StyledButton\n onClick={handleTriggerOnClick}\n onKeyDown={handleOnKeyDown}\n innerRef={handleRefs}\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_ITEM_BUTTON}\n aria-haspopup\n aria-expanded={userIsOpen ?? isOpen}\n {...useGetGlobalAttributes(otherProps)}\n type=\"button\"\n {...ownerProps}\n >\n {Icon && <Icon size=\"m\" />}\n </StyledButton>\n\n {refs.reference ? (\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={userIsOpen ?? isOpen}\n floatingStyles={floatingStyles}\n context={context}\n >\n <PopupMenuContent\n options={options}\n onItemClick={handleItemClick}\n onClose={handleOnClose}\n setIsOpen={hideTooltip}\n popupOnKeyPress={popupOnKeyPress}\n ownerProps={ownerProps}\n />\n <PopoverArrow {...arrowStyles} />\n </FloatingWrapper>\n ) : null}\n </div>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;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CAAC,SAAS,YAAY,WAAW;AAAA,EACnC;AAEA,QAAM,sBAAkB,0BAAY,MAAM;AACxC,QAAI,gBAAgB,eAAe,OAAW,eAAc;AAAA,EAC9D,GAAG,CAAC,cAAc,eAAe,UAAU,CAAC;AAE5C,QAAM,iBAAa;AAAA,IACjB,CAAC,QAA2B;AAC1B,aAAO,GAAG;AACV,WAAK,aAAa,GAAG;AAAA,IACvB;AAAA,IACA,CAAC,MAAM,MAAM;AAAA,EACf;AACA,SACE,6CAAC,SACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,WAAW;AAAA,QACX,UAAU;AAAA,QACV,eAAa,2CAA0B;AAAA,QACvC,iBAAa;AAAA,QACb,iBAAe,cAAc;AAAA,QAC5B,OAAG,gDAAuB,UAAU;AAAA,QACrC,MAAK;AAAA,QACJ,GAAG;AAAA,QAEH,kBAAQ,4CAAC,QAAK,MAAK,KAAI;AAAA;AAAA,IAC1B;AAAA,IAEC,KAAK,YACJ;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,KAAK;AAAA,QACf,QAAQ,cAAc;AAAA,QACtB;AAAA,QACA;AAAA,QAEA;AAAA;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,aAAa;AAAA,cACb,SAAS;AAAA,cACT,WAAW;AAAA,cACX;AAAA,cACA;AAAA;AAAA,UACF;AAAA,UACA,4CAAC,2CAAc,GAAG,aAAa;AAAA;AAAA;AAAA,IACjC,IACE;AAAA,KACN;AAEJ;",
6
- "names": []
4
+ "sourcesContent": ["import { useFloatingContext, PopoverArrow, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useRef } from 'react';\nimport { GLOBAL_HEADER_DATA_TESTID } from '../../../../constants/index.js';\nimport { StyledButton } from '../../../styles.js';\nimport { StyledPopupMenuContainer } from '../../styles.js';\nimport { PopupMenuContent } from './menuContent/PopupMenuContent.js';\nimport type { PopupMenuT } from './react-desc-prop-types.js';\n\nexport const PopupMenu = ({\n Icon,\n onClick,\n setRef,\n componentProps,\n getOwnerPropsAwareOfPropsPassedToGlobalHeader,\n ...otherProps\n}: PopupMenuT.Props): JSX.Element => {\n const {\n onClickOutside = () => null,\n onKeyPress,\n popupOnKeyPress,\n isOpen: userIsOpen,\n options,\n closeOnClick,\n onOpen,\n onClose,\n } = componentProps;\n\n // We need to declare the floating context before we can reference its hideTooltip in\n // handleOutside; but handleOutside is passed into the same hook call. We resolve this by\n // pulling hideTooltip / refs.reference via the latest-ref pattern of the hook itself \u2014\n // see comments on `onClickOutside` below.\n const { arrowStyles, floatingStyles, isOpen, refs, context, showTooltip, hideTooltip } = useFloatingContext({\n externallyControlledIsOpen: componentProps.isOpen,\n placement: 'bottom',\n withoutAnimation: true,\n withoutPortal: true,\n // The hook auto-excludes clicks inside the floating element and the reference, so the\n // outside boundary is now { reference, floating } \u2014 no boundary <div> needed.\n // Gated internally on `isOpen`, so it only fires while open.\n onClickOutside: (event) => {\n onClickOutside(event);\n // Closes but does NOT move focus. The user clicked somewhere else and the browser has already put\n // focus where they aimed; pulling it back to the trigger would undo that. Returning focus is a\n // scoped-Escape affordance only \u2014 the same line DSAppPicker and the floating context both draw.\n if (userIsOpen === undefined) hideTooltip();\n },\n /*\n * Passive notification, straight through from the floating context. Handed over rather than\n * reimplemented because the hook is the only place that sees every transition: the trigger click and\n * ArrowDown both go through `showTooltip`, and click-outside, Escape inside the menu and a\n * closeOnClick item all go through `hideTooltip` \u2014 plus a controlled flip of `isOpen`, which no\n * handler in this file observes at all.\n *\n * Notifying does NOT make the consumer responsible for the transition: this stays uncontrolled unless\n * they also supply `isOpen`.\n *\n * The scoped-Escape caveat in the hook's docs does not apply here. A scoped Escape would route to\n * `onEscape` instead of `onClose`, but that path needs `closeOnEscape`, which defaults to false and is\n * not passed \u2014 Escape is handled inside PopupMenuContent and closes via `hideTooltip`, so it surfaces\n * as a normal 'interaction' close. Passing `closeOnEscape` here later would silently punch a hole in\n * `onClose` unless `onEscape` is wired at the same time.\n */\n /*\n * Escape is the floating context's, not this part's. `closeOnEscape` closes the menu and\n * `returnFocusToReference` puts focus back on the trigger \u2014 both were hand-rolled here before, in\n * PopupMenuContent's per-item keydown and in a manual `.focus()`.\n *\n * Gated on being UNCONTROLLED, and that gate is load-bearing rather than tidy: the hook applies\n * `returnFocusToReference` on a scoped Escape whichever side owns the open state. For a controlled\n * consumer the close below is inert, so leaving it on would move focus to the trigger while their\n * menu is still open \u2014 focus outside an open menu. A controlled consumer owns the close, so they own\n * the Escape and the refocus with it.\n */\n closeOnEscape: userIsOpen === undefined,\n returnFocusToReference: true,\n /*\n * A scoped Escape routes HERE and not to `onClose`, so the consumer's close notification has to be\n * re-emitted or it silently stops reporting the most common keyboard close.\n */\n onEscape: (event) => {\n hideTooltip();\n onClose?.({ reason: 'interaction', event, isControlled: userIsOpen !== undefined });\n },\n onOpen,\n onClose,\n });\n\n /*\n * WHICH end of the menu the pending open lands on. Same mechanism as DSAppPicker's `openIntentRef`,\n * scoped to this part: the trigger is the only place that knows which key was pressed, and the seeding\n * happens later, in PopupMenuContent's ref callback. A ref rather than state because nothing renders\n * from it and it must not cause a render of its own between the key and the open.\n */\n const openIntentRef = useRef<'first' | 'last'>('first');\n\n /*\n * ArrowDown opens onto the first item, ArrowUp onto the last \u2014 the menubar convention, and the same\n * split DSAppPicker makes.\n *\n * Enter and Space are absent on purpose: this is a native <button>, so the browser turns them into a\n * click that arrives at handleTriggerOnClick. Handling them here too would open twice.\n *\n * `preventDefault` stops the page scrolling on a key being used to open a widget.\n */\n const handleOnKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.code === 'ArrowDown' || e.code === 'ArrowUp') {\n e.preventDefault();\n openIntentRef.current = e.code === 'ArrowUp' ? 'last' : 'first';\n if (userIsOpen === undefined) showTooltip();\n }\n if (onKeyPress) onKeyPress(e);\n },\n [onKeyPress, showTooltip, userIsOpen],\n );\n\n /*\n * Closes after an item click. No `.focus()` here: returning focus to the trigger is the floating\n * context's job on a scoped Escape, and an item click is not one \u2014 the clicked item is usually\n * navigating away, so yanking focus back to the trigger would fight the user.\n */\n const handleOnClose = useCallback(() => {\n if (userIsOpen === undefined) hideTooltip();\n }, [hideTooltip, userIsOpen]);\n\n const handleTriggerOnClick = useCallback(\n (e: React.MouseEvent) => {\n // Click, Enter and Space all land on the first item; only ArrowUp asks for the other end.\n openIntentRef.current = 'first';\n if (userIsOpen === undefined) showTooltip(e);\n if (onClick) onClick(e);\n },\n [onClick, userIsOpen, showTooltip],\n );\n\n const handleItemClick = useCallback(() => {\n if (closeOnClick && userIsOpen === undefined) handleOnClose();\n }, [closeOnClick, handleOnClose, userIsOpen]);\n\n const handleRefs = useCallback(\n (ref: HTMLButtonElement) => {\n setRef(ref);\n refs.setReference(ref);\n },\n [refs, setRef],\n );\n\n // Explicit and empty, shared by this part's slot render sites: `getOwnerPropsArguments` hydrates\n // function-form slot props and nothing else, and none of these elements have render-time values worth\n // passing. Stated rather than omitted so the answer is always visible at the call site.\n const noSlotArguments = useCallback(() => ({}), []);\n return (\n <StyledPopupMenuContainer\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_ITEM_POPUPMENU_CONTAINER}\n getOwnerProps={getOwnerPropsAwareOfPropsPassedToGlobalHeader}\n // Explicit and empty: this root has no render-time values to hand a function-form slot prop.\n getOwnerPropsArguments={noSlotArguments}\n // The part-level xstyled layer. This root is the only element in the part that can receive it, so it\n // must stay a styled component \u2014 a plain <div> here silently drops every xstyled prop the contract\n // advertises.\n {...useGetXstyledProps(otherProps)}\n >\n <StyledButton\n onClick={handleTriggerOnClick}\n onKeyDown={handleOnKeyDown}\n innerRef={handleRefs}\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_ITEM_BUTTON}\n aria-haspopup\n aria-expanded={userIsOpen ?? isOpen}\n {...useGetGlobalAttributes(otherProps)}\n type=\"button\"\n getOwnerProps={getOwnerPropsAwareOfPropsPassedToGlobalHeader}\n getOwnerPropsArguments={noSlotArguments}\n >\n {Icon && <Icon size=\"m\" />}\n </StyledButton>\n\n {refs.reference ? (\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={userIsOpen ?? isOpen}\n floatingStyles={floatingStyles}\n context={context}\n >\n <PopupMenuContent\n options={options}\n onItemClick={handleItemClick}\n openIntent={openIntentRef.current}\n setIsOpen={hideTooltip}\n popupOnKeyPress={popupOnKeyPress}\n getOwnerPropsAwareOfPropsPassedToGlobalHeader={getOwnerPropsAwareOfPropsPassedToGlobalHeader}\n />\n <PopoverArrow {...arrowStyles} />\n </FloatingWrapper>\n ) : null}\n </StyledPopupMenuContainer>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+KN;AA/KjB,iCAAkE;AAClE,8BAA2D;AAC3D,mBAA2C;AAC3C,uBAA0C;AAC1C,oBAA6B;AAC7B,IAAAA,iBAAyC;AACzC,8BAAiC;AAG1B,MAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAqC;AACnC,QAAM;AAAA,IACJ,iBAAiB,MAAM;AAAA,IACvB;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAMJ,QAAM,EAAE,aAAa,gBAAgB,QAAQ,MAAM,SAAS,aAAa,YAAY,QAAI,+CAAmB;AAAA,IAC1G,4BAA4B,eAAe;AAAA,IAC3C,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,eAAe;AAAA;AAAA;AAAA;AAAA,IAIf,gBAAgB,CAAC,UAAU;AACzB,qBAAe,KAAK;AAIpB,UAAI,eAAe,OAAW,aAAY;AAAA,IAC5C;AAAA;AAAA;AAAA;AAAA;AAA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AM,MAAM;AAAA,EACf;AAKA,QAAM,sBAAkB,0BAAY,OAAO,CAAC,IAAI,CAAC,CAAC;AAClD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,2CAA0B;AAAA,MACvC,eAAe;AAAA,MAEf,wBAAwB;AAAA,MAIvB,OAAG,4CAAmB,UAAU;AAAA,MAEjC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,WAAW;AAAA,YACX,UAAU;AAAA,YACV,eAAa,2CAA0B;AAAA,YACvC,iBAAa;AAAA,YACb,iBAAe,cAAc;AAAA,YAC5B,OAAG,gDAAuB,UAAU;AAAA,YACrC,MAAK;AAAA,YACL,eAAe;AAAA,YACf,wBAAwB;AAAA,YAEvB,kBAAQ,4CAAC,QAAK,MAAK,KAAI;AAAA;AAAA,QAC1B;AAAA,QAEC,KAAK,YACJ;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,KAAK;AAAA,YACf,QAAQ,cAAc;AAAA,YACtB;AAAA,YACA;AAAA,YAEA;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACC;AAAA,kBACA,aAAa;AAAA,kBACb,YAAY,cAAc;AAAA,kBAC1B,WAAW;AAAA,kBACX;AAAA,kBACA;AAAA;AAAA,cACF;AAAA,cACA,4CAAC,2CAAc,GAAG,aAAa;AAAA;AAAA;AAAA,QACjC,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;",
6
+ "names": ["import_styles"]
7
7
  }
@@ -43,20 +43,31 @@ const PopupMenuContent = import_react.default.memo(
43
43
  ({
44
44
  options,
45
45
  onItemClick,
46
- onClose,
46
+ openIntent,
47
47
  popupOnKeyPress,
48
48
  setIsOpen,
49
- ownerProps
49
+ getOwnerPropsAwareOfPropsPassedToGlobalHeader,
50
+ // The part-level global attribute + xstyled layers, forwarded onto the list root below.
51
+ ...restGlobalAndXstyled
50
52
  }) => {
51
53
  const { instanceUID } = (0, import_react.useContext)(import_DSGlobalHeaderContext.DSGlobalHeaderContext);
52
- const { menuRef, setRef, keyboardNavigation } = (0, import_usePopupMenuContent.usePopupMenuContent)({ setIsOpen });
54
+ const focusableItemsCount = options.filter((option) => option.type !== "separator").length;
55
+ const { menuRef, setRef, keyboardNavigation } = (0, import_usePopupMenuContent.usePopupMenuContent)({
56
+ setIsOpen,
57
+ openIntent,
58
+ focusableItemsCount
59
+ });
60
+ const noSlotArguments = () => ({});
53
61
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
62
  import_styles.StyledList,
55
63
  {
56
64
  innerRef: menuRef,
57
65
  role: "menu",
58
66
  "data-testid": import_constants.GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_LIST,
59
- ...ownerProps,
67
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
68
+ getOwnerPropsArguments: noSlotArguments,
69
+ ...(0, import_ds_props_helpers.getGlobalAttributes)(restGlobalAndXstyled),
70
+ ...(0, import_ds_props_helpers.getXstyledProps)(restGlobalAndXstyled),
60
71
  children: options.map((option) => {
61
72
  const { type, Icon, label = "", onClick, Content, ...rest } = option;
62
73
  const globalAttrs = (0, import_ds_props_helpers.getGlobalAttributes)(rest);
@@ -66,7 +77,6 @@ const PopupMenuContent = import_react.default.memo(
66
77
  };
67
78
  const handleKeyDown = (e) => {
68
79
  keyboardNavigation(e);
69
- if (e.code === "Escape") onClose();
70
80
  if (popupOnKeyPress) popupOnKeyPress(e);
71
81
  };
72
82
  switch (type) {
@@ -77,7 +87,8 @@ const PopupMenuContent = import_react.default.memo(
77
87
  role: "none",
78
88
  "data-testid": import_constants.GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_SEPARATOR,
79
89
  ...globalAttrs,
80
- ...ownerProps
90
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
91
+ getOwnerPropsArguments: noSlotArguments
81
92
  },
82
93
  `${instanceUID}-separator-${label}`
83
94
  );
@@ -87,7 +98,8 @@ const PopupMenuContent = import_react.default.memo(
87
98
  {
88
99
  role: "menuitem",
89
100
  "data-testid": import_constants.GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM,
90
- ...ownerProps,
101
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
102
+ getOwnerPropsArguments: noSlotArguments,
91
103
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
104
  import_styles.StyledItemButton,
93
105
  {
@@ -97,7 +109,8 @@ const PopupMenuContent = import_react.default.memo(
97
109
  "data-testid": import_constants.GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM_BUTTON,
98
110
  ...globalAttrs,
99
111
  type: "button",
100
- ...ownerProps,
112
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
113
+ getOwnerPropsArguments: noSlotArguments,
101
114
  children: Content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {})
102
115
  }
103
116
  )
@@ -110,7 +123,8 @@ const PopupMenuContent = import_react.default.memo(
110
123
  {
111
124
  role: "menuitem",
112
125
  "data-testid": import_constants.GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM,
113
- ...ownerProps,
126
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
127
+ getOwnerPropsArguments: noSlotArguments,
114
128
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
115
129
  import_styles.StyledItemButton,
116
130
  {
@@ -120,14 +134,16 @@ const PopupMenuContent = import_react.default.memo(
120
134
  "data-testid": import_constants.GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM_BUTTON,
121
135
  ...globalAttrs,
122
136
  type: "button",
123
- ...ownerProps,
137
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
138
+ getOwnerPropsArguments: noSlotArguments,
124
139
  children: [
125
140
  Icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {}),
126
141
  label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
127
142
  import_styles.StyledLabel,
128
143
  {
129
144
  "data-testid": import_constants.GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM_BUTTON_LABEL,
130
- ...ownerProps,
145
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
146
+ getOwnerPropsArguments: noSlotArguments,
131
147
  children: label
132
148
  }
133
149
  )
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/PopupMenuContent.tsx", "../../../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { getGlobalAttributes } from '@elliemae/ds-props-helpers';\nimport React, { useContext } from 'react';\nimport { DSGlobalHeaderContext } from '../../../../../DSGlobalHeaderContext.js';\nimport { GLOBAL_HEADER_DATA_TESTID } from '../../../../../constants/index.js';\nimport type { DSGlobalHeaderT } from '../../../../../react-desc-prop-types.js';\nimport { StyledItemButton, StyledItemContainer, StyledLabel, StyledList, StyledSeparator } from './styles.js';\nimport { usePopupMenuContent } from './usePopupMenuContent.js';\n\nexport const PopupMenuContent = React.memo(\n ({\n options,\n onItemClick,\n onClose,\n popupOnKeyPress,\n setIsOpen,\n ownerProps,\n }: DSGlobalHeaderT.PopupMenuContentProps): JSX.Element => {\n const { instanceUID } = useContext(DSGlobalHeaderContext);\n\n const { menuRef, setRef, keyboardNavigation } = usePopupMenuContent({ setIsOpen });\n\n return (\n <StyledList\n innerRef={menuRef}\n role=\"menu\"\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_LIST}\n {...ownerProps}\n >\n {options.map((option) => {\n const { type, Icon, label = '', onClick, Content, ...rest } = option;\n\n const globalAttrs = getGlobalAttributes(rest);\n\n const handleClick = (e: React.MouseEvent) => {\n onItemClick();\n if (onClick) onClick(e);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n keyboardNavigation(e);\n if (e.code === 'Escape') onClose();\n if (popupOnKeyPress) popupOnKeyPress(e);\n };\n\n switch (type) {\n case 'separator':\n return (\n <StyledSeparator\n key={`${instanceUID}-separator-${label}`}\n role=\"none\"\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_SEPARATOR}\n {...globalAttrs}\n {...ownerProps}\n />\n );\n case 'custom':\n return (\n <StyledItemContainer\n key={`${instanceUID}-popup-${label}`}\n role=\"menuitem\"\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM}\n {...ownerProps}\n >\n <StyledItemButton\n innerRef={setRef}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM_BUTTON}\n {...globalAttrs}\n type=\"button\"\n {...ownerProps}\n >\n {Content && <Content />}\n </StyledItemButton>\n </StyledItemContainer>\n );\n default:\n return (\n <StyledItemContainer\n key={`${instanceUID}-popup-${label}`}\n role=\"menuitem\"\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM}\n {...ownerProps}\n >\n <StyledItemButton\n innerRef={setRef}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM_BUTTON}\n {...globalAttrs}\n type=\"button\"\n {...ownerProps}\n >\n {Icon && <Icon />}\n {label && (\n <StyledLabel\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM_BUTTON_LABEL}\n {...ownerProps}\n >\n {label}\n </StyledLabel>\n )}\n </StyledItemButton>\n </StyledItemContainer>\n );\n }\n })}\n </StyledList>\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+CP;AA/ChB,8BAAoC;AACpC,mBA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AAa,2CAA0B;AAAA,sBACtC,GAAG;AAAA,sBACJ,MAAK;AAAA,sBACJ,GAAG;AAAA,sBAEH,qBAAW,4CAAC,WAAQ;AAAA;AAAA,kBACvB;AAAA;AAAA,gBAfK,GAAG,WAAW,UAAU,KAAK;AAAA,cAgBpC;AAAA,YAEJ;AACE,qBACE;AAAA,gBAAC;AAAA;AAAA,kBAEC,MAAK;AAAA,kBACL,eAAa,2CAA0B;AAAA,kBACtC,GAAG;AAAA,kBAEJ;AAAA,oBAAC;AAAA;AAAA,sBACC,UAAU;AAAA,sBACV,SAAS;AAAA,sBACT,WAAW;AAAA,sBACX,eAAa,2CAA0B;AAAA,sBACtC,GAAG;AAAA,sBACJ,MAAK;AAAA,sBACJ,GAAG;AAAA,sBAEH;AAAA,gCAAQ,4CAAC,QAAK;AAAA,wBACd,SACC;AAAA,0BAAC;AAAA;AAAA,4BACC,eAAa,2CAA0B;AAAA,4BACtC,GAAG;AAAA,4BAEH;AAAA;AAAA,wBACH;AAAA;AAAA;AAAA,kBAEJ;AAAA;AAAA,gBAvBK,GAAG,WAAW,UAAU,KAAK;AAAA,cAwBpC;AAAA,UAEN;AAAA,QACF,CAAC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;",
4
+ "sourcesContent": ["import { getGlobalAttributes, getXstyledProps } from '@elliemae/ds-props-helpers';\nimport React, { useContext } from 'react';\nimport { DSGlobalHeaderContext } from '../../../../../DSGlobalHeaderContext.js';\nimport { GLOBAL_HEADER_DATA_TESTID } from '../../../../../constants/index.js';\nimport { StyledItemButton, StyledItemContainer, StyledLabel, StyledList, StyledSeparator } from './styles.js';\nimport type { PopupMenuContentT } from './react-desc-prop-types.js';\nimport { usePopupMenuContent } from './usePopupMenuContent.js';\n\nexport const PopupMenuContent = React.memo(\n ({\n options,\n onItemClick,\n openIntent,\n popupOnKeyPress,\n setIsOpen,\n getOwnerPropsAwareOfPropsPassedToGlobalHeader,\n // The part-level global attribute + xstyled layers, forwarded onto the list root below.\n ...restGlobalAndXstyled\n }: PopupMenuContentT.Props): JSX.Element => {\n const { instanceUID } = useContext(DSGlobalHeaderContext);\n\n // Separators are rendered as `role=\"none\"` and carry no ref, so they are excluded from the count the\n // seeding compares against.\n const focusableItemsCount = options.filter((option) => option.type !== 'separator').length;\n\n const { menuRef, setRef, keyboardNavigation } = usePopupMenuContent({\n setIsOpen,\n openIntent,\n focusableItemsCount,\n });\n\n /*\n * Explicit and empty at every slot render site below. `getOwnerPropsArguments` hydrates function-form\n * slot props and nothing else, so \"no arguments\" is worth stating rather than leaving to inference.\n *\n * The per-option sites (item container, item button, label, separator) are where a real payload would\n * go \u2014 ds-fast-list hands its rows `{ index: getId(index) }` for exactly this. What a per-option payload\n * should contain is a consumer-facing contract decision, so adding one is a deliberate API change, not\n * a fill-in-the-blank.\n */\n const noSlotArguments = () => ({});\n\n return (\n <StyledList\n innerRef={menuRef}\n role=\"menu\"\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_LIST}\n getOwnerProps={getOwnerPropsAwareOfPropsPassedToGlobalHeader}\n getOwnerPropsArguments={noSlotArguments}\n {...getGlobalAttributes(restGlobalAndXstyled)}\n {...getXstyledProps(restGlobalAndXstyled)}\n >\n {options.map((option) => {\n const { type, Icon, label = '', onClick, Content, ...rest } = option;\n\n const globalAttrs = getGlobalAttributes(rest);\n\n const handleClick = (e: React.MouseEvent) => {\n onItemClick();\n if (onClick) onClick(e);\n };\n\n /*\n * No Escape branch here on purpose. Escape is the floating context's, via `closeOnEscape` +\n * `returnFocusToReference` \u2014 it closes the menu AND returns focus to the trigger, which this\n * part used to hand-roll. Re-adding a local Escape would close it twice and fight that focus\n * return.\n */\n const handleKeyDown = (e: React.KeyboardEvent) => {\n keyboardNavigation(e);\n if (popupOnKeyPress) popupOnKeyPress(e);\n };\n\n switch (type) {\n case 'separator':\n return (\n <StyledSeparator\n key={`${instanceUID}-separator-${label}`}\n role=\"none\"\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_SEPARATOR}\n {...globalAttrs}\n getOwnerProps={getOwnerPropsAwareOfPropsPassedToGlobalHeader}\n getOwnerPropsArguments={noSlotArguments}\n />\n );\n case 'custom':\n return (\n <StyledItemContainer\n key={`${instanceUID}-popup-${label}`}\n role=\"menuitem\"\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM}\n getOwnerProps={getOwnerPropsAwareOfPropsPassedToGlobalHeader}\n getOwnerPropsArguments={noSlotArguments}\n >\n <StyledItemButton\n innerRef={setRef}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM_BUTTON}\n {...globalAttrs}\n type=\"button\"\n getOwnerProps={getOwnerPropsAwareOfPropsPassedToGlobalHeader}\n getOwnerPropsArguments={noSlotArguments}\n >\n {Content && <Content />}\n </StyledItemButton>\n </StyledItemContainer>\n );\n default:\n return (\n <StyledItemContainer\n key={`${instanceUID}-popup-${label}`}\n role=\"menuitem\"\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM}\n getOwnerProps={getOwnerPropsAwareOfPropsPassedToGlobalHeader}\n getOwnerPropsArguments={noSlotArguments}\n >\n <StyledItemButton\n innerRef={setRef}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM_BUTTON}\n {...globalAttrs}\n type=\"button\"\n getOwnerProps={getOwnerPropsAwareOfPropsPassedToGlobalHeader}\n getOwnerPropsArguments={noSlotArguments}\n >\n {Icon && <Icon />}\n {label && (\n <StyledLabel\n data-testid={GLOBAL_HEADER_DATA_TESTID.MENUBAR_POPUP_MENU_ITEM_BUTTON_LABEL}\n getOwnerProps={getOwnerPropsAwareOfPropsPassedToGlobalHeader}\n getOwnerPropsArguments={noSlotArguments}\n >\n {label}\n </StyledLabel>\n )}\n </StyledItemButton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AA,cA2BpC;AAAA,UAEN;AAAA,QACF,CAAC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var react_desc_prop_types_exports = {};
30
+ __export(react_desc_prop_types_exports, {
31
+ PopupMenuContentPropTypes: () => PopupMenuContentPropTypes,
32
+ PopupMenuContentPropTypesSchema: () => PopupMenuContentPropTypesSchema
33
+ });
34
+ module.exports = __toCommonJS(react_desc_prop_types_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
37
+ const PopupMenuContentPropTypes = {
38
+ ...import_ds_props_helpers.globalAttributesPropTypes,
39
+ ...import_ds_props_helpers.xstyledPropTypes,
40
+ options: import_ds_props_helpers.PropTypes.array.description(
41
+ "Consumer-authored menu entries. Format: [{ type?, Icon?, label?, onClick?, Content?, ...globalAttributes }]"
42
+ ).isRequired,
43
+ onItemClick: import_ds_props_helpers.PropTypes.func.description("Invoked after a menu item click so the wrapper can apply its closeOnClick policy").signature("(() => void )").isRequired,
44
+ openIntent: import_ds_props_helpers.PropTypes.string.description('Which end of the menu this open lands on: "first" or "last"').isRequired,
45
+ setIsOpen: import_ds_props_helpers.PropTypes.func.description("The floating context's hide function").signature("(() => void )").isRequired,
46
+ getOwnerPropsAwareOfPropsPassedToGlobalHeader: import_ds_props_helpers.PropTypes.func.description(
47
+ "Returns the props passed to DSGlobalHeader, so getPartProps can look up this slot consumer-supplied props. Must come from DSGlobalHeader; the function-form hydrator is supplied per slot render site instead"
48
+ ).signature("(() => Partial<DSGlobalHeaderT.DefaultProps> )").isRequired,
49
+ popupOnKeyPress: import_ds_props_helpers.PropTypes.func.description("Consumer key handler, invoked on menu items alongside the internal keyboard navigation").signature("(( event: React.KeyboardEvent ) => void )")
50
+ };
51
+ const PopupMenuContentPropTypesSchema = PopupMenuContentPropTypes;
52
+ //# sourceMappingURL=react-desc-prop-types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/react-desc-prop-types.ts", "../../../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type React from 'react';\nimport type { DSGlobalHeaderT } from '../../../../../react-desc-prop-types.js';\n\n/*\n * Relocated here from DSGlobalHeaderT.PopupMenuContentProps, per the convention every other part in the\n * repo follows. Consumed by PopupMenuContent.tsx.\n *\n * This is the innermost of the three Popup* contracts and the one least likely to be a consumer's\n * business: it is what the PopupMenu wrapper hands to its own menu-content renderer. Every prop except\n * `options` is machinery the wrapper generated. `options` is the one consumer-authored value on it,\n * and it arrives already unwrapped from DSGlobalHeaderT.PopupMenuComponentProps \u2014 which is exactly why\n * having both `PopupMenuComponentProps` and `PopupMenuContentProps` visible side by side in the public\n * namespace was misleading: they look like a pair a developer chooses between, and they are not.\n *\n * IoC layers: the slot layer via `getOwnerPropsAwareOfPropsPassedToGlobalHeader` (fully wired \u2014 this part\n * passes it to the list, items, item buttons, labels and separators, each with its own explicit empty\n * hydrator), per-entry global attributes via `options` items, and the part-level global attribute /\n * xstyled layer below.\n *\n * KNOWN GAP \u2014 the part-level global attribute + xstyled layer is the one thing in this file that was an\n * addition rather than a transcription: the old DSGlobalHeaderT.PopupMenuContentProps did not extend\n * GlobalAttributesT at all, which made this the only out-of-the-box part missing that layer and left its\n * PropTypes unable to spread globalAttributesPropTypes coherently. Nothing forwards either to the root\n * list yet, so for this part both remain a statement of the intended contract rather than of behaviour.\n * Per-entry attributes on `options` items DO reach the DOM and are covered by the pillar tests.\n *\n * No slots of its own \u2014 see the AppPicker sibling file for why.\n */\nexport declare namespace PopupMenuContentT {\n export interface RequiredProps {\n /** The consumer-authored menu entries, unwrapped from componentProps by the PopupMenu wrapper. */\n options: DSGlobalHeaderT.PopupMenuContentItem[];\n /** Wrapper callback: applies the item's closeOnClick policy after a menu item is clicked. */\n onItemClick: () => void;\n /** Wrapper callback: closes the menu and returns focus to the trigger. */\n /** Which end of the menu this open lands on \u2014 see usePopupMenuContent. */\n openIntent: 'first' | 'last';\n /** Wrapper callback: the floating context's hide function. */\n setIsOpen: () => void;\n /*\n * The slot lookup table, and the only half of the slot IoC layer that may be drilled down \u2014 the\n * function-form hydrator is supplied per slot render site instead. See the AppPicker sibling for the\n * full reasoning and the getPartProps mechanics behind the name.\n */\n getOwnerPropsAwareOfPropsPassedToGlobalHeader: () => Partial<DSGlobalHeaderT.DefaultProps>;\n }\n\n /*\n * Intentionally empty, and intentionally still declared \u2014 \"this part has no default props, do not\n * expect them\". See the AppPicker sibling for the full reasoning.\n */\n export interface DefaultProps {}\n\n export interface OptionalProps {\n /*\n * Optional, matching the runtime: PopupMenuContent guards it (`if (popupOnKeyPress)`) and consumers\n * routinely omit it. It was declared required, which was simply wrong \u2014 the type claimed a guarantee\n * the code never relied on, and every consumer omitting it was type-lying to satisfy the compiler.\n */\n popupOnKeyPress?: (event: React.KeyboardEvent) => void;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLUListElement>,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n keyof RequiredProps | keyof DefaultProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLUListElement>,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n keyof RequiredProps | keyof DefaultProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const PopupMenuContentPropTypes: DSPropTypesSchema<PopupMenuContentT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n options: PropTypes.array.description(\n 'Consumer-authored menu entries. Format: [{ type?, Icon?, label?, onClick?, Content?, ...globalAttributes }]',\n ).isRequired,\n onItemClick: PropTypes.func\n .description('Invoked after a menu item click so the wrapper can apply its closeOnClick policy')\n .signature('(() => void )').isRequired,\n openIntent: PropTypes.string.description('Which end of the menu this open lands on: \"first\" or \"last\"').isRequired,\n setIsOpen: PropTypes.func.description(\"The floating context's hide function\").signature('(() => void )').isRequired,\n getOwnerPropsAwareOfPropsPassedToGlobalHeader: PropTypes.func\n .description(\n 'Returns the props passed to DSGlobalHeader, so getPartProps can look up this slot consumer-supplied props. Must come from DSGlobalHeader; the function-form hydrator is supplied per slot render site instead',\n )\n .signature('(() => Partial<DSGlobalHeaderT.DefaultProps> )').isRequired,\n popupOnKeyPress: PropTypes.func\n .description('Consumer key handler, invoked on menu items alongside the internal keyboard navigation')\n .signature('(( event: React.KeyboardEvent ) => void )'),\n};\n\nexport const PopupMenuContentPropTypesSchema =\n PopupMenuContentPropTypes as unknown as ValidationMap<PopupMenuContentT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAAuE;AAwFhE,MAAM,4BAAwE;AAAA,EACnF,GAAG;AAAA,EACH,GAAG;AAAA,EACH,SAAS,kCAAU,MAAM;AAAA,IACvB;AAAA,EACF,EAAE;AAAA,EACF,aAAa,kCAAU,KACpB,YAAY,kFAAkF,EAC9F,UAAU,eAAe,EAAE;AAAA,EAC9B,YAAY,kCAAU,OAAO,YAAY,6DAA6D,EAAE;AAAA,EACxG,WAAW,kCAAU,KAAK,YAAY,sCAAsC,EAAE,UAAU,eAAe,EAAE;AAAA,EACzG,+CAA+C,kCAAU,KACtD;AAAA,IACC;AAAA,EACF,EACC,UAAU,gDAAgD,EAAE;AAAA,EAC/D,iBAAiB,kCAAU,KACxB,YAAY,wFAAwF,EACpG,UAAU,2CAA2C;AAC1D;AAEO,MAAM,kCACX;",
6
+ "names": []
7
+ }
@@ -33,24 +33,32 @@ __export(usePopupMenuContent_exports, {
33
33
  module.exports = __toCommonJS(usePopupMenuContent_exports);
34
34
  var React = __toESM(require("react"));
35
35
  var import_react = require("react");
36
- const usePopupMenuContent = ({ setIsOpen }) => {
36
+ const usePopupMenuContent = ({ setIsOpen, openIntent, focusableItemsCount }) => {
37
37
  const menuRef = (0, import_react.useRef)(null);
38
38
  const allMenuItemsRef = (0, import_react.useRef)([]);
39
- const setRef = (0, import_react.useCallback)((ref) => {
40
- if (ref && !allMenuItemsRef.current.includes(ref)) {
41
- allMenuItemsRef.current.push(ref);
42
- }
43
- allMenuItemsRef.current.forEach((item, index) => {
44
- if (index === 0) {
45
- item?.setAttribute?.("tabindex", "0");
46
- } else {
47
- item?.setAttribute?.("tabindex", "-1");
39
+ const hasSeededFocusRef = (0, import_react.useRef)(false);
40
+ const setRef = (0, import_react.useCallback)(
41
+ (ref) => {
42
+ if (ref && !allMenuItemsRef.current.includes(ref)) {
43
+ allMenuItemsRef.current.push(ref);
44
+ }
45
+ allMenuItemsRef.current.forEach((item, index) => {
46
+ if (index === 0) {
47
+ item?.setAttribute?.("tabindex", "0");
48
+ } else {
49
+ item?.setAttribute?.("tabindex", "-1");
50
+ }
51
+ });
52
+ if (!ref || hasSeededFocusRef.current) return;
53
+ const hasReachedSeedTarget = openIntent === "last" ? allMenuItemsRef.current.length === focusableItemsCount : allMenuItemsRef.current[0] === ref;
54
+ if (hasReachedSeedTarget) {
55
+ hasSeededFocusRef.current = true;
56
+ const target = openIntent === "last" ? allMenuItemsRef.current[focusableItemsCount - 1] : ref;
57
+ target?.focus();
48
58
  }
49
- });
50
- }, []);
51
- (0, import_react.useEffect)(() => {
52
- setTimeout(() => allMenuItemsRef.current?.[0]?.focus(), 0);
53
- }, []);
59
+ },
60
+ [openIntent, focusableItemsCount]
61
+ );
54
62
  const keyboardNavigation = (0, import_react.useCallback)(
55
63
  (e) => {
56
64
  if (e.code === "Tab") {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/parts/Toolbar/outOfTheBox/PopupMenu/menuContent/usePopupMenuContent.tsx", "../../../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { useRef, useCallback, useEffect } from 'react';\n\ninterface UsePopupMenuContentT {\n setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;\n}\n\nexport const usePopupMenuContent = ({ setIsOpen }: UsePopupMenuContentT) => {\n const menuRef = useRef<HTMLUListElement>(null);\n const allMenuItemsRef = useRef<HTMLButtonElement[]>([]);\n\n const setRef = useCallback((ref: HTMLButtonElement) => {\n if (ref && !allMenuItemsRef.current.includes(ref)) {\n allMenuItemsRef.current.push(ref);\n }\n\n allMenuItemsRef.current.forEach((item, index) => {\n if (index === 0) {\n item?.setAttribute?.('tabindex', '0');\n } else {\n item?.setAttribute?.('tabindex', '-1');\n }\n });\n }, []);\n\n useEffect(() => {\n setTimeout(() => allMenuItemsRef.current?.[0]?.focus(), 0);\n }, []);\n\n const keyboardNavigation = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.code === 'Tab') {\n setIsOpen(false);\n } else {\n const currentIndex = allMenuItemsRef.current.indexOf(e.target as HTMLButtonElement);\n const allRefsLength = allMenuItemsRef.current.length;\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n if (currentIndex < allRefsLength - 1) {\n allMenuItemsRef.current[currentIndex + 1]?.focus?.();\n } else {\n allMenuItemsRef.current[0]?.focus?.();\n }\n }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n if (currentIndex === 0) {\n allMenuItemsRef.current[allRefsLength - 1]?.focus?.();\n } else {\n allMenuItemsRef.current[currentIndex - 1]?.focus?.();\n }\n }\n }\n },\n [setIsOpen],\n );\n\n return {\n menuRef,\n setRef,\n keyboardNavigation,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+C;AAMxC,MAAM,sBAAsB,CAAC,EAAE,UAAU,MAA4B;AAC1E,QAAM,cAAU,qBAAyB,IAAI;AAC7C,QAAM,sBAAkB,qBAA4B,CAAC,CAAC;AAEtD,QAAM,aAAS,0BAAY,CAAC,QAA2B;AACrD,QAAI,OAAO,CAAC,gBAAgB,QAAQ,SAAS,GAAG,GAAG;AACjD,sBAAgB,QAAQ,KAAK,GAAG;AAAA,IAClC;AAEA,oBAAgB,QAAQ,QAAQ,CAAC,MAAM,UAAU;AAC/C,UAAI,UAAU,GAAG;AACf,cAAM,eAAe,YAAY,GAAG;AAAA,MACtC,OAAO;AACL,cAAM,eAAe,YAAY,IAAI;AAAA,MACvC;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,8BAAU,MAAM;AACd,eAAW,MAAM,gBAAgB,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC;AAAA,EAC3D,GAAG,CAAC,CAAC;AAEL,QAAM,yBAAqB;AAAA,IACzB,CAAC,MAA2B;AAC1B,UAAI,EAAE,SAAS,OAAO;AACpB,kBAAU,KAAK;AAAA,MACjB,OAAO;AACL,cAAM,eAAe,gBAAgB,QAAQ,QAAQ,EAAE,MAA2B;AAClF,cAAM,gBAAgB,gBAAgB,QAAQ;AAC9C,YAAI,EAAE,QAAQ,aAAa;AACzB,YAAE,eAAe;AACjB,cAAI,eAAe,gBAAgB,GAAG;AACpC,4BAAgB,QAAQ,eAAe,CAAC,GAAG,QAAQ;AAAA,UACrD,OAAO;AACL,4BAAgB,QAAQ,CAAC,GAAG,QAAQ;AAAA,UACtC;AAAA,QACF;AACA,YAAI,EAAE,QAAQ,WAAW;AACvB,YAAE,eAAe;AACjB,cAAI,iBAAiB,GAAG;AACtB,4BAAgB,QAAQ,gBAAgB,CAAC,GAAG,QAAQ;AAAA,UACtD,OAAO;AACL,4BAAgB,QAAQ,eAAe,CAAC,GAAG,QAAQ;AAAA,UACrD;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { useRef, useCallback } from 'react';\n\ninterface UsePopupMenuContentT {\n setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;\n /**\n * Which end of the menu this open should land on. Mirrors DSAppPicker's open-intent mechanism, scoped\n * to this part: the trigger records WHICH key opened the menu and the seeding below reads it \u2014 ArrowUp\n * lands on the last item, everything else on the first.\n */\n openIntent: 'first' | 'last';\n /** How many focusable items the menu mounts. Separators are not focusable and are excluded. */\n focusableItemsCount: number;\n}\n\nexport const usePopupMenuContent = ({ setIsOpen, openIntent, focusableItemsCount }: UsePopupMenuContentT) => {\n const menuRef = useRef<HTMLUListElement>(null);\n const allMenuItemsRef = useRef<HTMLButtonElement[]>([]);\n // Seeded once per mount of the menu content. A ref rather than state because nothing renders from it.\n const hasSeededFocusRef = useRef(false);\n\n const setRef = useCallback(\n (ref: HTMLButtonElement) => {\n if (ref && !allMenuItemsRef.current.includes(ref)) {\n allMenuItemsRef.current.push(ref);\n }\n\n allMenuItemsRef.current.forEach((item, index) => {\n if (index === 0) {\n item?.setAttribute?.('tabindex', '0');\n } else {\n item?.setAttribute?.('tabindex', '-1');\n }\n });\n\n /*\n * Initial focus, seeded from this ref callback \u2014 the correct place for it, because the callback is\n * guaranteed to run once the node exists. Do not move this into an effect or wrap it in a timer; per\n * antipattern_focus_management.md there is nothing left to wait for, and both reintroduce a race this\n * has no need for.\n *\n * `first` can seed the moment item 0 attaches. `last` cannot: the ref callbacks fire one per item and\n * nothing else here knows when the set is complete, which is why the count is passed in rather than\n * inferred. Comparing against it keeps the decision inside the callback instead of deferring it.\n *\n * Seeds once per mount of the menu content, which is why the guard ref exists.\n */\n if (!ref || hasSeededFocusRef.current) return;\n\n const hasReachedSeedTarget =\n openIntent === 'last'\n ? allMenuItemsRef.current.length === focusableItemsCount\n : allMenuItemsRef.current[0] === ref;\n\n if (hasReachedSeedTarget) {\n hasSeededFocusRef.current = true;\n const target = openIntent === 'last' ? allMenuItemsRef.current[focusableItemsCount - 1] : ref;\n target?.focus();\n }\n },\n [openIntent, focusableItemsCount],\n );\n\n const keyboardNavigation = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.code === 'Tab') {\n setIsOpen(false);\n } else {\n const currentIndex = allMenuItemsRef.current.indexOf(e.target as HTMLButtonElement);\n const allRefsLength = allMenuItemsRef.current.length;\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n if (currentIndex < allRefsLength - 1) {\n allMenuItemsRef.current[currentIndex + 1]?.focus?.();\n } else {\n allMenuItemsRef.current[0]?.focus?.();\n }\n }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n if (currentIndex === 0) {\n allMenuItemsRef.current[allRefsLength - 1]?.focus?.();\n } else {\n allMenuItemsRef.current[currentIndex - 1]?.focus?.();\n }\n }\n }\n },\n [setIsOpen],\n );\n\n return {\n menuRef,\n setRef,\n keyboardNavigation,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAoC;AAc7B,MAAM,sBAAsB,CAAC,EAAE,WAAW,YAAY,oBAAoB,MAA4B;AAC3G,QAAM,cAAU,qBAAyB,IAAI;AAC7C,QAAM,sBAAkB,qBAA4B,CAAC,CAAC;AAEtD,QAAM,wBAAoB,qBAAO,KAAK;AAEtC,QAAM,aAAS;AAAA,IACb,CAAC,QAA2B;AAC1B,UAAI,OAAO,CAAC,gBAAgB,QAAQ,SAAS,GAAG,GAAG;AACjD,wBAAgB,QAAQ,KAAK,GAAG;AAAA,MAClC;AAEA,sBAAgB,QAAQ,QAAQ,CAAC,MAAM,UAAU;AAC/C,YAAI,UAAU,GAAG;AACf,gBAAM,eAAe,YAAY,GAAG;AAAA,QACtC,OAAO;AACL,gBAAM,eAAe,YAAY,IAAI;AAAA,QACvC;AAAA,MACF,CAAC;AAcD,UAAI,CAAC,OAAO,kBAAkB,QAAS;AAEvC,YAAM,uBACJ,eAAe,SACX,gBAAgB,QAAQ,WAAW,sBACnC,gBAAgB,QAAQ,CAAC,MAAM;AAErC,UAAI,sBAAsB;AACxB,0BAAkB,UAAU;AAC5B,cAAM,SAAS,eAAe,SAAS,gBAAgB,QAAQ,sBAAsB,CAAC,IAAI;AAC1F,gBAAQ,MAAM;AAAA,MAChB;AAAA,IACF;AAAA,IACA,CAAC,YAAY,mBAAmB;AAAA,EAClC;AAEA,QAAM,yBAAqB;AAAA,IACzB,CAAC,MAA2B;AAC1B,UAAI,EAAE,SAAS,OAAO;AACpB,kBAAU,KAAK;AAAA,MACjB,OAAO;AACL,cAAM,eAAe,gBAAgB,QAAQ,QAAQ,EAAE,MAA2B;AAClF,cAAM,gBAAgB,gBAAgB,QAAQ;AAC9C,YAAI,EAAE,QAAQ,aAAa;AACzB,YAAE,eAAe;AACjB,cAAI,eAAe,gBAAgB,GAAG;AACpC,4BAAgB,QAAQ,eAAe,CAAC,GAAG,QAAQ;AAAA,UACrD,OAAO;AACL,4BAAgB,QAAQ,CAAC,GAAG,QAAQ;AAAA,UACtC;AAAA,QACF;AACA,YAAI,EAAE,QAAQ,WAAW;AACvB,YAAE,eAAe;AACjB,cAAI,iBAAiB,GAAG;AACtB,4BAAgB,QAAQ,gBAAgB,CAAC,GAAG,QAAQ;AAAA,UACtD,OAAO;AACL,4BAAgB,QAAQ,eAAe,CAAC,GAAG,QAAQ;AAAA,UACrD;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var react_desc_prop_types_exports = {};
30
+ __export(react_desc_prop_types_exports, {
31
+ PopupMenuPropTypes: () => PopupMenuPropTypes,
32
+ PopupMenuPropTypesSchema: () => PopupMenuPropTypesSchema
33
+ });
34
+ module.exports = __toCommonJS(react_desc_prop_types_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
37
+ const PopupMenuPropTypes = {
38
+ ...import_ds_props_helpers.globalAttributesPropTypes,
39
+ ...import_ds_props_helpers.xstyledPropTypes,
40
+ componentProps: import_ds_props_helpers.PropTypes.object.description(
41
+ "The consumer-authored popup menu configuration: options, isOpen, closeOnClick and the key handlers"
42
+ ).isRequired,
43
+ getOwnerPropsAwareOfPropsPassedToGlobalHeader: import_ds_props_helpers.PropTypes.func.description(
44
+ "Returns the props passed to DSGlobalHeader, so getPartProps can look up this slot consumer-supplied props. Must come from DSGlobalHeader; the function-form hydrator is supplied per slot render site instead"
45
+ ).signature("(() => Partial<DSGlobalHeaderT.DefaultProps> )").isRequired,
46
+ setRef: import_ds_props_helpers.PropTypes.func.description("Registers the trigger node with the toolbar focus management for arrow-key navigation").signature("(( ref: HTMLElement ) => void )").isRequired,
47
+ Icon: import_ds_props_helpers.PropTypes.func.description("Icon rendered inside the trigger button"),
48
+ onClick: import_ds_props_helpers.PropTypes.func.description("Consumer click handler for the trigger, invoked alongside the internal open/close toggle").signature("(( event: React.MouseEvent ) => void )"),
49
+ title: import_ds_props_helpers.PropTypes.string.description(
50
+ "Receives the toolbar item label; printed as the HTML title attribute on the trigger"
51
+ )
52
+ };
53
+ const PopupMenuPropTypesSchema = PopupMenuPropTypes;
54
+ //# sourceMappingURL=react-desc-prop-types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/parts/Toolbar/outOfTheBox/PopupMenu/react-desc-prop-types.ts", "../../../../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport type React from 'react';\nimport type { DSGlobalHeaderT } from '../../../../react-desc-prop-types.js';\n\n/*\n * Relocated here from DSGlobalHeaderT.PopupProps, per the convention every other part in the repo\n * follows. Consumed by PopupMenu.tsx.\n *\n * This namespace describes what DSGlobalHeader passes DOWN to its own out-of-the-box Popup Menu\n * wrapper. It is NOT the shape an application developer authors \u2014 that is\n * DSGlobalHeaderT.PopupMenuItem (the toolbar config entry) and, inside it,\n * DSGlobalHeaderT.PopupMenuComponentProps. `setRef` and\n * `getOwnerPropsAwareOfPropsPassedToGlobalHeader` are generated by the widget and the developer is not\n * meant to know about them.\n *\n * The old name is worth losing on the way: `PopupProps` sat a word away from `PopupMenuItem`,\n * `PopupMenuComponentProps` and `PopupMenuContentProps` in the same namespace \u2014 the first two of which\n * ARE consumer-authored, while the third was internal and has been relocated to menuContent/ alongside\n * this one. `PopupMenuT.Props`, scoped to this directory, cannot be mistaken for any of them.\n *\n * All three IoC layers present: item-level global attributes onto the trigger, the slot layer via\n * `getOwnerPropsAwareOfPropsPassedToGlobalHeader`, and `componentProps` for the menu's own contract.\n *\n * No slots of its own \u2014 see the AppPicker sibling file for why (published slot surface stays under the\n * parent's name).\n *\n * KNOWN GAP \u2014 xstyled props are declared and not forwarded, as in every sibling part. See the AppPicker\n * file for the full statement; this part is additionally the one with no styled root to forward them to,\n * because PopupMenu.tsx's outermost element is a bare <div>.\n */\nexport declare namespace PopupMenuT {\n export interface RequiredProps {\n /** The consumer-authored configuration object for this toolbar item. */\n componentProps: DSGlobalHeaderT.PopupMenuComponentProps;\n /*\n * The slot lookup table, and the only half of the slot IoC layer that may be drilled down \u2014 the\n * function-form hydrator is supplied per slot render site instead. See the AppPicker sibling for the\n * full reasoning and the getPartProps mechanics behind the name.\n */\n getOwnerPropsAwareOfPropsPassedToGlobalHeader: () => Partial<DSGlobalHeaderT.DefaultProps>;\n /** Focus-management registration, supplied by useGlobalHeaderToolbar for arrow-key navigation. */\n setRef: (ref: HTMLElement) => void;\n }\n\n /*\n * Intentionally empty, and intentionally still declared \u2014 \"this part has no default props, do not\n * expect them\". See the AppPicker sibling for the full reasoning.\n */\n export interface DefaultProps {}\n\n export interface OptionalProps {\n Icon?: React.ComponentType<SvgIconT.Props>;\n onClick?: (event: React.MouseEvent) => void;\n /*\n * Carries the toolbar item's `label`: GlobalHeaderToolbar renders <PopupMenu title={label} .../>.\n * Faithful to the current declaration, including its standing note that landing this in the HTML\n * `title` attribute was probably not intended but is kept to avoid a breaking change.\n */\n title?: string;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n keyof RequiredProps | keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n keyof RequiredProps | keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const PopupMenuPropTypes: DSPropTypesSchema<PopupMenuT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n componentProps: PropTypes.object.description(\n 'The consumer-authored popup menu configuration: options, isOpen, closeOnClick and the key handlers',\n ).isRequired,\n getOwnerPropsAwareOfPropsPassedToGlobalHeader: PropTypes.func\n .description(\n 'Returns the props passed to DSGlobalHeader, so getPartProps can look up this slot consumer-supplied props. Must come from DSGlobalHeader; the function-form hydrator is supplied per slot render site instead',\n )\n .signature('(() => Partial<DSGlobalHeaderT.DefaultProps> )').isRequired,\n setRef: PropTypes.func\n .description('Registers the trigger node with the toolbar focus management for arrow-key navigation')\n .signature('(( ref: HTMLElement ) => void )').isRequired,\n Icon: PropTypes.func.description('Icon rendered inside the trigger button'),\n onClick: PropTypes.func\n .description('Consumer click handler for the trigger, invoked alongside the internal open/close toggle')\n .signature('(( event: React.MouseEvent ) => void )'),\n title: PropTypes.string.description(\n 'Receives the toolbar item label; printed as the HTML title attribute on the trigger',\n ),\n};\n\nexport const PopupMenuPropTypesSchema = PopupMenuPropTypes as unknown as ValidationMap<PopupMenuT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAAuE;AAuFhE,MAAM,qBAA0D;AAAA,EACrE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,gBAAgB,kCAAU,OAAO;AAAA,IAC/B;AAAA,EACF,EAAE;AAAA,EACF,+CAA+C,kCAAU,KACtD;AAAA,IACC;AAAA,EACF,EACC,UAAU,gDAAgD,EAAE;AAAA,EAC/D,QAAQ,kCAAU,KACf,YAAY,uFAAuF,EACnG,UAAU,iCAAiC,EAAE;AAAA,EAChD,MAAM,kCAAU,KAAK,YAAY,yCAAyC;AAAA,EAC1E,SAAS,kCAAU,KAChB,YAAY,0FAA0F,EACtG,UAAU,wCAAwC;AAAA,EACrD,OAAO,kCAAU,OAAO;AAAA,IACtB;AAAA,EACF;AACF;AAEO,MAAM,2BAA2B;",
6
+ "names": []
7
+ }
@@ -37,11 +37,12 @@ var import_ds_button_v2 = require("@elliemae/ds-button-v2");
37
37
  var import_ds_form_input_text = require("@elliemae/ds-form-input-text");
38
38
  var import_ds_grid = require("@elliemae/ds-grid");
39
39
  var import_ds_icons = require("@elliemae/ds-icons");
40
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
40
41
  var import_ds_system = require("@elliemae/ds-system");
41
42
  var import_react = __toESM(require("react"));
42
- var import_DSGlobalHeaderContext = require("../../../../DSGlobalHeaderContext.js");
43
43
  var import_constants = require("../../../../constants/index.js");
44
44
  var import_SearchToggleSpinButton = require("./SearchToggleSpinButton.js");
45
+ var import_react_desc_prop_types = require("./react-desc-prop-types.js");
45
46
  var import_useSearchToggle = require("./useSearchToggle.js");
46
47
  const StyledNavSearchBoxContainer = (0, import_ds_system.styled)("div", {
47
48
  name: import_constants.DSGlobalHeaderName,
@@ -126,10 +127,17 @@ const SearchToggle = (outOfTheBoxDrilledDownProps) => {
126
127
  const {
127
128
  componentProps,
128
129
  label,
130
+ getOwnerPropsAwareOfPropsPassedToGlobalHeader,
129
131
  // added in https://jira.elliemae.io/browse/PUI-17852
130
132
  // keeping the default value as "Close search" for backward compatibility
131
133
  // we expect authors to provide descriptive aria-labels that fit their specific context, we do so in our example stories.
132
- ariaLabelExpanded = "Close search"
134
+ // The default now comes from this part's own defaultProps rather than being repeated inline, so the
135
+ // documented contract and the runtime behaviour cannot drift apart.
136
+ ariaLabelExpanded = import_react_desc_prop_types.defaultProps.ariaLabelExpanded,
137
+ // Everything else the toolbar drilled down, which is where item-level global attributes arrive.
138
+ // `setRef` and `instanceUID` ride along in here too and are filtered out by getGlobalAttributes'
139
+ // own whitelist, so they never reach the DOM.
140
+ ...restIncludingItemLevelGlobalAttributes
133
141
  } = outOfTheBoxDrilledDownProps;
134
142
  const {
135
143
  isOpenUncontrolled,
@@ -137,12 +145,10 @@ const SearchToggle = (outOfTheBoxDrilledDownProps) => {
137
145
  handleToggleSearch,
138
146
  handleContainerKeyDown,
139
147
  handleChange,
140
- handleInputKeyDown,
141
148
  handleTriggerRefs,
142
149
  inputId,
143
150
  panelId
144
151
  } = (0, import_useSearchToggle.useSearchToggle)(outOfTheBoxDrilledDownProps);
145
- const { props: propsWithDefault } = import_react.default.useContext(import_DSGlobalHeaderContext.DSGlobalHeaderContext);
146
152
  const {
147
153
  onNext,
148
154
  onPrevious,
@@ -155,14 +161,18 @@ const SearchToggle = (outOfTheBoxDrilledDownProps) => {
155
161
  isOpen: userIsOpen,
156
162
  searchContainerRef
157
163
  } = componentProps;
158
- const getOwnerProps = import_react.default.useCallback(() => propsWithDefault, [propsWithDefault]);
159
- const getOwnerPropsArguments = import_react.default.useCallback(() => ({}), []);
164
+ const noSlotArguments = import_react.default.useCallback(() => ({}), []);
160
165
  const isOpen = userIsOpen ?? isOpenUncontrolled;
166
+ const itemLevelGlobalAttributes = (0, import_ds_props_helpers.getGlobalAttributes)(
167
+ restIncludingItemLevelGlobalAttributes
168
+ );
161
169
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
162
170
  StyledNavSearchBoxContainer,
163
171
  {
164
- getOwnerProps,
165
- getOwnerPropsArguments,
172
+ ...itemLevelGlobalAttributes,
173
+ ...(0, import_ds_props_helpers.getXstyledProps)(restIncludingItemLevelGlobalAttributes),
174
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
175
+ getOwnerPropsArguments: noSlotArguments,
166
176
  onKeyDown: handleContainerKeyDown,
167
177
  innerRef: (0, import_ds_system.mergeRefs)(searchContainerRef, containerRef),
168
178
  isOpen,
@@ -170,8 +180,8 @@ const SearchToggle = (outOfTheBoxDrilledDownProps) => {
170
180
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
171
181
  StyledToggleBtn,
172
182
  {
173
- getOwnerProps,
174
- getOwnerPropsArguments,
183
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
184
+ getOwnerPropsArguments: noSlotArguments,
175
185
  buttonType: "icon",
176
186
  innerRef: handleTriggerRefs,
177
187
  "aria-label": isOpen ? ariaLabelExpanded : label,
@@ -186,8 +196,8 @@ const SearchToggle = (outOfTheBoxDrilledDownProps) => {
186
196
  isOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
187
197
  StyledSearchNavContainer,
188
198
  {
189
- getOwnerProps,
190
- getOwnerPropsArguments,
199
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
200
+ getOwnerPropsArguments: noSlotArguments,
191
201
  id: panelId,
192
202
  alignItems: "center",
193
203
  cols: ["1fr", "1fr"],
@@ -195,8 +205,8 @@ const SearchToggle = (outOfTheBoxDrilledDownProps) => {
195
205
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
196
206
  StyledSearchInput,
197
207
  {
198
- getOwnerProps,
199
- getOwnerPropsArguments,
208
+ getOwnerProps: getOwnerPropsAwareOfPropsPassedToGlobalHeader,
209
+ getOwnerPropsArguments: noSlotArguments,
200
210
  id: inputId,
201
211
  "aria-label": import_constants.SEARCH_TOGGLE_DEFAULT_ARIA_LABEL,
202
212
  placeholder: placeholder || "Search...",
@@ -204,7 +214,6 @@ const SearchToggle = (outOfTheBoxDrilledDownProps) => {
204
214
  clearable: true,
205
215
  ...onBlur && { onBlur },
206
216
  onChange: handleChange,
207
- onKeyDown: handleInputKeyDown,
208
217
  onClear
209
218
  }
210
219
  ),
@@ -214,7 +223,8 @@ const SearchToggle = (outOfTheBoxDrilledDownProps) => {
214
223
  onNext,
215
224
  onPrevious,
216
225
  currentResultIndex,
217
- totalResults
226
+ totalResults,
227
+ getOwnerPropsAwareOfPropsPassedToGlobalHeader
218
228
  }
219
229
  )
220
230
  ]