@dooherceg/tiptap-controlled-editor-with-table 0.0.10 → 0.0.11

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 (124) hide show
  1. package/dist/Combination-CO0ZtURs.js +1333 -0
  2. package/dist/assets/{components/tiptap-ui-primitive/badge/badge-colors.css → badge.css} +1 -1
  3. package/dist/assets/{components/tiptap-ui-primitive/button/button-colors.css → button.css} +1 -1
  4. package/dist/assets/simple-editor.css +1 -0
  5. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +58 -6
  6. package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +4 -5
  7. package/dist/components/tiptap-templates/simple/simple-editor.js +1922 -160
  8. package/dist/components/tiptap-templates/simple/theme-toggle.js +7 -7
  9. package/dist/components/tiptap-ui/blockquote-button/blockquote-button.js +10 -10
  10. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +5 -6
  11. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +1 -1
  12. package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.js +19 -19
  13. package/dist/components/tiptap-ui/heading-button/heading-button.js +9 -9
  14. package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.js +37 -29
  15. package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.js +14 -13
  16. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +16 -16
  17. package/dist/components/tiptap-ui/insert-table-button/insert-table-button.js +9 -9
  18. package/dist/components/tiptap-ui/link-popover/link-popover.js +13 -13
  19. package/dist/components/tiptap-ui/list-button/list-button.js +7 -7
  20. package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.js +24 -20
  21. package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.js +3 -2
  22. package/dist/components/tiptap-ui/table-actions-toolbar/table-actions-toolbar.js +28 -28
  23. package/dist/components/tiptap-ui-primitive/badge/badge.js +16 -19
  24. package/dist/components/tiptap-ui-primitive/button/button.js +19 -22
  25. package/dist/components/tiptap-ui-primitive/card/card.js +12 -13
  26. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +1012 -39
  27. package/dist/components/tiptap-ui-primitive/input/input.js +6 -7
  28. package/dist/components/tiptap-ui-primitive/popover/popover.js +233 -24
  29. package/dist/components/tiptap-ui-primitive/separator/separator.js +8 -9
  30. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +7 -8
  31. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +1330 -84
  32. package/dist/floating-ui.react-dom-DgOuULHo.js +1334 -0
  33. package/dist/hooks/use-throttled-callback.js +108 -13
  34. package/dist/{node_modules/react-hotkeys-hook/packages/react-hotkeys-hook/dist/index.js → index-Bqw9S4qP.js} +55 -57
  35. package/package.json +1 -1
  36. package/dist/_virtual/_commonjsHelpers.js +0 -8
  37. package/dist/_virtual/index.js +0 -7
  38. package/dist/assets/components/tiptap-node/blockquote-node/blockquote-node.css +0 -1
  39. package/dist/assets/components/tiptap-node/code-block-node/code-block-node.css +0 -1
  40. package/dist/assets/components/tiptap-node/heading-node/heading-node.css +0 -1
  41. package/dist/assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css +0 -1
  42. package/dist/assets/components/tiptap-node/image-node/image-node.css +0 -1
  43. package/dist/assets/components/tiptap-node/list-node/list-node.css +0 -1
  44. package/dist/assets/components/tiptap-node/paragraph-node/paragraph-node.css +0 -1
  45. package/dist/assets/components/tiptap-templates/simple/simple-editor.css +0 -1
  46. package/dist/assets/components/tiptap-ui-primitive/badge/badge-group.css +0 -1
  47. package/dist/assets/components/tiptap-ui-primitive/badge/badge.css +0 -1
  48. package/dist/assets/components/tiptap-ui-primitive/button/button-group.css +0 -1
  49. package/dist/assets/components/tiptap-ui-primitive/button/button.css +0 -1
  50. package/dist/assets/styles/_keyframe-animations.css +0 -1
  51. package/dist/assets/styles/_variables.css +0 -1
  52. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -527
  53. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -402
  54. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.js +0 -932
  55. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +0 -185
  56. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -208
  57. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -136
  58. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -130
  59. package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -9
  60. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +0 -24
  61. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +0 -48
  62. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -29
  63. package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -53
  64. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +0 -10
  65. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -127
  66. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +0 -221
  67. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -17
  68. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -136
  69. package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -13
  70. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +0 -636
  71. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +0 -239
  72. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +0 -219
  73. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -15
  74. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -70
  75. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -36
  76. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +0 -183
  77. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -49
  78. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -10
  79. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -52
  80. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -14
  81. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -6
  82. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +0 -27
  83. package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +0 -84
  84. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -57
  85. package/dist/node_modules/@tiptap/extension-image/dist/index.js +0 -128
  86. package/dist/node_modules/@tiptap/extension-list/dist/index.js +0 -713
  87. package/dist/node_modules/@tiptap/extension-subscript/dist/index.js +0 -40
  88. package/dist/node_modules/@tiptap/extension-superscript/dist/index.js +0 -40
  89. package/dist/node_modules/@tiptap/extension-table/dist/index.js +0 -380
  90. package/dist/node_modules/@tiptap/extension-text-align/dist/index.js +0 -46
  91. package/dist/node_modules/@tiptap/extension-typography/dist/index.js +0 -125
  92. package/dist/node_modules/@tiptap/extensions/dist/index.js +0 -288
  93. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -52
  94. package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -7
  95. package/dist/node_modules/lodash.throttle/index.js +0 -95
  96. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -11
  97. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -112
  98. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -31
  99. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -16
  100. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -68
  101. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
  102. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
  103. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -71
  104. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -7
  105. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -25
  106. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -11
  107. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -15
  108. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -30
  109. package/dist/node_modules/tabbable/dist/index.esm.js +0 -197
  110. package/dist/node_modules/tslib/tslib.es6.js +0 -27
  111. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -6
  112. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -26
  113. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -25
  114. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -18
  115. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -67
  116. /package/dist/assets/{components/tiptap-ui-primitive/card/card.css → card.css} +0 -0
  117. /package/dist/assets/{components/tiptap-ui/color-highlight-button/color-highlight-button.css → color-highlight-button.css} +0 -0
  118. /package/dist/assets/{components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.css → dropdown-menu.css} +0 -0
  119. /package/dist/assets/{components/tiptap-node/image-upload-node/image-upload-node.css → image-upload-node.css} +0 -0
  120. /package/dist/assets/{components/tiptap-ui-primitive/input/input.css → input.css} +0 -0
  121. /package/dist/assets/{components/tiptap-ui-primitive/popover/popover.css → popover.css} +0 -0
  122. /package/dist/assets/{components/tiptap-ui-primitive/separator/separator.css → separator.css} +0 -0
  123. /package/dist/assets/{components/tiptap-ui-primitive/toolbar/toolbar.css → toolbar.css} +0 -0
  124. /package/dist/assets/{components/tiptap-ui-primitive/tooltip/tooltip.css → tooltip.css} +0 -0
