@elliemae/ds-form-combobox 3.51.0-next.0 → 3.51.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) 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 +15 -18
  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 +15 -18
  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/Section.d.ts +14 -0
  90. package/dist/types/parts/controls/styled.d.ts +2 -0
  91. package/dist/types/parts/controls-input/styled.d.ts +3 -1
  92. package/dist/types/parts/menu-list/styled.d.ts +0 -1
  93. package/dist/types/react-desc-prop-types.d.ts +4 -1
  94. package/dist/types/sharedTypes.d.ts +1 -4
  95. package/dist/types/tests/read-only.test.d.ts +1 -0
  96. package/dist/types/utils/listHelper.d.ts +0 -1
  97. package/package.json +17 -17
  98. package/dist/cjs/parts/header-list/HeaderList.js +0 -104
  99. package/dist/cjs/parts/header-list/HeaderList.js.map +0 -7
  100. package/dist/cjs/parts/header-list/index.js.map +0 -7
  101. package/dist/cjs/parts/header-list/styled.js +0 -85
  102. package/dist/cjs/parts/header-list/styled.js.map +0 -7
  103. package/dist/cjs/parts/header-list/useHeaderListHandlers.js +0 -140
  104. package/dist/cjs/parts/header-list/useHeaderListHandlers.js.map +0 -7
  105. package/dist/esm/parts/header-list/HeaderList.js +0 -80
  106. package/dist/esm/parts/header-list/HeaderList.js.map +0 -7
  107. package/dist/esm/parts/header-list/index.js +0 -6
  108. package/dist/esm/parts/header-list/index.js.map +0 -7
  109. package/dist/esm/parts/header-list/styled.js +0 -55
  110. package/dist/esm/parts/header-list/styled.js.map +0 -7
  111. package/dist/esm/parts/header-list/useHeaderListHandlers.js +0 -110
  112. package/dist/esm/parts/header-list/useHeaderListHandlers.js.map +0 -7
  113. package/dist/types/parts/header-list/HeaderList.d.ts +0 -2
  114. package/dist/types/parts/header-list/index.d.ts +0 -1
  115. package/dist/types/parts/header-list/styled.d.ts +0 -6
  116. package/dist/types/parts/header-list/useHeaderListHandlers.d.ts +0 -11
@@ -35,16 +35,18 @@ var React = __toESM(require("react"));
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = require("react");
37
37
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
38
- var import_ds_popperjs = require("@elliemae/ds-popperjs");
38
+ var import_ds_system = require("@elliemae/ds-system");
39
+ var import_ds_floating_context = require("@elliemae/ds-floating-context");
39
40
  var import_ComboBoxCTX = __toESM(require("../../ComboBoxCTX.js"));
40
41
  var import_styled = require("./styled.js");
41
42
  var import_controls = require("../controls/index.js");
42
43
  var import_menu_list = require("../menu-list/index.js");
43
44
  var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
44
45
  var import_LiveRegion = require("../LiveRegion.js");
46
+ var import_useClickOutside = require("../../config/useClickOutside.js");
45
47
  const Container = () => {
46
48
  const { props, internalRef, setMenuState, menuState, setReferenceElement, referenceElement } = (0, import_react.useContext)(import_ComboBoxCTX.default);
47
- const { inline, startPlacementPreference, placementOrderPreference, withoutPortal, applyAriaDisabled } = props;
49
+ const { inline, startPlacementPreference, placementOrderPreference, applyAriaDisabled } = props;
48
50
  const globalAttributes = (0, import_ds_props_helpers.useGetGlobalAttributes)(props);
49
51
  const { zIndex, ...xStyledProps } = (0, import_ds_props_helpers.useGetXstyledProps)(props);
50
52
  const correctZIndex = zIndex ? parseInt(zIndex, 10) : void 0;
@@ -65,13 +67,32 @@ const Container = () => {
65
67
  window.removeEventListener("blur", closeMenuOnWindowBlur);
66
68
  };
67
69
  }, [menuState, setMenuState]);
