@elliemae/ds-form-layout-autocomplete 3.16.0-next.2 → 3.16.0-next.21
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/Autocomplete.js +11 -7
- package/dist/cjs/Autocomplete.js.map +2 -2
- package/dist/cjs/AutocompleteCTX.js +6 -22
- package/dist/cjs/AutocompleteCTX.js.map +2 -2
- package/dist/cjs/AutocompleteDataTestids.js +4 -0
- package/dist/cjs/AutocompleteDataTestids.js.map +1 -1
- package/dist/cjs/DSAutocompleteDefinitions.js +4 -0
- package/dist/cjs/DSAutocompleteDefinitions.js.map +1 -1
- package/dist/cjs/config/useAutocomplete.js +34 -47
- package/dist/cjs/config/useAutocomplete.js.map +3 -3
- package/dist/cjs/config/usePopoverLogic.js +113 -0
- package/dist/cjs/config/usePopoverLogic.js.map +7 -0
- package/dist/cjs/{sharedTypes.js → config/useRefs.js} +20 -3
- package/dist/cjs/config/useRefs.js.map +7 -0
- package/dist/cjs/config/useVirtualization.js +66 -0
- package/dist/cjs/config/useVirtualization.js.map +7 -0
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/parts/A11yFocusedOption.js +9 -5
- package/dist/cjs/parts/A11yFocusedOption.js.map +2 -2
- package/dist/cjs/parts/container/Container.js +29 -25
- package/dist/cjs/parts/container/Container.js.map +2 -2
- package/dist/cjs/parts/container/index.js +5 -1
- package/dist/cjs/parts/container/index.js.map +2 -2
- package/dist/cjs/parts/container/styled.js +4 -0
- package/dist/cjs/parts/container/styled.js.map +1 -1
- package/dist/cjs/parts/container/useKeyboardNavigation.js +21 -20
- package/dist/cjs/parts/container/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/parts/menu-list/MenuList.js +23 -23
- package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
- package/dist/cjs/parts/menu-list/index.js +5 -1
- package/dist/cjs/parts/menu-list/index.js.map +2 -2
- package/dist/cjs/parts/menu-list/styled.js +4 -0
- package/dist/cjs/parts/menu-list/styled.js.map +1 -1
- package/dist/cjs/parts/menu-list/useItemRenderer.js +11 -5
- package/dist/cjs/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +16 -5
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/tests/utils.js +4 -0
- package/dist/cjs/tests/utils.js.map +1 -1
- package/dist/cjs/utils/listHelper.js +4 -0
- package/dist/cjs/utils/listHelper.js.map +2 -2
- package/dist/esm/Autocomplete.js +6 -6
- package/dist/esm/Autocomplete.js.map +1 -1
- package/dist/esm/AutocompleteCTX.js +3 -23
- package/dist/esm/AutocompleteCTX.js.map +2 -2
- package/dist/esm/config/useAutocomplete.js +27 -44
- package/dist/esm/config/useAutocomplete.js.map +3 -3
- package/dist/esm/config/usePopoverLogic.js +83 -0
- package/dist/esm/config/usePopoverLogic.js.map +7 -0
- package/dist/esm/config/useRefs.js +11 -0
- package/dist/esm/config/useRefs.js.map +7 -0
- package/dist/esm/config/useVirtualization.js +36 -0
- package/dist/esm/config/useVirtualization.js.map +7 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/package.json +7 -0
- package/dist/esm/parts/A11yFocusedOption.js +5 -5
- package/dist/esm/parts/A11yFocusedOption.js.map +2 -2
- package/dist/esm/parts/container/Container.js +26 -26
- package/dist/esm/parts/container/Container.js.map +2 -2
- package/dist/esm/parts/container/index.js +1 -1
- package/dist/esm/parts/container/index.js.map +1 -1
- package/dist/esm/parts/container/useKeyboardNavigation.js +17 -20
- package/dist/esm/parts/container/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/parts/menu-list/MenuList.js +19 -23
- package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
- package/dist/esm/parts/menu-list/index.js +1 -1
- package/dist/esm/parts/menu-list/index.js.map +1 -1
- package/dist/esm/parts/menu-list/useItemRenderer.js +7 -5
- package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +8 -1
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/utils/listHelper.js.map +2 -2
- package/package.json +12 -12
- package/dist/cjs/sharedTypes.js.map +0 -7
- package/dist/esm/sharedTypes.js +0 -2
- package/dist/esm/sharedTypes.js.map +0 -7
- package/dist/types/Autocomplete.d.ts +0 -5
- package/dist/types/AutocompleteCTX.d.ts +0 -7
- package/dist/types/AutocompleteDataTestids.d.ts +0 -5
- package/dist/types/DSAutocompleteDefinitions.d.ts +0 -1
- package/dist/types/config/useAutocomplete.d.ts +0 -3
- package/dist/types/index.d.ts +0 -1
- package/dist/types/parts/A11yFocusedOption.d.ts +0 -5
- package/dist/types/parts/container/Container.d.ts +0 -1
- package/dist/types/parts/container/index.d.ts +0 -1
- package/dist/types/parts/container/styled.d.ts +0 -2
- package/dist/types/parts/container/useKeyboardNavigation.d.ts +0 -4
- package/dist/types/parts/menu-list/MenuList.d.ts +0 -1
- package/dist/types/parts/menu-list/index.d.ts +0 -1
- package/dist/types/parts/menu-list/styled.d.ts +0 -7
- package/dist/types/parts/menu-list/useItemRenderer.d.ts +0 -1
- package/dist/types/react-desc-prop-types.d.ts +0 -44
- package/dist/types/sharedTypes.d.ts +0 -18
- package/dist/types/tests/general.test.d.ts +0 -1
- package/dist/types/tests/utils.d.ts +0 -5
- package/dist/types/utils/listHelper.d.ts +0 -7
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -33,8 +37,8 @@ var React = __toESM(require("react"));
|
|
|
33
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
38
|
var import_react = require("react");
|
|
35
39
|
var import_ds_system = require("@elliemae/ds-system");
|
|
36
|
-
var import_AutocompleteCTX = __toESM(require("../AutocompleteCTX"));
|
|
37
|
-
var import_listHelper = require("../utils/listHelper");
|
|
40
|
+
var import_AutocompleteCTX = __toESM(require("../AutocompleteCTX.js"));
|
|
41
|
+
var import_listHelper = require("../utils/listHelper.js");
|
|
38
42
|
const isSeparator = (el) => el?.type === "separator";
|
|
39
43
|
const StyledA11ySelectedValues = import_ds_system.styled.span`
|
|
40
44
|
width: 1px;
|
|
@@ -46,14 +50,14 @@ const A11yFocusedOption = () => {
|
|
|
46
50
|
const {
|
|
47
51
|
props: { options },
|
|
48
52
|
focusOptionIdx,
|
|
49
|
-
|
|
53
|
+
isShowingPopover
|
|
50
54
|
} = (0, import_react.useContext)(import_AutocompleteCTX.default);
|
|
51
55
|
return (0, import_react.useMemo)(() => {
|
|
52
56
|
const selectabledOptions = (0, import_listHelper.getSelectableOptions)(options);
|
|
53
57
|
const focusOption = options.find((option) => !isSeparator(option) && option.dsId === focusOptionIdx);
|
|
54
58
|
const focusSelectableOptionIdx = selectabledOptions.findIndex((option) => option.dsId === focusOptionIdx);
|
|
55
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledA11ySelectedValues, { "aria-live": "polite", children: !isSeparator(focusOption) &&
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledA11ySelectedValues, { "aria-live": "polite", children: !isSeparator(focusOption) && isShowingPopover && focusOption && `option ${focusOption.label} focused.${focusSelectableOptionIdx + 1} of ${selectabledOptions.length}
|
|
56
60
|
` });
|
|
57
|
-
}, [options,
|
|
61
|
+
}, [options, isShowingPopover, focusOptionIdx]);
|
|
58
62
|
};
|
|
59
63
|
//# sourceMappingURL=A11yFocusedOption.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/A11yFocusedOption.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport AutocompleteContext from '../AutocompleteCTX';\nimport { getSelectableOptions } from '../utils/listHelper';\nimport type { DSAutocompleteT } from '../react-desc-prop-types';\nexport const isSeparator = (el: DSAutocompleteT.OptionTypes | undefined): el is DSAutocompleteT.ItemSeparatorOptions =>\n el?.type === 'separator';\n\nexport const StyledA11ySelectedValues = styled.span`\n width: 1px;\n height: 1px;\n position: absolute;\n clip: rect(1px, 1px, 1px, 1px);\n`;\n\nexport const A11yFocusedOption: React.ComponentType = () => {\n const {\n props: { options },\n focusOptionIdx,\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport AutocompleteContext from '../AutocompleteCTX.js';\nimport { getSelectableOptions } from '../utils/listHelper.js';\nimport type { DSAutocompleteT } from '../react-desc-prop-types.js';\nexport const isSeparator = (el: DSAutocompleteT.OptionTypes | undefined): el is DSAutocompleteT.ItemSeparatorOptions =>\n el?.type === 'separator';\n\nexport const StyledA11ySelectedValues = styled.span`\n width: 1px;\n height: 1px;\n position: absolute;\n clip: rect(1px, 1px, 1px, 1px);\n`;\n\nexport const A11yFocusedOption: React.ComponentType = () => {\n const {\n props: { options },\n focusOptionIdx,\n isShowingPopover,\n } = useContext(AutocompleteContext);\n\n return useMemo(() => {\n const selectabledOptions = getSelectableOptions(options);\n const focusOption = options.find((option) => !isSeparator(option) && option.dsId === focusOptionIdx);\n const focusSelectableOptionIdx = selectabledOptions.findIndex((option) => option.dsId === focusOptionIdx);\n\n return (\n <StyledA11ySelectedValues aria-live=\"polite\">\n {!isSeparator(focusOption) &&\n isShowingPopover &&\n focusOption &&\n `option ${focusOption.label} focused.${focusSelectableOptionIdx + 1} of ${selectabledOptions.length}\n `}\n </StyledA11ySelectedValues>\n );\n }, [options, isShowingPopover, focusOptionIdx]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4BjB;AA5BN,mBAA2C;AAC3C,uBAAuB;AACvB,6BAAgC;AAChC,wBAAqC;AAE9B,MAAM,cAAc,CAAC,OAC1B,IAAI,SAAS;AAER,MAAM,2BAA2B,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOxC,MAAM,oBAAyC,MAAM;AAC1D,QAAM;AAAA,IACJ,OAAO,EAAE,QAAQ;AAAA,IACjB;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,uBAAAA,OAAmB;AAElC,aAAO,sBAAQ,MAAM;AACnB,UAAM,yBAAqB,wCAAqB,OAAO;AACvD,UAAM,cAAc,QAAQ,KAAK,CAAC,WAAW,CAAC,YAAY,MAAM,KAAK,OAAO,SAAS,cAAc;AACnG,UAAM,2BAA2B,mBAAmB,UAAU,CAAC,WAAW,OAAO,SAAS,cAAc;AAExG,WACE,4CAAC,4BAAyB,aAAU,UACjC,WAAC,YAAY,WAAW,KACvB,oBACA,eACA,UAAU,YAAY,iBAAiB,2BAA2B,QAAQ,mBAAmB;AAAA,cAEjG;AAAA,EAEJ,GAAG,CAAC,SAAS,kBAAkB,cAAc,CAAC;AAChD;",
|
|
6
6
|
"names": ["AutocompleteContext"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -31,37 +35,36 @@ var React = __toESM(require("react"));
|
|
|
31
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
36
|
var import_react = __toESM(require("react"));
|
|
33
37
|
var import_ds_popperjs = require("@elliemae/ds-popperjs");
|
|
34
|
-
var import_AutocompleteCTX = __toESM(require("../../AutocompleteCTX"));
|
|
35
|
-
var import_styled = require("./styled");
|
|
36
|
-
var import_menu_list = require("../menu-list");
|
|
37
|
-
var import_useKeyboardNavigation = require("./useKeyboardNavigation");
|
|
38
|
-
var import_AutocompleteDataTestids = require("../../AutocompleteDataTestids");
|
|
39
|
-
var import_A11yFocusedOption = require("../A11yFocusedOption");
|
|
38
|
+
var import_AutocompleteCTX = __toESM(require("../../AutocompleteCTX.js"));
|
|
39
|
+
var import_styled = require("./styled.js");
|
|
40
|
+
var import_menu_list = require("../menu-list/index.js");
|
|
41
|
+
var import_useKeyboardNavigation = require("./useKeyboardNavigation.js");
|
|
42
|
+
var import_AutocompleteDataTestids = require("../../AutocompleteDataTestids.js");
|
|
43
|
+
var import_A11yFocusedOption = require("../A11yFocusedOption.js");
|
|
40
44
|
const Container = () => {
|
|
41
45
|
const {
|
|
42
46
|
props: { id, startPlacementPreference, children, filter, placementOrderPreference },
|
|
43
|
-
|
|
47
|
+
isShowingPopover,
|
|
44
48
|
setReferenceElement,
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
setUserJustSelectedAnOption,
|
|
50
|
+
setUserTypedSomething,
|
|
51
|
+
setUserIsNavigatingWithArrows,
|
|
52
|
+
setForceClosePopover,
|
|
53
|
+
autoCompleteId,
|
|
47
54
|
referenceElement
|
|
48
55
|
} = (0, import_react.useContext)(import_AutocompleteCTX.default);
|
|
49
|
-
(0, import_react.useEffect)(() => {
|
|
50
|
-
const closePopper = () => {
|
|
51
|
-
setShowPopover(false);
|
|
52
|
-
};
|
|
53
|
-
window.addEventListener("blur", closePopper);
|
|
54
|
-
return () => {
|
|
55
|
-
window.removeEventListener("blur", closePopper);
|
|
56
|
-
};
|
|
57
|
-
}, [setShowPopover]);
|
|
58
56
|
const handleCloseMenu = (0, import_react.useCallback)(() => {
|
|
59
|
-
|
|
60
|
-
}, [
|
|
57
|
+
setForceClosePopover(true);
|
|
58
|
+
}, [setForceClosePopover]);
|
|
61
59
|
const { onInputKeyDown } = (0, import_useKeyboardNavigation.useKeyboardNavigation)();
|
|
62
60
|
const input = import_react.default.Children.only(children);
|
|
63
|
-
const childrenWithProps = import_react.default.isValidElement(input) ? import_react.default.cloneElement(input, { "aria-activedescendant": focusOptionIdx }) : input;
|
|
64
61
|
const idList = (0, import_react.useMemo)(() => `${id ? `${id}-` : ""}listbox`, [id]);
|
|
62
|
+
const onFocusPopoverStatusSync = (0, import_react.useCallback)(() => {
|
|
63
|
+
setForceClosePopover(false);
|
|
64
|
+
setUserJustSelectedAnOption(false);
|
|
65
|
+
setUserTypedSomething(false);
|
|
66
|
+
setUserIsNavigatingWithArrows(false);
|
|
67
|
+
}, [setForceClosePopover, setUserIsNavigatingWithArrows, setUserJustSelectedAnOption, setUserTypedSomething]);
|
|
65
68
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
66
69
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_A11yFocusedOption.A11yFocusedOption, {}),
|
|
67
70
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -71,21 +74,22 @@ const Container = () => {
|
|
|
71
74
|
ref: setReferenceElement,
|
|
72
75
|
role: "combobox",
|
|
73
76
|
"aria-autocomplete": "list",
|
|
74
|
-
"aria-controls":
|
|
75
|
-
"aria-expanded":
|
|
77
|
+
"aria-controls": `menu-list-${autoCompleteId}`,
|
|
78
|
+
"aria-expanded": isShowingPopover,
|
|
76
79
|
"aria-haspopup": "listbox",
|
|
77
80
|
"aria-owns": idList,
|
|
78
81
|
onKeyDown: onInputKeyDown,
|
|
82
|
+
onFocus: onFocusPopoverStatusSync,
|
|
79
83
|
"data-testid": import_AutocompleteDataTestids.AutocompleteDataTestid.CONTAINER,
|
|
80
84
|
children: [
|
|
81
|
-
|
|
85
|
+
input,
|
|
82
86
|
filter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
87
|
import_ds_popperjs.DSPopperJS,
|
|
84
88
|
{
|
|
85
89
|
customOffset: [0, 5],
|
|
86
90
|
closeContextMenu: handleCloseMenu,
|
|
87
91
|
referenceElement,
|
|
88
|
-
showPopover,
|
|
92
|
+
showPopover: isShowingPopover,
|
|
89
93
|
startPlacementPreference,
|
|
90
94
|
placementOrderPreference,
|
|
91
95
|
withoutPortal: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/container/Container.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useCallback, useMemo,
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useCallback, useMemo, useContext } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport AutocompleteContext from '../../AutocompleteCTX.js';\nimport { StyledContainer, StyledPopperWrapper } from './styled.js';\nimport { MenuList } from '../menu-list/index.js';\nimport { useKeyboardNavigation } from './useKeyboardNavigation.js';\nimport { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';\nimport { A11yFocusedOption } from '../A11yFocusedOption.js';\nexport const Container = (): JSX.Element => {\n const {\n props: { id, startPlacementPreference, children, filter, placementOrderPreference },\n isShowingPopover,\n setReferenceElement,\n setUserJustSelectedAnOption,\n setUserTypedSomething,\n setUserIsNavigatingWithArrows,\n setForceClosePopover,\n autoCompleteId,\n referenceElement,\n } = useContext(AutocompleteContext);\n\n const handleCloseMenu = useCallback(() => {\n setForceClosePopover(true);\n }, [setForceClosePopover]);\n\n const { onInputKeyDown } = useKeyboardNavigation();\n\n const input = React.Children.only(children);\n\n const idList = useMemo(() => `${id ? `${id}-` : ''}listbox`, [id]);\n\n const onFocusPopoverStatusSync = useCallback(() => {\n setForceClosePopover(false);\n setUserJustSelectedAnOption(false);\n setUserTypedSomething(false);\n setUserIsNavigatingWithArrows(false);\n }, [setForceClosePopover, setUserIsNavigatingWithArrows, setUserJustSelectedAnOption, setUserTypedSomething]);\n\n return (\n <>\n <A11yFocusedOption />\n\n <StyledContainer\n id={id}\n ref={setReferenceElement}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-controls={`menu-list-${autoCompleteId}`}\n aria-expanded={isShowingPopover}\n aria-haspopup=\"listbox\"\n aria-owns={idList}\n onKeyDown={onInputKeyDown}\n onFocus={onFocusPopoverStatusSync}\n data-testid={AutocompleteDataTestid.CONTAINER}\n >\n {input}\n {filter && (\n <DSPopperJS\n customOffset={[0, 5]}\n closeContextMenu={handleCloseMenu}\n referenceElement={referenceElement}\n showPopover={isShowingPopover}\n startPlacementPreference={startPlacementPreference}\n placementOrderPreference={placementOrderPreference}\n withoutPortal\n withoutArrow\n withoutAnimation\n zIndex={10}\n >\n <StyledPopperWrapper tabIndex={-1}>\n <MenuList />\n </StyledPopperWrapper>\n </DSPopperJS>\n )}\n </StyledContainer>\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwCnB;AAvCJ,mBAAwD;AACxD,yBAA2B;AAC3B,6BAAgC;AAChC,oBAAqD;AACrD,uBAAyB;AACzB,mCAAsC;AACtC,qCAAuC;AACvC,+BAAkC;AAC3B,MAAM,YAAY,MAAmB;AAC1C,QAAM;AAAA,IACJ,OAAO,EAAE,IAAI,0BAA0B,UAAU,QAAQ,yBAAyB;AAAA,IAClF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,uBAAAA,OAAmB;AAElC,QAAM,sBAAkB,0BAAY,MAAM;AACxC,yBAAqB,IAAI;AAAA,EAC3B,GAAG,CAAC,oBAAoB,CAAC;AAEzB,QAAM,EAAE,eAAe,QAAI,oDAAsB;AAEjD,QAAM,QAAQ,aAAAC,QAAM,SAAS,KAAK,QAAQ;AAE1C,QAAM,aAAS,sBAAQ,MAAM,GAAG,KAAK,GAAG,QAAQ,aAAa,CAAC,EAAE,CAAC;AAEjE,QAAM,+BAA2B,0BAAY,MAAM;AACjD,yBAAqB,KAAK;AAC1B,gCAA4B,KAAK;AACjC,0BAAsB,KAAK;AAC3B,kCAA8B,KAAK;AAAA,EACrC,GAAG,CAAC,sBAAsB,+BAA+B,6BAA6B,qBAAqB,CAAC;AAE5G,SACE,4EACE;AAAA,gDAAC,8CAAkB;AAAA,IAEnB;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,KAAK;AAAA,QACL,MAAK;AAAA,QACL,qBAAkB;AAAA,QAClB,iBAAe,aAAa;AAAA,QAC5B,iBAAe;AAAA,QACf,iBAAc;AAAA,QACd,aAAW;AAAA,QACX,WAAW;AAAA,QACX,SAAS;AAAA,QACT,eAAa,sDAAuB;AAAA,QAEnC;AAAA;AAAA,UACA,UACC;AAAA,YAAC;AAAA;AAAA,cACC,cAAc,CAAC,GAAG,CAAC;AAAA,cACnB,kBAAkB;AAAA,cAClB;AAAA,cACA,aAAa;AAAA,cACb;AAAA,cACA;AAAA,cACA,eAAa;AAAA,cACb,cAAY;AAAA,cACZ,kBAAgB;AAAA,cAChB,QAAQ;AAAA,cAER,sDAAC,qCAAoB,UAAU,IAC7B,sDAAC,6BAAS,GACZ;AAAA;AAAA,UACF;AAAA;AAAA;AAAA,IAEJ;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": ["AutocompleteContext", "React"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -28,5 +32,5 @@ __export(container_exports, {
|
|
|
28
32
|
});
|
|
29
33
|
module.exports = __toCommonJS(container_exports);
|
|
30
34
|
var React = __toESM(require("react"));
|
|
31
|
-
var import_Container = require("./Container");
|
|
35
|
+
var import_Container = require("./Container.js");
|
|
32
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/container/index.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export { Container } from './Container';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export { Container } from './Container.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA0B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/container/styled.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\n\nexport const StyledContainer = styled.div`\n width: 100%;\n height: 28px;\n position: relative;\n`;\n\nexport const StyledPopperWrapper = styled.div`\n background: #fff;\n overflow: auto;\n position: relative;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AAEhB,MAAM,kBAAkB,wBAAO;AAAA;AAAA;AAAA;AAAA;AAM/B,MAAM,sBAAsB,wBAAO;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -29,14 +33,15 @@ __export(useKeyboardNavigation_exports, {
|
|
|
29
33
|
module.exports = __toCommonJS(useKeyboardNavigation_exports);
|
|
30
34
|
var React = __toESM(require("react"));
|
|
31
35
|
var import_react = require("react");
|
|
32
|
-
var import_AutocompleteCTX = __toESM(require("../../AutocompleteCTX"));
|
|
33
|
-
var import_listHelper = require("../../utils/listHelper");
|
|
36
|
+
var import_AutocompleteCTX = __toESM(require("../../AutocompleteCTX.js"));
|
|
37
|
+
var import_listHelper = require("../../utils/listHelper.js");
|
|
34
38
|
const isOptionFocuseable = (opt) => !["section", "separator"].includes(opt.type);
|
|
35
39
|
const useKeyboardNavigation = () => {
|
|
36
40
|
const {
|
|
37
41
|
props: { onSelect, options },
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
trackUserInteractingViaKeyboard,
|
|
43
|
+
setForceClosePopover,
|
|
44
|
+
isShowingPopover,
|
|
40
45
|
focusOptionIdx,
|
|
41
46
|
setCurrentOption,
|
|
42
47
|
scrollOptionIntoView
|
|
@@ -47,18 +52,16 @@ const useKeyboardNavigation = () => {
|
|
|
47
52
|
);
|
|
48
53
|
const onInputKeyDown = (0, import_react.useCallback)(
|
|
49
54
|
(e) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (e.key === "Enter" && showPopover) {
|
|
55
|
+
trackUserInteractingViaKeyboard(e);
|
|
56
|
+
if (e.key === "Tab" || e.key === "Escape")
|
|
57
|
+
setForceClosePopover(true);
|
|
58
|
+
if (e.key === "Enter" && isShowingPopover) {
|
|
55
59
|
e.preventDefault();
|
|
56
60
|
onSelect(currentItem?.label, e);
|
|
57
|
-
setShowPopover(false);
|
|
58
61
|
}
|
|
59
62
|
if (e.key === "ArrowDown") {
|
|
60
63
|
e.preventDefault();
|
|
61
|
-
if (
|
|
64
|
+
if (isShowingPopover) {
|
|
62
65
|
const nextItemIndex = (0, import_listHelper.findInCircularList)(options, currentItemIndex, isOptionFocuseable);
|
|
63
66
|
setCurrentOption(options[nextItemIndex].dsId);
|
|
64
67
|
scrollOptionIntoView(options[nextItemIndex].dsId);
|
|
@@ -66,25 +69,23 @@ const useKeyboardNavigation = () => {
|
|
|
66
69
|
}
|
|
67
70
|
if (e.key === "ArrowUp") {
|
|
68
71
|
e.preventDefault();
|
|
69
|
-
if (
|
|
72
|
+
if (isShowingPopover) {
|
|
70
73
|
const nextItemIndex = (0, import_listHelper.findInCircularList)(options, currentItemIndex, isOptionFocuseable, -1);
|
|
71
74
|
setCurrentOption(options[nextItemIndex].dsId);
|
|
72
75
|
scrollOptionIntoView(options[nextItemIndex].dsId);
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
|
-
if (e.key === "Escape") {
|
|
76
|
-
setShowPopover(false);
|
|
77
|
-
}
|
|
78
78
|
},
|
|
79
79
|
[
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
trackUserInteractingViaKeyboard,
|
|
81
|
+
setForceClosePopover,
|
|
82
|
+
isShowingPopover,
|
|
82
83
|
onSelect,
|
|
84
|
+
currentItem?.label,
|
|
83
85
|
options,
|
|
84
|
-
|
|
86
|
+
currentItemIndex,
|
|
85
87
|
setCurrentOption,
|
|
86
|
-
|
|
87
|
-
showPopover
|
|
88
|
+
scrollOptionIntoView
|
|
88
89
|
]
|
|
89
90
|
);
|
|
90
91
|
return { onInputKeyDown };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/container/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 type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport type { DSAutocompleteT } from '../../react-desc-prop-types';\nimport AutocompleteContext from '../../AutocompleteCTX';\nimport { findInCircularList } from '../../utils/listHelper';\n\nconst isOptionFocuseable = (opt: DSAutocompleteT.OptionTypes): boolean => !['section', 'separator'].includes(opt.type);\n\nexport const useKeyboardNavigation = () => {\n const {\n props: { onSelect, options },\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-depth */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport type { DSAutocompleteT } from '../../react-desc-prop-types.js';\nimport AutocompleteContext from '../../AutocompleteCTX.js';\nimport { findInCircularList } from '../../utils/listHelper.js';\n\nconst isOptionFocuseable = (opt: DSAutocompleteT.OptionTypes): boolean => !['section', 'separator'].includes(opt.type);\n\nexport const useKeyboardNavigation = () => {\n const {\n props: { onSelect, options },\n trackUserInteractingViaKeyboard,\n setForceClosePopover,\n isShowingPopover,\n focusOptionIdx,\n setCurrentOption,\n scrollOptionIntoView,\n } = useContext(AutocompleteContext);\n\n const currentItemIndex = options.findIndex((opt) => opt.dsId === focusOptionIdx);\n const currentItem = options.find(\n (item) => item.type === 'option' && item.dsId === focusOptionIdx,\n ) as DSAutocompleteT.ItemOption;\n\n const onInputKeyDown: React.KeyboardEventHandler<HTMLInputElement> = useCallback(\n (e) => {\n // =============================================================================\n // TRACK STATE OF POPOVER SHOWING OR NOT\n // =============================================================================\n trackUserInteractingViaKeyboard(e);\n\n if (e.key === 'Tab' || e.key === 'Escape') setForceClosePopover(true);\n\n // =============================================================================\n // ENTER AND SPACE KEY SELECT OPTIONS AND OPEN CLOSE THE POPOVER\n // =============================================================================\n if (e.key === 'Enter' && isShowingPopover) {\n e.preventDefault();\n onSelect(currentItem?.label, e);\n }\n\n // =============================================================================\n // ARROWS UP AND DOWN\n // =============================================================================\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n if (isShowingPopover) {\n const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable);\n setCurrentOption(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n }\n }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n if (isShowingPopover) {\n const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable, -1);\n setCurrentOption(options[nextItemIndex].dsId);\n scrollOptionIntoView(options[nextItemIndex].dsId);\n }\n }\n },\n [\n trackUserInteractingViaKeyboard,\n setForceClosePopover,\n isShowingPopover,\n onSelect,\n currentItem?.label,\n options,\n currentItemIndex,\n setCurrentOption,\n scrollOptionIntoView,\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;ADKvB,mBAAwC;AAExC,6BAAgC;AAChC,wBAAmC;AAEnC,MAAM,qBAAqB,CAAC,QAA8C,CAAC,CAAC,WAAW,WAAW,EAAE,SAAS,IAAI,IAAI;AAE9G,MAAM,wBAAwB,MAAM;AACzC,QAAM;AAAA,IACJ,OAAO,EAAE,UAAU,QAAQ;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,uBAAAA,OAAmB;AAElC,QAAM,mBAAmB,QAAQ,UAAU,CAAC,QAAQ,IAAI,SAAS,cAAc;AAC/E,QAAM,cAAc,QAAQ;AAAA,IAC1B,CAAC,SAAS,KAAK,SAAS,YAAY,KAAK,SAAS;AAAA,EACpD;AAEA,QAAM,qBAA+D;AAAA,IACnE,CAAC,MAAM;AAIL,sCAAgC,CAAC;AAEjC,UAAI,EAAE,QAAQ,SAAS,EAAE,QAAQ;AAAU,6BAAqB,IAAI;AAKpE,UAAI,EAAE,QAAQ,WAAW,kBAAkB;AACzC,UAAE,eAAe;AACjB,iBAAS,aAAa,OAAO,CAAC;AAAA,MAChC;AAKA,UAAI,EAAE,QAAQ,aAAa;AACzB,UAAE,eAAe;AACjB,YAAI,kBAAkB;AACpB,gBAAM,oBAAgB,sCAAmB,SAAS,kBAAkB,kBAAkB;AACtF,2BAAiB,QAAQ,aAAa,EAAE,IAAI;AAC5C,+BAAqB,QAAQ,aAAa,EAAE,IAAI;AAAA,QAClD;AAAA,MACF;AACA,UAAI,EAAE,QAAQ,WAAW;AACvB,UAAE,eAAe;AACjB,YAAI,kBAAkB;AACpB,gBAAM,oBAAgB,sCAAmB,SAAS,kBAAkB,oBAAoB,EAAE;AAC1F,2BAAiB,QAAQ,aAAa,EAAE,IAAI;AAC5C,+BAAqB,QAAQ,aAAa,EAAE,IAAI;AAAA,QAClD;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,eAAe;AAC1B;",
|
|
6
6
|
"names": ["AutocompleteContext"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -30,17 +34,18 @@ module.exports = __toCommonJS(MenuList_exports);
|
|
|
30
34
|
var React = __toESM(require("react"));
|
|
31
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
36
|
var import_react = require("react");
|
|
33
|
-
var import_styled = require("./styled");
|
|
34
|
-
var import_AutocompleteDataTestids = require("../../AutocompleteDataTestids");
|
|
35
|
-
var import_AutocompleteCTX = __toESM(require("../../AutocompleteCTX"));
|
|
36
|
-
var import_useItemRenderer = require("./useItemRenderer");
|
|
37
|
+
var import_styled = require("./styled.js");
|
|
38
|
+
var import_AutocompleteDataTestids = require("../../AutocompleteDataTestids.js");
|
|
39
|
+
var import_AutocompleteCTX = __toESM(require("../../AutocompleteCTX.js"));
|
|
40
|
+
var import_useItemRenderer = require("./useItemRenderer.js");
|
|
37
41
|
const MenuList = () => {
|
|
38
42
|
const {
|
|
39
43
|
props: { options, id },
|
|
40
44
|
referenceElement,
|
|
41
45
|
inputRef,
|
|
42
46
|
listRef,
|
|
43
|
-
|
|
47
|
+
autoCompleteId,
|
|
48
|
+
isShowingPopover,
|
|
44
49
|
virtualListHelpers: { totalSize }
|
|
45
50
|
} = (0, import_react.useContext)(import_AutocompleteCTX.default);
|
|
46
51
|
const ItemRenderer = (0, import_useItemRenderer.useItemRenderer)();
|
|
@@ -48,26 +53,21 @@ const MenuList = () => {
|
|
|
48
53
|
inputRef.current?.focus();
|
|
49
54
|
}, [inputRef]);
|
|
50
55
|
const idList = (0, import_react.useMemo)(() => `${id ? `${id}-` : ""}listbox`, [id]);
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
const preventMouseDown = (0, import_react.useCallback)((e) => {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
}, []);
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledListWrapper, { onMouseDown: preventMouseDown, minWidth: referenceElement?.offsetWidth, id: idList, children: options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledVirtualListWrapper, { tabIndex: -1, ref: listRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
import_styled.StyledList,
|
|
53
61
|
{
|
|
54
|
-
tabIndex: -1,
|
|
55
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
56
|
-
minWidth: referenceElement?.offsetWidth,
|
|
57
|
-
id: idList,
|
|
58
62
|
role: "listbox",
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
style: { height: totalSize, margin: "8px 0px" },
|
|
67
|
-
children: ItemRenderer
|
|
68
|
-
}
|
|
69
|
-
) })
|
|
63
|
+
id: `menu-list-${autoCompleteId}`,
|
|
64
|
+
"aria-label": "autocomplete option lists",
|
|
65
|
+
"aria-expanded": isShowingPopover,
|
|
66
|
+
onFocus: handleOnFocus,
|
|
67
|
+
"data-testid": import_AutocompleteDataTestids.AutocompleteDataTestid.LIST,
|
|
68
|
+
style: { height: totalSize, margin: "8px 0px" },
|
|
69
|
+
children: ItemRenderer
|
|
70
70
|
}
|
|
71
|
-
);
|
|
71
|
+
) }) });
|
|
72
72
|
};
|
|
73
73
|
//# sourceMappingURL=MenuList.js.map
|
|
@@ -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 } from 'react';\nimport { StyledListWrapper, StyledList, StyledVirtualListWrapper } from './styled';\nimport { AutocompleteDataTestid } from '../../AutocompleteDataTestids';\nimport AutocompleteContext from '../../AutocompleteCTX';\nimport { useItemRenderer } from './useItemRenderer';\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo, useCallback } from 'react';\nimport { StyledListWrapper, StyledList, StyledVirtualListWrapper } from './styled.js';\nimport { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';\nimport AutocompleteContext from '../../AutocompleteCTX.js';\nimport { useItemRenderer } from './useItemRenderer.js';\n\nexport const MenuList = (): JSX.Element => {\n const {\n props: { options, id },\n referenceElement,\n inputRef,\n listRef,\n autoCompleteId,\n isShowingPopover,\n virtualListHelpers: { totalSize },\n } = useContext(AutocompleteContext);\n\n const ItemRenderer = useItemRenderer();\n\n const handleOnFocus = useCallback(() => {\n inputRef.current?.focus();\n }, [inputRef]);\n\n const idList = useMemo(() => `${id ? `${id}-` : ''}listbox`, [id]);\n const preventMouseDown: React.MouseEventHandler<HTMLDivElement> = useCallback((e) => {\n e.preventDefault();\n }, []);\n\n return (\n <StyledListWrapper onMouseDown={preventMouseDown} minWidth={referenceElement?.offsetWidth} id={idList}>\n {options.length > 0 && (\n <StyledVirtualListWrapper tabIndex={-1} ref={listRef}>\n <StyledList\n role=\"listbox\"\n id={`menu-list-${autoCompleteId}`}\n // default aria label until we integrate the aria props on autocomplete\n // this is for the axe core to pass\n aria-label=\"autocomplete option lists\"\n aria-expanded={isShowingPopover}\n onFocus={handleOnFocus}\n data-testid={AutocompleteDataTestid.LIST}\n style={{ height: totalSize, margin: '8px 0px' }}\n >\n {ItemRenderer}\n </StyledList>\n </StyledVirtualListWrapper>\n )}\n </StyledListWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgCb;AAhCV,mBAAwD;AACxD,oBAAwE;AACxE,qCAAuC;AACvC,6BAAgC;AAChC,6BAAgC;AAEzB,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS,GAAG;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB,EAAE,UAAU;AAAA,EAClC,QAAI,yBAAW,uBAAAA,OAAmB;AAElC,QAAM,mBAAe,wCAAgB;AAErC,QAAM,oBAAgB,0BAAY,MAAM;AACtC,aAAS,SAAS,MAAM;AAAA,EAC1B,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,aAAS,sBAAQ,MAAM,GAAG,KAAK,GAAG,QAAQ,aAAa,CAAC,EAAE,CAAC;AACjE,QAAM,uBAA4D,0BAAY,CAAC,MAAM;AACnF,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,SACE,4CAAC,mCAAkB,aAAa,kBAAkB,UAAU,kBAAkB,aAAa,IAAI,QAC5F,kBAAQ,SAAS,KAChB,4CAAC,0CAAyB,UAAU,IAAI,KAAK,SAC3C;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,IAAI,aAAa;AAAA,MAGjB,cAAW;AAAA,MACX,iBAAe;AAAA,MACf,SAAS;AAAA,MACT,eAAa,sDAAuB;AAAA,MACpC,OAAO,EAAE,QAAQ,WAAW,QAAQ,UAAU;AAAA,MAE7C;AAAA;AAAA,EACH,GACF,GAEJ;AAEJ;",
|
|
6
6
|
"names": ["AutocompleteContext"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -28,5 +32,5 @@ __export(menu_list_exports, {
|
|
|
28
32
|
});
|
|
29
33
|
module.exports = __toCommonJS(menu_list_exports);
|
|
30
34
|
var React = __toESM(require("react"));
|
|
31
|
-
var import_MenuList = require("./MenuList");
|
|
35
|
+
var import_MenuList = require("./MenuList.js");
|
|
32
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/menu-list/index.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export { MenuList } from './MenuList';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export { MenuList } from './MenuList.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,sBAAyB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/menu-list/styled.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\n\nexport const StyledListWrapper = styled.div<{ minWidth?: number | string }>`\n min-width: ${({ minWidth }) => (minWidth ? `${minWidth}px` : '100%')};\n`;\n\nexport const StyledList = styled.ul`\n position: relative;\n padding: 0;\n`;\n\nexport const StyledVirtualListWrapper = styled.div<{\n maxHeight: number;\n}>`\n overflow-y: auto;\n max-height: ${({ maxHeight }) => `${!maxHeight ? '400' : maxHeight}px`};\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AAEhB,MAAM,oBAAoB,wBAAO;AAAA,eACzB,CAAC,EAAE,SAAS,MAAO,WAAW,GAAG,eAAe;AAAA;AAGxD,MAAM,aAAa,wBAAO;AAAA;AAAA;AAAA;AAK1B,MAAM,2BAA2B,wBAAO;AAAA;AAAA,gBAI/B,CAAC,EAAE,UAAU,MAAM,GAAG,CAAC,YAAY,QAAQ;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -31,24 +35,26 @@ var React = __toESM(require("react"));
|
|
|
31
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
36
|
var import_react = require("react");
|
|
33
37
|
var import_ds_menu_items = require("@elliemae/ds-menu-items");
|
|
34
|
-
var import_AutocompleteCTX = __toESM(require("../../AutocompleteCTX"));
|
|
35
|
-
var import_AutocompleteDataTestids = require("../../AutocompleteDataTestids");
|
|
38
|
+
var import_AutocompleteCTX = __toESM(require("../../AutocompleteCTX.js"));
|
|
39
|
+
var import_AutocompleteDataTestids = require("../../AutocompleteDataTestids.js");
|
|
36
40
|
const useItemRenderer = () => {
|
|
37
41
|
const {
|
|
38
42
|
props: { options, onSelect },
|
|
39
43
|
inputRef,
|
|
40
|
-
|
|
44
|
+
setUserTypedSomething,
|
|
45
|
+
setUserJustSelectedAnOption,
|
|
41
46
|
focusOptionIdx,
|
|
42
47
|
virtualListHelpers
|
|
43
48
|
} = (0, import_react.useContext)(import_AutocompleteCTX.default);
|
|
44
49
|
const handleClick = (0, import_react.useCallback)(
|
|
45
50
|
(option, e) => {
|
|
46
51
|
onSelect(option.label, e);
|
|
47
|
-
|
|
52
|
+
setUserJustSelectedAnOption(true);
|
|
53
|
+
setUserTypedSomething(false);
|
|
48
54
|
e.stopPropagation();
|
|
49
55
|
e.preventDefault();
|
|
50
56
|
},
|
|
51
|
-
[onSelect,
|
|
57
|
+
[onSelect, setUserTypedSomething, setUserJustSelectedAnOption]
|
|
52
58
|
);
|
|
53
59
|
return (0, import_react.useMemo)(() => {
|
|
54
60
|
if (virtualListHelpers) {
|
|
@@ -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 react-hooks/exhaustive-deps */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { SingleMenuItem, Section } from '@elliemae/ds-menu-items';\nimport AutocompleteContext from '../../AutocompleteCTX';\nimport { AutocompleteDataTestid } from '../../AutocompleteDataTestids';\nimport type { DSAutocompleteT } from '../../react-desc-prop-types';\n\nexport const useItemRenderer = (): Array<JSX.Element> | null => {\n const {\n props: { options, onSelect },\n inputRef,\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { SingleMenuItem, Section } from '@elliemae/ds-menu-items';\nimport AutocompleteContext from '../../AutocompleteCTX.js';\nimport { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';\nimport type { DSAutocompleteT } from '../../react-desc-prop-types.js';\n\nexport const useItemRenderer = (): Array<JSX.Element> | null => {\n const {\n props: { options, onSelect },\n inputRef,\n setUserTypedSomething,\n setUserJustSelectedAnOption,\n focusOptionIdx,\n virtualListHelpers,\n } = useContext(AutocompleteContext);\n\n const handleClick = useCallback(\n (option: DSAutocompleteT.ItemOption, e: React.MouseEvent<HTMLInputElement>) => {\n onSelect(option.label, e);\n setUserJustSelectedAnOption(true);\n setUserTypedSomething(false);\n e.stopPropagation();\n e.preventDefault();\n },\n [onSelect, setUserTypedSomething, setUserJustSelectedAnOption],\n );\n\n return useMemo(() => {\n if (virtualListHelpers) {\n return virtualListHelpers.virtualItems.map((vItem) => {\n const option = options[vItem.index];\n const generalProps = {\n wrapperStyles: { position: 'absolute', top: vItem.start, left: 0, width: '100%' },\n key: `${option.dsId}`,\n innerRef: vItem.measureRef,\n };\n if (option.type === 'section') {\n return <Section label={option.label} {...generalProps} />;\n }\n if (option.type === 'option') {\n return (\n <SingleMenuItem\n {...generalProps}\n value={option.value}\n label={option.label}\n dataTestid={AutocompleteDataTestid.OPTION}\n disabled={option.disabled}\n onClick={(e: React.MouseEvent<HTMLInputElement>) => handleClick(option, e)}\n isActive={option.dsId === focusOptionIdx}\n />\n );\n }\n return <></>;\n });\n }\n return null;\n }, [options, focusOptionIdx, inputRef, virtualListHelpers]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsCN;AArCjB,mBAAwD;AACxD,2BAAwC;AACxC,6BAAgC;AAChC,qCAAuC;AAGhC,MAAM,kBAAkB,MAAiC;AAC9D,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS,SAAS;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,uBAAAA,OAAmB;AAElC,QAAM,kBAAc;AAAA,IAClB,CAAC,QAAoC,MAA0C;AAC7E,eAAS,OAAO,OAAO,CAAC;AACxB,kCAA4B,IAAI;AAChC,4BAAsB,KAAK;AAC3B,QAAE,gBAAgB;AAClB,QAAE,eAAe;AAAA,IACnB;AAAA,IACA,CAAC,UAAU,uBAAuB,2BAA2B;AAAA,EAC/D;AAEA,aAAO,sBAAQ,MAAM;AACnB,QAAI,oBAAoB;AACtB,aAAO,mBAAmB,aAAa,IAAI,CAAC,UAAU;AACpD,cAAM,SAAS,QAAQ,MAAM,KAAK;AAClC,cAAM,eAAe;AAAA,UACnB,eAAe,EAAE,UAAU,YAAY,KAAK,MAAM,OAAO,MAAM,GAAG,OAAO,OAAO;AAAA,UAChF,KAAK,GAAG,OAAO;AAAA,UACf,UAAU,MAAM;AAAA,QAClB;AACA,YAAI,OAAO,SAAS,WAAW;AAC7B,iBAAO,4CAAC,gCAAQ,OAAO,OAAO,OAAQ,GAAG,cAAc;AAAA,QACzD;AACA,YAAI,OAAO,SAAS,UAAU;AAC5B,iBACE;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,OAAO,OAAO;AAAA,cACd,OAAO,OAAO;AAAA,cACd,YAAY,sDAAuB;AAAA,cACnC,UAAU,OAAO;AAAA,cACjB,SAAS,CAAC,MAA0C,YAAY,QAAQ,CAAC;AAAA,cACzE,UAAU,OAAO,SAAS;AAAA;AAAA,UAC5B;AAAA,QAEJ;AACA,eAAO,2EAAE;AAAA,MACX,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT,GAAG,CAAC,SAAS,gBAAgB,UAAU,kBAAkB,CAAC;AAC5D;",
|
|
6
6
|
"names": ["AutocompleteContext"]
|
|
7
7
|
}
|