framepexls-ui-lib 0.1.8 → 0.1.10
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/Badge.d.mts +3 -1
- package/dist/Badge.d.ts +3 -1
- package/dist/Badge.js +12 -2
- package/dist/Badge.mjs +12 -2
- package/dist/Button.d.mts +5 -1
- package/dist/Button.d.ts +5 -1
- package/dist/Button.js +29 -5
- package/dist/Button.mjs +29 -5
- package/dist/ComboSelect.js +0 -1
- package/dist/ComboSelect.mjs +0 -1
- package/dist/DateTimeField.js +2 -1
- package/dist/DateTimeField.mjs +2 -1
- package/dist/Input.js +3 -1
- package/dist/Input.mjs +3 -1
- package/dist/MultiComboSelect.d.mts +23 -0
- package/dist/MultiComboSelect.d.ts +23 -0
- package/dist/MultiComboSelect.js +152 -0
- package/dist/MultiComboSelect.mjs +122 -0
- package/dist/ReviewHistory.d.mts +23 -0
- package/dist/ReviewHistory.d.ts +23 -0
- package/dist/ReviewHistory.js +137 -0
- package/dist/ReviewHistory.mjs +103 -0
- package/dist/Sidebar.d.mts +35 -0
- package/dist/Sidebar.d.ts +35 -0
- package/dist/Sidebar.js +407 -0
- package/dist/Sidebar.mjs +377 -0
- package/dist/TimePopover.js +2 -2
- package/dist/TimePopover.mjs +2 -2
- package/dist/TimeRangeField.d.mts +20 -0
- package/dist/TimeRangeField.d.ts +20 -0
- package/dist/TimeRangeField.js +268 -0
- package/dist/TimeRangeField.mjs +238 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +15 -0
- package/dist/index.mjs +18 -8
- package/package.json +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import ComboSelect from "./ComboSelect";
|
|
5
|
+
import Dialog from "./Dialog";
|
|
6
|
+
import Badge from "./Badge";
|
|
7
|
+
function MultiComboSelect({
|
|
8
|
+
options,
|
|
9
|
+
value,
|
|
10
|
+
onChange,
|
|
11
|
+
placeholder = "Selecciona\u2026",
|
|
12
|
+
disabled,
|
|
13
|
+
loading,
|
|
14
|
+
className,
|
|
15
|
+
noResultsText,
|
|
16
|
+
maxVisibleTags = 3,
|
|
17
|
+
enableDialog = true,
|
|
18
|
+
dialogTitle = "Seleccionadas"
|
|
19
|
+
}) {
|
|
20
|
+
const selectedSet = React.useMemo(() => new Set(value), [value]);
|
|
21
|
+
const [dialogOpen, setDialogOpen] = React.useState(false);
|
|
22
|
+
const toggle = React.useCallback(
|
|
23
|
+
(val) => {
|
|
24
|
+
if (val == null) return;
|
|
25
|
+
const next = new Set(selectedSet);
|
|
26
|
+
if (next.has(val)) next.delete(val);
|
|
27
|
+
else next.add(val);
|
|
28
|
+
onChange(Array.from(next));
|
|
29
|
+
},
|
|
30
|
+
[selectedSet, onChange]
|
|
31
|
+
);
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
ComboSelect,
|
|
35
|
+
{
|
|
36
|
+
options,
|
|
37
|
+
value: null,
|
|
38
|
+
onChange: (v) => toggle(v),
|
|
39
|
+
placeholder: value.length === 0 ? placeholder : "",
|
|
40
|
+
disabled,
|
|
41
|
+
loading,
|
|
42
|
+
className,
|
|
43
|
+
noResultsText,
|
|
44
|
+
closeOnSelect: false,
|
|
45
|
+
keepFocusOnSelect: true,
|
|
46
|
+
clearQueryOnSelect: false,
|
|
47
|
+
renderTags: null,
|
|
48
|
+
renderOption: (opt) => {
|
|
49
|
+
var _a;
|
|
50
|
+
const isSel = selectedSet.has(opt.value);
|
|
51
|
+
const color = (_a = opt.color) != null ? _a : void 0;
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex items-center gap-3", children: [
|
|
54
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block h-2.5 w-2.5 rounded-full", style: { background: color } }),
|
|
55
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label })
|
|
56
|
+
] }),
|
|
57
|
+
isSel && /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx("path", { d: "m5 12 4 4L19 6" }) })
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
value.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-wrap gap-1.5", children: [
|
|
63
|
+
value.slice(0, Math.max(0, maxVisibleTags)).map((v) => {
|
|
64
|
+
const opt = options.find((o) => o.value === v);
|
|
65
|
+
if (!opt) return null;
|
|
66
|
+
return /* @__PURE__ */ jsx(Badge, { tone: "slate", size: "sm", onClick: () => toggle(v), title: "Quitar", children: opt.label }, v);
|
|
67
|
+
}),
|
|
68
|
+
enableDialog && value.length > maxVisibleTags && /* @__PURE__ */ jsxs(
|
|
69
|
+
"button",
|
|
70
|
+
{
|
|
71
|
+
type: "button",
|
|
72
|
+
className: "inline-flex items-center gap-1 rounded-full border border-slate-200 bg-white px-2 py-0.5 text-xs text-slate-700 hover:bg-slate-50 active:scale-95 dark:border-white/10 dark:bg-white/10 dark:text-slate-200",
|
|
73
|
+
onClick: () => setDialogOpen(true),
|
|
74
|
+
title: "Ver todas",
|
|
75
|
+
children: [
|
|
76
|
+
"+",
|
|
77
|
+
value.length - Math.max(0, maxVisibleTags)
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] }),
|
|
82
|
+
enableDialog && /* @__PURE__ */ jsxs(Dialog, { open: dialogOpen, onClose: () => setDialogOpen(false), size: "sm", children: [
|
|
83
|
+
/* @__PURE__ */ jsx(Dialog.Header, { title: dialogTitle, onClose: () => setDialogOpen(false) }),
|
|
84
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
85
|
+
value.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted", children: "Sin seleccionadas" }),
|
|
86
|
+
value.map((v) => {
|
|
87
|
+
var _a;
|
|
88
|
+
const opt = options.find((o) => o.value === v);
|
|
89
|
+
if (!opt) return null;
|
|
90
|
+
const color = (_a = opt.color) != null ? _a : void 0;
|
|
91
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 rounded-xl border border-border bg-surface px-3 py-2 text-sm", children: [
|
|
92
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex items-center gap-2", children: [
|
|
93
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block h-2.5 w-2.5 rounded-full", style: { background: color } }),
|
|
94
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label })
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
"button",
|
|
98
|
+
{
|
|
99
|
+
type: "button",
|
|
100
|
+
className: "inline-flex h-8 items-center justify-center rounded-lg border border-slate-300/80 bg-white px-2 text-xs text-slate-700 hover:bg-slate-50 active:scale-95 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:bg-white/10",
|
|
101
|
+
onClick: () => toggle(v),
|
|
102
|
+
children: "Quitar"
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
] }, v);
|
|
106
|
+
})
|
|
107
|
+
] }) }),
|
|
108
|
+
/* @__PURE__ */ jsx(Dialog.Footer, { align: "end", children: /* @__PURE__ */ jsx(
|
|
109
|
+
"button",
|
|
110
|
+
{
|
|
111
|
+
type: "button",
|
|
112
|
+
className: "inline-flex h-10 items-center gap-2 rounded-xl border border-slate-300/80 bg-white px-4 text-sm font-medium text-slate-700 shadow-sm hover:bg-slate-50 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:bg-white/10",
|
|
113
|
+
onClick: () => setDialogOpen(false),
|
|
114
|
+
children: "Cerrar"
|
|
115
|
+
}
|
|
116
|
+
) })
|
|
117
|
+
] })
|
|
118
|
+
] });
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
MultiComboSelect as default
|
|
122
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type ReviewItem = {
|
|
4
|
+
id: number;
|
|
5
|
+
status: "pendiente" | "en_revision" | "aprobado" | "rechazado";
|
|
6
|
+
comment?: string | null;
|
|
7
|
+
by_name?: string | null;
|
|
8
|
+
by_email?: string | null;
|
|
9
|
+
user_id?: number | null;
|
|
10
|
+
created_at: string;
|
|
11
|
+
};
|
|
12
|
+
declare function ReviewHistory({ items, loading, onViewAll, }: {
|
|
13
|
+
items: ReviewItem[];
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
onViewAll?: () => void;
|
|
16
|
+
}): react_jsx_runtime.JSX.Element;
|
|
17
|
+
declare function ReviewHistoryDialog({ open, onClose, items, }: {
|
|
18
|
+
open: boolean;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
items: ReviewItem[];
|
|
21
|
+
}): react_jsx_runtime.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { ReviewHistoryDialog, type ReviewItem, ReviewHistory as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type ReviewItem = {
|
|
4
|
+
id: number;
|
|
5
|
+
status: "pendiente" | "en_revision" | "aprobado" | "rechazado";
|
|
6
|
+
comment?: string | null;
|
|
7
|
+
by_name?: string | null;
|
|
8
|
+
by_email?: string | null;
|
|
9
|
+
user_id?: number | null;
|
|
10
|
+
created_at: string;
|
|
11
|
+
};
|
|
12
|
+
declare function ReviewHistory({ items, loading, onViewAll, }: {
|
|
13
|
+
items: ReviewItem[];
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
onViewAll?: () => void;
|
|
16
|
+
}): react_jsx_runtime.JSX.Element;
|
|
17
|
+
declare function ReviewHistoryDialog({ open, onClose, items, }: {
|
|
18
|
+
open: boolean;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
items: ReviewItem[];
|
|
21
|
+
}): react_jsx_runtime.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { ReviewHistoryDialog, type ReviewItem, ReviewHistory as default };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var ReviewHistory_exports = {};
|
|
31
|
+
__export(ReviewHistory_exports, {
|
|
32
|
+
ReviewHistoryDialog: () => ReviewHistoryDialog,
|
|
33
|
+
default: () => ReviewHistory
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(ReviewHistory_exports);
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_Dialog = __toESM(require("./Dialog"));
|
|
38
|
+
var import_Badge = __toESM(require("./Badge"));
|
|
39
|
+
function ReviewHistory({
|
|
40
|
+
items,
|
|
41
|
+
loading,
|
|
42
|
+
onViewAll
|
|
43
|
+
}) {
|
|
44
|
+
const latest = (items != null ? items : []).slice(0, 3);
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid gap-2", children: [
|
|
46
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm font-semibold", children: "Historial de estado" }),
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-xs text-muted", children: loading ? "Cargando\u2026" : `${items.length} total` })
|
|
49
|
+
] }),
|
|
50
|
+
latest.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm text-muted", children: "Sin registros" }),
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid gap-2", children: latest.map((r) => {
|
|
52
|
+
var _a;
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-border bg-surface px-3 py-2 text-sm", children: [
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "font-medium", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Badge.default, { tone: statusTone(r.status), children: statusLabel(r.status) }) }),
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-xs text-muted", children: formatDateTime(r.created_at) })
|
|
57
|
+
] }),
|
|
58
|
+
r.comment && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-1 text-sm text-foreground whitespace-pre-line", children: r.comment }),
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-1 text-xs text-muted", children: r.by_name || r.by_email ? `${(_a = r.by_name) != null ? _a : ""} ${r.by_email ? `\xB7 ${r.by_email}` : ""}` : r.user_id ? "Usuario interno" : "Invitado" })
|
|
60
|
+
] }, r.id);
|
|
61
|
+
}) }),
|
|
62
|
+
items.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "text-sm text-blue-600 hover:underline dark:text-blue-400", onClick: onViewAll, children: "Ver todos" }) })
|
|
63
|
+
] });
|
|
64
|
+
}
|
|
65
|
+
function ReviewHistoryDialog({
|
|
66
|
+
open,
|
|
67
|
+
onClose,
|
|
68
|
+
items
|
|
69
|
+
}) {
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Dialog.default, { open, onClose, size: "md", children: [
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Dialog.default.Header, { title: "Historial de estado", onClose, showClose: true, compact: true }),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Dialog.default.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid gap-2", children: [
|
|
73
|
+
items.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm text-muted", children: "Sin registros" }),
|
|
74
|
+
items.map((r) => {
|
|
75
|
+
var _a;
|
|
76
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-border bg-surface px-3 py-2 text-sm", children: [
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "font-medium", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Badge.default, { tone: statusTone(r.status), children: statusLabel(r.status) }) }),
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-xs text-muted", children: formatDateTime(r.created_at) })
|
|
80
|
+
] }),
|
|
81
|
+
r.comment && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-1 text-sm text-foreground whitespace-pre-line", children: r.comment }),
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-1 text-xs text-muted", children: r.by_name || r.by_email ? `${(_a = r.by_name) != null ? _a : ""} ${r.by_email ? `\xB7 ${r.by_email}` : ""}` : r.user_id ? "Usuario interno" : "Invitado" })
|
|
83
|
+
] }, r.id);
|
|
84
|
+
})
|
|
85
|
+
] }) }),
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Dialog.default.Footer, { align: "end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
+
"button",
|
|
88
|
+
{
|
|
89
|
+
className: "inline-flex h-10 items-center gap-2 rounded-xl border border-slate-300/80 bg-white px-4 text-sm font-medium text-slate-700 shadow-sm hover:bg-slate-50 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:bg-white/10",
|
|
90
|
+
onClick: onClose,
|
|
91
|
+
children: "Cerrar"
|
|
92
|
+
}
|
|
93
|
+
) })
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
96
|
+
function formatDateTime(value) {
|
|
97
|
+
try {
|
|
98
|
+
return new Date(value).toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
|
|
99
|
+
} catch {
|
|
100
|
+
return value;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function ucfirst(s) {
|
|
104
|
+
return s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
105
|
+
}
|
|
106
|
+
function statusLabel(s) {
|
|
107
|
+
switch (s) {
|
|
108
|
+
case "pendiente":
|
|
109
|
+
return "Pendiente";
|
|
110
|
+
case "en_revision":
|
|
111
|
+
return "En revisi\xF3n";
|
|
112
|
+
case "aprobado":
|
|
113
|
+
return "Aprobado";
|
|
114
|
+
case "rechazado":
|
|
115
|
+
return "Rechazado";
|
|
116
|
+
default:
|
|
117
|
+
return ucfirst(String(s));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function statusTone(s) {
|
|
121
|
+
switch (s) {
|
|
122
|
+
case "pendiente":
|
|
123
|
+
return "sky";
|
|
124
|
+
case "en_revision":
|
|
125
|
+
return "amber";
|
|
126
|
+
case "aprobado":
|
|
127
|
+
return "emerald";
|
|
128
|
+
case "rechazado":
|
|
129
|
+
return "rose";
|
|
130
|
+
default:
|
|
131
|
+
return "slate";
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
ReviewHistoryDialog
|
|
137
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Dialog from "./Dialog";
|
|
4
|
+
import Badge from "./Badge";
|
|
5
|
+
function ReviewHistory({
|
|
6
|
+
items,
|
|
7
|
+
loading,
|
|
8
|
+
onViewAll
|
|
9
|
+
}) {
|
|
10
|
+
const latest = (items != null ? items : []).slice(0, 3);
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
12
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
13
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-semibold", children: "Historial de estado" }),
|
|
14
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted", children: loading ? "Cargando\u2026" : `${items.length} total` })
|
|
15
|
+
] }),
|
|
16
|
+
latest.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted", children: "Sin registros" }),
|
|
17
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-2", children: latest.map((r) => {
|
|
18
|
+
var _a;
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-surface px-3 py-2 text-sm", children: [
|
|
20
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
21
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: /* @__PURE__ */ jsx(Badge, { tone: statusTone(r.status), children: statusLabel(r.status) }) }),
|
|
22
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted", children: formatDateTime(r.created_at) })
|
|
23
|
+
] }),
|
|
24
|
+
r.comment && /* @__PURE__ */ jsx("div", { className: "mt-1 text-sm text-foreground whitespace-pre-line", children: r.comment }),
|
|
25
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-muted", children: r.by_name || r.by_email ? `${(_a = r.by_name) != null ? _a : ""} ${r.by_email ? `\xB7 ${r.by_email}` : ""}` : r.user_id ? "Usuario interno" : "Invitado" })
|
|
26
|
+
] }, r.id);
|
|
27
|
+
}) }),
|
|
28
|
+
items.length > 3 && /* @__PURE__ */ jsx("div", { className: "pt-1", children: /* @__PURE__ */ jsx("button", { className: "text-sm text-blue-600 hover:underline dark:text-blue-400", onClick: onViewAll, children: "Ver todos" }) })
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
function ReviewHistoryDialog({
|
|
32
|
+
open,
|
|
33
|
+
onClose,
|
|
34
|
+
items
|
|
35
|
+
}) {
|
|
36
|
+
return /* @__PURE__ */ jsxs(Dialog, { open, onClose, size: "md", children: [
|
|
37
|
+
/* @__PURE__ */ jsx(Dialog.Header, { title: "Historial de estado", onClose, showClose: true, compact: true }),
|
|
38
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
39
|
+
items.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted", children: "Sin registros" }),
|
|
40
|
+
items.map((r) => {
|
|
41
|
+
var _a;
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-surface px-3 py-2 text-sm", children: [
|
|
43
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
44
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: /* @__PURE__ */ jsx(Badge, { tone: statusTone(r.status), children: statusLabel(r.status) }) }),
|
|
45
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted", children: formatDateTime(r.created_at) })
|
|
46
|
+
] }),
|
|
47
|
+
r.comment && /* @__PURE__ */ jsx("div", { className: "mt-1 text-sm text-foreground whitespace-pre-line", children: r.comment }),
|
|
48
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-muted", children: r.by_name || r.by_email ? `${(_a = r.by_name) != null ? _a : ""} ${r.by_email ? `\xB7 ${r.by_email}` : ""}` : r.user_id ? "Usuario interno" : "Invitado" })
|
|
49
|
+
] }, r.id);
|
|
50
|
+
})
|
|
51
|
+
] }) }),
|
|
52
|
+
/* @__PURE__ */ jsx(Dialog.Footer, { align: "end", children: /* @__PURE__ */ jsx(
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
className: "inline-flex h-10 items-center gap-2 rounded-xl border border-slate-300/80 bg-white px-4 text-sm font-medium text-slate-700 shadow-sm hover:bg-slate-50 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:bg-white/10",
|
|
56
|
+
onClick: onClose,
|
|
57
|
+
children: "Cerrar"
|
|
58
|
+
}
|
|
59
|
+
) })
|
|
60
|
+
] });
|
|
61
|
+
}
|
|
62
|
+
function formatDateTime(value) {
|
|
63
|
+
try {
|
|
64
|
+
return new Date(value).toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
|
|
65
|
+
} catch {
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function ucfirst(s) {
|
|
70
|
+
return s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
71
|
+
}
|
|
72
|
+
function statusLabel(s) {
|
|
73
|
+
switch (s) {
|
|
74
|
+
case "pendiente":
|
|
75
|
+
return "Pendiente";
|
|
76
|
+
case "en_revision":
|
|
77
|
+
return "En revisi\xF3n";
|
|
78
|
+
case "aprobado":
|
|
79
|
+
return "Aprobado";
|
|
80
|
+
case "rechazado":
|
|
81
|
+
return "Rechazado";
|
|
82
|
+
default:
|
|
83
|
+
return ucfirst(String(s));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function statusTone(s) {
|
|
87
|
+
switch (s) {
|
|
88
|
+
case "pendiente":
|
|
89
|
+
return "sky";
|
|
90
|
+
case "en_revision":
|
|
91
|
+
return "amber";
|
|
92
|
+
case "aprobado":
|
|
93
|
+
return "emerald";
|
|
94
|
+
case "rechazado":
|
|
95
|
+
return "rose";
|
|
96
|
+
default:
|
|
97
|
+
return "slate";
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
ReviewHistoryDialog,
|
|
102
|
+
ReviewHistory as default
|
|
103
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
type SidebarUser = {
|
|
5
|
+
name: string;
|
|
6
|
+
rol_principal: string;
|
|
7
|
+
avatarUrl?: string | null;
|
|
8
|
+
};
|
|
9
|
+
type SidebarItem = {
|
|
10
|
+
key: string;
|
|
11
|
+
label: string;
|
|
12
|
+
group: string;
|
|
13
|
+
icon?: React__default.ComponentType<{
|
|
14
|
+
className?: string;
|
|
15
|
+
}>;
|
|
16
|
+
path?: string;
|
|
17
|
+
children?: SidebarItem[];
|
|
18
|
+
};
|
|
19
|
+
type SidebarProps = {
|
|
20
|
+
items: SidebarItem[];
|
|
21
|
+
activeKey?: string;
|
|
22
|
+
onNavigate: (key: string) => void;
|
|
23
|
+
user?: SidebarUser;
|
|
24
|
+
userMenuSlot?: React__default.ReactNode;
|
|
25
|
+
onBrandClick?: () => void;
|
|
26
|
+
/** LocalStorage key para persistir colapsado */
|
|
27
|
+
collapsedKey?: string;
|
|
28
|
+
/** Rotulación de marca, valores por defecto mantienen estilos existentes */
|
|
29
|
+
brandInitials?: string;
|
|
30
|
+
brandTitle?: string;
|
|
31
|
+
brandSubtitle?: string;
|
|
32
|
+
};
|
|
33
|
+
declare function Sidebar({ items, activeKey, onNavigate, user, userMenuSlot, onBrandClick, collapsedKey, brandInitials, brandTitle, brandSubtitle, }: SidebarProps): react_jsx_runtime.JSX.Element;
|
|
34
|
+
|
|
35
|
+
export { type SidebarItem, type SidebarProps, type SidebarUser, Sidebar as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
type SidebarUser = {
|
|
5
|
+
name: string;
|
|
6
|
+
rol_principal: string;
|
|
7
|
+
avatarUrl?: string | null;
|
|
8
|
+
};
|
|
9
|
+
type SidebarItem = {
|
|
10
|
+
key: string;
|
|
11
|
+
label: string;
|
|
12
|
+
group: string;
|
|
13
|
+
icon?: React__default.ComponentType<{
|
|
14
|
+
className?: string;
|
|
15
|
+
}>;
|
|
16
|
+
path?: string;
|
|
17
|
+
children?: SidebarItem[];
|
|
18
|
+
};
|
|
19
|
+
type SidebarProps = {
|
|
20
|
+
items: SidebarItem[];
|
|
21
|
+
activeKey?: string;
|
|
22
|
+
onNavigate: (key: string) => void;
|
|
23
|
+
user?: SidebarUser;
|
|
24
|
+
userMenuSlot?: React__default.ReactNode;
|
|
25
|
+
onBrandClick?: () => void;
|
|
26
|
+
/** LocalStorage key para persistir colapsado */
|
|
27
|
+
collapsedKey?: string;
|
|
28
|
+
/** Rotulación de marca, valores por defecto mantienen estilos existentes */
|
|
29
|
+
brandInitials?: string;
|
|
30
|
+
brandTitle?: string;
|
|
31
|
+
brandSubtitle?: string;
|
|
32
|
+
};
|
|
33
|
+
declare function Sidebar({ items, activeKey, onNavigate, user, userMenuSlot, onBrandClick, collapsedKey, brandInitials, brandTitle, brandSubtitle, }: SidebarProps): react_jsx_runtime.JSX.Element;
|
|
34
|
+
|
|
35
|
+
export { type SidebarItem, type SidebarProps, type SidebarUser, Sidebar as default };
|