@elliemae/ds-form-combobox 3.53.1-rc.0 → 3.54.0-beta.1

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 (64) hide show
  1. package/dist/cjs/constants/index.js +53 -0
  2. package/dist/cjs/constants/index.js.map +7 -0
  3. package/dist/cjs/parts/DropdownIndicator.js +10 -1
  4. package/dist/cjs/parts/DropdownIndicator.js.map +2 -2
  5. package/dist/cjs/parts/Section.js +82 -34
  6. package/dist/cjs/parts/Section.js.map +3 -3
  7. package/dist/cjs/parts/container/Container.js +3 -0
  8. package/dist/cjs/parts/container/Container.js.map +2 -2
  9. package/dist/cjs/parts/controls/Controls.js +5 -0
  10. package/dist/cjs/parts/controls/Controls.js.map +2 -2
  11. package/dist/cjs/parts/controls-input/ControlsInput.js +4 -0
  12. package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
  13. package/dist/cjs/parts/menu-list/LoadingContainer.js +6 -1
  14. package/dist/cjs/parts/menu-list/LoadingContainer.js.map +2 -2
  15. package/dist/cjs/parts/menu-list/MenuList.js +24 -5
  16. package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
  17. package/dist/cjs/parts/menu-list/SkeletonContainer.js +12 -2
  18. package/dist/cjs/parts/menu-list/SkeletonContainer.js.map +2 -2
  19. package/dist/cjs/parts/menu-list/useItemRenderer.js +27 -5
  20. package/dist/cjs/parts/menu-list/useItemRenderer.js.map +3 -3
  21. package/dist/esm/constants/index.js +23 -0
  22. package/dist/esm/constants/index.js.map +7 -0
  23. package/dist/esm/parts/DropdownIndicator.js +10 -1
  24. package/dist/esm/parts/DropdownIndicator.js.map +2 -2
  25. package/dist/esm/parts/Section.js +82 -34
  26. package/dist/esm/parts/Section.js.map +2 -2
  27. package/dist/esm/parts/container/Container.js +4 -1
  28. package/dist/esm/parts/container/Container.js.map +2 -2
  29. package/dist/esm/parts/controls/Controls.js +5 -0
  30. package/dist/esm/parts/controls/Controls.js.map +2 -2
  31. package/dist/esm/parts/controls-input/ControlsInput.js +5 -1
  32. package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
  33. package/dist/esm/parts/menu-list/LoadingContainer.js +6 -1
  34. package/dist/esm/parts/menu-list/LoadingContainer.js.map +2 -2
  35. package/dist/esm/parts/menu-list/MenuList.js +24 -5
  36. package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
  37. package/dist/esm/parts/menu-list/SkeletonContainer.js +12 -2
  38. package/dist/esm/parts/menu-list/SkeletonContainer.js.map +2 -2
  39. package/dist/esm/parts/menu-list/useItemRenderer.js +27 -5
  40. package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
  41. package/dist/types/ComboBoxCTX.d.ts +0 -1
  42. package/dist/types/constants/index.d.ts +14 -0
  43. package/dist/types/parts/DropdownIndicator.d.ts +0 -1
  44. package/dist/types/parts/Section.d.ts +4 -0
  45. package/dist/types/parts/container/Container.d.ts +0 -1
  46. package/dist/types/parts/container/styled.d.ts +2 -2
  47. package/dist/types/parts/controls/Controls.d.ts +0 -1
  48. package/dist/types/parts/controls/styled.d.ts +0 -1
  49. package/dist/types/parts/controls-input/ControlsInput.d.ts +0 -1
  50. package/dist/types/parts/controls-input/useControlsInput.d.ts +0 -1
  51. package/dist/types/parts/controls-input/useKeyboardNavigation.d.ts +0 -1
  52. package/dist/types/parts/controls-input/useMaskedOnChange.d.ts +0 -1
  53. package/dist/types/parts/menu-list/LoadingContainer.d.ts +3 -1
  54. package/dist/types/parts/menu-list/MenuList.d.ts +0 -1
  55. package/dist/types/parts/menu-list/SkeletonContainer.d.ts +2 -2
  56. package/dist/types/parts/menu-list/styled.d.ts +0 -1
  57. package/dist/types/parts/menu-list/useItemRenderer.d.ts +1 -2
  58. package/dist/types/parts/multi-selected-values-container/MultiSelectedValuesContainer.d.ts +0 -1
  59. package/dist/types/utils/useOnElementResize.d.ts +1 -1
  60. package/package.json +19 -18
  61. package/dist/cjs/tests/utils.js +0 -133
  62. package/dist/cjs/tests/utils.js.map +0 -7
  63. package/dist/esm/tests/utils.js +0 -103
  64. package/dist/esm/tests/utils.js.map +0 -7
@@ -3,7 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useContext, useMemo } from "react";
4
4
  import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
5
5
  import { mergeRefs } from "@elliemae/ds-system";
6
- import { useGetGlobalAttributes } from "@elliemae/ds-props-helpers";
6
+ import { useGetGlobalAttributes, useOwnerProps } from "@elliemae/ds-props-helpers";
7
7
  import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
