@elliemae/ds-dropdownmenu-v2 3.70.0-next.3 → 3.70.0-next.6

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.
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(DropdownMenuContent_exports);
34
34
  var React = __toESM(require("react"));
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = require("react");
37
- var import_ds_popperjs = require("@elliemae/ds-popperjs");
37
+ var import_ds_floating_context = require("@elliemae/ds-floating-context");
38
38
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
39
39
  var import_DropdownMenuDataTestId = require("../DropdownMenuDataTestId.js");
40
40
  var import_styled = require("../styled.js");
@@ -60,14 +60,42 @@ const DropdownMenuContent = () => {
60
60
  ...globalAttributes
61
61
  } = (0, import_ds_props_helpers.useGetGlobalAttributes)(props);
62
62
  const { minWidth, minHeight, ...restXstyledProps } = (0, import_ds_props_helpers.useGetXstyledProps)(props);
63
- const onClickOutsideHandler = (e) => {
64
- const dropdownListboxes = [
65
- ...document.body.querySelectorAll(`[data-testid="${import_DropdownMenuDataTestId.DropdownMenuDataTestId.MENU_WRAPPER}"]`)
66
- ];
67
- if (dropdownListboxes.every((listbox) => !listbox.contains(e.target))) {
68
- onClickOutside(e);
69
- }
70
- };
63
+ const {
64
+ refs,
65
+ floatingStyles,
66
+ context,
67
+ isOpen: isFloatingOpen
68
+ } = (0, import_ds_floating_context.useFloatingContext)({
69
+ externallyControlledIsOpen: isOpened,
70
+ withoutAnimation: true,
71
+ customOffset,
72
+ placement: startPlacementPreference,
73
+ placementOrderPreference
74
+ });
75
+ (0, import_react.useEffect)(() => {
76
+ if (triggerReferenceElement) refs.setReference(triggerReferenceElement);
77
+ }, [triggerReferenceElement, refs]);
78
+ const floatingEl = refs.floating;
79
+ (0, import_react.useEffect)(() => {
80
+ if (!isOpened || !floatingEl) return () => {
81
+ };
82
+ const listener = (event) => {
83
+ const target = event.target;
84
+ if (!target || floatingEl.contains(target)) return;
85
+ const dropdownListboxes = [
86
+ ...document.body.querySelectorAll(`[data-testid="${import_DropdownMenuDataTestId.DropdownMenuDataTestId.MENU_WRAPPER}"]`)
87
+ ];
88
+ if (dropdownListboxes.every((listbox) => !listbox.contains(target))) {
89
+ onClickOutside(event);
90
+ }
91
+ };
92
+ document.addEventListener("mousedown", listener, true);
93
+ document.addEventListener("touchstart", listener, true);
94
+ return () => {
95
+ document.removeEventListener("mousedown", listener, true);
96
+ document.removeEventListener("touchstart", listener, true);
97
+ };
98
+ }, [isOpened, floatingEl, onClickOutside]);
71
99
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
72
100
  import_styled.StyledTriggerWrapper,
