@elliemae/ds-form-combobox 3.51.0-next.1 → 3.51.0-next.12

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 (128) hide show
  1. package/dist/cjs/ComboBoxCTX.js +4 -7
  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 +40 -52
  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/DropdownIndicator.js +3 -2
  14. package/dist/cjs/parts/DropdownIndicator.js.map +2 -2
  15. package/dist/cjs/parts/Section.js +92 -0
  16. package/dist/cjs/parts/Section.js.map +7 -0
  17. package/dist/cjs/parts/container/Container.js +52 -41
  18. package/dist/cjs/parts/container/Container.js.map +3 -3
  19. package/dist/cjs/parts/controls/Controls.js +6 -4
  20. package/dist/cjs/parts/controls/Controls.js.map +2 -2
  21. package/dist/cjs/parts/controls/styled.js +22 -6
  22. package/dist/cjs/parts/controls/styled.js.map +2 -2
  23. package/dist/cjs/parts/controls/useOnPillsNavigation.js +3 -3
  24. package/dist/cjs/parts/controls/useOnPillsNavigation.js.map +2 -2
  25. package/dist/cjs/parts/controls-input/ControlsInput.js +21 -6
  26. package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
  27. package/dist/cjs/parts/controls-input/styled.js +3 -1
  28. package/dist/cjs/parts/controls-input/styled.js.map +2 -2
  29. package/dist/cjs/parts/controls-input/useKeyboardNavigation.js +15 -18
  30. package/dist/cjs/parts/controls-input/useKeyboardNavigation.js.map +2 -2
  31. package/dist/cjs/parts/controls-input/useMaskedOnChange.js +4 -5
  32. package/dist/cjs/parts/controls-input/useMaskedOnChange.js.map +2 -2
  33. package/dist/cjs/parts/menu-list/MenuList.js +31 -54
  34. package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
  35. package/dist/cjs/parts/menu-list/styled.js +3 -15
  36. package/dist/cjs/parts/menu-list/styled.js.map +2 -2
  37. package/dist/cjs/parts/menu-list/useItemRenderer.js +52 -47
  38. package/dist/cjs/parts/menu-list/useItemRenderer.js.map +2 -2
  39. package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +12 -4
  40. package/dist/cjs/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
  41. package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js +19 -4
  42. package/dist/cjs/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +3 -3
  43. package/dist/cjs/react-desc-prop-types.js +4 -1
  44. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  45. package/dist/cjs/sharedTypes.js.map +2 -2
  46. package/dist/cjs/utils/listHelper.js +7 -23
  47. package/dist/cjs/utils/listHelper.js.map +2 -2
  48. package/dist/esm/ComboBoxCTX.js +4 -7
  49. package/dist/esm/ComboBoxCTX.js.map +2 -2
  50. package/dist/esm/ComboboxDataTestids.js +0 -4
  51. package/dist/esm/ComboboxDataTestids.js.map +2 -2
  52. package/dist/esm/config/useClickOutside.js +22 -0
  53. package/dist/esm/config/useClickOutside.js.map +7 -0
  54. package/dist/esm/config/useComboBox.js +40 -52
  55. package/dist/esm/config/useComboBox.js.map +2 -2
  56. package/dist/esm/config/useCorrectOptions.js +4 -7
  57. package/dist/esm/config/useCorrectOptions.js.map +2 -2
  58. package/dist/esm/config/useOptionsPerSection.js +26 -0
  59. package/dist/esm/config/useOptionsPerSection.js.map +7 -0
  60. package/dist/esm/parts/DropdownIndicator.js +3 -2
  61. package/dist/esm/parts/DropdownIndicator.js.map +2 -2
  62. package/dist/esm/parts/Section.js +62 -0
  63. package/dist/esm/parts/Section.js.map +7 -0
  64. package/dist/esm/parts/container/Container.js +53 -42
  65. package/dist/esm/parts/container/Container.js.map +3 -3
  66. package/dist/esm/parts/controls/Controls.js +6 -4
  67. package/dist/esm/parts/controls/Controls.js.map +2 -2
  68. package/dist/esm/parts/controls/styled.js +22 -6
  69. package/dist/esm/parts/controls/styled.js.map +2 -2
  70. package/dist/esm/parts/controls/useOnPillsNavigation.js +3 -3
  71. package/dist/esm/parts/controls/useOnPillsNavigation.js.map +2 -2
  72. package/dist/esm/parts/controls-input/ControlsInput.js +21 -6
  73. package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
  74. package/dist/esm/parts/controls-input/styled.js +3 -1
  75. package/dist/esm/parts/controls-input/styled.js.map +2 -2
  76. package/dist/esm/parts/controls-input/useKeyboardNavigation.js +15 -18
  77. package/dist/esm/parts/controls-input/useKeyboardNavigation.js.map +2 -2
  78. package/dist/esm/parts/controls-input/useMaskedOnChange.js +4 -5
  79. package/dist/esm/parts/controls-input/useMaskedOnChange.js.map +2 -2
  80. package/dist/esm/parts/menu-list/MenuList.js +35 -58
  81. package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
  82. package/dist/esm/parts/menu-list/styled.js +3 -15
  83. package/dist/esm/parts/menu-list/styled.js.map +2 -2
  84. package/dist/esm/parts/menu-list/useItemRenderer.js +54 -49
  85. package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
  86. package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +12 -4
  87. package/dist/esm/parts/multi-selected-values-container/MultiSelectedValuesContainer.js.map +2 -2
  88. package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js +19 -4
  89. package/dist/esm/parts/multi-selected-values-container/RemovableSelectedValuePill.js.map +3 -3
  90. package/dist/esm/react-desc-prop-types.js +4 -1
  91. package/dist/esm/react-desc-prop-types.js.map +2 -2
  92. package/dist/esm/sharedTypes.js.map +2 -2
  93. package/dist/esm/utils/listHelper.js +7 -23
  94. package/dist/esm/utils/listHelper.js.map +2 -2
  95. package/dist/types/ComboboxDataTestids.d.ts +0 -4
  96. package/dist/types/config/useClickOutside.d.ts +1 -0
  97. package/dist/types/config/useCorrectOptions.d.ts +1 -1
  98. package/dist/types/config/useOptionsPerSection.d.ts +2 -0
  99. package/dist/types/parts/Section.d.ts +14 -0
  100. package/dist/types/parts/controls/styled.d.ts +2 -0
  101. package/dist/types/parts/controls-input/styled.d.ts +3 -1
  102. package/dist/types/parts/menu-list/styled.d.ts +2 -7
  103. package/dist/types/parts/menu-list/useItemRenderer.d.ts +9 -1
  104. package/dist/types/parts/multi-selected-values-container/RemovableSelectedValuePill.d.ts +1 -0
  105. package/dist/types/react-desc-prop-types.d.ts +11 -1
  106. package/dist/types/sharedTypes.d.ts +4 -10
  107. package/dist/types/tests/read-only.test.d.ts +1 -0
  108. package/dist/types/utils/listHelper.d.ts +0 -1
  109. package/package.json +17 -17
  110. package/dist/cjs/parts/header-list/HeaderList.js +0 -104
  111. package/dist/cjs/parts/header-list/HeaderList.js.map +0 -7
  112. package/dist/cjs/parts/header-list/index.js.map +0 -7
  113. package/dist/cjs/parts/header-list/styled.js +0 -85
  114. package/dist/cjs/parts/header-list/styled.js.map +0 -7
  115. package/dist/cjs/parts/header-list/useHeaderListHandlers.js +0 -140
  116. package/dist/cjs/parts/header-list/useHeaderListHandlers.js.map +0 -7
  117. package/dist/esm/parts/header-list/HeaderList.js +0 -80
  118. package/dist/esm/parts/header-list/HeaderList.js.map +0 -7
  119. package/dist/esm/parts/header-list/index.js +0 -6
  120. package/dist/esm/parts/header-list/index.js.map +0 -7
  121. package/dist/esm/parts/header-list/styled.js +0 -55
  122. package/dist/esm/parts/header-list/styled.js.map +0 -7
  123. package/dist/esm/parts/header-list/useHeaderListHandlers.js +0 -110
  124. package/dist/esm/parts/header-list/useHeaderListHandlers.js.map +0 -7
  125. package/dist/types/parts/header-list/HeaderList.d.ts +0 -2
  126. package/dist/types/parts/header-list/index.d.ts +0 -1
  127. package/dist/types/parts/header-list/styled.d.ts +0 -6
  128. package/dist/types/parts/header-list/useHeaderListHandlers.d.ts +0 -11
@@ -1,28 +1,29 @@
1
1
  import * as React from "react";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useContext, useMemo, useCallback, useLayoutEffect } from "react";
4
- import { StyledListWrapper, StyledNoResultsWrapper, StyledList, StyledVirtualListWrapper } from "./styled.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useContext, useMemo, useCallback } from "react";
4
+ import { DSFastList } from "@elliemae/ds-fast-list";
5
+ import { styled } from "@elliemae/ds-system";
6
+ import { Grid } from "@elliemae/ds-grid";
7
+ import { StyledListWrapper, StyledNoResultsWrapper } from "./styled.js";
5
8
  import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
6
9
  import { ComboBoxContext } from "../../ComboBoxCTX.js";
7
- import { HeaderList } from "../header-list/index.js";
8
- import { useItemRenderer } from "./useItemRenderer.js";
10
+ import { ItemRenderer } from "./useItemRenderer.js";
9
11
  import { LoadingContainer } from "./LoadingContainer.js";
10
12
  import { SkeletonContainer } from "./SkeletonContainer.js";
11
13
  import { useOnElementResize } from "../../utils/useOnElementResize.js";
