@stachelock/ui 0.8.2 → 0.8.4
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/UiSlideOver.vue_vue_type_script_setup_true_lang-CjSduy9N.js +191 -0
- package/dist/index.js +1763 -1946
- package/dist/modals/UiSlideOver.d.ts +3 -0
- package/dist/modals/UiSlideOver.js +4 -0
- package/dist/src/components/modals/index.d.ts +1 -1
- package/package.json +1 -1
- package/scripts/generateRecursiveIndex.cjs +5 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { defineComponent as T, ref as y, computed as r, createBlock as p, openBlock as i, unref as l, withCtx as o, createVNode as u, createCommentVNode as f, createElementVNode as e, normalizeClass as d, normalizeStyle as E, createElementBlock as g, renderSlot as x, createTextVNode as R, toDisplayString as D } from "vue";
|
|
2
|
+
import { TransitionRoot as N, Dialog as $, TransitionChild as b, DialogPanel as q, DialogTitle as A } from "@headlessui/vue";
|
|
3
|
+
import { XMarkIcon as L } from "@heroicons/vue/24/outline";
|
|
4
|
+
const M = { class: "sl-fixed sl-inset-0 sl-overflow-hidden" }, F = { class: "sl-absolute sl-inset-0 sl-overflow-hidden" }, P = { class: "sl-flex sl-items-center sl-justify-between sl-gap-3" }, j = { class: "sl-flex-1 sl-min-w-0" }, I = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "sl-flex sl-h-7 sl-items-center"
|
|
7
|
+
}, O = "sl-transform sl-transition sl-ease-in-out sl-duration-500 sm:sl-duration-700", U = "sl-transform sl-transition sl-ease-in-out sl-duration-500 sm:sl-duration-700", X = "sl-translate-x-0", G = "sl-translate-x-0", Q = /* @__PURE__ */ T({
|
|
8
|
+
__name: "UiSlideOver",
|
|
9
|
+
props: {
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
required: !0
|
|
13
|
+
},
|
|
14
|
+
position: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "right",
|
|
17
|
+
validator: (s) => ["left", "right"].includes(s)
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "md",
|
|
22
|
+
validator: (s) => ["sm", "md", "lg", "xl", "2xl", "full"].includes(s)
|
|
23
|
+
},
|
|
24
|
+
title: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ""
|
|
27
|
+
},
|
|
28
|
+
showBackdrop: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !0
|
|
31
|
+
},
|
|
32
|
+
preventAutoClose: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
compact: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !1
|
|
39
|
+
},
|
|
40
|
+
showCloseButton: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: !0
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
emits: ["update:modelValue", "close", "close-requested"],
|
|
46
|
+
setup(s, { expose: h, emit: k }) {
|
|
47
|
+
const a = s, c = k, w = y(null), v = y(null), C = r(() => a.position === "left" ? "sl-left-0 sl-pr-10" : "sl-right-0 sl-pl-10"), B = r(() => ({
|
|
48
|
+
sm: "sl-max-w-sm",
|
|
49
|
+
// 384px
|
|
50
|
+
md: "sl-max-w-md",
|
|
51
|
+
// 448px
|
|
52
|
+
lg: "sl-max-w-lg",
|
|
53
|
+
// 512px
|
|
54
|
+
xl: "sl-max-w-xl",
|
|
55
|
+
// 576px
|
|
56
|
+
"2xl": "sl-max-w-2xl",
|
|
57
|
+
// 672px
|
|
58
|
+
full: "sl-max-w-full"
|
|
59
|
+
// 100%
|
|
60
|
+
})[a.size]), z = r(
|
|
61
|
+
() => a.position === "left" ? "sl--translate-x-full" : "sl-translate-x-full"
|
|
62
|
+
), V = r(
|
|
63
|
+
() => a.position === "left" ? "sl--translate-x-full" : "sl-translate-x-full"
|
|
64
|
+
), S = r(() => ({
|
|
65
|
+
paddingTop: "env(safe-area-inset-top, 0px)",
|
|
66
|
+
paddingBottom: "env(safe-area-inset-bottom, 0px)"
|
|
67
|
+
})), m = () => {
|
|
68
|
+
a.preventAutoClose ? c("close-requested") : (c("update:modelValue", !1), c("close"));
|
|
69
|
+
};
|
|
70
|
+
return h({
|
|
71
|
+
close: m,
|
|
72
|
+
contentRef: v
|
|
73
|
+
}), (n, t) => (i(), p(l(N), {
|
|
74
|
+
as: "template",
|
|
75
|
+
show: s.modelValue
|
|
76
|
+
}, {
|
|
77
|
+
default: o(() => [
|
|
78
|
+
u(l($), {
|
|
79
|
+
as: "div",
|
|
80
|
+
class: "sl-relative sl-z-50",
|
|
81
|
+
onClose: m
|
|
82
|
+
}, {
|
|
83
|
+
default: o(() => [
|
|
84
|
+
s.showBackdrop ? (i(), p(l(b), {
|
|
85
|
+
key: 0,
|
|
86
|
+
as: "template",
|
|
87
|
+
enter: "sl-ease-in-out sl-duration-500",
|
|
88
|
+
"enter-from": "sl-opacity-0",
|
|
89
|
+
"enter-to": "sl-opacity-100",
|
|
90
|
+
leave: "sl-ease-in-out sl-duration-500",
|
|
91
|
+
"leave-from": "sl-opacity-100",
|
|
92
|
+
"leave-to": "sl-opacity-0"
|
|
93
|
+
}, {
|
|
94
|
+
default: o(() => [...t[0] || (t[0] = [
|
|
95
|
+
e("div", { class: "sl-fixed sl-inset-0 sl-bg-black/30 dark:sl-bg-black/50 sl-transition-opacity" }, null, -1)
|
|
96
|
+
])]),
|
|
97
|
+
_: 1
|
|
98
|
+
})) : f("", !0),
|
|
99
|
+
e("div", M, [
|
|
100
|
+
e("div", F, [
|
|
101
|
+
e("div", {
|
|
102
|
+
class: d(["sl-pointer-events-none sl-fixed sl-inset-y-0 sl-flex sl-max-w-full", C.value])
|
|
103
|
+
}, [
|
|
104
|
+
u(l(b), {
|
|
105
|
+
as: "template",
|
|
106
|
+
enter: O,
|
|
107
|
+
"enter-from": z.value,
|
|
108
|
+
"enter-to": X,
|
|
109
|
+
leave: U,
|
|
110
|
+
"leave-from": G,
|
|
111
|
+
"leave-to": V.value
|
|
112
|
+
}, {
|
|
113
|
+
default: o(() => [
|
|
114
|
+
u(l(q), {
|
|
115
|
+
class: d(["sl-pointer-events-auto sl-w-screen sl-flex sl-flex-col", B.value])
|
|
116
|
+
}, {
|
|
117
|
+
default: o(() => [
|
|
118
|
+
e("div", {
|
|
119
|
+
class: "sl-flex sl-h-full sl-flex-col sl-bg-white dark:sl-bg-slate-800 sl-shadow-xl",
|
|
120
|
+
style: E(S.value)
|
|
121
|
+
}, [
|
|
122
|
+
e("div", {
|
|
123
|
+
class: d(["sl-sticky sl-top-0 sl-z-10 sl-border-b sl-border-gray-200 dark:sl-border-slate-700 sl-bg-white dark:sl-bg-slate-800", s.compact ? "sl-px-3 sl-py-3" : "sl-px-4 sm:sl-px-6 sl-py-4"])
|
|
124
|
+
}, [
|
|
125
|
+
e("div", P, [
|
|
126
|
+
e("div", j, [
|
|
127
|
+
x(n.$slots, "header", {}, () => [
|
|
128
|
+
s.title ? (i(), p(l(A), {
|
|
129
|
+
key: 0,
|
|
130
|
+
class: "sl-text-base sl-font-semibold sl-leading-6 sl-text-gray-900 dark:sl-text-white sl-truncate"
|
|
131
|
+
}, {
|
|
132
|
+
default: o(() => [
|
|
133
|
+
R(D(s.title), 1)
|
|
134
|
+
]),
|
|
135
|
+
_: 1
|
|
136
|
+
})) : f("", !0)
|
|
137
|
+
])
|
|
138
|
+
]),
|
|
139
|
+
s.showCloseButton ? (i(), g("div", I, [
|
|
140
|
+
e("button", {
|
|
141
|
+
ref_key: "closeButtonRef",
|
|
142
|
+
ref: w,
|
|
143
|
+
type: "button",
|
|
144
|
+
class: "sl-relative sl-rounded-md sl-bg-white dark:sl-bg-slate-800 sl-text-gray-400 hover:sl-text-gray-500 dark:sl-text-slate-400 dark:hover:sl-text-slate-300 focus:sl-outline-none focus:sl-ring-2 focus:sl-ring-primary-500 focus:sl-ring-offset-2",
|
|
145
|
+
onClick: m
|
|
146
|
+
}, [
|
|
147
|
+
t[1] || (t[1] = e("span", { class: "sl-absolute sl--inset-2.5" }, null, -1)),
|
|
148
|
+
t[2] || (t[2] = e("span", { class: "sl-sr-only" }, "Close panel", -1)),
|
|
149
|
+
u(l(L), {
|
|
150
|
+
class: "sl-h-6 sl-w-6",
|
|
151
|
+
"aria-hidden": "true"
|
|
152
|
+
})
|
|
153
|
+
], 512)
|
|
154
|
+
])) : f("", !0)
|
|
155
|
+
])
|
|
156
|
+
], 2),
|
|
157
|
+
e("div", {
|
|
158
|
+
ref_key: "contentRef",
|
|
159
|
+
ref: v,
|
|
160
|
+
class: d(["sl-relative sl-flex-1 sl-overflow-y-auto sl-min-h-0", s.compact ? "sl-px-3 sl-py-3" : "sl-px-4 sm:sl-px-6 sl-py-4"]),
|
|
161
|
+
tabindex: "-1"
|
|
162
|
+
}, [
|
|
163
|
+
x(n.$slots, "default")
|
|
164
|
+
], 2),
|
|
165
|
+
n.$slots.footer ? (i(), g("div", {
|
|
166
|
+
key: 0,
|
|
167
|
+
class: d(["sl-sticky sl-bottom-0 sl-border-t sl-border-gray-200 dark:sl-border-slate-700 sl-bg-gray-50 dark:sl-bg-slate-800/50", s.compact ? "sl-px-3 sl-py-3" : "sl-px-4 sm:sl-px-6 sl-py-4"])
|
|
168
|
+
}, [
|
|
169
|
+
x(n.$slots, "footer")
|
|
170
|
+
], 2)) : f("", !0)
|
|
171
|
+
], 4)
|
|
172
|
+
]),
|
|
173
|
+
_: 3
|
|
174
|
+
}, 8, ["class"])
|
|
175
|
+
]),
|
|
176
|
+
_: 3
|
|
177
|
+
}, 8, ["enter-from", "leave-to"])
|
|
178
|
+
], 2)
|
|
179
|
+
])
|
|
180
|
+
])
|
|
181
|
+
]),
|
|
182
|
+
_: 3
|
|
183
|
+
})
|
|
184
|
+
]),
|
|
185
|
+
_: 3
|
|
186
|
+
}, 8, ["show"]));
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
export {
|
|
190
|
+
Q as _
|
|
191
|
+
};
|