@robuust-digital/vue-components 2.0.0 → 2.1.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.
@@ -1,201 +0,0 @@
1
- import { ref as g, computed as f, createBlock as B, openBlock as E, unref as t, withCtx as d, createVNode as r, withModifiers as D, createElementVNode as a, normalizeClass as L, renderSlot as c, createCommentVNode as T, createTextVNode as F, toDisplayString as I } from "vue";
2
- import { TransitionRoot as N, Dialog as R, TransitionChild as $, DialogPanel as V, DialogTitle as C } from "@headlessui/vue";
3
- import { _ as k } from "./ButtonBase-DfkwHIhN.js";
4
- import { r as S } from "./XMarkIcon-90mcPzBs.js";
5
- function q(o) {
6
- const v = g(null), n = g(!1), b = f(() => o.as === "form"), p = f(() => `${o.id}-title`), m = f(() => `${o.id}-content`), u = f(() => {
7
- var s;
8
- return (s = v.value) == null ? void 0 : s.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
9
- });
10
- return {
11
- contentRef: v,
12
- ready: n,
13
- isForm: b,
14
- titleId: p,
15
- descriptionId: m,
16
- initialFocusElement: u
17
- };
18
- }
19
- const h = {
20
- role: "presentation",
21
- class: "rvc-modal-presentation"
22
- }, A = { class: "rvc-modal-container" }, M = { class: "rvc-modal-header" }, x = { class: "rvc-modal-header-inner" }, z = { class: "rvc-modal-close-wrapper" }, P = ["id"], j = { class: "rvc-modal-footer" }, O = {
23
- __name: "Modal",
24
- props: {
25
- as: {
26
- type: String,
27
- default: "div"
28
- },
29
- id: {
30
- type: String,
31
- required: !0
32
- },
33
- title: {
34
- type: String,
35
- required: !0
36
- },
37
- showClose: {
38
- type: Boolean
39
- },
40
- spinning: {
41
- type: Boolean
42
- },
43
- submitLabel: {
44
- type: String,
45
- default: "Confirm"
46
- },
47
- cancelLabel: {
48
- type: String,
49
- default: "Cancel"
50
- },
51
- panelClass: {
52
- type: String,
53
- default: "rvc-modal-panel-max-width"
54
- }
55
- },
56
- emits: ["modal:open", "modal:opened", "modal:close", "modal:save", "modal:closed"],
57
- setup(o, { emit: v }) {
58
- const n = v, b = o, {
59
- contentRef: p,
60
- ready: m,
61
- isForm: u,
62
- titleId: s,
63
- descriptionId: y,
64
- initialFocusElement: w
65
- } = q(b);
66
- return (i, e) => (E(), B(t(N), { as: "template" }, {
67
- default: d(() => [
68
- r(t(R), {
69
- as: o.as,
70
- class: "rvc-modal",
71
- static: "",
72
- "aria-modal": "true",
73
- role: "dialog",
74
- "initial-focus": t(w),
75
- "aria-labelledby": t(s),
76
- onClose: e[7] || (e[7] = (l) => i.$emit("modal:close")),
77
- onSubmit: e[8] || (e[8] = D((l) => n("modal:save", l), ["prevent"]))
78
- }, {
79
- default: d(() => [
80
- r(t($), {
81
- as: "template",
82
- enter: "rvc-modal-backdrop-transition-enter",
83
- "enter-from": "rvc-modal-backdrop-transition-enter-from",
84
- "enter-to": "rvc-modal-backdrop-transition-enter-to",
85
- leave: "rvc-modal-backdrop-transition-leave",
86
- "leave-from": "rvc-modal-backdrop-transition-leave-from",
87
- "leave-to": "rvc-modal-backdrop-transition-leave-to",
88
- onBeforeEnter: e[0] || (e[0] = (l) => n("modal:open")),
89
- onAfterEnter: e[1] || (e[1] = (l) => n("modal:opened"))
90
- }, {
91
- default: d(() => e[9] || (e[9] = [
92
- a("div", {
93
- "aria-hidden": "true",
94
- class: "rvc-modal-backdrop"
95
- }, null, -1)
96
- ])),
97
- _: 1,
98
- __: [9]
99
- }),
100
- a("div", h, [
101
- a("div", A, [
102
- r(t($), {
103
- as: "template",
104
- enter: "rvc-modal-transition-enter",
105
- "enter-from": "rvc-modal-transition-enter-from",
106
- "enter-to": "rvc-modal-transition-enter-to",
107
- leave: "rvc-modal-transition-leave",
108
- "leave-from": "rvc-modal-transition-leave-from",
109
- "leave-to": "rvc-modal-transition-leave-to",
110
- onBeforeEnter: e[5] || (e[5] = (l) => m.value = !0),
111
- onAfterLeave: e[6] || (e[6] = (l) => (m.value = !1, n("modal:closed")))
112
- }, {
113
- default: d(() => [
114
- r(t(V), {
115
- class: L(["rvc-modal-panel", o.panelClass]),
116
- "aria-busy": o.spinning,
117
- "aria-describedby": t(y)
118
- }, {
119
- default: d(() => [
120
- a("header", M, [
121
- c(i.$slots, "header", { title: o.title }, () => [
122
- a("div", x, [
123
- c(i.$slots, "title", {
124
- id: t(s),
125
- dialogTitle: t(C),
126
- title: o.title
127
- }, () => [
128
- r(t(C), {
129
- id: t(s),
130
- class: "rvc-modal-title"
131
- }, {
132
- default: d(() => [
133
- F(I(o.title), 1)
134
- ]),
135
- _: 1
136
- }, 8, ["id"])
137
- ]),
138
- o.showClose ? c(i.$slots, "close", {
139
- key: 0,
140
- icon: t(S),
141
- emitClose: () => n("drawer:close")
142
- }, () => [
143
- a("div", z, [
144
- a("button", {
145
- type: "button",
146
- class: "rvc-modal-close",
147
- "aria-label": "Close panel",
148
- onClick: e[2] || (e[2] = (l) => n("modal:close"))
149
- }, [
150
- r(t(S), { "aria-hidden": "true" })
151
- ])
152
- ])
153
- ]) : T("", !0)
154
- ])
155
- ])
156
- ]),
157
- a("div", {
158
- id: t(y),
159
- ref_key: "contentRef",
160
- ref: p,
161
- class: "rvc-modal-content"
162
- }, [
163
- c(i.$slots, "default", { ready: t(m) })
164
- ], 8, P),
165
- a("footer", j, [
166
- c(i.$slots, "footer", { loading: o.spinning }, () => [
167
- r(k, {
168
- type: t(u) ? "submit" : "button",
169
- label: o.submitLabel,
170
- spinning: o.spinning,
171
- disabled: o.spinning,
172
- onClick: e[3] || (e[3] = (l) => !t(u) && i.$emit("modal:save"))
173
- }, null, 8, ["type", "label", "spinning", "disabled"]),
174
- r(k, {
175
- type: "button",
176
- color: "light",
177
- label: o.cancelLabel,
178
- onClick: e[4] || (e[4] = (l) => i.$emit("modal:close"))
179
- }, null, 8, ["label"])
180
- ])
181
- ])
182
- ]),
183
- _: 3
184
- }, 8, ["class", "aria-busy", "aria-describedby"])
185
- ]),
186
- _: 3
187
- })
188
- ])
189
- ])
190
- ]),
191
- _: 3
192
- }, 8, ["as", "initial-focus", "aria-labelledby"])
193
- ]),
194
- _: 3
195
- }));
196
- }
197
- };
198
- export {
199
- O as _,
200
- q as u
201
- };