@dufy_asesorias/widget-dufy-kit 1.0.0 → 1.0.2

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.es.js CHANGED
@@ -1,79 +1,375 @@
1
1
  import e, { useEffect as t, useState as n } from "react";
2
- import { Edit3 as r, Save as i, X as a } from "lucide-react";
3
- import o from "react-select";
2
+ import { ChevronDown as r, Edit3 as i, Save as a, X as o } from "lucide-react";
3
+ import s from "react-select";
4
4
  //#region src/EditableField/EditableField.jsx
5
- var s = ({ field: s, label: c, value: l, type: u = "text", options: d = [], placeholder: f = "", isAdmin: p = !1, onSave: m, onCancel: h, onInputChange: g, validation: _ = null, disabled: v = !1, required: y = !1, min: b = null, max: x = null, rows: S = 3, className: C = "" }) => {
6
- let [w, T] = n(!1), [E, D] = n(""), [O, k] = n("");
7
- return t(() => {
8
- !w && l !== void 0 && D(u === "react-select" ? d.find((e) => e.value === l) || null : l);
5
+ var c = ({ field: c, label: l, value: u, type: d = "text", options: f = [], placeholder: p = "", isAdmin: m = !1, onSave: h, onCancel: g, onInputChange: _, validation: v = null, disabled: y = !1, required: b = !1, min: x = null, max: S = null, rows: C = 3, className: w = "", formatDisplay: T = null, isClearable: E = !0, isSearchable: D = !0, isLoading: O = !1, noOptionsMessage: k = () => "No se encontraron resultados", getOptionFromValue: A = null, debug: j = !1 }) => {
6
+ let [M, N] = n(!1), [P, F] = n(""), [I, L] = n("");
7
+ t(() => {
8
+ j && console.log(`[EditableField ${c}] Props changed:`, {
9
+ value: u,
10
+ isEditing: M,
11
+ editValue: P,
12
+ type: d,
13
+ options: f?.length || 0
14
+ });
9
15
  }, [
10
- l,
11
- w,
12
16
  u,
13
- d
14
- ]), /* @__PURE__ */ e.createElement("div", { className: `flex items-start justify-between p-3 bg-brand-bgWidget rounded-lg ${C}` }, /* @__PURE__ */ e.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ e.createElement("label", { className: "text-sm text-gray-600 block mb-1" }, c, " ", y && /* @__PURE__ */ e.createElement("span", { className: "text-brand-danger" }, "*")), w ? /* @__PURE__ */ e.createElement("div", null, (() => {
15
- let t = {
16
- value: E || "",
17
- onChange: (e) => D(e.target.value),
18
- className: `w-full p-2 border rounded-md focus:ring-2 focus:ring-brand-primary focus:border-brand-primary ${O ? "border-brand-danger" : "border-gray-300"}`,
19
- placeholder: f,
20
- autoFocus: !0,
21
- disabled: v
22
- };
23
- return u === "react-select" ? /* @__PURE__ */ e.createElement(o, {
24
- value: E,
25
- onChange: (e) => D(e),
26
- options: d,
27
- placeholder: f,
28
- isDisabled: v,
29
- styles: {
30
- control: (e, t) => ({
31
- ...e,
32
- border: `1px solid ${O ? "#dc2626" : t.isFocused ? "var(--color-brand-primary, #4f46e5)" : "#d1d5db"}`,
33
- boxShadow: t.isFocused ? "0 0 0 2px #eff6ff" : "none"
34
- }),
35
- option: (e, t) => ({
36
- ...e,
37
- backgroundColor: t.isSelected ? "#4f46e5" : t.isFocused ? "#eff6ff" : "transparent",
38
- color: t.isSelected ? "white" : "#374151"
39
- })
17
+ M,
18
+ P,
19
+ c,
20
+ j,
21
+ d,
22
+ f
23
+ ]), t(() => {
24
+ if (!M && u !== void 0) {
25
+ let e = B(u, d);
26
+ j && console.log(`[EditableField ${c}] Syncing value:`, {
27
+ value: u,
28
+ formattedValue: e
29
+ });
30
+ }
31
+ }, [
32
+ u,
33
+ M,
34
+ c,
35
+ d,
36
+ j
37
+ ]);
38
+ let R = (e) => e.map((e) => typeof e == "string" ? {
39
+ value: e,
40
+ label: e
41
+ } : e), z = (e) => {
42
+ if (!e || !f.length) return null;
43
+ let t = R(f);
44
+ return A ? A(t, e) : t.find((t) => t.value === e) || null;
45
+ }, B = (e, t) => {
46
+ if (!e && e !== 0) return "";
47
+ try {
48
+ switch (t) {
49
+ case "date": {
50
+ let t = new Date(e);
51
+ return isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}`;
52
+ }
53
+ case "datetime":
54
+ if (typeof e == "string" && e.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/)) return e.slice(0, 16);
55
+ let t = new Date(e);
56
+ return isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}T${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
57
+ case "time": return e.includes("T") ? e.split("T")[1].slice(0, 5) : e;
58
+ case "react-select": return z(e);
59
+ default: return e;
40
60
  }
41
- }) : u === "textarea" ? /* @__PURE__ */ e.createElement("textarea", {
42
- ...t,
43
- rows: S
44
- }) : /* @__PURE__ */ e.createElement("input", {
45
- ...t,
46
- type: u,
47
- min: b,
48
- max: x
49
- });
50
- })(), O && /* @__PURE__ */ e.createElement("p", { className: "text-brand-danger text-xs mt-1" }, O)) : /* @__PURE__ */ e.createElement("span", { className: `font-medium text-gray-800 break-words ${!l && l !== 0 ? "text-gray-400 italic" : ""}` }, u === "react-select" ? d.find((e) => e.value === l)?.label || l || "No especificado" : l || "No especificado")), p && /* @__PURE__ */ e.createElement("div", { className: "ml-4 flex gap-2 flex-shrink-0" }, w ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("button", {
51
- onClick: async () => {
52
- let e = u === "react-select" ? E ? E.value : null : E;
53
- if (y && !e && e !== 0) {
54
- k("Este campo es obligatorio");
61
+ } catch (e) {
62
+ return console.error("Error formatting value:", e), "";
63
+ }
64
+ }, V = () => {
65
+ if (y) return;
66
+ let e = B(u, d);
67
+ j && console.log(`[EditableField ${c}] Starting edit:`, {
68
+ originalValue: u,
69
+ formattedValue: e,
70
+ type: d
71
+ }), N(!0), F(e), L("");
72
+ }, H = async () => {
73
+ let e = P;
74
+ if (j && console.log(`[EditableField ${c}] Attempting save:`, {
75
+ editValue: P,
76
+ type: d
77
+ }), d === "react-select" && (e = P ? P.value : null), (d === "date" || d === "datetime") && e) {
78
+ let t = d === "date" ? `${e}T00:00:00` : e;
79
+ e = new Date(t);
80
+ }
81
+ if (b && (!e || e.toString().trim() === "")) {
82
+ L("Este campo es obligatorio");
83
+ return;
84
+ }
85
+ if (v) {
86
+ let t = v(e);
87
+ if (t) {
88
+ L(t);
55
89
  return;
56
90
  }
57
- try {
58
- m && await m(s, e), T(!1), k("");
59
- } catch (e) {
60
- k(e.message || "Error al guardar");
61
- }
62
- },
63
- className: "p-1 text-brand-success hover:bg-brand-successLight rounded"
64
- }, /* @__PURE__ */ e.createElement(i, { size: 16 })), /* @__PURE__ */ e.createElement("button", {
65
- onClick: () => T(!1),
66
- className: "p-1 text-brand-danger hover:bg-brand-dangerLight rounded"
67
- }, /* @__PURE__ */ e.createElement(a, { size: 16 }))) : /* @__PURE__ */ e.createElement("button", {
68
- onClick: () => T(!0),
69
- className: "p-1 text-brand-edit hover:bg-brand-editLight rounded"
70
- }, /* @__PURE__ */ e.createElement(r, { size: 16 }))));
71
- }, c = ({ field: t, label: o, value: s, isAdmin: c = !1, onSave: l, required: u = !1, disabled: d = !1, className: f = "", labels: p = {
91
+ }
92
+ try {
93
+ h && (j && console.log(`[EditableField ${c}] Calling onSave with:`, e), await h(c, e)), N(!1), L(""), j && console.log(`[EditableField ${c}] Save completed successfully`);
94
+ } catch (e) {
95
+ j && console.error(`[EditableField ${c}] Save error:`, e), L(e.message || "Error al guardar");
96
+ }
97
+ }, U = () => {
98
+ N(!1), F(""), L(""), g && g(c);
99
+ }, W = (e) => {
100
+ e.key === "Enter" && d !== "textarea" ? H() : e.key === "Escape" && U();
101
+ }, G = (e) => {
102
+ let t = e.target.value;
103
+ if (j && console.log(`[EditableField ${c}] Input change:`, {
104
+ newValue: t,
105
+ type: d
106
+ }), F(t), _) try {
107
+ _(c, t, e);
108
+ } catch (e) {
109
+ j && console.error(`[EditableField ${c}] onInputChange error:`, e);
110
+ }
111
+ }, K = (e) => {
112
+ if (j && console.log(`[EditableField ${c}] Select change:`, {
113
+ option: e,
114
+ type: d
115
+ }), F(e), _) try {
116
+ _(c, e, e ? e.value : null);
117
+ } catch (e) {
118
+ j && console.error(`[EditableField ${c}] onInputChange error:`, e);
119
+ }
120
+ }, q = (e, t) => {
121
+ if (j && t.action === "input-change" && console.log(`[EditableField ${c}] Select input change:`, {
122
+ inputValue: e,
123
+ actionMeta: t
124
+ }), _ && t.action === "input-change") try {
125
+ _(c, e, {
126
+ action: "search",
127
+ inputValue: e
128
+ });
129
+ } catch (e) {
130
+ j && console.error(`[EditableField ${c}] onInputChange error:`, e);
131
+ }
132
+ };
133
+ return /* @__PURE__ */ e.createElement("div", { className: `flex items-start justify-between p-3 bg-gray-50 rounded-lg ${w}` }, /* @__PURE__ */ e.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ e.createElement("label", { className: "text-sm text-gray-600 block mb-1" }, l, b && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 ml-1" }, "*")), M ? /* @__PURE__ */ e.createElement("div", null, (() => {
134
+ let t = {
135
+ value: P || "",
136
+ onChange: G,
137
+ onKeyDown: W,
138
+ className: `w-full p-2 border rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${I ? "border-red-500" : "border-gray-300"}`,
139
+ placeholder: p,
140
+ autoFocus: !0,
141
+ disabled: y
142
+ };
143
+ switch (d) {
144
+ case "textarea": return /* @__PURE__ */ e.createElement("textarea", {
145
+ ...t,
146
+ rows: C,
147
+ onKeyDown: (e) => {
148
+ e.key === "Escape" && U();
149
+ }
150
+ });
151
+ case "number": return /* @__PURE__ */ e.createElement("input", {
152
+ ...t,
153
+ type: "number",
154
+ min: x,
155
+ max: S,
156
+ step: "any"
157
+ });
158
+ case "date": return /* @__PURE__ */ e.createElement("input", {
159
+ ...t,
160
+ type: "date",
161
+ min: x,
162
+ max: S
163
+ });
164
+ case "datetime": return /* @__PURE__ */ e.createElement("input", {
165
+ ...t,
166
+ type: "datetime-local",
167
+ min: x,
168
+ max: S
169
+ });
170
+ case "time": return /* @__PURE__ */ e.createElement("input", {
171
+ ...t,
172
+ type: "time",
173
+ min: x,
174
+ max: S
175
+ });
176
+ case "react-select":
177
+ let n = R(f);
178
+ return /* @__PURE__ */ e.createElement(s, {
179
+ value: P,
180
+ onChange: K,
181
+ onInputChange: q,
182
+ options: n,
183
+ placeholder: p,
184
+ isClearable: E,
185
+ isSearchable: D,
186
+ isLoading: O,
187
+ isDisabled: y,
188
+ noOptionsMessage: k,
189
+ classNamePrefix: "react-select",
190
+ className: I ? "react-select-error" : "",
191
+ autoFocus: !0,
192
+ openMenuOnFocus: !1,
193
+ styles: {
194
+ control: (e, t) => ({
195
+ ...e,
196
+ minHeight: "42px",
197
+ border: `1px solid ${I ? "#ef4444" : t.isFocused ? "#3b82f6" : "#d1d5db"}`,
198
+ borderRadius: "6px",
199
+ boxShadow: t.isFocused ? `0 0 0 2px ${I ? "#fecaca" : "#dbeafe"}` : "none",
200
+ backgroundColor: "white",
201
+ fontSize: "14px",
202
+ "&:hover": { borderColor: I ? "#ef4444" : "#9ca3af" }
203
+ }),
204
+ valueContainer: (e) => ({
205
+ ...e,
206
+ padding: "8px 12px"
207
+ }),
208
+ placeholder: (e) => ({
209
+ ...e,
210
+ color: "#9ca3af",
211
+ fontSize: "14px"
212
+ }),
213
+ singleValue: (e) => ({
214
+ ...e,
215
+ color: "#374151",
216
+ fontSize: "14px"
217
+ }),
218
+ menu: (e) => ({
219
+ ...e,
220
+ borderRadius: "6px",
221
+ border: "1px solid #e5e7eb",
222
+ boxShadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
223
+ zIndex: 9999
224
+ }),
225
+ menuList: (e) => ({
226
+ ...e,
227
+ borderRadius: "6px",
228
+ padding: "4px"
229
+ }),
230
+ option: (e, t) => ({
231
+ ...e,
232
+ backgroundColor: t.isSelected ? "#3b82f6" : t.isFocused ? "#f3f4f6" : "transparent",
233
+ color: t.isSelected ? "white" : "#374151",
234
+ padding: "12px 16px",
235
+ fontSize: "14px",
236
+ borderRadius: "4px",
237
+ margin: "2px 0",
238
+ cursor: "pointer",
239
+ "&:active": { backgroundColor: t.isSelected ? "#2563eb" : "#e5e7eb" }
240
+ }),
241
+ indicatorSeparator: (e) => ({
242
+ ...e,
243
+ backgroundColor: "#d1d5db"
244
+ }),
245
+ dropdownIndicator: (e, t) => ({
246
+ ...e,
247
+ color: "#6b7280",
248
+ padding: "8px",
249
+ "&:hover": { color: "#374151" }
250
+ }),
251
+ clearIndicator: (e) => ({
252
+ ...e,
253
+ color: "#6b7280",
254
+ padding: "8px",
255
+ "&:hover": { color: "#374151" }
256
+ }),
257
+ loadingIndicator: (e) => ({
258
+ ...e,
259
+ color: "#3b82f6"
260
+ }),
261
+ noOptionsMessage: (e) => ({
262
+ ...e,
263
+ color: "#6b7280",
264
+ fontSize: "14px",
265
+ padding: "8px 12px"
266
+ })
267
+ }
268
+ });
269
+ case "select": return /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("select", {
270
+ ...t,
271
+ className: `${t.className} appearance-none pr-8`
272
+ }, /* @__PURE__ */ e.createElement("option", { value: "" }, "Seleccionar..."), f.map((t, n) => /* @__PURE__ */ e.createElement("option", {
273
+ key: n,
274
+ value: typeof t == "object" ? t.value : t
275
+ }, typeof t == "object" ? t.label : t))), /* @__PURE__ */ e.createElement(r, {
276
+ size: 16,
277
+ className: "absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 pointer-events-none"
278
+ }));
279
+ case "email": return /* @__PURE__ */ e.createElement("input", {
280
+ ...t,
281
+ type: "email"
282
+ });
283
+ case "tel": return /* @__PURE__ */ e.createElement("input", {
284
+ ...t,
285
+ type: "tel"
286
+ });
287
+ default: return /* @__PURE__ */ e.createElement("input", {
288
+ ...t,
289
+ type: "text"
290
+ });
291
+ }
292
+ })(), I && /* @__PURE__ */ e.createElement("p", { className: "text-red-500 text-xs mt-1" }, I)) : /* @__PURE__ */ e.createElement("span", { className: `font-medium text-gray-800 break-words ${!u && u !== 0 ? "text-gray-400 italic" : ""}` }, (() => {
293
+ if (T) return T(u);
294
+ if (!u && u !== 0) return "No especificado";
295
+ switch (d) {
296
+ case "date":
297
+ if (u) {
298
+ let e = new Date(u);
299
+ if (!isNaN(e.getTime())) return e.toLocaleDateString("es-ES", {
300
+ year: "numeric",
301
+ month: "long",
302
+ day: "numeric"
303
+ });
304
+ }
305
+ return "No especificado";
306
+ case "datetime":
307
+ if (u) {
308
+ let e = new Date(u);
309
+ if (!isNaN(e.getTime())) return e.toLocaleString("es-CO", {
310
+ year: "numeric",
311
+ month: "long",
312
+ day: "numeric",
313
+ hour: "2-digit",
314
+ minute: "2-digit",
315
+ hour12: !0,
316
+ timeZone: "America/Bogota"
317
+ });
318
+ }
319
+ return "No especificado";
320
+ case "time": return u || "No especificado";
321
+ case "number": return typeof u == "number" ? u.toLocaleString("es-ES") : u;
322
+ case "select":
323
+ if (f.length > 0 && typeof f[0] == "object") {
324
+ let e = f.find((e) => e.value === u);
325
+ return e ? e.label : u;
326
+ }
327
+ return u;
328
+ case "react-select":
329
+ if (u && f.length > 0) {
330
+ let e = z(u);
331
+ return e ? e.label : u;
332
+ }
333
+ return u;
334
+ default: return u;
335
+ }
336
+ })())), m && /* @__PURE__ */ e.createElement("div", { className: "ml-4 flex gap-2 flex-shrink-0" }, M ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("button", {
337
+ onClick: H,
338
+ disabled: y,
339
+ className: "p-1 text-green-600 hover:bg-green-100 rounded disabled:opacity-50 disabled:cursor-not-allowed",
340
+ title: "Guardar"
341
+ }, /* @__PURE__ */ e.createElement(a, { size: 16 })), /* @__PURE__ */ e.createElement("button", {
342
+ onClick: U,
343
+ className: "p-1 text-red-600 hover:bg-red-100 rounded",
344
+ title: "Cancelar"
345
+ }, /* @__PURE__ */ e.createElement(o, { size: 16 }))) : /* @__PURE__ */ e.createElement("button", {
346
+ onClick: V,
347
+ disabled: y,
348
+ className: "p-1 text-blue-600 hover:bg-blue-100 rounded disabled:opacity-50 disabled:cursor-not-allowed",
349
+ title: "Editar"
350
+ }, /* @__PURE__ */ e.createElement(i, { size: 16 }))));
351
+ }, l = ({ field: t, label: r, value: s, isAdmin: c = !1, onSave: l, required: u = !1, disabled: d = !1, className: f = "", labels: p = {
72
352
  true: "Sí",
73
353
  false: "No"
74
354
  }, displayAs: m = "toggle" }) => {
75
- let [h, g] = n(!1), [_, v] = n(null), [y, b] = n("");
76
- return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-between p-3 bg-brand-bgWidget rounded-lg ${f}` }, /* @__PURE__ */ e.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ e.createElement("label", { className: "text-sm text-gray-600 block mb-1" }, o, u && m !== "toggle" && /* @__PURE__ */ e.createElement("span", { className: "text-brand-danger ml-1" }, "*")), h ? /* @__PURE__ */ e.createElement("div", null, m === "toggle" ? /* @__PURE__ */ e.createElement("label", {
355
+ let [h, g] = n(!1), [_, v] = n(null), [y, b] = n(""), x = () => {
356
+ d || (g(!0), v(m === "toggle" ? s ?? !1 : s), b(""));
357
+ }, S = async () => {
358
+ if (u && _ == null) {
359
+ b("Este campo es obligatorio");
360
+ return;
361
+ }
362
+ try {
363
+ l && await l(t, _), g(!1), b("");
364
+ } catch (e) {
365
+ b(e.message || "Error al guardar");
366
+ }
367
+ }, C = () => {
368
+ g(!1), v(null), b("");
369
+ }, w = (e) => {
370
+ v(e), b("");
371
+ };
372
+ return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-between p-3 bg-gray-50 rounded-lg ${f}` }, /* @__PURE__ */ e.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ e.createElement("label", { className: "text-sm text-gray-600 block mb-1" }, r, u && m !== "toggle" && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 ml-1" }, "*")), h ? /* @__PURE__ */ e.createElement("div", null, m === "toggle" ? /* @__PURE__ */ e.createElement("label", {
77
373
  htmlFor: `${t}_toggle`,
78
374
  className: "relative inline-flex items-center cursor-pointer"
79
375
  }, /* @__PURE__ */ e.createElement("input", {
@@ -81,47 +377,37 @@ var s = ({ field: s, label: c, value: l, type: u = "text", options: d = [], plac
81
377
  id: `${t}_toggle`,
82
378
  className: "sr-only peer",
83
379
  checked: _ === !0,
84
- onChange: () => v(!_),
380
+ onChange: () => w(!_),
85
381
  disabled: d
86
- }), /* @__PURE__ */ e.createElement("div", { className: "w-11 h-6 bg-gray-300 rounded-full peer peer-focus:ring-2 peer-focus:ring-brand-editLight peer-checked:bg-brand-primary peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all" }), /* @__PURE__ */ e.createElement("span", { className: "ml-3 text-sm font-medium text-gray-700 select-none" }, _ ? p.true : p.false)) : /* @__PURE__ */ e.createElement("div", { className: "space-y-2" }, [!0, !1].map((n) => /* @__PURE__ */ e.createElement("label", {
87
- key: n.toString(),
88
- className: "flex items-center cursor-pointer"
89
- }, /* @__PURE__ */ e.createElement("input", {
382
+ }), /* @__PURE__ */ e.createElement("div", { className: "w-11 h-6 bg-gray-300 rounded-full peer peer-focus:ring-2 peer-focus:ring-blue-300 peer-checked:bg-indigo-600 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all" }), /* @__PURE__ */ e.createElement("span", { className: "ml-3 text-sm font-medium text-gray-700 select-none" }, _ ? p.true : p.false)) : /* @__PURE__ */ e.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ e.createElement("label", { className: "flex items-center cursor-pointer" }, /* @__PURE__ */ e.createElement("input", {
90
383
  type: "radio",
91
384
  name: `${t}_boolean`,
92
- checked: _ === n,
93
- onChange: () => v(n),
94
- className: "mr-3 h-4 w-4 text-brand-primary focus:ring-brand-primary border-gray-300",
385
+ checked: _ === !0,
386
+ onChange: () => w(!0),
387
+ className: "mr-3 h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300",
95
388
  disabled: d
96
- }), /* @__PURE__ */ e.createElement("span", { className: "text-sm text-gray-700" }, n ? p.true : p.false)))), y && /* @__PURE__ */ e.createElement("p", { className: "text-brand-danger text-xs mt-2" }, y)) : /* @__PURE__ */ e.createElement("span", { className: `break-words ${!s && s !== 0 && m !== "toggle" ? "text-gray-400 italic" : "font-medium text-gray-800"}` }, s === !0 ? p.true : s === !1 || m === "toggle" ? p.false : "No especificado")), c && /* @__PURE__ */ e.createElement("div", { className: "ml-4 flex gap-2 flex-shrink-0" }, h ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("button", {
97
- onClick: async () => {
98
- if (u && _ == null) {
99
- b("Este campo es obligatorio");
100
- return;
101
- }
102
- try {
103
- l && await l(t, _), g(!1), b("");
104
- } catch (e) {
105
- b(e.message || "Error al guardar");
106
- }
107
- },
389
+ }), /* @__PURE__ */ e.createElement("span", { className: "text-sm text-gray-700" }, p.true)), /* @__PURE__ */ e.createElement("label", { className: "flex items-center cursor-pointer" }, /* @__PURE__ */ e.createElement("input", {
390
+ type: "radio",
391
+ name: `${t}_boolean`,
392
+ checked: _ === !1,
393
+ onChange: () => w(!1),
394
+ className: "mr-3 h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300",
395
+ disabled: d
396
+ }), /* @__PURE__ */ e.createElement("span", { className: "text-sm text-gray-700" }, p.false))), y && /* @__PURE__ */ e.createElement("p", { className: "text-red-500 text-xs mt-2" }, y)) : /* @__PURE__ */ e.createElement("span", { className: `break-words ${s == null && m !== "toggle" ? "text-gray-400 italic" : "font-medium text-gray-800"}` }, s === !0 ? p.true : s === !1 || m === "toggle" ? p.false : "No especificado")), c && /* @__PURE__ */ e.createElement("div", { className: "ml-4 flex gap-2 flex-shrink-0" }, h ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("button", {
397
+ onClick: S,
108
398
  disabled: d,
109
- className: "p-1 text-brand-success hover:bg-brand-successLight rounded disabled:opacity-50",
399
+ className: "p-1 text-green-600 hover:bg-green-100 rounded disabled:opacity-50",
110
400
  title: "Guardar"
111
- }, /* @__PURE__ */ e.createElement(i, { size: 16 })), /* @__PURE__ */ e.createElement("button", {
112
- onClick: () => {
113
- g(!1), v(null), b("");
114
- },
115
- className: "p-1 text-brand-danger hover:bg-brand-dangerLight rounded",
401
+ }, /* @__PURE__ */ e.createElement(a, { size: 16 })), /* @__PURE__ */ e.createElement("button", {
402
+ onClick: C,
403
+ className: "p-1 text-red-600 hover:bg-red-100 rounded",
116
404
  title: "Cancelar"
117
- }, /* @__PURE__ */ e.createElement(a, { size: 16 }))) : /* @__PURE__ */ e.createElement("button", {
118
- onClick: () => {
119
- d || (g(!0), v(m === "toggle" ? s ?? !1 : s), b(""));
120
- },
405
+ }, /* @__PURE__ */ e.createElement(o, { size: 16 }))) : /* @__PURE__ */ e.createElement("button", {
406
+ onClick: x,
121
407
  disabled: d,
122
- className: "p-1 text-brand-edit hover:bg-brand-editLight rounded disabled:opacity-50",
408
+ className: "p-1 text-blue-600 hover:bg-blue-100 rounded disabled:opacity-50",
123
409
  title: "Editar"
124
- }, /* @__PURE__ */ e.createElement(r, { size: 16 }))));
410
+ }, /* @__PURE__ */ e.createElement(i, { size: 16 }))));
125
411
  };
126
412
  //#endregion
127
- export { c as BooleanField, s as EditableField };
413
+ export { l as BooleanField, c as EditableField };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("lucide-react"),require("react-select")):typeof define==`function`&&define.amd?define([`exports`,`react`,`lucide-react`,`react-select`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.WidgetDufyKit={},e.React,e.LucideReact,e.Select))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=s(t),c=0,u=i.length,d;c<u;c++)d=i[c],!l.call(e,d)&&d!==n&&a(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=o(t,d))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:i(c(e)),u(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e));t=d(t,1),r=d(r,1),e.BooleanField=({field:e,label:r,value:i,isAdmin:a=!1,onSave:o,required:s=!1,disabled:c=!1,className:l=``,labels:u={true:`Sí`,false:`No`},displayAs:d=`toggle`})=>{let[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(null),[g,_]=(0,t.useState)(``);return t.default.createElement(`div`,{className:`flex items-center justify-between p-3 bg-brand-bgWidget rounded-lg ${l}`},t.default.createElement(`div`,{className:`flex-1 min-w-0`},t.default.createElement(`label`,{className:`text-sm text-gray-600 block mb-1`},r,s&&d!==`toggle`&&t.default.createElement(`span`,{className:`text-brand-danger ml-1`},`*`)),f?t.default.createElement(`div`,null,d===`toggle`?t.default.createElement(`label`,{htmlFor:`${e}_toggle`,className:`relative inline-flex items-center cursor-pointer`},t.default.createElement(`input`,{type:`checkbox`,id:`${e}_toggle`,className:`sr-only peer`,checked:m===!0,onChange:()=>h(!m),disabled:c}),t.default.createElement(`div`,{className:`w-11 h-6 bg-gray-300 rounded-full peer peer-focus:ring-2 peer-focus:ring-brand-editLight peer-checked:bg-brand-primary peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all`}),t.default.createElement(`span`,{className:`ml-3 text-sm font-medium text-gray-700 select-none`},m?u.true:u.false)):t.default.createElement(`div`,{className:`space-y-2`},[!0,!1].map(n=>t.default.createElement(`label`,{key:n.toString(),className:`flex items-center cursor-pointer`},t.default.createElement(`input`,{type:`radio`,name:`${e}_boolean`,checked:m===n,onChange:()=>h(n),className:`mr-3 h-4 w-4 text-brand-primary focus:ring-brand-primary border-gray-300`,disabled:c}),t.default.createElement(`span`,{className:`text-sm text-gray-700`},n?u.true:u.false)))),g&&t.default.createElement(`p`,{className:`text-brand-danger text-xs mt-2`},g)):t.default.createElement(`span`,{className:`break-words ${!i&&i!==0&&d!==`toggle`?`text-gray-400 italic`:`font-medium text-gray-800`}`},i===!0?u.true:i===!1||d===`toggle`?u.false:`No especificado`)),a&&t.default.createElement(`div`,{className:`ml-4 flex gap-2 flex-shrink-0`},f?t.default.createElement(t.default.Fragment,null,t.default.createElement(`button`,{onClick:async()=>{if(s&&m==null){_(`Este campo es obligatorio`);return}try{o&&await o(e,m),p(!1),_(``)}catch(e){_(e.message||`Error al guardar`)}},disabled:c,className:`p-1 text-brand-success hover:bg-brand-successLight rounded disabled:opacity-50`,title:`Guardar`},t.default.createElement(n.Save,{size:16})),t.default.createElement(`button`,{onClick:()=>{p(!1),h(null),_(``)},className:`p-1 text-brand-danger hover:bg-brand-dangerLight rounded`,title:`Cancelar`},t.default.createElement(n.X,{size:16}))):t.default.createElement(`button`,{onClick:()=>{c||(p(!0),h(d===`toggle`?i??!1:i),_(``))},disabled:c,className:`p-1 text-brand-edit hover:bg-brand-editLight rounded disabled:opacity-50`,title:`Editar`},t.default.createElement(n.Edit3,{size:16}))))},e.EditableField=({field:e,label:i,value:a,type:o=`text`,options:s=[],placeholder:c=``,isAdmin:l=!1,onSave:u,onCancel:d,onInputChange:f,validation:p=null,disabled:m=!1,required:h=!1,min:g=null,max:_=null,rows:v=3,className:y=``})=>{let[b,x]=(0,t.useState)(!1),[S,C]=(0,t.useState)(``),[w,T]=(0,t.useState)(``);return(0,t.useEffect)(()=>{!b&&a!==void 0&&C(o===`react-select`?s.find(e=>e.value===a)||null:a)},[a,b,o,s]),t.default.createElement(`div`,{className:`flex items-start justify-between p-3 bg-brand-bgWidget rounded-lg ${y}`},t.default.createElement(`div`,{className:`flex-1 min-w-0`},t.default.createElement(`label`,{className:`text-sm text-gray-600 block mb-1`},i,` `,h&&t.default.createElement(`span`,{className:`text-brand-danger`},`*`)),b?t.default.createElement(`div`,null,(()=>{let e={value:S||``,onChange:e=>C(e.target.value),className:`w-full p-2 border rounded-md focus:ring-2 focus:ring-brand-primary focus:border-brand-primary ${w?`border-brand-danger`:`border-gray-300`}`,placeholder:c,autoFocus:!0,disabled:m};return o===`react-select`?t.default.createElement(r.default,{value:S,onChange:e=>C(e),options:s,placeholder:c,isDisabled:m,styles:{control:(e,t)=>({...e,border:`1px solid ${w?`#dc2626`:t.isFocused?`var(--color-brand-primary, #4f46e5)`:`#d1d5db`}`,boxShadow:t.isFocused?`0 0 0 2px #eff6ff`:`none`}),option:(e,t)=>({...e,backgroundColor:t.isSelected?`#4f46e5`:t.isFocused?`#eff6ff`:`transparent`,color:t.isSelected?`white`:`#374151`})}}):o===`textarea`?t.default.createElement(`textarea`,{...e,rows:v}):t.default.createElement(`input`,{...e,type:o,min:g,max:_})})(),w&&t.default.createElement(`p`,{className:`text-brand-danger text-xs mt-1`},w)):t.default.createElement(`span`,{className:`font-medium text-gray-800 break-words ${!a&&a!==0?`text-gray-400 italic`:``}`},o===`react-select`?s.find(e=>e.value===a)?.label||a||`No especificado`:a||`No especificado`)),l&&t.default.createElement(`div`,{className:`ml-4 flex gap-2 flex-shrink-0`},b?t.default.createElement(t.default.Fragment,null,t.default.createElement(`button`,{onClick:async()=>{let t=o===`react-select`?S?S.value:null:S;if(h&&!t&&t!==0){T(`Este campo es obligatorio`);return}try{u&&await u(e,t),x(!1),T(``)}catch(e){T(e.message||`Error al guardar`)}},className:`p-1 text-brand-success hover:bg-brand-successLight rounded`},t.default.createElement(n.Save,{size:16})),t.default.createElement(`button`,{onClick:()=>x(!1),className:`p-1 text-brand-danger hover:bg-brand-dangerLight rounded`},t.default.createElement(n.X,{size:16}))):t.default.createElement(`button`,{onClick:()=>x(!0),className:`p-1 text-brand-edit hover:bg-brand-editLight rounded`},t.default.createElement(n.Edit3,{size:16}))))}});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("lucide-react"),require("react-select")):typeof define==`function`&&define.amd?define([`exports`,`react`,`lucide-react`,`react-select`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.WidgetDufyKit={},e.React,e.LucideReact,e.Select))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=s(t),c=0,u=i.length,d;c<u;c++)d=i[c],!l.call(e,d)&&d!==n&&a(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=o(t,d))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:i(c(e)),u(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e));t=d(t,1),r=d(r,1),e.BooleanField=({field:e,label:r,value:i,isAdmin:a=!1,onSave:o,required:s=!1,disabled:c=!1,className:l=``,labels:u={true:`Sí`,false:`No`},displayAs:d=`toggle`})=>{let[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(null),[g,_]=(0,t.useState)(``),v=()=>{c||(p(!0),h(d===`toggle`?i??!1:i),_(``))},y=async()=>{if(s&&m==null){_(`Este campo es obligatorio`);return}try{o&&await o(e,m),p(!1),_(``)}catch(e){_(e.message||`Error al guardar`)}},b=()=>{p(!1),h(null),_(``)},x=e=>{h(e),_(``)};return t.default.createElement(`div`,{className:`flex items-center justify-between p-3 bg-gray-50 rounded-lg ${l}`},t.default.createElement(`div`,{className:`flex-1 min-w-0`},t.default.createElement(`label`,{className:`text-sm text-gray-600 block mb-1`},r,s&&d!==`toggle`&&t.default.createElement(`span`,{className:`text-red-500 ml-1`},`*`)),f?t.default.createElement(`div`,null,d===`toggle`?t.default.createElement(`label`,{htmlFor:`${e}_toggle`,className:`relative inline-flex items-center cursor-pointer`},t.default.createElement(`input`,{type:`checkbox`,id:`${e}_toggle`,className:`sr-only peer`,checked:m===!0,onChange:()=>x(!m),disabled:c}),t.default.createElement(`div`,{className:`w-11 h-6 bg-gray-300 rounded-full peer peer-focus:ring-2 peer-focus:ring-blue-300 peer-checked:bg-indigo-600 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all`}),t.default.createElement(`span`,{className:`ml-3 text-sm font-medium text-gray-700 select-none`},m?u.true:u.false)):t.default.createElement(`div`,{className:`space-y-2`},t.default.createElement(`label`,{className:`flex items-center cursor-pointer`},t.default.createElement(`input`,{type:`radio`,name:`${e}_boolean`,checked:m===!0,onChange:()=>x(!0),className:`mr-3 h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300`,disabled:c}),t.default.createElement(`span`,{className:`text-sm text-gray-700`},u.true)),t.default.createElement(`label`,{className:`flex items-center cursor-pointer`},t.default.createElement(`input`,{type:`radio`,name:`${e}_boolean`,checked:m===!1,onChange:()=>x(!1),className:`mr-3 h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300`,disabled:c}),t.default.createElement(`span`,{className:`text-sm text-gray-700`},u.false))),g&&t.default.createElement(`p`,{className:`text-red-500 text-xs mt-2`},g)):t.default.createElement(`span`,{className:`break-words ${i==null&&d!==`toggle`?`text-gray-400 italic`:`font-medium text-gray-800`}`},i===!0?u.true:i===!1||d===`toggle`?u.false:`No especificado`)),a&&t.default.createElement(`div`,{className:`ml-4 flex gap-2 flex-shrink-0`},f?t.default.createElement(t.default.Fragment,null,t.default.createElement(`button`,{onClick:y,disabled:c,className:`p-1 text-green-600 hover:bg-green-100 rounded disabled:opacity-50`,title:`Guardar`},t.default.createElement(n.Save,{size:16})),t.default.createElement(`button`,{onClick:b,className:`p-1 text-red-600 hover:bg-red-100 rounded`,title:`Cancelar`},t.default.createElement(n.X,{size:16}))):t.default.createElement(`button`,{onClick:v,disabled:c,className:`p-1 text-blue-600 hover:bg-blue-100 rounded disabled:opacity-50`,title:`Editar`},t.default.createElement(n.Edit3,{size:16}))))},e.EditableField=({field:e,label:i,value:a,type:o=`text`,options:s=[],placeholder:c=``,isAdmin:l=!1,onSave:u,onCancel:d,onInputChange:f,validation:p=null,disabled:m=!1,required:h=!1,min:g=null,max:_=null,rows:v=3,className:y=``,formatDisplay:b=null,isClearable:x=!0,isSearchable:S=!0,isLoading:C=!1,noOptionsMessage:w=()=>`No se encontraron resultados`,getOptionFromValue:T=null,debug:E=!1})=>{let[D,O]=(0,t.useState)(!1),[k,A]=(0,t.useState)(``),[j,M]=(0,t.useState)(``);(0,t.useEffect)(()=>{E&&console.log(`[EditableField ${e}] Props changed:`,{value:a,isEditing:D,editValue:k,type:o,options:s?.length||0})},[a,D,k,e,E,o,s]),(0,t.useEffect)(()=>{if(!D&&a!==void 0){let t=F(a,o);E&&console.log(`[EditableField ${e}] Syncing value:`,{value:a,formattedValue:t})}},[a,D,e,o,E]);let N=e=>e.map(e=>typeof e==`string`?{value:e,label:e}:e),P=e=>{if(!e||!s.length)return null;let t=N(s);return T?T(t,e):t.find(t=>t.value===e)||null},F=(e,t)=>{if(!e&&e!==0)return``;try{switch(t){case`date`:{let t=new Date(e);return isNaN(t.getTime())?``:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}case`datetime`:if(typeof e==`string`&&e.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/))return e.slice(0,16);let t=new Date(e);return isNaN(t.getTime())?``:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}T${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`;case`time`:return e.includes(`T`)?e.split(`T`)[1].slice(0,5):e;case`react-select`:return P(e);default:return e}}catch(e){return console.error(`Error formatting value:`,e),``}},I=()=>{if(m)return;let t=F(a,o);E&&console.log(`[EditableField ${e}] Starting edit:`,{originalValue:a,formattedValue:t,type:o}),O(!0),A(t),M(``)},L=async()=>{let t=k;if(E&&console.log(`[EditableField ${e}] Attempting save:`,{editValue:k,type:o}),o===`react-select`&&(t=k?k.value:null),(o===`date`||o===`datetime`)&&t){let e=o===`date`?`${t}T00:00:00`:t;t=new Date(e)}if(h&&(!t||t.toString().trim()===``)){M(`Este campo es obligatorio`);return}if(p){let e=p(t);if(e){M(e);return}}try{u&&(E&&console.log(`[EditableField ${e}] Calling onSave with:`,t),await u(e,t)),O(!1),M(``),E&&console.log(`[EditableField ${e}] Save completed successfully`)}catch(t){E&&console.error(`[EditableField ${e}] Save error:`,t),M(t.message||`Error al guardar`)}},R=()=>{O(!1),A(``),M(``),d&&d(e)},z=e=>{e.key===`Enter`&&o!==`textarea`?L():e.key===`Escape`&&R()},B=t=>{let n=t.target.value;if(E&&console.log(`[EditableField ${e}] Input change:`,{newValue:n,type:o}),A(n),f)try{f(e,n,t)}catch(t){E&&console.error(`[EditableField ${e}] onInputChange error:`,t)}},V=t=>{if(E&&console.log(`[EditableField ${e}] Select change:`,{option:t,type:o}),A(t),f)try{f(e,t,t?t.value:null)}catch(t){E&&console.error(`[EditableField ${e}] onInputChange error:`,t)}},H=(t,n)=>{if(E&&n.action===`input-change`&&console.log(`[EditableField ${e}] Select input change:`,{inputValue:t,actionMeta:n}),f&&n.action===`input-change`)try{f(e,t,{action:`search`,inputValue:t})}catch(t){E&&console.error(`[EditableField ${e}] onInputChange error:`,t)}};return t.default.createElement(`div`,{className:`flex items-start justify-between p-3 bg-gray-50 rounded-lg ${y}`},t.default.createElement(`div`,{className:`flex-1 min-w-0`},t.default.createElement(`label`,{className:`text-sm text-gray-600 block mb-1`},i,h&&t.default.createElement(`span`,{className:`text-red-500 ml-1`},`*`)),D?t.default.createElement(`div`,null,(()=>{let e={value:k||``,onChange:B,onKeyDown:z,className:`w-full p-2 border rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${j?`border-red-500`:`border-gray-300`}`,placeholder:c,autoFocus:!0,disabled:m};switch(o){case`textarea`:return t.default.createElement(`textarea`,{...e,rows:v,onKeyDown:e=>{e.key===`Escape`&&R()}});case`number`:return t.default.createElement(`input`,{...e,type:`number`,min:g,max:_,step:`any`});case`date`:return t.default.createElement(`input`,{...e,type:`date`,min:g,max:_});case`datetime`:return t.default.createElement(`input`,{...e,type:`datetime-local`,min:g,max:_});case`time`:return t.default.createElement(`input`,{...e,type:`time`,min:g,max:_});case`react-select`:let i=N(s);return t.default.createElement(r.default,{value:k,onChange:V,onInputChange:H,options:i,placeholder:c,isClearable:x,isSearchable:S,isLoading:C,isDisabled:m,noOptionsMessage:w,classNamePrefix:`react-select`,className:j?`react-select-error`:``,autoFocus:!0,openMenuOnFocus:!1,styles:{control:(e,t)=>({...e,minHeight:`42px`,border:`1px solid ${j?`#ef4444`:t.isFocused?`#3b82f6`:`#d1d5db`}`,borderRadius:`6px`,boxShadow:t.isFocused?`0 0 0 2px ${j?`#fecaca`:`#dbeafe`}`:`none`,backgroundColor:`white`,fontSize:`14px`,"&:hover":{borderColor:j?`#ef4444`:`#9ca3af`}}),valueContainer:e=>({...e,padding:`8px 12px`}),placeholder:e=>({...e,color:`#9ca3af`,fontSize:`14px`}),singleValue:e=>({...e,color:`#374151`,fontSize:`14px`}),menu:e=>({...e,borderRadius:`6px`,border:`1px solid #e5e7eb`,boxShadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)`,zIndex:9999}),menuList:e=>({...e,borderRadius:`6px`,padding:`4px`}),option:(e,t)=>({...e,backgroundColor:t.isSelected?`#3b82f6`:t.isFocused?`#f3f4f6`:`transparent`,color:t.isSelected?`white`:`#374151`,padding:`12px 16px`,fontSize:`14px`,borderRadius:`4px`,margin:`2px 0`,cursor:`pointer`,"&:active":{backgroundColor:t.isSelected?`#2563eb`:`#e5e7eb`}}),indicatorSeparator:e=>({...e,backgroundColor:`#d1d5db`}),dropdownIndicator:(e,t)=>({...e,color:`#6b7280`,padding:`8px`,"&:hover":{color:`#374151`}}),clearIndicator:e=>({...e,color:`#6b7280`,padding:`8px`,"&:hover":{color:`#374151`}}),loadingIndicator:e=>({...e,color:`#3b82f6`}),noOptionsMessage:e=>({...e,color:`#6b7280`,fontSize:`14px`,padding:`8px 12px`})}});case`select`:return t.default.createElement(`div`,{className:`relative`},t.default.createElement(`select`,{...e,className:`${e.className} appearance-none pr-8`},t.default.createElement(`option`,{value:``},`Seleccionar...`),s.map((e,n)=>t.default.createElement(`option`,{key:n,value:typeof e==`object`?e.value:e},typeof e==`object`?e.label:e))),t.default.createElement(n.ChevronDown,{size:16,className:`absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 pointer-events-none`}));case`email`:return t.default.createElement(`input`,{...e,type:`email`});case`tel`:return t.default.createElement(`input`,{...e,type:`tel`});default:return t.default.createElement(`input`,{...e,type:`text`})}})(),j&&t.default.createElement(`p`,{className:`text-red-500 text-xs mt-1`},j)):t.default.createElement(`span`,{className:`font-medium text-gray-800 break-words ${!a&&a!==0?`text-gray-400 italic`:``}`},(()=>{if(b)return b(a);if(!a&&a!==0)return`No especificado`;switch(o){case`date`:if(a){let e=new Date(a);if(!isNaN(e.getTime()))return e.toLocaleDateString(`es-ES`,{year:`numeric`,month:`long`,day:`numeric`})}return`No especificado`;case`datetime`:if(a){let e=new Date(a);if(!isNaN(e.getTime()))return e.toLocaleString(`es-CO`,{year:`numeric`,month:`long`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!0,timeZone:`America/Bogota`})}return`No especificado`;case`time`:return a||`No especificado`;case`number`:return typeof a==`number`?a.toLocaleString(`es-ES`):a;case`select`:if(s.length>0&&typeof s[0]==`object`){let e=s.find(e=>e.value===a);return e?e.label:a}return a;case`react-select`:if(a&&s.length>0){let e=P(a);return e?e.label:a}return a;default:return a}})())),l&&t.default.createElement(`div`,{className:`ml-4 flex gap-2 flex-shrink-0`},D?t.default.createElement(t.default.Fragment,null,t.default.createElement(`button`,{onClick:L,disabled:m,className:`p-1 text-green-600 hover:bg-green-100 rounded disabled:opacity-50 disabled:cursor-not-allowed`,title:`Guardar`},t.default.createElement(n.Save,{size:16})),t.default.createElement(`button`,{onClick:R,className:`p-1 text-red-600 hover:bg-red-100 rounded`,title:`Cancelar`},t.default.createElement(n.X,{size:16}))):t.default.createElement(`button`,{onClick:I,disabled:m,className:`p-1 text-blue-600 hover:bg-blue-100 rounded disabled:opacity-50 disabled:cursor-not-allowed`,title:`Editar`},t.default.createElement(n.Edit3,{size:16}))))}});
@@ -1,3 +1,3 @@
1
1
  /*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-content:"";--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-brand-bgWidget:#fff;--color-brand-primary:#4f46e5;--color-brand-danger:#dc2626;--color-brand-dangerLight:#fef2f2;--color-brand-success:#16a34a;--color-brand-successLight:#f0fdf4;--color-brand-edit:#2563eb;--color-brand-editLight:#eff6ff}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.relative{position:relative}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mb-1{margin-bottom:var(--spacing)}.ml-1{margin-left:var(--spacing)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-4{margin-left:calc(var(--spacing) * 4)}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.h-4{height:calc(var(--spacing) * 4)}.h-6{height:calc(var(--spacing) * 6)}.w-4{width:calc(var(--spacing) * 4)}.w-11{width:calc(var(--spacing) * 11)}.w-full{width:100%}.min-w-0{min-width:0}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.gap-2{gap:calc(var(--spacing) * 2)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-brand-danger{border-color:var(--color-brand-danger)}.border-gray-300{border-color:var(--color-gray-300)}.bg-brand-bgWidget{background-color:var(--color-brand-bgWidget)}.bg-gray-300{background-color:var(--color-gray-300)}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.break-words{overflow-wrap:break-word}.text-brand-danger{color:var(--color-brand-danger)}.text-brand-edit{color:var(--color-brand-edit)}.text-brand-primary{color:var(--color-brand-primary)}.text-brand-success{color:var(--color-brand-success)}.text-gray-400{color:var(--color-gray-400)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.italic{font-style:italic}.select-none{-webkit-user-select:none;user-select:none}.peer-checked\:bg-brand-primary:is(:where(.peer):checked~*){background-color:var(--color-brand-primary)}.peer-focus\:ring-2:is(:where(.peer):focus~*){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.peer-focus\:ring-brand-editLight:is(:where(.peer):focus~*){--tw-ring-color:var(--color-brand-editLight)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:top-0\.5:after{content:var(--tw-content);top:calc(var(--spacing) * .5)}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:h-5:after{content:var(--tw-content);height:calc(var(--spacing) * 5)}.after\:w-5:after{content:var(--tw-content);width:calc(var(--spacing) * 5)}.after\:rounded-full:after{content:var(--tw-content);border-radius:3.40282e38px}.after\:border:after{content:var(--tw-content);border-style:var(--tw-border-style);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);border-color:var(--color-gray-300)}.after\:bg-white:after{content:var(--tw-content);background-color:var(--color-white)}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.after\:content-\[\'\'\]:after{--tw-content:"";content:var(--tw-content)}.peer-checked\:after\:translate-x-full:is(:where(.peer):checked~*):after{content:var(--tw-content);--tw-translate-x:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.peer-checked\:after\:border-white:is(:where(.peer):checked~*):after{content:var(--tw-content);border-color:var(--color-white)}@media (hover:hover){.hover\:bg-brand-dangerLight:hover{background-color:var(--color-brand-dangerLight)}.hover\:bg-brand-editLight:hover{background-color:var(--color-brand-editLight)}.hover\:bg-brand-successLight:hover{background-color:var(--color-brand-successLight)}}.focus\:border-brand-primary:focus{border-color:var(--color-brand-primary)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-brand-primary:focus{--tw-ring-color:var(--color-brand-primary)}.disabled\:opacity-50:disabled{opacity:.5}}@keyframes flash{0%{background-color:#e0f2fe}to{background-color:#0000}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-content:""}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-green-100:oklch(96.2% .044 156.743);--color-green-600:oklch(62.7% .194 149.214);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-brand-bgWidget:#fff;--color-brand-primary:#4f46e5;--color-brand-danger:#dc2626;--color-brand-dangerLight:#fef2f2;--color-brand-success:#16a34a;--color-brand-successLight:#f0fdf4;--color-brand-edit:#2563eb;--color-brand-editLight:#eff6ff}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.relative{position:relative}.top-1\/2{top:50%}.right-2{right:calc(var(--spacing) * 2)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mb-1{margin-bottom:var(--spacing)}.ml-1{margin-left:var(--spacing)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-4{margin-left:calc(var(--spacing) * 4)}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.h-4{height:calc(var(--spacing) * 4)}.h-6{height:calc(var(--spacing) * 6)}.w-4{width:calc(var(--spacing) * 4)}.w-11{width:calc(var(--spacing) * 11)}.w-full{width:100%}.min-w-0{min-width:0}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.appearance-none{appearance:none}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.gap-2{gap:calc(var(--spacing) * 2)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-gray-300{border-color:var(--color-gray-300)}.border-red-500{border-color:var(--color-red-500)}.bg-brand-bgWidget{background-color:var(--color-brand-bgWidget)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-300{background-color:var(--color-gray-300)}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.pr-8{padding-right:calc(var(--spacing) * 8)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.break-words{overflow-wrap:break-word}.text-blue-600{color:var(--color-blue-600)}.text-brand-danger{color:var(--color-brand-danger)}.text-brand-edit{color:var(--color-brand-edit)}.text-brand-primary{color:var(--color-brand-primary)}.text-brand-success{color:var(--color-brand-success)}.text-gray-400{color:var(--color-gray-400)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-green-600{color:var(--color-green-600)}.text-indigo-600{color:var(--color-indigo-600)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.italic{font-style:italic}.select-none{-webkit-user-select:none;user-select:none}.peer-checked\:bg-brand-primary:is(:where(.peer):checked~*){background-color:var(--color-brand-primary)}.peer-checked\:bg-indigo-600:is(:where(.peer):checked~*){background-color:var(--color-indigo-600)}.peer-focus\:ring-2:is(:where(.peer):focus~*){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.peer-focus\:ring-blue-300:is(:where(.peer):focus~*){--tw-ring-color:var(--color-blue-300)}.peer-focus\:ring-brand-editLight:is(:where(.peer):focus~*){--tw-ring-color:var(--color-brand-editLight)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:top-0\.5:after{content:var(--tw-content);top:calc(var(--spacing) * .5)}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:h-5:after{content:var(--tw-content);height:calc(var(--spacing) * 5)}.after\:w-5:after{content:var(--tw-content);width:calc(var(--spacing) * 5)}.after\:rounded-full:after{content:var(--tw-content);border-radius:3.40282e38px}.after\:border:after{content:var(--tw-content);border-style:var(--tw-border-style);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);border-color:var(--color-gray-300)}.after\:bg-white:after{content:var(--tw-content);background-color:var(--color-white)}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.after\:content-\[\'\'\]:after{--tw-content:"";content:var(--tw-content)}.peer-checked\:after\:translate-x-full:is(:where(.peer):checked~*):after{content:var(--tw-content);--tw-translate-x:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.peer-checked\:after\:border-white:is(:where(.peer):checked~*):after{content:var(--tw-content);border-color:var(--color-white)}@media (hover:hover){.hover\:bg-blue-100:hover{background-color:var(--color-blue-100)}.hover\:bg-brand-dangerLight:hover{background-color:var(--color-brand-dangerLight)}.hover\:bg-brand-editLight:hover{background-color:var(--color-brand-editLight)}.hover\:bg-brand-successLight:hover{background-color:var(--color-brand-successLight)}.hover\:bg-green-100:hover{background-color:var(--color-green-100)}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}}.focus\:border-blue-500:focus{border-color:var(--color-blue-500)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-brand-primary:focus{--tw-ring-color:var(--color-brand-primary)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}}@keyframes flash{0%{background-color:#e0f2fe}to{background-color:#0000}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-content{syntax:"*";inherits:false;initial-value:""}
3
3
  /*$vite$:1*/
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
+ //EDITABLEFIELD
3
4
  export interface EditableFieldProps {
4
5
  // === PROPIEDADES BÁSICAS ===
5
6
 
@@ -97,7 +98,6 @@ export interface EditableFieldProps {
97
98
  /** Función auxiliar para mapear un valor primitivo a su objeto de opción correspondiente. */
98
99
  getOptionFromValue?: ((options: any[], value: any) => any | null) | null;
99
100
  }
100
-
101
101
  /**
102
102
  * ### EditableField — Dufy Asesorías
103
103
  * Componente interactivo que permite editar diferentes tipos de datos directamente in-line,
@@ -124,4 +124,45 @@ export interface EditableFieldProps {
124
124
  * />
125
125
  * ```
126
126
  */
127
- export const EditableField: React.FC<EditableFieldProps>;
127
+ export const EditableField: React.FC<EditableFieldProps>
128
+ export interface BooleanFieldProps {
129
+ /** Identificador único del campo (ej: 'activo', 'tiene_experiencia') */
130
+ field: string;
131
+
132
+ /** Etiqueta o título que se muestra sobre el campo */
133
+ label: string;
134
+
135
+ /** Valor booleano actual */
136
+ value: boolean | null | undefined;
137
+
138
+ /** Determina si se muestran los controles de edición (Lápiz, Guardar, Cancelar) */
139
+ isAdmin?: boolean;
140
+
141
+ /** Callback obligatorio o síncrono/asíncrono que se ejecuta al presionar Guardar */
142
+ onSave?: (field: string, value: boolean | null) => void | Promise<void>;
143
+
144
+ /** Si es verdadero, exige que haya un valor seleccionado al guardar (No aplica para vista toggle) */
145
+ required?: boolean;
146
+
147
+ /** Deshabilita la edición del campo por completo */
148
+ disabled?: boolean;
149
+
150
+ /** Clases de CSS adicionales de Tailwind para dar estilos externos al contenedor */
151
+ className?: string;
152
+
153
+ /** Mapeo para personalizar los textos que ve el usuario */
154
+ labels?: {
155
+ true: string;
156
+ false: string;
157
+ };
158
+
159
+ /** Controla el tipo de interfaz visual que se renderiza al editar */
160
+ displayAs?: 'radio' | 'toggle';
161
+ }
162
+
163
+ //BOOLEAN
164
+ /**
165
+ * Componente BooleanField para visualizar y editar campos lógicos (Sí/No).
166
+ */
167
+ declare const BooleanField: React.FC<BooleanFieldProps>;
168
+ export default BooleanField;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@dufy_asesorias/widget-dufy-kit",
3
- "version": "1.0.0",
3
+ "descripton" : "Widgets para reutilizacion en empresa Dufy Asesorias",
4
+ "version": "1.0.2",
4
5
  "type": "module",
5
6
  "main": "./dist/index.umd.js",
6
7
  "module": "./dist/index.es.js",