@simplybusiness/mobius 10.4.2 → 10.4.3

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 (73) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/components/Popover/Arrow.js +43 -0
  3. package/dist/cjs/components/Popover/Arrow.js.map +7 -0
  4. package/dist/cjs/components/Popover/Popover.js +258 -83
  5. package/dist/cjs/components/Popover/Popover.js.map +4 -4
  6. package/dist/cjs/components/Popover/index.js +258 -83
  7. package/dist/cjs/components/Popover/index.js.map +4 -4
  8. package/dist/cjs/components/Popover/useAutoUpdate.js +53 -0
  9. package/dist/cjs/components/Popover/useAutoUpdate.js.map +7 -0
  10. package/dist/cjs/components/Popover/useFloatingPosition.js +128 -0
  11. package/dist/cjs/components/Popover/useFloatingPosition.js.map +7 -0
  12. package/dist/cjs/components/Popover/useOutsidePress.js +46 -0
  13. package/dist/cjs/components/Popover/useOutsidePress.js.map +7 -0
  14. package/dist/cjs/components/index.js +422 -245
  15. package/dist/cjs/components/index.js.map +4 -4
  16. package/dist/cjs/index.js +422 -245
  17. package/dist/cjs/index.js.map +4 -4
  18. package/dist/cjs/meta.json +316 -32
  19. package/dist/esm/chunk-26KZYRE6.js +108 -0
  20. package/dist/esm/chunk-26KZYRE6.js.map +7 -0
  21. package/dist/esm/chunk-CAL44W47.js +23 -0
  22. package/dist/esm/chunk-CAL44W47.js.map +7 -0
  23. package/dist/esm/{chunk-PEEQNAIN.js → chunk-DMYDWKKA.js} +4 -4
  24. package/dist/esm/chunk-K3ECDAUR.js +33 -0
  25. package/dist/esm/chunk-K3ECDAUR.js.map +7 -0
  26. package/dist/esm/{chunk-GJBH37DH.js → chunk-KFHPI67N.js} +4 -4
  27. package/dist/esm/{chunk-F5ELD54X.js → chunk-LGZWQZLS.js} +2 -2
  28. package/dist/esm/{chunk-OAG5T7NC.js → chunk-NEFRXIFY.js} +4 -4
  29. package/dist/esm/chunk-VZ3IWSK6.js +158 -0
  30. package/dist/esm/chunk-VZ3IWSK6.js.map +7 -0
  31. package/dist/esm/chunk-WYJP7HVL.js +26 -0
  32. package/dist/esm/chunk-WYJP7HVL.js.map +7 -0
  33. package/dist/esm/components/AddressLookup/AddressLookup.js +4 -4
  34. package/dist/esm/components/AddressLookup/index.js +6 -6
  35. package/dist/esm/components/Breadcrumbs/index.js +3 -3
  36. package/dist/esm/components/Checkbox/index.js +1 -1
  37. package/dist/esm/components/Combobox/Combobox.js +3 -3
  38. package/dist/esm/components/Combobox/index.js +3 -3
  39. package/dist/esm/components/Drawer/index.js +3 -3
  40. package/dist/esm/components/Modal/index.js +3 -3
  41. package/dist/esm/components/Popover/Arrow.js +8 -0
  42. package/dist/esm/components/Popover/Arrow.js.map +7 -0
  43. package/dist/esm/components/Popover/Popover.js +5 -1
  44. package/dist/esm/components/Popover/index.js +5 -1
  45. package/dist/esm/components/Popover/useAutoUpdate.js +8 -0
  46. package/dist/esm/components/Popover/useAutoUpdate.js.map +7 -0
  47. package/dist/esm/components/Popover/useFloatingPosition.js +8 -0
  48. package/dist/esm/components/Popover/useFloatingPosition.js.map +7 -0
  49. package/dist/esm/components/Popover/useOutsidePress.js +8 -0
  50. package/dist/esm/components/Popover/useOutsidePress.js.map +7 -0
  51. package/dist/esm/components/index.js +77 -73
  52. package/dist/esm/index.js +77 -73
  53. package/dist/esm/meta.json +3737 -3401
  54. package/dist/tsconfig.build.tsbuildinfo +1 -1
  55. package/dist/types/components/Popover/Arrow.d.ts +9 -0
  56. package/dist/types/components/Popover/useAutoUpdate.d.ts +9 -0
  57. package/dist/types/components/Popover/useFloatingPosition.d.ts +17 -0
  58. package/dist/types/components/Popover/useOutsidePress.d.ts +9 -0
  59. package/package.json +1 -2
  60. package/src/components/Popover/Arrow.tsx +25 -0
  61. package/src/components/Popover/Popover.characterization.test.tsx +269 -0
  62. package/src/components/Popover/Popover.stories.tsx +40 -3
  63. package/src/components/Popover/Popover.test.tsx +6 -2
  64. package/src/components/Popover/Popover.tsx +87 -81
  65. package/src/components/Popover/useAutoUpdate.ts +43 -0
  66. package/src/components/Popover/useFloatingPosition.ts +177 -0
  67. package/src/components/Popover/useOutsidePress.ts +31 -0
  68. package/dist/esm/chunk-O5YEU5TG.js +0 -155
  69. package/dist/esm/chunk-O5YEU5TG.js.map +0 -7
  70. /package/dist/esm/{chunk-PEEQNAIN.js.map → chunk-DMYDWKKA.js.map} +0 -0
  71. /package/dist/esm/{chunk-GJBH37DH.js.map → chunk-KFHPI67N.js.map} +0 -0
  72. /package/dist/esm/{chunk-F5ELD54X.js.map → chunk-LGZWQZLS.js.map} +0 -0
  73. /package/dist/esm/{chunk-OAG5T7NC.js.map → chunk-NEFRXIFY.js.map} +0 -0
