@zircon-labs/carousel 0.0.0-stage → 0.1.0-beta.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/LICENSE +201 -0
- package/README.md +229 -2
- package/dist/document-BD0NGsow.js +557 -0
- package/dist/editor.css +125 -0
- package/dist/editor.js +562 -0
- package/dist/index.js +1 -0
- package/dist/styles.css +370 -0
- package/dist/types/Carousel.d.ts +9 -0
- package/dist/types/CarouselControls.d.ts +15 -0
- package/dist/types/CarouselImage.d.ts +8 -0
- package/dist/types/assets.d.ts +34 -0
- package/dist/types/document.d.ts +13 -0
- package/dist/types/editor/CarouselEditor.d.ts +19 -0
- package/dist/types/editor/draft.d.ts +31 -0
- package/dist/types/editor/index.d.ts +2 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/model.d.ts +80 -0
- package/dist/types/slideNavigation.d.ts +13 -0
- package/dist/types/urls.d.ts +2 -0
- package/package.json +42 -4
package/dist/editor.js
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s } from "./document-BD0NGsow.js";
|
|
2
|
+
import { useId as c, useLayoutEffect as l, useRef as u, useState as d } from "react";
|
|
3
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
4
|
+
import { Button as h, Checkbox as ee, Input as g } from "@zircon-labs/primitives";
|
|
5
|
+
import { FileUpload as te } from "@zircon-labs/primitives/file-upload";
|
|
6
|
+
// src/editor/draft.ts
|
|
7
|
+
function _(e) {
|
|
8
|
+
let t = r(e), n = e.layout?.aspectRatio ?? t.layout.aspectRatio;
|
|
9
|
+
return {
|
|
10
|
+
schemaVersion: e.schemaVersion,
|
|
11
|
+
slides: e.slides.map(({ id: e, image: t, href: n }) => ({
|
|
12
|
+
id: e,
|
|
13
|
+
assetId: t.source.kind === "asset" ? t.source.id : void 0,
|
|
14
|
+
src: t.source.kind === "url" ? t.source.src : "",
|
|
15
|
+
srcSet: t.source.kind === "url" ? t.source.srcSet : void 0,
|
|
16
|
+
sizes: t.source.kind === "url" ? t.source.sizes : void 0,
|
|
17
|
+
alt: t.alt,
|
|
18
|
+
href: n ?? ""
|
|
19
|
+
})),
|
|
20
|
+
variant: t.variant,
|
|
21
|
+
transition: t.transition,
|
|
22
|
+
effects: t.effects,
|
|
23
|
+
aspectRatio: n === s.layout.aspectRatio ? "16:9" : String(n),
|
|
24
|
+
gapPx: String(e.layout?.gapPx ?? t.layout.gapPx),
|
|
25
|
+
imageFit: t.layout.imageFit
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function v(e) {
|
|
29
|
+
let t = e.trim().replace(",", ".");
|
|
30
|
+
return /^(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?$/i.test(t) ? Number(t) : NaN;
|
|
31
|
+
}
|
|
32
|
+
function y(e) {
|
|
33
|
+
let t = e.split(":");
|
|
34
|
+
return t.length === 1 ? v(t[0]) : t.length === 2 ? v(t[0]) / v(t[1]) : NaN;
|
|
35
|
+
}
|
|
36
|
+
function b(t) {
|
|
37
|
+
let n = { slides: /* @__PURE__ */ new Map() }, r = [], i = /* @__PURE__ */ new Set();
|
|
38
|
+
for (let s of t.slides) {
|
|
39
|
+
let t = {}, c = e(s.src), l = s.assetId === void 0 ? {
|
|
40
|
+
kind: "url",
|
|
41
|
+
src: c ?? "",
|
|
42
|
+
srcSet: s.srcSet,
|
|
43
|
+
sizes: s.sizes
|
|
44
|
+
} : {
|
|
45
|
+
kind: "asset",
|
|
46
|
+
id: s.assetId
|
|
47
|
+
}, u = o(l), d = s.alt.trim(), f = a(s.href);
|
|
48
|
+
(!s.id.trim() || i.has(s.id)) && (n.firstError ??= "Cada diapositiva debe tener un ID único."), i.add(s.id), u || (t.src = s.assetId === void 0 ? "Ingresá una ruta de imagen o una URL HTTP(S). Revisá los candidatos responsivos." : "Ingresá un ID de imagen válido."), d || (t.alt = "Ingresá el texto alternativo."), s.href.trim() && !f && (t.href = "Ingresá un enlace HTTP(S), una ruta relativa o un fragmento."), (t.src || t.alt || t.href) && (n.slides.set(s.id, t), n.firstError ??= `Diapositiva ${i.size}: ${t.src ?? t.alt ?? t.href}`), u && r.push({
|
|
49
|
+
id: s.id,
|
|
50
|
+
image: {
|
|
51
|
+
source: l,
|
|
52
|
+
alt: d
|
|
53
|
+
},
|
|
54
|
+
...f ? { href: f } : {}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
let s = y(t.aspectRatio), c = v(t.gapPx);
|
|
58
|
+
if ((!Number.isFinite(s) || s <= 0) && (n.aspectRatio = "Ingresá una proporción positiva, por ejemplo 16:9."), (!Number.isFinite(c) || c < 0) && (n.gapPx = "Ingresá una separación de 0 px o más."), n.firstError ??= n.aspectRatio ?? n.gapPx, !n.firstError) {
|
|
59
|
+
let e = {
|
|
60
|
+
variant: t.variant,
|
|
61
|
+
transition: t.transition,
|
|
62
|
+
effects: t.effects,
|
|
63
|
+
layout: {
|
|
64
|
+
aspectRatio: s,
|
|
65
|
+
gapPx: c,
|
|
66
|
+
imageFit: t.imageFit
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
n.config = t.schemaVersion === 2 || r.some(({ image: e }) => e.source.kind === "asset") ? {
|
|
70
|
+
schemaVersion: 2,
|
|
71
|
+
slides: r,
|
|
72
|
+
...e
|
|
73
|
+
} : {
|
|
74
|
+
schemaVersion: 1,
|
|
75
|
+
slides: r,
|
|
76
|
+
...e
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return n;
|
|
80
|
+
}
|
|
81
|
+
// src/editor/CarouselEditor.tsx
|
|
82
|
+
var x = {
|
|
83
|
+
schemaVersion: 1,
|
|
84
|
+
slides: []
|
|
85
|
+
}, ne = [
|
|
86
|
+
["snakeBorder", "Borde animado"],
|
|
87
|
+
["sparkle", "Destellos"],
|
|
88
|
+
["indicatorLine", "Línea del indicador"]
|
|
89
|
+
];
|
|
90
|
+
function S(e, t) {
|
|
91
|
+
let n = _(e), r = b(n);
|
|
92
|
+
return {
|
|
93
|
+
document: {},
|
|
94
|
+
received: e,
|
|
95
|
+
draft: n,
|
|
96
|
+
validation: r,
|
|
97
|
+
selectedId: n.slides.some(({ id: e }) => e === t?.selectedId) ? t?.selectedId : n.slides[0]?.id,
|
|
98
|
+
preview: r.config ? e : t?.preview ?? x,
|
|
99
|
+
pending: []
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function re(e, t) {
|
|
103
|
+
let n = S(e, t);
|
|
104
|
+
if (!n.validation.config) return n;
|
|
105
|
+
let r = i(e), a = t.latest?.key === r ? t.latest : t.pending.find((e) => e.key === r), o = a !== void 0 && a === t.latest;
|
|
106
|
+
return a || t.preview === t.received && r === i(t.received) ? {
|
|
107
|
+
...t,
|
|
108
|
+
received: e,
|
|
109
|
+
preview: e,
|
|
110
|
+
pending: o ? [] : t.pending.filter((e) => e !== a),
|
|
111
|
+
latest: o ? void 0 : t.latest
|
|
112
|
+
} : n;
|
|
113
|
+
}
|
|
114
|
+
function C(e) {
|
|
115
|
+
e.target instanceof Element && e.target.closest("a[href]") && e.preventDefault();
|
|
116
|
+
}
|
|
117
|
+
function w({ value: e, onChange: r, previewLabel: a, onDraftStatusChange: s, getAssetState: _, uploadImage: v, onRetryAsset: y, assetOptions: x = [] }) {
|
|
118
|
+
let [w, T] = d(() => S(e)), [ie, E] = d(""), [ae, D] = d(/* @__PURE__ */ new Map()), [O, k] = d(/* @__PURE__ */ new Map()), A = u(/* @__PURE__ */ new Map()), j = u(w), M = u(null), N = u(null), P = u(/* @__PURE__ */ new Map()), F = u(void 0), I = c(), L = c();
|
|
119
|
+
w.received !== e && T(re(e, w));
|
|
120
|
+
let { draft: R, validation: z, preview: B, selectedId: V } = w, H = R.slides.findIndex(({ id: e }) => e === V), U = R.slides[H], W = U ? z.slides.get(U.id) : void 0, oe = B === w.received ? i(B) : void 0, G = [...O.values()].some((e) => e.pending), K = U && O.get(U.id), q = U ? ae.get(U.id) ?? (U.assetId ? "catalog" : "url") : "url", J = U?.assetId ? _?.(U.assetId) : void 0, Y = !G && z.config !== void 0 && w.latest === void 0 && i(z.config) === oe;
|
|
121
|
+
l(() => {
|
|
122
|
+
j.current = w;
|
|
123
|
+
}, [w]), l(() => {
|
|
124
|
+
let e = A.current;
|
|
125
|
+
return D(/* @__PURE__ */ new Map()), k(/* @__PURE__ */ new Map()), () => {
|
|
126
|
+
for (let t of e.values()) t.abort();
|
|
127
|
+
e.clear();
|
|
128
|
+
};
|
|
129
|
+
}, [w.document]), l(() => {
|
|
130
|
+
s?.({ canExport: Y });
|
|
131
|
+
}, [Y, s]), l(() => {
|
|
132
|
+
let e = F.current;
|
|
133
|
+
F.current = void 0, e === "source" && N.current?.focus(), e === "row" && (V ? P.current.get(V) : M.current)?.focus();
|
|
134
|
+
}, [V]);
|
|
135
|
+
function X(e, t = { id: V }, n = w) {
|
|
136
|
+
let a = b(e), o = a.config, s = o && i(o), c = n.latest?.key ?? (n.preview === n.received ? i(n.preview) : void 0), l = s && s !== c ? { key: s } : void 0, u = {
|
|
137
|
+
...n,
|
|
138
|
+
draft: o?.schemaVersion === 2 ? {
|
|
139
|
+
...e,
|
|
140
|
+
schemaVersion: 2
|
|
141
|
+
} : e,
|
|
142
|
+
validation: a,
|
|
143
|
+
selectedId: t.id,
|
|
144
|
+
pending: l ? [...n.pending, l] : n.pending,
|
|
145
|
+
latest: l ?? n.latest
|
|
146
|
+
};
|
|
147
|
+
j.current = u, T(u), o && l && r(o);
|
|
148
|
+
}
|
|
149
|
+
function Z(e, t = V, n = w) {
|
|
150
|
+
X({
|
|
151
|
+
...n.draft,
|
|
152
|
+
slides: n.draft.slides.map((n) => n.id === t ? {
|
|
153
|
+
...n,
|
|
154
|
+
...e
|
|
155
|
+
} : n)
|
|
156
|
+
}, { id: n.selectedId }, n);
|
|
157
|
+
}
|
|
158
|
+
function Q(e, t) {
|
|
159
|
+
k((n) => {
|
|
160
|
+
let r = new Map(n);
|
|
161
|
+
return t ? r.set(e, t) : r.delete(e), r;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function $(e) {
|
|
165
|
+
A.current.get(e)?.abort(), A.current.delete(e), Q(e);
|
|
166
|
+
}
|
|
167
|
+
function se(e, t) {
|
|
168
|
+
$(e), D((n) => new Map(n).set(e, t)), t === "url" && U?.assetId && Z({
|
|
169
|
+
assetId: void 0,
|
|
170
|
+
src: ""
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
async function ce(e, t) {
|
|
174
|
+
if (!v) return;
|
|
175
|
+
$(e);
|
|
176
|
+
let n = new AbortController(), r = w.document;
|
|
177
|
+
A.current.set(e, n), Q(e, {
|
|
178
|
+
file: t,
|
|
179
|
+
pending: !0
|
|
180
|
+
});
|
|
181
|
+
let i = () => !n.signal.aborted && A.current.get(e) === n && j.current.document === r;
|
|
182
|
+
try {
|
|
183
|
+
let r = await v(t, { signal: n.signal });
|
|
184
|
+
if (!i()) return;
|
|
185
|
+
if (!o(r)) throw Error("La subida no devolvió una referencia válida.");
|
|
186
|
+
Z(r.kind === "asset" ? {
|
|
187
|
+
assetId: r.id,
|
|
188
|
+
src: "",
|
|
189
|
+
srcSet: void 0,
|
|
190
|
+
sizes: void 0
|
|
191
|
+
} : {
|
|
192
|
+
assetId: void 0,
|
|
193
|
+
src: r.src,
|
|
194
|
+
srcSet: r.srcSet,
|
|
195
|
+
sizes: r.sizes
|
|
196
|
+
}, e, j.current), Q(e);
|
|
197
|
+
} catch (n) {
|
|
198
|
+
i() && Q(e, {
|
|
199
|
+
file: t,
|
|
200
|
+
pending: !1,
|
|
201
|
+
error: n instanceof Error ? n.message : "No se pudo subir la imagen."
|
|
202
|
+
});
|
|
203
|
+
} finally {
|
|
204
|
+
A.current.get(e) === n && A.current.delete(e);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function le() {
|
|
208
|
+
let e = crypto.randomUUID();
|
|
209
|
+
F.current = "source", X({
|
|
210
|
+
...R,
|
|
211
|
+
slides: [...R.slides, {
|
|
212
|
+
id: e,
|
|
213
|
+
src: "",
|
|
214
|
+
alt: "",
|
|
215
|
+
href: ""
|
|
216
|
+
}]
|
|
217
|
+
}, { id: e }), E(`Diapositiva ${R.slides.length + 1} agregada.`);
|
|
218
|
+
}
|
|
219
|
+
function ue(e) {
|
|
220
|
+
let t = H + e;
|
|
221
|
+
if (!U || t < 0 || t >= R.slides.length) return;
|
|
222
|
+
let n = R.slides.slice();
|
|
223
|
+
n.splice(H, 1), n.splice(t, 0, U), X({
|
|
224
|
+
...R,
|
|
225
|
+
slides: n
|
|
226
|
+
}), E(`Diapositiva movida a la posición ${t + 1} de ${n.length}.`);
|
|
227
|
+
}
|
|
228
|
+
function de() {
|
|
229
|
+
V && ($(V), D((e) => {
|
|
230
|
+
let t = new Map(e);
|
|
231
|
+
return t.delete(V), t;
|
|
232
|
+
}));
|
|
233
|
+
let e = R.slides.filter(({ id: e }) => e !== V), n = t(R.slides.map(({ id: e }) => e), e.map(({ id: e }) => e), V);
|
|
234
|
+
F.current = "row", X({
|
|
235
|
+
...R,
|
|
236
|
+
slides: e
|
|
237
|
+
}, { id: n }), E(`Diapositiva eliminada. ${e.length ? `Quedan ${e.length}.` : "La lista está vacía."}`);
|
|
238
|
+
}
|
|
239
|
+
return /* @__PURE__ */ m("div", {
|
|
240
|
+
className: "zircon-editor",
|
|
241
|
+
children: [/* @__PURE__ */ m("div", {
|
|
242
|
+
className: "zircon-editor__fields",
|
|
243
|
+
children: [/* @__PURE__ */ m("section", {
|
|
244
|
+
"aria-labelledby": I,
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ p("h2", {
|
|
247
|
+
id: I,
|
|
248
|
+
children: "Diapositivas"
|
|
249
|
+
}),
|
|
250
|
+
!!R.slides.length && /* @__PURE__ */ p("ol", {
|
|
251
|
+
className: "zircon-editor__slides",
|
|
252
|
+
"aria-label": "Lista de diapositivas",
|
|
253
|
+
children: R.slides.map(({ id: e, alt: t }, n) => /* @__PURE__ */ p("li", { children: /* @__PURE__ */ m(h, {
|
|
254
|
+
ref: (t) => {
|
|
255
|
+
t ? P.current.set(e, t) : P.current.delete(e);
|
|
256
|
+
},
|
|
257
|
+
variant: "secondary",
|
|
258
|
+
"aria-current": e === V ? "true" : void 0,
|
|
259
|
+
onClick: () => T({
|
|
260
|
+
...w,
|
|
261
|
+
selectedId: e
|
|
262
|
+
}),
|
|
263
|
+
children: [
|
|
264
|
+
n + 1,
|
|
265
|
+
". ",
|
|
266
|
+
t.trim() || "Sin texto alternativo"
|
|
267
|
+
]
|
|
268
|
+
}) }, e))
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ p(h, {
|
|
271
|
+
ref: M,
|
|
272
|
+
onClick: le,
|
|
273
|
+
children: "Agregar diapositiva"
|
|
274
|
+
}),
|
|
275
|
+
U && /* @__PURE__ */ m("fieldset", {
|
|
276
|
+
className: "zircon-editor__group",
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ m("legend", { children: ["Editar diapositiva ", H + 1] }),
|
|
279
|
+
(v || x.length > 0 || U.assetId) && /* @__PURE__ */ m("label", { children: ["Fuente de imagen", /* @__PURE__ */ m("select", {
|
|
280
|
+
value: q,
|
|
281
|
+
onChange: (e) => se(U.id, e.target.value),
|
|
282
|
+
children: [
|
|
283
|
+
/* @__PURE__ */ p("option", {
|
|
284
|
+
value: "url",
|
|
285
|
+
children: "URL"
|
|
286
|
+
}),
|
|
287
|
+
v && /* @__PURE__ */ p("option", {
|
|
288
|
+
value: "upload",
|
|
289
|
+
children: "Subir archivo"
|
|
290
|
+
}),
|
|
291
|
+
(x.length > 0 || U.assetId) && /* @__PURE__ */ p("option", {
|
|
292
|
+
value: "catalog",
|
|
293
|
+
children: "Elegir del catálogo"
|
|
294
|
+
})
|
|
295
|
+
]
|
|
296
|
+
})] }),
|
|
297
|
+
q === "url" && /* @__PURE__ */ p(g, {
|
|
298
|
+
ref: N,
|
|
299
|
+
label: "URL de imagen",
|
|
300
|
+
inputMode: "url",
|
|
301
|
+
required: !0,
|
|
302
|
+
value: U.src,
|
|
303
|
+
error: W?.src,
|
|
304
|
+
onChange: (e) => Z({
|
|
305
|
+
src: e.target.value,
|
|
306
|
+
assetId: void 0
|
|
307
|
+
})
|
|
308
|
+
}),
|
|
309
|
+
q === "catalog" && x.length > 0 && /* @__PURE__ */ m("label", { children: ["Imagen del catálogo", /* @__PURE__ */ m("select", {
|
|
310
|
+
value: x.some(({ id: e }) => e === U.assetId) ? U.assetId : "",
|
|
311
|
+
onChange: (e) => {
|
|
312
|
+
e.target.value && ($(U.id), Z({
|
|
313
|
+
assetId: e.target.value,
|
|
314
|
+
src: "",
|
|
315
|
+
srcSet: void 0,
|
|
316
|
+
sizes: void 0
|
|
317
|
+
}));
|
|
318
|
+
},
|
|
319
|
+
children: [/* @__PURE__ */ p("option", {
|
|
320
|
+
value: "",
|
|
321
|
+
disabled: !0,
|
|
322
|
+
children: "Elegí una imagen"
|
|
323
|
+
}), x.map(({ id: e, label: t }) => /* @__PURE__ */ p("option", {
|
|
324
|
+
value: e,
|
|
325
|
+
children: t
|
|
326
|
+
}, e))]
|
|
327
|
+
})] }),
|
|
328
|
+
q === "upload" && v && /* @__PURE__ */ m(f, { children: [
|
|
329
|
+
/* @__PURE__ */ p(te, {
|
|
330
|
+
files: K ? [K.file] : [],
|
|
331
|
+
accept: "image/jpeg,image/png,image/webp",
|
|
332
|
+
status: K?.pending ? "loading" : "idle",
|
|
333
|
+
ariaLabel: "Subir imagen",
|
|
334
|
+
dropLabel: "Soltá una imagen",
|
|
335
|
+
selectLabel: "Elegir archivo",
|
|
336
|
+
loadingLabel: "Subiendo imagen",
|
|
337
|
+
onFilesChange: ([e]) => {
|
|
338
|
+
e && ce(U.id, e);
|
|
339
|
+
},
|
|
340
|
+
onRejectedFiles: ([e]) => {
|
|
341
|
+
e && Q(U.id, {
|
|
342
|
+
file: e,
|
|
343
|
+
pending: !1,
|
|
344
|
+
error: "Elegí una imagen JPEG, PNG o WebP."
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
}),
|
|
348
|
+
K?.error && /* @__PURE__ */ p("p", {
|
|
349
|
+
role: "alert",
|
|
350
|
+
children: K.error
|
|
351
|
+
}),
|
|
352
|
+
K?.error && /* @__PURE__ */ p(h, {
|
|
353
|
+
onClick: () => void ce(U.id, K.file),
|
|
354
|
+
children: "Reintentar subida"
|
|
355
|
+
}),
|
|
356
|
+
K && /* @__PURE__ */ p(h, {
|
|
357
|
+
variant: "secondary",
|
|
358
|
+
onClick: () => $(U.id),
|
|
359
|
+
children: K.pending ? "Cancelar subida" : "Descartar archivo"
|
|
360
|
+
})
|
|
361
|
+
] }),
|
|
362
|
+
U.assetId && /* @__PURE__ */ m("div", { children: [
|
|
363
|
+
/* @__PURE__ */ m("p", { children: ["Referencia: ", U.assetId] }),
|
|
364
|
+
J?.status === "loading" && /* @__PURE__ */ p("p", {
|
|
365
|
+
role: "status",
|
|
366
|
+
children: "Cargando imagen"
|
|
367
|
+
}),
|
|
368
|
+
(!J || J.status === "missing") && /* @__PURE__ */ p("p", {
|
|
369
|
+
role: "status",
|
|
370
|
+
children: "Imagen no encontrada"
|
|
371
|
+
}),
|
|
372
|
+
J?.status === "error" && /* @__PURE__ */ p("p", {
|
|
373
|
+
role: "status",
|
|
374
|
+
children: J.message ?? "No se pudo cargar la imagen"
|
|
375
|
+
}),
|
|
376
|
+
J?.status !== "loading" && y && /* @__PURE__ */ p(h, {
|
|
377
|
+
variant: "secondary",
|
|
378
|
+
onClick: () => y(U.assetId),
|
|
379
|
+
children: "Reintentar imagen"
|
|
380
|
+
})
|
|
381
|
+
] }),
|
|
382
|
+
/* @__PURE__ */ p(g, {
|
|
383
|
+
label: "Texto alternativo",
|
|
384
|
+
required: !0,
|
|
385
|
+
value: U.alt,
|
|
386
|
+
error: W?.alt,
|
|
387
|
+
onChange: (e) => Z({ alt: e.target.value })
|
|
388
|
+
}),
|
|
389
|
+
/* @__PURE__ */ p(g, {
|
|
390
|
+
label: "Enlace",
|
|
391
|
+
inputMode: "url",
|
|
392
|
+
hint: "Opcional",
|
|
393
|
+
value: U.href,
|
|
394
|
+
error: W?.href,
|
|
395
|
+
onChange: (e) => Z({ href: e.target.value })
|
|
396
|
+
}),
|
|
397
|
+
(U.srcSet !== void 0 || U.sizes !== void 0) && /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("p", { children: "El navegador puede elegir una imagen de los candidatos responsivos." }), /* @__PURE__ */ p(h, {
|
|
398
|
+
variant: "secondary",
|
|
399
|
+
onClick: () => {
|
|
400
|
+
Z({
|
|
401
|
+
srcSet: void 0,
|
|
402
|
+
sizes: void 0
|
|
403
|
+
}), N.current?.focus();
|
|
404
|
+
},
|
|
405
|
+
children: "Usar solo la URL principal"
|
|
406
|
+
})] }),
|
|
407
|
+
/* @__PURE__ */ m("div", {
|
|
408
|
+
className: "zircon-editor__actions",
|
|
409
|
+
role: "group",
|
|
410
|
+
"aria-label": "Acciones de la diapositiva",
|
|
411
|
+
children: [
|
|
412
|
+
/* @__PURE__ */ p(h, {
|
|
413
|
+
variant: "secondary",
|
|
414
|
+
"aria-disabled": H === 0,
|
|
415
|
+
onClick: () => ue(-1),
|
|
416
|
+
children: "Subir"
|
|
417
|
+
}),
|
|
418
|
+
/* @__PURE__ */ p(h, {
|
|
419
|
+
variant: "secondary",
|
|
420
|
+
"aria-disabled": H === R.slides.length - 1,
|
|
421
|
+
onClick: () => ue(1),
|
|
422
|
+
children: "Bajar"
|
|
423
|
+
}),
|
|
424
|
+
/* @__PURE__ */ p(h, {
|
|
425
|
+
variant: "danger",
|
|
426
|
+
onClick: de,
|
|
427
|
+
children: "Eliminar diapositiva"
|
|
428
|
+
})
|
|
429
|
+
]
|
|
430
|
+
})
|
|
431
|
+
]
|
|
432
|
+
}),
|
|
433
|
+
/* @__PURE__ */ p("p", {
|
|
434
|
+
className: "zircon-editor__sr-only",
|
|
435
|
+
role: "status",
|
|
436
|
+
children: ie
|
|
437
|
+
})
|
|
438
|
+
]
|
|
439
|
+
}), /* @__PURE__ */ m("fieldset", {
|
|
440
|
+
className: "zircon-editor__group",
|
|
441
|
+
children: [
|
|
442
|
+
/* @__PURE__ */ p("legend", { children: "Presentación" }),
|
|
443
|
+
/* @__PURE__ */ m("div", {
|
|
444
|
+
className: "zircon-editor__options",
|
|
445
|
+
children: [
|
|
446
|
+
/* @__PURE__ */ m("label", { children: ["Variante", /* @__PURE__ */ m("select", {
|
|
447
|
+
value: R.variant,
|
|
448
|
+
onChange: (e) => X({
|
|
449
|
+
...R,
|
|
450
|
+
variant: e.target.value
|
|
451
|
+
}),
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ p("option", {
|
|
454
|
+
value: "basic",
|
|
455
|
+
children: "Básica"
|
|
456
|
+
}),
|
|
457
|
+
/* @__PURE__ */ p("option", {
|
|
458
|
+
value: "standard",
|
|
459
|
+
children: "Estándar"
|
|
460
|
+
}),
|
|
461
|
+
/* @__PURE__ */ p("option", {
|
|
462
|
+
value: "advanced",
|
|
463
|
+
children: "Avanzada"
|
|
464
|
+
})
|
|
465
|
+
]
|
|
466
|
+
})] }),
|
|
467
|
+
/* @__PURE__ */ m("label", { children: ["Transición", /* @__PURE__ */ m("select", {
|
|
468
|
+
value: R.transition,
|
|
469
|
+
onChange: (e) => X({
|
|
470
|
+
...R,
|
|
471
|
+
transition: e.target.value
|
|
472
|
+
}),
|
|
473
|
+
children: [/* @__PURE__ */ p("option", {
|
|
474
|
+
value: "slide",
|
|
475
|
+
children: "Deslizamiento"
|
|
476
|
+
}), /* @__PURE__ */ p("option", {
|
|
477
|
+
value: "fade",
|
|
478
|
+
children: "Fundido"
|
|
479
|
+
})]
|
|
480
|
+
})] }),
|
|
481
|
+
/* @__PURE__ */ m("label", { children: ["Ajuste de imagen", /* @__PURE__ */ m("select", {
|
|
482
|
+
value: R.imageFit,
|
|
483
|
+
onChange: (e) => X({
|
|
484
|
+
...R,
|
|
485
|
+
imageFit: e.target.value === "contain" ? "contain" : "cover"
|
|
486
|
+
}),
|
|
487
|
+
children: [/* @__PURE__ */ p("option", {
|
|
488
|
+
value: "cover",
|
|
489
|
+
children: "Rellenar"
|
|
490
|
+
}), /* @__PURE__ */ p("option", {
|
|
491
|
+
value: "contain",
|
|
492
|
+
children: "Mostrar completa"
|
|
493
|
+
})]
|
|
494
|
+
})] })
|
|
495
|
+
]
|
|
496
|
+
}),
|
|
497
|
+
/* @__PURE__ */ p(g, {
|
|
498
|
+
label: "Proporción",
|
|
499
|
+
value: R.aspectRatio,
|
|
500
|
+
error: z.aspectRatio,
|
|
501
|
+
onChange: (e) => X({
|
|
502
|
+
...R,
|
|
503
|
+
aspectRatio: e.target.value
|
|
504
|
+
})
|
|
505
|
+
}),
|
|
506
|
+
/* @__PURE__ */ p(g, {
|
|
507
|
+
label: "Separación (px)",
|
|
508
|
+
inputMode: "decimal",
|
|
509
|
+
value: R.gapPx,
|
|
510
|
+
error: z.gapPx,
|
|
511
|
+
onChange: (e) => X({
|
|
512
|
+
...R,
|
|
513
|
+
gapPx: e.target.value
|
|
514
|
+
})
|
|
515
|
+
}),
|
|
516
|
+
/* @__PURE__ */ m("fieldset", {
|
|
517
|
+
className: "zircon-editor__effects",
|
|
518
|
+
children: [/* @__PURE__ */ p("legend", { children: "Efectos" }), ne.map(([e, t]) => /* @__PURE__ */ p(ee, {
|
|
519
|
+
label: t,
|
|
520
|
+
checked: R.effects[e],
|
|
521
|
+
onChange: (t) => X({
|
|
522
|
+
...R,
|
|
523
|
+
effects: {
|
|
524
|
+
...R.effects,
|
|
525
|
+
[e]: t.target.checked
|
|
526
|
+
}
|
|
527
|
+
})
|
|
528
|
+
}, e))]
|
|
529
|
+
})
|
|
530
|
+
]
|
|
531
|
+
})]
|
|
532
|
+
}), /* @__PURE__ */ m("section", {
|
|
533
|
+
className: "zircon-editor__preview",
|
|
534
|
+
"aria-labelledby": L,
|
|
535
|
+
children: [
|
|
536
|
+
/* @__PURE__ */ p("h2", {
|
|
537
|
+
id: L,
|
|
538
|
+
children: "Vista previa"
|
|
539
|
+
}),
|
|
540
|
+
/* @__PURE__ */ p("p", { children: "Podés probar los controles. Los enlaces de las imágenes no abren sus destinos aquí." }),
|
|
541
|
+
!Y && /* @__PURE__ */ m("p", {
|
|
542
|
+
role: "status",
|
|
543
|
+
children: [
|
|
544
|
+
"Vista previa de la última configuración válida.",
|
|
545
|
+
" ",
|
|
546
|
+
z.firstError ?? (G ? "Hay una subida pendiente." : "Esperando que se aplique el cambio.")
|
|
547
|
+
]
|
|
548
|
+
}),
|
|
549
|
+
B.slides.length === 0 ? /* @__PURE__ */ p("p", { children: "Sin diapositivas." }) : /* @__PURE__ */ p("div", {
|
|
550
|
+
onClickCapture: C,
|
|
551
|
+
onAuxClickCapture: C,
|
|
552
|
+
children: /* @__PURE__ */ p(n, {
|
|
553
|
+
ariaLabel: a,
|
|
554
|
+
config: B,
|
|
555
|
+
getAssetState: _
|
|
556
|
+
})
|
|
557
|
+
})
|
|
558
|
+
]
|
|
559
|
+
})]
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
export { w as CarouselEditor, i as serializeCarouselConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { i as Carousel, s as carouselDefaults, t as parseCarouselConfig } from "./document-BD0NGsow.js";
|