@robuust-digital/vue-components 2.0.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/_shared/ButtonBase.vue_vue_type_script_setup_true_lang-B0YsKehI.js +60 -0
  3. package/dist/_shared/ChevronDownIcon-DaaXfD3C.js +41 -0
  4. package/dist/_shared/Combobox.vue_vue_type_script_setup_true_lang-D1vKMJok.js +266 -0
  5. package/dist/_shared/Drawer.vue_vue_type_script_setup_true_lang-DT6tBBZ7.js +186 -0
  6. package/dist/_shared/Dropdown.vue_vue_type_script_setup_true_lang-D5vTFLkq.js +115 -0
  7. package/dist/_shared/FormInput.vue_vue_type_script_setup_true_lang-BhJpG-Fw.js +75 -0
  8. package/dist/_shared/Lightswitch.vue_vue_type_script_setup_true_lang-CvN-2WJt.js +44 -0
  9. package/dist/_shared/Modal.vue_vue_type_script_setup_true_lang-DBEOIZnO.js +187 -0
  10. package/dist/_shared/RichTextEditor.vue_vue_type_script_setup_true_lang-Bs4WdJhA.js +274 -0
  11. package/dist/_shared/Tabs.vue_vue_type_script_setup_true_lang-CsGx6wBK.js +676 -0
  12. package/dist/_shared/Toast.vue_vue_type_script_setup_true_lang-FEeRXoIx.js +75 -0
  13. package/dist/_shared/Tooltip.vue_vue_type_script_setup_true_lang-CoydN9sS.js +96 -0
  14. package/dist/combobox/index.js +3 -347
  15. package/dist/combobox.d.ts +4 -0
  16. package/dist/components/Accordion.vue.d.ts +37 -0
  17. package/dist/components/Alert.vue.d.ts +39 -0
  18. package/dist/components/Badge.vue.d.ts +32 -0
  19. package/dist/components/ButtonBase.vue.d.ts +50 -0
  20. package/dist/components/Checkbox.vue.d.ts +39 -0
  21. package/dist/components/Combobox.vue.d.ts +112 -0
  22. package/dist/components/DataTable.vue.d.ts +122 -0
  23. package/dist/components/Drawer.vue.d.ts +103 -0
  24. package/dist/components/Dropdown.vue.d.ts +120 -0
  25. package/dist/components/EmptyState.vue.d.ts +23 -0
  26. package/dist/components/FormInput.vue.d.ts +49 -0
  27. package/dist/components/FormSelect.vue.d.ts +58 -0
  28. package/dist/components/FormTextarea.vue.d.ts +16 -0
  29. package/dist/components/Lightswitch.vue.d.ts +26 -0
  30. package/dist/components/Modal.vue.d.ts +98 -0
  31. package/dist/components/Pagination.vue.d.ts +60 -0
  32. package/dist/components/Radio.vue.d.ts +34 -0
  33. package/dist/components/RichTextEditor.vue.d.ts +71 -0
  34. package/dist/components/Tabs.vue.d.ts +26 -0
  35. package/dist/components/Toast.vue.d.ts +46 -0
  36. package/dist/components/Tooltip.vue.d.ts +45 -0
  37. package/dist/composables/useDialogContext.d.ts +18 -0
  38. package/dist/composables/useForm.d.ts +6 -0
  39. package/dist/core/button.css +1 -9
  40. package/dist/core/checkbox.css +6 -9
  41. package/dist/core/index.js +17 -799
  42. package/dist/core/input.css +8 -7
  43. package/dist/core/radio.css +6 -9
  44. package/dist/core/utilities.css +12 -0
  45. package/dist/core.d.ts +27 -0
  46. package/dist/dialogs/index.js +4 -206
  47. package/dist/dialogs.d.ts +5 -0
  48. package/dist/dropdown/index.js +3 -131
  49. package/dist/dropdown.d.ts +4 -0
  50. package/dist/index/index.js +35 -0
  51. package/dist/index.d.ts +8 -0
  52. package/dist/lightswitch/index.js +3 -47
  53. package/dist/lightswitch.d.ts +4 -0
  54. package/dist/rich-text-editor/index.js +3 -263
  55. package/dist/rich-text-editor.d.ts +4 -0
  56. package/dist/toast/index.js +3 -99
  57. package/dist/toast.d.ts +4 -0
  58. package/dist/tooltip/index.js +1 -1
  59. package/dist/tooltip.d.ts +4 -0
  60. package/dist/types/shared.d.ts +3 -0
  61. package/package.json +55 -24
  62. package/dist/_shared/ButtonBase-DfkwHIhN.js +0 -87
  63. package/dist/_shared/ChevronDownIcon-z-5U4fIb.js +0 -55
  64. package/dist/_shared/FormInput-C5LjZViC.js +0 -85
  65. package/dist/_shared/Modal-dqDGKVw5.js +0 -201
  66. package/dist/_shared/Tooltip-B93ZF7IF.js +0 -126
@@ -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
+ };