@@ -0,0 +1,23 @@
1
+ // src/components/Popover/Arrow.tsx
2
+ import { jsx } from "react/jsx-runtime";
3
+ var Arrow = ({ ref, width = 20, className, style }) => {
4
+ const height = width / 2;
5
+ return /* @__PURE__ */ jsx(
6
+ "svg",
7
+ {
8
+ ref,
9
+ className,
10
+ "aria-hidden": "true",
11
+ width,
12
+ height,
13
+ viewBox: `0 0 ${width} ${height}`,
14
+ style,
15
+ children: /* @__PURE__ */ jsx("path", { d: `M0,0 H${width} L${width / 2},${height} Z` })
16
+ }
17
+ );
18
+ };
19
+
20
+ export {
21
+ Arrow
22
+ };
23
+ //# sourceMappingURL=chunk-CAL44W47.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/Popover/Arrow.tsx"],
4
+ "sourcesContent": ["import type { CSSProperties, Ref } from \"react\";\n\ninterface ArrowProps {\n ref?: Ref<SVGSVGElement>;\n width?: number;\n className?: string;\n style?: CSSProperties;\n}\n\nexport const Arrow = ({ ref, width = 20, className, style }: ArrowProps) => {\n const height = width / 2;\n return (\n <svg\n ref={ref}\n className={className}\n aria-hidden=\"true\"\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n style={style}\n >\n <path d={`M0,0 H${width} L${width / 2},${height} Z`} />\n </svg>\n );\n};\n"],
5
+ "mappings": ";AAqBM;AAZC,IAAM,QAAQ,CAAC,EAAE,KAAK,QAAQ,IAAI,WAAW,MAAM,MAAkB;AAC1E,QAAM,SAAS,QAAQ;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,eAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,SAAS,OAAO,KAAK,IAAI,MAAM;AAAA,MAC/B;AAAA,MAEA,8BAAC,UAAK,GAAG,SAAS,KAAK,KAAK,QAAQ,CAAC,IAAI,MAAM,MAAM;AAAA;AAAA,EACvD;AAEJ;",
6
+ "names": []
7
+ }
@@ -1,12 +1,12 @@
1
+ import {
2
+ Content
3
+ } from "./chunk-55NPJOV3.js";
1
4
  import {
2
5
  Header
3
6
  } from "./chunk-MPB5F6QL.js";
4
7
  import {
5
8
  Modal
6
9
  } from "./chunk-JJUTS5ET.js";
7
- import {
8
- Content
9
- } from "./chunk-55NPJOV3.js";
10
10
 
11
11
  // src/components/Modal/index.tsx