14
+ const StyledItemsWrapper = styled(Grid)`
15
+ max-height: ${({ maxHeight }) => maxHeight ? `${String(maxHeight)}px` : "300px"};
16
+ `;
17
+ const estimatedSize = () => 32;
12
18
  const MenuList = () => {
13
19
  const {
14
- props: { isLoading, menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline, selectedValues, isSkeleton },
20
+ props: { isLoading, menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline, isSkeleton },
15
21
  controlsWrapperRef,
16
22
  listRef,
17
- inputValue,
18
23
  wrapperListRef,
19
- virtualListHelpers,
20
24
  correctOptions: filteredOptions,
21
25
  instanceUid
22
26
  } = useContext(ComboBoxContext);
23
- const multiple = Array.isArray(selectedValues);
24
- const withHeader = !inline && multiple && filteredOptions && filteredOptions.length > 0 && !inputValue;
25
- const ItemRenderer = useItemRenderer();
26
27
  const { width } = useOnElementResize(controlsWrapperRef);
27
28
  const preventLoseInputFocus = useCallback((e) => {
28
29
  e.preventDefault();
@@ -30,55 +31,31 @@ const MenuList = () => {
30
31
  const menuListRender = useMemo(() => {
31
32
  if (isSkeleton) return /* @__PURE__ */ jsx(SkeletonContainer, { instanceUid });
32
33
  if (isLoading) return /* @__PURE__ */ jsx(LoadingContainer, {});
33
- return /* @__PURE__ */ jsxs(Fragment, { children: [
34
- withHeader && /* @__PURE__ */ jsx(HeaderList, {}),
35
- filteredOptions && filteredOptions.length > 0 || onCreate ? /* @__PURE__ */ jsx(
36
- StyledVirtualListWrapper,
34
+ if (filteredOptions && filteredOptions.length > 0 || onCreate) {
35
+ return /* @__PURE__ */ jsx(StyledItemsWrapper, { maxHeight: menuMaxHeight, id: `combo-listbox-${instanceUid}`, children: /* @__PURE__ */ jsx(
36
+ DSFastList,
37
37
  {
38
- tabIndex: -1,
39
- inline,
40
- maxHeight: menuMaxHeight,
41
- innerRef: listRef,
42
- withHeader,
43
- children: /* @__PURE__ */ jsx(
44
- StyledList,
45
- {
46
- "aria-label": "listbox",
47
- id: `combo-listbox-${instanceUid}`,
48
- role: "listbox",
49
- "data-testid": ComboboxDataTestid.LIST,
50
- style: { height: virtualListHelpers?.totalSize, margin: inline ? "0px" : "8px 0px" },
51
- children: ItemRenderer
52
- }
53
- )
38
+ dsFastlistWrapperList: { role: "listbox", "data-testid": ComboboxDataTestid.LIST, "aria-label": "listbox" },
39
+ dsFastlistItem: { role: "none" },
40
+ actionRef: listRef,
41
+ count: filteredOptions.length,
42
+ ItemRenderer,
43
+ extraItemProps: { itemList: filteredOptions },
44
+ getId: (index) => filteredOptions[index].dsId,
45
+ estimateSize: estimatedSize
54
46
  }
55
- ) : /* @__PURE__ */ jsx(
56
- StyledNoResultsWrapper,
57
- {
58
- id: `combo-listbox-${instanceUid}`,
59
- "data-testid": ComboboxDataTestid.NO_MATCHES_FOUND,
60
- role: "alert",
61
- children: noOptionsMessage
62
- }
63
- )
64
- ] });
65
- }, [
66
- instanceUid,
67
- isSkeleton,
68
- isLoading,
69
- withHeader,
70
- filteredOptions,
71
- onCreate,
72
- inline,
73
- menuMaxHeight,
74
- listRef,
75
- virtualListHelpers?.totalSize,
76
- ItemRenderer,
77
- noOptionsMessage
78
- ]);
79
- useLayoutEffect(() => {
80
- virtualListHelpers?.measure();
81
- }, [width]);
47
+ ) });
48
+ }
49
+ return /* @__PURE__ */ jsx(
50
+ StyledNoResultsWrapper,
51
+ {
52
+ id: `combo-listbox-${instanceUid}`,
53
+ "data-testid": ComboboxDataTestid.NO_MATCHES_FOUND,
54
+ role: "alert",
55
+ children: noOptionsMessage
56
+ }
57
+ );
58
+ }, [isSkeleton, instanceUid, isLoading, filteredOptions, onCreate, noOptionsMessage, menuMaxHeight, listRef]);
82
59
  return /* @__PURE__ */ jsx(
83
60
  StyledListWrapper,
84
61
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/menu-list/MenuList.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useCallback, useLayoutEffect } from 'react';\nimport { StyledListWrapper, StyledNoResultsWrapper, StyledList, StyledVirtualListWrapper } from './styled.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { HeaderList } from '../header-list/index.js';\nimport { useItemRenderer } from './useItemRenderer.js';\nimport { LoadingContainer } from './LoadingContainer.js';\nimport { SkeletonContainer } from './SkeletonContainer.js';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\n\nexport const MenuList = (): JSX.Element => {\n const {\n props: { isLoading, menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline, selectedValues, isSkeleton },\n controlsWrapperRef,\n listRef,\n inputValue,\n wrapperListRef,\n virtualListHelpers,\n correctOptions: filteredOptions,\n instanceUid,\n } = useContext(ComboBoxContext);\n\n const multiple = Array.isArray(selectedValues);\n // removing the header list if we are filtering or is inline cb or we have no options to show\n const withHeader = !inline && multiple && filteredOptions && filteredOptions.length > 0 && !inputValue;\n const ItemRenderer = useItemRenderer();\n const { width } = useOnElementResize(controlsWrapperRef);\n const preventLoseInputFocus: React.MouseEventHandler = useCallback((e) => {\n e.preventDefault();\n }, []);\n\n const menuListRender = useMemo(() => {\n if (isSkeleton) return <SkeletonContainer instanceUid={instanceUid} />;\n\n if (isLoading) return <LoadingContainer />;\n\n return (\n <>\n {withHeader && <HeaderList />}\n {(filteredOptions && filteredOptions.length > 0) || onCreate ? (\n <StyledVirtualListWrapper\n tabIndex={-1}\n inline={inline}\n maxHeight={menuMaxHeight}\n innerRef={listRef}\n withHeader={withHeader}\n >\n <StyledList\n aria-label=\"listbox\"\n id={`combo-listbox-${instanceUid}`}\n role=\"listbox\"\n data-testid={ComboboxDataTestid.LIST}\n style={{ height: virtualListHelpers?.totalSize, margin: inline ? '0px' : '8px 0px' }}\n >\n {ItemRenderer}\n </StyledList>\n </StyledVirtualListWrapper>\n ) : (\n <StyledNoResultsWrapper\n id={`combo-listbox-${instanceUid}`}\n data-testid={ComboboxDataTestid.NO_MATCHES_FOUND}\n role=\"alert\"\n >\n {noOptionsMessage}\n </StyledNoResultsWrapper>\n )}\n </>\n );\n }, [\n instanceUid,\n isSkeleton,\n isLoading,\n withHeader,\n filteredOptions,\n onCreate,\n inline,\n menuMaxHeight,\n listRef,\n virtualListHelpers?.totalSize,\n ItemRenderer,\n noOptionsMessage,\n ]);\n\n useLayoutEffect(() => {\n virtualListHelpers?.measure();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [width]);\n\n return (\n <StyledListWrapper\n innerRef={wrapperListRef}\n inline={inline}\n onMouseDown={preventLoseIn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AI,iBAAiB,WAAW;AAAA,cAChC,MAAK;AAAA,cACL,eAAa,mBAAmB;AAAA,cAChC,OAAO,EAAE,QAAQ,oBAAoB,WAAW,QAAQ,SAAS,QAAQ,UAAU;AAAA,cAElF;AAAA;AAAA,UACH;AAAA;AAAA,MACF,IAEA;AAAA,QAAC;AAAA;AAAA,UACC,IAAI,iBAAiB,WAAW;AAAA,UAChC,eAAa,mBAAmB;AAAA,UAChC,MAAK;AAAA,UAEJ;AAAA;AAAA,MACH;AAAA,OAEJ;AAAA,EAEJ,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB;AAAA,IACA;AAAA,EACF,CAAC;AAED,kBAAgB,MAAM;AACpB,wBAAoB,QAAQ;AAAA,EAE9B,GAAG,CAAC,KAAK,CAAC;AAEV,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA,UAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useCallback } from 'react';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport { type SizingProps, styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { StyledListWrapper, StyledNoResultsWrapper } from './styled.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { ItemRenderer } from './useItemRenderer.js';\nimport { LoadingContainer } from './LoadingContainer.js';\nimport { SkeletonContainer } from './SkeletonContainer.js';\nimport { useOnElementResize } from '../../utils/useOnElementResize.js';\n\nconst StyledItemsWrapper = styled(Grid)<{ maxHeight: SizingProps['maxHeight'] }>`\n max-height: ${({ maxHeight }) => (maxHeight ? `${String(maxHeight)}px` : '300px')};\n`;\n\nconst estimatedSize = () => 32;\nexport const MenuList = (): JSX.Element => {\n const {\n props: { isLoading, menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline, isSkeleton },\n controlsWrapperRef,\n listRef,\n wrapperListRef,\n correctOptions: filteredOptions,\n instanceUid,\n } = useContext(ComboBoxContext);\n\n // removing the header list if we are filtering or is inline cb or we have no options to show\n\n const { width } = useOnElementResize(controlsWrapperRef);\n const preventLoseInputFocus: React.MouseEventHandler = useCallback((e) => {\n e.preventDefault();\n }, []);\n\n const menuListRender = useMemo(() => {\n if (isSkeleton) return <SkeletonContainer instanceUid={instanceUid} />;\n\n if (isLoading) return <LoadingContainer />;\n\n if ((filteredOptions && filteredOptions.length > 0) || onCreate) {\n return (\n <StyledItemsWrapper maxHeight={menuMaxHeight} id={`combo-listbox-${instanceUid}`}>\n <DSFastList\n dsFastlistWrapperList={{ role: 'listbox', 'data-testid': ComboboxDataTestid.LIST, 'aria-label': 'listbox' }}\n dsFastlistItem={{ role: 'none' }}\n actionRef={listRef}\n count={filteredOptions.length}\n ItemRenderer={ItemRenderer}\n extraItemProps={{ itemList: filteredOptions }}\n getId={(index: number) => filteredOptions[index].dsId}\n estimateSize={estimatedSize}\n />\n </StyledItemsWrapper>\n );\n }\n\n return (\n <StyledNoResultsWrapper\n id={`combo-listbox-${instanceUid}`}\n data-testid={ComboboxDataTestid.NO_MATCHES_FOUND}\n role=\"alert\"\n >\n {noOptionsMessage}\n </StyledNoResultsWrapper>\n );\n }, [isSkeleton, instanceUid, isLoading, filteredOptions, onCreate, noOptionsMessage, menuMaxHeight, listRef]);\n\n return (\n <StyledListWrapper\n innerRef={wrapperListRef}\n inline={inline}\n onMouseDown={preventLoseInputFocus}\n width={width}\n minWidth={menuMinWidth}\n >\n {menuListRender}\n </StyledListWrapper>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACmCI;AAnC3B,SAAgB,YAAY,SAAS,mBAAmB;AACxD,SAAS,kBAAkB;AA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,IAEJ;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,iBAAiB,WAAW;AAAA,QAChC,eAAa,mBAAmB;AAAA,QAChC,MAAK;AAAA,QAEJ;AAAA;AAAA,IACH;AAAA,EAEJ,GAAG,CAAC,YAAY,aAAa,WAAW,iBAAiB,UAAU,kBAAkB,eAAe,OAAO,CAAC;AAE5G,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA,UAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,22 +1,12 @@
1
1
  import * as React from "react";
2
2
  import { styled } from "@elliemae/ds-system";
3
- const StyledListWrapper = styled.div`
3
+ import { Grid } from "@elliemae/ds-grid";
4
+ const StyledListWrapper = styled(Grid)`
4
5
  min-width: ${({ inline, minWidth }) => inline ? "100%" : `${String(minWidth)}px`};
5
6
  width: ${({ width }) => `${width}px`};
6
7
  background-color: #ffffff;
7
- max-height: ${({ maxHeight }) => `${String(maxHeight)}px`};
8
8
  z-index: 100;
9
9
  `;
10
- const StyledList = styled.ul`
11
- position: relative;
12
- padding: 0;
13
- background-color: #ffffff;
14
- overflow: hidden;
15
- `;
16
- const StyledVirtualListWrapper = styled.div`
17
- overflow-y: auto;
18
- max-height: ${({ maxHeight }) => maxHeight ? `${String(maxHeight)}px` : "300px"};
19
- `;
20
10
  const StyledCreatableLabel = styled.span`
21
11
  font-weight: bold;
22
12
  font-style: italic;
@@ -30,9 +20,7 @@ const StyledNoResultsWrapper = styled.div`
30
20
  export {
31
21
  StyledCreatableLabel,
32
22
  StyledCreatableValue,
33
- StyledList,
34
23
  StyledListWrapper,
35
- StyledNoResultsWrapper,
36
- StyledVirtualListWrapper
24
+ StyledNoResultsWrapper
37
25
  };
38
26
  //# sourceMappingURL=styled.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/menu-list/styled.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport type { SizingProps } from '@elliemae/ds-system';\n\ninterface StyledListWrapperT {\n minWidth: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n width: number | string;\n inline?: boolean;\n}\nexport const StyledListWrapper = styled.div<StyledListWrapperT>`\n min-width: ${({ inline, minWidth }) => (inline ? '100%' : `${String(minWidth)}px`)};\n width: ${({ width }) => `${width}px`};\n background-color: #ffffff;\n max-height: ${({ maxHeight }) => `${String(maxHeight)}px`};\n z-index: 100;\n`;\n\nexport const StyledList = styled.ul`\n position: relative;\n padding: 0;\n background-color: #ffffff;\n overflow: hidden;\n`;\n\nexport const StyledVirtualListWrapper = styled.div<{\n inline: boolean | undefined;\n maxHeight: SizingProps['maxHeight'];\n withHeader?: boolean;\n}>`\n overflow-y: auto;\n max-height: ${({ maxHeight }) => (maxHeight ? `${String(maxHeight)}px` : '300px')};\n`;\n\nexport const StyledCreatableLabel = styled.span`\n font-weight: bold;\n font-style: italic;\n`;\n\nexport const StyledCreatableValue = styled.span`\n word-break: break-all;\n`;\n\nexport const StyledNoResultsWrapper = styled.div`\n padding: 16px;\n`;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AAShB,MAAM,oBAAoB,OAAO;AAAA,eACzB,CAAC,EAAE,QAAQ,SAAS,MAAO,SAAS,SAAS,GAAG,OAAO,QAAQ,CAAC,IAAK;AAAA,WACzE,CAAC,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAAA;AAAA,gBAEtB,CAAC,EAAE,UAAU,MAAM,GAAG,OAAO,SAAS,CAAC,IAAI;AAAA;AAAA;AAIpD,MAAM,aAAa,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAO1B,MAAM,2BAA2B,OAAO;AAAA;AAAA,gBAM/B,CAAC,EAAE,UAAU,MAAO,YAAY,GAAG,OAAO,SAAS,CAAC,OAAO,OAAQ;AAAA;AAG5E,MAAM,uBAAuB,OAAO;AAAA;AAAA;AAAA;AAKpC,MAAM,uBAAuB,OAAO;AAAA;AAAA;AAIpC,MAAM,yBAAyB,OAAO;AAAA;AAAA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport type { SizingProps } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\n\ninterface StyledListWrapperT {\n minWidth: SizingProps['minWidth'];\n maxHeight?: SizingProps['maxHeight'];\n width: number | string;\n inline?: boolean;\n}\nexport const StyledListWrapper = styled(Grid)<StyledListWrapperT>`\n min-width: ${({ inline, minWidth }) => (inline ? '100%' : `${String(minWidth)}px`)};\n width: ${({ width }) => `${width}px`};\n background-color: #ffffff;\n z-index: 100;\n`;\n\nexport const StyledCreatableLabel = styled.span`\n font-weight: bold;\n font-style: italic;\n`;\n\nexport const StyledCreatableValue = styled.span`\n word-break: break-all;\n`;\n\nexport const StyledNoResultsWrapper = styled.div`\n padding: 16px;\n`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AAEvB,SAAS,YAAY;AAQd,MAAM,oBAAoB,OAAO,IAAI;AAAA,eAC7B,CAAC,EAAE,QAAQ,SAAS,MAAO,SAAS,SAAS,GAAG,OAAO,QAAQ,CAAC,IAAK;AAAA,WACzE,CAAC,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAAA;AAAA;AAAA;AAK/B,MAAM,uBAAuB,OAAO;AAAA;AAAA;AAAA;AAKpC,MAAM,uBAAuB,OAAO;AAAA;AAAA;AAIpC,MAAM,yBAAyB,OAAO;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -1,23 +1,24 @@
1
1
  import * as React from "react";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useMemo, useContext, useCallback } from "react";
4
4
  import { Grid } from "@elliemae/ds-grid";
5
- import { SingleMenuItem, MultiMenuItem, Section, Separator } from "@elliemae/ds-menu-items";
5
+ import { SingleMenuItem, MultiMenuItem, Separator } from "@elliemae/ds-menu-items";
6
+ import { Section } from "../Section.js";
6
7
  import { ComboBoxContext } from "../../ComboBoxCTX.js";
7
8
  import { StyledCreatableLabel, StyledCreatableValue } from "./styled.js";
8
9
  import { isSelected, getSuggestedValueOnChange } from "../../utils/listHelper.js";
9
10
  import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
10
11
  import { MENU_OPTION_TYPES, INTERNAL_MENU_OPTION_TYPES } from "../../constants.js";
11
- const useItemRenderer = () => {
12
+ const ItemRenderer = ({ index, extraItemProps }) => {
12
13
  const {
13
- props: { onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions },
14
+ props: { onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions, readOnly },
14
15
  setMenuState,
15
16
  inputValue,
16
17
  focusOptionIdx,
17
18
  setInputValue,
18
- virtualListHelpers,
19
- correctOptions: filteredOptions
19
+ optionsPerSection
20
20
  } = useContext(ComboBoxContext);
21
+ const option = extraItemProps?.itemList[index];
21
22
  const multiple = Array.isArray(selectedValues);
22
23
  const CBItem = multiple ? MultiMenuItem : SingleMenuItem;
23
24
  const handleOnCreateClick = useCallback(() => {
@@ -28,15 +29,16 @@ const useItemRenderer = () => {
28
29
  }
29
30
  }, [onFilter, onCreate, inputValue, allOptions, setInputValue]);
30
31
  const handleClick = useCallback(
31
- (option, e) => {
32
- if (option.type === MENU_OPTION_TYPES.OPTION) {
33
- if (!option.disabled) {
32
+ (currentOption, e) => {
33
+ if (readOnly) return;
34
+ if (currentOption.type === MENU_OPTION_TYPES.OPTION) {
35
+ if (!currentOption.disabled) {
34
36
  if (onFilter) onFilter(allOptions, inputValue);
35
37
  setInputValue("");
36
38
  if (!multiple) {
37
39
  setMenuState(false, "selectOption", e);
38
40
  }
39
- onChange(getSuggestedValueOnChange(option, selectedValues, isNonClearable), option, e);
41
+ onChange(getSuggestedValueOnChange(currentOption, selectedValues, isNonClearable), currentOption, e);
40
42
  }
41
43
  }
42
44
  e.stopPropagation();
@@ -48,52 +50,54 @@ const useItemRenderer = () => {
48
50
  e.preventDefault();
49
51
  }, []);
50
52
  return useMemo(() => {
51
- if (!virtualListHelpers) {
52
- return null;
53
- }
54
- return virtualListHelpers.virtualItems.map((vItem) => {
55
- const option = filteredOptions[vItem.index];
56
- const { dsId, type, disabled, applyAriaDisabled, ...rest } = option;
53
+ if (option) {
54
+ const { dsId, type, disabled, applyAriaDisabled, readOnly: itemReadOnly, ...rest } = option;
57
55
  const generalProps = {
58
- wrapperStyles: {
59
- position: "absolute",
60
- top: 0,
61
- left: 0,
62
- width: "100%",
63
- transform: `translateY(${vItem.start}px)`
64
- },
65
- "aria-setsize": `${filteredOptions.length}`,
66
- "aria-posinset": `${vItem.index + 1}`,
56
+ // 'aria-setsize': `${allOptions.length}`,
57
+ // 'aria-posinset': `${vItem.index + 1}`,
67
58
  key: `${dsId}`,
68
- innerRef: vItem.measureRef,
69
59
  dsId: dsId.toString(),
70
60
  ...rest
71
61
  };
72
62
  if (type === MENU_OPTION_TYPES.SECTION) {
73
- return /* @__PURE__ */ jsx(Section, { label: option.label, ...generalProps, render: void 0 });
63
+ return /* @__PURE__ */ jsx(
64
+ Section,
65
+ {
66
+ label: option.label,
67
+ ...generalProps,
68
+ options: option.options,
69
+ handleClick,
70
+ focusOptionIdx,
71
+ handleOnMouseDown,
72
+ selectedValues
73
+ }
74
+ );
74
75
  }
75
76
  if (type === MENU_OPTION_TYPES.SEPARATOR) {
76
77
  return /* @__PURE__ */ jsx(Separator, { ...generalProps, render: void 0 });
77
78
  }
78
79
  if (option.type === MENU_OPTION_TYPES.OPTION) {
79
- return /* @__PURE__ */ jsx(
80
- CBItem,
81
- {
82
- ...generalProps,
83
- value: option.value,
84
- label: option.label,
85
- dataTestid: ComboboxDataTestid.OPTION,
86
- disabled,
87
- applyAriaDisabled,
88
- onClick: (e) => {
89
- if (applyAriaDisabled) return;
90
- handleClick(option, e);
91
- },
92
- onMouseDown: handleOnMouseDown,
93
- isActive: dsId === focusOptionIdx,
94
- isSelected: isSelected(selectedValues, option),
95
- tabIndex: -1
96
- }
80
+ return (
81
+ // @ts-expect-error - this needs to be rewritten, this should not be a custom hook returning JSX, this should be a component.
82
+ /* @__PURE__ */ jsx(
83
+ CBItem,
84
+ {
85
+ ...generalProps,
86
+ value: option.value,
87
+ label: option.label,
88
+ dataTestid: ComboboxDataTestid.OPTION,
89
+ disabled,
90
+ applyAriaDisabled: applyAriaDisabled || itemReadOnly,
91
+ onClick: (e) => {
92
+ if (applyAriaDisabled) return;
93
+ handleClick(option, e);
94
+ },
95
+ onMouseDown: handleOnMouseDown,
96
+ isActive: dsId === focusOptionIdx,
97
+ isSelected: isSelected(selectedValues, option),
98
+ tabIndex: -1
99
+ }
100
+ )
97
101
  );
98
102
  }
99
103
  if (type === INTERNAL_MENU_OPTION_TYPES.CREATABLE) {
@@ -112,11 +116,12 @@ const useItemRenderer = () => {
112
116
  }
113
117
  );
114
118
  }
115
- return /* @__PURE__ */ jsx(Fragment, {});
116
- });
117
- }, [filteredOptions, focusOptionIdx, selectedValues, virtualListHelpers]);
119
+ return null;
120
+ }
121
+ return null;
122
+ }, [optionsPerSection, focusOptionIdx, selectedValues, allOptions, onCreate, inputValue, readOnly]);
118
123
  };
119
124
  export {
120
- useItemRenderer
125
+ ItemRenderer
121
126
  };
122
127
  //# sourceMappingURL=useItemRenderer.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/menu-list/useItemRenderer.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { SingleMenuItem, MultiMenuItem, Section, Separator } from '@elliemae/ds-menu-items';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { StyledCreatableLabel, StyledCreatableValue } from './styled.js';\nimport { isSelected, getSuggestedValueOnChange } from '../../utils/listHelper.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES, INTERNAL_MENU_OPTION_TYPES } from '../../constants.js';\nexport const useItemRenderer = (): Array<JSX.Element> | null => {\n const {\n props: { onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions },\n setMenuState,\n inputValue,\n focusOptionIdx,\n setInputValue,\n virtualListHelpers,\n correctOptions: filteredOptions,\n } = useContext(ComboBoxContext);\n\n const multiple = Array.isArray(selectedValues);\n const CBItem = multiple ? MultiMenuItem : SingleMenuItem;\n\n const handleOnCreateClick = useCallback(() => {\n if (inputValue && onCreate) {\n onCreate(inputValue);\n setInputValue('');\n if (onFilter) onFilter(allOptions, inputValue);\n }\n }, [onFilter, onCreate, inputValue, allOptions, setInputValue]);\n\n const handleClick = useCallback(\n (option: DSComboboxT.ItemOption, e: React.MouseEvent) => {\n if (option.type === MENU_OPTION_TYPES.OPTION) {\n if (!option.disabled) {\n if (onFilter) onFilter(allOptions, inputValue);\n setInputValue('');\n if (!multiple) {\n setMenuState(false, 'selectOption', e);\n }\n onChange(getSuggestedValueOnChange(option, selectedValues, isNonClearable), option, e);\n }\n }\n // prevent for loosing focus on input control\n e.stopPropagation();\n e.preventDefault();\n },\n [onFilter, selectedValues, allOptions, onChange, setMenuState, multiple],\n );\n\n // prevent blur from controls input\n const handleOnMouseDown = useCallback((e: React.MouseEvent<HTMLLIElement>) => {\n e.preventDefault();\n }, []);\n\n return useMemo(() => {\n if (!virtualListHelpers) {\n return null;\n }\n return virtualListHelpers.virtualItems.map((vItem) => {\n const option = filteredOptions[vItem.index];\n const { dsId, type, disabled, applyAriaDisabled, ...rest } = option;\n const generalProps = {\n wrapperStyles: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n transform: `translateY(${vItem.start}px)`,\n },\n 'aria-setsize': `${filteredOptions.length}`,\n 'aria-posinset': `${vItem.index + 1}`,\n key: `${dsId}`,\n innerRef: vItem.measureRef,\n dsId: dsId.toString(),\n ...rest,\n };\n if (type === MENU_OPTION_TYPES.SECTION) {\n return <Section label={option.label} {...generalProps} render={undefined} />;\n }\n if (type === MENU_OPTION_TYPES.SEPARATOR) {\n return <Separator {...generalProps} render={undefined} />;\n }\n if (option.type === MENU_OPTION_TYPES.OPTION) {\n return (\n <CBItem\n {...generalProps}\n value={option.value}\n label={option.label}\n dataTestid={ComboboxDataTestid.OPTION}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n onClick={(e: React.MouseEvent) => {\n if (applyAriaDisabled) return;\n handleClick(option, e);\n }}\n onMouseDown={handleOnMouseDown}\n isActive={dsId === focusOptionIdx}\n isSelected={isSelected(selectedValues, option)}\n tabIndex={-1}\n />\n );\n }\n if (type === INTERNAL_MENU_OPTION_TYPES.CREATABLE) {\n return (\n <SingleMenuItem\n dataTestid={ComboboxDataTestid.OPTION}\n isActive={dsId === focusOptionIdx}\n {...generalProps}\n render={({ label: labelCreatable }: { label?: string }) => (\n <Grid p=\"8px\" cols={['min-content', 'auto']} gutter=\"xxs\" alignItems=\"center\">\n <StyledCreatableLabel>Add:</StyledCreatableLabel>\n <StyledCreatableValue>{`\"${labelCreatable}\"`}</StyledCreatableValue>\n </Grid>\n )}\n label={option.label}\n onClick={handleOnCreateClick}\n />\n );\n }\n return <></>;\n });\n }, [filteredOptions, focusOptionIdx, selectedValues, virtualListHelpers]);\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACiFR,SA0CF,UA1CE,KAgCD,YAhCC;AA9Ef,SAAgB,SAAS,YAAY,mBAAmB;AACxD,SAAS,YAAY;AACrB,SAAS,gBAAgB,eAAe,SAAS,iBAAiB;A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AAAA,YACJ,QAAQ,CAAC,EAAE,OAAO,eAAe,MAC/B,qBAAC,QAAK,GAAE,OAAM,MAAM,CAAC,eAAe,MAAM,GAAG,QAAO,OAAM,YAAW,UACnE;AAAA,kCAAC,wBAAqB,kBAAI;AAAA,cAC1B,oBAAC,wBAAsB,cAAI,cAAc,KAAI;AAAA,eAC/C;AAAA,YAEF,OAAO,OAAO;AAAA,YACd,SAAS;AAAA;AAAA,QACX;AAAA,MAEJ;AACA,aAAO,gCAAE;AAAA,IACX,CAAC;AAAA,EACH,GAAG,CAAC,iBAAiB,gBAAgB,gBAAgB,kBAAkB,CAAC;AAC1E;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { SingleMenuItem, MultiMenuItem, Separator } from '@elliemae/ds-menu-items';\nimport { Section } from '../Section.js';\nimport { ComboBoxContext } from '../../ComboBoxCTX.js';\nimport { StyledCreatableLabel, StyledCreatableValue } from './styled.js';\nimport { isSelected, getSuggestedValueOnChange } from '../../utils/listHelper.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { MENU_OPTION_TYPES, INTERNAL_MENU_OPTION_TYPES } from '../../constants.js';\n\ninterface ItemRendererT {\n extraItemProps?: {\n itemList: DSComboboxT.OptionTypes[];\n };\n index: number;\n}\n\nexport const ItemRenderer = ({ index, extraItemProps }: ItemRendererT): JSX.Element => {\n const {\n props: { onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions, readOnly },\n setMenuState,\n inputValue,\n focusOptionIdx,\n setInputValue,\n optionsPerSection,\n } = useContext(ComboBoxContext);\n\n const option = extraItemProps?.itemList[index];\n\n const multiple = Array.isArray(selectedValues);\n const CBItem = multiple ? MultiMenuItem : SingleMenuItem;\n\n const handleOnCreateClick = useCallback(() => {\n if (inputValue && onCreate) {\n onCreate(inputValue);\n setInputValue('');\n if (onFilter) onFilter(allOptions, inputValue);\n }\n }, [onFilter, onCreate, inputValue, allOptions, setInputValue]);\n\n const handleClick = useCallback(\n (currentOption: DSComboboxT.ItemOption, e: React.MouseEvent) => {\n if (readOnly) return;\n if (currentOption.type === MENU_OPTION_TYPES.OPTION) {\n if (!currentOption.disabled) {\n if (onFilter) onFilter(allOptions, inputValue);\n setInputValue('');\n if (!multiple) {\n setMenuState(false, 'selectOption', e);\n }\n onChange(getSuggestedValueOnChange(currentOption, selectedValues, isNonClearable), currentOption, e);\n }\n }\n // prevent for loosing focus on input control\n e.stopPropagation();\n e.preventDefault();\n },\n [onFilter, selectedValues, allOptions, onChange, setMenuState, multiple],\n );\n\n // prevent blur from controls input\n const handleOnMouseDown = useCallback((e: React.MouseEvent<HTMLLIElement>) => {\n e.preventDefault();\n }, []);\n\n // @ts-expect-error - this needs to be rewritten, this should not be a custom hook returning JSX, this should be a component.\n return useMemo(() => {\n if (option) {\n const { dsId, type, disabled, applyAriaDisabled, readOnly: itemReadOnly, ...rest } = option;\n const generalProps = {\n // 'aria-setsize': `${allOptions.length}`,\n // 'aria-posinset': `${vItem.index + 1}`,\n key: `${dsId}`,\n dsId: dsId.toString(),\n ...rest,\n };\n if (type === MENU_OPTION_TYPES.SECTION) {\n return (\n <Section\n label={option.label}\n {...generalProps}\n // @ts-expect-error - this needs to be rewritten, broken typescript typings?\n options={option.options}\n handleClick={handleClick}\n focusOptionIdx={focusOptionIdx}\n handleOnMouseDown={handleOnMouseDown}\n selectedValues={selectedValues}\n />\n );\n }\n if (type === MENU_OPTION_TYPES.SEPARATOR) {\n return <Separator {...generalProps} render={undefined} />;\n }\n if (option.type === MENU_OPTION_TYPES.OPTION) {\n return (\n // @ts-expect-error - this needs to be rewritten, this should not be a custom hook returning JSX, this should be a component.\n <CBItem\n {...generalProps}\n value={option.value}\n label={option.label}\n dataTestid={ComboboxDataTestid.OPTION}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled || itemReadOnly}\n onClick={(e: React.MouseEvent) => {\n if (applyAriaDisabled) return;\n handleClick(option, e);\n }}\n onMouseDown={handleOnMouseDown}\n isActive={dsId === focusOptionIdx}\n isSelected={isSelected(selectedValues, option)}\n tabIndex={-1}\n />\n );\n }\n if (type === INTERNAL_MENU_OPTION_TYPES.CREATABLE) {\n return (\n <SingleMenuItem\n dataTestid={ComboboxDataTestid.OPTION}\n isActive={dsId === focusOptionIdx}\n {...generalProps}\n render={({ label: labelCreatable }: { label?: string }) => (\n <Grid p=\"8px\" cols={['min-content', 'auto']} gutter=\"xxs\" alignItems=\"center\">\n <StyledCreatableLabel>Add:</StyledCreatableLabel>\n <StyledCreatableValue>{`\"${labelCreatable}\"`}</StyledCreatableValue>\n </Grid>\n )}\n label={option.label}\n onClick={handleOnCreateClick}\n />\n );\n }\n return null;\n }\n return null;\n }, [optionsPerSection, focusOptionIdx, selectedValues, allOptions, onCreate, inputValue, readOnly]);\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACkFb,cA2CI,YA3CJ;AA/EV,SAAgB,SAAS,YAAY,mBAAmB;AACxD,SAAS,YAAY;AACrB,SAAS,gBAAgB,eAAe,iBAAiB;AACzD,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB,4BAA4B;AAC3D,SAAS,YAAY,iCAAiC;AACtD,SAAS,0BAA0B;AAEnC,SAAS,mBAAmB,kCAAkC;AASvD,MAAM,eAAe,CAAC,EAAE,OAAO,eAAe,MAAkC;AACrF,QAAM;AAAA,IACJ,OAAO,EAAE,UAAU,UAAU,gBAAgB,gBAAgB,UAAU,YAAY,SAAS;AAAA,IAC5F;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,SAAS,gBAAgB,SAAS,KAAK;AAE7C,QAAM,WAAW,MAAM,QAAQ,cAAc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;AACA,UAAI,SAAS,kBAAkB,WAAW;AACxC,eAAO,oBAAC,aAAW,GAAG,cAAc,QAAQ,QAAW;AAAA,MACzD;AACA,UAAI,OAAO,SAAS,kBAAkB,QAAQ;AAC5C;AAAA;AAAA,UAEE;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,OAAO,OAAO;AAAA,cACd,OAAO,OAAO;AAAA,cACd,YAAY,mBAAmB;AAAA,cAC/B;AAAA,cACA,mBAAmB,qBAAqB;AAAA,cACxC,SAAS,CAAC,MAAwB;AAChC,oBAAI,kBAAmB;AACvB,4BAAY,QAAQ,CAAC;AAAA,cACvB;AAAA,cACA,aAAa;AAAA,cACb,UAAU,SAAS;AAAA,cACnB,YAAY,WAAW,gBAAgB,MAAM;AAAA,cAC7C,UAAU;AAAA;AAAA,UACZ;AAAA;AAAA,MAEJ;AACA,UAAI,SAAS,2BAA2B,WAAW;AACjD,eACE;AAAA,UAAC;AAAA;AAAA,YACC,YAAY,mBAAmB;AAAA,YAC/B,UAAU,SAAS;AAAA,YAClB,GAAG;AAAA,YACJ,QAAQ,CAAC,EAAE,OAAO,eAAe,MAC/B,qBAAC,QAAK,GAAE,OAAM,MAAM,CAAC,eAAe,MAAM,GAAG,QAAO,OAAM,YAAW,UACnE;AAAA,kCAAC,wBAAqB,kBAAI;AAAA,cAC1B,oBAAC,wBAAsB,cAAI,cAAc,KAAI;AAAA,eAC/C;AAAA,YAEF,OAAO,OAAO;AAAA,YACd,SAAS;AAAA;AAAA,QACX;AAAA,MAEJ;AACA,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT,GAAG,CAAC,mBAAmB,gBAAgB,gBAAgB,YAAY,UAAU,YAAY,QAAQ,CAAC;AACpG;",
6
6
  "names": []
7
7
  }
@@ -8,7 +8,7 @@ import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
8
8
  import { RemovableSelectedValuePill } from "./RemovableSelectedValuePill.js";
9
9
  const MultiSelectedValuesContainer = () => {
10
10
  const {
11
- props: { selectedValues, disabled, applyAriaDisabled: applyAriaDisabledToContainer },
11
+ props: { selectedValues, disabled, applyAriaDisabled: applyAriaDisabledToContainer, readOnly },
12
12
  pillGroupRef
13
13
  } = useContext(ComboBoxContext);
14
14
  const multiSelectedValue = selectedValues;
@@ -20,7 +20,14 @@ const MultiSelectedValuesContainer = () => {
20
20
  style: { width: multiSelectedValue.length > 0 ? "max-content" : "0px" },
21
21
  "data-testid": ComboboxDataTestid.SELECTED_VALUES,
22
22
  children: /* @__PURE__ */ jsxs(DSPillGroupV2, { innerRef: pillGroupRef, children: [
23
- multiSelectedValue.length > 0 && multiSelectedValue.slice(0, correctPillsToShow).map((pill) => /* @__PURE__ */ jsx(RemovableSelectedValuePill, { pill }, pill.dsId)),
23
+ multiSelectedValue.length > 0 && multiSelectedValue.slice(0, correctPillsToShow).map((pill, idx) => /* @__PURE__ */ jsx(
24
+ RemovableSelectedValuePill,
25
+ {
26
+ pill,
27
+ trailingComma: (disabled || applyAriaDisabledToContainer || readOnly) && idx + 1 < correctPillsToShow || multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length
28
+ },
29
+ pill.dsId
30
+ )),
24
31
  multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && /* @__PURE__ */ jsx(
25
32
  DSPillV2,
26
33
  {
@@ -29,14 +36,15 @@ const MultiSelectedValuesContainer = () => {
29
36
  label: `+${multiSelectedValue.length - correctPillsToShow}`,
30
37
  type: "value",
31
38
  disabled,
32
- applyAriaDisabled: applyAriaDisabledToContainer
39
+ applyAriaDisabled: applyAriaDisabledToContainer,
40
+ readOnly
33
41
  },
34
42
  "grouped"
35
43
  )
36
44
  ] })
37
45
  }
38
46
  ),
39
- [pillGroupRef, multiSelectedValue, correctPillsToShow, disabled, applyAriaDisabledToContainer]
47
+ [pillGroupRef, multiSelectedValue, correctPillsToShow, disabled, applyAriaDisabledToContainer, readOnly]
40
48
  );
41
49
  };
42
50
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/multi-selected-values-container/MultiSelectedValuesContainer.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useContext } from 'react';\nimport { DSPillGroupV2, DSPillV2 } from '@elliemae/ds-pills-v2';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { useGroupPills } from './useGroupPills.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { RemovableSelectedValuePill } from './RemovableSelectedValuePill.js';\nexport const MultiSelectedValuesContainer = (): JSX.Element => {\n const {\n props: { selectedValues, disabled, applyAriaDisabled: applyAriaDisabledToContainer },\n pillGroupRef,\n } = useContext(ComboBoxContext);\n\n // this is always an array because logic in controls component\n const multiSelectedValue = selectedValues as DSComboboxT.ItemOption[];\n const correctPillsToShow = useGroupPills();\n\n return useMemo(\n () => (\n <div\n style={{ width: multiSelectedValue.length > 0 ? 'max-content' : '0px' }}\n data-testid={ComboboxDataTestid.SELECTED_VALUES}\n >\n <DSPillGroupV2 innerRef={pillGroupRef}>\n {multiSelectedValue.length > 0 &&\n multiSelectedValue\n .slice(0, correctPillsToShow)\n .map((pill) => <RemovableSelectedValuePill key={pill.dsId} pill={pill} />)}\n {multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && (\n <DSPillV2\n size=\"s\"\n labelTruncated={false}\n key=\"grouped\"\n label={`+${multiSelectedValue.length - correctPillsToShow}`}\n type=\"value\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabledToContainer}\n />\n )}\n </DSPillGroupV2>\n </div>\n ),\n\n [pillGroupRef, multiSelectedValue, correctPillsToShow, disabled, applyAriaDisabledToContainer],\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACuBf,SAIqB,KAJrB;AAvBR,SAAgB,SAAS,kBAAkB;AAC3C,SAAS,eAAe,gBAAgB;AACxC,OAAO,qBAAqB;AAC5B,SAAS,qBAAqB;AAE9B,SAAS,0BAA0B;AACnC,SAAS,kCAAkC;AACpC,MAAM,+BAA+B,MAAmB;AAC7D,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,UAAU,mBAAmB,6BAA6B;AAAA,IACnF;AAAA,EACF,IAAI,WAAW,eAAe;AAG9B,QAAM,qBAAqB;AAC3B,QAAM,qBAAqB,cAAc;AAEzC,SAAO;AAAA,IACL,MACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,OAAO,mBAAmB,SAAS,IAAI,gBAAgB,MAAM;AAAA,QACtE,eAAa,mBAAmB;AAAA,QAEhC,+BAAC,iBAAc,UAAU,cACtB;AAAA,6BAAmB,SAAS,KAC3B,mBACG,MAAM,GAAG,kBAAkB,EAC3B,IAAI,CAAC,SAAS,oBAAC,8BAA2C,QAAX,KAAK,IAAkB,CAAE;AAAA,UAC5E,mBAAmB,SAAS,KAAK,uBAAuB,mBAAmB,UAC1E;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,gBAAgB;AAAA,cAEhB,OAAO,IAAI,mBAAmB,SAAS,kBAAkB;AAAA,cACzD,MAAK;AAAA,cACL;AAAA,cACA,mBAAmB;AAAA;AAAA,YAJf;AAAA,UAKN;AAAA,WAEJ;AAAA;AAAA,IACF;AAAA,IAGF,CAAC,cAAc,oBAAoB,oBAAoB,UAAU,4BAA4B;AAAA,EAC/F;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useContext } from 'react';\nimport { DSPillGroupV2, DSPillV2 } from '@elliemae/ds-pills-v2';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { useGroupPills } from './useGroupPills.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { RemovableSelectedValuePill } from './RemovableSelectedValuePill.js';\n\nexport const MultiSelectedValuesContainer = (): JSX.Element => {\n const {\n props: { selectedValues, disabled, applyAriaDisabled: applyAriaDisabledToContainer, readOnly },\n pillGroupRef,\n } = useContext(ComboBoxContext);\n\n // this is always an array because logic in controls component\n const multiSelectedValue = selectedValues as DSComboboxT.ItemOption[];\n const correctPillsToShow = useGroupPills();\n\n return useMemo(\n () => (\n <div\n style={{ width: multiSelectedValue.length > 0 ? 'max-content' : '0px' }}\n data-testid={ComboboxDataTestid.SELECTED_VALUES}\n >\n <DSPillGroupV2 innerRef={pillGroupRef}>\n {multiSelectedValue.length > 0 &&\n multiSelectedValue\n .slice(0, correctPillsToShow)\n .map((pill, idx) => (\n <RemovableSelectedValuePill\n key={pill.dsId}\n pill={pill}\n trailingComma={\n ((disabled || applyAriaDisabledToContainer || readOnly) && idx + 1 < correctPillsToShow) ||\n (multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length)\n }\n />\n ))}\n {multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && (\n <DSPillV2\n size=\"s\"\n labelTruncated={false}\n key=\"grouped\"\n label={`+${multiSelectedValue.length - correctPillsToShow}`}\n type=\"value\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabledToContainer}\n readOnly={readOnly}\n />\n )}\n </DSPillGroupV2>\n </div>\n ),\n\n [pillGroupRef, multiSelectedValue, correctPillsToShow, disabled, applyAriaDisabledToContainer, readOnly],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACwBf,SAKQ,KALR;AAxBR,SAAgB,SAAS,kBAAkB;AAC3C,SAAS,eAAe,gBAAgB;AACxC,OAAO,qBAAqB;AAC5B,SAAS,qBAAqB;AAE9B,SAAS,0BAA0B;AACnC,SAAS,kCAAkC;AAEpC,MAAM,+BAA+B,MAAmB;AAC7D,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,UAAU,mBAAmB,8BAA8B,SAAS;AAAA,IAC7F;AAAA,EACF,IAAI,WAAW,eAAe;AAG9B,QAAM,qBAAqB;AAC3B,QAAM,qBAAqB,cAAc;AAEzC,SAAO;AAAA,IACL,MACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,OAAO,mBAAmB,SAAS,IAAI,gBAAgB,MAAM;AAAA,QACtE,eAAa,mBAAmB;AAAA,QAEhC,+BAAC,iBAAc,UAAU,cACtB;AAAA,6BAAmB,SAAS,KAC3B,mBACG,MAAM,GAAG,kBAAkB,EAC3B,IAAI,CAAC,MAAM,QACV;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA,cACA,gBACI,YAAY,gCAAgC,aAAa,MAAM,IAAI,sBACpE,mBAAmB,SAAS,KAAK,uBAAuB,mBAAmB;AAAA;AAAA,YAJzE,KAAK;AAAA,UAMZ,CACD;AAAA,UACJ,mBAAmB,SAAS,KAAK,uBAAuB,mBAAmB,UAC1E;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,gBAAgB;AAAA,cAEhB,OAAO,IAAI,mBAAmB,SAAS,kBAAkB;AAAA,cACzD,MAAK;AAAA,cACL;AAAA,cACA,mBAAmB;AAAA,cACnB;AAAA;AAAA,YALI;AAAA,UAMN;AAAA,WAEJ;AAAA;AAAA,IACF;AAAA,IAGF,CAAC,cAAc,oBAAoB,oBAAoB,UAAU,8BAA8B,QAAQ;AAAA,EACzG;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,25 +1,40 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useContext } from "react";
3
+ import React2, { useContext } from "react";
4
4
  import { DSPillV2 } from "@elliemae/ds-pills-v2";
5
5
  import ComboBoxContext from "../../ComboBoxCTX.js";
6
6
  import { getSuggestedValueOnChange } from "../../utils/listHelper.js";
7
7
  const RemovableSelectedValuePill = (props) => {
8
- const { pill } = props;
8
+ const { pill, trailingComma } = props;
9
9
  const {
10
- props: { onChange, isNonClearable, disabled, selectedValues, applyAriaDisabled: applyAriaDisabledToContainer },
10
+ props: {
11
+ onChange,
12
+ isNonClearable,
13
+ disabled,
14
+ selectedValues,
15
+ applyAriaDisabled: applyAriaDisabledToContainer,
16
+ readOnly
17
+ },
11
18
  internalRef
12
19
  } = useContext(ComboBoxContext);
20
+ const type = React2.useMemo(() => {
21
+ if (disabled || isNonClearable) return "value";
22
+ if (applyAriaDisabledToContainer || readOnly) return "labelOnly";
23
+ return "removable";
24
+ }, [disabled, isNonClearable, applyAriaDisabledToContainer, readOnly]);
13
25
  return /* @__PURE__ */ jsx(
14
26
  DSPillV2,
15
27
  {
16
28
  size: "s",
17
29
  label: pill.label,
18
30
  disabled,
19
- type: disabled || applyAriaDisabledToContainer || isNonClearable ? "value" : "removable",
31
+ type,
20
32
  applyAriaDisabled: applyAriaDisabledToContainer || pill.applyAriaDisabled,
33
+ readOnly,
34
+ trailingComma,
21
35
  tabIndex: -1,
22
36
  onRemove: (e) => {
37
+ if (readOnly) return;
23
38
  e.stopPropagation();
24
39
  onChange(getSuggestedValueOnChange(pill, selectedValues), pill, e);
25
40
  internalRef.current?.focus();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/multi-selected-values-container/RemovableSelectedValuePill.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { DSPillV2 } from '@elliemae/ds-pills-v2';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { getSuggestedValueOnChange } from '../../utils/listHelper.js';\nexport const RemovableSelectedValuePill: React.ComponentType<{\n pill: DSComboboxT.ItemOption;\n applyAriaDisabled?: boolean;\n}> = (props) => {\n const { pill } = props;\n const {\n props: { onChange, isNonClearable, disabled, selectedValues, applyAriaDisabled: applyAriaDisabledToContainer },\n internalRef,\n } = useContext(ComboBoxContext);\n\n return (\n <DSPillV2\n size=\"s\"\n key={pill.value}\n label={pill.label}\n disabled={disabled}\n type={disabled || applyAriaDisabledToContainer || isNonClearable ? 'value' : 'removable'}\n applyAriaDisabled={applyAriaDisabledToContainer || pill.applyAriaDisabled}\n tabIndex={-1}\n onRemove={(e: React.KeyboardEvent | React.MouseEvent) => {\n // preventing the menu to be opened\n e.stopPropagation();\n onChange(getSuggestedValueOnChange(pill, selectedValues), pill, e);\n internalRef.current?.focus();\n }}\n />\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACgBnB;AAhBJ,SAAgB,kBAAkB;AAClC,SAAS,gBAAgB;AACzB,OAAO,qBAAqB;AAE5B,SAAS,iCAAiC;AACnC,MAAM,6BAGR,CAAC,UAAU;AACd,QAAM,EAAE,KAAK,IAAI;AACjB,QAAM;AAAA,IACJ,OAAO,EAAE,UAAU,gBAAgB,UAAU,gBAAgB,mBAAmB,6BAA6B;AAAA,IAC7G;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MAEL,OAAO,KAAK;AAAA,MACZ;AAAA,MACA,MAAM,YAAY,gCAAgC,iBAAiB,UAAU;AAAA,MAC7E,mBAAmB,gCAAgC,KAAK;AAAA,MACxD,UAAU;AAAA,MACV,UAAU,CAAC,MAA8C;AAEvD,UAAE,gBAAgB;AAClB,iBAAS,0BAA0B,MAAM,cAAc,GAAG,MAAM,CAAC;AACjE,oBAAY,SAAS,MAAM;AAAA,MAC7B;AAAA;AAAA,IAXK,KAAK;AAAA,EAYZ;AAEJ;",
6
- "names": []
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { DSPillV2 } from '@elliemae/ds-pills-v2';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport type { DSComboboxT } from '../../react-desc-prop-types.js';\nimport { getSuggestedValueOnChange } from '../../utils/listHelper.js';\n\nexport const RemovableSelectedValuePill: React.ComponentType<{\n pill: DSComboboxT.ItemOption;\n applyAriaDisabled?: boolean;\n trailingComma?: boolean;\n}> = (props) => {\n const { pill, trailingComma } = props;\n const {\n props: {\n onChange,\n isNonClearable,\n disabled,\n selectedValues,\n applyAriaDisabled: applyAriaDisabledToContainer,\n readOnly,\n },\n internalRef,\n } = useContext(ComboBoxContext);\n\n const type = React.useMemo(() => {\n if (disabled || isNonClearable) return 'value';\n if (applyAriaDisabledToContainer || readOnly) return 'labelOnly';\n return 'removable';\n }, [disabled, isNonClearable, applyAriaDisabledToContainer, readOnly]);\n\n return (\n <DSPillV2\n size=\"s\"\n key={pill.value}\n label={pill.label}\n disabled={disabled}\n type={type}\n applyAriaDisabled={applyAriaDisabledToContainer || pill.applyAriaDisabled}\n readOnly={readOnly}\n trailingComma={trailingComma}\n tabIndex={-1}\n onRemove={(e: React.KeyboardEvent | React.MouseEvent) => {\n if (readOnly) return;\n // preventing the menu to be opened\n e.stopPropagation();\n onChange(getSuggestedValueOnChange(pill, selectedValues), pill, e);\n internalRef.current?.focus();\n }}\n />\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC+BnB;AA/BJ,OAAOA,UAAS,kBAAkB;AAClC,SAAS,gBAAgB;AACzB,OAAO,qBAAqB;AAE5B,SAAS,iCAAiC;AAEnC,MAAM,6BAIR,CAAC,UAAU;AACd,QAAM,EAAE,MAAM,cAAc,IAAI;AAChC,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB;AAAA,MACnB;AAAA,IACF;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,OAAOA,OAAM,QAAQ,MAAM;AAC/B,QAAI,YAAY,eAAgB,QAAO;AACvC,QAAI,gCAAgC,SAAU,QAAO;AACrD,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,gBAAgB,8BAA8B,QAAQ,CAAC;AAErE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MAEL,OAAO,KAAK;AAAA,MACZ;AAAA,MACA;AAAA,MACA,mBAAmB,gCAAgC,KAAK;AAAA,MACxD;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,UAAU,CAAC,MAA8C;AACvD,YAAI,SAAU;AAEd,UAAE,gBAAgB;AAClB,iBAAS,0BAA0B,MAAM,cAAc,GAAG,MAAM,CAAC;AACjE,oBAAY,SAAS,MAAM;AAAA,MAC7B;AAAA;AAAA,IAdK,KAAK;AAAA,EAeZ;AAEJ;",
6
+ "names": ["React"]
7
7
  }
@@ -32,7 +32,10 @@ const ComboboxPropTypes = {
32
32
  isSkeleton: PropTypes.bool.description("whether or not the component is in skeleton state").defaultValue(false),
33
33
  applyAriaDisabled: PropTypes.bool.description(
34
34
  "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION."
35
- ).defaultValue(false)
35
+ ).defaultValue(false),
36
+ readOnly: PropTypes.bool.description("Makes the component non-editable while remaining accessible.").defaultValue(false),
37
+ onSelectAll: PropTypes.func.description("function triggered when user select all the options").defaultValue("() => {}").deprecated({ version: "25.2" }),
38
+ popperProps: PropTypes.object.description("props to be passed to the FloatingWrapper component").defaultValue(void 0)
36
39
  };
37
40
  export {
38
41
  ComboboxPropTypes,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-unused-vars */\nimport type React from 'react';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { globalAttributesPropTypes, PropTypes } from '@elliemae/ds-props-helpers';\nimport type { DSMaskT } from '@elliemae/ds-form-helpers-mask-hooks';\nimport type { SizingProps } from '@elliemae/ds-system';\nimport type { DSPopperJST } from '@elliemae/ds-popperjs';\n\nexport function noop<T extends unknown[]>(..._args: T): void {}\n\nexport declare namespace DSComboboxT {\n export interface CommonItemOptions extends GlobalAttributesT {\n dsId: string;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n render?: React.ComponentType<unknown>;\n }\n export interface ItemSeparatorOptions extends CommonItemOptions {\n type: 'separator';\n }\n\n export interface ItemSectionOptions extends CommonItemOptions {\n type: 'section';\n label: string;\n }\n\n export interface ItemOption extends CommonItemOptions {\n value: string;\n label: string;\n type: 'option';\n }\n\n export interface ItemCreatableOption extends CommonItemOptions {\n label: string;\n type: 'creatable';\n }\n\n export type OptionTypes = ItemOption | ItemSectionOptions | ItemSeparatorOptions | ItemCreatableOption;\n\n export type SelectedOptionsT = ItemOption[] | ItemOption | null;\n export interface PropsOptional {\n inputMinWidth?: number;\n menuMinWidth?: SizingProps['minWidth'];\n menuMaxHeight?: SizingProps['maxHeight'];\n placeholder?: string;\n autoFocus?: boolean;\n filteredOptions?: OptionTypes[];\n isMenuOpen?: boolean;\n onMenuChange?: (\n state: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => void;\n onCreate?: (label: string) => void;\n onFilter?: (newOptions: OptionTypes[], inputValue?: string) => void;\n onCancel?: () => void;\n onSelectAll?: (suggestedValue: OptionTypes[] | [], event: React.MouseEvent | React.KeyboardEvent) => null;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: ItemOption) => void;\n isLoading?: boolean;\n }\n\n export interface RequiredProps {\n allOptions: OptionTypes[];\n selectedValues: SelectedOptionsT;\n onChange: (\n suggestedValue: SelectedOptionsT,\n selectedOption: ItemOption,\n event: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n }\n export interface DefaultProps {\n startPlacementPreference: DSPopperJST.PopperPlacementsT;\n placementOrderPreference: DSPopperJST.PopperPlacementsT[];\n hasError: boolean;\n inline: boolean;\n withoutPortal: boolean;\n isNonClearable: boolean;\n disabled: boolean;\n noOptionsMessage: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null> | ((ref: HTMLInputElement | null) => void);\n useMask: DSMaskT.Hook | typeof noop;\n onlySelectable: boolean;\n isSkeleton: boolean;\n applyAriaDisabled: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n RequiredProps,\n PropsOptional,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof PropsOptional>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n RequiredProps,\n PropsOptional,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof PropsOptional>,\n XstyledProps {}\n}\n\nexport const ComboboxPropTypes = {\n ...globalAttributesPropTypes,\n placeholder: PropTypes.string.description(\"input's placeholder value\").defaultValue(''),\n allOptions: PropTypes.oneOfType([PropTypes.array, PropTypes.object])\n .isRequired.description('List of original options')\n .defaultValue([]),\n filteredOptions: PropTypes.oneOfType([PropTypes.array, PropTypes.object])\n .description('List of filtered options to show in the menu based on the current internal input filter value')\n .defaultValue([]),\n selectedValues: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]).isRequired.description(\n 'Array of option or single option selected',\n ),\n disabled: PropTypes.bool.description('wheter or not the input is disabled').defaultValue('false'),\n autoFocus: PropTypes.bool.description('Whether the combo box uses auto focus or not').defaultValue('false'),\n hasError: PropTypes.bool.description('Whether the combo box has error or not').defaultValue('false'),\n noOptionsMessage: PropTypes.string\n .description('Custome message to be display when no matches found after filtering')\n .defaultValue('No Matches Found'),\n onChange: PropTypes.func.isRequired\n .description('function triggered when an option is selected it will send the options selected')\n .defaultValue('() => {}'),\n onFilter: PropTypes.func.description('function triggered when user type in the combobox input').defaultValue(''),\n onCreate: PropTypes.func\n .description(\n 'function triggered when user select \"create\" a new item whenever is not a match in the all option list',\n )\n .defaultValue(''),\n onCancel: PropTypes.func.description('function triggered when user press ESC key').defaultValue('() => {}'),\n onMenuChange: PropTypes.func\n .description('function triggered when user open or close the menu list')\n .defaultValue('() => {}'),\n inputMinWidth: PropTypes.any.description('Minimum width for the combo box input controller').defaultValue(undefined),\n menuMinWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),\n menuMaxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),\n withoutPortal: PropTypes.bool\n .description('Whether the combobox menu is rendered in a portal or not')\n .defaultValue(false),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'reference to the component',\n ),\n onlySelectable: PropTypes.bool.description('filtering is disabled'),\n isSkeleton: PropTypes.bool.description('whether or not the component is in skeleton state').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,2BAA2B,iBAAiB;AAK9C,SAAS,QAA6B,OAAgB;AAAC;AA6FvD,MAAM,oBAAoB;AAAA,EAC/B,GAAG;AAAA,EACH,aAAa,UAAU,OAAO,YAAY,2BAA2B,EAAE,aAAa,EAAE;AAAA,EACtF,YAAY,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC,EAChE,WAAW,YAAY,0BAA0B,EACjD,aAAa,CAAC,CAAC;AAAA,EAClB,iBAAiB,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC,EACrE,YAAY,+FAA+F,EAC3G,aAAa,CAAC,CAAC;AAAA,EAClB,gBAAgB,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,GAAG,UAAU,MAAM,CAAC,EAAE,WAAW;AAAA,IACtG;AAAA,EACF;AAAA,EACA,UAAU,UAAU,KAAK,YAAY,qCAAqC,EAAE,aAAa,OAAO;AAAA,EAChG,WAAW,UAAU,KAAK,YAAY,8CAA8C,EAAE,aAAa,OAAO;AAAA,EAC1G,UAAU,UAAU,KAAK,YAAY,wCAAwC,EAAE,aAAa,OAAO;AAAA,EACnG,kBAAkB,UAAU,OACzB,YAAY,qEAAqE,EACjF,aAAa,kBAAkB;AAAA,EAClC,UAAU,UAAU,KAAK,WACtB,YAAY,iFAAiF,EAC7F,aAAa,UAAU;AAAA,EAC1B,UAAU,UAAU,KAAK,YAAY,yDAAyD,EAAE,aAAa,EAAE;AAAA,EAC/G,UAAU,UAAU,KACjB;AAAA,IACC;AAAA,EACF,EACC,aAAa,EAAE;AAAA,EAClB,UAAU,UAAU,KAAK,YAAY,4CAA4C,EAAE,aAAa,UAAU;AAAA,EAC1G,cAAc,UAAU,KACrB,YAAY,0DAA0D,EACtE,aAAa,UAAU;AAAA,EAC1B,eAAe,UAAU,IAAI,YAAY,kDAAkD,EAAE,aAAa,MAAS;AAAA,EACnH,cAAc,UAAU,IAAI,YAAY,qCAAqC,EAAE,aAAa,MAAS;AAAA,EACrG,eAAe,UAAU,IAAI,YAAY,sCAAsC,EAAE,aAAa,MAAS;AAAA,EACvG,eAAe,UAAU,KACtB,YAAY,0DAA0D,EACtE,aAAa,KAAK;AAAA,EACrB,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,EAAE,SAAS,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC3F;AAAA,EACF;AAAA,EACA,gBAAgB,UAAU,KAAK,YAAY,uBAAuB;AAAA,EAClE,YAAY,UAAU,KAAK,YAAY,mDAAmD,EAAE,aAAa,KAAK;AAAA,EAC9G,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-unused-vars */\nimport type React from 'react';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { globalAttributesPropTypes, PropTypes } from '@elliemae/ds-props-helpers';\nimport type { DSFloatingWrapperT } from '@elliemae/ds-floating-context';\nimport type { DSMaskT } from '@elliemae/ds-form-helpers-mask-hooks';\nimport type { SizingProps } from '@elliemae/ds-system';\nimport type { DSPopperJST } from '@elliemae/ds-popperjs';\nimport type { DSFastListT } from '@elliemae/ds-fast-list';\n\nexport function noop<T extends unknown[]>(..._args: T): void {}\n\nexport declare namespace DSComboboxT {\n export interface CommonItemOptions extends GlobalAttributesT {\n dsId: string;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n render?: React.ComponentType<unknown>;\n }\n export interface ItemSeparatorOptions extends CommonItemOptions {\n type: 'separator';\n }\n\n export interface ItemSectionOptions extends CommonItemOptions {\n type: 'section';\n label: string;\n options: OptionTypes[];\n }\n\n export interface ItemOption extends CommonItemOptions {\n value: string;\n label: string;\n type: 'option';\n }\n\n export interface ItemCreatableOption extends CommonItemOptions {\n label: string;\n type: 'creatable';\n }\n\n export type OptionTypes = ItemOption | ItemSectionOptions | ItemSeparatorOptions | ItemCreatableOption;\n\n export type SelectedOptionsT = ItemOption[] | ItemOption | null;\n export interface PropsOptional {\n inputMinWidth?: number;\n menuMinWidth?: SizingProps['minWidth'];\n menuMaxHeight?: SizingProps['maxHeight'];\n placeholder?: string;\n autoFocus?: boolean;\n filteredOptions?: OptionTypes[];\n isMenuOpen?: boolean;\n onMenuChange?: (\n state: boolean,\n reason: string,\n e?: React.KeyboardEvent | React.MouseEvent | React.ChangeEvent<HTMLInputElement>,\n ) => void;\n onCreate?: (label: string) => void;\n onFilter?: (newOptions: OptionTypes[], inputValue?: string) => void;\n onCancel?: () => void;\n onSelectAll?: (suggestedValue: OptionTypes[] | [], event: React.MouseEvent | React.KeyboardEvent) => null;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: ItemOption) => void;\n isLoading?: boolean;\n popperProps?: DSFloatingWrapperT.Props;\n }\n\n export interface RequiredProps {\n allOptions: OptionTypes[];\n selectedValues: SelectedOptionsT;\n onChange: (\n suggestedValue: SelectedOptionsT,\n selectedOption: ItemOption,\n event: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n }\n export interface DefaultProps {\n startPlacementPreference: DSPopperJST.PopperPlacementsT;\n placementOrderPreference: DSPopperJST.PopperPlacementsT[];\n hasError: boolean;\n inline: boolean;\n withoutPortal: boolean;\n isNonClearable: boolean;\n disabled: boolean;\n noOptionsMessage: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null> | ((ref: HTMLInputElement | null) => void);\n useMask: DSMaskT.Hook | typeof noop;\n onlySelectable: boolean;\n isSkeleton: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n RequiredProps,\n PropsOptional,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof PropsOptional>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n RequiredProps,\n PropsOptional,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof PropsOptional>,\n XstyledProps {}\n\n type ActionRefVirtualized = {\n scrollTo: (index: number, opts?: DSFastListT.ScrollToOptions) => void;\n };\n}\n\nexport const ComboboxPropTypes = {\n ...globalAttributesPropTypes,\n placeholder: PropTypes.string.description(\"input's placeholder value\").defaultValue(''),\n allOptions: PropTypes.oneOfType([PropTypes.array, PropTypes.object])\n .isRequired.description('List of original options')\n .defaultValue([]),\n filteredOptions: PropTypes.oneOfType([PropTypes.array, PropTypes.object])\n .description('List of filtered options to show in the menu based on the current internal input filter value')\n .defaultValue([]),\n selectedValues: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]).isRequired.description(\n 'Array of option or single option selected',\n ),\n disabled: PropTypes.bool.description('wheter or not the input is disabled').defaultValue('false'),\n autoFocus: PropTypes.bool.description('Whether the combo box uses auto focus or not').defaultValue('false'),\n hasError: PropTypes.bool.description('Whether the combo box has error or not').defaultValue('false'),\n noOptionsMessage: PropTypes.string\n .description('Custome message to be display when no matches found after filtering')\n .defaultValue('No Matches Found'),\n onChange: PropTypes.func.isRequired\n .description('function triggered when an option is selected it will send the options selected')\n .defaultValue('() => {}'),\n onFilter: PropTypes.func.description('function triggered when user type in the combobox input').defaultValue(''),\n onCreate: PropTypes.func\n .description(\n 'function triggered when user select \"create\" a new item whenever is not a match in the all option list',\n )\n .defaultValue(''),\n onCancel: PropTypes.func.description('function triggered when user press ESC key').defaultValue('() => {}'),\n onMenuChange: PropTypes.func\n .description('function triggered when user open or close the menu list')\n .defaultValue('() => {}'),\n inputMinWidth: PropTypes.any.description('Minimum width for the combo box input controller').defaultValue(undefined),\n menuMinWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),\n menuMaxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),\n withoutPortal: PropTypes.bool\n .description('Whether the combobox menu is rendered in a portal or not')\n .defaultValue(false),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'reference to the component',\n ),\n onlySelectable: PropTypes.bool.description('filtering is disabled'),\n isSkeleton: PropTypes.bool.description('whether or not the component is in skeleton state').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n readOnly: PropTypes.bool\n .description('Makes the component non-editable while remaining accessible.')\n .defaultValue(false),\n onSelectAll: PropTypes.func\n .description('function triggered when user select all the options')\n .defaultValue('() => {}')\n .deprecated({ version: '25.2' }),\n popperProps: PropTypes.object\n .description('props to be passed to the FloatingWrapper component')\n .defaultValue(undefined),\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,2BAA2B,iBAAiB;AAO9C,SAAS,QAA6B,OAAgB;AAAC;AAoGvD,MAAM,oBAAoB;AAAA,EAC/B,GAAG;AAAA,EACH,aAAa,UAAU,OAAO,YAAY,2BAA2B,EAAE,aAAa,EAAE;AAAA,EACtF,YAAY,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC,EAChE,WAAW,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