@elliemae/ds-form-combobox 3.70.0-next.3 → 3.70.0-next.30
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/ComboBox.js +9 -1
- package/dist/cjs/ComboBox.js.map +2 -2
- package/dist/cjs/DSComboboxMultiT.js +2 -0
- package/dist/cjs/DSComboboxMultiT.js.map +2 -2
- package/dist/cjs/DSComboboxSingleT.js +2 -0
- package/dist/cjs/DSComboboxSingleT.js.map +2 -2
- package/dist/cjs/TruncatedTooltipText.js +96 -0
- package/dist/cjs/TruncatedTooltipText.js.map +7 -0
- package/dist/cjs/constants/index.js +32 -4
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/parts/DropdownIndicator.js +2 -2
- package/dist/cjs/parts/DropdownIndicator.js.map +2 -2
- package/dist/cjs/parts/LiveRegion.js +13 -1
- package/dist/cjs/parts/LiveRegion.js.map +2 -2
- package/dist/cjs/parts/Section.js +9 -11
- package/dist/cjs/parts/Section.js.map +2 -2
- package/dist/cjs/parts/container/Container.js +21 -15
- package/dist/cjs/parts/container/Container.js.map +2 -2
- package/dist/cjs/parts/container/styled.js +7 -4
- package/dist/cjs/parts/container/styled.js.map +2 -2
- package/dist/cjs/parts/controls/Controls.js +35 -15
- package/dist/cjs/parts/controls/Controls.js.map +2 -2
- package/dist/cjs/parts/controls/styled.js +21 -9
- package/dist/cjs/parts/controls/styled.js.map +2 -2
- package/dist/cjs/parts/controls-input/ControlsInput.js +20 -8
- package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/cjs/parts/controls-input/styled.js +25 -12
- package/dist/cjs/parts/controls-input/styled.js.map +2 -2
- package/dist/cjs/parts/controls-input/useKeyboardNavigation.js +10 -2
- package/dist/cjs/parts/controls-input/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/parts/controls-input/useMaskedOnChange.js +1 -1
- package/dist/cjs/parts/controls-input/useMaskedOnChange.js.map +2 -2
- package/dist/cjs/parts/menu-list/LoadingContainer.js +28 -2
- package/dist/cjs/parts/menu-list/LoadingContainer.js.map +2 -2
- package/dist/cjs/parts/menu-list/MenuList.js +12 -4
- package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
- package/dist/cjs/parts/menu-list/SkeletonContainer.js +20 -1
- package/dist/cjs/parts/menu-list/SkeletonContainer.js.map +2 -2
- package/dist/cjs/parts/menu-list/styled.js +35 -5
- package/dist/cjs/parts/menu-list/styled.js.map +2 -2
- package/dist/cjs/parts/menu-list/useItemRenderer.js +30 -41
- package/dist/cjs/parts/menu-list/useItemRenderer.js.map +3 -3
- package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js +5 -1
- package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/cjs/parts/styled.js +9 -2
- package/dist/cjs/parts/styled.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +2 -0
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/slot-props.js +82 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-combobox-multi-valid.js +158 -0
- package/dist/cjs/typescript-testing/typescript-combobox-multi-valid.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-combobox-single-valid.js +158 -0
- package/dist/cjs/typescript-testing/typescript-combobox-single-valid.js.map +7 -0
- package/dist/cjs/utils/listHelper.js.map +2 -2
- package/dist/esm/ComboBox.js +10 -2
- package/dist/esm/ComboBox.js.map +2 -2
- package/dist/esm/DSComboboxMultiT.js +8 -1
- package/dist/esm/DSComboboxMultiT.js.map +2 -2
- package/dist/esm/DSComboboxSingleT.js +8 -1
- package/dist/esm/DSComboboxSingleT.js.map +2 -2
- package/dist/esm/TruncatedTooltipText.js +70 -0
- package/dist/esm/TruncatedTooltipText.js.map +7 -0
- package/dist/esm/constants/index.js +32 -4
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/parts/DropdownIndicator.js +3 -3
- package/dist/esm/parts/DropdownIndicator.js.map +2 -2
- package/dist/esm/parts/LiveRegion.js +13 -1
- package/dist/esm/parts/LiveRegion.js.map +2 -2
- package/dist/esm/parts/Section.js +10 -12
- package/dist/esm/parts/Section.js.map +2 -2
- package/dist/esm/parts/container/Container.js +21 -15
- package/dist/esm/parts/container/Container.js.map +2 -2
- package/dist/esm/parts/container/styled.js +7 -4
- package/dist/esm/parts/container/styled.js.map +2 -2
- package/dist/esm/parts/controls/Controls.js +35 -15
- package/dist/esm/parts/controls/Controls.js.map +2 -2
- package/dist/esm/parts/controls/styled.js +21 -9
- package/dist/esm/parts/controls/styled.js.map +2 -2
- package/dist/esm/parts/controls-input/ControlsInput.js +20 -8
- package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
- package/dist/esm/parts/controls-input/styled.js +26 -13
- package/dist/esm/parts/controls-input/styled.js.map +2 -2
- package/dist/esm/parts/controls-input/useKeyboardNavigation.js +10 -2
- package/dist/esm/parts/controls-input/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/parts/controls-input/useMaskedOnChange.js +1 -1
- package/dist/esm/parts/controls-input/useMaskedOnChange.js.map +2 -2
- package/dist/esm/parts/menu-list/LoadingContainer.js +28 -2
- package/dist/esm/parts/menu-list/LoadingContainer.js.map +2 -2
- package/dist/esm/parts/menu-list/MenuList.js +12 -4
- package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
- package/dist/esm/parts/menu-list/SkeletonContainer.js +20 -1
- package/dist/esm/parts/menu-list/SkeletonContainer.js.map +2 -2
- package/dist/esm/parts/menu-list/styled.js +35 -5
- package/dist/esm/parts/menu-list/styled.js.map +2 -2
- package/dist/esm/parts/menu-list/useItemRenderer.js +30 -41
- package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js +5 -1
- package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
- package/dist/esm/parts/styled.js +9 -2
- package/dist/esm/parts/styled.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/typescript-testing/slot-props.js +59 -0
- package/dist/esm/typescript-testing/slot-props.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-combobox-multi-valid.js +135 -0
- package/dist/esm/typescript-testing/typescript-combobox-multi-valid.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-combobox-single-valid.js +135 -0
- package/dist/esm/typescript-testing/typescript-combobox-single-valid.js.map +7 -0
- package/dist/esm/utils/listHelper.js.map +2 -2
- package/dist/types/DSComboboxMultiT.d.ts +3 -1
- package/dist/types/DSComboboxSingleT.d.ts +3 -1
- package/dist/types/TruncatedTooltipText.d.ts +8 -0
- package/dist/types/constants/index.d.ts +80 -2
- package/dist/types/parts/LiveRegion.d.ts +21 -0
- package/dist/types/parts/Section.d.ts +4 -4
- package/dist/types/parts/controls/styled.d.ts +1 -1
- package/dist/types/parts/controls-input/styled.d.ts +4 -2
- package/dist/types/parts/menu-list/LoadingContainer.d.ts +3 -1
- package/dist/types/parts/menu-list/SkeletonContainer.d.ts +2 -1
- package/dist/types/parts/menu-list/styled.d.ts +21 -2
- package/dist/types/parts/menu-list/useItemRenderer.d.ts +2 -1
- package/dist/types/parts/multi-selected-values-container/RemovableSelectedValuePill.d.ts +1 -1
- package/dist/types/react-desc-prop-types.d.ts +28 -0
- package/dist/types/tests/DSCombobox.pui-18034.test.d.ts +1 -0
- package/dist/types/tests/DSCombobox.pui-18238.test.d.ts +1 -0
- package/dist/types/tests/DSCombobox.pui-18541.test.d.ts +1 -0
- package/dist/types/tests/DSCombobox.read-only.test.d.ts +1 -0
- package/dist/types/tests/DSCombobox.single-select.test.d.ts +1 -0
- package/dist/types/tests/DSCombobox.usemask.test.d.ts +1 -0
- package/dist/types/typescript-testing/slot-props.d.ts +1 -0
- package/dist/types/typescript-testing/typescript-combobox-multi-valid.d.ts +1 -0
- package/dist/types/typescript-testing/typescript-combobox-single-valid.d.ts +1 -0
- package/dist/types/utils/listHelper.d.ts +1 -1
- package/package.json +16 -16
- package/dist/cjs/config/useClickOutside.js +0 -52
- package/dist/cjs/config/useClickOutside.js.map +0 -7
- package/dist/esm/config/useClickOutside.js +0 -22
- package/dist/esm/config/useClickOutside.js.map +0 -7
- package/dist/types/config/useClickOutside.d.ts +0 -1
- /package/dist/types/tests/{a11y.test.d.ts → DSCombobox.a11y.test.d.ts} +0 -0
- /package/dist/types/tests/{creatable.test.d.ts → DSCombobox.api.test.d.ts} +0 -0
- /package/dist/types/tests/{disabled.test.d.ts → DSCombobox.creatable.test.d.ts} +0 -0
- /package/dist/types/tests/{force-focus-first-option-on-type.test.d.ts → DSCombobox.data-testid.test.d.ts} +0 -0
- /package/dist/types/tests/{general.test.d.ts → DSCombobox.disabled.test.d.ts} +0 -0
- /package/dist/types/tests/{multi-select.test.d.ts → DSCombobox.events.test.d.ts} +0 -0
- /package/dist/types/tests/{onlyselectable.test.d.ts → DSCombobox.force-focus-first-option-on-type.test.d.ts} +0 -0
- /package/dist/types/tests/{read-only.test.d.ts → DSCombobox.keyboard.test.d.ts} +0 -0
- /package/dist/types/tests/{single-select.test.d.ts → DSCombobox.multi-select.test.d.ts} +0 -0
- /package/dist/types/tests/{usemask.test.d.ts → DSCombobox.onlyselectable.test.d.ts} +0 -0
|
@@ -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 consistent-return */\n/* eslint-disable complexity */\nimport { FloatingWrapper, useFloatingContext } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useContext, useEffect, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable consistent-return */\n/* eslint-disable complexity */\nimport { FloatingWrapper, useFloatingContext } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useContext, useEffect, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { Controls } from '../controls/index.js';\nimport { LiveRegion } from '../LiveRegion.js';\nimport { MenuList } from '../menu-list/index.js';\nimport { StyledContainer, StyledPopperWrapper } from './styled.js';\n\nexport const Container = (): JSX.Element => {\n const { props, setMenuState, menuState } = useContext(ComboBoxContext);\n\n const {\n inline,\n startPlacementPreference,\n placementOrderPreference,\n isLoading,\n isSkeleton,\n applyAriaDisabled,\n popperProps,\n } = props;\n const globalAttributes = useGetGlobalAttributes(props) as ReturnType<typeof useGetGlobalAttributes> & {\n 'data-testid'?: string;\n };\n const { zIndex, ...xStyledProps } = useGetXstyledProps(props);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const correctZIndex = zIndex ? parseInt(zIndex as string, 10) : undefined;\n // Removing possible collisionable props\n const { className, 'data-testid': dataTestId } = globalAttributes;\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n }, []);\n\n useEffect(() => {\n const closeMenuOnWindowBlur = () => {\n if (menuState) setMenuState(false, 'blur');\n };\n\n window.addEventListener('blur', closeMenuOnWindowBlur);\n\n return () => {\n window.removeEventListener('blur', closeMenuOnWindowBlur);\n };\n }, [menuState, setMenuState]);\n\n // In inline mode the combobox is rendered inside a consumer-controlled FloatingWrapper.\n // The consumer owns dismissal; if we closed the internal menuState here, the outer wrapper\n // would stay open and the user would see the input without options (\"weird state\").\n const handleClickOutside = useCallback(() => {\n if (inline) return;\n setMenuState(false, 'blur');\n }, [setMenuState, inline]);\n\n const config = useMemo(\n () => ({\n placement: startPlacementPreference,\n withoutAnimation: true,\n placementOrderPreference,\n zIndex: correctZIndex,\n customOffset: [0, 5] as [number, number],\n externallyControlledIsOpen: menuState,\n // Gate on `!inline` \u2014 in inline mode the consumer's outer wrapper handles dismissal.\n onClickOutside: inline ? undefined : handleClickOutside,\n }),\n [startPlacementPreference, placementOrderPreference, correctZIndex, menuState, inline, handleClickOutside],\n );\n\n const { refs, floatingStyles, context } = useFloatingContext(config);\n\n return (\n <StyledContainer\n data-testid={dataTestId ?? ComboboxDataTestid.CONTAINER}\n innerRef={refs.setReference}\n className={className}\n applyAriaDisabled={applyAriaDisabled ?? false}\n {...xStyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <LiveRegion />\n <Controls />\n\n {menuState && inline ? <MenuList /> : null}\n {menuState && !inline && refs.reference ? (\n <FloatingWrapper\n innerRef={refs.setFloating}\n floatingStyles={floatingStyles}\n isOpen={menuState}\n context={context}\n {...popperProps}\n key={`${isLoading}${isSkeleton}`} // to force remount when loading/skeleton changes\n >\n <StyledPopperWrapper\n tabIndex={-1}\n onMouseDown={handleMouseDown}\n applyAriaDisabled={applyAriaDisabled ?? false}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <MenuList />\n </StyledPopperWrapper>\n </FloatingWrapper>\n ) : null}\n </StyledContainer>\n );\n};\n", "import * as React from 'react';\nexport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AClB;AAAA,MACA,QAAQ;AAAA,MACR,cAAc,CAAC,GAAG,CAAC;AAAA,MACnB,4BAA4B;AAAA;AAAA,MAE5B,gBAAgB,SAAS,SAAY;AAAA,IACvC;AAAA,IACA,CAAC,0BAA0B,0BAA0B,eAAe,WAAW,QAAQ,kBAAkB;AAAA,EAC3G;AAEA,QAAM,EAAE,MAAM,gBAAgB,QAAQ,QAAI,+CAAmB,MAAM;AAEnE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,cAAc,8CAAmB;AAAA,MAC9C,UAAU,KAAK;AAAA,MACf;AAAA,MACA,mBAAmB,qBAAqB;AAAA,MACvC,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MAEA;AAAA,oDAAC,gCAAW;AAAA,QACZ,4CAAC,4BAAS;AAAA,QAET,aAAa,SAAS,4CAAC,6BAAS,IAAK;AAAA,QACrC,aAAa,CAAC,UAAU,KAAK,YAC5B;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,KAAK;AAAA,YACf;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,YACC,GAAG;AAAA,YACJ,KAAK,GAAG,SAAS,GAAG,UAAU;AAAA;AAAA,UAE9B;AAAA,YAAC;AAAA;AAAA,cACC,UAAU;AAAA,cACV,aAAa;AAAA,cACb,mBAAmB,qBAAqB;AAAA,cACxC;AAAA,cACA;AAAA,cAEA,sDAAC,6BAAS;AAAA;AAAA,UACZ;AAAA,QACF,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;",
|
|
6
6
|
"names": ["import_react", "ComboBoxContext"]
|
|
7
7
|
}
|
|
@@ -34,10 +34,10 @@ __export(styled_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(styled_exports);
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_ds_system = require("@elliemae/ds-system");
|
|
37
|
-
var
|
|
37
|
+
var import_constants = require("../../constants/index.js");
|
|
38
38
|
const StyledContainer = (0, import_ds_system.styled)("div", {
|
|
39
|
-
name:
|
|
40
|
-
slot:
|
|
39
|
+
name: import_constants.DSFormComboboxName,
|
|
40
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.ROOT
|
|
41
41
|
})`
|
|
42
42
|
position: relative;
|
|
43
43
|
cursor: ${({ disabled }) => disabled ? "not-allowed" : "default"};
|
|
@@ -45,7 +45,10 @@ const StyledContainer = (0, import_ds_system.styled)("div", {
|
|
|
45
45
|
min-width: 64px;
|
|
46
46
|
${import_ds_system.xStyledCommonProps}
|
|
47
47
|
`;
|
|
48
|
-
const StyledPopperWrapper = (0, import_ds_system.styled)("div"
|
|
48
|
+
const StyledPopperWrapper = (0, import_ds_system.styled)("div", {
|
|
49
|
+
name: import_constants.DSFormComboboxName,
|
|
50
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.POPPER_WRAPPER
|
|
51
|
+
})`
|
|
49
52
|
position: relative;
|
|
50
53
|
cursor: ${({ disabled }) => disabled ? "not-allowed" : "default"};
|
|
51
54
|
cursor: ${({ applyAriaDisabled }) => applyAriaDisabled ? "not-allowed" : "default"};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/container/styled.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA2C;AAE3C,
|
|
4
|
+
"sourcesContent": ["import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\nimport type {} from '@xstyled/system';\n\nexport const StyledContainer = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.ROOT,\n})<XstyledProps & { disabled?: boolean; applyAriaDisabled: boolean }>`\n position: relative;\n cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'default')};\n cursor: ${({ applyAriaDisabled }) => (applyAriaDisabled ? 'not-allowed' : 'default')};\n min-width: 64px;\n ${xStyledCommonProps}\n`;\n\nexport const StyledPopperWrapper = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.POPPER_WRAPPER,\n})<{ disabled?: boolean; applyAriaDisabled: boolean }>`\n position: relative;\n cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'default')};\n cursor: ${({ applyAriaDisabled }) => (applyAriaDisabled ? 'not-allowed' : 'default')};\n overflow: auto;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA2C;AAE3C,uBAAwD;AAIjD,MAAM,sBAAkB,yBAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA,YAEW,CAAC,EAAE,SAAS,MAAO,WAAW,gBAAgB,SAAU;AAAA,YACxD,CAAC,EAAE,kBAAkB,MAAO,oBAAoB,gBAAgB,SAAU;AAAA;AAAA,IAElF,mCAAkB;AAAA;AAGf,MAAM,0BAAsB,yBAAO,OAAO;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA,YAEW,CAAC,EAAE,SAAS,MAAO,WAAW,gBAAgB,SAAU;AAAA,YACxD,CAAC,EAAE,kBAAkB,MAAO,oBAAoB,gBAAgB,SAAU;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,10 +34,10 @@ module.exports = __toCommonJS(Controls_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
|
-
var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
|
|
38
37
|
var import_react = require("react");
|
|
39
38
|
var import_ComboBoxCTX = __toESM(require("../../ComboBoxCTX.js"));
|
|
40
39
|
var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
|
|
40
|
+
var import_TruncatedTooltipText = require("../../TruncatedTooltipText.js");
|
|
41
41
|
var import_ControlsInput = require("../controls-input/ControlsInput.js");
|
|
42
42
|
var import_DropdownIndicator = require("../DropdownIndicator.js");
|
|
43
43
|
var import_multi_selected_values_container = require("../multi-selected-values-container/index.js");
|
|
@@ -117,28 +117,39 @@ const Controls = () => {
|
|
|
117
117
|
getOwnerProps,
|
|
118
118
|
getOwnerPropsArguments,
|
|
119
119
|
innerRef: controlsWrapperRef,
|
|
120
|
-
readOnly,
|
|
120
|
+
readOnly: readOnly ?? false,
|
|
121
121
|
cols,
|
|
122
|
-
disabled,
|
|
123
|
-
applyAriaDisabled,
|
|
124
|
-
hasError,
|
|
125
|
-
inline,
|
|
122
|
+
disabled: disabled ?? false,
|
|
123
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
124
|
+
hasError: hasError ?? false,
|
|
125
|
+
inline: inline ?? false,
|
|
126
126
|
onClick: handleOnClick,
|
|
127
127
|
onMouseDown: handleOnMouseDown,
|
|
128
128
|
onKeyDown: onKeyDownPills,
|
|
129
129
|
"aria-disabled": applyAriaDisabled,
|
|
130
130
|
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.CONTROLS_WRAPPER,
|
|
131
131
|
children: [
|
|
132
|
-
!inline && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
|
-
import_styled.
|
|
132
|
+
!inline && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
|
+
import_styled.StyledSelection,
|
|
134
134
|
{
|
|
135
|
-
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
variant: "b2",
|
|
136
|
+
component: "div",
|
|
137
|
+
innerRef: selectedOptionsRef,
|
|
138
|
+
onClick: handleOnPillsClick,
|
|
139
|
+
getOwnerProps,
|
|
140
|
+
children: Array.isArray(selectedValues) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_multi_selected_values_container.MultiSelectedValuesContainer, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
|
+
import_styled.StyledSingleSelectWraper,
|
|
142
|
+
{
|
|
143
|
+
readOnly: readOnly ?? false,
|
|
144
|
+
"data-testid": import_ComboboxDataTestids.ComboboxDataTestid.SELECTED_VALUES,
|
|
145
|
+
disabled: disabled ?? false,
|
|
146
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
147
|
+
getOwnerProps,
|
|
148
|
+
children: selectedValues && inputValue === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TruncatedTooltipText.TruncatedTooltipText, { value: selectedValues.label }) : null
|
|
149
|
+
}
|
|
150
|
+
)
|
|
140
151
|
}
|
|
141
|
-
)
|
|
152
|
+
),
|
|
142
153
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ControlsInput.ControlsInput, {}),
|
|
143
154
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {}),
|
|
144
155
|
!inline && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -147,8 +158,17 @@ const Controls = () => {
|
|
|
147
158
|
justifyItems: "center",
|
|
148
159
|
cols: ["min-content", "minmax(28px,max-content)"],
|
|
149
160
|
justifyContent: "flex-end",
|
|
161
|
+
getOwnerProps,
|
|
150
162
|
children: [
|
|
151
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
164
|
+
import_styled.StyleHeaderActionsSeparator,
|
|
165
|
+
{
|
|
166
|
+
disabled,
|
|
167
|
+
applyAriaDisabled,
|
|
168
|
+
readOnly,
|
|
169
|
+
getOwnerProps
|
|
170
|
+
}
|
|
171
|
+
),
|
|
152
172
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownIndicator.DropdownIndicator, {})
|
|
153
173
|
]
|
|
154
174
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/controls/Controls.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { TruncatedTooltipText } from '../../TruncatedTooltipText.js';\nimport { ControlsInput } from '../controls-input/ControlsInput.js';\nimport { DropdownIndicator } from '../DropdownIndicator.js';\nimport { MultiSelectedValuesContainer } from '../multi-selected-values-container/index.js';\nimport {\n StyledControlsWrapper,\n StyledHeaderActionsWrapper,\n StyledSelection,\n StyledSingleSelectWraper,\n StyleHeaderActionsSeparator,\n} from './styled.js';\nimport { useOnPillsNavigation } from './useOnPillsNavigation.js';\n\nexport const Controls = (): JSX.Element => {\n const {\n props,\n props: { inline, disabled, hasError, selectedValues, applyAriaDisabled, readOnly, isMenuOpenableWithReadOnly },\n selectedOptionsRef,\n setMenuState,\n setFocusOptionIdx,\n hasFocus,\n inputValue,\n listRef,\n focusOptionIdx,\n menuState,\n controlsWrapperRef,\n internalRef,\n shouldPreventContextMenuOpening,\n } = useContext(ComboBoxContext);\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const handleOnClick = useCallback(() => {\n if (disabled) return;\n if (applyAriaDisabled || shouldPreventContextMenuOpening) {\n internalRef.current?.focus();\n return;\n }\n if (hasFocus && menuState && !inline) {\n setMenuState(false, 'click');\n setFocusOptionIdx('');\n internalRef.current?.blur();\n return;\n }\n internalRef.current?.focus();\n setMenuState(true, 'click');\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n disabled,\n listRef,\n hasFocus,\n menuState,\n inline,\n setMenuState,\n focusOptionIdx,\n readOnly,\n applyAriaDisabled,\n isMenuOpenableWithReadOnly,\n ]);\n\n // this callback prevent to toggle the menu when clicking or removing pills\n const handleOnPillsClick: React.MouseEventHandler = useCallback(\n (e) => {\n if (applyAriaDisabled) return;\n if (menuState || disabled || shouldPreventContextMenuOpening) {\n e.stopPropagation();\n } else {\n internalRef.current?.focus();\n setMenuState(true, 'pill-click');\n }\n },\n [applyAriaDisabled, menuState, disabled, internalRef, setMenuState, shouldPreventContextMenuOpening],\n );\n\n // callback to prevent onBlur on the input when clicking in all the wrapper\n const handleOnMouseDown: React.MouseEventHandler = useCallback(\n (e) => {\n if (document.activeElement === internalRef.current || inline) {\n e.preventDefault();\n }\n },\n [internalRef, inline],\n );\n\n const { onKeyDownPills } = useOnPillsNavigation();\n\n const cols = useMemo(\n () => (!inline ? ['minmax(0px,max-content)', 'minmax(20px, auto)', '8px', '2.231rem'] : ['minmax(0px, auto)']),\n [inline],\n );\n return (\n <StyledControlsWrapper\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n innerRef={controlsWrapperRef}\n readOnly={readOnly ?? false}\n cols={cols}\n disabled={disabled ?? false}\n applyAriaDisabled={applyAriaDisabled ?? false}\n hasError={hasError ?? false}\n inline={inline ?? false}\n onClick={handleOnClick}\n onMouseDown={handleOnMouseDown}\n onKeyDown={onKeyDownPills}\n aria-disabled={applyAriaDisabled}\n data-testid={ComboboxDataTestid.CONTROLS_WRAPPER}\n >\n {!inline && (\n <StyledSelection\n variant=\"b2\"\n component=\"div\"\n innerRef={selectedOptionsRef}\n onClick={handleOnPillsClick}\n getOwnerProps={getOwnerProps}\n >\n {Array.isArray(selectedValues) ? (\n <MultiSelectedValuesContainer />\n ) : (\n <StyledSingleSelectWraper\n readOnly={readOnly ?? false}\n // legacy data-testid \u2014 preserved for QA/consumer compatibility, breaking change if removed\n data-testid={ComboboxDataTestid.SELECTED_VALUES}\n disabled={disabled ?? false}\n applyAriaDisabled={applyAriaDisabled ?? false}\n getOwnerProps={getOwnerProps}\n >\n {selectedValues && inputValue === '' ? <TruncatedTooltipText value={selectedValues.label} /> : null}\n </StyledSingleSelectWraper>\n )}\n </StyledSelection>\n )}\n\n <ControlsInput />\n {/** This empty div is a gap between the input and the drop down indicator */}\n <div />\n {!inline && (\n <StyledHeaderActionsWrapper\n justifyItems=\"center\"\n cols={['min-content', 'minmax(28px,max-content)']}\n justifyContent=\"flex-end\"\n getOwnerProps={getOwnerProps}\n >\n <StyleHeaderActionsSeparator\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n getOwnerProps={getOwnerProps}\n />\n <DropdownIndicator />\n </StyledHeaderActionsWrapper>\n )}\n </StyledControlsWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2HX;AAzHZ,8BAA8B;AAC9B,mBAAwD;AACxD,yBAA4B;AAC5B,iCAAmC;AACnC,kCAAqC;AACrC,2BAA8B;AAC9B,+BAAkC;AAClC,6CAA6C;AAC7C,oBAMO;AACP,kCAAqC;AAE9B,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,QAAQ,U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|
7
7
|
}
|
|
@@ -39,7 +39,8 @@ module.exports = __toCommonJS(styled_exports);
|
|
|
39
39
|
var React = __toESM(require("react"));
|
|
40
40
|
var import_ds_system = require("@elliemae/ds-system");
|
|
41
41
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
42
|
-
var
|
|
42
|
+
var import_ds_typography = require("@elliemae/ds-typography");
|
|
43
|
+
var import_constants = require("../../constants/index.js");
|
|
43
44
|
const readOnlyBorder = import_ds_system.css`
|
|
44
45
|
border: 1px solid ${({ theme }) => theme.colors.neutral["080"]};
|
|
45
46
|
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[400]};
|
|
@@ -67,8 +68,8 @@ const hoverBorder = import_ds_system.css`
|
|
|
67
68
|
border: 1px solid ${({ theme }) => theme.colors.brand[600]};
|
|
68
69
|
`;
|
|
69
70
|
const StyledControlsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
70
|
-
name:
|
|
71
|
-
slot:
|
|
71
|
+
name: import_constants.DSFormComboboxName,
|
|
72
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.INPUT_WRAPPER
|
|
72
73
|
})`
|
|
73
74
|
${backgroundStyles}
|
|
74
75
|
position: relative;
|
|
@@ -81,7 +82,7 @@ const StyledControlsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid,
|
|
|
81
82
|
@media (max-width: ${import_ds_system.th.breakpoint("small")}) {
|
|
82
83
|
padding: 1.25px 0px 1.25px 8px;
|
|
83
84
|
}
|
|
84
|
-
margin: ${({ inline }) => inline ? "
|
|
85
|
+
margin: ${({ inline }) => inline ? "8px 16px" : ""};
|
|
85
86
|
${borderStyles}
|
|
86
87
|
&:hover {
|
|
87
88
|
${({ disabled }) => !disabled ? hoverBorder : ""}
|
|
@@ -90,26 +91,37 @@ const StyledControlsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid,
|
|
|
90
91
|
${focusBorder}
|
|
91
92
|
}
|
|
92
93
|
`;
|
|
93
|
-
const StyledSingleSelectWraper = import_ds_system.styled
|
|
94
|
+
const StyledSingleSelectWraper = (0, import_ds_system.styled)("div", {
|
|
95
|
+
name: import_constants.DSFormComboboxName,
|
|
96
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.SELECTED_VALUES
|
|
97
|
+
})`
|
|
94
98
|
display: flex;
|
|
95
99
|
width: 100%;
|
|
96
100
|
align-items: center;
|
|
97
101
|
color: ${({ disabled, readOnly, theme }) => disabled || readOnly ? theme.colors.neutral["600"] : theme.colors.neutral["700"]};
|
|
98
102
|
user-select: ${({ disabled, applyAriaDisabled }) => disabled || applyAriaDisabled ? "none" : ""};
|
|
99
103
|
`;
|
|
100
|
-
const StyledSelection = import_ds_system.styled.
|
|
101
|
-
|
|
104
|
+
const StyledSelection = (0, import_ds_system.styled)(import_ds_typography.DSTypography, {
|
|
105
|
+
name: import_constants.DSFormComboboxName,
|
|
106
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.SELECTION
|
|
107
|
+
})`
|
|
102
108
|
margin-right: 3px;
|
|
103
109
|
display: flex;
|
|
104
110
|
`;
|
|
105
|
-
const StyledHeaderActionsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid
|
|
111
|
+
const StyledHeaderActionsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
112
|
+
name: import_constants.DSFormComboboxName,
|
|
113
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.HEADER_ACTIONS
|
|
114
|
+
})`
|
|
106
115
|
height: 100%;
|
|
107
116
|
.em-ds-button--text:focus::after {
|
|
108
117
|
border: none;
|
|
109
118
|
}
|
|
110
119
|
`;
|
|
111
120
|
const StyleDropdownIndicator = import_ds_system.styled.div``;
|
|
112
|
-
const StyleHeaderActionsSeparator = import_ds_system.styled
|
|
121
|
+
const StyleHeaderActionsSeparator = (0, import_ds_system.styled)("span", {
|
|
122
|
+
name: import_constants.DSFormComboboxName,
|
|
123
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.HEADER_ACTIONS_SEPARATOR
|
|
124
|
+
})`
|
|
113
125
|
height: 100%;
|
|
114
126
|
width: 1px;
|
|
115
127
|
background-color: ${({ theme }) => theme.colors.neutral["400"]};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/controls/styled.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled, css, th } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAgC;AAChC,qBAAqB;AACrB,
|
|
4
|
+
"sourcesContent": ["import { styled, css, th } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\ninterface StyledControlsWrapperT {\n hasError: boolean;\n inline: boolean;\n minWidth?: number;\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n}\n\nconst readOnlyBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.neutral['080']};\n border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[400]};\n`;\n\nconst borderStyles = css<{ hasError: boolean; readOnly: boolean; applyAriaDisabled: boolean }>`\n border: 1px solid ${({ hasError, theme }) => (hasError ? theme.colors.danger[900] : theme.colors.neutral[400])};\n ${({ readOnly, applyAriaDisabled }) => (readOnly || applyAriaDisabled ? readOnlyBorder : '')}\n`;\n\nconst backgroundStyles = css<{ disabled: boolean; applyAriaDisabled: boolean; readOnly: boolean }>`\n background: ${({ disabled, applyAriaDisabled, readOnly, theme }) => {\n if (readOnly || applyAriaDisabled) {\n return theme.colors.neutral['050'];\n }\n if (disabled) {\n return theme.colors.neutral['080'];\n }\n return '#ffffff';\n }};\n`;\n\nconst focusBorder = css`\n outline: 2px solid ${({ theme }) => theme.colors.brand[700]};\n outline-offset: -2px;\n`;\n\nconst hoverBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.brand[600]};\n`;\n\nexport const StyledControlsWrapper = styled(Grid, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.INPUT_WRAPPER,\n})<StyledControlsWrapperT>`\n ${backgroundStyles}\n position: relative;\n border-radius: 2px;\n min-width: ${({ minWidth, inline }) => (inline || !minWidth ? '' : `${minWidth}px`)};\n align-items: center;\n align-content: center;\n min-height: 28px;\n padding: 3px 0px 3px 8px;\n @media (max-width: ${th.breakpoint('small')}) {\n padding: 1.25px 0px 1.25px 8px;\n }\n margin: ${({ inline }) => (inline ? '8px 16px' : '')};\n ${borderStyles}\n &:hover {\n ${({ disabled }) => (!disabled ? hoverBorder : '')}\n }\n &:focus-within {\n ${focusBorder}\n }\n`;\n\nexport const StyledSingleSelectWraper = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.SELECTED_VALUES,\n})<{\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n}>`\n display: flex;\n width: 100%;\n align-items: center;\n color: ${({ disabled, readOnly, theme }) =>\n disabled || readOnly ? theme.colors.neutral['600'] : theme.colors.neutral['700']};\n user-select: ${({ disabled, applyAriaDisabled }) => (disabled || applyAriaDisabled ? 'none' : '')};\n`;\n\nexport const StyledSelection = styled(DSTypography, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.SELECTION,\n})`\n margin-right: 3px;\n display: flex;\n`;\n\nexport const StyledHeaderActionsWrapper = styled(Grid, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.HEADER_ACTIONS,\n})`\n height: 100%;\n .em-ds-button--text:focus::after {\n border: none;\n }\n`;\n\nexport const StyleDropdownIndicator = styled.div``;\n\nexport const StyleHeaderActionsSeparator = styled('span', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.HEADER_ACTIONS_SEPARATOR,\n})<Partial<StyledControlsWrapperT>>`\n height: 100%;\n width: 1px;\n background-color: ${({ theme }) => theme.colors.neutral['400']};\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAgC;AAChC,qBAAqB;AACrB,2BAA6B;AAC7B,uBAAwD;AAWxD,MAAM,iBAAiB;AAAA,sBACD,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,6BACnC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAGrE,MAAM,eAAe;AAAA,sBACC,CAAC,EAAE,UAAU,MAAM,MAAO,WAAW,MAAM,OAAO,OAAO,GAAG,IAAI,MAAM,OAAO,QAAQ,GAAG,CAAE;AAAA,IAC5G,CAAC,EAAE,UAAU,kBAAkB,MAAO,YAAY,oBAAoB,iBAAiB,EAAG;AAAA;AAG9F,MAAM,mBAAmB;AAAA,gBACT,CAAC,EAAE,UAAU,mBAAmB,UAAU,MAAM,MAAM;AAClE,MAAI,YAAY,mBAAmB;AACjC,WAAO,MAAM,OAAO,QAAQ,KAAK;AAAA,EACnC;AACA,MAAI,UAAU;AACZ,WAAO,MAAM,OAAO,QAAQ,KAAK;AAAA,EACnC;AACA,SAAO;AACT,CAAC;AAAA;AAGH,MAAM,cAAc;AAAA,uBACG,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAI7D,MAAM,cAAc;AAAA,sBACE,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAGrD,MAAM,4BAAwB,yBAAO,qBAAM;AAAA,EACh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export(ControlsInput_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(ControlsInput_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
36
37
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
38
|
var import_ds_system = require("@elliemae/ds-system");
|
|
38
|
-
var
|
|
39
|
-
var import_react = require("react");
|
|
39
|
+
var import_TruncatedTooltipText = require("../../TruncatedTooltipText.js");
|
|
40
40
|
var import_ComboBoxCTX = require("../../ComboBoxCTX.js");
|
|
41
41
|
var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
|
|
42
42
|
var import_listHelper = require("../../utils/listHelper.js");
|
|
@@ -81,7 +81,8 @@ const ControlsInput = () => {
|
|
|
81
81
|
});
|
|
82
82
|
const actualAriaDescribedBy = (0, import_react.useMemo)(() => {
|
|
83
83
|
if (id) {
|
|
84
|
-
|
|
84
|
+
const internalIds = `${id}_current_placeholder ${id}_feedback_message ${id}_error_message`;
|
|
85
|
+
return ariaDescribedBy ? `${ariaDescribedBy} ${internalIds}` : internalIds;
|
|
85
86
|
}
|
|
86
87
|
return ariaDescribedBy;
|
|
87
88
|
}, [ariaDescribedBy, id]);
|
|
@@ -103,14 +104,25 @@ const ControlsInput = () => {
|
|
|
103
104
|
}
|
|
104
105
|
return void 0;
|
|
105
106
|
}, [focusOptionIdx, hasFocus, isLoading, menuState]);
|
|
107
|
+
const isNonInteractive = [disabled, applyAriaDisabled, readOnly].some(Boolean);
|
|
106
108
|
const handleOnPaste = (e) => {
|
|
107
109
|
e.preventDefault();
|
|
108
110
|
setInputValue(e.clipboardData.getData("text/plain"));
|
|
109
111
|
internalRef.current?.focus();
|
|
110
112
|
};
|
|
111
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledInputWrapper, { children: [
|
|
113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledInputWrapper, { getOwnerProps, children: [
|
|
112
114
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledInputWidthReference, { innerRef: spanReference, children: spanReferenceText }),
|
|
113
|
-
showPlaceholder && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
|
+
showPlaceholder && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
116
|
+
import_styled.StyledInputPlaceHolder,
|
|
117
|
+
{
|
|
118
|
+
variant: "b2",
|
|
119
|
+
component: "span",
|
|
120
|
+
getOwnerProps,
|
|
121
|
+
"aria-hidden": "true",
|
|
122
|
+
$nonInteractive: isNonInteractive,
|
|
123
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TruncatedTooltipText.TruncatedTooltipText, { value: showPlaceholder })
|
|
124
|
+
}
|
|
125
|
+
),
|
|
114
126
|
menuState === false && !inline ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledHiddenDiv, { id: `combo-listbox-${instanceUid}` }) : null,
|
|
115
127
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledHiddenDiv, { id: `${id}_current_placeholder`, children: currentPlaceholder }),
|
|
116
128
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -133,7 +145,7 @@ const ControlsInput = () => {
|
|
|
133
145
|
"aria-autocomplete": "list",
|
|
134
146
|
role: "combobox",
|
|
135
147
|
disabled,
|
|
136
|
-
applyAriaDisabled,
|
|
148
|
+
applyAriaDisabled: applyAriaDisabled ?? false,
|
|
137
149
|
style: { width },
|
|
138
150
|
innerRef: (0, import_ds_system.mergeRefs)(innerRef, internalRef),
|
|
139
151
|
value: inputValue,
|
|
@@ -141,7 +153,7 @@ const ControlsInput = () => {
|
|
|
141
153
|
onKeyDown: onInputKeyDown,
|
|
142
154
|
onChange: handleOnChange,
|
|
143
155
|
tabIndex,
|
|
144
|
-
withoutCaret: onlySelectable,
|
|
156
|
+
withoutCaret: onlySelectable ?? false,
|
|
145
157
|
autoComplete: "off",
|
|
146
158
|
"aria-readonly": readOnly
|
|
147
159
|
}
|
|
@@ -156,7 +168,7 @@ const ControlsInput = () => {
|
|
|
156
168
|
tabIndex: -1,
|
|
157
169
|
onPaste: handleOnPaste,
|
|
158
170
|
"aria-hidden": "true",
|
|
159
|
-
isDisabled: disabled || applyAriaDisabled
|
|
171
|
+
isDisabled: !!(disabled || applyAriaDisabled)
|
|
160
172
|
}
|
|
161
173
|
)
|
|
162
174
|
] });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/controls-input/ControlsInput.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { useGetGlobalAttributes, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { TruncatedTooltipText } from '../../TruncatedTooltipText.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { isArrayOfItems } from '../../utils/listHelper.js';\nimport {\n StyledHiddenDiv,\n StyledInput,\n StyledInputPlaceHolder,\n StyledInputWidthReference,\n StyledInputWrapper,\n StyleHiddenInput,\n} from './styled.js';\nimport { useControlsInput } from './useControlsInput.js';\nimport { useKeyboardNavigation } from './useKeyboardNavigation.js';\n\nexport const ControlsInput = (): JSX.Element => {\n const {\n props,\n props: {\n autoFocus,\n inline,\n selectedValues,\n placeholder,\n disabled,\n innerRef,\n isLoading,\n onlySelectable,\n applyAriaDisabled,\n readOnly,\n ...restProps\n },\n focusOptionIdx,\n hasFocus,\n internalRef,\n inputValue,\n setInputValue,\n menuState,\n instanceUid,\n } = useContext(ComboBoxContext);\n const { onInputKeyDown } = useKeyboardNavigation();\n\n const { spanReference, width, spanReferenceText, showPlaceholder, handleOnBlur, handleOnChange, handleOnFocus } =\n useControlsInput();\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const {\n tabIndex,\n id,\n 'aria-describedby': ariaDescribedBy,\n ...globalAttrs\n } = useGetGlobalAttributes(restProps, {\n onFocus: handleOnFocus,\n onBlur: handleOnBlur,\n });\n\n const actualAriaDescribedBy = useMemo(() => {\n if (id) {\n const internalIds = `${id}_current_placeholder ${id}_feedback_message ${id}_error_message`;\n return ariaDescribedBy ? `${ariaDescribedBy} ${internalIds}` : internalIds;\n }\n return ariaDescribedBy;\n }, [ariaDescribedBy, id]);\n\n const currentPlaceholder = useMemo(() => {\n if (isArrayOfItems(selectedValues)) {\n return `options ${selectedValues.map((item) => item.label).join(', ')} selected. ${readOnly ? 'Read only' : ''}`;\n }\n if (typeof selectedValues?.label === 'string') {\n return `option ${selectedValues.label} selected. ${readOnly ? 'Read only' : ''}`;\n }\n if (readOnly) {\n return `${placeholder}. Read only`;\n }\n return placeholder;\n }, [placeholder, selectedValues, readOnly]);\n\n const activeDescendant = useMemo(() => {\n if (!isLoading && hasFocus && menuState) {\n return focusOptionIdx;\n }\n return undefined;\n }, [focusOptionIdx, hasFocus, isLoading, menuState]);\n\n // `.some(Boolean)` over `||` keeps this component within its cyclomatic-complexity limit.\n const isNonInteractive = [disabled, applyAriaDisabled, readOnly].some(Boolean);\n\n const handleOnPaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n setInputValue(e.clipboardData.getData('text/plain'));\n internalRef.current?.focus();\n };\n return (\n <StyledInputWrapper getOwnerProps={getOwnerProps}>\n <StyledInputWidthReference innerRef={spanReference}>{spanReferenceText}</StyledInputWidthReference>\n {showPlaceholder && (\n <StyledInputPlaceHolder\n variant=\"b2\"\n component=\"span\"\n getOwnerProps={getOwnerProps}\n aria-hidden=\"true\"\n $nonInteractive={isNonInteractive}\n >\n <TruncatedTooltipText value={showPlaceholder} />\n </StyledInputPlaceHolder>\n )}\n\n {/* The purpose of this div is to always have the 'combo-listbox-{uid}' present in the DOM */}\n {/* Fix for PUI-11597 */}\n {menuState === false && !inline ? <StyledHiddenDiv id={`combo-listbox-${instanceUid}`}></StyledHiddenDiv> : null}\n\n {/* The announcement of currentPlaceholder is being overridden by the value of actualAriaDescribedBy */}\n {/* and since this variable is necessary for the annoucement of FormLayoutBlockItem error and feedback */}\n {/* messages, we concatenate the value of actualPlaceholder with that aria description */}\n {/* Fix for PUI-9609 */}\n <StyledHiddenDiv id={`${id}_current_placeholder`}>{currentPlaceholder}</StyledHiddenDiv>\n\n <StyledInput\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n readOnly={readOnly || onlySelectable}\n {...globalAttrs}\n id={id}\n data-testid={ComboboxDataTestid.INPUT}\n autoFocus={autoFocus}\n placeholder={currentPlaceholder}\n aria-activedescendant={activeDescendant}\n aria-expanded={menuState}\n aria-controls={`combo-listbox-${instanceUid}`}\n aria-describedby={actualAriaDescribedBy}\n aria-autocomplete=\"list\"\n role=\"combobox\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled ?? false}\n style={{ width }}\n innerRef={mergeRefs(innerRef, internalRef)}\n value={inputValue}\n type=\"text\"\n onKeyDown={onInputKeyDown}\n onChange={handleOnChange}\n tabIndex={tabIndex}\n withoutCaret={onlySelectable ?? false}\n autoComplete=\"off\"\n aria-readonly={readOnly}\n />\n {/* This input is used to handle the paste event */}\n <StyleHiddenInput\n type=\"text\"\n disabled={disabled || applyAriaDisabled}\n readOnly={readOnly}\n name=\"hidden\"\n tabIndex={-1}\n onPaste={handleOnPaste}\n aria-hidden=\"true\"\n isDisabled={!!(disabled || applyAriaDisabled)}\n />\n </StyledInputWrapper>\n );\n};\n", "import * as React from 'react';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AAa,8CAAmB;AAAA,QAChC;AAAA,QACA,aAAa;AAAA,QACb,yBAAuB;AAAA,QACvB,iBAAe;AAAA,QACf,iBAAe,iBAAiB,WAAW;AAAA,QAC3C,oBAAkB;AAAA,QAClB,qBAAkB;AAAA,QAClB,MAAK;AAAA,QACL;AAAA,QACA,mBAAmB,qBAAqB;AAAA,QACxC,OAAO,EAAE,MAAM;AAAA,QACf,cAAU,4BAAU,UAAU,WAAW;AAAA,QACzC,OAAO;AAAA,QACP,MAAK;AAAA,QACL,WAAW;AAAA,QACX,UAAU;AAAA,QACV;AAAA,QACA,cAAc,kBAAkB;AAAA,QAChC,cAAa;AAAA,QACb,iBAAe;AAAA;AAAA,IACjB;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,UAAU,YAAY;AAAA,QACtB;AAAA,QACA,MAAK;AAAA,QACL,UAAU;AAAA,QACV,SAAS;AAAA,QACT,eAAY;AAAA,QACZ,YAAY,CAAC,EAAE,YAAY;AAAA;AAAA,IAC7B;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,7 +38,17 @@ __export(styled_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(styled_exports);
|
|
39
39
|
var React = __toESM(require("react"));
|
|
40
40
|
var import_ds_system = require("@elliemae/ds-system");
|
|
41
|
-
var
|
|
41
|
+
var import_ds_typography = require("@elliemae/ds-typography");
|
|
42
|
+
var import_constants = require("../../constants/index.js");
|
|
43
|
+
const b2InputTypography = import_ds_system.css`
|
|
44
|
+
font-size: 0.8125rem;
|
|
45
|
+
line-height: 1rem;
|
|
46
|
+
font-weight: 400;
|
|
47
|
+
@media (min-width: ${({ theme }) => theme.breakpoints.small}) {
|
|
48
|
+
font-size: 1rem;
|
|
49
|
+
line-height: 1.2307692308rem;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
42
52
|
const StyleHiddenInput = (0, import_ds_system.styled)("input")`
|
|
43
53
|
color: transparent;
|
|
44
54
|
position: absolute;
|
|
@@ -55,18 +65,17 @@ const StyleHiddenInput = (0, import_ds_system.styled)("input")`
|
|
|
55
65
|
${({ isDisabled }) => isDisabled && `cursor: not-allowed;`}
|
|
56
66
|
`;
|
|
57
67
|
const StyledInput = (0, import_ds_system.styled)("input", {
|
|
58
|
-
name:
|
|
59
|
-
slot:
|
|
68
|
+
name: import_constants.DSFormComboboxName,
|
|
69
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.INPUT
|
|
60
70
|
})`
|
|
61
|
-
|
|
71
|
+
${b2InputTypography}
|
|
62
72
|
background: transparent;
|
|
63
|
-
font-size: 1rem;
|
|
64
73
|
border: none;
|
|
65
74
|
overflow: hidden;
|
|
66
75
|
padding: 0;
|
|
67
76
|
z-index: 2;
|
|
68
77
|
outline: none;
|
|
69
|
-
color: ${(props) => props.theme.colors.neutral[700]};
|
|
78
|
+
color: ${(props) => props.disabled ? props.theme.colors.neutral[600] : props.theme.colors.neutral[700]};
|
|
70
79
|
&:focus {
|
|
71
80
|
outline: none;
|
|
72
81
|
}
|
|
@@ -77,18 +86,18 @@ const StyledInput = (0, import_ds_system.styled)("input", {
|
|
|
77
86
|
transition: none;
|
|
78
87
|
${({ applyAriaDisabled }) => applyAriaDisabled && `cursor: not-allowed; caret-color: transparent;`}
|
|
79
88
|
`;
|
|
80
|
-
const StyledInputPlaceHolder = import_ds_system.styled.
|
|
89
|
+
const StyledInputPlaceHolder = (0, import_ds_system.styled)(import_ds_typography.DSTypography, {
|
|
90
|
+
name: import_constants.DSFormComboboxName,
|
|
91
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.INPUT_PLACEHOLDER
|
|
92
|
+
})`
|
|
81
93
|
font-style: italic;
|
|
82
|
-
color: ${(props) => props.theme.colors.neutral[500]};
|
|
94
|
+
color: ${(props) => props.$nonInteractive ? props.theme.colors.neutral[600] : props.theme.colors.neutral[500]};
|
|
83
95
|
position: absolute;
|
|
84
96
|
display: flex;
|
|
85
97
|
align-items: center;
|
|
86
98
|
width: 100%;
|
|
87
99
|
user-select: none;
|
|
88
100
|
|
|
89
|
-
line-height: 1rem;
|
|
90
|
-
font-size: 1rem;
|
|
91
|
-
|
|
92
101
|
& span::after {
|
|
93
102
|
content: '';
|
|
94
103
|
padding: 1px;
|
|
@@ -96,12 +105,16 @@ const StyledInputPlaceHolder = import_ds_system.styled.div`
|
|
|
96
105
|
}
|
|
97
106
|
`;
|
|
98
107
|
const StyledInputWidthReference = import_ds_system.styled.span`
|
|
108
|
+
${b2InputTypography}
|
|
99
109
|
visibility: hidden;
|
|
100
110
|
position: absolute;
|
|
101
111
|
top: -9999px;
|
|
102
112
|
z-index: 1;
|
|
103
113
|
`;
|
|
104
|
-
const StyledInputWrapper = (0, import_ds_system.styled)("div"
|
|
114
|
+
const StyledInputWrapper = (0, import_ds_system.styled)("div", {
|
|
115
|
+
name: import_constants.DSFormComboboxName,
|
|
116
|
+
slot: import_constants.FORM_COMBOBOX_SLOTS.INPUT_FIELD_WRAPPER
|
|
117
|
+
})`
|
|
105
118
|
position: relative;
|
|
106
119
|
align-items: center;
|
|
107
120
|
display: flex;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/controls-input/styled.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import { styled, css } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\n/**\n * b2 typography mirrored as raw CSS for the native `<input>` and its hidden\n * width-measuring twin (`StyledInputWidthReference`). Neither can be a `DSTypography`\n * component \u2014 an `<input>` takes no children, and the reference must match the input's\n * exact font metrics or the autosizing (measured off the reference) drifts. ds-typography\n * does not export its VARIANTS_CSS_MAP, so the b2 values are duplicated here \u2014 keep in\n * sync with `ds-typography` b2 (`parts/variants/body.ts`). Text containers that CAN hold\n * children (placeholder, selection) use `styled(DSTypography)` with `variant=\"b2\"` instead.\n */\nconst b2InputTypography = css`\n font-size: 0.8125rem;\n line-height: 1rem;\n font-weight: 400;\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: 1rem;\n line-height: 1.2307692308rem;\n }\n`;\n\nexport const StyleHiddenInput = styled('input')<{ isDisabled: boolean }>`\n color: transparent;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n border: none;\n outline: none;\n background: transparent;\n width: 100%;\n &:focus {\n outline: none;\n }\n ${({ isDisabled }) => isDisabled && `cursor: not-allowed;`}\n`;\n\nexport const StyledInput = styled('input', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.INPUT,\n})<{ withoutCaret: boolean; applyAriaDisabled: boolean }>`\n ${b2InputTypography}\n background: transparent;\n border: none;\n overflow: hidden;\n padding: 0;\n z-index: 2;\n outline: none;\n color: ${(props) => (props.disabled ? props.theme.colors.neutral[600] : props.theme.colors.neutral[700])};\n &:focus {\n outline: none;\n }\n ${({ withoutCaret }) => withoutCaret && 'caret-color: transparent;'}\n &::placeholder {\n color: transparent;\n }\n transition: none;\n ${({ applyAriaDisabled }) => applyAriaDisabled && `cursor: not-allowed; caret-color: transparent;`}\n`;\n\nexport const StyledInputPlaceHolder = styled(DSTypography, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.INPUT_PLACEHOLDER,\n})<{ $nonInteractive?: boolean }>`\n font-style: italic;\n color: ${(props) => (props.$nonInteractive ? props.theme.colors.neutral[600] : props.theme.colors.neutral[500])};\n position: absolute;\n display: flex;\n align-items: center;\n width: 100%;\n user-select: none;\n\n & span::after {\n content: '';\n padding: 1px;\n // solve italic font style clipping issue with overflow hidden.\n }\n`;\n\nexport const StyledInputWidthReference = styled.span`\n ${b2InputTypography}\n visibility: hidden;\n position: absolute;\n top: -9999px;\n z-index: 1;\n`;\n\nexport const StyledInputWrapper = styled('div', {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.INPUT_FIELD_WRAPPER,\n})`\n position: relative;\n align-items: center;\n display: flex;\n padding-right: 1px;\n overflow: hidden;\n`;\n\nexport const StyledHiddenDiv = styled('div')`\n display: none;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA4B;AAC5B,2BAA6B;AAC7B,uBAAwD;AAWxD,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA,uBAIH,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAMtD,MAAM,uBAAmB,yBAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAa1C,CAAC,EAAE,WAAW,MAAM,cAAc,sBAAsB;AAAA;AAGrD,MAAM,kBAAc,yBAAO,SAAS;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA,IACG,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAOV,CAAC,UAAW,MAAM,WAAW,MAAM,MAAM,OAAO,QAAQ,GAAG,IAAI,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAE;AAAA;AAAA;AAAA;AAAA,IAItG,CAAC,EAAE,aAAa,MAAM,gBAAgB,2BAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,IAKjE,CAAC,EAAE,kBAAkB,MAAM,qBAAqB,gDAAgD;AAAA;AAG7F,MAAM,6BAAyB,yBAAO,mCAAc;AAAA,EACzD,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA,WAEU,CAAC,UAAW,MAAM,kBAAkB,MAAM,MAAM,OAAO,QAAQ,GAAG,IAAI,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAc1G,MAAM,4BAA4B,wBAAO;AAAA,IAC5C,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAOd,MAAM,yBAAqB,yBAAO,OAAO;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQM,MAAM,sBAAkB,yBAAO,KAAK;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -111,7 +111,11 @@ const useKeyboardNavigation = () => {
|
|
|
111
111
|
if (!multiple) {
|
|
112
112
|
setMenuState(false, import_constants.MENU_CONTROL_REASONS.SELECT_OPTION, e);
|
|
113
113
|
}
|
|
114
|
-
onChange(
|
|
114
|
+
onChange(
|
|
115
|
+
(0, import_listHelper.getSuggestedValueOnChange)(currentItem, selectedValues, isNonClearable),
|
|
116
|
+
currentItem,
|
|
117
|
+
e
|
|
118
|
+
);
|
|
115
119
|
}
|
|
116
120
|
}
|
|
117
121
|
if (e.key === "Enter" && e.altKey) {
|
|
@@ -162,7 +166,11 @@ const useKeyboardNavigation = () => {
|
|
|
162
166
|
if (readOnly) return;
|
|
163
167
|
const lastValue = (0, import_listHelper.getLastValueSelected)(selectedValues);
|
|
164
168
|
if (!e.currentTarget.value && lastValue && !isNonClearable && !lastValue.applyAriaDisabled) {
|
|
165
|
-
onChange(
|
|
169
|
+
onChange(
|
|
170
|
+
(0, import_listHelper.getSuggestedValueOnChange)(lastValue, selectedValues),
|
|
171
|
+
lastValue,
|
|
172
|
+
e
|
|
173
|
+
);
|
|
166
174
|
}
|
|
167
175
|
}
|
|
168
176
|
if (e.key === "Tab" && !inline && menuState) {
|