framepexls-ui-lib 0.1.4
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/ActionIconButton.d.mts +11 -0
- package/dist/ActionIconButton.d.ts +11 -0
- package/dist/ActionIconButton.js +71 -0
- package/dist/ActionIconButton.mjs +41 -0
- package/dist/AppTopbar.d.mts +17 -0
- package/dist/AppTopbar.d.ts +17 -0
- package/dist/AppTopbar.js +51 -0
- package/dist/AppTopbar.mjs +31 -0
- package/dist/AvatarSquare.d.mts +16 -0
- package/dist/AvatarSquare.d.ts +16 -0
- package/dist/AvatarSquare.js +82 -0
- package/dist/AvatarSquare.mjs +52 -0
- package/dist/Badge.d.mts +13 -0
- package/dist/Badge.d.ts +13 -0
- package/dist/Badge.js +65 -0
- package/dist/Badge.mjs +45 -0
- package/dist/BadgeCluster.d.mts +17 -0
- package/dist/BadgeCluster.d.ts +17 -0
- package/dist/BadgeCluster.js +125 -0
- package/dist/BadgeCluster.mjs +95 -0
- package/dist/Breadcrumb.d.mts +11 -0
- package/dist/Breadcrumb.d.ts +11 -0
- package/dist/Breadcrumb.js +42 -0
- package/dist/Breadcrumb.mjs +12 -0
- package/dist/Button.d.mts +15 -0
- package/dist/Button.d.ts +15 -0
- package/dist/Button.js +72 -0
- package/dist/Button.mjs +52 -0
- package/dist/CalendarPanel.d.mts +13 -0
- package/dist/CalendarPanel.d.ts +13 -0
- package/dist/CalendarPanel.js +110 -0
- package/dist/CalendarPanel.mjs +90 -0
- package/dist/ChartCard.d.mts +15 -0
- package/dist/ChartCard.d.ts +15 -0
- package/dist/ChartCard.js +44 -0
- package/dist/ChartCard.mjs +24 -0
- package/dist/CheckboxPillsGroup.d.mts +28 -0
- package/dist/CheckboxPillsGroup.d.ts +28 -0
- package/dist/CheckboxPillsGroup.js +186 -0
- package/dist/CheckboxPillsGroup.mjs +156 -0
- package/dist/ColumnSelector.d.mts +17 -0
- package/dist/ColumnSelector.d.ts +17 -0
- package/dist/ColumnSelector.js +74 -0
- package/dist/ColumnSelector.mjs +54 -0
- package/dist/ComboSelect.d.mts +46 -0
- package/dist/ComboSelect.d.ts +46 -0
- package/dist/ComboSelect.js +442 -0
- package/dist/ComboSelect.mjs +412 -0
- package/dist/DateTimeField.d.mts +22 -0
- package/dist/DateTimeField.d.ts +22 -0
- package/dist/DateTimeField.js +409 -0
- package/dist/DateTimeField.mjs +379 -0
- package/dist/Dialog.d.mts +82 -0
- package/dist/Dialog.d.ts +82 -0
- package/dist/Dialog.js +408 -0
- package/dist/Dialog.mjs +368 -0
- package/dist/Dropdown.d.mts +52 -0
- package/dist/Dropdown.d.ts +52 -0
- package/dist/Dropdown.js +333 -0
- package/dist/Dropdown.mjs +313 -0
- package/dist/EmptyState.d.mts +8 -0
- package/dist/EmptyState.d.ts +8 -0
- package/dist/EmptyState.js +35 -0
- package/dist/EmptyState.mjs +15 -0
- package/dist/InfoGrid.d.mts +20 -0
- package/dist/InfoGrid.d.ts +20 -0
- package/dist/InfoGrid.js +67 -0
- package/dist/InfoGrid.mjs +47 -0
- package/dist/Input.d.mts +20 -0
- package/dist/Input.d.ts +20 -0
- package/dist/Input.js +85 -0
- package/dist/Input.mjs +55 -0
- package/dist/Money.d.mts +8 -0
- package/dist/Money.d.ts +8 -0
- package/dist/Money.js +30 -0
- package/dist/Money.mjs +10 -0
- package/dist/OrderButton.d.mts +11 -0
- package/dist/OrderButton.d.ts +11 -0
- package/dist/OrderButton.js +39 -0
- package/dist/OrderButton.mjs +19 -0
- package/dist/Pagination.d.mts +12 -0
- package/dist/Pagination.d.ts +12 -0
- package/dist/Pagination.js +71 -0
- package/dist/Pagination.mjs +51 -0
- package/dist/SearchInput.d.mts +17 -0
- package/dist/SearchInput.d.ts +17 -0
- package/dist/SearchInput.js +116 -0
- package/dist/SearchInput.mjs +86 -0
- package/dist/Select.d.mts +31 -0
- package/dist/Select.d.ts +31 -0
- package/dist/Select.js +293 -0
- package/dist/Select.mjs +263 -0
- package/dist/StatCard.d.mts +15 -0
- package/dist/StatCard.d.ts +15 -0
- package/dist/StatCard.js +47 -0
- package/dist/StatCard.mjs +27 -0
- package/dist/Steps.d.mts +31 -0
- package/dist/Steps.d.ts +31 -0
- package/dist/Steps.js +123 -0
- package/dist/Steps.mjs +99 -0
- package/dist/Table.d.mts +31 -0
- package/dist/Table.d.ts +31 -0
- package/dist/Table.js +153 -0
- package/dist/Table.mjs +117 -0
- package/dist/TimeAgo.d.mts +12 -0
- package/dist/TimeAgo.d.ts +12 -0
- package/dist/TimeAgo.js +104 -0
- package/dist/TimeAgo.mjs +74 -0
- package/dist/TimePanel.d.mts +14 -0
- package/dist/TimePanel.d.ts +14 -0
- package/dist/TimePanel.js +145 -0
- package/dist/TimePanel.mjs +125 -0
- package/dist/TimePopover.d.mts +33 -0
- package/dist/TimePopover.d.ts +33 -0
- package/dist/TimePopover.js +441 -0
- package/dist/TimePopover.mjs +406 -0
- package/dist/iconos/index.d.mts +60 -0
- package/dist/iconos/index.d.ts +60 -0
- package/dist/iconos/index.js +621 -0
- package/dist/iconos/index.mjs +548 -0
- package/dist/index.d.mts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +141 -0
- package/dist/index.mjs +70 -0
- package/package.json +178 -0
package/dist/Dialog.mjs
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { useEffect, useRef } from "react";
|
|
4
|
+
import { motion, AnimatePresence } from "framer-motion";
|
|
5
|
+
import ActionIconButton from "./ActionIconButton";
|
|
6
|
+
const sizeToMaxW = {
|
|
7
|
+
sm: "max-w-sm",
|
|
8
|
+
md: "max-w-md",
|
|
9
|
+
lg: "max-w-lg",
|
|
10
|
+
xl: "max-w-xl",
|
|
11
|
+
"2xl": "max-w-2xl",
|
|
12
|
+
full: "max-w-[min(96vw,1200px)]"
|
|
13
|
+
};
|
|
14
|
+
function useLockBodyScroll(open) {
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!open) return;
|
|
17
|
+
const root = document.documentElement;
|
|
18
|
+
const body = document.body;
|
|
19
|
+
const prevOverflowRoot = root.style.overflow;
|
|
20
|
+
const prevOverflowBody = body.style.overflow;
|
|
21
|
+
const prevPadRightRoot = root.style.paddingRight;
|
|
22
|
+
const prevPadRightBody = body.style.paddingRight;
|
|
23
|
+
const scrollbarW = window.innerWidth - root.clientWidth;
|
|
24
|
+
root.style.overflow = "hidden";
|
|
25
|
+
body.style.overflow = body.style.overflow || "";
|
|
26
|
+
if (scrollbarW > 0) {
|
|
27
|
+
root.style.paddingRight = `${scrollbarW}px`;
|
|
28
|
+
body.style.paddingRight = `${scrollbarW}px`;
|
|
29
|
+
}
|
|
30
|
+
return () => {
|
|
31
|
+
root.style.overflow = prevOverflowRoot;
|
|
32
|
+
body.style.overflow = prevOverflowBody;
|
|
33
|
+
root.style.paddingRight = prevPadRightRoot;
|
|
34
|
+
body.style.paddingRight = prevPadRightBody;
|
|
35
|
+
};
|
|
36
|
+
}, [open]);
|
|
37
|
+
}
|
|
38
|
+
function useEscToClose(open, onClose, disabled) {
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!open || disabled) return;
|
|
41
|
+
const onKey = (e) => {
|
|
42
|
+
if (e.key === "Escape") onClose();
|
|
43
|
+
};
|
|
44
|
+
window.addEventListener("keydown", onKey);
|
|
45
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
46
|
+
}, [open, onClose, disabled]);
|
|
47
|
+
}
|
|
48
|
+
function cx(...a) {
|
|
49
|
+
return a.filter(Boolean).join(" ");
|
|
50
|
+
}
|
|
51
|
+
const CloseIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-4.5 w-4.5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" }) });
|
|
52
|
+
function DialogBase({
|
|
53
|
+
open,
|
|
54
|
+
onClose,
|
|
55
|
+
title,
|
|
56
|
+
description,
|
|
57
|
+
dismissibleBackdrop = true,
|
|
58
|
+
showClose = true,
|
|
59
|
+
size = "xl",
|
|
60
|
+
initialFocusRef,
|
|
61
|
+
className,
|
|
62
|
+
disableEscClose = false,
|
|
63
|
+
disableBackdropClose = false,
|
|
64
|
+
children
|
|
65
|
+
}) {
|
|
66
|
+
const containerRef = useRef(null);
|
|
67
|
+
const closeBtnRef = useRef(null);
|
|
68
|
+
const lastFocusedRef = useRef(null);
|
|
69
|
+
useLockBodyScroll(open);
|
|
70
|
+
useEscToClose(open, onClose, disableEscClose);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
var _a, _b, _c;
|
|
73
|
+
if (open) {
|
|
74
|
+
lastFocusedRef.current = document.activeElement;
|
|
75
|
+
const target = (_a = initialFocusRef == null ? void 0 : initialFocusRef.current) != null ? _a : closeBtnRef.current;
|
|
76
|
+
setTimeout(() => target == null ? void 0 : target.focus(), 0);
|
|
77
|
+
} else {
|
|
78
|
+
(_c = (_b = lastFocusedRef.current) == null ? void 0 : _b.focus) == null ? void 0 : _c.call(_b);
|
|
79
|
+
}
|
|
80
|
+
}, [open, initialFocusRef]);
|
|
81
|
+
const handleBackdropMouseDown = (e) => {
|
|
82
|
+
if (disableBackdropClose) return;
|
|
83
|
+
if (!dismissibleBackdrop) return;
|
|
84
|
+
if (e.target === e.currentTarget) onClose();
|
|
85
|
+
};
|
|
86
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
motion.div,
|
|
89
|
+
{
|
|
90
|
+
className: "fixed inset-0 z-[100] bg-black/45 backdrop-blur-sm",
|
|
91
|
+
initial: { opacity: 0 },
|
|
92
|
+
animate: { opacity: 1 },
|
|
93
|
+
exit: { opacity: 0 }
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ jsxs(
|
|
97
|
+
motion.div,
|
|
98
|
+
{
|
|
99
|
+
role: "dialog",
|
|
100
|
+
"aria-modal": "true",
|
|
101
|
+
"aria-labelledby": title ? "dialog-title" : void 0,
|
|
102
|
+
"aria-describedby": description ? "dialog-desc" : void 0,
|
|
103
|
+
className: "fixed inset-0 z-[101] grid place-items-center p-4",
|
|
104
|
+
initial: { opacity: 0, scale: 0.98, y: 8 },
|
|
105
|
+
animate: { opacity: 1, scale: 1, y: 0 },
|
|
106
|
+
exit: { opacity: 0, scale: 0.98, y: 8 },
|
|
107
|
+
onMouseDown: handleBackdropMouseDown,
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsx(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
ref: containerRef,
|
|
113
|
+
className: cx(
|
|
114
|
+
"w-full overflow-hidden rounded-3xl border border-slate-200 bg-white shadow-xl",
|
|
115
|
+
"dark:border-white/10 dark:bg-[#0e0d0e]",
|
|
116
|
+
"flex max-h-[88vh] flex-col",
|
|
117
|
+
sizeToMaxW[size],
|
|
118
|
+
className
|
|
119
|
+
),
|
|
120
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
121
|
+
children: children != null ? children : null
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
showClose && !children && /* @__PURE__ */ jsx("div", { className: "absolute right-5 top-5", children: /* @__PURE__ */ jsx(
|
|
125
|
+
ActionIconButton,
|
|
126
|
+
{
|
|
127
|
+
title: "Cerrar",
|
|
128
|
+
size: "lg",
|
|
129
|
+
onClick: onClose,
|
|
130
|
+
ref: closeBtnRef,
|
|
131
|
+
className: "shadow-sm",
|
|
132
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
133
|
+
}
|
|
134
|
+
) })
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
] }) });
|
|
139
|
+
}
|
|
140
|
+
function DialogHeader({
|
|
141
|
+
title,
|
|
142
|
+
description,
|
|
143
|
+
onClose,
|
|
144
|
+
showClose = true,
|
|
145
|
+
actions,
|
|
146
|
+
compact = false,
|
|
147
|
+
// 👈 nuevo
|
|
148
|
+
className
|
|
149
|
+
}) {
|
|
150
|
+
return /* @__PURE__ */ jsx("div", { className: cx("px-6", compact ? "pt-5 pb-2" : "pt-6 pb-3", className), children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
|
|
151
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
"h3",
|
|
154
|
+
{
|
|
155
|
+
id: "dialog-title",
|
|
156
|
+
className: cx("font-semibold tracking-tight", compact ? "text-lg leading-6" : "text-lg leading-6"),
|
|
157
|
+
children: title
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
description && /* @__PURE__ */ jsx(
|
|
161
|
+
"p",
|
|
162
|
+
{
|
|
163
|
+
id: "dialog-desc",
|
|
164
|
+
className: cx(compact ? "mt-1" : "mt-2", "text-sm text-slate-600 dark:text-slate-300"),
|
|
165
|
+
children: description
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
170
|
+
actions,
|
|
171
|
+
showClose && onClose && /* @__PURE__ */ jsx(ActionIconButton, { title: "Cerrar", size: "lg", onClick: onClose, className: "shadow-sm", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-4.5 w-4.5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" }) }) })
|
|
172
|
+
] })
|
|
173
|
+
] }) });
|
|
174
|
+
}
|
|
175
|
+
function DialogBody({ children, padded = true }) {
|
|
176
|
+
return /* @__PURE__ */ jsx("div", { className: cx("min-h-[60px] flex-1 overflow-auto", padded && "px-6 pb-6 pt-2"), children });
|
|
177
|
+
}
|
|
178
|
+
function DialogFooter({
|
|
179
|
+
children,
|
|
180
|
+
align = "end"
|
|
181
|
+
}) {
|
|
182
|
+
const map = {
|
|
183
|
+
start: "justify-start",
|
|
184
|
+
center: "justify-center",
|
|
185
|
+
end: "justify-end",
|
|
186
|
+
between: "justify-between"
|
|
187
|
+
};
|
|
188
|
+
return /* @__PURE__ */ jsx(
|
|
189
|
+
"div",
|
|
190
|
+
{
|
|
191
|
+
className: cx(
|
|
192
|
+
"sticky bottom-0 z-10 flex items-center gap-2 rounded-b-3xl border-t border-slate-200",
|
|
193
|
+
"bg-white px-6 py-4 text-sm",
|
|
194
|
+
"[box-shadow:inset_0_8px_10px_-8px_rgba(2,6,23,0.10)]",
|
|
195
|
+
"dark:border-white/10 dark:bg-[#0e0d0e] dark:[box-shadow:inset_0_8px_10px_-8px_rgba(255,255,255,0.08)]",
|
|
196
|
+
map[align]
|
|
197
|
+
),
|
|
198
|
+
children
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
function DialogField({
|
|
203
|
+
label,
|
|
204
|
+
hint,
|
|
205
|
+
required,
|
|
206
|
+
children,
|
|
207
|
+
className
|
|
208
|
+
}) {
|
|
209
|
+
return /* @__PURE__ */ jsxs("label", { className: cx("grid gap-1 text-sm content-start", className), children: [
|
|
210
|
+
label && /* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
211
|
+
label,
|
|
212
|
+
" ",
|
|
213
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-blue-600", children: "*" })
|
|
214
|
+
] }),
|
|
215
|
+
children,
|
|
216
|
+
hint && /* @__PURE__ */ jsx("span", { className: "text-xs text-slate-500 dark:text-slate-400", children: hint })
|
|
217
|
+
] });
|
|
218
|
+
}
|
|
219
|
+
function FormDialog({
|
|
220
|
+
open,
|
|
221
|
+
onClose,
|
|
222
|
+
title,
|
|
223
|
+
description,
|
|
224
|
+
children,
|
|
225
|
+
onSubmit,
|
|
226
|
+
submitLabel = "Aceptar",
|
|
227
|
+
cancelLabel = "Cerrar",
|
|
228
|
+
submitting = false,
|
|
229
|
+
submitDisabled = false,
|
|
230
|
+
error,
|
|
231
|
+
footerExtra,
|
|
232
|
+
footerAlign = "end",
|
|
233
|
+
...rest
|
|
234
|
+
}) {
|
|
235
|
+
const formId = React.useId();
|
|
236
|
+
return /* @__PURE__ */ jsxs(DialogBase, { open, onClose, title, description, ...rest, children: [
|
|
237
|
+
/* @__PURE__ */ jsx(DialogHeader, { title, description, onClose }),
|
|
238
|
+
/* @__PURE__ */ jsxs(DialogBody, { children: [
|
|
239
|
+
error && /* @__PURE__ */ jsx("div", { className: "mb-3 rounded-xl border border-blue-200/70 bg-blue-50 px-3 py-2 text-sm text-blue-700 dark:border-blue-500/30 dark:bg-blue-900/20 dark:text-blue-200", children: error }),
|
|
240
|
+
/* @__PURE__ */ jsx("form", { id: formId, onSubmit, className: "space-y-3", children })
|
|
241
|
+
] }),
|
|
242
|
+
/* @__PURE__ */ jsxs(DialogFooter, { align: footerAlign, children: [
|
|
243
|
+
footerExtra,
|
|
244
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
245
|
+
/* @__PURE__ */ jsx(
|
|
246
|
+
"button",
|
|
247
|
+
{
|
|
248
|
+
type: "button",
|
|
249
|
+
onClick: onClose,
|
|
250
|
+
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 active:scale-95 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:bg-white/10",
|
|
251
|
+
children: cancelLabel
|
|
252
|
+
}
|
|
253
|
+
),
|
|
254
|
+
/* @__PURE__ */ jsx(
|
|
255
|
+
"button",
|
|
256
|
+
{
|
|
257
|
+
type: "submit",
|
|
258
|
+
form: formId,
|
|
259
|
+
disabled: submitting || submitDisabled,
|
|
260
|
+
className: "inline-flex h-10 items-center gap-2 rounded-xl bg-slate-900 px-4 text-sm font-medium text-white shadow-sm hover:opacity-90 active:scale-95 disabled:opacity-60 dark:bg-white dark:text-slate-900",
|
|
261
|
+
children: submitting ? "Guardando\u2026" : submitLabel
|
|
262
|
+
}
|
|
263
|
+
)
|
|
264
|
+
] })
|
|
265
|
+
] })
|
|
266
|
+
] });
|
|
267
|
+
}
|
|
268
|
+
function ConfirmDialog({
|
|
269
|
+
open,
|
|
270
|
+
onClose,
|
|
271
|
+
title,
|
|
272
|
+
headerDescription,
|
|
273
|
+
// <— nuevo
|
|
274
|
+
description,
|
|
275
|
+
// body
|
|
276
|
+
confirmLabel = "Confirmar",
|
|
277
|
+
cancelLabel = "Cancelar",
|
|
278
|
+
danger,
|
|
279
|
+
loading,
|
|
280
|
+
onConfirm,
|
|
281
|
+
autoCloseOnConfirm = true,
|
|
282
|
+
disableEscClose,
|
|
283
|
+
disableBackdropClose
|
|
284
|
+
}) {
|
|
285
|
+
const [internalPending, setInternalPending] = React.useState(false);
|
|
286
|
+
const pending = loading != null ? loading : internalPending;
|
|
287
|
+
const confirmBtnRef = React.useRef(null);
|
|
288
|
+
const handleSubmit = async (e) => {
|
|
289
|
+
e == null ? void 0 : e.preventDefault();
|
|
290
|
+
try {
|
|
291
|
+
const result = onConfirm == null ? void 0 : onConfirm();
|
|
292
|
+
if (result && typeof result.then === "function") {
|
|
293
|
+
setInternalPending(true);
|
|
294
|
+
await result;
|
|
295
|
+
}
|
|
296
|
+
if (autoCloseOnConfirm) onClose();
|
|
297
|
+
} finally {
|
|
298
|
+
setInternalPending(false);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
return /* @__PURE__ */ jsxs(
|
|
302
|
+
DialogBase,
|
|
303
|
+
{
|
|
304
|
+
open,
|
|
305
|
+
onClose: pending ? () => {
|
|
306
|
+
} : onClose,
|
|
307
|
+
disableEscClose: disableEscClose || pending,
|
|
308
|
+
disableBackdropClose: disableBackdropClose || pending,
|
|
309
|
+
size: "md",
|
|
310
|
+
initialFocusRef: confirmBtnRef,
|
|
311
|
+
title,
|
|
312
|
+
description: headerDescription,
|
|
313
|
+
children: [
|
|
314
|
+
/* @__PURE__ */ jsx(DialogHeader, { title, onClose: pending ? void 0 : onClose, description: headerDescription }),
|
|
315
|
+
/* @__PURE__ */ jsx(DialogBody, { padded: true, children: typeof description === "string" ? /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-600 dark:text-slate-300", children: description }) : description != null ? description : null }),
|
|
316
|
+
/* @__PURE__ */ jsx(DialogFooter, { align: "end", children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "ml-auto flex items-center gap-2", children: [
|
|
317
|
+
/* @__PURE__ */ jsx(
|
|
318
|
+
"button",
|
|
319
|
+
{
|
|
320
|
+
type: "button",
|
|
321
|
+
onClick: onClose,
|
|
322
|
+
disabled: pending,
|
|
323
|
+
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 active:scale-95 disabled:opacity-60 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:bg-white/10",
|
|
324
|
+
children: cancelLabel
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
/* @__PURE__ */ jsxs(
|
|
328
|
+
"button",
|
|
329
|
+
{
|
|
330
|
+
ref: confirmBtnRef,
|
|
331
|
+
type: "submit",
|
|
332
|
+
disabled: pending,
|
|
333
|
+
className: [
|
|
334
|
+
"inline-flex h-10 items-center gap-2 rounded-xl px-4 text-sm font-semibold text-white shadow-sm active:scale-95 disabled:opacity-60",
|
|
335
|
+
danger ? "bg-blue-600 hover:bg-blue-700 focus-visible:ring-2 focus-visible:ring-blue-300" : "bg-slate-900 hover:opacity-90 focus-visible:ring-2 focus-visible:ring-slate-300 dark:bg-white dark:text-slate-900"
|
|
336
|
+
].join(" "),
|
|
337
|
+
children: [
|
|
338
|
+
pending && /* @__PURE__ */ jsxs("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", children: [
|
|
339
|
+
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
340
|
+
/* @__PURE__ */ jsx("path", { className: "opacity-75", d: "M4 12a8 8 0 018-8", stroke: "currentColor", strokeWidth: "4", strokeLinecap: "round" })
|
|
341
|
+
] }),
|
|
342
|
+
confirmLabel
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
)
|
|
346
|
+
] }) })
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
const Dialog = Object.assign(DialogBase, {
|
|
352
|
+
Header: DialogHeader,
|
|
353
|
+
Body: DialogBody,
|
|
354
|
+
Footer: DialogFooter,
|
|
355
|
+
Field: DialogField,
|
|
356
|
+
Confirm: ConfirmDialog
|
|
357
|
+
});
|
|
358
|
+
var Dialog_default = Dialog;
|
|
359
|
+
export {
|
|
360
|
+
ConfirmDialog,
|
|
361
|
+
Dialog,
|
|
362
|
+
DialogBody,
|
|
363
|
+
DialogField,
|
|
364
|
+
DialogFooter,
|
|
365
|
+
DialogHeader,
|
|
366
|
+
FormDialog,
|
|
367
|
+
Dialog_default as default
|
|
368
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { ReactNode, ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
declare function Dropdown({ children, align, onOpenChange, permissions, hasPermission, permStrategy, defaultHideUnauthorized, defaultDisableUnauthorized, }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
align?: "start" | "end";
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
permissions?: Iterable<string> | string[] | Set<string>;
|
|
9
|
+
hasPermission?: (perm: string) => boolean;
|
|
10
|
+
permStrategy?: "all" | "any";
|
|
11
|
+
defaultHideUnauthorized?: boolean;
|
|
12
|
+
defaultDisableUnauthorized?: boolean;
|
|
13
|
+
}): react_jsx_runtime.JSX.Element;
|
|
14
|
+
declare function Trigger({ children, className, ...btnProps }: {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "ref" | "children">): react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare function Content({ children, className, maxHeight, }: {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
className?: string;
|
|
21
|
+
maxHeight?: number;
|
|
22
|
+
}): React__default.ReactPortal | null;
|
|
23
|
+
declare function Label({ children }: {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}): react_jsx_runtime.JSX.Element;
|
|
26
|
+
declare function Separator({ className }: {
|
|
27
|
+
className?: string;
|
|
28
|
+
}): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare function Item({ children, icon, kbd, danger, disabled, require, hideIfUnauthorized, disableIfUnauthorized, onSelect, className, ...rest }: {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
kbd?: string;
|
|
33
|
+
danger?: boolean;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/** Permiso(s) requerido(s) para ver/ejecutar este item */
|
|
36
|
+
require?: string | string[];
|
|
37
|
+
/** Si no tiene permisos, ocultar por completo (default true, o el del Dropdown) */
|
|
38
|
+
hideIfUnauthorized?: boolean;
|
|
39
|
+
/** Si no tiene permisos, deshabilitar (default true si no se oculta) */
|
|
40
|
+
disableIfUnauthorized?: boolean;
|
|
41
|
+
onSelect?: () => void;
|
|
42
|
+
} & HTMLAttributes<HTMLButtonElement>): react_jsx_runtime.JSX.Element | null;
|
|
43
|
+
declare const DropdownExport: typeof Dropdown & {
|
|
44
|
+
Trigger: typeof Trigger;
|
|
45
|
+
Content: typeof Content;
|
|
46
|
+
Label: typeof Label;
|
|
47
|
+
Separator: typeof Separator;
|
|
48
|
+
Item: typeof Item;
|
|
49
|
+
MenuPuntosVerticalIcon: () => react_jsx_runtime.JSX.Element;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { Content, Dropdown, Item, Label, Separator, Trigger, DropdownExport as default };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { ReactNode, ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
declare function Dropdown({ children, align, onOpenChange, permissions, hasPermission, permStrategy, defaultHideUnauthorized, defaultDisableUnauthorized, }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
align?: "start" | "end";
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
permissions?: Iterable<string> | string[] | Set<string>;
|
|
9
|
+
hasPermission?: (perm: string) => boolean;
|
|
10
|
+
permStrategy?: "all" | "any";
|
|
11
|
+
defaultHideUnauthorized?: boolean;
|
|
12
|
+
defaultDisableUnauthorized?: boolean;
|
|
13
|
+
}): react_jsx_runtime.JSX.Element;
|
|
14
|
+
declare function Trigger({ children, className, ...btnProps }: {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "ref" | "children">): react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare function Content({ children, className, maxHeight, }: {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
className?: string;
|
|
21
|
+
maxHeight?: number;
|
|
22
|
+
}): React__default.ReactPortal | null;
|
|
23
|
+
declare function Label({ children }: {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}): react_jsx_runtime.JSX.Element;
|
|
26
|
+
declare function Separator({ className }: {
|
|
27
|
+
className?: string;
|
|
28
|
+
}): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare function Item({ children, icon, kbd, danger, disabled, require, hideIfUnauthorized, disableIfUnauthorized, onSelect, className, ...rest }: {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
kbd?: string;
|
|
33
|
+
danger?: boolean;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/** Permiso(s) requerido(s) para ver/ejecutar este item */
|
|
36
|
+
require?: string | string[];
|
|
37
|
+
/** Si no tiene permisos, ocultar por completo (default true, o el del Dropdown) */
|
|
38
|
+
hideIfUnauthorized?: boolean;
|
|
39
|
+
/** Si no tiene permisos, deshabilitar (default true si no se oculta) */
|
|
40
|
+
disableIfUnauthorized?: boolean;
|
|
41
|
+
onSelect?: () => void;
|
|
42
|
+
} & HTMLAttributes<HTMLButtonElement>): react_jsx_runtime.JSX.Element | null;
|
|
43
|
+
declare const DropdownExport: typeof Dropdown & {
|
|
44
|
+
Trigger: typeof Trigger;
|
|
45
|
+
Content: typeof Content;
|
|
46
|
+
Label: typeof Label;
|
|
47
|
+
Separator: typeof Separator;
|
|
48
|
+
Item: typeof Item;
|
|
49
|
+
MenuPuntosVerticalIcon: () => react_jsx_runtime.JSX.Element;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { Content, Dropdown, Item, Label, Separator, Trigger, DropdownExport as default };
|