8
8
  import {
9
9
  StyledInput,
@@ -19,6 +19,7 @@ import { ComboBoxContext } from "../../ComboBoxCTX.js";
19
19
  import { isArrayOfItems } from "../../utils/listHelper.js";
20
20
  const ControlsInput = () => {
21
21
  const {
22
+ props,
22
23
  props: {
23
24
  autoFocus,
24
25
  inline,
@@ -42,6 +43,7 @@ const ControlsInput = () => {
42
43
  } = useContext(ComboBoxContext);
43
44
  const { onInputKeyDown } = useKeyboardNavigation();
44
45
  const { spanReference, width, spanReferenceText, showPlaceholder, handleOnBlur, handleOnChange, handleOnFocus } = useControlsInput();
46
+ const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);
45
47
  const {
46
48
  tabIndex,
47
49
  id,
@@ -88,6 +90,8 @@ const ControlsInput = () => {
88
90
  /* @__PURE__ */ jsx(
89
91
  StyledInput,
90
92
  {
93
+ getOwnerProps,
94
+ getOwnerPropsArguments,
91
95
  onBlur: handleOnBlur,
92
96
  onFocus: handleOnFocus,
93
97
  readOnly: readOnly || onlySelectable,
@@ -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 readOnly,\n ...restProps\n },\n focusOptionIdx,\n hasFocus,\n internalRef,\n inputValue,\n setInputValue,\n menuState,\n instanceUid,\n } = useContext(ComboBoxContext);\n const { onInputKeyDown } = useKeyboardNavigation();\n const { spanReference, width, spanReferenceText, showPlaceholder, handleOnBlur, handleOnChange, handleOnFocus } =\n useControlsInput();\n\n const {\n tabIndex,\n id,\n 'aria-describedby': ariaDescribedBy,\n ...globalAttrs\n } = useGetGlobalAttributes(restProps, {\n onFocus: handleOnFocus,\n onBlur: handleOnBlur,\n });\n\n const actualAriaDescribedBy = useMemo(() => {\n if (id) {\n return `${ariaDescribedBy ?? ''} ${id}_current_placeholder ${id}_feedback_message ${id}_error_message`;\n }\n return ariaDescribedBy;\n }, [ariaDescribedBy, id]);\n\n const currentPlaceholder = useMemo(() => {\n if (isArrayOfItems(selectedValues)) {\n return `options ${selectedValues.map((item) => item.label).join(', ')} selected. ${readOnly ? 'Read only' : ''}`;\n }\n if (typeof selectedValues?.label === 'string') {\n return `option ${selectedValues.label} selected. ${readOnly ? 'Read only' : ''}`;\n }\n if (readOnly) {\n return `${placeholder}. Read only`;\n }\n return placeholder;\n }, [placeholder, selectedValues, readOnly]);\n\n const activeDescendant = useMemo(() => {\n if (!isLoading && hasFocus && menuState) {\n return focusOptionIdx;\n }\n return undefined;\n }, [focusOptionIdx, hasFocus, isLoading, menuState]);\n\n const handleOnPaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n setInputValue(e.clipboardData.getData('text/plain'));\n internalRef.current?.focus();\n };\n return (\n <StyledInputWrapper>\n <StyledInputWidthReference innerRef={spanReference}>{spanReferenceText}</StyledInputWidthReference>\n {showPlaceholder && (\n <StyledInputPlaceHolder aria-hidden=\"true\">\n <SimpleTruncatedTooltipText value={showPlaceholder}></SimpleTruncatedTooltipText>\n </StyledInputPlaceHolder>\n )}\n\n {/* The purpose of this div is to always have the 'combo-listbox-{uid}' present in the DOM */}\n {/* Fix for PUI-11597 */}\n {menuState === false && !inline ? <StyledHiddenDiv id={`combo-listbox-${instanceUid}`}></StyledHiddenDiv> : null}\n\n {/* The announcement of currentPlaceholder is being overridden by the value of actualAriaDescribedBy */}\n {/* and since this variable is necessary for the annoucement of FormLayoutBlockItem error and feedback */}\n {/* messages, we concatenate the value of actualPlaceholder with that aria description */}\n {/* Fix for PUI-9609 */}\n <StyledHiddenDiv id={`${id}_current_placeholder`}>{currentPlaceholder}</StyledHiddenDiv>\n\n <StyledInput\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n readOnly={readOnly || onlySelectable}\n {...globalAttrs}\n id={id}\n data-testid={ComboboxDataTestid.INPUT}\n autoFocus={autoFocus}\n placeholder={currentPlaceholder}\n aria-activedescendant={activeDescendant}\n aria-expanded={menuState}\n aria-controls={`combo-listbox-${instanceUid}`}\n aria-describedby={actualAriaDescribedBy}\n aria-autocomplete=\"list\"\n role=\"combobox\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n style={{ width }}\n innerRef={mergeRefs(innerRef, internalRef)}\n value={inputValue}\n type=\"text\"\n onKeyDown={onInputKeyDown}\n onChange={handleOnChange}\n tabIndex={tabIndex}\n withoutCaret={onlySelectable}\n autoComplete=\"off\"\n aria-readonly={readOnly}\n />\n {/* This input is used to handle the paste event */}\n <StyleHiddenInput\n type=\"text\"\n name=\"hidden\"\n tabIndex={-1}\n onPaste={handleOnPaste}\n aria-hidden=\"true\"\n isDisabled={disabled || applyAriaDisabled}\n />\n </StyledInputWrapper>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACwFnB,SACE,KADF;AAxFJ,SAAgB,YAAY,eAAe;AAC3C,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;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;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAC9B,QAAM,EAAE,eAAe,IAAI,sBAAsB;AACjD,QAAM,EAAE,eAAe,OAAO,mBAAmB,iBAAiB,cAAc,gBAAgB,cAAc,IAC5G,iBAAiB;AAEnB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,GAAG;AAAA,EACL,IAAI,uBAAuB,WAAW;AAAA,IACpC,SAAS;AAAA,IACT,QAAQ;AAAA,EACV,CAAC;AAED,QAAM,wBAAwB,QAAQ,MAAM;AAC1C,QAAI,IAAI;AACN,aAAO,GAAG,mBAAmB,EAAE,IAAI,EAAE,wBAAwB,EAAE,qBAAqB,EAAE;AAAA,IACxF;AACA,WAA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A,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,QACb,iBAAe;AAAA;AAAA,IACjB;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,UAAU;AAAA,QACV,SAAS;AAAA,QACT,eAAY;AAAA,QACZ,YAAY,YAAY;AAAA;AAAA,IAC1B;AAAA,KACF;AAEJ;",
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, useOwnerProps } 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 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 { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const {\n tabIndex,\n id,\n 'aria-describedby': ariaDescribedBy,\n ...globalAttrs\n } = useGetGlobalAttributes(restProps, {\n onFocus: handleOnFocus,\n onBlur: handleOnBlur,\n });\n\n const actualAriaDescribedBy = useMemo(() => {\n if (id) {\n 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 getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n readOnly={readOnly || onlySelectable}\n {...globalAttrs}\n id={id}\n data-testid={ComboboxDataTestid.INPUT}\n autoFocus={autoFocus}\n placeholder={currentPlaceholder}\n aria-activedescendant={activeDescendant}\n aria-expanded={menuState}\n aria-controls={`combo-listbox-${instanceUid}`}\n aria-describedby={actualAriaDescribedBy}\n aria-autocomplete=\"list\"\n role=\"combobox\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n style={{ width }}\n innerRef={mergeRefs(innerRef, internalRef)}\n value={inputValue}\n type=\"text\"\n onKeyDown={onInputKeyDown}\n onChange={handleOnChange}\n tabIndex={tabIndex}\n withoutCaret={onlySelectable}\n autoComplete=\"off\"\n aria-readonly={readOnly}\n />\n {/* This input is used to handle the paste event */}\n <StyleHiddenInput\n type=\"text\"\n name=\"hidden\"\n tabIndex={-1}\n onPaste={handleOnPaste}\n aria-hidden=\"true\"\n isDisabled={disabled || applyAriaDisabled}\n />\n </StyledInputWrapper>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC2FnB,SACE,KADF;AA3FJ,SAAgB,YAAY,eAAe;AAC3C,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB,qBAAqB;AACtD,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,u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ACL,MAAK;AAAA,QACL,UAAU;AAAA,QACV,SAAS;AAAA,QACT,eAAY;AAAA,QACZ,YAAY,YAAY;AAAA;AAAA,IAC1B;AAAA,KACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -2,12 +2,17 @@ import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { styled } from "@elliemae/ds-system";
4
4
  import { DSCircularIndeterminateIndicator } from "@elliemae/ds-circular-progress-indicator";
5
+ import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "../../constants/index.js";
5
6
  const Wrapper = styled.div`
6
7
  display: flex;
7
8
  justify-content: center;
8
9
  height: 56px;
9
10
  `;
10
- const LoadingContainer = () => /* @__PURE__ */ jsx(Wrapper, { id: "combobox-list", children: /* @__PURE__ */ jsx(DSCircularIndeterminateIndicator, { size: "m" }) });
11
+ const StyledDSCircularIndeterminateIndicator = styled(DSCircularIndeterminateIndicator, {
12
+ name: DSFormComboboxName,
13
+ slot: FORM_COMBOBOX_SLOTS.LOADING_INDICATOR
14
+ })``;
15
+ const LoadingContainer = ({ getOwnerProps }) => /* @__PURE__ */ jsx(Wrapper, { id: "combobox-list", children: /* @__PURE__ */ jsx(StyledDSCircularIndeterminateIndicator, { size: "m", getOwnerProps }) });
11
16
  var LoadingContainer_default = LoadingContainer;
12
17
  export {
13
18
  LoadingContainer,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/menu-list/LoadingContainer.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSCircularIndeterminateIndicator } from '@elliemae/ds-circular-progress-indicator';\n\nconst Wrapper = styled.div`\n display: flex;\n justify-content: center;\n height: 56px;\n`;\n\nconst LoadingContainer = () => (\n <Wrapper id=\"combobox-list\">\n <DSCircularIndeterminateIndicator size=\"m\" />\n </Wrapper>\n);\n\nexport { LoadingContainer };\nexport default LoadingContainer;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACYnB;AAXJ,SAAS,cAAc;AACvB,SAAS,wCAAwC;AAEjD,MAAM,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA;AAMvB,MAAM,mBAAmB,MACvB,oBAAC,WAAQ,IAAG,iBACV,8BAAC,oCAAiC,MAAK,KAAI,GAC7C;AAIF,IAAO,2BAAQ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSCircularIndeterminateIndicator } from '@elliemae/ds-circular-progress-indicator';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\nconst Wrapper = styled.div`\n display: flex;\n justify-content: center;\n height: 56px;\n`;\nconst StyledDSCircularIndeterminateIndicator = styled(DSCircularIndeterminateIndicator, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.LOADING_INDICATOR,\n})``;\n\nconst LoadingContainer = ({ getOwnerProps }: { getOwnerProps: () => object }) => (\n <Wrapper id=\"combobox-list\">\n <StyledDSCircularIndeterminateIndicator size=\"m\" getOwnerProps={getOwnerProps} />\n </Wrapper>\n);\n\nexport { LoadingContainer };\nexport default LoadingContainer;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACiBnB;AAhBJ,SAAS,cAAc;AACvB,SAAS,wCAAwC;AACjD,SAAS,oBAAoB,2BAA2B;AAExD,MAAM,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA;AAKvB,MAAM,yCAAyC,OAAO,kCAAkC;AAAA,EACtF,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAED,MAAM,mBAAmB,CAAC,EAAE,cAAc,MACxC,oBAAC,WAAQ,IAAG,iBACV,8BAAC,0CAAuC,MAAK,KAAI,eAA8B,GACjF;AAIF,IAAO,2BAAQ;",
6
6
  "names": []
7
7
  }
@@ -4,6 +4,7 @@ import { useContext, useMemo, useCallback } from "react";
4
4
  import { DSFastList } from "@elliemae/ds-fast-list";
5
5
  import { styled } from "@elliemae/ds-system";
6
6
  import { Grid } from "@elliemae/ds-grid";
7
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
7
8
  import { StyledListWrapper, StyledNoResultsWrapper } from "./styled.js";
8
9
  import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
9
10
  import { ComboBoxContext } from "../../ComboBoxCTX.js";
@@ -11,12 +12,18 @@ import { ItemRenderer } from "./useItemRenderer.js";
11
12
  import { LoadingContainer } from "./LoadingContainer.js";
12
13
  import { SkeletonContainer } from "./SkeletonContainer.js";
13
14
  import { useOnElementResize } from "../../utils/useOnElementResize.js";
15
+ import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "../../constants/index.js";
16
+ const StyledFastList = styled(DSFastList, {
17
+ name: DSFormComboboxName,
18
+ slot: FORM_COMBOBOX_SLOTS.FAST_LIST
19
+ })``;
14
20
  const StyledItemsWrapper = styled(Grid)`
15
21
  max-height: ${({ maxHeight }) => maxHeight ? `${String(maxHeight)}px` : "300px"};
16
22
  `;
17
23
  const estimatedSize = () => 32;
18
24
  const MenuList = () => {
19
25
  const {
26
+ props,
20
27
  props: { isLoading, menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline, isSkeleton },
21
28
  controlsWrapperRef,
22
29
  listRef,
@@ -24,16 +31,17 @@ const MenuList = () => {
24
31
  correctOptions: filteredOptions,
25
32
  instanceUid
26
33
  } = useContext(ComboBoxContext);
34
+ const { getOwnerProps } = useOwnerProps(props);
27
35
  const { width } = useOnElementResize(controlsWrapperRef);
28
36
  const preventLoseInputFocus = useCallback((e) => {
29
37
  e.preventDefault();
30
38
  }, []);
31
39
  const menuListRender = useMemo(() => {
32
- if (isSkeleton) return /* @__PURE__ */ jsx(SkeletonContainer, { instanceUid });
33
- if (isLoading) return /* @__PURE__ */ jsx(LoadingContainer, {});
40
+ if (isSkeleton) return /* @__PURE__ */ jsx(SkeletonContainer, { instanceUid, getOwnerProps });
41
+ if (isLoading) return /* @__PURE__ */ jsx(LoadingContainer, { getOwnerProps });
34
42
  if (filteredOptions && filteredOptions.length > 0 || onCreate) {
35
43
  return /* @__PURE__ */ jsx(StyledItemsWrapper, { maxHeight: menuMaxHeight, id: `combo-listbox-${instanceUid}`, children: /* @__PURE__ */ jsx(
36
- DSFastList,
44
+ StyledFastList,
37
45
  {
38
46
  dsFastlistWrapperList: { role: "listbox", "data-testid": ComboboxDataTestid.LIST, "aria-label": "listbox" },
39
47
  dsFastlistItem: { role: "none" },
@@ -42,7 +50,8 @@ const MenuList = () => {
42
50
  ItemRenderer,
43
51
  extraItemProps: { itemList: filteredOptions },
44
52
  getId: (index) => filteredOptions[index].dsId,
45
- estimateSize: estimatedSize
53
+ estimateSize: estimatedSize,
54
+ getOwnerProps
46
55
  }
47
56
  ) });
48
57
  }
@@ -55,7 +64,17 @@ const MenuList = () => {
55
64
  children: noOptionsMessage
56
65
  }
57
66
  );
58
- }, [isSkeleton, instanceUid, isLoading, filteredOptions, onCreate, noOptionsMessage, menuMaxHeight, listRef]);
67
+ }, [
68
+ isSkeleton,
69
+ instanceUid,
70
+ isLoading,
71
+ filteredOptions,
72
+ onCreate,
73
+ noOptionsMessage,
74
+ menuMaxHeight,
75
+ listRef,
76
+ getOwnerProps
77
+ ]);
59
78
  return /* @__PURE__ */ jsx(
60
79
  StyledListWrapper,
61
80
  {
@@ -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 } 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;AAC3B,SAA2B,cAAc;AACzC,SAAS,YAAY;AACrB,SAAS,mBAAmB,8BAA8B;AAC1D,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AAEnC,MAAM,qBAAqB,OAAO,IAAI;AAAA,gBACtB,CAAC,EAAE,UAAU,MAAO,YAAY,GAAG,OAAO,SAAS,CAAC,OAAO,OAAQ;AAAA;AAGnF,MAAM,gBAAgB,MAAM;AACrB,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ,OAAO,EAAE,WAAW,cAAc,kBAAkB,eAAe,UAAU,QAAQ,WAAW;AAAA,IAChG;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,EACF,IAAI,WAAW,eAAe;AAI9B,QAAM,EAAE,MAAM,IAAI,mBAAmB,kBAAkB;AACvD,QAAM,wBAAiD,YAAY,CAAC,MAAM;AACxE,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,WAAY,QAAO,oBAAC,qBAAkB,aAA0B;AAEpE,QAAI,UAAW,QAAO,oBAAC,oBAAiB;AAExC,QAAK,mBAAmB,gBAAgB,SAAS,KAAM,UAAU;AAC/D,aACE,oBAAC,sBAAmB,WAAW,eAAe,IAAI,iBAAiB,WAAW,IAC5E;AAAA,QAAC;AAAA;AAAA,UACC,uBAAuB,EAAE,MAAM,WAAW,eAAe,mBAAmB,MAAM,cAAc,UAAU;AAAA,UAC1G,gBAAgB,EAAE,MAAM,OAAO;AAAA,UAC/B,WAAW;AAAA,UACX,OAAO,gBAAgB;AAAA,UACvB;AAAA,UACA,gBAAgB,EAAE,UAAU,gBAAgB;AAAA,UAC5C,OAAO,CAAC,UAAkB,gBAAgB,KAAK,EAAE;AAAA,UACjD,cAAc;AAAA;AAAA,MAChB,GACF;AAAA,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;",
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 { useOwnerProps } from '@elliemae/ds-props-helpers';\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';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\nconst StyledFastList = styled(DSFastList, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.FAST_LIST,\n})``;\n\nconst StyledItemsWrapper = styled(Grid)<{\n maxHeight: SizingProps['maxHeight'];\n}>`\n max-height: ${({ maxHeight }) => (maxHeight ? `${String(maxHeight)}px` : '300px')};\n`;\n\nconst estimatedSize = () => 32;\nexport const MenuList = (): JSX.Element => {\n const {\n props,\n props: { isLoading, menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline, isSkeleton },\n controlsWrapperRef,\n listRef,\n wrapperListRef,\n correctOptions: filteredOptions,\n instanceUid,\n } = useContext(ComboBoxContext);\n const { getOwnerProps } = useOwnerProps(props);\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} getOwnerProps={getOwnerProps} />;\n\n if (isLoading) return <LoadingContainer getOwnerProps={getOwnerProps} />;\n\n if ((filteredOptions && filteredOptions.length > 0) || onCreate) {\n return (\n <StyledItemsWrapper maxHeight={menuMaxHeight} id={`combo-listbox-${instanceUid}`}>\n <StyledFastList\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 getOwnerProps={getOwnerProps}\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 }, [\n isSkeleton,\n instanceUid,\n isLoading,\n filteredOptions,\n onCreate,\n noOptionsMessage,\n menuMaxHeight,\n listRef,\n getOwnerProps,\n ]);\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;AC8CI;AA9C3B,SAAgB,YAAY,SAAS,mBAAmB;AACxD,SAAS,kBAAkB;AAC3B,SAA2B,cAAc;AACzC,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB,8BAA8B;AAC1D,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,oBAAoB,2BAA2B;AAExD,MAAM,iBAAiB,OAAO,YAAY;AAAA,EACxC,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAED,MAAM,qBAAqB,OAAO,IAAI;AAAA,gBAGtB,CAAC,EAAE,UAAU,MAAO,YAAY,GAAG,OAAO,SAAS,CAAC,OAAO,OAAQ;AAAA;AAGnF,MAAM,gBAAgB,MAAM;AACrB,MAAM,WAAW,MAAmB;AACzC,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,WAAW,cAAc,kBAAkB,eAAe,UAAU,QAAQ,WAAW;AAAA,IAChG;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,EACF,IAAI,WAAW,eAAe;AAC9B,QAAM,EAAE,cAAc,IAAI,cAAc,KAAK;AAI7C,QAAM,EAAE,MAAM,IAAI,mBAAmB,kBAAkB;AACvD,QAAM,wBAAiD,YAAY,CAAC,MAAM;AACxE,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,WAAY,QAAO,oBAAC,qBAAkB,aAA0B,eAA8B;AAElG,QAAI,UAAW,QAAO,oBAAC,oBAAiB,eAA8B;AAEtE,QAAK,mBAAmB,gBAAgB,SAAS,KAAM,UAAU;AAC/D,aACE,oBAAC,sBAAmB,WAAW,eAAe,IAAI,iBAAiB,WAAW,IAC5E;AAAA,QAAC;AAAA;AAAA,UACC,uBAAuB,EAAE,MAAM,WAAW,eAAe,mBAAmB,MAAM,cAAc,UAAU;AAAA,UAC1G,gBAAgB,EAAE,MAAM,OAAO;AAAA,UAC/B,WAAW;AAAA,UACX,OAAO,gBAAgB;AAAA,UACvB;AAAA,UACA,gBAAgB,EAAE,UAAU,gBAAgB;AAAA,UAC5C,OAAO,CAAC,UAAkB,gBAAgB,KAAK,EAAE;AAAA,UACjD,cAAc;AAAA,UACd;AAAA;AAAA,MACF,GACF;AAAA,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;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,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
  }
@@ -2,9 +2,19 @@ import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { SkeletonMenuItem } from "@elliemae/ds-menu-items";
4
4
  import { Grid } from "@elliemae/ds-grid";
5
- const SkeletonContainer = ({ instanceUid }) => {
5
+ import { styled } from "@elliemae/ds-system";
6
+ import { FORM_COMBOBOX_SLOTS, DSFormComboboxName } from "../../constants/index.js";
7
+ const StyledSkeletonMenuItem = styled(SkeletonMenuItem, {
8
+ name: DSFormComboboxName,
9
+ slot: FORM_COMBOBOX_SLOTS.SKELETON_MENU_ITEM,
10
+ preserveLegacyDataTestId: true
11
+ })``;
12
+ const SkeletonContainer = ({
13
+ instanceUid,
14
+ getOwnerProps
15
+ }) => {
6
16
  const SKELETON_AMOUNT = [0, 1, 2, 3, 4];
7
- return /* @__PURE__ */ jsx(Grid, { id: `combo-listbox-${instanceUid}`, children: SKELETON_AMOUNT.map((n, index) => /* @__PURE__ */ jsx(SkeletonMenuItem, { dsId: index.toString(), role: "presentation" }, n)) });
17
+ return /* @__PURE__ */ jsx(Grid, { id: `combo-listbox-${instanceUid}`, children: SKELETON_AMOUNT.map((n, index) => /* @__PURE__ */ jsx(StyledSkeletonMenuItem, { dsId: index.toString(), role: "presentation", getOwnerProps }, n)) });
8
18
  };
9
19
  export {
10
20
  SkeletonContainer
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/menu-list/SkeletonContainer.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { SkeletonMenuItem } from '@elliemae/ds-menu-items';\nimport { Grid } from '@elliemae/ds-grid';\n\nexport const SkeletonContainer = ({ instanceUid }: { instanceUid: string }): JSX.Element => {\n const SKELETON_AMOUNT = [0, 1, 2, 3, 4] as const;\n\n return (\n <Grid id={`combo-listbox-${instanceUid}`}>\n {SKELETON_AMOUNT.map((n, index) => (\n <SkeletonMenuItem key={n} dsId={index.toString()} role=\"presentation\" />\n ))}\n </Grid>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACUf;AATR,SAAS,wBAAwB;AACjC,SAAS,YAAY;AAEd,MAAM,oBAAoB,CAAC,EAAE,YAAY,MAA4C;AAC1F,QAAM,kBAAkB,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AAEtC,SACE,oBAAC,QAAK,IAAI,iBAAiB,WAAW,IACnC,0BAAgB,IAAI,CAAC,GAAG,UACvB,oBAAC,oBAAyB,MAAM,MAAM,SAAS,GAAG,MAAK,kBAAhC,CAA+C,CACvE,GACH;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { SkeletonMenuItem } from '@elliemae/ds-menu-items';\nimport { Grid } from '@elliemae/ds-grid';\nimport { styled } from '@elliemae/ds-system';\n\nimport { FORM_COMBOBOX_SLOTS, DSFormComboboxName } from '../../constants/index.js';\n\nconst StyledSkeletonMenuItem = styled(SkeletonMenuItem, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.SKELETON_MENU_ITEM,\n preserveLegacyDataTestId: true,\n})``;\n\nexport const SkeletonContainer = ({\n instanceUid,\n getOwnerProps,\n}: {\n instanceUid: string;\n getOwnerProps: () => object;\n}): JSX.Element => {\n const SKELETON_AMOUNT = [0, 1, 2, 3, 4] as const;\n\n return (\n <Grid id={`combo-listbox-${instanceUid}`}>\n {SKELETON_AMOUNT.map((n, index) => (\n <StyledSkeletonMenuItem key={n} dsId={index.toString()} role=\"presentation\" getOwnerProps={getOwnerProps} />\n ))}\n </Grid>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACyBf;AAxBR,SAAS,wBAAwB;AACjC,SAAS,YAAY;AACrB,SAAS,cAAc;AAEvB,SAAS,qBAAqB,0BAA0B;AAExD,MAAM,yBAAyB,OAAO,kBAAkB;AAAA,EACtD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAAA,EAC1B,0BAA0B;AAC5B,CAAC;AAEM,MAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AACF,MAGmB;AACjB,QAAM,kBAAkB,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AAEtC,SACE,oBAAC,QAAK,IAAI,iBAAiB,WAAW,IACnC,0BAAgB,IAAI,CAAC,GAAG,UACvB,oBAAC,0BAA+B,MAAM,MAAM,SAAS,GAAG,MAAK,gBAAe,iBAA/C,CAA6E,CAC3G,GACH;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -3,14 +3,23 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useMemo, useContext, useCallback } from "react";
4
4
  import { Grid } from "@elliemae/ds-grid";
5
5
  import { SingleMenuItem, MultiMenuItem, Separator } from "@elliemae/ds-menu-items";
6
+ import { styled } from "@elliemae/ds-system";
7
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
6
8
  import { Section } from "../Section.js";
7
9
  import { ComboBoxContext } from "../../ComboBoxCTX.js";
8
10
  import { StyledCreatableLabel, StyledCreatableValue } from "./styled.js";
9
11
  import { isSelected, getSuggestedValueOnChange } from "../../utils/listHelper.js";
10
12
  import { ComboboxDataTestid } from "../../ComboboxDataTestids.js";
11
13
  import { MENU_OPTION_TYPES, INTERNAL_MENU_OPTION_TYPES } from "../../constants.js";
14
+ import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "../../constants/index.js";
15
+ const StyledSingleMenuItem = styled(SingleMenuItem, {
16
+ name: DSFormComboboxName,
17
+ slot: FORM_COMBOBOX_SLOTS.SINGLE_MENU_ITEM,
18
+ preserveLegacyDataTestId: true
19
+ })``;
12
20
  const ItemRenderer = ({ index, extraItemProps }) => {
13
21
  const {
22
+ props,
14
23
  props: { onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions, readOnly },
15
24
  setMenuState,
16
25
  inputValue,
@@ -18,9 +27,16 @@ const ItemRenderer = ({ index, extraItemProps }) => {
18
27
  setInputValue,
19
28
  optionsPerSection
20
29
  } = useContext(ComboBoxContext);
21
- const option = extraItemProps?.itemList[index];
30
+ const { getOwnerProps } = useOwnerProps(props);
31
+ const getOwnerPropsArguments = useCallback(
32
+ () => ({
33
+ index
34
+ }),
35
+ [index]
36
+ );
37
+ const option = extraItemProps?.itemList?.[index];
22
38
  const multiple = Array.isArray(selectedValues);
23
- const CBItem = multiple ? MultiMenuItem : SingleMenuItem;
39
+ const CBItem = multiple ? MultiMenuItem : StyledSingleMenuItem;
24
40
  const handleOnCreateClick = useCallback(() => {
25
41
  if (inputValue && onCreate) {
26
42
  onCreate(inputValue);
@@ -69,7 +85,9 @@ const ItemRenderer = ({ index, extraItemProps }) => {
69
85
  handleClick,
70
86
  focusOptionIdx,
71
87
  handleOnMouseDown,
72
- selectedValues
88
+ selectedValues,
89
+ getOwnerProps,
90
+ getOwnerPropsArguments
73
91
  }
74
92
  );
75
93
  }
@@ -95,15 +113,19 @@ const ItemRenderer = ({ index, extraItemProps }) => {
95
113
  onMouseDown: handleOnMouseDown,
96
114
  isActive: dsId === focusOptionIdx,
97
115
  isSelected: isSelected(selectedValues, option),
98
- tabIndex: -1
116
+ tabIndex: -1,
117
+ getOwnerProps,
118
+ getOwnerPropsArguments
99
119
  }
100
120
  )
101
121
  );
102
122
  }
103
123
  if (type === INTERNAL_MENU_OPTION_TYPES.CREATABLE) {
104
124
  return /* @__PURE__ */ jsx(
105
- SingleMenuItem,
125
+ StyledSingleMenuItem,
106
126
  {
127
+ getOwnerProps,
128
+ getOwnerPropsArguments,
107
129
  dataTestid: ComboboxDataTestid.OPTION,
108
130
  isActive: dsId === focusOptionIdx,
109
131
  ...generalProps,
@@ -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, 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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;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;",
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 { styled } from '@elliemae/ds-system';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\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';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../../constants/index.js';\n\ninterface ItemRendererT {\n extraItemProps?: {\n itemList?: DSComboboxT.OptionTypes[];\n };\n index: number;\n}\n\nconst StyledSingleMenuItem = styled(SingleMenuItem, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.SINGLE_MENU_ITEM,\n preserveLegacyDataTestId: true,\n})``;\n\nexport const ItemRenderer = ({ index, extraItemProps }: ItemRendererT): JSX.Element => {\n const {\n props,\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 { getOwnerProps } = useOwnerProps(props);\n const getOwnerPropsArguments = useCallback(\n () => ({\n index,\n }),\n [index],\n );\n\n const option = extraItemProps?.itemList?.[index];\n\n const multiple = Array.isArray(selectedValues);\n const CBItem = multiple ? MultiMenuItem : StyledSingleMenuItem;\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 getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\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 getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n );\n }\n if (type === INTERNAL_MENU_OPTION_TYPES.CREATABLE) {\n return (\n <StyledSingleMenuItem\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\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;ACoGb,cAiDI,YAjDJ;AAjGV,SAAgB,SAAS,YAAY,mBAAmB;AACxD,SAAS,YAAY;AACrB,SAAS,gBAAgB,eAAe,iBAAiB;AACzD,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS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AA,UACF;AAAA;AAAA,MAEJ;AACA,UAAI,SAAS,2BAA2B,WAAW;AACjD,eACE;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,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
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DSComboboxT } from './react-desc-prop-types.js';
3
2
  import type { DSComboboxInternalsT } from './sharedTypes.js';
4
3
  export declare function noop<T extends unknown[]>(..._args: T): void;
@@ -0,0 +1,14 @@
1
+ export declare const DSFormComboboxName = "DSCombobox";
2
+ export declare const FORM_COMBOBOX_SLOTS: {
3
+ readonly ROOT: "root";
4
+ readonly INPUT_WRAPPER: "input-wrapper";
5
+ readonly INPUT: "input";
6
+ readonly DROPDOWN_BUTTON: "dropdown-button";
7
+ readonly FAST_LIST: "fast-list";
8
+ readonly SECTION_WRAPPER: "section-wrapper";
9
+ readonly SECTION_LABEL: "section-label";
10
+ readonly SINGLE_MENU_ITEM: "single-menu-item";
11
+ readonly LOADING_INDICATOR: "loading-indicator";
12
+ readonly SKELETON_MENU_ITEM: "skeleton-menu-item";
13
+ };
14
+ export declare const FORM_COMBOBOX_DATA_TESTID: Record<string, string>;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const DropdownIndicator: () => JSX.Element;
@@ -9,6 +9,10 @@ interface SectionProps {
9
9
  handleOnMouseDown: (e: React.MouseEvent<HTMLLIElement>) => void;
10
10
  focusOptionIdx: string;
11
11
  selectedValues: DSComboboxT.SelectedOptionsT;
12
+ getOwnerProps: () => object;
13
+ getOwnerPropsArguments?: () => {
14
+ index: number;
15
+ };
12
16
  }
13
17
  export declare const Section: React.MemoExoticComponent<(props: SectionProps) => import("react/jsx-runtime.js").JSX.Element>;
14
18
  export {};
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const Container: () => JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import type { XstyledProps } from '@elliemae/ds-props-helpers';
2
2
  export declare const StyledContainer: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, XstyledProps & {
3
- disabled?: boolean | undefined;
3
+ disabled?: boolean;
4
4
  applyAriaDisabled: boolean;
5
5
  } & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
6
6
  export declare const StyledPopperWrapper: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, {
7
- disabled?: boolean | undefined;
7
+ disabled?: boolean;
8
8
  applyAriaDisabled: boolean;
9
9
  } & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const Controls: () => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface StyledControlsWrapperT {
3
2
  hasError: boolean;
4
3
  inline: boolean;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const ControlsInput: () => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface UseControlsInputT {
3
2
  handleOnBlur: () => void;
4
3
  handleOnChange?: React.ChangeEventHandler<HTMLInputElement>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const useKeyboardNavigation: () => {
3
2
  onInputKeyDown: import("react").KeyboardEventHandler<HTMLInputElement>;
4
3
  };
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const useMaskedOnChange: () => import("react").ChangeEventHandler<HTMLInputElement>;
3
2
  export { useMaskedOnChange };
@@ -1,3 +1,5 @@
1
- declare const LoadingContainer: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const LoadingContainer: ({ getOwnerProps }: {
2
+ getOwnerProps: () => object;
3
+ }) => import("react/jsx-runtime.js").JSX.Element;
2
4
  export { LoadingContainer };
3
5
  export default LoadingContainer;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const MenuList: () => JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
2
- export declare const SkeletonContainer: ({ instanceUid }: {
1
+ export declare const SkeletonContainer: ({ instanceUid, getOwnerProps, }: {
3
2
  instanceUid: string;
3
+ getOwnerProps: () => object;
4
4
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { SizingProps } from '@elliemae/ds-system';
3
2
  interface StyledListWrapperT {
4
3
  minWidth: SizingProps['minWidth'];
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
1
  import type { DSComboboxT } from '../../react-desc-prop-types.js';
3
2
  interface ItemRendererT {
4
3
  extraItemProps?: {
5
- itemList: DSComboboxT.OptionTypes[];
4
+ itemList?: DSComboboxT.OptionTypes[];
6
5
  };
7
6
  index: number;
8
7
  }
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const MultiSelectedValuesContainer: () => JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import type React from 'react';
2
- export declare const useOnElementResize: <T extends HTMLElement>(targetRef: React.RefObject<T>) => Record<'width' | 'height', number>;
2
+ export declare const useOnElementResize: <T extends HTMLElement>(targetRef: React.RefObject<T>) => Record<"width" | "height", number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-form-combobox",
3
- "version": "3.53.1-rc.0",
3
+ "version": "3.54.0-beta.1",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Controlled Form Combobox",
6
6
  "files": [
@@ -38,30 +38,31 @@
38
38
  "dependencies": {
39
39
  "react-virtual": "~2.10.4",
40
40
  "uid": "~2.0.1",
41
- "@elliemae/ds-button-v2": "3.53.1-rc.0",
42
- "@elliemae/ds-circular-progress-indicator": "3.53.1-rc.0",
43
- "@elliemae/ds-fast-list": "3.53.1-rc.0",
44
- "@elliemae/ds-floating-context": "3.53.1-rc.0",
45
- "@elliemae/ds-form-checkbox": "3.53.1-rc.0",
46
- "@elliemae/ds-grid": "3.53.1-rc.0",
47
- "@elliemae/ds-menu-items": "3.53.1-rc.0",
48
- "@elliemae/ds-icons": "3.53.1-rc.0",
49
- "@elliemae/ds-pills-v2": "3.53.1-rc.0",
50
- "@elliemae/ds-system": "3.53.1-rc.0",
51
- "@elliemae/ds-truncated-tooltip-text": "3.53.1-rc.0",
52
- "@elliemae/ds-props-helpers": "3.53.1-rc.0"
41
+ "@elliemae/ds-button-v2": "3.54.0-beta.1",
42
+ "@elliemae/ds-form-checkbox": "3.54.0-beta.1",
43
+ "@elliemae/ds-circular-progress-indicator": "3.54.0-beta.1",
44
+ "@elliemae/ds-fast-list": "3.54.0-beta.1",
45
+ "@elliemae/ds-grid": "3.54.0-beta.1",
46
+ "@elliemae/ds-menu-items": "3.54.0-beta.1",
47
+ "@elliemae/ds-icons": "3.54.0-beta.1",
48
+ "@elliemae/ds-floating-context": "3.54.0-beta.1",
49
+ "@elliemae/ds-props-helpers": "3.54.0-beta.1",
50
+ "@elliemae/ds-system": "3.54.0-beta.1",
51
+ "@elliemae/ds-truncated-tooltip-text": "3.54.0-beta.1",
52
+ "@elliemae/ds-pills-v2": "3.54.0-beta.1"
53
53
  },
54
54
  "devDependencies": {
55
- "@elliemae/pui-cli": "9.0.0-next.63",
56
- "@elliemae/pui-theme": "~2.12.0",
55
+ "@elliemae/pui-cli": "9.0.0-next.65",
56
+ "@elliemae/pui-theme": "~2.13.0",
57
57
  "jest": "~29.7.0",
58
58
  "styled-components": "~5.3.9",
59
59
  "styled-system": "^5.1.5",
60
- "@elliemae/ds-form-helpers-mask-hooks": "3.53.1-rc.0",
61
- "@elliemae/ds-monorepo-devops": "3.53.1-rc.0"
60
+ "@elliemae/ds-form-helpers-mask-hooks": "3.54.0-beta.1",
61
+ "@elliemae/ds-monorepo-devops": "3.54.0-beta.1",
62
+ "@elliemae/ds-test-utils": "3.54.0-beta.1"
62
63
  },
63
64
  "peerDependencies": {
64
- "@elliemae/pui-theme": "~2.12.0",
65
+ "@elliemae/pui-theme": "~2.13.0",
65
66
  "react": "^18.3.1",
66
67
  "react-dom": "^18.3.1",
67
68
  "styled-components": "~5.3.9",