@elliemae/ds-form-combobox 3.51.0-next.1 → 3.51.0-next.11
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/ComboBoxCTX.js +4 -6
- package/dist/cjs/ComboBoxCTX.js.map +2 -2
- package/dist/cjs/ComboboxDataTestids.js +0 -4
- package/dist/cjs/ComboboxDataTestids.js.map +2 -2
- package/dist/cjs/{parts/header-list/index.js → config/useClickOutside.js} +22 -6
- package/dist/cjs/config/useClickOutside.js.map +7 -0
- package/dist/cjs/config/useComboBox.js +29 -42
- package/dist/cjs/config/useComboBox.js.map +2 -2
- package/dist/cjs/config/useCorrectOptions.js +3 -6
- package/dist/cjs/config/useCorrectOptions.js.map +2 -2
- package/dist/cjs/config/useOptionsPerSection.js +56 -0
- package/dist/cjs/config/useOptionsPerSection.js.map +7 -0
- package/dist/cjs/parts/Section.js +92 -0
- package/dist/cjs/parts/Section.js.map +7 -0
- package/dist/cjs/parts/container/Container.js +29 -14
- package/dist/cjs/parts/container/Container.js.map +2 -2
- package/dist/cjs/parts/controls/Controls.js +6 -4
- package/dist/cjs/parts/controls/Controls.js.map +2 -2
- package/dist/cjs/parts/controls/styled.js +21 -5
- package/dist/cjs/parts/controls/styled.js.map +2 -2
- package/dist/cjs/parts/controls/useOnPillsNavigation.js +3 -3
- package/dist/cjs/parts/controls/useOnPillsNavigation.js.map +2 -2
- package/dist/cjs/parts/controls-input/ControlsInput.js +21 -6
- package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/cjs/parts/controls-input/styled.js +3 -1
- package/dist/cjs/parts/controls-input/styled.js.map +2 -2
- package/dist/cjs/parts/controls-input/useKeyboardNavigation.js +15 -18
- package/dist/cjs/parts/controls-input/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/parts/controls-input/useMaskedOnChange.js +4 -5
- package/dist/cjs/parts/controls-input/useMaskedOnChange.js.map +2 -2
- package/dist/cjs/parts/menu-list/MenuList.js +20 -35
- package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
- package/dist/cjs/parts/menu-list/styled.js.map +2 -2
- package/dist/cjs/parts/menu-list/useItemRenderer.js +59 -40
- package/dist/cjs/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js +10 -2
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +3 -1
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/sharedTypes.js.map +2 -2
- package/dist/cjs/utils/listHelper.js +7 -23
- package/dist/cjs/utils/listHelper.js.map +2 -2
- package/dist/esm/ComboBoxCTX.js +4 -6
- package/dist/esm/ComboBoxCTX.js.map +2 -2
- package/dist/esm/ComboboxDataTestids.js +0 -4
- package/dist/esm/ComboboxDataTestids.js.map +2 -2
- package/dist/esm/config/useClickOutside.js +22 -0
- package/dist/esm/config/useClickOutside.js.map +7 -0
- package/dist/esm/config/useComboBox.js +30 -43
- package/dist/esm/config/useComboBox.js.map +2 -2
- package/dist/esm/config/useCorrectOptions.js +4 -7
- package/dist/esm/config/useCorrectOptions.js.map +2 -2
- package/dist/esm/config/useOptionsPerSection.js +26 -0
- package/dist/esm/config/useOptionsPerSection.js.map +7 -0
- package/dist/esm/parts/Section.js +62 -0
- package/dist/esm/parts/Section.js.map +7 -0
- package/dist/esm/parts/container/Container.js +30 -15
- package/dist/esm/parts/container/Container.js.map +2 -2
- package/dist/esm/parts/controls/Controls.js +6 -4
- package/dist/esm/parts/controls/Controls.js.map +2 -2
- package/dist/esm/parts/controls/styled.js +21 -5
- package/dist/esm/parts/controls/styled.js.map +2 -2
- package/dist/esm/parts/controls/useOnPillsNavigation.js +3 -3
- package/dist/esm/parts/controls/useOnPillsNavigation.js.map +2 -2
- package/dist/esm/parts/controls-input/ControlsInput.js +21 -6
- package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/esm/parts/controls-input/styled.js +3 -1
- package/dist/esm/parts/controls-input/styled.js.map +2 -2
- package/dist/esm/parts/controls-input/useKeyboardNavigation.js +15 -18
- package/dist/esm/parts/controls-input/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/parts/controls-input/useMaskedOnChange.js +4 -5
- package/dist/esm/parts/controls-input/useMaskedOnChange.js.map +2 -2
- package/dist/esm/parts/menu-list/MenuList.js +21 -36
- package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
- package/dist/esm/parts/menu-list/styled.js.map +2 -2
- package/dist/esm/parts/menu-list/useItemRenderer.js +61 -42
- package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js +10 -2
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +3 -1
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/sharedTypes.js.map +2 -2
- package/dist/esm/utils/listHelper.js +7 -23
- package/dist/esm/utils/listHelper.js.map +2 -2
- package/dist/types/ComboboxDataTestids.d.ts +0 -4
- package/dist/types/config/useClickOutside.d.ts +1 -0
- package/dist/types/config/useCorrectOptions.d.ts +1 -1
- package/dist/types/config/useOptionsPerSection.d.ts +2 -0
- package/dist/types/parts/Section.d.ts +14 -0
- package/dist/types/parts/controls/styled.d.ts +2 -0
- package/dist/types/parts/controls-input/styled.d.ts +3 -1
- package/dist/types/parts/menu-list/styled.d.ts +0 -1
- package/dist/types/react-desc-prop-types.d.ts +4 -1
- package/dist/types/sharedTypes.d.ts +1 -4
- package/dist/types/tests/read-only.test.d.ts +1 -0
- package/dist/types/utils/listHelper.d.ts +0 -1
- package/package.json +17 -17
- package/dist/cjs/parts/header-list/HeaderList.js +0 -104
- package/dist/cjs/parts/header-list/HeaderList.js.map +0 -7
- package/dist/cjs/parts/header-list/index.js.map +0 -7
- package/dist/cjs/parts/header-list/styled.js +0 -85
- package/dist/cjs/parts/header-list/styled.js.map +0 -7
- package/dist/cjs/parts/header-list/useHeaderListHandlers.js +0 -140
- package/dist/cjs/parts/header-list/useHeaderListHandlers.js.map +0 -7
- package/dist/esm/parts/header-list/HeaderList.js +0 -80
- package/dist/esm/parts/header-list/HeaderList.js.map +0 -7
- package/dist/esm/parts/header-list/index.js +0 -6
- package/dist/esm/parts/header-list/index.js.map +0 -7
- package/dist/esm/parts/header-list/styled.js +0 -55
- package/dist/esm/parts/header-list/styled.js.map +0 -7
- package/dist/esm/parts/header-list/useHeaderListHandlers.js +0 -110
- package/dist/esm/parts/header-list/useHeaderListHandlers.js.map +0 -7
- package/dist/types/parts/header-list/HeaderList.d.ts +0 -2
- package/dist/types/parts/header-list/index.d.ts +0 -1
- package/dist/types/parts/header-list/styled.d.ts +0 -6
- package/dist/types/parts/header-list/useHeaderListHandlers.d.ts +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/controls-input/useKeyboardNavigation.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-depth */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useCallback, useContext } from 'react';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport {\n findInCircularList,\n getOptions,\n getSuggestedValueOnChange,\n getLastValueSelected,\n} from '../../utils/listHelper.js';\nimport { INTERNAL_MENU_OPTION_TYPES, MENU_OPTION_TYPES, MENU_CONTROL_REASONS } from '../../constants.js';\nconst isOptionFocuseable = (opt: DSComboboxT.OptionTypes): boolean
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAwC;AAExC,yBAAgC;AAChC,wBAKO;AACP,uBAAoF;AACpF,MAAM,qBAAqB,CAAC,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-depth */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useCallback, useContext } from 'react';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport {\n findInCircularList,\n getOptions,\n getSuggestedValueOnChange,\n getLastValueSelected,\n} from '../../utils/listHelper.js';\nimport { INTERNAL_MENU_OPTION_TYPES, MENU_OPTION_TYPES, MENU_CONTROL_REASONS } from '../../constants.js';\nconst isOptionFocuseable = (opt: DSComboboxT.OptionTypes): boolean => !['section', 'separator'].includes(opt.type);\n\nconst optionHasFirstLetter = (opt: DSComboboxT.OptionTypes, letter: string): boolean =>\n opt.label !== undefined && opt.label.toLowerCase().startsWith(letter.toLowerCase());\nexport const useKeyboardNavigation = () => {\n const {\n props: {\n allOptions,\n isNonClearable,\n onCancel,\n onKeyDown,\n onChange,\n onCreate,\n onFilter,\n onSelectAll,\n inline,\n selectedValues,\n withoutPortal,\n onlySelectable,\n applyAriaDisabled,\n readOnly,\n },\n inputValue,\n correctOptions: filteredOptions,\n menuState,\n focusOptionIdx,\n listRef,\n setMenuState,\n setInputValue,\n scrollOptionIntoView,\n setFocusOptionIdx,\n } = useContext(ComboBoxContext);\n\n const multiple = Array.isArray(selectedValues);\n const selectableOptions = getOptions(filteredOptions);\n const currentItemIndex = filteredOptions.findIndex((opt) => opt.dsId === focusOptionIdx);\n const currentItem = filteredOptions.find((item) => item.dsId === focusOptionIdx);\n\n const onInputKeyDown: React.KeyboardEventHandler<HTMLInputElement> = useCallback(\n (e) => {\n if (applyAriaDisabled || readOnly) return;\n\n // =============================================================================\n // CUSTOM KEYS\n // =============================================================================\n if (onKeyDown && currentItem?.type === MENU_OPTION_TYPES.OPTION) onKeyDown(e, currentItem);\n\n if (\n (['ArrowDown', 'ArrowUp', 'Enter', 'Spacebar'].includes(e.key) || /^[a-zA-Z0-9]$/.test(e.key)) &&\n !menuState\n ) {\n setMenuState(true, MENU_CONTROL_REASONS.OPEN, e);\n }\n // =============================================================================\n // ESCAPE\n // =============================================================================\n if (e.key === 'Escape') {\n if (onCancel) onCancel();\n if (inputValue) {\n if (onFilter) onFilter(allOptions, inputValue);\n setInputValue('');\n }\n if (!inline) setMenuState(false, MENU_CONTROL_REASONS.CLOSE, e);\n }\n // =============================================================================\n // ENTER KEY TO CREATE ELEMENTS\n // =============================================================================\n if (e.key === 'Enter' && currentItem?.type === INTERNAL_MENU_OPTION_TYPES.CREATABLE && onCreate) {\n onCreate(inputValue);\n // blank active item to force search last one\n setFocusOptionIdx('');\n if (onFilter) onFilter(allOptions, '');\n setInputValue('');\n return;\n }\n\n // =============================================================================\n // Enter, space and Tab on selection\n // =============================================================================\n if (e.key === 'Enter' || (e.key === ' ' && e.altKey) || (e.key === 'Tab' && !multiple && !inline)) {\n if (readOnly || currentItem?.applyAriaDisabled) return;\n\n if (e.key !== 'Tab') e.preventDefault();\n e.stopPropagation();\n\n if (\n focusOptionIdx !== '' &&\n (menuState || inline) &&\n currentItem?.type === MENU_OPTION_TYPES.OPTION &&\n !currentItem.disabled\n ) {\n if (onFilter) onFilter(allOptions, '');\n setInputValue('');\n if (!multiple) {\n setMenuState(false, MENU_CONTROL_REASONS.SELECT_OPTION, e);\n }\n onChange(getSuggestedValueOnChange(currentItem, selectedValues, isNonClearable), currentItem, e);\n }\n }\n\n if (e.key === 'Enter' && e.altKey) {\n setMenuState(false, 'selectOption', e);\n }\n\n if (e.key === 'a' && e.ctrlKey && multiple && onSelectAll) {\n onSelectAll(\n filteredOptions.filter((option) => option.type === 'option' && !option.disabled),\n e,\n );\n }\n // =============================================================================\n // ARROWS UP AND DOWN: LOGIC TO CALCULATE NEXT OR PREV ITEM TO PSEUDOFOCUS FROM INPUT\n // =============================================================================\n\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n e.stopPropagation();\n if ((menuState || inline) && (selectableOptions.length || onCreate)) {\n const nextItemIndexIndex = findInCircularList(filteredOptions, currentItemIndex, isOptionFocuseable);\n if (nextItemIndexIndex > -1) {\n setFocusOptionIdx(filteredOptions[nextItemIndexIndex].dsId);\n scrollOptionIntoView(filteredOptions[nextItemIndexIndex].dsId);\n }\n }\n }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n e.stopPropagation();\n if (!selectableOptions.length && !onCreate) return;\n const prevItemIndex = findInCircularList(\n filteredOptions,\n currentItemIndex === -1 ? 0 : currentItemIndex,\n isOptionFocuseable,\n -1,\n );\n if (prevItemIndex > -1) {\n if (menuState || inline) {\n setFocusOptionIdx(filteredOptions[prevItemIndex].dsId);\n scrollOptionIntoView(filteredOptions[prevItemIndex].dsId);\n } else {\n // open menu and search last item to focused\n setMenuState(true, MENU_CONTROL_REASONS.OPEN, e);\n const lastItemIndex = findInCircularList(filteredOptions, 0, isOptionFocuseable, -1);\n setFocusOptionIdx(filteredOptions[lastItemIndex].dsId);\n setTimeout(() => {\n scrollOptionIntoView(filteredOptions[lastItemIndex].dsId);\n });\n }\n }\n }\n\n // =============================================================================\n // BACKSPACE\n // =============================================================================\n if (e.key === 'Backspace' && e.currentTarget.value.length <= 0 && !inline) {\n if (readOnly) return;\n const lastValue = getLastValueSelected(selectedValues);\n if (!e.currentTarget.value && lastValue && !isNonClearable && !lastValue.applyAriaDisabled) {\n onChange(getSuggestedValueOnChange(lastValue, selectedValues), lastValue, e);\n }\n }\n\n if (e.key === 'Tab' && !inline && menuState) {\n setMenuState(false, MENU_CONTROL_REASONS.BLUR, e);\n }\n\n // =============================================================================\n // ONLYSELECTABLE LETTER/NUMBER KEYS TO FOCUS OPTIONS\n // =============================================================================\n\n if (onlySelectable && /^[a-zA-Z\\d]$/.test(e.key)) {\n if (!menuState) {\n setMenuState(true, MENU_CONTROL_REASONS.OPEN, e);\n }\n\n const isOptionFocusableByLetter = (opt: DSComboboxT.OptionTypes): boolean =>\n isOptionFocuseable(opt) && optionHasFirstLetter(opt, e.key);\n\n const nextItemIndexIndex = findInCircularList(filteredOptions, currentItemIndex, isOptionFocusableByLetter);\n const nextItem = filteredOptions[nextItemIndexIndex];\n if (!nextItem) return;\n setFocusOptionIdx(filteredOptions[nextItemIndexIndex].dsId);\n scrollOptionIntoView(filteredOptions[nextItemIndexIndex].dsId);\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n onKeyDown,\n currentItem,\n onCreate,\n multiple,\n inputValue,\n inline,\n withoutPortal,\n setMenuState,\n onCancel,\n onFilter,\n setInputValue,\n listRef,\n focusOptionIdx,\n menuState,\n selectableOptions.length,\n filteredOptions,\n currentItemIndex,\n setFocusOptionIdx,\n selectedValues,\n onChange,\n isNonClearable,\n ],\n );\n\n return { onInputKeyDown };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAwC;AAExC,yBAAgC;AAChC,wBAKO;AACP,uBAAoF;AACpF,MAAM,qBAAqB,CAAC,QAA0C,CAAC,CAAC,WAAW,WAAW,EAAE,SAAS,IAAI,IAAI;AAEjH,MAAM,uBAAuB,CAAC,KAA8B,WAC1D,IAAI,UAAU,UAAa,IAAI,MAAM,YAAY,EAAE,WAAW,OAAO,YAAY,CAAC;AAC7E,MAAM,wBAAwB,MAAM;AACzC,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kCAAe;AAE9B,QAAM,WAAW,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
|
"names": []
|
|
7
7
|
}
|
|
@@ -40,28 +40,27 @@ const useMaskedOnChange = () => {
|
|
|
40
40
|
props: { useMask, onFilter, allOptions, applyAriaDisabled },
|
|
41
41
|
setMenuState,
|
|
42
42
|
setInputValue,
|
|
43
|
-
|
|
43
|
+
setFocusOptionIdx
|
|
44
44
|
} = (0, import_react.useContext)(import_ComboBoxCTX.default);
|
|
45
45
|
const handleOnChange = (0, import_react.useCallback)(
|
|
46
46
|
(e) => {
|
|
47
47
|
if (applyAriaDisabled) return;
|
|
48
|
-
setShowSelectedOptions(false);
|
|
49
48
|
setMenuState(true, "filter", e);
|
|
50
49
|
if (onFilter) {
|
|
51
50
|
onFilter((0, import_listHelper.filterOptions)(e.currentTarget.value, allOptions), e.currentTarget.value);
|
|
52
51
|
}
|
|
52
|
+
setFocusOptionIdx("");
|
|
53
53
|
setInputValue(e.currentTarget.value);
|
|
54
54
|
},
|
|
55
|
-
[
|
|
55
|
+
[applyAriaDisabled, setMenuState, onFilter, setFocusOptionIdx, setInputValue, allOptions]
|
|
56
56
|
);
|
|
57
57
|
const handleOnChangeMask = (0, import_react.useCallback)(
|
|
58
58
|
(e, mask) => {
|
|
59
|
-
setShowSelectedOptions(false);
|
|
60
59
|
setMenuState(true, "filter", e);
|
|
61
60
|
if (mask && onFilter) onFilter((0, import_listHelper.filterOptions)(mask, allOptions), mask);
|
|
62
61
|
else if (!mask && onFilter) onFilter(allOptions, "");
|
|
63
62
|
},
|
|
64
|
-
[allOptions, onFilter, setMenuState
|
|
63
|
+
[allOptions, onFilter, setMenuState]
|
|
65
64
|
);
|
|
66
65
|
const onChangeMask = useMask({ valueSetter: setInputValue, onChange: handleOnChangeMask });
|
|
67
66
|
return onChangeMask?.onChange || handleOnChange;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/controls-input/useMaskedOnChange.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useContext, useCallback } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { filterOptions } from '../../utils/listHelper.js';\n\nconst useMaskedOnChange = () => {\n const {\n props: { useMask, onFilter, allOptions, applyAriaDisabled },\n setMenuState,\n setInputValue,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwC;AACxC,yBAA4B;AAC5B,wBAA8B;AAE9B,MAAM,oBAAoB,MAAM;AAC9B,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS,UAAU,YAAY,kBAAkB;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,mBAAAA,OAAe;AAG9B,QAAM,qBAAiB;AAAA,IACrB,CAAC,MAA2C;AAC1C,UAAI,kBAAmB;AACvB,
|
|
4
|
+
"sourcesContent": ["import { useContext, useCallback } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { filterOptions } from '../../utils/listHelper.js';\n\nconst useMaskedOnChange = () => {\n const {\n props: { useMask, onFilter, allOptions, applyAriaDisabled },\n setMenuState,\n setInputValue,\n setFocusOptionIdx,\n } = useContext(ComboBoxContext);\n\n // default onchange when no mask provided\n const handleOnChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (applyAriaDisabled) return;\n setMenuState(true, 'filter', e);\n if (onFilter) {\n // when filtering is controlled we suggest the basic filtering but let the user decide\n onFilter(filterOptions(e.currentTarget.value, allOptions), e.currentTarget.value);\n }\n setFocusOptionIdx('');\n setInputValue(e.currentTarget.value);\n },\n [applyAriaDisabled, setMenuState, onFilter, setFocusOptionIdx, setInputValue, allOptions],\n );\n\n // onchange used when mask is provided\n const handleOnChangeMask = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>, mask?: string) => {\n setMenuState(true, 'filter', e);\n if (mask && onFilter) onFilter(filterOptions(mask, allOptions), mask);\n else if (!mask && onFilter) onFilter(allOptions, '');\n },\n [allOptions, onFilter, setMenuState],\n );\n\n const onChangeMask = useMask({ valueSetter: setInputValue, onChange: handleOnChangeMask });\n\n return onChangeMask?.onChange || handleOnChange;\n};\n\nexport { useMaskedOnChange };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwC;AACxC,yBAA4B;AAC5B,wBAA8B;AAE9B,MAAM,oBAAoB,MAAM;AAC9B,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS,UAAU,YAAY,kBAAkB;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,mBAAAA,OAAe;AAG9B,QAAM,qBAAiB;AAAA,IACrB,CAAC,MAA2C;AAC1C,UAAI,kBAAmB;AACvB,mBAAa,MAAM,UAAU,CAAC;AAC9B,UAAI,UAAU;AAEZ,qBAAS,iCAAc,EAAE,cAAc,OAAO,UAAU,GAAG,EAAE,cAAc,KAAK;AAAA,MAClF;AACA,wBAAkB,EAAE;AACpB,oBAAc,EAAE,cAAc,KAAK;AAAA,IACrC;AAAA,IACA,CAAC,mBAAmB,cAAc,UAAU,mBAAmB,eAAe,UAAU;AAAA,EAC1F;AAGA,QAAM,yBAAqB;AAAA,IACzB,CAAC,GAAwC,SAAkB;AACzD,mBAAa,MAAM,UAAU,CAAC;AAC9B,UAAI,QAAQ,SAAU,cAAS,iCAAc,MAAM,UAAU,GAAG,IAAI;AAAA,eAC3D,CAAC,QAAQ,SAAU,UAAS,YAAY,EAAE;AAAA,IACrD;AAAA,IACA,CAAC,YAAY,UAAU,YAAY;AAAA,EACrC;AAEA,QAAM,eAAe,QAAQ,EAAE,aAAa,eAAe,UAAU,mBAAmB,CAAC;AAEzF,SAAO,cAAc,YAAY;AACnC;",
|
|
6
6
|
"names": ["ComboBoxContext"]
|
|
7
7
|
}
|
|
@@ -37,24 +37,20 @@ var import_react = require("react");
|
|
|
37
37
|
var import_styled = require("./styled.js");
|
|
38
38
|
var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
|
|
39
39
|
var import_ComboBoxCTX = require("../../ComboBoxCTX.js");
|
|
40
|
-
var import_header_list = require("../header-list/index.js");
|
|
41
40
|
var import_useItemRenderer = require("./useItemRenderer.js");
|
|
42
41
|
var import_LoadingContainer = require("./LoadingContainer.js");
|
|
43
42
|
var import_SkeletonContainer = require("./SkeletonContainer.js");
|
|
44
43
|
var import_useOnElementResize = require("../../utils/useOnElementResize.js");
|
|
45
44
|
const MenuList = () => {
|
|
46
45
|
const {
|
|
47
|
-
props: { isLoading, menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline,
|
|
46
|
+
props: { isLoading, menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline, isSkeleton },
|
|
48
47
|
controlsWrapperRef,
|
|
49
48
|
listRef,
|
|
50
|
-
inputValue,
|
|
51
49
|
wrapperListRef,
|
|
52
50
|
virtualListHelpers,
|
|
53
51
|
correctOptions: filteredOptions,
|
|
54
52
|
instanceUid
|
|
55
53
|
} = (0, import_react.useContext)(import_ComboBoxCTX.ComboBoxContext);
|
|
56
|
-
const multiple = Array.isArray(selectedValues);
|
|
57
|
-
const withHeader = !inline && multiple && filteredOptions && filteredOptions.length > 0 && !inputValue;
|
|
58
54
|
const ItemRenderer = (0, import_useItemRenderer.useItemRenderer)();
|
|
59
55
|
const { width } = (0, import_useOnElementResize.useOnElementResize)(controlsWrapperRef);
|
|
60
56
|
const preventLoseInputFocus = (0, import_react.useCallback)((e) => {
|
|
@@ -63,43 +59,32 @@ const MenuList = () => {
|
|
|
63
59
|
const menuListRender = (0, import_react.useMemo)(() => {
|
|
64
60
|
if (isSkeleton) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SkeletonContainer.SkeletonContainer, { instanceUid });
|
|
65
61
|
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LoadingContainer.LoadingContainer, {});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
import_styled.StyledVirtualListWrapper,
|
|
70
|
-
{
|
|
71
|
-
tabIndex: -1,
|
|
72
|
-
inline,
|
|
73
|
-
maxHeight: menuMaxHeight,
|
|
74
|
-
innerRef: listRef,
|
|
75
|
-
withHeader,
|
|
76
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
|
-
import_styled.StyledList,
|
|
78
|
-
{
|
|
79
|
-
"aria-label": "listbox",
|
|
80
|
-
id: `combo-listbox-${instanceUid}`,
|
|
81
|
-
role: "listbox",
|
|
82
|
-
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.LIST,
|
|
83
|
-
style: { height: virtualListHelpers?.totalSize, margin: inline ? "0px" : "8px 0px" },
|
|
84
|
-
children: ItemRenderer
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
}
|
|
88
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
-
import_styled.StyledNoResultsWrapper,
|
|
62
|
+
if (filteredOptions && filteredOptions.length > 0 || onCreate) {
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledVirtualListWrapper, { tabIndex: -1, inline, maxHeight: menuMaxHeight, innerRef: listRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_styled.StyledList,
|
|
90
65
|
{
|
|
66
|
+
"aria-label": "listbox",
|
|
91
67
|
id: `combo-listbox-${instanceUid}`,
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
68
|
+
role: "listbox",
|
|
69
|
+
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.LIST,
|
|
70
|
+
style: { height: virtualListHelpers?.totalSize, margin: inline ? "0px" : "8px 0px" },
|
|
71
|
+
children: ItemRenderer
|
|
95
72
|
}
|
|
96
|
-
)
|
|
97
|
-
|
|
73
|
+
) });
|
|
74
|
+
}
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
|
+
import_styled.StyledNoResultsWrapper,
|
|
77
|
+
{
|
|
78
|
+
id: `combo-listbox-${instanceUid}`,
|
|
79
|
+
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.NO_MATCHES_FOUND,
|
|
80
|
+
role: "alert",
|
|
81
|
+
children: noOptionsMessage
|
|
82
|
+
}
|
|
83
|
+
);
|
|
98
84
|
}, [
|
|
99
85
|
instanceUid,
|
|
100
86
|
isSkeleton,
|
|
101
87
|
isLoading,
|
|
102
|
-
withHeader,
|
|
103
88
|
filteredOptions,
|
|
104
89
|
onCreate,
|
|
105
90
|
inline,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/menu-list/MenuList.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useMemo, useCallback, useLayoutEffect } from 'react';\nimport { StyledListWrapper, StyledNoResultsWrapper, StyledList, StyledVirtualListWrapper } from './styled.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo, useCallback, useLayoutEffect } from 'react';\nimport { StyledListWrapper, StyledNoResultsWrapper, StyledList, StyledVirtualListWrapper } from './styled.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { useItemRenderer } from './useItemRenderer.js';\nimport { LoadingContainer } from './LoadingContainer.js';\nimport { SkeletonContainer } from './SkeletonContainer.js';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\n\nexport const MenuList = (): JSX.Element => {\n const {\n props: { isLoading, menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline, isSkeleton },\n controlsWrapperRef,\n listRef,\n wrapperListRef,\n virtualListHelpers,\n correctOptions: filteredOptions,\n instanceUid,\n } = useContext(ComboBoxContext);\n\n // removing the header list if we are filtering or is inline cb or we have no options to show\n const ItemRenderer = useItemRenderer();\n const { width } = useOnElementResize(controlsWrapperRef);\n const preventLoseInputFocus: React.MouseEventHandler = useCallback((e) => {\n e.preventDefault();\n }, []);\n\n const menuListRender = useMemo(() => {\n if (isSkeleton) return <SkeletonContainer instanceUid={instanceUid} />;\n\n if (isLoading) return <LoadingContainer />;\n\n if ((filteredOptions && filteredOptions.length > 0) || onCreate) {\n return (\n <StyledVirtualListWrapper tabIndex={-1} inline={inline} maxHeight={menuMaxHeight} innerRef={listRef}>\n <StyledList\n aria-label=\"listbox\"\n id={`combo-listbox-${instanceUid}`}\n role=\"listbox\"\n data-testid={ComboboxDataTestid.LIST}\n style={{ height: virtualListHelpers?.totalSize, margin: inline ? '0px' : '8px 0px' }}\n >\n {ItemRenderer}\n </StyledList>\n </StyledVirtualListWrapper>\n );\n }\n\n return (\n <StyledNoResultsWrapper\n id={`combo-listbox-${instanceUid}`}\n data-testid={ComboboxDataTestid.NO_MATCHES_FOUND}\n role=\"alert\"\n >\n {noOptionsMessage}\n </StyledNoResultsWrapper>\n );\n }, [\n instanceUid,\n isSkeleton,\n isLoading,\n filteredOptions,\n onCreate,\n inline,\n menuMaxHeight,\n listRef,\n virtualListHelpers?.totalSize,\n ItemRenderer,\n noOptionsMessage,\n ]);\n\n useLayoutEffect(() => {\n virtualListHelpers?.measure();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [width]);\n\n return (\n <StyledListWrapper\n innerRef={wrapperListRef}\n inline={inline}\n onMouseDown={preventLoseInputFocus}\n width={width}\n minWidth={menuMinWidth}\n >\n {menuListRender}\n </StyledListWrapper>\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AAA,IACH;AAAA,EAEJ,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB;AAAA,IACA;AAAA,EACF,CAAC;AAED,oCAAgB,MAAM;AACpB,wBAAoB,QAAQ;AAAA,EAE9B,GAAG,CAAC,KAAK,CAAC;AAEV,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA,UAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/menu-list/styled.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport type { SizingProps } from '@elliemae/ds-system';\n\ninterface StyledListWrapperT {\n minWidth: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n width: number | string;\n inline?: boolean;\n}\nexport const StyledListWrapper = styled.div<StyledListWrapperT>`\n min-width: ${({ inline, minWidth }) => (inline ? '100%' : `${String(minWidth)}px`)};\n width: ${({ width }) => `${width}px`};\n background-color: #ffffff;\n max-height: ${({ maxHeight }) => `${String(maxHeight)}px`};\n z-index: 100;\n`;\n\nexport const StyledList = styled.ul`\n position: relative;\n padding: 0;\n background-color: #ffffff;\n overflow: hidden;\n`;\n\nexport const StyledVirtualListWrapper = styled.div<{\n inline: boolean | undefined;\n maxHeight: SizingProps['maxHeight'];\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AAShB,MAAM,oBAAoB,wBAAO;AAAA,eACzB,CAAC,EAAE,QAAQ,SAAS,MAAO,SAAS,SAAS,GAAG,OAAO,QAAQ,CAAC,IAAK;AAAA,WACzE,CAAC,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAAA;AAAA,gBAEtB,CAAC,EAAE,UAAU,MAAM,GAAG,OAAO,SAAS,CAAC,IAAI;AAAA;AAAA;AAIpD,MAAM,aAAa,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAO1B,MAAM,2BAA2B,wBAAO;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport type { SizingProps } from '@elliemae/ds-system';\n\ninterface StyledListWrapperT {\n minWidth: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n width: number | string;\n inline?: boolean;\n}\nexport const StyledListWrapper = styled.div<StyledListWrapperT>`\n min-width: ${({ inline, minWidth }) => (inline ? '100%' : `${String(minWidth)}px`)};\n width: ${({ width }) => `${width}px`};\n background-color: #ffffff;\n max-height: ${({ maxHeight }) => `${String(maxHeight)}px`};\n z-index: 100;\n`;\n\nexport const StyledList = styled.ul`\n position: relative;\n padding: 0;\n background-color: #ffffff;\n overflow: hidden;\n`;\n\nexport const StyledVirtualListWrapper = styled.div<{\n inline: boolean | undefined;\n maxHeight: SizingProps['maxHeight'];\n}>`\n overflow-y: auto;\n max-height: ${({ maxHeight }) => (maxHeight ? `${String(maxHeight)}px` : '300px')};\n`;\n\nexport const StyledCreatableLabel = styled.span`\n font-weight: bold;\n font-style: italic;\n`;\n\nexport const StyledCreatableValue = styled.span`\n word-break: break-all;\n`;\n\nexport const StyledNoResultsWrapper = styled.div`\n padding: 16px;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AAShB,MAAM,oBAAoB,wBAAO;AAAA,eACzB,CAAC,EAAE,QAAQ,SAAS,MAAO,SAAS,SAAS,GAAG,OAAO,QAAQ,CAAC,IAAK;AAAA,WACzE,CAAC,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAAA;AAAA,gBAEtB,CAAC,EAAE,UAAU,MAAM,GAAG,OAAO,SAAS,CAAC,IAAI;AAAA;AAAA;AAIpD,MAAM,aAAa,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAO1B,MAAM,2BAA2B,wBAAO;AAAA;AAAA,gBAK/B,CAAC,EAAE,UAAU,MAAO,YAAY,GAAG,OAAO,SAAS,CAAC,OAAO,OAAQ;AAAA;AAG5E,MAAM,uBAAuB,wBAAO;AAAA;AAAA;AAAA;AAKpC,MAAM,uBAAuB,wBAAO;AAAA;AAAA;AAIpC,MAAM,yBAAyB,wBAAO;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,6 +36,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
38
38
|
var import_ds_menu_items = require("@elliemae/ds-menu-items");
|
|
39
|
+
var import_Section = require("../Section.js");
|
|
39
40
|
var import_ComboBoxCTX = require("../../ComboBoxCTX.js");
|
|
40
41
|
var import_styled = require("./styled.js");
|
|
41
42
|
var import_listHelper = require("../../utils/listHelper.js");
|
|
@@ -43,13 +44,13 @@ var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
|
|
|
43
44
|
var import_constants = require("../../constants.js");
|
|
44
45
|
const useItemRenderer = () => {
|
|
45
46
|
const {
|
|
46
|
-
props: { onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions },
|
|
47
|
+
props: { onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions, readOnly },
|
|
47
48
|
setMenuState,
|
|
48
49
|
inputValue,
|
|
49
50
|
focusOptionIdx,
|
|
50
51
|
setInputValue,
|
|
51
52
|
virtualListHelpers,
|
|
52
|
-
|
|
53
|
+
optionsPerSection
|
|
53
54
|
} = (0, import_react.useContext)(import_ComboBoxCTX.ComboBoxContext);
|
|
54
55
|
const multiple = Array.isArray(selectedValues);
|
|
55
56
|
const CBItem = multiple ? import_ds_menu_items.MultiMenuItem : import_ds_menu_items.SingleMenuItem;
|
|
@@ -62,6 +63,7 @@ const useItemRenderer = () => {
|
|
|
62
63
|
}, [onFilter, onCreate, inputValue, allOptions, setInputValue]);
|
|
63
64
|
const handleClick = (0, import_react.useCallback)(
|
|
64
65
|
(option, e) => {
|
|
66
|
+
if (readOnly) return;
|
|
65
67
|
if (option.type === import_constants.MENU_OPTION_TYPES.OPTION) {
|
|
66
68
|
if (!option.disabled) {
|
|
67
69
|
if (onFilter) onFilter(allOptions, inputValue);
|
|
@@ -85,8 +87,8 @@ const useItemRenderer = () => {
|
|
|
85
87
|
return null;
|
|
86
88
|
}
|
|
87
89
|
return virtualListHelpers.virtualItems.map((vItem) => {
|
|
88
|
-
const option =
|
|
89
|
-
const { dsId, type, disabled, applyAriaDisabled, ...rest } = option;
|
|
90
|
+
const option = optionsPerSection[vItem.index];
|
|
91
|
+
const { dsId, type, disabled, applyAriaDisabled, readOnly: itemReadOnly, ...rest } = option;
|
|
90
92
|
const generalProps = {
|
|
91
93
|
wrapperStyles: {
|
|
92
94
|
position: "absolute",
|
|
@@ -95,58 +97,75 @@ const useItemRenderer = () => {
|
|
|
95
97
|
width: "100%",
|
|
96
98
|
transform: `translateY(${vItem.start}px)`
|
|
97
99
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
// 'aria-setsize': `${allOptions.length}`,
|
|
101
|
+
// 'aria-posinset': `${vItem.index + 1}`,
|
|
100
102
|
key: `${dsId}`,
|
|
101
103
|
innerRef: vItem.measureRef,
|
|
102
104
|
dsId: dsId.toString(),
|
|
103
105
|
...rest
|
|
104
106
|
};
|
|
105
107
|
if (type === import_constants.MENU_OPTION_TYPES.SECTION) {
|
|
106
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
109
|
+
import_Section.Section,
|
|
110
|
+
{
|
|
111
|
+
label: option.label,
|
|
112
|
+
...generalProps,
|
|
113
|
+
options: option.options,
|
|
114
|
+
handleClick,
|
|
115
|
+
focusOptionIdx,
|
|
116
|
+
handleOnMouseDown,
|
|
117
|
+
selectedValues
|
|
118
|
+
}
|
|
119
|
+
);
|
|
107
120
|
}
|
|
108
121
|
if (type === import_constants.MENU_OPTION_TYPES.SEPARATOR) {
|
|
109
122
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items.Separator, { ...generalProps, render: void 0 });
|
|
110
123
|
}
|
|
111
124
|
if (option.type === import_constants.MENU_OPTION_TYPES.OPTION) {
|
|
112
|
-
return
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
return (
|
|
126
|
+
// @ts-expect-error - this needs to be rewritten, this should not be a custom hook returning JSX, this should be a component.
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
128
|
+
CBItem,
|
|
129
|
+
{
|
|
130
|
+
...generalProps,
|
|
131
|
+
value: option.value,
|
|
132
|
+
label: option.label,
|
|
133
|
+
dataTestid: import_ComboboxDataTestids.ComboboxDataTestid.OPTION,
|
|
134
|
+
disabled,
|
|
135
|
+
applyAriaDisabled: applyAriaDisabled || itemReadOnly,
|
|
136
|
+
onClick: (e) => {
|
|
137
|
+
if (applyAriaDisabled) return;
|
|
138
|
+
handleClick(option, e);
|
|
139
|
+
},
|
|
140
|
+
onMouseDown: handleOnMouseDown,
|
|
141
|
+
isActive: dsId === focusOptionIdx,
|
|
142
|
+
isSelected: (0, import_listHelper.isSelected)(selectedValues, option),
|
|
143
|
+
tabIndex: -1
|
|
144
|
+
}
|
|
145
|
+
)
|
|
130
146
|
);
|
|
131
147
|
}
|
|
132
148
|
if (type === import_constants.INTERNAL_MENU_OPTION_TYPES.CREATABLE) {
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
149
|
+
return (
|
|
150
|
+
// @ts-expect-error - this needs to be rewritten, this should not be a custom hook returning JSX, this should be a component.
|
|
151
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
152
|
+
import_ds_menu_items.SingleMenuItem,
|
|
153
|
+
{
|
|
154
|
+
dataTestid: import_ComboboxDataTestids.ComboboxDataTestid.OPTION,
|
|
155
|
+
isActive: dsId === focusOptionIdx,
|
|
156
|
+
...generalProps,
|
|
157
|
+
render: ({ label: labelCreatable }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_grid.Grid, { p: "8px", cols: ["min-content", "auto"], gutter: "xxs", alignItems: "center", children: [
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledCreatableLabel, { children: "Add:" }),
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledCreatableValue, { children: `"${labelCreatable}"` })
|
|
160
|
+
] }),
|
|
161
|
+
label: option.label,
|
|
162
|
+
onClick: handleOnCreateClick
|
|
163
|
+
}
|
|
164
|
+
)
|
|
146
165
|
);
|
|
147
166
|
}
|
|
148
|
-
return
|
|
167
|
+
return null;
|
|
149
168
|
});
|
|
150
|
-
}, [
|
|
169
|
+
}, [focusOptionIdx, selectedValues, virtualListHelpers]);
|
|
151
170
|
};
|
|
152
171
|
//# sourceMappingURL=useItemRenderer.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/menu-list/useItemRenderer.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { SingleMenuItem, MultiMenuItem,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { SingleMenuItem, MultiMenuItem, Separator } from '@elliemae/ds-menu-items';\nimport { Section } from '../Section.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { StyledCreatableLabel, StyledCreatableValue } from './styled.js';\nimport { isSelected, getSuggestedValueOnChange } from '../../utils/listHelper.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES, INTERNAL_MENU_OPTION_TYPES } from '../../constants.js';\nexport const useItemRenderer = (): Array<JSX.Element> | null => {\n const {\n props: { onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions, readOnly },\n setMenuState,\n inputValue,\n focusOptionIdx,\n setInputValue,\n virtualListHelpers,\n optionsPerSection,\n } = useContext(ComboBoxContext);\n\n const multiple = Array.isArray(selectedValues);\n const CBItem = multiple ? MultiMenuItem : SingleMenuItem;\n\n const handleOnCreateClick = useCallback(() => {\n if (inputValue && onCreate) {\n onCreate(inputValue);\n setInputValue('');\n if (onFilter) onFilter(allOptions, inputValue);\n }\n }, [onFilter, onCreate, inputValue, allOptions, setInputValue]);\n\n const handleClick = useCallback(\n (option: DSComboboxT.ItemOption, e: React.MouseEvent) => {\n if (readOnly) return;\n if (option.type === MENU_OPTION_TYPES.OPTION) {\n if (!option.disabled) {\n if (onFilter) onFilter(allOptions, inputValue);\n setInputValue('');\n if (!multiple) {\n setMenuState(false, 'selectOption', e);\n }\n onChange(getSuggestedValueOnChange(option, selectedValues, isNonClearable), option, e);\n }\n }\n // prevent for loosing focus on input control\n e.stopPropagation();\n e.preventDefault();\n },\n [onFilter, selectedValues, allOptions, onChange, setMenuState, multiple],\n );\n\n // prevent blur from controls input\n const handleOnMouseDown = useCallback((e: React.MouseEvent<HTMLLIElement>) => {\n e.preventDefault();\n }, []);\n\n // @ts-expect-error - this needs to be rewritten, this should not be a custom hook returning JSX, this should be a component.\n return useMemo(() => {\n if (!virtualListHelpers) {\n return null;\n }\n return virtualListHelpers.virtualItems.map((vItem) => {\n const option = optionsPerSection[vItem.index];\n const { dsId, type, disabled, applyAriaDisabled, readOnly: itemReadOnly, ...rest } = option;\n const generalProps = {\n wrapperStyles: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n transform: `translateY(${vItem.start}px)`,\n },\n // 'aria-setsize': `${allOptions.length}`,\n // 'aria-posinset': `${vItem.index + 1}`,\n key: `${dsId}`,\n innerRef: vItem.measureRef,\n dsId: dsId.toString(),\n ...rest,\n };\n if (type === MENU_OPTION_TYPES.SECTION) {\n return (\n <Section\n label={option.label}\n {...generalProps}\n // @ts-expect-error - this needs to be rewritten, broken typescript typings?\n options={option.options}\n handleClick={handleClick}\n focusOptionIdx={focusOptionIdx}\n handleOnMouseDown={handleOnMouseDown}\n selectedValues={selectedValues}\n />\n );\n }\n if (type === MENU_OPTION_TYPES.SEPARATOR) {\n // @ts-expect-error - this needs to be rewritten, this should not be a custom hook returning JSX, this should be a component.\n return <Separator {...generalProps} render={undefined} />;\n }\n if (option.type === MENU_OPTION_TYPES.OPTION) {\n return (\n // @ts-expect-error - this needs to be rewritten, this should not be a custom hook returning JSX, this should be a component.\n <CBItem\n {...generalProps}\n value={option.value}\n label={option.label}\n dataTestid={ComboboxDataTestid.OPTION}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled || itemReadOnly}\n onClick={(e: React.MouseEvent) => {\n if (applyAriaDisabled) return;\n handleClick(option, e);\n }}\n onMouseDown={handleOnMouseDown}\n isActive={dsId === focusOptionIdx}\n isSelected={isSelected(selectedValues, option)}\n tabIndex={-1}\n />\n );\n }\n if (type === INTERNAL_MENU_OPTION_TYPES.CREATABLE) {\n return (\n // @ts-expect-error - this needs to be rewritten, this should not be a custom hook returning JSX, this should be a component.\n <SingleMenuItem\n dataTestid={ComboboxDataTestid.OPTION}\n isActive={dsId === focusOptionIdx}\n {...generalProps}\n render={({ label: labelCreatable }: { label?: string }) => (\n <Grid p=\"8px\" cols={['min-content', 'auto']} gutter=\"xxs\" alignItems=\"center\">\n <StyledCreatableLabel>Add:</StyledCreatableLabel>\n <StyledCreatableValue>{`\"${labelCreatable}\"`}</StyledCreatableValue>\n </Grid>\n )}\n label={option.label}\n onClick={handleOnCreateClick}\n />\n );\n }\n return null;\n });\n }, [focusOptionIdx, selectedValues, virtualListHelpers]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqFb;AAlFV,mBAAwD;AACxD,qBAAqB;AACrB,2BAAyD;AACzD,qBAAwB;AACxB,yBAAgC;AAChC,oBAA2D;AAC3D,wBAAsD;AACtD,iCAAmC;AAEnC,uBAA8D;AACvD,MAAM,kBAAkB,MAAiC;AAC9D,QAAM;AAAA,IACJ,OAAO,EAAE,UAAU,UAAU,gBAAgB,gBAAgB,UAAU,YAAY,SAAS;AAAA,IAC5F;AAAA,IACA;AAAA,IACA;AAAA,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sCAAsB,cAAI,cAAc,KAAI;AAAA,iBAC/C;AAAA,cAEF,OAAO,OAAO;AAAA,cACd,SAAS;AAAA;AAAA,UACX;AAAA;AAAA,MAEJ;AACA,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,gBAAgB,gBAAgB,kBAAkB,CAAC;AACzD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -40,7 +40,14 @@ var import_listHelper = require("../../utils/listHelper.js");
|
|
|
40
40
|
const RemovableSelectedValuePill = (props) => {
|
|
41
41
|
const { pill } = props;
|
|
42
42
|
const {
|
|
43
|
-
props: {
|
|
43
|
+
props: {
|
|
44
|
+
onChange,
|
|
45
|
+
isNonClearable,
|
|
46
|
+
disabled,
|
|
47
|
+
selectedValues,
|
|
48
|
+
applyAriaDisabled: applyAriaDisabledToContainer,
|
|
49
|
+
readOnly
|
|
50
|
+
},
|
|
44
51
|
internalRef
|
|
45
52
|
} = (0, import_react.useContext)(import_ComboBoxCTX.default);
|
|
46
53
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -50,9 +57,10 @@ const RemovableSelectedValuePill = (props) => {
|
|
|
50
57
|
label: pill.label,
|
|
51
58
|
disabled,
|
|
52
59
|
type: disabled || applyAriaDisabledToContainer || isNonClearable ? "value" : "removable",
|
|
53
|
-
applyAriaDisabled: applyAriaDisabledToContainer || pill.applyAriaDisabled,
|
|
60
|
+
applyAriaDisabled: applyAriaDisabledToContainer || pill.applyAriaDisabled || readOnly,
|
|
54
61
|
tabIndex: -1,
|
|
55
62
|
onRemove: (e) => {
|
|
63
|
+
if (readOnly) return;
|
|
56
64
|
e.stopPropagation();
|
|
57
65
|
onChange((0, import_listHelper.getSuggestedValueOnChange)(pill, selectedValues), pill, e);
|
|
58
66
|
internalRef.current?.focus();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/multi-selected-values-container/RemovableSelectedValuePill.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { DSPillV2 } from '@elliemae/ds-pills-v2';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { getSuggestedValueOnChange } from '../../utils/listHelper.js';\nexport const RemovableSelectedValuePill: React.ComponentType<{\n pill: DSComboboxT.ItemOption;\n applyAriaDisabled?: boolean;\n}> = (props) => {\n const { pill } = props;\n const {\n props: {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { DSPillV2 } from '@elliemae/ds-pills-v2';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { getSuggestedValueOnChange } from '../../utils/listHelper.js';\nexport const RemovableSelectedValuePill: React.ComponentType<{\n pill: DSComboboxT.ItemOption;\n applyAriaDisabled?: boolean;\n}> = (props) => {\n const { pill } = props;\n const {\n props: {\n onChange,\n isNonClearable,\n disabled,\n selectedValues,\n applyAriaDisabled: applyAriaDisabledToContainer,\n readOnly,\n },\n internalRef,\n } = useContext(ComboBoxContext);\n\n return (\n <DSPillV2\n size=\"s\"\n key={pill.value}\n label={pill.label}\n disabled={disabled}\n type={disabled || applyAriaDisabledToContainer || isNonClearable ? 'value' : 'removable'}\n applyAriaDisabled={applyAriaDisabledToContainer || pill.applyAriaDisabled || readOnly}\n tabIndex={-1}\n onRemove={(e: React.KeyboardEvent | React.MouseEvent) => {\n if (readOnly) return;\n // preventing the menu to be opened\n e.stopPropagation();\n onChange(getSuggestedValueOnChange(pill, selectedValues), pill, e);\n internalRef.current?.focus();\n }}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADuBnB;AAvBJ,mBAAkC;AAClC,yBAAyB;AACzB,yBAA4B;AAE5B,wBAA0C;AACnC,MAAM,6BAGR,CAAC,UAAU;AACd,QAAM,EAAE,KAAK,IAAI;AACjB,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB;AAAA,MACnB;AAAA,IACF;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,mBAAAA,OAAe;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MAEL,OAAO,KAAK;AAAA,MACZ;AAAA,MACA,MAAM,YAAY,gCAAgC,iBAAiB,UAAU;AAAA,MAC7E,mBAAmB,gCAAgC,KAAK,qBAAqB;AAAA,MAC7E,UAAU;AAAA,MACV,UAAU,CAAC,MAA8C;AACvD,YAAI,SAAU;AAEd,UAAE,gBAAgB;AAClB,qBAAS,6CAA0B,MAAM,cAAc,GAAG,MAAM,CAAC;AACjE,oBAAY,SAAS,MAAM;AAAA,MAC7B;AAAA;AAAA,IAZK,KAAK;AAAA,EAaZ;AAEJ;",
|
|
6
6
|
"names": ["ComboBoxContext"]
|
|
7
7
|
}
|
|
@@ -66,6 +66,8 @@ const ComboboxPropTypes = {
|
|
|
66
66
|
isSkeleton: import_ds_props_helpers.PropTypes.bool.description("whether or not the component is in skeleton state").defaultValue(false),
|
|
67
67
|
applyAriaDisabled: import_ds_props_helpers.PropTypes.bool.description(
|
|
68
68
|
"Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION."
|
|
69
|
-
).defaultValue(false)
|
|
69
|
+
).defaultValue(false),
|
|
70
|
+
readOnly: import_ds_props_helpers.PropTypes.bool.description("Makes the component non-editable while remaining accessible.").defaultValue(false),
|
|
71
|
+
onSelectAll: import_ds_props_helpers.PropTypes.func.description("function triggered when user select all the options").defaultValue("() => {}").deprecated({ version: "25.2" })
|
|
70
72
|
};
|
|
71
73
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-unused-vars */\nimport type React from 'react';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { globalAttributesPropTypes, PropTypes } from '@elliemae/ds-props-helpers';\nimport type { DSMaskT } from '@elliemae/ds-form-helpers-mask-hooks';\nimport type { SizingProps } from '@elliemae/ds-system';\nimport type { DSPopperJST } from '@elliemae/ds-popperjs';\n\nexport function noop<T extends unknown[]>(..._args: T): void {}\n\nexport declare namespace DSComboboxT {\n export interface CommonItemOptions extends GlobalAttributesT {\n dsId: string;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n render?: React.ComponentType<unknown>;\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 ItemOption extends CommonItemOptions {\n value: string;\n label: string;\n type: 'option';\n }\n\n export interface ItemCreatableOption extends CommonItemOptions {\n label: string;\n type: 'creatable';\n }\n\n export type OptionTypes = ItemOption | ItemSectionOptions | ItemSeparatorOptions | ItemCreatableOption;\n\n export type SelectedOptionsT = ItemOption[] | ItemOption | null;\n export interface PropsOptional {\n inputMinWidth?: number;\n menuMinWidth?: SizingProps['minWidth'];\n menuMaxHeight?: SizingProps['maxHeight'];\n placeholder?: string;\n autoFocus?: boolean;\n filteredOptions?: OptionTypes[];\n isMenuOpen?: boolean;\n onMenuChange?: (\n state: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => void;\n onCreate?: (label: string) => void;\n onFilter?: (newOptions: OptionTypes[], inputValue?: string) => void;\n onCancel?: () => void;\n onSelectAll?: (suggestedValue: OptionTypes[] | [], event: React.MouseEvent | React.KeyboardEvent) => null;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: ItemOption) => void;\n isLoading?: boolean;\n }\n\n export interface RequiredProps {\n allOptions: OptionTypes[];\n selectedValues: SelectedOptionsT;\n onChange: (\n suggestedValue: SelectedOptionsT,\n selectedOption: ItemOption,\n event: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n }\n export interface DefaultProps {\n startPlacementPreference: DSPopperJST.PopperPlacementsT;\n placementOrderPreference: DSPopperJST.PopperPlacementsT[];\n hasError: boolean;\n inline: boolean;\n withoutPortal: boolean;\n isNonClearable: boolean;\n disabled: boolean;\n noOptionsMessage: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null> | ((ref: HTMLInputElement | null) => void);\n useMask: DSMaskT.Hook | typeof noop;\n onlySelectable: boolean;\n isSkeleton: boolean;\n applyAriaDisabled: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n RequiredProps,\n PropsOptional,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof PropsOptional>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n RequiredProps,\n PropsOptional,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof PropsOptional>,\n XstyledProps {}\n}\n\nexport const ComboboxPropTypes = {\n ...globalAttributesPropTypes,\n placeholder: PropTypes.string.description(\"input's placeholder value\").defaultValue(''),\n allOptions: PropTypes.oneOfType([PropTypes.array, PropTypes.object])\n .isRequired.description('List of original options')\n .defaultValue([]),\n filteredOptions: PropTypes.oneOfType([PropTypes.array, PropTypes.object])\n .description('List of filtered options to show in the menu based on the current internal input filter value')\n .defaultValue([]),\n selectedValues: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]).isRequired.description(\n 'Array of option or single option selected',\n ),\n disabled: PropTypes.bool.description('wheter or not the input is disabled').defaultValue('false'),\n autoFocus: PropTypes.bool.description('Whether the combo box uses auto focus or not').defaultValue('false'),\n hasError: PropTypes.bool.description('Whether the combo box has error or not').defaultValue('false'),\n noOptionsMessage: PropTypes.string\n .description('Custome message to be display when no matches found after filtering')\n .defaultValue('No Matches Found'),\n onChange: PropTypes.func.isRequired\n .description('function triggered when an option is selected it will send the options selected')\n .defaultValue('() => {}'),\n onFilter: PropTypes.func.description('function triggered when user type in the combobox input').defaultValue(''),\n onCreate: PropTypes.func\n .description(\n 'function triggered when user select \"create\" a new item whenever is not a match in the all option list',\n )\n .defaultValue(''),\n onCancel: PropTypes.func.description('function triggered when user press ESC key').defaultValue('() => {}'),\n onMenuChange: PropTypes.func\n .description('function triggered when user open or close the menu list')\n .defaultValue('() => {}'),\n inputMinWidth: PropTypes.any.description('Minimum width for the combo box input controller').defaultValue(undefined),\n menuMinWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),\n menuMaxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),\n withoutPortal: PropTypes.bool\n .description('Whether the combobox menu is rendered in a portal or not')\n .defaultValue(false),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'reference to the component',\n ),\n onlySelectable: PropTypes.bool.description('filtering is disabled'),\n isSkeleton: PropTypes.bool.description('whether or not the component is in skeleton state').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,8BAAqD;AAK9C,SAAS,QAA6B,OAAgB;AAAC;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-unused-vars */\nimport type React from 'react';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { globalAttributesPropTypes, PropTypes } from '@elliemae/ds-props-helpers';\nimport type { DSMaskT } from '@elliemae/ds-form-helpers-mask-hooks';\nimport type { SizingProps } from '@elliemae/ds-system';\nimport type { DSPopperJST } from '@elliemae/ds-popperjs';\n\nexport function noop<T extends unknown[]>(..._args: T): void {}\n\nexport declare namespace DSComboboxT {\n export interface CommonItemOptions extends GlobalAttributesT {\n dsId: string;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n render?: React.ComponentType<unknown>;\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 options: OptionTypes[];\n }\n\n export interface ItemOption extends CommonItemOptions {\n value: string;\n label: string;\n type: 'option';\n }\n\n export interface ItemCreatableOption extends CommonItemOptions {\n label: string;\n type: 'creatable';\n }\n\n export type OptionTypes = ItemOption | ItemSectionOptions | ItemSeparatorOptions | ItemCreatableOption;\n\n export type SelectedOptionsT = ItemOption[] | ItemOption | null;\n export interface PropsOptional {\n inputMinWidth?: number;\n menuMinWidth?: SizingProps['minWidth'];\n menuMaxHeight?: SizingProps['maxHeight'];\n placeholder?: string;\n autoFocus?: boolean;\n filteredOptions?: OptionTypes[];\n isMenuOpen?: boolean;\n onMenuChange?: (\n state: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => void;\n onCreate?: (label: string) => void;\n onFilter?: (newOptions: OptionTypes[], inputValue?: string) => void;\n onCancel?: () => void;\n onSelectAll?: (suggestedValue: OptionTypes[] | [], event: React.MouseEvent | React.KeyboardEvent) => null;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: ItemOption) => void;\n isLoading?: boolean;\n }\n\n export interface RequiredProps {\n allOptions: OptionTypes[];\n selectedValues: SelectedOptionsT;\n onChange: (\n suggestedValue: SelectedOptionsT,\n selectedOption: ItemOption,\n event: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n }\n export interface DefaultProps {\n startPlacementPreference: DSPopperJST.PopperPlacementsT;\n placementOrderPreference: DSPopperJST.PopperPlacementsT[];\n hasError: boolean;\n inline: boolean;\n withoutPortal: boolean;\n isNonClearable: boolean;\n disabled: boolean;\n noOptionsMessage: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null> | ((ref: HTMLInputElement | null) => void);\n useMask: DSMaskT.Hook | typeof noop;\n onlySelectable: boolean;\n isSkeleton: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n RequiredProps,\n PropsOptional,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof PropsOptional>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n RequiredProps,\n PropsOptional,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof PropsOptional>,\n XstyledProps {}\n}\n\nexport const ComboboxPropTypes = {\n ...globalAttributesPropTypes,\n placeholder: PropTypes.string.description(\"input's placeholder value\").defaultValue(''),\n allOptions: PropTypes.oneOfType([PropTypes.array, PropTypes.object])\n .isRequired.description('List of original options')\n .defaultValue([]),\n filteredOptions: PropTypes.oneOfType([PropTypes.array, PropTypes.object])\n .description('List of filtered options to show in the menu based on the current internal input filter value')\n .defaultValue([]),\n selectedValues: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]).isRequired.description(\n 'Array of option or single option selected',\n ),\n disabled: PropTypes.bool.description('wheter or not the input is disabled').defaultValue('false'),\n autoFocus: PropTypes.bool.description('Whether the combo box uses auto focus or not').defaultValue('false'),\n hasError: PropTypes.bool.description('Whether the combo box has error or not').defaultValue('false'),\n noOptionsMessage: PropTypes.string\n .description('Custome message to be display when no matches found after filtering')\n .defaultValue('No Matches Found'),\n onChange: PropTypes.func.isRequired\n .description('function triggered when an option is selected it will send the options selected')\n .defaultValue('() => {}'),\n onFilter: PropTypes.func.description('function triggered when user type in the combobox input').defaultValue(''),\n onCreate: PropTypes.func\n .description(\n 'function triggered when user select \"create\" a new item whenever is not a match in the all option list',\n )\n .defaultValue(''),\n onCancel: PropTypes.func.description('function triggered when user press ESC key').defaultValue('() => {}'),\n onMenuChange: PropTypes.func\n .description('function triggered when user open or close the menu list')\n .defaultValue('() => {}'),\n inputMinWidth: PropTypes.any.description('Minimum width for the combo box input controller').defaultValue(undefined),\n menuMinWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),\n menuMaxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),\n withoutPortal: PropTypes.bool\n .description('Whether the combobox menu is rendered in a portal or not')\n .defaultValue(false),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'reference to the component',\n ),\n onlySelectable: PropTypes.bool.description('filtering is disabled'),\n isSkeleton: PropTypes.bool.description('whether or not the component is in skeleton state').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n readOnly: PropTypes.bool\n .description('Makes the component non-editable while remaining accessible.')\n .defaultValue(false),\n onSelectAll: PropTypes.func\n .description('function triggered when user select all the options')\n .defaultValue('() => {}')\n .deprecated({ version: '25.2' }),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,8BAAqD;AAK9C,SAAS,QAA6B,OAAgB;AAAC;AA+FvD,MAAM,oBAAoB;AAAA,EAC/B,GAAG;AAAA,EACH,aAAa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YAAY,0DAA0D,EACtE,aAAa,KAAK;AAAA,EACrB,UAAU,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,EAAE,SAAS,kCAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC3F;AAAA,EACF;AAAA,EACA,gBAAgB,kCAAU,KAAK,YAAY,uBAAuB;AAAA,EAClE,YAAY,kCAAU,KAAK,YAAY,mDAAmD,EAAE,aAAa,KAAK;AAAA,EAC9G,mBAAmB,kCAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,UAAU,kCAAU,KACjB,YAAY,8DAA8D,EAC1E,aAAa,KAAK;AAAA,EACrB,aAAa,kCAAU,KACpB,YAAY,qDAAqD,EACjE,aAAa,UAAU,EACvB,WAAW,EAAE,SAAS,OAAO,CAAC;AACnC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/sharedTypes.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type React from 'react';\nimport type { useVirtual } from 'react-virtual';\nimport type { DSComboboxT } from './react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES } from './constants.js';\nexport declare namespace DSComboboxInternalsT {\n export interface ComboBoxContextT {\n props: DSComboboxT.InternalProps;\n internalRef: React.RefObject<HTMLInputElement>;\n virtualListHelpers?: ReturnType<typeof useVirtual>;\n menuState: boolean;\n setShowPopover: React.Dispatch<React.SetStateAction<boolean>>;\n referenceElement: HTMLElement | null;\n setReferenceElement: React.Dispatch<React.SetStateAction<HTMLElement | null>>;\n pillGroupRef: React.RefObject<HTMLDivElement>;\n scrollOptionIntoView: (dsId: string) => void;\n setHasFocus: React.Dispatch<React.SetStateAction<boolean>>;\n hasFocus: boolean;\n listRef: React.RefObject<HTMLDivElement>;\n wrapperListRef: React.RefObject<HTMLDivElement>;\n inputValue: string;\n setInputValue: React.Dispatch<React.SetStateAction<string>>;\n selectedOptionsRef: React.RefObject<HTMLDivElement>;\n controlsWrapperRef: React.RefObject<HTMLDivElement>;\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,uBAAkC;
|
|
4
|
+
"sourcesContent": ["import type React from 'react';\nimport type { useVirtual } from 'react-virtual';\nimport type { DSComboboxT } from './react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES } from './constants.js';\nexport declare namespace DSComboboxInternalsT {\n export interface ComboBoxContextT {\n props: DSComboboxT.InternalProps;\n internalRef: React.RefObject<HTMLInputElement>;\n virtualListHelpers?: ReturnType<typeof useVirtual>;\n menuState: boolean;\n setShowPopover: React.Dispatch<React.SetStateAction<boolean>>;\n referenceElement: HTMLElement | null;\n setReferenceElement: React.Dispatch<React.SetStateAction<HTMLElement | null>>;\n pillGroupRef: React.RefObject<HTMLDivElement>;\n scrollOptionIntoView: (dsId: string) => void;\n setHasFocus: React.Dispatch<React.SetStateAction<boolean>>;\n hasFocus: boolean;\n listRef: React.RefObject<HTMLDivElement>;\n wrapperListRef: React.RefObject<HTMLDivElement>;\n inputValue: string;\n setInputValue: React.Dispatch<React.SetStateAction<string>>;\n selectedOptionsRef: React.RefObject<HTMLDivElement>;\n controlsWrapperRef: React.RefObject<HTMLDivElement>;\n focusOptionIdx: string;\n setFocusOptionIdx: React.Dispatch<React.SetStateAction<string>>;\n setMenuState: (\n newState: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => void;\n correctOptions: DSComboboxT.OptionTypes[];\n instanceUid: string;\n optionsPerSection: DSComboboxT.OptionTypes[];\n }\n}\n\nexport const isSeparator = (el: DSComboboxT.OptionTypes | undefined): el is DSComboboxT.ItemSeparatorOptions =>\n el?.type === MENU_OPTION_TYPES.SEPARATOR;\n\nexport const isOption = (el: DSComboboxT.OptionTypes | undefined): el is DSComboboxT.ItemOption =>\n el?.type === MENU_OPTION_TYPES.OPTION;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,uBAAkC;AAiC3B,MAAM,cAAc,CAAC,OAC1B,IAAI,SAAS,mCAAkB;AAE1B,MAAM,WAAW,CAAC,OACvB,IAAI,SAAS,mCAAkB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|