@robuust-digital/vue-components 2.1.0 → 2.2.0-rc.0
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/CHANGELOG.md +6 -0
- package/dist/_shared/ButtonBase.vue_vue_type_script_setup_true_lang-B0YsKehI.js +60 -0
- package/dist/_shared/ChevronDownIcon-DaaXfD3C.js +41 -0
- package/dist/_shared/Combobox.vue_vue_type_script_setup_true_lang-D1vKMJok.js +266 -0
- package/dist/_shared/Drawer.vue_vue_type_script_setup_true_lang-DT6tBBZ7.js +186 -0
- package/dist/_shared/Dropdown.vue_vue_type_script_setup_true_lang-D5vTFLkq.js +115 -0
- package/dist/_shared/FormInput.vue_vue_type_script_setup_true_lang-BhJpG-Fw.js +75 -0
- package/dist/_shared/Lightswitch.vue_vue_type_script_setup_true_lang-CvN-2WJt.js +44 -0
- package/dist/_shared/Modal.vue_vue_type_script_setup_true_lang-DBEOIZnO.js +187 -0
- package/dist/_shared/RichTextEditor.vue_vue_type_script_setup_true_lang-Bs4WdJhA.js +274 -0
- package/dist/_shared/Tabs.vue_vue_type_script_setup_true_lang-CsGx6wBK.js +676 -0
- package/dist/_shared/Toast.vue_vue_type_script_setup_true_lang-FEeRXoIx.js +75 -0
- package/dist/_shared/Tooltip.vue_vue_type_script_setup_true_lang-CoydN9sS.js +96 -0
- package/dist/combobox/index.js +3 -347
- package/dist/combobox.d.ts +4 -0
- package/dist/components/Accordion.vue.d.ts +37 -0
- package/dist/components/Alert.vue.d.ts +39 -0
- package/dist/components/Badge.vue.d.ts +32 -0
- package/dist/components/ButtonBase.vue.d.ts +50 -0
- package/dist/components/Checkbox.vue.d.ts +39 -0
- package/dist/components/Combobox.vue.d.ts +112 -0
- package/dist/components/DataTable.vue.d.ts +122 -0
- package/dist/components/Drawer.vue.d.ts +103 -0
- package/dist/components/Dropdown.vue.d.ts +120 -0
- package/dist/components/EmptyState.vue.d.ts +23 -0
- package/dist/components/FormInput.vue.d.ts +49 -0
- package/dist/components/FormSelect.vue.d.ts +58 -0
- package/dist/components/FormTextarea.vue.d.ts +16 -0
- package/dist/components/Lightswitch.vue.d.ts +26 -0
- package/dist/components/Modal.vue.d.ts +98 -0
- package/dist/components/Pagination.vue.d.ts +60 -0
- package/dist/components/Radio.vue.d.ts +34 -0
- package/dist/components/RichTextEditor.vue.d.ts +71 -0
- package/dist/components/Tabs.vue.d.ts +26 -0
- package/dist/components/Toast.vue.d.ts +46 -0
- package/dist/components/Tooltip.vue.d.ts +45 -0
- package/dist/composables/useDialogContext.d.ts +18 -0
- package/dist/composables/useForm.d.ts +6 -0
- package/dist/core/index.js +17 -826
- package/dist/core.d.ts +27 -0
- package/dist/dialogs/index.js +4 -216
- package/dist/dialogs.d.ts +5 -0
- package/dist/dropdown/index.js +3 -131
- package/dist/dropdown.d.ts +4 -0
- package/dist/index/index.js +35 -0
- package/dist/index.d.ts +8 -0
- package/dist/lightswitch/index.js +3 -47
- package/dist/lightswitch.d.ts +4 -0
- package/dist/rich-text-editor/index.js +3 -261
- package/dist/rich-text-editor.d.ts +4 -0
- package/dist/toast/index.js +3 -99
- package/dist/toast.d.ts +4 -0
- package/dist/tooltip/index.js +1 -1
- package/dist/tooltip.d.ts +4 -0
- package/dist/types/shared.d.ts +3 -0
- package/package.json +49 -15
- package/dist/_shared/ButtonBase-DfkwHIhN.js +0 -87
- package/dist/_shared/ChevronDownIcon-z-5U4fIb.js +0 -55
- package/dist/_shared/FormInput-B-SQTZTA.js +0 -92
- package/dist/_shared/Modal-Bw2sID1x.js +0 -213
- package/dist/_shared/Tooltip-B93ZF7IF.js +0 -126
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { computed as v, getCurrentInstance as I, defineComponent as g, useSlots as B, ref as C, createElementBlock as n, openBlock as o, normalizeClass as V, createCommentVNode as p, renderSlot as s, unref as r, createBlock as f, resolveDynamicComponent as m, normalizeProps as b, guardReactiveProps as z, withDirectives as F, mergeProps as y, vModelDynamic as M } from "vue";
|
|
2
|
+
const O = () => ({ hasModelBinding: v(() => {
|
|
3
|
+
var i;
|
|
4
|
+
const t = I();
|
|
5
|
+
return !!((i = t == null ? void 0 : t.vnode) != null && i.props && Object.prototype.hasOwnProperty.call(t.vnode.props, "onUpdate:modelValue"));
|
|
6
|
+
}) }), P = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "rvc-input-prefix"
|
|
9
|
+
}, j = ["type"], D = ["type"], w = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "rvc-input-suffix"
|
|
12
|
+
}, U = /* @__PURE__ */ g({
|
|
13
|
+
inheritAttrs: !1,
|
|
14
|
+
__name: "FormInput",
|
|
15
|
+
props: {
|
|
16
|
+
modelValue: { default: void 0 },
|
|
17
|
+
rootClass: { default: "" },
|
|
18
|
+
prefixIcon: { type: [Function, Object, null], default: null },
|
|
19
|
+
icon: { type: [Function, Object, null], default: null },
|
|
20
|
+
size: { default: "base" }
|
|
21
|
+
},
|
|
22
|
+
emits: ["update:modelValue"],
|
|
23
|
+
setup(u, { emit: t }) {
|
|
24
|
+
const i = u, h = t, { hasModelBinding: k } = O(), l = B(), a = C(null), d = v({
|
|
25
|
+
get: () => i.modelValue,
|
|
26
|
+
set: (e) => h("update:modelValue", e)
|
|
27
|
+
});
|
|
28
|
+
return (e, c) => (o(), n("div", {
|
|
29
|
+
class: V([
|
|
30
|
+
"rvc-input",
|
|
31
|
+
`rvc-input-${e.size}`,
|
|
32
|
+
e.rootClass
|
|
33
|
+
])
|
|
34
|
+
}, [
|
|
35
|
+
r(l).prefix || r(l).prefixIcon || e.prefixIcon ? (o(), n("span", P, [
|
|
36
|
+
s(e.$slots, "prefix", {}, () => [
|
|
37
|
+
s(e.$slots, "prefixIcon", { icon: e.prefixIcon }, () => [
|
|
38
|
+
e.prefixIcon ? (o(), f(m(e.prefixIcon), {
|
|
39
|
+
key: 0,
|
|
40
|
+
"aria-hidden": "true"
|
|
41
|
+
})) : p("", !0)
|
|
42
|
+
])
|
|
43
|
+
])
|
|
44
|
+
])) : p("", !0),
|
|
45
|
+
s(e.$slots, "input", b(z(e.$attrs)), () => [
|
|
46
|
+
r(k) ? F((o(), n("input", y({ key: 0 }, e.$attrs, {
|
|
47
|
+
ref_key: "input",
|
|
48
|
+
ref: a,
|
|
49
|
+
"onUpdate:modelValue": c[0] || (c[0] = ($) => d.value = $),
|
|
50
|
+
type: e.$attrs.type || "text"
|
|
51
|
+
}), null, 16, j)), [
|
|
52
|
+
[M, d.value]
|
|
53
|
+
]) : (o(), n("input", y({ key: 1 }, e.$attrs, {
|
|
54
|
+
ref_key: "input",
|
|
55
|
+
ref: a,
|
|
56
|
+
type: e.$attrs.type || "text"
|
|
57
|
+
}), null, 16, D))
|
|
58
|
+
]),
|
|
59
|
+
r(l).suffix || r(l).icon || e.icon ? (o(), n("span", w, [
|
|
60
|
+
s(e.$slots, "suffix", {}, () => [
|
|
61
|
+
s(e.$slots, "icon", { icon: e.icon }, () => [
|
|
62
|
+
e.icon ? (o(), f(m(e.icon), {
|
|
63
|
+
key: 0,
|
|
64
|
+
"aria-hidden": "true"
|
|
65
|
+
})) : p("", !0)
|
|
66
|
+
])
|
|
67
|
+
])
|
|
68
|
+
])) : p("", !0)
|
|
69
|
+
], 2));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
U as _,
|
|
74
|
+
O as u
|
|
75
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineComponent as c, computed as p, createBlock as s, openBlock as r, unref as o, withCtx as a, createVNode as f, createCommentVNode as h, mergeProps as g, createElementVNode as V, renderSlot as w } from "vue";
|
|
2
|
+
import { SwitchGroup as v, Switch as _, SwitchLabel as S } from "@headlessui/vue";
|
|
3
|
+
const B = /* @__PURE__ */ c({
|
|
4
|
+
inheritAttrs: !1,
|
|
5
|
+
__name: "Lightswitch",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: { type: Boolean, default: !1 }
|
|
8
|
+
},
|
|
9
|
+
emits: ["update:modelValue"],
|
|
10
|
+
setup(u, { emit: d }) {
|
|
11
|
+
const i = u, n = d, l = p({
|
|
12
|
+
get: () => i.modelValue,
|
|
13
|
+
set: (e) => n("update:modelValue", e)
|
|
14
|
+
});
|
|
15
|
+
return (e, t) => (r(), s(o(v), {
|
|
16
|
+
as: "div",
|
|
17
|
+
class: "rvc-lightswitch-group"
|
|
18
|
+
}, {
|
|
19
|
+
default: a(() => [
|
|
20
|
+
f(o(_), g({
|
|
21
|
+
modelValue: l.value,
|
|
22
|
+
"onUpdate:modelValue": t[0] || (t[0] = (m) => l.value = m),
|
|
23
|
+
class: [{ "rvc-lightswitch-enabled": l.value }, "rvc-lightswitch"]
|
|
24
|
+
}, e.$attrs), {
|
|
25
|
+
default: a(() => t[1] || (t[1] = [
|
|
26
|
+
V("span", { class: "rvc-lightswitch-toggle" }, null, -1)
|
|
27
|
+
])),
|
|
28
|
+
_: 1,
|
|
29
|
+
__: [1]
|
|
30
|
+
}, 16, ["modelValue", "class"]),
|
|
31
|
+
e.$slots.default ? (r(), s(o(S), { key: 0 }, {
|
|
32
|
+
default: a(() => [
|
|
33
|
+
w(e.$slots, "default")
|
|
34
|
+
]),
|
|
35
|
+
_: 3
|
|
36
|
+
})) : h("", !0)
|
|
37
|
+
]),
|
|
38
|
+
_: 3
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export {
|
|
43
|
+
B as _
|
|
44
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { ref as C, computed as u, defineComponent as D, createBlock as L, openBlock as y, unref as t, withCtx as d, createVNode as n, withModifiers as T, createElementVNode as r, normalizeClass as I, createElementBlock as $, renderSlot as s, createCommentVNode as N, createTextVNode as R, toDisplayString as S } from "vue";
|
|
2
|
+
import { TransitionRoot as V, Dialog as h, TransitionChild as g, DialogPanel as A, DialogTitle as B } from "@headlessui/vue";
|
|
3
|
+
import { _ as E } from "./ButtonBase.vue_vue_type_script_setup_true_lang-B0YsKehI.js";
|
|
4
|
+
import { r as w } from "./XMarkIcon-90mcPzBs.js";
|
|
5
|
+
function H(m) {
|
|
6
|
+
const f = C(null), p = C(!1), l = u(() => m.as === "form"), b = u(() => `${m.id}-title`), v = u(() => `${m.id}-content`), c = u(() => {
|
|
7
|
+
var i;
|
|
8
|
+
return (i = f.value) == null ? void 0 : i.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
9
|
+
});
|
|
10
|
+
return {
|
|
11
|
+
contentRef: f,
|
|
12
|
+
ready: p,
|
|
13
|
+
isForm: l,
|
|
14
|
+
titleId: b,
|
|
15
|
+
descriptionId: v,
|
|
16
|
+
initialFocusElement: c
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const M = {
|
|
20
|
+
role: "presentation",
|
|
21
|
+
class: "rvc-modal-presentation"
|
|
22
|
+
}, q = { class: "rvc-modal-container" }, z = {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: "rvc-modal-header"
|
|
25
|
+
}, P = { class: "rvc-modal-header-inner" }, j = { class: "rvc-modal-close-wrapper" }, G = ["id"], J = {
|
|
26
|
+
key: 2,
|
|
27
|
+
class: "rvc-modal-footer"
|
|
28
|
+
}, W = /* @__PURE__ */ D({
|
|
29
|
+
__name: "Modal",
|
|
30
|
+
props: {
|
|
31
|
+
as: { default: "div" },
|
|
32
|
+
id: {},
|
|
33
|
+
title: {},
|
|
34
|
+
showClose: { type: Boolean, default: !1 },
|
|
35
|
+
spinning: { type: Boolean, default: !1 },
|
|
36
|
+
submitLabel: { default: "Confirm" },
|
|
37
|
+
cancelLabel: { default: "Cancel" },
|
|
38
|
+
panelClass: { default: "rvc-modal-panel-max-width" },
|
|
39
|
+
resetHeader: { type: Boolean, default: !1 },
|
|
40
|
+
resetFooter: { type: Boolean, default: !1 }
|
|
41
|
+
},
|
|
42
|
+
emits: ["modal:open", "modal:opened", "modal:close", "modal:save", "modal:closed"],
|
|
43
|
+
setup(m, { emit: f }) {
|
|
44
|
+
const p = m, l = f, {
|
|
45
|
+
contentRef: b,
|
|
46
|
+
ready: v,
|
|
47
|
+
isForm: c,
|
|
48
|
+
titleId: i,
|
|
49
|
+
descriptionId: k,
|
|
50
|
+
initialFocusElement: F
|
|
51
|
+
} = H(p);
|
|
52
|
+
return (e, o) => (y(), L(t(V), { as: "template" }, {
|
|
53
|
+
default: d(() => [
|
|
54
|
+
n(t(h), {
|
|
55
|
+
as: e.as,
|
|
56
|
+
class: "rvc-modal",
|
|
57
|
+
static: "",
|
|
58
|
+
"aria-modal": "true",
|
|
59
|
+
role: "dialog",
|
|
60
|
+
"initial-focus": t(F),
|
|
61
|
+
"aria-labelledby": t(i),
|
|
62
|
+
onClose: o[7] || (o[7] = (a) => l("modal:close")),
|
|
63
|
+
onSubmit: o[8] || (o[8] = T((a) => l("modal:save", a), ["prevent"]))
|
|
64
|
+
}, {
|
|
65
|
+
default: d(() => [
|
|
66
|
+
n(t(g), {
|
|
67
|
+
as: "template",
|
|
68
|
+
enter: "rvc-modal-backdrop-transition-enter",
|
|
69
|
+
"enter-from": "rvc-modal-backdrop-transition-enter-from",
|
|
70
|
+
"enter-to": "rvc-modal-backdrop-transition-enter-to",
|
|
71
|
+
leave: "rvc-modal-backdrop-transition-leave",
|
|
72
|
+
"leave-from": "rvc-modal-backdrop-transition-leave-from",
|
|
73
|
+
"leave-to": "rvc-modal-backdrop-transition-leave-to",
|
|
74
|
+
onBeforeEnter: o[0] || (o[0] = (a) => l("modal:open")),
|
|
75
|
+
onAfterEnter: o[1] || (o[1] = (a) => l("modal:opened"))
|
|
76
|
+
}, {
|
|
77
|
+
default: d(() => o[9] || (o[9] = [
|
|
78
|
+
r("div", {
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
class: "rvc-modal-backdrop"
|
|
81
|
+
}, null, -1)
|
|
82
|
+
])),
|
|
83
|
+
_: 1,
|
|
84
|
+
__: [9]
|
|
85
|
+
}),
|
|
86
|
+
r("div", M, [
|
|
87
|
+
r("div", q, [
|
|
88
|
+
n(t(g), {
|
|
89
|
+
as: "template",
|
|
90
|
+
enter: "rvc-modal-transition-enter",
|
|
91
|
+
"enter-from": "rvc-modal-transition-enter-from",
|
|
92
|
+
"enter-to": "rvc-modal-transition-enter-to",
|
|
93
|
+
leave: "rvc-modal-transition-leave",
|
|
94
|
+
"leave-from": "rvc-modal-transition-leave-from",
|
|
95
|
+
"leave-to": "rvc-modal-transition-leave-to",
|
|
96
|
+
onBeforeEnter: o[5] || (o[5] = (a) => v.value = !0),
|
|
97
|
+
onAfterLeave: o[6] || (o[6] = (a) => (v.value = !1, l("modal:closed")))
|
|
98
|
+
}, {
|
|
99
|
+
default: d(() => [
|
|
100
|
+
n(t(A), {
|
|
101
|
+
class: I(["rvc-modal-panel", e.panelClass]),
|
|
102
|
+
"aria-busy": e.spinning,
|
|
103
|
+
"aria-describedby": t(k)
|
|
104
|
+
}, {
|
|
105
|
+
default: d(() => [
|
|
106
|
+
e.resetHeader ? s(e.$slots, "header", { key: 1 }) : (y(), $("header", z, [
|
|
107
|
+
s(e.$slots, "header", { title: e.title }, () => [
|
|
108
|
+
r("div", P, [
|
|
109
|
+
s(e.$slots, "title", {
|
|
110
|
+
id: t(i),
|
|
111
|
+
dialogTitle: t(B),
|
|
112
|
+
title: e.title
|
|
113
|
+
}, () => [
|
|
114
|
+
n(t(B), {
|
|
115
|
+
id: t(i),
|
|
116
|
+
class: "rvc-modal-title"
|
|
117
|
+
}, {
|
|
118
|
+
default: d(() => [
|
|
119
|
+
R(S(e.title), 1)
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 8, ["id"])
|
|
123
|
+
]),
|
|
124
|
+
e.showClose ? s(e.$slots, "close", {
|
|
125
|
+
key: 0,
|
|
126
|
+
icon: t(w),
|
|
127
|
+
emitClose: () => l("modal:close")
|
|
128
|
+
}, () => [
|
|
129
|
+
r("div", j, [
|
|
130
|
+
r("button", {
|
|
131
|
+
type: "button",
|
|
132
|
+
class: "rvc-modal-close",
|
|
133
|
+
"aria-label": "Close panel",
|
|
134
|
+
onClick: o[2] || (o[2] = (a) => l("modal:close"))
|
|
135
|
+
}, [
|
|
136
|
+
n(t(w), { "aria-hidden": "true" })
|
|
137
|
+
])
|
|
138
|
+
])
|
|
139
|
+
]) : N("", !0)
|
|
140
|
+
])
|
|
141
|
+
])
|
|
142
|
+
])),
|
|
143
|
+
r("div", {
|
|
144
|
+
id: t(k),
|
|
145
|
+
ref_key: "contentRef",
|
|
146
|
+
ref: b,
|
|
147
|
+
class: "rvc-modal-content"
|
|
148
|
+
}, [
|
|
149
|
+
s(e.$slots, "default", { ready: t(v) })
|
|
150
|
+
], 8, G),
|
|
151
|
+
e.resetFooter ? s(e.$slots, "footer", { key: 3 }) : (y(), $("footer", J, [
|
|
152
|
+
s(e.$slots, "footer", { loading: e.spinning }, () => [
|
|
153
|
+
n(E, {
|
|
154
|
+
type: t(c) ? "submit" : "button",
|
|
155
|
+
label: e.submitLabel,
|
|
156
|
+
spinning: e.spinning,
|
|
157
|
+
disabled: e.spinning,
|
|
158
|
+
onClick: o[3] || (o[3] = (a) => !t(c) && l("modal:save"))
|
|
159
|
+
}, null, 8, ["type", "label", "spinning", "disabled"]),
|
|
160
|
+
n(E, {
|
|
161
|
+
type: "button",
|
|
162
|
+
color: "light",
|
|
163
|
+
label: e.cancelLabel,
|
|
164
|
+
onClick: o[4] || (o[4] = (a) => l("modal:close"))
|
|
165
|
+
}, null, 8, ["label"])
|
|
166
|
+
])
|
|
167
|
+
]))
|
|
168
|
+
]),
|
|
169
|
+
_: 3
|
|
170
|
+
}, 8, ["class", "aria-busy", "aria-describedby"])
|
|
171
|
+
]),
|
|
172
|
+
_: 3
|
|
173
|
+
})
|
|
174
|
+
])
|
|
175
|
+
])
|
|
176
|
+
]),
|
|
177
|
+
_: 3
|
|
178
|
+
}, 8, ["as", "initial-focus", "aria-labelledby"])
|
|
179
|
+
]),
|
|
180
|
+
_: 3
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
export {
|
|
185
|
+
W as _,
|
|
186
|
+
H as u
|
|
187
|
+
};
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { createElementBlock as n, openBlock as o, createElementVNode as s, defineComponent as L, ref as h, useAttrs as $, computed as x, watch as B, Fragment as C, createVNode as v, renderSlot as A, withCtx as _, normalizeClass as M, createCommentVNode as y, unref as f, renderList as E, createBlock as S, resolveDynamicComponent as U } from "vue";
|
|
2
|
+
import { useEditor as N, EditorContent as O } from "@tiptap/vue-3";
|
|
3
|
+
import T from "@tiptap/starter-kit";
|
|
4
|
+
import { _ as z } from "./Tooltip.vue_vue_type_script_setup_true_lang-CoydN9sS.js";
|
|
5
|
+
import { _ as D } from "./FormInput.vue_vue_type_script_setup_true_lang-BhJpG-Fw.js";
|
|
6
|
+
import { _ as I } from "./Modal.vue_vue_type_script_setup_true_lang-DBEOIZnO.js";
|
|
7
|
+
function q(r, d) {
|
|
8
|
+
return o(), n("svg", {
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
viewBox: "0 0 16 16",
|
|
11
|
+
fill: "currentColor",
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
"data-slot": "icon"
|
|
14
|
+
}, [
|
|
15
|
+
s("path", {
|
|
16
|
+
"fill-rule": "evenodd",
|
|
17
|
+
d: "M3 3a1 1 0 0 1 1-1h5a3.5 3.5 0 0 1 2.843 5.541A3.75 3.75 0 0 1 9.25 14H4a1 1 0 0 1-1-1V3Zm2.5 3.5v-2H9a1 1 0 0 1 0 2H5.5Zm0 2.5v2.5h3.75a1.25 1.25 0 1 0 0-2.5H5.5Z",
|
|
18
|
+
"clip-rule": "evenodd"
|
|
19
|
+
})
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
function F(r, d) {
|
|
23
|
+
return o(), n("svg", {
|
|
24
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
25
|
+
viewBox: "0 0 16 16",
|
|
26
|
+
fill: "currentColor",
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
"data-slot": "icon"
|
|
29
|
+
}, [
|
|
30
|
+
s("path", {
|
|
31
|
+
"fill-rule": "evenodd",
|
|
32
|
+
d: "M6.25 2.75A.75.75 0 0 1 7 2h6a.75.75 0 0 1 0 1.5h-2.483l-3.429 9H9A.75.75 0 0 1 9 14H3a.75.75 0 0 1 0-1.5h2.483l3.429-9H7a.75.75 0 0 1-.75-.75Z",
|
|
33
|
+
"clip-rule": "evenodd"
|
|
34
|
+
})
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
function K(r, d) {
|
|
38
|
+
return o(), n("svg", {
|
|
39
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
40
|
+
viewBox: "0 0 16 16",
|
|
41
|
+
fill: "currentColor",
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
"data-slot": "icon"
|
|
44
|
+
}, [
|
|
45
|
+
s("path", {
|
|
46
|
+
"fill-rule": "evenodd",
|
|
47
|
+
d: "M8.914 6.025a.75.75 0 0 1 1.06 0 3.5 3.5 0 0 1 0 4.95l-2 2a3.5 3.5 0 0 1-5.396-4.402.75.75 0 0 1 1.251.827 2 2 0 0 0 3.085 2.514l2-2a2 2 0 0 0 0-2.828.75.75 0 0 1 0-1.06Z",
|
|
48
|
+
"clip-rule": "evenodd"
|
|
49
|
+
}),
|
|
50
|
+
s("path", {
|
|
51
|
+
"fill-rule": "evenodd",
|
|
52
|
+
d: "M7.086 9.975a.75.75 0 0 1-1.06 0 3.5 3.5 0 0 1 0-4.95l2-2a3.5 3.5 0 0 1 5.396 4.402.75.75 0 0 1-1.251-.827 2 2 0 0 0-3.085-2.514l-2 2a2 2 0 0 0 0 2.828.75.75 0 0 1 0 1.06Z",
|
|
53
|
+
"clip-rule": "evenodd"
|
|
54
|
+
})
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
function P(r, d) {
|
|
58
|
+
return o(), n("svg", {
|
|
59
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
60
|
+
viewBox: "0 0 16 16",
|
|
61
|
+
fill: "currentColor",
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
"data-slot": "icon"
|
|
64
|
+
}, [
|
|
65
|
+
s("path", { d: "M3 4.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM6.25 3a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 7.25a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 11.5a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM4 12.25a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM3 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" })
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
function R(r, d) {
|
|
69
|
+
return o(), n("svg", {
|
|
70
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
71
|
+
viewBox: "0 0 16 16",
|
|
72
|
+
fill: "currentColor",
|
|
73
|
+
"aria-hidden": "true",
|
|
74
|
+
"data-slot": "icon"
|
|
75
|
+
}, [
|
|
76
|
+
s("path", { d: "M2.995 1a.625.625 0 1 0 0 1.25h.38v2.125a.625.625 0 1 0 1.25 0v-2.75A.625.625 0 0 0 4 1H2.995ZM3.208 7.385a2.37 2.37 0 0 1 1.027-.124L2.573 8.923a.625.625 0 0 0 .439 1.067l1.987.011a.625.625 0 0 0 .006-1.25l-.49-.003.777-.776c.215-.215.335-.506.335-.809 0-.465-.297-.957-.842-1.078a3.636 3.636 0 0 0-1.993.121.625.625 0 1 0 .416 1.179ZM2.625 11a.625.625 0 1 0 0 1.25H4.25a.125.125 0 0 1 0 .25H3.5a.625.625 0 1 0 0 1.25h.75a.125.125 0 0 1 0 .25H2.625a.625.625 0 1 0 0 1.25H4.25a1.375 1.375 0 0 0 1.153-2.125A1.375 1.375 0 0 0 4.25 11H2.625ZM7.25 2a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5h-6ZM7.25 7.25a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5h-6ZM6.5 13.25a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 0 1.5h-6a.75.75 0 0 1-.75-.75Z" })
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
79
|
+
const j = { class: "rvc-rich-text-toolbar" }, G = ["disabled", "aria-label", "onClick"], te = /* @__PURE__ */ L({
|
|
80
|
+
inheritAttrs: !1,
|
|
81
|
+
__name: "RichTextEditor",
|
|
82
|
+
props: {
|
|
83
|
+
id: {},
|
|
84
|
+
modelValue: { default: "" },
|
|
85
|
+
rootClass: { default: void 0 },
|
|
86
|
+
config: { default: "default" },
|
|
87
|
+
customExtensions: { default: () => [] },
|
|
88
|
+
customCommands: { default: () => [] },
|
|
89
|
+
disabled: { type: Boolean, default: !1 }
|
|
90
|
+
},
|
|
91
|
+
emits: ["update:modelValue", "tiptap:onCreate"],
|
|
92
|
+
setup(r, { emit: d }) {
|
|
93
|
+
const i = r, b = d, w = h(!1), u = h(!1), c = h(""), m = $(), k = m.class ? `${m.class} ` : "", V = T.configure({
|
|
94
|
+
link: {
|
|
95
|
+
openOnClick: !1
|
|
96
|
+
}
|
|
97
|
+
}), t = N({
|
|
98
|
+
extensions: [V, ...i.customExtensions],
|
|
99
|
+
content: i.modelValue,
|
|
100
|
+
editorProps: {
|
|
101
|
+
attributes: {
|
|
102
|
+
...m,
|
|
103
|
+
id: i.id,
|
|
104
|
+
class: `${k}rvc-textarea rvc-rich-text-textarea`
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
onCreate: ({ editor: a }) => {
|
|
108
|
+
b("tiptap:onCreate", a);
|
|
109
|
+
},
|
|
110
|
+
onUpdate: ({ editor: a }) => {
|
|
111
|
+
const e = a.isEmpty ? "" : a.getHTML();
|
|
112
|
+
b("update:modelValue", e);
|
|
113
|
+
},
|
|
114
|
+
onSelectionUpdate({ editor: a }) {
|
|
115
|
+
w.value = !a.view.state.selection.empty;
|
|
116
|
+
}
|
|
117
|
+
}), Z = x(() => {
|
|
118
|
+
var a;
|
|
119
|
+
return [
|
|
120
|
+
{
|
|
121
|
+
name: "bold",
|
|
122
|
+
icon: q,
|
|
123
|
+
title: "Bold",
|
|
124
|
+
isVisible: !0,
|
|
125
|
+
isActive: () => {
|
|
126
|
+
var e;
|
|
127
|
+
return ((e = t.value) == null ? void 0 : e.isActive("bold")) ?? !1;
|
|
128
|
+
},
|
|
129
|
+
action: () => {
|
|
130
|
+
var e;
|
|
131
|
+
return (e = t.value) == null ? void 0 : e.commands.toggleBold();
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "italic",
|
|
136
|
+
icon: F,
|
|
137
|
+
title: "Italic",
|
|
138
|
+
isVisible: !0,
|
|
139
|
+
isActive: () => {
|
|
140
|
+
var e;
|
|
141
|
+
return ((e = t.value) == null ? void 0 : e.isActive("italic")) ?? !1;
|
|
142
|
+
},
|
|
143
|
+
action: () => {
|
|
144
|
+
var e;
|
|
145
|
+
return (e = t.value) == null ? void 0 : e.commands.toggleItalic();
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "bulletList",
|
|
150
|
+
icon: P,
|
|
151
|
+
title: "Bullet List",
|
|
152
|
+
isVisible: i.config === "default",
|
|
153
|
+
isActive: () => {
|
|
154
|
+
var e;
|
|
155
|
+
return ((e = t.value) == null ? void 0 : e.isActive("bulletList")) ?? !1;
|
|
156
|
+
},
|
|
157
|
+
action: () => {
|
|
158
|
+
var e;
|
|
159
|
+
return (e = t.value) == null ? void 0 : e.commands.toggleBulletList();
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: "orderedList",
|
|
164
|
+
icon: R,
|
|
165
|
+
title: "Ordered List",
|
|
166
|
+
isVisible: i.config === "default",
|
|
167
|
+
isActive: () => {
|
|
168
|
+
var e;
|
|
169
|
+
return ((e = t.value) == null ? void 0 : e.isActive("orderedList")) ?? !1;
|
|
170
|
+
},
|
|
171
|
+
action: () => {
|
|
172
|
+
var e;
|
|
173
|
+
return (e = t.value) == null ? void 0 : e.commands.toggleOrderedList();
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "link",
|
|
178
|
+
icon: K,
|
|
179
|
+
title: "Hyperlink",
|
|
180
|
+
isVisible: i.config === "default",
|
|
181
|
+
disabled: !w.value && !(((a = t.value) == null ? void 0 : a.isActive("link")) ?? !1),
|
|
182
|
+
isActive: () => {
|
|
183
|
+
var e;
|
|
184
|
+
return ((e = t.value) == null ? void 0 : e.isActive("link")) ?? !1;
|
|
185
|
+
},
|
|
186
|
+
action: () => {
|
|
187
|
+
var e;
|
|
188
|
+
c.value = ((e = t.value) == null ? void 0 : e.getAttributes("link").href) || "", u.value = !0;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
];
|
|
192
|
+
}), g = x(() => {
|
|
193
|
+
const a = Z.value.filter((l) => i.config === "default" || ["bold", "italic"].includes(l.name)), e = i.customCommands.map((l) => {
|
|
194
|
+
let p = !1;
|
|
195
|
+
return typeof l.disabled == "function" ? p = t.value ? l.disabled(t.value) : !1 : p = l.disabled ?? !1, {
|
|
196
|
+
...l,
|
|
197
|
+
isVisible: l.isVisible ?? !0,
|
|
198
|
+
disabled: p,
|
|
199
|
+
isActive: () => l.isActive && t.value ? l.isActive(t.value) : !1,
|
|
200
|
+
action: () => t.value && l.action(t.value)
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
return [...a, ...e];
|
|
204
|
+
});
|
|
205
|
+
B(() => i.modelValue, (a) => {
|
|
206
|
+
if (!t.value) return;
|
|
207
|
+
t.value.getHTML() === a || t.value.commands.setContent(a, { emitUpdate: !1 });
|
|
208
|
+
});
|
|
209
|
+
const H = () => {
|
|
210
|
+
t.value && (t.value.commands.setLink({ href: c.value }), u.value = !1, c.value = "");
|
|
211
|
+
};
|
|
212
|
+
return (a, e) => (o(), n(C, null, [
|
|
213
|
+
v(I, {
|
|
214
|
+
id: `${i.id}-modal-add-hyperlink`,
|
|
215
|
+
title: "Add Hyperlink",
|
|
216
|
+
as: "form",
|
|
217
|
+
show: u.value,
|
|
218
|
+
"onModal:close": e[1] || (e[1] = (l) => u.value = !1),
|
|
219
|
+
"onModal:save": H
|
|
220
|
+
}, {
|
|
221
|
+
default: _(() => [
|
|
222
|
+
v(D, {
|
|
223
|
+
modelValue: c.value,
|
|
224
|
+
"onUpdate:modelValue": e[0] || (e[0] = (l) => c.value = l),
|
|
225
|
+
placeholder: "https://www.example.com",
|
|
226
|
+
type: "url",
|
|
227
|
+
required: ""
|
|
228
|
+
}, null, 8, ["modelValue"])
|
|
229
|
+
]),
|
|
230
|
+
_: 1
|
|
231
|
+
}, 8, ["id", "show"]),
|
|
232
|
+
A(a.$slots, "default"),
|
|
233
|
+
s("div", {
|
|
234
|
+
class: M(["rvc-rich-text", a.rootClass, { "rvc-rich-text-disabled": a.disabled }])
|
|
235
|
+
}, [
|
|
236
|
+
f(t) ? A(a.$slots, "toolbar", {
|
|
237
|
+
key: 0,
|
|
238
|
+
commands: g.value,
|
|
239
|
+
tiptap: f(t)
|
|
240
|
+
}, () => [
|
|
241
|
+
s("ul", j, [
|
|
242
|
+
(o(!0), n(C, null, E(g.value.filter((l) => l.isVisible), (l) => (o(), n("li", {
|
|
243
|
+
key: `toolbar-item-command-${l.name}`
|
|
244
|
+
}, [
|
|
245
|
+
v(z, {
|
|
246
|
+
content: l.title,
|
|
247
|
+
placement: "bottom",
|
|
248
|
+
size: "sm",
|
|
249
|
+
class: "rvc-rich-text-tooltip"
|
|
250
|
+
}, {
|
|
251
|
+
default: _(() => [
|
|
252
|
+
s("button", {
|
|
253
|
+
disabled: l.disabled,
|
|
254
|
+
type: "button",
|
|
255
|
+
"aria-label": l.title,
|
|
256
|
+
class: M([{ "rvc-rich-text-button-active": l.isActive() }, "rvc-rich-text-button"]),
|
|
257
|
+
onClick: l.action
|
|
258
|
+
}, [
|
|
259
|
+
(o(), S(U(l.icon)))
|
|
260
|
+
], 10, G)
|
|
261
|
+
]),
|
|
262
|
+
_: 2
|
|
263
|
+
}, 1032, ["content"])
|
|
264
|
+
]))), 128))
|
|
265
|
+
])
|
|
266
|
+
]) : y("", !0),
|
|
267
|
+
v(f(O), { editor: f(t) }, null, 8, ["editor"])
|
|
268
|
+
], 2)
|
|
269
|
+
], 64));
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
export {
|
|
273
|
+
te as _
|
|
274
|
+
};
|