12
12
  var Modal2 = Object.assign(Modal, {
@@ -18,4 +18,4 @@ Modal2.displayName = "Modal";
18
18
  export {
19
19
  Modal2 as Modal
20
20
  };
21
- //# sourceMappingURL=chunk-PEEQNAIN.js.map
21
+ //# sourceMappingURL=chunk-DMYDWKKA.js.map
@@ -0,0 +1,33 @@
1
+ // src/components/Popover/useAutoUpdate.ts
2
+ import { useEffect } from "react";
3
+ var useAutoUpdate = ({
4
+ referenceRef,
5
+ floatingRef,
6
+ onUpdate,
7
+ enabled
8
+ }) => {
9
+ useEffect(() => {
10
+ if (!enabled) return;
11
+ const reference = referenceRef.current;
12
+ const floating = floatingRef.current;
13
+ const scrollOpts = {
14
+ capture: true,
15
+ passive: true
16
+ };
17
+ window.addEventListener("scroll", onUpdate, scrollOpts);
18
+ window.addEventListener("resize", onUpdate, { passive: true });
19
+ const observer = typeof ResizeObserver === "function" ? new ResizeObserver(onUpdate) : null;
20
+ if (observer && reference) observer.observe(reference);
21
+ if (observer && floating) observer.observe(floating);
22
+ return () => {
23
+ window.removeEventListener("scroll", onUpdate, scrollOpts);
24
+ window.removeEventListener("resize", onUpdate);
25
+ observer?.disconnect();
26
+ };
27
+ }, [enabled, onUpdate, referenceRef, floatingRef]);
28
+ };
29
+
30
+ export {
31
+ useAutoUpdate
32
+ };
33
+ //# sourceMappingURL=chunk-K3ECDAUR.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/Popover/useAutoUpdate.ts"],
4
+ "sourcesContent": ["import type { RefObject } from \"react\";\nimport { useEffect } from \"react\";\n\ninterface UseAutoUpdateArgs {\n referenceRef: RefObject<HTMLElement | null>;\n floatingRef: RefObject<HTMLDivElement | null>;\n onUpdate: () => void;\n enabled: boolean;\n}\n\nexport const useAutoUpdate = ({\n referenceRef,\n floatingRef,\n onUpdate,\n enabled,\n}: UseAutoUpdateArgs): void => {\n useEffect(() => {\n if (!enabled) return;\n\n const reference = referenceRef.current;\n const floating = floatingRef.current;\n\n const scrollOpts: AddEventListenerOptions = {\n capture: true,\n passive: true,\n };\n window.addEventListener(\"scroll\", onUpdate, scrollOpts);\n window.addEventListener(\"resize\", onUpdate, { passive: true });\n\n const observer =\n typeof ResizeObserver === \"function\"\n ? new ResizeObserver(onUpdate)\n : null;\n if (observer && reference) observer.observe(reference);\n if (observer && floating) observer.observe(floating);\n\n return () => {\n window.removeEventListener(\"scroll\", onUpdate, scrollOpts);\n window.removeEventListener(\"resize\", onUpdate);\n observer?.disconnect();\n };\n }, [enabled, onUpdate, referenceRef, floatingRef]);\n};\n"],
5
+ "mappings": ";AACA,SAAS,iBAAiB;AASnB,IAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA+B;AAC7B,YAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAEd,UAAM,YAAY,aAAa;AAC/B,UAAM,WAAW,YAAY;AAE7B,UAAM,aAAsC;AAAA,MAC1C,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AACA,WAAO,iBAAiB,UAAU,UAAU,UAAU;AACtD,WAAO,iBAAiB,UAAU,UAAU,EAAE,SAAS,KAAK,CAAC;AAE7D,UAAM,WACJ,OAAO,mBAAmB,aACtB,IAAI,eAAe,QAAQ,IAC3B;AACN,QAAI,YAAY,UAAW,UAAS,QAAQ,SAAS;AACrD,QAAI,YAAY,SAAU,UAAS,QAAQ,QAAQ;AAEnD,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,UAAU,UAAU;AACzD,aAAO,oBAAoB,UAAU,QAAQ;AAC7C,gBAAU,WAAW;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,SAAS,UAAU,cAAc,WAAW,CAAC;AACnD;",
6
+ "names": []
7
+ }
@@ -1,12 +1,12 @@
1
+ import {
2
+ Header
3
+ } from "./chunk-UZV5PZ7R.js";
1
4
  import {
2
5
  Content
3
6
  } from "./chunk-WHRUNWJI.js";
4
7
  import {
5
8
  Drawer
6
9
  } from "./chunk-VYQRTISC.js";
7
- import {
8
- Header
9
- } from "./chunk-UZV5PZ7R.js";
10
10
 
11
11
  // src/components/Drawer/index.tsx
12
12
  var Drawer2 = Object.assign(Drawer, {
@@ -18,4 +18,4 @@ Drawer2.displayName = "Drawer";
18
18
  export {
19
19
  Drawer2 as Drawer
20
20
  };
21
- //# sourceMappingURL=chunk-GJBH37DH.js.map
21
+ //# sourceMappingURL=chunk-KFHPI67N.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-66ARYOY7.js";
4
4
  import {
5
5
  Combobox
6
- } from "./chunk-OAG5T7NC.js";
6
+ } from "./chunk-NEFRXIFY.js";
7
7
  import {
8
8
  Icon
9
9
  } from "./chunk-TKIP5Q5H.js";
@@ -93,4 +93,4 @@ AddressLookup.displayName = "AddressLookup";
93
93
  export {
94
94
  AddressLookup
95
95
  };
96
- //# sourceMappingURL=chunk-F5ELD54X.js.map
96
+ //# sourceMappingURL=chunk-LGZWQZLS.js.map
@@ -1,12 +1,12 @@
1
- import {
2
- Listbox
3
- } from "./chunk-PQSPISME.js";
4
1
  import {
5
2
  useComboboxHighlight
6
3
  } from "./chunk-XZUQV54A.js";
7
4
  import {
8
5
  useComboboxOptions
9
6
  } from "./chunk-GU5OMKTM.js";
7
+ import {
8
+ Listbox
9
+ } from "./chunk-PQSPISME.js";
10
10
  import {
11
11
  getOptionLabel,
12
12
  getOptionValue,
@@ -352,4 +352,4 @@ var Combobox = ComboboxInner;
352
352
  export {
353
353
  Combobox
354
354
  };
355
- //# sourceMappingURL=chunk-OAG5T7NC.js.map
355
+ //# sourceMappingURL=chunk-NEFRXIFY.js.map
@@ -0,0 +1,158 @@
1
+ import {
2
+ Button
3
+ } from "./chunk-FD3JTY5L.js";
4
+ import {
5
+ useAutoUpdate
6
+ } from "./chunk-K3ECDAUR.js";
7
+ import {
8
+ useFloatingPosition
9
+ } from "./chunk-26KZYRE6.js";
10
+ import {
11
+ useOutsidePress
12
+ } from "./chunk-WYJP7HVL.js";
13
+ import {
14
+ Arrow
15
+ } from "./chunk-CAL44W47.js";
16
+ import {
17
+ Icon
18
+ } from "./chunk-TKIP5Q5H.js";
19
+
20
+ // src/components/Popover/Popover.tsx
21
+ import { cross } from "@simplybusiness/icons";
22
+ import classNames from "classnames/dedupe";
23
+ import { cloneElement, useCallback, useEffect, useRef, useState } from "react";
24
+ import { createPortal } from "react-dom";
25
+ import { useWindowEvent } from "@simplybusiness/mobius-hooks";
26
+ import "@simplybusiness/mobius/src/components/Popover/Popover.css";
27
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
28
+ var OFFSET_FROM_CONTENT_DEFAULT = 10;
29
+ var ARROW_WIDTH = 20;
30
+ var Popover = (props) => {
31
+ const { trigger, children, onOpen, onClose, className } = props;
32
+ const referenceRef = useRef(null);
33
+ const floatingRef = useRef(null);
34
+ const arrowRef = useRef(null);
35
+ const [isOpen, setIsOpen] = useState(false);
36
+ const [portalTarget, setPortalTarget] = useState(null);
37
+ const isInsideDialog = portalTarget !== null && portalTarget.tagName === "DIALOG";
38
+ const { initialFloatingStyles, initialArrowStyles, update } = useFloatingPosition({
39
+ referenceRef,
40
+ floatingRef,
41
+ arrowRef,
42
+ isOpen,
43
+ offsetPx: OFFSET_FROM_CONTENT_DEFAULT,
44
+ arrowWidth: ARROW_WIDTH,
45
+ useFixedStrategy: isInsideDialog
46
+ });
47
+ useAutoUpdate({
48
+ referenceRef,
49
+ floatingRef,
50
+ onUpdate: update,
51
+ enabled: isOpen
52
+ });
53
+ useOutsidePress({
54
+ referenceRef,
55
+ floatingRef,
56
+ enabled: isOpen,
57
+ onOutsidePress: () => {
58
+ onClose?.();
59
+ setIsOpen(false);
60
+ }
61
+ });
62
+ const containerClasses = classNames(
63
+ "mobius",
64
+ "mobius-popover__container",
65
+ className
66
+ );
67
+ useEffect(() => {
68
+ const el = floatingRef.current;
69
+ if (!el) return;
70
+ const preventLabelActivation = (e) => {
71
+ const target = e.target;
72
+ if (!target.closest("a[href], input, select, textarea")) {
73
+ e.preventDefault();
74
+ }
75
+ };
76
+ el.addEventListener("click", preventLabelActivation);
77
+ return () => el.removeEventListener("click", preventLabelActivation);
78
+ }, [isOpen]);
79
+ const toggleVisibility = () => {
80
+ if (isOpen) {
81
+ setIsOpen(false);
82
+ onClose?.();
83
+ return;
84
+ }
85
+ const dialog = referenceRef.current?.closest("dialog");
86
+ setPortalTarget(dialog ?? document.body);
87
+ setIsOpen(true);
88
+ onOpen?.();
89
+ };
90
+ const setReferenceRef = useCallback((node) => {
91
+ referenceRef.current = node;
92
+ }, []);
93
+ const triggerComponent = cloneElement(trigger, {
94
+ ref: setReferenceRef,
95
+ className: classNames(
96
+ trigger.props.className,
97
+ "mobius-popover__toggle"
98
+ ),
99
+ onClick: toggleVisibility
100
+ });
101
+ useWindowEvent("keydown", (e) => {
102
+ if (e.key === "Escape" && isOpen) {
103
+ setIsOpen(false);
104
+ onClose?.();
105
+ e.preventDefault();
106
+ e.stopPropagation();
107
+ }
108
+ });
109
+ const floatingElement = isOpen ? /* @__PURE__ */ jsxs(
110
+ "div",
111
+ {
112
+ className: containerClasses,
113
+ ref: floatingRef,
114
+ style: initialFloatingStyles,
115
+ children: [
116
+ /* @__PURE__ */ jsxs("div", { className: "mobius-popover", children: [
117
+ /* @__PURE__ */ jsx("header", { className: "mobius-popover__header", children: /* @__PURE__ */ jsx(
118
+ Button,
119
+ {
120
+ type: "button",
121
+ className: "mobius-popover__close-button",
122
+ onClick: toggleVisibility,
123
+ "aria-label": "Close",
124
+ variant: "ghost",
125
+ children: /* @__PURE__ */ jsx(
126
+ Icon,
127
+ {
128
+ icon: cross,
129
+ size: "md",
130
+ className: "mobius-popover__close-icon"
131
+ }
132
+ )
133
+ }
134
+ ) }),
135
+ /* @__PURE__ */ jsx("div", { className: "mobius-popover__body", children })
136
+ ] }),
137
+ /* @__PURE__ */ jsx(
138
+ Arrow,
139
+ {
140
+ ref: arrowRef,
141
+ style: initialArrowStyles,
142
+ className: "mobius-popover__arrow-icon",
143
+ width: ARROW_WIDTH
144
+ }
145
+ )
146
+ ]
147
+ }
148
+ ) : null;
149
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
150
+ triggerComponent,
151
+ floatingElement && portalTarget ? createPortal(floatingElement, portalTarget) : null
152
+ ] });
153
+ };
154
+
155
+ export {
156
+ Popover
157
+ };
158
+ //# sourceMappingURL=chunk-VZ3IWSK6.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/Popover/Popover.tsx"],
4
+ "sourcesContent": ["import { cross } from \"@simplybusiness/icons\";\nimport classNames from \"classnames/dedupe\";\nimport type { ReactElement, ReactNode, RefAttributes } from \"react\";\nimport { cloneElement, useCallback, useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useWindowEvent } from \"@simplybusiness/mobius-hooks\";\nimport type { DOMProps } from \"../../types\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Arrow } from \"./Arrow\";\nimport { useAutoUpdate } from \"./useAutoUpdate\";\nimport { useFloatingPosition } from \"./useFloatingPosition\";\nimport { useOutsidePress } from \"./useOutsidePress\";\nimport \"./Popover.css\";\n\nexport type PopoverElementType = HTMLDivElement;\n\nexport interface PopoverProps\n extends DOMProps, RefAttributes<PopoverElementType> {\n children?: ReactNode;\n trigger: ReactElement;\n /** Callback that fires each time the accordion is opened */\n onOpen?: () => void;\n /** Callback that fires each time the accordion is closed */\n onClose?: () => void;\n /** Custom class name for setting specific CSS */\n className?: string;\n}\n\nconst OFFSET_FROM_CONTENT_DEFAULT = 10;\nconst ARROW_WIDTH = 20;\n\nexport const Popover = (props: PopoverProps) => {\n const { trigger, children, onOpen, onClose, className } = props;\n const referenceRef = useRef<HTMLElement | null>(null);\n const floatingRef = useRef<HTMLDivElement | null>(null);\n const arrowRef = useRef<SVGSVGElement | null>(null);\n const [isOpen, setIsOpen] = useState(false);\n const [portalTarget, setPortalTarget] = useState<HTMLElement | null>(null);\n\n const isInsideDialog =\n portalTarget !== null && portalTarget.tagName === \"DIALOG\";\n\n const { initialFloatingStyles, initialArrowStyles, update } =\n useFloatingPosition({\n referenceRef,\n floatingRef,\n arrowRef,\n isOpen,\n offsetPx: OFFSET_FROM_CONTENT_DEFAULT,\n arrowWidth: ARROW_WIDTH,\n useFixedStrategy: isInsideDialog,\n });\n\n useAutoUpdate({\n referenceRef,\n floatingRef,\n onUpdate: update,\n enabled: isOpen,\n });\n\n useOutsidePress({\n referenceRef,\n floatingRef,\n enabled: isOpen,\n onOutsidePress: () => {\n onClose?.();\n setIsOpen(false);\n },\n });\n\n const containerClasses = classNames(\n \"mobius\",\n \"mobius-popover__container\",\n className,\n );\n\n // Native listener to prevent clicks inside the popover from activating\n // interactive ancestors. Must be native because React's onClick fires\n // too late via delegation.\n useEffect(() => {\n const el = floatingRef.current;\n if (!el) return;\n\n const preventLabelActivation = (e: Event) => {\n const target = e.target as HTMLElement;\n // Allow default behavior for interactive elements (links, inputs, etc.)\n // so they remain functional inside the popover.\n if (!target.closest(\"a[href], input, select, textarea\")) {\n e.preventDefault();\n }\n };\n el.addEventListener(\"click\", preventLabelActivation);\n return () => el.removeEventListener(\"click\", preventLabelActivation);\n }, [isOpen]);\n\n const toggleVisibility = () => {\n if (isOpen) {\n setIsOpen(false);\n onClose?.();\n return;\n }\n\n // Portal into the nearest open <dialog> ancestor so the popover renders\n // in the same top-layer as the dialog. document.body falls outside that\n // top-layer and paints beneath the modal backdrop.\n const dialog = referenceRef.current?.closest(\"dialog\");\n setPortalTarget(dialog ?? document.body);\n setIsOpen(true);\n onOpen?.();\n };\n\n const setReferenceRef = useCallback((node: HTMLElement | null) => {\n referenceRef.current = node;\n }, []);\n\n const triggerComponent = cloneElement(trigger, {\n ref: setReferenceRef,\n className: classNames(\n (trigger.props as { className?: string }).className,\n \"mobius-popover__toggle\",\n ),\n onClick: toggleVisibility,\n } as Record<string, unknown>);\n\n useWindowEvent(\"keydown\", e => {\n if (e.key === \"Escape\" && isOpen) {\n setIsOpen(false);\n onClose?.();\n e.preventDefault();\n e.stopPropagation();\n }\n });\n\n const floatingElement = isOpen ? (\n <div\n className={containerClasses}\n ref={floatingRef}\n style={initialFloatingStyles}\n >\n <div className=\"mobius-popover\">\n <header className=\"mobius-popover__header\">\n <Button\n type=\"button\"\n className=\"mobius-popover__close-button\"\n onClick={toggleVisibility}\n aria-label=\"Close\"\n variant=\"ghost\"\n >\n <Icon\n icon={cross}\n size=\"md\"\n className=\"mobius-popover__close-icon\"\n />\n </Button>\n </header>\n <div className=\"mobius-popover__body\">{children}</div>\n </div>\n <Arrow\n ref={arrowRef}\n style={initialArrowStyles}\n className=\"mobius-popover__arrow-icon\"\n width={ARROW_WIDTH}\n />\n </div>\n ) : null;\n\n return (\n <>\n {triggerComponent}\n {floatingElement && portalTarget\n ? createPortal(floatingElement, portalTarget)\n : null}\n </>\n );\n};\n"],
5
+ "mappings": ";;;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AA,YACL,OAAO;AAAA,YACP,WAAU;AAAA,YACV,OAAO;AAAA;AAAA,QACT;AAAA;AAAA;AAAA,EACF,IACE;AAEJ,SACE,iCACG;AAAA;AAAA,IACA,mBAAmB,eAChB,aAAa,iBAAiB,YAAY,IAC1C;AAAA,KACN;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,26 @@
1
+ // src/components/Popover/useOutsidePress.ts
2
+ import { useEffect } from "react";
3
+ var useOutsidePress = ({
4
+ referenceRef,
5
+ floatingRef,
6
+ enabled,
7
+ onOutsidePress
8
+ }) => {
9
+ useEffect(() => {
10
+ if (!enabled) return;
11
+ const handler = (event) => {
12
+ const target = event.target;
13
+ if (!target) return;
14
+ if (referenceRef.current?.contains(target)) return;
15
+ if (floatingRef.current?.contains(target)) return;
16
+ onOutsidePress(event);
17
+ };
18
+ document.addEventListener("pointerdown", handler);
19
+ return () => document.removeEventListener("pointerdown", handler);
20
+ }, [enabled, onOutsidePress, referenceRef, floatingRef]);
21
+ };
22
+
23
+ export {
24
+ useOutsidePress
25
+ };
26
+ //# sourceMappingURL=chunk-WYJP7HVL.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/Popover/useOutsidePress.ts"],
4
+ "sourcesContent": ["import type { RefObject } from \"react\";\nimport { useEffect } from \"react\";\n\ninterface UseOutsidePressArgs {\n referenceRef: RefObject<HTMLElement | null>;\n floatingRef: RefObject<HTMLDivElement | null>;\n enabled: boolean;\n onOutsidePress: (event: PointerEvent) => void;\n}\n\nexport const useOutsidePress = ({\n referenceRef,\n floatingRef,\n enabled,\n onOutsidePress,\n}: UseOutsidePressArgs): void => {\n useEffect(() => {\n if (!enabled) return;\n\n const handler = (event: PointerEvent) => {\n const target = event.target as Node | null;\n if (!target) return;\n if (referenceRef.current?.contains(target)) return;\n if (floatingRef.current?.contains(target)) return;\n onOutsidePress(event);\n };\n\n document.addEventListener(\"pointerdown\", handler);\n return () => document.removeEventListener(\"pointerdown\", handler);\n }, [enabled, onOutsidePress, referenceRef, floatingRef]);\n};\n"],
5
+ "mappings": ";AACA,SAAS,iBAAiB;AASnB,IAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAiC;AAC/B,YAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAEd,UAAM,UAAU,CAAC,UAAwB;AACvC,YAAM,SAAS,MAAM;AACrB,UAAI,CAAC,OAAQ;AACb,UAAI,aAAa,SAAS,SAAS,MAAM,EAAG;AAC5C,UAAI,YAAY,SAAS,SAAS,MAAM,EAAG;AAC3C,qBAAe,KAAK;AAAA,IACtB;AAEA,aAAS,iBAAiB,eAAe,OAAO;AAChD,WAAO,MAAM,SAAS,oBAAoB,eAAe,OAAO;AAAA,EAClE,GAAG,CAAC,SAAS,gBAAgB,cAAc,WAAW,CAAC;AACzD;",
6
+ "names": []
7
+ }
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  AddressLookup
3
- } from "../../chunk-F5ELD54X.js";
3
+ } from "../../chunk-LGZWQZLS.js";
4
4
  import "../../chunk-66ARYOY7.js";
