@directo-ui/web 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/figma-components-directo.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/wari/MultiSelect.d.ts +44 -0
- package/dist/wari/StatusTag.d.ts +14 -0
- package/dist/wari/WariDateField.d.ts +28 -0
- package/dist/wari/WariSchedule.d.ts +32 -0
- package/dist/wari/WariSelect.d.ts +29 -0
- package/dist/wari/WariServiceMeta.d.ts +8 -0
- package/dist/wari/WariStatusSelect.d.ts +14 -0
- package/dist/wari/WariStepper.d.ts +16 -0
- package/dist/wari/WariSwitchList.d.ts +17 -0
- package/dist/wari/WariTimeField.d.ts +23 -0
- package/dist/wari/WariTripAttributes.d.ts +24 -0
- package/dist/wari/datetime.d.ts +57 -0
- package/dist/wari/icons.d.ts +16 -0
- package/dist/wari/index.d.ts +30 -0
- package/dist/wari/logic.d.ts +14 -0
- package/dist/wari/statuses.d.ts +34 -0
- package/dist/wari/trip.d.ts +56 -0
- package/dist/wari.js +1735 -0
- package/dist/wari.js.map +1 -0
- package/package.json +5 -1
package/dist/wari.js
ADDED
|
@@ -0,0 +1,1735 @@
|
|
|
1
|
+
import { useEffect as e, useId as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
2
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
//#region src/wari/statuses.ts
|
|
4
|
+
var c = [
|
|
5
|
+
{
|
|
6
|
+
value: "libre",
|
|
7
|
+
label: "Libre"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
value: "aceptado",
|
|
11
|
+
label: "Aceptado"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
value: "contacto",
|
|
15
|
+
label: "Contacto"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "inicio",
|
|
19
|
+
label: "Inició"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: "llego",
|
|
23
|
+
label: "Llegó"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: "terminado",
|
|
27
|
+
label: "Terminado"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: "preasignado",
|
|
31
|
+
label: "Preasignado"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: "anulado-operador",
|
|
35
|
+
label: "Anulado Operador"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: "anulado-usuario",
|
|
39
|
+
label: "Anulado Usuario"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
value: "empalmado",
|
|
43
|
+
label: "Empalmado"
|
|
44
|
+
}
|
|
45
|
+
], l = (e) => c.find((t) => t.value === e)?.label ?? e;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/wari/StatusTag.tsx
|
|
48
|
+
function u({ status: e, size: t = "md", color: n, children: r, className: i, style: a, ...s }) {
|
|
49
|
+
let c = n ? {
|
|
50
|
+
"--ds-status-bg": n.background,
|
|
51
|
+
"--ds-status-fg": n.foreground
|
|
52
|
+
} : void 0, u = r ?? (e && e !== "todos" ? l(e) : "Todos");
|
|
53
|
+
return /* @__PURE__ */ o("span", {
|
|
54
|
+
...s,
|
|
55
|
+
className: ["ds-status", i].filter(Boolean).join(" "),
|
|
56
|
+
"data-status": e,
|
|
57
|
+
"data-size": t,
|
|
58
|
+
style: c ? {
|
|
59
|
+
...c,
|
|
60
|
+
...a
|
|
61
|
+
} : a,
|
|
62
|
+
children: /* @__PURE__ */ o("span", { children: u })
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/wari/logic.ts
|
|
67
|
+
function d(e) {
|
|
68
|
+
return e.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase().trim();
|
|
69
|
+
}
|
|
70
|
+
function f(e, t) {
|
|
71
|
+
let n = d(t);
|
|
72
|
+
return n ? e.filter((e) => d(e.label).includes(n)) : [...e];
|
|
73
|
+
}
|
|
74
|
+
function p(e, t) {
|
|
75
|
+
let n = new Set(e);
|
|
76
|
+
return t.filter((e) => n.has(e.value)).map((e) => e.value);
|
|
77
|
+
}
|
|
78
|
+
function m(e, t, n) {
|
|
79
|
+
let r = n.find((e) => e.value === t);
|
|
80
|
+
if (!r || r.disabled) return [...e];
|
|
81
|
+
let i = new Set(e);
|
|
82
|
+
return i.has(t) ? i.delete(t) : i.add(t), p(i, n);
|
|
83
|
+
}
|
|
84
|
+
function h(e, t) {
|
|
85
|
+
let n = t.filter((e) => !e.disabled), r = n.filter((t) => e.includes(t.value)).length;
|
|
86
|
+
return r === 0 ? "none" : r === n.length ? "all" : "some";
|
|
87
|
+
}
|
|
88
|
+
function g(e, t) {
|
|
89
|
+
let n = t.filter((t) => t.disabled && e.includes(t.value)).map((e) => e.value);
|
|
90
|
+
return h(e, t) === "all" ? p(n, t) : p([...n, ...t.filter((e) => !e.disabled).map((e) => e.value)], t);
|
|
91
|
+
}
|
|
92
|
+
function _(e) {
|
|
93
|
+
return e <= 0 ? "" : e === 1 ? "1 elemento seleccionado" : `${e} elementos seleccionados`;
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/wari/MultiSelect.tsx
|
|
97
|
+
var v = Symbol("all");
|
|
98
|
+
function y({ options: a, value: c, defaultValue: l, onChange: d, label: p, "aria-label": y, placeholder: b = "Seleccionar", searchPlaceholder: x = "Buscar…", allLabel: S = "Todos", maxTags: C = 2, supportingText: w, summary: T = !0, emptyMessage: E = "Sin coincidencias", error: D = !1, disabled: O = !1, required: k, name: A, id: j, className: M, size: N = "md" }) {
|
|
99
|
+
let P = t(), F = j ?? P, I = `${F}-listbox`, L = `${F}-label`, ee = `${F}-hint`, R = (e) => `${F}-option-${e}`, [z, te] = i(() => l ?? []), B = c ?? z, [V, H] = i(!1), [U, ne] = i(""), [re, W] = i(0), ie = r(null), G = r(null), ae = n(() => f(a, U), [a, U]), K = S && !U && a.length > 0 ? [v, ...ae] : ae, q = Math.min(re, K.length - 1), J = h(B, a), oe = a.some((e) => e.status || e.color), Y = a.filter((e) => B.includes(e.value)).length, se = w ?? (T === !1 ? "" : typeof T == "function" ? T(Y, a.length) : _(Y));
|
|
100
|
+
e(() => {
|
|
101
|
+
if (!V) return;
|
|
102
|
+
let e = (e) => {
|
|
103
|
+
ie.current?.contains(e.target) || (H(!1), ne(""));
|
|
104
|
+
};
|
|
105
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
106
|
+
}, [V]), e(() => {
|
|
107
|
+
V && q >= 0 && document.getElementById(`${F}-option-${q}`)?.scrollIntoView?.({ block: "nearest" });
|
|
108
|
+
}, [
|
|
109
|
+
V,
|
|
110
|
+
q,
|
|
111
|
+
F
|
|
112
|
+
]);
|
|
113
|
+
let X = (e) => {
|
|
114
|
+
c === void 0 && te(e), d?.(e);
|
|
115
|
+
}, Z = () => {
|
|
116
|
+
H(!1), ne("");
|
|
117
|
+
}, Q = (e) => {
|
|
118
|
+
O || (H(!0), W(e));
|
|
119
|
+
}, $ = (e) => X(e === v ? g(B, a) : m(B, e.value, a)), ce = (e, t, n) => oe ? /* @__PURE__ */ o(u, {
|
|
120
|
+
status: t,
|
|
121
|
+
color: n,
|
|
122
|
+
children: e
|
|
123
|
+
}) : /* @__PURE__ */ o("span", {
|
|
124
|
+
className: "ds-multiselect-option-label",
|
|
125
|
+
children: e
|
|
126
|
+
}), le = (e) => {
|
|
127
|
+
let t = K.length - 1;
|
|
128
|
+
switch (e.key) {
|
|
129
|
+
case "ArrowDown":
|
|
130
|
+
e.preventDefault(), V ? W(Math.min(q + 1, t)) : Q(0);
|
|
131
|
+
break;
|
|
132
|
+
case "ArrowUp":
|
|
133
|
+
e.preventDefault(), V ? W(Math.max(q - 1, 0)) : Q(t);
|
|
134
|
+
break;
|
|
135
|
+
case "Home":
|
|
136
|
+
case "End":
|
|
137
|
+
V && (e.preventDefault(), W(e.key === "Home" ? 0 : t));
|
|
138
|
+
break;
|
|
139
|
+
case "Enter":
|
|
140
|
+
e.preventDefault(), V ? K[q] && $(K[q]) : Q(0);
|
|
141
|
+
break;
|
|
142
|
+
case "Escape":
|
|
143
|
+
V && (e.preventDefault(), U ? (ne(""), W(0)) : Z());
|
|
144
|
+
break;
|
|
145
|
+
case "Tab": Z();
|
|
146
|
+
}
|
|
147
|
+
}, ue = (e) => {
|
|
148
|
+
O || e.target === G.current || (e.preventDefault(), G.current?.focus(), V ? Z() : Q(0));
|
|
149
|
+
}, de = (e) => {
|
|
150
|
+
let t = e.relatedTarget;
|
|
151
|
+
t && !ie.current?.contains(t) && Z();
|
|
152
|
+
}, fe = a.filter((e) => B.includes(e.value)), pe = Math.max(0, fe.length - C);
|
|
153
|
+
return /* @__PURE__ */ s("div", {
|
|
154
|
+
ref: ie,
|
|
155
|
+
className: [
|
|
156
|
+
"ds-input",
|
|
157
|
+
"ds-multiselect",
|
|
158
|
+
M
|
|
159
|
+
].filter(Boolean).join(" "),
|
|
160
|
+
"data-open": V,
|
|
161
|
+
"data-error": D,
|
|
162
|
+
"data-disabled": O,
|
|
163
|
+
"data-size": N,
|
|
164
|
+
onBlur: de,
|
|
165
|
+
children: [
|
|
166
|
+
p && /* @__PURE__ */ s("label", {
|
|
167
|
+
id: L,
|
|
168
|
+
htmlFor: F,
|
|
169
|
+
children: [p, k && /* @__PURE__ */ o("span", {
|
|
170
|
+
className: "ds-input-required",
|
|
171
|
+
"aria-hidden": "true",
|
|
172
|
+
children: "*"
|
|
173
|
+
})]
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ s("div", {
|
|
176
|
+
className: "ds-multiselect-anchor",
|
|
177
|
+
children: [/* @__PURE__ */ s("div", {
|
|
178
|
+
className: "ds-input-shell",
|
|
179
|
+
onMouseDown: ue,
|
|
180
|
+
children: [
|
|
181
|
+
Y > 0 && /* @__PURE__ */ s("div", {
|
|
182
|
+
className: "ds-multiselect-values",
|
|
183
|
+
"aria-hidden": "true",
|
|
184
|
+
children: [J === "all" && S ? ce(S, "todos") : fe.slice(0, C).map((e) => /* @__PURE__ */ o("span", { children: ce(e.label, e.status, e.color) }, e.value)), !(J === "all" && S) && pe > 0 && /* @__PURE__ */ s("span", {
|
|
185
|
+
className: "ds-multiselect-more",
|
|
186
|
+
children: ["+", pe]
|
|
187
|
+
})]
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ o("input", {
|
|
190
|
+
ref: G,
|
|
191
|
+
id: F,
|
|
192
|
+
className: "ds-multiselect-input",
|
|
193
|
+
type: "text",
|
|
194
|
+
role: "combobox",
|
|
195
|
+
autoComplete: "off",
|
|
196
|
+
"aria-expanded": V,
|
|
197
|
+
"aria-controls": I,
|
|
198
|
+
"aria-autocomplete": "list",
|
|
199
|
+
"aria-activedescendant": V && q >= 0 ? R(q) : void 0,
|
|
200
|
+
"aria-label": p ? void 0 : y,
|
|
201
|
+
"aria-invalid": D || void 0,
|
|
202
|
+
"aria-required": k || void 0,
|
|
203
|
+
"aria-describedby": se ? ee : void 0,
|
|
204
|
+
placeholder: V ? x : Y ? "" : b,
|
|
205
|
+
value: U,
|
|
206
|
+
disabled: O,
|
|
207
|
+
onChange: (e) => {
|
|
208
|
+
ne(e.target.value), H(!0), W(0);
|
|
209
|
+
},
|
|
210
|
+
onClick: () => {
|
|
211
|
+
V || Q(0);
|
|
212
|
+
},
|
|
213
|
+
onKeyDown: le
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ o("button", {
|
|
216
|
+
type: "button",
|
|
217
|
+
className: "ds-multiselect-caret",
|
|
218
|
+
tabIndex: -1,
|
|
219
|
+
"aria-hidden": "true",
|
|
220
|
+
disabled: O,
|
|
221
|
+
children: /* @__PURE__ */ o("svg", {
|
|
222
|
+
width: "16",
|
|
223
|
+
height: "16",
|
|
224
|
+
viewBox: "0 0 16 16",
|
|
225
|
+
fill: "none",
|
|
226
|
+
stroke: "currentColor",
|
|
227
|
+
strokeWidth: "1.8",
|
|
228
|
+
strokeLinecap: "round",
|
|
229
|
+
strokeLinejoin: "round",
|
|
230
|
+
children: /* @__PURE__ */ o("path", { d: "m4 6 4 4 4-4" })
|
|
231
|
+
})
|
|
232
|
+
})
|
|
233
|
+
]
|
|
234
|
+
}), V && /* @__PURE__ */ s("ul", {
|
|
235
|
+
id: I,
|
|
236
|
+
className: "ds-multiselect-list",
|
|
237
|
+
role: "listbox",
|
|
238
|
+
"aria-multiselectable": "true",
|
|
239
|
+
"aria-labelledby": p ? L : void 0,
|
|
240
|
+
"aria-label": p ? void 0 : y,
|
|
241
|
+
children: [K.map((e, t) => {
|
|
242
|
+
let n = e === v, r = !n && !!e.disabled, i = n ? J === "all" : B.includes(e.value);
|
|
243
|
+
return /* @__PURE__ */ s("li", {
|
|
244
|
+
id: R(t),
|
|
245
|
+
role: "option",
|
|
246
|
+
className: "ds-multiselect-option",
|
|
247
|
+
"aria-selected": i,
|
|
248
|
+
"aria-disabled": r || void 0,
|
|
249
|
+
"data-active": t === q,
|
|
250
|
+
"data-indeterminate": n && J === "some",
|
|
251
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
252
|
+
onMouseMove: () => {
|
|
253
|
+
t !== q && W(t);
|
|
254
|
+
},
|
|
255
|
+
onClick: () => {
|
|
256
|
+
r || ($(e), W(t));
|
|
257
|
+
},
|
|
258
|
+
children: [
|
|
259
|
+
/* @__PURE__ */ o("span", {
|
|
260
|
+
className: "ds-multiselect-check",
|
|
261
|
+
"aria-hidden": "true"
|
|
262
|
+
}),
|
|
263
|
+
n ? ce(S, "todos") : ce(e.label, e.status, e.color),
|
|
264
|
+
!n && e.description != null && /* @__PURE__ */ o("span", {
|
|
265
|
+
className: "ds-multiselect-option-label",
|
|
266
|
+
children: e.description
|
|
267
|
+
})
|
|
268
|
+
]
|
|
269
|
+
}, n ? "__all__" : e.value);
|
|
270
|
+
}), K.length === 0 && /* @__PURE__ */ o("li", {
|
|
271
|
+
className: "ds-multiselect-empty",
|
|
272
|
+
role: "presentation",
|
|
273
|
+
children: E
|
|
274
|
+
})]
|
|
275
|
+
})]
|
|
276
|
+
}),
|
|
277
|
+
se && /* @__PURE__ */ o("small", {
|
|
278
|
+
id: ee,
|
|
279
|
+
"aria-live": "polite",
|
|
280
|
+
children: se
|
|
281
|
+
}),
|
|
282
|
+
A && B.map((e) => /* @__PURE__ */ o("input", {
|
|
283
|
+
type: "hidden",
|
|
284
|
+
name: A,
|
|
285
|
+
value: e
|
|
286
|
+
}, e))
|
|
287
|
+
]
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/wari/WariStatusSelect.tsx
|
|
292
|
+
function b({ statuses: e, descriptions: t, onChange: n, label: r = "Estado", ...i }) {
|
|
293
|
+
let a = c.filter((t) => !e || e.includes(t.value)).map((e) => ({
|
|
294
|
+
value: e.value,
|
|
295
|
+
label: e.label,
|
|
296
|
+
status: e.value,
|
|
297
|
+
description: t?.[e.value]
|
|
298
|
+
}));
|
|
299
|
+
return /* @__PURE__ */ o(y, {
|
|
300
|
+
...i,
|
|
301
|
+
label: r,
|
|
302
|
+
options: a,
|
|
303
|
+
onChange: (e) => n?.(e)
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/wari/datetime.ts
|
|
308
|
+
var x = (e, t = 2) => String(e).padStart(t, "0");
|
|
309
|
+
function S(e, t, n) {
|
|
310
|
+
return `${x(e, 4)}-${x(t + 1)}-${x(n)}`;
|
|
311
|
+
}
|
|
312
|
+
function C(e) {
|
|
313
|
+
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e ?? "");
|
|
314
|
+
if (!t) return null;
|
|
315
|
+
let n = Number(t[1]), r = Number(t[2]) - 1, i = Number(t[3]), a = new Date(n, r, i);
|
|
316
|
+
return a.getFullYear() === n && a.getMonth() === r && a.getDate() === i ? {
|
|
317
|
+
year: n,
|
|
318
|
+
month: r,
|
|
319
|
+
day: i
|
|
320
|
+
} : null;
|
|
321
|
+
}
|
|
322
|
+
function w(e = /* @__PURE__ */ new Date()) {
|
|
323
|
+
return S(e.getFullYear(), e.getMonth(), e.getDate());
|
|
324
|
+
}
|
|
325
|
+
function T(e) {
|
|
326
|
+
let t = C(e);
|
|
327
|
+
return t ? `${x(t.day)}/${x(t.month + 1)}/${x(t.year % 100)}` : "";
|
|
328
|
+
}
|
|
329
|
+
function E(e) {
|
|
330
|
+
let t = /^\s*(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})\s*$/.exec(e);
|
|
331
|
+
if (!t) return null;
|
|
332
|
+
let n = S(t[3].length === 2 ? 2e3 + Number(t[3]) : Number(t[3]), Number(t[2]) - 1, Number(t[1]));
|
|
333
|
+
return C(n) ? n : null;
|
|
334
|
+
}
|
|
335
|
+
function D(e, t, n) {
|
|
336
|
+
return (!t || e >= t) && (!n || e <= n);
|
|
337
|
+
}
|
|
338
|
+
function O(e, t, n) {
|
|
339
|
+
let r = new Date(e, t + n, 1);
|
|
340
|
+
return {
|
|
341
|
+
year: r.getFullYear(),
|
|
342
|
+
month: r.getMonth()
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function k(e, t, n = 0) {
|
|
346
|
+
let r = (new Date(e, t, 1).getDay() - n + 7) % 7, i = [];
|
|
347
|
+
for (let n = 0; n < 6; n++) {
|
|
348
|
+
let a = [];
|
|
349
|
+
for (let i = 0; i < 7; i++) {
|
|
350
|
+
let o = new Date(e, t, 1 - r + n * 7 + i);
|
|
351
|
+
a.push({
|
|
352
|
+
iso: S(o.getFullYear(), o.getMonth(), o.getDate()),
|
|
353
|
+
day: o.getDate(),
|
|
354
|
+
outside: o.getMonth() !== t
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
i.push(a);
|
|
358
|
+
}
|
|
359
|
+
return i;
|
|
360
|
+
}
|
|
361
|
+
function A(e, t) {
|
|
362
|
+
let n = C(e);
|
|
363
|
+
if (!n) return e;
|
|
364
|
+
let r = new Date(n.year, n.month, n.day + t);
|
|
365
|
+
return S(r.getFullYear(), r.getMonth(), r.getDate());
|
|
366
|
+
}
|
|
367
|
+
function j(e, t) {
|
|
368
|
+
let n = C(e);
|
|
369
|
+
if (!n) return e;
|
|
370
|
+
let r = O(n.year, n.month, t), i = new Date(r.year, r.month + 1, 0).getDate();
|
|
371
|
+
return S(r.year, r.month, Math.min(n.day, i));
|
|
372
|
+
}
|
|
373
|
+
function M(e = "es", t = "long") {
|
|
374
|
+
let n = new Intl.DateTimeFormat(e, {
|
|
375
|
+
month: t,
|
|
376
|
+
timeZone: "UTC"
|
|
377
|
+
});
|
|
378
|
+
return Array.from({ length: 12 }, (e, t) => n.format(new Date(Date.UTC(2024, t, 1))).replace(".", ""));
|
|
379
|
+
}
|
|
380
|
+
function N(e = "es", t = 0, n = "narrow") {
|
|
381
|
+
let r = new Intl.DateTimeFormat(e, {
|
|
382
|
+
weekday: n,
|
|
383
|
+
timeZone: "UTC"
|
|
384
|
+
});
|
|
385
|
+
return Array.from({ length: 7 }, (e, n) => r.format(new Date(Date.UTC(2024, 0, 7 + (n + t) % 7))));
|
|
386
|
+
}
|
|
387
|
+
function P(e, t = "es") {
|
|
388
|
+
let n = C(e);
|
|
389
|
+
return n ? new Intl.DateTimeFormat(t, {
|
|
390
|
+
weekday: "long",
|
|
391
|
+
day: "numeric",
|
|
392
|
+
month: "long",
|
|
393
|
+
year: "numeric",
|
|
394
|
+
timeZone: "UTC"
|
|
395
|
+
}).format(new Date(Date.UTC(n.year, n.month, n.day))) : "";
|
|
396
|
+
}
|
|
397
|
+
function F(e) {
|
|
398
|
+
let t = /^(\d{1,2}):(\d{2})$/.exec(e ?? "");
|
|
399
|
+
if (!t) return null;
|
|
400
|
+
let n = Number(t[1]), r = Number(t[2]);
|
|
401
|
+
return n < 24 && r < 60 ? {
|
|
402
|
+
hours: n,
|
|
403
|
+
minutes: r
|
|
404
|
+
} : null;
|
|
405
|
+
}
|
|
406
|
+
function I(e, t) {
|
|
407
|
+
return `${x(e)}:${x(t)}`;
|
|
408
|
+
}
|
|
409
|
+
function L(e) {
|
|
410
|
+
return {
|
|
411
|
+
hour: e % 12 == 0 ? 12 : e % 12,
|
|
412
|
+
period: e < 12 ? "AM" : "PM"
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
function ee(e, t) {
|
|
416
|
+
return e % 12 + (t === "PM" ? 12 : 0);
|
|
417
|
+
}
|
|
418
|
+
function R(e) {
|
|
419
|
+
let t = F(e);
|
|
420
|
+
if (!t) return "";
|
|
421
|
+
let { hour: n, period: r } = L(t.hours);
|
|
422
|
+
return `${x(n)}:${x(t.minutes)} ${r}`;
|
|
423
|
+
}
|
|
424
|
+
function z(e) {
|
|
425
|
+
let t = /^\s*(\d{1,2})(?::?(\d{2}))?\s*([ap])?\.?\s*m?\.?\s*$/i.exec(e);
|
|
426
|
+
if (!t) return null;
|
|
427
|
+
let n = Number(t[1]), r = t[2] ? Number(t[2]) : 0, i = t[3]?.toLowerCase();
|
|
428
|
+
if (r > 59) return null;
|
|
429
|
+
if (i) {
|
|
430
|
+
if (n < 1 || n > 12) return null;
|
|
431
|
+
n = ee(n, i === "p" ? "PM" : "AM");
|
|
432
|
+
} else if (n > 23) return null;
|
|
433
|
+
return I(n, r);
|
|
434
|
+
}
|
|
435
|
+
function te(e, t, n, r) {
|
|
436
|
+
let i = e % t / t * Math.PI * 2;
|
|
437
|
+
return {
|
|
438
|
+
x: r + n * Math.sin(i),
|
|
439
|
+
y: r - n * Math.cos(i)
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
function B(e, t, n, r) {
|
|
443
|
+
let i = (Math.atan2(e - n, n - t) * 180 / Math.PI + 360) % 360;
|
|
444
|
+
if (r === "hour") {
|
|
445
|
+
let e = Math.round(i / 30) % 12;
|
|
446
|
+
return e === 0 ? 12 : e;
|
|
447
|
+
}
|
|
448
|
+
return Math.round(i / 6) % 60;
|
|
449
|
+
}
|
|
450
|
+
var V = (e) => x(e), H = {
|
|
451
|
+
width: 20,
|
|
452
|
+
height: 20,
|
|
453
|
+
viewBox: "0 0 24 24",
|
|
454
|
+
fill: "none",
|
|
455
|
+
stroke: "currentColor",
|
|
456
|
+
strokeWidth: 1.8,
|
|
457
|
+
strokeLinecap: "round",
|
|
458
|
+
strokeLinejoin: "round",
|
|
459
|
+
"aria-hidden": !0
|
|
460
|
+
}, U = () => /* @__PURE__ */ s("svg", {
|
|
461
|
+
...H,
|
|
462
|
+
children: [
|
|
463
|
+
/* @__PURE__ */ o("rect", {
|
|
464
|
+
x: "3.5",
|
|
465
|
+
y: "5",
|
|
466
|
+
width: "17",
|
|
467
|
+
height: "15.5",
|
|
468
|
+
rx: "2.5"
|
|
469
|
+
}),
|
|
470
|
+
/* @__PURE__ */ o("path", { d: "M3.5 9.5h17M8 3v4M16 3v4" }),
|
|
471
|
+
/* @__PURE__ */ o("rect", {
|
|
472
|
+
x: "11",
|
|
473
|
+
y: "13",
|
|
474
|
+
width: "2.4",
|
|
475
|
+
height: "2.4",
|
|
476
|
+
rx: ".6",
|
|
477
|
+
fill: "currentColor",
|
|
478
|
+
stroke: "none"
|
|
479
|
+
})
|
|
480
|
+
]
|
|
481
|
+
}), ne = ({ size: e = 20 }) => /* @__PURE__ */ s("svg", {
|
|
482
|
+
...H,
|
|
483
|
+
width: e,
|
|
484
|
+
height: e,
|
|
485
|
+
children: [/* @__PURE__ */ o("circle", {
|
|
486
|
+
cx: "12",
|
|
487
|
+
cy: "12",
|
|
488
|
+
r: "8.5"
|
|
489
|
+
}), /* @__PURE__ */ o("path", { d: "M12 7.5V12l3 2" })]
|
|
490
|
+
}), re = () => /* @__PURE__ */ o("svg", {
|
|
491
|
+
...H,
|
|
492
|
+
children: /* @__PURE__ */ o("path", { d: "m14.5 6-6 6 6 6" })
|
|
493
|
+
}), W = () => /* @__PURE__ */ o("svg", {
|
|
494
|
+
...H,
|
|
495
|
+
children: /* @__PURE__ */ o("path", { d: "m9.5 6 6 6-6 6" })
|
|
496
|
+
}), ie = () => /* @__PURE__ */ o("svg", {
|
|
497
|
+
...H,
|
|
498
|
+
width: 18,
|
|
499
|
+
height: 18,
|
|
500
|
+
children: /* @__PURE__ */ o("path", {
|
|
501
|
+
d: "m7 10 5 5 5-5",
|
|
502
|
+
fill: "currentColor",
|
|
503
|
+
stroke: "none"
|
|
504
|
+
})
|
|
505
|
+
}), G = () => /* @__PURE__ */ o("svg", {
|
|
506
|
+
...H,
|
|
507
|
+
width: 24,
|
|
508
|
+
height: 24,
|
|
509
|
+
children: /* @__PURE__ */ o("path", { d: "m5 12.5 4.5 4.5L19 7.5" })
|
|
510
|
+
}), ae = () => /* @__PURE__ */ s("svg", {
|
|
511
|
+
...H,
|
|
512
|
+
children: [/* @__PURE__ */ o("rect", {
|
|
513
|
+
x: "2.5",
|
|
514
|
+
y: "6",
|
|
515
|
+
width: "19",
|
|
516
|
+
height: "12",
|
|
517
|
+
rx: "2"
|
|
518
|
+
}), /* @__PURE__ */ o("path", { d: "M6 9.5h.01M9 9.5h.01M12 9.5h.01M15 9.5h.01M18 9.5h.01M7 14.5h10" })]
|
|
519
|
+
}), K = () => /* @__PURE__ */ o("svg", {
|
|
520
|
+
...H,
|
|
521
|
+
width: 24,
|
|
522
|
+
height: 24,
|
|
523
|
+
children: /* @__PURE__ */ o("path", { d: "M6 4v8M6 16v4M12 4v2M12 10v10M18 4v10M18 18v2M4 14h4M10 8h4M16 16h4" })
|
|
524
|
+
}), q = () => /* @__PURE__ */ o("svg", {
|
|
525
|
+
...H,
|
|
526
|
+
children: /* @__PURE__ */ o("path", { d: "m6 9.5 6 6 6-6" })
|
|
527
|
+
}), J = () => /* @__PURE__ */ o("svg", {
|
|
528
|
+
...H,
|
|
529
|
+
width: 16,
|
|
530
|
+
height: 16,
|
|
531
|
+
children: /* @__PURE__ */ o("path", { d: "M5 12h14" })
|
|
532
|
+
}), oe = () => /* @__PURE__ */ o("svg", {
|
|
533
|
+
...H,
|
|
534
|
+
width: 16,
|
|
535
|
+
height: 16,
|
|
536
|
+
children: /* @__PURE__ */ o("path", { d: "M12 5v14M5 12h14" })
|
|
537
|
+
}), Y = {
|
|
538
|
+
...H,
|
|
539
|
+
width: 12,
|
|
540
|
+
height: 12,
|
|
541
|
+
strokeWidth: 2
|
|
542
|
+
}, se = () => /* @__PURE__ */ s("svg", {
|
|
543
|
+
...Y,
|
|
544
|
+
children: [/* @__PURE__ */ o("circle", {
|
|
545
|
+
cx: "12",
|
|
546
|
+
cy: "8",
|
|
547
|
+
r: "4",
|
|
548
|
+
fill: "currentColor",
|
|
549
|
+
stroke: "none"
|
|
550
|
+
}), /* @__PURE__ */ o("path", {
|
|
551
|
+
d: "M4.5 20.5c1-4 4-6 7.5-6s6.5 2 7.5 6",
|
|
552
|
+
fill: "currentColor",
|
|
553
|
+
stroke: "none"
|
|
554
|
+
})]
|
|
555
|
+
}), X = () => /* @__PURE__ */ s("svg", {
|
|
556
|
+
...Y,
|
|
557
|
+
children: [/* @__PURE__ */ o("rect", {
|
|
558
|
+
x: "6",
|
|
559
|
+
y: "7",
|
|
560
|
+
width: "12",
|
|
561
|
+
height: "13",
|
|
562
|
+
rx: "2",
|
|
563
|
+
fill: "currentColor",
|
|
564
|
+
stroke: "none"
|
|
565
|
+
}), /* @__PURE__ */ o("path", { d: "M9.5 7V4.5h5V7M9 22v-2M15 22v-2" })]
|
|
566
|
+
}), Z = () => /* @__PURE__ */ s("svg", {
|
|
567
|
+
...Y,
|
|
568
|
+
children: [/* @__PURE__ */ o("rect", {
|
|
569
|
+
x: "2.5",
|
|
570
|
+
y: "8.5",
|
|
571
|
+
width: "19",
|
|
572
|
+
height: "11",
|
|
573
|
+
rx: "2",
|
|
574
|
+
fill: "currentColor",
|
|
575
|
+
stroke: "none"
|
|
576
|
+
}), /* @__PURE__ */ o("path", { d: "M9 8.5V6.5h6v2" })]
|
|
577
|
+
});
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region src/wari/WariDateField.tsx
|
|
580
|
+
function Q({ label: n, value: a, defaultValue: c = "", onChange: l, min: u, max: d, placeholder: f = "dd/mm/aa", supportingText: p, error: m = !1, required: h, disabled: g = !1, name: _, id: v, locale: y = "es", weekStartsOn: b = 0, cancelLabel: x = "Cancelar", okLabel: S = "Aceptar", align: F = "start", className: I }) {
|
|
581
|
+
let L = t(), ee = v ?? L, R = `${ee}-hint`, [z, te] = i(c), B = a ?? z, [V, H] = i(() => T(B)), [ne, ae] = i(!1), [K, q] = i(!1), [J, oe] = i("days"), [Y, se] = i(""), [X, Z] = i(""), [Q, $] = i(() => {
|
|
582
|
+
let e = C(B) ?? C(w());
|
|
583
|
+
return {
|
|
584
|
+
year: e.year,
|
|
585
|
+
month: e.month
|
|
586
|
+
};
|
|
587
|
+
}), ce = r(null), le = r(null), ue = r(null), de = r(!1), fe = ne ? V : T(B), pe = M(y, "long"), me = M(y, "short"), he = N(y, b), ge = N(y, b, "long"), _e = w(), ve = C(u)?.year ?? Q.year - 50, ye = C(d)?.year ?? Q.year + 50, be = (e) => {
|
|
588
|
+
a === void 0 && te(e), e !== B && l?.(e);
|
|
589
|
+
}, xe = (e) => u && e < u ? u : d && e > d ? d : e, Se = () => {
|
|
590
|
+
if (g) return;
|
|
591
|
+
let e = xe(C(B) ? B : _e), t = C(e);
|
|
592
|
+
se(C(B) ? B : ""), Z(e), $({
|
|
593
|
+
year: t.year,
|
|
594
|
+
month: t.month
|
|
595
|
+
}), oe("days"), de.current = !0, q(!0);
|
|
596
|
+
}, Ce = (e = !0) => {
|
|
597
|
+
q(!1), e && le.current?.focus();
|
|
598
|
+
};
|
|
599
|
+
e(() => {
|
|
600
|
+
if (!K) return;
|
|
601
|
+
let e = (e) => {
|
|
602
|
+
ce.current?.contains(e.target) || q(!1);
|
|
603
|
+
};
|
|
604
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
605
|
+
}, [K]), e(() => {
|
|
606
|
+
if (!K || !de.current) return;
|
|
607
|
+
de.current = !1;
|
|
608
|
+
let e = J === "days" ? ue.current?.querySelector(`[data-iso="${X}"]`) : ue.current?.querySelector(".ds-wpicker-option[tabindex=\"0\"]");
|
|
609
|
+
e?.focus(), J !== "days" && e?.scrollIntoView?.({ block: "center" });
|
|
610
|
+
});
|
|
611
|
+
let we = (e) => {
|
|
612
|
+
let t = xe(e), n = C(t);
|
|
613
|
+
Z(t), (n.year !== Q.year || n.month !== Q.month) && $({
|
|
614
|
+
year: n.year,
|
|
615
|
+
month: n.month
|
|
616
|
+
}), de.current = !0;
|
|
617
|
+
}, Te = (e) => {
|
|
618
|
+
let t = {
|
|
619
|
+
ArrowLeft: () => A(X, -1),
|
|
620
|
+
ArrowRight: () => A(X, 1),
|
|
621
|
+
ArrowUp: () => A(X, -7),
|
|
622
|
+
ArrowDown: () => A(X, 7),
|
|
623
|
+
PageUp: () => j(X, e.shiftKey ? -12 : -1),
|
|
624
|
+
PageDown: () => j(X, e.shiftKey ? 12 : 1),
|
|
625
|
+
Home: () => A(X, -(((/* @__PURE__ */ new Date(`${X}T00:00`)).getDay() - b + 7) % 7)),
|
|
626
|
+
End: () => A(X, 6 - ((/* @__PURE__ */ new Date(`${X}T00:00`)).getDay() - b + 7) % 7)
|
|
627
|
+
};
|
|
628
|
+
t[e.key] && (e.preventDefault(), we(t[e.key]()));
|
|
629
|
+
}, Ee = (e) => {
|
|
630
|
+
let t = [...e.currentTarget.querySelectorAll(".ds-wpicker-option")], n = t.indexOf(document.activeElement), r = {
|
|
631
|
+
ArrowDown: n + 1,
|
|
632
|
+
ArrowUp: n - 1,
|
|
633
|
+
Home: 0,
|
|
634
|
+
End: t.length - 1
|
|
635
|
+
}[e.key];
|
|
636
|
+
r !== void 0 && (e.preventDefault(), t[Math.max(0, Math.min(r, t.length - 1))]?.focus());
|
|
637
|
+
}, De = (e) => {
|
|
638
|
+
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), J === "days" ? Ce() : (oe("days"), de.current = !0));
|
|
639
|
+
}, Oe = () => {
|
|
640
|
+
if (ae(!1), !V.trim()) {
|
|
641
|
+
be("");
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
let e = E(V);
|
|
645
|
+
e && D(e, u, d) && be(e);
|
|
646
|
+
}, ke = (e) => {
|
|
647
|
+
let t = e.relatedTarget;
|
|
648
|
+
K && t && !ce.current?.contains(t) && q(!1);
|
|
649
|
+
}, Ae = (e) => {
|
|
650
|
+
$(e);
|
|
651
|
+
let t = C(X)?.day ?? 1, n = new Date(e.year, e.month + 1, 0).getDate();
|
|
652
|
+
Z(xe(`${String(e.year).padStart(4, "0")}-${String(e.month + 1).padStart(2, "0")}-${String(Math.min(t, n)).padStart(2, "0")}`)), oe("days"), de.current = !0;
|
|
653
|
+
}, je = O(Q.year, Q.month, -1), Me = O(Q.year, Q.month, 1), Ne = !!u && `${je.year}-${String(je.month + 1).padStart(2, "0")}-31` < u, Pe = !!d && `${Me.year}-${String(Me.month + 1).padStart(2, "0")}-01` > d, Fe = Array.from({ length: ye - ve + 1 }, (e, t) => ve + t);
|
|
654
|
+
return /* @__PURE__ */ s("div", {
|
|
655
|
+
ref: ce,
|
|
656
|
+
className: [
|
|
657
|
+
"ds-input",
|
|
658
|
+
"ds-wfield",
|
|
659
|
+
I
|
|
660
|
+
].filter(Boolean).join(" "),
|
|
661
|
+
"data-open": K,
|
|
662
|
+
"data-error": m,
|
|
663
|
+
"data-disabled": g,
|
|
664
|
+
"data-align": F,
|
|
665
|
+
onBlur: ke,
|
|
666
|
+
children: [
|
|
667
|
+
n && /* @__PURE__ */ s("label", {
|
|
668
|
+
htmlFor: ee,
|
|
669
|
+
children: [n, h && /* @__PURE__ */ o("span", {
|
|
670
|
+
className: "ds-input-required",
|
|
671
|
+
"aria-hidden": "true",
|
|
672
|
+
children: "*"
|
|
673
|
+
})]
|
|
674
|
+
}),
|
|
675
|
+
/* @__PURE__ */ s("div", {
|
|
676
|
+
className: "ds-wfield-anchor",
|
|
677
|
+
children: [/* @__PURE__ */ s("div", {
|
|
678
|
+
className: "ds-input-shell",
|
|
679
|
+
children: [/* @__PURE__ */ o("input", {
|
|
680
|
+
id: ee,
|
|
681
|
+
type: "text",
|
|
682
|
+
inputMode: "numeric",
|
|
683
|
+
autoComplete: "off",
|
|
684
|
+
placeholder: f,
|
|
685
|
+
value: fe,
|
|
686
|
+
disabled: g,
|
|
687
|
+
required: h,
|
|
688
|
+
"aria-invalid": m || void 0,
|
|
689
|
+
"aria-describedby": p ? R : void 0,
|
|
690
|
+
onChange: (e) => {
|
|
691
|
+
ae(!0), H(e.target.value);
|
|
692
|
+
},
|
|
693
|
+
onFocus: () => {
|
|
694
|
+
ae(!0), H(T(B));
|
|
695
|
+
},
|
|
696
|
+
onBlur: Oe,
|
|
697
|
+
onKeyDown: (e) => {
|
|
698
|
+
e.key === "Enter" && (e.preventDefault(), Oe()), e.key === "ArrowDown" && (e.altKey || !K) && (e.preventDefault(), Oe(), Se());
|
|
699
|
+
}
|
|
700
|
+
}), /* @__PURE__ */ o("button", {
|
|
701
|
+
ref: le,
|
|
702
|
+
type: "button",
|
|
703
|
+
className: "ds-wfield-trigger",
|
|
704
|
+
disabled: g,
|
|
705
|
+
"aria-label": `Elegir fecha${B ? `, ${P(B, y)}` : ""}`,
|
|
706
|
+
"aria-haspopup": "dialog",
|
|
707
|
+
"aria-expanded": K,
|
|
708
|
+
onClick: () => K ? Ce() : Se(),
|
|
709
|
+
children: /* @__PURE__ */ o(U, {})
|
|
710
|
+
})]
|
|
711
|
+
}), K && /* @__PURE__ */ s("div", {
|
|
712
|
+
ref: ue,
|
|
713
|
+
className: "ds-wpicker",
|
|
714
|
+
"data-kind": "date",
|
|
715
|
+
"data-view": J,
|
|
716
|
+
role: "dialog",
|
|
717
|
+
"aria-label": "Elegir fecha",
|
|
718
|
+
onKeyDown: De,
|
|
719
|
+
children: [
|
|
720
|
+
/* @__PURE__ */ s("div", {
|
|
721
|
+
className: "ds-wpicker-head",
|
|
722
|
+
children: [/* @__PURE__ */ s("div", {
|
|
723
|
+
className: "ds-wpicker-nav",
|
|
724
|
+
"data-part": "month",
|
|
725
|
+
children: [
|
|
726
|
+
/* @__PURE__ */ o("button", {
|
|
727
|
+
type: "button",
|
|
728
|
+
className: "ds-wpicker-icon",
|
|
729
|
+
"aria-label": "Mes anterior",
|
|
730
|
+
disabled: Ne || J !== "days",
|
|
731
|
+
onClick: () => $(je),
|
|
732
|
+
children: /* @__PURE__ */ o(re, {})
|
|
733
|
+
}),
|
|
734
|
+
/* @__PURE__ */ s("button", {
|
|
735
|
+
type: "button",
|
|
736
|
+
className: "ds-wpicker-menu",
|
|
737
|
+
"aria-haspopup": "listbox",
|
|
738
|
+
"aria-expanded": J === "months",
|
|
739
|
+
"aria-label": `Elegir mes, ${pe[Q.month]}`,
|
|
740
|
+
onClick: () => {
|
|
741
|
+
oe(J === "months" ? "days" : "months"), de.current = !0;
|
|
742
|
+
},
|
|
743
|
+
children: [me[Q.month], /* @__PURE__ */ o(ie, {})]
|
|
744
|
+
}),
|
|
745
|
+
/* @__PURE__ */ o("button", {
|
|
746
|
+
type: "button",
|
|
747
|
+
className: "ds-wpicker-icon",
|
|
748
|
+
"aria-label": "Mes siguiente",
|
|
749
|
+
disabled: Pe || J !== "days",
|
|
750
|
+
onClick: () => $(Me),
|
|
751
|
+
children: /* @__PURE__ */ o(W, {})
|
|
752
|
+
})
|
|
753
|
+
]
|
|
754
|
+
}), /* @__PURE__ */ s("div", {
|
|
755
|
+
className: "ds-wpicker-nav",
|
|
756
|
+
"data-part": "year",
|
|
757
|
+
children: [
|
|
758
|
+
/* @__PURE__ */ o("button", {
|
|
759
|
+
type: "button",
|
|
760
|
+
className: "ds-wpicker-icon",
|
|
761
|
+
"aria-label": "Año anterior",
|
|
762
|
+
disabled: Q.year - 1 < ve || J !== "days",
|
|
763
|
+
onClick: () => $({
|
|
764
|
+
...Q,
|
|
765
|
+
year: Q.year - 1
|
|
766
|
+
}),
|
|
767
|
+
children: /* @__PURE__ */ o(re, {})
|
|
768
|
+
}),
|
|
769
|
+
/* @__PURE__ */ s("button", {
|
|
770
|
+
type: "button",
|
|
771
|
+
className: "ds-wpicker-menu",
|
|
772
|
+
"aria-haspopup": "listbox",
|
|
773
|
+
"aria-expanded": J === "years",
|
|
774
|
+
"aria-label": `Elegir año, ${Q.year}`,
|
|
775
|
+
onClick: () => {
|
|
776
|
+
oe(J === "years" ? "days" : "years"), de.current = !0;
|
|
777
|
+
},
|
|
778
|
+
children: [Q.year, /* @__PURE__ */ o(ie, {})]
|
|
779
|
+
}),
|
|
780
|
+
/* @__PURE__ */ o("button", {
|
|
781
|
+
type: "button",
|
|
782
|
+
className: "ds-wpicker-icon",
|
|
783
|
+
"aria-label": "Año siguiente",
|
|
784
|
+
disabled: Q.year + 1 > ye || J !== "days",
|
|
785
|
+
onClick: () => $({
|
|
786
|
+
...Q,
|
|
787
|
+
year: Q.year + 1
|
|
788
|
+
}),
|
|
789
|
+
children: /* @__PURE__ */ o(W, {})
|
|
790
|
+
})
|
|
791
|
+
]
|
|
792
|
+
})]
|
|
793
|
+
}),
|
|
794
|
+
J === "days" && /* @__PURE__ */ s("table", {
|
|
795
|
+
className: "ds-wpicker-grid",
|
|
796
|
+
role: "grid",
|
|
797
|
+
"aria-label": `${pe[Q.month]} ${Q.year}`,
|
|
798
|
+
onKeyDown: Te,
|
|
799
|
+
children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: he.map((e, t) => /* @__PURE__ */ o("th", {
|
|
800
|
+
scope: "col",
|
|
801
|
+
abbr: ge[t],
|
|
802
|
+
children: e
|
|
803
|
+
}, t)) }) }), /* @__PURE__ */ o("tbody", { children: k(Q.year, Q.month, b).map((e, t) => /* @__PURE__ */ o("tr", { children: e.map((e) => {
|
|
804
|
+
let t = !D(e.iso, u, d);
|
|
805
|
+
return /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o("button", {
|
|
806
|
+
type: "button",
|
|
807
|
+
className: "ds-wpicker-day",
|
|
808
|
+
"data-iso": e.iso,
|
|
809
|
+
"data-outside": e.outside,
|
|
810
|
+
"data-today": e.iso === _e,
|
|
811
|
+
"aria-selected": e.iso === Y,
|
|
812
|
+
"aria-disabled": t || void 0,
|
|
813
|
+
"aria-label": P(e.iso, y),
|
|
814
|
+
tabIndex: e.iso === X ? 0 : -1,
|
|
815
|
+
onClick: () => {
|
|
816
|
+
t || (se(e.iso), we(e.iso));
|
|
817
|
+
},
|
|
818
|
+
children: e.day
|
|
819
|
+
}) }, e.iso);
|
|
820
|
+
}) }, t)) })]
|
|
821
|
+
}),
|
|
822
|
+
J === "months" && /* @__PURE__ */ o("div", {
|
|
823
|
+
className: "ds-wpicker-list",
|
|
824
|
+
role: "listbox",
|
|
825
|
+
"aria-label": "Meses",
|
|
826
|
+
onKeyDown: Ee,
|
|
827
|
+
children: pe.map((e, t) => /* @__PURE__ */ s("button", {
|
|
828
|
+
type: "button",
|
|
829
|
+
role: "option",
|
|
830
|
+
className: "ds-wpicker-option",
|
|
831
|
+
"aria-selected": t === Q.month,
|
|
832
|
+
tabIndex: t === Q.month ? 0 : -1,
|
|
833
|
+
onClick: () => Ae({
|
|
834
|
+
year: Q.year,
|
|
835
|
+
month: t
|
|
836
|
+
}),
|
|
837
|
+
children: [/* @__PURE__ */ o(G, {}), e]
|
|
838
|
+
}, e))
|
|
839
|
+
}),
|
|
840
|
+
J === "years" && /* @__PURE__ */ o("div", {
|
|
841
|
+
className: "ds-wpicker-list",
|
|
842
|
+
role: "listbox",
|
|
843
|
+
"aria-label": "Años",
|
|
844
|
+
onKeyDown: Ee,
|
|
845
|
+
children: Fe.map((e) => /* @__PURE__ */ s("button", {
|
|
846
|
+
type: "button",
|
|
847
|
+
role: "option",
|
|
848
|
+
className: "ds-wpicker-option",
|
|
849
|
+
"aria-selected": e === Q.year,
|
|
850
|
+
tabIndex: e === Q.year ? 0 : -1,
|
|
851
|
+
onClick: () => Ae({
|
|
852
|
+
year: e,
|
|
853
|
+
month: Q.month
|
|
854
|
+
}),
|
|
855
|
+
children: [/* @__PURE__ */ o(G, {}), e]
|
|
856
|
+
}, e))
|
|
857
|
+
}),
|
|
858
|
+
/* @__PURE__ */ s("div", {
|
|
859
|
+
className: "ds-wpicker-actions",
|
|
860
|
+
children: [/* @__PURE__ */ o("button", {
|
|
861
|
+
type: "button",
|
|
862
|
+
className: "ds-wpicker-action",
|
|
863
|
+
onClick: () => Ce(),
|
|
864
|
+
children: x
|
|
865
|
+
}), /* @__PURE__ */ o("button", {
|
|
866
|
+
type: "button",
|
|
867
|
+
className: "ds-wpicker-action",
|
|
868
|
+
onClick: () => {
|
|
869
|
+
Y && be(Y), Ce();
|
|
870
|
+
},
|
|
871
|
+
children: S
|
|
872
|
+
})]
|
|
873
|
+
})
|
|
874
|
+
]
|
|
875
|
+
})]
|
|
876
|
+
}),
|
|
877
|
+
p && /* @__PURE__ */ o("small", {
|
|
878
|
+
id: R,
|
|
879
|
+
children: p
|
|
880
|
+
}),
|
|
881
|
+
_ && /* @__PURE__ */ o("input", {
|
|
882
|
+
type: "hidden",
|
|
883
|
+
name: _,
|
|
884
|
+
value: B
|
|
885
|
+
})
|
|
886
|
+
]
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
//#endregion
|
|
890
|
+
//#region src/wari/WariTimeField.tsx
|
|
891
|
+
var $ = 256, ce = $ / 2, le = 100, ue = [
|
|
892
|
+
12,
|
|
893
|
+
1,
|
|
894
|
+
2,
|
|
895
|
+
3,
|
|
896
|
+
4,
|
|
897
|
+
5,
|
|
898
|
+
6,
|
|
899
|
+
7,
|
|
900
|
+
8,
|
|
901
|
+
9,
|
|
902
|
+
10,
|
|
903
|
+
11
|
|
904
|
+
], de = [
|
|
905
|
+
0,
|
|
906
|
+
5,
|
|
907
|
+
10,
|
|
908
|
+
15,
|
|
909
|
+
20,
|
|
910
|
+
25,
|
|
911
|
+
30,
|
|
912
|
+
35,
|
|
913
|
+
40,
|
|
914
|
+
45,
|
|
915
|
+
50,
|
|
916
|
+
55
|
|
917
|
+
];
|
|
918
|
+
function fe({ label: n, value: a, defaultValue: c = "", onChange: l, placeholder: u = "hh:mm", supportingText: d, error: f = !1, required: p, disabled: m = !1, name: h, id: g, title: _ = "Selecciona la hora", cancelLabel: v = "Cancelar", okLabel: y = "Aceptar", align: b = "start", className: x }) {
|
|
919
|
+
let S = t(), C = g ?? S, w = `${C}-hint`, [T, E] = i(c), D = a ?? T, [O, k] = i(""), [A, j] = i(!1), [M, N] = i(!1), [P, H] = i(12), [U, re] = i(0), [W, ie] = i("AM"), [G, K] = i("hour"), [q, J] = i("dial"), oe = r(null), Y = r(null), se = r(null), X = r(null), Z = r(!1), Q = A ? O : R(D), fe = (e) => {
|
|
920
|
+
a === void 0 && E(e), e !== D && l?.(e);
|
|
921
|
+
}, pe = () => {
|
|
922
|
+
if (m) return;
|
|
923
|
+
let e = F(D) ?? {
|
|
924
|
+
hours: 12,
|
|
925
|
+
minutes: 0
|
|
926
|
+
}, t = L(e.hours);
|
|
927
|
+
H(t.hour), re(e.minutes), ie(t.period), K("hour"), N(!0);
|
|
928
|
+
}, me = (e = !0) => {
|
|
929
|
+
N(!1), e && Y.current?.focus();
|
|
930
|
+
}, he = () => {
|
|
931
|
+
fe(I(ee(P, W), U)), me();
|
|
932
|
+
};
|
|
933
|
+
e(() => {
|
|
934
|
+
if (!M) return;
|
|
935
|
+
se.current?.focus(), se.current?.select();
|
|
936
|
+
let e = (e) => {
|
|
937
|
+
oe.current?.contains(e.target) || N(!1);
|
|
938
|
+
};
|
|
939
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
940
|
+
}, [M]);
|
|
941
|
+
let ge = () => {
|
|
942
|
+
if (j(!1), !O.trim()) {
|
|
943
|
+
fe("");
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
let e = z(O);
|
|
947
|
+
e && fe(e);
|
|
948
|
+
}, _e = (e) => {
|
|
949
|
+
let t = e.currentTarget.getBoundingClientRect(), n = $ / t.width, r = B((e.clientX - t.left) * n, (e.clientY - t.top) * n, ce, G);
|
|
950
|
+
G === "hour" ? H(r) : re(r);
|
|
951
|
+
}, ve = (e, t) => {
|
|
952
|
+
let n = e.key === "ArrowUp" ? 1 : e.key === "ArrowDown" ? -1 : 0;
|
|
953
|
+
n && (e.preventDefault(), t === "hour" ? H((e) => (e - 1 + n + 12) % 12 + 1) : re((e) => (e + n + 60) % 60)), e.key === "Enter" && (e.preventDefault(), he());
|
|
954
|
+
}, ye = (e, t) => {
|
|
955
|
+
let n = e.replace(/\D/g, "").slice(-2);
|
|
956
|
+
if (!n) return;
|
|
957
|
+
let r = Number(n);
|
|
958
|
+
t === "hour" ? (r >= 1 && r <= 12 ? H(r) : r > 12 && Number(n.slice(-1)) >= 1 && H(Number(n.slice(-1))), (n.length === 2 || r > 1) && (K("minute"), X.current?.focus(), X.current?.select())) : re(r <= 59 ? r : Number(n.slice(-1)));
|
|
959
|
+
}, be = (e) => {
|
|
960
|
+
let t = e.relatedTarget;
|
|
961
|
+
M && t && !oe.current?.contains(t) && N(!1);
|
|
962
|
+
}, xe = G === "hour" ? P : U, Se = G === "hour" ? P % 12 * 30 : U * 6, Ce = G === "hour" ? ue : de;
|
|
963
|
+
return /* @__PURE__ */ s("div", {
|
|
964
|
+
ref: oe,
|
|
965
|
+
className: [
|
|
966
|
+
"ds-input",
|
|
967
|
+
"ds-wfield",
|
|
968
|
+
x
|
|
969
|
+
].filter(Boolean).join(" "),
|
|
970
|
+
"data-open": M,
|
|
971
|
+
"data-error": f,
|
|
972
|
+
"data-disabled": m,
|
|
973
|
+
"data-align": b,
|
|
974
|
+
onBlur: be,
|
|
975
|
+
children: [
|
|
976
|
+
n && /* @__PURE__ */ s("label", {
|
|
977
|
+
htmlFor: C,
|
|
978
|
+
children: [n, p && /* @__PURE__ */ o("span", {
|
|
979
|
+
className: "ds-input-required",
|
|
980
|
+
"aria-hidden": "true",
|
|
981
|
+
children: "*"
|
|
982
|
+
})]
|
|
983
|
+
}),
|
|
984
|
+
/* @__PURE__ */ s("div", {
|
|
985
|
+
className: "ds-wfield-anchor",
|
|
986
|
+
children: [/* @__PURE__ */ s("div", {
|
|
987
|
+
className: "ds-input-shell",
|
|
988
|
+
children: [/* @__PURE__ */ o("input", {
|
|
989
|
+
id: C,
|
|
990
|
+
type: "text",
|
|
991
|
+
autoComplete: "off",
|
|
992
|
+
placeholder: u,
|
|
993
|
+
value: Q,
|
|
994
|
+
disabled: m,
|
|
995
|
+
required: p,
|
|
996
|
+
"aria-invalid": f || void 0,
|
|
997
|
+
"aria-describedby": d ? w : void 0,
|
|
998
|
+
onChange: (e) => {
|
|
999
|
+
j(!0), k(e.target.value);
|
|
1000
|
+
},
|
|
1001
|
+
onFocus: () => {
|
|
1002
|
+
j(!0), k(R(D));
|
|
1003
|
+
},
|
|
1004
|
+
onBlur: ge,
|
|
1005
|
+
onKeyDown: (e) => {
|
|
1006
|
+
e.key === "Enter" && (e.preventDefault(), ge()), e.key === "ArrowDown" && (e.altKey || !M) && (e.preventDefault(), ge(), pe());
|
|
1007
|
+
}
|
|
1008
|
+
}), /* @__PURE__ */ o("button", {
|
|
1009
|
+
ref: Y,
|
|
1010
|
+
type: "button",
|
|
1011
|
+
className: "ds-wfield-trigger",
|
|
1012
|
+
disabled: m,
|
|
1013
|
+
"aria-label": `Elegir hora${D ? `, ${R(D)}` : ""}`,
|
|
1014
|
+
"aria-haspopup": "dialog",
|
|
1015
|
+
"aria-expanded": M,
|
|
1016
|
+
onClick: () => M ? me() : pe(),
|
|
1017
|
+
children: /* @__PURE__ */ o(ne, {})
|
|
1018
|
+
})]
|
|
1019
|
+
}), M && /* @__PURE__ */ s("div", {
|
|
1020
|
+
className: "ds-wpicker",
|
|
1021
|
+
"data-kind": "time",
|
|
1022
|
+
"data-input": q,
|
|
1023
|
+
role: "dialog",
|
|
1024
|
+
"aria-label": _,
|
|
1025
|
+
onKeyDown: (e) => {
|
|
1026
|
+
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), me());
|
|
1027
|
+
},
|
|
1028
|
+
children: [
|
|
1029
|
+
/* @__PURE__ */ o("div", {
|
|
1030
|
+
className: "ds-wpicker-title",
|
|
1031
|
+
children: _
|
|
1032
|
+
}),
|
|
1033
|
+
/* @__PURE__ */ s("div", {
|
|
1034
|
+
className: "ds-wtime-body",
|
|
1035
|
+
children: [/* @__PURE__ */ s("div", {
|
|
1036
|
+
className: "ds-wtime-inputs",
|
|
1037
|
+
children: [/* @__PURE__ */ s("div", {
|
|
1038
|
+
className: "ds-wtime-fields",
|
|
1039
|
+
children: [
|
|
1040
|
+
/* @__PURE__ */ o("input", {
|
|
1041
|
+
ref: se,
|
|
1042
|
+
className: "ds-wtime-box",
|
|
1043
|
+
inputMode: "numeric",
|
|
1044
|
+
"aria-label": "Hora",
|
|
1045
|
+
"data-active": G === "hour",
|
|
1046
|
+
value: V(P),
|
|
1047
|
+
onFocus: (e) => {
|
|
1048
|
+
K("hour"), e.currentTarget.select();
|
|
1049
|
+
},
|
|
1050
|
+
onChange: (e) => ye(e.target.value, "hour"),
|
|
1051
|
+
onKeyDown: (e) => ve(e, "hour")
|
|
1052
|
+
}),
|
|
1053
|
+
/* @__PURE__ */ o("span", {
|
|
1054
|
+
className: "ds-wtime-sep",
|
|
1055
|
+
"aria-hidden": "true",
|
|
1056
|
+
children: ":"
|
|
1057
|
+
}),
|
|
1058
|
+
/* @__PURE__ */ o("input", {
|
|
1059
|
+
ref: X,
|
|
1060
|
+
className: "ds-wtime-box",
|
|
1061
|
+
inputMode: "numeric",
|
|
1062
|
+
"aria-label": "Minutos",
|
|
1063
|
+
"data-active": G === "minute",
|
|
1064
|
+
value: V(U),
|
|
1065
|
+
onFocus: (e) => {
|
|
1066
|
+
K("minute"), e.currentTarget.select();
|
|
1067
|
+
},
|
|
1068
|
+
onChange: (e) => ye(e.target.value, "minute"),
|
|
1069
|
+
onKeyDown: (e) => ve(e, "minute")
|
|
1070
|
+
})
|
|
1071
|
+
]
|
|
1072
|
+
}), /* @__PURE__ */ o("div", {
|
|
1073
|
+
className: "ds-wtime-period",
|
|
1074
|
+
role: "group",
|
|
1075
|
+
"aria-label": "AM o PM",
|
|
1076
|
+
children: ["AM", "PM"].map((e) => /* @__PURE__ */ o("button", {
|
|
1077
|
+
type: "button",
|
|
1078
|
+
"aria-pressed": W === e,
|
|
1079
|
+
onClick: () => ie(e),
|
|
1080
|
+
children: e
|
|
1081
|
+
}, e))
|
|
1082
|
+
})]
|
|
1083
|
+
}), /* @__PURE__ */ s("div", {
|
|
1084
|
+
className: "ds-wtime-dial",
|
|
1085
|
+
"aria-hidden": "true",
|
|
1086
|
+
onPointerDown: (e) => {
|
|
1087
|
+
Z.current = !0, e.currentTarget.setPointerCapture?.(e.pointerId), e.preventDefault(), _e(e);
|
|
1088
|
+
},
|
|
1089
|
+
onPointerMove: (e) => {
|
|
1090
|
+
Z.current && _e(e);
|
|
1091
|
+
},
|
|
1092
|
+
onPointerUp: () => {
|
|
1093
|
+
Z.current = !1, G === "hour" && (K("minute"), X.current?.focus());
|
|
1094
|
+
},
|
|
1095
|
+
children: [
|
|
1096
|
+
/* @__PURE__ */ o("span", {
|
|
1097
|
+
className: "ds-wtime-hand",
|
|
1098
|
+
style: {
|
|
1099
|
+
width: le,
|
|
1100
|
+
transform: `rotate(${Se - 90}deg)`
|
|
1101
|
+
}
|
|
1102
|
+
}),
|
|
1103
|
+
/* @__PURE__ */ o("span", { className: "ds-wtime-center" }),
|
|
1104
|
+
Ce.map((e) => {
|
|
1105
|
+
let t = te(e, G === "hour" ? 12 : 60, le, ce);
|
|
1106
|
+
return /* @__PURE__ */ o("span", {
|
|
1107
|
+
className: "ds-wtime-num",
|
|
1108
|
+
"data-selected": e === xe,
|
|
1109
|
+
style: {
|
|
1110
|
+
left: `${t.x / $ * 100}%`,
|
|
1111
|
+
top: `${t.y / $ * 100}%`
|
|
1112
|
+
},
|
|
1113
|
+
children: G === "hour" ? e : V(e)
|
|
1114
|
+
}, e);
|
|
1115
|
+
})
|
|
1116
|
+
]
|
|
1117
|
+
})]
|
|
1118
|
+
}),
|
|
1119
|
+
/* @__PURE__ */ s("div", {
|
|
1120
|
+
className: "ds-wpicker-actions",
|
|
1121
|
+
children: [
|
|
1122
|
+
/* @__PURE__ */ o("button", {
|
|
1123
|
+
type: "button",
|
|
1124
|
+
className: "ds-wpicker-mode",
|
|
1125
|
+
"aria-label": q === "dial" ? "Escribir la hora" : "Usar el reloj",
|
|
1126
|
+
onClick: () => J(q === "dial" ? "keyboard" : "dial"),
|
|
1127
|
+
children: o(q === "dial" ? ae : ne, {})
|
|
1128
|
+
}),
|
|
1129
|
+
/* @__PURE__ */ o("span", { className: "ds-wpicker-actions-spacer" }),
|
|
1130
|
+
/* @__PURE__ */ o("button", {
|
|
1131
|
+
type: "button",
|
|
1132
|
+
className: "ds-wpicker-action",
|
|
1133
|
+
onClick: () => me(),
|
|
1134
|
+
children: v
|
|
1135
|
+
}),
|
|
1136
|
+
/* @__PURE__ */ o("button", {
|
|
1137
|
+
type: "button",
|
|
1138
|
+
className: "ds-wpicker-action",
|
|
1139
|
+
onClick: he,
|
|
1140
|
+
children: y
|
|
1141
|
+
})
|
|
1142
|
+
]
|
|
1143
|
+
})
|
|
1144
|
+
]
|
|
1145
|
+
})]
|
|
1146
|
+
}),
|
|
1147
|
+
d && /* @__PURE__ */ o("small", {
|
|
1148
|
+
id: w,
|
|
1149
|
+
children: d
|
|
1150
|
+
}),
|
|
1151
|
+
h && /* @__PURE__ */ o("input", {
|
|
1152
|
+
type: "hidden",
|
|
1153
|
+
name: h,
|
|
1154
|
+
value: D
|
|
1155
|
+
})
|
|
1156
|
+
]
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
//#endregion
|
|
1160
|
+
//#region src/wari/WariSchedule.tsx
|
|
1161
|
+
function pe({ title: e = "Horario", headingLevel: n = 3, date: r, defaultDate: i, onDateChange: a, time: c, defaultTime: l, onTimeChange: u, dateLabel: d = "Fecha", timeLabel: f = "Hora de recojo", minDate: p, maxDate: m, dateName: h, timeName: g, required: _ = !0, disabled: v, dateError: y, timeError: b, dateSupportingText: x, timeSupportingText: S, locale: C, weekStartsOn: w, className: T }) {
|
|
1162
|
+
let E = t(), D = `h${n}`;
|
|
1163
|
+
return /* @__PURE__ */ s("section", {
|
|
1164
|
+
className: ["ds-wschedule", T].filter(Boolean).join(" "),
|
|
1165
|
+
"aria-labelledby": E,
|
|
1166
|
+
children: [/* @__PURE__ */ s("header", {
|
|
1167
|
+
className: "ds-wschedule-header",
|
|
1168
|
+
children: [/* @__PURE__ */ o(ne, { size: 24 }), /* @__PURE__ */ o(D, {
|
|
1169
|
+
id: E,
|
|
1170
|
+
className: "ds-wschedule-title",
|
|
1171
|
+
children: e
|
|
1172
|
+
})]
|
|
1173
|
+
}), /* @__PURE__ */ s("div", {
|
|
1174
|
+
className: "ds-wschedule-fields",
|
|
1175
|
+
children: [/* @__PURE__ */ o(Q, {
|
|
1176
|
+
label: d,
|
|
1177
|
+
value: r,
|
|
1178
|
+
defaultValue: i,
|
|
1179
|
+
onChange: a,
|
|
1180
|
+
min: p,
|
|
1181
|
+
max: m,
|
|
1182
|
+
name: h,
|
|
1183
|
+
required: _,
|
|
1184
|
+
disabled: v,
|
|
1185
|
+
error: y,
|
|
1186
|
+
supportingText: x,
|
|
1187
|
+
locale: C,
|
|
1188
|
+
weekStartsOn: w
|
|
1189
|
+
}), /* @__PURE__ */ o(fe, {
|
|
1190
|
+
label: f,
|
|
1191
|
+
value: c,
|
|
1192
|
+
defaultValue: l,
|
|
1193
|
+
onChange: u,
|
|
1194
|
+
name: g,
|
|
1195
|
+
required: _,
|
|
1196
|
+
disabled: v,
|
|
1197
|
+
error: b,
|
|
1198
|
+
supportingText: S,
|
|
1199
|
+
align: "end"
|
|
1200
|
+
})]
|
|
1201
|
+
})]
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
//#endregion
|
|
1205
|
+
//#region src/wari/trip.ts
|
|
1206
|
+
var me = [
|
|
1207
|
+
{
|
|
1208
|
+
value: "lite",
|
|
1209
|
+
label: "Lite",
|
|
1210
|
+
passengers: 4,
|
|
1211
|
+
luggage: 1,
|
|
1212
|
+
hourlyPrice: 80
|
|
1213
|
+
},
|
|
1214
|
+
{
|
|
1215
|
+
value: "comfort",
|
|
1216
|
+
label: "Comfort",
|
|
1217
|
+
passengers: 4,
|
|
1218
|
+
luggage: 2,
|
|
1219
|
+
hourlyPrice: 90
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
value: "comfort-xl",
|
|
1223
|
+
label: "Comfort XL",
|
|
1224
|
+
passengers: 4,
|
|
1225
|
+
luggage: 2,
|
|
1226
|
+
hourlyPrice: 90
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
value: "xl",
|
|
1230
|
+
label: "XL",
|
|
1231
|
+
passengers: 4,
|
|
1232
|
+
luggage: 4,
|
|
1233
|
+
luggageAlt: 6,
|
|
1234
|
+
hourlyPrice: 90
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
value: "van",
|
|
1238
|
+
label: "Van",
|
|
1239
|
+
passengers: 7,
|
|
1240
|
+
luggage: 6,
|
|
1241
|
+
luggageAlt: 10,
|
|
1242
|
+
hourlyPrice: 140
|
|
1243
|
+
}
|
|
1244
|
+
], he = [
|
|
1245
|
+
{
|
|
1246
|
+
value: "carseat",
|
|
1247
|
+
label: "Carseat"
|
|
1248
|
+
},
|
|
1249
|
+
{
|
|
1250
|
+
value: "booster",
|
|
1251
|
+
label: "Booster"
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
value: "carga",
|
|
1255
|
+
label: "Carga"
|
|
1256
|
+
}
|
|
1257
|
+
], ge = [
|
|
1258
|
+
{
|
|
1259
|
+
value: "efectivo",
|
|
1260
|
+
label: "Efectivo"
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
value: "tarjeta",
|
|
1264
|
+
label: "Tarjeta"
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
value: "vale",
|
|
1268
|
+
label: "Vale corporativo"
|
|
1269
|
+
}
|
|
1270
|
+
], _e = {
|
|
1271
|
+
service: "lite",
|
|
1272
|
+
hourly: !1,
|
|
1273
|
+
delivery: !1,
|
|
1274
|
+
extras: [],
|
|
1275
|
+
vehicles: 1,
|
|
1276
|
+
payment: "efectivo"
|
|
1277
|
+
}, ve = (e) => `S/${Number.isInteger(e) ? e : e.toFixed(2)}`;
|
|
1278
|
+
function ye(e, t) {
|
|
1279
|
+
let n = t.hourly && e.hourlyPrice != null ? `Desde ${ve(e.hourlyPrice)}` : null, r = !t.hourly && !t.delivery ? {
|
|
1280
|
+
passengers: e.passengers,
|
|
1281
|
+
luggage: e.luggage,
|
|
1282
|
+
luggageAlt: e.luggageAlt
|
|
1283
|
+
} : null, i = [];
|
|
1284
|
+
return t.delivery && i.push("envío"), n && i.push(n.toLowerCase()), r && (i.push(`${r.passengers} pasajeros`), i.push(r.luggageAlt == null ? `${r.luggage} ${r.luggage === 1 ? "maleta" : "maletas"}` : `${r.luggage} o ${r.luggageAlt} maletas`)), {
|
|
1285
|
+
delivery: t.delivery,
|
|
1286
|
+
price: n,
|
|
1287
|
+
capacity: r,
|
|
1288
|
+
label: i.join(", ")
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
function be(e, t = 1, n = 99) {
|
|
1292
|
+
return Number.isFinite(e) ? Math.min(n, Math.max(t, Math.round(e))) : t;
|
|
1293
|
+
}
|
|
1294
|
+
function xe(e, t, n) {
|
|
1295
|
+
let r = t.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase();
|
|
1296
|
+
if (!r) return -1;
|
|
1297
|
+
let i = e.length;
|
|
1298
|
+
for (let t = 1; t <= i; t++) {
|
|
1299
|
+
let a = (n + t + i) % i, o = e[a], s = o.label.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase();
|
|
1300
|
+
if (!o.disabled && s.startsWith(r)) return a;
|
|
1301
|
+
}
|
|
1302
|
+
return -1;
|
|
1303
|
+
}
|
|
1304
|
+
function Se(e, t, n = he) {
|
|
1305
|
+
let r = new Set(e);
|
|
1306
|
+
return r.has(t) ? r.delete(t) : r.add(t), n.filter((e) => r.has(e.value)).map((e) => e.value);
|
|
1307
|
+
}
|
|
1308
|
+
//#endregion
|
|
1309
|
+
//#region src/wari/WariSelect.tsx
|
|
1310
|
+
function Ce({ label: n, "aria-label": a, options: c, value: l, defaultValue: u = "", onChange: d, placeholder: f = "Seleccionar", supportingText: p, error: m = !1, required: h, disabled: g = !1, name: _, id: v, className: y }) {
|
|
1311
|
+
let b = t(), x = v ?? b, S = `${x}-label`, C = `${x}-value`, w = `${x}-listbox`, T = `${x}-hint`, [E, D] = i(u), O = l ?? E, [k, A] = i(!1), [j, M] = i(0), N = r(null), P = r(null), F = r({
|
|
1312
|
+
text: "",
|
|
1313
|
+
at: 0
|
|
1314
|
+
}), I = c.findIndex((e) => e.value === O), L = c[I], ee = (e) => !!c[e] && !c[e].disabled, R = (e) => {
|
|
1315
|
+
let t = c[e];
|
|
1316
|
+
t && !t.disabled && (l === void 0 && D(t.value), t.value !== O && d?.(t.value));
|
|
1317
|
+
}, z = (e) => {
|
|
1318
|
+
g || (M(Math.max(0, e)), A(!0));
|
|
1319
|
+
}, te = (e, t) => {
|
|
1320
|
+
let n = e;
|
|
1321
|
+
for (let e = 0; e < c.length; e++) {
|
|
1322
|
+
if (n = Math.min(c.length - 1, Math.max(0, n + t)), ee(n)) return n;
|
|
1323
|
+
if (n === 0 || n === c.length - 1) break;
|
|
1324
|
+
}
|
|
1325
|
+
return e;
|
|
1326
|
+
};
|
|
1327
|
+
return e(() => {
|
|
1328
|
+
if (!k) return;
|
|
1329
|
+
document.getElementById(`${x}-option-${j}`)?.scrollIntoView?.({ block: "nearest" });
|
|
1330
|
+
let e = (e) => {
|
|
1331
|
+
N.current?.contains(e.target) || A(!1);
|
|
1332
|
+
};
|
|
1333
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
1334
|
+
}, [
|
|
1335
|
+
k,
|
|
1336
|
+
j,
|
|
1337
|
+
x
|
|
1338
|
+
]), /* @__PURE__ */ s("div", {
|
|
1339
|
+
ref: N,
|
|
1340
|
+
className: [
|
|
1341
|
+
"ds-input",
|
|
1342
|
+
"ds-wfield",
|
|
1343
|
+
"ds-wselect",
|
|
1344
|
+
y
|
|
1345
|
+
].filter(Boolean).join(" "),
|
|
1346
|
+
"data-open": k,
|
|
1347
|
+
"data-error": m,
|
|
1348
|
+
"data-disabled": g,
|
|
1349
|
+
"data-label": "lg",
|
|
1350
|
+
onBlur: (e) => {
|
|
1351
|
+
let t = e.relatedTarget;
|
|
1352
|
+
k && t && !N.current?.contains(t) && A(!1);
|
|
1353
|
+
},
|
|
1354
|
+
children: [
|
|
1355
|
+
n && /* @__PURE__ */ s("label", {
|
|
1356
|
+
id: S,
|
|
1357
|
+
onClick: () => P.current?.focus(),
|
|
1358
|
+
children: [n, h && /* @__PURE__ */ o("span", {
|
|
1359
|
+
className: "ds-input-required",
|
|
1360
|
+
"aria-hidden": "true",
|
|
1361
|
+
children: "*"
|
|
1362
|
+
})]
|
|
1363
|
+
}),
|
|
1364
|
+
/* @__PURE__ */ s("div", {
|
|
1365
|
+
className: "ds-wfield-anchor",
|
|
1366
|
+
children: [/* @__PURE__ */ s("div", {
|
|
1367
|
+
ref: P,
|
|
1368
|
+
className: "ds-input-shell",
|
|
1369
|
+
role: "combobox",
|
|
1370
|
+
tabIndex: g ? -1 : 0,
|
|
1371
|
+
"aria-haspopup": "listbox",
|
|
1372
|
+
"aria-expanded": k,
|
|
1373
|
+
"aria-controls": w,
|
|
1374
|
+
"aria-labelledby": n ? `${S} ${C}` : void 0,
|
|
1375
|
+
"aria-label": n ? void 0 : a,
|
|
1376
|
+
"aria-activedescendant": k ? `${x}-option-${j}` : void 0,
|
|
1377
|
+
"aria-disabled": g || void 0,
|
|
1378
|
+
"aria-required": h || void 0,
|
|
1379
|
+
"aria-invalid": m || void 0,
|
|
1380
|
+
"aria-describedby": p ? T : void 0,
|
|
1381
|
+
onClick: () => k ? A(!1) : z(I >= 0 ? I : 0),
|
|
1382
|
+
onKeyDown: (e) => {
|
|
1383
|
+
if (g) return;
|
|
1384
|
+
let t = I >= 0 ? I : 0;
|
|
1385
|
+
switch (e.key) {
|
|
1386
|
+
case "ArrowDown":
|
|
1387
|
+
e.preventDefault(), k ? M(te(j, 1)) : z(t);
|
|
1388
|
+
return;
|
|
1389
|
+
case "ArrowUp":
|
|
1390
|
+
e.preventDefault(), k ? M(te(j, -1)) : z(t);
|
|
1391
|
+
return;
|
|
1392
|
+
case "Home":
|
|
1393
|
+
e.preventDefault(), z(te(-1, 1));
|
|
1394
|
+
return;
|
|
1395
|
+
case "End":
|
|
1396
|
+
e.preventDefault(), z(te(c.length, -1));
|
|
1397
|
+
return;
|
|
1398
|
+
case "PageDown":
|
|
1399
|
+
case "PageUp":
|
|
1400
|
+
k && (e.preventDefault(), M(te(j, e.key === "PageDown" ? 10 : -10)));
|
|
1401
|
+
return;
|
|
1402
|
+
case "Enter":
|
|
1403
|
+
case " ":
|
|
1404
|
+
e.preventDefault(), k ? (R(j), A(!1)) : z(t);
|
|
1405
|
+
return;
|
|
1406
|
+
case "Escape":
|
|
1407
|
+
k && (e.preventDefault(), A(!1));
|
|
1408
|
+
return;
|
|
1409
|
+
case "Tab":
|
|
1410
|
+
k && (R(j), A(!1));
|
|
1411
|
+
return;
|
|
1412
|
+
}
|
|
1413
|
+
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
1414
|
+
let n = Date.now();
|
|
1415
|
+
F.current = {
|
|
1416
|
+
text: n - F.current.at < 600 ? F.current.text + e.key : e.key,
|
|
1417
|
+
at: n
|
|
1418
|
+
};
|
|
1419
|
+
let r = k ? j : t, i = xe(c, F.current.text, F.current.text.length > 1 ? r - 1 : r);
|
|
1420
|
+
i >= 0 && (k ? M(i) : z(i));
|
|
1421
|
+
}
|
|
1422
|
+
},
|
|
1423
|
+
children: [
|
|
1424
|
+
/* @__PURE__ */ s("span", {
|
|
1425
|
+
id: C,
|
|
1426
|
+
className: "ds-wselect-value",
|
|
1427
|
+
"data-placeholder": !L,
|
|
1428
|
+
children: [L ? L.label : f, L?.metaLabel && /* @__PURE__ */ s("span", {
|
|
1429
|
+
className: "ds-wvisually-hidden",
|
|
1430
|
+
children: [", ", L.metaLabel]
|
|
1431
|
+
})]
|
|
1432
|
+
}),
|
|
1433
|
+
L?.meta && /* @__PURE__ */ o("span", {
|
|
1434
|
+
"aria-hidden": "true",
|
|
1435
|
+
style: { display: "contents" },
|
|
1436
|
+
children: L.meta
|
|
1437
|
+
}),
|
|
1438
|
+
/* @__PURE__ */ o("span", {
|
|
1439
|
+
className: "ds-wselect-caret",
|
|
1440
|
+
"aria-hidden": "true",
|
|
1441
|
+
children: /* @__PURE__ */ o(q, {})
|
|
1442
|
+
})
|
|
1443
|
+
]
|
|
1444
|
+
}), k && /* @__PURE__ */ o("ul", {
|
|
1445
|
+
id: w,
|
|
1446
|
+
className: "ds-wselect-list",
|
|
1447
|
+
role: "listbox",
|
|
1448
|
+
"aria-labelledby": n ? S : void 0,
|
|
1449
|
+
"aria-label": n ? void 0 : a,
|
|
1450
|
+
children: c.map((e, t) => /* @__PURE__ */ s("li", {
|
|
1451
|
+
id: `${x}-option-${t}`,
|
|
1452
|
+
role: "option",
|
|
1453
|
+
className: "ds-wselect-option",
|
|
1454
|
+
"aria-selected": e.value === O,
|
|
1455
|
+
"aria-disabled": e.disabled || void 0,
|
|
1456
|
+
"data-active": t === j,
|
|
1457
|
+
"aria-label": e.metaLabel ? `${e.label}, ${e.metaLabel}` : void 0,
|
|
1458
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1459
|
+
onMouseMove: () => {
|
|
1460
|
+
t !== j && !e.disabled && M(t);
|
|
1461
|
+
},
|
|
1462
|
+
onClick: () => {
|
|
1463
|
+
e.disabled || (R(t), A(!1), P.current?.focus());
|
|
1464
|
+
},
|
|
1465
|
+
children: [/* @__PURE__ */ o("span", {
|
|
1466
|
+
className: "ds-wselect-label",
|
|
1467
|
+
children: e.label
|
|
1468
|
+
}), e.meta && /* @__PURE__ */ o("span", {
|
|
1469
|
+
"aria-hidden": "true",
|
|
1470
|
+
style: { display: "contents" },
|
|
1471
|
+
children: e.meta
|
|
1472
|
+
})]
|
|
1473
|
+
}, e.value))
|
|
1474
|
+
})]
|
|
1475
|
+
}),
|
|
1476
|
+
p && /* @__PURE__ */ o("small", {
|
|
1477
|
+
id: T,
|
|
1478
|
+
children: p
|
|
1479
|
+
}),
|
|
1480
|
+
_ && /* @__PURE__ */ o("input", {
|
|
1481
|
+
type: "hidden",
|
|
1482
|
+
name: _,
|
|
1483
|
+
value: O
|
|
1484
|
+
})
|
|
1485
|
+
]
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
//#endregion
|
|
1489
|
+
//#region src/wari/WariSwitchList.tsx
|
|
1490
|
+
function we({ legend: e, items: t, value: n, defaultValue: r = [], onChange: a, orientation: c = "vertical", name: l, disabled: u = !1, className: d }) {
|
|
1491
|
+
let [f, p] = i(r), m = n ?? f, h = (e, r) => {
|
|
1492
|
+
let i = new Set(m);
|
|
1493
|
+
r ? i.add(e) : i.delete(e);
|
|
1494
|
+
let o = t.filter((e) => i.has(e.value)).map((e) => e.value);
|
|
1495
|
+
n === void 0 && p(o), a?.(o);
|
|
1496
|
+
};
|
|
1497
|
+
return /* @__PURE__ */ s("fieldset", {
|
|
1498
|
+
className: ["ds-wswitches", d].filter(Boolean).join(" "),
|
|
1499
|
+
"data-orientation": c,
|
|
1500
|
+
disabled: u,
|
|
1501
|
+
children: [/* @__PURE__ */ o("legend", { children: e }), t.map((e) => /* @__PURE__ */ s("label", {
|
|
1502
|
+
className: "ds-wswitch",
|
|
1503
|
+
children: [/* @__PURE__ */ o("span", { children: e.label }), /* @__PURE__ */ o("input", {
|
|
1504
|
+
type: "checkbox",
|
|
1505
|
+
role: "switch",
|
|
1506
|
+
name: l,
|
|
1507
|
+
value: e.value,
|
|
1508
|
+
checked: m.includes(e.value),
|
|
1509
|
+
disabled: e.disabled,
|
|
1510
|
+
onChange: (t) => h(e.value, t.target.checked)
|
|
1511
|
+
})]
|
|
1512
|
+
}, e.value))]
|
|
1513
|
+
});
|
|
1514
|
+
}
|
|
1515
|
+
//#endregion
|
|
1516
|
+
//#region src/wari/WariStepper.tsx
|
|
1517
|
+
function Te({ label: e, value: n, defaultValue: r = 1, onChange: a, min: c = 1, max: l = 99, name: u, id: d, disabled: f = !1, supportingText: p, className: m }) {
|
|
1518
|
+
let h = t(), g = d ?? h, [_, v] = i(() => be(r, c, l)), y = n ?? _, [b, x] = i(null), S = (e) => {
|
|
1519
|
+
let t = be(e, c, l);
|
|
1520
|
+
n === void 0 && v(t), t !== y && a?.(t);
|
|
1521
|
+
}, C = () => {
|
|
1522
|
+
b !== null && (b.trim() && S(Number(b)), x(null));
|
|
1523
|
+
}, w = e ? e.toLowerCase() : "cantidad";
|
|
1524
|
+
return /* @__PURE__ */ s("div", {
|
|
1525
|
+
className: [
|
|
1526
|
+
"ds-input",
|
|
1527
|
+
"ds-wfield",
|
|
1528
|
+
"ds-wstepper",
|
|
1529
|
+
m
|
|
1530
|
+
].filter(Boolean).join(" "),
|
|
1531
|
+
"data-disabled": f,
|
|
1532
|
+
"data-label": "lg",
|
|
1533
|
+
children: [
|
|
1534
|
+
e && /* @__PURE__ */ o("label", {
|
|
1535
|
+
htmlFor: g,
|
|
1536
|
+
children: e
|
|
1537
|
+
}),
|
|
1538
|
+
/* @__PURE__ */ s("div", {
|
|
1539
|
+
className: "ds-input-shell",
|
|
1540
|
+
children: [
|
|
1541
|
+
/* @__PURE__ */ o("button", {
|
|
1542
|
+
type: "button",
|
|
1543
|
+
className: "ds-wstepper-button",
|
|
1544
|
+
"aria-label": `Disminuir ${w}`,
|
|
1545
|
+
"aria-controls": g,
|
|
1546
|
+
disabled: f || y <= c,
|
|
1547
|
+
onClick: () => S(y - 1),
|
|
1548
|
+
children: /* @__PURE__ */ o(J, {})
|
|
1549
|
+
}),
|
|
1550
|
+
/* @__PURE__ */ o("input", {
|
|
1551
|
+
id: g,
|
|
1552
|
+
type: "text",
|
|
1553
|
+
inputMode: "numeric",
|
|
1554
|
+
role: "spinbutton",
|
|
1555
|
+
name: u,
|
|
1556
|
+
disabled: f,
|
|
1557
|
+
"aria-valuenow": y,
|
|
1558
|
+
"aria-valuemin": c,
|
|
1559
|
+
"aria-valuemax": l,
|
|
1560
|
+
"aria-describedby": p ? `${g}-hint` : void 0,
|
|
1561
|
+
value: b ?? String(y),
|
|
1562
|
+
onChange: (e) => x(e.target.value.replace(/\D/g, "")),
|
|
1563
|
+
onBlur: C,
|
|
1564
|
+
onKeyDown: (e) => {
|
|
1565
|
+
let t = {
|
|
1566
|
+
ArrowUp: y + 1,
|
|
1567
|
+
ArrowDown: y - 1,
|
|
1568
|
+
PageUp: y + 10,
|
|
1569
|
+
PageDown: y - 10,
|
|
1570
|
+
Home: c,
|
|
1571
|
+
End: l
|
|
1572
|
+
};
|
|
1573
|
+
e.key in t && (e.preventDefault(), x(null), S(t[e.key])), e.key === "Enter" && (e.preventDefault(), C());
|
|
1574
|
+
}
|
|
1575
|
+
}),
|
|
1576
|
+
/* @__PURE__ */ o("button", {
|
|
1577
|
+
type: "button",
|
|
1578
|
+
className: "ds-wstepper-button",
|
|
1579
|
+
"aria-label": `Aumentar ${w}`,
|
|
1580
|
+
"aria-controls": g,
|
|
1581
|
+
disabled: f || y >= l,
|
|
1582
|
+
onClick: () => S(y + 1),
|
|
1583
|
+
children: /* @__PURE__ */ o(oe, {})
|
|
1584
|
+
})
|
|
1585
|
+
]
|
|
1586
|
+
}),
|
|
1587
|
+
p && /* @__PURE__ */ o("small", {
|
|
1588
|
+
id: `${g}-hint`,
|
|
1589
|
+
children: p
|
|
1590
|
+
})
|
|
1591
|
+
]
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
//#endregion
|
|
1595
|
+
//#region src/wari/WariServiceMeta.tsx
|
|
1596
|
+
function Ee({ service: e, hourly: t = !1, delivery: n = !1 }) {
|
|
1597
|
+
let r = ye(e, {
|
|
1598
|
+
hourly: t,
|
|
1599
|
+
delivery: n
|
|
1600
|
+
});
|
|
1601
|
+
return /* @__PURE__ */ s("span", {
|
|
1602
|
+
className: "ds-wmeta",
|
|
1603
|
+
children: [
|
|
1604
|
+
r.delivery && /* @__PURE__ */ o("span", {
|
|
1605
|
+
className: "ds-wmeta-badge",
|
|
1606
|
+
children: "Envío"
|
|
1607
|
+
}),
|
|
1608
|
+
r.price && /* @__PURE__ */ o("span", {
|
|
1609
|
+
className: "ds-wmeta-item",
|
|
1610
|
+
children: r.price
|
|
1611
|
+
}),
|
|
1612
|
+
r.capacity && /* @__PURE__ */ s(a, { children: [
|
|
1613
|
+
/* @__PURE__ */ s("span", {
|
|
1614
|
+
className: "ds-wmeta-item",
|
|
1615
|
+
children: [/* @__PURE__ */ o(se, {}), r.capacity.passengers]
|
|
1616
|
+
}),
|
|
1617
|
+
/* @__PURE__ */ s("span", {
|
|
1618
|
+
className: "ds-wmeta-item",
|
|
1619
|
+
children: [/* @__PURE__ */ o(X, {}), r.capacity.luggage]
|
|
1620
|
+
}),
|
|
1621
|
+
r.capacity.luggageAlt != null && /* @__PURE__ */ s("span", {
|
|
1622
|
+
className: "ds-wmeta-item",
|
|
1623
|
+
children: [
|
|
1624
|
+
"o ",
|
|
1625
|
+
/* @__PURE__ */ o(Z, {}),
|
|
1626
|
+
r.capacity.luggageAlt
|
|
1627
|
+
]
|
|
1628
|
+
})
|
|
1629
|
+
] })
|
|
1630
|
+
]
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
//#endregion
|
|
1634
|
+
//#region src/wari/WariTripAttributes.tsx
|
|
1635
|
+
function De({ title: e = "Atributos del viaje", headingLevel: n = 3, value: r, defaultValue: a, onChange: c, services: l = me, extras: u = he, paymentMethods: d = ge, maxVehicles: f = 10, name: p, disabled: m = !1, serviceLabel: h = "Tipo de servicio", vehiclesLabel: g = "Cantidad de vehículos", paymentLabel: _ = "Método de pago", hourlyLabel: v = "Por horas", deliveryLabel: y = "Envíos", className: b }) {
|
|
1636
|
+
let x = t(), [S, C] = i(() => ({
|
|
1637
|
+
..._e,
|
|
1638
|
+
...a
|
|
1639
|
+
})), w = r ?? S, T = (e) => {
|
|
1640
|
+
let t = {
|
|
1641
|
+
...w,
|
|
1642
|
+
...e
|
|
1643
|
+
};
|
|
1644
|
+
r === void 0 && C(t), c?.(t);
|
|
1645
|
+
}, E = (e) => p ? `${p}.${e}` : void 0, D = `h${n}`, O = {
|
|
1646
|
+
hourly: w.hourly,
|
|
1647
|
+
delivery: w.delivery
|
|
1648
|
+
}, k = [{
|
|
1649
|
+
value: "hourly",
|
|
1650
|
+
label: v
|
|
1651
|
+
}, {
|
|
1652
|
+
value: "delivery",
|
|
1653
|
+
label: y
|
|
1654
|
+
}];
|
|
1655
|
+
return /* @__PURE__ */ s("section", {
|
|
1656
|
+
className: [
|
|
1657
|
+
"ds-wcard",
|
|
1658
|
+
"ds-wtrip",
|
|
1659
|
+
b
|
|
1660
|
+
].filter(Boolean).join(" "),
|
|
1661
|
+
"aria-labelledby": x,
|
|
1662
|
+
children: [/* @__PURE__ */ s("header", {
|
|
1663
|
+
className: "ds-wcard-header",
|
|
1664
|
+
children: [/* @__PURE__ */ o(K, {}), /* @__PURE__ */ o(D, {
|
|
1665
|
+
id: x,
|
|
1666
|
+
className: "ds-wcard-title",
|
|
1667
|
+
children: e
|
|
1668
|
+
})]
|
|
1669
|
+
}), /* @__PURE__ */ s("div", {
|
|
1670
|
+
className: "ds-wcard-body",
|
|
1671
|
+
children: [
|
|
1672
|
+
/* @__PURE__ */ s("div", {
|
|
1673
|
+
className: "ds-wtrip-service",
|
|
1674
|
+
children: [/* @__PURE__ */ o(Ce, {
|
|
1675
|
+
label: h,
|
|
1676
|
+
value: w.service,
|
|
1677
|
+
onChange: (e) => T({ service: e }),
|
|
1678
|
+
disabled: m,
|
|
1679
|
+
name: E("service"),
|
|
1680
|
+
options: l.map((e) => ({
|
|
1681
|
+
value: e.value,
|
|
1682
|
+
label: e.label,
|
|
1683
|
+
disabled: e.disabled,
|
|
1684
|
+
meta: /* @__PURE__ */ o(Ee, {
|
|
1685
|
+
service: e,
|
|
1686
|
+
...O
|
|
1687
|
+
}),
|
|
1688
|
+
metaLabel: ye(e, O).label
|
|
1689
|
+
}))
|
|
1690
|
+
}), /* @__PURE__ */ o(we, {
|
|
1691
|
+
legend: "Modalidad del viaje",
|
|
1692
|
+
orientation: "horizontal",
|
|
1693
|
+
items: k,
|
|
1694
|
+
disabled: m,
|
|
1695
|
+
value: k.filter((e) => w[e.value]).map((e) => e.value),
|
|
1696
|
+
onChange: (e) => T({
|
|
1697
|
+
hourly: e.includes("hourly"),
|
|
1698
|
+
delivery: e.includes("delivery")
|
|
1699
|
+
}),
|
|
1700
|
+
name: E("mode")
|
|
1701
|
+
})]
|
|
1702
|
+
}),
|
|
1703
|
+
/* @__PURE__ */ o(we, {
|
|
1704
|
+
legend: "Extras",
|
|
1705
|
+
items: u,
|
|
1706
|
+
value: w.extras,
|
|
1707
|
+
onChange: (e) => T({ extras: e }),
|
|
1708
|
+
disabled: m,
|
|
1709
|
+
name: E("extras")
|
|
1710
|
+
}),
|
|
1711
|
+
/* @__PURE__ */ o(Te, {
|
|
1712
|
+
label: g,
|
|
1713
|
+
value: w.vehicles,
|
|
1714
|
+
onChange: (e) => T({ vehicles: e }),
|
|
1715
|
+
min: 1,
|
|
1716
|
+
max: f,
|
|
1717
|
+
disabled: m,
|
|
1718
|
+
name: E("vehicles")
|
|
1719
|
+
}),
|
|
1720
|
+
/* @__PURE__ */ o(Ce, {
|
|
1721
|
+
label: _,
|
|
1722
|
+
value: w.payment,
|
|
1723
|
+
onChange: (e) => T({ payment: e }),
|
|
1724
|
+
options: d,
|
|
1725
|
+
disabled: m,
|
|
1726
|
+
name: E("payment")
|
|
1727
|
+
})
|
|
1728
|
+
]
|
|
1729
|
+
})]
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
//#endregion
|
|
1733
|
+
export { y as MultiSelect, u as StatusTag, Q as WariDateField, pe as WariSchedule, Ce as WariSelect, Ee as WariServiceMeta, b as WariStatusSelect, Te as WariStepper, we as WariSwitchList, fe as WariTimeField, De as WariTripAttributes, k as calendarWeeks, be as clampCount, _e as defaultTripAttributes, f as filterOptions, T as formatDisplayDate, R as formatDisplayTime, ve as formatSoles, d as normalizeSearch, E as parseDisplayDate, z as parseDisplayTime, C as parseISODate, F as parseTime24, h as selectionState, _ as selectionSummary, ye as serviceMeta, S as toISODate, w as todayISO, g as toggleAll, Se as toggleExtra, m as toggleValue, xe as typeaheadIndex, he as wariExtras, ge as wariPaymentMethods, me as wariServices, l as wariStatusLabel, c as wariStatuses };
|
|
1734
|
+
|
|
1735
|
+
//# sourceMappingURL=wari.js.map
|