@elliemae/ds-menu-button 3.70.0-next.6 → 3.70.0-next.61

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 (105) hide show
  1. package/dist/cjs/package.json +1 -4
  2. package/dist/cjs/parts/DSFlyoutMenu/DSFlyoutMenu.js +19 -9
  3. package/dist/cjs/parts/DSFlyoutMenu/DSFlyoutMenu.js.map +2 -2
  4. package/dist/cjs/parts/DSFlyoutMenu/react-desc-prop-types.js +0 -1
  5. package/dist/cjs/parts/DSFlyoutMenu/react-desc-prop-types.js.map +2 -2
  6. package/dist/cjs/parts/DSFlyoutMenu/typescript-testing/slot-props.js +36 -0
  7. package/dist/cjs/parts/DSFlyoutMenu/typescript-testing/slot-props.js.map +7 -0
  8. package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useMenuBehaviouralContextProvider.js.map +2 -2
  9. package/dist/cjs/parts/DSMenuBehaviouralContextProvider/utils/nodeGettersByCriterias.js.map +2 -2
  10. package/dist/cjs/parts/DSMenuItemRendererFactory/ActivableMenuItem.js +13 -4
  11. package/dist/cjs/parts/DSMenuItemRendererFactory/ActivableMenuItem.js.map +2 -2
  12. package/dist/cjs/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.js +13 -2
  13. package/dist/cjs/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.js.map +2 -2
  14. package/dist/cjs/parts/DSMenuItemRendererFactory/DSMenuItemRendererFactory.js +66 -18
  15. package/dist/cjs/parts/DSMenuItemRendererFactory/DSMenuItemRendererFactory.js.map +3 -3
  16. package/dist/cjs/parts/DSMenuItemRendererFactory/MultipleSelectMenuItem.js +13 -2
  17. package/dist/cjs/parts/DSMenuItemRendererFactory/MultipleSelectMenuItem.js.map +2 -2
  18. package/dist/cjs/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.js +13 -2
  19. package/dist/cjs/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.js.map +2 -2
  20. package/dist/cjs/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.js +18 -5
  21. package/dist/cjs/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.js.map +3 -3
  22. package/dist/cjs/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.js +18 -3
  23. package/dist/cjs/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.js.map +3 -3
  24. package/dist/cjs/parts/DSMenuItemRendererFactory/SkeletonMenuItem.js +5 -5
  25. package/dist/cjs/parts/DSMenuItemRendererFactory/SkeletonMenuItem.js.map +2 -2
  26. package/dist/cjs/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.js +13 -2
  27. package/dist/cjs/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.js.map +2 -2
  28. package/dist/cjs/parts/DSMenuItemRendererFactory/constants/index.js +5 -1
  29. package/dist/cjs/parts/DSMenuItemRendererFactory/constants/index.js.map +2 -2
  30. package/dist/cjs/parts/DSMenuItemRendererFactory/react-desc-prop-types.js.map +2 -2
  31. package/dist/cjs/parts/DSMenuItemRendererFactory/typescript-testing/slot-props.js +38 -0
  32. package/dist/cjs/parts/DSMenuItemRendererFactory/typescript-testing/slot-props.js.map +7 -0
  33. package/dist/cjs/parts/DSOpinionatedButton/react-desc-prop-types.js.map +2 -2
  34. package/dist/cjs/parts/DSOpinionatedButton/typescript-testing/slot-props.js +32 -0
  35. package/dist/cjs/parts/DSOpinionatedButton/typescript-testing/slot-props.js.map +7 -0
  36. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  37. package/dist/cjs/typescript-testing/slot-props.js +32 -0
  38. package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
  39. package/dist/cjs/utils/nodesTypeguardsAndGetters.js +6 -0
  40. package/dist/cjs/utils/nodesTypeguardsAndGetters.js.map +2 -2
  41. package/dist/esm/package.json +1 -4
  42. package/dist/esm/parts/DSFlyoutMenu/DSFlyoutMenu.js +20 -10
  43. package/dist/esm/parts/DSFlyoutMenu/DSFlyoutMenu.js.map +2 -2
  44. package/dist/esm/parts/DSFlyoutMenu/react-desc-prop-types.js +0 -1
  45. package/dist/esm/parts/DSFlyoutMenu/react-desc-prop-types.js.map +2 -2
  46. package/dist/esm/parts/DSFlyoutMenu/typescript-testing/slot-props.js +13 -0
  47. package/dist/esm/parts/DSFlyoutMenu/typescript-testing/slot-props.js.map +7 -0
  48. package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useMenuBehaviouralContextProvider.js.map +2 -2
  49. package/dist/esm/parts/DSMenuBehaviouralContextProvider/utils/nodeGettersByCriterias.js.map +2 -2
  50. package/dist/esm/parts/DSMenuItemRendererFactory/ActivableMenuItem.js +13 -4
  51. package/dist/esm/parts/DSMenuItemRendererFactory/ActivableMenuItem.js.map +2 -2
  52. package/dist/esm/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.js +13 -2
  53. package/dist/esm/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.js.map +2 -2
  54. package/dist/esm/parts/DSMenuItemRendererFactory/DSMenuItemRendererFactory.js +67 -18
  55. package/dist/esm/parts/DSMenuItemRendererFactory/DSMenuItemRendererFactory.js.map +3 -3
  56. package/dist/esm/parts/DSMenuItemRendererFactory/MultipleSelectMenuItem.js +13 -2
  57. package/dist/esm/parts/DSMenuItemRendererFactory/MultipleSelectMenuItem.js.map +2 -2
  58. package/dist/esm/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.js +13 -2
  59. package/dist/esm/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.js.map +2 -2
  60. package/dist/esm/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.js +18 -5
  61. package/dist/esm/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.js.map +2 -2
  62. package/dist/esm/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.js +18 -3
  63. package/dist/esm/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.js.map +2 -2
  64. package/dist/esm/parts/DSMenuItemRendererFactory/SkeletonMenuItem.js +5 -5
  65. package/dist/esm/parts/DSMenuItemRendererFactory/SkeletonMenuItem.js.map +2 -2
  66. package/dist/esm/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.js +13 -2
  67. package/dist/esm/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.js.map +2 -2
  68. package/dist/esm/parts/DSMenuItemRendererFactory/constants/index.js +5 -1
  69. package/dist/esm/parts/DSMenuItemRendererFactory/constants/index.js.map +2 -2
  70. package/dist/esm/parts/DSMenuItemRendererFactory/react-desc-prop-types.js.map +2 -2
  71. package/dist/esm/parts/DSMenuItemRendererFactory/typescript-testing/slot-props.js +15 -0
  72. package/dist/esm/parts/DSMenuItemRendererFactory/typescript-testing/slot-props.js.map +7 -0
  73. package/dist/esm/parts/DSOpinionatedButton/react-desc-prop-types.js.map +2 -2
  74. package/dist/esm/parts/DSOpinionatedButton/typescript-testing/slot-props.js +9 -0
  75. package/dist/esm/parts/DSOpinionatedButton/typescript-testing/slot-props.js.map +7 -0
  76. package/dist/esm/react-desc-prop-types.js.map +2 -2
  77. package/dist/esm/typescript-testing/slot-props.js +9 -0
  78. package/dist/esm/typescript-testing/slot-props.js.map +7 -0
  79. package/dist/esm/utils/nodesTypeguardsAndGetters.js +6 -0
  80. package/dist/esm/utils/nodesTypeguardsAndGetters.js.map +2 -2
  81. package/dist/types/config/useSplitInherithedProps.d.ts +1 -1
  82. package/dist/types/constants/index.d.ts +2 -1
  83. package/dist/types/parts/DSFlyoutMenu/react-desc-prop-types.d.ts +5 -0
  84. package/dist/types/parts/DSMenuItemRendererFactory/ActivableMenuItem.d.ts +2 -0
  85. package/dist/types/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.d.ts +2 -0
  86. package/dist/types/parts/DSMenuItemRendererFactory/MultipleSelectMenuItem.d.ts +2 -0
  87. package/dist/types/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.d.ts +2 -0
  88. package/dist/types/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.d.ts +2 -0
  89. package/dist/types/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.d.ts +2 -0
  90. package/dist/types/parts/DSMenuItemRendererFactory/SkeletonMenuItem.d.ts +2 -0
  91. package/dist/types/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.d.ts +2 -0
  92. package/dist/types/parts/DSMenuItemRendererFactory/constants/index.d.ts +4 -2
  93. package/dist/types/parts/DSMenuItemRendererFactory/react-desc-prop-types.d.ts +6 -0
  94. package/dist/types/parts/DSOpinionatedButton/config/useOpinionatedButton.d.ts +8 -8
  95. package/dist/types/parts/DSOpinionatedButton/react-desc-prop-types.d.ts +3 -0
  96. package/dist/types/react-desc-prop-types.d.ts +3 -0
  97. package/dist/types/utils/nodesTypeguardsAndGetters.d.ts +15 -0
  98. package/package.json +15 -15
  99. package/dist/types/tests/config/ControlledTestRender.d.ts +0 -3
  100. package/dist/types/tests/menu-button.keyboard.test.d.ts +0 -1
  101. package/dist/types/tests/playwright/DSMenuButton.ControlledTestRenderer.d.ts +0 -2
  102. package/dist/types/tests/playwright/DSMenuButton.test.playwright.d.ts +0 -1
  103. /package/dist/types/{tests/menu-button.exports.test.d.ts → parts/DSFlyoutMenu/typescript-testing/slot-props.d.ts} +0 -0
  104. /package/dist/types/{tests/menu-button.floating-config.test.d.ts → parts/DSMenuItemRendererFactory/typescript-testing/slot-props.d.ts} +0 -0
  105. /package/dist/types/{tests/menu-button.get-owner-props.test.d.ts → parts/DSOpinionatedButton/typescript-testing/slot-props.d.ts} +0 -0
@@ -3,8 +3,5 @@
3
3
  "sideEffects": [
4
4
  "*.css",
5
5
  "*.scss"
6
- ],
7
- "publishConfig": {
8
- "access": "public"
9
- }
6
+ ]
10
7
  }
@@ -78,6 +78,11 @@ const DSFlyoutMenu = (props) => {
78
78
  } = import_react.default.useContext(import_MenuBehaviouralContextProviderCTX.MenuBehaviouralContextProviderContext);
79
79
  const [didAnimationEnd, setDidAnimationEnd] = import_react.default.useState(false);
80
80
  const { setFloatingRef, floatingStyles, floatingContext, ItemRenderer, isMenuOpen, itemNode } = propsWithDefault;
81
+ const ariaPositionsByDsId = import_react.default.useMemo(
82
+ // DSTree doesn't support children having a polymorphic type, so we need to cast it manually (same as below)
83
+ () => (0, import_nodesTypeguardsAndGetters.getAriaSetSizeAndPosInSetBySiblingList)(itemNode.children),
84
+ [itemNode.children]
85
+ );
81
86
  const handleRefChange = import_react.default.useCallback(
82
87
  (node) => {
83
88
  if ((0, import_nodesTypeguardsAndGetters.isRootNode)(itemNode)) {
@@ -114,15 +119,20 @@ const DSFlyoutMenu = (props) => {
114
119
  $maxHeight: itemNode.plainItem.maxHeight ?? import_react_desc_prop_types.menuSpecificDefaultProps.maxHeight,
115
120
  getOwnerProps,
116
121
  getOwnerPropsArguments,
117
- children: itemNode.children.map((optionNode) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
- import_DSMenuItemRendererFactory.DSMenuItemRendererFactory,
119
- {
120
- itemNode: optionNode,
121
- ItemRenderer,
122
- FlyoutMenuCircularDepInject: didAnimationEnd ? DSFlyoutMenu : NoComponentPlaceholder
123
- },
124
- `flyout-menu-item-${optionNode.dsId}-${instanceUid}`
125
- ))
122
+ children: itemNode.children.map((optionNode) => {
123
+ const ariaPosition = ariaPositionsByDsId.get(optionNode.dsId);
124
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
125
+ import_DSMenuItemRendererFactory.DSMenuItemRendererFactory,
126
+ {
127
+ itemNode: optionNode,
128
+ ItemRenderer,
129
+ FlyoutMenuCircularDepInject: didAnimationEnd ? DSFlyoutMenu : NoComponentPlaceholder,
130
+ "aria-posinset": ariaPosition?.ariaPosInSet,
131
+ "aria-setsize": ariaPosition?.ariaSetSize
132
+ },
133
+ `flyout-menu-item-${optionNode.dsId}-${instanceUid}`
134
+ );
135
+ })
126
136
  }
127
137
  ) })