5
5
  import "../../chunk-SZEFLEDA.js";
6
6
  import "../../chunk-Q4QTBY7C.js";
7
- import "../../chunk-OAG5T7NC.js";
8
- import "../../chunk-PQSPISME.js";
9
- import "../../chunk-WNWHIFKH.js";
7
+ import "../../chunk-NEFRXIFY.js";
10
8
  import "../../chunk-XZUQV54A.js";
11
9
  import "../../chunk-GU5OMKTM.js";
10
+ import "../../chunk-PQSPISME.js";
11
+ import "../../chunk-WNWHIFKH.js";
12
12
  import "../../chunk-2JLZNSLY.js";
13
13
  import "../../chunk-CUOVI2HT.js";
14
14
  import "../../chunk-IQKS662C.js";
@@ -1,20 +1,20 @@
1
1
  import "../../chunk-WNRO77YH.js";
2
+ import "../../chunk-52GWES2P.js";
2
3
  import {
3
4
  AddressLookup
4
- } from "../../chunk-F5ELD54X.js";
5
+ } from "../../chunk-LGZWQZLS.js";
6
+ import "../../chunk-66ARYOY7.js";
5
7
  import {
6
8
  LoqateAddressLookupService
7
9
  } from "../../chunk-VVL4B2KD.js";
