@dooherceg/tiptap-controlled-editor-with-table 0.0.7 → 0.0.9

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 (115) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +8 -0
  2. package/dist/_virtual/index.js +7 -0
  3. package/dist/assets/components/tiptap-node/blockquote-node/blockquote-node.css +1 -0
  4. package/dist/assets/components/tiptap-node/code-block-node/code-block-node.css +1 -0
  5. package/dist/assets/components/tiptap-node/heading-node/heading-node.css +1 -0
  6. package/dist/assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css +1 -0
  7. package/dist/assets/components/tiptap-node/image-node/image-node.css +1 -0
  8. package/dist/assets/components/tiptap-node/list-node/list-node.css +1 -0
  9. package/dist/assets/components/tiptap-node/paragraph-node/paragraph-node.css +1 -0
  10. package/dist/assets/components/tiptap-templates/simple/simple-editor.css +1 -0
  11. package/dist/assets/{badge.css → components/tiptap-ui-primitive/badge/badge-colors.css} +1 -1
  12. package/dist/assets/components/tiptap-ui-primitive/badge/badge-group.css +1 -0
  13. package/dist/assets/components/tiptap-ui-primitive/badge/badge.css +1 -0
  14. package/dist/assets/{button.css → components/tiptap-ui-primitive/button/button-colors.css} +1 -1
  15. package/dist/assets/components/tiptap-ui-primitive/button/button-group.css +1 -0
  16. package/dist/assets/components/tiptap-ui-primitive/button/button.css +1 -0
  17. package/dist/assets/styles/_keyframe-animations.css +1 -0
  18. package/dist/assets/styles/_variables.css +1 -0
  19. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +6 -58
  20. package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +4 -3
  21. package/dist/components/tiptap-templates/simple/simple-editor.d.ts +1 -3
  22. package/dist/components/tiptap-templates/simple/simple-editor.js +201 -1947
  23. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +6 -5
  24. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +1 -1
  25. package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.js +12 -12
  26. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +16 -16
  27. package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.js +3 -3
  28. package/dist/components/tiptap-ui-primitive/badge/badge.js +19 -16
  29. package/dist/components/tiptap-ui-primitive/button/button.js +18 -15
  30. package/dist/components/tiptap-ui-primitive/card/card.js +13 -12
  31. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +39 -1012
  32. package/dist/components/tiptap-ui-primitive/input/input.js +7 -6
  33. package/dist/components/tiptap-ui-primitive/popover/popover.js +24 -233
  34. package/dist/components/tiptap-ui-primitive/separator/separator.js +9 -8
  35. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +2 -1
  36. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +84 -1330
  37. package/dist/hooks/use-throttled-callback.js +13 -108
  38. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +527 -0
  39. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +402 -0
  40. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.js +932 -0
  41. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +185 -0
  42. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +208 -0
  43. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
  44. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +130 -0
  45. package/dist/node_modules/@radix-ui/primitive/dist/index.js +9 -0
  46. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
  47. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +48 -0
  48. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +29 -0
  49. package/dist/node_modules/@radix-ui/react-context/dist/index.js +53 -0
  50. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +10 -0
  51. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
  52. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +221 -0
  53. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +17 -0
  54. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +136 -0
  55. package/dist/node_modules/@radix-ui/react-id/dist/index.js +13 -0
  56. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +636 -0
  57. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +239 -0
  58. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +219 -0
  59. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +15 -0
  60. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
  61. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
  62. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +183 -0
  63. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +49 -0
  64. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +10 -0
  65. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
  66. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
  67. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
  68. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +27 -0
  69. package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +84 -0
  70. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +57 -0
  71. package/dist/node_modules/@tiptap/extension-image/dist/index.js +128 -0
  72. package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
  73. package/dist/node_modules/@tiptap/extension-subscript/dist/index.js +40 -0
  74. package/dist/node_modules/@tiptap/extension-superscript/dist/index.js +40 -0
  75. package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
  76. package/dist/node_modules/@tiptap/extension-text-align/dist/index.js +46 -0
  77. package/dist/node_modules/@tiptap/extension-typography/dist/index.js +125 -0
  78. package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
  79. package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
  80. package/dist/node_modules/get-nonce/dist/es2015/index.js +7 -0
  81. package/dist/node_modules/lodash.throttle/index.js +95 -0
  82. package/dist/{index-Bqw9S4qP.js → node_modules/react-hotkeys-hook/packages/react-hotkeys-hook/dist/index.js} +57 -55
  83. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
  84. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +112 -0
  85. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -0
  86. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
  87. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +68 -0
  88. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
  89. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
  90. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +71 -0
  91. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +7 -0
  92. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +25 -0
  93. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +11 -0
  94. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +15 -0
  95. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +30 -0
  96. package/dist/node_modules/tabbable/dist/index.esm.js +197 -0
  97. package/dist/node_modules/tslib/tslib.es6.js +27 -0
  98. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +6 -0
  99. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +26 -0
  100. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +25 -0
  101. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +18 -0
  102. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +67 -0
  103. package/package.json +1 -1
  104. package/dist/Combination-CO0ZtURs.js +0 -1333
  105. package/dist/assets/simple-editor.css +0 -1
  106. package/dist/floating-ui.react-dom-DgOuULHo.js +0 -1334
  107. /package/dist/assets/{image-upload-node.css → components/tiptap-node/image-upload-node/image-upload-node.css} +0 -0
  108. /package/dist/assets/{color-highlight-button.css → components/tiptap-ui/color-highlight-button/color-highlight-button.css} +0 -0
  109. /package/dist/assets/{card.css → components/tiptap-ui-primitive/card/card.css} +0 -0
  110. /package/dist/assets/{dropdown-menu.css → components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.css} +0 -0
  111. /package/dist/assets/{input.css → components/tiptap-ui-primitive/input/input.css} +0 -0
  112. /package/dist/assets/{popover.css → components/tiptap-ui-primitive/popover/popover.css} +0 -0
  113. /package/dist/assets/{separator.css → components/tiptap-ui-primitive/separator/separator.css} +0 -0
  114. /package/dist/assets/{toolbar.css → components/tiptap-ui-primitive/toolbar/toolbar.css} +0 -0
  115. /package/dist/assets/{tooltip.css → components/tiptap-ui-primitive/tooltip/tooltip.css} +0 -0
