framepexls-ui-lib 0.1.13 → 0.1.15
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 +1 -0
- package/dist/ActionIconButton.d.ts +1 -0
- package/dist/ActionIconButton.js +12 -9
- package/dist/ActionIconButton.mjs +13 -10
- package/dist/AppTopbar.js +23 -6
- package/dist/AppTopbar.mjs +13 -6
- package/dist/AvatarGroup.d.mts +14 -0
- package/dist/AvatarGroup.d.ts +14 -0
- package/dist/AvatarGroup.js +77 -0
- package/dist/AvatarGroup.mjs +47 -0
- package/dist/AvatarSquare.d.mts +2 -5
- package/dist/AvatarSquare.d.ts +2 -5
- package/dist/AvatarSquare.js +52 -3
- package/dist/AvatarSquare.mjs +52 -3
- package/dist/Badge.d.mts +2 -1
- package/dist/Badge.d.ts +2 -1
- package/dist/Badge.js +3 -1
- package/dist/Badge.mjs +3 -1
- package/dist/BadgeCluster.js +3 -3
- package/dist/BadgeCluster.mjs +3 -3
- package/dist/Button.d.mts +3 -4
- package/dist/Button.d.ts +3 -4
- package/dist/Button.js +96 -8
- package/dist/Button.mjs +86 -8
- package/dist/CalendarPanel.js +20 -3
- package/dist/CalendarPanel.mjs +10 -3
- package/dist/Card.d.mts +6 -0
- package/dist/Card.d.ts +6 -0
- package/dist/Card.js +52 -0
- package/dist/Card.mjs +22 -0
- package/dist/CheckboxPillsGroup.d.mts +2 -1
- package/dist/CheckboxPillsGroup.d.ts +2 -1
- package/dist/CheckboxPillsGroup.js +16 -12
- package/dist/CheckboxPillsGroup.mjs +16 -12
- package/dist/ColumnSelector.js +16 -2
- package/dist/ColumnSelector.mjs +6 -2
- package/dist/ComboSelect.d.mts +0 -2
- package/dist/ComboSelect.d.ts +0 -2
- package/dist/ComboSelect.js +8 -4
- package/dist/ComboSelect.mjs +8 -4
- package/dist/DateTimeField.d.mts +0 -5
- package/dist/DateTimeField.d.ts +0 -5
- package/dist/DateTimeField.js +17 -8
- package/dist/DateTimeField.mjs +17 -8
- package/dist/Dialog.d.mts +2 -5
- package/dist/Dialog.d.ts +2 -5
- package/dist/Dialog.js +21 -22
- package/dist/Dialog.mjs +21 -22
- package/dist/Drawer.d.mts +38 -0
- package/dist/Drawer.d.ts +38 -0
- package/dist/Drawer.js +139 -0
- package/dist/Drawer.mjs +102 -0
- package/dist/Dropdown.d.mts +0 -3
- package/dist/Dropdown.d.ts +0 -3
- package/dist/Dropdown.js +61 -42
- package/dist/Dropdown.mjs +51 -42
- package/dist/FiltersMultiSelect.d.mts +28 -0
- package/dist/FiltersMultiSelect.d.ts +28 -0
- package/dist/FiltersMultiSelect.js +136 -0
- package/dist/FiltersMultiSelect.mjs +106 -0
- package/dist/Input.d.mts +2 -0
- package/dist/Input.d.ts +2 -0
- package/dist/Input.js +20 -5
- package/dist/Input.mjs +20 -5
- package/dist/Link.d.mts +15 -0
- package/dist/Link.d.ts +15 -0
- package/dist/Link.js +93 -0
- package/dist/Link.mjs +63 -0
- package/dist/MediaCard.d.mts +15 -0
- package/dist/MediaCard.d.ts +15 -0
- package/dist/MediaCard.js +153 -0
- package/dist/MediaCard.mjs +123 -0
- package/dist/MediaSelector.d.mts +48 -0
- package/dist/MediaSelector.d.ts +48 -0
- package/dist/MediaSelector.js +225 -0
- package/dist/MediaSelector.mjs +195 -0
- package/dist/Money.d.mts +2 -1
- package/dist/Money.d.ts +2 -1
- package/dist/Money.js +26 -2
- package/dist/Money.mjs +26 -2
- package/dist/MultiComboSelect.js +6 -11
- package/dist/MultiComboSelect.mjs +6 -11
- package/dist/OrderButton.js +13 -1
- package/dist/OrderButton.mjs +3 -1
- package/dist/Pagination.d.mts +2 -1
- package/dist/Pagination.d.ts +2 -1
- package/dist/Pagination.js +40 -3
- package/dist/Pagination.mjs +30 -3
- package/dist/ReviewHistory.js +3 -9
- package/dist/ReviewHistory.mjs +3 -9
- package/dist/SearchInput.js +17 -42
- package/dist/SearchInput.mjs +17 -42
- package/dist/Select.js +5 -2
- package/dist/Select.mjs +5 -2
- package/dist/Sidebar.d.mts +2 -3
- package/dist/Sidebar.d.ts +2 -3
- package/dist/Sidebar.js +132 -24
- package/dist/Sidebar.mjs +132 -24
- package/dist/Steps.d.mts +0 -2
- package/dist/Steps.d.ts +0 -2
- package/dist/Steps.js +19 -6
- package/dist/Steps.mjs +9 -6
- package/dist/Table.js +3 -1
- package/dist/Table.mjs +3 -1
- package/dist/TimePanel.js +21 -7
- package/dist/TimePanel.mjs +11 -7
- package/dist/TimePopover.js +32 -15
- package/dist/TimePopover.mjs +32 -15
- package/dist/TimeRangeField.js +13 -6
- package/dist/TimeRangeField.mjs +13 -6
- package/dist/Toast.d.mts +53 -0
- package/dist/Toast.d.ts +53 -0
- package/dist/Toast.js +273 -0
- package/dist/Toast.mjs +238 -0
- package/dist/Tooltip.d.mts +15 -0
- package/dist/Tooltip.d.ts +15 -0
- package/dist/Tooltip.js +135 -0
- package/dist/Tooltip.mjs +105 -0
- package/dist/UploadCard.d.mts +27 -0
- package/dist/UploadCard.d.ts +27 -0
- package/dist/UploadCard.js +143 -0
- package/dist/UploadCard.mjs +113 -0
- package/dist/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +33 -1
- package/dist/index.mjs +78 -57
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type MediaSelectorItem = {
|
|
4
|
+
id: number | string;
|
|
5
|
+
nombre: string;
|
|
6
|
+
url?: string | null;
|
|
7
|
+
};
|
|
8
|
+
type MediosAdapter = {
|
|
9
|
+
items: MediaSelectorItem[];
|
|
10
|
+
page: number;
|
|
11
|
+
lastPage: number;
|
|
12
|
+
setPage: (p: number) => void;
|
|
13
|
+
obtenerMedios: (opts?: {
|
|
14
|
+
page?: number;
|
|
15
|
+
per_page?: number;
|
|
16
|
+
}) => Promise<any>;
|
|
17
|
+
subirMedio: (file: File, opts?: {
|
|
18
|
+
onProgress?: (p: {
|
|
19
|
+
porcentaje: number;
|
|
20
|
+
}) => void;
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
ok: boolean;
|
|
23
|
+
data?: any;
|
|
24
|
+
error?: any;
|
|
25
|
+
}>;
|
|
26
|
+
importFromUrl?: (url: string) => Promise<{
|
|
27
|
+
ok: boolean;
|
|
28
|
+
data?: any;
|
|
29
|
+
error?: any;
|
|
30
|
+
}>;
|
|
31
|
+
importarMedioDesdeUrl?: (url: string) => Promise<{
|
|
32
|
+
ok: boolean;
|
|
33
|
+
data?: any;
|
|
34
|
+
error?: any;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
declare function MediaSelector({ value, onChange, medios, accept, autoOpen, dialogOnly, onClose, }: {
|
|
38
|
+
value?: string | null;
|
|
39
|
+
onChange: (url: string | null, picked?: MediaSelectorItem | null) => void;
|
|
40
|
+
medios: MediosAdapter;
|
|
41
|
+
label?: string;
|
|
42
|
+
accept?: string;
|
|
43
|
+
autoOpen?: boolean;
|
|
44
|
+
dialogOnly?: boolean;
|
|
45
|
+
onClose?: () => void;
|
|
46
|
+
}): react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
export { type MediaSelectorItem, type MediosAdapter, MediaSelector as default };
|
|
@@ -0,0 +1,225 @@
|
|
|
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 MediaSelector_exports = {};
|
|
31
|
+
__export(MediaSelector_exports, {
|
|
32
|
+
default: () => MediaSelector
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(MediaSelector_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_ChartCard = __toESM(require("./ChartCard"));
|
|
38
|
+
var import_Button = __toESM(require("./Button"));
|
|
39
|
+
var import_Input = __toESM(require("./Input"));
|
|
40
|
+
var import_Dialog = __toESM(require("./Dialog"));
|
|
41
|
+
var import_Pagination = __toESM(require("./Pagination"));
|
|
42
|
+
function MediaSelector({
|
|
43
|
+
value,
|
|
44
|
+
onChange,
|
|
45
|
+
medios,
|
|
46
|
+
accept = "image/png,image/jpeg,image/jpg,image/webp,image/gif",
|
|
47
|
+
autoOpen,
|
|
48
|
+
dialogOnly,
|
|
49
|
+
onClose
|
|
50
|
+
}) {
|
|
51
|
+
const { obtenerMedios, items, page, lastPage, setPage, subirMedio } = medios;
|
|
52
|
+
const [openPicker, setOpenPicker] = (0, import_react.useState)(false);
|
|
53
|
+
const [uploading, setUploading] = (0, import_react.useState)(false);
|
|
54
|
+
const [progress, setProgress] = (0, import_react.useState)(0);
|
|
55
|
+
const inputRef = (0, import_react.useRef)(null);
|
|
56
|
+
const [linkValue, setLinkValue] = (0, import_react.useState)(value != null ? value : "");
|
|
57
|
+
const [linkLoading, setLinkLoading] = (0, import_react.useState)(false);
|
|
58
|
+
const [linkError, setLinkError] = (0, import_react.useState)(null);
|
|
59
|
+
(0, import_react.useEffect)(() => {
|
|
60
|
+
if (openPicker) obtenerMedios({ page: page || 1 });
|
|
61
|
+
}, [openPicker, page, obtenerMedios]);
|
|
62
|
+
(0, import_react.useEffect)(() => {
|
|
63
|
+
if (autoOpen) setOpenPicker(true);
|
|
64
|
+
}, [autoOpen]);
|
|
65
|
+
(0, import_react.useEffect)(() => {
|
|
66
|
+
if (openPicker) setLinkValue(value != null ? value : "");
|
|
67
|
+
}, [openPicker, value]);
|
|
68
|
+
const onFiles = async (files) => {
|
|
69
|
+
var _a, _b, _c, _d;
|
|
70
|
+
if (!(files == null ? void 0 : files.length)) return;
|
|
71
|
+
const file = files[0];
|
|
72
|
+
setUploading(true);
|
|
73
|
+
setProgress(0);
|
|
74
|
+
const res = await subirMedio(file, { onProgress: (p) => setProgress(p.porcentaje) });
|
|
75
|
+
setUploading(false);
|
|
76
|
+
if (res.ok) {
|
|
77
|
+
const url = (_d = (_c = (_a = res.data) == null ? void 0 : _a.url) != null ? _c : (_b = res.data) == null ? void 0 : _b.url) != null ? _d : null;
|
|
78
|
+
onChange(url, res.data);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const handleDrop = (e) => {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
onFiles(e.dataTransfer.files);
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
86
|
+
!dialogOnly && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Input.default, { value: value != null ? value : "", onChange: (e) => onChange(e.target.value || null), placeholder: "URL de imagen", clearable: true, onClear: () => onChange(null) }),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.default, { variant: "secondary", onClick: () => setOpenPicker(true), children: "Elegir" })
|
|
90
|
+
] }),
|
|
91
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "overflow-hidden rounded-2xl border border-slate-200 bg-white/60 p-2 dark:border-white/10 dark:bg-white/5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "aspect-video w-full overflow-hidden rounded-xl bg-slate-100", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: value, alt: "preview", className: "h-full w-full object-cover" }) }) })
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Dialog.default, { open: openPicker, onClose: () => {
|
|
94
|
+
setOpenPicker(false);
|
|
95
|
+
onClose == null ? void 0 : onClose();
|
|
96
|
+
}, size: "full", children: [
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Dialog.default.Header, { title: "Biblioteca de medios", description: "Selecciona una imagen o sube una nueva", onClose: () => {
|
|
98
|
+
setOpenPicker(false);
|
|
99
|
+
onClose == null ? void 0 : onClose();
|
|
100
|
+
} }),
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Dialog.default.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ChartCard.default, { className: "lg:col-span-1", title: "Subir imagen", subtitle: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Arrastra una imagen o selecci\xF3nala" }), right: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Input.default, { unstyled: true, ref: inputRef, type: "file", accept, className: "hidden", onChange: (e) => onFiles(e.target.files) }),
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.default, { onClick: () => {
|
|
105
|
+
var _a;
|
|
106
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
107
|
+
}, disabled: uploading, children: "Seleccionar" })
|
|
108
|
+
] }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
onDragOver: (e) => {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
e.dataTransfer.dropEffect = "copy";
|
|
114
|
+
},
|
|
115
|
+
onDrop: handleDrop,
|
|
116
|
+
onClick: () => {
|
|
117
|
+
var _a;
|
|
118
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
119
|
+
},
|
|
120
|
+
className: "flex cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-slate-300 bg-gradient-to-b from-white/90 to-white/60 p-8 text-center transition hover:border-slate-400 hover:bg-white/80 dark:border-white/10 dark:from-white/10 dark:to-white/5",
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", className: "h-8 w-8 text-slate-400", fill: "none", stroke: "currentColor", strokeWidth: "1.6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 16V4M7 9l5-5 5 5M20 16v3a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3" }) }),
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm font-medium", children: "Soltar imagen aqu\xED" }),
|
|
124
|
+
uploading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-3 w-full", children: [
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mb-1 text-xs text-slate-500", children: [
|
|
126
|
+
progress,
|
|
127
|
+
"%"
|
|
128
|
+
] }),
|
|
129
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-2 overflow-hidden rounded-full bg-slate-100 dark:bg-white/10", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-full bg-gradient-to-r from-emerald-500/70 to-emerald-500/20", style: { width: `${progress}%` } }) })
|
|
130
|
+
] })
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
) }),
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ChartCard.default, { className: "lg:col-span-1", title: "Desde enlace", subtitle: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Pega una URL http(s) v\xE1lida" }), compact: true, children: [
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
137
|
+
import_Input.default,
|
|
138
|
+
{
|
|
139
|
+
type: "url",
|
|
140
|
+
placeholder: "https://\u2026",
|
|
141
|
+
value: linkValue,
|
|
142
|
+
onChange: (e) => {
|
|
143
|
+
setLinkValue(e.target.value);
|
|
144
|
+
setLinkError(null);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
149
|
+
import_Button.default,
|
|
150
|
+
{
|
|
151
|
+
onClick: async () => {
|
|
152
|
+
var _a, _b, _c, _d;
|
|
153
|
+
if (!linkValue) return;
|
|
154
|
+
setLinkError(null);
|
|
155
|
+
const isHttp = /^https?:\/\//i.test(linkValue);
|
|
156
|
+
if (!isHttp) {
|
|
157
|
+
setLinkError("Ingresa un enlace v\xE1lido (http/https)");
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const importer = (_a = medios.importFromUrl) != null ? _a : medios.importarMedioDesdeUrl;
|
|
161
|
+
if (importer) {
|
|
162
|
+
setLinkLoading(true);
|
|
163
|
+
const res = await importer(linkValue);
|
|
164
|
+
setLinkLoading(false);
|
|
165
|
+
if (res && res.ok) {
|
|
166
|
+
const d = (_b = res.data) != null ? _b : res;
|
|
167
|
+
onChange((_c = d == null ? void 0 : d.url) != null ? _c : null, d != null ? d : null);
|
|
168
|
+
setOpenPicker(false);
|
|
169
|
+
onClose == null ? void 0 : onClose();
|
|
170
|
+
} else {
|
|
171
|
+
setLinkError(String((_d = res == null ? void 0 : res.error) != null ? _d : "No se pudo importar el enlace"));
|
|
172
|
+
}
|
|
173
|
+
} else {
|
|
174
|
+
onChange(linkValue || null, null);
|
|
175
|
+
setOpenPicker(false);
|
|
176
|
+
onClose == null ? void 0 : onClose();
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
disabled: !linkValue || linkLoading,
|
|
180
|
+
children: linkLoading ? "Importando\u2026" : "Usar"
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
] }),
|
|
184
|
+
linkError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-2 rounded-xl border border-rose-300/70 bg-rose-50 px-3 py-2 text-rose-900 text-xs", children: linkError })
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "lg:col-span-2 space-y-3", children: [
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
|
|
188
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-sm text-slate-500", children: [
|
|
189
|
+
"P\xE1gina ",
|
|
190
|
+
page,
|
|
191
|
+
" de ",
|
|
192
|
+
Math.max(1, lastPage)
|
|
193
|
+
] }),
|
|
194
|
+
lastPage > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Pagination.default, { page, totalPages: lastPage, onPageChange: setPage })
|
|
195
|
+
] }),
|
|
196
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4", children: items.map((m) => {
|
|
197
|
+
var _a;
|
|
198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
199
|
+
import_Button.default,
|
|
200
|
+
{
|
|
201
|
+
unstyled: true,
|
|
202
|
+
className: "group overflow-hidden rounded-2xl border border-slate-200 bg-white/70 p-1 text-left transition hover:shadow-md focus:outline-none focus:ring-2 focus:ring-slate-300 dark:border-white/10 dark:bg-white/5",
|
|
203
|
+
onClick: () => {
|
|
204
|
+
var _a2;
|
|
205
|
+
onChange((_a2 = m.url) != null ? _a2 : null, m);
|
|
206
|
+
setOpenPicker(false);
|
|
207
|
+
onClose == null ? void 0 : onClose();
|
|
208
|
+
},
|
|
209
|
+
children: [
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "aspect-square w-full overflow-hidden rounded-xl bg-slate-100", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: (_a = m.url) != null ? _a : "", alt: m.nombre, className: "h-full w-full object-cover transition group-hover:scale-[1.01]" }) }),
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "truncate p-1 text-xs", children: m.nombre })
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
m.id
|
|
215
|
+
);
|
|
216
|
+
}) })
|
|
217
|
+
] })
|
|
218
|
+
] }) }),
|
|
219
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Dialog.default.Footer, { align: "end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.default, { variant: "secondary", onClick: () => {
|
|
220
|
+
setOpenPicker(false);
|
|
221
|
+
onClose == null ? void 0 : onClose();
|
|
222
|
+
}, children: "Cerrar" }) })
|
|
223
|
+
] })
|
|
224
|
+
] });
|
|
225
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import ChartCard from "./ChartCard";
|
|
5
|
+
import Button from "./Button";
|
|
6
|
+
import Input from "./Input";
|
|
7
|
+
import Dialog from "./Dialog";
|
|
8
|
+
import Pagination from "./Pagination";
|
|
9
|
+
function MediaSelector({
|
|
10
|
+
value,
|
|
11
|
+
onChange,
|
|
12
|
+
medios,
|
|
13
|
+
accept = "image/png,image/jpeg,image/jpg,image/webp,image/gif",
|
|
14
|
+
autoOpen,
|
|
15
|
+
dialogOnly,
|
|
16
|
+
onClose
|
|
17
|
+
}) {
|
|
18
|
+
const { obtenerMedios, items, page, lastPage, setPage, subirMedio } = medios;
|
|
19
|
+
const [openPicker, setOpenPicker] = useState(false);
|
|
20
|
+
const [uploading, setUploading] = useState(false);
|
|
21
|
+
const [progress, setProgress] = useState(0);
|
|
22
|
+
const inputRef = useRef(null);
|
|
23
|
+
const [linkValue, setLinkValue] = useState(value != null ? value : "");
|
|
24
|
+
const [linkLoading, setLinkLoading] = useState(false);
|
|
25
|
+
const [linkError, setLinkError] = useState(null);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (openPicker) obtenerMedios({ page: page || 1 });
|
|
28
|
+
}, [openPicker, page, obtenerMedios]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (autoOpen) setOpenPicker(true);
|
|
31
|
+
}, [autoOpen]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (openPicker) setLinkValue(value != null ? value : "");
|
|
34
|
+
}, [openPicker, value]);
|
|
35
|
+
const onFiles = async (files) => {
|
|
36
|
+
var _a, _b, _c, _d;
|
|
37
|
+
if (!(files == null ? void 0 : files.length)) return;
|
|
38
|
+
const file = files[0];
|
|
39
|
+
setUploading(true);
|
|
40
|
+
setProgress(0);
|
|
41
|
+
const res = await subirMedio(file, { onProgress: (p) => setProgress(p.porcentaje) });
|
|
42
|
+
setUploading(false);
|
|
43
|
+
if (res.ok) {
|
|
44
|
+
const url = (_d = (_c = (_a = res.data) == null ? void 0 : _a.url) != null ? _c : (_b = res.data) == null ? void 0 : _b.url) != null ? _d : null;
|
|
45
|
+
onChange(url, res.data);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const handleDrop = (e) => {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
onFiles(e.dataTransfer.files);
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
53
|
+
!dialogOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
55
|
+
/* @__PURE__ */ jsx(Input, { value: value != null ? value : "", onChange: (e) => onChange(e.target.value || null), placeholder: "URL de imagen", clearable: true, onClear: () => onChange(null) }),
|
|
56
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => setOpenPicker(true), children: "Elegir" })
|
|
57
|
+
] }),
|
|
58
|
+
value && /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-2xl border border-slate-200 bg-white/60 p-2 dark:border-white/10 dark:bg-white/5", children: /* @__PURE__ */ jsx("div", { className: "aspect-video w-full overflow-hidden rounded-xl bg-slate-100", children: /* @__PURE__ */ jsx("img", { src: value, alt: "preview", className: "h-full w-full object-cover" }) }) })
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ jsxs(Dialog, { open: openPicker, onClose: () => {
|
|
61
|
+
setOpenPicker(false);
|
|
62
|
+
onClose == null ? void 0 : onClose();
|
|
63
|
+
}, size: "full", children: [
|
|
64
|
+
/* @__PURE__ */ jsx(Dialog.Header, { title: "Biblioteca de medios", description: "Selecciona una imagen o sube una nueva", onClose: () => {
|
|
65
|
+
setOpenPicker(false);
|
|
66
|
+
onClose == null ? void 0 : onClose();
|
|
67
|
+
} }),
|
|
68
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [
|
|
69
|
+
/* @__PURE__ */ jsx(ChartCard, { className: "lg:col-span-1", title: "Subir imagen", subtitle: /* @__PURE__ */ jsx("span", { children: "Arrastra una imagen o selecci\xF3nala" }), right: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(Input, { unstyled: true, ref: inputRef, type: "file", accept, className: "hidden", onChange: (e) => onFiles(e.target.files) }),
|
|
71
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => {
|
|
72
|
+
var _a;
|
|
73
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
74
|
+
}, disabled: uploading, children: "Seleccionar" })
|
|
75
|
+
] }), children: /* @__PURE__ */ jsxs(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
onDragOver: (e) => {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
e.dataTransfer.dropEffect = "copy";
|
|
81
|
+
},
|
|
82
|
+
onDrop: handleDrop,
|
|
83
|
+
onClick: () => {
|
|
84
|
+
var _a;
|
|
85
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
86
|
+
},
|
|
87
|
+
className: "flex cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-slate-300 bg-gradient-to-b from-white/90 to-white/60 p-8 text-center transition hover:border-slate-400 hover:bg-white/80 dark:border-white/10 dark:from-white/10 dark:to-white/5",
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-8 w-8 text-slate-400", fill: "none", stroke: "currentColor", strokeWidth: "1.6", children: /* @__PURE__ */ jsx("path", { d: "M12 16V4M7 9l5-5 5 5M20 16v3a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3" }) }),
|
|
90
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: "Soltar imagen aqu\xED" }),
|
|
91
|
+
uploading && /* @__PURE__ */ jsxs("div", { className: "mt-3 w-full", children: [
|
|
92
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-1 text-xs text-slate-500", children: [
|
|
93
|
+
progress,
|
|
94
|
+
"%"
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 overflow-hidden rounded-full bg-slate-100 dark:bg-white/10", children: /* @__PURE__ */ jsx("div", { className: "h-full bg-gradient-to-r from-emerald-500/70 to-emerald-500/20", style: { width: `${progress}%` } }) })
|
|
97
|
+
] })
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
) }),
|
|
101
|
+
/* @__PURE__ */ jsxs(ChartCard, { className: "lg:col-span-1", title: "Desde enlace", subtitle: /* @__PURE__ */ jsx("span", { children: "Pega una URL http(s) v\xE1lida" }), compact: true, children: [
|
|
102
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
Input,
|
|
105
|
+
{
|
|
106
|
+
type: "url",
|
|
107
|
+
placeholder: "https://\u2026",
|
|
108
|
+
value: linkValue,
|
|
109
|
+
onChange: (e) => {
|
|
110
|
+
setLinkValue(e.target.value);
|
|
111
|
+
setLinkError(null);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
Button,
|
|
117
|
+
{
|
|
118
|
+
onClick: async () => {
|
|
119
|
+
var _a, _b, _c, _d;
|
|
120
|
+
if (!linkValue) return;
|
|
121
|
+
setLinkError(null);
|
|
122
|
+
const isHttp = /^https?:\/\//i.test(linkValue);
|
|
123
|
+
if (!isHttp) {
|
|
124
|
+
setLinkError("Ingresa un enlace v\xE1lido (http/https)");
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const importer = (_a = medios.importFromUrl) != null ? _a : medios.importarMedioDesdeUrl;
|
|
128
|
+
if (importer) {
|
|
129
|
+
setLinkLoading(true);
|
|
130
|
+
const res = await importer(linkValue);
|
|
131
|
+
setLinkLoading(false);
|
|
132
|
+
if (res && res.ok) {
|
|
133
|
+
const d = (_b = res.data) != null ? _b : res;
|
|
134
|
+
onChange((_c = d == null ? void 0 : d.url) != null ? _c : null, d != null ? d : null);
|
|
135
|
+
setOpenPicker(false);
|
|
136
|
+
onClose == null ? void 0 : onClose();
|
|
137
|
+
} else {
|
|
138
|
+
setLinkError(String((_d = res == null ? void 0 : res.error) != null ? _d : "No se pudo importar el enlace"));
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
onChange(linkValue || null, null);
|
|
142
|
+
setOpenPicker(false);
|
|
143
|
+
onClose == null ? void 0 : onClose();
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
disabled: !linkValue || linkLoading,
|
|
147
|
+
children: linkLoading ? "Importando\u2026" : "Usar"
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] }),
|
|
151
|
+
linkError && /* @__PURE__ */ jsx("div", { className: "mt-2 rounded-xl border border-rose-300/70 bg-rose-50 px-3 py-2 text-rose-900 text-xs", children: linkError })
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ jsxs("div", { className: "lg:col-span-2 space-y-3", children: [
|
|
154
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
155
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm text-slate-500", children: [
|
|
156
|
+
"P\xE1gina ",
|
|
157
|
+
page,
|
|
158
|
+
" de ",
|
|
159
|
+
Math.max(1, lastPage)
|
|
160
|
+
] }),
|
|
161
|
+
lastPage > 1 && /* @__PURE__ */ jsx(Pagination, { page, totalPages: lastPage, onPageChange: setPage })
|
|
162
|
+
] }),
|
|
163
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4", children: items.map((m) => {
|
|
164
|
+
var _a;
|
|
165
|
+
return /* @__PURE__ */ jsxs(
|
|
166
|
+
Button,
|
|
167
|
+
{
|
|
168
|
+
unstyled: true,
|
|
169
|
+
className: "group overflow-hidden rounded-2xl border border-slate-200 bg-white/70 p-1 text-left transition hover:shadow-md focus:outline-none focus:ring-2 focus:ring-slate-300 dark:border-white/10 dark:bg-white/5",
|
|
170
|
+
onClick: () => {
|
|
171
|
+
var _a2;
|
|
172
|
+
onChange((_a2 = m.url) != null ? _a2 : null, m);
|
|
173
|
+
setOpenPicker(false);
|
|
174
|
+
onClose == null ? void 0 : onClose();
|
|
175
|
+
},
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ jsx("div", { className: "aspect-square w-full overflow-hidden rounded-xl bg-slate-100", children: /* @__PURE__ */ jsx("img", { src: (_a = m.url) != null ? _a : "", alt: m.nombre, className: "h-full w-full object-cover transition group-hover:scale-[1.01]" }) }),
|
|
178
|
+
/* @__PURE__ */ jsx("div", { className: "truncate p-1 text-xs", children: m.nombre })
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
m.id
|
|
182
|
+
);
|
|
183
|
+
}) })
|
|
184
|
+
] })
|
|
185
|
+
] }) }),
|
|
186
|
+
/* @__PURE__ */ jsx(Dialog.Footer, { align: "end", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => {
|
|
187
|
+
setOpenPicker(false);
|
|
188
|
+
onClose == null ? void 0 : onClose();
|
|
189
|
+
}, children: "Cerrar" }) })
|
|
190
|
+
] })
|
|
191
|
+
] });
|
|
192
|
+
}
|
|
193
|
+
export {
|
|
194
|
+
MediaSelector as default
|
|
195
|
+
};
|
package/dist/Money.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
declare function Money({ amount, currency }: {
|
|
3
|
+
declare function Money({ amount, currency, color }: {
|
|
4
4
|
amount: number;
|
|
5
5
|
currency?: string;
|
|
6
|
+
color?: "slate" | "gray" | "zinc" | "neutral" | "stone" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
|
|
6
7
|
}): react_jsx_runtime.JSX.Element;
|
|
7
8
|
|
|
8
9
|
export { Money as default };
|
package/dist/Money.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
declare function Money({ amount, currency }: {
|
|
3
|
+
declare function Money({ amount, currency, color }: {
|
|
4
4
|
amount: number;
|
|
5
5
|
currency?: string;
|
|
6
|
+
color?: "slate" | "gray" | "zinc" | "neutral" | "stone" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
|
|
6
7
|
}): react_jsx_runtime.JSX.Element;
|
|
7
8
|
|
|
8
9
|
export { Money as default };
|
package/dist/Money.js
CHANGED
|
@@ -23,8 +23,32 @@ __export(Money_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(Money_exports);
|
|
25
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
function Money({ amount, currency = "MXN" }) {
|
|
26
|
+
function Money({ amount, currency = "MXN", color = "blue" }) {
|
|
27
27
|
const s = amount.toLocaleString("es-MX", { style: "currency", currency });
|
|
28
|
-
const
|
|
28
|
+
const POS = {
|
|
29
|
+
slate: "font-semibold text-slate-600 dark:text-slate-400",
|
|
30
|
+
gray: "font-semibold text-gray-600 dark:text-gray-400",
|
|
31
|
+
zinc: "font-semibold text-zinc-600 dark:text-zinc-400",
|
|
32
|
+
neutral: "font-semibold text-neutral-600 dark:text-neutral-400",
|
|
33
|
+
stone: "font-semibold text-stone-600 dark:text-stone-400",
|
|
34
|
+
red: "font-semibold text-red-600 dark:text-red-400",
|
|
35
|
+
orange: "font-semibold text-orange-600 dark:text-orange-400",
|
|
36
|
+
amber: "font-semibold text-amber-600 dark:text-amber-400",
|
|
37
|
+
yellow: "font-semibold text-yellow-600 dark:text-yellow-400",
|
|
38
|
+
lime: "font-semibold text-lime-600 dark:text-lime-400",
|
|
39
|
+
green: "font-semibold text-green-600 dark:text-green-400",
|
|
40
|
+
emerald: "font-semibold text-emerald-600 dark:text-emerald-400",
|
|
41
|
+
teal: "font-semibold text-teal-600 dark:text-teal-400",
|
|
42
|
+
cyan: "font-semibold text-cyan-600 dark:text-cyan-400",
|
|
43
|
+
sky: "font-semibold text-sky-600 dark:text-sky-400",
|
|
44
|
+
blue: "font-semibold text-blue-600 dark:text-blue-400",
|
|
45
|
+
indigo: "font-semibold text-indigo-600 dark:text-indigo-400",
|
|
46
|
+
violet: "font-semibold text-violet-600 dark:text-violet-400",
|
|
47
|
+
purple: "font-semibold text-purple-600 dark:text-purple-400",
|
|
48
|
+
fuchsia: "font-semibold text-fuchsia-600 dark:text-fuchsia-400",
|
|
49
|
+
pink: "font-semibold text-pink-600 dark:text-pink-400",
|
|
50
|
+
rose: "font-semibold text-rose-600 dark:text-rose-400"
|
|
51
|
+
};
|
|
52
|
+
const cls = amount > 0 ? POS[color] : "text-slate-600";
|
|
29
53
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cls, children: s });
|
|
30
54
|
}
|
package/dist/Money.mjs
CHANGED
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
function Money({ amount, currency = "MXN" }) {
|
|
3
|
+
function Money({ amount, currency = "MXN", color = "blue" }) {
|
|
4
4
|
const s = amount.toLocaleString("es-MX", { style: "currency", currency });
|
|
5
|
-
const
|
|
5
|
+
const POS = {
|
|
6
|
+
slate: "font-semibold text-slate-600 dark:text-slate-400",
|
|
7
|
+
gray: "font-semibold text-gray-600 dark:text-gray-400",
|
|
8
|
+
zinc: "font-semibold text-zinc-600 dark:text-zinc-400",
|
|
9
|
+
neutral: "font-semibold text-neutral-600 dark:text-neutral-400",
|
|
10
|
+
stone: "font-semibold text-stone-600 dark:text-stone-400",
|
|
11
|
+
red: "font-semibold text-red-600 dark:text-red-400",
|
|
12
|
+
orange: "font-semibold text-orange-600 dark:text-orange-400",
|
|
13
|
+
amber: "font-semibold text-amber-600 dark:text-amber-400",
|
|
14
|
+
yellow: "font-semibold text-yellow-600 dark:text-yellow-400",
|
|
15
|
+
lime: "font-semibold text-lime-600 dark:text-lime-400",
|
|
16
|
+
green: "font-semibold text-green-600 dark:text-green-400",
|
|
17
|
+
emerald: "font-semibold text-emerald-600 dark:text-emerald-400",
|
|
18
|
+
teal: "font-semibold text-teal-600 dark:text-teal-400",
|
|
19
|
+
cyan: "font-semibold text-cyan-600 dark:text-cyan-400",
|
|
20
|
+
sky: "font-semibold text-sky-600 dark:text-sky-400",
|
|
21
|
+
blue: "font-semibold text-blue-600 dark:text-blue-400",
|
|
22
|
+
indigo: "font-semibold text-indigo-600 dark:text-indigo-400",
|
|
23
|
+
violet: "font-semibold text-violet-600 dark:text-violet-400",
|
|
24
|
+
purple: "font-semibold text-purple-600 dark:text-purple-400",
|
|
25
|
+
fuchsia: "font-semibold text-fuchsia-600 dark:text-fuchsia-400",
|
|
26
|
+
pink: "font-semibold text-pink-600 dark:text-pink-400",
|
|
27
|
+
rose: "font-semibold text-rose-600 dark:text-rose-400"
|
|
28
|
+
};
|
|
29
|
+
const cls = amount > 0 ? POS[color] : "text-slate-600";
|
|
6
30
|
return /* @__PURE__ */ jsx("span", { className: cls, children: s });
|
|
7
31
|
}
|
|
8
32
|
export {
|
package/dist/MultiComboSelect.js
CHANGED
|
@@ -36,6 +36,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_ComboSelect = __toESM(require("./ComboSelect"));
|
|
38
38
|
var import_Dialog = __toESM(require("./Dialog"));
|
|
39
|
+
var import_Button = __toESM(require("./Button"));
|
|
39
40
|
var import_Badge = __toESM(require("./Badge"));
|
|
40
41
|
function MultiComboSelect({
|
|
41
42
|
options,
|
|
@@ -99,8 +100,9 @@ function MultiComboSelect({
|
|
|
99
100
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Badge.default, { tone: "slate", size: "sm", onClick: () => toggle(v), title: "Quitar", children: opt.label }, v);
|
|
100
101
|
}),
|
|
101
102
|
enableDialog && value.length > maxVisibleTags && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
102
|
-
|
|
103
|
+
import_Button.default,
|
|
103
104
|
{
|
|
105
|
+
unstyled: true,
|
|
104
106
|
type: "button",
|
|
105
107
|
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",
|
|
106
108
|
onClick: () => setDialogOpen(true),
|
|
@@ -127,8 +129,9 @@ function MultiComboSelect({
|
|
|
127
129
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "truncate", children: opt.label })
|
|
128
130
|
] }),
|
|
129
131
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
|
-
|
|
132
|
+
import_Button.default,
|
|
131
133
|
{
|
|
134
|
+
unstyled: true,
|
|
132
135
|
type: "button",
|
|
133
136
|
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",
|
|
134
137
|
onClick: () => toggle(v),
|
|
@@ -138,15 +141,7 @@ function MultiComboSelect({
|
|
|
138
141
|
] }, v);
|
|
139
142
|
})
|
|
140
143
|
] }) }),
|
|
141
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Dialog.default.Footer, { align: "end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
142
|
-
"button",
|
|
143
|
-
{
|
|
144
|
-
type: "button",
|
|
145
|
-
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",
|
|
146
|
-
onClick: () => setDialogOpen(false),
|
|
147
|
-
children: "Cerrar"
|
|
148
|
-
}
|
|
149
|
-
) })
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Dialog.default.Footer, { align: "end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.default, { variant: "secondary", size: "md", className: "shadow-sm", onClick: () => setDialogOpen(false), children: "Cerrar" }) })
|
|
150
145
|
] })
|
|
151
146
|
] });
|
|
152
147
|
}
|