@@ -1,932 +0,0 @@
1
- import * as n from "react";
2
- import { enableFocusInside as pe, isOutsideEvent as te, getPreviousTabbable as Ae, getNextTabbable as Ke, useModernLayoutEffect as B, disableFocusInside as He, isSafari as Pe, useLatestRef as z, useEffectEvent as $, getDocument as U, isMouseLikePointerType as ae, activeElement as ge, contains as Q, getTarget as j, isTypeableElement as $e, matchesFocusVisible as Be, getFloatingFocusElement as We, isMac as Ye, getNodeChildren as ne, isReactEvent as Ve, isRootElement as Xe, isEventTargetWithin as oe } from "./floating-ui.react.utils.js";
3
- import { jsxs as Ge, jsx as J } from "react/jsx-runtime";
4
- import { isNode as Ue, isElement as D, getWindow as je, getOverflowAncestors as re, isHTMLElement as Ie, isWebKit as qe, isLastTraversableNode as se, getParentNode as Je, getComputedStyle as Qe } from "../../utils/dist/floating-ui.utils.dom.js";
5
- import * as Ze from "react-dom";
6
- import { useFloating as ze } from "../../react-dom/dist/floating-ui.react-dom.js";
7
- import { arrow as St, flip as Dt, hide as Ot, limitShift as kt, offset as _t, shift as Nt, size as At } from "../../react-dom/dist/floating-ui.react-dom.js";
8
- function ht(e) {
9
- const c = n.useRef(void 0), i = n.useCallback((t) => {
10
- const s = e.map((o) => {
11
- if (o != null) {
12
- if (typeof o == "function") {
13
- const r = o, u = r(t);
14
- return typeof u == "function" ? u : () => {
15
- r(null);
16
- };
17
- }
18
- return o.current = t, () => {
19
- o.current = null;
20
- };
21
- }
22
- });
23
- return () => {
24
- s.forEach((o) => o?.());
25
- };
26
- }, e);
27
- return n.useMemo(() => e.every((t) => t == null) ? null : (t) => {
28
- c.current && (c.current(), c.current = void 0), t != null && (c.current = i(t));
29
- }, e);
30
- }
31
- const et = "data-floating-ui-focusable", Re = "active", Ee = "selected", tt = {
32
- ...n
33
- };
34
- let be = !1, nt = 0;
35
- const he = () => (
36
- // Ensure the id is unique with multiple independent versions of Floating UI
37
- // on <React 18
38
- "floating-ui-" + Math.random().toString(36).slice(2, 6) + nt++
39
- );
40
- function ot() {
41
- const [e, c] = n.useState(() => be ? he() : void 0);
42
- return B(() => {
43
- e == null && c(he());
44
- }, []), n.useEffect(() => {
45
- be = !0;
46
- }, []), e;
47
- }
48
- const rt = tt.useId, de = rt || ot;
49
- let fe;
50
- process.env.NODE_ENV !== "production" && (fe = /* @__PURE__ */ new Set());
51
- function st() {
52
- for (var e, c = arguments.length, i = new Array(c), t = 0; t < c; t++)
53
- i[t] = arguments[t];
54
- const s = "Floating UI: " + i.join(" ");
55
- if (!((e = fe) != null && e.has(s))) {
56
- var o;
57
- (o = fe) == null || o.add(s), console.error(s);
58
- }
59
- }
60
- function ut() {
61
- const e = /* @__PURE__ */ new Map();
62
- return {
63
- emit(c, i) {
64
- var t;
65
- (t = e.get(c)) == null || t.forEach((s) => s(i));
66
- },
67
- on(c, i) {
68
- e.has(c) || e.set(c, /* @__PURE__ */ new Set()), e.get(c).add(i);
69
- },
70
- off(c, i) {
71
- var t;
72
- (t = e.get(c)) == null || t.delete(i);
73
- }
74
- };
75
- }
76
- const ct = /* @__PURE__ */ n.createContext(null), it = /* @__PURE__ */ n.createContext(null), me = () => {
77
- var e;
78
- return ((e = n.useContext(ct)) == null ? void 0 : e.id) || null;
79
- }, ve = () => n.useContext(it);
80
- function Z(e) {
81
- return "data-floating-ui-" + e;
82
- }
83
- function N(e) {
84
- e.current !== -1 && (clearTimeout(e.current), e.current = -1);
85
- }
86
- const ye = /* @__PURE__ */ Z("safe-polygon");
87
- function ue(e, c, i) {
88
- if (i && !ae(i))
89
- return 0;
90
- if (typeof e == "number")
91
- return e;
92
- if (typeof e == "function") {
93
- const t = e();
94
- return typeof t == "number" ? t : t?.[c];
95
- }
96
- return e?.[c];
97
- }
98
- function ce(e) {
99
- return typeof e == "function" ? e() : e;
100
- }
101
- function yt(e, c) {
102
- c === void 0 && (c = {});
103
- const {
104
- open: i,
105
- onOpenChange: t,
106
- dataRef: s,
107
- events: o,
108
- elements: r
109
- } = e, {
110
- enabled: u = !0,
111
- delay: f = 0,
112
- handleClose: m = null,
113
- mouseOnly: g = !1,
114
- restMs: w = 0,
115
- move: E = !0
116
- } = c, a = ve(), R = me(), d = z(m), y = z(f), x = z(i), b = z(w), C = n.useRef(), L = n.useRef(-1), k = n.useRef(), A = n.useRef(-1), X = n.useRef(!0), _ = n.useRef(!1), G = n.useRef(() => {
117
- }), H = n.useRef(!1), Y = $(() => {
118
- var v;
119
- const l = (v = s.current.openEvent) == null ? void 0 : v.type;
120
- return l?.includes("mouse") && l !== "mousedown";
121
- });
122
- n.useEffect(() => {
123
- if (!u) return;
124
- function v(l) {
125
- let {
126
- open: h
127
- } = l;
128
- h || (N(L), N(A), X.current = !0, H.current = !1);
129
- }
130
- return o.on("openchange", v), () => {
131
- o.off("openchange", v);
132
- };
133
- }, [u, o]), n.useEffect(() => {
134
- if (!u || !d.current || !i) return;
135
- function v(h) {
136
- Y() && t(!1, h, "hover");
137
- }
138
- const l = U(r.floating).documentElement;
139
- return l.addEventListener("mouseleave", v), () => {
140
- l.removeEventListener("mouseleave", v);
141
- };
142
- }, [r.floating, i, t, u, d, Y]);
143
- const V = n.useCallback(function(v, l, h) {
144
- l === void 0 && (l = !0), h === void 0 && (h = "hover");
145
- const P = ue(y.current, "close", C.current);
146
- P && !k.current ? (N(L), L.current = window.setTimeout(() => t(!1, v, h), P)) : l && (N(L), t(!1, v, h));
147
- }, [y, t]), K = $(() => {
148
- G.current(), k.current = void 0;
149
- }), p = $(() => {
150
- if (_.current) {
151
- const v = U(r.floating).body;
152
- v.style.pointerEvents = "", v.removeAttribute(ye), _.current = !1;
153
- }
154
- }), I = $(() => s.current.openEvent ? ["click", "mousedown"].includes(s.current.openEvent.type) : !1);
155
- n.useEffect(() => {
156
- if (!u) return;
157
- function v(M) {
158
- if (N(L), X.current = !1, g && !ae(C.current) || ce(b.current) > 0 && !ue(y.current, "open"))
159
- return;
160
- const T = ue(y.current, "open", C.current);
161
- T ? L.current = window.setTimeout(() => {
162
- x.current || t(!0, M, "hover");
163
- }, T) : i || t(!0, M, "hover");
164
- }
165
- function l(M) {
166
- if (I()) {
167
- p();
168
- return;
169
- }
170
- G.current();
171
- const T = U(r.floating);
172
- if (N(A), H.current = !1, d.current && s.current.floatingContext) {
173
- i || N(L), k.current = d.current({
174
- ...s.current.floatingContext,
175
- tree: a,
176
- x: M.clientX,
177
- y: M.clientY,
178
- onClose() {
179
- p(), K(), I() || V(M, !0, "safe-polygon");
180
- }
181
- });
182
- const F = k.current;
183
- T.addEventListener("mousemove", F), G.current = () => {
184
- T.removeEventListener("mousemove", F);
185
- };
186
- return;
187
- }
188
- (C.current === "touch" ? !Q(r.floating, M.relatedTarget) : !0) && V(M);
189
- }
190
- function h(M) {
191
- I() || s.current.floatingContext && (d.current == null || d.current({
192
- ...s.current.floatingContext,
193
- tree: a,
194
- x: M.clientX,
195
- y: M.clientY,
196
- onClose() {
197
- p(), K(), I() || V(M);
198
- }
199
- })(M));
200
- }
201
- function P() {
202
- N(L);
203
- }
204
- function O(M) {
205
- I() || V(M, !1);
206
- }
207
- if (D(r.domReference)) {
208
- const M = r.domReference, T = r.floating;
209
- return i && M.addEventListener("mouseleave", h), E && M.addEventListener("mousemove", v, {
210
- once: !0
211
- }), M.addEventListener("mouseenter", v), M.addEventListener("mouseleave", l), T && (T.addEventListener("mouseleave", h), T.addEventListener("mouseenter", P), T.addEventListener("mouseleave", O)), () => {
212
- i && M.removeEventListener("mouseleave", h), E && M.removeEventListener("mousemove", v), M.removeEventListener("mouseenter", v), M.removeEventListener("mouseleave", l), T && (T.removeEventListener("mouseleave", h), T.removeEventListener("mouseenter", P), T.removeEventListener("mouseleave", O));
213
- };
214
- }
215
- }, [r, u, e, g, E, V, K, p, t, i, x, a, y, d, s, I, b]), B(() => {
216
- var v;
217
- if (u && i && (v = d.current) != null && (v = v.__options) != null && v.blockPointerEvents && Y()) {
218
- _.current = !0;
219
- const h = r.floating;
220
- if (D(r.domReference) && h) {
221
- var l;
222
- const P = U(r.floating).body;
223
- P.setAttribute(ye, "");
224
- const O = r.domReference, M = a == null || (l = a.nodesRef.current.find((T) => T.id === R)) == null || (l = l.context) == null ? void 0 : l.elements.floating;
225
- return M && (M.style.pointerEvents = ""), P.style.pointerEvents = "none", O.style.pointerEvents = "auto", h.style.pointerEvents = "auto", () => {
226
- P.style.pointerEvents = "", O.style.pointerEvents = "", h.style.pointerEvents = "";
227
- };
228
- }
229
- }
230
- }, [u, i, R, r, a, d, Y]), B(() => {
231
- i || (C.current = void 0, H.current = !1, K(), p());
232
- }, [i, K, p]), n.useEffect(() => () => {
233
- K(), N(L), N(A), p();
234
- }, [u, r.domReference, K, p]);
235
- const S = n.useMemo(() => {
236
- function v(l) {
237
- C.current = l.pointerType;
238
- }
239
- return {
240
- onPointerDown: v,
241
- onPointerEnter: v,
242
- onMouseMove(l) {
243
- const {
244
- nativeEvent: h
245
- } = l;
246
- function P() {
247
- !X.current && !x.current && t(!0, h, "hover");
248
- }
249
- g && !ae(C.current) || i || ce(b.current) === 0 || H.current && l.movementX ** 2 + l.movementY ** 2 < 2 || (N(A), C.current === "touch" ? P() : (H.current = !0, A.current = window.setTimeout(P, ce(b.current))));
250
- }
251
- };
252
- }, [g, t, i, x, b]);
253
- return n.useMemo(() => u ? {
254
- reference: S
255
- } : {}, [u, S]);
256
- }
257
- const Ce = () => {
258
- }, lt = /* @__PURE__ */ n.createContext({
259
- delay: 0,
260
- initialDelay: 0,
261
- timeoutMs: 0,
262
- currentId: null,
263
- setCurrentId: Ce,
264
- setState: Ce,
265
- isInstantPhase: !1
266
- });
267
- function Ct(e) {
268
- const {
269
- children: c,
270
- delay: i,
271
- timeoutMs: t = 0
272
- } = e, [s, o] = n.useReducer((f, m) => ({
273
- ...f,
274
- ...m
275
- }), {
276
- delay: i,
277
- timeoutMs: t,
278
- initialDelay: i,
279
- currentId: null,
280
- isInstantPhase: !1
281
- }), r = n.useRef(null), u = n.useCallback((f) => {
282
- o({
283
- currentId: f
284
- });
285
- }, []);
286
- return B(() => {
287
- s.currentId ? r.current === null ? r.current = s.currentId : s.isInstantPhase || o({
288
- isInstantPhase: !0
289
- }) : (s.isInstantPhase && o({
290
- isInstantPhase: !1
291
- }), r.current = null);
292
- }, [s.currentId, s.isInstantPhase]), /* @__PURE__ */ J(lt.Provider, {
293
- value: n.useMemo(() => ({
294
- ...s,
295
- setState: o,
296
- setCurrentId: u
297
- }), [s, u]),
298
- children: c
299
- });
300
- }
301
- const Le = {
302
- border: 0,
303
- clip: "rect(0 0 0 0)",
304
- height: "1px",
305
- margin: "-1px",
306
- overflow: "hidden",
307
- padding: 0,
308
- position: "fixed",
309
- whiteSpace: "nowrap",
310
- width: "1px",
311
- top: 0,
312
- left: 0
313
- }, we = /* @__PURE__ */ n.forwardRef(function(c, i) {
314
- const [t, s] = n.useState();
315
- B(() => {
316
- Pe() && s("button");
317
- }, []);
318
- const o = {
319
- ref: i,
320
- tabIndex: 0,
321
- // Role is only for VoiceOver
322
- role: t,
323
- "aria-hidden": t ? void 0 : !0,
324
- [Z("focus-guard")]: "",
325
- style: Le
326
- };
327
- return /* @__PURE__ */ J("span", {
328
- ...c,
329
- ...o
330
- });
331
- }), Te = /* @__PURE__ */ n.createContext(null), Me = /* @__PURE__ */ Z("portal");
332
- function at(e) {
333
- e === void 0 && (e = {});
334
- const {
335
- id: c,
336
- root: i
337
- } = e, t = de(), s = ft(), [o, r] = n.useState(null), u = n.useRef(null);
338
- return B(() => () => {
339
- o?.remove(), queueMicrotask(() => {
340
- u.current = null;
341
- });
342
- }, [o]), B(() => {
343
- if (!t || u.current) return;
344
- const f = c ? document.getElementById(c) : null;
345
- if (!f) return;
346
- const m = document.createElement("div");
347
- m.id = t, m.setAttribute(Me, ""), f.appendChild(m), u.current = m, r(m);
348
- }, [c, t]), B(() => {
349
- if (i === null || !t || u.current) return;
350
- let f = i || s?.portalNode;
351
- f && !Ue(f) && (f = f.current), f = f || document.body;
352
- let m = null;
353
- c && (m = document.createElement("div"), m.id = c, f.appendChild(m));
354
- const g = document.createElement("div");
355
- g.id = t, g.setAttribute(Me, ""), f = m || f, f.appendChild(g), u.current = g, r(g);
356
- }, [c, i, t, s]), o;
357
- }
358
- function wt(e) {
359
- const {
360
- children: c,
361
- id: i,
362
- root: t,
363
- preserveTabOrder: s = !0
364
- } = e, o = at({
365
- id: i,
366
- root: t
367
- }), [r, u] = n.useState(null), f = n.useRef(null), m = n.useRef(null), g = n.useRef(null), w = n.useRef(null), E = r?.modal, a = r?.open, R = (
368
- // The FocusManager and therefore floating element are currently open/
369
- // rendered.
370
- !!r && // Guards are only for non-modal focus management.
371
- !r.modal && // Don't render if unmount is transitioning.
372
- r.open && s && !!(t || o)
373
- );
374
- return n.useEffect(() => {
375
- if (!o || !s || E)
376
- return;
377
- function d(y) {
378
- o && te(y) && (y.type === "focusin" ? pe : He)(o);
379
- }
380
- return o.addEventListener("focusin", d, !0), o.addEventListener("focusout", d, !0), () => {
381
- o.removeEventListener("focusin", d, !0), o.removeEventListener("focusout", d, !0);
382
- };
383
- }, [o, s, E]), n.useEffect(() => {
384
- o && (a || pe(o));
385
- }, [a, o]), /* @__PURE__ */ Ge(Te.Provider, {
386
- value: n.useMemo(() => ({
387
- preserveTabOrder: s,
388
- beforeOutsideRef: f,
389
- afterOutsideRef: m,
390
- beforeInsideRef: g,
391
- afterInsideRef: w,
392
- portalNode: o,
393
- setFocusManagerState: u
394
- }), [s, o]),
395
- children: [R && o && /* @__PURE__ */ J(we, {
396
- "data-type": "outside",
397
- ref: f,
398
- onFocus: (d) => {
399
- if (te(d, o)) {
400
- var y;
401
- (y = g.current) == null || y.focus();
402
- } else {
403
- const x = r ? r.domReference : null, b = Ae(x);
404
- b?.focus();
405
- }
406
- }
407
- }), R && o && /* @__PURE__ */ J("span", {
408
- "aria-owns": o.id,
409
- style: Le
410
- }), o && /* @__PURE__ */ Ze.createPortal(c, o), R && o && /* @__PURE__ */ J(we, {
411
- "data-type": "outside",
412
- ref: m,
413
- onFocus: (d) => {
414
- if (te(d, o)) {
415
- var y;
416
- (y = w.current) == null || y.focus();
417
- } else {
418
- const x = r ? r.domReference : null, b = Ke(x);
419
- b?.focus(), r?.closeOnFocusOut && r?.onOpenChange(!1, d.nativeEvent, "focus-out");
420
- }
421
- }
422
- })]
423
- });
424
- }
425
- const ft = () => n.useContext(Te), dt = {
426
- pointerdown: "onPointerDown",
427
- mousedown: "onMouseDown",
428
- click: "onClick"
429
- }, mt = {
430
- pointerdown: "onPointerDownCapture",
431
- mousedown: "onMouseDownCapture",
432
- click: "onClickCapture"
433
- }, xe = (e) => {
434
- var c, i;
435
- return {
436
- escapeKey: typeof e == "boolean" ? e : (c = e?.escapeKey) != null ? c : !1,
437
- outsidePress: typeof e == "boolean" ? e : (i = e?.outsidePress) != null ? i : !0
438
- };
439
- };
440
- function Mt(e, c) {
441
- c === void 0 && (c = {});
442
- const {
443
- open: i,
444
- onOpenChange: t,
445
- elements: s,
446
- dataRef: o
447
- } = e, {
448
- enabled: r = !0,
449
- escapeKey: u = !0,
450
- outsidePress: f = !0,
451
- outsidePressEvent: m = "pointerdown",
452
- referencePress: g = !1,
453
- referencePressEvent: w = "pointerdown",
454
- ancestorScroll: E = !1,
455
- bubbles: a,
456
- capture: R
457
- } = c, d = ve(), y = $(typeof f == "function" ? f : () => !1), x = typeof f == "function" ? y : f, b = n.useRef(!1), {
458
- escapeKey: C,
459
- outsidePress: L
460
- } = xe(a), {
461
- escapeKey: k,
462
- outsidePress: A
463
- } = xe(R), X = n.useRef(!1), _ = $((p) => {
464
- var I;
465
- if (!i || !r || !u || p.key !== "Escape" || X.current)
466
- return;
467
- const S = (I = o.current.floatingContext) == null ? void 0 : I.nodeId, v = d ? ne(d.nodesRef.current, S) : [];
468
- if (!C && (p.stopPropagation(), v.length > 0)) {
469
- let l = !0;
470
- if (v.forEach((h) => {
471
- var P;
472
- if ((P = h.context) != null && P.open && !h.context.dataRef.current.__escapeKeyBubbles) {
473
- l = !1;
474
- return;
475
- }
476
- }), !l)
477
- return;
478
- }
479
- t(!1, Ve(p) ? p.nativeEvent : p, "escape-key");
480
- }), G = $((p) => {
481
- var I;
482
- const S = () => {
483
- var v;
484
- _(p), (v = j(p)) == null || v.removeEventListener("keydown", S);
485
- };
486
- (I = j(p)) == null || I.addEventListener("keydown", S);
487
- }), H = $((p) => {
488
- var I;
489
- const S = o.current.insideReactTree;
490
- o.current.insideReactTree = !1;
491
- const v = b.current;
492
- if (b.current = !1, m === "click" && v || S || typeof x == "function" && !x(p))
493
- return;
494
- const l = j(p), h = "[" + Z("inert") + "]", P = U(s.floating).querySelectorAll(h);
495
- let O = D(l) ? l : null;
496
- for (; O && !se(O); ) {
497
- const F = Je(O);
498
- if (se(F) || !D(F))
499
- break;
500
- O = F;
501
- }
502
- if (P.length && D(l) && !Xe(l) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
503
- !Q(l, s.floating) && // If the target root element contains none of the markers, then the
504
- // element was injected after the floating element rendered.
505
- Array.from(P).every((F) => !Q(O, F)))
506
- return;
507
- if (Ie(l) && K) {
508
- const F = se(l), W = Qe(l), q = /auto|scroll/, Fe = F || q.test(W.overflowX), Se = F || q.test(W.overflowY), De = Fe && l.clientWidth > 0 && l.scrollWidth > l.clientWidth, Oe = Se && l.clientHeight > 0 && l.scrollHeight > l.clientHeight, ke = W.direction === "rtl", _e = Oe && (ke ? p.offsetX <= l.offsetWidth - l.clientWidth : p.offsetX > l.clientWidth), Ne = De && p.offsetY > l.clientHeight;
509
- if (_e || Ne)
510
- return;
511
- }
512
- const M = (I = o.current.floatingContext) == null ? void 0 : I.nodeId, T = d && ne(d.nodesRef.current, M).some((F) => {
513
- var W;
514
- return oe(p, (W = F.context) == null ? void 0 : W.elements.floating);
515
- });
516
- if (oe(p, s.floating) || oe(p, s.domReference) || T)
517
- return;
518
- const ee = d ? ne(d.nodesRef.current, M) : [];
519
- if (ee.length > 0) {
520
- let F = !0;
521
- if (ee.forEach((W) => {
522
- var q;
523
- if ((q = W.context) != null && q.open && !W.context.dataRef.current.__outsidePressBubbles) {
524
- F = !1;
525
- return;
526
- }
527
- }), !F)
528
- return;
529
- }
530
- t(!1, p, "outside-press");
531
- }), Y = $((p) => {
532
- var I;
533
- const S = () => {
534
- var v;
535
- H(p), (v = j(p)) == null || v.removeEventListener(m, S);
536
- };
537
- (I = j(p)) == null || I.addEventListener(m, S);
538
- });
539
- n.useEffect(() => {
540
- if (!i || !r)
541
- return;
542
- o.current.__escapeKeyBubbles = C, o.current.__outsidePressBubbles = L;
543
- let p = -1;
544
- function I(P) {
545
- t(!1, P, "ancestor-scroll");
546
- }
547
- function S() {
548
- window.clearTimeout(p), X.current = !0;
549
- }
550
- function v() {
551
- p = window.setTimeout(
552
- () => {
553
- X.current = !1;
554
- },
555
- // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
556
- // Only apply to WebKit for the test to remain 0ms.
557
- qe() ? 5 : 0
558
- );
559
- }
560
- const l = U(s.floating);
561
- u && (l.addEventListener("keydown", k ? G : _, k), l.addEventListener("compositionstart", S), l.addEventListener("compositionend", v)), x && l.addEventListener(m, A ? Y : H, A);
562
- let h = [];
563
- return E && (D(s.domReference) && (h = re(s.domReference)), D(s.floating) && (h = h.concat(re(s.floating))), !D(s.reference) && s.reference && s.reference.contextElement && (h = h.concat(re(s.reference.contextElement)))), h = h.filter((P) => {
564
- var O;
565
- return P !== ((O = l.defaultView) == null ? void 0 : O.visualViewport);
566
- }), h.forEach((P) => {
567
- P.addEventListener("scroll", I, {
568
- passive: !0
569
- });
570
- }), () => {
571
- u && (l.removeEventListener("keydown", k ? G : _, k), l.removeEventListener("compositionstart", S), l.removeEventListener("compositionend", v)), x && l.removeEventListener(m, A ? Y : H, A), h.forEach((P) => {
572
- P.removeEventListener("scroll", I);
573
- }), window.clearTimeout(p);
574
- };
575
- }, [o, s, u, x, m, i, t, E, r, C, L, _, k, G, H, A, Y]), n.useEffect(() => {
576
- o.current.insideReactTree = !1;
577
- }, [o, x, m]);
578
- const V = n.useMemo(() => ({
579
- onKeyDown: _,
580
- ...g && {
581
- [dt[w]]: (p) => {
582
- t(!1, p.nativeEvent, "reference-press");
583
- },
584
- ...w !== "click" && {
585
- onClick(p) {
586
- t(!1, p.nativeEvent, "reference-press");
587
- }
588
- }
589
- }
590
- }), [_, t, g, w]), K = n.useMemo(() => ({
591
- onKeyDown: _,
592
- onMouseDown() {
593
- b.current = !0;
594
- },
595
- onMouseUp() {
596
- b.current = !0;
597
- },
598
- [mt[m]]: () => {
599
- o.current.insideReactTree = !0;
600
- }
601
- }), [_, m, o]);
602
- return n.useMemo(() => r ? {
603
- reference: V,
604
- floating: K
605
- } : {}, [r, V, K]);
606
- }
607
- function vt(e) {
608
- const {
609
- open: c = !1,
610
- onOpenChange: i,
611
- elements: t
612
- } = e, s = de(), o = n.useRef({}), [r] = n.useState(() => ut()), u = me() != null;
613
- if (process.env.NODE_ENV !== "production") {
614
- const a = t.reference;
615
- a && !D(a) && st("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
616
- }
617
- const [f, m] = n.useState(t.reference), g = $((a, R, d) => {
618
- o.current.openEvent = a ? R : void 0, r.emit("openchange", {
619
- open: a,
620
- event: R,
621
- reason: d,
622
- nested: u
623
- }), i?.(a, R, d);
624
- }), w = n.useMemo(() => ({
625
- setPositionReference: m
626
- }), []), E = n.useMemo(() => ({
627
- reference: f || t.reference || null,
628
- floating: t.floating || null,
629
- domReference: t.reference
630
- }), [f, t.reference, t.floating]);
631
- return n.useMemo(() => ({
632
- dataRef: o,
633
- open: c,
634
- onOpenChange: g,
635
- elements: E,
636
- events: r,
637
- floatingId: s,
638
- refs: w
639
- }), [c, g, E, r, s, w]);
640
- }
641
- function xt(e) {
642
- e === void 0 && (e = {});
643
- const {
644
- nodeId: c
645
- } = e, i = vt({
646
- ...e,
647
- elements: {
648
- reference: null,
649
- floating: null,
650
- ...e.elements
651
- }
652
- }), t = e.rootContext || i, s = t.elements, [o, r] = n.useState(null), [u, f] = n.useState(null), g = s?.domReference || o, w = n.useRef(null), E = ve();
653
- B(() => {
654
- g && (w.current = g);
655
- }, [g]);
656
- const a = ze({
657
- ...e,
658
- elements: {
659
- ...s,
660
- ...u && {
661
- reference: u
662
- }
663
- }
664
- }), R = n.useCallback((C) => {
665
- const L = D(C) ? {
666
- getBoundingClientRect: () => C.getBoundingClientRect(),
667
- getClientRects: () => C.getClientRects(),
668
- contextElement: C
669
- } : C;
670
- f(L), a.refs.setReference(L);
671
- }, [a.refs]), d = n.useCallback((C) => {
672
- (D(C) || C === null) && (w.current = C, r(C)), (D(a.refs.reference.current) || a.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
673
- // `null` to support `positionReference` + an unstable `reference`
674
- // callback ref.
675
- C !== null && !D(C)) && a.refs.setReference(C);
676
- }, [a.refs]), y = n.useMemo(() => ({
677
- ...a.refs,
678
- setReference: d,
679
- setPositionReference: R,
680
- domReference: w
681
- }), [a.refs, d, R]), x = n.useMemo(() => ({
682
- ...a.elements,
683
- domReference: g
684
- }), [a.elements, g]), b = n.useMemo(() => ({
685
- ...a,
686
- ...t,
687
- refs: y,
688
- elements: x,
689
- nodeId: c
690
- }), [a, y, x, c, t]);
691
- return B(() => {
692
- t.dataRef.current.floatingContext = b;
693
- const C = E?.nodesRef.current.find((L) => L.id === c);
694
- C && (C.context = b);
695
- }), n.useMemo(() => ({
696
- ...a,
697
- context: b,
698
- refs: y,
699
- elements: x
700
- }), [a, y, x, b]);
701
- }
702
- function ie() {
703
- return Ye() && Pe();
704
- }
705
- function Pt(e, c) {
706
- c === void 0 && (c = {});
707
- const {
708
- open: i,
709
- onOpenChange: t,
710
- events: s,
711
- dataRef: o,
712
- elements: r
713
- } = e, {
714
- enabled: u = !0,
715
- visibleOnly: f = !0
716
- } = c, m = n.useRef(!1), g = n.useRef(-1), w = n.useRef(!0);
717
- n.useEffect(() => {
718
- if (!u) return;
719
- const a = je(r.domReference);
720
- function R() {
721
- !i && Ie(r.domReference) && r.domReference === ge(U(r.domReference)) && (m.current = !0);
722
- }
723
- function d() {
724
- w.current = !0;
725
- }
726
- function y() {
727
- w.current = !1;
728
- }
729
- return a.addEventListener("blur", R), ie() && (a.addEventListener("keydown", d, !0), a.addEventListener("pointerdown", y, !0)), () => {
730
- a.removeEventListener("blur", R), ie() && (a.removeEventListener("keydown", d, !0), a.removeEventListener("pointerdown", y, !0));
731
- };
732
- }, [r.domReference, i, u]), n.useEffect(() => {
733
- if (!u) return;
734
- function a(R) {
735
- let {
736
- reason: d
737
- } = R;
738
- (d === "reference-press" || d === "escape-key") && (m.current = !0);
739
- }
740
- return s.on("openchange", a), () => {
741
- s.off("openchange", a);
742
- };
743
- }, [s, u]), n.useEffect(() => () => {
744
- N(g);
745
- }, []);
746
- const E = n.useMemo(() => ({
747
- onMouseLeave() {
748
- m.current = !1;
749
- },
750
- onFocus(a) {
751
- if (m.current) return;
752
- const R = j(a.nativeEvent);
753
- if (f && D(R)) {
754
- if (ie() && !a.relatedTarget) {
755
- if (!w.current && !$e(R))
756
- return;
757
- } else if (!Be(R))
758
- return;
759
- }
760
- t(!0, a.nativeEvent, "focus");
761
- },
762
- onBlur(a) {
763
- m.current = !1;
764
- const R = a.relatedTarget, d = a.nativeEvent, y = D(R) && R.hasAttribute(Z("focus-guard")) && R.getAttribute("data-type") === "outside";
765
- g.current = window.setTimeout(() => {
766
- var x;
767
- const b = ge(r.domReference ? r.domReference.ownerDocument : document);
768
- !R && b === r.domReference || Q((x = o.current.floatingContext) == null ? void 0 : x.refs.floating.current, b) || Q(r.domReference, b) || y || t(!1, d, "focus");
769
- });
770
- }
771
- }), [o, r.domReference, t, f]);
772
- return n.useMemo(() => u ? {
773
- reference: E
774
- } : {}, [u, E]);
775
- }
776
- function le(e, c, i) {
777
- const t = /* @__PURE__ */ new Map(), s = i === "item";
778
- let o = e;
779
- if (s && e) {
780
- const {
781
- [Re]: r,
782
- [Ee]: u,
783
- ...f
784
- } = e;
785
- o = f;
786
- }
787
- return {
788
- ...i === "floating" && {
789
- tabIndex: -1,
790
- [et]: ""
791
- },
792
- ...o,
793
- ...c.map((r) => {
794
- const u = r ? r[i] : null;
795
- return typeof u == "function" ? e ? u(e) : null : u;
796
- }).concat(e).reduce((r, u) => (u && Object.entries(u).forEach((f) => {
797
- let [m, g] = f;
798
- if (!(s && [Re, Ee].includes(m)))
799
- if (m.indexOf("on") === 0) {
800
- if (t.has(m) || t.set(m, []), typeof g == "function") {
801
- var w;
802
- (w = t.get(m)) == null || w.push(g), r[m] = function() {
803
- for (var E, a = arguments.length, R = new Array(a), d = 0; d < a; d++)
804
- R[d] = arguments[d];
805
- return (E = t.get(m)) == null ? void 0 : E.map((y) => y(...R)).find((y) => y !== void 0);
806
- };
807
- }
808
- } else
809
- r[m] = g;
810
- }), r), {})
811
- };
812
- }
813
- function It(e) {
814
- e === void 0 && (e = []);
815
- const c = e.map((u) => u?.reference), i = e.map((u) => u?.floating), t = e.map((u) => u?.item), s = n.useCallback(
816
- (u) => le(u, e, "reference"),
817
- // eslint-disable-next-line react-hooks/exhaustive-deps
818
- c
819
- ), o = n.useCallback(
820
- (u) => le(u, e, "floating"),
821
- // eslint-disable-next-line react-hooks/exhaustive-deps
822
- i
823
- ), r = n.useCallback(
824
- (u) => le(u, e, "item"),
825
- // eslint-disable-next-line react-hooks/exhaustive-deps
826
- t
827
- );
828
- return n.useMemo(() => ({
829
- getReferenceProps: s,
830
- getFloatingProps: o,
831
- getItemProps: r
832
- }), [s, o, r]);
833
- }
834
- const pt = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
835
- function Lt(e, c) {
836
- var i, t;
837
- c === void 0 && (c = {});
838
- const {
839
- open: s,
840
- elements: o,
841
- floatingId: r
842
- } = e, {
843
- enabled: u = !0,
844
- role: f = "dialog"
845
- } = c, m = de(), g = ((i = o.domReference) == null ? void 0 : i.id) || m, w = n.useMemo(() => {
846
- var b;
847
- return ((b = We(o.floating)) == null ? void 0 : b.id) || r;
848
- }, [o.floating, r]), E = (t = pt.get(f)) != null ? t : f, R = me() != null, d = n.useMemo(() => E === "tooltip" || f === "label" ? {
849
- ["aria-" + (f === "label" ? "labelledby" : "describedby")]: s ? w : void 0
850
- } : {
851
- "aria-expanded": s ? "true" : "false",
852
- "aria-haspopup": E === "alertdialog" ? "dialog" : E,
853
- "aria-controls": s ? w : void 0,
854
- ...E === "listbox" && {
855
- role: "combobox"
856
- },
857
- ...E === "menu" && {
858
- id: g
859
- },
860
- ...E === "menu" && R && {
861
- role: "menuitem"
862
- },
863
- ...f === "select" && {
864
- "aria-autocomplete": "none"
865
- },
866
- ...f === "combobox" && {
867
- "aria-autocomplete": "list"
868
- }
869
- }, [E, w, R, s, g, f]), y = n.useMemo(() => {
870
- const b = {
871
- id: w,
872
- ...E && {
873
- role: E
874
- }
875
- };
876
- return E === "tooltip" || f === "label" ? b : {
877
- ...b,
878
- ...E === "menu" && {
879
- "aria-labelledby": g
880
- }
881
- };
882
- }, [E, w, g, f]), x = n.useCallback((b) => {
883
- let {
884
- active: C,
885
- selected: L
886
- } = b;
887
- const k = {
888
- role: "option",
889
- ...C && {
890
- id: w + "-fui-option"
891
- }
892
- };
893
- switch (f) {
894
- case "select":
895
- case "combobox":
896
- return {
897
- ...k,
898
- "aria-selected": L
899
- };
900
- }
901
- return {};
902
- }, [w, f]);
903
- return n.useMemo(() => u ? {
904
- reference: d,
905
- floating: y,
906
- item: x
907
- } : {}, [u, d, y, x]);
908
- }
909
- export {
910
- Ct as FloatingDelayGroup,
911
- wt as FloatingPortal,
912
- St as arrow,
913
- Dt as flip,
914
- re as getOverflowAncestors,
915
- Ot as hide,
916
- kt as limitShift,
917
- _t as offset,
918
- Nt as shift,
919
- At as size,
920
- Mt as useDismiss,
921
- xt as useFloating,
922
- me as useFloatingParentNodeId,
923
- at as useFloatingPortalNode,
924
- vt as useFloatingRootContext,
925
- ve as useFloatingTree,
926
- Pt as useFocus,
927
- yt as useHover,
928
- de as useId,
929
- It as useInteractions,
930
- ht as useMergeRefs,
931
- Lt as useRole
932
- };