8
10
  import "../../chunk-EDSRI6SV.js";
9
- import "../../chunk-52GWES2P.js";
10
- import "../../chunk-66ARYOY7.js";
11
11
  import "../../chunk-SZEFLEDA.js";
12
12
  import "../../chunk-Q4QTBY7C.js";
13
- import "../../chunk-OAG5T7NC.js";
14
- import "../../chunk-PQSPISME.js";
15
- import "../../chunk-WNWHIFKH.js";
13
+ import "../../chunk-NEFRXIFY.js";
16
14
  import "../../chunk-XZUQV54A.js";
17
15
  import "../../chunk-GU5OMKTM.js";
16
+ import "../../chunk-PQSPISME.js";
17
+ import "../../chunk-WNWHIFKH.js";
18
18
  import "../../chunk-2JLZNSLY.js";
19
19
  import "../../chunk-CUOVI2HT.js";
20
20
  import "../../chunk-IQKS662C.js";
@@ -1,11 +1,11 @@
1
1
  import "../../chunk-LX5HBXZN.js";
2
- import {
3
- Breadcrumbs
4
- } from "../../chunk-JFDDW3IV.js";
5
2
  import {
6
3
  BreadcrumbItem
7
4
  } from "../../chunk-HP2NRM7T.js";
8
5
  import "../../chunk-HWGFFTOM.js";