@@ -0,0 +1,48 @@
1
+ import r from "react";
2
+ import { createContextScope as y } from "../../react-context/dist/index.js";
3
+ import { useComposedRefs as M } from "../../react-compose-refs/dist/index.js";
4
+ import { createSlot as x } from "../../react-slot/dist/index.js";
5
+ import { jsx as u } from "react/jsx-runtime";
6
+ function g(s) {
7
+ const m = s + "CollectionProvider", [A, N] = y(m), [_, f] = A(
8
+ m,
9
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
10
+ ), p = (c) => {
11
+ const { scope: e, children: l } = c, o = r.useRef(null), t = r.useRef(/* @__PURE__ */ new Map()).current;
12
+ return /* @__PURE__ */ u(_, { scope: e, itemMap: t, collectionRef: o, children: l });
13
+ };
14
+ p.displayName = m;
15
+ const a = s + "CollectionSlot", E = x(a), C = r.forwardRef(
16
+ (c, e) => {
17
+ const { scope: l, children: o } = c, t = f(a, l), n = M(e, t.collectionRef);
18
+ return /* @__PURE__ */ u(E, { ref: n, children: o });
19
+ }
20
+ );
21
+ C.displayName = a;
22
+ const d = s + "CollectionItemSlot", R = "data-radix-collection-item", T = x(d), I = r.forwardRef(
23
+ (c, e) => {
24
+ const { scope: l, children: o, ...t } = c, n = r.useRef(null), S = M(e, n), i = f(d, l);
25
+ return r.useEffect(() => (i.itemMap.set(n, { ref: n, ...t }), () => void i.itemMap.delete(n))), /* @__PURE__ */ u(T, { [R]: "", ref: S, children: o });
26
+ }
27
+ );
28
+ I.displayName = d;
29
+ function O(c) {
30
+ const e = f(s + "CollectionConsumer", c);
31
+ return r.useCallback(() => {
32
+ const o = e.collectionRef.current;
33
+ if (!o) return [];
34
+ const t = Array.from(o.querySelectorAll(`[${R}]`));
35
+ return Array.from(e.itemMap.values()).sort(
36
+ (i, v) => t.indexOf(i.ref.current) - t.indexOf(v.ref.current)
37
+ );
38
+ }, [e.collectionRef, e.itemMap]);
39
+ }
40
+ return [
41
+ { Provider: p, Slot: C, ItemSlot: I },
42
+ O,
43
+ N
44
+ ];
45
+ }
46
+ export {
47
+ g as createCollection
48
+ };
@@ -0,0 +1,29 @@
1
+ import * as f from "react";
2
+ function l(n, o) {
3
+ if (typeof n == "function")
4
+ return n(o);
5
+ n != null && (n.current = o);
6
+ }
7
+ function i(...n) {
8
+ return (o) => {
9
+ let u = !1;
10
+ const c = n.map((t) => {
11
+ const e = l(t, o);
12
+ return !u && typeof e == "function" && (u = !0), e;
13
+ });
14
+ if (u)
15
+ return () => {
16
+ for (let t = 0; t < c.length; t++) {
17
+ const e = c[t];
18
+ typeof e == "function" ? e() : l(n[t], null);
19
+ }
20
+ };
21
+ };
22
+ }
23
+ function s(...n) {
24
+ return f.useCallback(i(...n), n);
25
+ }
26
+ export {
27
+ i as composeRefs,
28
+ s as useComposedRefs
29
+ };
@@ -0,0 +1,53 @@
1
+ import * as u from "react";
2
+ import { jsx as _ } from "react/jsx-runtime";
3
+ function P(e, p = []) {
4
+ let n = [];
5
+ function m(s, t) {
6
+ const o = u.createContext(t), c = n.length;
7
+ n = [...n, t];
8
+ const a = (i) => {
9
+ const { scope: f, children: C, ...x } = i, d = f?.[e]?.[c] || o, v = u.useMemo(() => x, Object.values(x));
10
+ return /* @__PURE__ */ _(d.Provider, { value: v, children: C });
11
+ };
12
+ a.displayName = s + "Provider";
13
+ function S(i, f) {
14
+ const C = f?.[e]?.[c] || o, x = u.useContext(C);
15
+ if (x) return x;
16
+ if (t !== void 0) return t;
17
+ throw new Error(`\`${i}\` must be used within \`${s}\``);
18
+ }
19
+ return [a, S];
20
+ }
21
+ const r = () => {
22
+ const s = n.map((t) => u.createContext(t));
23
+ return function(o) {
24
+ const c = o?.[e] || s;
25
+ return u.useMemo(
26
+ () => ({ [`__scope${e}`]: { ...o, [e]: c } }),
27
+ [o, c]
28
+ );
29
+ };
30
+ };
31
+ return r.scopeName = e, [m, h(r, ...p)];
32
+ }
33
+ function h(...e) {
34
+ const p = e[0];
35
+ if (e.length === 1) return p;
36
+ const n = () => {
37
+ const m = e.map((r) => ({
38
+ useScope: r(),
39
+ scopeName: r.scopeName
40
+ }));
41
+ return function(s) {
42
+ const t = m.reduce((o, { useScope: c, scopeName: a }) => {
43
+ const i = c(s)[`__scope${a}`];
44
+ return { ...o, ...i };
45
+ }, {});
46
+ return u.useMemo(() => ({ [`__scope${p.scopeName}`]: t }), [t]);
47
+ };
48
+ };
49
+ return n.scopeName = p.scopeName, n;
50
+ }
51
+ export {
52
+ P as createContextScope
53
+ };
@@ -0,0 +1,10 @@
1
+ import * as t from "react";
2
+ import "react/jsx-runtime";
3
+ var r = t.createContext(void 0);
4
+ function n(o) {
5
+ const e = t.useContext(r);
6
+ return o || e || "ltr";
7
+ }
8
+ export {
9
+ n as useDirection
10
+ };
@@ -0,0 +1,127 @@
1
+ import * as n from "react";
2
+ import { composeEventHandlers as h } from "../../primitive/dist/index.js";
3
+ import { Primitive as w, dispatchDiscreteCustomEvent as k } from "../../react-primitive/dist/index.js";
4
+ import { useComposedRefs as g } from "../../react-compose-refs/dist/index.js";
5
+ import { useCallbackRef as R } from "../../react-use-callback-ref/dist/index.js";
6
+ import { useEscapeKeydown as U } from "../../react-use-escape-keydown/dist/index.js";
7
+ import { jsx as T } from "react/jsx-runtime";
8
+ var z = "DismissableLayer", y = "dismissableLayer.update", H = "dismissableLayer.pointerDownOutside", M = "dismissableLayer.focusOutside", C, B = n.createContext({
9
+ layers: /* @__PURE__ */ new Set(),
10
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
11
+ branches: /* @__PURE__ */ new Set()
12
+ }), K = n.forwardRef(
13
+ (s, e) => {
14
+ const {
15
+ disableOutsidePointerEvents: r = !1,
16
+ onEscapeKeyDown: a,
17
+ onPointerDownOutside: i,
18
+ onFocusOutside: c,
19
+ onInteractOutside: f,
20
+ onDismiss: d,
21
+ ...E
22
+ } = s, o = n.useContext(B), [u, F] = n.useState(null), l = u?.ownerDocument ?? globalThis?.document, [, I] = n.useState({}), S = g(e, (t) => F(t)), p = Array.from(o.layers), [W] = [...o.layersWithOutsidePointerEventsDisabled].slice(-1), A = p.indexOf(W), b = u ? p.indexOf(u) : -1, N = o.layersWithOutsidePointerEventsDisabled.size > 0, D = b >= A, _ = Y((t) => {
23
+ const v = t.target, P = [...o.branches].some((m) => m.contains(v));
24
+ !D || P || (i?.(t), f?.(t), t.defaultPrevented || d?.());
25
+ }, l), O = q((t) => {
26
+ const v = t.target;
27
+ [...o.branches].some((m) => m.contains(v)) || (c?.(t), f?.(t), t.defaultPrevented || d?.());
28
+ }, l);
29
+ return U((t) => {
30
+ b === o.layers.size - 1 && (a?.(t), !t.defaultPrevented && d && (t.preventDefault(), d()));
31
+ }, l), n.useEffect(() => {
32
+ if (u)
33
+ return r && (o.layersWithOutsidePointerEventsDisabled.size === 0 && (C = l.body.style.pointerEvents, l.body.style.pointerEvents = "none"), o.layersWithOutsidePointerEventsDisabled.add(u)), o.layers.add(u), L(), () => {
34
+ r && o.layersWithOutsidePointerEventsDisabled.size === 1 && (l.body.style.pointerEvents = C);
35
+ };
36
+ }, [u, l, r, o]), n.useEffect(() => () => {
37
+ u && (o.layers.delete(u), o.layersWithOutsidePointerEventsDisabled.delete(u), L());
38
+ }, [u, o]), n.useEffect(() => {
39
+ const t = () => I({});
40
+ return document.addEventListener(y, t), () => document.removeEventListener(y, t);
41
+ }, []), /* @__PURE__ */ T(
42
+ w.div,
43
+ {
44
+ ...E,
45
+ ref: S,
46
+ style: {
47
+ pointerEvents: N ? D ? "auto" : "none" : void 0,
48
+ ...s.style
49
+ },
50
+ onFocusCapture: h(s.onFocusCapture, O.onFocusCapture),
51
+ onBlurCapture: h(s.onBlurCapture, O.onBlurCapture),
52
+ onPointerDownCapture: h(
53
+ s.onPointerDownCapture,
54
+ _.onPointerDownCapture
55
+ )
56
+ }
57
+ );
58
+ }
59
+ );
60
+ K.displayName = z;
61
+ var j = "DismissableLayerBranch", X = n.forwardRef((s, e) => {
62
+ const r = n.useContext(B), a = n.useRef(null), i = g(e, a);
63
+ return n.useEffect(() => {
64
+ const c = a.current;
65
+ if (c)
66
+ return r.branches.add(c), () => {
67
+ r.branches.delete(c);
68
+ };
69
+ }, [r.branches]), /* @__PURE__ */ T(w.div, { ...s, ref: i });
70
+ });
71
+ X.displayName = j;
72
+ function Y(s, e = globalThis?.document) {
73
+ const r = R(s), a = n.useRef(!1), i = n.useRef(() => {
74
+ });
75
+ return n.useEffect(() => {
76
+ const c = (d) => {
77
+ if (d.target && !a.current) {
78
+ let E = function() {
79
+ x(
80
+ H,
81
+ r,
82
+ o,
83
+ { discrete: !0 }
84
+ );
85
+ };
86
+ const o = { originalEvent: d };
87
+ d.pointerType === "touch" ? (e.removeEventListener("click", i.current), i.current = E, e.addEventListener("click", i.current, { once: !0 })) : E();
88
+ } else
89
+ e.removeEventListener("click", i.current);
90
+ a.current = !1;
91
+ }, f = window.setTimeout(() => {
92
+ e.addEventListener("pointerdown", c);
93
+ }, 0);
94
+ return () => {
95
+ window.clearTimeout(f), e.removeEventListener("pointerdown", c), e.removeEventListener("click", i.current);
96
+ };
97
+ }, [e, r]), {
98
+ // ensures we check React component tree (not just DOM tree)
99
+ onPointerDownCapture: () => a.current = !0
100
+ };
101
+ }
102
+ function q(s, e = globalThis?.document) {
103
+ const r = R(s), a = n.useRef(!1);
104
+ return n.useEffect(() => {
105
+ const i = (c) => {
106
+ c.target && !a.current && x(M, r, { originalEvent: c }, {
107
+ discrete: !1
108
+ });
109
+ };
110
+ return e.addEventListener("focusin", i), () => e.removeEventListener("focusin", i);
111
+ }, [e, r]), {
112
+ onFocusCapture: () => a.current = !0,
113
+ onBlurCapture: () => a.current = !1
114
+ };
115
+ }
116
+ function L() {
117
+ const s = new CustomEvent(y);
118
+ document.dispatchEvent(s);
119
+ }
120
+ function x(s, e, r, { discrete: a }) {
121
+ const i = r.originalEvent.target, c = new CustomEvent(s, { bubbles: !1, cancelable: !0, detail: r });
122
+ e && i.addEventListener(s, e, { once: !0 }), a ? k(i, c) : i.dispatchEvent(c);
123
+ }
124
+ export {
125
+ K as DismissableLayer,
126
+ X as DismissableLayerBranch
127
+ };
@@ -0,0 +1,221 @@
1
+ import * as u from "react";
2
+ import { composeEventHandlers as m } from "../../primitive/dist/index.js";
3
+ import { composeRefs as y } from "../../react-compose-refs/dist/index.js";
4
+ import { createContextScope as T } from "../../react-context/dist/index.js";
5
+ import { useControllableState as v } from "../../react-use-controllable-state/dist/index.js";
6
+ import { Primitive as G } from "../../react-primitive/dist/index.js";
7
+ import { createMenuScope as D, Anchor as k, SubContent as L, Content as K, Portal as U, Item as B, Root as F, Group as H, Sub as W, SubTrigger as $, RadioGroup as j, Label as X, CheckboxItem as q, RadioItem as z, ItemIndicator as J, Separator as Q, Arrow as V } from "../../react-menu/dist/index.js";
8
+ import { useId as g } from "../../react-id/dist/index.js";
9
+ import { jsx as a } from "react/jsx-runtime";
10
+ var f = "DropdownMenu", [Y] = T(
11
+ f,
12
+ [D]
13
+ ), i = D(), [Z, _] = Y(f), h = (o) => {
14
+ const {
15
+ __scopeDropdownMenu: n,
16
+ children: r,
17
+ dir: e,
18
+ open: t,
19
+ defaultOpen: d,
20
+ onOpenChange: s,
21
+ modal: p = !0
22
+ } = o, c = i(n), M = u.useRef(null), [l, w] = v({
23
+ prop: t,
24
+ defaultProp: d ?? !1,
25
+ onChange: s,
26
+ caller: f
27
+ });
28
+ return /* @__PURE__ */ a(
29
+ Z,
30
+ {
31
+ scope: n,
32
+ triggerId: g(),
33
+ triggerRef: M,
34
+ contentId: g(),
35
+ open: l,
36
+ onOpenChange: w,
37
+ onOpenToggle: u.useCallback(() => w((O) => !O), [w]),
38
+ modal: p,
39
+ children: /* @__PURE__ */ a(F, { ...c, open: l, onOpenChange: w, dir: e, modal: p, children: r })
40
+ }
41
+ );
42
+ };
43
+ h.displayName = f;
44
+ var R = "DropdownMenuTrigger", b = u.forwardRef(
45
+ (o, n) => {
46
+ const { __scopeDropdownMenu: r, disabled: e = !1, ...t } = o, d = _(R, r), s = i(r);
47
+ return /* @__PURE__ */ a(k, { asChild: !0, ...s, children: /* @__PURE__ */ a(
48
+ G.button,
49
+ {
50
+ type: "button",
51
+ id: d.triggerId,
52
+ "aria-haspopup": "menu",
53
+ "aria-expanded": d.open,
54
+ "aria-controls": d.open ? d.contentId : void 0,
55
+ "data-state": d.open ? "open" : "closed",
56
+ "data-disabled": e ? "" : void 0,
57
+ disabled: e,
58
+ ...t,
59
+ ref: y(n, d.triggerRef),
60
+ onPointerDown: m(o.onPointerDown, (p) => {
61
+ !e && p.button === 0 && p.ctrlKey === !1 && (d.onOpenToggle(), d.open || p.preventDefault());
62
+ }),
63
+ onKeyDown: m(o.onKeyDown, (p) => {
64
+ e || (["Enter", " "].includes(p.key) && d.onOpenToggle(), p.key === "ArrowDown" && d.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(p.key) && p.preventDefault());
65
+ })
66
+ }
67
+ ) });
68
+ }
69
+ );
70
+ b.displayName = R;
71
+ var oo = "DropdownMenuPortal", S = (o) => {
72
+ const { __scopeDropdownMenu: n, ...r } = o, e = i(n);
73
+ return /* @__PURE__ */ a(U, { ...e, ...r });
74
+ };
75
+ S.displayName = oo;
76
+ var I = "DropdownMenuContent", C = u.forwardRef(
77
+ (o, n) => {
78
+ const { __scopeDropdownMenu: r, ...e } = o, t = _(I, r), d = i(r), s = u.useRef(!1);
79
+ return /* @__PURE__ */ a(
80
+ K,
81
+ {
82
+ id: t.contentId,
83
+ "aria-labelledby": t.triggerId,
84
+ ...d,
85
+ ...e,
86
+ ref: n,
87
+ onCloseAutoFocus: m(o.onCloseAutoFocus, (p) => {
88
+ s.current || t.triggerRef.current?.focus(), s.current = !1, p.preventDefault();
89
+ }),
90
+ onInteractOutside: m(o.onInteractOutside, (p) => {
91
+ const c = p.detail.originalEvent, M = c.button === 0 && c.ctrlKey === !0, l = c.button === 2 || M;
92
+ (!t.modal || l) && (s.current = !0);
93
+ }),
94
+ style: {
95
+ ...o.style,
96
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
97
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
98
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
99
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
100
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
101
+ }
102
+ }
103
+ );
104
+ }
105
+ );
106
+ C.displayName = I;
107
+ var eo = "DropdownMenuGroup", N = u.forwardRef(
108
+ (o, n) => {
109
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
110
+ return /* @__PURE__ */ a(H, { ...t, ...e, ref: n });
111
+ }
112
+ );
113
+ N.displayName = eo;
114
+ var ro = "DropdownMenuLabel", no = u.forwardRef(
115
+ (o, n) => {
116
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
117
+ return /* @__PURE__ */ a(X, { ...t, ...e, ref: n });
118
+ }
119
+ );
120
+ no.displayName = ro;
121
+ var to = "DropdownMenuItem", A = u.forwardRef(
122
+ (o, n) => {
123
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
124
+ return /* @__PURE__ */ a(B, { ...t, ...e, ref: n });
125
+ }
126
+ );
127
+ A.displayName = to;
128
+ var ao = "DropdownMenuCheckboxItem", po = u.forwardRef((o, n) => {
129
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
130
+ return /* @__PURE__ */ a(q, { ...t, ...e, ref: n });
131
+ });
132
+ po.displayName = ao;
133
+ var uo = "DropdownMenuRadioGroup", x = u.forwardRef((o, n) => {
134
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
135
+ return /* @__PURE__ */ a(j, { ...t, ...e, ref: n });
136
+ });
137
+ x.displayName = uo;
138
+ var io = "DropdownMenuRadioItem", so = u.forwardRef((o, n) => {
139
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
140
+ return /* @__PURE__ */ a(z, { ...t, ...e, ref: n });
141
+ });
142
+ so.displayName = io;
143
+ var co = "DropdownMenuItemIndicator", lo = u.forwardRef((o, n) => {
144
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
145
+ return /* @__PURE__ */ a(J, { ...t, ...e, ref: n });
146
+ });
147
+ lo.displayName = co;
148
+ var wo = "DropdownMenuSeparator", mo = u.forwardRef((o, n) => {
149
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
150
+ return /* @__PURE__ */ a(Q, { ...t, ...e, ref: n });
151
+ });
152
+ mo.displayName = wo;
153
+ var fo = "DropdownMenuArrow", Mo = u.forwardRef(
154
+ (o, n) => {
155
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
156
+ return /* @__PURE__ */ a(V, { ...t, ...e, ref: n });
157
+ }
158
+ );
159
+ Mo.displayName = fo;
160
+ var go = (o) => {
161
+ const { __scopeDropdownMenu: n, children: r, open: e, onOpenChange: t, defaultOpen: d } = o, s = i(n), [p, c] = v({
162
+ prop: e,
163
+ defaultProp: d ?? !1,
164
+ onChange: t,
165
+ caller: "DropdownMenuSub"
166
+ });
167
+ return /* @__PURE__ */ a(W, { ...s, open: p, onOpenChange: c, children: r });
168
+ }, vo = "DropdownMenuSubTrigger", P = u.forwardRef((o, n) => {
169
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
170
+ return /* @__PURE__ */ a($, { ...t, ...e, ref: n });
171
+ });
172
+ P.displayName = vo;
173
+ var Do = "DropdownMenuSubContent", E = u.forwardRef((o, n) => {
174
+ const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
175
+ return /* @__PURE__ */ a(
176
+ L,
177
+ {
178
+ ...t,
179
+ ...e,
180
+ ref: n,
181
+ style: {
182
+ ...o.style,
183
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
184
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
185
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
186
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
187
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
188
+ }
189
+ }
190
+ );
191
+ });
192
+ E.displayName = Do;
193
+ var Ao = h, xo = b, Po = S, Eo = C, Oo = N, yo = A, To = x, Go = go, ko = P, Lo = E;
194
+ export {
195
+ Eo as Content,
196
+ h as DropdownMenu,
197
+ Mo as DropdownMenuArrow,
198
+ po as DropdownMenuCheckboxItem,
199
+ C as DropdownMenuContent,
200
+ N as DropdownMenuGroup,
201
+ A as DropdownMenuItem,
202
+ lo as DropdownMenuItemIndicator,
203
+ no as DropdownMenuLabel,
204
+ S as DropdownMenuPortal,
205
+ x as DropdownMenuRadioGroup,
206
+ so as DropdownMenuRadioItem,
207
+ mo as DropdownMenuSeparator,
208
+ go as DropdownMenuSub,
209
+ E as DropdownMenuSubContent,
210
+ P as DropdownMenuSubTrigger,
211
+ b as DropdownMenuTrigger,
212
+ Oo as Group,
213
+ yo as Item,
214
+ Po as Portal,
215
+ To as RadioGroup,
216
+ Ao as Root,
217
+ Go as Sub,
218
+ Lo as SubContent,
219
+ ko as SubTrigger,
220
+ xo as Trigger
221
+ };
@@ -0,0 +1,17 @@
1
+ import * as r from "react";
2
+ var t = 0;
3
+ function a() {
4
+ r.useEffect(() => {
5
+ const e = document.querySelectorAll("[data-radix-focus-guard]");
6
+ return document.body.insertAdjacentElement("afterbegin", e[0] ?? n()), document.body.insertAdjacentElement("beforeend", e[1] ?? n()), t++, () => {
7
+ t === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((o) => o.remove()), t--;
8
+ };
9
+ }, []);
10
+ }
11
+ function n() {
12
+ const e = document.createElement("span");
13
+ return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
14
+ }
15
+ export {
16
+ a as useFocusGuards
17
+ };
@@ -0,0 +1,136 @@
1
+ import * as d from "react";
2
+ import { useComposedRefs as R } from "../../react-compose-refs/dist/index.js";
3
+ import { Primitive as M } from "../../react-primitive/dist/index.js";
4
+ import { useCallbackRef as y } from "../../react-use-callback-ref/dist/index.js";
5
+ import { jsx as _ } from "react/jsx-runtime";
6
+ var F = "focusScope.autoFocusOnMount", T = "focusScope.autoFocusOnUnmount", N = { bubbles: !1, cancelable: !0 }, K = "FocusScope", k = d.forwardRef((e, t) => {
7
+ const {
8
+ loop: n = !1,
9
+ trapped: u = !1,
10
+ onMountAutoFocus: p,
11
+ onUnmountAutoFocus: L,
12
+ ...g
13
+ } = e, [o, U] = d.useState(null), E = y(p), v = y(L), b = d.useRef(null), A = R(t, (s) => U(s)), a = d.useRef({
14
+ paused: !1,
15
+ pause() {
16
+ this.paused = !0;
17
+ },
18
+ resume() {
19
+ this.paused = !1;
20
+ }
21
+ }).current;
22
+ d.useEffect(() => {
23
+ if (u) {
24
+ let s = function(i) {
25
+ if (a.paused || !o) return;
26
+ const c = i.target;
27
+ o.contains(c) ? b.current = c : f(b.current, { select: !0 });
28
+ }, l = function(i) {
29
+ if (a.paused || !o) return;
30
+ const c = i.relatedTarget;
31
+ c !== null && (o.contains(c) || f(b.current, { select: !0 }));
32
+ }, r = function(i) {
33
+ if (document.activeElement === document.body)
34
+ for (const h of i)
35
+ h.removedNodes.length > 0 && f(o);
36
+ };
37
+ document.addEventListener("focusin", s), document.addEventListener("focusout", l);
38
+ const m = new MutationObserver(r);
39
+ return o && m.observe(o, { childList: !0, subtree: !0 }), () => {
40
+ document.removeEventListener("focusin", s), document.removeEventListener("focusout", l), m.disconnect();
41
+ };
42
+ }
43
+ }, [u, o, a.paused]), d.useEffect(() => {
44
+ if (o) {
45
+ O.add(a);
46
+ const s = document.activeElement;
47
+ if (!o.contains(s)) {
48
+ const r = new CustomEvent(F, N);
49
+ o.addEventListener(F, E), o.dispatchEvent(r), r.defaultPrevented || (w(W(I(o)), { select: !0 }), document.activeElement === s && f(o));
50
+ }
51
+ return () => {
52
+ o.removeEventListener(F, E), setTimeout(() => {
53
+ const r = new CustomEvent(T, N);
54
+ o.addEventListener(T, v), o.dispatchEvent(r), r.defaultPrevented || f(s ?? document.body, { select: !0 }), o.removeEventListener(T, v), O.remove(a);
55
+ }, 0);
56
+ };
57
+ }
58
+ }, [o, E, v, a]);
59
+ const P = d.useCallback(
60
+ (s) => {
61
+ if (!n && !u || a.paused) return;
62
+ const l = s.key === "Tab" && !s.altKey && !s.ctrlKey && !s.metaKey, r = document.activeElement;
63
+ if (l && r) {
64
+ const m = s.currentTarget, [i, c] = x(m);
65
+ i && c ? !s.shiftKey && r === c ? (s.preventDefault(), n && f(i, { select: !0 })) : s.shiftKey && r === i && (s.preventDefault(), n && f(c, { select: !0 })) : r === m && s.preventDefault();
66
+ }
67
+ },
68
+ [n, u, a.paused]
69
+ );
70
+ return /* @__PURE__ */ _(M.div, { tabIndex: -1, ...g, ref: A, onKeyDown: P });
71
+ });
72
+ k.displayName = K;
73
+ function w(e, { select: t = !1 } = {}) {
74
+ const n = document.activeElement;
75
+ for (const u of e)
76
+ if (f(u, { select: t }), document.activeElement !== n) return;
77
+ }
78
+ function x(e) {
79
+ const t = I(e), n = S(t, e), u = S(t.reverse(), e);
80
+ return [n, u];
81
+ }
82
+ function I(e) {
83
+ const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
84
+ acceptNode: (u) => {
85
+ const p = u.tagName === "INPUT" && u.type === "hidden";
86
+ return u.disabled || u.hidden || p ? NodeFilter.FILTER_SKIP : u.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
87
+ }
88
+ });
89
+ for (; n.nextNode(); ) t.push(n.currentNode);
90
+ return t;
91
+ }
92
+ function S(e, t) {
93
+ for (const n of e)
94
+ if (!D(n, { upTo: t })) return n;
95
+ }
96
+ function D(e, { upTo: t }) {
97
+ if (getComputedStyle(e).visibility === "hidden") return !0;
98
+ for (; e; ) {
99
+ if (t !== void 0 && e === t) return !1;
100
+ if (getComputedStyle(e).display === "none") return !0;
101
+ e = e.parentElement;
102
+ }
103
+ return !1;
104
+ }
105
+ function H(e) {
106
+ return e instanceof HTMLInputElement && "select" in e;
107
+ }
108
+ function f(e, { select: t = !1 } = {}) {
109
+ if (e && e.focus) {
110
+ const n = document.activeElement;
111
+ e.focus({ preventScroll: !0 }), e !== n && H(e) && t && e.select();
112
+ }
113
+ }
114
+ var O = V();
115
+ function V() {
116
+ let e = [];
117
+ return {
118
+ add(t) {
119
+ const n = e[0];
120
+ t !== n && n?.pause(), e = C(e, t), e.unshift(t);
121
+ },
122
+ remove(t) {
123
+ e = C(e, t), e[0]?.resume();
124
+ }
125
+ };
126
+ }
127
+ function C(e, t) {
128
+ const n = [...e], u = n.indexOf(t);
129
+ return u !== -1 && n.splice(u, 1), n;
130
+ }
131
+ function W(e) {
132
+ return e.filter((t) => t.tagName !== "A");
133
+ }
134
+ export {
135
+ k as FocusScope
136
+ };
@@ -0,0 +1,13 @@
1
+ import * as o from "react";
2
+ import { useLayoutEffect as a } from "../../react-use-layout-effect/dist/index.js";
3
+ var s = o[" useId ".trim().toString()] || (() => {
4
+ }), f = 0;
5
+ function i(t) {
6
+ const [e, r] = o.useState(s());
7
+ return a(() => {
8
+ r((u) => u ?? String(f++));
9
+ }, [t]), t || (e ? `radix-${e}` : "");
10
+ }
11
+ export {
12
+ i as useId
13
+ };