@oneclick.dev/cms-core-modules 0.0.53 → 0.0.54
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/CalendarDate-CRT2Viyt.mjs +830 -0
- package/dist/CalendarDate-CWtpXgpD.js +1 -0
- package/dist/Components-D9yIIosM.mjs +623 -0
- package/dist/Components-DXbx0RLV.js +1 -0
- package/dist/ContentEditor-DRJFQKCv.mjs +34915 -0
- package/dist/ContentEditor-DzTi8fSZ.js +290 -0
- package/dist/Create-BP8TX6rj.js +1 -0
- package/dist/Create-Bwf1RXdG.mjs +1248 -0
- package/dist/DateFormatter-BbcSwTs4.js +1 -0
- package/dist/DateFormatter-CbO0PVUK.mjs +99 -0
- package/dist/Detail-B-PnkcXD.mjs +3473 -0
- package/dist/Detail-BVlGSjOq.mjs +380 -0
- package/dist/Detail-C4E1T87K.mjs +26 -0
- package/dist/Detail-CNfTDUE5.js +1 -0
- package/dist/Detail-Cd5CBVN0.js +1 -0
- package/dist/Detail-CpfOQChd.mjs +585 -0
- package/dist/Detail-CwagT6gQ.mjs +650 -0
- package/dist/Detail-DUo6qKqO.js +1 -0
- package/dist/Detail-Dd_OkpcN.js +1 -0
- package/dist/Detail-mvSGbnFU.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +55 -0
- package/dist/Entries-DcpPvlYj.js +1 -0
- package/dist/Entries-QLMtTYLX.mjs +713 -0
- package/dist/Find-BPR0uU-Z.mjs +229 -0
- package/dist/Find-BidEQJxT.js +1 -0
- package/dist/GlobalStyling-CMzPRd18.js +17 -0
- package/dist/GlobalStyling-DoLHUJeV.mjs +988 -0
- package/dist/Overview-BDlBCUI_.js +1 -0
- package/dist/Overview-BH3NwvNX.mjs +26 -0
- package/dist/Overview-BLsZMHNW.mjs +178 -0
- package/dist/Overview-BNMZ9MUK.js +1 -0
- package/dist/Overview-BbvfH1u-.js +1 -0
- package/dist/Overview-CDN88OSM.mjs +190 -0
- package/dist/Overview-CEPodGCn.mjs +311 -0
- package/dist/Overview-CvquDPhB.js +1 -0
- package/dist/Overview-D54pjmI6.mjs +633 -0
- package/dist/Overview-D67UjG6n.mjs +947 -0
- package/dist/Overview-KT2Mgfh5.js +1 -0
- package/dist/Overview-T-lsy3UZ.js +1 -0
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +1 -0
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +392 -0
- package/dist/TableView-CpO53xcX.js +111 -0
- package/dist/TableView-D9J5rUls.mjs +72921 -0
- package/dist/TemplateList.vue_vue_type_script_setup_true_lang-B_AtWnHa.js +1 -0
- package/dist/TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs +40 -0
- package/dist/View-DlHBZbFu.js +1 -0
- package/dist/View-Dv5QMrSn.mjs +25 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/dist/agenda-B49oKGeh.mjs +706 -0
- package/dist/agenda-DipQ5IWP.js +1 -0
- package/dist/availability-C7q9tq6l.js +1 -0
- package/dist/availability-DeCkqiu8.mjs +613 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/countries-BTPvmrsb.mjs +4 -0
- package/dist/countries-CgZ081No.js +1 -0
- package/dist/exceptions-D3b18TiY.mjs +647 -0
- package/dist/exceptions-DJ9zWX3k.js +1 -0
- package/dist/floating-ui.dom-C82nbomj.js +1 -0
- package/dist/floating-ui.dom-ouSgPqty.mjs +1133 -0
- package/dist/google-CvtuJwgk.mjs +4 -0
- package/dist/google-D4N3gb01.js +1 -0
- package/dist/index--jjEzba7.mjs +24 -0
- package/dist/index-9HVlmvK3.js +1 -0
- package/dist/index-BEGU8Kme.mjs +12 -0
- package/dist/index-Bwi1mtkq.mjs +24 -0
- package/dist/index-BzuHN-r8.mjs +24 -0
- package/dist/index-CImCyE3L.mjs +24 -0
- package/dist/index-CKPshlZ8-BQiiP6r_.mjs +1264 -0
- package/dist/index-CKPshlZ8-CIz1tDwX.js +1 -0
- package/dist/index-CQiY-oTN.mjs +24 -0
- package/dist/index-CSxYBeVA.js +1 -0
- package/dist/index-CkiNvRzs.js +1 -0
- package/dist/index-Co4ON2Di.js +1 -0
- package/dist/index-CwqrAU-H.js +1 -0
- package/dist/index-Cz-baGax.js +1 -0
- package/dist/index-D2a6wEPh.js +1 -0
- package/dist/index-DFQGVHTs.js +1 -0
- package/dist/index-DI6mydpm.mjs +138 -0
- package/dist/index-DMoyoaks.mjs +22 -0
- package/dist/index-DT1wWnUk.mjs +24 -0
- package/dist/index-DUeFrD-B.js +1 -0
- package/dist/index-DsnoK4ia.mjs +579 -0
- package/dist/index-R2oUDsjx.js +1 -0
- package/dist/index-RLz1QPrf.mjs +203 -0
- package/dist/index-UtjLbLw-.js +1 -0
- package/dist/index-_mG-aU3Z.mjs +87 -0
- package/dist/index-_sQDF1pH.js +1 -0
- package/dist/index-ijdf0d9-.js +1 -0
- package/dist/index-klI238nT.mjs +24 -0
- package/dist/index.cjs.js +1 -330
- package/dist/index.mjs +287 -69051
- package/dist/interpolation-BNUjI7LH.js +1 -0
- package/dist/interpolation-BpGXqOz8.mjs +59 -0
- package/dist/payment-kTjsV0Jj.js +1 -0
- package/dist/payment-zpCM0LD-.mjs +981 -0
- package/dist/regular-C4_3YXqx.mjs +602 -0
- package/dist/regular-DFwPEbZO.js +1 -0
- package/dist/regular-slots-4ooEpICB.mjs +67 -0
- package/dist/regular-slots-BAVGbomI.js +1 -0
- package/dist/resources-MpQkSstv.mjs +563 -0
- package/dist/resources-iM28T3dD.js +1 -0
- package/dist/src/appointments/index.d.ts +4 -28
- package/dist/src/appointments/routes.d.ts +3 -9
- package/dist/src/content-manager/index.d.ts +5 -147
- package/dist/src/content-manager/routes.d.ts +4 -128
- package/dist/src/custom/index.d.ts +2 -2
- package/dist/src/custom/routes.d.ts +1 -1
- package/dist/src/mail-templates/index.d.ts +2 -30
- package/dist/src/mail-templates/routes.d.ts +1 -11
- package/dist/src/product-collections/index.d.ts +2 -30
- package/dist/src/product-collections/routes.d.ts +1 -11
- package/dist/src/products/index.d.ts +2 -30
- package/dist/src/products/routes.d.ts +1 -11
- package/dist/src/promo-codes/index.d.ts +2 -30
- package/dist/src/promo-codes/routes.d.ts +1 -11
- package/dist/src/shipping-options/index.d.ts +2 -30
- package/dist/src/shipping-options/routes.d.ts +1 -11
- package/dist/src/table/index.d.ts +2 -70
- package/dist/src/table/routes.d.ts +1 -51
- package/dist/utils-BVKy9S2J.mjs +29 -0
- package/dist/utils-D6CaKJbp.js +2 -0
- package/dist/vee-validate-zod-BPQyEfpF.js +1 -0
- package/dist/vee-validate-zod-IXkfh-6Q.mjs +4402 -0
- package/package.json +3 -3
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { defineComponent as Y, ref as y, withAsyncContext as M, watch as $, onMounted as O, resolveComponent as s, createElementBlock as j, openBlock as d, createElementVNode as c, createVNode as t, unref as v, withCtx as l, createTextVNode as o, createBlock as g, createCommentVNode as T, toDisplayString as r, Fragment as Q, renderList as h } from "vue";
|
|
2
|
+
import { useModulePermissions as G, useModuleRoute as J, useModuleStorage as K, useModuleBreadcrumbs as W, useFirebaseIntegration as X, useRoute as Z, useRouter as ee } from "@oneclick.dev/cms-kit";
|
|
3
|
+
import { Plus as te, Search as le, Loader2 as ne, Pencil as oe } from "lucide-vue-next";
|
|
4
|
+
import { u as se } from "./index-_mG-aU3Z.mjs";
|
|
5
|
+
const ae = { class: "relative" }, ue = {
|
|
6
|
+
ref: "container",
|
|
7
|
+
class: "w-full max-w-5xl mx-auto"
|
|
8
|
+
}, ie = { class: "flex justify-between items-center mb-4" }, re = { class: "relative w-full max-w-sm items-center" }, de = { class: "absolute start-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none" }, ce = { class: "absolute end-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none" }, ye = /* @__PURE__ */ Y({
|
|
9
|
+
__name: "Find",
|
|
10
|
+
props: {
|
|
11
|
+
config: {
|
|
12
|
+
type: Object,
|
|
13
|
+
required: !0
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
async setup(z) {
|
|
17
|
+
let a, b;
|
|
18
|
+
const x = z, { hasPermission: fe } = G(), { navigateTo: B } = J(), { getModuleData: F } = K();
|
|
19
|
+
W(() => [
|
|
20
|
+
{ text: "Promo codes list" }
|
|
21
|
+
]);
|
|
22
|
+
const w = y([]);
|
|
23
|
+
w.value = ([a, b] = M(() => F("promo-types")), a = await a, b(), a || []);
|
|
24
|
+
const _ = y([]), k = X(x.config.project);
|
|
25
|
+
_.value = ([a, b] = M(() => k.find(x.config.promoCodeCollection)), a = await a, b(), a);
|
|
26
|
+
const N = Z(), R = ee(), u = y(N.query.q || ""), C = y(""), S = y(!1), P = se(async () => {
|
|
27
|
+
S.value = !0;
|
|
28
|
+
let i = u.value.trim().toUpperCase();
|
|
29
|
+
i.length === 0 ? _.value = await k.find(x.config.promoCodeCollection) : _.value = await k.find(x.config.promoCodeCollection, {
|
|
30
|
+
filters: [
|
|
31
|
+
{
|
|
32
|
+
field: "code",
|
|
33
|
+
operator: ">=",
|
|
34
|
+
value: i
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
field: "code",
|
|
38
|
+
operator: "<",
|
|
39
|
+
value: i.slice(0, -1) + String.fromCharCode(i.slice(-1).charCodeAt(0) + 1)
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}), C.value = u.value, S.value = !1;
|
|
43
|
+
}, 600);
|
|
44
|
+
$(u, async () => {
|
|
45
|
+
await P(), R.replace({
|
|
46
|
+
query: {
|
|
47
|
+
...N.query,
|
|
48
|
+
q: u.value.trim() ? u.value.trim() : void 0
|
|
49
|
+
// remove param when empty
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
const D = (i) => {
|
|
54
|
+
const e = /* @__PURE__ */ new Date();
|
|
55
|
+
return i.expiresAt > e && i.startsAt < e;
|
|
56
|
+
};
|
|
57
|
+
return O(async () => {
|
|
58
|
+
u.value.trim() && await P();
|
|
59
|
+
}), (i, e) => {
|
|
60
|
+
const V = s("Button"), H = s("Input"), q = s("TableCaption"), f = s("TableHead"), A = s("TableRow"), E = s("TableHeader"), m = s("TableCell"), I = s("TableBody"), L = s("Table"), U = s("Card");
|
|
61
|
+
return d(), j("div", ae, [
|
|
62
|
+
c("div", ue, [
|
|
63
|
+
c("div", ie, [
|
|
64
|
+
e[3] || (e[3] = c("h1", { class: "text-2xl font-bold" }, "Find Promo Codes", -1)),
|
|
65
|
+
t(V, {
|
|
66
|
+
onClick: e[0] || (e[0] = (n) => v(B)("")),
|
|
67
|
+
variant: "outline"
|
|
68
|
+
}, {
|
|
69
|
+
default: l(() => [
|
|
70
|
+
t(v(te), { class: "size-4" }),
|
|
71
|
+
e[2] || (e[2] = o(" Create New Promo Code ", -1))
|
|
72
|
+
]),
|
|
73
|
+
_: 1
|
|
74
|
+
})
|
|
75
|
+
]),
|
|
76
|
+
t(U, { class: "p-4" }, {
|
|
77
|
+
default: l(() => [
|
|
78
|
+
c("div", re, [
|
|
79
|
+
t(H, {
|
|
80
|
+
id: "search",
|
|
81
|
+
type: "text",
|
|
82
|
+
placeholder: "Search...",
|
|
83
|
+
modelValue: u.value,
|
|
84
|
+
"onUpdate:modelValue": e[1] || (e[1] = (n) => u.value = n),
|
|
85
|
+
class: "px-8"
|
|
86
|
+
}, null, 8, ["modelValue"]),
|
|
87
|
+
c("span", de, [
|
|
88
|
+
t(v(le), { class: "size-4 text-muted-foreground" })
|
|
89
|
+
]),
|
|
90
|
+
c("span", ce, [
|
|
91
|
+
S.value ? (d(), g(v(ne), {
|
|
92
|
+
key: 0,
|
|
93
|
+
class: "size-4 text-muted-foreground animate-spin"
|
|
94
|
+
})) : T("", !0)
|
|
95
|
+
])
|
|
96
|
+
]),
|
|
97
|
+
t(L, null, {
|
|
98
|
+
default: l(() => [
|
|
99
|
+
C.value ? T("", !0) : (d(), g(q, { key: 0 }, {
|
|
100
|
+
default: l(() => [...e[4] || (e[4] = [
|
|
101
|
+
o("A list of your most recent promo codes.", -1)
|
|
102
|
+
])]),
|
|
103
|
+
_: 1
|
|
104
|
+
})),
|
|
105
|
+
C.value ? (d(), g(q, { key: 1 }, {
|
|
106
|
+
default: l(() => [
|
|
107
|
+
e[5] || (e[5] = o("A list of your promo codes starting with ", -1)),
|
|
108
|
+
c("strong", null, '"' + r(C.value) + '"', 1),
|
|
109
|
+
e[6] || (e[6] = o(".", -1))
|
|
110
|
+
]),
|
|
111
|
+
_: 1
|
|
112
|
+
})) : T("", !0),
|
|
113
|
+
t(E, null, {
|
|
114
|
+
default: l(() => [
|
|
115
|
+
t(A, null, {
|
|
116
|
+
default: l(() => [
|
|
117
|
+
t(f, null, {
|
|
118
|
+
default: l(() => [...e[7] || (e[7] = [
|
|
119
|
+
o("Code", -1)
|
|
120
|
+
])]),
|
|
121
|
+
_: 1
|
|
122
|
+
}),
|
|
123
|
+
t(f, null, {
|
|
124
|
+
default: l(() => [...e[8] || (e[8] = [
|
|
125
|
+
o("Type", -1)
|
|
126
|
+
])]),
|
|
127
|
+
_: 1
|
|
128
|
+
}),
|
|
129
|
+
t(f, null, {
|
|
130
|
+
default: l(() => [...e[9] || (e[9] = [
|
|
131
|
+
o("Value", -1)
|
|
132
|
+
])]),
|
|
133
|
+
_: 1
|
|
134
|
+
}),
|
|
135
|
+
t(f, null, {
|
|
136
|
+
default: l(() => [...e[10] || (e[10] = [
|
|
137
|
+
o("Used", -1)
|
|
138
|
+
])]),
|
|
139
|
+
_: 1
|
|
140
|
+
}),
|
|
141
|
+
t(f, null, {
|
|
142
|
+
default: l(() => [...e[11] || (e[11] = [
|
|
143
|
+
o("Still eligible", -1)
|
|
144
|
+
])]),
|
|
145
|
+
_: 1
|
|
146
|
+
}),
|
|
147
|
+
t(f, null, {
|
|
148
|
+
default: l(() => [...e[12] || (e[12] = [
|
|
149
|
+
o("Action", -1)
|
|
150
|
+
])]),
|
|
151
|
+
_: 1
|
|
152
|
+
})
|
|
153
|
+
]),
|
|
154
|
+
_: 1
|
|
155
|
+
})
|
|
156
|
+
]),
|
|
157
|
+
_: 1
|
|
158
|
+
}),
|
|
159
|
+
_.value?.length > 0 ? (d(), g(I, { key: 2 }, {
|
|
160
|
+
default: l(() => [
|
|
161
|
+
(d(!0), j(Q, null, h(_.value, (n) => (d(), g(A, {
|
|
162
|
+
key: n.id
|
|
163
|
+
}, {
|
|
164
|
+
default: l(() => [
|
|
165
|
+
t(m, { class: "font-medium uppercase" }, {
|
|
166
|
+
default: l(() => [
|
|
167
|
+
o(r(n.code), 1)
|
|
168
|
+
]),
|
|
169
|
+
_: 2
|
|
170
|
+
}, 1024),
|
|
171
|
+
t(m, null, {
|
|
172
|
+
default: l(() => [
|
|
173
|
+
o(r(w.value.find((p) => p.key === n.type)?.label), 1)
|
|
174
|
+
]),
|
|
175
|
+
_: 2
|
|
176
|
+
}, 1024),
|
|
177
|
+
t(m, null, {
|
|
178
|
+
default: l(() => [
|
|
179
|
+
o(r(w.value.find((p) => p.key === n.type)?.valuePrefix) + " " + r(n.value) + " " + r(w.value.find((p) => p.key === n.type)?.valueSuffix), 1)
|
|
180
|
+
]),
|
|
181
|
+
_: 2
|
|
182
|
+
}, 1024),
|
|
183
|
+
t(m, null, {
|
|
184
|
+
default: l(() => [
|
|
185
|
+
o(r(n.usageLimit === 1 ? n.usageCount > 0 ? "Yes" : "No" : n.usageCount === 0 ? "No" : n.usageCount === 1 ? "1 time" : n.usageCount + " times"), 1)
|
|
186
|
+
]),
|
|
187
|
+
_: 2
|
|
188
|
+
}, 1024),
|
|
189
|
+
t(m, null, {
|
|
190
|
+
default: l(() => [
|
|
191
|
+
o(r(D(n) ? "Yes" : "No"), 1)
|
|
192
|
+
]),
|
|
193
|
+
_: 2
|
|
194
|
+
}, 1024),
|
|
195
|
+
t(m, null, {
|
|
196
|
+
default: l(() => [
|
|
197
|
+
t(V, {
|
|
198
|
+
variant: "ghost",
|
|
199
|
+
size: "icon",
|
|
200
|
+
onClick: (p) => v(B)("/promo-codes/" + n.id)
|
|
201
|
+
}, {
|
|
202
|
+
default: l(() => [
|
|
203
|
+
t(v(oe), { class: "size-4" })
|
|
204
|
+
]),
|
|
205
|
+
_: 1
|
|
206
|
+
}, 8, ["onClick"])
|
|
207
|
+
]),
|
|
208
|
+
_: 2
|
|
209
|
+
}, 1024)
|
|
210
|
+
]),
|
|
211
|
+
_: 2
|
|
212
|
+
}, 1024))), 128))
|
|
213
|
+
]),
|
|
214
|
+
_: 1
|
|
215
|
+
})) : T("", !0)
|
|
216
|
+
]),
|
|
217
|
+
_: 1
|
|
218
|
+
})
|
|
219
|
+
]),
|
|
220
|
+
_: 1
|
|
221
|
+
})
|
|
222
|
+
], 512)
|
|
223
|
+
]);
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
export {
|
|
228
|
+
ye as default
|
|
229
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("@oneclick.dev/cms-kit"),x=require("lucide-vue-next"),P=require("./index-DUeFrD-B.js"),A={class:"relative"},M={ref:"container",class:"w-full max-w-5xl mx-auto"},j={class:"flex justify-between items-center mb-4"},z={class:"relative w-full max-w-sm items-center"},F={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none"},R={class:"absolute end-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none"},H=e.defineComponent({__name:"Find",props:{config:{type:Object,required:!0}},async setup(T){let n,d;const f=T,{hasPermission:I}=r.useModulePermissions(),{navigateTo:N}=r.useModuleRoute(),{getModuleData:b}=r.useModuleStorage();r.useModuleBreadcrumbs(()=>[{text:"Promo codes list"}]);const m=e.ref([]);m.value=([n,d]=e.withAsyncContext(()=>b("promo-types")),n=await n,d(),n||[]);const c=e.ref([]),v=r.useFirebaseIntegration(f.config.project);c.value=([n,d]=e.withAsyncContext(()=>v.find(f.config.promoCodeCollection)),n=await n,d(),n);const V=r.useRoute(),k=r.useRouter(),l=e.ref(V.query.q||""),p=e.ref(""),C=e.ref(!1),y=P.useDebounceFn(async()=>{C.value=!0;let a=l.value.trim().toUpperCase();a.length===0?c.value=await v.find(f.config.promoCodeCollection):c.value=await v.find(f.config.promoCodeCollection,{filters:[{field:"code",operator:">=",value:a},{field:"code",operator:"<",value:a.slice(0,-1)+String.fromCharCode(a.slice(-1).charCodeAt(0)+1)}]}),p.value=l.value,C.value=!1},600);e.watch(l,async()=>{await y(),k.replace({query:{...V.query,q:l.value.trim()?l.value.trim():void 0}})});const h=a=>{const t=new Date;return a.expiresAt>t&&a.startsAt<t};return e.onMounted(async()=>{l.value.trim()&&await y()}),(a,t)=>{const w=e.resolveComponent("Button"),B=e.resolveComponent("Input"),_=e.resolveComponent("TableCaption"),s=e.resolveComponent("TableHead"),g=e.resolveComponent("TableRow"),S=e.resolveComponent("TableHeader"),i=e.resolveComponent("TableCell"),q=e.resolveComponent("TableBody"),D=e.resolveComponent("Table"),E=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",M,[e.createElementVNode("div",j,[t[3]||(t[3]=e.createElementVNode("h1",{class:"text-2xl font-bold"},"Find Promo Codes",-1)),e.createVNode(w,{onClick:t[0]||(t[0]=o=>e.unref(N)("")),variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(x.Plus),{class:"size-4"}),t[2]||(t[2]=e.createTextVNode(" Create New Promo Code ",-1))]),_:1})]),e.createVNode(E,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",z,[e.createVNode(B,{id:"search",type:"text",placeholder:"Search...",modelValue:l.value,"onUpdate:modelValue":t[1]||(t[1]=o=>l.value=o),class:"px-8"},null,8,["modelValue"]),e.createElementVNode("span",F,[e.createVNode(e.unref(x.Search),{class:"size-4 text-muted-foreground"})]),e.createElementVNode("span",R,[C.value?(e.openBlock(),e.createBlock(e.unref(x.Loader2),{key:0,class:"size-4 text-muted-foreground animate-spin"})):e.createCommentVNode("",!0)])]),e.createVNode(D,null,{default:e.withCtx(()=>[p.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(_,{key:0},{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("A list of your most recent promo codes.",-1)])]),_:1})),p.value?(e.openBlock(),e.createBlock(_,{key:1},{default:e.withCtx(()=>[t[5]||(t[5]=e.createTextVNode("A list of your promo codes starting with ",-1)),e.createElementVNode("strong",null,'"'+e.toDisplayString(p.value)+'"',1),t[6]||(t[6]=e.createTextVNode(".",-1))]),_:1})):e.createCommentVNode("",!0),e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(s,null,{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Code",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Type",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Value",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Used",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Still eligible",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Action",-1)])]),_:1})]),_:1})]),_:1}),c.value?.length>0?(e.openBlock(),e.createBlock(q,{key:2},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,o=>(e.openBlock(),e.createBlock(g,{key:o.id},{default:e.withCtx(()=>[e.createVNode(i,{class:"font-medium uppercase"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.code),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.find(u=>u.key===o.type)?.label),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.find(u=>u.key===o.type)?.valuePrefix)+" "+e.toDisplayString(o.value)+" "+e.toDisplayString(m.value.find(u=>u.key===o.type)?.valueSuffix),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.usageLimit===1?o.usageCount>0?"Yes":"No":o.usageCount===0?"No":o.usageCount===1?"1 time":o.usageCount+" times"),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h(o)?"Yes":"No"),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(w,{variant:"ghost",size:"icon",onClick:u=>e.unref(N)("/promo-codes/"+o.id)},{default:e.withCtx(()=>[e.createVNode(e.unref(x.Pencil),{class:"size-4"})]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024))),128))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})],512)])}}});exports.default=H;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),D=require("@oneclick.dev/cms-kit"),m=require("lucide-vue-next"),z={class:"grid py-4"},U={class:"grid grid-cols-2 gap-2 mb-6"},R={class:"relative"},A={class:"grid grid-cols-3 gap-2 mb-6"},L={class:"relative"},M={class:"relative"},I={class:"relative"},G={class:"grid grid-cols-1 gap-2 mb-6"},O={class:"relative"},P={class:"flex items-center space-x-2"},J={class:"flex items-center space-x-2"},H={class:"grid grid-cols-2 gap-2 mb-6"},j={key:0},q={class:"relative"},K={key:1},Q={class:"relative"},W={key:0,class:"bg-muted px-4 py-2 rounded-md text-sm"},X=e.defineComponent({__name:"SectionStyleDialog",props:{buttons:{type:Array,default:()=>[]}},emits:["add","edit","delete"],setup(h,{expose:k,emit:b}){const{confirm:f}=D.useConfirmation(),g=b,y=e.ref(!1),s=e.ref("create"),r=e.ref(null),p=e.ref(!1),o=e.reactive({name:"",rendering:"class",className:"",componentName:"",styles:{backgroundColor:"#FFFFFF",titleColor:"#000000",textColor:"#000000"}}),B=v=>{v?(s.value="edit",r.value=v.id,p.value=v.id==="DEFAULT",o.name=v.name||"",o.rendering=v.rendering||"class",o.className=v.className||"",o.componentName=v.componentName||"",o.styles.backgroundColor=v.styles.backgroundColor||"#FFFFFF",o.styles.titleColor=v.styles.titleColor||"#000000",o.styles.textColor=v.styles.textColor||"#000000"):(s.value="create",r.value=null,p.value=!1,o.name="",o.rendering="class",o.className="",o.componentName="",o.styles.backgroundColor="#FFFFFF",o.styles.titleColor="#000000",o.styles.textColor="#000000"),y.value=!0},E=()=>{g("add",o),y.value=!1},T=()=>{p.value&&(o.name="Default"),g("edit",{id:r.value,...o}),y.value=!1},S=async()=>{if(p.value)return;await f("Are you sure you want to delete this theme? This action cannot be undone.","Delete Theme","Delete")&&(g("delete",r.value),y.value=!1)},w=()=>{o.styles.backgroundColor="#FFFFFF",o.styles.titleColor="#000000",o.styles.textColor="#000000"};return k({openDialog:B}),(v,n)=>{const l=e.resolveComponent("DialogTitle"),t=e.resolveComponent("DialogDescription"),d=e.resolveComponent("DialogHeader"),c=e.resolveComponent("Label"),i=e.resolveComponent("Input"),x=e.resolveComponent("RadioGroupItem"),C=e.resolveComponent("RadioGroup"),V=e.resolveComponent("Button"),F=e.resolveComponent("DialogFooter"),N=e.resolveComponent("DialogScrollContent"),$=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock($,{open:y.value,"onUpdate:open":n[10]||(n[10]=u=>y.value=u)},{default:e.withCtx(()=>[e.createVNode(N,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(d,null,{default:e.withCtx(()=>[e.createVNode(l,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.value==="create"?"Add New Section Style":"Edit Section Style"),1)]),_:1}),e.createVNode(t,null,{default:e.withCtx(()=>[...n[11]||(n[11]=[e.createTextVNode(" These settings change how this section looks in the editor. To style your live site, add matching CSS or use a custom component. ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",z,[e.createElementVNode("div",U,[e.createElementVNode("div",null,[e.createVNode(c,{class:"mb-2",for:"collection-theme-dialog-theme-name"},{default:e.withCtx(()=>[...n[12]||(n[12]=[e.createTextVNode("Display name",-1)])]),_:1}),e.createElementVNode("div",R,[e.createVNode(i,{modelValue:o.name,"onUpdate:modelValue":n[0]||(n[0]=u=>o.name=u),id:"collection-theme-dialog-theme-name",disabled:p.value},null,8,["modelValue","disabled"])])])]),n[21]||(n[21]=e.createElementVNode("h2",{class:"font-semibold mb-4"},"Style Settings",-1)),e.createElementVNode("div",A,[e.createElementVNode("div",null,[e.createVNode(c,{class:"mb-2",for:"collection-theme-dialog-background-color"},{default:e.withCtx(()=>[...n[13]||(n[13]=[e.createTextVNode("Background color",-1)])]),_:1}),e.createElementVNode("div",L,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n[1]||(n[1]=u=>o.styles.backgroundColor=u),type:"color",label:"Primary Color",class:"absolute top-0.5 left-1 size-8"},null,512),[[e.vModelText,o.styles.backgroundColor]]),e.createVNode(i,{modelValue:o.styles.backgroundColor,"onUpdate:modelValue":n[2]||(n[2]=u=>o.styles.backgroundColor=u),class:"pl-12",id:"collection-theme-dialog-background-color"},null,8,["modelValue"])])]),e.createElementVNode("div",null,[e.createVNode(c,{class:"mb-2",for:"collection-theme-dialog-title-color"},{default:e.withCtx(()=>[...n[14]||(n[14]=[e.createTextVNode("Heading color",-1)])]),_:1}),e.createElementVNode("div",M,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n[3]||(n[3]=u=>o.styles.titleColor=u),type:"color",label:"Primary Color",class:"absolute top-0.5 left-1 size-8"},null,512),[[e.vModelText,o.styles.titleColor]]),e.createVNode(i,{modelValue:o.styles.titleColor,"onUpdate:modelValue":n[4]||(n[4]=u=>o.styles.titleColor=u),class:"pl-12",id:"collection-theme-dialog-title-color"},null,8,["modelValue"])])]),e.createElementVNode("div",null,[e.createVNode(c,{class:"mb-2",for:"collection-theme-dialog-text-color"},{default:e.withCtx(()=>[...n[15]||(n[15]=[e.createTextVNode("Body text color",-1)])]),_:1}),e.createElementVNode("div",I,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n[5]||(n[5]=u=>o.styles.textColor=u),type:"color",label:"Primary Color",class:"absolute top-0.5 left-1 size-8"},null,512),[[e.vModelText,o.styles.textColor]]),e.createVNode(i,{modelValue:o.styles.textColor,"onUpdate:modelValue":n[6]||(n[6]=u=>o.styles.textColor=u),class:"pl-12",id:"collection-theme-dialog-text-color"},null,8,["modelValue"])])])]),n[22]||(n[22]=e.createElementVNode("h2",{class:"font-semibold mb-4"},"Rendering Method",-1)),e.createElementVNode("div",G,[e.createElementVNode("div",null,[e.createElementVNode("div",O,[e.createVNode(c,{class:"mb-4 text-muted-foreground"},{default:e.withCtx(()=>[...n[16]||(n[16]=[e.createTextVNode("Choose how this section should be styled on your site:",-1)])]),_:1}),e.createVNode(C,{modelValue:o.rendering,"onUpdate:modelValue":n[7]||(n[7]=u=>o.rendering=u),"default-value":"class"},{default:e.withCtx(()=>[e.createElementVNode("div",P,[e.createVNode(x,{id:"collection-theme-dialog-render-class",value:"class"}),e.createVNode(c,{for:"collection-theme-dialog-render-class"},{default:e.withCtx(()=>[...n[17]||(n[17]=[e.createTextVNode("Use a CSS class",-1)])]),_:1})]),e.createElementVNode("div",J,[e.createVNode(x,{id:"collection-theme-dialog-render-component",value:"component"}),e.createVNode(c,{for:"collection-theme-dialog-render-component"},{default:e.withCtx(()=>[...n[18]||(n[18]=[e.createTextVNode("Custom component",-1)])]),_:1})])]),_:1},8,["modelValue"])])])]),e.createElementVNode("div",H,[o.rendering==="class"?(e.openBlock(),e.createElementBlock("div",j,[e.createVNode(c,{class:"mb-2",for:"collection-theme-dialog-class-name"},{default:e.withCtx(()=>[...n[19]||(n[19]=[e.createTextVNode("Class name",-1)])]),_:1}),e.createElementVNode("div",q,[e.createVNode(i,{modelValue:o.className,"onUpdate:modelValue":n[8]||(n[8]=u=>o.className=u),id:"collection-theme-dialog-class-name"},null,8,["modelValue"])])])):(e.openBlock(),e.createElementBlock("div",K,[e.createVNode(c,{class:"mb-2",for:"collection-theme-dialog-component-name"},{default:e.withCtx(()=>[...n[20]||(n[20]=[e.createTextVNode("Component name",-1)])]),_:1}),e.createElementVNode("div",Q,[e.createVNode(i,{modelValue:o.componentName,"onUpdate:modelValue":n[9]||(n[9]=u=>o.componentName=u),id:"collection-theme-dialog-component-name"},null,8,["modelValue"])])]))]),o.rendering==="class"?(e.openBlock(),e.createElementBlock("pre",W,"."+e.toDisplayString(o.className)+` {
|
|
2
|
+
background-color: `+e.toDisplayString(o.styles.backgroundColor)+`;
|
|
3
|
+
color: `+e.toDisplayString(o.styles.textColor)+`;
|
|
4
|
+
|
|
5
|
+
h1, h2, h3, h4, h5, h6 {
|
|
6
|
+
color: `+e.toDisplayString(o.styles.titleColor)+`;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`,1)):e.createCommentVNode("",!0)]),e.createVNode(F,null,{default:e.withCtx(()=>[s.value==="edit"&&!p.value?(e.openBlock(),e.createBlock(V,{key:0,variant:"destructive",class:"mr-auto",onClick:S},{default:e.withCtx(()=>[...n[23]||(n[23]=[e.createTextVNode(" Delete Style ",-1)])]),_:1})):e.createCommentVNode("",!0),s.value==="edit"&&p.value?(e.openBlock(),e.createBlock(V,{key:1,variant:"outline",class:"mr-auto",onClick:w},{default:e.withCtx(()=>[...n[24]||(n[24]=[e.createTextVNode(" Reset to Default ",-1)])]),_:1})):e.createCommentVNode("",!0),s.value==="create"?(e.openBlock(),e.createBlock(V,{key:2,type:"submit",onClick:E},{default:e.withCtx(()=>[...n[25]||(n[25]=[e.createTextVNode(" Add Style ",-1)])]),_:1})):(e.openBlock(),e.createBlock(V,{key:3,type:"submit",onClick:T},{default:e.withCtx(()=>[...n[26]||(n[26]=[e.createTextVNode(" Save Changes ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),Y={class:"grid py-4"},Z={class:"grid grid-cols-2 gap-2 mb-6"},ee={class:"relative"},te={class:"grid grid-cols-3 gap-2 mb-6"},oe={class:"relative"},le={class:"relative"},ne={class:"relative"},se={class:"grid grid-cols-4 gap-4 mb-6 bg-white/90 p-2 rounded"},re={class:"grid grid-cols-1 gap-2 mb-6"},ae={class:"relative"},de={class:"flex items-center space-x-2"},ie={class:"flex items-center space-x-2"},ce={class:"grid grid-cols-2 gap-2 mb-6"},ue={key:0},me={class:"relative"},pe={key:1},ye={class:"relative"},ve={key:0,class:"bg-muted px-4 py-2 rounded-md text-sm"},xe=e.defineComponent({__name:"ButtonStyleDialog",props:{buttons:{type:Array,default:()=>[]}},emits:["add","edit","delete"],setup(h,{expose:k,emit:b}){const{confirm:f}=D.useConfirmation(),g=b,y=e.ref(!1),s=e.ref("create"),r=e.ref(null),p=e.ref(!1),o=e.reactive({name:"",rendering:"class",className:"",componentName:"",styles:{backgroundColor:"#FFFFFF",textColor:"#000000",borderColor:"#000000",buttonRoundness:"none",buttonStyle:"default"}}),B=l=>{l?(s.value="edit",r.value=l.id,p.value=l.id==="DEFAULT",o.name=l.name||"",o.rendering=l.rendering||"class",o.className=l.className||"",o.componentName=l.componentName||"",o.styles.backgroundColor=l.styles.backgroundColor||"#FFFFFF",o.styles.textColor=l.styles.textColor||"#000000",o.styles.borderColor=l.styles.borderColor||"#000000",o.styles.buttonRoundness=l.styles.buttonRoundness||"none",o.styles.buttonStyle=l.styles.buttonStyle||"default"):(s.value="create",r.value=null,p.value=!1,o.name="",o.rendering="class",o.className="",o.componentName="",o.styles.backgroundColor="#FFFFFF",o.styles.textColor="#000000",o.styles.borderColor="#000000",o.styles.buttonRoundness="none",o.styles.buttonStyle="default"),y.value=!0},E=()=>{g("add",o),y.value=!1},T=()=>{p.value&&(o.name="Default"),g("edit",{id:r.value,...o}),y.value=!1},S=async()=>{if(p.value)return;await f("Are you sure you want to delete this theme? This action cannot be undone.","Delete Theme","Delete")&&(g("delete",r.value),y.value=!1)},w=()=>{o.styles.backgroundColor="#FFFFFF",o.styles.textColor="#000000",o.styles.borderColor="#000000",o.styles.buttonRoundness="none",o.styles.buttonStyle="default"},v=l=>{switch(l){case"none":return 0;case"small":return 8;case"medium":return 12;case"pill":return 99;default:return 0}},n=e.computed(()=>{let l="."+o.className+` {
|
|
10
|
+
`;return l+=` background-color: ${o.styles.backgroundColor};
|
|
11
|
+
`,l+=` color: ${o.styles.textColor};
|
|
12
|
+
`,o.styles.buttonStyle==="outline"?l+=` border: 1px solid ${o.styles.borderColor};
|
|
13
|
+
`:o.styles.buttonStyle==="shadow"?l+=` box-shadow: 0 3px 6px #ccc;
|
|
14
|
+
`:o.styles.buttonStyle==="retro"&&(l+=` box-shadow: inset 0 0 0 2px ${o.styles.borderColor}, 2px 2px 0 ${o.styles.borderColor};
|
|
15
|
+
`),o.styles.buttonRoundness!=="none"&&(l+=` border-radius: ${v(o.styles.buttonRoundness)}px;
|
|
16
|
+
`),l+=`}
|
|
17
|
+
`,l});return k({openDialog:B}),(l,t)=>{const d=e.resolveComponent("DialogTitle"),c=e.resolveComponent("DialogDescription"),i=e.resolveComponent("DialogHeader"),x=e.resolveComponent("Label"),C=e.resolveComponent("Input"),V=e.resolveComponent("RadioGroupItem"),F=e.resolveComponent("RadioGroup"),N=e.resolveComponent("Button"),$=e.resolveComponent("DialogFooter"),u=e.resolveComponent("DialogScrollContent"),_=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(_,{open:y.value,"onUpdate:open":t[18]||(t[18]=a=>y.value=a)},{default:e.withCtx(()=>[e.createVNode(u,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(d,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.value==="create"?"Add New Button Style":"Edit Button Style"),1)]),_:1}),e.createVNode(c,null,{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode(" These settings change how this section looks in the editor. To style your live site, add matching CSS or use a custom component. ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",Y,[e.createElementVNode("div",Z,[e.createElementVNode("div",null,[e.createVNode(x,{class:"mb-2",for:"collection-theme-dialog-theme-name"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Display name",-1)])]),_:1}),e.createElementVNode("div",ee,[e.createVNode(C,{modelValue:o.name,"onUpdate:modelValue":t[0]||(t[0]=a=>o.name=a),id:"collection-theme-dialog-theme-name",disabled:p.value},null,8,["modelValue","disabled"])])])]),t[38]||(t[38]=e.createElementVNode("h2",{class:"font-semibold mb-4"},"Style Settings",-1)),e.createElementVNode("div",te,[e.createElementVNode("div",null,[e.createVNode(x,{class:"mb-2",for:"collection-theme-dialog-background-color"},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Background color",-1)])]),_:1}),e.createElementVNode("div",oe,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[1]||(t[1]=a=>o.styles.backgroundColor=a),type:"color",label:"Primary Color",class:"absolute top-0.5 left-1 size-8"},null,512),[[e.vModelText,o.styles.backgroundColor]]),e.createVNode(C,{modelValue:o.styles.backgroundColor,"onUpdate:modelValue":t[2]||(t[2]=a=>o.styles.backgroundColor=a),class:"pl-12",id:"collection-theme-dialog-background-color"},null,8,["modelValue"])])]),e.createElementVNode("div",null,[e.createVNode(x,{class:"mb-2",for:"collection-theme-dialog-text-color"},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("Text color",-1)])]),_:1}),e.createElementVNode("div",le,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[3]||(t[3]=a=>o.styles.textColor=a),type:"color",label:"Primary Color",class:"absolute top-0.5 left-1 size-8"},null,512),[[e.vModelText,o.styles.textColor]]),e.createVNode(C,{modelValue:o.styles.textColor,"onUpdate:modelValue":t[4]||(t[4]=a=>o.styles.textColor=a),class:"pl-12",id:"collection-theme-dialog-text-color"},null,8,["modelValue"])])]),e.createElementVNode("div",null,[e.createVNode(x,{class:"mb-2",for:"collection-theme-dialog-border-color"},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Border color",-1)])]),_:1}),e.createElementVNode("div",ne,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[5]||(t[5]=a=>o.styles.borderColor=a),type:"color",label:"Primary Color",class:"absolute top-0.5 left-1 size-8"},null,512),[[e.vModelText,o.styles.borderColor]]),e.createVNode(C,{modelValue:o.styles.borderColor,"onUpdate:modelValue":t[6]||(t[6]=a=>o.styles.borderColor=a),class:"pl-12",id:"collection-theme-dialog-border-color"},null,8,["modelValue"])])])]),e.createElementVNode("div",{style:e.normalizeStyle(`--button-background-color: ${o.styles.backgroundColor}; --button-text-color: ${o.styles.textColor}`)},[e.createVNode(x,{class:"mb-4"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Shape",-1)])]),_:1}),e.createElementVNode("div",se,[e.createElementVNode("div",{class:"flex flex-col gap-2 items-center cursor-pointer",onClick:t[7]||(t[7]=a=>o.styles.buttonRoundness="none")},[t[25]||(t[25]=e.createElementVNode("div",{class:"text-center px-8 py-2 bg-[var(--button-background-color)] text-[var(--button-text-color)]"},"Button",-1)),o.styles.buttonRoundness!=="none"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 text-black/30"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheckBig),{key:1,class:"size-4 text-black"}))]),e.createElementVNode("div",{class:"flex flex-col gap-2 items-center cursor-pointer",onClick:t[8]||(t[8]=a=>o.styles.buttonRoundness="small")},[t[26]||(t[26]=e.createElementVNode("div",{class:"text-center px-8 py-2 bg-[var(--button-background-color)] text-[var(--button-text-color)] rounded-[8px]"},"Button",-1)),o.styles.buttonRoundness!=="small"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 text-black/30"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheckBig),{key:1,class:"size-4 text-black"}))]),e.createElementVNode("div",{class:"flex flex-col gap-2 items-center cursor-pointer",onClick:t[9]||(t[9]=a=>o.styles.buttonRoundness="medium")},[t[27]||(t[27]=e.createElementVNode("div",{class:"text-center px-8 py-2 bg-[var(--button-background-color)] text-[var(--button-text-color)] rounded-[12px]"},"Button",-1)),o.styles.buttonRoundness!=="medium"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 text-black/30"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheckBig),{key:1,class:"size-4 text-black"}))]),e.createElementVNode("div",{class:"flex flex-col gap-2 items-center cursor-pointer",onClick:t[10]||(t[10]=a=>o.styles.buttonRoundness="pill")},[t[28]||(t[28]=e.createElementVNode("div",{class:"text-center px-8 py-2 bg-[var(--button-background-color)] text-[var(--button-text-color)] rounded-[99px]"},"Button",-1)),o.styles.buttonRoundness!=="pill"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 text-black/30"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheckBig),{key:1,class:"size-4 text-black"}))])]),e.createVNode(x,{class:"mb-4"},{default:e.withCtx(()=>[...t[29]||(t[29]=[e.createTextVNode("Style",-1)])]),_:1}),e.createElementVNode("div",{class:"grid grid-cols-4 gap-4 mb-6 bg-white/90 p-2 rounded",style:e.normalizeStyle(`--button-border-radius: ${v(o.styles.buttonRoundness)}px; --button-border-color: ${o.styles.borderColor}`)},[e.createElementVNode("div",{class:"flex flex-col gap-2 items-center cursor-pointer",onClick:t[11]||(t[11]=a=>o.styles.buttonStyle="default")},[t[30]||(t[30]=e.createElementVNode("div",{class:"text-center px-8 py-2 bg-[var(--button-background-color)] text-[var(--button-text-color)] rounded-[var(--button-border-radius)]"},"Button",-1)),o.styles.buttonStyle!=="default"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 text-black/30"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheckBig),{key:1,class:"size-4 text-black"}))]),e.createElementVNode("div",{class:"flex flex-col gap-2 items-center cursor-pointer",onClick:t[12]||(t[12]=a=>o.styles.buttonStyle="outline")},[t[31]||(t[31]=e.createElementVNode("div",{class:"text-center px-8 py-2 bg-[var(--button-background-color)] text-[var(--button-text-color)] rounded-[var(--button-border-radius)] border border-[var(--button-border-color)]"}," Button ",-1)),o.styles.buttonStyle!=="outline"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 text-black/30"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheckBig),{key:1,class:"size-4 text-black"}))]),e.createElementVNode("div",{class:"flex flex-col gap-2 items-center cursor-pointer",onClick:t[13]||(t[13]=a=>o.styles.buttonStyle="shadow")},[t[32]||(t[32]=e.createElementVNode("div",{class:"text-center px-8 py-2 bg-[var(--button-background-color)] text-[var(--button-text-color)] rounded-[var(--button-border-radius)]",style:{"box-shadow":"0 3px 6px #ccc"}}," Button ",-1)),o.styles.buttonStyle!=="shadow"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 text-black/30"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheckBig),{key:1,class:"size-4 text-black"}))]),e.createElementVNode("div",{class:"flex flex-col gap-2 items-center cursor-pointer",onClick:t[14]||(t[14]=a=>o.styles.buttonStyle="retro")},[e.createElementVNode("div",{class:"text-center px-8 py-2 bg-[var(--button-background-color)] text-[var(--button-text-color)] rounded-[var(--button-border-radius)]",style:e.normalizeStyle(`box-shadow: inset 0 0 0 2px ${o.styles.borderColor}, 2px 2px 0 ${o.styles.borderColor};`)}," Button ",4),o.styles.buttonStyle!=="retro"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 text-black/30"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheckBig),{key:1,class:"size-4 text-black"}))])],4)],4),t[39]||(t[39]=e.createElementVNode("h2",{class:"font-semibold mb-4"},"Rendering Method",-1)),e.createElementVNode("div",re,[e.createElementVNode("div",null,[e.createElementVNode("div",ae,[e.createVNode(x,{class:"mb-4 text-muted-foreground"},{default:e.withCtx(()=>[...t[33]||(t[33]=[e.createTextVNode("Choose how this section should be styled on your site:",-1)])]),_:1}),e.createVNode(F,{modelValue:o.rendering,"onUpdate:modelValue":t[15]||(t[15]=a=>o.rendering=a),"default-value":"class"},{default:e.withCtx(()=>[e.createElementVNode("div",de,[e.createVNode(V,{id:"collection-theme-dialog-render-class",value:"class"}),e.createVNode(x,{for:"collection-theme-dialog-render-class"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode("Use a CSS class",-1)])]),_:1})]),e.createElementVNode("div",ie,[e.createVNode(V,{id:"collection-theme-dialog-render-component",value:"component"}),e.createVNode(x,{for:"collection-theme-dialog-render-component"},{default:e.withCtx(()=>[...t[35]||(t[35]=[e.createTextVNode("Custom component",-1)])]),_:1})])]),_:1},8,["modelValue"])])])]),e.createElementVNode("div",ce,[o.rendering==="class"?(e.openBlock(),e.createElementBlock("div",ue,[e.createVNode(x,{class:"mb-2",for:"collection-theme-dialog-class-name"},{default:e.withCtx(()=>[...t[36]||(t[36]=[e.createTextVNode("Class name",-1)])]),_:1}),e.createElementVNode("div",me,[e.createVNode(C,{modelValue:o.className,"onUpdate:modelValue":t[16]||(t[16]=a=>o.className=a),id:"collection-theme-dialog-class-name"},null,8,["modelValue"])])])):(e.openBlock(),e.createElementBlock("div",pe,[e.createVNode(x,{class:"mb-2",for:"collection-theme-dialog-component-name"},{default:e.withCtx(()=>[...t[37]||(t[37]=[e.createTextVNode("Component name",-1)])]),_:1}),e.createElementVNode("div",ye,[e.createVNode(C,{modelValue:o.componentName,"onUpdate:modelValue":t[17]||(t[17]=a=>o.componentName=a),id:"collection-theme-dialog-component-name"},null,8,["modelValue"])])]))]),o.rendering==="class"?(e.openBlock(),e.createElementBlock("pre",ve,e.toDisplayString(n.value),1)):e.createCommentVNode("",!0)]),e.createVNode($,null,{default:e.withCtx(()=>[s.value==="edit"&&!p.value?(e.openBlock(),e.createBlock(N,{key:0,variant:"destructive",class:"mr-auto",onClick:S},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode(" Delete Style ",-1)])]),_:1})):e.createCommentVNode("",!0),s.value==="edit"&&p.value?(e.openBlock(),e.createBlock(N,{key:1,variant:"outline",class:"mr-auto",onClick:w},{default:e.withCtx(()=>[...t[41]||(t[41]=[e.createTextVNode(" Reset to Default ",-1)])]),_:1})):e.createCommentVNode("",!0),s.value==="create"?(e.openBlock(),e.createBlock(N,{key:2,type:"submit",onClick:E},{default:e.withCtx(()=>[...t[42]||(t[42]=[e.createTextVNode(" Add Style ",-1)])]),_:1})):(e.openBlock(),e.createBlock(N,{key:3,type:"submit",onClick:T},{default:e.withCtx(()=>[...t[43]||(t[43]=[e.createTextVNode(" Save Changes ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),be={class:"w-full"},fe={class:"flex items-center justify-between gap-4 w-full my-4"},ge={key:0,class:"flex gap-4 flex-wrap mb-8"},Ce=["onClick"],Ve={class:"text-muted-foreground group-hover/item:text-white transition-colors duration-300"},Ne={key:1,class:"flex gap-4 flex-wrap mb-8"},ke={key:2,class:"flex gap-4 flex-wrap mb-8"},Be=["onClick"],Ee={class:"flex flex-col items-center justify-center rounded-md p-4 size-44 bg-white"},Te={class:"text-muted-foreground group-hover/item:text-white transition-colors duration-300"},Se={key:3,class:"flex gap-4 flex-wrap mb-8"},we=e.defineComponent({__name:"GlobalStyling",setup(h){const{navigateTo:k}=D.useModuleRoute(),{getModuleData:b,setModuleData:f}=D.useModuleStorage();D.useModuleBreadcrumbs(()=>[{text:"Global Styling"}]);const g=e.ref(""),y=e.ref(""),s=e.ref(null),r=e.ref(null),p=e.computed(()=>s.value===null?null:s.value&&s.value.find(l=>l.id==="DEFAULT")?s.value:[{id:"DEFAULT",name:"Default",className:"",styles:{backgroundColor:"#FFFFFF",textColor:"#000000"}},...s.value]),o=e.computed(()=>r.value===null?null:r.value&&r.value.find(l=>l.id==="DEFAULT")?r.value:[{id:"DEFAULT",name:"Default",className:"",styles:{backgroundColor:"#FFFFFF",textColor:"#000000"}},...r.value]);async function B(l){let t=JSON.parse(JSON.stringify(l)),d=crypto.randomUUID();t.id=d,s.value.push(t),s.value=await b("sectionThemes")||[],s.value.push(t),f("sectionThemes",s.value)}async function E(l){let t=JSON.parse(JSON.stringify(l)),d=s.value.findIndex(c=>c.id===t.id);d!==-1?s.value[d]=t:t.id==="DEFAULT"&&(Array.isArray(s.value)||(s.value=[]),s.value=[{id:"DEFAULT",name:"Default",styles:t.styles},...s.value]),s.value=await b("sectionThemes")||[],d=s.value.findIndex(c=>c.id===t.id),d!==-1?(s.value[d]=t,f("sectionThemes",s.value)):t.id==="DEFAULT"&&(Array.isArray(s.value)||(s.value=[]),s.value=[{id:"DEFAULT",name:"Default",styles:t.styles},...s.value],f("sectionThemes",s.value))}async function T(l){s.value=s.value.filter(t=>t.id!==l),s.value=await b("sectionThemes")||[],s.value=s.value.filter(t=>t.id!==l),f("sectionThemes",s.value)}async function S(l){let t=JSON.parse(JSON.stringify(l)),d=crypto.randomUUID();t.id=d,r.value.push(t),r.value=await b("buttonThemes")||[],r.value.push(t),f("buttonThemes",r.value)}async function w(l){let t=JSON.parse(JSON.stringify(l)),d=r.value.findIndex(c=>c.id===t.id);d!==-1?r.value[d]=t:t.id==="DEFAULT"&&(Array.isArray(r.value)||(r.value=[]),r.value=[{id:"DEFAULT",name:"Default",styles:t.styles},...r.value]),r.value=await b("buttonThemes")||[],d=r.value.findIndex(c=>c.id===t.id),d!==-1?(r.value[d]=t,f("buttonThemes",r.value)):t.id==="DEFAULT"&&(Array.isArray(r.value)||(r.value=[]),r.value=[{id:"DEFAULT",name:"Default",styles:t.styles},...r.value],f("buttonThemes",r.value))}async function v(l){r.value=r.value.filter(t=>t.id!==l),r.value=await b("buttonThemes")||[],r.value=r.value.filter(t=>t.id!==l),f("buttonThemes",r.value)}const n=function(l){let t={};if(t.backgroundColor=l.styles.backgroundColor,t.color=l.styles.textColor,l.styles.buttonStyle==="outline"?t.border=`1px solid ${l.styles.borderColor}`:l.styles.buttonStyle==="shadow"?t.boxShadow="0 3px 6px #ccc":l.styles.buttonStyle==="retro"&&(t.boxShadow=`inset 0 0 0 2px ${l.styles.borderColor}, 2px 2px 0 ${l.styles.borderColor}`),l.styles.buttonRoundness!=="none"){let d=0;l.styles.buttonRoundness==="small"?d=4:l.styles.buttonRoundness==="medium"?d=8:l.styles.buttonRoundness==="pill"&&(d=9999),t.borderRadius=`${d}px`}return t};return e.onMounted(()=>{b("sectionThemes").then(l=>{s.value=l||[]}),b("buttonThemes").then(l=>{r.value=l||[]})}),(l,t)=>{const d=e.resolveComponent("Button"),c=e.resolveComponent("Skeleton");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",be,[e.createElementVNode("div",fe,[e.createVNode(d,{onClick:t[0]||(t[0]=i=>e.unref(k)("/")),variant:"link",class:"!pl-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ChevronLeft),{class:"size-4"}),t[3]||(t[3]=e.createTextVNode(" Collections ",-1))]),_:1})]),t[7]||(t[7]=e.createElementVNode("h1",{class:"text-3xl mb-8"},"Global Styling",-1)),t[8]||(t[8]=e.createElementVNode("h3",{class:"text-2xl mb-2"},"Section Variants",-1)),t[9]||(t[9]=e.createElementVNode("p",{class:"mb-6 max-w-3xl text-muted-foreground"}," Set up the default design variants for your sections. These styles will be available across all collections by default, but you can choose to disable them within individual collections if needed. ",-1)),p.value!==null?(e.openBlock(),e.createElementBlock("div",ge,[e.createElementVNode("div",{class:"group/item flex flex-col gap-2 items-center",onClick:t[1]||(t[1]=i=>g.value.openDialog())},[e.createVNode(d,{variant:"outline",class:"size-44 border-dotted",tabindex:"-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.Plus),{class:"size-14"})]),_:1}),t[4]||(t[4]=e.createElementVNode("p",{class:"text-muted-foreground group-hover/item:text-white transition-colors duration-300"},"New Style",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,i=>(e.openBlock(),e.createElementBlock("div",{class:"group/item flex flex-col gap-2 text-black items-center cursor-pointer hover:brightness-105 transition-all duration-300",key:i.id,onClick:x=>g.value.openDialog(i)},[e.createElementVNode("div",{class:"flex flex-col items-start rounded-md p-4 size-44",style:e.normalizeStyle({backgroundColor:i.styles.backgroundColor,border:"1px solid #E5E7EB"})},[e.createElementVNode("strong",{class:"text-2xl",style:e.normalizeStyle({color:i.styles.titleColor})},"Title",4),e.createElementVNode("p",{class:"mb-1",style:e.normalizeStyle({color:i.styles.textColor})},[...t[5]||(t[5]=[e.createTextVNode("Lorem ipsum dolor",-1),e.createElementVNode("br",null,null,-1),e.createTextVNode("sit amet.",-1)])],4),i.className?(e.openBlock(),e.createElementBlock("p",{key:0,class:"px-3 py-1.5 rounded-[99px]",style:e.normalizeStyle({backgroundColor:i.styles.textColor,color:i.styles.backgroundColor})},"."+e.toDisplayString(i.className),5)):e.createCommentVNode("",!0)],4),e.createElementVNode("p",Ve,e.toDisplayString(i.name),1)],8,Ce))),128))])):(e.openBlock(),e.createElementBlock("div",Ne,[e.createVNode(c,{class:"size-44 rounded-md"}),e.createVNode(c,{class:"size-44 rounded-md"})])),t[10]||(t[10]=e.createElementVNode("h3",{class:"text-2xl mb-2"},"Button Variants",-1)),t[11]||(t[11]=e.createElementVNode("p",{class:"mb-6 max-w-3xl text-muted-foreground"}," Define your standard button styles here. Collections can inherit these defaults or customize their own variants for more tailored experiences. ",-1)),o.value!==null?(e.openBlock(),e.createElementBlock("div",ke,[e.createElementVNode("div",{class:"group/item flex flex-col gap-2 items-center",onClick:t[2]||(t[2]=i=>y.value.openDialog())},[e.createVNode(d,{variant:"outline",class:"size-44 border-dotted",tabindex:"-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.Plus),{class:"size-14"})]),_:1}),t[6]||(t[6]=e.createElementVNode("p",{class:"text-muted-foreground group-hover/item:text-white transition-colors duration-300"},"New Style",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,i=>(e.openBlock(),e.createElementBlock("div",{class:"group/item flex flex-col gap-2 text-black items-center cursor-pointer hover:brightness-105 transition-all duration-300",key:i.id,onClick:x=>y.value.openDialog(i)},[e.createElementVNode("div",Ee,[e.createElementVNode("div",{style:e.normalizeStyle(n(i)),class:"px-4 py-2"}," Button ",4)]),e.createElementVNode("p",Te,e.toDisplayString(i.name),1)],8,Be))),128))])):(e.openBlock(),e.createElementBlock("div",Se,[e.createVNode(c,{class:"size-44 rounded-md"}),e.createVNode(c,{class:"size-44 rounded-md"})]))]),e.createVNode(X,{ref_key:"sectionStyleDialog",ref:g,onAdd:B,onEdit:E,onDelete:T},null,512),e.createVNode(xe,{ref_key:"buttonStyleDialog",ref:y,onAdd:S,onEdit:w,onDelete:v},null,512)],64)}}});exports.default=we;
|