corekit-ui 0.1.4 → 0.1.8

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/index.js DELETED
@@ -1,921 +0,0 @@
1
- import { jsx as e, jsxs as i, Fragment as Se } from "react/jsx-runtime";
2
- import A from "clsx";
3
- import { forwardRef as me, useRef as Q, useState as E, useCallback as $, useImperativeHandle as ye, useEffect as Z, useLayoutEffect as De, useId as Fe } from "react";
4
- const Te = "_boton_3lotu_1", Be = "_inner_3lotu_81", He = "_start_3lotu_99", We = "_end_3lotu_101", $e = "_label_3lotu_103", Ve = "_spinner_3lotu_105", Oe = "_ripple_3lotu_145", Ue = "_ripple_effect_3lotu_1", Pe = "_ripple_effect_3lotu_1", Ge = "_tap_animation_3lotu_199", Xe = "_tap_animation_3lotu_199", Ye = "_modern_spinner_3lotu_243", Je = "_modern_spinner_3lotu_243", Ke = "_spinner_rotate_3lotu_1", Qe = "_spinner_rotate_3lotu_1", Ze = "_loading_3lotu_279", eo = "_disabled_3lotu_291", oo = "_full_width_3lotu_303", no = "_full_width_3lotu_303", to = "_icon_only_3lotu_311", ao = "_icon_only_3lotu_311", so = "_sm_3lotu_329", ro = "_md_3lotu_337", io = "_lg_3lotu_345", co = "_radius_none_3lotu_389", _o = "_radius_none_3lotu_389", lo = "_radius_sm_3lotu_397", uo = "_radius_sm_3lotu_397", mo = "_radius_md_3lotu_405", go = "_radius_md_3lotu_405", bo = "_radius_lg_3lotu_413", ho = "_radius_lg_3lotu_413", po = "_radius_full_3lotu_421", fo = "_radius_full_3lotu_421", vo = "_solid_3lotu_429", wo = "_bordered_3lotu_439", yo = "_ghost_3lotu_451", xo = "_light_3lotu_465", zo = "_faded_3lotu_477", No = "_shadow_3lotu_489", ko = "_primary_3lotu_581", Eo = "_secondary_3lotu_599", Co = "_success_3lotu_617", Ao = "_warning_3lotu_635", Mo = "_danger_3lotu_653", x = {
5
- boton: Te,
6
- inner: Be,
7
- start: He,
8
- end: We,
9
- label: $e,
10
- spinner: Ve,
11
- ripple: Oe,
12
- ripple_effect: Ue,
13
- rippleEffect: Pe,
14
- tap_animation: Ge,
15
- tapAnimation: Xe,
16
- modern_spinner: Ye,
17
- modernSpinner: Je,
18
- spinner_rotate: Ke,
19
- spinnerRotate: Qe,
20
- loading: Ze,
21
- disabled: eo,
22
- full_width: oo,
23
- fullWidth: no,
24
- icon_only: to,
25
- iconOnly: ao,
26
- sm: so,
27
- md: ro,
28
- lg: io,
29
- radius_none: co,
30
- radiusNone: _o,
31
- radius_sm: lo,
32
- radiusSm: uo,
33
- radius_md: mo,
34
- radiusMd: go,
35
- radius_lg: bo,
36
- radiusLg: ho,
37
- radius_full: po,
38
- radiusFull: fo,
39
- solid: vo,
40
- bordered: wo,
41
- ghost: yo,
42
- light: xo,
43
- faded: zo,
44
- shadow: No,
45
- primary: ko,
46
- secondary: Eo,
47
- success: Co,
48
- warning: Ao,
49
- danger: Mo,
50
- default: "_default_3lotu_671"
51
- }, Lo = me(
52
- ({
53
- variant: a = "solid",
54
- color: c = "default",
55
- size: z = "md",
56
- radius: w = "md",
57
- fullWidth: v = !1,
58
- isLoading: g = !1,
59
- isDisabled: h = !1,
60
- isIconOnly: b = !1,
61
- startContent: y,
62
- endContent: M,
63
- spinner: R,
64
- spinnerPlacement: T,
65
- disableRipple: N = !1,
66
- disableAnimation: L = !1,
67
- children: S,
68
- className: k,
69
- ...l
70
- }, u) => {
71
- const j = Q(null), P = A(
72
- x.boton,
73
- x[a],
74
- x[c],
75
- x[z],
76
- x[`radius_${w}`],
77
- v && !b && x.full_width,
78
- (h || l.disabled) && x.disabled,
79
- b && x.icon_only,
80
- g && x.loading,
81
- !L && x.tap_animation,
82
- k
83
- ), s = !!S && (!g || !b), r = (o) => {
84
- if (!N && !h && !g && j.current && !window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
85
- const t = j.current, m = document.createElement("span");
86
- m.className = x.ripple, m.setAttribute("aria-hidden", "true");
87
- const p = t.getBoundingClientRect(), D = o.clientX - p.left, B = o.clientY - p.top, f = Math.max(D, p.width - D), H = Math.max(B, p.height - B), G = Math.hypot(f, H) * 2;
88
- m.style.width = m.style.height = `${G}px`, m.style.left = `${D}px`, m.style.top = `${B}px`, m.addEventListener("animationend", () => m.remove(), { once: !0 }), t.appendChild(m);
89
- }
90
- l.onClick?.(o);
91
- };
92
- return /* @__PURE__ */ e(
93
- "button",
94
- {
95
- ...l,
96
- "aria-busy": g,
97
- ref: (o) => {
98
- j.current = o, typeof u == "function" ? u(o) : u && (u.current = o);
99
- },
100
- type: l.type || "button",
101
- className: P,
102
- disabled: h || g,
103
- onClick: r,
104
- children: /* @__PURE__ */ i("span", { className: x.inner, children: [
105
- y && !g && /* @__PURE__ */ e("span", { className: x.start, children: y }),
106
- s && /* @__PURE__ */ e("span", { className: x.label, children: S }),
107
- g && /* @__PURE__ */ e("span", { className: x.spinner, children: R ?? /* @__PURE__ */ e("div", { className: x.modern_spinner }) }),
108
- M && !g && /* @__PURE__ */ e("span", { className: x.end, children: M })
109
- ] })
110
- }
111
- );
112
- }
113
- );
114
- Lo.displayName = "Boton";
115
- const jo = "_dialog_1i8zu_1", qo = "_modal_1i8zu_71", Io = "_encabezado_1i8zu_95", Ro = "_titulo_1i8zu_109", So = "_boton_cerrar_1i8zu_123", Do = "_texto_esc_1i8zu_159", Fo = "_icono_x_1i8zu_173", To = "_contenedor_lienzo_1i8zu_183", Bo = "_area_firma_1i8zu_193", Ho = "_lienzo_1i8zu_207", Wo = "_lienzo_deshabilitado_1i8zu_235", $o = "_barra_acciones_1i8zu_245", Vo = "_grupo_izquierda_1i8zu_261", Oo = "_separador_1i8zu_273", Uo = "_boton_accion_1i8zu_285", Po = "_boton_guardar_1i8zu_331", Go = "_icono_1i8zu_173", Xo = "_contenedor_consentimiento_1i8zu_385", Yo = "_contenedor_checkbox_1i8zu_401", Jo = "_checkbox_nativo_1i8zu_417", Ko = "_checkbox_custom_1i8zu_431", Qo = "_texto_consentimiento_1i8zu_497", Zo = "_contenedor_subir_1i8zu_515", en = "_boton_subir_1i8zu_525", on = "_input_archivo_1i8zu_561", d = {
116
- dialog: jo,
117
- modal: qo,
118
- encabezado: Io,
119
- titulo: Ro,
120
- boton_cerrar: So,
121
- texto_esc: Do,
122
- icono_x: Fo,
123
- contenedor_lienzo: To,
124
- area_firma: Bo,
125
- lienzo: Ho,
126
- lienzo_deshabilitado: Wo,
127
- barra_acciones: $o,
128
- grupo_izquierda: Vo,
129
- separador: Oo,
130
- boton_accion: Uo,
131
- boton_guardar: Po,
132
- icono: Go,
133
- contenedor_consentimiento: Xo,
134
- contenedor_checkbox: Yo,
135
- checkbox_nativo: Jo,
136
- checkbox_custom: Ko,
137
- texto_consentimiento: Qo,
138
- contenedor_subir: Zo,
139
- boton_subir: en,
140
- input_archivo: on
141
- }, nn = () => {
142
- const a = Q(null), [c, z] = E(!1), [w, v] = E(!0), [g, h] = E(null), [b, y] = E([]), [M, R] = E([]), T = $(() => {
143
- const s = a.current, r = s?.getContext("2d");
144
- s && r && (r.clearRect(0, 0, s.width, s.height), v(!0), y([]), R([]));
145
- }, []), N = $(() => {
146
- if (b.length === 0) return;
147
- const s = b.slice(0, -1);
148
- y(s);
149
- const r = a.current, o = r?.getContext("2d");
150
- !r || !o || (o.clearRect(0, 0, r.width, r.height), s.forEach((t) => {
151
- if (!(t.puntos.length < 2)) {
152
- o.strokeStyle = t.color, o.beginPath(), o.moveTo(t.puntos[0].x, t.puntos[0].y);
153
- for (let m = 1; m < t.puntos.length; m++)
154
- o.lineTo(t.puntos[m].x, t.puntos[m].y);
155
- o.stroke();
156
- }
157
- }), v(s.length === 0));
158
- }, [b]), L = $((s) => {
159
- const r = a.current;
160
- if (!r) return { x: 0, y: 0 };
161
- const o = r.getBoundingClientRect(), t = r.width / o.width, m = r.height / o.height;
162
- return "touches" in s ? {
163
- x: (s.touches[0].clientX - o.left) * t,
164
- y: (s.touches[0].clientY - o.top) * m
165
- } : {
166
- x: (s.clientX - o.left) * t,
167
- y: (s.clientY - o.top) * m
168
- };
169
- }, []), S = $((s, r) => {
170
- const t = a.current?.getContext("2d");
171
- t && (t.beginPath(), t.moveTo(s.x, s.y), t.lineTo(r.x, r.y), t.stroke(), v(!1));
172
- }, []), k = $(
173
- (s) => {
174
- s.preventDefault();
175
- const r = L(s);
176
- z(!0), h(r), R([r]);
177
- },
178
- [L]
179
- ), l = $(
180
- (s) => {
181
- if (!c || !g) return;
182
- s.preventDefault();
183
- const r = L(s);
184
- S(g, r), h(r), R((o) => [...o, r]);
185
- },
186
- [c, g, L, S]
187
- ), u = $(() => {
188
- if (c && M.length > 0) {
189
- const r = a.current?.getContext("2d"), o = {
190
- puntos: M,
191
- color: r?.strokeStyle || "#000000"
192
- };
193
- y((t) => [...t, o]), R([]);
194
- }
195
- z(!1), h(null);
196
- }, [c, M]), j = $(() => {
197
- const s = a.current;
198
- return !s || w ? null : s.toDataURL("image/png");
199
- }, [w]), P = $(
200
- (s, r = !0) => {
201
- const o = a.current, t = o?.getContext("2d");
202
- if (!(!o || !t))
203
- return t.strokeStyle = s, t.lineWidth = 4, t.lineCap = "round", t.lineJoin = "round", r ? (o.addEventListener("mousedown", k), o.addEventListener("mousemove", l), o.addEventListener("mouseup", u), o.addEventListener("mouseout", u), o.addEventListener("touchstart", k), o.addEventListener("touchmove", l), o.addEventListener("touchend", u), () => {
204
- o.removeEventListener("mousedown", k), o.removeEventListener("mousemove", l), o.removeEventListener("mouseup", u), o.removeEventListener("mouseout", u), o.removeEventListener("touchstart", k), o.removeEventListener("touchmove", l), o.removeEventListener("touchend", u);
205
- }) : () => {
206
- };
207
- },
208
- [k, l, u]
209
- );
210
- return {
211
- canvasRef: a,
212
- estaVacio: w,
213
- limpiarCanvas: T,
214
- deshacerUltimoTrazo: N,
215
- puedeDeshacer: b.length > 0,
216
- obtenerDatosFirma: j,
217
- configurarCanvas: P
218
- };
219
- }, tn = ({ className: a, title: c = "Deshacer" }) => /* @__PURE__ */ i("svg", { className: a, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "aria-hidden": !c, role: "img", children: [
220
- /* @__PURE__ */ e("title", { children: c }),
221
- /* @__PURE__ */ e("path", { d: "M3 7v6h6", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
222
- /* @__PURE__ */ e("path", { d: "M21 17a9 9 0 00-9-9 9 9 0 00-6 2.3L3 13", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
223
- ] }), an = ({ className: a, title: c = "Limpiar" }) => /* @__PURE__ */ i("svg", { className: a, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "aria-hidden": !c, role: "img", children: [
224
- /* @__PURE__ */ e("title", { children: c }),
225
- /* @__PURE__ */ e(
226
- "path",
227
- {
228
- d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",
229
- strokeWidth: "2",
230
- strokeLinecap: "round",
231
- strokeLinejoin: "round"
232
- }
233
- )
234
- ] }), sn = ({ className: a, title: c = "Adjuntar" }) => /* @__PURE__ */ i("svg", { className: a, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "aria-hidden": !c, role: "img", children: [
235
- /* @__PURE__ */ e("title", { children: c }),
236
- /* @__PURE__ */ e(
237
- "path",
238
- {
239
- d: "M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M17 8l-5-5-5 5M12 3v12",
240
- strokeWidth: "2",
241
- strokeLinecap: "round",
242
- strokeLinejoin: "round"
243
- }
244
- )
245
- ] }), rn = ({ className: a, title: c = "Cerrar" }) => /* @__PURE__ */ i("svg", { className: a, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "aria-hidden": !c, role: "img", children: [
246
- /* @__PURE__ */ e("title", { children: c }),
247
- /* @__PURE__ */ e("path", { d: "M6 18L18 6M6 6l12 12", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
248
- ] }), cn = me(
249
- ({
250
- isOpen: a = !1,
251
- onClose: c,
252
- onConfirm: z,
253
- titulo: w = "Firmar el contrato",
254
- textoGuardar: v = "Guardar firma",
255
- textoModificar: g = "Modificar firma",
256
- textoDeshacer: h = "Atrás",
257
- textoLimpiar: b = "Limpiar",
258
- textoAdjuntar: y = "Adjuntar firma",
259
- ancho: M = 500,
260
- alto: R = 200,
261
- className: T,
262
- textoConsentimiento: N = "Al firmar, confirmo que he leído y acepto todos los términos contractuales, los cuales se vuelven legalmente vinculantes",
263
- mostrarBotonSubir: L = !1,
264
- cerrarAlGuardar: S = !1
265
- }, k) => {
266
- const {
267
- canvasRef: l,
268
- estaVacio: u,
269
- limpiarCanvas: j,
270
- deshacerUltimoTrazo: P,
271
- obtenerDatosFirma: s,
272
- configurarCanvas: r,
273
- puedeDeshacer: o
274
- } = nn(), t = Q(null), m = Q(null), [p, D] = E(!1), [B, f] = E(!1), [H, oe] = E(!1);
275
- ye(k, () => ({
276
- limpiar: j,
277
- obtenerDatosFirma: s,
278
- estaVacio: () => u
279
- })), Z(() => {
280
- if (a && l.current) {
281
- const _ = l.current, K = (() => {
282
- const O = document.documentElement.getAttribute("data-theme"), q = window.matchMedia("(prefers-color-scheme: dark)").matches;
283
- return O === "dark" || O === null && q;
284
- })() ? "#ffffff" : "#000000", W = r(K, !H), F = new MutationObserver(() => {
285
- const O = document.documentElement.getAttribute("data-theme"), q = window.matchMedia("(prefers-color-scheme: dark)").matches, te = O === "dark" || O === null && q ? "#ffffff" : "#000000", I = _.getContext("2d");
286
- I && (I.strokeStyle = te);
287
- });
288
- return F.observe(document.documentElement, {
289
- attributes: !0,
290
- attributeFilter: ["style", "class"]
291
- }), () => {
292
- W?.(), F.disconnect();
293
- };
294
- }
295
- }, [a, r, l, H]), Z(() => {
296
- const _ = t.current;
297
- if (_)
298
- return a ? (_.showModal(), document.body.style.overflow = "hidden") : (_.close(), document.body.style.overflow = ""), () => {
299
- document.body.style.overflow = "";
300
- };
301
- }, [a]);
302
- const G = $(() => {
303
- c && (f(!1), D(!1), oe(!1), c());
304
- }, [c]);
305
- Z(() => {
306
- if (!a) return;
307
- const _ = (X) => {
308
- X.key === "Escape" && G();
309
- };
310
- return document.addEventListener("keydown", _), () => {
311
- document.removeEventListener("keydown", _);
312
- };
313
- }, [a, G]);
314
- const ie = $(
315
- (_) => {
316
- const X = t.current;
317
- if (!X) return;
318
- const V = X.getBoundingClientRect();
319
- (_.clientX < V.left || _.clientX > V.right || _.clientY < V.top || _.clientY > V.bottom) && G();
320
- },
321
- [G]
322
- ), de = () => {
323
- const _ = s();
324
- _ && z && p && (f(!0), z(_), S && c && G());
325
- }, le = () => {
326
- f(!1), oe(!1), j();
327
- }, ee = (_) => {
328
- const X = _.target.files?.[0];
329
- if (!X || !l.current) return;
330
- const V = new FileReader();
331
- V.onload = (K) => {
332
- const W = new Image();
333
- W.onload = () => {
334
- const F = l.current, O = F?.getContext("2d");
335
- if (!F || !O) return;
336
- O.clearRect(0, 0, F.width, F.height);
337
- const q = F.width, Y = F.height, te = q / Y, I = W.width / W.height;
338
- let ae, se, re, U;
339
- I > te ? (ae = q, se = q / I, re = 0, U = (Y - se) / 2) : (se = Y, ae = Y * I, re = (q - ae) / 2, U = 0), O.drawImage(W, re, U, ae, se), oe(!0);
340
- }, W.src = K.target?.result;
341
- }, V.readAsDataURL(X);
342
- }, J = () => {
343
- m.current?.click();
344
- }, ne = B || H, ce = !B && (u && !H || !p);
345
- return a ? /* @__PURE__ */ e("dialog", { ref: t, className: `${d.dialog} ${T || ""}`, onClick: ie, children: /* @__PURE__ */ i("div", { className: d.modal, children: [
346
- /* @__PURE__ */ i("div", { className: d.encabezado, children: [
347
- /* @__PURE__ */ e("h2", { className: d.titulo, children: w }),
348
- /* @__PURE__ */ i("button", { className: d.boton_cerrar, onClick: G, type: "button", "aria-label": "Cerrar", children: [
349
- /* @__PURE__ */ e("span", { className: d.texto_esc, children: "ESC" }),
350
- /* @__PURE__ */ e(rn, { className: d.icono_x })
351
- ] })
352
- ] }),
353
- /* @__PURE__ */ e("div", { className: d.contenedor_lienzo, children: /* @__PURE__ */ i("div", { className: d.area_firma, children: [
354
- /* @__PURE__ */ e(
355
- "canvas",
356
- {
357
- ref: l,
358
- className: `${d.lienzo} ${ne ? d.lienzo_deshabilitado : ""}`,
359
- width: M * 2,
360
- height: R * 2,
361
- style: {
362
- pointerEvents: ne ? "none" : "auto"
363
- }
364
- }
365
- ),
366
- /* @__PURE__ */ i("div", { className: d.barra_acciones, children: [
367
- /* @__PURE__ */ i("div", { className: d.grupo_izquierda, children: [
368
- /* @__PURE__ */ i(
369
- "button",
370
- {
371
- className: d.boton_accion,
372
- onClick: P,
373
- type: "button",
374
- disabled: !o || ne,
375
- title: h,
376
- children: [
377
- /* @__PURE__ */ e(tn, { className: d.icono }),
378
- h
379
- ]
380
- }
381
- ),
382
- /* @__PURE__ */ e("span", { className: d.separador, children: "|" }),
383
- /* @__PURE__ */ i(
384
- "button",
385
- {
386
- className: d.boton_accion,
387
- onClick: j,
388
- type: "button",
389
- disabled: u || ne,
390
- title: b,
391
- children: [
392
- /* @__PURE__ */ e(an, { className: d.icono }),
393
- b
394
- ]
395
- }
396
- )
397
- ] }),
398
- /* @__PURE__ */ e(
399
- "button",
400
- {
401
- className: d.boton_guardar,
402
- onClick: B ? le : de,
403
- type: "button",
404
- disabled: ce,
405
- children: B ? g : v
406
- }
407
- )
408
- ] })
409
- ] }) }),
410
- /* @__PURE__ */ e("div", { className: d.contenedor_consentimiento, children: /* @__PURE__ */ i("label", { className: d.contenedor_checkbox, children: [
411
- /* @__PURE__ */ e(
412
- "input",
413
- {
414
- type: "checkbox",
415
- className: d.checkbox_nativo,
416
- checked: p,
417
- onChange: (_) => D(_.target.checked)
418
- }
419
- ),
420
- /* @__PURE__ */ e("span", { className: d.checkbox_custom }),
421
- /* @__PURE__ */ e("span", { className: d.texto_consentimiento, children: N })
422
- ] }) }),
423
- L && /* @__PURE__ */ i("div", { className: d.contenedor_subir, children: [
424
- /* @__PURE__ */ e(
425
- "input",
426
- {
427
- ref: m,
428
- type: "file",
429
- accept: "image/*",
430
- className: d.input_archivo,
431
- onChange: ee
432
- }
433
- ),
434
- /* @__PURE__ */ i("button", { className: d.boton_subir, onClick: J, type: "button", children: [
435
- /* @__PURE__ */ e(sn, { className: d.icono }),
436
- y
437
- ] })
438
- ] })
439
- ] }) }) : null;
440
- }
441
- );
442
- cn.displayName = "FirmaManual";
443
- function ve({ mostrar: a, children: c, ...z }) {
444
- const [w, v] = E(a), [g, h] = E(!1);
445
- De(() => {
446
- a && !w ? (v(!0), h(!0)) : a || (v(!1), h(!1));
447
- }, [a, w]);
448
- const b = () => {
449
- g && h(!1);
450
- };
451
- return w ? /* @__PURE__ */ e(
452
- "div",
453
- {
454
- ...z,
455
- onAnimationEnd: b,
456
- className: g ? "transicion_desvanecer_deslizar_entrada" : "",
457
- children: c
458
- }
459
- ) : null;
460
- }
461
- function xe(a) {
462
- return /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 16 16", ...a, children: /* @__PURE__ */ i("g", { fill: "currentColor", children: [
463
- /* @__PURE__ */ e("path", { d: "M5 3a3 3 0 0 1 6 0v4a3 3 0 0 1-6 0z" }),
464
- /* @__PURE__ */ e("path", { d: "M8 11a4 4 0 0 1-4-4H2a6 6 0 0 0 5 5.917V14H5v2h6v-2H9v-1.083A6 6 0 0 0 14 7h-2a4 4 0 0 1-4 4" })
465
- ] }) });
466
- }
467
- function ze(a) {
468
- return /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 32 32", ...a, children: /* @__PURE__ */ e(
469
- "path",
470
- {
471
- fill: "currentColor",
472
- d: "M18 5.433c0-1.398-1.742-2.036-2.645-.97l-4.086 4.83A2 2 0 0 1 9.743 10H6a4 4 0 0 0-4 4v4a4 4 0 0 0 4 4h3.743a2 2 0 0 1 1.526.708l4.086 4.829c.902 1.066 2.645.428 2.645-.97zm3.433 3.743a1 1 0 0 1 1.391.258c1.465 2.13 2.238 4.324 2.238 6.566s-.773 4.436-2.238 6.567a1 1 0 1 1-1.648-1.133c1.285-1.87 1.887-3.676 1.887-5.434s-.602-3.564-1.887-5.433a1 1 0 0 1 .258-1.39m4.257-3.9a1 1 0 0 0-1.38 1.448c2.387 2.273 3.628 5.739 3.628 9.276s-1.241 7.003-3.628 9.276a1 1 0 0 0 1.38 1.448c2.863-2.727 4.247-6.761 4.247-10.724S28.554 8.003 25.69 5.276"
473
- }
474
- ) });
475
- }
476
- function _n(a) {
477
- return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 21", ...a, children: [
478
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "6", fill: "currentColor", opacity: ".5" }),
479
- /* @__PURE__ */ e(
480
- "path",
481
- {
482
- fill: "currentColor",
483
- d: "M12 2a10 10 0 1 0 10 10A10.01 10.01 0 0 0 12 2m0 16a6 6 0 1 1 6-6a6.007 6.007 0 0 1-6 6"
484
- }
485
- )
486
- ] });
487
- }
488
- const dn = "_contenedor_base_sg347_19", ln = "_contenedor_base_sg347_19", un = "_etiqueta_sg347_39", mn = "_marca_requerido_sg347_53", gn = "_marca_requerido_sg347_53", bn = "_fila_acciones_sg347_67", hn = "_fila_acciones_sg347_67", pn = "_etiqueta_externa_sg347_79", fn = "_etiqueta_externa_sg347_79", vn = "_etiqueta_interna_sg347_93", wn = "_etiqueta_interna_sg347_93", yn = "_encabezado_interno_sg347_109", xn = "_encabezado_interno_sg347_109", zn = "_acciones_grupo_sg347_141", Nn = "_acciones_grupo_sg347_141", kn = "_acciones_header_sg347_157", En = "_acciones_header_sg347_157", Cn = "_envoltorio_input_sg347_181", An = "_envoltorio_input_sg347_181", Mn = "_label_outside_sg347_203", Ln = "_label_outside_sg347_203", jn = "_variante_normal_sg347_211", qn = "_variante_normal_sg347_211", In = "_variante_underlined_sg347_223", Rn = "_variante_underlined_sg347_223", Sn = "_variante_light_sg347_267", Dn = "_variante_light_sg347_267", Fn = "_variante_bordered_sg347_279", Tn = "_variante_bordered_sg347_279", Bn = "_variante_faded_sg347_287", Hn = "_variante_faded_sg347_287", Wn = "_radio_none_sg347_299", $n = "_radio_none_sg347_299", Vn = "_radio_sm_sg347_307", On = "_radio_sm_sg347_307", Un = "_radio_md_sg347_315", Pn = "_radio_md_sg347_315", Gn = "_radio_lg_sg347_323", Xn = "_radio_lg_sg347_323", Yn = "_invalido_sg347_353", Jn = "_color_primary_sg347_373", Kn = "_color_primary_sg347_373", Qn = "_color_secondary_sg347_383", Zn = "_color_secondary_sg347_383", et = "_color_success_sg347_393", ot = "_color_success_sg347_393", nt = "_color_warning_sg347_403", tt = "_color_warning_sg347_403", at = "_color_danger_sg347_413", st = "_color_danger_sg347_413", rt = "_deshabilitado_sg347_425", it = "_sin_animacion_sg347_435", ct = "_sin_animacion_sg347_435", _t = "_contenedor_interior_sg347_453", dt = "_contenedor_interior_sg347_453", lt = "_inicio_sg347_469", ut = "_fin_sg347_471", mt = "_entrada_sg347_483", gt = "_sin_autosize_sg347_519", bt = "_sin_autosize_sg347_519", ht = "_estado_interno_sg347_529", pt = "_estado_interno_sg347_529", ft = "_tam_sm_sg347_543", vt = "_tam_sm_sg347_543", wt = "_tam_md_sg347_551", yt = "_tam_md_sg347_551", xt = "_tam_lg_sg347_559", zt = "_tam_lg_sg347_559", Nt = "_boton_tts_sg347_569", kt = "_boton_tts_sg347_569", Et = "_boton_limpiar_sg347_571", Ct = "_boton_limpiar_sg347_571", At = "_boton_activo_sg347_635", Mt = "_boton_activo_sg347_635", Lt = "_btn_halo_azul_sg347_1", jt = "_btn_halo_azul_sg347_1", qt = "_boton_activo_mic_sg347_677", It = "_boton_activo_mic_sg347_677", Rt = "_btn_halo_rojo_sg347_1", St = "_btn_halo_rojo_sg347_1", Dt = "_badges_wrap_sg347_783", Ft = "_badges_wrap_sg347_783", Tt = "_badges_wrap_visible_sg347_791", Bt = "_badges_wrap_visible_sg347_791", Ht = "_badge_voz_sg347_813", Wt = "_badge_voz_sg347_813", $t = "_badge_sm_sg347_845", Vt = "_badge_sm_sg347_845", Ot = "_badge_md_sg347_857", Ut = "_badge_md_sg347_857", Pt = "_badge_lg_sg347_869", Gt = "_badge_lg_sg347_869", Xt = "_badge_estirada_sg347_881", Yt = "_badge_estirada_sg347_881", Jt = "_badge_icono_sg347_901", Kt = "_badge_icono_sg347_901", Qt = "_badge_texto_sg347_927", Zt = "_badge_texto_sg347_927", ea = "_badge_mic_sg347_937", oa = "_badge_mic_sg347_937", na = "_badge_tts_sg347_945", ta = "_badge_tts_sg347_945", aa = "_badge_ondas_sg347_955", sa = "_badge_ondas_sg347_955", ra = "_badge_onda_sg347_955", ia = "_badge_onda_sg347_955", ca = "_badge_eq_sg347_995", _a = "_badge_eq_sg347_995", da = "_descripcion_sg347_1137", la = "_mensaje_error_sg347_1147", ua = "_mensaje_error_sg347_1147", ma = "_ancho_total_sg347_1159", ga = "_ancho_total_sg347_1159", n = {
489
- contenedor_base: dn,
490
- contenedorBase: ln,
491
- etiqueta: un,
492
- marca_requerido: mn,
493
- marcaRequerido: gn,
494
- fila_acciones: bn,
495
- filaAcciones: hn,
496
- etiqueta_externa: pn,
497
- etiquetaExterna: fn,
498
- etiqueta_interna: vn,
499
- etiquetaInterna: wn,
500
- encabezado_interno: yn,
501
- encabezadoInterno: xn,
502
- acciones_grupo: zn,
503
- accionesGrupo: Nn,
504
- acciones_header: kn,
505
- accionesHeader: En,
506
- envoltorio_input: Cn,
507
- envoltorioInput: An,
508
- label_outside: Mn,
509
- labelOutside: Ln,
510
- variante_normal: jn,
511
- varianteNormal: qn,
512
- variante_underlined: In,
513
- varianteUnderlined: Rn,
514
- variante_light: Sn,
515
- varianteLight: Dn,
516
- variante_bordered: Fn,
517
- varianteBordered: Tn,
518
- variante_faded: Bn,
519
- varianteFaded: Hn,
520
- radio_none: Wn,
521
- radioNone: $n,
522
- radio_sm: Vn,
523
- radioSm: On,
524
- radio_md: Un,
525
- radioMd: Pn,
526
- radio_lg: Gn,
527
- radioLg: Xn,
528
- invalido: Yn,
529
- color_primary: Jn,
530
- colorPrimary: Kn,
531
- color_secondary: Qn,
532
- colorSecondary: Zn,
533
- color_success: et,
534
- colorSuccess: ot,
535
- color_warning: nt,
536
- colorWarning: tt,
537
- color_danger: at,
538
- colorDanger: st,
539
- deshabilitado: rt,
540
- sin_animacion: it,
541
- sinAnimacion: ct,
542
- contenedor_interior: _t,
543
- contenedorInterior: dt,
544
- inicio: lt,
545
- fin: ut,
546
- entrada: mt,
547
- sin_autosize: gt,
548
- sinAutosize: bt,
549
- estado_interno: ht,
550
- estadoInterno: pt,
551
- tam_sm: ft,
552
- tamSm: vt,
553
- tam_md: wt,
554
- tamMd: yt,
555
- tam_lg: xt,
556
- tamLg: zt,
557
- boton_tts: Nt,
558
- botonTts: kt,
559
- boton_limpiar: Et,
560
- botonLimpiar: Ct,
561
- boton_activo: At,
562
- botonActivo: Mt,
563
- btn_halo_azul: Lt,
564
- btnHaloAzul: jt,
565
- boton_activo_mic: qt,
566
- botonActivoMic: It,
567
- btn_halo_rojo: Rt,
568
- btnHaloRojo: St,
569
- badges_wrap: Dt,
570
- badgesWrap: Ft,
571
- badges_wrap_visible: Tt,
572
- badgesWrapVisible: Bt,
573
- badge_voz: Ht,
574
- badgeVoz: Wt,
575
- badge_sm: $t,
576
- badgeSm: Vt,
577
- badge_md: Ot,
578
- badgeMd: Ut,
579
- badge_lg: Pt,
580
- badgeLg: Gt,
581
- badge_estirada: Xt,
582
- badgeEstirada: Yt,
583
- badge_icono: Jt,
584
- badgeIcono: Kt,
585
- badge_texto: Qt,
586
- badgeTexto: Zt,
587
- badge_mic: ea,
588
- badgeMic: oa,
589
- badge_tts: na,
590
- badgeTts: ta,
591
- badge_ondas: aa,
592
- badgeOndas: sa,
593
- badge_onda: ra,
594
- badgeOnda: ia,
595
- badge_eq: ca,
596
- badgeEq: _a,
597
- descripcion: da,
598
- mensaje_error: la,
599
- mensajeError: ua,
600
- ancho_total: ma,
601
- anchoTotal: ga
602
- };
603
- function we({ tipo: a, texto: c, size: z = "md", estirar: w }) {
604
- const v = a === "mic";
605
- return /* @__PURE__ */ i(
606
- "span",
607
- {
608
- className: A(
609
- n.badge_voz,
610
- v ? n.badge_mic : n.badge_tts,
611
- n[`badge_${z}`],
612
- w && n.badge_estirada
613
- // ⬅️
614
- ),
615
- "data-tipo": a,
616
- children: [
617
- /* @__PURE__ */ e("span", { className: n.badge_icono, children: v ? /* @__PURE__ */ e(xe, {}) : /* @__PURE__ */ e(ze, {}) }),
618
- /* @__PURE__ */ e("span", { className: n.badge_texto, children: c }),
619
- v ? /* @__PURE__ */ i("span", { className: n.badge_ondas, "aria-hidden": "true", children: [
620
- /* @__PURE__ */ e("span", {}),
621
- /* @__PURE__ */ e("span", {}),
622
- /* @__PURE__ */ e("span", {})
623
- ] }) : /* @__PURE__ */ i("span", { className: n.badge_eq, "aria-hidden": "true", children: [
624
- /* @__PURE__ */ e("span", {}),
625
- /* @__PURE__ */ e("span", {}),
626
- /* @__PURE__ */ e("span", {}),
627
- /* @__PURE__ */ e("span", {})
628
- ] })
629
- ]
630
- }
631
- );
632
- }
633
- function ba({
634
- isDisabled: a,
635
- isReadOnly: c,
636
- value: z,
637
- onChange: w,
638
- redimensionar: v,
639
- idioma: g = "es-ES"
640
- }) {
641
- const [h, b] = E(!1), [y, M] = E(!1), [R, T] = E(null), N = Q(null), L = Q(!1), S = Q(!1);
642
- Z(() => {
643
- L.current = y;
644
- }, [y]), Z(() => {
645
- S.current = h;
646
- }, [h]);
647
- const k = typeof window < "u" && "speechSynthesis" in window, l = typeof window < "u" && (!!window.SpeechRecognition || !!window.webkitSpeechRecognition), u = () => {
648
- k && (window.speechSynthesis.cancel(), b(!1));
649
- }, j = () => {
650
- if (!k || !z || L.current) return;
651
- if (N.current && typeof N.current.stop == "function")
652
- try {
653
- N.current.stop();
654
- } catch {
655
- }
656
- window.speechSynthesis.cancel();
657
- const o = new window.SpeechSynthesisUtterance(z);
658
- o.lang = g, o.onstart = () => b(!0), o.onend = () => b(!1), window.speechSynthesis.speak(o);
659
- }, P = () => {
660
- const o = N.current;
661
- if (o && typeof o.stop == "function")
662
- try {
663
- o.stop();
664
- } catch {
665
- }
666
- }, s = () => {
667
- if (!l || a || c || S.current) {
668
- T("Dictado no disponible o está reproduciendo audio.");
669
- return;
670
- }
671
- if (y && N.current && typeof N.current.stop == "function") {
672
- try {
673
- N.current.stop();
674
- } catch {
675
- }
676
- return;
677
- }
678
- const o = window.SpeechRecognition || window.webkitSpeechRecognition;
679
- if (!o) {
680
- T("No se pudo iniciar el reconocimiento de voz.");
681
- return;
682
- }
683
- const t = new o();
684
- N.current = t, t.lang = g, t.interimResults = !0, t.continuous = !0, t.maxAlternatives = 1;
685
- let m = "";
686
- t.onresult = (p) => {
687
- let D = "";
688
- for (let f = p.resultIndex; f < p.results.length; f++) {
689
- const H = p.results[f];
690
- H.isFinal ? m += H[0].transcript : D += H[0].transcript;
691
- }
692
- const B = (m + D).trim();
693
- w?.(B), v?.();
694
- }, t.onerror = (p) => {
695
- M(!1), T(p?.error ?? "error");
696
- }, t.onend = () => M(!1), T(null), M(!0);
697
- try {
698
- t.start();
699
- } catch {
700
- }
701
- }, r = () => {
702
- P(), u();
703
- };
704
- return Z(() => () => r(), []), {
705
- puedeHablar: k,
706
- hablando: h,
707
- escuchar: j,
708
- detenerHablar: u,
709
- puedeEscuchar: l,
710
- escuchando: y,
711
- errorDictado: R,
712
- dictar: s,
713
- detenerDictado: P,
714
- detenerTodo: r
715
- };
716
- }
717
- const ha = me((a, c) => {
718
- const {
719
- children: z,
720
- variant: w = "flat",
721
- color: v = "default",
722
- size: g = "md",
723
- radius: h = "md",
724
- label: b,
725
- labelPlacement: y = "inside",
726
- fullWidth: M = !0,
727
- value: R,
728
- defaultValue: T,
729
- placeholder: N,
730
- startContent: L,
731
- endContent: S,
732
- isRequired: k = !1,
733
- isReadOnly: l,
734
- isDisabled: u = !1,
735
- isClearable: j = !1,
736
- isInvalid: P,
737
- validationState: s,
738
- description: r,
739
- errorMessage: o,
740
- validate: t,
741
- minRows: m = 3,
742
- maxRows: p = 8,
743
- disableAutosize: D = !1,
744
- disableAnimation: B = !1,
745
- classNames: f,
746
- id: H,
747
- name: oe,
748
- rows: G,
749
- onChange: ie,
750
- onClear: de
751
- } = a, le = Fe(), ee = H ?? `ta-${le}`, J = R != null, [ne, ce] = E(T ?? ""), _ = J ? R : ne, [X, V] = E(!1), [K, W] = E(null), F = P ?? (s === "invalid" ? !0 : s === "valid" ? !1 : !!K), O = { invalido: !!F, mensaje: K };
752
- Z(() => {
753
- if (!t) return W(null);
754
- const C = t(_);
755
- C === !0 || C == null ? W(null) : W(typeof C == "string" ? C : C.message ?? "Entrada inválida");
756
- }, [_, t]);
757
- const q = Q(null), Y = $(() => {
758
- if (!q.current || D) return;
759
- const C = q.current;
760
- C.style.height = "auto";
761
- const Re = Math.min(Math.max(C.scrollHeight, m * 24), p * 24);
762
- C.style.height = `${Re}px`;
763
- }, [D, m, p]);
764
- Z(() => {
765
- Y();
766
- }, [_, Y]), ye(c, () => q.current);
767
- const {
768
- puedeHablar: te,
769
- hablando: I,
770
- escuchar: ae,
771
- detenerHablar: se,
772
- puedeEscuchar: re,
773
- escuchando: U,
774
- errorDictado: _e,
775
- dictar: Ne,
776
- detenerDictado: ke
777
- } = ba({
778
- isDisabled: u,
779
- isReadOnly: l,
780
- value: _,
781
- onChange: (C) => {
782
- J || ce(C), ie?.(C);
783
- },
784
- redimensionar: Y
785
- }), Ee = (C) => {
786
- u || l || (J || ce(C.target.value), ie?.(C.target.value));
787
- }, Ce = () => {
788
- u || l || (J || ce(""), ie?.(""), de?.(), requestAnimationFrame(() => q.current?.focus()));
789
- }, Ae = () => I ? se() : ae(), Me = () => U ? ke() : Ne(), ue = typeof o == "function" ? o(O) : o ?? K, Le = j && !!_ && !l && !u, ge = U || I, je = y === "inside" && (b || j || te || re), be = r ? `${ee}-desc` : void 0, he = ue || _e ? `${ee}-err` : void 0, qe = [be, he].filter(Boolean).join(" ") || void 0, Ie = A(
790
- n.contenedor_base,
791
- n[`variante_${w}`],
792
- n[`color_${v}`],
793
- n[`tam_${g}`],
794
- n[`radio_${h}`],
795
- M && n.ancho_total,
796
- B && n.sin_animacion,
797
- u && n.deshabilitado,
798
- y === "outside" && n.label_outside,
799
- F && n.invalido,
800
- X && n.enfocado,
801
- f?.base
802
- ), pe = () => /* @__PURE__ */ i("div", { className: n.acciones_header, children: [
803
- /* @__PURE__ */ e(
804
- "button",
805
- {
806
- type: "button",
807
- className: A(n.boton_tts, I && n.boton_activo),
808
- onClick: Ae,
809
- disabled: !te || !I && (!_ || U),
810
- title: "Escuchar",
811
- "aria-pressed": I,
812
- children: /* @__PURE__ */ e(ze, {})
813
- }
814
- ),
815
- re && /* @__PURE__ */ e(
816
- "button",
817
- {
818
- type: "button",
819
- className: A(n.boton_tts, U && n.boton_activo_mic),
820
- onClick: Me,
821
- disabled: u || l || I,
822
- title: "Dictar",
823
- "aria-pressed": U,
824
- children: U ? /* @__PURE__ */ e(_n, { color: "red" }) : /* @__PURE__ */ e(xe, {})
825
- }
826
- ),
827
- Le && /* @__PURE__ */ e(
828
- "button",
829
- {
830
- type: "button",
831
- className: n.boton_limpiar,
832
- onClick: Ce,
833
- title: "Limpiar",
834
- "aria-label": "Limpiar contenido",
835
- children: "×"
836
- }
837
- )
838
- ] }), fe = () => /* @__PURE__ */ i(Se, { children: [
839
- /* @__PURE__ */ e(ve, { mostrar: U, children: /* @__PURE__ */ e(we, { tipo: "mic", texto: "Habla ahora", size: g }) }),
840
- /* @__PURE__ */ e(ve, { mostrar: I, children: /* @__PURE__ */ e(we, { tipo: "tts", texto: "Reproduciendo", size: g }) })
841
- ] });
842
- return /* @__PURE__ */ i("div", { className: Ie, children: [
843
- y === "outside" && /* @__PURE__ */ i("div", { className: n.fila_acciones, children: [
844
- b && /* @__PURE__ */ i("label", { className: A(n.etiqueta, n.etiqueta_externa, f?.label), htmlFor: ee, children: [
845
- b,
846
- " ",
847
- k && /* @__PURE__ */ e("span", { className: n.marca_requerido, children: "*" })
848
- ] }),
849
- /* @__PURE__ */ i("div", { className: n.acciones_grupo, children: [
850
- pe(),
851
- /* @__PURE__ */ e(
852
- "div",
853
- {
854
- className: A(n.badges_wrap, ge && n.badges_wrap_visible),
855
- "aria-live": "polite",
856
- role: "status",
857
- children: fe()
858
- }
859
- )
860
- ] })
861
- ] }),
862
- /* @__PURE__ */ i("div", { className: A(n.envoltorio_input, f?.inputWrapper), children: [
863
- je && /* @__PURE__ */ i("div", { className: A(n.encabezado_interno, f?.headerWrapper), children: [
864
- b && /* @__PURE__ */ i("label", { className: A(n.etiqueta_interna, f?.label), htmlFor: ee, children: [
865
- b,
866
- " ",
867
- k && /* @__PURE__ */ e("span", { className: n.marca_requerido, children: "*" })
868
- ] }),
869
- /* @__PURE__ */ i("div", { className: n.acciones_grupo, children: [
870
- pe(),
871
- /* @__PURE__ */ e(
872
- "div",
873
- {
874
- className: A(n.badges_wrap, ge && n.badges_wrap_visible),
875
- "aria-live": "polite",
876
- role: "status",
877
- children: fe()
878
- }
879
- )
880
- ] })
881
- ] }),
882
- /* @__PURE__ */ i("div", { className: A(n.contenedor_interior, f?.innerWrapper), children: [
883
- L && /* @__PURE__ */ e("div", { className: n.inicio, children: L }),
884
- /* @__PURE__ */ e(
885
- "textarea",
886
- {
887
- ref: q,
888
- id: ee,
889
- name: oe,
890
- placeholder: N,
891
- value: J ? _ : void 0,
892
- defaultValue: J ? void 0 : T ?? "",
893
- onChange: Ee,
894
- onFocus: () => V(!0),
895
- onBlur: () => V(!1),
896
- className: A(n.entrada, D && n.sin_autosize, f?.input),
897
- readOnly: l,
898
- disabled: u,
899
- rows: G ?? m,
900
- "aria-invalid": F || void 0,
901
- "aria-describedby": qe
902
- }
903
- ),
904
- S && /* @__PURE__ */ e("div", { className: n.fin, children: S })
905
- ] })
906
- ] }),
907
- r && /* @__PURE__ */ e("div", { id: be, className: A(n.descripcion, f?.description), children: r }),
908
- (ue || _e) && /* @__PURE__ */ i("div", { id: he, className: A(n.mensaje_error, f?.errorMessage), children: [
909
- ue,
910
- _e && /* @__PURE__ */ e("span", { className: n.mensaje_error, children: _e })
911
- ] }),
912
- z
913
- ] });
914
- });
915
- ha.displayName = "TextArea";
916
- export {
917
- Lo as Boton,
918
- cn as FirmaManual,
919
- ha as TextArea
920
- };
921
- //# sourceMappingURL=index.js.map