@elliemae/ds-menu-button 3.45.0-rc.1 → 3.45.0-rc.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/DSMenuButton.js +16 -5
- package/dist/cjs/DSMenuButton.js.map +2 -2
- package/dist/cjs/config/useMenuButton.js +49 -18
- package/dist/cjs/config/useMenuButton.js.map +3 -3
- package/dist/cjs/config/useSplitInherithedProps.js +141 -0
- package/dist/cjs/config/useSplitInherithedProps.js.map +7 -0
- package/dist/cjs/config/useValidateProps.js.map +2 -2
- package/dist/cjs/constants/index.js +17 -4
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/index.js +7 -3
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/parts/DSFlyoutMenu/DSFlyoutMenu.js +96 -0
- package/dist/cjs/parts/DSFlyoutMenu/DSFlyoutMenu.js.map +7 -0
- package/dist/cjs/parts/DSFlyoutMenu/config/useFlyoutMenu.js +54 -0
- package/dist/cjs/parts/DSFlyoutMenu/config/useFlyoutMenu.js.map +7 -0
- package/dist/cjs/parts/{ItemFactory.js → DSFlyoutMenu/config/useValidateProps.js} +9 -35
- package/dist/cjs/parts/DSFlyoutMenu/config/useValidateProps.js.map +7 -0
- package/dist/cjs/parts/DSFlyoutMenu/constants/index.js +46 -0
- package/dist/cjs/parts/DSFlyoutMenu/constants/index.js.map +7 -0
- package/dist/cjs/{DSMenuButtonCTX.js → parts/DSFlyoutMenu/index.js} +7 -8
- package/dist/cjs/parts/DSFlyoutMenu/index.js.map +7 -0
- package/dist/cjs/parts/DSFlyoutMenu/react-desc-prop-types.js +62 -0
- package/dist/cjs/parts/DSFlyoutMenu/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/DSMenuBehaviouralContextProvider.js +70 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/DSMenuBehaviouralContextProvider.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js +40 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useFocusTracker.js +186 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useFocusTracker.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useGlobalEvents.js +89 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useGlobalEvents.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useMenuBehaviouralContextProvider.js +92 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useMenuBehaviouralContextProvider.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useMenuItemEventsHandlers.js +315 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useMenuItemEventsHandlers.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useMenuOpenStatus.js +66 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useMenuOpenStatus.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useValidateProps.js +40 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/config/useValidateProps.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/constants/Errors.js +58 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/constants/Errors.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/constants/index.js +44 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/constants/index.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/index.js +37 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/index.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/react-desc-prop-types.js +53 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/utils/multipleSelectionHelpers.js +139 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/utils/multipleSelectionHelpers.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/utils/nodeGettersByCriterias.js +144 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/utils/nodeGettersByCriterias.js.map +7 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/utils/singleSelectionHelpers.js +44 -0
- package/dist/cjs/parts/DSMenuBehaviouralContextProvider/utils/singleSelectionHelpers.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/ActivableMenuItem.js +116 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/ActivableMenuItem.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.js +159 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/DSMenuItemRendererFactory.js +97 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/DSMenuItemRendererFactory.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/MultipleSelectMenuItem.js +122 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/MultipleSelectMenuItem.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.js +173 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.js +130 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.js +176 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.js +162 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/config/useMenuItemRendererFactory.js +57 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/config/useMenuItemRendererFactory.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/config/useValidateProps.js +40 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/config/useValidateProps.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/constants/index.js +48 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/constants/index.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/index.js +37 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/index.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/react-desc-prop-types.js +51 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/useMenuItemHighlightState.js +62 -0
- package/dist/cjs/parts/DSMenuItemRendererFactory/useMenuItemHighlightState.js.map +7 -0
- package/dist/cjs/parts/DSOpinionatedButton/DSOpinionatedButton.js +100 -0
- package/dist/cjs/parts/DSOpinionatedButton/DSOpinionatedButton.js.map +7 -0
- package/dist/cjs/parts/DSOpinionatedButton/config/useOpinionatedButton.js +80 -0
- package/dist/cjs/parts/DSOpinionatedButton/config/useOpinionatedButton.js.map +7 -0
- package/dist/cjs/parts/DSOpinionatedButton/config/useTriggerEventsHandlers.js +98 -0
- package/dist/cjs/parts/DSOpinionatedButton/config/useTriggerEventsHandlers.js.map +7 -0
- package/dist/cjs/parts/DSOpinionatedButton/config/useValidateProps.js +40 -0
- package/dist/cjs/parts/DSOpinionatedButton/config/useValidateProps.js.map +7 -0
- package/dist/cjs/parts/DSOpinionatedButton/constants/index.js +48 -0
- package/dist/cjs/parts/DSOpinionatedButton/constants/index.js.map +7 -0
- package/dist/cjs/parts/DSOpinionatedButton/index.js +37 -0
- package/dist/cjs/parts/DSOpinionatedButton/index.js.map +7 -0
- package/dist/cjs/parts/DSOpinionatedButton/react-desc-prop-types.js +53 -0
- package/dist/cjs/parts/DSOpinionatedButton/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +61 -25
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/utils/nodesTypeguardsAndGetters.js +123 -0
- package/dist/cjs/utils/nodesTypeguardsAndGetters.js.map +7 -0
- package/dist/cjs/utils/useOptionsArrayToDsTree.js +55 -0
- package/dist/cjs/utils/useOptionsArrayToDsTree.js.map +7 -0
- package/dist/esm/DSMenuButton.js +19 -8
- package/dist/esm/DSMenuButton.js.map +2 -2
- package/dist/esm/config/useMenuButton.js +51 -20
- package/dist/esm/config/useMenuButton.js.map +3 -3
- package/dist/esm/config/useSplitInherithedProps.js +111 -0
- package/dist/esm/config/useSplitInherithedProps.js.map +7 -0
- package/dist/esm/config/useValidateProps.js.map +2 -2
- package/dist/esm/constants/index.js +17 -4
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/index.js +8 -4
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/parts/DSFlyoutMenu/DSFlyoutMenu.js +66 -0
- package/dist/esm/parts/DSFlyoutMenu/DSFlyoutMenu.js.map +7 -0
- package/dist/esm/parts/DSFlyoutMenu/config/useFlyoutMenu.js +24 -0
- package/dist/esm/parts/DSFlyoutMenu/config/useFlyoutMenu.js.map +7 -0
- package/dist/esm/parts/DSFlyoutMenu/config/useValidateProps.js +10 -0
- package/dist/esm/parts/DSFlyoutMenu/config/useValidateProps.js.map +7 -0
- package/dist/esm/parts/DSFlyoutMenu/constants/index.js +16 -0
- package/dist/esm/parts/DSFlyoutMenu/constants/index.js.map +7 -0
- package/dist/esm/parts/DSFlyoutMenu/index.js +7 -0
- package/dist/esm/parts/DSFlyoutMenu/index.js.map +7 -0
- package/dist/esm/parts/DSFlyoutMenu/react-desc-prop-types.js +40 -0
- package/dist/esm/parts/DSFlyoutMenu/react-desc-prop-types.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/DSMenuBehaviouralContextProvider.js +42 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/DSMenuBehaviouralContextProvider.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js +10 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useFocusTracker.js +161 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useFocusTracker.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useGlobalEvents.js +59 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useGlobalEvents.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useMenuBehaviouralContextProvider.js +65 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useMenuBehaviouralContextProvider.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useMenuItemEventsHandlers.js +292 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useMenuItemEventsHandlers.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useMenuOpenStatus.js +36 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useMenuOpenStatus.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useValidateProps.js +10 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/config/useValidateProps.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/constants/Errors.js +28 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/constants/Errors.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/constants/index.js +14 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/constants/index.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/index.js +10 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/index.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/react-desc-prop-types.js +23 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/react-desc-prop-types.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/utils/multipleSelectionHelpers.js +113 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/utils/multipleSelectionHelpers.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/utils/nodeGettersByCriterias.js +123 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/utils/nodeGettersByCriterias.js.map +7 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/utils/singleSelectionHelpers.js +14 -0
- package/dist/esm/parts/DSMenuBehaviouralContextProvider/utils/singleSelectionHelpers.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/ActivableMenuItem.js +91 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/ActivableMenuItem.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.js +134 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/DSMenuItemRendererFactory.js +78 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/DSMenuItemRendererFactory.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/MultipleSelectMenuItem.js +97 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/MultipleSelectMenuItem.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.js +148 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.js +105 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.js +151 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.js +137 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/config/useMenuItemRendererFactory.js +30 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/config/useMenuItemRendererFactory.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/config/useValidateProps.js +10 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/config/useValidateProps.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/constants/index.js +18 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/constants/index.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/index.js +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/index.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/react-desc-prop-types.js +26 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/react-desc-prop-types.js.map +7 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/useMenuItemHighlightState.js +32 -0
- package/dist/esm/parts/DSMenuItemRendererFactory/useMenuItemHighlightState.js.map +7 -0
- package/dist/esm/parts/DSOpinionatedButton/DSOpinionatedButton.js +70 -0
- package/dist/esm/parts/DSOpinionatedButton/DSOpinionatedButton.js.map +7 -0
- package/dist/esm/parts/DSOpinionatedButton/config/useOpinionatedButton.js +53 -0
- package/dist/esm/parts/DSOpinionatedButton/config/useOpinionatedButton.js.map +7 -0
- package/dist/esm/parts/DSOpinionatedButton/config/useTriggerEventsHandlers.js +68 -0
- package/dist/esm/parts/DSOpinionatedButton/config/useTriggerEventsHandlers.js.map +7 -0
- package/dist/esm/parts/DSOpinionatedButton/config/useValidateProps.js +10 -0
- package/dist/esm/parts/DSOpinionatedButton/config/useValidateProps.js.map +7 -0
- package/dist/esm/parts/DSOpinionatedButton/constants/index.js +18 -0
- package/dist/esm/parts/DSOpinionatedButton/constants/index.js.map +7 -0
- package/dist/esm/parts/DSOpinionatedButton/index.js +10 -0
- package/dist/esm/parts/DSOpinionatedButton/index.js.map +7 -0
- package/dist/esm/parts/DSOpinionatedButton/react-desc-prop-types.js +23 -0
- package/dist/esm/parts/DSOpinionatedButton/react-desc-prop-types.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +62 -26
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/utils/nodesTypeguardsAndGetters.js +93 -0
- package/dist/esm/utils/nodesTypeguardsAndGetters.js.map +7 -0
- package/dist/esm/utils/useOptionsArrayToDsTree.js +25 -0
- package/dist/esm/utils/useOptionsArrayToDsTree.js.map +7 -0
- package/dist/types/DSMenuButton.d.ts +4 -6
- package/dist/types/config/useMenuButton.d.ts +9 -13
- package/dist/types/config/useSplitInherithedProps.d.ts +495 -0
- package/dist/types/config/useValidateProps.d.ts +3 -3
- package/dist/types/constants/index.d.ts +14 -2
- package/dist/types/index.d.ts +4 -2
- package/dist/types/parts/DSFlyoutMenu/DSFlyoutMenu.d.ts +5 -0
- package/dist/types/parts/DSFlyoutMenu/config/useFlyoutMenu.d.ts +8 -0
- package/dist/types/parts/DSFlyoutMenu/config/useValidateProps.d.ts +3 -0
- package/dist/types/parts/DSFlyoutMenu/constants/index.d.ts +7 -0
- package/dist/types/parts/DSFlyoutMenu/index.d.ts +1 -0
- package/dist/types/parts/DSFlyoutMenu/react-desc-prop-types.d.ts +25 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/DSMenuBehaviouralContextProvider.d.ts +5 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.d.ts +5 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/config/useFocusTracker.d.ts +15 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/config/useGlobalEvents.d.ts +15 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/config/useMenuBehaviouralContextProvider.d.ts +15 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/config/useMenuItemEventsHandlers.d.ts +18 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/config/useMenuOpenStatus.d.ts +17 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/config/useValidateProps.d.ts +3 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/constants/Errors.d.ts +15 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/constants/index.d.ts +7 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/index.d.ts +1 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/react-desc-prop-types.d.ts +24 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/utils/multipleSelectionHelpers.d.ts +6 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/utils/nodeGettersByCriterias.d.ts +35 -0
- package/dist/types/parts/DSMenuBehaviouralContextProvider/utils/singleSelectionHelpers.d.ts +13 -0
- package/dist/types/parts/DSMenuItemRendererFactory/ActivableMenuItem.d.ts +5 -0
- package/dist/types/parts/DSMenuItemRendererFactory/ActivableWithSubmenuMenuItem.d.ts +7 -0
- package/dist/types/parts/DSMenuItemRendererFactory/DSMenuItemRendererFactory.d.ts +5 -0
- package/dist/types/parts/DSMenuItemRendererFactory/MultipleSelectMenuItem.d.ts +5 -0
- package/dist/types/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.d.ts +7 -0
- package/dist/types/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.d.ts +5 -0
- package/dist/types/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.d.ts +7 -0
- package/dist/types/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.d.ts +7 -0
- package/dist/types/parts/DSMenuItemRendererFactory/config/useMenuItemRendererFactory.d.ts +6 -0
- package/dist/types/parts/DSMenuItemRendererFactory/config/useValidateProps.d.ts +3 -0
- package/dist/types/parts/DSMenuItemRendererFactory/constants/index.d.ts +6 -0
- package/dist/types/parts/DSMenuItemRendererFactory/index.d.ts +1 -0
- package/dist/types/parts/DSMenuItemRendererFactory/react-desc-prop-types.d.ts +24 -0
- package/dist/types/parts/DSMenuItemRendererFactory/useMenuItemHighlightState.d.ts +12 -0
- package/dist/types/parts/DSOpinionatedButton/DSOpinionatedButton.d.ts +5 -0
- package/dist/types/parts/DSOpinionatedButton/config/useOpinionatedButton.d.ts +38 -0
- package/dist/types/parts/DSOpinionatedButton/config/useTriggerEventsHandlers.d.ts +14 -0
- package/dist/types/parts/DSOpinionatedButton/config/useValidateProps.d.ts +3 -0
- package/dist/types/parts/DSOpinionatedButton/constants/index.d.ts +6 -0
- package/dist/types/parts/DSOpinionatedButton/index.d.ts +1 -0
- package/dist/types/parts/DSOpinionatedButton/react-desc-prop-types.d.ts +23 -0
- package/dist/types/react-desc-prop-types.d.ts +206 -41
- package/dist/types/utils/nodesTypeguardsAndGetters.d.ts +22 -0
- package/dist/types/utils/useOptionsArrayToDsTree.d.ts +8 -0
- package/package.json +18 -16
- package/dist/cjs/DSMenuButtonCTX.js.map +0 -7
- package/dist/cjs/parts/ItemFactory.js.map +0 -7
- package/dist/cjs/parts/Menu.js +0 -125
- package/dist/cjs/parts/Menu.js.map +0 -7
- package/dist/cjs/parts/MenuButtonContent.js +0 -156
- package/dist/cjs/parts/MenuButtonContent.js.map +0 -7
- package/dist/cjs/parts/MenuItem.js +0 -252
- package/dist/cjs/parts/MenuItem.js.map +0 -7
- package/dist/cjs/styled.js +0 -132
- package/dist/cjs/styled.js.map +0 -7
- package/dist/esm/DSMenuButtonCTX.js +0 -8
- package/dist/esm/DSMenuButtonCTX.js.map +0 -7
- package/dist/esm/parts/ItemFactory.js +0 -36
- package/dist/esm/parts/ItemFactory.js.map +0 -7
- package/dist/esm/parts/Menu.js +0 -95
- package/dist/esm/parts/Menu.js.map +0 -7
- package/dist/esm/parts/MenuButtonContent.js +0 -126
- package/dist/esm/parts/MenuButtonContent.js.map +0 -7
- package/dist/esm/parts/MenuItem.js +0 -229
- package/dist/esm/parts/MenuItem.js.map +0 -7
- package/dist/esm/styled.js +0 -102
- package/dist/esm/styled.js.map +0 -7
- package/dist/types/DSMenuButtonCTX.d.ts +0 -15
- package/dist/types/parts/ItemFactory.d.ts +0 -14
- package/dist/types/parts/Menu.d.ts +0 -14
- package/dist/types/parts/MenuButtonContent.d.ts +0 -1
- package/dist/types/parts/MenuItem.d.ts +0 -21
- package/dist/types/styled.d.ts +0 -16
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSMenuItemRendererFactory/MultipleSelectWithSubmenuMenuItem.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-nested-ternary */\n/* eslint-disable max-lines */\nimport { useFloatingContext, type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport { Grid } from '@elliemae/ds-grid';\nimport { Checkmark, ChevronSmallRight, ParenthesisRemove } from '@elliemae/ds-icons';\nimport {\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n StyledContentWrapper,\n StyledGlobalMenuItemWrapper,\n} from '@elliemae/ds-menu-items-commons';\nimport React 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 { type DSMenuItemRendererFactoryT } from './react-desc-prop-types.js';\nimport { getIsMultipleSelectNodeWithSubmenuSelected } from '../DSMenuBehaviouralContextProvider/utils/multipleSelectionHelpers.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];\nconst LeftBoxlessCheckbox = React.memo(({ isSelected }: { isSelected: boolean | 'mixed' }) => (\n <Grid width=\"16px\">\n {isSelected ? (\n isSelected === 'mixed' ? (\n <ParenthesisRemove size=\"s\" color={['brand-primary', '600']} />\n ) : (\n <Checkmark size=\"s\" color={['brand-primary', '600']} />\n )\n ) : (\n <div />\n )}\n </Grid>\n));\nexport const MultipleSelectWithSubmenuMenuItem: React.ComponentType<{\n itemNode: DSMenuButtonT.MenuNodeMultipleSelectWithSubmenuItem;\n FlyoutMenuCircularDepInject: DSMenuItemRendererFactoryT.RequiredProps['FlyoutMenuCircularDepInject'];\n}> = ({ itemNode, FlyoutMenuCircularDepInject }) => {\n const { dsId, plainItem } = itemNode;\n const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;\n const floatingContext = useFloatingContext({\n placement: placementOrderPreference[0],\n placementOrderPreference,\n animationDuration: 100,\n customOffset: [0, 0],\n });\n const {\n refs: { setReference },\n } = floatingContext;\n\n const {\n focusRegion,\n propsWithDefault,\n openedSubItems,\n menuItemEventsHandlers: {\n handleFocusableMenuItemKeyDown,\n handleFocusableMenuItemClick,\n handleFocusableMenuItemOnMouseEnter,\n handleMenuItemFocusReconciliation,\n },\n } = React.useContext(MenuBehaviouralContextProviderContext);\n const { selectedItems } = propsWithDefault;\n\n const gridLayout = React.useMemo(() => {\n const cols = LeftDecComponent ? ['min-content', 'min-content', 'auto'] : ['min-content', 'auto'];\n if (secondaryLabel) cols.push('auto');\n cols.push('min-content');\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 const isSelected = React.useMemo<'mixed' | boolean>(\n () => getIsMultipleSelectNodeWithSubmenuSelected({ itemNode, selectedItems }),\n [itemNode, selectedItems],\n );\n const handleFocusOnRender = React.useCallback(\n (node: HTMLDivElement) => {\n setReference(node);\n if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {\n node.focus();\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 handleOnMouseEnter = React.useCallback<React.MouseEventHandler<HTMLDivElement>>(\n (e) => {\n handleFocusableMenuItemOnMouseEnter(itemNode, e);\n },\n [handleFocusableMenuItemOnMouseEnter, itemNode],\n );\n const handleOnFocusReconciliation = React.useCallback(() => {\n handleMenuItemFocusReconciliation(itemNode);\n }, [handleMenuItemFocusReconciliation, itemNode]);\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={handleOnFocusReconciliation}\n as=\"div\"\n id={`${spacelessDsIdForDom}`}\n tabIndex={isFocused ? 0 : -1}\n role=\"menuitemcheckbox\"\n aria-checked={isSelected}\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 >\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n minWidth={minWidth ?? undefined}\n >\n <LeftBoxlessCheckbox isSelected={isSelected} />\n {LeftDecComponent ? <LeftDecComponent /> : null}\n <StyleMenuItemLabel>{label}</StyleMenuItemLabel>\n {secondaryLabel !== undefined && <StyleMenuItemSecondaryLabel>{secondaryLabel}</StyleMenuItemSecondaryLabel>}\n <ChevronSmallRight />\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"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC8Bf,SAgFJ,UAhFI,KA6GA,YA7GA;AA5BR,SAAS,0BAAuD;AAChE,SAAS,YAAY;AACrB,SAAS,WAAW,mBAAmB,yBAAyB;AAChE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAOA,YAAW;AAElB,SAAS,6CAA6C;AACtD,SAAS,0BAA0B;AAEnC,SAAS,kDAAkD;AAE3D,MAAM,2BAA+F;AAAA,EACnG;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,sBAAsBA,OAAM,KAAK,CAAC,EAAE,WAAW,MACnD,oBAAC,QAAK,OAAM,QACT,uBACC,eAAe,UACb,oBAAC,qBAAkB,MAAK,KAAI,OAAO,CAAC,iBAAiB,KAAK,GA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BAAC,sBAAoB,iBAAM;AAAA,cAC1B,mBAAmB,UAAa,oBAAC,+BAA6B,0BAAe;AAAA,cAC9E,oBAAC,qBAAkB;AAAA;AAAA;AAAA,QACrB;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;",
|
6
|
+
"names": ["React"]
|
7
|
+
}
|
@@ -0,0 +1,105 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
3
|
+
import { Grid } from "@elliemae/ds-grid";
|
4
|
+
import {
|
5
|
+
StyleMenuItemLabel,
|
6
|
+
StyleMenuItemSecondaryLabel,
|
7
|
+
StyledContentWrapper,
|
8
|
+
StyledGlobalMenuItemWrapper
|
9
|
+
} from "@elliemae/ds-menu-items-commons";
|
10
|
+
import { styled } from "@elliemae/ds-system";
|
11
|
+
import React2 from "react";
|
12
|
+
import { MenuBehaviouralContextProviderContext } from "../DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js";
|
13
|
+
import { MENU_FOCUS_REGIONS } from "../DSMenuBehaviouralContextProvider/constants/index.js";
|
14
|
+
const StyledRadioDotIndicator = styled("div")`
|
15
|
+
width: 8px;
|
16
|
+
height: 8px;
|
17
|
+
border-radius: 50%;
|
18
|
+
background-color: #005ea2;
|
19
|
+
`;
|
20
|
+
const LeftBoxlessRadio = React2.memo(({ isSelected }) => /* @__PURE__ */ jsx(Grid, { width: "16px", children: isSelected ? /* @__PURE__ */ jsx(StyledRadioDotIndicator, {}) : /* @__PURE__ */ jsx("div", {}) }));
|
21
|
+
const SingleSelectMenuItem = ({
|
22
|
+
itemNode
|
23
|
+
}) => {
|
24
|
+
const { dsId, plainItem } = itemNode;
|
25
|
+
const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;
|
26
|
+
const {
|
27
|
+
focusRegion,
|
28
|
+
propsWithDefault,
|
29
|
+
menuItemEventsHandlers: {
|
30
|
+
handleFocusableMenuItemKeyDown,
|
31
|
+
handleFocusableMenuItemClick,
|
32
|
+
handleFocusableMenuItemOnMouseEnter,
|
33
|
+
handleMenuItemFocusReconciliation
|
34
|
+
}
|
35
|
+
} = React2.useContext(MenuBehaviouralContextProviderContext);
|
36
|
+
const { selectedItems } = propsWithDefault;
|
37
|
+
const gridLayout = React2.useMemo(() => {
|
38
|
+
const cols = LeftDecComponent ? ["min-content", "min-content", "auto"] : ["min-content", "auto"];
|
39
|
+
if (secondaryLabel) cols.push("auto");
|
40
|
+
return cols;
|
41
|
+
}, [LeftDecComponent, secondaryLabel]);
|
42
|
+
const focusedRegionPerformanceHelper = React2.useRef(focusRegion);
|
43
|
+
focusedRegionPerformanceHelper.current = focusRegion;
|
44
|
+
const isFocused = focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId);
|
45
|
+
const isSelected = selectedItems.some((itemMarkesAsSelected) => itemMarkesAsSelected.dsId === dsId);
|
46
|
+
const handleFocusOnRender = React2.useCallback(
|
47
|
+
(node) => {
|
48
|
+
if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {
|
49
|
+
node.focus();
|
50
|
+
}
|
51
|
+
},
|
52
|
+
// we need to change the callback reference every time the focusRegion changes or else the focus will not be set
|
53
|
+
[dsId, focusRegion]
|
54
|
+
// we are using the "as='div'", typescript is not able to infer the correct type
|
55
|
+
// the logic here actually receives a ref to a HTMLDivElement,
|
56
|
+
// but the component must think this is a HTMLLIElement ref callback
|
57
|
+
);
|
58
|
+
const handleOnMouseEnter = React2.useCallback(
|
59
|
+
(e) => {
|
60
|
+
handleFocusableMenuItemOnMouseEnter(itemNode, e);
|
61
|
+
},
|
62
|
+
[handleFocusableMenuItemOnMouseEnter, itemNode]
|
63
|
+
);
|
64
|
+
const handleOnFocusReconciliation = React2.useCallback(() => {
|
65
|
+
handleMenuItemFocusReconciliation(itemNode);
|
66
|
+
}, [handleMenuItemFocusReconciliation, itemNode]);
|
67
|
+
const spacelessDsIdForDom = `ds-menu-item-${`${dsId}`.replace(/\s/g, "")}`;
|
68
|
+
return /* @__PURE__ */ jsx(
|
69
|
+
StyledGlobalMenuItemWrapper,
|
70
|
+
{
|
71
|
+
innerRef: handleFocusOnRender,
|
72
|
+
onKeyDown: handleFocusableMenuItemKeyDown,
|
73
|
+
onClick: handleFocusableMenuItemClick,
|
74
|
+
onMouseEnter: handleOnMouseEnter,
|
75
|
+
onFocus: handleOnFocusReconciliation,
|
76
|
+
as: "div",
|
77
|
+
id: `${spacelessDsIdForDom}`,
|
78
|
+
tabIndex: isFocused ? 0 : -1,
|
79
|
+
role: "menuitemradio",
|
80
|
+
"aria-checked": isSelected,
|
81
|
+
"aria-disabled": disabled,
|
82
|
+
applyAriaDisabled: disabled,
|
83
|
+
children: /* @__PURE__ */ jsxs(
|
84
|
+
StyledContentWrapper,
|
85
|
+
{
|
86
|
+
cols: gridLayout,
|
87
|
+
minHeight: "16px",
|
88
|
+
gutter: "xxs",
|
89
|
+
alignItems: "center",
|
90
|
+
minWidth: minWidth ?? void 0,
|
91
|
+
children: [
|
92
|
+
/* @__PURE__ */ jsx(LeftBoxlessRadio, { isSelected }),
|
93
|
+
LeftDecComponent ? /* @__PURE__ */ jsx(LeftDecComponent, {}) : null,
|
94
|
+
/* @__PURE__ */ jsx(StyleMenuItemLabel, { children: label }),
|
95
|
+
secondaryLabel !== void 0 && /* @__PURE__ */ jsx(StyleMenuItemSecondaryLabel, { children: secondaryLabel })
|
96
|
+
]
|
97
|
+
}
|
98
|
+
)
|
99
|
+
}
|
100
|
+
);
|
101
|
+
};
|
102
|
+
export {
|
103
|
+
SingleSelectMenuItem
|
104
|
+
};
|
105
|
+
//# sourceMappingURL=SingleSelectMenuItem.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSMenuItemRendererFactory/SingleSelectMenuItem.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { Grid } from '@elliemae/ds-grid';\nimport {\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n StyledContentWrapper,\n StyledGlobalMenuItemWrapper,\n} from '@elliemae/ds-menu-items-commons';\nimport { styled } from '@elliemae/ds-system';\nimport React 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';\n\nconst StyledRadioDotIndicator = styled('div')`\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background-color: #005ea2;\n`;\n\nconst LeftBoxlessRadio = React.memo(({ isSelected }: { isSelected: boolean }) => (\n <Grid width=\"16px\">{isSelected ? <StyledRadioDotIndicator /> : <div />}</Grid>\n));\nexport const SingleSelectMenuItem: React.ComponentType<{ itemNode: DSMenuButtonT.MenuNodeSingleSelectItem }> = ({\n itemNode,\n}) => {\n const { dsId, plainItem } = itemNode;\n const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;\n\n const {\n focusRegion,\n propsWithDefault,\n menuItemEventsHandlers: {\n handleFocusableMenuItemKeyDown,\n handleFocusableMenuItemClick,\n handleFocusableMenuItemOnMouseEnter,\n handleMenuItemFocusReconciliation,\n },\n } = React.useContext(MenuBehaviouralContextProviderContext);\n const { selectedItems } = propsWithDefault;\n\n const gridLayout = React.useMemo(() => {\n const cols = LeftDecComponent ? ['min-content', 'min-content', 'auto'] : ['min-content', '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 const isSelected = selectedItems.some((itemMarkesAsSelected) => itemMarkesAsSelected.dsId === dsId);\n\n const handleFocusOnRender = React.useCallback(\n (node: HTMLDivElement) => {\n if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {\n node.focus();\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\n const handleOnMouseEnter = React.useCallback<React.MouseEventHandler<HTMLDivElement>>(\n (e) => {\n handleFocusableMenuItemOnMouseEnter(itemNode, e);\n },\n [handleFocusableMenuItemOnMouseEnter, itemNode],\n );\n\n const handleOnFocusReconciliation = React.useCallback(() => {\n handleMenuItemFocusReconciliation(itemNode);\n }, [handleMenuItemFocusReconciliation, itemNode]);\n const spacelessDsIdForDom = `ds-menu-item-${`${dsId}`.replace(/\\s/g, '')}`;\n return (\n <StyledGlobalMenuItemWrapper\n innerRef={handleFocusOnRender}\n onKeyDown={handleFocusableMenuItemKeyDown}\n onClick={handleFocusableMenuItemClick}\n onMouseEnter={handleOnMouseEnter}\n onFocus={handleOnFocusReconciliation}\n as=\"div\"\n id={`${spacelessDsIdForDom}`}\n tabIndex={isFocused ? 0 : -1}\n role=\"menuitemradio\"\n aria-checked={isSelected}\n aria-disabled={disabled}\n applyAriaDisabled={disabled}\n >\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n minWidth={minWidth ?? undefined}\n >\n <LeftBoxlessRadio isSelected={isSelected} />\n {LeftDecComponent ? <LeftDecComponent /> : null}\n <StyleMenuItemLabel>{label}</StyleMenuItemLabel>\n {secondaryLabel !== undefined && <StyleMenuItemSecondaryLabel>{secondaryLabel}</StyleMenuItemSecondaryLabel>}\n </StyledContentWrapper>\n </StyledGlobalMenuItemWrapper>\n );\n};\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACsBY,cAuE7B,YAvE6B;AArBnC,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,OAAOA,YAAW;AAElB,SAAS,6CAA6C;AACtD,SAAS,0BAA0B;AAEnC,MAAM,0BAA0B,OAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAO5C,MAAM,mBAAmBA,OAAM,KAAK,CAAC,EAAE,WAAW,MAChD,oBAAC,QAAK,OAAM,QAAQ,uBAAa,oBAAC,2BAAwB,IAAK,oBAAC,SAAI,GAAG,CACxE;AACM,MAAM,uBAAkG,CAAC;AAAA,EAC9G;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,UAAU,IAAI;AAC5B,QAAM,EAAE,OAAO,gBAAgB,gBAAgB,kBAAkB,UAAU,SAAS,IAAI;AAExF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,IAAIA,OAAM,WAAW,qCAAqC;AAC1D,QAAM,EAAE,cAAc,IAAI;AAE1B,QAAM,aAAaA,OAAM,QAAQ,MAAM;AACrC,UAAM,OAAO,mBAAmB,CAAC,eAAe,eAAe,MAAM,IAAI,CAAC,eAAe,MAAM;AAC/F,QAAI,eAAgB,MAAK,KAAK,MAAM;AACpC,WAAO;AAAA,EACT,GAAG,CAAC,kBAAkB,cAAc,CAAC;AAErC,QAAM,iCAAiCA,OAAM,OAAO,WAAW;AAC/D,iCAA+B,UAAU;AAEzC,QAAM,YAAY,gBAAgB,mBAAmB,aAAa,IAAI;AACtE,QAAM,aAAa,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+1,151 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
3
|
+
import { Grid } from "@elliemae/ds-grid";
|
4
|
+
import { ChevronSmallRight } from "@elliemae/ds-icons";
|
5
|
+
import { useFloatingContext } from "@elliemae/ds-floating-context";
|
6
|
+
import {
|
7
|
+
StyleMenuItemLabel,
|
8
|
+
StyleMenuItemSecondaryLabel,
|
9
|
+
StyledContentWrapper,
|
10
|
+
StyledGlobalMenuItemWrapper
|
11
|
+
} from "@elliemae/ds-menu-items-commons";
|
12
|
+
import { styled } from "@elliemae/ds-system";
|
13
|
+
import React2 from "react";
|
14
|
+
import { MenuBehaviouralContextProviderContext } from "../DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js";
|
15
|
+
import { MENU_FOCUS_REGIONS } from "../DSMenuBehaviouralContextProvider/constants/index.js";
|
16
|
+
const placementOrderPreference = [
|
17
|
+
"right-start",
|
18
|
+
"right-start",
|
19
|
+
"right",
|
20
|
+
"left-start",
|
21
|
+
"left-end",
|
22
|
+
"left"
|
23
|
+
];
|
24
|
+
const StyledRadioDotIndicator = styled("div")`
|
25
|
+
width: 8px;
|
26
|
+
height: 8px;
|
27
|
+
border-radius: 50%;
|
28
|
+
background-color: #005ea2;
|
29
|
+
`;
|
30
|
+
const LeftBoxlessRadio = React2.memo(({ isSelected }) => /* @__PURE__ */ jsx(Grid, { width: "16px", children: isSelected ? /* @__PURE__ */ jsx(StyledRadioDotIndicator, {}) : /* @__PURE__ */ jsx("div", {}) }));
|
31
|
+
const SingleSelectWithSubmenuMenuItem = ({ itemNode, FlyoutMenuCircularDepInject }) => {
|
32
|
+
const { dsId, plainItem } = itemNode;
|
33
|
+
const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;
|
34
|
+
const floatingContext = useFloatingContext({
|
35
|
+
placement: placementOrderPreference[0],
|
36
|
+
placementOrderPreference,
|
37
|
+
animationDuration: 100,
|
38
|
+
customOffset: [0, 0]
|
39
|
+
});
|
40
|
+
const {
|
41
|
+
refs: { setReference }
|
42
|
+
} = floatingContext;
|
43
|
+
const {
|
44
|
+
focusRegion,
|
45
|
+
propsWithDefault,
|
46
|
+
openedSubItems,
|
47
|
+
menuItemEventsHandlers: {
|
48
|
+
handleFocusableMenuItemKeyDown,
|
49
|
+
handleFocusableMenuItemClick,
|
50
|
+
handleFocusableMenuItemOnMouseEnter,
|
51
|
+
handleMenuItemFocusReconciliation
|
52
|
+
}
|
53
|
+
} = React2.useContext(MenuBehaviouralContextProviderContext);
|
54
|
+
const { selectedItems } = propsWithDefault;
|
55
|
+
const gridLayout = React2.useMemo(() => {
|
56
|
+
const cols = LeftDecComponent ? ["min-content", "min-content", "auto"] : ["min-content", "auto"];
|
57
|
+
if (secondaryLabel) cols.push("auto");
|
58
|
+
cols.push("min-content");
|
59
|
+
return cols;
|
60
|
+
}, [LeftDecComponent, secondaryLabel]);
|
61
|
+
const focusedRegionPerformanceHelper = React2.useRef(focusRegion);
|
62
|
+
focusedRegionPerformanceHelper.current = focusRegion;
|
63
|
+
const isExpanded = openedSubItems.some((itemWithOpenSubmenu) => itemWithOpenSubmenu.dsId === dsId);
|
64
|
+
const isFocused = focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId);
|
65
|
+
const isSelected = selectedItems.some((itemMarkesAsSelected) => itemMarkesAsSelected.dsId === dsId);
|
66
|
+
const handleFocusOnRender = React2.useCallback(
|
67
|
+
(node) => {
|
68
|
+
setReference(node);
|
69
|
+
if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {
|
70
|
+
node.focus();
|
71
|
+
}
|
72
|
+
},
|
73
|
+
// we need to change the callback reference every time the focusRegion changes or else the focus will not be set
|
74
|
+
[dsId, focusRegion, setReference]
|
75
|
+
// we are using the "as='div'", typescript is not able to infer the correct type
|
76
|
+
// the logic here actually receives a ref to a HTMLDivElement,
|
77
|
+
// but the component must think this is a HTMLLIElement ref callback
|
78
|
+
);
|
79
|
+
const handleOnMouseEnter = React2.useCallback(
|
80
|
+
(e) => {
|
81
|
+
handleFocusableMenuItemOnMouseEnter(itemNode, e);
|
82
|
+
},
|
83
|
+
[handleFocusableMenuItemOnMouseEnter, itemNode]
|
84
|
+
);
|
85
|
+
const handleOnFocusReconciliation = React2.useCallback(() => {
|
86
|
+
handleMenuItemFocusReconciliation(itemNode);
|
87
|
+
}, [handleMenuItemFocusReconciliation, itemNode]);
|
88
|
+
const spacelessDsIdForDom = `ds-menu-item-${`${dsId}`.replace(/\s/g, "")}`;
|
89
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
90
|
+
/* @__PURE__ */ jsx(
|
91
|
+
StyledGlobalMenuItemWrapper,
|
92
|
+
{
|
93
|
+
innerRef: handleFocusOnRender,
|
94
|
+
onKeyDown: handleFocusableMenuItemKeyDown,
|
95
|
+
onClick: handleFocusableMenuItemClick,
|
96
|
+
onMouseEnter: handleOnMouseEnter,
|
97
|
+
onFocus: handleOnFocusReconciliation,
|
98
|
+
as: "div",
|
99
|
+
id: `${spacelessDsIdForDom}`,
|
100
|
+
tabIndex: isFocused ? 0 : -1,
|
101
|
+
role: "menuitemradio",
|
102
|
+
"aria-checked": isSelected,
|
103
|
+
"aria-controls": (
|
104
|
+
/* ********************************************************************************************************************
|
105
|
+
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls
|
106
|
+
* 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.
|
107
|
+
* ********************************************************************************************************************
|
108
|
+
* ^^^ some automated tools will mark an error if the aria-controls references an element that does (yet) exist in the DOM
|
109
|
+
* so, while technically valid to not check if expanded, we are doing it to avoid automated tools marking an error
|
110
|
+
* ******************************************************************************************************************** */
|
111
|
+
isExpanded ? itemNode.plainChildren.map((child) => `ds-menu-item-${`${child.dsId}`.replace(/\s/g, "")}`).join(" ") : void 0
|
112
|
+
),
|
113
|
+
"aria-haspopup": "menu",
|
114
|
+
"aria-expanded": isExpanded,
|
115
|
+
"aria-disabled": disabled,
|
116
|
+
applyAriaDisabled: disabled,
|
117
|
+
children: /* @__PURE__ */ jsxs(
|
118
|
+
StyledContentWrapper,
|
119
|
+
{
|
120
|
+
cols: gridLayout,
|
121
|
+
minHeight: "16px",
|
122
|
+
gutter: "xxs",
|
123
|
+
alignItems: "center",
|
124
|
+
minWidth: minWidth ?? void 0,
|
125
|
+
children: [
|
126
|
+
/* @__PURE__ */ jsx(LeftBoxlessRadio, { isSelected }),
|
127
|
+
LeftDecComponent ? /* @__PURE__ */ jsx(LeftDecComponent, {}) : null,
|
128
|
+
/* @__PURE__ */ jsx(StyleMenuItemLabel, { children: label }),
|
129
|
+
secondaryLabel !== void 0 && /* @__PURE__ */ jsx(StyleMenuItemSecondaryLabel, { children: secondaryLabel }),
|
130
|
+
/* @__PURE__ */ jsx(ChevronSmallRight, {})
|
131
|
+
]
|
132
|
+
}
|
133
|
+
)
|
134
|
+
}
|
135
|
+
),
|
136
|
+
/* @__PURE__ */ jsx(
|
137
|
+
FlyoutMenuCircularDepInject,
|
138
|
+
{
|
139
|
+
isMenuOpen: isExpanded,
|
140
|
+
floatingContext: floatingContext.context,
|
141
|
+
floatingStyles: floatingContext.floatingStyles,
|
142
|
+
setFloatingRef: floatingContext.refs.setFloating,
|
143
|
+
itemNode
|
144
|
+
}
|
145
|
+
)
|
146
|
+
] });
|
147
|
+
};
|
148
|
+
export {
|
149
|
+
SingleSelectWithSubmenuMenuItem
|
150
|
+
};
|
151
|
+
//# sourceMappingURL=SingleSelectWithSubmenuMenuItem.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSMenuItemRendererFactory/SingleSelectWithSubmenuMenuItem.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { Grid } from '@elliemae/ds-grid';\nimport { ChevronSmallRight } from '@elliemae/ds-icons';\nimport { useFloatingContext, type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport {\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n StyledContentWrapper,\n StyledGlobalMenuItemWrapper,\n} from '@elliemae/ds-menu-items-commons';\nimport { styled } from '@elliemae/ds-system';\nimport React 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 { type DSMenuItemRendererFactoryT } from './react-desc-prop-types.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];\nconst StyledRadioDotIndicator = styled('div')`\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background-color: #005ea2;\n`;\n\nconst LeftBoxlessRadio = React.memo(({ isSelected }: { isSelected: boolean }) => (\n <Grid width=\"16px\">{isSelected ? <StyledRadioDotIndicator /> : <div />}</Grid>\n));\nexport const SingleSelectWithSubmenuMenuItem: React.ComponentType<{\n itemNode: DSMenuButtonT.MenuNodeSingleSelectWithSubmenuItem;\n FlyoutMenuCircularDepInject: DSMenuItemRendererFactoryT.RequiredProps['FlyoutMenuCircularDepInject'];\n}> = ({ itemNode, FlyoutMenuCircularDepInject }) => {\n const { dsId, plainItem } = itemNode;\n const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;\n const floatingContext = useFloatingContext({\n placement: placementOrderPreference[0],\n placementOrderPreference,\n animationDuration: 100,\n customOffset: [0, 0],\n });\n const {\n refs: { setReference },\n } = floatingContext;\n\n const {\n focusRegion,\n propsWithDefault,\n openedSubItems,\n menuItemEventsHandlers: {\n handleFocusableMenuItemKeyDown,\n handleFocusableMenuItemClick,\n handleFocusableMenuItemOnMouseEnter,\n handleMenuItemFocusReconciliation,\n },\n } = React.useContext(MenuBehaviouralContextProviderContext);\n const { selectedItems } = propsWithDefault;\n\n const gridLayout = React.useMemo(() => {\n const cols = LeftDecComponent ? ['min-content', 'min-content', 'auto'] : ['min-content', 'auto'];\n if (secondaryLabel) cols.push('auto');\n cols.push('min-content');\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 const isSelected = selectedItems.some((itemMarkesAsSelected) => itemMarkesAsSelected.dsId === dsId);\n\n const handleFocusOnRender = React.useCallback(\n (node: HTMLDivElement) => {\n setReference(node);\n if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {\n node.focus();\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 handleOnMouseEnter = React.useCallback<React.MouseEventHandler<HTMLDivElement>>(\n (e) => {\n handleFocusableMenuItemOnMouseEnter(itemNode, e);\n },\n [handleFocusableMenuItemOnMouseEnter, itemNode],\n );\n const handleOnFocusReconciliation = React.useCallback(() => {\n handleMenuItemFocusReconciliation(itemNode);\n }, [handleMenuItemFocusReconciliation, itemNode]);\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={handleOnFocusReconciliation}\n as=\"div\"\n id={`${spacelessDsIdForDom}`}\n tabIndex={isFocused ? 0 : -1}\n role=\"menuitemradio\"\n aria-checked={isSelected}\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 >\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n minWidth={minWidth ?? undefined}\n >\n <LeftBoxlessRadio isSelected={isSelected} />\n {LeftDecComponent ? <LeftDecComponent /> : null}\n <StyleMenuItemLabel>{label}</StyleMenuItemLabel>\n {secondaryLabel !== undefined && <StyleMenuItemSecondaryLabel>{secondaryLabel}</StyleMenuItemSecondaryLabel>}\n <ChevronSmallRight />\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"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACiCY,SAuE/B,UAvE+B,KAoG3B,YApG2B;AAhCnC,SAAS,YAAY;AACrB,SAAS,yBAAyB;AAClC,SAAS,0BAAuD;AAChE;AAAA,EACE;AAAA,EACA;AAAA,EACA;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AAA,QACf,mBAAmB;AAAA,QAEnB;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,WAAU;AAAA,YACV,QAAO;AAAA,YACP,YAAW;AAAA,YACX,UAAU,YAAY;AAAA,YAEtB;AAAA,kCAAC,oBAAiB,YAAwB;AAAA,cACzC,mBAAmB,oBAAC,oBAAiB,IAAK;AAAA,cAC3C,oBAAC,sBAAoB,iBAAM;AAAA,cAC1B,mBAAmB,UAAa,oBAAC,+BAA6B,0BAAe;AAAA,cAC9E,oBAAC,qBAAkB;AAAA;AAAA;AAAA,QACrB;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;",
|
6
|
+
"names": ["React"]
|
7
|
+
}
|
@@ -0,0 +1,137 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
3
|
+
import { ChevronSmallRight } from "@elliemae/ds-icons";
|
4
|
+
import {
|
5
|
+
StyleMenuItemLabel,
|
6
|
+
StyleMenuItemSecondaryLabel,
|
7
|
+
StyledContentWrapper,
|
8
|
+
StyledGlobalMenuItemWrapper
|
9
|
+
} from "@elliemae/ds-menu-items-commons";
|
10
|
+
import { useFloatingContext } from "@elliemae/ds-floating-context";
|
11
|
+
import React2 from "react";
|
12
|
+
import { MenuBehaviouralContextProviderContext } from "../DSMenuBehaviouralContextProvider/MenuBehaviouralContextProviderCTX.js";
|
13
|
+
import { MENU_FOCUS_REGIONS } from "../DSMenuBehaviouralContextProvider/constants/index.js";
|
14
|
+
const placementOrderPreference = [
|
15
|
+
"right-start",
|
16
|
+
"right-start",
|
17
|
+
"right",
|
18
|
+
"left-start",
|
19
|
+
"left-end",
|
20
|
+
"left"
|
21
|
+
];
|
22
|
+
const WithSubmenuMenuItem = ({ itemNode, FlyoutMenuCircularDepInject }) => {
|
23
|
+
const { dsId, plainItem } = itemNode;
|
24
|
+
const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;
|
25
|
+
const floatingContext = useFloatingContext({
|
26
|
+
placement: placementOrderPreference[0],
|
27
|
+
placementOrderPreference,
|
28
|
+
animationDuration: 100,
|
29
|
+
customOffset: [0, 0]
|
30
|
+
});
|
31
|
+
const {
|
32
|
+
refs: { setReference }
|
33
|
+
} = floatingContext;
|
34
|
+
const {
|
35
|
+
focusRegion,
|
36
|
+
openedSubItems,
|
37
|
+
menuItemEventsHandlers: {
|
38
|
+
handleFocusableMenuItemKeyDown,
|
39
|
+
handleFocusableMenuItemClick,
|
40
|
+
handleFocusableMenuItemOnMouseEnter,
|
41
|
+
handleMenuItemFocusReconciliation
|
42
|
+
}
|
43
|
+
} = React2.useContext(MenuBehaviouralContextProviderContext);
|
44
|
+
const gridLayout = React2.useMemo(() => {
|
45
|
+
const cols = LeftDecComponent ? ["min-content", "auto"] : ["auto"];
|
46
|
+
if (secondaryLabel) cols.push("auto");
|
47
|
+
cols.push("min-content");
|
48
|
+
return cols;
|
49
|
+
}, [LeftDecComponent, secondaryLabel]);
|
50
|
+
const focusedRegionPerformanceHelper = React2.useRef(focusRegion);
|
51
|
+
focusedRegionPerformanceHelper.current = focusRegion;
|
52
|
+
const isFocused = focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId);
|
53
|
+
const isExpanded = openedSubItems.some((itemWithOpenSubmenu) => itemWithOpenSubmenu.dsId === dsId);
|
54
|
+
const handleFocusOnRender = React2.useCallback(
|
55
|
+
(node) => {
|
56
|
+
setReference(node);
|
57
|
+
if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {
|
58
|
+
node.focus();
|
59
|
+
}
|
60
|
+
},
|
61
|
+
// we need to change the callback reference every time the focusRegion changes or else the focus will not be set
|
62
|
+
[dsId, focusRegion, setReference]
|
63
|
+
// we are using the "as='div'", typescript is not able to infer the correct type
|
64
|
+
// the logic here actually receives a ref to a HTMLDivElement,
|
65
|
+
// but the component must think this is a HTMLLIElement ref callback
|
66
|
+
);
|
67
|
+
const handleOnMouseEnter = React2.useCallback(
|
68
|
+
(e) => {
|
69
|
+
handleFocusableMenuItemOnMouseEnter(itemNode, e);
|
70
|
+
},
|
71
|
+
[handleFocusableMenuItemOnMouseEnter, itemNode]
|
72
|
+
);
|
73
|
+
const handleOnFocusReconciliation = React2.useCallback(() => {
|
74
|
+
handleMenuItemFocusReconciliation(itemNode);
|
75
|
+
}, [handleMenuItemFocusReconciliation, itemNode]);
|
76
|
+
const spacelessDsIdForDom = `ds-menu-item-${`${dsId}`.replace(/\s/g, "")}`;
|
77
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
78
|
+
/* @__PURE__ */ jsx(
|
79
|
+
StyledGlobalMenuItemWrapper,
|
80
|
+
{
|
81
|
+
innerRef: handleFocusOnRender,
|
82
|
+
onKeyDown: handleFocusableMenuItemKeyDown,
|
83
|
+
onClick: handleFocusableMenuItemClick,
|
84
|
+
onMouseEnter: handleOnMouseEnter,
|
85
|
+
onFocus: handleOnFocusReconciliation,
|
86
|
+
as: "div",
|
87
|
+
id: `${spacelessDsIdForDom}`,
|
88
|
+
tabIndex: isFocused ? 0 : -1,
|
89
|
+
role: "menuitem",
|
90
|
+
"aria-haspopup": "menu",
|
91
|
+
"aria-expanded": isExpanded,
|
92
|
+
"aria-controls": (
|
93
|
+
/* ********************************************************************************************************************
|
94
|
+
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls
|
95
|
+
* 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.
|
96
|
+
* ********************************************************************************************************************
|
97
|
+
* ^^^ some automated tools will mark an error if the aria-controls references an element that does (yet) exist in the DOM
|
98
|
+
* so, while technically valid to not check if expanded, we are doing it to avoid automated tools marking an error
|
99
|
+
* ******************************************************************************************************************** */
|
100
|
+
isExpanded ? itemNode.plainChildren.map((child) => `ds-menu-item-${`${child.dsId}`.replace(/\s/g, "")}`).join(" ") : void 0
|
101
|
+
),
|
102
|
+
"aria-disabled": disabled,
|
103
|
+
applyAriaDisabled: disabled,
|
104
|
+
children: /* @__PURE__ */ jsxs(
|
105
|
+
StyledContentWrapper,
|
106
|
+
{
|
107
|
+
cols: gridLayout,
|
108
|
+
minHeight: "16px",
|
109
|
+
gutter: "xxs",
|
110
|
+
alignItems: "center",
|
111
|
+
minWidth: minWidth ?? void 0,
|
112
|
+
children: [
|
113
|
+
LeftDecComponent ? /* @__PURE__ */ jsx(LeftDecComponent, {}) : null,
|
114
|
+
/* @__PURE__ */ jsx(StyleMenuItemLabel, { children: label }),
|
115
|
+
secondaryLabel !== void 0 && /* @__PURE__ */ jsx(StyleMenuItemSecondaryLabel, { children: secondaryLabel }),
|
116
|
+
/* @__PURE__ */ jsx(ChevronSmallRight, {})
|
117
|
+
]
|
118
|
+
}
|
119
|
+
)
|
120
|
+
}
|
121
|
+
),
|
122
|
+
/* @__PURE__ */ jsx(
|
123
|
+
FlyoutMenuCircularDepInject,
|
124
|
+
{
|
125
|
+
isMenuOpen: isExpanded,
|
126
|
+
floatingContext: floatingContext.context,
|
127
|
+
floatingStyles: floatingContext.floatingStyles,
|
128
|
+
setFloatingRef: floatingContext.refs.setFloating,
|
129
|
+
itemNode
|
130
|
+
}
|
131
|
+
)
|
132
|
+
] });
|
133
|
+
};
|
134
|
+
export {
|
135
|
+
WithSubmenuMenuItem
|
136
|
+
};
|
137
|
+
//# sourceMappingURL=WithSubmenuMenuItem.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSMenuItemRendererFactory/WithSubmenuMenuItem.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { ChevronSmallRight } from '@elliemae/ds-icons';\nimport {\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n StyledContentWrapper,\n StyledGlobalMenuItemWrapper,\n} from '@elliemae/ds-menu-items-commons';\nimport { useFloatingContext, type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport React 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 { type DSMenuItemRendererFactoryT } from './react-desc-prop-types.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 WithSubmenuMenuItem: React.ComponentType<{\n itemNode: DSMenuButtonT.MenuNodeWithSubmenuItem;\n FlyoutMenuCircularDepInject: DSMenuItemRendererFactoryT.RequiredProps['FlyoutMenuCircularDepInject'];\n}> = ({ itemNode, FlyoutMenuCircularDepInject }) => {\n const { dsId, plainItem } = itemNode;\n const { label, secondaryLabel, leftDecoration: LeftDecComponent, minWidth, disabled } = plainItem;\n const floatingContext = useFloatingContext({\n placement: placementOrderPreference[0],\n placementOrderPreference,\n animationDuration: 100,\n customOffset: [0, 0],\n });\n const {\n refs: { setReference },\n } = floatingContext;\n\n const {\n focusRegion,\n openedSubItems,\n menuItemEventsHandlers: {\n handleFocusableMenuItemKeyDown,\n handleFocusableMenuItemClick,\n handleFocusableMenuItemOnMouseEnter,\n handleMenuItemFocusReconciliation,\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 cols.push('min-content');\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 const isExpanded = openedSubItems.some((itemWithOpenSubmenu) => itemWithOpenSubmenu.dsId === dsId);\n\n const handleFocusOnRender = React.useCallback(\n (node: HTMLDivElement) => {\n setReference(node);\n if (node && focusRegion === MENU_FOCUS_REGIONS.ITEM_BY_DSID(dsId)) {\n node.focus();\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 handleOnMouseEnter = React.useCallback<React.MouseEventHandler<HTMLDivElement>>(\n (e) => {\n handleFocusableMenuItemOnMouseEnter(itemNode, e);\n },\n [handleFocusableMenuItemOnMouseEnter, itemNode],\n );\n const handleOnFocusReconciliation = React.useCallback(() => {\n handleMenuItemFocusReconciliation(itemNode);\n }, [handleMenuItemFocusReconciliation, itemNode]);\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={handleOnFocusReconciliation}\n as=\"div\"\n id={`${spacelessDsIdForDom}`}\n tabIndex={isFocused ? 0 : -1}\n role=\"menuitem\"\n aria-haspopup=\"menu\"\n aria-expanded={isExpanded}\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-disabled={disabled}\n applyAriaDisabled={disabled}\n >\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n minWidth={minWidth ?? undefined}\n >\n {LeftDecComponent ? <LeftDecComponent /> : null}\n <StyleMenuItemLabel>{label}</StyleMenuItemLabel>\n {secondaryLabel !== undefined && <StyleMenuItemSecondaryLabel>{secondaryLabel}</StyleMenuItemSecondaryLabel>}\n <ChevronSmallRight />\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"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACwFnB,mBAmC0B,KAPtB,YA5BJ;AAxFJ,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAAuD;AAChE,OAAOA,YAAW;AAElB,SAAS,6CAA6C;AACtD,SAAS,0BAA0B;AAGnC,MAAM,2BAA+F;AAAA,EACnG;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,sBAGR,CAAC,EAAE,UAAU,4BAA4B,MAAM;AAClD,QAAM,EAAE,MAAM,UAAU,IAAI;AAC5B,QAAM,EAAE,OAAO,gBAAgB,gBAAgB,kBAAkB,UAAU,SAAS,IAAI;AACxF,QAAM,kBAAkB,mBAAmB;AAAA,IACzC,WAAW,yBAAyB,CAAC;AAAA,IACrC;AAAA,IACA,mBAAmB;AAAA,IACnB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AAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV,WAAW;AAAA,QACX,SAAS;AAAA,QACT,cAAc;AAAA,QACd,SAAS;AAAA,QACT,IAAG;AAAA,QACH,IAAI,GAAG,mBAAmB;AAAA,QAC1B,UAAU,YAAY,IAAI;AAAA,QAC1B,MAAK;AAAA,QACL,iBAAc;AAAA,QACd,iBAAe;AAAA,QACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAQE,aACI,SAAS,cAAc,IAAI,CAAC,UAAU,gBAAgB,GAAG,MAAM,IAAI,GAAG,QAAQ,OAAO,EAAE,CAAC,EAAE,EAAE,KAAK,GAAG,IACpG;AAAA;AAAA,QAEN,iBAAe;AAAA,QACf,mBAAmB;AAAA,QAEnB;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,WAAU;AAAA,YACV,QAAO;AAAA,YACP,YAAW;AAAA,YACX,UAAU,YAAY;AAAA,YAErB;AAAA,iCAAmB,oBAAC,oBAAiB,IAAK;AAAA,cAC3C,oBAAC,sBAAoB,iBAAM;AAAA,cAC1B,mBAAmB,UAAa,oBAAC,+BAA6B,0BAAe;AAAA,cAC9E,oBAAC,qBAAkB;AAAA;AAAA;AAAA,QACrB;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;",
|
6
|
+
"names": ["React"]
|
7
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import React2 from "react";
|
3
|
+
import { useGetXstyledProps, useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
|
4
|
+
import { uid } from "uid";
|
5
|
+
import {
|
6
|
+
DSMenuItemRendererFactoryPropTypesSchema,
|
7
|
+
defaultProps
|
8
|
+
} from "../react-desc-prop-types.js";
|
9
|
+
import { useValidateProps } from "./useValidateProps.js";
|
10
|
+
const useMenuItemRendererFactory = (propsFromUser) => {
|
11
|
+
const propsWithDefault = useMemoMergePropsWithDefault(
|
12
|
+
propsFromUser,
|
13
|
+
defaultProps
|
14
|
+
);
|
15
|
+
useValidateProps(propsWithDefault, DSMenuItemRendererFactoryPropTypesSchema);
|
16
|
+
const xstyledProps = useGetXstyledProps(propsWithDefault);
|
17
|
+
const instanceUid = React2.useMemo(() => `ds-menu-item-renderer-factory-${uid(5)}`, []);
|
18
|
+
return React2.useMemo(
|
19
|
+
() => ({
|
20
|
+
propsWithDefault,
|
21
|
+
xstyledProps,
|
22
|
+
instanceUid
|
23
|
+
}),
|
24
|
+
[propsWithDefault, xstyledProps, instanceUid]
|
25
|
+
);
|
26
|
+
};
|
27
|
+
export {
|
28
|
+
useMenuItemRendererFactory
|
29
|
+
};
|
30
|
+
//# sourceMappingURL=useMenuItemRendererFactory.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSMenuItemRendererFactory/config/useMenuItemRendererFactory.ts"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport {\n type DSMenuItemRendererFactoryT,\n DSMenuItemRendererFactoryPropTypesSchema,\n defaultProps,\n} from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport const useMenuItemRendererFactory = (propsFromUser: DSMenuItemRendererFactoryT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSMenuItemRendererFactoryT.InternalProps>(\n propsFromUser,\n defaultProps,\n );\n useValidateProps(propsWithDefault, DSMenuItemRendererFactoryPropTypesSchema);\n // =============================================================================\n // XSTYLED PROPS\n // =============================================================================\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const instanceUid = React.useMemo(() => `ds-menu-item-renderer-factory-${uid(5)}`, []);\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n xstyledProps,\n instanceUid,\n }),\n [propsWithDefault, xstyledProps, instanceUid],\n );\n};\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,oBAAoB,oCAAoC;AACjE,SAAS,WAAW;AACpB;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AAE1B,MAAM,6BAA6B,CAAC,kBAAoD;AAI7F,QAAM,mBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AACA,mBAAiB,kBAAkB,wCAAwC;AAI3E,QAAM,eAAe,mBAAmB,gBAAgB;AAKxD,QAAM,cAAcA,OAAM,QAAQ,MAAM,iCAAiC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AAErF,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,cAAc,WAAW;AAAA,EAC9C;AACF;",
|
6
|
+
"names": ["React"]
|
7
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
|
3
|
+
import { DSMenuItemRendererFactoryName } from "../constants/index.js";
|
4
|
+
const useValidateProps = (props, propTypes) => {
|
5
|
+
useValidateTypescriptPropTypes(props, propTypes, DSMenuItemRendererFactoryName);
|
6
|
+
};
|
7
|
+
export {
|
8
|
+
useValidateProps
|
9
|
+
};
|
10
|
+
//# sourceMappingURL=useValidateProps.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSMenuItemRendererFactory/config/useValidateProps.ts"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport type { ValidationMap } from '@elliemae/ds-props-helpers';\nimport { type DSMenuItemRendererFactoryT } from '../react-desc-prop-types.js';\nimport { DSMenuItemRendererFactoryName } from '../constants/index.js';\n\nexport const useValidateProps = (\n props: DSMenuItemRendererFactoryT.InternalProps,\n propTypes: ValidationMap<DSMenuItemRendererFactoryT.Props>,\n): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSMenuItemRendererFactoryName);\n};\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sCAAsC;AAG/C,SAAS,qCAAqC;AAEvC,MAAM,mBAAmB,CAC9B,OACA,cACS;AAET,iCAA+B,OAAO,WAAW,6BAA6B;AAChF;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { slotObjectToDataTestIds } from "@elliemae/ds-system";
|
3
|
+
const DSMenuItemRendererFactoryName = "DSMenuItemRendererFactory";
|
4
|
+
const EXAMPLE_CONSTANTS = {};
|
5
|
+
const MENU_ITEM_RENDERER_FACTORY_SLOTS = {
|
6
|
+
ROOT: "root"
|
7
|
+
};
|
8
|
+
const MENU_ITEM_RENDERER_FACTORY_DATA_TESTID = slotObjectToDataTestIds(
|
9
|
+
DSMenuItemRendererFactoryName,
|
10
|
+
MENU_ITEM_RENDERER_FACTORY_SLOTS
|
11
|
+
);
|
12
|
+
export {
|
13
|
+
DSMenuItemRendererFactoryName,
|
14
|
+
EXAMPLE_CONSTANTS,
|
15
|
+
MENU_ITEM_RENDERER_FACTORY_DATA_TESTID,
|
16
|
+
MENU_ITEM_RENDERER_FACTORY_SLOTS
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSMenuItemRendererFactory/constants/index.ts"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSMenuItemRendererFactoryName = 'DSMenuItemRendererFactory';\n\nexport const EXAMPLE_CONSTANTS = {} as const;\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const MENU_ITEM_RENDERER_FACTORY_SLOTS = {\n ROOT: 'root',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const MENU_ITEM_RENDERER_FACTORY_DATA_TESTID = slotObjectToDataTestIds(\n DSMenuItemRendererFactoryName,\n MENU_ITEM_RENDERER_FACTORY_SLOTS,\n);\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,gCAAgC;AAEtC,MAAM,oBAAoB,CAAC;AAG3B,MAAM,mCAAmC;AAAA,EAC9C,MAAM;AACR;AAGO,MAAM,yCAAyC;AAAA,EACpD;AAAA,EACA;AACF;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSMenuItemRendererFactory/index.ts"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSMenuItemRendererFactory, DSMenuItemRendererFactoryWithSchema } from './DSMenuItemRendererFactory.js';\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,2BAA2B,2CAA2C;",
|
6
|
+
"names": []
|
7
|
+
}
|