@elliemae/ds-form-combobox 3.50.1-next.9 → 3.51.0-beta.2

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.
Files changed (124) hide show
  1. package/dist/cjs/ComboBoxCTX.js +4 -6
  2. package/dist/cjs/ComboBoxCTX.js.map +2 -2
  3. package/dist/cjs/ComboboxDataTestids.js +0 -4
  4. package/dist/cjs/ComboboxDataTestids.js.map +2 -2
  5. package/dist/cjs/{parts/header-list/index.js → config/useClickOutside.js} +22 -6
  6. package/dist/cjs/config/useClickOutside.js.map +7 -0
  7. package/dist/cjs/config/useComboBox.js +29 -42
  8. package/dist/cjs/config/useComboBox.js.map +2 -2
  9. package/dist/cjs/config/useCorrectOptions.js +3 -6
  10. package/dist/cjs/config/useCorrectOptions.js.map +2 -2
  11. package/dist/cjs/config/useOptionsPerSection.js +56 -0
  12. package/dist/cjs/config/useOptionsPerSection.js.map +7 -0
  13. package/dist/cjs/parts/Section.js +92 -0
  14. package/dist/cjs/parts/Section.js.map +7 -0
  15. package/dist/cjs/parts/container/Container.js +29 -14
  16. package/dist/cjs/parts/container/Container.js.map +2 -2
  17. package/dist/cjs/parts/controls/Controls.js +6 -4
  18. package/dist/cjs/parts/controls/Controls.js.map +2 -2
  19. package/dist/cjs/parts/controls/styled.js +21 -5
  20. package/dist/cjs/parts/controls/styled.js.map +2 -2
  21. package/dist/cjs/parts/controls/useOnPillsNavigation.js +3 -3
  22. package/dist/cjs/parts/controls/useOnPillsNavigation.js.map +2 -2
  23. package/dist/cjs/parts/controls-input/ControlsInput.js +21 -6
  24. package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
  25. package/dist/cjs/parts/controls-input/styled.js +3 -1
  26. package/dist/cjs/parts/controls-input/styled.js.map +2 -2
  27. package/dist/cjs/parts/controls-input/useKeyboardNavigation.js +17 -20
  28. package/dist/cjs/parts/controls-input/useKeyboardNavigation.js.map +2 -2
  29. package/dist/cjs/parts/controls-input/useMaskedOnChange.js +4 -5
  30. package/dist/cjs/parts/controls-input/useMaskedOnChange.js.map +2 -2
  31. package/dist/cjs/parts/menu-list/MenuList.js +20 -35
  32. package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
  33. package/dist/cjs/parts/menu-list/styled.js.map +2 -2
  34. package/dist/cjs/parts/menu-list/useItemRenderer.js +59 -40
  35. package/dist/cjs/parts/menu-list/useItemRenderer.js.map +2 -2
  36. package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js +10 -2
  37. package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
  38. package/dist/cjs/react-desc-prop-types.js +3 -1
  39. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  40. package/dist/cjs/sharedTypes.js.map +2 -2
  41. package/dist/cjs/utils/listHelper.js +7 -23
  42. package/dist/cjs/utils/listHelper.js.map +2 -2
  43. package/dist/esm/ComboBoxCTX.js +4 -6
  44. package/dist/esm/ComboBoxCTX.js.map +2 -2
  45. package/dist/esm/ComboboxDataTestids.js +0 -4
  46. package/dist/esm/ComboboxDataTestids.js.map +2 -2
  47. package/dist/esm/config/useClickOutside.js +22 -0
  48. package/dist/esm/config/useClickOutside.js.map +7 -0
  49. package/dist/esm/config/useComboBox.js +30 -43
  50. package/dist/esm/config/useComboBox.js.map +2 -2
  51. package/dist/esm/config/useCorrectOptions.js +4 -7
  52. package/dist/esm/config/useCorrectOptions.js.map +2 -2
  53. package/dist/esm/config/useOptionsPerSection.js +26 -0
  54. package/dist/esm/config/useOptionsPerSection.js.map +7 -0
  55. package/dist/esm/parts/Section.js +62 -0
  56. package/dist/esm/parts/Section.js.map +7 -0
  57. package/dist/esm/parts/container/Container.js +30 -15
  58. package/dist/esm/parts/container/Container.js.map +2 -2
  59. package/dist/esm/parts/controls/Controls.js +6 -4
  60. package/dist/esm/parts/controls/Controls.js.map +2 -2
  61. package/dist/esm/parts/controls/styled.js +21 -5
  62. package/dist/esm/parts/controls/styled.js.map +2 -2
  63. package/dist/esm/parts/controls/useOnPillsNavigation.js +3 -3
  64. package/dist/esm/parts/controls/useOnPillsNavigation.js.map +2 -2
  65. package/dist/esm/parts/controls-input/ControlsInput.js +21 -6
  66. package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
  67. package/dist/esm/parts/controls-input/styled.js +3 -1
  68. package/dist/esm/parts/controls-input/styled.js.map +2 -2
  69. package/dist/esm/parts/controls-input/useKeyboardNavigation.js +17 -20
  70. package/dist/esm/parts/controls-input/useKeyboardNavigation.js.map +2 -2
  71. package/dist/esm/parts/controls-input/useMaskedOnChange.js +4 -5
  72. package/dist/esm/parts/controls-input/useMaskedOnChange.js.map +2 -2
  73. package/dist/esm/parts/menu-list/MenuList.js +21 -36
  74. package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
  75. package/dist/esm/parts/menu-list/styled.js.map +2 -2
  76. package/dist/esm/parts/menu-list/useItemRenderer.js +61 -42
  77. package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
  78. package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js +10 -2
  79. package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
  80. package/dist/esm/react-desc-prop-types.js +3 -1
  81. package/dist/esm/react-desc-prop-types.js.map +2 -2
  82. package/dist/esm/sharedTypes.js.map +2 -2
  83. package/dist/esm/utils/listHelper.js +7 -23
  84. package/dist/esm/utils/listHelper.js.map +2 -2
  85. package/dist/types/ComboboxDataTestids.d.ts +0 -4
  86. package/dist/types/config/useClickOutside.d.ts +1 -0
  87. package/dist/types/config/useCorrectOptions.d.ts +1 -1
  88. package/dist/types/config/useOptionsPerSection.d.ts +2 -0
  89. package/dist/types/parts/DropdownIndicator.d.ts +1 -0
  90. package/dist/types/parts/Section.d.ts +14 -0
  91. package/dist/types/parts/container/Container.d.ts +1 -0
  92. package/dist/types/parts/controls/Controls.d.ts +1 -0
  93. package/dist/types/parts/controls/styled.d.ts +2 -0
  94. package/dist/types/parts/controls-input/ControlsInput.d.ts +1 -0
  95. package/dist/types/parts/controls-input/styled.d.ts +3 -1
  96. package/dist/types/parts/menu-list/MenuList.d.ts +1 -0
  97. package/dist/types/parts/menu-list/SkeletonContainer.d.ts +1 -0
  98. package/dist/types/parts/menu-list/styled.d.ts +0 -1
  99. package/dist/types/parts/menu-list/useItemRenderer.d.ts +1 -0
  100. package/dist/types/parts/multi-selected-values-container/MultiSelectedValuesContainer.d.ts +1 -0
  101. package/dist/types/react-desc-prop-types.d.ts +4 -1
  102. package/dist/types/sharedTypes.d.ts +1 -4
  103. package/dist/types/tests/read-only.test.d.ts +1 -0
  104. package/dist/types/utils/listHelper.d.ts +0 -1
  105. package/package.json +19 -19
  106. package/dist/cjs/parts/header-list/HeaderList.js +0 -104
  107. package/dist/cjs/parts/header-list/HeaderList.js.map +0 -7
  108. package/dist/cjs/parts/header-list/index.js.map +0 -7
  109. package/dist/cjs/parts/header-list/styled.js +0 -85
  110. package/dist/cjs/parts/header-list/styled.js.map +0 -7
  111. package/dist/cjs/parts/header-list/useHeaderListHandlers.js +0 -140
  112. package/dist/cjs/parts/header-list/useHeaderListHandlers.js.map +0 -7
  113. package/dist/esm/parts/header-list/HeaderList.js +0 -80
  114. package/dist/esm/parts/header-list/HeaderList.js.map +0 -7
  115. package/dist/esm/parts/header-list/index.js +0 -6
  116. package/dist/esm/parts/header-list/index.js.map +0 -7
  117. package/dist/esm/parts/header-list/styled.js +0 -55
  118. package/dist/esm/parts/header-list/styled.js.map +0 -7
  119. package/dist/esm/parts/header-list/useHeaderListHandlers.js +0 -110
  120. package/dist/esm/parts/header-list/useHeaderListHandlers.js.map +0 -7
  121. package/dist/types/parts/header-list/HeaderList.d.ts +0 -1
  122. package/dist/types/parts/header-list/index.d.ts +0 -1
  123. package/dist/types/parts/header-list/styled.d.ts +0 -6
  124. package/dist/types/parts/header-list/useHeaderListHandlers.d.ts +0 -11