70
+ const config = (0, import_react.useMemo)(
71
+ () => ({
72
+ placement: "bottom",
73
+ withoutAnimation: true,
74
+ startPlacementPreference,
75
+ placementOrderPreference,
76
+ zIndex: correctZIndex,
77
+ customOffset: [0, 5],
78
+ handleCloseMenu,
79
+ portalDOMContainer: document.body
80
+ }),
81
+ [startPlacementPreference, placementOrderPreference, correctZIndex, handleCloseMenu]
82
+ );
83
+ const { refs, floatingStyles, context } = (0, import_ds_floating_context.useFloatingContext)(config);
84
+ const comboboxRef = (0, import_ds_system.mergeRefs)(setReferenceElement, refs.setReference);
85
+ const hideTooltip = (0, import_react.useCallback)(() => {
86
+ setMenuState(false, "blur");
87
+ }, [setMenuState]);
88
+ (0, import_useClickOutside.useOnClickOutside)(referenceElement, hideTooltip, refs.floating);
68
89
  return (
69
90
  // eslint-disable-next-line react/jsx-no-useless-fragment
70
91
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
71
92
  import_styled.StyledContainer,
72
93
  {
73
94
  "data-testid": dataTestId ?? import_ComboboxDataTestids.ComboboxDataTestid.CONTAINER,
74
- innerRef: setReferenceElement,
95
+ innerRef: comboboxRef,
75
96
  className,
76
97
  applyAriaDisabled,
77
98
  ...xStyledProps,
@@ -83,18 +104,12 @@ const Container = () => {
83
104
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
84
105
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_controls.Controls, {}),
85
106
  referenceElement ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
86
- import_ds_popperjs.DSPopperJS,
107
+ import_ds_floating_context.FloatingWrapper,
87
108
  {
88
- customOffset: [0, 5],
89
- referenceElement,
90
- showPopover: menuState,
91
- closeContextMenu: handleCloseMenu,
92
- startPlacementPreference,
93
- placementOrderPreference,
94
- withoutPortal,
95
- withoutArrow: true,
96
- withoutAnimation: true,
97
- zIndex: correctZIndex,
109
+ innerRef: refs.setFloating,
110
+ floatingStyles,
111
+ isOpen: menuState,
112
+ context,
98
113
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledPopperWrapper, { tabIndex: -1, onMouseDown: handleMouseDown, applyAriaDisabled, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_list.MenuList, {}) })
99
114
  }
100
115
  ) : null
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/container/Container.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable complexity */\nimport React, { useCallback, 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>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CAAmB;AAAA,QAC9C,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QAEJ;AAAA,sDAAC,gCAAW;AAAA,UAEX,SACC,4EACE;AAAA,wDAAC,4BAAS;AAAA,YACV,4CAAC,6BAAS;AAAA,aACZ,IAEA,4EACE;AAAA,wDAAC,4BAAS;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,sDAAC,qCAAoB,UAAU,IAAI,aAAa,iBAAiB,mBAC/D,sDAAC,6BAAS,GACZ;AAAA;AAAA,YACF,IACE;AAAA,aACN;AAAA;AAAA;AAAA,IAEJ,GACF;AAAA;AAEJ;",
4
+ "sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiFf;AAhFR,mBAAmE;AACnE,8BAA2D;AAC3D,uBAA0B;AAC1B,iCAAiF;AACjF,yBAA4B;AAC5B,oBAAqD;AACrD,sBAAyB;AACzB,uBAAyB;AACzB,iCAAmC;AACnC,wBAA2B;AAC3B,6BAAkC;AAE3B,MAAM,YAAY,MAAmB;AAC1C,QAAM,EAAE,OAAO,aAAa,cAAc,WAAW,qBAAqB,iBAAiB,QACzF,yBAAW,mBAAAA,OAAe;AAE5B,QAAM,EAAE,QAAQ,0BAA0B,0BAA0B,kBAAkB,IAAI;AAC1F,QAAM,uBAAmB,gDAAuB,KAAK;AAGrD,QAAM,EAAE,QAAQ,GAAG,aAAa,QAAI,4CAAmB,KAAK;AAE5D,QAAM,gBAAgB,SAAS,SAAS,QAAkB,EAAE,IAAI;AAEhE,QAAM,EAAE,WAAW,eAAe,WAAW,IAAI;AACjD,QAAM,sBAAkB,0BAAY,CAAC,MAAwB;AAC3D,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,QAAM,sBAAkB,0BAAY,MAAM;AACxC,iBAAa,OAAO,MAAM;AAC1B,QAAI,aAAa,QAAS,aAAY,QAAQ,KAAK;AAAA,EACrD,GAAG,CAAC,aAAa,YAAY,CAAC;AAE9B,8BAAU,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,QAAM,aAAS;AAAA,IACb,OAAO;AAAA,MACL,WAAW;AAAA,MACX,kBAAkB;AAAA,MAClB;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR,cAAc,CAAC,GAAG,CAAC;AAAA,MACnB;AAAA,MACA,oBAAoB,SAAS;AAAA,IAC/B;AAAA,IACA,CAAC,0BAA0B,0BAA0B,eAAe,eAAe;AAAA,EACrF;AAEA,QAAM,EAAE,MAAM,gBAAgB,QAAQ,QAAI,+CAAmB,MAAM;AAEnE,QAAM,kBAAc,4BAAU,qBAAqB,KAAK,YAAY;AAEpE,QAAM,kBAAc,0BAAY,MAAM;AACpC,iBAAa,OAAO,MAAM;AAAA,EAC5B,GAAG,CAAC,YAAY,CAAC;AAEjB,gDAAkB,kBAAkB,aAAa,KAAK,QAAQ;AAE9D;AAAA;AAAA,IAEE,2EACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAa,cAAc,8CAAmB;AAAA,QAC9C,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QAEJ;AAAA,sDAAC,gCAAW;AAAA,UAEX,SACC,4EACE;AAAA,wDAAC,4BAAS;AAAA,YACV,4CAAC,6BAAS;AAAA,aACZ,IAEA,4EACE;AAAA,wDAAC,4BAAS;AAAA,YACT,mBACC;AAAA,cAAC;AAAA;AAAA,gBACC,UAAU,KAAK;AAAA,gBACf;AAAA,gBACA,QAAQ;AAAA,gBACR;AAAA,gBAEA,sDAAC,qCAAoB,UAAU,IAAI,aAAa,iBAAiB,mBAC/D,sDAAC,6BAAS,GACZ;AAAA;AAAA,YACF,IACE;AAAA,aACN;AAAA;AAAA;AAAA,IAEJ,GACF;AAAA;AAEJ;",
6
6
  "names": ["ComboBoxContext"]
7
7
  }
