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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) 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/package.json +4 -1
  4. package/dist/cjs/parts/DropdownIndicator.js +10 -1
  5. package/dist/cjs/parts/DropdownIndicator.js.map +2 -2
  6. package/dist/cjs/parts/Section.js +82 -34
  7. package/dist/cjs/parts/Section.js.map +3 -3
  8. package/dist/cjs/parts/container/Container.js +3 -0
  9. package/dist/cjs/parts/container/Container.js.map +2 -2
  10. package/dist/cjs/parts/controls/Controls.js +5 -0
  11. package/dist/cjs/parts/controls/Controls.js.map +2 -2
  12. package/dist/cjs/parts/controls-input/ControlsInput.js +4 -0
  13. package/dist/cjs/parts/controls-input/ControlsInput.js.map +2 -2
  14. package/dist/cjs/parts/menu-list/LoadingContainer.js +6 -1
  15. package/dist/cjs/parts/menu-list/LoadingContainer.js.map +2 -2
  16. package/dist/cjs/parts/menu-list/MenuList.js +24 -5
  17. package/dist/cjs/parts/menu-list/MenuList.js.map +2 -2
  18. package/dist/cjs/parts/menu-list/SkeletonContainer.js +12 -2
  19. package/dist/cjs/parts/menu-list/SkeletonContainer.js.map +2 -2
  20. package/dist/cjs/parts/menu-list/useItemRenderer.js +27 -5
  21. package/dist/cjs/parts/menu-list/useItemRenderer.js.map +3 -3
  22. package/dist/esm/constants/index.js +23 -0
  23. package/dist/esm/constants/index.js.map +7 -0
  24. package/dist/esm/package.json +4 -1
  25. package/dist/esm/parts/DropdownIndicator.js +10 -1
  26. package/dist/esm/parts/DropdownIndicator.js.map +2 -2
  27. package/dist/esm/parts/Section.js +82 -34
  28. package/dist/esm/parts/Section.js.map +2 -2
  29. package/dist/esm/parts/container/Container.js +4 -1
  30. package/dist/esm/parts/container/Container.js.map +2 -2
  31. package/dist/esm/parts/controls/Controls.js +5 -0
  32. package/dist/esm/parts/controls/Controls.js.map +2 -2
  33. package/dist/esm/parts/controls-input/ControlsInput.js +5 -1
  34. package/dist/esm/parts/controls-input/ControlsInput.js.map +2 -2
  35. package/dist/esm/parts/menu-list/LoadingContainer.js +6 -1
  36. package/dist/esm/parts/menu-list/LoadingContainer.js.map +2 -2
  37. package/dist/esm/parts/menu-list/MenuList.js +24 -5
  38. package/dist/esm/parts/menu-list/MenuList.js.map +2 -2
  39. package/dist/esm/parts/menu-list/SkeletonContainer.js +12 -2
  40. package/dist/esm/parts/menu-list/SkeletonContainer.js.map +2 -2
  41. package/dist/esm/parts/menu-list/useItemRenderer.js +27 -5
  42. package/dist/esm/parts/menu-list/useItemRenderer.js.map +2 -2
  43. package/dist/types/ComboBoxCTX.d.ts +0 -1
  44. package/dist/types/constants/index.d.ts +14 -0
  45. package/dist/types/parts/DropdownIndicator.d.ts +0 -1
  46. package/dist/types/parts/Section.d.ts +4 -0
  47. package/dist/types/parts/container/Container.d.ts +0 -1
  48. package/dist/types/parts/container/styled.d.ts +2 -2
  49. package/dist/types/parts/controls/Controls.d.ts +0 -1
  50. package/dist/types/parts/controls/styled.d.ts +0 -1
  51. package/dist/types/parts/controls-input/ControlsInput.d.ts +0 -1
  52. package/dist/types/parts/controls-input/useControlsInput.d.ts +0 -1
  53. package/dist/types/parts/controls-input/useKeyboardNavigation.d.ts +0 -1
  54. package/dist/types/parts/controls-input/useMaskedOnChange.d.ts +0 -1
  55. package/dist/types/parts/menu-list/LoadingContainer.d.ts +3 -1
  56. package/dist/types/parts/menu-list/MenuList.d.ts +0 -1
  57. package/dist/types/parts/menu-list/SkeletonContainer.d.ts +2 -2
  58. package/dist/types/parts/menu-list/styled.d.ts +0 -1
  59. package/dist/types/parts/menu-list/useItemRenderer.d.ts +1 -2
  60. package/dist/types/parts/multi-selected-values-container/MultiSelectedValuesContainer.d.ts +0 -1
  61. package/dist/types/utils/useOnElementResize.d.ts +1 -1
  62. package/package.json +19 -18
  63. package/dist/cjs/tests/utils.js +0 -133
  64. package/dist/cjs/tests/utils.js.map +0 -7
  65. package/dist/esm/tests/utils.js +0 -103
  66. package/dist/esm/tests/utils.js.map +0 -7
@@ -37,6 +37,7 @@ var import_react = require("react");
37
37
  var import_ds_fast_list = require("@elliemae/ds-fast-list");
38
38
  var import_ds_system = require("@elliemae/ds-system");
39
39
  var import_ds_grid = require("@elliemae/ds-grid");
40
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
40
41
  var import_styled = require("./styled.js");
41
42
  var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
42
43
  var import_ComboBoxCTX = require("../../ComboBoxCTX.js");
@@ -44,12 +45,18 @@ var import_useItemRenderer = require("./useItemRenderer.js");
44
45
  var import_LoadingContainer = require("./LoadingContainer.js");
45
46
  var import_SkeletonContainer = require("./SkeletonContainer.js");
46
47
  var import_useOnElementResize = require("../../utils/useOnElementResize.js");
48
+ var import_constants = require("../../constants/index.js");
49
+ const StyledFastList = (0, import_ds_system.styled)(import_ds_fast_list.DSFastList, {
50
+ name: import_constants.DSFormComboboxName,
51
+ slot: import_constants.FORM_COMBOBOX_SLOTS.FAST_LIST
52
+ })``;
47
53
  const StyledItemsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid)`
48
54
  max-height: ${({ maxHeight }) => maxHeight ? `${String(maxHeight)}px` : "300px"};
49
55
  `;
50
56
  const estimatedSize = () => 32;