@@ -1,17 +1,19 @@
1
1
  import * as React from "react";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useCallback, useEffect, useContext } from "react";
3
+ import { useCallback, useMemo, useEffect, useContext } from "react";
4
4
  import { useGetGlobalAttributes, useGetXstyledProps } from "@elliemae/ds-props-helpers";
5
- import { DSPopperJS } from "@elliemae/ds-popperjs";
5
+ import { mergeRefs } from "@elliemae/ds-system";
6
+ import { useFloatingContext, FloatingWrapper } from "@elliemae/ds-floating-context";
6
7
  import ComboBoxContext from "../../ComboBoxCTX.js";
7
8
  import { StyledContainer, StyledPopperWrapper } from "./styled.js";
8
9
  import { Controls } from "../controls/index.js";
9
10
  import { MenuList } from "../menu-list/index.js";
10
11
  import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
11
12
  import { LiveRegion } from "../LiveRegion.js";
13
+ import { useOnClickOutside } from "../../config/useClickOutside.js";
12
14
  const Container = () => {
13
15
  const { props, internalRef, setMenuState, menuState, setReferenceElement, referenceElement } = useContext(ComboBoxContext);
14
- const { inline, startPlacementPreference, placementOrderPreference, withoutPortal, applyAriaDisabled } = props;
16
+ const { inline, startPlacementPreference, placementOrderPreference, applyAriaDisabled } = props;
15
17
  const globalAttributes = useGetGlobalAttributes(props);
16
18
  const { zIndex, ...xStyledProps } = useGetXstyledProps(props);
17
19
  const correctZIndex = zIndex ? parseInt(zIndex, 10) : void 0;
@@ -32,13 +34,32 @@ const Container = () => {
32
34
  window.removeEventListener("blur", closeMenuOnWindowBlur);
33
35
  };
34
36
  }, [menuState, setMenuState]);
