@elliemae/ds-form-combobox 3.51.0-next.2 → 3.51.0-next.4

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 (88) hide show
  1. package/dist/cjs/ComboBoxCTX.js +0 -4
  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 +19 -36
  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/parts/container/Container.js +29 -14
  12. package/dist/cjs/parts/container/Container.js.map +2 -2
  13. package/dist/cjs/parts/controls-input/ControlsInput.js +10 -5
  14. package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
  15. package/dist/cjs/parts/controls-input/useKeyboardNavigation.js +13 -16
  16. package/dist/cjs/parts/controls-input/useKeyboardNavigation.js.map +2 -2
  17. package/dist/cjs/parts/controls-input/useMaskedOnChange.js +4 -5
  18. package/dist/cjs/parts/controls-input/useMaskedOnChange.js.map +2 -2
  19. package/dist/cjs/parts/menu-list/MenuList.js +20 -35
  20. package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
  21. package/dist/cjs/parts/menu-list/styled.js.map +2 -2
  22. package/dist/cjs/parts/menu-list/useItemRenderer.js +40 -33
  23. package/dist/cjs/parts/menu-list/useItemRenderer.js.map +2 -2
  24. package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js +9 -1
  25. package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
  26. package/dist/cjs/react-desc-prop-types.js +3 -1
  27. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  28. package/dist/cjs/sharedTypes.js.map +2 -2
  29. package/dist/cjs/utils/listHelper.js +7 -23
  30. package/dist/cjs/utils/listHelper.js.map +2 -2
  31. package/dist/esm/ComboBoxCTX.js +0 -4
  32. package/dist/esm/ComboBoxCTX.js.map +2 -2
  33. package/dist/esm/ComboboxDataTestids.js +0 -4
  34. package/dist/esm/ComboboxDataTestids.js.map +2 -2
  35. package/dist/esm/config/useClickOutside.js +22 -0
  36. package/dist/esm/config/useClickOutside.js.map +7 -0
  37. package/dist/esm/config/useComboBox.js +20 -37
  38. package/dist/esm/config/useComboBox.js.map +2 -2
  39. package/dist/esm/config/useCorrectOptions.js +4 -7
  40. package/dist/esm/config/useCorrectOptions.js.map +2 -2
  41. package/dist/esm/parts/container/Container.js +30 -15
  42. package/dist/esm/parts/container/Container.js.map +2 -2
  43. package/dist/esm/parts/controls-input/ControlsInput.js +10 -5
  44. package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
  45. package/dist/esm/parts/controls-input/useKeyboardNavigation.js +13 -16
  46. package/dist/esm/parts/controls-input/useKeyboardNavigation.js.map +2 -2
  47. package/dist/esm/parts/controls-input/useMaskedOnChange.js +4 -5
  48. package/dist/esm/parts/controls-input/useMaskedOnChange.js.map +2 -2
  49. package/dist/esm/parts/menu-list/MenuList.js +21 -36
  50. package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
  51. package/dist/esm/parts/menu-list/styled.js.map +2 -2
  52. package/dist/esm/parts/menu-list/useItemRenderer.js +41 -34
  53. package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
  54. package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js +9 -1
  55. package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +2 -2
  56. package/dist/esm/react-desc-prop-types.js +3 -1
  57. package/dist/esm/react-desc-prop-types.js.map +2 -2
  58. package/dist/esm/sharedTypes.js.map +2 -2
  59. package/dist/esm/utils/listHelper.js +7 -23
  60. package/dist/esm/utils/listHelper.js.map +2 -2
  61. package/dist/types/ComboboxDataTestids.d.ts +0 -4
  62. package/dist/types/config/useClickOutside.d.ts +1 -0
  63. package/dist/types/config/useCorrectOptions.d.ts +1 -1
  64. package/dist/types/parts/menu-list/styled.d.ts +0 -1
  65. package/dist/types/react-desc-prop-types.d.ts +3 -1
  66. package/dist/types/sharedTypes.d.ts +0 -4
  67. package/dist/types/tests/read-only.test.d.ts +1 -0
  68. package/dist/types/utils/listHelper.d.ts +0 -1
  69. package/package.json +14 -14
  70. package/dist/cjs/parts/header-list/HeaderList.js +0 -104
  71. package/dist/cjs/parts/header-list/HeaderList.js.map +0 -7
  72. package/dist/cjs/parts/header-list/index.js.map +0 -7
  73. package/dist/cjs/parts/header-list/styled.js +0 -85
  74. package/dist/cjs/parts/header-list/styled.js.map +0 -7
  75. package/dist/cjs/parts/header-list/useHeaderListHandlers.js +0 -140
  76. package/dist/cjs/parts/header-list/useHeaderListHandlers.js.map +0 -7
  77. package/dist/esm/parts/header-list/HeaderList.js +0 -80
  78. package/dist/esm/parts/header-list/HeaderList.js.map +0 -7
  79. package/dist/esm/parts/header-list/index.js +0 -6
  80. package/dist/esm/parts/header-list/index.js.map +0 -7
  81. package/dist/esm/parts/header-list/styled.js +0 -55
  82. package/dist/esm/parts/header-list/styled.js.map +0 -7
  83. package/dist/esm/parts/header-list/useHeaderListHandlers.js +0 -110
  84. package/dist/esm/parts/header-list/useHeaderListHandlers.js.map +0 -7
  85. package/dist/types/parts/header-list/HeaderList.d.ts +0 -2
  86. package/dist/types/parts/header-list/index.d.ts +0 -1
  87. package/dist/types/parts/header-list/styled.d.ts +0 -6
  88. package/dist/types/parts/header-list/useHeaderListHandlers.d.ts +0 -11
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/listHelper.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES } from '../constants.js';\nexport const getSelectableOptions = (options: Array<DSComboboxT.OptionTypes>): Array<DSComboboxT.OptionTypes> =>\n options.filter((option) => option.type === MENU_OPTION_TYPES.OPTION && !option.disabled);\n\nexport const getOptions = (options: Array<DSComboboxT.OptionTypes>): Array<DSComboboxT.OptionTypes> =>\n options.filter((option) => option.type === MENU_OPTION_TYPES.OPTION);\n\nexport const isSelectedValueEmpty = (value: DSComboboxT.SelectedOptionsT): boolean =>\n Array.isArray(value) ? value.length === 0 : !value;\n\nexport const isSelectedValueMultiple = (value: DSComboboxT.SelectedOptionsT): boolean => Array.isArray(value);\n\nexport const isSelected = (value: DSComboboxT.SelectedOptionsT, activeOption: DSComboboxT.ItemOption): boolean => {\n if (isSelectedValueMultiple(value)) {\n const multiValue = value as DSComboboxT.ItemOption[];\n return multiValue.some((item) => item?.value === activeOption?.value);\n }\n const singleValue = value as DSComboboxT.ItemOption;\n return singleValue?.value === activeOption.value;\n};\n\nexport function isArrayOfItems(value: DSComboboxT.SelectedOptionsT): value is DSComboboxT.ItemOption[] {\n return Array.isArray(value) && value.length > 0;\n}\n\nexport const isItem = (value: DSComboboxT.SelectedOptionsT): value is DSComboboxT.ItemOption =>\n !Array.isArray(value) && value !== null && typeof value === 'object';\n\nexport const findInCircularList = (\n list: DSComboboxT.OptionTypes[],\n from: number,\n criteria: (item: DSComboboxT.OptionTypes) => boolean,\n step = 1,\n // eslint-disable-next-line max-params\n): number => {\n for (\n let i = (from + step + list.length) % list.length;\n i !== from && from > -1;\n i = (i + step + list.length) % list.length\n ) {\n if (criteria(list[i])) return i;\n }\n return from; // return same item\n};\n\nexport const getLastValueSelected = (selectedValues: DSComboboxT.SelectedOptionsT) => {\n if (Array.isArray(selectedValues)) {\n return selectedValues[selectedValues.length - 1];\n }\n return selectedValues;\n};\n\nexport const getFirstOption = (\n options: DSComboboxT.OptionTypes[],\n selectedValues: DSComboboxT.SelectedOptionsT,\n): string => {\n const lastValue = getLastValueSelected(selectedValues);\n if (lastValue) return lastValue.dsId;\n\n for (let i = 0; i < options.length; i += 1)\n if (!['section', 'separator'].includes(options[i].type) && !options[i].disabled) {\n return options[i].dsId;\n }\n // list of disabled item results return ''\n return '';\n};\n\nexport const getSuggestedValueOnChange = (\n selectedOption: DSComboboxT.ItemOption,\n selectedValues: DSComboboxT.SelectedOptionsT,\n isNonClearable?: boolean,\n) => {\n if (Array.isArray(selectedValues)) {\n const isFound = selectedValues.find((item) => item.type === 'option' && item.value === selectedOption.value);\n if (isFound) {\n if (isNonClearable) return selectedValues;\n return selectedValues.filter((item) => item.type === 'option' && item.value !== selectedOption.value);\n }\n return [...selectedValues, selectedOption];\n }\n if (selectedValues && selectedValues.dsId === selectedOption.dsId) {\n if (isNonClearable) return selectedOption;\n return null;\n }\n return selectedOption;\n};\n\nexport const filterOptions = (inputValue: string, options: DSComboboxT.OptionTypes[]) => {\n if (!inputValue) return options;\n return options.filter(\n (option) =>\n option.type === MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()),\n );\n};\n\nexport const selectedValuesWithSections = (\n optionsToParse: DSComboboxT.OptionTypes[],\n multiSelectedValue: DSComboboxT.ItemOption[],\n) => {\n const items = [] as DSComboboxT.OptionTypes[];\n\n if (optionsToParse)\n optionsToParse.forEach((option) => {\n // const isSelectedValue = multiSelectedValue.find((item) => item?.dsId === option.dsId);\n if (option.type === MENU_OPTION_TYPES.OPTION && isSelected(multiSelectedValue, option)) {\n items.push(option);\n }\n\n if (option.type === MENU_OPTION_TYPES.SECTION) {\n if (items[items.length - 1]?.type === MENU_OPTION_TYPES.SECTION) {\n items[items.length - 1] = option;\n } else {\n items.push(option);\n }\n }\n });\n if (items[items.length - 1]?.type === MENU_OPTION_TYPES.SECTION) {\n items.pop();\n }\n\n return items;\n};\n\nexport const getFilteredOptionsSelected = (\n filteredOption: DSComboboxT.OptionTypes[],\n selectedValues: DSComboboxT.ItemOption[],\n) => filteredOption.filter((option) => option.type === MENU_OPTION_TYPES.OPTION && isSelected(selectedValues, option));\n\nexport const scrollIfNeeded = (\n elem: HTMLElement,\n options = { behavior: 'smooth', block: 'end', inline: 'nearest' } as ScrollIntoViewOptions | undefined,\n) => {\n const bounding = elem.getBoundingClientRect();\n if (\n !(\n bounding.top >= 0 &&\n bounding.left >= 0 &&\n bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&\n bounding.right <= (window.innerWidth || document.documentElement.clientWidth)\n )\n )\n elem.scrollIntoView(options);\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAAkC;AAC3B,MAAM,uBAAuB,CAAC,YACnC,QAAQ,OAAO,CAAC,WAAW,OAAO,SAAS,mCAAkB,UAAU,CAAC,OAAO,QAAQ;AAElF,MAAM,aAAa,CAAC,YACzB,QAAQ,OAAO,CAAC,WAAW,OAAO,SAAS,mCAAkB,MAAM;AAE9D,MAAM,uBAAuB,CAAC,UACnC,MAAM,QAAQ,KAAK,IAAI,MAAM,WAAW,IAAI,CAAC;AAExC,MAAM,0BAA0B,CAAC,UAAiD,MAAM,QAAQ,KAAK;AAErG,MAAM,aAAa,CAAC,OAAqC,iBAAkD;AAChH,MAAI,wBAAwB,KAAK,GAAG;AAClC,UAAM,aAAa;AACnB,WAAO,WAAW,KAAK,CAAC,SAAS,MAAM,UAAU,cAAc,KAAK;AAAA,EACtE;AACA,QAAM,cAAc;AACpB,SAAO,aAAa,UAAU,aAAa;AAC7C;AAEO,SAAS,eAAe,OAAwE;AACrG,SAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS;AAChD;AAEO,MAAM,SAAS,CAAC,UACrB,CAAC,MAAM,QAAQ,KAAK,KAAK,UAAU,QAAQ,OAAO,UAAU;AAEvD,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ACxB,SAAO,QAAQ;AAAA,IACb,CAAC,WACC,OAAO,SAAS,mCAAkB,UAAU,OAAO,MAAM,YAAY,EAAE,SAAS,WAAW,YAAY,CAAC;AAAA,EAC5G;AACF;AAEO,MAAM,6BAA6B,CACxC,gBACA,uBACG;AACH,QAAM,QAAQ,CAAC;AAEf,MAAI;AACF,mBAAe,QAAQ,CAAC,WAAW;AAEjC,UAAI,OAAO,SAAS,mCAAkB,UAAU,WAAW,oBAAoB,MAAM,GAAG;AACtF,cAAM,KAAK,MAAM;AAAA,MACnB;AAEA,UAAI,OAAO,SAAS,mCAAkB,SAAS;AAC7C,YAAI,MAAM,MAAM,SAAS,CAAC,GAAG,SAAS,mCAAkB,SAAS;AAC/D,gBAAM,MAAM,SAAS,CAAC,IAAI;AAAA,QAC5B,OAAO;AACL,gBAAM,KAAK,MAAM;AAAA,QACnB;AAAA,MACF;AAAA,IACF,CAAC;AACH,MAAI,MAAM,MAAM,SAAS,CAAC,GAAG,SAAS,mCAAkB,SAAS;AAC/D,UAAM,IAAI;AAAA,EACZ;AAEA,SAAO;AACT;AAEO,MAAM,6BAA6B,CACxC,gBACA,mBACG,eAAe,OAAO,CAAC,WAAW,OAAO,SAAS,mCAAkB,UAAU,WAAW,gBAAgB,MAAM,CAAC;AAE9G,MAAM,iBAAiB,CAC5B,MACA,UAAU,EAAE,UAAU,UAAU,OAAO,OAAO,QAAQ,UAAU,MAC7D;AACH,QAAM,WAAW,KAAK,sBAAsB;AAC5C,MACE,EACE,SAAS,OAAO,KAChB,SAAS,QAAQ,KACjB,SAAS,WAAW,OAAO,eAAe,SAAS,gBAAgB,iBACnE,SAAS,UAAU,OAAO,cAAc,SAAS,gBAAgB;AAGnE,SAAK,eAAe,OAAO;AAC/B;",
4
+ "sourcesContent": ["/* eslint-disable max-params */\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES } from '../constants.js';\nexport const getSelectableOptions = (options: Array<DSComboboxT.OptionTypes>): Array<DSComboboxT.OptionTypes> =>\n options.filter((option) => option.type === MENU_OPTION_TYPES.OPTION && !option.disabled);\n\nexport const getOptions = (options: Array<DSComboboxT.OptionTypes>): Array<DSComboboxT.OptionTypes> =>\n options.filter((option) => option.type === MENU_OPTION_TYPES.OPTION);\n\nexport const isSelectedValueEmpty = (value: DSComboboxT.SelectedOptionsT): boolean =>\n Array.isArray(value) ? value.length === 0 : !value;\n\nexport const isSelectedValueMultiple = (value: DSComboboxT.SelectedOptionsT): boolean => Array.isArray(value);\n\nexport const isSelected = (value: DSComboboxT.SelectedOptionsT, activeOption: DSComboboxT.ItemOption): boolean => {\n if (isSelectedValueMultiple(value)) {\n const multiValue = value as DSComboboxT.ItemOption[];\n return multiValue.some((item) => item?.value === activeOption?.value);\n }\n const singleValue = value as DSComboboxT.ItemOption;\n return singleValue?.value === activeOption.value;\n};\n\nexport function isArrayOfItems(value: DSComboboxT.SelectedOptionsT): value is DSComboboxT.ItemOption[] {\n return Array.isArray(value) && value.length > 0;\n}\n\nexport const isItem = (value: DSComboboxT.SelectedOptionsT): value is DSComboboxT.ItemOption =>\n !Array.isArray(value) && value !== null && typeof value === 'object';\n\nexport const findInCircularList = (\n list: DSComboboxT.OptionTypes[],\n from: number,\n criteria: (item: DSComboboxT.OptionTypes) => boolean,\n step = 1,\n): number => {\n if (list.length === 0) return from;\n\n let i = (from + step + list.length) % list.length;\n let iterations = 0;\n\n while (iterations < list.length) {\n if (criteria(list[i])) return i;\n\n i = (i + step + list.length) % list.length;\n iterations += 1;\n }\n\n return from; // Return the original index if no match is found\n};\nexport const getLastValueSelected = (selectedValues: DSComboboxT.SelectedOptionsT) => {\n if (Array.isArray(selectedValues)) {\n return selectedValues[selectedValues.length - 1];\n }\n return selectedValues;\n};\n\nexport const getFirstOption = (\n options: DSComboboxT.OptionTypes[],\n selectedValues: DSComboboxT.SelectedOptionsT,\n): string => {\n const lastValue = getLastValueSelected(selectedValues);\n if (lastValue) return lastValue.dsId;\n\n for (let i = 0; i < options.length; i += 1)\n if (!['section', 'separator'].includes(options[i].type) && !options[i].disabled) {\n return options[i].dsId;\n }\n // list of disabled item results return ''\n return '';\n};\n\nexport const getSuggestedValueOnChange = (\n selectedOption: DSComboboxT.ItemOption,\n selectedValues: DSComboboxT.SelectedOptionsT,\n isNonClearable?: boolean,\n) => {\n if (Array.isArray(selectedValues)) {\n const isFound = selectedValues.find((item) => item.type === 'option' && item.value === selectedOption.value);\n if (isFound) {\n if (isNonClearable) return selectedValues;\n return selectedValues.filter((item) => item.type === 'option' && item.value !== selectedOption.value);\n }\n return [...selectedValues, selectedOption];\n }\n if (selectedValues && selectedValues.dsId === selectedOption.dsId) {\n if (isNonClearable) return selectedOption;\n return null;\n }\n return selectedOption;\n};\n\nexport const filterOptions = (inputValue: string, options: DSComboboxT.OptionTypes[]) => {\n if (!inputValue) return options;\n return options.filter(\n (option) =>\n option.type === MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()),\n );\n};\n\nexport const getFilteredOptionsSelected = (\n filteredOption: DSComboboxT.OptionTypes[],\n selectedValues: DSComboboxT.ItemOption[],\n) => filteredOption.filter((option) => option.type === MENU_OPTION_TYPES.OPTION && isSelected(selectedValues, option));\n\nexport const scrollIfNeeded = (\n elem: HTMLElement,\n options = { behavior: 'smooth', block: 'end', inline: 'nearest' } as ScrollIntoViewOptions | undefined,\n) => {\n const bounding = elem.getBoundingClientRect();\n if (\n !(\n bounding.top >= 0 &&\n bounding.left >= 0 &&\n bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&\n bounding.right <= (window.innerWidth || document.documentElement.clientWidth)\n )\n )\n elem.scrollIntoView(options);\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADE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W,OAAO,eAAe,SAAS,gBAAgB,iBACnE,SAAS,UAAU,OAAO,cAAc,SAAS,gBAAgB;AAGnE,SAAK,eAAe,OAAO;AAC/B;",
6
6
  "names": []
7
7
  }
@@ -25,21 +25,17 @@ const defaultContext = {
25
25
  referenceElement: null,
26
26
  inputValue: "",
27
27
  focusOptionIdx: "",
28
- showSelectedOptions: false,
29
28
  pillGroupRef: createRef(),
30
29
  listRef: createRef(),
31
30
  wrapperListRef: createRef(),
32
31
  controlsWrapperRef: createRef(),
33
32
  selectedOptionsRef: createRef(),
34
- selectAllCheckboxRef: createRef(),
35
- toggleSelectionButtonRef: createRef(),
36
33
  setShowPopover: noop,
37
34
  scrollOptionIntoView: noop,
38
35
  setHasFocus: noop,
39
36
  setInputValue: noop,
40
37
  setReferenceElement: noop,
41
38
  setFocusOptionIdx: noop,
42
- setShowSelectedOptions: noop,
43
39
  setMenuState: noop,
44
40
  internalRef: createRef(),
45
41
  correctOptions: [],
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/ComboBoxCTX.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext, createRef } from 'react';\nimport type { DSComboboxT } from './react-desc-prop-types.js';\nimport type { DSComboboxInternalsT } from './sharedTypes.js';\n// eslint-disable-next-line @typescript-eslint/no-empty-function\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\nexport function noop<T extends unknown[]>(..._args: T): void {}\n\nexport const defaultProps: DSComboboxT.DefaultProps = {\n hasError: false,\n inline: false,\n withoutPortal: false,\n disabled: false,\n useMask: noop,\n innerRef: createRef(),\n startPlacementPreference: 'bottom-start',\n placementOrderPreference: ['bottom-start', 'top-start'],\n noOptionsMessage: 'No Matches Found',\n isNonClearable: false,\n onlySelectable: false,\n isSkeleton: false,\n // override in useCombobox to avoid ref duplications when more than one cb is used\n applyAriaDisabled: false,\n};\n\nconst defaultContext: DSComboboxInternalsT.ComboBoxContextT = {\n props: defaultProps as DSComboboxT.InternalProps,\n menuState: false,\n hasFocus: false,\n referenceElement: null,\n inputValue: '',\n focusOptionIdx: '',\n showSelectedOptions: false,\n pillGroupRef: createRef<HTMLDivElement>(),\n listRef: createRef<HTMLDivElement>(),\n wrapperListRef: createRef<HTMLDivElement>(),\n controlsWrapperRef: createRef<HTMLInputElement>(),\n selectedOptionsRef: createRef<HTMLInputElement>(),\n selectAllCheckboxRef: createRef<HTMLInputElement>(),\n toggleSelectionButtonRef: createRef<HTMLButtonElement>(),\n setShowPopover: noop,\n scrollOptionIntoView: noop,\n setHasFocus: noop,\n setInputValue: noop,\n setReferenceElement: noop,\n setFocusOptionIdx: noop,\n setShowSelectedOptions: noop,\n setMenuState: noop,\n internalRef: createRef<HTMLInputElement>(),\n correctOptions: [],\n instanceUid: '',\n};\n/** Context for cross component communication */\nexport const ComboBoxContext = createContext(defaultContext);\n\nexport default ComboBoxContext;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe,iBAAiB;AAMlC,SAAS,QAA6B,OAAgB;AAAC;AAEvD,MAAM,eAAyC;AAAA,EACpD,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU,UAAU;AAAA,EACpB,0BAA0B;AAAA,EAC1B,0BAA0B,CAAC,gBAAgB,WAAW;AAAA,EACtD,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,YAAY;AAAA;AAAA,EAEZ,mBAAmB;AACrB;AAEA,MAAM,iBAAwD;AAAA,EAC5D,OAAO;AAAA,EACP,WAAW;AAAA,EACX,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,cAAc,UAA0B;AAAA,EACxC,SAAS,UAA0B;AAAA,EACnC,gBAAgB,UAA0B;AAAA,EAC1C,oBAAoB,UAA4B;AAAA,EAChD,oBAAoB,UAA4B;AAAA,EAChD,sBAAsB,UAA4B;AAAA,EAClD,0BAA0B,UAA6B;AAAA,EACvD,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,mBAAmB;AAAA,EACnB,wBAAwB;AAAA,EACxB,cAAc;AAAA,EACd,aAAa,UAA4B;AAAA,EACzC,gBAAgB,CAAC;AAAA,EACjB,aAAa;AACf;AAEO,MAAM,kBAAkB,cAAc,cAAc;AAE3D,IAAO,sBAAQ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext, createRef } from 'react';\nimport type { DSComboboxT } from './react-desc-prop-types.js';\nimport type { DSComboboxInternalsT } from './sharedTypes.js';\n// eslint-disable-next-line @typescript-eslint/no-empty-function\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\nexport function noop<T extends unknown[]>(..._args: T): void {}\n\nexport const defaultProps: DSComboboxT.DefaultProps = {\n hasError: false,\n inline: false,\n withoutPortal: false,\n disabled: false,\n useMask: noop,\n innerRef: createRef(),\n startPlacementPreference: 'bottom-start',\n placementOrderPreference: ['bottom-start', 'top-start'],\n noOptionsMessage: 'No Matches Found',\n isNonClearable: false,\n onlySelectable: false,\n isSkeleton: false,\n // override in useCombobox to avoid ref duplications when more than one cb is used\n applyAriaDisabled: false,\n};\n\nconst defaultContext: DSComboboxInternalsT.ComboBoxContextT = {\n props: defaultProps as DSComboboxT.InternalProps,\n menuState: false,\n hasFocus: false,\n referenceElement: null,\n inputValue: '',\n focusOptionIdx: '',\n pillGroupRef: createRef<HTMLDivElement>(),\n listRef: createRef<HTMLDivElement>(),\n wrapperListRef: createRef<HTMLDivElement>(),\n controlsWrapperRef: createRef<HTMLInputElement>(),\n selectedOptionsRef: createRef<HTMLInputElement>(),\n setShowPopover: noop,\n scrollOptionIntoView: noop,\n setHasFocus: noop,\n setInputValue: noop,\n setReferenceElement: noop,\n setFocusOptionIdx: noop,\n setMenuState: noop,\n internalRef: createRef<HTMLInputElement>(),\n correctOptions: [],\n instanceUid: '',\n};\n/** Context for cross component communication */\nexport const ComboBoxContext = createContext(defaultContext);\n\nexport default ComboBoxContext;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe,iBAAiB;AAMlC,SAAS,QAA6B,OAAgB;AAAC;AAEvD,MAAM,eAAyC;AAAA,EACpD,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU,UAAU;AAAA,EACpB,0BAA0B;AAAA,EAC1B,0BAA0B,CAAC,gBAAgB,WAAW;AAAA,EACtD,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,YAAY;AAAA;AAAA,EAEZ,mBAAmB;AACrB;AAEA,MAAM,iBAAwD;AAAA,EAC5D,OAAO;AAAA,EACP,WAAW;AAAA,EACX,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,cAAc,UAA0B;AAAA,EACxC,SAAS,UAA0B;AAAA,EACnC,gBAAgB,UAA0B;AAAA,EAC1C,oBAAoB,UAA4B;AAAA,EAChD,oBAAoB,UAA4B;AAAA,EAChD,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,aAAa,UAA4B;AAAA,EACzC,gBAAgB,CAAC;AAAA,EACjB,aAAa;AACf;AAEO,MAAM,kBAAkB,cAAc,cAAc;AAE3D,IAAO,sBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,9 +1,5 @@
1
1
  import * as React from "react";
2
2
  const ComboboxDataTestid = {
3
- MULTISELECT: {
4
- HEADER_LIST: "combobox-header-list",
5
- SHOW_SELECTED_OPTIONS_TOGGLE: "combobox-selected-options-toggle"
6
- },
7
3
  CONTROLS_WRAPPER: "combobox-controls-wrapper",
8
4
  CONTAINER: "combobox-container",
9
5
  INPUT: "combobox-input",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/ComboboxDataTestids.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const ComboboxDataTestid = {\n MULTISELECT: {\n HEADER_LIST: 'combobox-header-list',\n SHOW_SELECTED_OPTIONS_TOGGLE: 'combobox-selected-options-toggle',\n },\n CONTROLS_WRAPPER: 'combobox-controls-wrapper',\n CONTAINER: 'combobox-container',\n INPUT: 'combobox-input',\n LIST: 'combobox-menu-list',\n NO_MATCHES_FOUND: 'combobox-no-matches-found',\n SELECTED_VALUES: 'combobox-selected-values',\n DROPDOWN: 'combobox-dropdown-btn',\n OPTION: 'combobox-option',\n ALLY_SELECTED_VALUES: 'combobox-ally-selected-values',\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,qBAAqB;AAAA,EAChC,aAAa;AAAA,IACX,aAAa;AAAA,IACb,8BAA8B;AAAA,EAChC;AAAA,EACA,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AAAA,EACN,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,sBAAsB;AACxB;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const ComboboxDataTestid = {\n CONTROLS_WRAPPER: 'combobox-controls-wrapper',\n CONTAINER: 'combobox-container',\n INPUT: 'combobox-input',\n LIST: 'combobox-menu-list',\n NO_MATCHES_FOUND: 'combobox-no-matches-found',\n SELECTED_VALUES: 'combobox-selected-values',\n DROPDOWN: 'combobox-dropdown-btn',\n OPTION: 'combobox-option',\n ALLY_SELECTED_VALUES: 'combobox-ally-selected-values',\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,qBAAqB;AAAA,EAChC,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AAAA,EACN,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,sBAAsB;AACxB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ import { useEffect } from "react";
3
+ function useOnClickOutside(ref, cb, excludeNode) {
4
+ useEffect(() => {
5
+ const listener = (event) => {
6
+ if (!ref || ref?.contains?.(event.target) || excludeNode && excludeNode.contains(event.target)) {
7
+ return;
8
+ }
9
+ cb(event);
10
+ };
11
+ document.addEventListener("mousedown", listener);
12
+ document.addEventListener("touchstart", listener);
13
+ return () => {
14
+ document.removeEventListener("mousedown", listener);
15
+ document.removeEventListener("touchstart", listener);
16
+ };
17
+ }, [ref, cb, excludeNode]);
18
+ }
19
+ export {
20
+ useOnClickOutside
21
+ };
22
+ //# sourceMappingURL=useClickOutside.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useClickOutside.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect } from 'react';\n\nexport function useOnClickOutside<T extends Node, CbT extends (event: Event) => void, Z extends Node>(\n ref: T | null,\n cb: CbT,\n excludeNode: Z | null,\n): void {\n useEffect(() => {\n const listener = (event: MouseEvent | TouchEvent) => {\n if (\n !ref ||\n ref?.contains?.(event.target as Node) ||\n (excludeNode && excludeNode.contains(event.target as Node))\n ) {\n return;\n }\n cb(event);\n };\n document.addEventListener('mousedown', listener);\n document.addEventListener('touchstart', listener);\n return () => {\n document.removeEventListener('mousedown', listener);\n document.removeEventListener('touchstart', listener);\n };\n }, [ref, cb, excludeNode]);\n}\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,iBAAiB;AAEnB,SAAS,kBACd,KACA,IACA,aACM;AACN,YAAU,MAAM;AACd,UAAM,WAAW,CAAC,UAAmC;AACnD,UACE,CAAC,OACD,KAAK,WAAW,MAAM,MAAc,KACnC,eAAe,YAAY,SAAS,MAAM,MAAc,GACzD;AACA;AAAA,MACF;AACA,SAAG,KAAK;AAAA,IACV;AACA,aAAS,iBAAiB,aAAa,QAAQ;AAC/C,aAAS,iBAAiB,cAAc,QAAQ;AAChD,WAAO,MAAM;AACX,eAAS,oBAAoB,aAAa,QAAQ;AAClD,eAAS,oBAAoB,cAAc,QAAQ;AAAA,IACrD;AAAA,EACF,GAAG,CAAC,KAAK,IAAI,WAAW,CAAC;AAC3B;",
6
+ "names": []
7
+ }
@@ -6,15 +6,13 @@ import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@e
6
6
  import { defaultProps } from "../ComboBoxCTX.js";
7
7
  import { ComboboxPropTypes } from "../react-desc-prop-types.js";
8
8
  import { useCorrectOptions } from "./useCorrectOptions.js";
9
- import { getFirstOption } from "../utils/listHelper.js";
9
+ import { getFirstOption, isSelectedValueEmpty } from "../utils/listHelper.js";
10
10
  import { DSComboBoxName } from "../theming.js";
11
- import { useMakeMutable } from "./useMakeMutable.js";
12
11
  const useComboBox = (props) => {
13
12
  const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);
14
13
  useValidateTypescriptPropTypes(propsWithDefaults, ComboboxPropTypes, DSComboBoxName);
15
14
  const [showPopover, setShowPopover] = useState(false);
16
15
  const [referenceElement, setReferenceElement] = useState(null);
17
- const [showSelectedOptions, setShowSelectedOptions] = useState(false);
18
16
  const [inputValue, setInputValue] = useState("");
19
17
  const [hasFocus, setHasFocus] = useState(false);
20
18
  const internalRef = useRef(null);
@@ -22,8 +20,6 @@ const useComboBox = (props) => {
22
20
  const wrapperListRef = useRef(null);
23
21
  const selectedOptionsRef = useRef(null);
24
22
  const controlsWrapperRef = useRef(null);
25
- const selectAllCheckboxRef = useRef(null);
26
- const toggleSelectionButtonRef = useRef(null);
27
23
  const pillGroupRef = useRef(null);
28
24
  const { id, selectedValues, isMenuOpen, onMenuChange, applyAriaDisabled } = propsWithDefaults;
29
25
  const instanceUid = useMemo(() => id || uid(5), [id]);
@@ -31,15 +27,7 @@ const useComboBox = (props) => {
31
27
  if (isMenuOpen !== void 0) return isMenuOpen;
32
28
  return showPopover;
33
29
  }, [showPopover, isMenuOpen]);
34
- const setMenuState = useCallback(
35
- (newState, reason, e) => {
36
- if (applyAriaDisabled) return;
37
- if (onMenuChange !== void 0) onMenuChange(newState, reason, e);
38
- setShowPopover(newState);
39
- },
40
- [onMenuChange, applyAriaDisabled]
41
- );
42
- const correctOptions = useCorrectOptions(propsWithDefaults, inputValue, showSelectedOptions);
30
+ const correctOptions = useCorrectOptions(propsWithDefaults, inputValue);
43
31
  const virtualListHelpers = useVirtual({
44
32
  size: correctOptions.length,
45
33
  parentRef: listRef,
@@ -56,24 +44,26 @@ const useComboBox = (props) => {
56
44
  [correctOptions, virtualListHelpers]
57
45
  );
58
46
  const [focusOptionIdx, setFocusOptionIdx] = useState("");
47
+ const setMenuState = useCallback(
48
+ (newState, reason, e) => {
49
+ if (applyAriaDisabled) return;
50
+ if (onMenuChange !== void 0) onMenuChange(newState, reason, e);
51
+ setShowPopover(newState);
52
+ if (!inputValue && newState && !focusOptionIdx && !isSelectedValueEmpty(selectedValues)) {
53
+ const focusedValue = getFirstOption(correctOptions, selectedValues);
54
+ setFocusOptionIdx(focusedValue);
55
+ scrollOptionIntoView(focusedValue, { align: "center" });
56
+ } else {
57
+ setFocusOptionIdx("");
58
+ }
59
+ },
60
+ [applyAriaDisabled, onMenuChange, inputValue, focusOptionIdx, selectedValues, correctOptions, scrollOptionIntoView]
61
+ );
59
62
  useEffect(() => {
60
- if (!hasFocus) setFocusOptionIdx("");
61
- if (hasFocus && (!focusOptionIdx || showSelectedOptions)) {
62
- const focusedValue = getFirstOption(correctOptions, selectedValues);
63
- setFocusOptionIdx(focusedValue);
64
- scrollOptionIntoView(focusedValue, { align: "center" });
65
- }
66
- }, [showPopover, hasFocus, correctOptions, selectedValues]);
67
- const correctOptionsRef = useMakeMutable(correctOptions);
68
- useEffect(() => {
69
- setFocusOptionIdx(correctOptionsRef.current?.[0]?.dsId ?? "");
70
- }, [correctOptionsRef, inputValue]);
71
- useEffect(() => {
72
- if (!showPopover) {
73
- setFocusOptionIdx("");
74
- setShowSelectedOptions(false);
63
+ if (propsWithDefaults.inline) {
64
+ setMenuState(true, "inline");
75
65
  }
76
- }, [showPopover]);
66
+ }, []);
77
67
  const ctx = useMemo(
78
68
  () => ({
79
69
  props: { ...propsWithDefaults },
@@ -84,16 +74,12 @@ const useComboBox = (props) => {
84
74
  focusOptionIdx,
85
75
  selectedOptionsRef,
86
76
  controlsWrapperRef,
87
- selectAllCheckboxRef,
88
77
  inputValue,
89
78
  setInputValue,
90
79
  setMenuState,
91
80
  hasFocus,
92
- toggleSelectionButtonRef,
93
81
  pillGroupRef,
94
- showSelectedOptions,
95
82
  wrapperListRef,
96
- setShowSelectedOptions,
97
83
  setHasFocus,
98
84
  setFocusOptionIdx,
99
85
  scrollOptionIntoView,
@@ -113,14 +99,11 @@ const useComboBox = (props) => {
113
99
  inputValue,
114
100
  focusOptionIdx,
115
101
  wrapperListRef,
116
- showSelectedOptions,
117
102
  menuState,
118
103
  pillGroupRef,
119
104
  referenceElement,
120
105
  selectedOptionsRef,
121
106
  controlsWrapperRef,
122
- selectAllCheckboxRef,
123
- toggleSelectionButtonRef,
124
107
  listRef,
125
108
  internalRef,
126
109
  instanceUid
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useComboBox.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable import/prefer-default-export */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useMemo, useState, useRef, useCallback, useEffect } from 'react';\nimport { useVirtual, type ScrollToIndexOptions } from 'react-virtual';\nimport { uid } from 'uid';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { defaultProps } from '../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { ComboboxPropTypes } from '../react-desc-prop-types.js';\nimport type { DSComboboxInternalsT } from '../sharedTypes.js';\nimport { useCorrectOptions } from './useCorrectOptions.js';\nimport { getFirstOption } from '../utils/listHelper.js';\nimport { DSComboBoxName } from '../theming.js';\nimport { useMakeMutable } from './useMakeMutable.js';\n\nexport const useComboBox = (props: DSComboboxT.Props): DSComboboxInternalsT.ComboBoxContextT => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSComboboxT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, ComboboxPropTypes, DSComboBoxName);\n const [showPopover, setShowPopover] = useState<boolean>(false);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n const [showSelectedOptions, setShowSelectedOptions] = useState<boolean>(false);\n\n const [inputValue, setInputValue] = useState<string>('');\n const [hasFocus, setHasFocus] = useState<boolean>(false);\n\n const internalRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const wrapperListRef = useRef<HTMLDivElement>(null);\n\n const selectedOptionsRef = useRef<HTMLDivElement>(null);\n const controlsWrapperRef = useRef<HTMLDivElement>(null);\n const selectAllCheckboxRef = useRef<HTMLInputElement>(null);\n const toggleSelectionButtonRef = useRef<HTMLButtonElement>(null);\n const pillGroupRef = useRef<HTMLDivElement>(null);\n\n const { id, selectedValues, isMenuOpen, onMenuChange, applyAriaDisabled } = propsWithDefaults;\n\n const instanceUid = useMemo(() => id || uid(5), [id]);\n\n const menuState = useMemo(() => {\n if (isMenuOpen !== undefined) return isMenuOpen;\n return showPopover;\n }, [showPopover, isMenuOpen]);\n\n const setMenuState = useCallback(\n (\n newState: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => {\n if (applyAriaDisabled) return;\n if (onMenuChange !== undefined) onMenuChange(newState, reason, e);\n setShowPopover(newState);\n },\n [onMenuChange, applyAriaDisabled],\n );\n // ---------------------------------------------------------------------------\n // Options with creatable option + filtered by selected\n // ---------------------------------------------------------------------------\n\n const correctOptions = useCorrectOptions(propsWithDefaults, inputValue, showSelectedOptions);\n\n // ===========================================================================\n // Virtualization setup\n // ===========================================================================\n\n const virtualListHelpers: ReturnType<typeof useVirtual> = useVirtual({\n size: correctOptions.length,\n parentRef: listRef,\n overscan: 15,\n paddingStart: 0,\n });\n\n // ===========================================================================\n // Scroll into view function\n // ===========================================================================\n const scrollOptionIntoView = useCallback(\n (dsId: string, opts: ScrollToIndexOptions = { align: 'center' }) => {\n virtualListHelpers.scrollToIndex(\n correctOptions.findIndex((opt) => opt.dsId === dsId),\n opts,\n );\n },\n [correctOptions, virtualListHelpers],\n );\n\n // ===========================================================================\n // Init focused option when opening the menu list\n // ===========================================================================\n\n const [focusOptionIdx, setFocusOptionIdx] = useState<string>('');\n\n useEffect(() => {\n // this code calculate the option to be focused when opening the menu\n // when losing focus we remove the focused one\n // when focus adquired again getFirstOption calculate the correct one\n if (!hasFocus) setFocusOptionIdx('');\n if (hasFocus && (!focusOptionIdx || showSelectedOptions)) {\n const focusedValue = getFirstOption(correctOptions, selectedValues);\n setFocusOptionIdx(focusedValue);\n scrollOptionIntoView(focusedValue, { align: 'center' });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [showPopover, hasFocus, correctOptions, selectedValues]);\n\n const correctOptionsRef = useMakeMutable(correctOptions);\n\n // focus first option when typing\n useEffect(() => {\n setFocusOptionIdx(correctOptionsRef.current?.[0]?.dsId ?? '');\n }, [correctOptionsRef, inputValue]);\n\n useEffect(() => {\n if (!showPopover) {\n setFocusOptionIdx('');\n setShowSelectedOptions(false);\n }\n }, [showPopover]);\n\n const ctx = useMemo(\n () => ({\n props: { ...propsWithDefaults },\n virtualListHelpers,\n menuState,\n referenceElement,\n listRef,\n focusOptionIdx,\n selectedOptionsRef,\n controlsWrapperRef,\n selectAllCheckboxRef,\n inputValue,\n setInputValue,\n setMenuState,\n hasFocus,\n toggleSelectionButtonRef,\n pillGroupRef,\n showSelectedOptions,\n wrapperListRef,\n setShowSelectedOptions,\n setHasFocus,\n setFocusOptionIdx,\n scrollOptionIntoView,\n setReferenceElement,\n setShowPopover,\n internalRef,\n correctOptions,\n instanceUid,\n }),\n [\n scrollOptionIntoView,\n setMenuState,\n correctOptions,\n hasFocus,\n propsWithDefaults,\n virtualListHelpers,\n inputValue,\n focusOptionIdx,\n wrapperListRef,\n showSelectedOptions,\n menuState,\n pillGroupRef,\n referenceElement,\n selectedOptionsRef,\n controlsWrapperRef,\n selectAllCheckboxRef,\n toggleSelectionButtonRef,\n listRef,\n internalRef,\n instanceUid,\n ],\n );\n\n return ctx;\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,SAAS,UAAU,QAAQ,aAAa,iBAAiB;AAClE,SAAS,kBAA6C;AACtD,SAAS,WAAW;AACpB,SAAS,8BAA8B,sCAAsC;AAC7E,SAAS,oBAAoB;AAE7B,SAAS,yBAAyB;AAElC,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAExB,MAAM,cAAc,CAAC,UAAoE;AAC9F,QAAM,oBAAoB,6BAAwD,OAAO,YAAY;AACrG,iCAA+B,mBAAmB,mBAAmB,cAAc;AACnF,QAAM,CAAC,aAAa,cAAc,IAAI,SAAkB,KAAK;AAC7D,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAA6B,IAAI;AACjF,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAkB,KAAK;AAE7E,QAAM,CAAC,YAAY,aAAa,IAAI,SAAiB,EAA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U,MAAM;AAId,QAAI,CAAC,SAAU,mBAAkB,EAAE;AACnC,QAAI,aAAa,CAAC,kBAAkB,sBAAsB;AACxD,YAAM,eAAe,eAAe,gBAAgB,cAAc;AAClE,wBAAkB,YAAY;AAC9B,2BAAqB,cAAc,EAAE,OAAO,SAAS,CAAC;AAAA,IACxD;AAAA,EAEF,GAAG,CAAC,aAAa,UAAU,gBAAgB,cAAc,CAAC;AAE1D,QAAM,oBAAoB,eAAe,cAAc;AAGvD,YAAU,MAAM;AACd,sBAAkB,kBAAkB,UAAU,CAAC,GAAG,QAAQ,EAAE;AAAA,EAC9D,GAAG,CAAC,mBAAmB,UAAU,CAAC;AAElC,YAAU,MAAM;AACd,QAAI,CAAC,aAAa;AAChB,wBAAkB,EAAE;AACpB,6BAAuB,KAAK;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAEhB,QAAM,MAAM;AAAA,IACV,OAAO;AAAA,MACL,OAAO,EAAE,GAAG,kBAAkB;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable import/prefer-default-export */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useMemo, useState, useRef, useCallback, useEffect } from 'react';\nimport { useVirtual, type ScrollToIndexOptions } from 'react-virtual';\nimport { uid } from 'uid';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { defaultProps } from '../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { ComboboxPropTypes } from '../react-desc-prop-types.js';\nimport type { DSComboboxInternalsT } from '../sharedTypes.js';\nimport { useCorrectOptions } from './useCorrectOptions.js';\nimport { getFirstOption, isSelectedValueEmpty } from '../utils/listHelper.js';\nimport { DSComboBoxName } from '../theming.js';\n\nexport const useComboBox = (props: DSComboboxT.Props): DSComboboxInternalsT.ComboBoxContextT => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSComboboxT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, ComboboxPropTypes, DSComboBoxName);\n const [showPopover, setShowPopover] = useState<boolean>(false);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n\n const [inputValue, setInputValue] = useState<string>('');\n const [hasFocus, setHasFocus] = useState<boolean>(false);\n\n const internalRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const wrapperListRef = useRef<HTMLDivElement>(null);\n\n const selectedOptionsRef = useRef<HTMLDivElement>(null);\n const controlsWrapperRef = useRef<HTMLDivElement>(null);\n const pillGroupRef = useRef<HTMLDivElement>(null);\n\n const { id, selectedValues, isMenuOpen, onMenuChange, applyAriaDisabled } = propsWithDefaults;\n\n const instanceUid = useMemo(() => id || uid(5), [id]);\n\n const menuState = useMemo(() => {\n if (isMenuOpen !== undefined) return isMenuOpen;\n return showPopover;\n }, [showPopover, isMenuOpen]);\n\n // ---------------------------------------------------------------------------\n // Options with creatable option + filtered by selected\n // ---------------------------------------------------------------------------\n\n const correctOptions = useCorrectOptions(propsWithDefaults, inputValue);\n\n // ===========================================================================\n // Virtualization setup\n // ===========================================================================\n\n const virtualListHelpers: ReturnType<typeof useVirtual> = useVirtual({\n size: correctOptions.length,\n parentRef: listRef,\n overscan: 15,\n paddingStart: 0,\n });\n\n // ===========================================================================\n // Scroll into view function\n // ===========================================================================\n const scrollOptionIntoView = useCallback(\n (dsId: string, opts: ScrollToIndexOptions = { align: 'center' }) => {\n virtualListHelpers.scrollToIndex(\n correctOptions.findIndex((opt) => opt.dsId === dsId),\n opts,\n );\n },\n [correctOptions, virtualListHelpers],\n );\n\n // ===========================================================================\n // Init focused option when opening the menu list\n // ===========================================================================\n\n const [focusOptionIdx, setFocusOptionIdx] = useState<string>('');\n\n const setMenuState = useCallback(\n (\n newState: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => {\n if (applyAriaDisabled) return;\n if (onMenuChange !== undefined) onMenuChange(newState, reason, e);\n setShowPopover(newState);\n\n if (!inputValue && newState && !focusOptionIdx && !isSelectedValueEmpty(selectedValues)) {\n const focusedValue = getFirstOption(correctOptions, selectedValues);\n setFocusOptionIdx(focusedValue);\n scrollOptionIntoView(focusedValue, { align: 'center' });\n } else {\n setFocusOptionIdx('');\n }\n },\n [applyAriaDisabled, onMenuChange, inputValue, focusOptionIdx, selectedValues, correctOptions, scrollOptionIntoView],\n );\n\n // We need to force the auto focus for the inline since we dont control the floating wrapper.\n useEffect(() => {\n if (propsWithDefaults.inline) {\n setMenuState(true, 'inline');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const ctx = useMemo(\n () => ({\n props: { ...propsWithDefaults },\n virtualListHelpers,\n menuState,\n referenceElement,\n listRef,\n focusOptionIdx,\n selectedOptionsRef,\n controlsWrapperRef,\n inputValue,\n setInputValue,\n setMenuState,\n hasFocus,\n pillGroupRef,\n wrapperListRef,\n setHasFocus,\n setFocusOptionIdx,\n scrollOptionIntoView,\n setReferenceElement,\n setShowPopover,\n internalRef,\n correctOptions,\n instanceUid,\n }),\n [\n scrollOptionIntoView,\n setMenuState,\n correctOptions,\n hasFocus,\n propsWithDefaults,\n virtualListHelpers,\n inputValue,\n focusOptionIdx,\n wrapperListRef,\n menuState,\n pillGroupRef,\n referenceElement,\n selectedOptionsRef,\n controlsWrapperRef,\n listRef,\n internalRef,\n instanceUid,\n ],\n );\n\n return ctx;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,SAAS,UAAU,QAAQ,aAAa,iBAAiB;AAClE,SAAS,kBAA6C;AACtD,SAAS,WAAW;AACpB,SAAS,8BAA8B,sCAAsC;AAC7E,SAAS,oBAAoB;AAE7B,SAAS,yBAAyB;AAElC,SAAS,yBAAyB;AAClC,SAAS,gBAAgB,4BAA4B;AACrD,SAAS,sBAAsB;AAExB,MAAM,cAAc,CAAC,UAAoE;AAC9F,QAAM,oBAAoB,6BAAwD,OAAO,YAAY;AACrG,iCAA+B,mBAAmB,mBAAmB,cAAc;AACnF,QAAM,CAAC,aAAa,cAAc,IAAI,SAAkB,KAAK;AAC7D,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAA6B,IAAI;AAEjF,QAAM,CAAC,YAAY,aAAa,IAAI,SAAiB,EAAE;AACvD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkB,KAAK;AAEvD,QAAM,cAAc,OAAyB,IAAI;AACjD,QAAM,UAAU,OAAuB,IAAI;AAC3C,QAAM,iBAAiB,OAAuB,IAAI;AAElD,QAAM,qBAAqB,OAAuB,IAAI;AACtD,QAAM,qBAAqB,OAAuB,IAAI;AACtD,QAAM,eAAe,OAAuB,IAAI;AAEhD,QAAM,EAAE,IAAI,gBAAgB,YAAY,cAAc,kBAAkB,IAAI;AAE5E,QAAM,cAAc,QAAQ,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAEpD,QAAM,YAAY,QAAQ,MAAM;AAC9B,QAAI,eAAe,OAAW,QAAO;AACrC,WAA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A,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -2,9 +2,9 @@ import * as React from "react";
2
2
  import { useMemo } from "react";
3
3
  import { uid } from "uid";
4
4
  import { MENU_OPTION_TYPES } from "../constants.js";
5
- import { selectedValuesWithSections, filterOptions } from "../utils/listHelper.js";
6
- const useCorrectOptions = (propsWithDefaults, inputValue, showSelectedOptions) => {
7
- const { filteredOptions, allOptions, selectedValues, onCreate } = propsWithDefaults;
5
+ import { filterOptions } from "../utils/listHelper.js";
6
+ const useCorrectOptions = (propsWithDefaults, inputValue) => {
7
+ const { filteredOptions, allOptions, onCreate } = propsWithDefaults;
8
8
  return useMemo(() => {
9
9
  let correctAllOptions = allOptions;
10
10
  if (allOptions?.every((option) => typeof option === "string")) {
@@ -16,9 +16,6 @@ const useCorrectOptions = (propsWithDefaults, inputValue, showSelectedOptions) =
16
16
  }));
17
17
  }
18
18
  const correctFilterOptions = filteredOptions ?? filterOptions(inputValue, correctAllOptions);
19
- if (showSelectedOptions && Array.isArray(selectedValues) && selectedValues.length > 0) {
20
- return selectedValuesWithSections(correctFilterOptions, selectedValues);
21
- }
22
19
  if (onCreate && inputValue && correctFilterOptions.findIndex(
23
20
  (option) => option.type === MENU_OPTION_TYPES.OPTION && option.label === inputValue
24
21
  ) === -1) {
@@ -32,7 +29,7 @@ const useCorrectOptions = (propsWithDefaults, inputValue, showSelectedOptions) =
32
29
  return [creatableItem, ...correctFilterOptions];
33
30
  }
34
31
  return correctFilterOptions;
35
- }, [filteredOptions, allOptions, showSelectedOptions, selectedValues, onCreate, inputValue]);
32
+ }, [filteredOptions, allOptions, onCreate, inputValue]);
36
33
  };
37
34
  export {
38
35
  useCorrectOptions
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useCorrectOptions.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { useMemo } from 'react';\nimport { uid } from 'uid';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES } from '../constants.js';\nimport { selectedValuesWithSections, filterOptions } from '../utils/listHelper.js';\nconst useCorrectOptions = (propsWithDefaults: DSComboboxT.Props, inputValue: string, showSelectedOptions: boolean) => {\n const { filteredOptions, allOptions, selectedValues, onCreate } = propsWithDefaults;\n\n return useMemo(() => {\n let correctAllOptions = allOptions;\n if (allOptions?.every((option) => typeof option === 'string')) {\n correctAllOptions = allOptions.map((option, index) => ({\n dsId: index.toString(),\n label: option as unknown as string,\n type: MENU_OPTION_TYPES.OPTION,\n value: option as unknown as string,\n }));\n }\n const correctFilterOptions = filteredOptions ?? filterOptions(inputValue, correctAllOptions);\n // when show selected toggle is on we return the selected value only as filteredOptions prop\n if (showSelectedOptions && Array.isArray(selectedValues) && selectedValues.length > 0) {\n return selectedValuesWithSections(correctFilterOptions, selectedValues);\n }\n\n // whether oncreate is passed we add as first option the creatable action based on input value string\n if (\n onCreate &&\n inputValue &&\n correctFilterOptions.findIndex(\n (option) => option.type === MENU_OPTION_TYPES.OPTION && option.label === inputValue,\n ) === -1\n ) {\n const creatableUuid = uid();\n const creatableItem: DSComboboxT.ItemCreatableOption = {\n dsId: `creatable-${creatableUuid}`,\n label: inputValue,\n type: 'creatable',\n 'aria-describedby': `aria-creatable`,\n };\n\n return [creatableItem, ...correctFilterOptions];\n }\n\n return correctFilterOptions;\n }, [filteredOptions, allOptions, showSelectedOptions, selectedValues, onCreate, inputValue]);\n};\n\nexport { useCorrectOptions };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,eAAe;AACxB,SAAS,WAAW;AAEpB,SAAS,yBAAyB;AAClC,SAAS,4BAA4B,qBAAqB;AAC1D,MAAM,oBAAoB,CAAC,mBAAsC,YAAoB,wBAAiC;AACpH,QAAM,EAAE,iBAAiB,YAAY,gBAAgB,SAAS,IAAI;AAElE,SAAO,QAAQ,MAAM;AACnB,QAAI,oBAAoB;AACxB,QAAI,YAAY,MAAM,CAAC,WAAW,OAAO,WAAW,QAAQ,GAAG;AAC7D,0BAAoB,WAAW,IAAI,CAAC,QAAQ,WAAW;AAAA,QACrD,MAAM,MAAM,SAAS;AAAA,QACrB,OAAO;AAAA,QACP,MAAM,kBAAkB;AAAA,QACxB,OAAO;AAAA,MACT,EAAE;AAAA,IACJ;AACA,UAAM,uBAAuB,mBAAmB,cAAc,YAAY,iBAAiB;AAE3F,QAAI,uBAAuB,MAAM,QAAQ,cAAc,KAAK,eAAe,SAAS,GAAG;AACrF,aAAO,2BAA2B,sBAAsB,cAAc;AAAA,IACxE;AAGA,QACE,YACA,cACA,qBAAqB;AAAA,MACnB,CAAC,WAAW,OAAO,SAAS,kBAAkB,UAAU,OAAO,UAAU;AAAA,IAC3E,MAAM,IACN;AACA,YAAM,gBAAgB,IAAI;AAC1B,YAAM,gBAAiD;AAAA,QACrD,MAAM,aAAa,aAAa;AAAA,QAChC,OAAO;AAAA,QACP,MAAM;AAAA,QACN,oBAAoB;AAAA,MACtB;AAEA,aAAO,CAAC,eAAe,GAAG,oBAAoB;AAAA,IAChD;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,iBAAiB,YAAY,qBAAqB,gBAAgB,UAAU,UAAU,CAAC;AAC7F;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { useMemo } from 'react';\nimport { uid } from 'uid';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES } from '../constants.js';\nimport { filterOptions } from '../utils/listHelper.js';\nconst useCorrectOptions = (propsWithDefaults: DSComboboxT.Props, inputValue: string) => {\n const { filteredOptions, allOptions, onCreate } = propsWithDefaults;\n\n return useMemo(() => {\n let correctAllOptions = allOptions;\n if (allOptions?.every((option) => typeof option === 'string')) {\n correctAllOptions = allOptions.map((option, index) => ({\n dsId: index.toString(),\n label: option as unknown as string,\n type: MENU_OPTION_TYPES.OPTION,\n value: option as unknown as string,\n }));\n }\n const correctFilterOptions = filteredOptions ?? filterOptions(inputValue, correctAllOptions);\n\n // whether oncreate is passed we add as first option the creatable action based on input value string\n if (\n onCreate &&\n inputValue &&\n correctFilterOptions.findIndex(\n (option) => option.type === MENU_OPTION_TYPES.OPTION && option.label === inputValue,\n ) === -1\n ) {\n const creatableUuid = uid();\n const creatableItem: DSComboboxT.ItemCreatableOption = {\n dsId: `creatable-${creatableUuid}`,\n label: inputValue,\n type: 'creatable',\n 'aria-describedby': `aria-creatable`,\n };\n\n return [creatableItem, ...correctFilterOptions];\n }\n\n return correctFilterOptions;\n }, [filteredOptions, allOptions, onCreate, inputValue]);\n};\n\nexport { useCorrectOptions };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,eAAe;AACxB,SAAS,WAAW;AAEpB,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAC9B,MAAM,oBAAoB,CAAC,mBAAsC,eAAuB;AACtF,QAAM,EAAE,iBAAiB,YAAY,SAAS,IAAI;AAElD,SAAO,QAAQ,MAAM;AACnB,QAAI,oBAAoB;AACxB,QAAI,YAAY,MAAM,CAAC,WAAW,OAAO,WAAW,QAAQ,GAAG;AAC7D,0BAAoB,WAAW,IAAI,CAAC,QAAQ,WAAW;AAAA,QACrD,MAAM,MAAM,SAAS;AAAA,QACrB,OAAO;AAAA,QACP,MAAM,kBAAkB;AAAA,QACxB,OAAO;AAAA,MACT,EAAE;AAAA,IACJ;AACA,UAAM,uBAAuB,mBAAmB,cAAc,YAAY,iBAAiB;AAG3F,QACE,YACA,cACA,qBAAqB;AAAA,MACnB,CAAC,WAAW,OAAO,SAAS,kBAAkB,UAAU,OAAO,UAAU;AAAA,IAC3E,MAAM,IACN;AACA,YAAM,gBAAgB,IAAI;AAC1B,YAAM,gBAAiD;AAAA,QACrD,MAAM,aAAa,aAAa;AAAA,QAChC,OAAO;AAAA,QACP,MAAM;AAAA,QACN,oBAAoB;AAAA,MACtB;AAEA,aAAO,CAAC,eAAe,GAAG,oBAAoB;AAAA,IAChD;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,iBAAiB,YAAY,UAAU,UAAU,CAAC;AACxD;",
6
6
  "names": []
7
7
  }
@@ -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,GA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EJ,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;AA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AA,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,UAAU,KAAK;AAAA,gBACf;AAAA,gBACA,QAAQ;AAAA,gBACR;AAAA,gBAEA,8BAAC,uBAAoB,UAAU,IAAI,aAAa,iBAAiB,mBAC/D,8BAAC,YAAS,GACZ;AAAA;AAAA,YACF,IACE;AAAA,aACN;AAAA;AAAA;AAAA,IAEJ,GACF;AAAA;AAEJ;",
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,7 +112,8 @@ 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
119
  /* @__PURE__ */ jsx(StyleHiddenInput, { type: "text", name: "hidden", tabIndex: -1, onPaste: handleOnPaste, "aria-hidden": "true" })
@@ -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,I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AAC,8BAA2B,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 type=\"text\" name=\"hidden\" tabIndex={-1} onPaste={handleOnPaste} aria-hidden=\"true\" />\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;AACvC,SAAS,0BAA0B;AACnC;AAAA,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