@elliemae/ds-dropdownmenu-v2 3.40.1-rc.0 → 3.41.0-rc.1
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.
- package/dist/cjs/hooks/useDropdownListboxHandlers.js +8 -0
- package/dist/cjs/hooks/useDropdownListboxHandlers.js.map +2 -2
- package/dist/cjs/hooks/useDropdownMenuItemHandlers.js +4 -0
- package/dist/cjs/hooks/useDropdownMenuItemHandlers.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/esm/hooks/useDropdownListboxHandlers.js +8 -0
- package/dist/esm/hooks/useDropdownListboxHandlers.js.map +2 -2
- package/dist/esm/hooks/useDropdownMenuItemHandlers.js +4 -0
- package/dist/esm/hooks/useDropdownMenuItemHandlers.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/types/react-desc-prop-types.d.ts +5 -0
- package/dist/types/tests/DSDropdownMenuV2.a11y.test.d.ts +1 -0
- package/package.json +9 -9
|
@@ -72,9 +72,17 @@ const useDropdownListboxHandlers = () => {
|
|
|
72
72
|
scrollOptionIntoView(options[nextItemIndex].dsId);
|
|
73
73
|
} else if (e.code === "ArrowRight" && ["submenu", "singleWithSubmenu"].includes(option.type) && !openedSubmenus[option.dsId]) {
|
|
74
74
|
e.preventDefault();
|
|
75
|
+
const { type } = option;
|
|
76
|
+
if (type === "submenu" || type === "singleWithSubmenu") {
|
|
77
|
+
if (option.applyAriaDisabled) return;
|
|
78
|
+
}
|
|
75
79
|
onSubmenuToggle((0, import_utils.manageOpenedSubmenus)(options, { ...openedSubmenus, [option.dsId]: true }, option), option, e);
|
|
76
80
|
} else if (["Space", "Enter"].includes(e.code)) {
|
|
77
81
|
e.preventDefault();
|
|
82
|
+
const { type } = option;
|
|
83
|
+
if (type === "singleWithSubmenu") {
|
|
84
|
+
if (option.applyAriaDisabled) return;
|
|
85
|
+
}
|
|
78
86
|
const nextSelectedOptions = { ...selectedOptions };
|
|
79
87
|
nextSelectedOptions[option.dsId] = !selectedOptions[option.dsId];
|
|
80
88
|
if (option?.disabled) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useDropdownListboxHandlers.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-params */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport type { DSDropdownMenuT } from '../react-desc-prop-types.js';\nimport { findInCircularList, isOptionFocuseable, manageOpenedSubmenus } from '../utils/index.js';\n\ntype UseDropdownListboxHandlersType = () => {\n onKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave?: React.MouseEventHandler;\n};\n\nexport const useDropdownListboxHandlers: UseDropdownListboxHandlersType = () => {\n const {\n props: {\n options,\n onOptionClick,\n openedSubmenus,\n onSubmenuToggle,\n onKeyDown: userOnKeyDown,\n selectedOptions,\n onClickOutside,\n onMouseEnter: userOnMouseEnter,\n onMouseLeave,\n },\n activeDescendant,\n setActiveDescendant,\n scrollOptionIntoView,\n listboxReference,\n inputReference,\n } = useContext(DSDropdownMenuContext);\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n const currentItemIndex = options.findIndex((opt) => opt.dsId === activeDescendant);\n if (currentItemIndex === -1) return;\n\n const option = options[currentItemIndex];\n\n e.stopPropagation();\n\n if (e.code === 'ArrowDown') {\n e.preventDefault();\n const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (e.code === 'ArrowUp') {\n e.preventDefault();\n const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable, -1);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (\n e.code === 'ArrowRight' &&\n ['submenu', 'singleWithSubmenu'].includes(option.type) &&\n !openedSubmenus[option.dsId]\n ) {\n e.preventDefault();\n onSubmenuToggle(manageOpenedSubmenus(options, { ...openedSubmenus, [option.dsId]: true }, option), option, e);\n } else if (['Space', 'Enter'].includes(e.code)) {\n e.preventDefault();\n const nextSelectedOptions = { ...selectedOptions };\n nextSelectedOptions[option.dsId] = !selectedOptions[option.dsId];\n if ((option as DSDropdownMenuT.ItemActionOptions)?.disabled) return; // prevent click when is disabled\n onOptionClick(nextSelectedOptions, option, e);\n if (option.onClick) option.onClick(e);\n } else if (e.code === 'Escape') {\n onClickOutside(e);\n } else if (e.code === 'Home') {\n const nextItemIndex = findInCircularList(options, options.length - 1, isOptionFocuseable);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (e.code === 'End') {\n const nextItemIndex = findInCircularList(options, 0, isOptionFocuseable, -1);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n }\n if (option.onKeyDown) option.onKeyDown(e);\n userOnKeyDown(e);\n },\n [\n options,\n openedSubmenus,\n userOnKeyDown,\n activeDescendant,\n setActiveDescendant,\n scrollOptionIntoView,\n onSubmenuToggle,\n selectedOptions,\n onOptionClick,\n onClickOutside,\n ],\n );\n\n const onMouseEnter: React.MouseEventHandler = useCallback(\n (e: React.MouseEvent) => {\n if (inputReference.current) inputReference.current.focus();\n else listboxReference.current?.focus();\n userOnMouseEnter(e);\n },\n [inputReference, listboxReference, userOnMouseEnter],\n );\n return { onKeyDown, onMouseEnter, onMouseLeave };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAwC;AACxC,iCAAsC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,4BAAoB,OAAO,IAAI,IAAI,CAAC,gBAAgB,OAAO,IAAI;AAC/D,YAAK,QAA8C,SAAU;AAC7D,sBAAc,qBAAqB,QAAQ,CAAC;AAC5C,YAAI,OAAO,QAAS,QAAO,QAAQ,CAAC;AAAA,MACtC,WAAW,EAAE,SAAS,UAAU;AAC9B,uBAAe,CAAC;AAAA,MAClB,WAAW,EAAE,SAAS,QAAQ;AAC5B,cAAM,oBAAgB,iCAAmB,SAAS,QAAQ,SAAS,GAAG,+BAAkB;AACxF,4BAAoB,QAAQ,aAAa,EAAE,IAAI;AAC/C,6BAAqB,QAAQ,aAAa,EAAE,IAAI;AAAA,MAClD,WAAW,EAAE,SAAS,OAAO;AAC3B,cAAM,oBAAgB,iCAAmB,SAAS,GAAG,iCAAoB,EAAE;AAC3E,4BAAoB,QAAQ,aAAa,EAAE,IAAI;AAC/C,6BAAqB,QAAQ,aAAa,EAAE,IAAI;AAAA,MAClD;AACA,UAAI,OAAO,UAAW,QAAO,UAAU,CAAC;AACxC,oBAAc,CAAC;AAAA,IACjB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,mBAAwC;AAAA,IAC5C,CAAC,MAAwB;AACvB,UAAI,eAAe,QAAS,gBAAe,QAAQ,MAAM;AAAA,UACpD,kBAAiB,SAAS,MAAM;AACrC,uBAAiB,CAAC;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,kBAAkB,gBAAgB;AAAA,EACrD;AACA,SAAO,EAAE,WAAW,cAAc,aAAa;AACjD;",
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-params */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport type { DSDropdownMenuT } from '../react-desc-prop-types.js';\nimport { findInCircularList, isOptionFocuseable, manageOpenedSubmenus } from '../utils/index.js';\n\ntype UseDropdownListboxHandlersType = () => {\n onKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave?: React.MouseEventHandler;\n};\n\nexport const useDropdownListboxHandlers: UseDropdownListboxHandlersType = () => {\n const {\n props: {\n options,\n onOptionClick,\n openedSubmenus,\n onSubmenuToggle,\n onKeyDown: userOnKeyDown,\n selectedOptions,\n onClickOutside,\n onMouseEnter: userOnMouseEnter,\n onMouseLeave,\n },\n activeDescendant,\n setActiveDescendant,\n scrollOptionIntoView,\n listboxReference,\n inputReference,\n } = useContext(DSDropdownMenuContext);\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n const currentItemIndex = options.findIndex((opt) => opt.dsId === activeDescendant);\n if (currentItemIndex === -1) return;\n\n const option = options[currentItemIndex];\n\n e.stopPropagation();\n\n if (e.code === 'ArrowDown') {\n e.preventDefault();\n const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (e.code === 'ArrowUp') {\n e.preventDefault();\n const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable, -1);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (\n e.code === 'ArrowRight' &&\n ['submenu', 'singleWithSubmenu'].includes(option.type) &&\n !openedSubmenus[option.dsId]\n ) {\n e.preventDefault();\n const { type } = option;\n if (type === 'submenu' || type === 'singleWithSubmenu') {\n if (option.applyAriaDisabled) return;\n }\n onSubmenuToggle(manageOpenedSubmenus(options, { ...openedSubmenus, [option.dsId]: true }, option), option, e);\n } else if (['Space', 'Enter'].includes(e.code)) {\n e.preventDefault();\n const { type } = option;\n if (type === 'singleWithSubmenu') {\n if (option.applyAriaDisabled) return;\n }\n const nextSelectedOptions = { ...selectedOptions };\n nextSelectedOptions[option.dsId] = !selectedOptions[option.dsId];\n if ((option as DSDropdownMenuT.ItemActionOptions)?.disabled) return; // prevent click when is disabled\n onOptionClick(nextSelectedOptions, option, e);\n if (option.onClick) option.onClick(e);\n } else if (e.code === 'Escape') {\n onClickOutside(e);\n } else if (e.code === 'Home') {\n const nextItemIndex = findInCircularList(options, options.length - 1, isOptionFocuseable);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (e.code === 'End') {\n const nextItemIndex = findInCircularList(options, 0, isOptionFocuseable, -1);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n }\n if (option.onKeyDown) option.onKeyDown(e);\n userOnKeyDown(e);\n },\n [\n options,\n openedSubmenus,\n userOnKeyDown,\n activeDescendant,\n setActiveDescendant,\n scrollOptionIntoView,\n onSubmenuToggle,\n selectedOptions,\n onOptionClick,\n onClickOutside,\n ],\n );\n\n const onMouseEnter: React.MouseEventHandler = useCallback(\n (e: React.MouseEvent) => {\n if (inputReference.current) inputReference.current.focus();\n else listboxReference.current?.focus();\n userOnMouseEnter(e);\n },\n [inputReference, listboxReference, userOnMouseEnter],\n );\n return { onKeyDown, onMouseEnter, onMouseLeave };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAwC;AACxC,iCAAsC;AAEtC,mBAA6E;AAQtE,MAAM,6BAA6D,MAAM;AAC9E,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gD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AU;AAC7D,sBAAc,qBAAqB,QAAQ,CAAC;AAC5C,YAAI,OAAO,QAAS,QAAO,QAAQ,CAAC;AAAA,MACtC,WAAW,EAAE,SAAS,UAAU;AAC9B,uBAAe,CAAC;AAAA,MAClB,WAAW,EAAE,SAAS,QAAQ;AAC5B,cAAM,oBAAgB,iCAAmB,SAAS,QAAQ,SAAS,GAAG,+BAAkB;AACxF,4BAAoB,QAAQ,aAAa,EAAE,IAAI;AAC/C,6BAAqB,QAAQ,aAAa,EAAE,IAAI;AAAA,MAClD,WAAW,EAAE,SAAS,OAAO;AAC3B,cAAM,oBAAgB,iCAAmB,SAAS,GAAG,iCAAoB,EAAE;AAC3E,4BAAoB,QAAQ,aAAa,EAAE,IAAI;AAC/C,6BAAqB,QAAQ,aAAa,EAAE,IAAI;AAAA,MAClD;AACA,UAAI,OAAO,UAAW,QAAO,UAAU,CAAC;AACxC,oBAAc,CAAC;AAAA,IACjB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,mBAAwC;AAAA,IAC5C,CAAC,MAAwB;AACvB,UAAI,eAAe,QAAS,gBAAe,QAAQ,MAAM;AAAA,UACpD,kBAAiB,SAAS,MAAM;AACrC,uBAAiB,CAAC;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,kBAAkB,gBAAgB;AAAA,EACrD;AACA,SAAO,EAAE,WAAW,cAAc,aAAa;AACjD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -61,6 +61,10 @@ const useDropdownMenuItemHandlers = (option) => {
|
|
|
61
61
|
(e) => {
|
|
62
62
|
e.stopPropagation();
|
|
63
63
|
e.preventDefault();
|
|
64
|
+
if (mutableOption?.current?.type === "singleWithSubmenu") {
|
|
65
|
+
const { applyAriaDisabled } = mutableOption.current;
|
|
66
|
+
if (applyAriaDisabled) return;
|
|
67
|
+
}
|
|
64
68
|
const nextSelectedOptions = { ...mutableSelectedOptions.current };
|
|
65
69
|
nextSelectedOptions[mutableOption.current.dsId] = !mutableSelectedOptions.current[mutableOption.current.dsId];
|
|
66
70
|
if (mutableOption?.current?.disabled) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useDropdownMenuItemHandlers.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type React from 'react';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { useMakeMutable } from './useMakeMutable.js';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { manageOpenedSubmenus } from '../utils/index.js';\nimport type { DSDropdownMenuT } from '../react-desc-prop-types.js';\n\ntype UseDropdownMenuItemHandlersType = (option: DSDropdownMenuT.Item) => {\n onClick: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onSubmenuOpen: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onSubmenuClose: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onDropdownKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n};\n\nexport const useDropdownMenuItemHandlers: UseDropdownMenuItemHandlersType = (option) => {\n const {\n props: {\n options,\n selectedOptions,\n onOptionClick,\n openedSubmenus,\n onSubmenuToggle,\n onMouseEnter,\n onMouseLeave,\n onMouseDown,\n },\n listboxReference,\n inputReference,\n } = useContext(DSDropdownMenuContext);\n\n // it's vital for the opinionated onSubmenuOpen / onSubmenuClose to\n // - have access to the latest information about openedSubmenus\n // - be as \"pure\" as possible to guarantee that usage with the \"bridge\" pattern\n // will be as \"transparent\" as possible (if nested inside async code, redefing the callback may invoke a stale closure)\n // the whole component is kind of messy so I'm going to implement a quick and dirty solution\n // I'm going to make all the arguments for the callbacks \"mutable\",\n // this is sub-optimal on a performance level but will have to do for now\n const mutableOption = useMakeMutable(option);\n const mutableOptions = useMakeMutable(options);\n const mutableOpenedSubmenus = useMakeMutable(openedSubmenus);\n const mutableOnSubmenuToggle = useMakeMutable(onSubmenuToggle);\n const mutableOnOptionClick = useMakeMutable(onOptionClick);\n const mutableSelectedOptions = useMakeMutable(selectedOptions);\n\n // This callback is used on single / multi items to toggle the selection\n const onClick = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n e.stopPropagation();\n e.preventDefault();\n const nextSelectedOptions = { ...mutableSelectedOptions.current };\n nextSelectedOptions[mutableOption.current.dsId] = !mutableSelectedOptions.current[mutableOption.current.dsId];\n if ((mutableOption?.current as DSDropdownMenuT.ItemActionOptions)?.disabled) return; // prevent click when is disabled\n mutableOnOptionClick?.current?.(nextSelectedOptions, mutableOption.current, e);\n // we avoid invoking \"onClick\" twice when the users \"key-down - enter\" on the item by checking if the event is keyboard related\n if (e.type === 'click') mutableOption?.current?.onClick?.(e);\n },\n [mutableOnOptionClick, mutableOption, mutableSelectedOptions],\n );\n\n // This callback is used on submenu items to open it onMouseEnter\n const onSubmenuOpen = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n mutableOnSubmenuToggle?.current?.(\n manageOpenedSubmenus(\n mutableOptions.current,\n { ...(mutableOpenedSubmenus?.current || {}), [mutableOption.current.dsId]: true },\n mutableOption.current,\n ),\n mutableOption.current,\n e,\n );\n },\n [mutableOnSubmenuToggle, mutableOpenedSubmenus, mutableOption, mutableOptions],\n );\n\n // This callback is used on submenu to close it onMouseLeave\n const onSubmenuClose = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n mutableOnSubmenuToggle?.current?.(\n manageOpenedSubmenus(\n mutableOptions.current,\n { ...(mutableOpenedSubmenus?.current || {}), [mutableOption.current.dsId]: false },\n mutableOption.current,\n ),\n mutableOption.current,\n e,\n );\n if (inputReference.current) inputReference.current.focus();\n else listboxReference.current?.focus();\n },\n [inputReference, listboxReference, mutableOnSubmenuToggle, mutableOpenedSubmenus, mutableOption, mutableOptions],\n );\n\n // This callback is used on child dropdown to close the current opened submenu (which spawned it)\n const onDropdownKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (e.code === 'ArrowLeft') {\n onSubmenuClose(e);\n e.preventDefault();\n }\n },\n [onSubmenuClose],\n );\n\n return useMemo(\n () => ({\n onClick,\n onSubmenuOpen,\n onSubmenuClose,\n onDropdownKeyDown,\n onMouseEnter,\n onMouseLeave,\n onMouseDown,\n }),\n [onClick, onSubmenuOpen, onSubmenuClose, onDropdownKeyDown, onMouseEnter, onMouseLeave, onMouseDown],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAiD;AACjD,4BAA+B;AAC/B,iCAAsC;AACtC,mBAAqC;AAY9B,MAAM,8BAA+D,CAAC,WAAW;AACtF,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gDAAqB;AASpC,QAAM,oBAAgB,sCAAe,MAAM;AAC3C,QAAM,qBAAiB,sCAAe,OAAO;AAC7C,QAAM,4BAAwB,sCAAe,cAAc;AAC3D,QAAM,6BAAyB,sCAAe,eAAe;AAC7D,QAAM,2BAAuB,sCAAe,aAAa;AACzD,QAAM,6BAAyB,sCAAe,eAAe;AAG7D,QAAM,cAAU;AAAA,IACd,CAAC,MAA8C;AAC7C,QAAE,gBAAgB;AAClB,QAAE,eAAe;AACjB,YAAM,sBAAsB,EAAE,GAAG,uBAAuB,QAAQ;AAChE,0BAAoB,cAAc,QAAQ,IAAI,IAAI,CAAC,uBAAuB,QAAQ,cAAc,QAAQ,IAAI;AAC5G,UAAK,eAAe,SAA+C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cAAc,cAAc,WAAW;AAAA,EACrG;AACF;",
|
|
4
|
+
"sourcesContent": ["import type React from 'react';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { useMakeMutable } from './useMakeMutable.js';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { manageOpenedSubmenus } from '../utils/index.js';\nimport type { DSDropdownMenuT } from '../react-desc-prop-types.js';\n\ntype UseDropdownMenuItemHandlersType = (option: DSDropdownMenuT.Item) => {\n onClick: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onSubmenuOpen: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onSubmenuClose: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onDropdownKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n};\n\nexport const useDropdownMenuItemHandlers: UseDropdownMenuItemHandlersType = (option) => {\n const {\n props: {\n options,\n selectedOptions,\n onOptionClick,\n openedSubmenus,\n onSubmenuToggle,\n onMouseEnter,\n onMouseLeave,\n onMouseDown,\n },\n listboxReference,\n inputReference,\n } = useContext(DSDropdownMenuContext);\n\n // it's vital for the opinionated onSubmenuOpen / onSubmenuClose to\n // - have access to the latest information about openedSubmenus\n // - be as \"pure\" as possible to guarantee that usage with the \"bridge\" pattern\n // will be as \"transparent\" as possible (if nested inside async code, redefing the callback may invoke a stale closure)\n // the whole component is kind of messy so I'm going to implement a quick and dirty solution\n // I'm going to make all the arguments for the callbacks \"mutable\",\n // this is sub-optimal on a performance level but will have to do for now\n const mutableOption = useMakeMutable(option);\n const mutableOptions = useMakeMutable(options);\n const mutableOpenedSubmenus = useMakeMutable(openedSubmenus);\n const mutableOnSubmenuToggle = useMakeMutable(onSubmenuToggle);\n const mutableOnOptionClick = useMakeMutable(onOptionClick);\n const mutableSelectedOptions = useMakeMutable(selectedOptions);\n\n // This callback is used on single / multi items to toggle the selection\n const onClick = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n e.stopPropagation();\n e.preventDefault();\n if (mutableOption?.current?.type === 'singleWithSubmenu') {\n const { applyAriaDisabled } = mutableOption.current;\n if (applyAriaDisabled) return;\n }\n const nextSelectedOptions = { ...mutableSelectedOptions.current };\n nextSelectedOptions[mutableOption.current.dsId] = !mutableSelectedOptions.current[mutableOption.current.dsId];\n if ((mutableOption?.current as DSDropdownMenuT.ItemActionOptions)?.disabled) return; // prevent click when is disabled\n mutableOnOptionClick?.current?.(nextSelectedOptions, mutableOption.current, e);\n // we avoid invoking \"onClick\" twice when the users \"key-down - enter\" on the item by checking if the event is keyboard related\n if (e.type === 'click') mutableOption?.current?.onClick?.(e);\n },\n [mutableOnOptionClick, mutableOption, mutableSelectedOptions],\n );\n\n // This callback is used on submenu items to open it onMouseEnter\n const onSubmenuOpen = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n mutableOnSubmenuToggle?.current?.(\n manageOpenedSubmenus(\n mutableOptions.current,\n { ...(mutableOpenedSubmenus?.current || {}), [mutableOption.current.dsId]: true },\n mutableOption.current,\n ),\n mutableOption.current,\n e,\n );\n },\n [mutableOnSubmenuToggle, mutableOpenedSubmenus, mutableOption, mutableOptions],\n );\n\n // This callback is used on submenu to close it onMouseLeave\n const onSubmenuClose = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n mutableOnSubmenuToggle?.current?.(\n manageOpenedSubmenus(\n mutableOptions.current,\n { ...(mutableOpenedSubmenus?.current || {}), [mutableOption.current.dsId]: false },\n mutableOption.current,\n ),\n mutableOption.current,\n e,\n );\n if (inputReference.current) inputReference.current.focus();\n else listboxReference.current?.focus();\n },\n [inputReference, listboxReference, mutableOnSubmenuToggle, mutableOpenedSubmenus, mutableOption, mutableOptions],\n );\n\n // This callback is used on child dropdown to close the current opened submenu (which spawned it)\n const onDropdownKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (e.code === 'ArrowLeft') {\n onSubmenuClose(e);\n e.preventDefault();\n }\n },\n [onSubmenuClose],\n );\n\n return useMemo(\n () => ({\n onClick,\n onSubmenuOpen,\n onSubmenuClose,\n onDropdownKeyDown,\n onMouseEnter,\n onMouseLeave,\n onMouseDown,\n }),\n [onClick, onSubmenuOpen, onSubmenuClose, onDropdownKeyDown, onMouseEnter, onMouseLeave, onMouseDown],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAiD;AACjD,4BAA+B;AAC/B,iCAAsC;AACtC,mBAAqC;AAY9B,MAAM,8BAA+D,CAAC,WAAW;AACtF,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gDAAqB;AASpC,QAAM,oBAAgB,sCAAe,MAAM;AAC3C,QAAM,qBAAiB,sCAAe,OAAO;AAC7C,QAAM,4BAAwB,sCAAe,cAAc;AAC3D,QAAM,6BAAyB,sCAAe,eAAe;AAC7D,QAAM,2BAAuB,sCAAe,aAAa;AACzD,QAAM,6BAAyB,sCAAe,eAAe;AAG7D,QAAM,cAAU;AAAA,IACd,CAAC,MAA8C;AAC7C,QAAE,gBAAgB;AAClB,QAAE,eAAe;AACjB,UAAI,eAAe,SAAS,SAAS,qBAAqB;AACxD,cAAM,EAAE,kBAAkB,IAAI,cAAc;AAC5C,YAAI,kBAAmB;AAAA,MACzB;AACA,YAAM,sBAAsB,EAAE,GAAG,uBAAuB,QAAQ;AAChE,0BAAoB,cAAc,QAAQ,IAAI,IAAI,CAAC,uBAAuB,QAAQ,cAAc,QAAQ,IAAI;AAC5G,UAAK,eAAe,SAA+C,SAAU;AAC7E,4BAAsB,UAAU,qBAAqB,cAAc,SAAS,CAAC;AAE7E,UAAI,EAAE,SAAS,QAAS,gB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 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport type React from 'react';\nimport type { useVirtual } from 'react-virtual';\nimport {\n type GlobalAttributesT,\n PropTypes,\n type XstyledProps,\n globalAttributesPropTypes,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\nimport type { SizingProps } from '@elliemae/ds-system';\n\nexport namespace DSDropdownMenuT {\n export type PopperPlacementsT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n\n export interface RequiredProps {\n options: Item[];\n isOpened: boolean;\n }\n\n export interface DefaultProps {\n onClickOutside: (e: MouseEvent | React.KeyboardEvent | TouchEvent) => void;\n onKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n selectedOptions: Record<string, boolean>;\n onOptionClick: (\n nextSelectedOptions: Record<string, boolean>,\n clickedOption: Item,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n openedSubmenus: Record<string, boolean>;\n onSubmenuToggle: (\n nextOpenedSubmenus: Record<string, boolean>,\n submenu: Item,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n isLoading: boolean;\n hasInput: boolean;\n inputValue: string;\n inputPlaceholder: string;\n onInputChange: React.FormEventHandler<HTMLInputElement>;\n startPlacementPreference: PopperPlacementsT;\n placementOrderPreference: PopperPlacementsT[];\n customOffset: [number, number];\n wrapperStyles: Record<string, unknown>;\n actionRef: React.MutableRefObject<Record<string, unknown>>;\n as: keyof JSX.IntrinsicElements;\n children?: React.ReactNode;\n isSkeleton: boolean;\n }\n\n export interface OptionalProps {\n zIndex?: number;\n minWidth?: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n HeaderComp?: React.ComponentType<{ ctx?: DSDropdownMenuT.CTX }>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n\n export interface CTX {\n props: React.PropsWithChildren<InternalProps>;\n triggerReferenceElement: HTMLDivElement | null;\n setTriggerReferenceElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n listboxReference: React.RefObject<HTMLDivElement>;\n inputReference: React.RefObject<HTMLInputElement>;\n activeDescendant: string;\n setActiveDescendant: React.Dispatch<React.SetStateAction<string>>;\n scrollOptionIntoView: (dsId: string) => void;\n virtualListHelpers: ReturnType<typeof useVirtual>;\n DSDropdownMenuV2: React.ComponentType<Props>;\n }\n\n interface CommonItemOptions extends Omit<GlobalAttributesT, 'value'>, XstyledProps {\n dsId: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n render?: React.ComponentType<any>;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => null;\n }\n\n export interface ItemActionOptions extends CommonItemOptions {\n type: 'action';\n label: string;\n value: unknown;\n disabled?: boolean;\n }\n\n export interface ItemSingleOptions extends CommonItemOptions {\n type: 'single';\n label: string;\n value: unknown;\n disabled?: boolean;\n }\n\n export interface ItemSingleWithSubmenuOptions extends CommonItemOptions {\n type: 'singleWithSubmenu';\n label: string;\n value: unknown;\n disabled?: boolean;\n rightAddon?: 'chevron' | 'ellipsis';\n options: Item[];\n }\n\n export interface ItemCheckboxOptions extends CommonItemOptions {\n type: 'checkbox';\n label: string;\n value: unknown;\n disabled?: boolean;\n }\n\n export interface ItemSubmenuOptions extends CommonItemOptions {\n type: 'submenu';\n label: string;\n value: unknown;\n disabled?: boolean;\n rightAddon?: 'chevron' | 'ellipsis';\n options: Item[];\n }\n\n export interface ItemSeparatorOptions extends CommonItemOptions {\n type: 'separator';\n }\n\n export interface ItemSectionOptions extends CommonItemOptions {\n type: 'section';\n label: string;\n }\n\n export interface ItemSkeletonOptions extends CommonItemOptions {\n type: 'skeleton';\n }\n\n export type Item =\n | ItemActionOptions\n | ItemSingleOptions\n | ItemCheckboxOptions\n | ItemSubmenuOptions\n | ItemSingleWithSubmenuOptions\n | ItemSeparatorOptions\n | ItemSectionOptions\n | ItemSkeletonOptions;\n\n export interface ItemDictionary {\n [dsId: string]: {\n original: Item;\n containerRef: React.RefObject<HTMLDivElement>;\n parent: string | null;\n };\n }\n}\n\nexport const actionOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['action']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const singleOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['single']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const checkboxOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['checkbox']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const submenuOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['submenu']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n rightAddon: PropTypes.oneOf(['chevron', 'ellipsis']),\n options: PropTypes.array,\n minWidth: PropTypes.any,\n maxHeight: PropTypes.any,\n render: PropTypes.func,\n});\nexport const singleWithSubmenuOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['singleWithSubmenu']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n rightAddon: PropTypes.oneOf(['chevron', 'ellipsis']),\n options: PropTypes.array,\n minWidth: PropTypes.any,\n maxHeight: PropTypes.any,\n render: PropTypes.func,\n});\nexport const separatorOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['separator']),\n label: PropTypes.string.isRequired,\n render: PropTypes.func,\n});\nexport const sectionOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['section']),\n label: PropTypes.string.isRequired,\n render: PropTypes.func,\n});\n\nexport const optionTypesSchemas = PropTypes.oneOfType([\n actionOptionSchema,\n singleOptionSchema,\n checkboxOptionSchema,\n submenuOptionSchema,\n singleWithSubmenuOptionSchema,\n separatorOptionSchema,\n sectionOptionSchema,\n]);\n\nexport const DSDropdownMenuV2PropTypes = {\n options: PropTypes.arrayOf(optionTypesSchemas).description('The array of option for the menu').omitValidation()\n .isRequired,\n isOpened: PropTypes.bool.description('Whether the dropdown menu is opened or not').isRequired,\n onClickOutside: PropTypes.func\n .description('Callback executed when you click outside the dropdown menu, or press the Esc key')\n .defaultValue(() => null),\n selectedOptions: PropTypes.object\n .description(\n 'Object with the ids of the options as keys, and booleans as keys. Represents the state of the current selection in the dropdown menu',\n )\n .defaultValue({}),\n onOptionClick: PropTypes.func\n .description(\n 'Callback triggered when an item is clicked or pressed. We provide the next selected options, the clicked option and the event, in that order',\n )\n .defaultValue(() => null),\n openedSubmenus: PropTypes.object\n .description(\n 'Object with the ids of the submenus as keys, and booleans as keys. Represents the state of the current opened submenus',\n )\n .defaultValue({}),\n onSubmenuToggle: PropTypes.func\n .description(\n 'Callback triggered when a submenu is opened or closed. We provide the next opened submenus, the clicked one and the event, in that order',\n )\n .defaultValue(() => null),\n startPlacementPreference: PropTypes.string\n .description('Where to place the popper for the dropdown menu')\n .defaultValue('bottom-start'),\n placementOrderPreference: PropTypes.arrayOf(PropTypes.string)\n .description('Placement priorities for the dropdown menu')\n .defaultValue(['bottom-start', 'top-start', 'right-start', 'right-end', 'left-start', 'left-end']),\n customOffset: PropTypes.arrayOf(PropTypes.number)\n .description('Custom offset for the dropdown menu')\n .defaultValue([0, 4]),\n wrapperStyles: PropTypes.object.description('Styling for the dropdown menu wrapper').defaultValue({}),\n isLoading: PropTypes.bool\n .description('Whether the dropdown menu should render the loading indicator')\n .defaultValue(false),\n zIndex: PropTypes.number.description('ZIndex for the popper').defaultValue(10),\n HeaderComp: PropTypes.func\n .description('Component to render as a header for the dropdown menu')\n .defaultValue(undefined),\n actionRef: PropTypes.object.description('Reference where all the exposed action callbacks will be exposed'),\n minWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),\n maxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),\n ...globalAttributesPropTypes,\n onKeyDown: PropTypes.func.description('Callback executed when a key is pressed').defaultValue(() => null),\n onMouseEnter: PropTypes.func\n .description('Callback executed when the mouse enter the dropdown menu')\n .defaultValue(() => null),\n onMouseLeave: PropTypes.func\n .description('Callback executed when the mouse leaves the dropdown menu')\n .defaultValue(() => null),\n isSkeleton: PropTypes.bool.description('Whether the dropdown menu should render the skeleton').defaultValue(false),\n} as ValidationMap<unknown>;\n\nexport const defaultProps: DSDropdownMenuT.DefaultProps = {\n onClickOutside: () => null,\n onKeyDown: () => null,\n onMouseEnter: () => null,\n onMouseLeave: () => null,\n selectedOptions: {},\n onOptionClick: () => null,\n openedSubmenus: {},\n onSubmenuToggle: () => null,\n isLoading: false,\n hasInput: false,\n inputValue: '',\n inputPlaceholder: 'Hint text',\n onInputChange: () => null,\n startPlacementPreference: 'bottom-start',\n placementOrderPreference: ['bottom-start', 'top-start', 'right-start', 'right-end', 'left-start', 'left-end'],\n customOffset: [0, 4],\n wrapperStyles: {},\n actionRef: { current: {} },\n as: 'div',\n isSkeleton: false,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,8BAMO;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport type React from 'react';\nimport type { useVirtual } from 'react-virtual';\nimport {\n type GlobalAttributesT,\n PropTypes,\n type XstyledProps,\n globalAttributesPropTypes,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\nimport type { SizingProps } from '@elliemae/ds-system';\n\nexport namespace DSDropdownMenuT {\n export type PopperPlacementsT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n\n export interface RequiredProps {\n options: Item[];\n isOpened: boolean;\n }\n\n export interface DefaultProps {\n onClickOutside: (e: MouseEvent | React.KeyboardEvent | TouchEvent) => void;\n onKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n selectedOptions: Record<string, boolean>;\n onOptionClick: (\n nextSelectedOptions: Record<string, boolean>,\n clickedOption: Item,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n openedSubmenus: Record<string, boolean>;\n onSubmenuToggle: (\n nextOpenedSubmenus: Record<string, boolean>,\n submenu: Item,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n isLoading: boolean;\n hasInput: boolean;\n inputValue: string;\n inputPlaceholder: string;\n onInputChange: React.FormEventHandler<HTMLInputElement>;\n startPlacementPreference: PopperPlacementsT;\n placementOrderPreference: PopperPlacementsT[];\n customOffset: [number, number];\n wrapperStyles: Record<string, unknown>;\n actionRef: React.MutableRefObject<Record<string, unknown>>;\n as: keyof JSX.IntrinsicElements;\n children?: React.ReactNode;\n isSkeleton: boolean;\n }\n\n export interface OptionalProps {\n zIndex?: number;\n minWidth?: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n HeaderComp?: React.ComponentType<{ ctx?: DSDropdownMenuT.CTX }>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n\n export interface CTX {\n props: React.PropsWithChildren<InternalProps>;\n triggerReferenceElement: HTMLDivElement | null;\n setTriggerReferenceElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n listboxReference: React.RefObject<HTMLDivElement>;\n inputReference: React.RefObject<HTMLInputElement>;\n activeDescendant: string;\n setActiveDescendant: React.Dispatch<React.SetStateAction<string>>;\n scrollOptionIntoView: (dsId: string) => void;\n virtualListHelpers: ReturnType<typeof useVirtual>;\n DSDropdownMenuV2: React.ComponentType<Props>;\n }\n\n interface CommonItemOptions extends Omit<GlobalAttributesT, 'value'>, XstyledProps {\n dsId: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n render?: React.ComponentType<any>;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => null;\n }\n\n export interface ItemActionOptions extends CommonItemOptions {\n type: 'action';\n label: string;\n value: unknown;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n }\n\n export interface ItemSingleOptions extends CommonItemOptions {\n type: 'single';\n label: string;\n value: unknown;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n }\n\n export interface ItemSingleWithSubmenuOptions extends CommonItemOptions {\n type: 'singleWithSubmenu';\n label: string;\n value: unknown;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n rightAddon?: 'chevron' | 'ellipsis';\n options: Item[];\n }\n\n export interface ItemCheckboxOptions extends CommonItemOptions {\n type: 'checkbox';\n label: string;\n value: unknown;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n }\n\n export interface ItemSubmenuOptions extends CommonItemOptions {\n type: 'submenu';\n label: string;\n value: unknown;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n rightAddon?: 'chevron' | 'ellipsis';\n options: Item[];\n }\n\n export interface ItemSeparatorOptions extends CommonItemOptions {\n type: 'separator';\n }\n\n export interface ItemSectionOptions extends CommonItemOptions {\n type: 'section';\n label: string;\n }\n\n export interface ItemSkeletonOptions extends CommonItemOptions {\n type: 'skeleton';\n }\n\n export type Item =\n | ItemActionOptions\n | ItemSingleOptions\n | ItemCheckboxOptions\n | ItemSubmenuOptions\n | ItemSingleWithSubmenuOptions\n | ItemSeparatorOptions\n | ItemSectionOptions\n | ItemSkeletonOptions;\n\n export interface ItemDictionary {\n [dsId: string]: {\n original: Item;\n containerRef: React.RefObject<HTMLDivElement>;\n parent: string | null;\n };\n }\n}\n\nexport const actionOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['action']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const singleOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['single']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const checkboxOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['checkbox']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const submenuOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['submenu']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n rightAddon: PropTypes.oneOf(['chevron', 'ellipsis']),\n options: PropTypes.array,\n minWidth: PropTypes.any,\n maxHeight: PropTypes.any,\n render: PropTypes.func,\n});\nexport const singleWithSubmenuOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['singleWithSubmenu']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n rightAddon: PropTypes.oneOf(['chevron', 'ellipsis']),\n options: PropTypes.array,\n minWidth: PropTypes.any,\n maxHeight: PropTypes.any,\n render: PropTypes.func,\n});\nexport const separatorOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['separator']),\n label: PropTypes.string.isRequired,\n render: PropTypes.func,\n});\nexport const sectionOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['section']),\n label: PropTypes.string.isRequired,\n render: PropTypes.func,\n});\n\nexport const optionTypesSchemas = PropTypes.oneOfType([\n actionOptionSchema,\n singleOptionSchema,\n checkboxOptionSchema,\n submenuOptionSchema,\n singleWithSubmenuOptionSchema,\n separatorOptionSchema,\n sectionOptionSchema,\n]);\n\nexport const DSDropdownMenuV2PropTypes = {\n options: PropTypes.arrayOf(optionTypesSchemas).description('The array of option for the menu').omitValidation()\n .isRequired,\n isOpened: PropTypes.bool.description('Whether the dropdown menu is opened or not').isRequired,\n onClickOutside: PropTypes.func\n .description('Callback executed when you click outside the dropdown menu, or press the Esc key')\n .defaultValue(() => null),\n selectedOptions: PropTypes.object\n .description(\n 'Object with the ids of the options as keys, and booleans as keys. Represents the state of the current selection in the dropdown menu',\n )\n .defaultValue({}),\n onOptionClick: PropTypes.func\n .description(\n 'Callback triggered when an item is clicked or pressed. We provide the next selected options, the clicked option and the event, in that order',\n )\n .defaultValue(() => null),\n openedSubmenus: PropTypes.object\n .description(\n 'Object with the ids of the submenus as keys, and booleans as keys. Represents the state of the current opened submenus',\n )\n .defaultValue({}),\n onSubmenuToggle: PropTypes.func\n .description(\n 'Callback triggered when a submenu is opened or closed. We provide the next opened submenus, the clicked one and the event, in that order',\n )\n .defaultValue(() => null),\n startPlacementPreference: PropTypes.string\n .description('Where to place the popper for the dropdown menu')\n .defaultValue('bottom-start'),\n placementOrderPreference: PropTypes.arrayOf(PropTypes.string)\n .description('Placement priorities for the dropdown menu')\n .defaultValue(['bottom-start', 'top-start', 'right-start', 'right-end', 'left-start', 'left-end']),\n customOffset: PropTypes.arrayOf(PropTypes.number)\n .description('Custom offset for the dropdown menu')\n .defaultValue([0, 4]),\n wrapperStyles: PropTypes.object.description('Styling for the dropdown menu wrapper').defaultValue({}),\n isLoading: PropTypes.bool\n .description('Whether the dropdown menu should render the loading indicator')\n .defaultValue(false),\n zIndex: PropTypes.number.description('ZIndex for the popper').defaultValue(10),\n HeaderComp: PropTypes.func\n .description('Component to render as a header for the dropdown menu')\n .defaultValue(undefined),\n actionRef: PropTypes.object.description('Reference where all the exposed action callbacks will be exposed'),\n minWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),\n maxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),\n ...globalAttributesPropTypes,\n onKeyDown: PropTypes.func.description('Callback executed when a key is pressed').defaultValue(() => null),\n onMouseEnter: PropTypes.func\n .description('Callback executed when the mouse enter the dropdown menu')\n .defaultValue(() => null),\n onMouseLeave: PropTypes.func\n .description('Callback executed when the mouse leaves the dropdown menu')\n .defaultValue(() => null),\n isSkeleton: PropTypes.bool.description('Whether the dropdown menu should render the skeleton').defaultValue(false),\n} as ValidationMap<unknown>;\n\nexport const defaultProps: DSDropdownMenuT.DefaultProps = {\n onClickOutside: () => null,\n onKeyDown: () => null,\n onMouseEnter: () => null,\n onMouseLeave: () => null,\n selectedOptions: {},\n onOptionClick: () => null,\n openedSubmenus: {},\n onSubmenuToggle: () => null,\n isLoading: false,\n hasInput: false,\n inputValue: '',\n inputPlaceholder: 'Hint text',\n onInputChange: () => null,\n startPlacementPreference: 'bottom-start',\n placementOrderPreference: ['bottom-start', 'top-start', 'right-start', 'right-end', 'left-start', 'left-end'],\n customOffset: [0, 4],\n wrapperStyles: {},\n actionRef: { current: {} },\n as: 'div',\n isSkeleton: false,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,8BAMO;AA6KA,MAAM,qBAAqB,kCAAU,MAAM;AAAA,EAChD,MAAM,kCAAU,OAAO;AAAA,EACvB,MAAM,kCAAU,MAAM,CAAC,QAAQ,CAAC;AAAA,EAChC,OAAO,kCAAU,OAAO;AAAA,EACxB,gBAAgB,kCAAU;AAAA,EAC1B,UAAU,kCAAU;AAAA,EACpB,QAAQ,kCAAU;AACpB,CAAC;AACM,MAAM,qBAAqB,kCAAU,MAAM;AAAA,EAChD,MAAM,kCAAU,OAAO;AAAA,EACvB,MAAM,kCAAU,MAAM,CAAC,QAAQ,CAAC;AAAA,EAChC,OAAO,kCAAU,OAAO;AAAA,EACxB,gBAAgB,kCAAU;AAAA,EAC1B,OAAO,kCAAU,IAAI;AAAA,EACrB,UAAU,kCAAU;AAAA,EACpB,QAAQ,kCAAU;AACpB,CAAC;AACM,MAAM,uBAAuB,kCAAU,MAAM;AAAA,EAClD,MAAM,kCAAU,OAA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Handlers = () => {
|
|
|
39
39
|
scrollOptionIntoView(options[nextItemIndex].dsId);
|
|
40
40
|
} else if (e.code === "ArrowRight" && ["submenu", "singleWithSubmenu"].includes(option.type) && !openedSubmenus[option.dsId]) {
|
|
41
41
|
e.preventDefault();
|
|
42
|
+
const { type } = option;
|
|
43
|
+
if (type === "submenu" || type === "singleWithSubmenu") {
|
|
44
|
+
if (option.applyAriaDisabled) return;
|
|
45
|
+
}
|
|
42
46
|
onSubmenuToggle(manageOpenedSubmenus(options, { ...openedSubmenus, [option.dsId]: true }, option), option, e);
|
|
43
47
|
} else if (["Space", "Enter"].includes(e.code)) {
|
|
44
48
|
e.preventDefault();
|
|
49
|
+
const { type } = option;
|
|
50
|
+
if (type === "singleWithSubmenu") {
|
|
51
|
+
if (option.applyAriaDisabled) return;
|
|
52
|
+
}
|
|
45
53
|
const nextSelectedOptions = { ...selectedOptions };
|
|
46
54
|
nextSelectedOptions[option.dsId] = !selectedOptions[option.dsId];
|
|
47
55
|
if (option?.disabled) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useDropdownListboxHandlers.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport type { DSDropdownMenuT } from '../react-desc-prop-types.js';\nimport { findInCircularList, isOptionFocuseable, manageOpenedSubmenus } from '../utils/index.js';\n\ntype UseDropdownListboxHandlersType = () => {\n onKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave?: React.MouseEventHandler;\n};\n\nexport const useDropdownListboxHandlers: UseDropdownListboxHandlersType = () => {\n const {\n props: {\n options,\n onOptionClick,\n openedSubmenus,\n onSubmenuToggle,\n onKeyDown: userOnKeyDown,\n selectedOptions,\n onClickOutside,\n onMouseEnter: userOnMouseEnter,\n onMouseLeave,\n },\n activeDescendant,\n setActiveDescendant,\n scrollOptionIntoView,\n listboxReference,\n inputReference,\n } = useContext(DSDropdownMenuContext);\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n const currentItemIndex = options.findIndex((opt) => opt.dsId === activeDescendant);\n if (currentItemIndex === -1) return;\n\n const option = options[currentItemIndex];\n\n e.stopPropagation();\n\n if (e.code === 'ArrowDown') {\n e.preventDefault();\n const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (e.code === 'ArrowUp') {\n e.preventDefault();\n const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable, -1);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (\n e.code === 'ArrowRight' &&\n ['submenu', 'singleWithSubmenu'].includes(option.type) &&\n !openedSubmenus[option.dsId]\n ) {\n e.preventDefault();\n onSubmenuToggle(manageOpenedSubmenus(options, { ...openedSubmenus, [option.dsId]: true }, option), option, e);\n } else if (['Space', 'Enter'].includes(e.code)) {\n e.preventDefault();\n const nextSelectedOptions = { ...selectedOptions };\n nextSelectedOptions[option.dsId] = !selectedOptions[option.dsId];\n if ((option as DSDropdownMenuT.ItemActionOptions)?.disabled) return; // prevent click when is disabled\n onOptionClick(nextSelectedOptions, option, e);\n if (option.onClick) option.onClick(e);\n } else if (e.code === 'Escape') {\n onClickOutside(e);\n } else if (e.code === 'Home') {\n const nextItemIndex = findInCircularList(options, options.length - 1, isOptionFocuseable);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (e.code === 'End') {\n const nextItemIndex = findInCircularList(options, 0, isOptionFocuseable, -1);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n }\n if (option.onKeyDown) option.onKeyDown(e);\n userOnKeyDown(e);\n },\n [\n options,\n openedSubmenus,\n userOnKeyDown,\n activeDescendant,\n setActiveDescendant,\n scrollOptionIntoView,\n onSubmenuToggle,\n selectedOptions,\n onOptionClick,\n onClickOutside,\n ],\n );\n\n const onMouseEnter: React.MouseEventHandler = useCallback(\n (e: React.MouseEvent) => {\n if (inputReference.current) inputReference.current.focus();\n else listboxReference.current?.focus();\n userOnMouseEnter(e);\n },\n [inputReference, listboxReference, userOnMouseEnter],\n );\n return { onKeyDown, onMouseEnter, onMouseLeave };\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,aAAa,kBAAkB;AACxC,SAAS,6BAA6B;AAEtC,SAAS,oBAAoB,oBAAoB,4BAA4B;AAQtE,MAAM,6BAA6D,MAAM;AAC9E,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,qBAAqB;AAEpC,QAAM,YAAwC;AAAA,IAC5C,CAAC,MAAM;AACL,YAAM,mBAAmB,QAAQ,UAAU,CAAC,QAAQ,IAAI,SAAS,gBAAgB;AACjF,UAAI,qBAAqB,GAAI;AAE7B,YAAM,SAAS,QAAQ,gBAAgB;AAEvC,QAAE,gBAAgB;AAElB,UAAI,EAAE,SAAS,aAAa;AAC1B,UAAE,eAAe;AACjB,cAAM,gBAAgB,mBAAmB,SAAS,kBAAkB,kBAAkB;AACtF,4BAAoB,QAAQ,aAAa,EAAE,IAAI;AAC/C,6BAAqB,QAAQ,aAAa,EAAE,IAAI;AAAA,MAClD,WAAW,EAAE,SAAS,WAAW;AAC/B,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AA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,eAAwC;AAAA,IAC5C,CAAC,MAAwB;AACvB,UAAI,eAAe,QAAS,gBAAe,QAAQ,MAAM;AAAA,UACpD,kBAAiB,SAAS,MAAM;AACrC,uBAAiB,CAAC;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,kBAAkB,gBAAgB;AAAA,EACrD;AACA,SAAO,EAAE,WAAW,cAAc,aAAa;AACjD;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport type { DSDropdownMenuT } from '../react-desc-prop-types.js';\nimport { findInCircularList, isOptionFocuseable, manageOpenedSubmenus } from '../utils/index.js';\n\ntype UseDropdownListboxHandlersType = () => {\n onKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave?: React.MouseEventHandler;\n};\n\nexport const useDropdownListboxHandlers: UseDropdownListboxHandlersType = () => {\n const {\n props: {\n options,\n onOptionClick,\n openedSubmenus,\n onSubmenuToggle,\n onKeyDown: userOnKeyDown,\n selectedOptions,\n onClickOutside,\n onMouseEnter: userOnMouseEnter,\n onMouseLeave,\n },\n activeDescendant,\n setActiveDescendant,\n scrollOptionIntoView,\n listboxReference,\n inputReference,\n } = useContext(DSDropdownMenuContext);\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n const currentItemIndex = options.findIndex((opt) => opt.dsId === activeDescendant);\n if (currentItemIndex === -1) return;\n\n const option = options[currentItemIndex];\n\n e.stopPropagation();\n\n if (e.code === 'ArrowDown') {\n e.preventDefault();\n const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (e.code === 'ArrowUp') {\n e.preventDefault();\n const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable, -1);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (\n e.code === 'ArrowRight' &&\n ['submenu', 'singleWithSubmenu'].includes(option.type) &&\n !openedSubmenus[option.dsId]\n ) {\n e.preventDefault();\n const { type } = option;\n if (type === 'submenu' || type === 'singleWithSubmenu') {\n if (option.applyAriaDisabled) return;\n }\n onSubmenuToggle(manageOpenedSubmenus(options, { ...openedSubmenus, [option.dsId]: true }, option), option, e);\n } else if (['Space', 'Enter'].includes(e.code)) {\n e.preventDefault();\n const { type } = option;\n if (type === 'singleWithSubmenu') {\n if (option.applyAriaDisabled) return;\n }\n const nextSelectedOptions = { ...selectedOptions };\n nextSelectedOptions[option.dsId] = !selectedOptions[option.dsId];\n if ((option as DSDropdownMenuT.ItemActionOptions)?.disabled) return; // prevent click when is disabled\n onOptionClick(nextSelectedOptions, option, e);\n if (option.onClick) option.onClick(e);\n } else if (e.code === 'Escape') {\n onClickOutside(e);\n } else if (e.code === 'Home') {\n const nextItemIndex = findInCircularList(options, options.length - 1, isOptionFocuseable);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n } else if (e.code === 'End') {\n const nextItemIndex = findInCircularList(options, 0, isOptionFocuseable, -1);\n setActiveDescendant(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n }\n if (option.onKeyDown) option.onKeyDown(e);\n userOnKeyDown(e);\n },\n [\n options,\n openedSubmenus,\n userOnKeyDown,\n activeDescendant,\n setActiveDescendant,\n scrollOptionIntoView,\n onSubmenuToggle,\n selectedOptions,\n onOptionClick,\n onClickOutside,\n ],\n );\n\n const onMouseEnter: React.MouseEventHandler = useCallback(\n (e: React.MouseEvent) => {\n if (inputReference.current) inputReference.current.focus();\n else listboxReference.current?.focus();\n userOnMouseEnter(e);\n },\n [inputReference, listboxReference, userOnMouseEnter],\n );\n return { onKeyDown, onMouseEnter, onMouseLeave };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,aAAa,kBAAkB;AACxC,SAAS,6BAA6B;AAEtC,SAAS,oBAAoB,oBAAoB,4BAA4B;AAQtE,MAAM,6BAA6D,MAAM;AAC9E,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,qBAAqB;AAEpC,QAAM,YAAwC;AAAA,IAC5C,CAAC,MAAM;AACL,YAAM,mBAAmB,QAAQ,UAAU,CAAC,QAAQ,IAAI,SAAS,gBAAgB;AACjF,UAAI,qBAAqB,GAAI;AAE7B,YAAM,SAAS,QAAQ,gBAAgB;AAEvC,QAAE,gBAAgB;AAElB,UAAI,EAAE,SAAS,aAAa;AAC1B,UAAE,eAAe;AACjB,cAAM,gBAAgB,mBAAmB,SAAS,kBAAkB,kBAAkB;AACtF,4BAAoB,QAAQ,aAAa,EAAE,IAAI;AAC/C,6BAAqB,QAAQ,aAAa,EAAE,IAAI;AAAA,MAClD,WAAW,EAAE,SAAS,WAAW;AAC/B,UAAE,eAAe;AACjB,cAAM,gBAAgB,mBAAmB,SAAS,kBAAkB,oBAAoB,EAAE;AAC1F,4BAAoB,QAAQ,aAAa,EAAE,IAAI;AAC/C,6BAAqB,QAAQ,aAAa,EAAE,IAAI;AAAA,MAClD,WACE,EAAE,SAAS,gBACX,CAAC,WAAW,mBAAmB,EAAE,SAAS,OAAO,IAAI,KACrD,CAAC,eAAe,OAAO,IAAI,GAC3B;AACA,UAAE,eAAe;AACjB,cAAM,E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A,QAAM,eAAwC;AAAA,IAC5C,CAAC,MAAwB;AACvB,UAAI,eAAe,QAAS,gBAAe,QAAQ,MAAM;AAAA,UACpD,kBAAiB,SAAS,MAAM;AACrC,uBAAiB,CAAC;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,kBAAkB,gBAAgB;AAAA,EACrD;AACA,SAAO,EAAE,WAAW,cAAc,aAAa;AACjD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -28,6 +28,10 @@ const useDropdownMenuItemHandlers = (option) => {
|
|
|
28
28
|
(e) => {
|
|
29
29
|
e.stopPropagation();
|
|
30
30
|
e.preventDefault();
|
|
31
|
+
if (mutableOption?.current?.type === "singleWithSubmenu") {
|
|
32
|
+
const { applyAriaDisabled } = mutableOption.current;
|
|
33
|
+
if (applyAriaDisabled) return;
|
|
34
|
+
}
|
|
31
35
|
const nextSelectedOptions = { ...mutableSelectedOptions.current };
|
|
32
36
|
nextSelectedOptions[mutableOption.current.dsId] = !mutableSelectedOptions.current[mutableOption.current.dsId];
|
|
33
37
|
if (mutableOption?.current?.disabled) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useDropdownMenuItemHandlers.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { useMakeMutable } from './useMakeMutable.js';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { manageOpenedSubmenus } from '../utils/index.js';\nimport type { DSDropdownMenuT } from '../react-desc-prop-types.js';\n\ntype UseDropdownMenuItemHandlersType = (option: DSDropdownMenuT.Item) => {\n onClick: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onSubmenuOpen: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onSubmenuClose: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onDropdownKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n};\n\nexport const useDropdownMenuItemHandlers: UseDropdownMenuItemHandlersType = (option) => {\n const {\n props: {\n options,\n selectedOptions,\n onOptionClick,\n openedSubmenus,\n onSubmenuToggle,\n onMouseEnter,\n onMouseLeave,\n onMouseDown,\n },\n listboxReference,\n inputReference,\n } = useContext(DSDropdownMenuContext);\n\n // it's vital for the opinionated onSubmenuOpen / onSubmenuClose to\n // - have access to the latest information about openedSubmenus\n // - be as \"pure\" as possible to guarantee that usage with the \"bridge\" pattern\n // will be as \"transparent\" as possible (if nested inside async code, redefing the callback may invoke a stale closure)\n // the whole component is kind of messy so I'm going to implement a quick and dirty solution\n // I'm going to make all the arguments for the callbacks \"mutable\",\n // this is sub-optimal on a performance level but will have to do for now\n const mutableOption = useMakeMutable(option);\n const mutableOptions = useMakeMutable(options);\n const mutableOpenedSubmenus = useMakeMutable(openedSubmenus);\n const mutableOnSubmenuToggle = useMakeMutable(onSubmenuToggle);\n const mutableOnOptionClick = useMakeMutable(onOptionClick);\n const mutableSelectedOptions = useMakeMutable(selectedOptions);\n\n // This callback is used on single / multi items to toggle the selection\n const onClick = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n e.stopPropagation();\n e.preventDefault();\n const nextSelectedOptions = { ...mutableSelectedOptions.current };\n nextSelectedOptions[mutableOption.current.dsId] = !mutableSelectedOptions.current[mutableOption.current.dsId];\n if ((mutableOption?.current as DSDropdownMenuT.ItemActionOptions)?.disabled) return; // prevent click when is disabled\n mutableOnOptionClick?.current?.(nextSelectedOptions, mutableOption.current, e);\n // we avoid invoking \"onClick\" twice when the users \"key-down - enter\" on the item by checking if the event is keyboard related\n if (e.type === 'click') mutableOption?.current?.onClick?.(e);\n },\n [mutableOnOptionClick, mutableOption, mutableSelectedOptions],\n );\n\n // This callback is used on submenu items to open it onMouseEnter\n const onSubmenuOpen = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n mutableOnSubmenuToggle?.current?.(\n manageOpenedSubmenus(\n mutableOptions.current,\n { ...(mutableOpenedSubmenus?.current || {}), [mutableOption.current.dsId]: true },\n mutableOption.current,\n ),\n mutableOption.current,\n e,\n );\n },\n [mutableOnSubmenuToggle, mutableOpenedSubmenus, mutableOption, mutableOptions],\n );\n\n // This callback is used on submenu to close it onMouseLeave\n const onSubmenuClose = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n mutableOnSubmenuToggle?.current?.(\n manageOpenedSubmenus(\n mutableOptions.current,\n { ...(mutableOpenedSubmenus?.current || {}), [mutableOption.current.dsId]: false },\n mutableOption.current,\n ),\n mutableOption.current,\n e,\n );\n if (inputReference.current) inputReference.current.focus();\n else listboxReference.current?.focus();\n },\n [inputReference, listboxReference, mutableOnSubmenuToggle, mutableOpenedSubmenus, mutableOption, mutableOptions],\n );\n\n // This callback is used on child dropdown to close the current opened submenu (which spawned it)\n const onDropdownKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (e.code === 'ArrowLeft') {\n onSubmenuClose(e);\n e.preventDefault();\n }\n },\n [onSubmenuClose],\n );\n\n return useMemo(\n () => ({\n onClick,\n onSubmenuOpen,\n onSubmenuClose,\n onDropdownKeyDown,\n onMouseEnter,\n onMouseLeave,\n onMouseDown,\n }),\n [onClick, onSubmenuOpen, onSubmenuClose, onDropdownKeyDown, onMouseEnter, onMouseLeave, onMouseDown],\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,aAAa,YAAY,eAAe;AACjD,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,4BAA4B;AAY9B,MAAM,8BAA+D,CAAC,WAAW;AACtF,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,I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,gBAAe,QAAQ,MAAM;AAAA,UACpD,kBAAiB,SAAS,MAAM;AAAA,IACvC;AAAA,IACA,CAAC,gBAAgB,kBAAkB,wBAAwB,uBAAuB,eAAe,cAAc;AAAA,EACjH;AAGA,QAAM,oBAAgD;AAAA,IACpD,CAAC,MAAM;AACL,UAAI,EAAE,SAAS,aAAa;AAC1B,uBAAe,CAAC;AAChB,UAAE,eAAe;AAAA,MACnB;AAAA,IACF;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,SAAS,eAAe,gBAAgB,mBAAmB,cAAc,cAAc,WAAW;AAAA,EACrG;AACF;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { useMakeMutable } from './useMakeMutable.js';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { manageOpenedSubmenus } from '../utils/index.js';\nimport type { DSDropdownMenuT } from '../react-desc-prop-types.js';\n\ntype UseDropdownMenuItemHandlersType = (option: DSDropdownMenuT.Item) => {\n onClick: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onSubmenuOpen: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onSubmenuClose: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onDropdownKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n};\n\nexport const useDropdownMenuItemHandlers: UseDropdownMenuItemHandlersType = (option) => {\n const {\n props: {\n options,\n selectedOptions,\n onOptionClick,\n openedSubmenus,\n onSubmenuToggle,\n onMouseEnter,\n onMouseLeave,\n onMouseDown,\n },\n listboxReference,\n inputReference,\n } = useContext(DSDropdownMenuContext);\n\n // it's vital for the opinionated onSubmenuOpen / onSubmenuClose to\n // - have access to the latest information about openedSubmenus\n // - be as \"pure\" as possible to guarantee that usage with the \"bridge\" pattern\n // will be as \"transparent\" as possible (if nested inside async code, redefing the callback may invoke a stale closure)\n // the whole component is kind of messy so I'm going to implement a quick and dirty solution\n // I'm going to make all the arguments for the callbacks \"mutable\",\n // this is sub-optimal on a performance level but will have to do for now\n const mutableOption = useMakeMutable(option);\n const mutableOptions = useMakeMutable(options);\n const mutableOpenedSubmenus = useMakeMutable(openedSubmenus);\n const mutableOnSubmenuToggle = useMakeMutable(onSubmenuToggle);\n const mutableOnOptionClick = useMakeMutable(onOptionClick);\n const mutableSelectedOptions = useMakeMutable(selectedOptions);\n\n // This callback is used on single / multi items to toggle the selection\n const onClick = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n e.stopPropagation();\n e.preventDefault();\n if (mutableOption?.current?.type === 'singleWithSubmenu') {\n const { applyAriaDisabled } = mutableOption.current;\n if (applyAriaDisabled) return;\n }\n const nextSelectedOptions = { ...mutableSelectedOptions.current };\n nextSelectedOptions[mutableOption.current.dsId] = !mutableSelectedOptions.current[mutableOption.current.dsId];\n if ((mutableOption?.current as DSDropdownMenuT.ItemActionOptions)?.disabled) return; // prevent click when is disabled\n mutableOnOptionClick?.current?.(nextSelectedOptions, mutableOption.current, e);\n // we avoid invoking \"onClick\" twice when the users \"key-down - enter\" on the item by checking if the event is keyboard related\n if (e.type === 'click') mutableOption?.current?.onClick?.(e);\n },\n [mutableOnOptionClick, mutableOption, mutableSelectedOptions],\n );\n\n // This callback is used on submenu items to open it onMouseEnter\n const onSubmenuOpen = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n mutableOnSubmenuToggle?.current?.(\n manageOpenedSubmenus(\n mutableOptions.current,\n { ...(mutableOpenedSubmenus?.current || {}), [mutableOption.current.dsId]: true },\n mutableOption.current,\n ),\n mutableOption.current,\n e,\n );\n },\n [mutableOnSubmenuToggle, mutableOpenedSubmenus, mutableOption, mutableOptions],\n );\n\n // This callback is used on submenu to close it onMouseLeave\n const onSubmenuClose = useCallback(\n (e: React.MouseEvent | React.KeyboardEvent) => {\n mutableOnSubmenuToggle?.current?.(\n manageOpenedSubmenus(\n mutableOptions.current,\n { ...(mutableOpenedSubmenus?.current || {}), [mutableOption.current.dsId]: false },\n mutableOption.current,\n ),\n mutableOption.current,\n e,\n );\n if (inputReference.current) inputReference.current.focus();\n else listboxReference.current?.focus();\n },\n [inputReference, listboxReference, mutableOnSubmenuToggle, mutableOpenedSubmenus, mutableOption, mutableOptions],\n );\n\n // This callback is used on child dropdown to close the current opened submenu (which spawned it)\n const onDropdownKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (e.code === 'ArrowLeft') {\n onSubmenuClose(e);\n e.preventDefault();\n }\n },\n [onSubmenuClose],\n );\n\n return useMemo(\n () => ({\n onClick,\n onSubmenuOpen,\n onSubmenuClose,\n onDropdownKeyDown,\n onMouseEnter,\n onMouseLeave,\n onMouseDown,\n }),\n [onClick, onSubmenuOpen, onSubmenuClose, onDropdownKeyDown, onMouseEnter, onMouseLeave, onMouseDown],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,aAAa,YAAY,eAAe;AACjD,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,4BAA4B;AAY9B,MAAM,8BAA+D,CAAC,WAAW;AACtF,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,qBAAqB;AASpC,QAAM,gBAAgB,eAAe,MAAM;AAC3C,QAAM,iBAAiB,eAAe,OAAO;AAC7C,QAAM,wBAAwB,eAAe,cAAc;AAC3D,QAAM,yBAAyB,eAAe,eAAe;AAC7D,QAAM,uBAAuB,eAAe,aAAa;AACzD,QAAM,yBAAyB,eAAe,eAA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cAAc;AAAA,EACjH;AAGA,QAAM,oBAAgD;AAAA,IACpD,CAAC,MAAM;AACL,UAAI,EAAE,SAAS,aAAa;AAC1B,uBAAe,CAAC;AAChB,UAAE,eAAe;AAAA,MACnB;AAAA,IACF;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,SAAS,eAAe,gBAAgB,mBAAmB,cAAc,cAAc,WAAW;AAAA,EACrG;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport type React from 'react';\nimport type { useVirtual } from 'react-virtual';\nimport {\n type GlobalAttributesT,\n PropTypes,\n type XstyledProps,\n globalAttributesPropTypes,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\nimport type { SizingProps } from '@elliemae/ds-system';\n\nexport namespace DSDropdownMenuT {\n export type PopperPlacementsT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n\n export interface RequiredProps {\n options: Item[];\n isOpened: boolean;\n }\n\n export interface DefaultProps {\n onClickOutside: (e: MouseEvent | React.KeyboardEvent | TouchEvent) => void;\n onKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n selectedOptions: Record<string, boolean>;\n onOptionClick: (\n nextSelectedOptions: Record<string, boolean>,\n clickedOption: Item,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n openedSubmenus: Record<string, boolean>;\n onSubmenuToggle: (\n nextOpenedSubmenus: Record<string, boolean>,\n submenu: Item,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n isLoading: boolean;\n hasInput: boolean;\n inputValue: string;\n inputPlaceholder: string;\n onInputChange: React.FormEventHandler<HTMLInputElement>;\n startPlacementPreference: PopperPlacementsT;\n placementOrderPreference: PopperPlacementsT[];\n customOffset: [number, number];\n wrapperStyles: Record<string, unknown>;\n actionRef: React.MutableRefObject<Record<string, unknown>>;\n as: keyof JSX.IntrinsicElements;\n children?: React.ReactNode;\n isSkeleton: boolean;\n }\n\n export interface OptionalProps {\n zIndex?: number;\n minWidth?: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n HeaderComp?: React.ComponentType<{ ctx?: DSDropdownMenuT.CTX }>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n\n export interface CTX {\n props: React.PropsWithChildren<InternalProps>;\n triggerReferenceElement: HTMLDivElement | null;\n setTriggerReferenceElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n listboxReference: React.RefObject<HTMLDivElement>;\n inputReference: React.RefObject<HTMLInputElement>;\n activeDescendant: string;\n setActiveDescendant: React.Dispatch<React.SetStateAction<string>>;\n scrollOptionIntoView: (dsId: string) => void;\n virtualListHelpers: ReturnType<typeof useVirtual>;\n DSDropdownMenuV2: React.ComponentType<Props>;\n }\n\n interface CommonItemOptions extends Omit<GlobalAttributesT, 'value'>, XstyledProps {\n dsId: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n render?: React.ComponentType<any>;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => null;\n }\n\n export interface ItemActionOptions extends CommonItemOptions {\n type: 'action';\n label: string;\n value: unknown;\n disabled?: boolean;\n }\n\n export interface ItemSingleOptions extends CommonItemOptions {\n type: 'single';\n label: string;\n value: unknown;\n disabled?: boolean;\n }\n\n export interface ItemSingleWithSubmenuOptions extends CommonItemOptions {\n type: 'singleWithSubmenu';\n label: string;\n value: unknown;\n disabled?: boolean;\n rightAddon?: 'chevron' | 'ellipsis';\n options: Item[];\n }\n\n export interface ItemCheckboxOptions extends CommonItemOptions {\n type: 'checkbox';\n label: string;\n value: unknown;\n disabled?: boolean;\n }\n\n export interface ItemSubmenuOptions extends CommonItemOptions {\n type: 'submenu';\n label: string;\n value: unknown;\n disabled?: boolean;\n rightAddon?: 'chevron' | 'ellipsis';\n options: Item[];\n }\n\n export interface ItemSeparatorOptions extends CommonItemOptions {\n type: 'separator';\n }\n\n export interface ItemSectionOptions extends CommonItemOptions {\n type: 'section';\n label: string;\n }\n\n export interface ItemSkeletonOptions extends CommonItemOptions {\n type: 'skeleton';\n }\n\n export type Item =\n | ItemActionOptions\n | ItemSingleOptions\n | ItemCheckboxOptions\n | ItemSubmenuOptions\n | ItemSingleWithSubmenuOptions\n | ItemSeparatorOptions\n | ItemSectionOptions\n | ItemSkeletonOptions;\n\n export interface ItemDictionary {\n [dsId: string]: {\n original: Item;\n containerRef: React.RefObject<HTMLDivElement>;\n parent: string | null;\n };\n }\n}\n\nexport const actionOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['action']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const singleOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['single']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const checkboxOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['checkbox']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const submenuOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['submenu']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n rightAddon: PropTypes.oneOf(['chevron', 'ellipsis']),\n options: PropTypes.array,\n minWidth: PropTypes.any,\n maxHeight: PropTypes.any,\n render: PropTypes.func,\n});\nexport const singleWithSubmenuOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['singleWithSubmenu']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n rightAddon: PropTypes.oneOf(['chevron', 'ellipsis']),\n options: PropTypes.array,\n minWidth: PropTypes.any,\n maxHeight: PropTypes.any,\n render: PropTypes.func,\n});\nexport const separatorOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['separator']),\n label: PropTypes.string.isRequired,\n render: PropTypes.func,\n});\nexport const sectionOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['section']),\n label: PropTypes.string.isRequired,\n render: PropTypes.func,\n});\n\nexport const optionTypesSchemas = PropTypes.oneOfType([\n actionOptionSchema,\n singleOptionSchema,\n checkboxOptionSchema,\n submenuOptionSchema,\n singleWithSubmenuOptionSchema,\n separatorOptionSchema,\n sectionOptionSchema,\n]);\n\nexport const DSDropdownMenuV2PropTypes = {\n options: PropTypes.arrayOf(optionTypesSchemas).description('The array of option for the menu').omitValidation()\n .isRequired,\n isOpened: PropTypes.bool.description('Whether the dropdown menu is opened or not').isRequired,\n onClickOutside: PropTypes.func\n .description('Callback executed when you click outside the dropdown menu, or press the Esc key')\n .defaultValue(() => null),\n selectedOptions: PropTypes.object\n .description(\n 'Object with the ids of the options as keys, and booleans as keys. Represents the state of the current selection in the dropdown menu',\n )\n .defaultValue({}),\n onOptionClick: PropTypes.func\n .description(\n 'Callback triggered when an item is clicked or pressed. We provide the next selected options, the clicked option and the event, in that order',\n )\n .defaultValue(() => null),\n openedSubmenus: PropTypes.object\n .description(\n 'Object with the ids of the submenus as keys, and booleans as keys. Represents the state of the current opened submenus',\n )\n .defaultValue({}),\n onSubmenuToggle: PropTypes.func\n .description(\n 'Callback triggered when a submenu is opened or closed. We provide the next opened submenus, the clicked one and the event, in that order',\n )\n .defaultValue(() => null),\n startPlacementPreference: PropTypes.string\n .description('Where to place the popper for the dropdown menu')\n .defaultValue('bottom-start'),\n placementOrderPreference: PropTypes.arrayOf(PropTypes.string)\n .description('Placement priorities for the dropdown menu')\n .defaultValue(['bottom-start', 'top-start', 'right-start', 'right-end', 'left-start', 'left-end']),\n customOffset: PropTypes.arrayOf(PropTypes.number)\n .description('Custom offset for the dropdown menu')\n .defaultValue([0, 4]),\n wrapperStyles: PropTypes.object.description('Styling for the dropdown menu wrapper').defaultValue({}),\n isLoading: PropTypes.bool\n .description('Whether the dropdown menu should render the loading indicator')\n .defaultValue(false),\n zIndex: PropTypes.number.description('ZIndex for the popper').defaultValue(10),\n HeaderComp: PropTypes.func\n .description('Component to render as a header for the dropdown menu')\n .defaultValue(undefined),\n actionRef: PropTypes.object.description('Reference where all the exposed action callbacks will be exposed'),\n minWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),\n maxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),\n ...globalAttributesPropTypes,\n onKeyDown: PropTypes.func.description('Callback executed when a key is pressed').defaultValue(() => null),\n onMouseEnter: PropTypes.func\n .description('Callback executed when the mouse enter the dropdown menu')\n .defaultValue(() => null),\n onMouseLeave: PropTypes.func\n .description('Callback executed when the mouse leaves the dropdown menu')\n .defaultValue(() => null),\n isSkeleton: PropTypes.bool.description('Whether the dropdown menu should render the skeleton').defaultValue(false),\n} as ValidationMap<unknown>;\n\nexport const defaultProps: DSDropdownMenuT.DefaultProps = {\n onClickOutside: () => null,\n onKeyDown: () => null,\n onMouseEnter: () => null,\n onMouseLeave: () => null,\n selectedOptions: {},\n onOptionClick: () => null,\n openedSubmenus: {},\n onSubmenuToggle: () => null,\n isLoading: false,\n hasInput: false,\n inputValue: '',\n inputPlaceholder: 'Hint text',\n onInputChange: () => null,\n startPlacementPreference: 'bottom-start',\n placementOrderPreference: ['bottom-start', 'top-start', 'right-start', 'right-end', 'left-start', 'left-end'],\n customOffset: [0, 4],\n wrapperStyles: {},\n actionRef: { current: {} },\n as: 'div',\n isSkeleton: false,\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACGvB;AAAA,EAEE;AAAA,EAEA;AAAA,OAEK;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport type React from 'react';\nimport type { useVirtual } from 'react-virtual';\nimport {\n type GlobalAttributesT,\n PropTypes,\n type XstyledProps,\n globalAttributesPropTypes,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\nimport type { SizingProps } from '@elliemae/ds-system';\n\nexport namespace DSDropdownMenuT {\n export type PopperPlacementsT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n\n export interface RequiredProps {\n options: Item[];\n isOpened: boolean;\n }\n\n export interface DefaultProps {\n onClickOutside: (e: MouseEvent | React.KeyboardEvent | TouchEvent) => void;\n onKeyDown: React.KeyboardEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n selectedOptions: Record<string, boolean>;\n onOptionClick: (\n nextSelectedOptions: Record<string, boolean>,\n clickedOption: Item,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n openedSubmenus: Record<string, boolean>;\n onSubmenuToggle: (\n nextOpenedSubmenus: Record<string, boolean>,\n submenu: Item,\n e: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n isLoading: boolean;\n hasInput: boolean;\n inputValue: string;\n inputPlaceholder: string;\n onInputChange: React.FormEventHandler<HTMLInputElement>;\n startPlacementPreference: PopperPlacementsT;\n placementOrderPreference: PopperPlacementsT[];\n customOffset: [number, number];\n wrapperStyles: Record<string, unknown>;\n actionRef: React.MutableRefObject<Record<string, unknown>>;\n as: keyof JSX.IntrinsicElements;\n children?: React.ReactNode;\n isSkeleton: boolean;\n }\n\n export interface OptionalProps {\n zIndex?: number;\n minWidth?: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n HeaderComp?: React.ComponentType<{ ctx?: DSDropdownMenuT.CTX }>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n Omit<XstyledProps, 'zIndex'>,\n RequiredProps {}\n\n export interface CTX {\n props: React.PropsWithChildren<InternalProps>;\n triggerReferenceElement: HTMLDivElement | null;\n setTriggerReferenceElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>;\n listboxReference: React.RefObject<HTMLDivElement>;\n inputReference: React.RefObject<HTMLInputElement>;\n activeDescendant: string;\n setActiveDescendant: React.Dispatch<React.SetStateAction<string>>;\n scrollOptionIntoView: (dsId: string) => void;\n virtualListHelpers: ReturnType<typeof useVirtual>;\n DSDropdownMenuV2: React.ComponentType<Props>;\n }\n\n interface CommonItemOptions extends Omit<GlobalAttributesT, 'value'>, XstyledProps {\n dsId: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n render?: React.ComponentType<any>;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => null;\n }\n\n export interface ItemActionOptions extends CommonItemOptions {\n type: 'action';\n label: string;\n value: unknown;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n }\n\n export interface ItemSingleOptions extends CommonItemOptions {\n type: 'single';\n label: string;\n value: unknown;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n }\n\n export interface ItemSingleWithSubmenuOptions extends CommonItemOptions {\n type: 'singleWithSubmenu';\n label: string;\n value: unknown;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n rightAddon?: 'chevron' | 'ellipsis';\n options: Item[];\n }\n\n export interface ItemCheckboxOptions extends CommonItemOptions {\n type: 'checkbox';\n label: string;\n value: unknown;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n }\n\n export interface ItemSubmenuOptions extends CommonItemOptions {\n type: 'submenu';\n label: string;\n value: unknown;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n rightAddon?: 'chevron' | 'ellipsis';\n options: Item[];\n }\n\n export interface ItemSeparatorOptions extends CommonItemOptions {\n type: 'separator';\n }\n\n export interface ItemSectionOptions extends CommonItemOptions {\n type: 'section';\n label: string;\n }\n\n export interface ItemSkeletonOptions extends CommonItemOptions {\n type: 'skeleton';\n }\n\n export type Item =\n | ItemActionOptions\n | ItemSingleOptions\n | ItemCheckboxOptions\n | ItemSubmenuOptions\n | ItemSingleWithSubmenuOptions\n | ItemSeparatorOptions\n | ItemSectionOptions\n | ItemSkeletonOptions;\n\n export interface ItemDictionary {\n [dsId: string]: {\n original: Item;\n containerRef: React.RefObject<HTMLDivElement>;\n parent: string | null;\n };\n }\n}\n\nexport const actionOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['action']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const singleOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['single']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const checkboxOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['checkbox']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n render: PropTypes.func,\n});\nexport const submenuOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['submenu']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n rightAddon: PropTypes.oneOf(['chevron', 'ellipsis']),\n options: PropTypes.array,\n minWidth: PropTypes.any,\n maxHeight: PropTypes.any,\n render: PropTypes.func,\n});\nexport const singleWithSubmenuOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['singleWithSubmenu']),\n label: PropTypes.string.isRequired,\n secondaryLabel: PropTypes.string,\n value: PropTypes.any.isRequired,\n disabled: PropTypes.bool,\n rightAddon: PropTypes.oneOf(['chevron', 'ellipsis']),\n options: PropTypes.array,\n minWidth: PropTypes.any,\n maxHeight: PropTypes.any,\n render: PropTypes.func,\n});\nexport const separatorOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['separator']),\n label: PropTypes.string.isRequired,\n render: PropTypes.func,\n});\nexport const sectionOptionSchema = PropTypes.shape({\n dsId: PropTypes.string.isRequired,\n type: PropTypes.oneOf(['section']),\n label: PropTypes.string.isRequired,\n render: PropTypes.func,\n});\n\nexport const optionTypesSchemas = PropTypes.oneOfType([\n actionOptionSchema,\n singleOptionSchema,\n checkboxOptionSchema,\n submenuOptionSchema,\n singleWithSubmenuOptionSchema,\n separatorOptionSchema,\n sectionOptionSchema,\n]);\n\nexport const DSDropdownMenuV2PropTypes = {\n options: PropTypes.arrayOf(optionTypesSchemas).description('The array of option for the menu').omitValidation()\n .isRequired,\n isOpened: PropTypes.bool.description('Whether the dropdown menu is opened or not').isRequired,\n onClickOutside: PropTypes.func\n .description('Callback executed when you click outside the dropdown menu, or press the Esc key')\n .defaultValue(() => null),\n selectedOptions: PropTypes.object\n .description(\n 'Object with the ids of the options as keys, and booleans as keys. Represents the state of the current selection in the dropdown menu',\n )\n .defaultValue({}),\n onOptionClick: PropTypes.func\n .description(\n 'Callback triggered when an item is clicked or pressed. We provide the next selected options, the clicked option and the event, in that order',\n )\n .defaultValue(() => null),\n openedSubmenus: PropTypes.object\n .description(\n 'Object with the ids of the submenus as keys, and booleans as keys. Represents the state of the current opened submenus',\n )\n .defaultValue({}),\n onSubmenuToggle: PropTypes.func\n .description(\n 'Callback triggered when a submenu is opened or closed. We provide the next opened submenus, the clicked one and the event, in that order',\n )\n .defaultValue(() => null),\n startPlacementPreference: PropTypes.string\n .description('Where to place the popper for the dropdown menu')\n .defaultValue('bottom-start'),\n placementOrderPreference: PropTypes.arrayOf(PropTypes.string)\n .description('Placement priorities for the dropdown menu')\n .defaultValue(['bottom-start', 'top-start', 'right-start', 'right-end', 'left-start', 'left-end']),\n customOffset: PropTypes.arrayOf(PropTypes.number)\n .description('Custom offset for the dropdown menu')\n .defaultValue([0, 4]),\n wrapperStyles: PropTypes.object.description('Styling for the dropdown menu wrapper').defaultValue({}),\n isLoading: PropTypes.bool\n .description('Whether the dropdown menu should render the loading indicator')\n .defaultValue(false),\n zIndex: PropTypes.number.description('ZIndex for the popper').defaultValue(10),\n HeaderComp: PropTypes.func\n .description('Component to render as a header for the dropdown menu')\n .defaultValue(undefined),\n actionRef: PropTypes.object.description('Reference where all the exposed action callbacks will be exposed'),\n minWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),\n maxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),\n ...globalAttributesPropTypes,\n onKeyDown: PropTypes.func.description('Callback executed when a key is pressed').defaultValue(() => null),\n onMouseEnter: PropTypes.func\n .description('Callback executed when the mouse enter the dropdown menu')\n .defaultValue(() => null),\n onMouseLeave: PropTypes.func\n .description('Callback executed when the mouse leaves the dropdown menu')\n .defaultValue(() => null),\n isSkeleton: PropTypes.bool.description('Whether the dropdown menu should render the skeleton').defaultValue(false),\n} as ValidationMap<unknown>;\n\nexport const defaultProps: DSDropdownMenuT.DefaultProps = {\n onClickOutside: () => null,\n onKeyDown: () => null,\n onMouseEnter: () => null,\n onMouseLeave: () => null,\n selectedOptions: {},\n onOptionClick: () => null,\n openedSubmenus: {},\n onSubmenuToggle: () => null,\n isLoading: false,\n hasInput: false,\n inputValue: '',\n inputPlaceholder: 'Hint text',\n onInputChange: () => null,\n startPlacementPreference: 'bottom-start',\n placementOrderPreference: ['bottom-start', 'top-start', 'right-start', 'right-end', 'left-start', 'left-end'],\n customOffset: [0, 4],\n wrapperStyles: {},\n actionRef: { current: {} },\n as: 'div',\n isSkeleton: false,\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB;AAAA,EAEE;AAAA,EAEA;AAAA,OAEK;AA6KA,MAAM,qBAAqB,UAAU,MAAM;AAAA,EAChD,MAAM,UAAU,OAAO;AAAA,EACvB,MAAM,UAAU,MAAM,CAAC,QAAQ,CAAC;AAAA,EAChC,OAAO,UAAU,OAAO;AAAA,EACxB,gBAAgB,UAAU;AAAA,EAC1B,UAAU,UAAU;AAAA,EACpB,QAAQ,UAAU;AACpB,CAAC;AACM,MAAM,qBAAqB,UAAU,MAAM;AAAA,EAChD,MAAM,UAAU,OAAO;AAAA,EAC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,EACnB,eAAe,CAAC;AAAA,EAChB,WAAW,EAAE,SAAS,CAAC,EAAE;AAAA,EACzB,IAAI;AAAA,EACJ,YAAY;AACd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -66,18 +66,21 @@ export declare namespace DSDropdownMenuT {
|
|
|
66
66
|
label: string;
|
|
67
67
|
value: unknown;
|
|
68
68
|
disabled?: boolean;
|
|
69
|
+
applyAriaDisabled?: boolean;
|
|
69
70
|
}
|
|
70
71
|
export interface ItemSingleOptions extends CommonItemOptions {
|
|
71
72
|
type: 'single';
|
|
72
73
|
label: string;
|
|
73
74
|
value: unknown;
|
|
74
75
|
disabled?: boolean;
|
|
76
|
+
applyAriaDisabled?: boolean;
|
|
75
77
|
}
|
|
76
78
|
export interface ItemSingleWithSubmenuOptions extends CommonItemOptions {
|
|
77
79
|
type: 'singleWithSubmenu';
|
|
78
80
|
label: string;
|
|
79
81
|
value: unknown;
|
|
80
82
|
disabled?: boolean;
|
|
83
|
+
applyAriaDisabled?: boolean;
|
|
81
84
|
rightAddon?: 'chevron' | 'ellipsis';
|
|
82
85
|
options: Item[];
|
|
83
86
|
}
|
|
@@ -86,12 +89,14 @@ export declare namespace DSDropdownMenuT {
|
|
|
86
89
|
label: string;
|
|
87
90
|
value: unknown;
|
|
88
91
|
disabled?: boolean;
|
|
92
|
+
applyAriaDisabled?: boolean;
|
|
89
93
|
}
|
|
90
94
|
export interface ItemSubmenuOptions extends CommonItemOptions {
|
|
91
95
|
type: 'submenu';
|
|
92
96
|
label: string;
|
|
93
97
|
value: unknown;
|
|
94
98
|
disabled?: boolean;
|
|
99
|
+
applyAriaDisabled?: boolean;
|
|
95
100
|
rightAddon?: 'chevron' | 'ellipsis';
|
|
96
101
|
options: Item[];
|
|
97
102
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-dropdownmenu-v2",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.41.0-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Dropdown Menu V2",
|
|
6
6
|
"files": [
|
|
@@ -38,18 +38,18 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@xstyled/system": "~3.7.3",
|
|
40
40
|
"react-virtual": "~2.10.4",
|
|
41
|
-
"@elliemae/ds-circular-progress-indicator": "3.
|
|
42
|
-
"@elliemae/ds-form-input-text": "3.
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-menu-items": "3.
|
|
45
|
-
"@elliemae/ds-
|
|
46
|
-
"@elliemae/ds-
|
|
47
|
-
"@elliemae/ds-
|
|
41
|
+
"@elliemae/ds-circular-progress-indicator": "3.41.0-rc.1",
|
|
42
|
+
"@elliemae/ds-form-input-text": "3.41.0-rc.1",
|
|
43
|
+
"@elliemae/ds-popperjs": "3.41.0-rc.1",
|
|
44
|
+
"@elliemae/ds-menu-items": "3.41.0-rc.1",
|
|
45
|
+
"@elliemae/ds-props-helpers": "3.41.0-rc.1",
|
|
46
|
+
"@elliemae/ds-system": "3.41.0-rc.1",
|
|
47
|
+
"@elliemae/ds-grid": "3.41.0-rc.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@elliemae/pui-cli": "9.0.0-next.50",
|
|
51
51
|
"styled-components": "~5.3.9",
|
|
52
|
-
"@elliemae/ds-monorepo-devops": "3.
|
|
52
|
+
"@elliemae/ds-monorepo-devops": "3.41.0-rc.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@xstyled/styled-components": "~3.6.0",
|