37
+ const config = useMemo(
38
+ () => ({
39
+ placement: "bottom",
40
+ withoutAnimation: true,
41
+ startPlacementPreference,
42
+ placementOrderPreference,
43
+ zIndex: correctZIndex,
44
+ customOffset: [0, 5],
45
+ handleCloseMenu,
46
+ portalDOMContainer: document.body
47
+ }),
48
+ [startPlacementPreference, placementOrderPreference, correctZIndex, handleCloseMenu]
49
+ );
50
+ const { refs, floatingStyles, context } = useFloatingContext(config);
51
+ const comboboxRef = mergeRefs(setReferenceElement, refs.setReference);
52
+ const hideTooltip = useCallback(() => {
53
+ setMenuState(false, "blur");
54
+ }, [setMenuState]);
55
+ useOnClickOutside(referenceElement, hideTooltip, refs.floating);
35
56
  return (
36
57
  // eslint-disable-next-line react/jsx-no-useless-fragment
37
58
  /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
38
59
  StyledContainer,
39
60
  {
40
61
  "data-testid": dataTestId ?? ComboboxDataTestid.CONTAINER,
41
- innerRef: setReferenceElement,
62
+ innerRef: comboboxRef,
42
63
  className,
43
64
  applyAriaDisabled,
44
65
  ...xStyledProps,
@@ -50,18 +71,12 @@ const Container = () => {
50
71
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
51
72
  /* @__PURE__ */ jsx(Controls, {}),
52
73
  referenceElement ? /* @__PURE__ */ jsx(
53
- DSPopperJS,
74
+ FloatingWrapper,
54
75
  {
55
- customOffset: [0, 5],
56
- referenceElement,
57
- showPopover: menuState,
58
- closeContextMenu: handleCloseMenu,
59
- startPlacementPreference,
60
- placementOrderPreference,
61
- withoutPortal,
62
- withoutArrow: true,
63
- withoutAnimation: true,
64
- zIndex: correctZIndex,
76
+ innerRef: refs.setFloating,
77
+ floatingStyles,
78
+ isOpen: menuState,
79
+ context,
65
80
  children: /* @__PURE__ */ jsx(StyledPopperWrapper, { tabIndex: -1, onMouseDown: handleMouseDown, applyAriaDisabled, children: /* @__PURE__ */ jsx(MenuList, {}) })
66
81
  }
67
82
  ) : null
@@ -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 complexity */\nimport React, { useCallback, useEffect, useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { StyledContainer, StyledPopperWrapper } from './styled.js';\nimport { Controls } from '../controls/index.js';\nimport { MenuList } from '../menu-list/index.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { LiveRegion } from '../LiveRegion.js';\n\nexport const Container = (): JSX.Element => {\n const { props, internalRef, setMenuState, menuState, setReferenceElement, referenceElement } =\n useContext(ComboBoxContext);\n\n const { inline, startPlacementPreference, placementOrderPreference, withoutPortal, applyAriaDisabled } = props;\n const globalAttributes = useGetGlobalAttributes(props) as ReturnType<typeof useGetGlobalAttributes> & {\n 'data-testid'?: string;\n };\n const { zIndex, ...xStyledProps } = useGetXstyledProps(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 const handleCloseMenu = useCallback(() => {\n setMenuState(false, 'blur');\n if (internalRef?.current) internalRef.current.blur();\n }, [internalRef, setMenuState]);\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 return (\n // eslint-disable-next-line react/jsx-no-useless-fragment\n <>\n <StyledContainer\n data-testid={dataTestId ?? ComboboxDataTestid.CONTAINER}\n innerRef={setReferenceElement}\n className={className}\n applyAriaDisabled={applyAriaDisabled}\n {...xStyledProps}\n >\n <LiveRegion />\n\n {inline ? (\n <>\n <Controls />\n <MenuList />\n </>\n ) : (\n <>\n <Controls />\n {referenceElement ? (\n <DSPopperJS\n customOffset={[0, 5]}\n referenceElement={referenceElement}\n showPopover={menuState}\n closeContextMenu={handleCloseMenu}\n startPlacementPreference={startPlacementPreference}\n placementOrderPreference={placementOrderPreference}\n withoutPortal={withoutPortal}\n withoutArrow\n withoutAnimation\n zIndex={correctZIndex}\n >\n <StyledPopperWrapper tabIndex={-1} onMouseDown={handleMouseDown} applyAriaDisabled={applyAriaDisabled}>\n <MenuList />\n </StyledPopperWrapper>\n </DSPopperJS>\n ) : null}\n </>\n )}\n </StyledContainer>\n </>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACuDf,SAGE,UAHF,KAGE,YAHF;AAtDR,SAAgB,aAAa,WAAW,kBAAkB;AAC1D,SAAS,wBAAwB,0BAA0B;AAC3D,SAAS,kBAAkB;AAC3B,OAAO,qBAAqB;AAC5B,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,0BAA0B;AACnC,SAAS,kBAAkB;AAEpB,MAAM,YAAY,MAAmB;AAC1C,QAAM,EAAE,OAAO,aAAa,cAAc,WAAW,qBAAqB,iBAAiB,IACzF,WAAW,eAAe;AAE5B,QAAM,EAAE,QAAQ,0BAA0B,0BAA0B,eAAe,kBAAkB,IAAI;AACzG,QAAM,mBAAmB,uBAAuB,KAAK;AAGrD,QAAM,EAAE,QAAQ,GAAG,aAAa,IAAI,mBAAmB,KAAK;AAE5D,QAAM,gBAAgB,SAAS,SAAS,QAAkB,EAAE,IAAI;AAEhE,QAAM,EAAE,WAAW,eAAe,WAAW,IAAI;AACjD,QAAM,kBAAkB,YAAY,CAAC,MAAwB;AAC3D,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,QAAM,kBAAkB,YAAY,MAAM;AACxC,iBAAa,OAAO,MAAM;AAC1B,QAAI,aAAa,QAAS,aAAY,QAAQ,KAAK;AAAA,EACrD,GAAG,CAAC,aAAa,YAAY,CAAC;AAE9B,YAAU,MAAM;AACd,UAAM,wBAAwB,MAAM;AAClC,UAAI,UAAW,cAAa,OAAO,MAAM;AAAA,IAC3C;AAEA,WAAO,iBAAiB,QAAQ,qBAAqB;AAErD,WAAO,MAAM;AACX,aAAO,oBAAoB,QAAQ,qBAAqB;AAAA,IAC1D;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,CAAC;AAE5B;AAAA;AAAA,IAEE,gCACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAa,cAAc,mBAAmB;AAAA,QAC9C,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QAEJ;AAAA,8BAAC,cAAW;AAAA,UAEX,SACC,iCACE;AAAA,gCAAC,YAAS;AAAA,YACV,oBAAC,YAAS;AAAA,aACZ,IAEA,iCACE;AAAA,gCAAC,YAAS;AAAA,YACT,mBACC;AAAA,cAAC;AAAA;AAAA,gBACC,cAAc,CAAC,GAAG,CAAC;AAAA,gBACnB;AAAA,gBACA,aAAa;AAAA,gBACb,kBAAkB;AAAA,gBAClB;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,cAAY;AAAA,gBACZ,kBAAgB;AAAA,gBAChB,QAAQ;AAAA,gBAER,8BAAC,uBAAoB,UAAU,IAAI,aAAa,iBAAiB,mBAC/D,8BAAC,YAAS,GACZ;AAAA;AAAA,YACF,IACE;AAAA,aACN;AAAA;AAAA;AAAA,IAEJ,GACF;AAAA;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useCallback, useMemo, useEffect, useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { useFloatingContext, FloatingWrapper, type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { StyledContainer, StyledPopperWrapper } from './styled.js';\nimport { Controls } from '../controls/index.js';\nimport { MenuList } from '../menu-list/index.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { LiveRegion } from '../LiveRegion.js';\nimport { useOnClickOutside } from '../../config/useClickOutside.js';\n\nexport const Container = (): JSX.Element => {\n const { props, internalRef, setMenuState, menuState, setReferenceElement, referenceElement } =\n useContext(ComboBoxContext);\n\n const { inline, startPlacementPreference, placementOrderPreference, applyAriaDisabled } = props;\n const globalAttributes = useGetGlobalAttributes(props) as ReturnType<typeof useGetGlobalAttributes> & {\n 'data-testid'?: string;\n };\n const { zIndex, ...xStyledProps } = useGetXstyledProps(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 const handleCloseMenu = useCallback(() => {\n setMenuState(false, 'blur');\n if (internalRef?.current) internalRef.current.blur();\n }, [internalRef, setMenuState]);\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 const config = useMemo(\n () => ({\n placement: 'bottom' as DSHookFloatingContextT.PopperPlacementsT,\n withoutAnimation: true,\n startPlacementPreference,\n placementOrderPreference,\n zIndex: correctZIndex,\n customOffset: [0, 5] as [number, number],\n handleCloseMenu,\n portalDOMContainer: document.body,\n }),\n [startPlacementPreference, placementOrderPreference, correctZIndex, handleCloseMenu],\n );\n\n const { refs, floatingStyles, context } = useFloatingContext(config);\n\n const comboboxRef = mergeRefs(setReferenceElement, refs.setReference);\n\n const hideTooltip = useCallback(() => {\n setMenuState(false, 'blur');\n }, [setMenuState]);\n\n useOnClickOutside(referenceElement, hideTooltip, refs.floating);\n\n return (\n // eslint-disable-next-line react/jsx-no-useless-fragment\n <>\n <StyledContainer\n data-testid={dataTestId ?? ComboboxDataTestid.CONTAINER}\n innerRef={comboboxRef}\n className={className}\n applyAriaDisabled={applyAriaDisabled}\n {...xStyledProps}\n >\n <LiveRegion />\n\n {inline ? (\n <>\n <Controls />\n <MenuList />\n </>\n ) : (\n <>\n <Controls />\n {referenceElement ? (\n <FloatingWrapper\n innerRef={refs.setFloating}\n floatingStyles={floatingStyles}\n isOpen={menuState}\n context={context}\n >\n <StyledPopperWrapper tabIndex={-1} onMouseDown={handleMouseDown} applyAriaDisabled={applyAriaDisabled}>\n <MenuList />\n </StyledPopperWrapper>\n </FloatingWrapper>\n ) : null}\n </>\n )}\n </StyledContainer>\n </>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACiFf,SAGE,UAHF,KAGE,YAHF;AAhFR,SAAgB,aAAa,SAAS,WAAW,kBAAkB;AACnE,SAAS,wBAAwB,0BAA0B;AAC3D,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB,uBAAoD;AACjF,OAAO,qBAAqB;AAC5B,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,0BAA0B;AACnC,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAE3B,MAAM,YAAY,MAAmB;AAC1C,QAAM,EAAE,OAAO,aAAa,cAAc,WAAW,qBAAqB,iBAAiB,IACzF,WAAW,eAAe;AAE5B,QAAM,EAAE,QAAQ,0BAA0B,0BAA0B,kBAAkB,IAAI;AAC1F,QAAM,mBAAmB,uBAAuB,KAAK;AAGrD,QAAM,EAAE,QAAQ,GAAG,aAAa,IAAI,mBAAmB,KAAK;AAE5D,QAAM,gBAAgB,SAAS,SAAS,QAAkB,EAAE,IAAI;AAEhE,QAAM,EAAE,WAAW,eAAe,WAAW,IAAI;AACjD,QAAM,kBAAkB,YAAY,CAAC,MAAwB;AAC3D,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,QAAM,kBAAkB,YAAY,MAAM;AACxC,iBAAa,OAAO,MAAM;AAC1B,QAAI,aAAa,QAAS,aAAY,QAAQ,KAAK;AAAA,EACrD,GAAG,CAAC,aAAa,YAAY,CAAC;AAE9B,YAAU,MAAM;AACd,UAAM,wBAAwB,MAAM;AAClC,UAAI,UAAW,c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
  }
@@ -17,7 +17,7 @@ import { ControlsInput } from "../controls-input/ControlsInput.js";
17
17
  import { useOnPillsNavigation } from "./useOnPillsNavigation.js";
18
18
  const Controls = () => {
19
19
  const {
20
- props: { inline, disabled, inputMinWidth, hasError, selectedValues, applyAriaDisabled },
20
+ props: { inline, disabled, inputMinWidth, hasError, selectedValues, applyAriaDisabled, readOnly },
21
21
  selectedOptionsRef,
22
22
  setMenuState,
23
23
  setFocusOptionIdx,
@@ -30,7 +30,7 @@ const Controls = () => {
30
30
  internalRef
31
31
  } = useContext(ComboBoxContext);
32
32
  const handleOnClick = useCallback(() => {
33
- if (disabled) return;
33
+ if (disabled || readOnly) return;
34
34
  if (applyAriaDisabled) {
35
35
  internalRef.current?.focus();
36
36
  return;
@@ -47,14 +47,14 @@ const Controls = () => {
47
47
  const handleOnPillsClick = useCallback(
48
48
  (e) => {
49
49
  if (applyAriaDisabled) return;
50
- if (menuState || disabled) {
50
+ if (menuState || disabled || readOnly) {
51
51
  e.stopPropagation();
52
52
  } else {
53
53
  internalRef.current?.focus();
54
54
  setMenuState(true, "pill-click");
55
55
  }
56
56
  },
57
- [menuState, internalRef, disabled, setMenuState, applyAriaDisabled]
57
+ [applyAriaDisabled, menuState, disabled, readOnly, internalRef, setMenuState]
58
58
  );
59
59
  const handleOnMouseDown = useCallback(
60
60
  (e) => {
@@ -73,6 +73,7 @@ const Controls = () => {
73
73
  StyledControlsWrapper,
74
74
  {
75
75
  innerRef: controlsWrapperRef,
76
+ readOnly,
76
77
  cols,
77
78
  disabled,
78
79
  applyAriaDisabled,
@@ -88,6 +89,7 @@ const Controls = () => {
88
89
  !inline && /* @__PURE__ */ jsx(StyledSelection, { innerRef: selectedOptionsRef, onClick: handleOnPillsClick, children: Array.isArray(selectedValues) ? /* @__PURE__ */ jsx(MultiSelectedValuesContainer, {}) : /* @__PURE__ */ jsx(
89
90
  StyledSingleSelectWraper,
90
91
  {
92
+ readOnly,
91
93
  "data-testid": ComboboxDataTestid.SELECTED_VALUES,
92
94
  disabled,
93
95
  applyAriaDisabled,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/controls/Controls.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport React, { useContext, useMemo, useCallback } from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { DropdownIndicator } from '../DropdownIndicator.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\n\nimport {\n StyledControlsWrapper,\n StyleHeaderActionsSeparator,\n StyledHeaderActionsWrapper,\n StyledSelection,\n StyledSingleSelectWraper,\n} from './styled.js';\nimport { MultiSelectedValuesContainer } from '../multi-selected-values-container/index.js';\nimport { ControlsInput } from '../controls-input/ControlsInput.js';\nimport { useOnPillsNavigation } from './useOnPillsNavigation.js';\nexport const Controls = (): JSX.Element => {\n const {\n props: { inline, disabled, inputMinWidth, hasError, selectedValues, applyAriaDisabled },\n selectedOptionsRef,\n setMenuState,\n setFocusOptionIdx,\n hasFocus,\n inputValue,\n listRef,\n focusOptionIdx,\n menuState,\n controlsWrapperRef,\n internalRef,\n } = useContext(ComboBoxContext);\n\n const handleOnClick = useCallback(() => {\n if (disabled) return;\n if (applyAriaDisabled) {\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 }, [disabled, listRef, hasFocus, menuState, inline, setMenuState, focusOptionIdx]);\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) {\n e.stopPropagation();\n } else {\n internalRef.current?.focus();\n setMenuState(true, 'pill-click');\n }\n },\n [menuState, internalRef, disabled, setMenuState, applyAriaDisabled],\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)', '2.231rem'] : ['minmax(0px, auto)']),\n [inline],\n );\n return (\n <StyledControlsWrapper\n innerRef={controlsWrapperRef}\n cols={cols}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n minWidth={inputMinWidth}\n hasError={hasError}\n inline={inline}\n onClick={handleOnClick}\n onMouseDown={handleOnMouseDown}\n onKeyDown={onKeyDownPills}\n aria-disabled={applyAriaDisabled}\n data-testid={ComboboxDataTestid.CONTROLS_WRAPPER}\n >\n {!inline && (\n <StyledSelection innerRef={selectedOptionsRef} onClick={handleOnPillsClick}>\n {Array.isArray(selectedValues) ? (\n <MultiSelectedValuesContainer />\n ) : (\n <StyledSingleSelectWraper\n data-testid={ComboboxDataTestid.SELECTED_VALUES}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n >\n {selectedValues && inputValue === '' ? <SimpleTruncatedTooltipText value={selectedValues.label} /> : null}\n </StyledSingleSelectWraper>\n )}\n </StyledSelection>\n )}\n\n <ControlsInput />\n {!inline && (\n <StyledHeaderActionsWrapper\n justifyItems=\"center\"\n cols={['min-content', 'minmax(28px,max-content)']}\n justifyContent=\"flex-end\"\n >\n <StyleHeaderActionsSeparator disabled={disabled} applyAriaDisabled={applyAriaDisabled} />\n <DropdownIndicator />\n </StyledHeaderActionsWrapper>\n )}\n </StyledControlsWrapper>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACmGX,cAeJ,YAfI;AAjGZ,SAAgB,YA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,IACF;AAAA,IACA,CAAC,aAAa,MAAM;AAAA,EACtB;AAEA,QAAM,EAAE,eAAe,IAAI,qBAAqB;AAEhD,QAAM,OAAO;AAAA,IACX,MAAO,CAAC,SAAS,CAAC,2BAA2B,sBAAsB,UAAU,IAAI,CAAC,mBAAmB;AAAA,IACrG,CAAC,MAAM;AAAA,EACT;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,aAAa;AAAA,MACb,WAAW;AAAA,MACX,iBAAe;AAAA,MACf,eAAa,mBAAmB;AAAA,MAE/B;AAAA,SAAC,UACA,oBAAC,mBAAgB,UAAU,oBAAoB,SAAS,oBACrD,gBAAM,QAAQ,cAAc,IAC3B,oBAAC,gCAA6B,IAE9B;AAAA,UAAC;AAAA;AAAA,YACC,eAAa,mBAAmB;AAAA,YAChC;AAAA,YACA;AAAA,YAEC,4BAAkB,eAAe,KAAK,oBAAC,8BAA2B,OAAO,eAAe,OAAO,IAAK;AAAA;AAAA,QACvG,GAEJ;AAAA,QAGF,oBAAC,iBAAc;AAAA,QACd,CAAC,UACA;AAAA,UAAC;AAAA;AAAA,YACC,cAAa;AAAA,YACb,MAAM,CAAC,eAAe,0BAA0B;AAAA,YAChD,gBAAe;AAAA,YAEf;AAAA,kCAAC,+BAA4B,UAAoB,mBAAsC;AAAA,cACvF,oBAAC,qBAAkB;AAAA;AAAA;AAAA,QACrB;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport React, { useContext, useMemo, useCallback } from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { DropdownIndicator } from '../DropdownIndicator.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\n\nimport {\n StyledControlsWrapper,\n StyleHeaderActionsSeparator,\n StyledHeaderActionsWrapper,\n StyledSelection,\n StyledSingleSelectWraper,\n} from './styled.js';\nimport { MultiSelectedValuesContainer } from '../multi-selected-values-container/index.js';\nimport { ControlsInput } from '../controls-input/ControlsInput.js';\nimport { useOnPillsNavigation } from './useOnPillsNavigation.js';\nexport const Controls = (): JSX.Element => {\n const {\n props: { inline, disabled, inputMinWidth, hasError, selectedValues, applyAriaDisabled, readOnly },\n selectedOptionsRef,\n setMenuState,\n setFocusOptionIdx,\n hasFocus,\n inputValue,\n listRef,\n focusOptionIdx,\n menuState,\n controlsWrapperRef,\n internalRef,\n } = useContext(ComboBoxContext);\n\n const handleOnClick = useCallback(() => {\n if (disabled || readOnly) return;\n if (applyAriaDisabled) {\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 }, [disabled, listRef, hasFocus, menuState, inline, setMenuState, focusOptionIdx]);\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 || readOnly) {\n e.stopPropagation();\n } else {\n internalRef.current?.focus();\n setMenuState(true, 'pill-click');\n }\n },\n [applyAriaDisabled, menuState, disabled, readOnly, internalRef, setMenuState],\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)', '2.231rem'] : ['minmax(0px, auto)']),\n [inline],\n );\n return (\n <StyledControlsWrapper\n innerRef={controlsWrapperRef}\n readOnly={readOnly}\n cols={cols}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n minWidth={inputMinWidth}\n hasError={hasError}\n inline={inline}\n onClick={handleOnClick}\n onMouseDown={handleOnMouseDown}\n onKeyDown={onKeyDownPills}\n aria-disabled={applyAriaDisabled}\n data-testid={ComboboxDataTestid.CONTROLS_WRAPPER}\n >\n {!inline && (\n <StyledSelection innerRef={selectedOptionsRef} onClick={handleOnPillsClick}>\n {Array.isArray(selectedValues) ? (\n <MultiSelectedValuesContainer />\n ) : (\n <StyledSingleSelectWraper\n readOnly={readOnly}\n data-testid={ComboboxDataTestid.SELECTED_VALUES}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n >\n {selectedValues && inputValue === '' ? <SimpleTruncatedTooltipText value={selectedValues.label} /> : null}\n </StyledSingleSelectWraper>\n )}\n </StyledSelection>\n )}\n\n <ControlsInput />\n {!inline && (\n <StyledHeaderActionsWrapper\n justifyItems=\"center\"\n cols={['min-content', 'minmax(28px,max-content)']}\n justifyContent=\"flex-end\"\n >\n <StyleHeaderActionsSeparator disabled={disabled} applyAriaDisabled={applyAriaDisabled} />\n <DropdownIndicator />\n </StyledHeaderActionsWrapper>\n )}\n </StyledControlsWrapper>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACoGX,cAgBJ,YAhBI;AAlGZ,SAAgB,YAAY,SAAS,mBAAmB;AACxD,SAAS,kCAAkC;AAC3C,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,OAAO,qBAAqB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oCAAoC;AAC7C,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AAC9B,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ,OAAO,EAAE,QAAQ,UAAU,eAAe,UAAU,gBAAgB,mBA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AA,MACA,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,aAAa;AAAA,MACb,WAAW;AAAA,MACX,iBAAe;AAAA,MACf,eAAa,mBAAmB;AAAA,MAE/B;AAAA,SAAC,UACA,oBAAC,mBAAgB,UAAU,oBAAoB,SAAS,oBACrD,gBAAM,QAAQ,cAAc,IAC3B,oBAAC,gCAA6B,IAE9B;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,eAAa,mBAAmB;AAAA,YAChC;AAAA,YACA;AAAA,YAEC,4BAAkB,eAAe,KAAK,oBAAC,8BAA2B,OAAO,eAAe,OAAO,IAAK;AAAA;AAAA,QACvG,GAEJ;AAAA,QAGF,oBAAC,iBAAc;AAAA,QACd,CAAC,UACA;AAAA,UAAC;AAAA;AAAA,YACC,cAAa;AAAA,YACb,MAAM,CAAC,eAAe,0BAA0B;AAAA,YAChD,gBAAe;AAAA,YAEf;AAAA,kCAAC,+BAA4B,UAAoB,mBAAsC;AAAA,cACvF,oBAAC,qBAAkB;AAAA;AAAA;AAAA,QACrB;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -2,21 +2,37 @@ import * as React from "react";
2
2
  import { styled, css, th } from "@elliemae/ds-system";
3
3
  import { Grid } from "@elliemae/ds-grid";
4
4
  import { DSComboBoxName, DSComboboxSlots } from "../../theming.js";
5
- const normalBorder = css`
5
+ const readOnlyBorder = css`
6
+ border: 1px solid ${({ theme }) => theme.colors.neutral["080"]};
7
+ border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[400]};
8
+ `;
9
+ const borderStyles = css`
6
10
  border: 1px solid ${({ hasError, theme }) => hasError ? theme.colors.danger[900] : theme.colors.neutral[400]};
11
+ ${({ readOnly, applyAriaDisabled }) => readOnly || applyAriaDisabled ? readOnlyBorder : ""}
12
+ `;
13
+ const backgroundStyles = css`
14
+ background: ${({ disabled, applyAriaDisabled, readOnly, theme }) => {
15
+ if (readOnly || applyAriaDisabled) {
16
+ return theme.colors.neutral["050"];
17
+ }
18
+ if (disabled) {
19
+ return theme.colors.neutral["080"];
20
+ }
21
+ return "#ffffff";
22
+ }};
7
23
  `;
8
24
  const focusBorder = css`
9
25
  outline: 2px solid ${({ theme }) => theme.colors.brand[700]};
10
26
  outline-offset: -2px;
11
27
  `;
12
28
  const hoverBorder = css`
13
- border: 1px solid ${({ theme }) => theme.colors.brand[700]};
29
+ border: 1px solid ${({ theme }) => theme.colors.brand[600]};
14
30
  `;
15
31
  const StyledControlsWrapper = styled(Grid, {
16
32
  name: DSComboBoxName,
17
33
  slot: DSComboboxSlots.INPUT_WRAPPER
18
34
  })`
19
- background: ${({ disabled, applyAriaDisabled, theme }) => disabled || applyAriaDisabled ? theme.colors.neutral["080"] : "#ffffff"};
35
+ ${backgroundStyles}
20
36
  position: relative;
21
37
  border-radius: 2px;
22
38
  min-width: ${({ minWidth, inline }) => inline || !minWidth ? "" : `${minWidth}px`};
@@ -28,7 +44,7 @@ const StyledControlsWrapper = styled(Grid, {
28
44
  padding: 1.25px 0px 1.25px 8px;
29
45
  }
30
46
  margin: ${({ inline }) => inline ? "10px 16px" : ""};
31
- ${normalBorder}
47
+ ${borderStyles}
32
48
  &:hover {
33
49
  ${({ disabled }) => !disabled ? hoverBorder : ""}
34
50
  }
@@ -40,7 +56,7 @@ const StyledSingleSelectWraper = styled.div`
40
56
  display: flex;
41
57
  width: 100%;
42
58
  align-items: center;
43
- color: ${({ disabled, applyAriaDisabled }) => disabled || applyAriaDisabled ? "#616b7f" : ""};
59
+ color: ${({ disabled, readOnly, applyAriaDisabled }) => disabled || applyAriaDisabled || readOnly ? "#616b7f" : ""};
44
60
  user-select: ${({ disabled, applyAriaDisabled }) => disabled || applyAriaDisabled ? "none" : ""};
45
61
  `;
46
62
  const StyledSelection = styled.div`
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/controls/styled.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css, th } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSComboBoxName, DSComboboxSlots } from '../../theming.js';\n\ninterface StyledControlsWrapperT {\n hasError: boolean;\n inline: boolean;\n minWidth?: number;\n disabled: boolean;\n applyAriaDisabled: boolean;\n}\nconst normalBorder = css<{ hasError: boolean }>`\n border: 1px solid ${({ hasError, theme }) => (hasError ? theme.colors.danger[900] : theme.colors.neutral[400])};\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[700]};\n`;\nexport const StyledControlsWrapper = styled(Grid, {\n name: DSComboBoxName,\n slot: DSComboboxSlots.INPUT_WRAPPER,\n})<StyledControlsWrapperT>`\n background: ${({ disabled, applyAriaDisabled, theme }) =>\n disabled || applyAriaDisabled ? theme.colors.neutral['080'] : '#ffffff'};\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 ? '10px 16px' : '')};\n ${normalBorder}\n &:hover {\n ${({ disabled }) => (!disabled ? hoverBorder : '')}\n }\n &:focus-within {\n ${focusBorder}\n }\n`;\n\nexport const StyledSingleSelectWraper = styled.div<{ disabled: boolean; applyAriaDisabled: boolean }>`\n display: flex;\n width: 100%;\n align-items: center;\n color: ${({ disabled, applyAriaDisabled }) => (disabled || applyAriaDisabled ? '#616b7f' : '')};\n user-select: ${({ disabled, applyAriaDisabled }) => (disabled || applyAriaDisabled ? 'none' : '')};\n`;\n\nexport const StyledSelection = styled.div`\n font-size: 1rem;\n margin-right: 3px;\n display: flex;\n`;\n\nexport const StyledHeaderActionsWrapper = styled(Grid)`\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<Partial<StyledControlsWrapperT>>`\n height: 100%;\n width: 1px;\n background-color: ${({ theme, disabled, applyAriaDisabled }) =>\n disabled || applyAriaDisabled ? theme.colors.neutral['400'] : theme.colors.neutral['500']};\n`;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,KAAK,UAAU;AAChC,SAAS,YAAY;AACrB,SAAS,gBAAgB,uBAAuB;AAShD,MAAM,eAAe;AAAA,sBACC,CAAC,EAAE,UAAU,MAAM,MAAO,WAAW,MAAM,OAAO,OAAO,GAAG,IAAI,MAAM,OAAO,QAAQ,GAAG,CAAE;AAAA;AAEhH,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;AAErD,MAAM,wBAAwB,OAAO,MAAM;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,gBAAgB;AACxB,CAAC;AAAA,gBACe,CAAC,EAAE,UAAU,mBAAmB,MAAM,MAClD,YAAY,oBAAoB,MAAM,OAAO,QAAQ,KAAK,IAAI,SAAS;AAAA;AAAA;AAAA,eAG5D,CAAC,EAAE,UAAU,OAAO,MAAO,UAAU,CAAC,WAAW,KAAK,GAAG,QAAQ,IAAK;AAAA;AAAA;AAAA;AAAA;AAAA,uBAK9D,GAAG,WAAW,OAAO,CAAC;AAAA;AAAA;AAAA,YAGjC,CAAC,EAAE,OAAO,MAAO,SAAS,cAAc,EAAG;AAAA,IACnD,YAAY;AAAA;AAAA,MAEV,CAAC,EAAE,SAAS,MAAO,CAAC,WAAW,cAAc,EAAG;AAAA;AAAA;AAAA,MAGhD,WAAW;AAAA;AAAA;AAIV,MAAM,2BAA2B,OAAO;AAAA;AAAA;AAAA;AAAA,WAIpC,CAAC,EAAE,UAAU,kBAAkB,MAAO,YAAY,oBAAoB,YAAY,EAAG;AAAA,iBAC/E,CAAC,EAAE,UAAU,kBAAkB,MAAO,YAAY,oBAAoB,SAAS,EAAG;AAAA;AAG5F,MAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA;AAM/B,MAAM,6BAA6B,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9C,MAAM,yBAAyB,OAAO;AAEtC,MAAM,8BAA8B,OAAO;AAAA;AAAA;AAAA,sBAG5B,CAAC,EAAE,OAAO,UAAU,kBAAkB,MACxD,YAAY,oBAAoB,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css, th } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSComboBoxName, DSComboboxSlots } from '../../theming.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: DSComboBoxName,\n slot: DSComboboxSlots.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 ? '10px 16px' : '')};\n ${borderStyles}\n &:hover {\n ${({ disabled }) => (!disabled ? hoverBorder : '')}\n }\n &:focus-within {\n ${focusBorder}\n }\n`;\n\nexport const StyledSingleSelectWraper = styled.div<{\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n}>`\n display: flex;\n width: 100%;\n align-items: center;\n color: ${({ disabled, readOnly, applyAriaDisabled }) => (disabled || applyAriaDisabled || readOnly ? '#616b7f' : '')};\n user-select: ${({ disabled, applyAriaDisabled }) => (disabled || applyAriaDisabled ? 'none' : '')};\n`;\n\nexport const StyledSelection = styled.div`\n font-size: 1rem;\n margin-right: 3px;\n display: flex;\n`;\n\nexport const StyledHeaderActionsWrapper = styled(Grid)`\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<Partial<StyledControlsWrapperT>>`\n height: 100%;\n width: 1px;\n background-color: ${({ theme, disabled, applyAriaDisabled }) =>\n disabled || applyAriaDisabled ? theme.colors.neutral['400'] : theme.colors.neutral['500']};\n`;\n"],
5
+ "mappings": "AAAA,YA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;AAAA,IACnD,YAAY;AAAA;AAAA,MAEV,CAAC,EAAE,SAAS,MAAO,CAAC,WAAW,cAAc,EAAG;AAAA;AAAA;AAAA,MAGhD,WAAW;AAAA;AAAA;AAIV,MAAM,2BAA2B,OAAO;AAAA;AAAA;AAAA;AAAA,WAQpC,CAAC,EAAE,UAAU,UAAU,kBAAkB,MAAO,YAAY,qBAAqB,WAAW,YAAY,EAAG;AAAA,iBACrG,CAAC,EAAE,UAAU,kBAAkB,MAAO,YAAY,oBAAoB,SAAS,EAAG;AAAA;AAG5F,MAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA;AAM/B,MAAM,6BAA6B,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9C,MAAM,yBAAyB,OAAO;AAEtC,MAAM,8BAA8B,OAAO;AAAA;AAAA;AAAA,sBAG5B,CAAC,EAAE,OAAO,UAAU,kBAAkB,MACxD,YAAY,oBAAoB,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;",
6
6
  "names": []
7
7
  }
@@ -8,12 +8,12 @@ const useOnPillsNavigation = () => {
8
8
  hasFocus,
9
9
  setMenuState,
10
10
  selectedOptionsRef,
11
- props: { applyAriaDisabled }
11
+ props: { applyAriaDisabled, readOnly }
12
12
  } = useContext(ComboBoxContext);
13
13
  const REMOVABLE_PILL_SELECTOR = ".ds-pill-wrapper-removable button";
14
14
  const onKeyDownPills = useCallback(
15
15
  (e) => {
16
- if (applyAriaDisabled) {
16
+ if (applyAriaDisabled || readOnly) {
17
17
  return;
18
18
  }
19
19
  if ((e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "ArrowUp" || e.key === "ArrowDown") && inputValue === "") {
@@ -34,7 +34,7 @@ const useOnPillsNavigation = () => {
34
34
  }
35
35
  }
36
36
  },
37
- [inputValue, internalRef, setMenuState, selectedOptionsRef, hasFocus, applyAriaDisabled]
37
+ [inputValue, internalRef, setMenuState, selectedOptionsRef, hasFocus, applyAriaDisabled, readOnly]
38
38
  );
39
39
  return { onKeyDownPills };
40
40
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/controls/useOnPillsNavigation.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable max-depth */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\n\nexport const useOnPillsNavigation = () => {\n const {\n internalRef,\n inputValue,\n hasFocus,\n setMenuState,\n selectedOptionsRef,\n props: { applyAriaDisabled },\n } = useContext(ComboBoxContext);\n\n // todo: constant must be defined on pills component\n const REMOVABLE_PILL_SELECTOR = '.ds-pill-wrapper-removable button';\n\n const onKeyDownPills: React.KeyboardEventHandler<HTMLInputElement> = useCallback(\n (e) => {\n if (applyAriaDisabled) {\n return;\n }\n if (\n (e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'ArrowUp' || e.key === 'ArrowDown') &&\n inputValue === ''\n ) {\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n internalRef.current?.focus();\n setMenuState(true, 'open', e);\n return;\n }\n if (e.key === 'ArrowLeft') {\n const removablePills: NodeListOf<HTMLButtonElement> | undefined =\n selectedOptionsRef.current?.querySelectorAll(REMOVABLE_PILL_SELECTOR);\n\n if (hasFocus && removablePills) {\n removablePills[removablePills.length - 1]?.focus();\n }\n }\n if (e.key === 'ArrowRight') {\n e.preventDefault();\n internalRef.current?.focus();\n }\n }\n },\n [inputValue, internalRef, setMenuState, selectedOptionsRef, hasFocus, applyAriaDisabled],\n );\n\n return { onKeyDownPills };\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACKvB,SAAS,aAAa,kBAAkB;AACxC,OAAO,qBAAqB;AAErB,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,kBAAkB;AAAA,EAC7B,IAAI,WAAW,eAAe;AAG9B,QAAM,0BAA0B;AAEhC,QAAM,iBAA+D;AAAA,IACnE,CAAC,MAAM;AACL,UAAI,mBAAmB;AACrB;AAAA,MACF;AACA,WACG,EAAE,QAAQ,eAAe,EAAE,QAAQ,gBAAgB,EAAE,QAAQ,aAAa,EAAE,QAAQ,gBACrF,eAAe,IACf;AACA,YAAI,EAAE,QAAQ,aAAa,EAAE,QAAQ,aAAa;AAChD,sBAAY,SAAS,MAAM;AAC3B,uBAAa,MAAM,QAAQ,CAAC;AAC5B;AAAA,QACF;AACA,YAAI,EAAE,QAAQ,aAAa;AACzB,gBAAM,iBACJ,mBAAmB,SAAS,iBAAiB,uBAAuB;AAEtE,cAAI,YAAY,gBAAgB;AAC9B,2BAAe,eAAe,SAAS,CAAC,GAAG,MAAM;AAAA,UACnD;AAAA,QACF;AACA,YAAI,EAAE,QAAQ,cAAc;AAC1B,YAAE,eAAe;AACjB,sBAAY,SAAS,MAAM;AAAA,QAC7B;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,YAAY,aAAa,cAAc,oBAAoB,UAAU,iBAAiB;AAAA,EACzF;AAEA,SAAO,EAAE,eAAe;AAC1B;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable max-depth */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\n\nexport const useOnPillsNavigation = () => {\n const {\n internalRef,\n inputValue,\n hasFocus,\n setMenuState,\n selectedOptionsRef,\n props: { applyAriaDisabled, readOnly },\n } = useContext(ComboBoxContext);\n\n // todo: constant must be defined on pills component\n const REMOVABLE_PILL_SELECTOR = '.ds-pill-wrapper-removable button';\n\n const onKeyDownPills: React.KeyboardEventHandler<HTMLInputElement> = useCallback(\n (e) => {\n if (applyAriaDisabled || readOnly) {\n return;\n }\n if (\n (e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'ArrowUp' || e.key === 'ArrowDown') &&\n inputValue === ''\n ) {\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n internalRef.current?.focus();\n setMenuState(true, 'open', e);\n return;\n }\n if (e.key === 'ArrowLeft') {\n const removablePills: NodeListOf<HTMLButtonElement> | undefined =\n selectedOptionsRef.current?.querySelectorAll(REMOVABLE_PILL_SELECTOR);\n\n if (hasFocus && removablePills) {\n removablePills[removablePills.length - 1]?.focus();\n }\n }\n if (e.key === 'ArrowRight') {\n e.preventDefault();\n internalRef.current?.focus();\n }\n }\n },\n [inputValue, internalRef, setMenuState, selectedOptionsRef, hasFocus, applyAriaDisabled, readOnly],\n );\n\n return { onKeyDownPills };\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACKvB,SAAS,aAAa,kBAAkB;AACxC,OAAO,qBAAqB;AAErB,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,mBAAmB,SAAS;AAAA,EACvC,IAAI,WAAW,eAAe;AAG9B,QAAM,0BAA0B;AAEhC,QAAM,iBAA+D;AAAA,IACnE,CAAC,MAAM;AACL,UAAI,qBAAqB,UAAU;AACjC;AAAA,MACF;AACA,WACG,EAAE,QAAQ,eAAe,EAAE,QAAQ,gBAAgB,EAAE,QAAQ,aAAa,EAAE,QAAQ,gBACrF,eAAe,IACf;AACA,YAAI,EAAE,QAAQ,aAAa,EAAE,QAAQ,aAAa;AAChD,sBAAY,SAAS,MAAM;AAC3B,uBAAa,MAAM,QAAQ,CAAC;AAC5B;AAAA,QACF;AACA,YAAI,EAAE,QAAQ,aAAa;AACzB,gBAAM,iBACJ,mBAAmB,SAAS,iBAAiB,uBAAuB;AAEtE,cAAI,YAAY,gBAAgB;AAC9B,2BAAe,eAAe,SAAS,CAAC,GAAG,MAAM;AAAA,UACnD;AAAA,QACF;AACA,YAAI,EAAE,QAAQ,cAAc;AAC1B,YAAE,eAAe;AACjB,sBAAY,SAAS,MAAM;AAAA,QAC7B;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,YAAY,aAAa,cAAc,oBAAoB,UAAU,mBAAmB,QAAQ;AAAA,EACnG;AAEA,SAAO,EAAE,eAAe;AAC1B;",
6
6
  "names": []
7
7
  }
@@ -29,6 +29,7 @@ const ControlsInput = () => {
29
29
  isLoading,
30
30
  onlySelectable,
31
31
  applyAriaDisabled,
32
+ readOnly,
32
33
  ...restProps
33
34
  },
34
35
  focusOptionIdx,
@@ -58,13 +59,16 @@ const ControlsInput = () => {
58
59
  }, [ariaDescribedBy, id]);
59
60
  const currentPlaceholder = useMemo(() => {
60
61
  if (isArrayOfItems(selectedValues)) {
61
- return `options ${selectedValues.map((item) => item.label).join(", ")} selected`;
62
+ return `options ${selectedValues.map((item) => item.label).join(", ")} selected. ${readOnly ? "Read only" : ""}`;
62
63
  }
63
64
  if (typeof selectedValues?.label === "string") {
64
- return `option ${selectedValues.label} selected`;
65
+ return `option ${selectedValues.label} selected. ${readOnly ? "Read only" : ""}`;
66
+ }
67
+ if (readOnly) {
68
+ return `${placeholder}. Read only`;
65
69
  }
66
70
  return placeholder;
67
- }, [placeholder, selectedValues]);
71
+ }, [placeholder, selectedValues, readOnly]);
68
72
  const activeDescendant = useMemo(() => {
69
73
  if (!isLoading && hasFocus && menuState) {
70
74
  return focusOptionIdx;
@@ -86,7 +90,7 @@ const ControlsInput = () => {
86
90
  {
87
91
  onBlur: handleOnBlur,
88
92
  onFocus: handleOnFocus,
89
- readOnly: onlySelectable,
93
+ readOnly: readOnly || onlySelectable,
90
94
  ...globalAttrs,
91
95
  id,
92
96
  "data-testid": ComboboxDataTestid.INPUT,
@@ -108,10 +112,21 @@ const ControlsInput = () => {
108
112
  onChange: handleOnChange,
109
113
  tabIndex,
110
114
  withoutCaret: onlySelectable,
111
- autoComplete: "off"
115
+ autoComplete: "off",
116
+ "aria-readonly": readOnly
112
117
  }
113
118
  ),
114
- /* @__PURE__ */ jsx(StyleHiddenInput, { type: "text", name: "hidden", tabIndex: -1, onPaste: handleOnPaste, "aria-hidden": "true" })
119
+ /* @__PURE__ */ jsx(
120
+ StyleHiddenInput,
121
+ {
122
+ type: "text",
123
+ name: "hidden",
124
+ tabIndex: -1,
125
+ onPaste: handleOnPaste,
126
+ "aria-hidden": "true",
127
+ isDisabled: disabled || applyAriaDisabled
128
+ }
129
+ )
115
130
  ] });
116
131
  };
117
132
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/controls-input/ControlsInput.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { useGetGlobalAttributes } from '@elliemae/ds-props-helpers';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport {\n StyledInput,\n StyledInputWrapper,\n StyledInputPlaceHolder,\n StyledInputWidthReference,\n StyledHiddenDiv,\n StyleHiddenInput,\n} from './styled.js';\nimport { useKeyboardNavigation } from './useKeyboardNavigation.js';\nimport { useControlsInput } from './useControlsInput.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { isArrayOfItems } from '../../utils/listHelper.js';\n\nexport const ControlsInput = (): JSX.Element => {\n const {\n props: {\n autoFocus,\n inline,\n selectedValues,\n placeholder,\n disabled,\n innerRef,\n isLoading,\n onlySelectable,\n applyAriaDisabled,\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 const { spanReference, width, spanReferenceText, showPlaceholder, handleOnBlur, handleOnChange, handleOnFocus } =\n useControlsInput();\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 return `${ariaDescribedBy ?? ''} ${id}_current_placeholder ${id}_feedback_message ${id}_error_message`;\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`;\n }\n if (typeof selectedValues?.label === 'string') {\n return `option ${selectedValues.label} selected`;\n }\n return placeholder;\n }, [placeholder, selectedValues]);\n\n const activeDescendant = useMemo(() => {\n if (!isLoading && hasFocus && menuState) {\n return focusOptionIdx;\n }\n return undefined;\n }, [focusOptionIdx, hasFocus, isLoading, menuState]);\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>\n <StyledInputWidthReference innerRef={spanReference}>{spanReferenceText}</StyledInputWidthReference>\n {showPlaceholder && (\n <StyledInputPlaceHolder aria-hidden=\"true\">\n <SimpleTruncatedTooltipText value={showPlaceholder}></SimpleTruncatedTooltipText>\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 onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n 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}\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}\n autoComplete=\"off\"\n />\n {/* This input is used to handle the paste event */}\n <StyleHiddenInput type=\"text\" name=\"hidden\" tabIndex={-1} onPaste={handleOnPaste} aria-hidden=\"true\" />\n </StyledInputWrapper>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACoFnB,SACE,KADF;AApFJ,SAAgB,YAAY,eAAe;AAC3C,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAExB,MAAM,gBAAgB,MAAmB;AAC9C,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,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2B,OAAO,iBAAiB,GACtD;AAAA,IAKD,cAAc,SAAS,CAAC,SAAS,oBAAC,mBAAgB,IAAI,iBAAiB,WAAW,IAAI,IAAqB;AAAA,IAM5G,oBAAC,mBAAgB,IAAI,GAAG,EAAE,wBAAyB,8BAAmB;AAAA,IAEtE;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,UAAU;AAAA,QACT,GAAG;AAAA,QACJ;AAAA,QACA,eAAa,mBAAmB;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;AAAA,QACA,OAAO,EAAE,MAAM;AAAA,QACf,UAAU,UAAU,UAAU,WAAW;AAAA,QACzC,OAAO;AAAA,QACP,MAAK;AAAA,QACL,WAAW;AAAA,QACX,UAAU;AAAA,QACV;AAAA,QACA,cAAc;AAAA,QACd,cAAa;AAAA;AAAA,IACf;AAAA,IAEA,oBAAC,oBAAiB,MAAK,QAAO,MAAK,UAAS,UAAU,IAAI,SAAS,eAAe,eAAY,QAAO;AAAA,KACvG;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { useGetGlobalAttributes } from '@elliemae/ds-props-helpers';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport {\n StyledInput,\n StyledInputWrapper,\n StyledInputPlaceHolder,\n StyledInputWidthReference,\n StyledHiddenDiv,\n StyleHiddenInput,\n} from './styled.js';\nimport { useKeyboardNavigation } from './useKeyboardNavigation.js';\nimport { useControlsInput } from './useControlsInput.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { isArrayOfItems } from '../../utils/listHelper.js';\n\nexport const ControlsInput = (): JSX.Element => {\n const {\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 const { spanReference, width, spanReferenceText, showPlaceholder, handleOnBlur, handleOnChange, handleOnFocus } =\n useControlsInput();\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 return `${ariaDescribedBy ?? ''} ${id}_current_placeholder ${id}_feedback_message ${id}_error_message`;\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 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>\n <StyledInputWidthReference innerRef={spanReference}>{spanReferenceText}</StyledInputWidthReference>\n {showPlaceholder && (\n <StyledInputPlaceHolder aria-hidden=\"true\">\n <SimpleTruncatedTooltipText value={showPlaceholder}></SimpleTruncatedTooltipText>\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 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}\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}\n autoComplete=\"off\"\n aria-readonly={readOnly}\n />\n {/* This input is used to handle the paste event */}\n <StyleHiddenInput\n type=\"text\"\n name=\"hidden\"\n tabIndex={-1}\n onPaste={handleOnPaste}\n aria-hidden=\"true\"\n isDisabled={disabled || applyAriaDisabled}\n />\n </StyledInputWrapper>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACwFnB,SACE,KADF;AAxFJ,SAAgB,YAAY,eAAe;AAC3C,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;A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AAA;AAAA,IACjB;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,UAAU;AAAA,QACV,SAAS;AAAA,QACT,eAAY;AAAA,QACZ,YAAY,YAAY;AAAA;AAAA,IAC1B;AAAA,KACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -14,12 +14,14 @@ const StyleHiddenInput = styled("input")`
14
14
  &:focus {
15
15
  outline: none;
16
16
  }
17
+ ${({ isDisabled }) => isDisabled && `cursor: not-allowed;`}
17
18
  `;
18
19
  const StyledInput = styled("input", {
19
20
  name: DSComboBoxName,
20
21
  slot: DSComboboxSlots.INPUT
21
22
  })`
22
23
  line-height: 1rem;
24
+ background: transparent;
23
25
  font-size: 1rem;
24
26
  border: none;
25
27
  overflow: hidden;
@@ -34,7 +36,7 @@ const StyledInput = styled("input", {
34
36
  &::placeholder {
35
37
  color: transparent;
36
38
  }
37
- ${({ applyAriaDisabled, theme }) => applyAriaDisabled && `cursor: not-allowed; background: ${theme.colors.neutral["080"]}; caret-color: transparent;`}
39
+ ${({ applyAriaDisabled }) => applyAriaDisabled && `cursor: not-allowed; caret-color: transparent;`}
38
40
  `;
39
41
  const StyledInputPlaceHolder = styled.div`
40
42
  font-style: italic;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/controls-input/styled.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { DSComboBoxName, DSComboboxSlots } from '../../theming.js';\n\nexport const StyleHiddenInput = styled('input')`\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`;\n\nexport const StyledInput = styled('input', {\n name: DSComboBoxName,\n slot: DSComboboxSlots.INPUT,\n})<{ withoutCaret: boolean; applyAriaDisabled: boolean }>`\n line-height: 1rem;\n font-size: 1rem;\n border: none;\n overflow: hidden;\n padding: 0;\n z-index: 2;\n outline: none;\n color: ${(props) => props.theme.colors.neutral[700]};\n &:focus {\n outline: none;\n }\n ${({ withoutCaret }) => withoutCaret && 'caret-color: transparent;'}\n &::placeholder {\n color: transparent;\n }\n ${({ applyAriaDisabled, theme }) =>\n applyAriaDisabled && `cursor: not-allowed; background: ${theme.colors.neutral['080']}; caret-color: transparent;`}\n`;\n\nexport const StyledInputPlaceHolder = styled.div`\n font-style: italic;\n color: ${(props) => props.theme.colors.neutral[500]};\n position: absolute;\n display: flex;\n align-items: center;\n width: 100%;\n user-select: none;\n\n line-height: 1rem;\n font-size: 1rem;\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 visibility: hidden;\n position: absolute;\n top: -9999px;\n z-index: 1;\n`;\n\nexport const StyledInputWrapper = styled('div')`\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"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AACvB,SAAS,gBAAgB,uBAAuB;AAEzC,MAAM,mBAAmB,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAevC,MAAM,cAAc,OAAO,SAAS;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,gBAAgB;AACxB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAQU,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA,IAIjD,CAAC,EAAE,aAAa,MAAM,gBAAgB,2BAA2B;AAAA;AAAA;AAAA;AAAA,IAIjE,CAAC,EAAE,mBAAmB,MAAM,MAC5B,qBAAqB,oCAAoC,MAAM,OAAO,QAAQ,KAAK,CAAC,6BAA6B;AAAA;AAG9G,MAAM,yBAAyB,OAAO;AAAA;AAAA,WAElC,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB9C,MAAM,4BAA4B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOzC,MAAM,qBAAqB,OAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQvC,MAAM,kBAAkB,OAAO,KAAK;AAAA;AAAA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { DSComboBoxName, DSComboboxSlots } from '../../theming.js';\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: DSComboBoxName,\n slot: DSComboboxSlots.INPUT,\n})<{ withoutCaret: boolean; applyAriaDisabled: boolean }>`\n line-height: 1rem;\n background: transparent;\n font-size: 1rem;\n border: none;\n overflow: hidden;\n padding: 0;\n z-index: 2;\n outline: none;\n color: ${(props) => props.theme.colors.neutral[700]};\n &:focus {\n outline: none;\n }\n ${({ withoutCaret }) => withoutCaret && 'caret-color: transparent;'}\n &::placeholder {\n color: transparent;\n }\n ${({ applyAriaDisabled }) => applyAriaDisabled && `cursor: not-allowed; caret-color: transparent;`}\n`;\n\nexport const StyledInputPlaceHolder = styled.div`\n font-style: italic;\n color: ${(props) => props.theme.colors.neutral[500]};\n position: absolute;\n display: flex;\n align-items: center;\n width: 100%;\n user-select: none;\n\n line-height: 1rem;\n font-size: 1rem;\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 visibility: hidden;\n position: absolute;\n top: -9999px;\n z-index: 1;\n`;\n\nexport const StyledInputWrapper = styled('div')`\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"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AACvB,SAAS,gBAAgB,uBAAuB;AAEzC,MAAM,mBAAmB,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAa1C,CAAC,EAAE,WAAW,MAAM,cAAc,sBAAsB;AAAA;AAGrD,MAAM,cAAc,OAAO,SAAS;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,gBAAgB;AACxB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WASU,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA,IAIjD,CAAC,EAAE,aAAa,MAAM,gBAAgB,2BAA2B;AAAA;AAAA;AAAA;AAAA,IAIjE,CAAC,EAAE,kBAAkB,MAAM,qBAAqB,gDAAgD;AAAA;AAG7F,MAAM,yBAAyB,OAAO;AAAA;AAAA,WAElC,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB9C,MAAM,4BAA4B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOzC,MAAM,qBAAqB,OAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQvC,MAAM,kBAAkB,OAAO,KAAK;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -8,7 +8,7 @@ import {
8
8
  getLastValueSelected
9
9
  } from "../../utils/listHelper.js";
10
10
  import { INTERNAL_MENU_OPTION_TYPES, MENU_OPTION_TYPES, MENU_CONTROL_REASONS } from "../../constants.js";
11
- const isOptionFocuseable = (opt) => !["section", "separator"].includes(opt.type) && !opt.disabled;
11
+ const isOptionFocuseable = (opt) => !["section", "separator"].includes(opt.type);
12
12
  const optionHasFirstLetter = (opt, letter) => opt.label !== void 0 && opt.label.toLowerCase().startsWith(letter.toLowerCase());
13
13
  const useKeyboardNavigation = () => {
14
14
  const {
@@ -25,15 +25,14 @@ const useKeyboardNavigation = () => {
25
25
  selectedValues,
26
26
  withoutPortal,
27
27
  onlySelectable,
28
- applyAriaDisabled
28
+ applyAriaDisabled,
29
+ readOnly
29
30
  },
30
31
  inputValue,
31
32
  correctOptions: filteredOptions,
32
33
  menuState,
33
34
  focusOptionIdx,
34
35
  listRef,
35
- selectAllCheckboxRef,
36
- toggleSelectionButtonRef,
37
36
  setMenuState,
38
37
  setInputValue,
39
38
  scrollOptionIntoView,
@@ -45,9 +44,9 @@ const useKeyboardNavigation = () => {
45
44
  const currentItem = filteredOptions.find((item) => item.dsId === focusOptionIdx);
46
45
  const onInputKeyDown = useCallback(
47
46
  (e) => {
48
- if (applyAriaDisabled) return;
47
+ if (applyAriaDisabled || readOnly) return;
49
48
  if (onKeyDown && currentItem?.type === MENU_OPTION_TYPES.OPTION) onKeyDown(e, currentItem);
50
- if ((["ArrowDown", "ArrowUp", "Enter", "Spacebar"].includes(e.key) || e.keyCode >= 48 && e.keyCode <= 90) && !menuState) {
49
+ if ((["ArrowDown", "ArrowUp", "Enter", "Spacebar"].includes(e.key) || /^[a-zA-Z0-9]$/.test(e.key)) && !menuState) {
51
50
  setMenuState(true, MENU_CONTROL_REASONS.OPEN, e);
52
51
  }
53
52
  if (e.key === "Escape") {
@@ -65,8 +64,8 @@ const useKeyboardNavigation = () => {
65
64
  setInputValue("");
66
65
  return;
67
66
  }
68
- if (e.key === "Enter" || e.keyCode === 32 && e.altKey || e.key === "Tab" && !multiple && !inline) {
69
- if (currentItem?.applyAriaDisabled) return;
67
+ if (e.key === "Enter" || e.key === " " && e.altKey || e.key === "Tab" && !multiple && !inline) {
68
+ if (readOnly || currentItem?.applyAriaDisabled) return;
70
69
  if (e.key !== "Tab") e.preventDefault();
71
70
  e.stopPropagation();
72
71
  if (focusOptionIdx !== "" && (menuState || inline) && currentItem?.type === MENU_OPTION_TYPES.OPTION && !currentItem.disabled) {
@@ -90,7 +89,7 @@ const useKeyboardNavigation = () => {
90
89
  if (e.key === "ArrowDown") {
91
90
  e.preventDefault();
92
91
  e.stopPropagation();
93
- if ((menuState || inline) && selectableOptions.length) {
92
+ if ((menuState || inline) && (selectableOptions.length || onCreate)) {
94
93
  const nextItemIndexIndex = findInCircularList(filteredOptions, currentItemIndex, isOptionFocuseable);
95
94
  if (nextItemIndexIndex > -1) {
96
95
  setFocusOptionIdx(filteredOptions[nextItemIndexIndex].dsId);
@@ -101,8 +100,13 @@ const useKeyboardNavigation = () => {
101
100
  if (e.key === "ArrowUp") {
102
101
  e.preventDefault();
103
102
  e.stopPropagation();
104
- if (!selectableOptions.length) return;
105
- const prevItemIndex = findInCircularList(filteredOptions, currentItemIndex, isOptionFocuseable, -1);
103
+ if (!selectableOptions.length && !onCreate) return;
104
+ const prevItemIndex = findInCircularList(
105
+ filteredOptions,
106
+ currentItemIndex === -1 ? 0 : currentItemIndex,
107
+ isOptionFocuseable,
108
+ -1
109
+ );
106
110
  if (prevItemIndex > -1) {
107
111
  if (menuState || inline) {
108
112
  setFocusOptionIdx(filteredOptions[prevItemIndex].dsId);
@@ -118,19 +122,14 @@ const useKeyboardNavigation = () => {
118
122
  }
119
123
  }
120
124
  if (e.key === "Backspace" && e.currentTarget.value.length <= 0 && !inline) {
125
+ if (readOnly) return;
121
126
  const lastValue = getLastValueSelected(selectedValues);
122
127
  if (!e.currentTarget.value && lastValue && !isNonClearable && !lastValue.applyAriaDisabled) {
123
128
  onChange(getSuggestedValueOnChange(lastValue, selectedValues), lastValue, e);
124
129
  }
125
130
  }
126
131
  if (e.key === "Tab" && !inline && menuState) {
127
- const element = selectAllCheckboxRef.current ?? toggleSelectionButtonRef.current;
128
- if (element) {
129
- e.preventDefault();
130
- element.focus();
131
- } else {
132
- setMenuState(false, MENU_CONTROL_REASONS.BLUR, e);
133
- }
132
+ setMenuState(false, MENU_CONTROL_REASONS.BLUR, e);
134
133
  }
135
134
  if (onlySelectable && /^[a-zA-Z\d]$/.test(e.key)) {
136
135
  if (!menuState) {
@@ -166,8 +165,6 @@ const useKeyboardNavigation = () => {
166
165
  setFocusOptionIdx,
167
166
  selectedValues,
168
167
  onChange,
169
- selectAllCheckboxRef,
170
- toggleSelectionButtonRef,
171
168
  isNonClearable
172
169
  ]
173
170
  );