128
138
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/DSFlyoutMenu/DSFlyoutMenu.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { Grid } from '@elliemae/ds-grid';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { styled, xStyledCommonProps } from '@elliemae/ds-system';\n\nimport React from 'react';\nimport { type DSMenuButtonT, menuSpecificDefaultProps } from '../../react-desc-prop-types.js';\nimport { MenuBehaviouralContextProviderContext } from '../DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js';\nimport { DSMenuItemRendererFactory } from '../DSMenuItemRendererFactory/index.js';\nimport { useFlyoutMenu } from './config/useFlyoutMenu.js';\nimport { DSFlyoutMenuName, FLYOUT_MENU_SLOTS } from './constants/index.js';\nimport { DSFlyoutMenuPropTypesSchema, type DSFlyoutMenuT } from './react-desc-prop-types.js';\nimport { isRootNode } from '../../utils/nodesTypeguardsAndGetters.js';\nimport { MenuButtonContextProvider } from '../../MenuButtonContextProviderCTX.js';\nconst StyledWrapper = styled(Grid, {\n name: DSFlyoutMenuName,\n slot: FLYOUT_MENU_SLOTS.ROOT,\n})`\n min-width: 1px;\n background-color: white;\n padding: ${({ theme }) => theme.space.xxxs} 0;\n ${xStyledCommonProps}\n`;\n\nconst StyledFloatingWrapper = styled(FloatingWrapper, {\n name: DSFlyoutMenuName,\n slot: FLYOUT_MENU_SLOTS.FLOATING_WRAPPER,\n})``;\n\nconst StyledMenu = styled('div', { name: DSFlyoutMenuName, slot: FLYOUT_MENU_SLOTS.LIST_WRAPPER })<{\n $maxHeight: string | number;\n}>`\n max-height: ${({ $maxHeight }) => (typeof $maxHeight === 'number' ? `${$maxHeight}px` : $maxHeight)};\n overflow-y: auto;\n padding: 0;\n margin: 0;\n`;\n\nconst NoComponentPlaceholder = () => null;\n\nconst DSFlyoutMenu: React.ComponentType<DSFlyoutMenuT.Props> = (props) => {\n const { propsWithDefault, xstyledProps } = useFlyoutMenu(props);\n const {\n ownerProps: { getOwnerProps, getOwnerPropsArguments },\n } = React.useContext(MenuButtonContextProvider);\n const {\n instanceUid,\n globalEventsHelpers: { mainMenuRef, handleSubmenusRefChange },\n } = React.useContext(MenuBehaviouralContextProviderContext);\n const [didAnimationEnd, setDidAnimationEnd] = React.useState(false);\n\n const { setFloatingRef, floatingStyles, floatingContext, ItemRenderer, isMenuOpen, itemNode } = propsWithDefault;\n const handleRefChange = React.useCallback(\n (node: HTMLDivElement) => {\n if (isRootNode(itemNode)) {\n mainMenuRef.current = node;\n return;\n }\n handleSubmenusRefChange(node, itemNode.dsId);\n },\n [handleSubmenusRefChange, itemNode, mainMenuRef],\n );\n\n const handleAnimationStartTrigger = React.useCallback(() => {\n setDidAnimationEnd(false);\n }, []);\n const handleAnimationEnd = React.useCallback(() => {\n setDidAnimationEnd(true);\n }, []);\n\n return (\n <StyledFloatingWrapper\n innerRef={setFloatingRef}\n floatingStyles={floatingStyles}\n isOpen={isMenuOpen}\n context={floatingContext}\n onAnimationStartTriggered={handleAnimationStartTrigger}\n onAnimationEnd={handleAnimationEnd}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n // Adding a data-testid for legacy e2e tests\n data-testid=\"ds-floating-wrapper-root\"\n >\n <StyledWrapper getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments} {...xstyledProps}>\n <StyledMenu\n role=\"menu\"\n innerRef={handleRefChange}\n $maxHeight={itemNode.plainItem.maxHeight ?? menuSpecificDefaultProps.maxHeight}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {itemNode.children.map((optionNode) => (\n <DSMenuItemRendererFactory\n key={`flyout-menu-item-${optionNode.dsId}-${instanceUid}`}\n // DSTree doesn't support children having a polymorphic type, so we need to cast it manually\n itemNode={optionNode as DSMenuButtonT.MenuNode}\n ItemRenderer={ItemRenderer}\n // we are passing the DSFlyoutMenu component as a prop to the DSMenuItemRendererFactory\n // this solves the circular-ish dependency\n // the conditional `didAnimationEnd` solves the visual artefact of nested FloatingWrapper wrongly positioned due to animation\n FlyoutMenuCircularDepInject={didAnimationEnd ? DSFlyoutMenu : NoComponentPlaceholder}\n />\n ))}\n </StyledMenu>\n </StyledWrapper>\n </StyledFloatingWrapper>\n );\n};\n\nDSFlyoutMenu.displayName = DSFlyoutMenuName;\nconst DSFlyoutMenuWithSchema = describe(DSFlyoutMenu);\nDSFlyoutMenuWithSchema.propTypes = DSFlyoutMenuPropTypesSchema;\n\nexport { DSFlyoutMenu, DSFlyoutMenuWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4FX;AA5FZ,iCAAgC;AAChC,qBAAqB;AACrB,8BAAyB;AACzB,uBAA2C;AAE3C,mBAAkB;AAClB,mCAA6D;AAC7D,+CAAsD;AACtD,uCAA0C;AAC1C,2BAA8B;AAC9B,uBAAoD;AACpD,IAAAA,gCAAgE;AAChE,uCAA2B;AAC3B,0CAA0C;AAC1C,MAAM,oBAAgB,yBAAO,qBAAM;AAAA,EACjC,MAAM;AAAA,EACN,MAAM,mCAAkB;AAC1B,CAAC;AAAA;AAAA;AAAA,aAGY,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,IAAI;AAAA,IACxC,mCAAkB;AAAA;AAGtB,MAAM,4BAAwB,yBAAO,4CAAiB;AAAA,EACpD,MAAM;AAAA,EACN,MAAM,mCAAkB;AAC1B,CAAC;AAED,MAAM,iBAAa,yBAAO,OAAO,EAAE,MAAM,mCAAkB,MAAM,mCAAkB,aAAa,CAAC;AAAA,gBAGjF,CAAC,EAAE,WAAW,MAAO,OAAO,eAAe,WAAW,GAAG,UAAU,OAAO,UAAW;AAAA;AAAA;AAAA;AAAA;AAM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S,SAAS,IAAI,CAAC,eACtB;AAAA,YAAC;AAAA;AAAA,cAGC,UAAU;AAAA,cACV;AAAA,cAIA,6BAA6B,kBAAkB,eAAe;AAAA;AAAA,YAPzD,oBAAoB,WAAW,IAAI,IAAI,WAAW;AAAA,UAQzD,CACD;AAAA;AAAA,MACH,GACF;AAAA;AAAA,EACF;AAEJ;AAEA,aAAa,cAAc;AAC3B,MAAM,6BAAyB,kCAAS,YAAY;AACpD,uBAAuB,YAAY;",
4
+ "sourcesContent": ["import { FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { Grid } from '@elliemae/ds-grid';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { styled, xStyledCommonProps } from '@elliemae/ds-system';\n\nimport React from 'react';\nimport { type DSMenuButtonT, menuSpecificDefaultProps } from '../../react-desc-prop-types.js';\nimport { MenuBehaviouralContextProviderContext } from '../DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js';\nimport { DSMenuItemRendererFactory } from '../DSMenuItemRendererFactory/index.js';\nimport { useFlyoutMenu } from './config/useFlyoutMenu.js';\nimport { DSFlyoutMenuName, FLYOUT_MENU_SLOTS } from './constants/index.js';\nimport { DSFlyoutMenuPropTypesSchema, type DSFlyoutMenuT } from './react-desc-prop-types.js';\nimport { getAriaSetSizeAndPosInSetBySiblingList, isRootNode } from '../../utils/nodesTypeguardsAndGetters.js';\nimport { MenuButtonContextProvider } from '../../MenuButtonContextProviderCTX.js';\nconst StyledWrapper = styled(Grid, {\n name: DSFlyoutMenuName,\n slot: FLYOUT_MENU_SLOTS.ROOT,\n})`\n min-width: 1px;\n background-color: white;\n padding: ${({ theme }) => theme.space.xxxs} 0;\n ${xStyledCommonProps}\n`;\n\nconst StyledFloatingWrapper = styled(FloatingWrapper, {\n name: DSFlyoutMenuName,\n slot: FLYOUT_MENU_SLOTS.FLOATING_WRAPPER,\n})``;\n\nconst StyledMenu = styled('div', { name: DSFlyoutMenuName, slot: FLYOUT_MENU_SLOTS.LIST_WRAPPER })<{\n $maxHeight: string | number;\n}>`\n max-height: ${({ $maxHeight }) => (typeof $maxHeight === 'number' ? `${$maxHeight}px` : $maxHeight)};\n overflow-y: auto;\n padding: 0;\n margin: 0;\n`;\n\nconst NoComponentPlaceholder = () => null;\n\nconst DSFlyoutMenu: React.ComponentType<DSFlyoutMenuT.Props> = (props) => {\n const { propsWithDefault, xstyledProps } = useFlyoutMenu(props);\n const {\n ownerProps: { getOwnerProps, getOwnerPropsArguments },\n } = React.useContext(MenuButtonContextProvider);\n const {\n instanceUid,\n globalEventsHelpers: { mainMenuRef, handleSubmenusRefChange },\n } = React.useContext(MenuBehaviouralContextProviderContext);\n const [didAnimationEnd, setDidAnimationEnd] = React.useState(false);\n\n const { setFloatingRef, floatingStyles, floatingContext, ItemRenderer, isMenuOpen, itemNode } = propsWithDefault;\n const ariaPositionsByDsId = React.useMemo(\n // DSTree doesn't support children having a polymorphic type, so we need to cast it manually (same as below)\n () => getAriaSetSizeAndPosInSetBySiblingList(itemNode.children as DSMenuButtonT.MenuNode[]),\n [itemNode.children],\n );\n const handleRefChange = React.useCallback(\n (node: HTMLDivElement) => {\n if (isRootNode(itemNode)) {\n mainMenuRef.current = node;\n return;\n }\n handleSubmenusRefChange(node, itemNode.dsId);\n },\n [handleSubmenusRefChange, itemNode, mainMenuRef],\n );\n\n const handleAnimationStartTrigger = React.useCallback(() => {\n setDidAnimationEnd(false);\n }, []);\n const handleAnimationEnd = React.useCallback(() => {\n setDidAnimationEnd(true);\n }, []);\n\n return (\n <StyledFloatingWrapper\n innerRef={setFloatingRef}\n floatingStyles={floatingStyles}\n isOpen={isMenuOpen}\n context={floatingContext}\n onAnimationStartTriggered={handleAnimationStartTrigger}\n onAnimationEnd={handleAnimationEnd}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n // Adding a data-testid for legacy e2e tests\n data-testid=\"ds-floating-wrapper-root\"\n >\n <StyledWrapper getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments} {...xstyledProps}>\n <StyledMenu\n role=\"menu\"\n innerRef={handleRefChange}\n $maxHeight={itemNode.plainItem.maxHeight ?? menuSpecificDefaultProps.maxHeight}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {itemNode.children.map((optionNode) => {\n const ariaPosition = ariaPositionsByDsId.get(optionNode.dsId);\n return (\n <DSMenuItemRendererFactory\n key={`flyout-menu-item-${optionNode.dsId}-${instanceUid}`}\n // DSTree doesn't support children having a polymorphic type, so we need to cast it manually\n itemNode={optionNode as DSMenuButtonT.MenuNode}\n ItemRenderer={ItemRenderer}\n // we are passing the DSFlyoutMenu component as a prop to the DSMenuItemRendererFactory\n // this solves the circular-ish dependency\n // the conditional `didAnimationEnd` solves the visual artefact of nested FloatingWrapper wrongly positioned due to animation\n FlyoutMenuCircularDepInject={didAnimationEnd ? DSFlyoutMenu : NoComponentPlaceholder}\n aria-posinset={ariaPosition?.ariaPosInSet}\n aria-setsize={ariaPosition?.ariaSetSize}\n />\n );\n })}\n </StyledMenu>\n </StyledWrapper>\n </StyledFloatingWrapper>\n );\n};\n\nDSFlyoutMenu.displayName = DSFlyoutMenuName;\nconst DSFlyoutMenuWithSchema = describe(DSFlyoutMenu);\nDSFlyoutMenuWithSchema.propTypes = DSFlyoutMenuPropTypesSchema;\n\nexport { DSFlyoutMenu, DSFlyoutMenuWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmGT;AAnGd,iCAAgC;AAChC,qBAAqB;AACrB,8BAAyB;AACzB,uBAA2C;AAE3C,mBAAkB;AAClB,mCAA6D;AAC7D,+CAAsD;AACtD,uCAA0C;AAC1C,2BAA8B;AAC9B,uBAAoD;AACpD,IAAAA,gCAAgE;AAChE,uCAAmE;AACnE,0CAA0C;AAC1C,MAAM,oBAAgB,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AA,EACjD;AAEA,QAAM,8BAA8B,aAAAA,QAAM,YAAY,MAAM;AAC1D,uBAAmB,KAAK;AAAA,EAC1B,GAAG,CAAC,CAAC;AACL,QAAM,qBAAqB,aAAAA,QAAM,YAAY,MAAM;AACjD,uBAAmB,IAAI;AAAA,EACzB,GAAG,CAAC,CAAC;AAEL,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,2BAA2B;AAAA,MAC3B,gBAAgB;AAAA,MAChB;AAAA,MACA;AAAA,MAEA,eAAY;AAAA,MAEZ,sDAAC,iBAAc,eAA8B,wBAAiD,GAAG,cAC/F;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,UAAU;AAAA,UACV,YAAY,SAAS,UAAU,aAAa,sDAAyB;AAAA,UACrE;AAAA,UACA;AAAA,UAEC,mBAAS,SAAS,IAAI,CAAC,eAAe;AACrC,kBAAM,eAAe,oBAAoB,IAAI,WAAW,IAAI;AAC5D,mBACE;AAAA,cAAC;AAAA;AAAA,gBAGC,UAAU;AAAA,gBACV;AAAA,gBAIA,6BAA6B,kBAAkB,eAAe;AAAA,gBAC9D,iBAAe,cAAc;AAAA,gBAC7B,gBAAc,cAAc;AAAA;AAAA,cATvB,oBAAoB,WAAW,IAAI,IAAI,WAAW;AAAA,YAUzD;AAAA,UAEJ,CAAC;AAAA;AAAA,MACH,GACF;AAAA;AAAA,EACF;AAEJ;AAEA,aAAa,cAAc;AAC3B,MAAM,6BAAyB,kCAAS,YAAY;AACpD,uBAAuB,YAAY;",
6
6
  "names": ["import_react_desc_prop_types", "React"]
7
7
  }
@@ -49,7 +49,6 @@ const DSFlyoutMenuPropTypes = {
49
49
  floatingContext: import_ds_props_helpers.PropTypes.object.description(
50
50
  "The context object from useFloatingContext, used to allow FloatingWrapper correct functionality"
51
51
  ).isRequired,
52
- // anchorNode: PropTypes.instanceOf(HTMLElement).isRequired,
53
52
  isMenuOpen: import_ds_props_helpers.PropTypes.bool.description("Wheter or not this particular instance of the flyout menu is open").isRequired,
54
53
  ...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants.DSFlyoutMenuName, import_constants.FLYOUT_MENU_SLOTS),
55
54
  ...import_ds_props_helpers.globalAttributesPropTypes,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/DSFlyoutMenu/react-desc-prop-types.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport { type useFloatingContext } from '@elliemae/ds-floating-context';\nimport type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSMenuSpecificPropTypes, menuSpecificDefaultProps, type DSMenuButtonT } from '../../react-desc-prop-types.js';\nimport { DSFlyoutMenuName, FLYOUT_MENU_SLOTS } from './constants/index.js';\n\nexport declare namespace DSFlyoutMenuT {\n /*\n * everything that is specifically added in this namespace declaration and is not part of the original component\n * is because the original component is an \"opinionated widget\" that offloads a chunk of responsibilities from dev to dimsum\n * as such, the widget generates those interfaces,\n * but the app developer is not supposed to know about them\n * untill they go atomic composition (this namespace)\n */\n export interface RequiredProps extends DSMenuButtonT.MenuSpecificRequiredProps {\n isMenuOpen: boolean;\n itemNode:\n | DSMenuButtonT.MenuNodeWithSubmenuItem\n | DSMenuButtonT.MenuNodeSingleSelectWithSubmenuItem\n | DSMenuButtonT.MenuNodeMultipleSelectWithSubmenuItem\n | DSMenuButtonT.MenuNodeActivableWithSubmenuItem\n | DSMenuButtonT.MenuNodeRootItem;\n setFloatingRef: ReturnType<typeof useFloatingContext>['refs']['setFloating'];\n floatingStyles: ReturnType<typeof useFloatingContext>['floatingStyles'];\n floatingContext: ReturnType<typeof useFloatingContext>['context'];\n }\n\n export interface DefaultProps extends DSMenuButtonT.MenuSpecifiDefaultProps {}\n\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSFlyoutMenuName, typeof FLYOUT_MENU_SLOTS>,\n DSMenuButtonT.MenuSpecificOptionalProps {}\n\n export interface Props extends RequiredProps, Partial<DefaultProps>, OptionalProps {}\n\n export interface InternalProps extends RequiredProps, DefaultProps, OptionalProps {}\n}\n\nexport const defaultProps: DSFlyoutMenuT.DefaultProps = { ...menuSpecificDefaultProps };\n\nexport const DSFlyoutMenuPropTypes: DSPropTypesSchema<DSFlyoutMenuT.Props> = {\n itemNode: PropTypes.object.description('The parent menu node to render the menu from').isRequired,\n setFloatingRef: PropTypes.func.description(\n 'The function to set the ref of the floating element (from useFloatingContext.refs.setFloating)',\n ).isRequired,\n floatingStyles: PropTypes.object.description(\n 'The styles to apply to the floating element to correctly position it (from useFloatingContext.floatingStyles)',\n ).isRequired,\n floatingContext: PropTypes.object.description(\n 'The context object from useFloatingContext, used to allow FloatingWrapper correct functionality',\n ).isRequired,\n // anchorNode: PropTypes.instanceOf(HTMLElement).isRequired,\n isMenuOpen: PropTypes.bool.description('Wheter or not this particular instance of the flyout menu is open')\n .isRequired,\n ...getPropsPerSlotPropTypes(DSFlyoutMenuName, FLYOUT_MENU_SLOTS),\n ...globalAttributesPropTypes,\n // this component is meant to be used from a ds-menu-button compliant API,\n // for this reason we want to inherit the DSMenuButton props interface that relates to the menu and not the button...\n ...DSMenuSpecificPropTypes,\n ...xstyledPropTypes,\n};\n\nexport const DSFlyoutMenuPropTypesSchema = DSFlyoutMenuPropTypes as unknown as ValidationMap<DSFlyoutMenuT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,8BAKO;AAEP,mCAAsF;AACtF,uBAAoD;AAkC7C,MAAM,eAA2C,EAAE,GAAG,sDAAyB;AAE/E,MAAM,wBAAgE;AAAA,EAC3E,UAAU,kCAAU,OAAO,YAAY,8CAA8C,EAAE;AAAA,EACvF,gBAAgB,kCAAU,KAAK;AAAA,IAC7B;AAAA,EACF,EAAE;AAAA,EACF,gBAAgB,kCAAU,OAAO;AAAA,IAC/B;AAAA,EACF,EAAE;AAAA,EACF,iBAAiB,kCAAU,OAAO;AAAA,IAChC;AAAA,EACF,EAAE;AAAA;AAAA,EAEF,YAAY,kCAAU,KAAK,YAAY,mEAAmE,EACvG;AAAA,EACH,OAAG,kDAAyB,mCAAkB,kCAAiB;AAAA,EAC/D,GAAG;AAAA;AAAA;AAAA,EAGH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,8BAA8B;",
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport { type useFloatingContext } from '@elliemae/ds-floating-context';\nimport type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSMenuSpecificPropTypes, menuSpecificDefaultProps, type DSMenuButtonT } from '../../react-desc-prop-types.js';\nimport { DSFlyoutMenuName, FLYOUT_MENU_SLOTS } from './constants/index.js';\n\nexport declare namespace DSFlyoutMenuT {\n /* Slot function-form prop arguments \u2014 one entry per slot in FLYOUT_MENU_SLOTS. */\n export type SlotFunctionArguments = {\n dsFlyoutmenuFloatingWrapper: () => object;\n dsFlyoutmenuRoot: () => object;\n dsFlyoutmenuListWrapper: () => object;\n };\n\n /*\n * everything that is specifically added in this namespace declaration and is not part of the original component\n * is because the original component is an \"opinionated widget\" that offloads a chunk of responsibilities from dev to dimsum\n * as such, the widget generates those interfaces,\n * but the app developer is not supposed to know about them\n * untill they go atomic composition (this namespace)\n */\n export interface RequiredProps extends DSMenuButtonT.MenuSpecificRequiredProps {\n isMenuOpen: boolean;\n itemNode:\n | DSMenuButtonT.MenuNodeWithSubmenuItem\n | DSMenuButtonT.MenuNodeSingleSelectWithSubmenuItem\n | DSMenuButtonT.MenuNodeMultipleSelectWithSubmenuItem\n | DSMenuButtonT.MenuNodeActivableWithSubmenuItem\n | DSMenuButtonT.MenuNodeRootItem;\n setFloatingRef: ReturnType<typeof useFloatingContext>['refs']['setFloating'];\n floatingStyles: ReturnType<typeof useFloatingContext>['floatingStyles'];\n floatingContext: ReturnType<typeof useFloatingContext>['context'];\n }\n\n export interface DefaultProps extends DSMenuButtonT.MenuSpecifiDefaultProps {}\n\n export interface OptionalProps\n extends\n TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSFlyoutMenuName, typeof FLYOUT_MENU_SLOTS>,\n DSMenuButtonT.MenuSpecificOptionalProps {}\n\n export interface Props extends RequiredProps, Partial<DefaultProps>, OptionalProps {}\n\n export interface InternalProps extends RequiredProps, DefaultProps, OptionalProps {}\n}\n\nexport const defaultProps: DSFlyoutMenuT.DefaultProps = { ...menuSpecificDefaultProps };\n\nexport const DSFlyoutMenuPropTypes: DSPropTypesSchema<DSFlyoutMenuT.Props> = {\n itemNode: PropTypes.object.description('The parent menu node to render the menu from').isRequired,\n setFloatingRef: PropTypes.func.description(\n 'The function to set the ref of the floating element (from useFloatingContext.refs.setFloating)',\n ).isRequired,\n floatingStyles: PropTypes.object.description(\n 'The styles to apply to the floating element to correctly position it (from useFloatingContext.floatingStyles)',\n ).isRequired,\n floatingContext: PropTypes.object.description(\n 'The context object from useFloatingContext, used to allow FloatingWrapper correct functionality',\n ).isRequired,\n isMenuOpen: PropTypes.bool.description('Wheter or not this particular instance of the flyout menu is open')\n .isRequired,\n ...getPropsPerSlotPropTypes(DSFlyoutMenuName, FLYOUT_MENU_SLOTS),\n ...globalAttributesPropTypes,\n // this component is meant to be used from a ds-menu-button compliant API,\n // for this reason we want to inherit the DSMenuButton props interface that relates to the menu and not the button...\n ...DSMenuSpecificPropTypes,\n ...xstyledPropTypes,\n};\n\nexport const DSFlyoutMenuPropTypesSchema = DSFlyoutMenuPropTypes as unknown as ValidationMap<DSFlyoutMenuT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,8BAKO;AAEP,mCAAsF;AACtF,uBAAoD;AA0C7C,MAAM,eAA2C,EAAE,GAAG,sDAAyB;AAE/E,MAAM,wBAAgE;AAAA,EAC3E,UAAU,kCAAU,OAAO,YAAY,8CAA8C,EAAE;AAAA,EACvF,gBAAgB,kCAAU,KAAK;AAAA,IAC7B;AAAA,EACF,EAAE;AAAA,EACF,gBAAgB,kCAAU,OAAO;AAAA,IAC/B;AAAA,EACF,EAAE;AAAA,EACF,iBAAiB,kCAAU,OAAO;AAAA,IAChC;AAAA,EACF,EAAE;AAAA,EACF,YAAY,kCAAU,KAAK,YAAY,mEAAmE,EACvG;AAAA,EACH,OAAG,kDAAyB,mCAAkB,kCAAiB;AAAA,EAC/D,GAAG;AAAA;AAAA;AAAA,EAGH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,8BAA8B;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,36 @@
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 __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var React = __toESM(require("react"));
25
+ const SlotPropsAsObj = {
26
+ dsFlyoutmenuFloatingWrapper: { "aria-label": "just a typescript test" },
27
+ dsFlyoutmenuRoot: { "aria-label": "just a typescript test" },
28
+ dsFlyoutmenuListWrapper: { "aria-label": "just a typescript test" }
29
+ };
30
+ const SlotPropsAsFunctions = {
31
+ dsFlyoutmenuFloatingWrapper: () => ({ "aria-label": "just a typescript test" }),
32
+ dsFlyoutmenuRoot: () => ({ "aria-label": "just a typescript test" }),
33
+ dsFlyoutmenuListWrapper: () => ({ "aria-label": "just a typescript test" })
34
+ };
35
+ const EnsureAllSlotsExistInSlotFunctionArguments = SlotPropsAsFunctions;
36
+ //# sourceMappingURL=slot-props.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSFlyoutMenu/typescript-testing/slot-props.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\n\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\n\nimport type { DSFlyoutMenuT } from '../react-desc-prop-types.js';\nimport type { DSFlyoutMenuName, FLYOUT_MENU_SLOTS } from '../constants/index.js';\n\nconst SlotPropsAsObj: Partial<DSFlyoutMenuT.Props> = {\n dsFlyoutmenuFloatingWrapper: { 'aria-label': 'just a typescript test' },\n dsFlyoutmenuRoot: { 'aria-label': 'just a typescript test' },\n dsFlyoutmenuListWrapper: { 'aria-label': 'just a typescript test' },\n};\n\nconst SlotPropsAsFunctions: DSFlyoutMenuT.SlotFunctionArguments = {\n dsFlyoutmenuFloatingWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsFlyoutmenuRoot: () => ({ 'aria-label': 'just a typescript test' }),\n dsFlyoutmenuListWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n};\n\n// Exhaustiveness check \u2014 fails compilation if a slot is missing from SlotFunctionArguments.\nconst EnsureAllSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSFlyoutMenuName, typeof FLYOUT_MENU_SLOTS>\n> = SlotPropsAsFunctions;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACOvB,MAAM,iBAA+C;AAAA,EACnD,6BAA6B,EAAE,cAAc,yBAAyB;AAAA,EACtE,kBAAkB,EAAE,cAAc,yBAAyB;AAAA,EAC3D,yBAAyB,EAAE,cAAc,yBAAyB;AACpE;AAEA,MAAM,uBAA4D;AAAA,EAChE,6BAA6B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC7E,kBAAkB,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAClE,yBAAyB,OAAO,EAAE,cAAc,yBAAyB;AAC3E;AAGA,MAAM,6CAEF;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/parts/DSMenuBehaviouralContextProvider/config/useMenuBehaviouralContextProvider.ts", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { uid } from 'uid';\nimport type { DSMenuButtonT } from '../../../react-desc-prop-types.js';\nimport {\n DSMenuBehaviouralContextProviderPropTypesSchema,\n defaultProps,\n type DSMenuBehaviouralContextProviderT,\n} from '../react-desc-prop-types.js';\nimport { useAdvancedValidation } from './useAdvancedValidation.js';\nimport { useFocusTracker } from './useFocusTracker.js';\nimport { useGlobalEvents } from './useGlobalEvents.js';\nimport { useMenuItemEventsHandlers } from './useMenuItemEventsHandlers.js';\nimport { useMenuOpenStatus } from './useMenuOpenStatus.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface MenuBehaviouralContextProviderCTX\n extends ReturnType<typeof useFocusTracker>,\n ReturnType<typeof useMenuOpenStatus> {\n propsWithDefault: DSMenuBehaviouralContextProviderT.InternalProps;\n instanceUid: string;\n menuItemEventsHandlers: ReturnType<typeof useMenuItemEventsHandlers>;\n openedSubItems: DSMenuButtonT.WithSubmenuMenuNodes[];\n handleChangeOpenedSubItems: Required<DSMenuButtonT.MenuBehaviouralLayerOptionalProps>['onDisplayedSubmenuChange'];\n globalEventsHelpers: ReturnType<typeof useGlobalEvents>;\n}\n\nexport const useMenuBehaviouralContextProvider = (propsFromUser: DSMenuBehaviouralContextProviderT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n // the component deals with HTML DOM elements,\n // Deep compare of HTML DOM elements is pointless and extremely costly\n // for this specific case, we are better of not using `useMemoMergePropsWithDefault`\n const propsWithDefault = React.useMemo(\n () => ({\n ...defaultProps,\n ...propsFromUser,\n }),\n [propsFromUser],\n ) as DSMenuBehaviouralContextProviderT.InternalProps;\n useValidateProps(propsWithDefault, DSMenuBehaviouralContextProviderPropTypesSchema);\n\n // =============================================================================\n // SPECIAL VALIDATIONS\n // =============================================================================\n useAdvancedValidation({ propsWithDefault });\n\n // =============================================================================\n // XSTYLED PROPS\n // =============================================================================\n // NO XSTYLED PROPS\n // this is 100% a pure logic context provider, it's not a visual component\n\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const { onDisplayedSubmenuChange } = propsWithDefault;\n const instanceUid = React.useMemo(() => `ds-menu-behavioural-context-provider-${uid(5)}`, []);\n const [openedSubItems, setOpenedSubItems] = React.useState<DSMenuButtonT.WithSubmenuMenuNodes[]>([]);\n\n const handleChangeOpenedSubItems = React.useCallback<\n Required<DSMenuButtonT.MenuBehaviouralLayerOptionalProps>['onDisplayedSubmenuChange']\n >(\n (newOpenedItems, metainfo) => {\n setOpenedSubItems(newOpenedItems);\n onDisplayedSubmenuChange?.(newOpenedItems, metainfo);\n },\n [onDisplayedSubmenuChange],\n );\n\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n const focusTrackers = useFocusTracker();\n const menuOpenStatus = useMenuOpenStatus({ propsWithDefault, focusTrackers });\n\n // why item events handlers declared in the menu behaviour context provider and not in the menu item itself?\n // 1 - each menu item depending on it's own type (single select, multiple select, with submenu) will have different behaviours\n // having each menu item to declare it's own events handlers would make the single event handler way easier to create per se\n // BUT we would lose the big picture of how the menu items are interacting with each other\n // 2 - having each item to declare it's own event handler repeatdly is a waste of resources (even if it's a useless micro-optimization, it hurts me)\n const menuItemEventsHandlers = useMenuItemEventsHandlers({\n propsWithDefault,\n focusTrackers,\n menuOpenStatus,\n handleChangeOpenedSubItems,\n });\n\n // handle \"onClickOutside\" + on window blur...\n // the helpers contain a way to register the submenu refs/mainmenu refs, used in checking \"if click is outside\"\n const globalEventsHelpers = useGlobalEvents({ menuOpenStatus, handleChangeOpenedSubItems, propsWithDefault });\n\n return React.useMemo<MenuBehaviouralContextProviderCTX>(\n () => ({\n propsWithDefault,\n instanceUid,\n ...focusTrackers,\n ...menuOpenStatus,\n menuItemEventsHandlers,\n openedSubItems,\n handleChangeOpenedSubItems,\n globalEventsHelpers,\n }),\n [\n propsWithDefault,\n instanceUid,\n focusTrackers,\n menuOpenStatus,\n menuItemEventsHandlers,\n openedSubItems,\n handleChangeOpenedSubItems,\n globalEventsHelpers,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBA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,EACF;AACF;",
4
+ "sourcesContent": ["import React from 'react';\nimport { uid } from 'uid';\nimport type { DSMenuButtonT } from '../../../react-desc-prop-types.js';\nimport {\n DSMenuBehaviouralContextProviderPropTypesSchema,\n defaultProps,\n type DSMenuBehaviouralContextProviderT,\n} from '../react-desc-prop-types.js';\nimport { useAdvancedValidation } from './useAdvancedValidation.js';\nimport { useFocusTracker } from './useFocusTracker.js';\nimport { useGlobalEvents } from './useGlobalEvents.js';\nimport { useMenuItemEventsHandlers } from './useMenuItemEventsHandlers.js';\nimport { useMenuOpenStatus } from './useMenuOpenStatus.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface MenuBehaviouralContextProviderCTX\n extends ReturnType<typeof useFocusTracker>, ReturnType<typeof useMenuOpenStatus> {\n propsWithDefault: DSMenuBehaviouralContextProviderT.InternalProps;\n instanceUid: string;\n menuItemEventsHandlers: ReturnType<typeof useMenuItemEventsHandlers>;\n openedSubItems: DSMenuButtonT.WithSubmenuMenuNodes[];\n handleChangeOpenedSubItems: Required<DSMenuButtonT.MenuBehaviouralLayerOptionalProps>['onDisplayedSubmenuChange'];\n globalEventsHelpers: ReturnType<typeof useGlobalEvents>;\n}\n\nexport const useMenuBehaviouralContextProvider = (propsFromUser: DSMenuBehaviouralContextProviderT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n // the component deals with HTML DOM elements,\n // Deep compare of HTML DOM elements is pointless and extremely costly\n // for this specific case, we are better of not using `useMemoMergePropsWithDefault`\n const propsWithDefault = React.useMemo(\n () => ({\n ...defaultProps,\n ...propsFromUser,\n }),\n [propsFromUser],\n ) as DSMenuBehaviouralContextProviderT.InternalProps;\n useValidateProps(propsWithDefault, DSMenuBehaviouralContextProviderPropTypesSchema);\n\n // =============================================================================\n // SPECIAL VALIDATIONS\n // =============================================================================\n useAdvancedValidation({ propsWithDefault });\n\n // =============================================================================\n // XSTYLED PROPS\n // =============================================================================\n // NO XSTYLED PROPS\n // this is 100% a pure logic context provider, it's not a visual component\n\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const { onDisplayedSubmenuChange } = propsWithDefault;\n const instanceUid = React.useMemo(() => `ds-menu-behavioural-context-provider-${uid(5)}`, []);\n const [openedSubItems, setOpenedSubItems] = React.useState<DSMenuButtonT.WithSubmenuMenuNodes[]>([]);\n\n const handleChangeOpenedSubItems = React.useCallback<\n Required<DSMenuButtonT.MenuBehaviouralLayerOptionalProps>['onDisplayedSubmenuChange']\n >(\n (newOpenedItems, metainfo) => {\n setOpenedSubItems(newOpenedItems);\n onDisplayedSubmenuChange?.(newOpenedItems, metainfo);\n },\n [onDisplayedSubmenuChange],\n );\n\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n const focusTrackers = useFocusTracker();\n const menuOpenStatus = useMenuOpenStatus({ propsWithDefault, focusTrackers });\n\n // why item events handlers declared in the menu behaviour context provider and not in the menu item itself?\n // 1 - each menu item depending on it's own type (single select, multiple select, with submenu) will have different behaviours\n // having each menu item to declare it's own events handlers would make the single event handler way easier to create per se\n // BUT we would lose the big picture of how the menu items are interacting with each other\n // 2 - having each item to declare it's own event handler repeatdly is a waste of resources (even if it's a useless micro-optimization, it hurts me)\n const menuItemEventsHandlers = useMenuItemEventsHandlers({\n propsWithDefault,\n focusTrackers,\n menuOpenStatus,\n handleChangeOpenedSubItems,\n });\n\n // handle \"onClickOutside\" + on window blur...\n // the helpers contain a way to register the submenu refs/mainmenu refs, used in checking \"if click is outside\"\n const globalEventsHelpers = useGlobalEvents({ menuOpenStatus, handleChangeOpenedSubItems, propsWithDefault });\n\n return React.useMemo<MenuBehaviouralContextProviderCTX>(\n () => ({\n propsWithDefault,\n instanceUid,\n ...focusTrackers,\n ...menuOpenStatus,\n menuItemEventsHandlers,\n openedSubItems,\n handleChangeOpenedSubItems,\n globalEventsHelpers,\n }),\n [\n propsWithDefault,\n instanceUid,\n focusTrackers,\n menuOpenStatus,\n menuItemEventsHandlers,\n openedSubItems,\n handleChangeOpenedSubItems,\n globalEventsHelpers,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,iBAAoB;AAEpB,mCAIO;AACP,mCAAsC;AACtC,6BAAgC;AAChC,6BAAgC;AAChC,uCAA0C;AAC1C,+BAAkC;AAClC,8BAAiC;AAY1B,MAAM,oCAAoC,CAAC,kBAA2D;AAO3G,QAAM,mBAAmB,aAAAA,QAAM;AAAA,IAC7B,OAAO;AAAA,MACL,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IACA,CAAC,aAAa;AAAA,EAChB;AACA,gDAAiB,kBAAkB,4EAA+C;AAKlF,0DAAsB,EAAE,iBAAiB,CAAC;AAY1C,QAAM,EAAE,yBAAyB,IAAI;AACrC,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,4CAAwC,gBAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5F,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,aAAAA,QAAM,SAA+C,CAAC,CAAC;AAEnG,QAAM,6BAA6B,aAAAA,QAAM;AAAA,IAGvC,CAAC,gBAAgB,aAAa;AAC5B,wBAAkB,cAAc;AAChC,iCAA2B,gBAAgB,QAAQ;AAAA,IACrD;AAAA,IACA,CAAC,wBAAwB;AAAA,EAC3B;AAKA,QAAM,oBAAgB,wCAAgB;AACtC,QAAM,qBAAiB,4CAAkB,EAAE,kBAAkB,cAAc,CAAC;AAO5E,QAAM,6BAAyB,4DAA0B;AAAA,IACvD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAID,QAAM,0BAAsB,wCAAgB,EAAE,gBAAgB,4BAA4B,iBAAiB,CAAC;AAE5G,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": ["React"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/parts/DSMenuBehaviouralContextProvider/utils/nodeGettersByCriterias.ts", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable no-console */\n/* eslint-disable max-lines */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type { DSMenuButtonT } from '../../../react-desc-prop-types.js';\nimport {\n isFocusableNode,\n isGroup,\n isMenuNodeAllowedToHaveChildren,\n isMultipleSelectNode,\n isSelectionableNode,\n isSelectionableWithSubmenuNode,\n isSingleSelectNode,\n isWithSubmenuNode,\n} from '../../../utils/nodesTypeguardsAndGetters.js';\nimport { TREE_STRUCTURE_ERRORS, UNEXPECTED_INTERNAL_ERRORS } from '../constants/Errors.js';\n\nexport const getSubMenusPath = (itemNode: DSMenuButtonT.MenuNode) => {\n const subMenuNodesPath: DSMenuButtonT.WithSubmenuMenuNodes[] = [];\n itemNode.walkParents((node) => {\n // discards itself, we want the parents only\n if (node.dsId === itemNode.dsId) return true;\n if (isWithSubmenuNode(node)) {\n subMenuNodesPath.push(node);\n }\n return true;\n });\n return subMenuNodesPath.reverse();\n};\n\nexport const getFocusableSiblingsList = (itemNode: DSMenuButtonT.MenuNode) => {\n const { parent: parentNode } = itemNode;\n if (!parentNode) {\n console.log('getFocusableSiblingsList > itemNode', itemNode);\n throw UNEXPECTED_INTERNAL_ERRORS.NODE_WITHOUT_PARENT;\n }\n if (!isMenuNodeAllowedToHaveChildren(parentNode)) {\n // this should be impossible to reach, if this is reached, there is a bug in the code/validation checks\n console.log('parentNode', parentNode);\n console.log('itemNode', itemNode);\n throw TREE_STRUCTURE_ERRORS.NODE_CANNOT_HAVE_CHILDREN;\n }\n // each tree depth may be composed of a mix of focusable and non-focusable nodes\n // in particular, the parent node may be a group node which is not focusable but it's children are (and are visually siblings)\n // we need to do our calculations only on top of focusable nodes, and we also need to consider the scenario of a group node\n const focusableSiblingsNodes: DSMenuButtonT.PseudoFocusableMenuNodes[] = [];\n\n let parseableParentNode = parentNode;\n // nesting a group node inside another group node is not allowed\n // I could not find a supporting explicit statement in the WCAG standard,\n // but given how everything else is defined and graphically represented,\n // it's the only logical conclusion.\n // Nesting would result in nodes being visually siblings\n // but logically non-exclusively selectable,\n // which would be a contradiction of the visuals\n // so violating the WCAG standard for other reasons\n if (isGroup(parentNode)) {\n if (!parentNode.parent) {\n throw TREE_STRUCTURE_ERRORS.GROUP_WITHOUT_PARENT;\n }\n parseableParentNode = parentNode.parent;\n }\n\n parseableParentNode.children.forEach((node) => {\n if (isFocusableNode(node)) {\n focusableSiblingsNodes.push(node);\n }\n // if we encounter a group node we need to add it's children too\n // (which here is guaranteed because we checked it in the if statement above)\n if (isGroup(node)) {\n node.children.forEach((groupChild) => {\n if (isFocusableNode(groupChild)) {\n focusableSiblingsNodes.push(groupChild);\n }\n });\n }\n });\n\n return focusableSiblingsNodes;\n};\n\n/**\n * This functions walks the tree downwards starting from the oldest shared parent and returns all the single-selectable items ids\n * @param oldestParent - the oldest parent to start the walk from\n * @returns string | number[] - the list of all the single-selectable items ids starting from the oldest shared group\n */\nexport const getAllSingleSelectIdsFromParent = (oldestParent: DSMenuButtonT.MenuNodesAllowedToHaveChildren) => {\n const singleSelectionableItemsIds: (string | number)[] = [];\n oldestParent.walk((node) => {\n // DSTree typescript doesn't understand ethereogeneous subitems, so we need to typecast manually\n const typeCastedNode = node as unknown as\n | DSMenuButtonT.SingleSelectionableMenuNodes\n | DSMenuButtonT.MenuNodeSeparatorItem;\n // is the node is a single-selectable item, we add it to the list\n if (isSingleSelectNode(typeCastedNode)) {\n singleSelectionableItemsIds.push(node.dsId);\n }\n // we walk all the tree (from the shared group), we never shortcircuit\n return true;\n });\n return singleSelectionableItemsIds;\n};\n\n/**\n * walk all parents from a given node and gives back multiple supporting datastructures by different criterias\n *\n * @param menuNode\n * @returns {object} - an object holding different datastructures and information about the parents\n * @property {Object} oldestGroup - the oldest shared group\n * @property {Object[]} selectionableParentsWithSubmenu - the single/multiple selection parents with submenu\n * @property {Object[]} groupParents - all the 'groups' encountered while traversing the tree upwards\n */\nexport const getParentsByCriterias = (menuNode: DSMenuButtonT.MenuNode) => {\n // group\n let oldestGroupFoundSoFar: DSMenuButtonT.MenuNodeGroupItem;\n const selectionableParentsWithSubmenu: DSMenuButtonT.SelectionablesWithSubmenuMenuNodes[] = [];\n const groupParents: DSMenuButtonT.MenuNodeGroupItem[] = [];\n\n menuNode.walkParents((node) => {\n // discards itself, we want the parents only\n if (node.dsId === menuNode.dsId) return true;\n // DSTree is not able to understand ethereogeneous subitems, so we need to typecast manually\n const typeCastedNode = node as unknown as DSMenuButtonT.MenuNode;\n\n if (isGroup(typeCastedNode)) {\n oldestGroupFoundSoFar = typeCastedNode;\n groupParents.push(oldestGroupFoundSoFar);\n // nothing else to do in this walking step, returing true to continue the walk\n return true;\n }\n // we continue checking shared parents untill we see the pattern\n // group -> single-select-with-submenu -> group -> ...\n // the moment the parent of a group is not a single-select-with-submenu we can stop,\n // we have found the oldest shared group\n if (isSelectionableWithSubmenuNode(typeCastedNode)) {\n selectionableParentsWithSubmenu.push(typeCastedNode);\n return true;\n }\n // the node is not a single-select-with-submenu, we can stop the walk\n return true;\n });\n // if we found no group parent starting from menuNode, the tree is malformed\n // @ts-expect-error - typescript doesn't understand that \"walkParents\" actually executes the function synchronously\n // so it thinks that oldestGroupFoundSoFar was never assigned, it's a false positive\n if (!oldestGroupFoundSoFar) {\n console.log('node:', menuNode);\n console.log('parent:', menuNode.parent);\n throw TREE_STRUCTURE_ERRORS.PARENT_NOT_GROUP;\n }\n return {\n oldestGroup: oldestGroupFoundSoFar,\n selectionableParentsWithSubmenu,\n groupParents,\n };\n};\n\n/**\n * walk all childrens from a given node and gives back multiple supporting datastructures by different criterias\n *\n * @param menuNode\n * @returns {object} - an object holding different datastructures and information about the children\n * @property {Object[]} selectionableChilrens - the single/multiple selection children (regardless of the presence of a submenu)\n * @property {Object[]} multiSelectionableChilrens - the multiple selection children (regardless of the presence of a submenu)\n */\nexport const getChildrenByCriterias = (menuNode: DSMenuButtonT.MenuNode) => {\n const selectionableChilrens: DSMenuButtonT.SelectionableMenuNodes[] = [];\n const multiSelectionableChilrens: DSMenuButtonT.MultipleSelectionableMenuNodes[] = [];\n menuNode.walk((node) => {\n // discards itself, we want the children only\n if (node.dsId === menuNode.dsId) return true;\n // DSTree is not able to understand ethereogeneous subitems, so we need to typecast manually\n const typeCastedNode = node as unknown as DSMenuButtonT.MenuNode;\n if (isSelectionableNode(typeCastedNode)) {\n selectionableChilrens.push(typeCastedNode);\n if (isMultipleSelectNode(typeCastedNode)) {\n multiSelectionableChilrens.push(typeCastedNode);\n }\n }\n // we walk all the tree (from the shared group), we never shortcircuit\n return true;\n });\n return {\n selectionableChilrens,\n multiSelectionableChilrens,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,uCASO;AACP,oBAAkE;AAE3D,MAAM,kBAAkB,CAAC,aAAqC;AACnE,QAAM,mBAAyD,CAAC;AAChE,WAAS,YAAY,CAAC,SAAS;AAE7B,QAAI,KAAK,SAAS,SAAS,KAAM,QAAO;AACxC,YAAI,oDAAkB,IAAI,GAAG;AAC3B,uBAAiB,KAAK,IAAI;AAAA,IAC5B;AACA,WAAO;AAAA,EACT,CAAC;AACD,SAAO,iBAAiB,QAAQ;AAClC;AAEO,MAAM,2BAA2B,CAAC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AAG;AAC3B,8BAAwB;AACxB,mBAAa,KAAK,qBAAqB;AAEvC,aAAO;AAAA,IACT;AAKA,YAAI,iEAA+B,cAAc,GAAG;AAClD,sCAAgC,KAAK,cAAc;AACnD,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AAID,MAAI,CAAC,uBAAuB;AAC1B,YAAQ,IAAI,SAAS,QAAQ;AAC7B,YAAQ,IAAI,WAAW,SAAS,MAAM;AACtC,UAAM,oCAAsB;AAAA,EAC9B;AACA,SAAO;AAAA,IACL,aAAa;AAAA,IACb;AAAA,IACA;AAAA,EACF;AACF;AAUO,MAAM,yBAAyB,CAAC,aAAqC;AAC1E,QAAM,wBAAgE,CAAC;AACvE,QAAM,6BAA6E,CAAC;AACpF,WAAS,KAAK,CAAC,SAAS;AAEtB,QAAI,KAAK,SAAS,SAAS,KAAM,QAAO;AAExC,UAAM,iBAAiB;AACvB,YAAI,sDAAoB,cAAc,GAAG;AACvC,4BAAsB,KAAK,cAAc;AACzC,cAAI,uDAAqB,cAAc,GAAG;AACxC,mCAA2B,KAAK,cAAc;AAAA,MAChD;AAAA,IACF;AAEA,WAAO;AAAA,EACT,CAAC;AACD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["/* eslint-disable no-console */\n/* eslint-disable max-lines */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type { DSMenuButtonT } from '../../../react-desc-prop-types.js';\nimport {\n isFocusableNode,\n isGroup,\n isMenuNodeAllowedToHaveChildren,\n isMultipleSelectNode,\n isSelectionableNode,\n isSelectionableWithSubmenuNode,\n isSingleSelectNode,\n isWithSubmenuNode,\n} from '../../../utils/nodesTypeguardsAndGetters.js';\nimport { TREE_STRUCTURE_ERRORS, UNEXPECTED_INTERNAL_ERRORS } from '../constants/Errors.js';\n\nexport const getSubMenusPath = (itemNode: DSMenuButtonT.MenuNode) => {\n const subMenuNodesPath: DSMenuButtonT.WithSubmenuMenuNodes[] = [];\n itemNode.walkParents((node) => {\n // discards itself, we want the parents only\n if (node.dsId === itemNode.dsId) return true;\n if (isWithSubmenuNode(node)) {\n subMenuNodesPath.push(node);\n }\n return true;\n });\n return subMenuNodesPath.reverse();\n};\n\nexport const getFocusableSiblingsList = (itemNode: DSMenuButtonT.MenuNode) => {\n const { parent: parentNode } = itemNode;\n if (!parentNode) {\n console.log('getFocusableSiblingsList > itemNode', itemNode);\n throw UNEXPECTED_INTERNAL_ERRORS.NODE_WITHOUT_PARENT;\n }\n if (!isMenuNodeAllowedToHaveChildren(parentNode)) {\n // this should be impossible to reach, if this is reached, there is a bug in the code/validation checks\n console.log('parentNode', parentNode);\n console.log('itemNode', itemNode);\n throw TREE_STRUCTURE_ERRORS.NODE_CANNOT_HAVE_CHILDREN;\n }\n // each tree depth may be composed of a mix of focusable and non-focusable nodes\n // in particular, the parent node may be a group node which is not focusable but it's children are (and are visually siblings)\n // we need to do our calculations only on top of focusable nodes, and we also need to consider the scenario of a group node\n const focusableSiblingsNodes: DSMenuButtonT.PseudoFocusableMenuNodes[] = [];\n\n let parseableParentNode = parentNode;\n // nesting a group node inside another group node is not allowed\n // I could not find a supporting explicit statement in the WCAG standard,\n // but given how everything else is defined and graphically represented,\n // it's the only logical conclusion.\n // Nesting would result in nodes being visually siblings\n // but logically non-exclusively selectable,\n // which would be a contradiction of the visuals\n // so violating the WCAG standard for other reasons\n if (isGroup(parentNode)) {\n if (!parentNode.parent) {\n throw TREE_STRUCTURE_ERRORS.GROUP_WITHOUT_PARENT;\n }\n parseableParentNode = parentNode.parent;\n }\n\n parseableParentNode.children.forEach((node) => {\n if (isFocusableNode(node)) {\n focusableSiblingsNodes.push(node);\n }\n // if we encounter a group node we need to add it's children too\n // (which here is guaranteed because we checked it in the if statement above)\n if (isGroup(node)) {\n node.children.forEach((groupChild) => {\n if (isFocusableNode(groupChild)) {\n focusableSiblingsNodes.push(groupChild);\n }\n });\n }\n });\n\n return focusableSiblingsNodes;\n};\n\n/**\n * This functions walks the tree downwards starting from the oldest shared parent and returns all the single-selectable items ids\n * @param oldestParent - the oldest parent to start the walk from\n * @returns string | number[] - the list of all the single-selectable items ids starting from the oldest shared group\n */\nexport const getAllSingleSelectIdsFromParent = (oldestParent: DSMenuButtonT.MenuNodesAllowedToHaveChildren) => {\n const singleSelectionableItemsIds: (string | number)[] = [];\n oldestParent.walk((node) => {\n // DSTree typescript doesn't understand ethereogeneous subitems, so we need to typecast manually\n const typeCastedNode = node as unknown as\n DSMenuButtonT.SingleSelectionableMenuNodes | DSMenuButtonT.MenuNodeSeparatorItem;\n // is the node is a single-selectable item, we add it to the list\n if (isSingleSelectNode(typeCastedNode)) {\n singleSelectionableItemsIds.push(node.dsId);\n }\n // we walk all the tree (from the shared group), we never shortcircuit\n return true;\n });\n return singleSelectionableItemsIds;\n};\n\n/**\n * walk all parents from a given node and gives back multiple supporting datastructures by different criterias\n *\n * @param menuNode\n * @returns {object} - an object holding different datastructures and information about the parents\n * @property {Object} oldestGroup - the oldest shared group\n * @property {Object[]} selectionableParentsWithSubmenu - the single/multiple selection parents with submenu\n * @property {Object[]} groupParents - all the 'groups' encountered while traversing the tree upwards\n */\nexport const getParentsByCriterias = (menuNode: DSMenuButtonT.MenuNode) => {\n // group\n let oldestGroupFoundSoFar: DSMenuButtonT.MenuNodeGroupItem;\n const selectionableParentsWithSubmenu: DSMenuButtonT.SelectionablesWithSubmenuMenuNodes[] = [];\n const groupParents: DSMenuButtonT.MenuNodeGroupItem[] = [];\n\n menuNode.walkParents((node) => {\n // discards itself, we want the parents only\n if (node.dsId === menuNode.dsId) return true;\n // DSTree is not able to understand ethereogeneous subitems, so we need to typecast manually\n const typeCastedNode = node as unknown as DSMenuButtonT.MenuNode;\n\n if (isGroup(typeCastedNode)) {\n oldestGroupFoundSoFar = typeCastedNode;\n groupParents.push(oldestGroupFoundSoFar);\n // nothing else to do in this walking step, returing true to continue the walk\n return true;\n }\n // we continue checking shared parents untill we see the pattern\n // group -> single-select-with-submenu -> group -> ...\n // the moment the parent of a group is not a single-select-with-submenu we can stop,\n // we have found the oldest shared group\n if (isSelectionableWithSubmenuNode(typeCastedNode)) {\n selectionableParentsWithSubmenu.push(typeCastedNode);\n return true;\n }\n // the node is not a single-select-with-submenu, we can stop the walk\n return true;\n });\n // if we found no group parent starting from menuNode, the tree is malformed\n // @ts-expect-error - typescript doesn't understand that \"walkParents\" actually executes the function synchronously\n // so it thinks that oldestGroupFoundSoFar was never assigned, it's a false positive\n if (!oldestGroupFoundSoFar) {\n console.log('node:', menuNode);\n console.log('parent:', menuNode.parent);\n throw TREE_STRUCTURE_ERRORS.PARENT_NOT_GROUP;\n }\n return {\n oldestGroup: oldestGroupFoundSoFar,\n selectionableParentsWithSubmenu,\n groupParents,\n };\n};\n\n/**\n * walk all childrens from a given node and gives back multiple supporting datastructures by different criterias\n *\n * @param menuNode\n * @returns {object} - an object holding different datastructures and information about the children\n * @property {Object[]} selectionableChilrens - the single/multiple selection children (regardless of the presence of a submenu)\n * @property {Object[]} multiSelectionableChilrens - the multiple selection children (regardless of the presence of a submenu)\n */\nexport const getChildrenByCriterias = (menuNode: DSMenuButtonT.MenuNode) => {\n const selectionableChilrens: DSMenuButtonT.SelectionableMenuNodes[] = [];\n const multiSelectionableChilrens: DSMenuButtonT.MultipleSelectionableMenuNodes[] = [];\n menuNode.walk((node) => {\n // discards itself, we want the children only\n if (node.dsId === menuNode.dsId) return true;\n // DSTree is not able to understand ethereogeneous subitems, so we need to typecast manually\n const typeCastedNode = node as unknown as DSMenuButtonT.MenuNode;\n if (isSelectionableNode(typeCastedNode)) {\n selectionableChilrens.push(typeCastedNode);\n if (isMultipleSelectNode(typeCastedNode)) {\n multiSelectionableChilrens.push(typeCastedNode);\n }\n }\n // we walk all the tree (from the shared group), we never shortcircuit\n return true;\n });\n return {\n selectionableChilrens,\n multiSelectionableChilrens,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;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X = require("../DSMenuBehaviouralCont
39
39
  var import_constants = require("../DSMenuBehaviouralContextProvider/constants/index.js");
40
40
  var import_focusNodeRacingConditionSolved = require("./focusNodeRacingConditionSolved.js");
41
41
  var import_MenuButtonContextProviderCTX = require("../../MenuButtonContextProviderCTX.js");
42
- const ActivableMenuItem = ({
43
- itemNode
44
- }) => {
42
+ const ActivableMenuItem = ({ itemNode, ariaPosInSet, ariaSetSize }) => {
45
43
  const { dsId, plainItem } = itemNode;
46
44
  const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;
47
45
  const {
@@ -100,6 +98,8 @@ const ActivableMenuItem = ({
100
98
  role: "menuitem",
101
99
  tabIndex: isFocused ? 0 : -1,
102
100
  "aria-disabled": disabled,
101
+ "aria-posinset": ariaPosInSet,
102
+ "aria-setsize": ariaSetSize,
103
103
  applyAriaDisabled: disabled,
104
104
  getOwnerProps,
105
105
  getOwnerPropsArguments,
@@ -115,7 +115,16 @@ const ActivableMenuItem = ({
115
115
  getOwnerPropsArguments,
116
116
  children: [
117
117
  LeftDecComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LeftDecComponent, {}) : null,
118
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyleMenuItemLabel, { getOwnerProps, getOwnerPropsArguments, children: label }),
118
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
119
+ import_ds_menu_items_commons.StyleMenuItemLabel,
120
+ {
121
+ getOwnerProps,
122
+ getOwnerPropsArguments,
123
+ variant: "b2",
124
+ component: "span",
125
+ children: label
126
+ }
127
+ ),
119
128
  secondaryLabel !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
120
129
  import_ds_menu_items_commons.StyleMenuItemSecondaryLabel,
121
130
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/DSMenuItemRendererFactory/ActivableMenuItem.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-lines */\nimport {\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n StyledContentWrapper,\n StyledGlobalMenuItemWrapper,\n} from '@elliemae/ds-menu-items-commons';\nimport React, { useCallback } from 'react';\nimport type { DSMenuButtonT } from '../../react-desc-prop-types.js';\nimport { MenuBehaviouralContextProviderContext } from '../DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js';\nimport { MENU_FOCUS_REGIONS } from '../DSMenuBehaviouralContextProvider/constants/index.js';\nimport { focusNodeRacingConditionSolved } from './focusNodeRacingConditionSolved.js';\nimport { MenuButtonContextProvider } from '../../MenuButtonContextProviderCTX.js';\nexport const ActivableMenuItem: React.ComponentType<{ itemNode: DSMenuButtonT.MenuNodeActivableItem }> = ({\n itemNode,\n}) => {\n const { dsId, plainItem } = itemNode;\n const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;\n\n const {\n ownerProps: { getOwnerProps },\n } = React.useContext(MenuButtonContextProvider);\n\n const getOwnerPropsArguments = useCallback(() => plainItem, [plainItem]);\n const {\n focusRegion,\n menuItemEventsHandlers: {\n handleFocusableMenuItemKeyDown,\n handleFocusableMenuItemClick,\n handleFocusableMenuItemOnMouseEnter,\n handleFocusableMenuItemNativeFocusEvent,\n },\n } = React.useContext(MenuBehaviouralContextProviderContext);\n\n const gridLayout = React.useMemo(() => {\n const cols = LeftDecComponent ? ['min-content', 'auto'] : ['auto'];\n if (secondaryLabel) cols.push('auto');\n return cols;\n }, [LeftDecComponent, secondaryLabel]);\n\n const focusedRegionPerformanceHelper = React.useRef(focusRegion);\n focusedRegionPerformanceHelper.current = focusRegion;\n\n const isFocused = focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId);\n\n const handleFocusOnRender = React.useCallback(\n (node: HTMLDivElement) => {\n if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {\n focusNodeRacingConditionSolved(node);\n }\n },\n // we need to change the callback reference every time the focusRegion changes or else the focus will not be set\n [dsId, focusRegion],\n // we are using the \"as='div'\", typescript is not able to infer the correct type\n // the logic here actually receives a ref to a HTMLDivElement,\n // but the component must think this is a HTMLLIElement ref callback\n ) as unknown as React.RefCallback<HTMLLIElement>;\n const handleOnMouseEnter = React.useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n handleFocusableMenuItemOnMouseEnter(itemNode);\n }, [handleFocusableMenuItemOnMouseEnter, itemNode]);\n const handleOnFocus = React.useCallback<React.FocusEventHandler<HTMLDivElement>>(\n (e) => {\n handleFocusableMenuItemNativeFocusEvent(itemNode, e);\n },\n [handleFocusableMenuItemNativeFocusEvent, itemNode],\n );\n\n const spacelessDsIdForDom = `ds-menu-item-${`${dsId}`.replace(/\\s/g, '')}`;\n\n return (\n <StyledGlobalMenuItemWrapper\n innerRef={handleFocusOnRender}\n onKeyDown={handleFocusableMenuItemKeyDown}\n onClick={handleFocusableMenuItemClick}\n onMouseEnter={handleOnMouseEnter}\n onFocus={handleOnFocus}\n as=\"div\"\n id={`${spacelessDsIdForDom}`}\n role=\"menuitem\"\n tabIndex={isFocused ? 0 : -1}\n aria-disabled={disabled}\n applyAriaDisabled={disabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n minWidth={minWidth ?? undefined}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {LeftDecComponent ? <LeftDecComponent /> : null}\n <StyleMenuItemLabel getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n {label}\n </StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n disabled={disabled}\n >\n {secondaryLabel}\n </StyleMenuItemSecondaryLabel>\n )}\n </StyledContentWrapper>\n </StyledGlobalMenuItemWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqFjB;AApFN,mCAKO;AACP,mBAAmC;AAEnC,+CAAsD;AACtD,uBAAmC;AACnC,4CAA+C;AAC/C,0CAA0C;AACnC,MAAM,oBAA4F,CAAC;AAAA,EACxG;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,UAAU,IAAI;AAC5B,QAAM,EAAE,OAAO,gBAAgB,gBAAgB,kBAAkB,UAAU,SAAS,IAAI;AAExF,QAAM;AAAA,IACJ,YAAY,EAAE,cAAc;AAAA,EAC9B,IAAI,aAAAA,QAAM,WAAW,6DAAyB;AAE9C,QAAM,6BAAyB,0BAAY,MAAM,WAAW,CAAC,SAAS,CAAC;AACvE,QAAM;AAAA,IACJ;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,IAAI,aAAAA,QAAM,WAAW,8EAAqC;AAE1D,QAAM,aAAa,aAAAA,QAAM,QAAQ,MAAM;AACrC,UAAM,OAAO,mBAAmB,CAAC,eAAe,MAAM,IAAI,CAAC,MAAM;AACjE,QAAI,eAAgB,MAAK,KAAK,MAAM;AACpC,WAAO;AAAA,EACT,GAAG,CAAC,kBAAkB,cAAc,CAAC;AAErC,QAAM,iCAAiC,aAAAA,QAAM,OAAO,WAAW;AAC/D,iCAA+B,UAAU;AAEzC,QAAM,YAAY,gBAAgB,oCAAmB,aAAa,IAAI;AAEtE,QAAM,sBAAsB,aAAAA,QAAM;AAAA,IAChC,CAAC,SAAyB;AACxB,UAAI,QAAQ,gBAAgB,oCAAmB,aAAa,IAAI,GAAG;AACjE,kFAA+B,IAAI;AAAA,MACrC;AAAA,IACF;AAAA;AAAA,IAEA,CAAC,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA,EAIpB;AACA,QAAM,qBAAqB,aAAAA,QAAM,YAAqD,MAAM;AAC1F,wCAAoC,QAAQ;AAAA,EAC9C,GAAG,CAAC,qCAAqC,QAAQ,CAAC;AAClD,QAAM,gBAAgB,aAAAA,QAAM;AAAA,IAC1B,CAAC,MAAM;AACL,8CAAwC,UAAU,CAAC;AAAA,IACrD;AAAA,IACA,CAAC,yCAAyC,QAAQ;AAAA,EACpD;AAEA,QAAM,sBAAsB,gBAAgB,GAAG,IAAI,GAAG,QAAQ,OAAO,EAAE,CAAC;AAExE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,WAAW;AAAA,MACX,SAAS;AAAA,MACT,cAAc;AAAA,MACd,SAAS;AAAA,MACT,IAAG;AAAA,MACH,IAAI,GAAG,mBAAmB;AAAA,MAC1B,MAAK;AAAA,MACL,UAAU,YAAY,IAAI;AAAA,MAC1B,iBAAe;AAAA,MACf,mBAAmB;AAAA,MACnB;AAAA,MACA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,WAAU;AAAA,UACV,QAAO;AAAA,UACP,YAAW;AAAA,UACX,UAAU,YAAY;AAAA,UACtB;AAAA,UACA;AAAA,UAEC;AAAA,+BAAmB,4CAAC,oBAAiB,IAAK;AAAA,YAC3C,4CAAC,mDAAmB,eAA8B,wBAC/C,iBACH;AAAA,YACC,mBAAmB,UAClB;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA;AAAA,gBAEC;AAAA;AAAA,YACH;AAAA;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;",
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport {\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n StyledContentWrapper,\n StyledGlobalMenuItemWrapper,\n} from '@elliemae/ds-menu-items-commons';\nimport React, { useCallback } from 'react';\nimport type { DSMenuButtonT } from '../../react-desc-prop-types.js';\nimport { MenuBehaviouralContextProviderContext } from '../DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js';\nimport { MENU_FOCUS_REGIONS } from '../DSMenuBehaviouralContextProvider/constants/index.js';\nimport { focusNodeRacingConditionSolved } from './focusNodeRacingConditionSolved.js';\nimport { MenuButtonContextProvider } from '../../MenuButtonContextProviderCTX.js';\nexport const ActivableMenuItem: React.ComponentType<{\n itemNode: DSMenuButtonT.MenuNodeActivableItem;\n ariaPosInSet?: number;\n ariaSetSize?: number;\n}> = ({ itemNode, ariaPosInSet, ariaSetSize }) => {\n const { dsId, plainItem } = itemNode;\n const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;\n\n const {\n ownerProps: { getOwnerProps },\n } = React.useContext(MenuButtonContextProvider);\n\n const getOwnerPropsArguments = useCallback(() => plainItem, [plainItem]);\n const {\n focusRegion,\n menuItemEventsHandlers: {\n handleFocusableMenuItemKeyDown,\n handleFocusableMenuItemClick,\n handleFocusableMenuItemOnMouseEnter,\n handleFocusableMenuItemNativeFocusEvent,\n },\n } = React.useContext(MenuBehaviouralContextProviderContext);\n\n const gridLayout = React.useMemo(() => {\n const cols = LeftDecComponent ? ['min-content', 'auto'] : ['auto'];\n if (secondaryLabel) cols.push('auto');\n return cols;\n }, [LeftDecComponent, secondaryLabel]);\n\n const focusedRegionPerformanceHelper = React.useRef(focusRegion);\n focusedRegionPerformanceHelper.current = focusRegion;\n\n const isFocused = focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId);\n\n const handleFocusOnRender = React.useCallback(\n (node: HTMLDivElement) => {\n if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {\n focusNodeRacingConditionSolved(node);\n }\n },\n // we need to change the callback reference every time the focusRegion changes or else the focus will not be set\n [dsId, focusRegion],\n // we are using the \"as='div'\", typescript is not able to infer the correct type\n // the logic here actually receives a ref to a HTMLDivElement,\n // but the component must think this is a HTMLLIElement ref callback\n ) as unknown as React.RefCallback<HTMLLIElement>;\n const handleOnMouseEnter = React.useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n handleFocusableMenuItemOnMouseEnter(itemNode);\n }, [handleFocusableMenuItemOnMouseEnter, itemNode]);\n const handleOnFocus = React.useCallback<React.FocusEventHandler<HTMLDivElement>>(\n (e) => {\n handleFocusableMenuItemNativeFocusEvent(itemNode, e);\n },\n [handleFocusableMenuItemNativeFocusEvent, itemNode],\n );\n\n const spacelessDsIdForDom = `ds-menu-item-${`${dsId}`.replace(/\\s/g, '')}`;\n\n return (\n <StyledGlobalMenuItemWrapper\n innerRef={handleFocusOnRender}\n onKeyDown={handleFocusableMenuItemKeyDown}\n onClick={handleFocusableMenuItemClick}\n onMouseEnter={handleOnMouseEnter}\n onFocus={handleOnFocus}\n as=\"div\"\n id={`${spacelessDsIdForDom}`}\n role=\"menuitem\"\n tabIndex={isFocused ? 0 : -1}\n aria-disabled={disabled}\n aria-posinset={ariaPosInSet}\n aria-setsize={ariaSetSize}\n applyAriaDisabled={disabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n minWidth={minWidth ?? undefined}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {LeftDecComponent ? <LeftDecComponent /> : null}\n <StyleMenuItemLabel\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n variant=\"b2\"\n component=\"span\"\n >\n {label}\n </StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n disabled={disabled}\n >\n {secondaryLabel}\n </StyleMenuItemSecondaryLabel>\n )}\n </StyledContentWrapper>\n </StyledGlobalMenuItemWrapper>\n );\n};\n", "import * as React from 'react';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MAAM;AAC1F,wCAAoC,QAAQ;AAAA,EAC9C,GAAG,CAAC,qCAAqC,QAAQ,CAAC;AAClD,QAAM,gBAAgB,aAAAA,QAAM;AAAA,IAC1B,CAAC,MAAM;AACL,8CAAwC,UAAU,CAAC;AAAA,IACrD;AAAA,IACA,CAAC,yCAAyC,QAAQ;AAAA,EACpD;AAEA,QAAM,sBAAsB,gBAAgB,GAAG,IAAI,GAAG,QAAQ,OAAO,EAAE,CAAC;AAExE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,WAAW;AAAA,MACX,SAAS;AAAA,MACT,cAAc;AAAA,MACd,SAAS;AAAA,MACT,IAAG;AAAA,MACH,IAAI,GAAG,mBAAmB;AAAA,MAC1B,MAAK;AAAA,MACL,UAAU,YAAY,IAAI;AAAA,MAC1B,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,gBAAc;AAAA,MACd,mBAAmB;AAAA,MACnB;AAAA,MACA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,WAAU;AAAA,UACV,QAAO;AAAA,UACP,YAAW;AAAA,UACX,UAAU,YAAY;AAAA,UACtB;AAAA,UACA;AAAA,UAEC;AAAA,+BAAmB,4CAAC,oBAAiB,IAAK;AAAA,YAC3C;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA,SAAQ;AAAA,gBACR,WAAU;AAAA,gBAET;AAAA;AAAA,YACH;AAAA,YACC,mBAAmB,UAClB;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA;AAAA,gBAEC;AAAA;AAAA,YACH;AAAA;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;",
6
6
  "names": ["React"]
7
7
  }
@@ -48,7 +48,7 @@ const placementOrderPreference = [
48
48
  "left-end",
49
49
  "left"
50
50
  ];
51
- const ActivableWithSubmenuMenuItem = ({ itemNode, FlyoutMenuCircularDepInject }) => {
51
+ const ActivableWithSubmenuMenuItem = ({ itemNode, FlyoutMenuCircularDepInject, ariaPosInSet, ariaSetSize }) => {
52
52
  const { dsId, plainItem } = itemNode;
53
53
  const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;
54
54
  const {
@@ -133,6 +133,8 @@ const ActivableWithSubmenuMenuItem = ({ itemNode, FlyoutMenuCircularDepInject })
133
133
  "aria-haspopup": "menu",
134
134
  "aria-expanded": isExpanded,
135
135
  "aria-disabled": disabled,
136
+ "aria-posinset": ariaPosInSet,
137
+ "aria-setsize": ariaSetSize,
136
138
  applyAriaDisabled: disabled,
137
139
  getOwnerProps,
138
140
  getOwnerPropsArguments,
@@ -148,7 +150,16 @@ const ActivableWithSubmenuMenuItem = ({ itemNode, FlyoutMenuCircularDepInject })
148
150
  getOwnerPropsArguments,
149
151
  children: [
150
152
  LeftDecComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LeftDecComponent, {}) : null,
151
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyleMenuItemLabel, { getOwnerProps, getOwnerPropsArguments, children: label }),
153
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
154
+ import_ds_menu_items_commons.StyleMenuItemLabel,
155
+ {
156
+ getOwnerProps,
157
+ getOwnerPropsArguments,
158
+ variant: "b2",
159
+ component: "span",
160
+ children: label
161
+ }
162
+ ),
152
163
  secondaryLabel !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
153
164
  import_ds_menu_items_commons.StyleMenuItemSecondaryLabel,
154
165
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-lines */\nimport {\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n StyledContentWrapper,\n StyledGlobalMenuItemWrapper,\n} from '@elliemae/ds-menu-items-commons';\nimport React from 'react';\nimport { useFloatingContext, type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport type { DSMenuButtonT } from '../../react-desc-prop-types.js';\nimport { MenuBehaviouralContextProviderContext } from '../DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js';\nimport { MENU_FOCUS_REGIONS } from '../DSMenuBehaviouralContextProvider/constants/index.js';\nimport { type DSMenuItemRendererFactoryT } from './react-desc-prop-types.js';\nimport { focusNodeRacingConditionSolved } from './focusNodeRacingConditionSolved.js';\nimport { MenuButtonContextProvider } from '../../MenuButtonContextProviderCTX.js';\n\nconst placementOrderPreference: Required<DSHookFloatingContextT.Props>['placementOrderPreference'] = [\n 'right-start',\n 'right-start',\n 'right',\n 'left-start',\n 'left-end',\n 'left',\n];\nexport const ActivableWithSubmenuMenuItem: React.ComponentType<{\n itemNode: DSMenuButtonT.MenuNodeActivableWithSubmenuItem;\n FlyoutMenuCircularDepInject: DSMenuItemRendererFactoryT.RequiredProps['FlyoutMenuCircularDepInject'];\n}> = ({ itemNode, FlyoutMenuCircularDepInject }) => {\n const { dsId, plainItem } = itemNode;\n const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;\n\n const {\n ownerProps: { getOwnerProps },\n } = React.useContext(MenuButtonContextProvider);\n\n const {\n focusRegion,\n openedSubItems,\n menuItemEventsHandlers: {\n handleFocusableMenuItemKeyDown,\n handleFocusableMenuItemClick,\n handleFocusableMenuItemOnMouseEnter,\n handleFocusableMenuItemNativeFocusEvent,\n },\n } = React.useContext(MenuBehaviouralContextProviderContext);\n\n const gridLayout = React.useMemo(() => {\n const cols = LeftDecComponent ? ['min-content', 'auto'] : ['auto'];\n if (secondaryLabel) cols.push('auto');\n return cols;\n }, [LeftDecComponent, secondaryLabel]);\n\n const focusedRegionPerformanceHelper = React.useRef(focusRegion);\n focusedRegionPerformanceHelper.current = focusRegion;\n\n const isExpanded = openedSubItems.some((itemWithOpenSubmenu) => itemWithOpenSubmenu.dsId === dsId);\n const isFocused = focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId);\n\n const floatingContext = useFloatingContext({\n placement: placementOrderPreference[0],\n placementOrderPreference,\n animationDuration: 100,\n customOffset: [0, 0],\n externallyControlledIsOpen: isExpanded,\n });\n const {\n refs: { setReference },\n } = floatingContext;\n\n const handleFocusOnRender = React.useCallback(\n (node: HTMLDivElement) => {\n setReference(node);\n if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {\n focusNodeRacingConditionSolved(node);\n }\n },\n // we need to change the callback reference every time the focusRegion changes or else the focus will not be set\n [dsId, focusRegion, setReference],\n // we are using the \"as='div'\", typescript is not able to infer the correct type\n // the logic here actually receives a ref to a HTMLDivElement,\n // but the component must think this is a HTMLLIElement ref callback\n ) as unknown as React.RefCallback<HTMLLIElement>;\n\n const getOwnerPropsArguments = React.useCallback(() => plainItem, [plainItem]);\n\n const handleOnMouseEnter = React.useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n handleFocusableMenuItemOnMouseEnter(itemNode);\n }, [handleFocusableMenuItemOnMouseEnter, itemNode]);\n const handleOnFocus = React.useCallback<React.FocusEventHandler<HTMLDivElement>>(\n (e) => {\n handleFocusableMenuItemNativeFocusEvent(itemNode, e);\n },\n [handleFocusableMenuItemNativeFocusEvent, itemNode],\n );\n\n const spacelessDsIdForDom = `ds-menu-item-${`${dsId}`.replace(/\\s/g, '')}`;\n return (\n <>\n <StyledGlobalMenuItemWrapper\n innerRef={handleFocusOnRender}\n onKeyDown={handleFocusableMenuItemKeyDown}\n onClick={handleFocusableMenuItemClick}\n onMouseEnter={handleOnMouseEnter}\n onFocus={handleOnFocus}\n as=\"div\"\n id={`${spacelessDsIdForDom}`}\n tabIndex={isFocused ? 0 : -1}\n role=\"menuitem\"\n aria-controls={\n /* ********************************************************************************************************************\n * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls\n * The aria-controls only needs to be set when the popup is visible, but it is valid and easier to program to reference an element that is not visible.\n * ********************************************************************************************************************\n * ^^^ some automated tools will mark an error if the aria-controls references an element that does (yet) exist in the DOM\n * so, while technically valid to not check if expanded, we are doing it to avoid automated tools marking an error\n * ******************************************************************************************************************** */\n isExpanded\n ? itemNode.plainChildren.map((child) => `ds-menu-item-${`${child.dsId}`.replace(/\\s/g, '')}`).join(' ')\n : undefined\n }\n aria-haspopup=\"menu\"\n aria-expanded={isExpanded}\n aria-disabled={disabled}\n applyAriaDisabled={disabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n minWidth={minWidth ?? undefined}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {LeftDecComponent ? <LeftDecComponent /> : null}\n <StyleMenuItemLabel getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n {label}\n </StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n disabled={disabled}\n >\n {secondaryLabel}\n </StyleMenuItemSecondaryLabel>\n )}\n </StyledContentWrapper>\n </StyledGlobalMenuItemWrapper>\n <FlyoutMenuCircularDepInject\n isMenuOpen={isExpanded}\n floatingContext={floatingContext.context}\n floatingStyles={floatingContext.floatingStyles}\n setFloatingRef={floatingContext.refs.setFloating}\n itemNode={itemNode}\n />\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiGnB;AAhGJ,mCAKO;AACP,mBAAkB;AAClB,iCAAgE;AAEhE,+CAAsD;AACtD,uBAAmC;AAEnC,4CAA+C;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AiB,IAAK;AAAA,cAC3C,4CAAC,mDAAmB,eAA8B,wBAC/C,iBACH;AAAA,cACC,mBAAmB,UAClB;AAAA,gBAAC;AAAA;AAAA,kBACC;AAAA,kBACA;AAAA,kBACA;AAAA,kBAEC;AAAA;AAAA,cACH;AAAA;AAAA;AAAA,QAEJ;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,YAAY;AAAA,QACZ,iBAAiB,gBAAgB;AAAA,QACjC,gBAAgB,gBAAgB;AAAA,QAChC,gBAAgB,gBAAgB,KAAK;AAAA,QACrC;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;",
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport {\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n StyledContentWrapper,\n StyledGlobalMenuItemWrapper,\n} from '@elliemae/ds-menu-items-commons';\nimport React from 'react';\nimport { useFloatingContext, type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport type { DSMenuButtonT } from '../../react-desc-prop-types.js';\nimport { MenuBehaviouralContextProviderContext } from '../DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js';\nimport { MENU_FOCUS_REGIONS } from '../DSMenuBehaviouralContextProvider/constants/index.js';\nimport { type DSMenuItemRendererFactoryT } from './react-desc-prop-types.js';\nimport { focusNodeRacingConditionSolved } from './focusNodeRacingConditionSolved.js';\nimport { MenuButtonContextProvider } from '../../MenuButtonContextProviderCTX.js';\n\nconst placementOrderPreference: Required<DSHookFloatingContextT.Props>['placementOrderPreference'] = [\n 'right-start',\n 'right-start',\n 'right',\n 'left-start',\n 'left-end',\n 'left',\n];\nexport const ActivableWithSubmenuMenuItem: React.ComponentType<{\n itemNode: DSMenuButtonT.MenuNodeActivableWithSubmenuItem;\n FlyoutMenuCircularDepInject: DSMenuItemRendererFactoryT.RequiredProps['FlyoutMenuCircularDepInject'];\n ariaPosInSet?: number;\n ariaSetSize?: number;\n}> = ({ itemNode, FlyoutMenuCircularDepInject, ariaPosInSet, ariaSetSize }) => {\n const { dsId, plainItem } = itemNode;\n const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;\n\n const {\n ownerProps: { getOwnerProps },\n } = React.useContext(MenuButtonContextProvider);\n\n const {\n focusRegion,\n openedSubItems,\n menuItemEventsHandlers: {\n handleFocusableMenuItemKeyDown,\n handleFocusableMenuItemClick,\n handleFocusableMenuItemOnMouseEnter,\n handleFocusableMenuItemNativeFocusEvent,\n },\n } = React.useContext(MenuBehaviouralContextProviderContext);\n\n const gridLayout = React.useMemo(() => {\n const cols = LeftDecComponent ? ['min-content', 'auto'] : ['auto'];\n if (secondaryLabel) cols.push('auto');\n return cols;\n }, [LeftDecComponent, secondaryLabel]);\n\n const focusedRegionPerformanceHelper = React.useRef(focusRegion);\n focusedRegionPerformanceHelper.current = focusRegion;\n\n const isExpanded = openedSubItems.some((itemWithOpenSubmenu) => itemWithOpenSubmenu.dsId === dsId);\n const isFocused = focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId);\n\n const floatingContext = useFloatingContext({\n placement: placementOrderPreference[0],\n placementOrderPreference,\n animationDuration: 100,\n customOffset: [0, 0],\n externallyControlledIsOpen: isExpanded,\n });\n const {\n refs: { setReference },\n } = floatingContext;\n\n const handleFocusOnRender = React.useCallback(\n (node: HTMLDivElement) => {\n setReference(node);\n if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {\n focusNodeRacingConditionSolved(node);\n }\n },\n // we need to change the callback reference every time the focusRegion changes or else the focus will not be set\n [dsId, focusRegion, setReference],\n // we are using the \"as='div'\", typescript is not able to infer the correct type\n // the logic here actually receives a ref to a HTMLDivElement,\n // but the component must think this is a HTMLLIElement ref callback\n ) as unknown as React.RefCallback<HTMLLIElement>;\n\n const getOwnerPropsArguments = React.useCallback(() => plainItem, [plainItem]);\n\n const handleOnMouseEnter = React.useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n handleFocusableMenuItemOnMouseEnter(itemNode);\n }, [handleFocusableMenuItemOnMouseEnter, itemNode]);\n const handleOnFocus = React.useCallback<React.FocusEventHandler<HTMLDivElement>>(\n (e) => {\n handleFocusableMenuItemNativeFocusEvent(itemNode, e);\n },\n [handleFocusableMenuItemNativeFocusEvent, itemNode],\n );\n\n const spacelessDsIdForDom = `ds-menu-item-${`${dsId}`.replace(/\\s/g, '')}`;\n return (\n <>\n <StyledGlobalMenuItemWrapper\n innerRef={handleFocusOnRender}\n onKeyDown={handleFocusableMenuItemKeyDown}\n onClick={handleFocusableMenuItemClick}\n onMouseEnter={handleOnMouseEnter}\n onFocus={handleOnFocus}\n as=\"div\"\n id={`${spacelessDsIdForDom}`}\n tabIndex={isFocused ? 0 : -1}\n role=\"menuitem\"\n aria-controls={\n /* ********************************************************************************************************************\n * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls\n * The aria-controls only needs to be set when the popup is visible, but it is valid and easier to program to reference an element that is not visible.\n * ********************************************************************************************************************\n * ^^^ some automated tools will mark an error if the aria-controls references an element that does (yet) exist in the DOM\n * so, while technically valid to not check if expanded, we are doing it to avoid automated tools marking an error\n * ******************************************************************************************************************** */\n isExpanded\n ? itemNode.plainChildren.map((child) => `ds-menu-item-${`${child.dsId}`.replace(/\\s/g, '')}`).join(' ')\n : undefined\n }\n aria-haspopup=\"menu\"\n aria-expanded={isExpanded}\n aria-disabled={disabled}\n aria-posinset={ariaPosInSet}\n aria-setsize={ariaSetSize}\n applyAriaDisabled={disabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n minWidth={minWidth ?? undefined}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {LeftDecComponent ? <LeftDecComponent /> : null}\n <StyleMenuItemLabel\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n variant=\"b2\"\n component=\"span\"\n >\n {label}\n </StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n disabled={disabled}\n >\n {secondaryLabel}\n </StyleMenuItemSecondaryLabel>\n )}\n </StyledContentWrapper>\n </StyledGlobalMenuItemWrapper>\n <FlyoutMenuCircularDepInject\n isMenuOpen={isExpanded}\n floatingContext={floatingContext.context}\n floatingStyles={floatingContext.floatingStyles}\n setFloatingRef={floatingContext.refs.setFloating}\n itemNode={itemNode}\n />\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmGnB;AAlGJ,mCAKO;AACP,mBAAkB;AAClB,iCAAgE;AAEhE,+CAAsD;AACtD,uBAAmC;AAEnC,4CAA+C;AAC/C,0CAA0C;AAE1C,MAAM,2BAA+F;AAAA,EACnG;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,+BAKR,CAAC,EAAE,UAAU,6BAA6B,cAAc,YAAY,MAAM;AAC7E,QAAM,EAAE,MAAM,UAAU,IAAI;AAC5B,QAAM,EAAE,OAAO,gBAAgB,gBAAgB,kBAAkB,UAAU,SAAS,IAAI;AAExF,QAAM;AAAA,IACJ,YAAY,EAAE,cAAc;AAAA,EAC9B,IAAI,aAAAA,QAAM,WAAW,6DAAyB;AAE9C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,IAAI,aAAAA,QAAM,WAAW,8EAAqC;AAE1D,QAAM,aAAa,aAAAA,QAAM,QAAQ,MAAM;AACrC,UAAM,OAAO,mBAAm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-grid");
38
38
  var import_ds_menu_items_commons = require("@elliemae/ds-menu-items-commons");
39
39
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
40
40
  var import_ds_system = require("@elliemae/ds-system");
41
+ var import_react = __toESM(require("react"));
41
42
  var import_nodesTypeguardsAndGetters = require("../../utils/nodesTypeguardsAndGetters.js");
42
43
  var import_ActivableMenuItem = require("./ActivableMenuItem.js");
43
44
  var import_ActivableWithSubmenuMenuItem = require("./ActivableWithSubmenuMenuItem.js");
@@ -54,6 +55,8 @@ const StyledGroupLabelWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid
54
55
  name: import_constants.DSMenuItemRendererFactoryName,
55
56
  slot: import_constants.MENU_ITEM_RENDERER_FACTORY_SLOTS.GROUP_LABEL_WRAPPER
56
57
  })`
58
+ min-height: 32px;
59
+ align-items: center;
57
60
  padding: ${({ theme }) => theme.space.xxxs} ${({ theme }) => theme.space.xs};
58
61
  `;
59
62
  const StyledLabelWithLeftDecWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, {
@@ -64,44 +67,89 @@ const StyledLabelWithLeftDecWrapper = (0, import_ds_system.styled)(import_ds_gri
64
67
  `;
65
68
  const DSMenuItemRendererFactory = (props) => {
66
69
  const { propsWithDefault, instanceUid } = (0, import_useMenuItemRendererFactory.useMenuItemRendererFactory)(props);
67
- const { itemNode, ItemRenderer, FlyoutMenuCircularDepInject } = propsWithDefault;
70
+ const {
71
+ itemNode,
72
+ ItemRenderer,
73
+ FlyoutMenuCircularDepInject,
74
+ "aria-posinset": ariaPosInSet,
75
+ "aria-setsize": ariaSetSize
76
+ } = propsWithDefault;
77
+ const groupAriaPositionsByDsId = import_react.default.useMemo(
78
+ () => (0, import_nodesTypeguardsAndGetters.getAriaSetSizeAndPosInSetBySiblingList)(itemNode.children),
79
+ [itemNode.children]
80
+ );
68
81
  if (ItemRenderer) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemRenderer, { itemNode });
69
82
  if ((0, import_nodesTypeguardsAndGetters.isSeparatorNode)(itemNode))
70
83
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyledSeparatorWrapper, { as: "div", role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyledSeparator, {}) });
71
- if ((0, import_nodesTypeguardsAndGetters.isSkeletonNode)(itemNode)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SkeletonMenuItem.SkeletonMenuItem, { itemNode });
72
- if ((0, import_nodesTypeguardsAndGetters.isActivableNode)(itemNode)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ActivableMenuItem.ActivableMenuItem, { itemNode });
73
- if ((0, import_nodesTypeguardsAndGetters.isMultipleSelectOnlyNode)(itemNode)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MultipleSelectMenuItem.MultipleSelectMenuItem, { itemNode });
74
- if ((0, import_nodesTypeguardsAndGetters.isSingleSelectOnlyNode)(itemNode)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SingleSelectMenuItem.SingleSelectMenuItem, { itemNode });
84
+ if ((0, import_nodesTypeguardsAndGetters.isSkeletonNode)(itemNode))
85
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SkeletonMenuItem.SkeletonMenuItem, { itemNode, ariaPosInSet, ariaSetSize });
86
+ if ((0, import_nodesTypeguardsAndGetters.isActivableNode)(itemNode))
87
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ActivableMenuItem.ActivableMenuItem, { itemNode, ariaPosInSet, ariaSetSize });
88
+ if ((0, import_nodesTypeguardsAndGetters.isMultipleSelectOnlyNode)(itemNode))
89
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MultipleSelectMenuItem.MultipleSelectMenuItem, { itemNode, ariaPosInSet, ariaSetSize });
90
+ if ((0, import_nodesTypeguardsAndGetters.isSingleSelectOnlyNode)(itemNode))
91
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SingleSelectMenuItem.SingleSelectMenuItem, { itemNode, ariaPosInSet, ariaSetSize });
75
92
  if ((0, import_nodesTypeguardsAndGetters.isWithSubmenuOnlyNode)(itemNode))
76
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_WithSubmenuMenuItem.WithSubmenuMenuItem, { itemNode, FlyoutMenuCircularDepInject });
93
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
94
+ import_WithSubmenuMenuItem.WithSubmenuMenuItem,
95
+ {
96
+ itemNode,
97
+ FlyoutMenuCircularDepInject,
98
+ ariaPosInSet,
99
+ ariaSetSize
100
+ }
101
+ );
77
102
  if ((0, import_nodesTypeguardsAndGetters.isSingleSelectNodeWithSubmenu)(itemNode))
78
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SingleSelectWithSubmenuMenuItem.SingleSelectWithSubmenuMenuItem, { itemNode, FlyoutMenuCircularDepInject });
103
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
+ import_SingleSelectWithSubmenuMenuItem.SingleSelectWithSubmenuMenuItem,
105
+ {
106
+ itemNode,
107
+ FlyoutMenuCircularDepInject,
108
+ ariaPosInSet,
109
+ ariaSetSize
110
+ }
111
+ );
79
112
  if ((0, import_nodesTypeguardsAndGetters.isMultipleSelectWithSubmenuNode)(itemNode))
80
113
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
114
  import_MultipleSelectWithSubmenuMenuItem.MultipleSelectWithSubmenuMenuItem,
82
115
  {
83
116
  itemNode,
84
- FlyoutMenuCircularDepInject
117
+ FlyoutMenuCircularDepInject,
118
+ ariaPosInSet,
119
+ ariaSetSize
85
120
  }
86
121
  );
87
122
  if ((0, import_nodesTypeguardsAndGetters.isActivableWithSubmenuNode)(itemNode))
88
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ActivableWithSubmenuMenuItem.ActivableWithSubmenuMenuItem, { itemNode, FlyoutMenuCircularDepInject });
123
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
124
+ import_ActivableWithSubmenuMenuItem.ActivableWithSubmenuMenuItem,
125
+ {
126
+ itemNode,
127
+ FlyoutMenuCircularDepInject,
128
+ ariaPosInSet,
129
+ ariaSetSize
130
+ }
131
+ );
89
132
  if ((0, import_nodesTypeguardsAndGetters.isGroup)(itemNode)) {
90
133
  const { leftDecoration: LeftDecComponent, label, minWidth } = itemNode.plainItem;
91
134
  const spacelessIdForGroup = label ? `label-${label.replace(/\s/g, "")}` : void 0;
92
135
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { role: "group", "aria-labelledby": spacelessIdForGroup, style: minWidth ? { minWidth } : {}, children: [
93
136
  label ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StyledGroupLabelWrapper, { cols: LeftDecComponent ? ["min-content", "1fr"] : ["1fr"], children: [
94
137
  LeftDecComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LeftDecComponent, {}) : null,
95
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyledGroupLabel, { role: "presentation", id: spacelessIdForGroup, children: LeftDecComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledLabelWithLeftDecWrapper, { children: label }) : label })
138
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items_commons.StyledGroupLabel, { variant: "b3-strong", component: "span", role: "presentation", id: spacelessIdForGroup, children: LeftDecComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledLabelWithLeftDecWrapper, { children: label }) : label })
96
139
  ] }) : null,
97
- itemNode.children.map((subItemNode) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
98
- DSMenuItemRendererFactory,
99
- {
100
- itemNode: subItemNode,
101
- FlyoutMenuCircularDepInject
102
- },
103
- `item-factory-${subItemNode.dsId}-${instanceUid}`
104
- ))
140
+ itemNode.children.map((subItemNode) => {
141
+ const ariaPosition = groupAriaPositionsByDsId.get(subItemNode.dsId);
142
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
143
+ DSMenuItemRendererFactory,
144
+ {
145
+ itemNode: subItemNode,
146
+ FlyoutMenuCircularDepInject,
147
+ "aria-posinset": ariaPosition?.ariaPosInSet,
148
+ "aria-setsize": ariaPosition?.ariaSetSize
149
+ },
150
+ `item-factory-${subItemNode.dsId}-${instanceUid}`
151
+ );
152
+ })
105
153
  ] });
106
154
  }
107
155
  throw new Error(`Invalid item type: ${JSON.stringify(itemNode)}`);