51
57
  const MenuList = () => {
52
58
  const {
59
+ props,
53
60
  props: { isLoading, menuMinWidth, noOptionsMessage, menuMaxHeight, onCreate, inline, isSkeleton },
54
61
  controlsWrapperRef,
55
62
  listRef,
@@ -57,16 +64,17 @@ const MenuList = () => {
57
64
  correctOptions: filteredOptions,
58
65
  instanceUid
59
66
  } = (0, import_react.useContext)(import_ComboBoxCTX.ComboBoxContext);
67
+ const { getOwnerProps } = (0, import_ds_props_helpers.useOwnerProps)(props);
60
68
  const { width } = (0, import_useOnElementResize.useOnElementResize)(controlsWrapperRef);
61
69
  const preventLoseInputFocus = (0, import_react.useCallback)((e) => {
62
70
  e.preventDefault();
63
71
  }, []);
64
72
  const menuListRender = (0, import_react.useMemo)(() => {
65
- if (isSkeleton) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SkeletonContainer.SkeletonContainer, { instanceUid });
66
- if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LoadingContainer.LoadingContainer, {});
73
+ if (isSkeleton) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SkeletonContainer.SkeletonContainer, { instanceUid, getOwnerProps });
74
+ if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LoadingContainer.LoadingContainer, { getOwnerProps });
67
75
  if (filteredOptions && filteredOptions.length > 0 || onCreate) {
68
76
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledItemsWrapper, { maxHeight: menuMaxHeight, id: `combo-listbox-${instanceUid}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
- import_ds_fast_list.DSFastList,
77
+ StyledFastList,
70
78
  {
71
79
  dsFastlistWrapperList: { role: "listbox", "data-testid": import_ComboboxDataTestids.ComboboxDataTestid.LIST, "aria-label": "listbox" },
72
80
  dsFastlistItem: { role: "none" },
@@ -75,7 +83,8 @@ const MenuList = () => {
75
83
  ItemRenderer: import_useItemRenderer.ItemRenderer,
76
84
  extraItemProps: { itemList: filteredOptions },
77
85
  getId: (index) => filteredOptions[index].dsId,
78
- estimateSize: estimatedSize
86
+ estimateSize: estimatedSize,
87
+ getOwnerProps
79
88
  }
80
89
  ) });
81
90
  }
@@ -88,7 +97,17 @@ const MenuList = () => {
88
97
  children: noOptionsMessage
89
98
  }
90
99
  );
91
- }, [isSkeleton, instanceUid, isLoading, filteredOptions, onCreate, noOptionsMessage, menuMaxHeight, listRef]);
100
+ }, [
101
+ isSkeleton,
102
+ instanceUid,
103
+ isLoading,
104
+ filteredOptions,
105
+ onCreate,
106
+ noOptionsMessage,
107
+ menuMaxHeight,
108
+ listRef,
109
+ getOwnerProps
110
+ ]);
92
111
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
93
112
  import_styled.StyledListWrapper,
94
113
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/menu-list/MenuList.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmCI;AAnC3B,mBAAwD;AACxD,0BAA2B;AAC3B,uBAAyC;AACzC,qBAAqB;AACrB,oBAA0D;AAC1D,iCAAmC;AACnC,yBAAgC;AAChC,6BAA6B;AAC7B,8BAAiC;AACjC,+BAAkC;AAClC,gCAAmC;AAEnC,MAAM,yBAAqB,yBAAO,mBAAI;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,QAAI,yBAAW,kCAAe;AAI9B,QAAM,EAAE,MAAM,QAAI,8CAAmB,kBAAkB;AACvD,QAAM,4BAAiD,0BAAY,CAAC,MAAM;AACxE,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,QAAM,qBAAiB,sBAAQ,MAAM;AACnC,QAAI,WAAY,QAAO,4CAAC,8CAAkB,aAA0B;AAEpE,QAAI,UAAW,QAAO,4CAAC,4CAAiB;AAExC,QAAK,mBAAmB,gBAAgB,SAAS,KAAM,UAAU;AAC/D,aACE,4CAAC,sBAAmB,WAAW,eAAe,IAAI,iBAAiB,WAAW,IAC5E;AAAA,QAAC;AAAA;AAAA,UACC,uBAAuB,EAAE,MAAM,WAAW,eAAe,8CAAmB,MAAM,cAAc,UAAU;AAAA,UAC1G,gBAAgB,EAAE,MAAM,OAAO;AAAA,UAC/B,WAAW;AAAA,UACX,OAAO,gBAAgB;AAAA,UACvB,cAAc;AAAA,UACd,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,8CAAmB;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 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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD8CI;AA9C3B,mBAAwD;AACxD,0BAA2B;AAC3B,uBAAyC;AACzC,qBAAqB;AACrB,8BAA8B;AAC9B,oBAA0D;AAC1D,iCAAmC;AACnC,yBAAgC;AAChC,6BAA6B;AAC7B,8BAAiC;AACjC,+BAAkC;AAClC,gCAAmC;AACnC,uBAAwD;AAExD,MAAM,qBAAiB,yBAAO,gCAAY;AAAA,EACxC,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAED,MAAM,yBAAqB,yBAAO,mBAAI;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,kBA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A,MACA,aAAa;AAAA,MACb;AAAA,MACA,UAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -35,8 +35,18 @@ var React = __toESM(require("react"));
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_ds_menu_items = require("@elliemae/ds-menu-items");
37
37
  var import_ds_grid = require("@elliemae/ds-grid");
38
- const SkeletonContainer = ({ instanceUid }) => {
38
+ var import_ds_system = require("@elliemae/ds-system");
39
+ var import_constants = require("../../constants/index.js");
40
+ const StyledSkeletonMenuItem = (0, import_ds_system.styled)(import_ds_menu_items.SkeletonMenuItem, {
41
+ name: import_constants.DSFormComboboxName,
42
+ slot: import_constants.FORM_COMBOBOX_SLOTS.SKELETON_MENU_ITEM,
43
+ preserveLegacyDataTestId: true
44
+ })``;
45
+ const SkeletonContainer = ({
46
+ instanceUid,
47
+ getOwnerProps
48
+ }) => {
39
49
  const SKELETON_AMOUNT = [0, 1, 2, 3, 4];
40
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, { id: `combo-listbox-${instanceUid}`, children: SKELETON_AMOUNT.map((n, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_menu_items.SkeletonMenuItem, { dsId: index.toString(), role: "presentation" }, n)) });
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, { id: `combo-listbox-${instanceUid}`, children: SKELETON_AMOUNT.map((n, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledSkeletonMenuItem, { dsId: index.toString(), role: "presentation", getOwnerProps }, n)) });
41
51
  };
42
52
  //# sourceMappingURL=SkeletonContainer.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/menu-list/SkeletonContainer.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADUf;AATR,2BAAiC;AACjC,qBAAqB;AAEd,MAAM,oBAAoB,CAAC,EAAE,YAAY,MAA4C;AAC1F,QAAM,kBAAkB,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AAEtC,SACE,4CAAC,uBAAK,IAAI,iBAAiB,WAAW,IACnC,0BAAgB,IAAI,CAAC,GAAG,UACvB,4CAAC,yCAAyB,MAAM,MAAM,SAAS,GAAG,MAAK,kBAAhC,CAA+C,CACvE,GACH;AAEJ;",
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADyBf;AAxBR,2BAAiC;AACjC,qBAAqB;AACrB,uBAAuB;AAEvB,uBAAwD;AAExD,MAAM,6BAAyB,yBAAO,uCAAkB;AAAA,EACtD,MAAM;AAAA,EACN,MAAM,qCAAoB;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,4CAAC,uBAAK,IAAI,iBAAiB,WAAW,IACnC,0BAAgB,IAAI,CAAC,GAAG,UACvB,4CAAC,0BAA+B,MAAM,MAAM,SAAS,GAAG,MAAK,gBAAe,iBAA/C,CAA6E,CAC3G,GACH;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -36,14 +36,23 @@ var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = require("react");
37
37
  var import_ds_grid = require("@elliemae/ds-grid");
38
38
  var import_ds_menu_items = require("@elliemae/ds-menu-items");
39
+ var import_ds_system = require("@elliemae/ds-system");
40
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
39
41
  var import_Section = require("../Section.js");
40
42
  var import_ComboBoxCTX = require("../../ComboBoxCTX.js");
41
43
  var import_styled = require("./styled.js");
42
44
  var import_listHelper = require("../../utils/listHelper.js");
43
45
  var import_ComboboxDataTestids = require("../../ComboboxDataTestids.js");
44
46
  var import_constants = require("../../constants.js");
47
+ var import_constants2 = require("../../constants/index.js");
48
+ const StyledSingleMenuItem = (0, import_ds_system.styled)(import_ds_menu_items.SingleMenuItem, {
49
+ name: import_constants2.DSFormComboboxName,
50
+ slot: import_constants2.FORM_COMBOBOX_SLOTS.SINGLE_MENU_ITEM,
51
+ preserveLegacyDataTestId: true
52
+ })``;
45
53
  const ItemRenderer = ({ index, extraItemProps }) => {
46
54
  const {
55
+ props,
47
56
  props: { onCreate, onChange, isNonClearable, selectedValues, onFilter, allOptions, readOnly },
48
57
  setMenuState,
49
58
  inputValue,
@@ -51,9 +60,16 @@ const ItemRenderer = ({ index, extraItemProps }) => {
51
60
  setInputValue,
52
61
  optionsPerSection
53
62
  } = (0, import_react.useContext)(import_ComboBoxCTX.ComboBoxContext);
54
- const option = extraItemProps?.itemList[index];
63
+ const { getOwnerProps } = (0, import_ds_props_helpers.useOwnerProps)(props);
64
+ const getOwnerPropsArguments = (0, import_react.useCallback)(
65
+ () => ({
66
+ index
67
+ }),
68
+ [index]
69
+ );
70
+ const option = extraItemProps?.itemList?.[index];
55
71
  const multiple = Array.isArray(selectedValues);
56
- const CBItem = multiple ? import_ds_menu_items.MultiMenuItem : import_ds_menu_items.SingleMenuItem;
72
+ const CBItem = multiple ? import_ds_menu_items.MultiMenuItem : StyledSingleMenuItem;
57
73
  const handleOnCreateClick = (0, import_react.useCallback)(() => {
58
74
  if (inputValue && onCreate) {
59
75
  onCreate(inputValue);
@@ -102,7 +118,9 @@ const ItemRenderer = ({ index, extraItemProps }) => {
102
118
  handleClick,
103
119
  focusOptionIdx,
104
120
  handleOnMouseDown,
105
- selectedValues
121
+ selectedValues,
122
+ getOwnerProps,
123
+ getOwnerPropsArguments
106
124
  }
107
125
  );
108
126
  }
@@ -128,15 +146,19 @@ const ItemRenderer = ({ index, extraItemProps }) => {
128
146
  onMouseDown: handleOnMouseDown,
129
147
  isActive: dsId === focusOptionIdx,
130
148
  isSelected: (0, import_listHelper.isSelected)(selectedValues, option),
131
- tabIndex: -1
149
+ tabIndex: -1,
150
+ getOwnerProps,
151
+ getOwnerPropsArguments
132
152
  }
133
153
  )
134
154
  );
135
155
  }
136
156
  if (type === import_constants.INTERNAL_MENU_OPTION_TYPES.CREATABLE) {
137
157
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
- import_ds_menu_items.SingleMenuItem,
158
+ StyledSingleMenuItem,
139
159
  {
160
+ getOwnerProps,
161
+ getOwnerPropsArguments,
140
162
  dataTestid: import_ComboboxDataTestids.ComboboxDataTestid.OPTION,
141
163
  isActive: dsId === focusOptionIdx,
142
164
  ...generalProps,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/menu-list/useItemRenderer.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkFb;AA/EV,mBAAwD;AACxD,qBAAqB;AACrB,2BAAyD;AACzD,qBAAwB;AACxB,yBAAgC;AAChC,oBAA2D;AAC3D,wBAAsD;AACtD,iCAAmC;AAEnC,uBAA8D;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,QAAI,yBAAW,kCAAe;AAE9B,QAAM,SAAS,gBAAgB,SAAS,KAAK;AAE7C,QAAM,WAAW,MAAM,QAAQ,cAAc;AAC7C,QAAM,SAAS,WAAW,qCAAgB;AAE1C,QAAM,0BAAsB,0BAAY,MAAM;AAC5C,QAAI,cAAc,UAAU;AAC1B,eAAS,UAAU;AACnB,oBAAc,EAAE;AA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AQ;AAC5C;AAAA;AAAA,UAEE;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,OAAO,OAAO;AAAA,cACd,OAAO,OAAO;AAAA,cACd,YAAY,8CAAmB;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,gBAAY,8BAAW,gBAAgB,MAAM;AAAA,cAC7C,UAAU;AAAA;AAAA,UACZ;AAAA;AAAA,MAEJ;AACA,UAAI,SAAS,4CAA2B,WAAW;AACjD,eACE;AAAA,UAAC;AAAA;AAAA,YACC,YAAY,8CAAmB;AAAA,YAC/B,UAAU,SAAS;AAAA,YAClB,GAAG;AAAA,YACJ,QAAQ,CAAC,EAAE,OAAO,eAAe,MAC/B,6CAAC,uBAAK,GAAE,OAAM,MAAM,CAAC,eAAe,MAAM,GAAG,QAAO,OAAM,YAAW,UACnE;AAAA,0DAAC,sCAAqB,kBAAI;AAAA,cAC1B,4CAAC,sCAAsB,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
- "names": []
4
+ "sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoGb;AAjGV,mBAAwD;AACxD,qBAAqB;AACrB,2BAAyD;AACzD,uBAAuB;AACvB,8BAA8B;AAC9B,qBAAwB;AACxB,yBAAgC;AAChC,oBAA2D;AAC3D,wBAAsD;AACtD,iCAAmC;AAEnC,uBAA8D;AAC9D,IAAAA,oBAAwD;AASxD,MAAM,2BAAuB,yBAAO,qCAAgB;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,sCAAoB;AAAA,EAC1B,0BAA0B;AAC5B,CAAC;AAEM,MAAM,eAAe,CAAC,EAAE,OAAO,eAAe,MAAkC;AACrF,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,UAAU,UAAU,gBAAgB,gBAAgB,UAAU,YAAY,SAAS;AAAA,IAC5F;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kCAAe;AAE9B,QAAM,EAAE,cAAc,QAAI,uCAAc,KAAK;AAC7C,QAAM,6BAAyB;AAAA,IAC7B,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,KAAK;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
6
+ "names": ["import_constants"]
7
7
  }
@@ -0,0 +1,23 @@
1
+ import * as React from "react";
2
+ import { slotObjectToDataTestIds } from "@elliemae/ds-system";
3
+ const DSFormComboboxName = "DSCombobox";
4
+ const FORM_COMBOBOX_SLOTS = {
5
+ // Same as old container
6
+ ROOT: "root",
7
+ INPUT_WRAPPER: "input-wrapper",
8
+ INPUT: "input",
9
+ DROPDOWN_BUTTON: "dropdown-button",
10
+ FAST_LIST: "fast-list",
11
+ SECTION_WRAPPER: "section-wrapper",
12
+ SECTION_LABEL: "section-label",
13
+ SINGLE_MENU_ITEM: "single-menu-item",
14
+ LOADING_INDICATOR: "loading-indicator",
15
+ SKELETON_MENU_ITEM: "skeleton-menu-item"
16
+ };
17
+ const FORM_COMBOBOX_DATA_TESTID = slotObjectToDataTestIds(DSFormComboboxName, FORM_COMBOBOX_SLOTS);
18
+ export {
19
+ DSFormComboboxName,
20
+ FORM_COMBOBOX_DATA_TESTID,
21
+ FORM_COMBOBOX_SLOTS
22
+ };
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSFormComboboxName = 'DSCombobox';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_SLOTS = {\n // Same as old container\n ROOT: 'root',\n INPUT_WRAPPER: 'input-wrapper',\n INPUT: 'input',\n DROPDOWN_BUTTON: 'dropdown-button',\n FAST_LIST: 'fast-list',\n SECTION_WRAPPER: 'section-wrapper',\n SECTION_LABEL: 'section-label',\n SINGLE_MENU_ITEM: 'single-menu-item',\n LOADING_INDICATOR: 'loading-indicator',\n SKELETON_MENU_ITEM: 'skeleton-menu-item',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const FORM_COMBOBOX_DATA_TESTID = slotObjectToDataTestIds(DSFormComboboxName, FORM_COMBOBOX_SLOTS);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,qBAAqB;AAG3B,MAAM,sBAAsB;AAAA;AAAA,EAEjC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,oBAAoB;AACtB;AAGO,MAAM,4BAA4B,wBAAwB,oBAAoB,mBAAmB;",
6
+ "names": []
7
+ }
@@ -3,5 +3,8 @@
3
3
  "sideEffects": [
4
4
  "*.css",
5
5
  "*.scss"
6
- ]
6
+ ],
7
+ "publishConfig": {
8
+ "access": "public"
9
+ }
7
10
  }
@@ -4,9 +4,14 @@ import { useCallback, useContext } from "react";
4
4
  import { styled } from "@elliemae/ds-system";
5
5
  import { DSButtonV2 } from "@elliemae/ds-button-v2";
6
6
  import { ChevronSmallDown } from "@elliemae/ds-icons";
7
+ import { useOwnerProps } from "@elliemae/ds-props-helpers";
7
8
  import ComboBoxContext from "../ComboBoxCTX.js";
8
9
  import { ComboboxDataTestid } from "../ComboboxDataTestids.js";
9
- const StyledDropDownButton = styled(DSButtonV2)`
10
+ import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "../constants/index.js";
11
+ const StyledDropDownButton = styled(DSButtonV2, {
12
+ name: DSFormComboboxName,
13
+ slot: FORM_COMBOBOX_SLOTS.DROPDOWN_BUTTON
14
+ })`
10
15
  &:focus::after {
11
16
  border: none;
12
17
  }
@@ -22,16 +27,20 @@ const StyledDropDownButton = styled(DSButtonV2)`
22
27
  `;
23
28
  const DropdownIndicator = () => {
24
29
  const {
30
+ props,
25
31
  props: { disabled, applyAriaDisabled, readOnly, isMenuOpenableWithReadOnly },
26
32
  menuState,
27
33
  instanceUid
28
34
  } = useContext(ComboBoxContext);
35
+ const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);
29
36
  const handleOnClick = useCallback((e) => {
30
37
  e.preventDefault();
31
38
  }, []);
32
39
  return /* @__PURE__ */ jsx(
33
40
  StyledDropDownButton,
34
41
  {
42
+ getOwnerProps,
43
+ getOwnerPropsArguments,
35
44
  onClick: handleOnClick,
36
45
  "data-testid": ComboboxDataTestid.DROPDOWN,
37
46
  "aria-controls": `combo-listbox-${instanceUid}`,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DropdownIndicator.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable import/no-cycle */\nimport React, { useCallback, useContext } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport ComboBoxContext from '../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\n\nconst StyledDropDownButton = styled(DSButtonV2)<{ applyAriaDisabled: boolean }>`\n &:focus::after {\n border: none;\n }\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n\n & svg {\n fill: ${({ theme, disabled, readOnly, applyAriaDisabled }) =>\n disabled || readOnly || applyAriaDisabled ? theme.colors.neutral['400'] : theme.colors.brand['600']};\n }\n\n ${({ applyAriaDisabled }) => applyAriaDisabled && `cursor: not-allowed`}\n`;\n\nexport const DropdownIndicator = (): JSX.Element => {\n const {\n props: { disabled, applyAriaDisabled, readOnly, isMenuOpenableWithReadOnly },\n menuState,\n instanceUid,\n } = useContext(ComboBoxContext);\n\n const handleOnClick: (e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void =\n useCallback((e) => {\n e.preventDefault();\n }, []);\n\n return (\n <StyledDropDownButton\n onClick={handleOnClick}\n data-testid={ComboboxDataTestid.DROPDOWN}\n aria-controls={`combo-listbox-${instanceUid}`}\n aria-labelledby=\"combo-label\"\n disabled={disabled}\n aria-disabled={readOnly && !isMenuOpenableWithReadOnly} // button never use readOnly attribute\n aria-expanded={menuState}\n aria-haspopup=\"listbox\"\n aria-hidden\n buttonType=\"icon\"\n tabIndex={-1}\n size=\"s\"\n applyAriaDisabled={applyAriaDisabled}\n >\n <ChevronSmallDown size=\"s\" />\n </StyledDropDownButton>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACqDjB;AAnDN,SAAgB,aAAa,kBAAkB;AAC/C,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,OAAO,qBAAqB;AAC5B,SAAS,0BAA0B;AAEnC,MAAM,uBAAuB,OAAO,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YASlC,CAAC,EAAE,OAAO,UAAU,UAAU,kBAAkB,MACtD,YAAY,YAAY,oBAAoB,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,OAAO,MAAM,KAAK,CAAC;AAAA;AAAA;AAAA,IAGrG,CAAC,EAAE,kBAAkB,MAAM,qBAAqB,qBAAqB;AAAA;AAGlE,MAAM,oBAAoB,MAAmB;AAClD,QAAM;AAAA,IACJ,OAAO,EAAE,UAAU,mBAAmB,UAAU,2BAA2B;AAAA,IAC3E;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,gBACJ,YAAY,CAAC,MAAM;AACjB,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEP,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,eAAa,mBAAmB;AAAA,MAChC,iBAAe,iBAAiB,WAAW;AAAA,MAC3C,mBAAgB;AAAA,MAChB;AAAA,MACA,iBAAe,YAAY,CAAC;AAAA,MAC5B,iBAAe;AAAA,MACf,iBAAc;AAAA,MACd,eAAW;AAAA,MACX,YAAW;AAAA,MACX,UAAU;AAAA,MACV,MAAK;AAAA,MACL;AAAA,MAEA,8BAAC,oBAAiB,MAAK,KAAI;AAAA;AAAA,EAC7B;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable import/no-cycle */\nimport React, { useCallback, useContext } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport ComboBoxContext from '../ComboBoxCTX.js';\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../constants/index.js';\n\nconst StyledDropDownButton = styled(DSButtonV2, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.DROPDOWN_BUTTON,\n})<{ applyAriaDisabled: boolean }>`\n &:focus::after {\n border: none;\n }\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n\n & svg {\n fill: ${({ theme, disabled, readOnly, applyAriaDisabled }) =>\n disabled || readOnly || applyAriaDisabled ? theme.colors.neutral['400'] : theme.colors.brand['600']};\n }\n\n ${({ applyAriaDisabled }) => applyAriaDisabled && `cursor: not-allowed`}\n`;\n\nexport const DropdownIndicator = (): JSX.Element => {\n const {\n props,\n props: { disabled, applyAriaDisabled, readOnly, isMenuOpenableWithReadOnly },\n menuState,\n instanceUid,\n } = useContext(ComboBoxContext);\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const handleOnClick: (e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void =\n useCallback((e) => {\n e.preventDefault();\n }, []);\n\n return (\n <StyledDropDownButton\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n onClick={handleOnClick}\n data-testid={ComboboxDataTestid.DROPDOWN}\n aria-controls={`combo-listbox-${instanceUid}`}\n aria-labelledby=\"combo-label\"\n disabled={disabled}\n aria-disabled={readOnly && !isMenuOpenableWithReadOnly} // button never use readOnly attribute\n aria-expanded={menuState}\n aria-haspopup=\"listbox\"\n aria-hidden\n buttonType=\"icon\"\n tabIndex={-1}\n size=\"s\"\n applyAriaDisabled={applyAriaDisabled}\n >\n <ChevronSmallDown size=\"s\" />\n </StyledDropDownButton>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC+DjB;AA7DN,SAAgB,aAAa,kBAAkB;AAC/C,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,OAAO,qBAAqB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,oBAAoB,2BAA2B;AAExD,MAAM,uBAAuB,OAAO,YAAY;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YASW,CAAC,EAAE,OAAO,UAAU,UAAU,kBAAkB,MACtD,YAAY,YAAY,oBAAoB,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,OAAO,MAAM,KAAK,CAAC;AAAA;AAAA;AAAA,IAGrG,CAAC,EAAE,kBAAkB,MAAM,qBAAqB,qBAAqB;AAAA;AAGlE,MAAM,oBAAoB,MAAmB;AAClD,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,UAAU,mBAAmB,UAAU,2BAA2B;AAAA,IAC3E;AAAA,IACA;AAAA,EACF,IAAI,WAAW,eAAe;AAE9B,QAAM,EAAE,eAAe,uBAAuB,IAAI,cAAc,KAAK;AAErE,QAAM,gBACJ,YAAY,CAAC,MAAM;AACjB,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAEP,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,eAAa,mBAAmB;AAAA,MAChC,iBAAe,iBAAiB,WAAW;AAAA,MAC3C,mBAAgB;AAAA,MAChB;AAAA,MACA,iBAAe,YAAY,CAAC;AAAA,MAC5B,iBAAe;AAAA,MACf,iBAAc;AAAA,MACd,eAAW;AAAA,MACX,YAAW;AAAA,MACX,UAAU;AAAA,MACV,MAAK;AAAA,MACL;AAAA,MAEA,8BAAC,oBAAiB,MAAK,KAAI;AAAA;AAAA,EAC7B;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -7,13 +7,14 @@ import { SingleMenuItem, MultiMenuItem, Separator } from "@elliemae/ds-menu-item
7
7
  import { MENU_OPTION_TYPES } from "../constants.js";
8
8
  import { ComboboxDataTestid } from "../ComboboxDataTestids.js";
9
9
  import { isSelected } from "../utils/listHelper.js";
10
- const StyledSectionWrapper = styled("section")`
10
+ import { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from "../constants/index.js";
11
+ const StyledSectionWrapper = styled("section", { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_WRAPPER })`
11
12
  list-style: none;
12
13
  min-height: 24px;
13
14
  display: grid;
14
15
  align-items: center;
15
16
  `;
16
- const StyledSectionLabel = styled("header")`
17
+ const StyledSectionLabel = styled("header", { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_LABEL })`
17
18
  display: flex;
18
19
  align-items: center;
19
20
  padding: 0px 16px;
@@ -21,40 +22,87 @@ const StyledSectionLabel = styled("header")`
21
22
  font-size: 1rem;
22
23
  color: neutral-500;
23
24
  `;
25
+ const StyledSingleMenuItem = styled(SingleMenuItem, {
26
+ name: DSFormComboboxName,
27
+ slot: FORM_COMBOBOX_SLOTS.SINGLE_MENU_ITEM
28
+ })``;
24
29
  const Section = React2.memo((props) => {
25
- const { label, wrapperStyles, focusOptionIdx, selectedValues, innerRef, handleOnMouseDown, options, handleClick } = props;
30
+ const {
31
+ label,
32
+ wrapperStyles,
33
+ focusOptionIdx,
34
+ selectedValues,
35
+ innerRef,
36
+ handleOnMouseDown,
37
+ options,
38
+ handleClick,
39
+ getOwnerProps,
40
+ getOwnerPropsArguments
41
+ } = props;
26
42
  const id = `${label.replace(/ /g, "")}-section`;
27
- const CBItem = Array.isArray(selectedValues) ? MultiMenuItem : SingleMenuItem;
28
- return /* @__PURE__ */ jsxs(StyledSectionWrapper, { role: "group", "aria-labelledby": id, style: wrapperStyles, innerRef, children: [
29
- /* @__PURE__ */ jsx(StyledSectionLabel, { id, role: "presentation", children: label }),
30
- options?.map((option) => {
31
- const { dsId, type, value, label: optionLabel, readOnly, disabled, applyAriaDisabled, ...rest } = option;
32
- if (type === MENU_OPTION_TYPES.SEPARATOR) {
33
- return /* @__PURE__ */ jsx(Separator, {}, dsId);
34
- }
35
- return /* @__PURE__ */ createElement(
36
- CBItem,
37
- {
38
- value,
39
- label: optionLabel,
40
- dataTestid: ComboboxDataTestid.OPTION,
41
- disabled,
42
- applyAriaDisabled: applyAriaDisabled || readOnly,
43
- onClick: (e) => {
44
- if (applyAriaDisabled) return;
45
- handleClick(option, e);
46
- },
47
- onMouseDown: handleOnMouseDown,
48
- isActive: dsId === focusOptionIdx,
49
- isSelected: isSelected(selectedValues, option),
50
- tabIndex: -1,
51
- ...rest,
52
- key: option.dsId,
53
- dsId: option.dsId
54
- }
55
- );
56
- })
57
- ] });
43
+ const CBItem = Array.isArray(selectedValues) ? MultiMenuItem : StyledSingleMenuItem;
44
+ return /* @__PURE__ */ jsxs(
45
+ StyledSectionWrapper,
46
+ {
47
+ role: "group",
48
+ "aria-labelledby": id,
49
+ style: wrapperStyles,
50
+ innerRef,
51
+ getOwnerProps,
52
+ getOwnerPropsArguments,
53
+ children: [
54
+ /* @__PURE__ */ jsx(
55
+ StyledSectionLabel,
56
+ {
57
+ id,
58
+ role: "presentation",
59
+ getOwnerProps,
60
+ getOwnerPropsArguments,
61
+ children: label
62
+ }
63
+ ),
64
+ options?.map((option) => {
65
+ const {
66
+ dsId,
67
+ type,
68
+ value,
69
+ label: optionLabel,
70
+ readOnly,
71
+ disabled,
72
+ applyAriaDisabled,
73
+ render,
74
+ ...rest
75
+ } = option;
76
+ if (type === MENU_OPTION_TYPES.SEPARATOR) {
77
+ return /* @__PURE__ */ jsx(Separator, {}, dsId);
78
+ }
79
+ return /* @__PURE__ */ createElement(
80
+ CBItem,
81
+ {
82
+ getOwnerProps,
83
+ getOwnerPropsArguments,
84
+ value,
85
+ label: optionLabel,
86
+ dataTestid: ComboboxDataTestid.OPTION,
87
+ disabled,
88
+ applyAriaDisabled: applyAriaDisabled || readOnly,
89
+ onClick: (e) => {
90
+ if (applyAriaDisabled) return;
91
+ handleClick(option, e);
92
+ },
93
+ onMouseDown: handleOnMouseDown,
94
+ isActive: dsId === focusOptionIdx,
95
+ isSelected: isSelected(selectedValues, option),
96
+ tabIndex: -1,
97
+ ...rest,
98
+ key: option.dsId,
99
+ dsId: option.dsId
100
+ }
101
+ );
102
+ })
103
+ ]
104
+ }
105
+ );
58
106
  });
59
107
  export {
60
108
  Section
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Section.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { SingleMenuItem, MultiMenuItem, Separator } from '@elliemae/ds-menu-items';\nimport { MENU_OPTION_TYPES } from '../constants.js';\n\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { isSelected } from '../utils/listHelper.js';\n\ninterface SectionProps {\n label: string;\n wrapperStyles: React.CSSProperties;\n innerRef: (instance: HTMLDivElement | null) => void;\n options: DSComboboxT.ItemOption[] | DSComboboxT.ItemSeparatorOptions[];\n handleClick: (option: DSComboboxT.ItemOption, e: React.MouseEvent<HTMLInputElement>) => void;\n handleOnMouseDown: (e: React.MouseEvent<HTMLLIElement>) => void;\n focusOptionIdx: string;\n selectedValues: DSComboboxT.SelectedOptionsT;\n}\n\nconst StyledSectionWrapper = styled('section')`\n list-style: none;\n min-height: 24px;\n display: grid;\n align-items: center;\n`;\n\nconst StyledSectionLabel = styled('header')`\n display: flex;\n align-items: center;\n padding: 0px 16px;\n min-height: 24px;\n font-size: 1rem;\n color: neutral-500;\n`;\n\nexport const Section = React.memo((props: SectionProps) => {\n const { label, wrapperStyles, focusOptionIdx, selectedValues, innerRef, handleOnMouseDown, options, handleClick } =\n props;\n const id = `${label.replace(/ /g, '')}-section`;\n\n const CBItem = Array.isArray(selectedValues) ? MultiMenuItem : SingleMenuItem;\n\n return (\n <StyledSectionWrapper role=\"group\" aria-labelledby={id} style={wrapperStyles} innerRef={innerRef}>\n <StyledSectionLabel id={id} role=\"presentation\">\n {label}\n </StyledSectionLabel>\n {options?.map((option) => {\n const { dsId, type, value, label: optionLabel, readOnly, disabled, applyAriaDisabled, ...rest } = option;\n\n if (type === MENU_OPTION_TYPES.SEPARATOR) {\n return <Separator key={dsId} />;\n }\n\n return (\n <CBItem\n value={value}\n label={optionLabel}\n dataTestid={ComboboxDataTestid.OPTION}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled || readOnly}\n onClick={(e: React.MouseEvent<HTMLInputElement>) => {\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 {...rest}\n key={option.dsId}\n dsId={option.dsId}\n />\n );\n })}\n </StyledSectionWrapper>\n );\n});\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AC4CnB,SACE,KADF;AAYM;AAxDV,OAAOA,YAAW;AAClB,SAAS,cAAc;AACvB,SAAS,gBAAgB,eAAe,iBAAiB;AACzD,SAAS,yBAAyB;AAElC,SAAS,0BAA0B;AAEnC,SAAS,kBAAkB;AAa3B,MAAM,uBAAuB,OAAO,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAO7C,MAAM,qBAAqB,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASnC,MAAM,UAAUA,OAAM,KAAK,CAAC,UAAwB;AACzD,QAAM,EAAE,OAAO,eAAe,gBAAgB,gBAAgB,UAAU,mBAAmB,SAAS,YAAY,IAC9G;AACF,QAAM,KAAK,GAAG,MAAM,QAAQ,MAAM,EAAE,CAAC;AAErC,QAAM,SAAS,MAAM,QAAQ,cAAc,IAAI,gBAAgB;AAE/D,SACE,qBAAC,wBAAqB,MAAK,SAAQ,mBAAiB,IAAI,OAAO,eAAe,UAC5E;AAAA,wBAAC,sBAAmB,IAAQ,MAAK,gBAC9B,iBACH;AAAA,IACC,SAAS,IAAI,CAAC,WAAW;AACxB,YAAM,EAAE,MAAM,MAAM,OAAO,OAAO,aAAa,UAAU,UAAU,mBAAmB,GAAG,KAAK,IAAI;AAElG,UAAI,SAAS,kBAAkB,WAAW;AACxC,eAAO,oBAAC,eAAe,IAAM;AAAA,MAC/B;AAEA,aACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,OAAO;AAAA,UACP,YAAY,mBAAmB;AAAA,UAC/B;AAAA,UACA,mBAAmB,qBAAqB;AAAA,UACxC,SAAS,CAAC,MAA0C;AAClD,gBAAI,kBAAmB;AACvB,wBAAY,QAAQ,CAAC;AAAA,UACvB;AAAA,UACA,aAAa;AAAA,UACb,UAAU,SAAS;AAAA,UACnB,YAAY,WAAW,gBAAgB,MAAM;AAAA,UAC7C,UAAU;AAAA,UACT,GAAG;AAAA,UACJ,KAAK,OAAO;AAAA,UACZ,MAAM,OAAO;AAAA;AAAA,MACf;AAAA,IAEJ,CAAC;AAAA,KACH;AAEJ,CAAC;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { SingleMenuItem, MultiMenuItem, Separator } from '@elliemae/ds-menu-items';\n\nimport { MENU_OPTION_TYPES } from '../constants.js';\n\nimport { ComboboxDataTestid } from '../ComboboxDataTestids.js';\nimport type { DSComboboxT } from '../react-desc-prop-types.js';\nimport { isSelected } from '../utils/listHelper.js';\nimport { DSFormComboboxName, FORM_COMBOBOX_SLOTS } from '../constants/index.js';\n\ninterface SectionProps {\n label: string;\n wrapperStyles: React.CSSProperties;\n innerRef: (instance: HTMLDivElement | null) => void;\n options: DSComboboxT.ItemOption[] | DSComboboxT.ItemSeparatorOptions[];\n handleClick: (option: DSComboboxT.ItemOption, e: React.MouseEvent<HTMLInputElement>) => void;\n handleOnMouseDown: (e: React.MouseEvent<HTMLLIElement>) => void;\n focusOptionIdx: string;\n selectedValues: DSComboboxT.SelectedOptionsT;\n getOwnerProps: () => object;\n getOwnerPropsArguments?: () => { index: number };\n}\n\nconst StyledSectionWrapper = styled('section', { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_WRAPPER })`\n list-style: none;\n min-height: 24px;\n display: grid;\n align-items: center;\n`;\n\nconst StyledSectionLabel = styled('header', { name: DSFormComboboxName, slot: FORM_COMBOBOX_SLOTS.SECTION_LABEL })`\n display: flex;\n align-items: center;\n padding: 0px 16px;\n min-height: 24px;\n font-size: 1rem;\n color: neutral-500;\n`;\n\nconst StyledSingleMenuItem = styled(SingleMenuItem, {\n name: DSFormComboboxName,\n slot: FORM_COMBOBOX_SLOTS.SINGLE_MENU_ITEM,\n})``;\n\nexport const Section = React.memo((props: SectionProps) => {\n const {\n label,\n wrapperStyles,\n focusOptionIdx,\n selectedValues,\n innerRef,\n handleOnMouseDown,\n options,\n handleClick,\n getOwnerProps,\n getOwnerPropsArguments,\n } = props;\n const id = `${label.replace(/ /g, '')}-section`;\n const CBItem = Array.isArray(selectedValues) ? MultiMenuItem : StyledSingleMenuItem;\n\n return (\n <StyledSectionWrapper\n role=\"group\"\n aria-labelledby={id}\n style={wrapperStyles}\n innerRef={innerRef}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledSectionLabel\n id={id}\n role=\"presentation\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {label}\n </StyledSectionLabel>\n {options?.map((option) => {\n const {\n dsId,\n type,\n value,\n label: optionLabel,\n readOnly,\n disabled,\n applyAriaDisabled,\n render,\n ...rest\n } = option;\n\n if (type === MENU_OPTION_TYPES.SEPARATOR) {\n return <Separator key={dsId} />;\n }\n\n return (\n <CBItem\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n value={value}\n label={optionLabel}\n dataTestid={ComboboxDataTestid.OPTION}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled || readOnly}\n onClick={(e: React.MouseEvent<HTMLInputElement>) => {\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 {...rest}\n key={option.dsId}\n dsId={option.dsId}\n />\n );\n })}\n </StyledSectionWrapper>\n );\n});\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC8DnB,SAQE,KARF;AAkCM;AAhGV,OAAOA,YAAW;AAClB,SAAS,cAAc;AACvB,SAAS,gBAAgB,eAAe,iBAAiB;AAEzD,SAAS,yBAAyB;AAElC,SAAS,0BAA0B;AAEnC,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB,2BAA2B;AAexD,MAAM,uBAAuB,OAAO,WAAW,EAAE,MAAM,oBAAoB,MAAM,oBAAoB,gBAAgB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAOtH,MAAM,qBAAqB,OAAO,UAAU,EAAE,MAAM,oBAAoB,MAAM,oBAAoB,cAAc,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASjH,MAAM,uBAAuB,OAAO,gBAAgB;AAAA,EAClD,MAAM;AAA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,QAEJ,CAAC;AAAA;AAAA;AAAA,EACH;AAEJ,CAAC;",
6
6
  "names": ["React"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import React2, { useCallback, useMemo, useEffect, useContext } from "react";
4
- import { useGetGlobalAttributes, useGetXstyledProps } from "@elliemae/ds-props-helpers";
4
+ import { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from "@elliemae/ds-props-helpers";
5
5
  import { mergeRefs } from "@elliemae/ds-system";
6
6
  import { useFloatingContext, FloatingWrapper } from "@elliemae/ds-floating-context";
7
7
  import ComboBoxContext from "../../ComboBoxCTX.js";
@@ -17,6 +17,7 @@ const Container = () => {
17
17
  const { inline, startPlacementPreference, placementOrderPreference, applyAriaDisabled } = props;
18
18
  const globalAttributes = useGetGlobalAttributes(props);
19
19
  const { zIndex, ...xStyledProps } = useGetXstyledProps(props);
20
+ const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);
20
21
  const correctZIndex = zIndex ? parseInt(zIndex, 10) : void 0;
21
22
  const { className, "data-testid": dataTestId } = globalAttributes;
22
23
  const handleMouseDown = useCallback((e) => {
@@ -63,6 +64,8 @@ const Container = () => {
63
64
  className,
64
65
  applyAriaDisabled,
65
66
  ...xStyledProps,
67
+ getOwnerProps,
68
+ getOwnerPropsArguments,
66
69
  children: [
67
70
  /* @__PURE__ */ jsx(LiveRegion, {}),
68
71
  /* @__PURE__ */ jsx(Controls, {}),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/container/Container.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useCallback, useMemo, useEffect, useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { useFloatingContext, FloatingWrapper, type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { StyledContainer, StyledPopperWrapper } from './styled.js';\nimport { Controls } from '../controls/index.js';\nimport { MenuList } from '../menu-list/index.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { LiveRegion } from '../LiveRegion.js';\nimport { useOnClickOutside } from '../../config/useClickOutside.js';\n\nexport const Container = (): JSX.Element => {\n const [referenceElement, setReferenceElement] = React.useState<HTMLElement | null>(null);\n const { props, internalRef, setMenuState, menuState } = useContext(ComboBoxContext);\n\n const { inline, startPlacementPreference, placementOrderPreference, applyAriaDisabled } = props;\n const globalAttributes = useGetGlobalAttributes(props) as ReturnType<typeof useGetGlobalAttributes> & {\n 'data-testid'?: string;\n };\n const { zIndex, ...xStyledProps } = useGetXstyledProps(props);\n\n const correctZIndex = zIndex ? parseInt(zIndex as string, 10) : undefined;\n // Removing possible collisionable props\n const { className, 'data-testid': dataTestId } = globalAttributes;\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n }, []);\n\n const handleCloseMenu = useCallback(() => {\n setMenuState(false, 'blur');\n if (internalRef?.current) internalRef.current.blur();\n }, [internalRef, setMenuState]);\n\n useEffect(() => {\n const closeMenuOnWindowBlur = () => {\n if (menuState) setMenuState(false, 'blur');\n };\n\n window.addEventListener('blur', closeMenuOnWindowBlur);\n\n return () => {\n window.removeEventListener('blur', closeMenuOnWindowBlur);\n };\n }, [menuState, setMenuState]);\n\n const config = useMemo(\n () => ({\n placement: 'bottom' as DSHookFloatingContextT.PopperPlacementsT,\n withoutAnimation: true,\n startPlacementPreference,\n placementOrderPreference,\n zIndex: correctZIndex,\n customOffset: [0, 5] as [number, number],\n handleCloseMenu,\n portalDOMContainer: document.body,\n externallyControlledIsOpen: menuState,\n }),\n [startPlacementPreference, placementOrderPreference, correctZIndex, handleCloseMenu, menuState],\n );\n\n const { refs, floatingStyles, context } = useFloatingContext(config);\n\n const comboboxRef = mergeRefs(setReferenceElement, refs.setReference);\n\n const hideTooltip = useCallback(() => {\n setMenuState(false, 'blur');\n }, [setMenuState]);\n\n useOnClickOutside(referenceElement, hideTooltip, refs.floating);\n\n return (\n <StyledContainer\n data-testid={dataTestId ?? ComboboxDataTestid.CONTAINER}\n innerRef={comboboxRef}\n className={className}\n applyAriaDisabled={applyAriaDisabled}\n {...xStyledProps}\n >\n <LiveRegion />\n <Controls />\n\n {menuState && inline ? <MenuList /> : null}\n {menuState && !inline && referenceElement ? (\n <FloatingWrapper\n innerRef={refs.setFloating}\n floatingStyles={floatingStyles}\n isOpen={menuState}\n context={context}\n {...props.popperProps}\n >\n <StyledPopperWrapper tabIndex={-1} onMouseDown={handleMouseDown} applyAriaDisabled={applyAriaDisabled}>\n <MenuList />\n </StyledPopperWrapper>\n </FloatingWrapper>\n ) : null}\n </StyledContainer>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACyEnB,SAOE,KAPF;AAxEJ,OAAOA,UAAS,aAAa,SAAS,WAAW,kBAAkB;AACnE,SAAS,wBAAwB,0BAA0B;AAC3D,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB,uBAAoD;AACjF,OAAO,qBAAqB;AAC5B,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,0BAA0B;AACnC,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAE3B,MAAM,YAAY,MAAmB;AAC1C,QAAM,CAAC,kBAAkB,mBAAmB,IAAIA,OAAM,SAA6B,IAAI;AACvF,QAAM,EAAE,OAAO,aAAa,cAAc,UAAU,IAAI,WAAW,eAAe;AAElF,QAAM,EAAE,QAAQ,0BAA0B,0BAA0B,kBAAkB,IAAI;AAC1F,QAAM,mBAAmB,uBAAuB,KAAK;AAGrD,QAAM,EAAE,QAAQ,GAAG,aAAa,IAAI,mBAAmB,KAAK;AAE5D,QAAM,gBAAgB,SAAS,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oBAAC,YAAS;AAAA,QAET,aAAa,SAAS,oBAAC,YAAS,IAAK;AAAA,QACrC,aAAa,CAAC,UAAU,mBACvB;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,KAAK;AAAA,YACf;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,YACC,GAAG,MAAM;AAAA,YAEV,8BAAC,uBAAoB,UAAU,IAAI,aAAa,iBAAiB,mBAC/D,8BAAC,YAAS,GACZ;AAAA;AAAA,QACF,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useCallback, useMemo, useEffect, useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { useFloatingContext, FloatingWrapper, type DSHookFloatingContextT } from '@elliemae/ds-floating-context';\nimport ComboBoxContext from '../../ComboBoxCTX.js';\nimport { StyledContainer, StyledPopperWrapper } from './styled.js';\nimport { Controls } from '../controls/index.js';\nimport { MenuList } from '../menu-list/index.js';\nimport { ComboboxDataTestid } from '../../ComboboxDataTestids.js';\nimport { LiveRegion } from '../LiveRegion.js';\nimport { useOnClickOutside } from '../../config/useClickOutside.js';\n\nexport const Container = (): JSX.Element => {\n const [referenceElement, setReferenceElement] = React.useState<HTMLElement | null>(null);\n const { props, internalRef, setMenuState, menuState } = useContext(ComboBoxContext);\n\n const { inline, startPlacementPreference, placementOrderPreference, applyAriaDisabled } = props;\n const globalAttributes = useGetGlobalAttributes(props) as ReturnType<typeof useGetGlobalAttributes> & {\n 'data-testid'?: string;\n };\n const { zIndex, ...xStyledProps } = useGetXstyledProps(props);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n const correctZIndex = zIndex ? parseInt(zIndex as string, 10) : undefined;\n // Removing possible collisionable props\n const { className, 'data-testid': dataTestId } = globalAttributes;\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n }, []);\n\n const handleCloseMenu = useCallback(() => {\n setMenuState(false, 'blur');\n if (internalRef?.current) internalRef.current.blur();\n }, [internalRef, setMenuState]);\n\n useEffect(() => {\n const closeMenuOnWindowBlur = () => {\n if (menuState) setMenuState(false, 'blur');\n };\n\n window.addEventListener('blur', closeMenuOnWindowBlur);\n\n return () => {\n window.removeEventListener('blur', closeMenuOnWindowBlur);\n };\n }, [menuState, setMenuState]);\n\n const config = useMemo(\n () => ({\n placement: 'bottom' as DSHookFloatingContextT.PopperPlacementsT,\n withoutAnimation: true,\n startPlacementPreference,\n placementOrderPreference,\n zIndex: correctZIndex,\n customOffset: [0, 5] as [number, number],\n handleCloseMenu,\n portalDOMContainer: document.body,\n externallyControlledIsOpen: menuState,\n }),\n [startPlacementPreference, placementOrderPreference, correctZIndex, handleCloseMenu, menuState],\n );\n\n const { refs, floatingStyles, context } = useFloatingContext(config);\n\n const comboboxRef = mergeRefs(setReferenceElement, refs.setReference);\n\n const hideTooltip = useCallback(() => {\n setMenuState(false, 'blur');\n }, [setMenuState]);\n\n useOnClickOutside(referenceElement, hideTooltip, refs.floating);\n\n return (\n <StyledContainer\n data-testid={dataTestId ?? ComboboxDataTestid.CONTAINER}\n innerRef={comboboxRef}\n className={className}\n applyAriaDisabled={applyAriaDisabled}\n {...xStyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <LiveRegion />\n <Controls />\n\n {menuState && inline ? <MenuList /> : null}\n {menuState && !inline && referenceElement ? (\n <FloatingWrapper\n innerRef={refs.setFloating}\n floatingStyles={floatingStyles}\n isOpen={menuState}\n context={context}\n {...props.popperProps}\n >\n <StyledPopperWrapper tabIndex={-1} onMouseDown={handleMouseDown} applyAriaDisabled={applyAriaDisabled}>\n <MenuList />\n </StyledPopperWrapper>\n </FloatingWrapper>\n ) : null}\n </StyledContainer>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC0E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