@@ -44,7 +44,7 @@ var import_ControlsInput = require("../controls-input/ControlsInput.js");
44
44
  var import_useOnPillsNavigation = require("./useOnPillsNavigation.js");
45
45
  const Controls = () => {
46
46
  const {
47
- props: { inline, disabled, inputMinWidth, hasError, selectedValues, applyAriaDisabled },
47
+ props: { inline, disabled, inputMinWidth, hasError, selectedValues, applyAriaDisabled, readOnly },
48
48
  selectedOptionsRef,
49
49
  setMenuState,
50
50
  setFocusOptionIdx,
@@ -57,7 +57,7 @@ const Controls = () => {
57
57
  internalRef
58
58
  } = (0, import_react.useContext)(import_ComboBoxCTX.default);
59
59
  const handleOnClick = (0, import_react.useCallback)(() => {
60
- if (disabled) return;
60
+ if (disabled || readOnly) return;
61
61
  if (applyAriaDisabled) {
62
62
  internalRef.current?.focus();
63
63
  return;
@@ -74,14 +74,14 @@ const Controls = () => {
74
74
  const handleOnPillsClick = (0, import_react.useCallback)(
75
75
  (e) => {
76
76
  if (applyAriaDisabled) return;
77
- if (menuState || disabled) {
77
+ if (menuState || disabled || readOnly) {
78
78
  e.stopPropagation();
79
79
  } else {
80
80
  internalRef.current?.focus();
81
81
  setMenuState(true, "pill-click");
82
82
  }
83
83
  },
84
- [menuState, internalRef, disabled, setMenuState, applyAriaDisabled]
84
+ [applyAriaDisabled, menuState, disabled, readOnly, internalRef, setMenuState]
85
85
  );
86
86
  const handleOnMouseDown = (0, import_react.useCallback)(
87
87
  (e) => {
@@ -100,6 +100,7 @@ const Controls = () => {
100
100
  import_styled.StyledControlsWrapper,
101
101
  {
102
102
  innerRef: controlsWrapperRef,
103
+ readOnly,
103
104
  cols,
104
105
  disabled,
105
106
  applyAriaDisabled,
@@ -115,6 +116,7 @@ const Controls = () => {
115
116
  !inline && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledSelection, { innerRef: selectedOptionsRef, onClick: handleOnPillsClick, children: Array.isArray(selectedValues) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_multi_selected_values_container.MultiSelectedValuesContainer, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
116
117
  import_styled.StyledSingleSelectWraper,
117
118
  {
119
+ readOnly,
118
120
  "data-testid": import_ComboboxDataTestids.ComboboxDataTestid.SELECTED_VALUES,
119
121
  disabled,
120
122
  applyAriaDisabled,
@@ -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 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", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,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,kDAAqB;AAEhD,QAAM,WAAO;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,8CAAmB;AAAA,MAE/B;AAAA,SAAC,UACA,4CAAC,iCAAgB,UAAU,oBAAoB,SAAS,oBACrD,gBAAM,QAAQ,cAAc,IAC3B,4CAAC,uEAA6B,IAE9B;AAAA,UAAC;AAAA;AAAA,YACC,eAAa,8CAAmB;AAAA,YAChC;AAAA,YACA;AAAA,YAEC,4BAAkB,eAAe,KAAK,4CAAC,+DAA2B,OAAO,eAAe,OAAO,IAAK;AAAA;AAAA,QACvG,GAEJ;AAAA,QAGF,4CAAC,sCAAc;AAAA,QACd,CAAC,UACA;AAAA,UAAC;AAAA;AAAA,YACC,cAAa;AAAA,YACb,MAAM,CAAC,eAAe,0BAA0B;AAAA,YAChD,gBAAe;AAAA,YAEf;AAAA,0DAAC,6CAA4B,UAAoB,mBAAsC;AAAA,cACvF,4CAAC,8CAAkB;AAAA;AAAA;AAAA,QACrB;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
4
+ "sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoGX;AAlGZ,mBAAwD;AACxD,uCAA2C;AAC3C,+BAAkC;AAClC,iCAAmC;AACnC,yBAA4B;AAE5B,oBAMO;AACP,6CAA6C;AAC7C,2BAA8B;AAC9B,kCAAqC;AAC9B,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ,OAAO,EAAE,QAAQ,UAAU,eAAe,UAAU,gBAAgB,mBAAmB,SAAS;AAAA,IAChG;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,mBAAAA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B;AAAA,SAAC,UACA,4CAAC,iCAAgB,UAAU,oBAAoB,SAAS,oBACrD,gBAAM,QAAQ,cAAc,IAC3B,4CAAC,uEAA6B,IAE9B;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,eAAa,8CAAmB;AAAA,YAChC;AAAA,YACA;AAAA,YAEC,4BAAkB,eAAe,KAAK,4CAAC,+DAA2B,OAAO,eAAe,OAAO,IAAK;AAAA;AAAA,QACvG,GAEJ;AAAA,QAGF,4CAAC,sCAAc;AAAA,QACd,CAAC,UACA;AAAA,UAAC;AAAA;AAAA,YACC,cAAa;AAAA,YACb,MAAM,CAAC,eAAe,0BAA0B;AAAA,YAChD,gBAAe;AAAA,YAEf;AAAA,0DAAC,6CAA4B,UAAoB,mBAAsC;AAAA,cACvF,4CAAC,8CAAkB;AAAA;AAAA;AAAA,QACrB;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
6
6
  "names": ["ComboBoxContext"]
7
7
  }
@@ -40,21 +40,37 @@ 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
42
  var import_theming = require("../../theming.js");
43
- const normalBorder = import_ds_system.css`
43
+ const readOnlyBorder = import_ds_system.css`
44
+ border: 1px solid ${({ theme }) => theme.colors.neutral["080"]};
45
+ border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[400]};
46
+ `;
47
+ const borderStyles = import_ds_system.css`
44
48
  border: 1px solid ${({ hasError, theme }) => hasError ? theme.colors.danger[900] : theme.colors.neutral[400]};
49
+ ${({ readOnly, applyAriaDisabled }) => readOnly || applyAriaDisabled ? readOnlyBorder : ""}
50
+ `;
51
+ const backgroundStyles = import_ds_system.css`
52
+ background: ${({ disabled, applyAriaDisabled, readOnly, theme }) => {
53
+ if (readOnly || applyAriaDisabled) {
54
+ return theme.colors.neutral["050"];
55
+ }
56
+ if (disabled) {
57
+ return theme.colors.neutral["080"];
58
+ }
59
+ return "#ffffff";
60
+ }};
45
61
  `;
46
62
  const focusBorder = import_ds_system.css`
47
63
  outline: 2px solid ${({ theme }) => theme.colors.brand[700]};
48
64
  outline-offset: -2px;
49
65
  `;
50
66
  const hoverBorder = import_ds_system.css`
51
- border: 1px solid ${({ theme }) => theme.colors.brand[700]};
67
+ border: 1px solid ${({ theme }) => theme.colors.brand[600]};
52
68
  `;
53
69
  const StyledControlsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, {
54
70
  name: import_theming.DSComboBoxName,
55
71
  slot: import_theming.DSComboboxSlots.INPUT_WRAPPER
56
72
  })`
57
- background: ${({ disabled, applyAriaDisabled, theme }) => disabled || applyAriaDisabled ? theme.colors.neutral["080"] : "#ffffff"};
73
+ ${backgroundStyles}
58
74
  position: relative;
59
75
  border-radius: 2px;
60
76
  min-width: ${({ minWidth, inline }) => inline || !minWidth ? "" : `${minWidth}px`};
@@ -66,7 +82,7 @@ const StyledControlsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid,
66
82
  padding: 1.25px 0px 1.25px 8px;
67
83
  }
68
84
  margin: ${({ inline }) => inline ? "10px 16px" : ""};
69
- ${normalBorder}
85
+ ${borderStyles}
70
86
  &:hover {
71
87
  ${({ disabled }) => !disabled ? hoverBorder : ""}
72
88
  }
@@ -78,7 +94,7 @@ const StyledSingleSelectWraper = import_ds_system.styled.div`
78
94
  display: flex;
79
95
  width: 100%;
80
96
  align-items: center;
81
- color: ${({ disabled, applyAriaDisabled }) => disabled || applyAriaDisabled ? "#616b7f" : ""};
97
+ color: ${({ disabled, readOnly, applyAriaDisabled }) => disabled || applyAriaDisabled || readOnly ? "#616b7f" : ""};
82
98
  user-select: ${({ disabled, applyAriaDisabled }) => disabled || applyAriaDisabled ? "none" : ""};
83
99
  `;
84
100
  const StyledSelection = import_ds_system.styled.div`
@@ -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 { 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", "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,qBAAgD;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,4BAAwB,yBAAO,qBAAM;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,+BAAgB;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,oBAAG,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,wBAAO;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,wBAAO;AAAA;AAAA;AAAA;AAAA;AAM/B,MAAM,iCAA6B,yBAAO,mBAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9C,MAAM,yBAAyB,wBAAO;AAEtC,MAAM,8BAA8B,wBAAO;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 { 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`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AA;AAAA,uBAK9D,oBAAG,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,wBAAO;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,wBAAO;AAAA;AAAA;AAAA;AAAA;AAM/B,MAAM,iCAA6B,yBAAO,mBAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9C,MAAM,yBAAyB,wBAAO;AAEtC,MAAM,8BAA8B,wBAAO;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
  }
@@ -41,12 +41,12 @@ const useOnPillsNavigation = () => {
41
41
  hasFocus,
42
42
  setMenuState,
43
43
  selectedOptionsRef,
44
- props: { applyAriaDisabled }
44
+ props: { applyAriaDisabled, readOnly }
45
45
  } = (0, import_react.useContext)(import_ComboBoxCTX.default);
46
46
  const REMOVABLE_PILL_SELECTOR = ".ds-pill-wrapper-removable button";
47
47
  const onKeyDownPills = (0, import_react.useCallback)(
48
48
  (e) => {
49
- if (applyAriaDisabled) {
49
+ if (applyAriaDisabled || readOnly) {
50
50
  return;
51
51
  }
52
52
  if ((e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "ArrowUp" || e.key === "ArrowDown") && inputValue === "") {
@@ -67,7 +67,7 @@ const useOnPillsNavigation = () => {
67
67
  }
68
68
  }
69
69
  },
70
- [inputValue, internalRef, setMenuState, selectedOptionsRef, hasFocus, applyAriaDisabled]
70
+ [inputValue, internalRef, setMenuState, selectedOptionsRef, hasFocus, applyAriaDisabled, readOnly]
71
71
  );
72
72
  return { onKeyDownPills };
73
73
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/controls/useOnPillsNavigation.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-depth */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport 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", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,mBAAwC;AACxC,yBAA4B;AAErB,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,kBAAkB;AAAA,EAC7B,QAAI,yBAAW,mBAAAA,OAAe;AAG9B,QAAM,0BAA0B;AAEhC,QAAM,qBAA+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": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,mBAAwC;AACxC,yBAA4B;AAErB,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,mBAAmB,SAAS;AAAA,EACvC,QAAI,yBAAW,mBAAAA,OAAe;AAG9B,QAAM,0BAA0B;AAEhC,QAAM,qBAA+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": ["ComboBoxContext"]
7
7
  }
@@ -55,6 +55,7 @@ const ControlsInput = () => {
55
55
  isLoading,
56
56
  onlySelectable,
57
57
  applyAriaDisabled,
58
+ readOnly,
58
59
  ...restProps
59
60
  },
60
61
  focusOptionIdx,
@@ -84,13 +85,16 @@ const ControlsInput = () => {
84
85
  }, [ariaDescribedBy, id]);
85
86
  const currentPlaceholder = (0, import_react.useMemo)(() => {
86
87
  if ((0, import_listHelper.isArrayOfItems)(selectedValues)) {
87
- return `options ${selectedValues.map((item) => item.label).join(", ")} selected`;
88
+ return `options ${selectedValues.map((item) => item.label).join(", ")} selected. ${readOnly ? "Read only" : ""}`;
88
89
  }
89
90
  if (typeof selectedValues?.label === "string") {
90
- return `option ${selectedValues.label} selected`;
91
+ return `option ${selectedValues.label} selected. ${readOnly ? "Read only" : ""}`;
92
+ }
93
+ if (readOnly) {
94
+ return `${placeholder}. Read only`;
91
95
  }
92
96
  return placeholder;
93
- }, [placeholder, selectedValues]);
97
+ }, [placeholder, selectedValues, readOnly]);
94
98
  const activeDescendant = (0, import_react.useMemo)(() => {
95
99
  if (!isLoading && hasFocus && menuState) {
96
100
  return focusOptionIdx;
@@ -112,7 +116,7 @@ const ControlsInput = () => {
112
116
  {
113
117
  onBlur: handleOnBlur,
114
118
  onFocus: handleOnFocus,
115
- readOnly: onlySelectable,
119
+ readOnly: readOnly || onlySelectable,
116
120
  ...globalAttrs,
117
121
  id,
118
122
  "data-testid": import_ComboboxDataTestids.ComboboxDataTestid.INPUT,
@@ -134,10 +138,21 @@ const ControlsInput = () => {
134
138
  onChange: handleOnChange,
135
139
  tabIndex,
136
140
  withoutCaret: onlySelectable,
137
- autoComplete: "off"
141
+ autoComplete: "off",
142
+ "aria-readonly": readOnly
138
143
  }
139
144
  ),
140
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyleHiddenInput, { type: "text", name: "hidden", tabIndex: -1, onPaste: handleOnPaste, "aria-hidden": "true" })
145
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
146
+ import_styled.StyleHiddenInput,
147
+ {
148
+ type: "text",
149
+ name: "hidden",
150
+ tabIndex: -1,
151
+ onPaste: handleOnPaste,
152
+ "aria-hidden": "true",
153
+ isDisabled: disabled || applyAriaDisabled
154
+ }
155
+ )
141
156
  ] });
142
157
  };
143
158
  //# sourceMappingURL=ControlsInput.js.map
@@ -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 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", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoFnB;AApFJ,mBAA2C;AAC3C,uCAA2C;AAC3C,uBAA0B;AAC1B,8BAAuC;AACvC,iCAAmC;AACnC,oB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AG,CAAC,gBAAgB,UAAU,WAAW,SAAS,CAAC;AAEnD,QAAM,gBAAgB,CAAC,MAA8C;AACnE,MAAE,eAAe;AACjB,kBAAc,EAAE,cAAc,QAAQ,YAAY,CAAC;AACnD,gBAAY,SAAS,MAAM;AAAA,EAC7B;AACA,SACE,6CAAC,oCACC;AAAA,gDAAC,2CAA0B,UAAU,eAAgB,6BAAkB;AAAA,IACtE,mBACC,4CAAC,wCAAuB,eAAY,QAClC,sDAAC,+DAA2B,OAAO,iBAAiB,GACtD;AAAA,IAKD,cAAc,SAAS,CAAC,SAAS,4CAAC,iCAAgB,IAAI,iBAAiB,WAAW,IAAI,IAAqB;AAAA,IAM5G,4CAAC,iCAAgB,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,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;AAAA,QACA,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;AAAA,QACd,cAAa;AAAA;AAAA,IACf;AAAA,IAEA,4CAAC,kCAAiB,MAAK,QAAO,MAAK,UAAS,UAAU,IAAI,SAAS,eAAe,eAAY,QAAO;AAAA,KACvG;AAEJ;",
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwFnB;AAxFJ,mBAA2C;AAC3C,uCAA2C;AAC3C,uBAA0B;AAC1B,8BAAuC;AACvC,iCAAmC;AACnC,oBAOO;AACP,mCAAsC;AACtC,8BAAiC;AACjC,yBAAgC;AAChC,wBAA+B;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;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kCAAe;AAC9B,QAAM,EAAE,eAAe,QAAI,oDAAsB;AACjD,QAAM,EAAE,eAAe,OAAO,mBAAmB,iBAAiB,cAAc,gBAAgB,cAAc,QAC5G,0CAAiB;AAEnB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,GAAG;AAAA,EACL,QAAI,gDAAuB,WAAW;AAAA,IACpC,SAAS;AAAA,IACT,QAAQ;AAAA,EACV,CAAC;AAED,QAAM,4BAAwB,sBAAQ,MAAM;AAC1C,QAAI,IAAI;AACN,aAAO,GAAG,mBAAmB,EAAE,IAAI,EAAE,wBAAwB,EAAE,qBAAqB,EAAE;AAAA,IACxF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,iBAAiB,EAAE,CAAC;AAExB,QAAM,yBAAqB,sBAAQ,MAAM;AACvC,YAAI,kCAA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A,QAClB,MAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA,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;AAAA,QACd,cAAa;AAAA,QACb,iBAAe;AAAA;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
  }
@@ -52,12 +52,14 @@ const StyleHiddenInput = (0, import_ds_system.styled)("input")`
52
52
  &:focus {
53
53
  outline: none;
54
54
  }
55
+ ${({ isDisabled }) => isDisabled && `cursor: not-allowed;`}
55
56
  `;
56
57
  const StyledInput = (0, import_ds_system.styled)("input", {
57
58
  name: import_theming.DSComboBoxName,
58
59
  slot: import_theming.DSComboboxSlots.INPUT
59
60
  })`
60
61
  line-height: 1rem;
62
+ background: transparent;
61
63
  font-size: 1rem;
62
64
  border: none;
63
65
  overflow: hidden;
@@ -72,7 +74,7 @@ const StyledInput = (0, import_ds_system.styled)("input", {
72
74
  &::placeholder {
73
75
  color: transparent;
74
76
  }
75
- ${({ applyAriaDisabled, theme }) => applyAriaDisabled && `cursor: not-allowed; background: ${theme.colors.neutral["080"]}; caret-color: transparent;`}
77
+ ${({ applyAriaDisabled }) => applyAriaDisabled && `cursor: not-allowed; caret-color: transparent;`}
76
78
  `;
77
79
  const StyledInputPlaceHolder = import_ds_system.styled.div`
78
80
  font-style: italic;
@@ -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 { 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", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,qBAAgD;AAEzC,MAAM,uBAAmB,yBAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAevC,MAAM,kBAAc,yBAAO,SAAS;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,+BAAgB;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,wBAAO;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,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOzC,MAAM,yBAAqB,yBAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQvC,MAAM,sBAAkB,yBAAO,KAAK;AAAA;AAAA;",
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,qBAAgD;AAEzC,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,+BAAgB;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,wBAAO;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,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOzC,MAAM,yBAAqB,yBAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQvC,MAAM,sBAAkB,yBAAO,KAAK;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -36,7 +36,7 @@ var import_react = require("react");
36
36
  var import_ComboBoxCTX = require("../../ComboBoxCTX.js");
37
37
  var import_listHelper = require("../../utils/listHelper.js");
38
38
  var import_constants = require("../../constants.js");
39
- const isOptionFocuseable = (opt) => !["section", "separator"].includes(opt.type) && !opt.disabled;
39
+ const isOptionFocuseable = (opt) => !["section", "separator"].includes(opt.type);
40
40
  const optionHasFirstLetter = (opt, letter) => opt.label !== void 0 && opt.label.toLowerCase().startsWith(letter.toLowerCase());
41
41
  const useKeyboardNavigation = () => {
42
42
  const {
@@ -53,15 +53,14 @@ const useKeyboardNavigation = () => {
53
53
  selectedValues,
54
54
  withoutPortal,
55
55
  onlySelectable,
56
- applyAriaDisabled
56
+ applyAriaDisabled,
57
+ readOnly
57
58
  },
58
59
  inputValue,
59
60
  correctOptions: filteredOptions,
60
61
  menuState,
61
62
  focusOptionIdx,
62
63
  listRef,
63
- selectAllCheckboxRef,
64
- toggleSelectionButtonRef,
65
64
  setMenuState,
66
65
  setInputValue,
67
66
  scrollOptionIntoView,
@@ -73,7 +72,7 @@ const useKeyboardNavigation = () => {
73
72
  const currentItem = filteredOptions.find((item) => item.dsId === focusOptionIdx);
74
73
  const onInputKeyDown = (0, import_react.useCallback)(
75
74
  (e) => {
76
- if (applyAriaDisabled) return;
75
+ if (applyAriaDisabled || readOnly) return;
77
76
  if (onKeyDown && currentItem?.type === import_constants.MENU_OPTION_TYPES.OPTION) onKeyDown(e, currentItem);
78
77
  if ((["ArrowDown", "ArrowUp", "Enter", "Spacebar"].includes(e.key) || /^[a-zA-Z0-9]$/.test(e.key)) && !menuState) {
79
78
  setMenuState(true, import_constants.MENU_CONTROL_REASONS.OPEN, e);
@@ -94,7 +93,7 @@ const useKeyboardNavigation = () => {
94
93
  return;
95
94
  }
96
95
  if (e.key === "Enter" || e.key === " " && e.altKey || e.key === "Tab" && !multiple && !inline) {
97
- if (currentItem?.applyAriaDisabled) return;
96
+ if (readOnly || currentItem?.applyAriaDisabled) return;
98
97
  if (e.key !== "Tab") e.preventDefault();
99
98
  e.stopPropagation();
100
99
  if (focusOptionIdx !== "" && (menuState || inline) && currentItem?.type === import_constants.MENU_OPTION_TYPES.OPTION && !currentItem.disabled) {
@@ -118,7 +117,7 @@ const useKeyboardNavigation = () => {
118
117
  if (e.key === "ArrowDown") {
119
118
  e.preventDefault();
120
119
  e.stopPropagation();
121
- if ((menuState || inline) && selectableOptions.length) {
120
+ if ((menuState || inline) && (selectableOptions.length || onCreate)) {
122
121
  const nextItemIndexIndex = (0, import_listHelper.findInCircularList)(filteredOptions, currentItemIndex, isOptionFocuseable);
123
122
  if (nextItemIndexIndex > -1) {
124
123
  setFocusOptionIdx(filteredOptions[nextItemIndexIndex].dsId);
@@ -129,8 +128,13 @@ const useKeyboardNavigation = () => {
129
128
  if (e.key === "ArrowUp") {
130
129
  e.preventDefault();
131
130
  e.stopPropagation();
132
- if (!selectableOptions.length) return;
133
- const prevItemIndex = (0, import_listHelper.findInCircularList)(filteredOptions, currentItemIndex, isOptionFocuseable, -1);
131
+ if (!selectableOptions.length && !onCreate) return;
132
+ const prevItemIndex = (0, import_listHelper.findInCircularList)(
133
+ filteredOptions,
134
+ currentItemIndex === -1 ? 0 : currentItemIndex,
135
+ isOptionFocuseable,
136
+ -1
137
+ );
134
138
  if (prevItemIndex > -1) {
135
139
  if (menuState || inline) {
136
140
  setFocusOptionIdx(filteredOptions[prevItemIndex].dsId);
@@ -146,19 +150,14 @@ const useKeyboardNavigation = () => {
146
150
  }
147
151
  }
148
152
  if (e.key === "Backspace" && e.currentTarget.value.length <= 0 && !inline) {
153
+ if (readOnly) return;
149
154
  const lastValue = (0, import_listHelper.getLastValueSelected)(selectedValues);
150
155
  if (!e.currentTarget.value && lastValue && !isNonClearable && !lastValue.applyAriaDisabled) {
151
156
  onChange((0, import_listHelper.getSuggestedValueOnChange)(lastValue, selectedValues), lastValue, e);
152
157
  }
153
158
  }
154
159
  if (e.key === "Tab" && !inline && menuState) {
155
- const element = selectAllCheckboxRef.current ?? toggleSelectionButtonRef.current;
156
- if (element) {
157
- e.preventDefault();
158
- element.focus();
159
- } else {
160
- setMenuState(false, import_constants.MENU_CONTROL_REASONS.BLUR, e);
161
- }
160
+ setMenuState(false, import_constants.MENU_CONTROL_REASONS.BLUR, e);
162
161
  }
163
162
  if (onlySelectable && /^[a-zA-Z\d]$/.test(e.key)) {
164
163
  if (!menuState) {
@@ -194,8 +193,6 @@ const useKeyboardNavigation = () => {
194
193
  setFocusOptionIdx,
195
194
  selectedValues,
196
195
  onChange,
197
- selectAllCheckboxRef,
198
- toggleSelectionButtonRef,
199
196
  isNonClearable
200
197
  ]
201
198
  );