6
+ import {
7
+ Breadcrumbs
8
+ } from "../../chunk-JFDDW3IV.js";
9
9
  import "../../chunk-TJCUKTFX.js";
10
10
  import "../../chunk-FIAL4HTE.js";
11
11
  import "../../chunk-QGGILW3D.js";
@@ -1,11 +1,11 @@
1
1
  import "../../chunk-6O77SOOB.js";
2
+ import "../../chunk-IFGPGF5W.js";
2
3
  import {
3
4
  CheckboxGroup
4
5
  } from "../../chunk-576SEJGC.js";
5
6
  import {
6
7
  Checkbox
7
8
  } from "../../chunk-2VEO5SSY.js";
8
- import "../../chunk-IFGPGF5W.js";
9
9
  import "../../chunk-3PRSHEVX.js";
10
10
  import "../../chunk-MZJT3USG.js";
11
11
  import "../../chunk-NPOXFILT.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Combobox
3
- } from "../../chunk-OAG5T7NC.js";
4
- import "../../chunk-PQSPISME.js";
5
- import "../../chunk-WNWHIFKH.js";
3
+ } from "../../chunk-NEFRXIFY.js";
6
4
  import "../../chunk-XZUQV54A.js";
7
5
  import "../../chunk-GU5OMKTM.js";
