@elliemae/ds-form-layout-autocomplete 3.57.0-next.5 → 3.57.0-next.51
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 +2 -2
- package/dist/cjs/Autocomplete.js.map +2 -2
- package/dist/cjs/AutocompleteDataTestids.js +2 -1
- package/dist/cjs/AutocompleteDataTestids.js.map +2 -2
- package/dist/cjs/config/useAutocomplete.js +6 -3
- package/dist/cjs/config/useAutocomplete.js.map +2 -2
- package/dist/cjs/{DSAutocompleteDefinitions.js → constants/index.js} +12 -5
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/package.json +4 -1
- package/dist/cjs/parts/container/Container.js +11 -4
- package/dist/cjs/parts/container/Container.js.map +2 -2
- package/dist/cjs/parts/container/styled.js +5 -1
- package/dist/cjs/parts/container/styled.js.map +2 -2
- package/dist/cjs/parts/menu-list/MenuList.js +2 -0
- package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
- package/dist/cjs/parts/menu-list/styled.js +5 -1
- package/dist/cjs/parts/menu-list/styled.js.map +2 -2
- package/dist/cjs/parts/menu-list/useItemRenderer.js +14 -4
- package/dist/cjs/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/esm/Autocomplete.js +1 -1
- package/dist/esm/Autocomplete.js.map +1 -1
- package/dist/esm/AutocompleteDataTestids.js +2 -1
- package/dist/esm/AutocompleteDataTestids.js.map +2 -2
- package/dist/esm/config/useAutocomplete.js +5 -2
- package/dist/esm/config/useAutocomplete.js.map +2 -2
- package/dist/esm/constants/index.js +13 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/package.json +4 -1
- package/dist/esm/parts/container/Container.js +11 -4
- package/dist/esm/parts/container/Container.js.map +2 -2
- package/dist/esm/parts/container/styled.js +5 -1
- package/dist/esm/parts/container/styled.js.map +2 -2
- package/dist/esm/parts/menu-list/MenuList.js +2 -0
- package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
- package/dist/esm/parts/menu-list/styled.js +5 -1
- package/dist/esm/parts/menu-list/styled.js.map +2 -2
- package/dist/esm/parts/menu-list/useItemRenderer.js +14 -4
- package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/types/AutocompleteDataTestids.d.ts +1 -0
- package/dist/types/config/useAutocomplete.d.ts +1 -0
- package/dist/types/constants/index.d.ts +7 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/parts/menu-list/styled.d.ts +1 -1
- package/dist/types/tests/autocomplete.keyboard.test.d.ts +1 -0
- package/dist/types/tests/autocomplete.renderInput.test.d.ts +1 -0
- package/dist/types/tests/autocomplete.withSections.test.d.ts +1 -0
- package/package.json +34 -33
- package/dist/cjs/DSAutocompleteDefinitions.js.map +0 -7
- package/dist/esm/DSAutocompleteDefinitions.js +0 -6
- package/dist/esm/DSAutocompleteDefinitions.js.map +0 -7
- package/dist/types/DSAutocompleteDefinitions.d.ts +0 -1
- /package/dist/types/tests/{a11y/axe.test.d.ts → autocomplete.a11y.test.d.ts} +0 -0
- /package/dist/types/tests/{general.test.d.ts → autocomplete.data-testid.test.d.ts} +0 -0
- /package/dist/types/tests/{keyboard-interactions/composition-keyboard-interactions.test.d.ts → autocomplete.events.test.d.ts} +0 -0
- /package/dist/types/tests/{renderInput.test.d.ts → autocomplete.exports.test.d.ts} +0 -0
- /package/dist/types/tests/{withSections.test.d.ts → autocomplete.get-owner-props.test.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useAutocomplete.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { cloneDeep } from 'lodash-es';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,8BAA8B,sCAAsC;AAC7E,SAAS,iBAAiB;AAC1B,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useMemo, useState } from 'react';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { cloneDeep } from 'lodash-es';\nimport { uid } from 'uid';\nimport { DSAutocompleteName } from '../constants/index.js';\nimport type { DSAutocompleteT } from '../react-desc-prop-types.js';\nimport { DSAutocompletePropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { usePopoverLogic } from './usePopoverLogic.js';\nimport { useRefs } from './useRefs.js';\nimport { useVirtualization } from './useVirtualization.js';\n\nexport type AutocompleteContextT = ReturnType<typeof useRefs> &\n ReturnType<typeof useVirtualization> &\n ReturnType<typeof usePopoverLogic> & {\n props: DSAutocompleteT.InternalProps;\n referenceElement: HTMLElement | null;\n focusOptionIdx: string;\n autoCompleteId: string;\n optionsPerSection: DSAutocompleteT.InternalProps['options'];\n setCurrentOption: React.Dispatch<React.SetStateAction<string>>;\n setReferenceElement: React.Dispatch<React.SetStateAction<HTMLElement | null>>;\n getOwnerProps: () => DSAutocompleteT.InternalProps;\n };\n\nexport const useAutocomplete = (propsFromUser: DSAutocompleteT.Props): AutocompleteContextT => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSAutocompleteT.InternalProps>(propsFromUser, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSAutocompletePropTypes, DSAutocompleteName);\n\n const { options } = propsWithDefault;\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n const [focusOptionIdx, setCurrentOption] = useState<string>('');\n\n const references = useRefs();\n\n const getOwnerProps = useCallback(() => propsWithDefault, [propsWithDefault]);\n\n // Why are we cloning the options?\n // TODO - confirm, is this to solve the \"redux\" frozen object issue?\n // if yes, why do we need to mutate the options in the first place?\n const clonedOptions = useMemo(() => cloneDeep(options), [options]);\n\n // we need to group the options by sections to render them in the correct HTML sementic order\n const optionsPerSection = useMemo(() => {\n const result: DSAutocompleteT.OptionTypes[] = [];\n let currentSection: DSAutocompleteT.ItemSectionOptions | null = null;\n\n clonedOptions.forEach((item) => {\n if (item.type === 'section') {\n // Start a new section\n currentSection = {\n dsId: item.dsId,\n type: item.type,\n label: item.label,\n options: [],\n };\n result.push(currentSection);\n } else if (item.type === 'option' && currentSection) {\n // Add option to the current section's options array\n currentSection.options.push(item);\n } else if (item.type === 'option') {\n // If we encounter an option without a section, push it to the result array\n result.push(item);\n }\n });\n return result;\n }, [clonedOptions]);\n\n const virtualizationManager = useVirtualization({\n references,\n options: optionsPerSection,\n });\n\n const autoCompleteId = useMemo(() => uid(4), []);\n const popoverManager = usePopoverLogic(propsWithDefault, setCurrentOption);\n\n const ctx = useMemo(\n () => ({\n props: propsWithDefault,\n referenceElement,\n focusOptionIdx,\n setCurrentOption,\n setReferenceElement,\n autoCompleteId,\n optionsPerSection,\n getOwnerProps,\n ...references,\n ...popoverManager,\n ...virtualizationManager,\n }),\n [\n propsWithDefault,\n autoCompleteId,\n referenceElement,\n focusOptionIdx,\n popoverManager,\n references,\n getOwnerProps,\n virtualizationManager,\n optionsPerSection,\n ],\n );\n\n return ctx;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,SAAS,gBAAgB;AAC/C,SAAS,8BAA8B,sCAAsC;AAC7E,SAAS,iBAAiB;AAC1B,SAAS,WAAW;AACpB,SAAS,0BAA0B;AAEnC,SAAS,yBAAyB,oBAAoB;AACtD,SAAS,uBAAuB;AAChC,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAe3B,MAAM,kBAAkB,CAAC,kBAA+D;AAI7F,QAAM,mBAAmB,6BAA4D,eAAe,YA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ACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const DSAutocompleteName = "DSAutocomplete";
|
|
3
|
+
const DSAutocompleteSlots = {
|
|
4
|
+
CONTAINER: "container",
|
|
5
|
+
INPUT: "input",
|
|
6
|
+
MENU_LIST: "menu-list",
|
|
7
|
+
OPTION: "option"
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
DSAutocompleteName,
|
|
11
|
+
DSAutocompleteSlots
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSAutocompleteName = 'DSAutocomplete';\n\nexport const DSAutocompleteSlots = {\n CONTAINER: 'container',\n INPUT: 'input',\n MENU_LIST: 'menu-list',\n OPTION: 'option',\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,qBAAqB;AAE3B,MAAM,sBAAsB;AAAA,EACjC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,QAAQ;AACV;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { DSAutocomplete, DSAutocompleteWithSchema } from "./Autocomplete.js";
|
|
3
3
|
import { AutocompleteDataTestid } from "./AutocompleteDataTestids.js";
|
|
4
|
+
import { DSAutocompleteName, DSAutocompleteSlots } from "./constants/index.js";
|
|
4
5
|
export {
|
|
5
6
|
AutocompleteDataTestid,
|
|
6
7
|
DSAutocomplete,
|
|
8
|
+
DSAutocompleteName,
|
|
9
|
+
DSAutocompleteSlots,
|
|
7
10
|
DSAutocompleteWithSchema
|
|
8
11
|
};
|
|
9
12
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSAutocomplete, DSAutocompleteWithSchema } from './Autocomplete.js';\nexport { AutocompleteDataTestid } from './AutocompleteDataTestids.js';\nexport type { DSAutocompleteT } from './react-desc-prop-types.js';\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB,gCAAgC;AACzD,SAAS,8BAA8B;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSAutocomplete, DSAutocompleteWithSchema } from './Autocomplete.js';\nexport { AutocompleteDataTestid } from './AutocompleteDataTestids.js';\nexport type { DSAutocompleteT } from './react-desc-prop-types.js';\nexport { DSAutocompleteName, DSAutocompleteSlots } from './constants/index.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB,gCAAgC;AACzD,SAAS,8BAA8B;AAEvC,SAAS,oBAAoB,2BAA2B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React2, { useCallback, useMemo, useContext } from "react";
|
|
4
|
+
import { styled, mergeRefs } from "@elliemae/ds-system";
|
|
4
5
|
import { DSInputText } from "@elliemae/ds-form-input-text";
|
|
5
6
|
import { useFloatingContext, FloatingWrapper } from "@elliemae/ds-floating-context";
|
|
6
|
-
import { mergeRefs } from "@elliemae/ds-system";
|
|
7
7
|
import { useGetGlobalAttributes, useGetXstyledProps } from "@elliemae/ds-props-helpers";
|
|
8
8
|
import AutocompleteContext from "../../AutocompleteCTX.js";
|
|
9
9
|
import { StyledContainer, StyledPopperWrapper } from "./styled.js";
|
|
@@ -11,6 +11,11 @@ import { MenuList } from "../menu-list/index.js";
|
|
|
11
11
|
import { useKeyboardNavigation } from "./useKeyboardNavigation.js";
|
|
12
12
|
import { AutocompleteDataTestid } from "../../AutocompleteDataTestids.js";
|
|
13
13
|
import { useOnClickOutside } from "../../config/useClickOutside.js";
|
|
14
|
+
import { DSAutocompleteName, DSAutocompleteSlots } from "../../constants/index.js";
|
|
15
|
+
const StyledInputText = styled(DSInputText, {
|
|
16
|
+
name: DSAutocompleteName,
|
|
17
|
+
slot: DSAutocompleteSlots.INPUT
|
|
18
|
+
})``;
|
|
14
19
|
const Container = () => {
|
|
15
20
|
const {
|
|
16
21
|
props: {
|
|
@@ -26,6 +31,7 @@ const Container = () => {
|
|
|
26
31
|
},
|
|
27
32
|
isShowingPopover,
|
|
28
33
|
referenceElement,
|
|
34
|
+
getOwnerProps,
|
|
29
35
|
setReferenceElement,
|
|
30
36
|
setUserJustSelectedAnOption,
|
|
31
37
|
setUserTypedSomething,
|
|
@@ -50,7 +56,6 @@ const Container = () => {
|
|
|
50
56
|
zIndex,
|
|
51
57
|
customOffset: [0, 5],
|
|
52
58
|
handleCloseMenu,
|
|
53
|
-
portalDOMContainer: document.body,
|
|
54
59
|
externallyControlledIsOpen: isShowingPopover
|
|
55
60
|
}),
|
|
56
61
|
[startPlacementPreference, placementOrderPreference, zIndex, handleCloseMenu, isShowingPopover]
|
|
@@ -75,6 +80,7 @@ const Container = () => {
|
|
|
75
80
|
onKeyDown: onInputKeyDown,
|
|
76
81
|
onFocus: onFocusPopoverStatusSync,
|
|
77
82
|
"data-testid": AutocompleteDataTestid.CONTAINER,
|
|
83
|
+
getOwnerProps,
|
|
78
84
|
...globalsAttrs,
|
|
79
85
|
...xStyledProps,
|
|
80
86
|
children: [
|
|
@@ -90,7 +96,7 @@ const Container = () => {
|
|
|
90
96
|
spellCheck: "false",
|
|
91
97
|
...inputProps
|
|
92
98
|
}) || /* @__PURE__ */ jsx(
|
|
93
|
-
|
|
99
|
+
StyledInputText,
|
|
94
100
|
{
|
|
95
101
|
onValueChange,
|
|
96
102
|
value: filter,
|
|
@@ -102,7 +108,8 @@ const Container = () => {
|
|
|
102
108
|
autoComplete: "off",
|
|
103
109
|
autoCorrect: "off",
|
|
104
110
|
spellCheck: "false",
|
|
105
|
-
...inputProps
|
|
111
|
+
...inputProps,
|
|
112
|
+
getOwnerProps
|
|
106
113
|
}
|
|
107
114
|
),
|
|
108
115
|
filter && /* @__PURE__ */ jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/container/Container.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-unused-vars */\n/* eslint-disable complexity */\nimport React, { useCallback, useMemo, useContext } from 'react';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-unused-vars */\n/* eslint-disable complexity */\nimport React, { useCallback, useMemo, useContext } from 'react';\nimport { styled, mergeRefs } from '@elliemae/ds-system';\nimport { DSInputText } from '@elliemae/ds-form-input-text';\nimport { useFloatingContext, FloatingWrapper, type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\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 { useOnClickOutside } from '../../config/useClickOutside.js';\nimport { DSAutocompleteName, DSAutocompleteSlots } from '../../constants/index.js';\n\nconst StyledInputText = styled(DSInputText, {\n name: DSAutocompleteName,\n slot: DSAutocompleteSlots.INPUT,\n})``;\n\nexport const Container = (): JSX.Element => {\n const {\n props: {\n startPlacementPreference,\n onValueChange,\n inputProps,\n children,\n filter,\n placementOrderPreference,\n renderInput,\n zIndex,\n ...restProps\n },\n isShowingPopover,\n referenceElement,\n getOwnerProps,\n setReferenceElement,\n setUserJustSelectedAnOption,\n setUserTypedSomething,\n setUserIsNavigatingWithArrows,\n setForceClosePopover,\n autoCompleteId,\n focusOptionIdx,\n } = useContext(AutocompleteContext);\n\n const handleCloseMenu = useCallback(() => {\n setForceClosePopover(true);\n }, [setForceClosePopover]);\n\n const { onSelect, id, ...globalsAttrs } = useGetGlobalAttributes(restProps);\n const xStyledProps = useGetXstyledProps(restProps);\n const { onInputKeyDown } = useKeyboardNavigation();\n\n const input = !onValueChange && !renderInput ? React.Children.only(children) : null;\n\n const config = useMemo(\n () => ({\n placement: 'bottom' as DSHookFloatingContextT.PopperPlacementsT,\n withoutAnimation: true,\n startPlacementPreference,\n placementOrderPreference,\n zIndex,\n customOffset: [0, 5] as [number, number],\n handleCloseMenu,\n externallyControlledIsOpen: isShowingPopover,\n }),\n [startPlacementPreference, placementOrderPreference, zIndex, handleCloseMenu, isShowingPopover],\n );\n\n const { refs, floatingStyles, context } = useFloatingContext(config);\n\n const autoCompleteRef = mergeRefs(setReferenceElement, refs.setReference);\n\n const hideTooltip = useCallback(() => {\n setForceClosePopover(true);\n }, [setForceClosePopover]);\n\n useOnClickOutside(referenceElement, hideTooltip, refs.floating);\n\n const onFocusPopoverStatusSync = useCallback(() => {\n setForceClosePopover(false);\n setUserJustSelectedAnOption(false);\n setUserTypedSomething(false);\n setUserIsNavigatingWithArrows(false);\n }, [setForceClosePopover, setUserIsNavigatingWithArrows, setUserJustSelectedAnOption, setUserTypedSomething]);\n return (\n <>\n {/* The purpose of this div is to always have the 'menu-list-{autoCompleteId}' present in the DOM */}\n {/* Fix for PUI-11627 */}\n {/* {isShowingPopover === false ? <StyledHiddenDiv id={`menu-list-${autoCompleteId}`} /> : null} */}\n\n <StyledContainer\n id={id}\n innerRef={autoCompleteRef}\n onKeyDown={onInputKeyDown}\n onFocus={onFocusPopoverStatusSync}\n // aria-owns={`menu-list-${autoCompleteId}`}\n data-testid={AutocompleteDataTestid.CONTAINER}\n getOwnerProps={getOwnerProps}\n {...globalsAttrs}\n {...xStyledProps}\n >\n {input ||\n (renderInput &&\n renderInput({\n value: filter,\n role: 'combobox',\n 'aria-expanded': isShowingPopover,\n 'aria-controls': `menu-list-${autoCompleteId}`,\n 'aria-activedescendant': isShowingPopover ? focusOptionIdx : undefined,\n 'aria-autocomplete': 'list',\n autoComplete: 'off',\n autoCorrect: 'off',\n spellCheck: 'false',\n ...inputProps,\n })) || (\n <StyledInputText\n onValueChange={onValueChange}\n value={filter}\n role=\"combobox\"\n aria-expanded={isShowingPopover}\n aria-controls={`menu-list-${autoCompleteId}`}\n aria-activedescendant={isShowingPopover ? focusOptionIdx : undefined}\n aria-autocomplete=\"list\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck=\"false\"\n {...inputProps}\n getOwnerProps={getOwnerProps}\n />\n )}\n {filter && (\n <FloatingWrapper\n innerRef={refs.setFloating}\n floatingStyles={floatingStyles}\n isOpen={isShowingPopover}\n context={context}\n >\n <StyledPopperWrapper tabIndex={-1}>\n <MenuList />\n </StyledPopperWrapper>\n </FloatingWrapper>\n )}\n </StyledContainer>\n </>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACsFnB,mBA8BQ,KAzBN,YALF;AApFJ,OAAOA,UAAS,aAAa,SAAS,kBAAkB;AACxD,SAAS,QAAQ,iBAAi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B,UAAU,IAC7B,8BAAC,YAAS,GACZ;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { styled } from "@elliemae/ds-system";
|
|
3
|
-
|
|
3
|
+
import { DSAutocompleteSlots, DSAutocompleteName } from "../../constants/index.js";
|
|
4
|
+
const StyledContainer = styled("div", {
|
|
5
|
+
name: DSAutocompleteName,
|
|
6
|
+
slot: DSAutocompleteSlots.CONTAINER
|
|
7
|
+
})`
|
|
4
8
|
width: 100%;
|
|
5
9
|
height: 28px;
|
|
6
10
|
position: relative;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/container/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\n\nexport const StyledContainer = styled.
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { DSAutocompleteSlots, DSAutocompleteName } from '../../constants/index.js';\n\nexport const StyledContainer = styled('div', {\n name: DSAutocompleteName,\n slot: DSAutocompleteSlots.CONTAINER,\n})`\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\nexport const StyledHiddenDiv = styled.div`\n display: none;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AACvB,SAAS,qBAAqB,0BAA0B;AAEjD,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAMM,MAAM,sBAAsB,OAAO;AAAA;AAAA;AAAA;AAAA;AAMnC,MAAM,kBAAkB,OAAO;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,6 +13,7 @@ const MenuList = () => {
|
|
|
13
13
|
inputRef,
|
|
14
14
|
listRef,
|
|
15
15
|
autoCompleteId,
|
|
16
|
+
getOwnerProps,
|
|
16
17
|
virtualListHelpers: { totalSize, measure }
|
|
17
18
|
} = useContext(AutocompleteContext);
|
|
18
19
|
const ItemRenderer = useItemRenderer();
|
|
@@ -35,6 +36,7 @@ const MenuList = () => {
|
|
|
35
36
|
onFocus: handleOnFocus,
|
|
36
37
|
"data-testid": AutocompleteDataTestid.LIST,
|
|
37
38
|
style: { height: totalSize, margin: "8px 0px" },
|
|
39
|
+
getOwnerProps,
|
|
38
40
|
children: ItemRenderer
|
|
39
41
|
},
|
|
40
42
|
options.length
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/menu-list/MenuList.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useEffect } from 'react';\nimport { StyledListWrapper, StyledList, StyledVirtualListWrapper } from './styled.js';\nimport { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';\nimport AutocompleteContext from '../../AutocompleteCTX.js';\nimport { useItemRenderer } from './useItemRenderer.js';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\n\nexport const MenuList = (): JSX.Element => {\n const {\n props: { options },\n referenceElement,\n inputRef,\n listRef,\n autoCompleteId,\n virtualListHelpers: { totalSize, measure },\n } = useContext(AutocompleteContext);\n\n const ItemRenderer = useItemRenderer();\n const { width } = useOnElementResize(referenceElement);\n\n const handleOnFocus = useCallback(() => {\n inputRef.current?.focus();\n }, [inputRef]);\n\n const preventMouseDown: React.MouseEventHandler<HTMLDivElement> = useCallback((e) => {\n e.preventDefault();\n }, []);\n\n useEffect(() => {\n if (measure) measure();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [width]);\n\n return (\n <StyledListWrapper onMouseDown={preventMouseDown} minWidth={referenceElement?.offsetWidth}>\n {options.length > 0 && (\n <StyledVirtualListWrapper tabIndex={-1} innerRef={listRef}>\n <StyledList\n // recalculate the key to force the re-render of the list and update virtualization\n key={options.length}\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 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"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useEffect } from 'react';\nimport { StyledListWrapper, StyledList, StyledVirtualListWrapper } from './styled.js';\nimport { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';\nimport AutocompleteContext from '../../AutocompleteCTX.js';\nimport { useItemRenderer } from './useItemRenderer.js';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\n\nexport const MenuList = (): JSX.Element => {\n const {\n props: { options },\n referenceElement,\n inputRef,\n listRef,\n autoCompleteId,\n getOwnerProps,\n virtualListHelpers: { totalSize, measure },\n } = useContext(AutocompleteContext);\n\n const ItemRenderer = useItemRenderer();\n const { width } = useOnElementResize(referenceElement);\n\n const handleOnFocus = useCallback(() => {\n inputRef.current?.focus();\n }, [inputRef]);\n\n const preventMouseDown: React.MouseEventHandler<HTMLDivElement> = useCallback((e) => {\n e.preventDefault();\n }, []);\n\n useEffect(() => {\n if (measure) measure();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [width]);\n\n return (\n <StyledListWrapper onMouseDown={preventMouseDown} minWidth={referenceElement?.offsetWidth}>\n {options.length > 0 && (\n <StyledVirtualListWrapper tabIndex={-1} innerRef={listRef}>\n <StyledList\n // recalculate the key to force the re-render of the list and update virtualization\n key={options.length}\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 onFocus={handleOnFocus}\n data-testid={AutocompleteDataTestid.LIST}\n style={{ height: totalSize, margin: '8px 0px' }}\n getOwnerProps={getOwnerProps}\n >\n {ItemRenderer}\n </StyledList>\n </StyledVirtualListWrapper>\n )}\n </StyledListWrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACsCb;AAtCV,SAAgB,YAAY,aAAa,iBAAiB;AAC1D,SAAS,mBAAmB,YAAY,gCAAgC;AACxE,SAAS,8BAA8B;AACvC,OAAO,yBAAyB;AAChC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AAE5B,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ,OAAO,EAAE,QAAQ;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB,EAAE,WAAW,QAAQ;AAAA,EAC3C,IAAI,WAAW,mBAAmB;AAElC,QAAM,eAAe,gBAAgB;AACrC,QAAM,EAAE,MAAM,IAAI,mBAAmB,gBAAgB;AAErD,QAAM,gBAAgB,YAAY,MAAM;AACtC,aAAS,SAAS,MAAM;AAAA,EAC1B,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,mBAA4D,YAAY,CAAC,MAAM;AACnF,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,QAAI,QAAS,SAAQ;AAAA,EAEvB,GAAG,CAAC,KAAK,CAAC;AAEV,SACE,oBAAC,qBAAkB,aAAa,kBAAkB,UAAU,kBAAkB,aAC3E,kBAAQ,SAAS,KAChB,oBAAC,4BAAyB,UAAU,IAAI,UAAU,SAChD;AAAA,IAAC;AAAA;AAAA,MAGC,MAAK;AAAA,MACL,IAAI,aAAa,cAAc;AAAA,MAG/B,cAAW;AAAA,MACX,SAAS;AAAA,MACT,eAAa,uBAAuB;AAAA,MACpC,OAAO,EAAE,QAAQ,WAAW,QAAQ,UAAU;AAAA,MAC9C;AAAA,MAEC;AAAA;AAAA,IAXI,QAAQ;AAAA,EAYf,GACF,GAEJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { styled } from "@elliemae/ds-system";
|
|
3
|
+
import { DSAutocompleteName, DSAutocompleteSlots } from "../../constants/index.js";
|
|
3
4
|
const StyledListWrapper = styled.div`
|
|
4
5
|
min-width: ${({ minWidth }) => minWidth ? `${minWidth}px` : "100%"};
|
|
5
6
|
`;
|
|
6
|
-
const StyledList = styled
|
|
7
|
+
const StyledList = styled("ul", {
|
|
8
|
+
name: DSAutocompleteName,
|
|
9
|
+
slot: DSAutocompleteSlots.MENU_LIST
|
|
10
|
+
})`
|
|
7
11
|
position: relative;
|
|
8
12
|
padding: 0;
|
|
9
13
|
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/menu-list/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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.
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { DSAutocompleteName, DSAutocompleteSlots } from '../../constants/index.js';\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 name: DSAutocompleteName,\n slot: DSAutocompleteSlots.MENU_LIST,\n})`\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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AACvB,SAAS,oBAAoB,2BAA2B;AAEjD,MAAM,oBAAoB,OAAO;AAAA,eACzB,CAAC,EAAE,SAAS,MAAO,WAAW,GAAG,QAAQ,OAAO,MAAO;AAAA;AAG/D,MAAM,aAAa,OAAO,MAAM;AAAA,EACrC,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAKM,MAAM,2BAA2B,OAAO;AAAA;AAAA,gBAI/B,CAAC,EAAE,UAAU,MAAM,GAAG,CAAC,YAAY,QAAQ,SAAS,IAAI;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,9 +2,15 @@ import * as React from "react";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useContext, useCallback } from "react";
|
|
4
4
|
import { DSMenuItemsAction } from "@elliemae/ds-menu-items";
|
|
5
|
+
import { styled } from "@elliemae/ds-system";
|
|
6
|
+
import { DSAutocompleteName, DSAutocompleteSlots } from "../../constants/index.js";
|
|
5
7
|
import AutocompleteContext from "../../AutocompleteCTX.js";
|
|
6
8
|
import { AutocompleteDataTestid } from "../../AutocompleteDataTestids.js";
|
|
7
9
|
import { Section } from "../Section.js";
|
|
10
|
+
const StyledMenuItemAction = styled(DSMenuItemsAction, {
|
|
11
|
+
name: DSAutocompleteName,
|
|
12
|
+
slot: DSAutocompleteSlots.OPTION
|
|
13
|
+
})``;
|
|
8
14
|
const useItemRenderer = () => {
|
|
9
15
|
const {
|
|
10
16
|
props: { onSelect },
|
|
@@ -13,7 +19,8 @@ const useItemRenderer = () => {
|
|
|
13
19
|
setUserJustSelectedAnOption,
|
|
14
20
|
focusOptionIdx,
|
|
15
21
|
optionsPerSection: options,
|
|
16
|
-
virtualListHelpers
|
|
22
|
+
virtualListHelpers,
|
|
23
|
+
getOwnerProps
|
|
17
24
|
} = useContext(AutocompleteContext);
|
|
18
25
|
const handleClick = useCallback(
|
|
19
26
|
(option, e) => {
|
|
@@ -35,6 +42,7 @@ const useItemRenderer = () => {
|
|
|
35
42
|
innerRef: vItem.measureRef,
|
|
36
43
|
dsId: option.dsId
|
|
37
44
|
};
|
|
45
|
+
const getOwnerPropsArguments = () => option;
|
|
38
46
|
if (option.type === "section") {
|
|
39
47
|
return /* @__PURE__ */ jsx(
|
|
40
48
|
Section,
|
|
@@ -49,17 +57,19 @@ const useItemRenderer = () => {
|
|
|
49
57
|
}
|
|
50
58
|
if (option.type === "option") {
|
|
51
59
|
return /* @__PURE__ */ jsx(
|
|
52
|
-
|
|
60
|
+
StyledMenuItemAction,
|
|
53
61
|
{
|
|
54
|
-
as: "div",
|
|
55
62
|
id: option.dsId,
|
|
56
63
|
label: option.label,
|
|
57
64
|
"data-testid": AutocompleteDataTestid.OPTION,
|
|
58
65
|
disabled: option.disabled,
|
|
66
|
+
tabIndex: 0,
|
|
59
67
|
onClick: (e) => handleClick(option, e),
|
|
60
68
|
isActive: option.dsId === focusOptionIdx,
|
|
61
69
|
"aria-selected": "false",
|
|
62
|
-
...generalProps
|
|
70
|
+
...generalProps,
|
|
71
|
+
getOwnerProps,
|
|
72
|
+
getOwnerPropsArguments
|
|
63
73
|
}
|
|
64
74
|
);
|
|
65
75
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/menu-list/useItemRenderer.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { DSMenuItemsAction } from '@elliemae/ds-menu-items';\nimport AutocompleteContext from '../../AutocompleteCTX.js';\nimport { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';\nimport type { DSAutocompleteT } from '../../react-desc-prop-types.js';\nimport { Section } from '../Section.js';\nexport const useItemRenderer = () => {\n const {\n props: { onSelect },\n inputRef,\n setUserTypedSomething,\n setUserJustSelectedAnOption,\n focusOptionIdx,\n optionsPerSection: options,\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%' } as React.CSSProperties,\n key: `${option.dsId}`,\n innerRef: vItem.measureRef,\n dsId: option.dsId,\n };\n if (option.type === 'section') {\n return (\n <Section\n label={option.label}\n {...generalProps}\n options={option.options}\n handleClick={handleClick}\n focusOptionIdx={focusOptionIdx}\n />\n );\n }\n if (option.type === 'option') {\n return (\n <
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { DSMenuItemsAction } from '@elliemae/ds-menu-items';\nimport { styled } from '@elliemae/ds-system';\nimport { DSAutocompleteName, DSAutocompleteSlots } from '../../constants/index.js';\nimport AutocompleteContext from '../../AutocompleteCTX.js';\nimport { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';\nimport type { DSAutocompleteT } from '../../react-desc-prop-types.js';\nimport { Section } from '../Section.js';\n\nconst StyledMenuItemAction = styled(DSMenuItemsAction, {\n name: DSAutocompleteName,\n slot: DSAutocompleteSlots.OPTION,\n})``;\n\nexport const useItemRenderer = () => {\n const {\n props: { onSelect },\n inputRef,\n setUserTypedSomething,\n setUserJustSelectedAnOption,\n focusOptionIdx,\n optionsPerSection: options,\n virtualListHelpers,\n getOwnerProps,\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%' } as React.CSSProperties,\n key: `${option.dsId}`,\n innerRef: vItem.measureRef,\n dsId: option.dsId,\n };\n const getOwnerPropsArguments = () => option;\n\n if (option.type === 'section') {\n return (\n <Section\n label={option.label}\n {...generalProps}\n options={option.options}\n handleClick={handleClick}\n focusOptionIdx={focusOptionIdx}\n />\n );\n }\n if (option.type === 'option') {\n return (\n <StyledMenuItemAction\n id={option.dsId}\n label={option.label}\n data-testid={AutocompleteDataTestid.OPTION}\n disabled={option.disabled}\n tabIndex={0}\n onClick={(e: React.MouseEvent<HTMLInputElement>) => handleClick(option, e)}\n isActive={option.dsId === focusOptionIdx}\n aria-selected=\"false\"\n {...generalProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n );\n }\n return null;\n });\n }\n return null;\n }, [options, focusOptionIdx, inputRef, virtualListHelpers]);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACqDX;AAnDZ,SAAgB,SAAS,YAAY,mBAAmB;AACxD,SAAS,yBAAyB;AAClC,SAAS,cAAc;AACvB,SAAS,oBAAoB,2BAA2B;AACxD,OAAO,yBAAyB;AAChC,SAAS,8BAA8B;AAEvC,SAAS,eAAe;AAExB,MAAM,uBAAuB,OAAO,mBAAmB;AAAA,EACrD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAEM,MAAM,kBAAkB,MAAM;AACnC,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,EACF,IAAI,WAAW,mBAAmB;AAElC,QAAM,cAAc;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,SAAO,QAAQ,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,IAAI;AAAA,UACnB,UAAU,MAAM;AAAA,UAChB,MAAM,OAAO;AAAA,QACf;AACA,cAAM,yBAAyB,MAAM;AAErC,YAAI,OAAO,SAAS,WAAW;AAC7B,iBACE;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,OAAO;AAAA,cACb,GAAG;AAAA,cACJ,SAAS,OAAO;AAAA,cAChB;AAAA,cACA;AAAA;AAAA,UACF;AAAA,QAEJ;AACA,YAAI,OAAO,SAAS,UAAU;AAC5B,iBACE;AAAA,YAAC;AAAA;AAAA,cACC,IAAI,OAAO;AAAA,cACX,OAAO,OAAO;AAAA,cACd,eAAa,uBAAuB;AAAA,cACpC,UAAU,OAAO;AAAA,cACjB,UAAU;AAAA,cACV,SAAS,CAAC,MAA0C,YAAY,QAAQ,CAAC;AAAA,cACzE,UAAU,OAAO,SAAS;AAAA,cAC1B,iBAAc;AAAA,cACb,GAAG;AAAA,cACJ;AAAA,cACA;AAAA;AAAA,UACF;AAAA,QAEJ;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT,GAAG,CAAC,SAAS,gBAAgB,UAAU,kBAAkB,CAAC;AAC5D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,5 +10,6 @@ export type AutocompleteContextT = ReturnType<typeof useRefs> & ReturnType<typeo
|
|
|
10
10
|
optionsPerSection: DSAutocompleteT.InternalProps['options'];
|
|
11
11
|
setCurrentOption: React.Dispatch<React.SetStateAction<string>>;
|
|
12
12
|
setReferenceElement: React.Dispatch<React.SetStateAction<HTMLElement | null>>;
|
|
13
|
+
getOwnerProps: () => DSAutocompleteT.InternalProps;
|
|
13
14
|
};
|
|
14
15
|
export declare const useAutocomplete: (propsFromUser: DSAutocompleteT.Props) => AutocompleteContextT;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { DSAutocomplete, DSAutocompleteWithSchema } from './Autocomplete.js';
|
|
2
2
|
export { AutocompleteDataTestid } from './AutocompleteDataTestids.js';
|
|
3
3
|
export type { DSAutocompleteT } from './react-desc-prop-types.js';
|
|
4
|
+
export { DSAutocompleteName, DSAutocompleteSlots } from './constants/index.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const StyledListWrapper: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, {
|
|
2
2
|
minWidth?: number | string;
|
|
3
3
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
|
|
4
|
-
export declare const StyledList: import("styled-components").StyledComponent<"
|
|
4
|
+
export declare const StyledList: import("styled-components").StyledComponent<"ul", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"ul">, never>;
|
|
5
5
|
export declare const StyledVirtualListWrapper: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, {
|
|
6
6
|
maxHeight?: number;
|
|
7
7
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form-layout-autocomplete",
|
|
3
|
-
"version": "3.57.0-next.
|
|
3
|
+
"version": "3.57.0-next.51",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Form Layout - Autocomplete",
|
|
6
6
|
"files": [
|
|
@@ -35,45 +35,46 @@
|
|
|
35
35
|
"reportFile": "tests.xml",
|
|
36
36
|
"indent": 4
|
|
37
37
|
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
|
40
|
+
"test": "pui-cli test --passWithNoTests --coverage=\"false\"",
|
|
41
|
+
"lint": "node ../../../scripts/lint.mjs --fix",
|
|
42
|
+
"lint:strict": "node ../../../scripts/lint-strict.mjs",
|
|
43
|
+
"dts": "node ../../../scripts/dts.mjs",
|
|
44
|
+
"build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
|
|
45
|
+
"checkDeps": "npm exec ../../util/ds-codemods -- check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
46
|
+
},
|
|
38
47
|
"dependencies": {
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"@elliemae/ds-
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
+
"@elliemae/ds-floating-context": "3.57.0-next.51",
|
|
49
|
+
"@elliemae/ds-form-input-text": "3.57.0-next.51",
|
|
50
|
+
"@elliemae/ds-grid": "3.57.0-next.51",
|
|
51
|
+
"@elliemae/ds-menu-items": "3.57.0-next.51",
|
|
52
|
+
"@elliemae/ds-props-helpers": "3.57.0-next.51",
|
|
53
|
+
"@elliemae/ds-system": "3.57.0-next.51",
|
|
54
|
+
"react-virtual": "catalog:",
|
|
55
|
+
"styled-components": "catalog:",
|
|
56
|
+
"uid": "catalog:"
|
|
48
57
|
},
|
|
49
58
|
"devDependencies": {
|
|
50
|
-
"@elliemae/
|
|
51
|
-
"@elliemae/
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
59
|
+
"@elliemae/ds-form-input-text": "workspace:*",
|
|
60
|
+
"@elliemae/ds-monorepo-devops": "3.57.0-next.51",
|
|
61
|
+
"@elliemae/ds-test-utils": "3.57.0-next.51",
|
|
62
|
+
"@elliemae/pui-cli": "catalog:",
|
|
63
|
+
"@elliemae/pui-theme": "catalog:",
|
|
64
|
+
"jest": "catalog:",
|
|
65
|
+
"styled-components": "catalog:",
|
|
66
|
+
"styled-system": "catalog:"
|
|
58
67
|
},
|
|
59
68
|
"peerDependencies": {
|
|
60
|
-
"@elliemae/pui-theme": "
|
|
61
|
-
"react": "
|
|
62
|
-
"react-dom": "
|
|
63
|
-
"styled-components": "
|
|
64
|
-
"styled-system": "
|
|
69
|
+
"@elliemae/pui-theme": "catalog:",
|
|
70
|
+
"react": "catalog:",
|
|
71
|
+
"react-dom": "catalog:",
|
|
72
|
+
"styled-components": "catalog:",
|
|
73
|
+
"styled-system": "catalog:"
|
|
65
74
|
},
|
|
66
75
|
"publishConfig": {
|
|
67
76
|
"access": "public",
|
|
68
77
|
"typeSafety": true
|
|
69
78
|
},
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
"test": "pui-cli test --passWithNoTests --coverage=\"false\"",
|
|
73
|
-
"lint": "node ../../../scripts/lint.mjs --fix",
|
|
74
|
-
"lint:strict": "node ../../../scripts/lint-strict.mjs",
|
|
75
|
-
"dts": "node ../../../scripts/dts.mjs",
|
|
76
|
-
"build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
|
|
77
|
-
"checkDeps": "npm exec ../../util/ds-codemods -- check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
78
|
-
}
|
|
79
|
-
}
|
|
79
|
+
"gitHead": "fcac2232f8f5629d3bdd93bd5f09f42ea5c6a72b"
|
|
80
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/DSAutocompleteDefinitions.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export const DSAutocompleteName = 'DSAutocomplete';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,qBAAqB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSAutocompleteDefinitions.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSAutocompleteName = 'DSAutocomplete';\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,qBAAqB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DSAutocompleteName = "DSAutocomplete";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|