73
101
  {
@@ -81,17 +109,12 @@ const DropdownMenuContent = () => {
81
109
  children: [
82
110
  children,
83
111
  triggerReferenceElement && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
- import_ds_popperjs.DSPopperJS,
112
+ import_ds_floating_context.FloatingWrapper,
85
113
  {
86
- referenceElement: triggerReferenceElement,
87
- showPopover: isOpened,
88
- withoutArrow: true,
89
- withoutAnimation: true,
90
- customOffset,
91
- onClickOutside: onClickOutsideHandler,
92
- startPlacementPreference,
93
- placementOrderPreference,
94
- zIndex,
114
+ innerRef: refs.setFloating,
115
+ isOpen: isFloatingOpen,
116
+ floatingStyles: { ...floatingStyles, ...zIndex !== void 0 && { zIndex } },
117
+ context,
95
118
  "aria-label": dataPopoverLabel || "dropdown-menu popover",
96
119
  children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenuLoading.DropdownMenuLoading, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenuListBox.DropdownMenuListBox, {})
97
120
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/parts/DropdownMenuContent.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable no-unused-vars */\nimport React, { useContext } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { DropdownMenuDataTestId } from '../DropdownMenuDataTestId.js';\nimport { StyledTriggerWrapper } from '../styled.js';\nimport { DropdownMenuListBox } from './DropdownMenuListBox.js';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { DropdownMenuLoading } from './DropdownMenuLoading.js';\n\nexport const DropdownMenuContent: React.ComponentType<Record<string, never>> = () => {\n const { props, triggerReferenceElement, setTriggerReferenceElement } = useContext(DSDropdownMenuContext);\n\n const {\n children,\n isOpened,\n onClickOutside,\n startPlacementPreference,\n placementOrderPreference,\n customOffset,\n wrapperStyles,\n isLoading,\n zIndex,\n as,\n } = props;\n const {\n 'data-popover-label': dataPopoverLabel,\n ...globalAttributes\n }: ReturnType<typeof useGetGlobalAttributes> & { 'data-popover-label'?: string } = useGetGlobalAttributes(props);\n // we need to exclude this props from the xstyled props because there is a conflict\n // using submenus items with the name of the prop of ddmenu and xstyled\n const { minWidth, minHeight, ...restXstyledProps } = useGetXstyledProps(props);\n const onClickOutsideHandler = (e: MouseEvent | TouchEvent) => {\n // We need to find out if the click was originated inside a child's dropdownmenu\n const dropdownListboxes = [\n ...document.body.querySelectorAll(`[data-testid=\"${DropdownMenuDataTestId.MENU_WRAPPER}\"]`),\n ];\n if (dropdownListboxes.every((listbox) => !listbox.contains(e.target as Node))) {\n onClickOutside(e);\n }\n };\n\n return (\n <StyledTriggerWrapper\n data-testid={`${DropdownMenuDataTestId.TRIGGER_WRAPPER}`}\n innerRef={setTriggerReferenceElement}\n aria-haspopup=\"listbox\"\n {...wrapperStyles}\n {...globalAttributes}\n {...restXstyledProps}\n as={as}\n >\n {children}\n {triggerReferenceElement && (\n <DSPopperJS\n referenceElement={triggerReferenceElement}\n showPopover={isOpened}\n withoutArrow\n withoutAnimation\n customOffset={customOffset}\n onClickOutside={onClickOutsideHandler}\n startPlacementPreference={startPlacementPreference}\n placementOrderPreference={placementOrderPreference}\n zIndex={zIndex}\n aria-label={(dataPopoverLabel as string) || 'dropdown-menu popover'}\n >\n {isLoading ? <DropdownMenuLoading /> : <DropdownMenuListBox />}\n </DSPopperJS>\n )}\n </StyledTriggerWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2CnB;AA1CJ,mBAAkC;AAClC,yBAA2B;AAC3B,8BAA2D;AAC3D,oCAAuC;AACvC,oBAAqC;AACrC,iCAAoC;AACpC,iCAAsC;AACtC,iCAAoC;AAE7B,MAAM,sBAAkE,MAAM;AACnF,QAAM,EAAE,OAAO,yBAAyB,2BAA2B,QAAI,yBAAW,gDAAqB;AAEvG,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM;AAAA,IACJ,sBAAsB;AAAA,IACtB,GAAG;AAAA,EACL,QAAmF,gDAAuB,KAAK;AAG/G,QAAM,EAAE,UAAU,WAAW,GAAG,iBAAiB,QAAI,4CAAmB,KAAK;AAC7E,QAAM,wBAAwB,CAAC,MAA+B;AAE5D,UAAM,oBAAoB;AAAA,MACxB,GAAG,SAAS,KAAK,iBAAiB,iBAAiB,qDAAuB,YAAY,IAAI;AAAA,IAC5F;AACA,QAAI,kBAAkB,MAAM,CAAC,YAAY,CAAC,QAAQ,SAAS,EAAE,MAAc,CAAC,GAAG;AAC7E,qBAAe,CAAC;AAAA,IAClB;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,GAAG,qDAAuB,eAAe;AAAA,MACtD,UAAU;AAAA,MACV,iBAAc;AAAA,MACb,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MAEC;AAAA;AAAA,QACA,2BACC;AAAA,UAAC;AAAA;AAAA,YACC,kBAAkB;AAAA,YAClB,aAAa;AAAA,YACb,cAAY;AAAA,YACZ,kBAAgB;AAAA,YAChB;AAAA,YACA,gBAAgB;AAAA,YAChB;AAAA,YACA;AAAA,YACA;AAAA,YACA,cAAa,oBAA+B;AAAA,YAE3C,sBAAY,4CAAC,kDAAoB,IAAK,4CAAC,kDAAoB;AAAA;AAAA,QAC9D;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
4
+ "sourcesContent": ["/* eslint-disable no-unused-vars */\nimport React, { useContext, useEffect } from 'react';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { DropdownMenuDataTestId } from '../DropdownMenuDataTestId.js';\nimport { StyledTriggerWrapper } from '../styled.js';\nimport { DropdownMenuListBox } from './DropdownMenuListBox.js';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { DropdownMenuLoading } from './DropdownMenuLoading.js';\n\nexport const DropdownMenuContent: React.ComponentType<Record<string, never>> = () => {\n const { props, triggerReferenceElement, setTriggerReferenceElement } = useContext(DSDropdownMenuContext);\n\n const {\n children,\n isOpened,\n onClickOutside,\n startPlacementPreference,\n placementOrderPreference,\n customOffset,\n wrapperStyles,\n isLoading,\n zIndex,\n as,\n } = props;\n const {\n 'data-popover-label': dataPopoverLabel,\n ...globalAttributes\n }: ReturnType<typeof useGetGlobalAttributes> & { 'data-popover-label'?: string } = useGetGlobalAttributes(props);\n // we need to exclude this props from the xstyled props because there is a conflict\n // using submenus items with the name of the prop of ddmenu and xstyled\n const { minWidth, minHeight, ...restXstyledProps } = useGetXstyledProps(props);\n\n const {\n refs,\n floatingStyles,\n context,\n isOpen: isFloatingOpen,\n } = useFloatingContext({\n externallyControlledIsOpen: isOpened,\n withoutAnimation: true,\n customOffset,\n placement: startPlacementPreference,\n placementOrderPreference,\n });\n\n useEffect(() => {\n if (triggerReferenceElement) refs.setReference(triggerReferenceElement);\n }, [triggerReferenceElement, refs]);\n\n // Click-outside: close only when the click is not inside any child dropdown listbox\n const floatingEl = refs.floating;\n useEffect(() => {\n if (!isOpened || !floatingEl) return () => {};\n const listener = (event: MouseEvent | TouchEvent) => {\n const target = event.target as Node | null;\n if (!target || floatingEl.contains(target)) return;\n const dropdownListboxes = [\n ...document.body.querySelectorAll(`[data-testid=\"${DropdownMenuDataTestId.MENU_WRAPPER}\"]`),\n ];\n if (dropdownListboxes.every((listbox) => !listbox.contains(target))) {\n onClickOutside(event);\n }\n };\n document.addEventListener('mousedown', listener, true);\n document.addEventListener('touchstart', listener, true);\n return () => {\n document.removeEventListener('mousedown', listener, true);\n document.removeEventListener('touchstart', listener, true);\n };\n }, [isOpened, floatingEl, onClickOutside]);\n\n return (\n <StyledTriggerWrapper\n data-testid={`${DropdownMenuDataTestId.TRIGGER_WRAPPER}`}\n innerRef={setTriggerReferenceElement}\n aria-haspopup=\"listbox\"\n {...wrapperStyles}\n {...globalAttributes}\n {...restXstyledProps}\n as={as}\n >\n {children}\n {triggerReferenceElement && (\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isFloatingOpen}\n floatingStyles={{ ...floatingStyles, ...(zIndex !== undefined && { zIndex }) }}\n context={context}\n aria-label={(dataPopoverLabel as string) || 'dropdown-menu popover'}\n >\n {isLoading ? <DropdownMenuLoading /> : <DropdownMenuListBox />}\n </FloatingWrapper>\n )}\n </StyledTriggerWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADyEnB;AAxEJ,mBAA6C;AAC7C,iCAAoD;AACpD,8BAA2D;AAC3D,oCAAuC;AACvC,oBAAqC;AACrC,iCAAoC;AACpC,iCAAsC;AACtC,iCAAoC;AAE7B,MAAM,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oB,cAAc,UAAU,IAAI;AAAA,IAC3D;AAAA,EACF,GAAG,CAAC,UAAU,YAAY,cAAc,CAAC;AAEzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,GAAG,qDAAuB,eAAe;AAAA,MACtD,UAAU;AAAA,MACV,iBAAc;AAAA,MACb,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MAEC;AAAA;AAAA,QACA,2BACC;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,KAAK;AAAA,YACf,QAAQ;AAAA,YACR,gBAAgB,EAAE,GAAG,gBAAgB,GAAI,WAAW,UAAa,EAAE,OAAO,EAAG;AAAA,YAC7E;AAAA,YACA,cAAa,oBAA+B;AAAA,YAE3C,sBAAY,4CAAC,kDAAoB,IAAK,4CAAC,kDAAoB;AAAA;AAAA,QAC9D;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useContext } from "react";
4
- import { DSPopperJS } from "@elliemae/ds-popperjs";
3
+ import { useContext, useEffect } from "react";
4
+ import { useFloatingContext, FloatingWrapper } from "@elliemae/ds-floating-context";
5
5
  import { useGetGlobalAttributes, useGetXstyledProps } from "@elliemae/ds-props-helpers";
6
6
  import { DropdownMenuDataTestId } from "../DropdownMenuDataTestId.js";
7
7
  import { StyledTriggerWrapper } from "../styled.js";
@@ -27,14 +27,42 @@ const DropdownMenuContent = () => {
27
27
  ...globalAttributes
28
28
  } = useGetGlobalAttributes(props);
29
29
  const { minWidth, minHeight, ...restXstyledProps } = useGetXstyledProps(props);
30
- const onClickOutsideHandler = (e) => {
31
- const dropdownListboxes = [
32
- ...document.body.querySelectorAll(`[data-testid="${DropdownMenuDataTestId.MENU_WRAPPER}"]`)
33
- ];
34
- if (dropdownListboxes.every((listbox) => !listbox.contains(e.target))) {
35
- onClickOutside(e);
36
- }
37
- };
30
+ const {
31
+ refs,
32
+ floatingStyles,
33
+ context,
34
+ isOpen: isFloatingOpen
35
+ } = useFloatingContext({
36
+ externallyControlledIsOpen: isOpened,
37
+ withoutAnimation: true,
38
+ customOffset,
39
+ placement: startPlacementPreference,
40
+ placementOrderPreference
41
+ });
42
+ useEffect(() => {
43
+ if (triggerReferenceElement) refs.setReference(triggerReferenceElement);
44
+ }, [triggerReferenceElement, refs]);
45
+ const floatingEl = refs.floating;
46
+ useEffect(() => {
47
+ if (!isOpened || !floatingEl) return () => {
48
+ };
49
+ const listener = (event) => {
50
+ const target = event.target;
51
+ if (!target || floatingEl.contains(target)) return;
52
+ const dropdownListboxes = [
53
+ ...document.body.querySelectorAll(`[data-testid="${DropdownMenuDataTestId.MENU_WRAPPER}"]`)
54
+ ];
55
+ if (dropdownListboxes.every((listbox) => !listbox.contains(target))) {
56
+ onClickOutside(event);
57
+ }
58
+ };
59
+ document.addEventListener("mousedown", listener, true);
60
+ document.addEventListener("touchstart", listener, true);
61
+ return () => {
62
+ document.removeEventListener("mousedown", listener, true);
63
+ document.removeEventListener("touchstart", listener, true);
64
+ };
65
+ }, [isOpened, floatingEl, onClickOutside]);
38
66
  return /* @__PURE__ */ jsxs(
39
67
  StyledTriggerWrapper,
40
68
  {
@@ -48,17 +76,12 @@ const DropdownMenuContent = () => {
48
76
  children: [
49
77
  children,
50
78
  triggerReferenceElement && /* @__PURE__ */ jsx(
51
- DSPopperJS,
79
+ FloatingWrapper,
52
80
  {
53
- referenceElement: triggerReferenceElement,
54
- showPopover: isOpened,
55
- withoutArrow: true,
56
- withoutAnimation: true,
57
- customOffset,
58
- onClickOutside: onClickOutsideHandler,
59
- startPlacementPreference,
60
- placementOrderPreference,
61
- zIndex,
81
+ innerRef: refs.setFloating,
82
+ isOpen: isFloatingOpen,
83
+ floatingStyles: { ...floatingStyles, ...zIndex !== void 0 && { zIndex } },
84
+ context,
62
85
  "aria-label": dataPopoverLabel || "dropdown-menu popover",
63
86
  children: isLoading ? /* @__PURE__ */ jsx(DropdownMenuLoading, {}) : /* @__PURE__ */ jsx(DropdownMenuListBox, {})
64
87
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DropdownMenuContent.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-unused-vars */\nimport React, { useContext } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { DropdownMenuDataTestId } from '../DropdownMenuDataTestId.js';\nimport { StyledTriggerWrapper } from '../styled.js';\nimport { DropdownMenuListBox } from './DropdownMenuListBox.js';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { DropdownMenuLoading } from './DropdownMenuLoading.js';\n\nexport const DropdownMenuContent: React.ComponentType<Record<string, never>> = () => {\n const { props, triggerReferenceElement, setTriggerReferenceElement } = useContext(DSDropdownMenuContext);\n\n const {\n children,\n isOpened,\n onClickOutside,\n startPlacementPreference,\n placementOrderPreference,\n customOffset,\n wrapperStyles,\n isLoading,\n zIndex,\n as,\n } = props;\n const {\n 'data-popover-label': dataPopoverLabel,\n ...globalAttributes\n }: ReturnType<typeof useGetGlobalAttributes> & { 'data-popover-label'?: string } = useGetGlobalAttributes(props);\n // we need to exclude this props from the xstyled props because there is a conflict\n // using submenus items with the name of the prop of ddmenu and xstyled\n const { minWidth, minHeight, ...restXstyledProps } = useGetXstyledProps(props);\n const onClickOutsideHandler = (e: MouseEvent | TouchEvent) => {\n // We need to find out if the click was originated inside a child's dropdownmenu\n const dropdownListboxes = [\n ...document.body.querySelectorAll(`[data-testid=\"${DropdownMenuDataTestId.MENU_WRAPPER}\"]`),\n ];\n if (dropdownListboxes.every((listbox) => !listbox.contains(e.target as Node))) {\n onClickOutside(e);\n }\n };\n\n return (\n <StyledTriggerWrapper\n data-testid={`${DropdownMenuDataTestId.TRIGGER_WRAPPER}`}\n innerRef={setTriggerReferenceElement}\n aria-haspopup=\"listbox\"\n {...wrapperStyles}\n {...globalAttributes}\n {...restXstyledProps}\n as={as}\n >\n {children}\n {triggerReferenceElement && (\n <DSPopperJS\n referenceElement={triggerReferenceElement}\n showPopover={isOpened}\n withoutArrow\n withoutAnimation\n customOffset={customOffset}\n onClickOutside={onClickOutsideHandler}\n startPlacementPreference={startPlacementPreference}\n placementOrderPreference={placementOrderPreference}\n zIndex={zIndex}\n aria-label={(dataPopoverLabel as string) || 'dropdown-menu popover'}\n >\n {isLoading ? <DropdownMenuLoading /> : <DropdownMenuListBox />}\n </DSPopperJS>\n )}\n </StyledTriggerWrapper>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AC2CnB,SAuBmB,KAvBnB;AA1CJ,SAAgB,kBAAkB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB,0BAA0B;AAC3D,SAAS,8BAA8B;AACvC,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AAE7B,MAAM,sBAAkE,MAAM;AACnF,QAAM,EAAE,OAAO,yBAAyB,2BAA2B,IAAI,WAAW,qBAAqB;AAEvG,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM;AAAA,IACJ,sBAAsB;AAAA,IACtB,GAAG;AAAA,EACL,IAAmF,uBAAuB,KAAK;AAG/G,QAAM,EAAE,UAAU,WAAW,GAAG,iBAAiB,IAAI,mBAAmB,KAAK;AAC7E,QAAM,wBAAwB,CAAC,MAA+B;AAE5D,UAAM,oBAAoB;AAAA,MACxB,GAAG,SAAS,KAAK,iBAAiB,iBAAiB,uBAAuB,YAAY,IAAI;AAAA,IAC5F;AACA,QAAI,kBAAkB,MAAM,CAAC,YAAY,CAAC,QAAQ,SAAS,EAAE,MAAc,CAAC,GAAG;AAC7E,qBAAe,CAAC;AAAA,IAClB;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,GAAG,uBAAuB,eAAe;AAAA,MACtD,UAAU;AAAA,MACV,iBAAc;AAAA,MACb,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MAEC;AAAA;AAAA,QACA,2BACC;AAAA,UAAC;AAAA;AAAA,YACC,kBAAkB;AAAA,YAClB,aAAa;AAAA,YACb,cAAY;AAAA,YACZ,kBAAgB;AAAA,YAChB;AAAA,YACA,gBAAgB;AAAA,YAChB;AAAA,YACA;AAAA,YACA;AAAA,YACA,cAAa,oBAA+B;AAAA,YAE3C,sBAAY,oBAAC,uBAAoB,IAAK,oBAAC,uBAAoB;AAAA;AAAA,QAC9D;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-unused-vars */\nimport React, { useContext, useEffect } from 'react';\nimport { useFloatingContext, FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { DropdownMenuDataTestId } from '../DropdownMenuDataTestId.js';\nimport { StyledTriggerWrapper } from '../styled.js';\nimport { DropdownMenuListBox } from './DropdownMenuListBox.js';\nimport { DSDropdownMenuContext } from '../DropdownMenuContext.js';\nimport { DropdownMenuLoading } from './DropdownMenuLoading.js';\n\nexport const DropdownMenuContent: React.ComponentType<Record<string, never>> = () => {\n const { props, triggerReferenceElement, setTriggerReferenceElement } = useContext(DSDropdownMenuContext);\n\n const {\n children,\n isOpened,\n onClickOutside,\n startPlacementPreference,\n placementOrderPreference,\n customOffset,\n wrapperStyles,\n isLoading,\n zIndex,\n as,\n } = props;\n const {\n 'data-popover-label': dataPopoverLabel,\n ...globalAttributes\n }: ReturnType<typeof useGetGlobalAttributes> & { 'data-popover-label'?: string } = useGetGlobalAttributes(props);\n // we need to exclude this props from the xstyled props because there is a conflict\n // using submenus items with the name of the prop of ddmenu and xstyled\n const { minWidth, minHeight, ...restXstyledProps } = useGetXstyledProps(props);\n\n const {\n refs,\n floatingStyles,\n context,\n isOpen: isFloatingOpen,\n } = useFloatingContext({\n externallyControlledIsOpen: isOpened,\n withoutAnimation: true,\n customOffset,\n placement: startPlacementPreference,\n placementOrderPreference,\n });\n\n useEffect(() => {\n if (triggerReferenceElement) refs.setReference(triggerReferenceElement);\n }, [triggerReferenceElement, refs]);\n\n // Click-outside: close only when the click is not inside any child dropdown listbox\n const floatingEl = refs.floating;\n useEffect(() => {\n if (!isOpened || !floatingEl) return () => {};\n const listener = (event: MouseEvent | TouchEvent) => {\n const target = event.target as Node | null;\n if (!target || floatingEl.contains(target)) return;\n const dropdownListboxes = [\n ...document.body.querySelectorAll(`[data-testid=\"${DropdownMenuDataTestId.MENU_WRAPPER}\"]`),\n ];\n if (dropdownListboxes.every((listbox) => !listbox.contains(target))) {\n onClickOutside(event);\n }\n };\n document.addEventListener('mousedown', listener, true);\n document.addEventListener('touchstart', listener, true);\n return () => {\n document.removeEventListener('mousedown', listener, true);\n document.removeEventListener('touchstart', listener, true);\n };\n }, [isOpened, floatingEl, onClickOutside]);\n\n return (\n <StyledTriggerWrapper\n data-testid={`${DropdownMenuDataTestId.TRIGGER_WRAPPER}`}\n innerRef={setTriggerReferenceElement}\n aria-haspopup=\"listbox\"\n {...wrapperStyles}\n {...globalAttributes}\n {...restXstyledProps}\n as={as}\n >\n {children}\n {triggerReferenceElement && (\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={isFloatingOpen}\n floatingStyles={{ ...floatingStyles, ...(zIndex !== undefined && { zIndex }) }}\n context={context}\n aria-label={(dataPopoverLabel as string) || 'dropdown-menu popover'}\n >\n {isLoading ? <DropdownMenuLoading /> : <DropdownMenuListBox />}\n </FloatingWrapper>\n )}\n </StyledTriggerWr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A,MAC5F;AACA,UAAI,kBAAkB,MAAM,CAAC,YAAY,CAAC,QAAQ,SAAS,MAAM,CAAC,GAAG;AACnE,uBAAe,KAAK;AAAA,MACtB;AAAA,IACF;AACA,aAAS,iBAAiB,aAAa,UAAU,IAAI;AACrD,aAAS,iBAAiB,cAAc,UAAU,IAAI;AACtD,WAAO,MAAM;AACX,eAAS,oBAAoB,aAAa,UAAU,IAAI;AACxD,eAAS,oBAAoB,cAAc,UAAU,IAAI;AAAA,IAC3D;AAAA,EACF,GAAG,CAAC,UAAU,YAAY,cAAc,CAAC;AAEzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,GAAG,uBAAuB,eAAe;AAAA,MACtD,UAAU;AAAA,MACV,iBAAc;AAAA,MACb,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MAEC;AAAA;AAAA,QACA,2BACC;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,KAAK;AAAA,YACf,QAAQ;AAAA,YACR,gBAAgB,EAAE,GAAG,gBAAgB,GAAI,WAAW,UAAa,EAAE,OAAO,EAAG;AAAA,YAC7E;AAAA,YACA,cAAa,oBAA+B;AAAA,YAE3C,sBAAY,oBAAC,uBAAoB,IAAK,oBAAC,uBAAoB;AAAA;AAAA,QAC9D;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-dropdownmenu-v2",
3
- "version": "3.70.0-next.3",
3
+ "version": "3.70.0-next.6",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Dropdown Menu V2",
6
6
  "files": [
@@ -38,20 +38,20 @@
38
38
  "dependencies": {
39
39
  "@xstyled/system": "~3.8.1",
40
40
  "react-virtual": "~2.10.4",
41
- "@elliemae/ds-circular-progress-indicator": "3.70.0-next.3",
42
- "@elliemae/ds-popperjs": "3.70.0-next.3",
43
- "@elliemae/ds-menu-items": "3.70.0-next.3",
44
- "@elliemae/ds-menu-button": "3.70.0-next.3",
45
- "@elliemae/ds-form-input-text": "3.70.0-next.3",
46
- "@elliemae/ds-props-helpers": "3.70.0-next.3",
47
- "@elliemae/ds-system": "3.70.0-next.3",
48
- "@elliemae/ds-grid": "3.70.0-next.3"
41
+ "@elliemae/ds-circular-progress-indicator": "3.70.0-next.6",
42
+ "@elliemae/ds-floating-context": "3.70.0-next.6",
43
+ "@elliemae/ds-form-input-text": "3.70.0-next.6",
44
+ "@elliemae/ds-grid": "3.70.0-next.6",
45
+ "@elliemae/ds-menu-button": "3.70.0-next.6",
46
+ "@elliemae/ds-menu-items": "3.70.0-next.6",
47
+ "@elliemae/ds-system": "3.70.0-next.6",
48
+ "@elliemae/ds-props-helpers": "3.70.0-next.6"
49
49
  },
50
50
  "devDependencies": {
51
51
  "jest": "^30.0.0",
52
52
  "styled-components": "~5.3.9",
53
- "@elliemae/ds-test-utils": "3.70.0-next.3",
54
- "@elliemae/ds-monorepo-devops": "3.70.0-next.3"
53
+ "@elliemae/ds-test-utils": "3.70.0-next.6",
54
+ "@elliemae/ds-monorepo-devops": "3.70.0-next.6"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "react": "^18.3.1",