@vkzstudio/muza-ui 1.0.9 → 1.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.
- package/dist/components/Button/Button.d.ts +2 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +58 -55
- package/dist/components/Button/Button.stories.d.ts +2 -1
- package/dist/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Button/buttonVariants.d.ts +1 -1
- package/dist/components/Button/buttonVariants.d.ts.map +1 -1
- package/dist/components/Button/buttonVariants.js +6 -2
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +5 -4
- package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/components/Icons/CustomIcons.d.ts +1 -0
- package/dist/components/Icons/CustomIcons.d.ts.map +1 -1
- package/dist/components/Icons/CustomIcons.js +38 -27
- package/dist/components/Reorderable/Reorderable.d.ts +2 -0
- package/dist/components/Reorderable/Reorderable.d.ts.map +1 -1
- package/dist/components/Reorderable/Reorderable.js +80 -78
- package/dist/components/ReorderableTable/ReorderableTable.d.ts.map +1 -1
- package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts.map +1 -1
- package/dist/components/TextEditor/EditorToolbar.d.ts +18 -0
- package/dist/components/TextEditor/EditorToolbar.d.ts.map +1 -0
- package/dist/components/TextEditor/EditorToolbar.js +175 -0
- package/dist/components/TextEditor/LinkBubbleMenu.d.ts +52 -0
- package/dist/components/TextEditor/LinkBubbleMenu.d.ts.map +1 -0
- package/dist/components/TextEditor/LinkBubbleMenu.js +97 -0
- package/dist/components/TextEditor/TextEditor.d.ts +134 -0
- package/dist/components/TextEditor/TextEditor.d.ts.map +1 -0
- package/dist/components/TextEditor/TextEditor.js +240 -0
- package/dist/components/TextEditor/TextEditor.stories.d.ts +51 -0
- package/dist/components/TextEditor/TextEditor.stories.d.ts.map +1 -0
- package/dist/components/TextEditor/ToolbarButton.d.ts +38 -0
- package/dist/components/TextEditor/ToolbarButton.d.ts.map +1 -0
- package/dist/components/TextEditor/ToolbarButton.js +68 -0
- package/dist/components/TextEditor/ToolbarSeparator.d.ts +22 -0
- package/dist/components/TextEditor/ToolbarSeparator.d.ts.map +1 -0
- package/dist/components/TextEditor/ToolbarSeparator.js +23 -0
- package/dist/components/TextEditor/index.d.ts +4 -0
- package/dist/components/TextEditor/index.d.ts.map +1 -0
- package/dist/components/TextEditor/useLinkEditor.d.ts +37 -0
- package/dist/components/TextEditor/useLinkEditor.d.ts.map +1 -0
- package/dist/components/TextEditor/useLinkEditor.js +32 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.js +140 -132
- package/dist/muza-ui.css +1 -1
- package/dist/node_modules/@popperjs/core/lib/createPopper.js +122 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/contains.js +18 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js +23 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js +37 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js +32 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js +7 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js +17 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js +9 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js +13 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js +35 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js +18 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js +21 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindow.js +12 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js +11 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js +9 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js +20 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js +7 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js +8 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js +7 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js +16 -0
- package/dist/node_modules/@popperjs/core/lib/enums.js +31 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/applyStyles.js +47 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/arrow.js +37 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/computeStyles.js +99 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/eventListeners.js +26 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/flip.js +74 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/hide.js +44 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/offset.js +31 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js +19 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js +54 -0
- package/dist/node_modules/@popperjs/core/lib/popper.js +27 -0
- package/dist/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js +27 -0
- package/dist/node_modules/@popperjs/core/lib/utils/computeOffsets.js +54 -0
- package/dist/node_modules/@popperjs/core/lib/utils/debounce.js +13 -0
- package/dist/node_modules/@popperjs/core/lib/utils/detectOverflow.js +33 -0
- package/dist/node_modules/@popperjs/core/lib/utils/expandToHashMap.js +8 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getAltAxis.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getBasePlacement.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js +11 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js +14 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js +12 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getVariation.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/utils/math.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/utils/mergeByName.js +15 -0
- package/dist/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js +7 -0
- package/dist/node_modules/@popperjs/core/lib/utils/orderModifiers.js +31 -0
- package/dist/node_modules/@popperjs/core/lib/utils/rectToClientRect.js +11 -0
- package/dist/node_modules/@popperjs/core/lib/utils/userAgent.js +9 -0
- package/dist/node_modules/@popperjs/core/lib/utils/within.js +12 -0
- package/dist/node_modules/@tiptap/core/dist/index.js +2857 -0
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +45 -0
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js +76 -0
- package/dist/node_modules/@tiptap/extension-bubble-menu/dist/index.js +129 -0
- package/dist/node_modules/@tiptap/extension-bullet-list/dist/index.js +55 -0
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +54 -0
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +136 -0
- package/dist/node_modules/@tiptap/extension-document/dist/index.js +10 -0
- package/dist/node_modules/@tiptap/extension-dropcursor/dist/index.js +21 -0
- package/dist/node_modules/@tiptap/extension-gapcursor/dist/index.js +25 -0
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +56 -0
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +55 -0
- package/dist/node_modules/@tiptap/extension-history/dist/index.js +36 -0
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +59 -0
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js +75 -0
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +272 -0
- package/dist/node_modules/@tiptap/extension-list-item/dist/index.js +34 -0
- package/dist/node_modules/@tiptap/extension-ordered-list/dist/index.js +73 -0
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +34 -0
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +53 -0
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js +64 -0
- package/dist/node_modules/@tiptap/extension-text/dist/index.js +9 -0
- package/dist/node_modules/@tiptap/react/dist/index.js +709 -0
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js +30 -0
- package/dist/node_modules/linkifyjs/dist/linkify.js +707 -0
- package/dist/node_modules/orderedmap/dist/index.js +103 -0
- package/dist/node_modules/prosemirror-commands/dist/index.js +388 -0
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
- package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
- package/dist/node_modules/prosemirror-keymap/dist/index.js +62 -0
- package/dist/node_modules/prosemirror-model/dist/index.js +2733 -0
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +88 -0
- package/dist/node_modules/prosemirror-state/dist/index.js +822 -0
- package/dist/node_modules/prosemirror-transform/dist/index.js +1520 -0
- package/dist/node_modules/prosemirror-view/dist/index.js +3794 -0
- package/dist/node_modules/rope-sequence/dist/index.js +100 -0
- package/dist/node_modules/tippy.js/dist/tippy.esm.js +813 -0
- package/dist/node_modules/w3c-keyname/index.js +93 -0
- package/dist/translations/locales/cs.d.ts.map +1 -1
- package/dist/translations/locales/cs.js +18 -0
- package/dist/translations/locales/en.d.ts.map +1 -1
- package/dist/translations/locales/en.js +18 -0
- package/dist/translations/locales/sk.d.ts.map +1 -1
- package/dist/translations/locales/sk.js +18 -0
- package/dist/translations/types.d.ts +22 -0
- package/dist/translations/types.d.ts.map +1 -1
- package/package.json +17 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
2
|
+
import { forwardRef as I, useContext as P, useRef as _, useCallback as A, createContext as E } from "react";
|
|
3
3
|
import { useMuzaTranslations as K } from "../../translations/TranslationContext.js";
|
|
4
4
|
import { useDragControls as S } from "../../node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js";
|
|
5
5
|
import { motion as O } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
6
|
-
import { cn as
|
|
6
|
+
import { cn as x } from "../../utils/cn.js";
|
|
7
7
|
import { ReorderGroup as U } from "../../node_modules/framer-motion/dist/es/components/Reorder/Group.js";
|
|
8
8
|
import { ReorderItem as Y } from "../../node_modules/framer-motion/dist/es/components/Reorder/Item.js";
|
|
9
9
|
const k = E({}), z = 50, N = 3, M = () => P(k), H = E(null), j = () => {
|
|
@@ -13,19 +13,19 @@ const k = E({}), z = 50, N = 3, M = () => P(k), H = E(null), j = () => {
|
|
|
13
13
|
return r;
|
|
14
14
|
}, V = ({
|
|
15
15
|
values: r,
|
|
16
|
-
onReorder:
|
|
16
|
+
onReorder: a,
|
|
17
17
|
axis: l = "y",
|
|
18
18
|
as: c = "ol",
|
|
19
19
|
disabled: o = !1,
|
|
20
20
|
layoutScroll: b = !1,
|
|
21
|
-
style:
|
|
22
|
-
className:
|
|
23
|
-
children:
|
|
24
|
-
},
|
|
25
|
-
const
|
|
21
|
+
style: D,
|
|
22
|
+
className: g,
|
|
23
|
+
children: y
|
|
24
|
+
}, m) => {
|
|
25
|
+
const s = K(), f = {
|
|
26
26
|
disabled: o,
|
|
27
27
|
values: r,
|
|
28
|
-
onReorder: o ? void 0 :
|
|
28
|
+
onReorder: o ? void 0 : a,
|
|
29
29
|
axis: l
|
|
30
30
|
};
|
|
31
31
|
return /* @__PURE__ */ u(
|
|
@@ -35,124 +35,126 @@ const k = E({}), z = 50, N = 3, M = () => P(k), H = E(null), j = () => {
|
|
|
35
35
|
children: /* @__PURE__ */ u(
|
|
36
36
|
U,
|
|
37
37
|
{
|
|
38
|
-
ref:
|
|
38
|
+
ref: m,
|
|
39
39
|
axis: l,
|
|
40
40
|
values: r,
|
|
41
41
|
onReorder: o ? () => {
|
|
42
|
-
} :
|
|
42
|
+
} : a,
|
|
43
43
|
as: c,
|
|
44
44
|
layoutScroll: b,
|
|
45
|
-
style:
|
|
45
|
+
style: D,
|
|
46
46
|
role: "list",
|
|
47
|
-
"aria-label":
|
|
48
|
-
className:
|
|
49
|
-
children:
|
|
47
|
+
"aria-label": s.reorderableTable.listAriaLabel,
|
|
48
|
+
className: x(g),
|
|
49
|
+
children: y
|
|
50
50
|
}
|
|
51
51
|
)
|
|
52
52
|
}
|
|
53
53
|
);
|
|
54
|
-
}, Z =
|
|
54
|
+
}, Z = I(V);
|
|
55
55
|
Z.displayName = "ReorderableGroup";
|
|
56
56
|
const q = ({
|
|
57
57
|
value: r,
|
|
58
|
-
as:
|
|
58
|
+
as: a = "li",
|
|
59
59
|
disabled: l = !1,
|
|
60
60
|
dragListenerDisabled: c = !1,
|
|
61
61
|
whileDrag: o,
|
|
62
62
|
className: b,
|
|
63
|
-
children:
|
|
64
|
-
|
|
63
|
+
children: D,
|
|
64
|
+
style: g
|
|
65
|
+
}, y) => {
|
|
65
66
|
const {
|
|
66
|
-
disabled:
|
|
67
|
-
values:
|
|
68
|
-
onReorder:
|
|
69
|
-
axis:
|
|
70
|
-
} = M(),
|
|
71
|
-
(
|
|
72
|
-
if (!
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
|
|
67
|
+
disabled: m,
|
|
68
|
+
values: s,
|
|
69
|
+
onReorder: f,
|
|
70
|
+
axis: p
|
|
71
|
+
} = M(), t = S(), v = l || m, d = !v && !c, w = A(
|
|
72
|
+
(n) => {
|
|
73
|
+
if (!s || !f) return;
|
|
74
|
+
const e = s.indexOf(r);
|
|
75
|
+
if (e === -1) return;
|
|
76
|
+
const i = e + n;
|
|
77
|
+
if (i < 0 || i >= s.length) return;
|
|
78
|
+
const R = [...s];
|
|
79
|
+
R.splice(e, 1), R.splice(i, 0, r), f(R);
|
|
79
80
|
},
|
|
80
|
-
[
|
|
81
|
-
),
|
|
82
|
-
(
|
|
83
|
-
if (!
|
|
84
|
-
const
|
|
85
|
-
|
|
81
|
+
[s, f, r]
|
|
82
|
+
), h = A(
|
|
83
|
+
(n) => {
|
|
84
|
+
if (!d) return;
|
|
85
|
+
const e = p === "y" ? "ArrowUp" : "ArrowLeft", i = p === "y" ? "ArrowDown" : "ArrowRight";
|
|
86
|
+
n.key === e ? (n.preventDefault(), w(-1)) : n.key === i && (n.preventDefault(), w(1));
|
|
86
87
|
},
|
|
87
|
-
[
|
|
88
|
+
[d, p, w]
|
|
88
89
|
);
|
|
89
90
|
return /* @__PURE__ */ u(
|
|
90
91
|
H.Provider,
|
|
91
92
|
{
|
|
92
|
-
value: { dragControls:
|
|
93
|
+
value: { dragControls: t, dragListenerDisabled: c, moveItem: w },
|
|
93
94
|
children: /* @__PURE__ */ u(
|
|
94
95
|
Y,
|
|
95
96
|
{
|
|
96
|
-
ref:
|
|
97
|
+
ref: y,
|
|
97
98
|
value: r,
|
|
98
|
-
as:
|
|
99
|
-
dragControls:
|
|
100
|
-
dragListener:
|
|
101
|
-
tabIndex:
|
|
99
|
+
as: a,
|
|
100
|
+
dragControls: t,
|
|
101
|
+
dragListener: d,
|
|
102
|
+
tabIndex: d ? 0 : void 0,
|
|
102
103
|
role: "listitem",
|
|
103
|
-
"aria-disabled":
|
|
104
|
-
onKeyDown:
|
|
105
|
-
className:
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
"aria-disabled": v,
|
|
105
|
+
onKeyDown: h,
|
|
106
|
+
className: x(
|
|
107
|
+
d && "cursor-grab active:cursor-grabbing",
|
|
108
|
+
d && "focus-visible-default",
|
|
108
109
|
b
|
|
109
110
|
),
|
|
111
|
+
style: g,
|
|
110
112
|
whileDrag: {
|
|
111
113
|
zIndex: z,
|
|
112
114
|
position: "relative",
|
|
113
115
|
...o
|
|
114
116
|
},
|
|
115
|
-
children:
|
|
117
|
+
children: D
|
|
116
118
|
}
|
|
117
119
|
)
|
|
118
120
|
}
|
|
119
121
|
);
|
|
120
|
-
}, B =
|
|
122
|
+
}, B = I(q);
|
|
121
123
|
B.displayName = "ReorderableItem";
|
|
122
|
-
const F =
|
|
124
|
+
const F = I(
|
|
123
125
|
({
|
|
124
126
|
as: r = "button",
|
|
125
|
-
disabled:
|
|
127
|
+
disabled: a = !1,
|
|
126
128
|
"aria-label": l,
|
|
127
129
|
className: c,
|
|
128
130
|
children: o
|
|
129
131
|
}, b) => {
|
|
130
|
-
const
|
|
132
|
+
const D = K(), g = l ?? D.reorderableTable.dragHandleAriaLabel, { disabled: y, axis: m } = M(), { dragControls: s, dragListenerDisabled: f, moveItem: p } = j(), t = f && !y && !a, v = _(!1), d = (e) => {
|
|
131
133
|
if (!t) return;
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
const T = Math.abs(G.clientX -
|
|
135
|
-
(T > N || X > N) && (
|
|
134
|
+
v.current = !1;
|
|
135
|
+
const i = e.clientX, R = e.clientY, L = (G) => {
|
|
136
|
+
const T = Math.abs(G.clientX - i), X = Math.abs(G.clientY - R);
|
|
137
|
+
(T > N || X > N) && (v.current = !0);
|
|
136
138
|
}, C = () => {
|
|
137
139
|
document.removeEventListener("pointermove", L), document.removeEventListener("pointerup", C);
|
|
138
140
|
};
|
|
139
|
-
document.addEventListener("pointermove", L), document.addEventListener("pointerup", C),
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
},
|
|
141
|
+
document.addEventListener("pointermove", L), document.addEventListener("pointerup", C), s.start(e);
|
|
142
|
+
}, w = (e) => {
|
|
143
|
+
v.current && (e.stopPropagation(), v.current = !1);
|
|
144
|
+
}, h = A(
|
|
143
145
|
(e) => {
|
|
144
146
|
if (!t) return;
|
|
145
|
-
const
|
|
146
|
-
e.key ===
|
|
147
|
+
const i = m === "y" ? "ArrowUp" : "ArrowLeft", R = m === "y" ? "ArrowDown" : "ArrowRight";
|
|
148
|
+
e.key === i ? (e.preventDefault(), p(-1)) : e.key === R && (e.preventDefault(), p(1));
|
|
147
149
|
},
|
|
148
|
-
[t,
|
|
149
|
-
),
|
|
150
|
-
"aria-label":
|
|
150
|
+
[t, m, p]
|
|
151
|
+
), n = {
|
|
152
|
+
"aria-label": g,
|
|
151
153
|
"aria-roledescription": "sortable",
|
|
152
|
-
onPointerDown:
|
|
153
|
-
onKeyDown:
|
|
154
|
-
onClick:
|
|
155
|
-
className:
|
|
154
|
+
onPointerDown: d,
|
|
155
|
+
onKeyDown: h,
|
|
156
|
+
onClick: w,
|
|
157
|
+
className: x(
|
|
156
158
|
"touch-none select-none",
|
|
157
159
|
t && "cursor-grab active:cursor-grabbing",
|
|
158
160
|
!t && "cursor-default",
|
|
@@ -160,13 +162,13 @@ const F = y(
|
|
|
160
162
|
c
|
|
161
163
|
)
|
|
162
164
|
};
|
|
163
|
-
return r === "button" ? /* @__PURE__ */ u("button", { ref: b, type: "button", disabled:
|
|
165
|
+
return r === "button" ? /* @__PURE__ */ u("button", { ref: b, type: "button", disabled: a, ...n, children: o }) : r === "div" ? /* @__PURE__ */ u(
|
|
164
166
|
"div",
|
|
165
167
|
{
|
|
166
168
|
ref: b,
|
|
167
169
|
tabIndex: t ? 0 : void 0,
|
|
168
170
|
role: t ? "button" : void 0,
|
|
169
|
-
...
|
|
171
|
+
...n,
|
|
170
172
|
children: o
|
|
171
173
|
}
|
|
172
174
|
) : /* @__PURE__ */ u(
|
|
@@ -175,17 +177,17 @@ const F = y(
|
|
|
175
177
|
ref: b,
|
|
176
178
|
tabIndex: t ? 0 : void 0,
|
|
177
179
|
role: t ? "button" : void 0,
|
|
178
|
-
...
|
|
180
|
+
...n,
|
|
179
181
|
children: o
|
|
180
182
|
}
|
|
181
183
|
);
|
|
182
184
|
}
|
|
183
185
|
);
|
|
184
186
|
F.displayName = "ReorderableHandle";
|
|
185
|
-
const J = ({ as: r = "li", className:
|
|
187
|
+
const J = ({ as: r = "li", className: a, children: l }, c) => {
|
|
186
188
|
const o = O[r];
|
|
187
|
-
return /* @__PURE__ */ u(o, { ref: c, layout: !0, role: "listitem", className:
|
|
188
|
-
}, Q =
|
|
189
|
+
return /* @__PURE__ */ u(o, { ref: c, layout: !0, role: "listitem", className: x(a), children: l });
|
|
190
|
+
}, Q = I(J);
|
|
189
191
|
Q.displayName = "ReorderableStaticItem";
|
|
190
192
|
export {
|
|
191
193
|
Z as ReorderableGroup,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReorderableTable.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/ReorderableTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAWrE,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC,CAAA;IAChB,yBAAyB;IACzB,KAAK,EAAE,SAAS,CAAA;IAChB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAA;IAC3B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAA;CACxE;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CACtE,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAChE,2DAA2D;IAC3D,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,uCAAuC;IACvC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,IAAI,CAAA;IAClC,yBAAyB;IACzB,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAA;IACpC,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAA;IACzD,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;
|
|
1
|
+
{"version":3,"file":"ReorderableTable.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/ReorderableTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAWrE,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC,CAAA;IAChB,yBAAyB;IACzB,KAAK,EAAE,SAAS,CAAA;IAChB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAA;IAC3B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAA;CACxE;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CACtE,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAChE,2DAA2D;IAC3D,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,uCAAuC;IACvC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,IAAI,CAAA;IAClC,yBAAyB;IACzB,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAA;IACpC,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAA;IACzD,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAiOD,QAAA,MAAM,gBAAgB,EAAwC,CAC5D,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAEjC,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAA;CAAE,KACvE,KAAK,CAAC,YAAY,CACtB;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReorderableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/ReorderableTable.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAM3D,OAAO,EACL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAA;AAE3B,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;CAC9B;AAyCD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ReorderableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/ReorderableTable.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAM3D,OAAO,EACL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAA;AAE3B,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;CAC9B;AAyCD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAuEvC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAA;AAExD,eAAO,MAAM,OAAO,EAAE,KAkHrB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAsG3B,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KA2G7B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAkG3B,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { TextEditorTranslations } from '../../translations/types';
|
|
4
|
+
import { TextEditorToolbarConfig } from './TextEditor';
|
|
5
|
+
export interface EditorToolbarProps {
|
|
6
|
+
editor: Editor | null;
|
|
7
|
+
toolbarConfig: Required<TextEditorToolbarConfig>;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
translations: TextEditorTranslations;
|
|
10
|
+
onLinkClick: () => void;
|
|
11
|
+
toolbarExtra?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Internal toolbar component for TextEditor.
|
|
15
|
+
* Renders toolbar buttons based on the provided configuration.
|
|
16
|
+
*/
|
|
17
|
+
export declare const EditorToolbar: ({ editor, toolbarConfig, disabled, translations: t, onLinkClick, toolbarExtra, }: EditorToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=EditorToolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/TextEditor/EditorToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAgBlE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAI3D,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,aAAa,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAA;IAChD,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,sBAAsB,CAAA;IACpC,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,YAAY,CAAC,EAAE,SAAS,CAAA;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,kFAO3B,kBAAkB,4CAoLpB,CAAA"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { jsxs as u, Fragment as m, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { ToolbarButton as h } from "./ToolbarButton.js";
|
|
3
|
+
import { ToolbarSeparator as e } from "./ToolbarSeparator.js";
|
|
4
|
+
import { Flex as v } from "../Flex/Flex.js";
|
|
5
|
+
import { TextH1 as B, TextH2 as L, TextH3 as A, BulletList as T, NumberList as i } from "../Icons/CustomIcons.js";
|
|
6
|
+
import { UndoLeftBold as H, UndoRightBold as y, TextBoldBold as F, TextItalicBold as w, TextCrossBold as I, LinkRoundBold as N, EraserBold as S } from "@solar-icons/react-perf";
|
|
7
|
+
const O = ({
|
|
8
|
+
editor: l,
|
|
9
|
+
toolbarConfig: c,
|
|
10
|
+
disabled: a,
|
|
11
|
+
translations: s,
|
|
12
|
+
onLinkClick: x,
|
|
13
|
+
toolbarExtra: p
|
|
14
|
+
}) => {
|
|
15
|
+
const g = (k, f) => typeof k == "boolean" ? k : k.includes(f);
|
|
16
|
+
return /* @__PURE__ */ u(
|
|
17
|
+
v,
|
|
18
|
+
{
|
|
19
|
+
wrap: "wrap",
|
|
20
|
+
align: "center",
|
|
21
|
+
gap: "md",
|
|
22
|
+
padding: { px: "2xl", py: "md" },
|
|
23
|
+
className: "border-b border-comp-texteditor-stroke-def",
|
|
24
|
+
children: [
|
|
25
|
+
c.history !== !1 && /* @__PURE__ */ u(m, { children: [
|
|
26
|
+
/* @__PURE__ */ u(v, { align: "center", gap: "3xs", children: [
|
|
27
|
+
g(c.history, "undo") && /* @__PURE__ */ n(
|
|
28
|
+
h,
|
|
29
|
+
{
|
|
30
|
+
icon: /* @__PURE__ */ n(H, {}),
|
|
31
|
+
onClick: () => l == null ? void 0 : l.chain().focus().undo().run(),
|
|
32
|
+
disabled: a || !(l != null && l.can().undo()),
|
|
33
|
+
label: s.undo
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
g(c.history, "redo") && /* @__PURE__ */ n(
|
|
37
|
+
h,
|
|
38
|
+
{
|
|
39
|
+
icon: /* @__PURE__ */ n(y, {}),
|
|
40
|
+
onClick: () => l == null ? void 0 : l.chain().focus().redo().run(),
|
|
41
|
+
disabled: a || !(l != null && l.can().redo()),
|
|
42
|
+
label: s.redo
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ n(e, {})
|
|
47
|
+
] }),
|
|
48
|
+
c.headings !== !1 && /* @__PURE__ */ u(m, { children: [
|
|
49
|
+
/* @__PURE__ */ u(v, { align: "center", gap: "3xs", children: [
|
|
50
|
+
g(c.headings, 1) && /* @__PURE__ */ n(
|
|
51
|
+
h,
|
|
52
|
+
{
|
|
53
|
+
icon: /* @__PURE__ */ n(B, {}),
|
|
54
|
+
onClick: () => l == null ? void 0 : l.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
55
|
+
active: l == null ? void 0 : l.isActive("heading", { level: 1 }),
|
|
56
|
+
disabled: a,
|
|
57
|
+
label: s.heading1
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
g(c.headings, 2) && /* @__PURE__ */ n(
|
|
61
|
+
h,
|
|
62
|
+
{
|
|
63
|
+
icon: /* @__PURE__ */ n(L, {}),
|
|
64
|
+
onClick: () => l == null ? void 0 : l.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
65
|
+
active: l == null ? void 0 : l.isActive("heading", { level: 2 }),
|
|
66
|
+
disabled: a,
|
|
67
|
+
label: s.heading2
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
g(c.headings, 3) && /* @__PURE__ */ n(
|
|
71
|
+
h,
|
|
72
|
+
{
|
|
73
|
+
icon: /* @__PURE__ */ n(A, {}),
|
|
74
|
+
onClick: () => l == null ? void 0 : l.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
75
|
+
active: l == null ? void 0 : l.isActive("heading", { level: 3 }),
|
|
76
|
+
disabled: a,
|
|
77
|
+
label: s.heading3
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ n(e, {})
|
|
82
|
+
] }),
|
|
83
|
+
c.formatting !== !1 && /* @__PURE__ */ u(m, { children: [
|
|
84
|
+
/* @__PURE__ */ u(v, { align: "center", gap: "3xs", children: [
|
|
85
|
+
g(c.formatting, "bold") && /* @__PURE__ */ n(
|
|
86
|
+
h,
|
|
87
|
+
{
|
|
88
|
+
icon: /* @__PURE__ */ n(F, {}),
|
|
89
|
+
onClick: () => l == null ? void 0 : l.chain().focus().toggleBold().run(),
|
|
90
|
+
active: l == null ? void 0 : l.isActive("bold"),
|
|
91
|
+
disabled: a,
|
|
92
|
+
label: s.bold
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
g(c.formatting, "italic") && /* @__PURE__ */ n(
|
|
96
|
+
h,
|
|
97
|
+
{
|
|
98
|
+
icon: /* @__PURE__ */ n(w, {}),
|
|
99
|
+
onClick: () => l == null ? void 0 : l.chain().focus().toggleItalic().run(),
|
|
100
|
+
active: l == null ? void 0 : l.isActive("italic"),
|
|
101
|
+
disabled: a,
|
|
102
|
+
label: s.italic
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
g(c.formatting, "strikethrough") && /* @__PURE__ */ n(
|
|
106
|
+
h,
|
|
107
|
+
{
|
|
108
|
+
icon: /* @__PURE__ */ n(I, {}),
|
|
109
|
+
onClick: () => l == null ? void 0 : l.chain().focus().toggleStrike().run(),
|
|
110
|
+
active: l == null ? void 0 : l.isActive("strike"),
|
|
111
|
+
disabled: a,
|
|
112
|
+
label: s.strikethrough
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ n(e, {})
|
|
117
|
+
] }),
|
|
118
|
+
c.lists !== !1 && /* @__PURE__ */ u(m, { children: [
|
|
119
|
+
/* @__PURE__ */ u(v, { align: "center", gap: "3xs", children: [
|
|
120
|
+
g(c.lists, "bullet") && /* @__PURE__ */ n(
|
|
121
|
+
h,
|
|
122
|
+
{
|
|
123
|
+
icon: /* @__PURE__ */ n(T, {}),
|
|
124
|
+
onClick: () => l == null ? void 0 : l.chain().focus().toggleBulletList().run(),
|
|
125
|
+
active: l == null ? void 0 : l.isActive("bulletList"),
|
|
126
|
+
disabled: a,
|
|
127
|
+
label: s.bulletList
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
g(c.lists, "ordered") && /* @__PURE__ */ n(
|
|
131
|
+
h,
|
|
132
|
+
{
|
|
133
|
+
icon: /* @__PURE__ */ n(i, {}),
|
|
134
|
+
onClick: () => l == null ? void 0 : l.chain().focus().toggleOrderedList().run(),
|
|
135
|
+
active: l == null ? void 0 : l.isActive("orderedList"),
|
|
136
|
+
disabled: a,
|
|
137
|
+
label: s.orderedList
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] }),
|
|
141
|
+
/* @__PURE__ */ n(e, {})
|
|
142
|
+
] }),
|
|
143
|
+
c.link && /* @__PURE__ */ u(m, { children: [
|
|
144
|
+
/* @__PURE__ */ n(
|
|
145
|
+
h,
|
|
146
|
+
{
|
|
147
|
+
icon: /* @__PURE__ */ n(N, {}),
|
|
148
|
+
onClick: x,
|
|
149
|
+
active: l == null ? void 0 : l.isActive("link"),
|
|
150
|
+
disabled: a,
|
|
151
|
+
label: s.insertLink
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ n(e, {})
|
|
155
|
+
] }),
|
|
156
|
+
c.clearFormatting && /* @__PURE__ */ u(m, { children: [
|
|
157
|
+
/* @__PURE__ */ n(
|
|
158
|
+
h,
|
|
159
|
+
{
|
|
160
|
+
icon: /* @__PURE__ */ n(S, {}),
|
|
161
|
+
onClick: () => l == null ? void 0 : l.chain().focus().unsetAllMarks().clearNodes().run(),
|
|
162
|
+
disabled: a,
|
|
163
|
+
label: s.clearFormatting
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
p && /* @__PURE__ */ n(e, {})
|
|
167
|
+
] }),
|
|
168
|
+
p
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
export {
|
|
174
|
+
O as EditorToolbar
|
|
175
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
/**
|
|
3
|
+
* Translations for the LinkBubbleMenu component.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface LinkBubbleMenuTranslations {
|
|
7
|
+
/** Text for the save button */
|
|
8
|
+
saveButton: string;
|
|
9
|
+
/** Text for the cancel button */
|
|
10
|
+
cancelButton: string;
|
|
11
|
+
/** Aria label for the edit button */
|
|
12
|
+
editButton: string;
|
|
13
|
+
/** Aria label for the remove button */
|
|
14
|
+
removeButton: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Props for the LinkBubbleMenu component.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export interface LinkBubbleMenuProps {
|
|
21
|
+
/** The TipTap editor instance */
|
|
22
|
+
editor: Editor;
|
|
23
|
+
/** Current URL value in the input */
|
|
24
|
+
linkUrl: string;
|
|
25
|
+
/** Whether the edit input is visible */
|
|
26
|
+
isEditingLink: boolean;
|
|
27
|
+
/** Fires when the URL input value changes */
|
|
28
|
+
onUrlChange: (url: string) => void;
|
|
29
|
+
/** Fires when the edit button is clicked */
|
|
30
|
+
onEdit: () => void;
|
|
31
|
+
/** Fires when the save button is clicked or Enter is pressed */
|
|
32
|
+
onSave: () => void;
|
|
33
|
+
/** Fires when the remove button is clicked */
|
|
34
|
+
onRemove: () => void;
|
|
35
|
+
/** Fires when the cancel button is clicked or Escape is pressed */
|
|
36
|
+
onCancel: () => void;
|
|
37
|
+
/** Translation strings */
|
|
38
|
+
translations: LinkBubbleMenuTranslations;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Bubble menu for editing links in the TextEditor.
|
|
42
|
+
*
|
|
43
|
+
* Shows when a link is selected, displaying either:
|
|
44
|
+
* - View mode: Link URL with edit/remove buttons
|
|
45
|
+
* - Edit mode: Input field with save/cancel buttons
|
|
46
|
+
*
|
|
47
|
+
* Supports keyboard shortcuts: Enter to save, Escape to cancel.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare const LinkBubbleMenu: ({ editor, linkUrl, isEditingLink, onUrlChange, onEdit, onSave, onRemove, onCancel, translations, }: LinkBubbleMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
//# sourceMappingURL=LinkBubbleMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkBubbleMenu.d.ts","sourceRoot":"","sources":["../../../src/components/TextEditor/LinkBubbleMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,eAAe,CAAA;AAKvD;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAA;IACpB,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,wCAAwC;IACxC,aAAa,EAAE,OAAO,CAAA;IACtB,6CAA6C;IAC7C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,4CAA4C;IAC5C,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,gEAAgE;IAChE,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,mEAAmE;IACnE,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,0BAA0B;IAC1B,YAAY,EAAE,0BAA0B,CAAA;CACzC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAI,oGAU5B,mBAAmB,4CAmFrB,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import { BubbleMenu as b } from "../../node_modules/@tiptap/react/dist/index.js";
|
|
3
|
+
import { Flex as a } from "../Flex/Flex.js";
|
|
4
|
+
import { Button as s } from "../Button/Button.js";
|
|
5
|
+
import { Pen2Bold as h, TrashBinTrashBold as x } from "@solar-icons/react-perf";
|
|
6
|
+
const N = ({
|
|
7
|
+
editor: o,
|
|
8
|
+
linkUrl: c,
|
|
9
|
+
isEditingLink: u,
|
|
10
|
+
onUrlChange: p,
|
|
11
|
+
onEdit: d,
|
|
12
|
+
onSave: l,
|
|
13
|
+
onRemove: m,
|
|
14
|
+
onCancel: i,
|
|
15
|
+
translations: r
|
|
16
|
+
}) => /* @__PURE__ */ e(
|
|
17
|
+
b,
|
|
18
|
+
{
|
|
19
|
+
editor: o,
|
|
20
|
+
tippyOptions: {
|
|
21
|
+
duration: 150,
|
|
22
|
+
placement: "top",
|
|
23
|
+
popperOptions: {
|
|
24
|
+
modifiers: [
|
|
25
|
+
{
|
|
26
|
+
name: "flip",
|
|
27
|
+
options: {
|
|
28
|
+
fallbackPlacements: ["top"]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
shouldShow: ({ editor: t }) => t.isActive("link"),
|
|
35
|
+
children: /* @__PURE__ */ e(
|
|
36
|
+
a,
|
|
37
|
+
{
|
|
38
|
+
direction: "column",
|
|
39
|
+
className: "gap-2 rounded-xl bg-surface-base-secondary p-3 shadow-lg",
|
|
40
|
+
children: u ? /* @__PURE__ */ n(f, { children: [
|
|
41
|
+
/* @__PURE__ */ e(
|
|
42
|
+
"input",
|
|
43
|
+
{
|
|
44
|
+
type: "text",
|
|
45
|
+
value: c,
|
|
46
|
+
onChange: (t) => p(t.target.value),
|
|
47
|
+
onKeyDown: (t) => {
|
|
48
|
+
t.key === "Enter" && (t.preventDefault(), l()), t.key === "Escape" && i();
|
|
49
|
+
},
|
|
50
|
+
placeholder: "https://...",
|
|
51
|
+
className: "w-64 rounded-lg border border-comp-input-stroke-def bg-comp-input-fill-def px-3 py-2 text-sm outline-none focus:border-comp-input-stroke-focused",
|
|
52
|
+
autoFocus: !0
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ n(a, { justify: "end", className: "w-full gap-2", children: [
|
|
56
|
+
/* @__PURE__ */ e(s, { size: "xs", variant: "secondary", ghost: !0, onClick: i, children: r.cancelButton }),
|
|
57
|
+
/* @__PURE__ */ e(s, { size: "xs", onClick: l, children: r.saveButton })
|
|
58
|
+
] })
|
|
59
|
+
] }) : /* @__PURE__ */ n(a, { align: "center", className: "gap-2", children: [
|
|
60
|
+
/* @__PURE__ */ e(
|
|
61
|
+
"a",
|
|
62
|
+
{
|
|
63
|
+
href: o.getAttributes("link").href,
|
|
64
|
+
target: "_blank",
|
|
65
|
+
rel: "noopener noreferrer",
|
|
66
|
+
className: "max-w-48 flex-1 truncate text-sm text-text-brand-def hover:underline",
|
|
67
|
+
children: o.getAttributes("link").href
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ e(
|
|
71
|
+
"button",
|
|
72
|
+
{
|
|
73
|
+
type: "button",
|
|
74
|
+
onClick: d,
|
|
75
|
+
className: "cursor-pointer rounded p-1 text-text-brand-def hover:bg-surface-base-tertiary",
|
|
76
|
+
"aria-label": r.editButton,
|
|
77
|
+
children: /* @__PURE__ */ e(h, { className: "size-icon-xsmall" })
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ e(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
type: "button",
|
|
84
|
+
onClick: m,
|
|
85
|
+
className: "cursor-pointer rounded p-1 text-text-brand-def hover:bg-surface-base-tertiary",
|
|
86
|
+
"aria-label": r.removeButton,
|
|
87
|
+
children: /* @__PURE__ */ e(x, { className: "size-icon-xsmall" })
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
] })
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
export {
|
|
96
|
+
N as LinkBubbleMenu
|
|
97
|
+
};
|