6
+ import "../../chunk-PQSPISME.js";
7
+ import "../../chunk-WNWHIFKH.js";
8
8
  import "../../chunk-2JLZNSLY.js";
9
9
  import "../../chunk-CUOVI2HT.js";
10
10
  import "../../chunk-IQKS662C.js";
@@ -2,11 +2,11 @@ import "../../chunk-SZEFLEDA.js";
2
2
  import "../../chunk-Q4QTBY7C.js";
3
3
  import {
4
4
  Combobox
5
- } from "../../chunk-OAG5T7NC.js";
6
- import "../../chunk-PQSPISME.js";
7
- import "../../chunk-WNWHIFKH.js";
5
+ } from "../../chunk-NEFRXIFY.js";
8
6
  import "../../chunk-XZUQV54A.js";
9
7
  import "../../chunk-GU5OMKTM.js";
8
+ import "../../chunk-PQSPISME.js";
9
+ import "../../chunk-WNWHIFKH.js";
10
10
  import {
11
11
  buildOptionTestId
12
12
  } from "../../chunk-2JLZNSLY.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Drawer
3
- } from "../../chunk-GJBH37DH.js";
4
- import "../../chunk-WHRUNWJI.js";
5
- import "../../chunk-VYQRTISC.js";
3
+ } from "../../chunk-KFHPI67N.js";
6
4
  import "../../chunk-UZV5PZ7R.js";
7
5
  import {
8
6
  useDrawer
9
7
  } from "../../chunk-GZFZXQRU.js";
8
+ import "../../chunk-WHRUNWJI.js";
9
+ import "../../chunk-VYQRTISC.js";
10
10
  import "../../chunk-26JGSX7J.js";
11
11
  import "../../chunk-F6UWB5K2.js";
12
12
  import "../../chunk-FD3JTY5L.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Modal
3
- } from "../../chunk-PEEQNAIN.js";
3
+ } from "../../chunk-DMYDWKKA.js";
4
+ import "../../chunk-55NPJOV3.js";
4
5
  import "../../chunk-MPB5F6QL.js";
5
- import "../../chunk-JJUTS5ET.js";
6
6
  import {
7
7
  useModal
8
8
  } from "../../chunk-Q5MIALGZ.js";
9
+ import "../../chunk-JJUTS5ET.js";
9
10
  import "../../chunk-TBKQA5ZF.js";
10
- import "../../chunk-55NPJOV3.js";
11
11
  import "../../chunk-F6UWB5K2.js";
12
12
  import "../../chunk-FD3JTY5L.js";
13
13
  import "../../chunk-STMV644L.js";
@@ -0,0 +1,8 @@
1
+ import {
2
+ Arrow
3
+ } from "../../chunk-CAL44W47.js";
4
+ import "../../chunk-VHAA22YE.js";
5
+ export {
6
+ Arrow
7
+ };
8
+ //# sourceMappingURL=Arrow.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,10 +1,14 @@
1
1
  import {
2
2
  Popover
3
- } from "../../chunk-O5YEU5TG.js";
3
+ } from "../../chunk-VZ3IWSK6.js";
4
4
  import "../../chunk-F6UWB5K2.js";
5
5
  import "../../chunk-FD3JTY5L.js";
6
6
  import "../../chunk-STMV644L.js";
7
7
  import "../../chunk-GBENSQUV.js";
8
+ import "../../chunk-K3ECDAUR.js";
9
+ import "../../chunk-26KZYRE6.js";
10
+ import "../../chunk-WYJP7HVL.js";
11
+ import "../../chunk-CAL44W47.js";
8
12
  import "../../chunk-R43NQOOV.js";
9
13
  import "../../chunk-7IRHPNBO.js";
10
14
  import "../../chunk-TKIP5Q5H.js";
@@ -1,11 +1,15 @@
1
1
  import "../../chunk-ZZBOR5WE.js";
2
2
  import {
3
3
  Popover
4
- } from "../../chunk-O5YEU5TG.js";
4
+ } from "../../chunk-VZ3IWSK6.js";
5
5
  import "../../chunk-F6UWB5K2.js";
6
6
  import "../../chunk-FD3JTY5L.js";
7
7
  import "../../chunk-STMV644L.js";
8
8
  import "../../chunk-GBENSQUV.js";
9
+ import "../../chunk-K3ECDAUR.js";
10
+ import "../../chunk-26KZYRE6.js";
11
+ import "../../chunk-WYJP7HVL.js";
12
+ import "../../chunk-CAL44W47.js";
9
13
  import "../../chunk-R43NQOOV.js";
10
14
  import "../../chunk-7IRHPNBO.js";
11
15
  import "../../chunk-TKIP5Q5H.js";
@@ -0,0 +1,8 @@
1
+ import {
2
+ useAutoUpdate
3
+ } from "../../chunk-K3ECDAUR.js";
4
+ import "../../chunk-VHAA22YE.js";
5
+ export {
6
+ useAutoUpdate
7
+ };
8
+ //# sourceMappingURL=useAutoUpdate.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ import {
2
+ useFloatingPosition
3
+ } from "../../chunk-26KZYRE6.js";
4
+ import "../../chunk-VHAA22YE.js";
5
+ export {
6
+ useFloatingPosition
7
+ };
8
+ //# sourceMappingURL=useFloatingPosition.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ import {
2
+ useOutsidePress
3
+ } from "../../chunk-WYJP7HVL.js";
4
+ import "../../chunk-VHAA22YE.js";
5
+ export {
6
+ useOutsidePress
7
+ };
8
+ //# sourceMappingURL=useOutsidePress.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }