prometeo-design-system 7.2.4 → 7.2.5

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.
@@ -0,0 +1,6 @@
1
+ export * from './exports/AttachInput'
2
+ export {}
3
+ import PrometeoDesignSystem from './exports/AttachInput'
4
+ export default PrometeoDesignSystem
5
+ export * from './exports/AttachInput'
6
+ export {}
@@ -0,0 +1,206 @@
1
+ import { j as r } from "./jsx-runtime-GkKLlHH4.js";
2
+ import { c as s } from "./cn-B6yFEsav.js";
3
+ import { memo as T, forwardRef as H, useCallback as P } from "react";
4
+ import { useDropzone as E } from "react-dropzone";
5
+ import G from "./PlainTooltip.es.js";
6
+ import { H as _ } from "./HelperComponent-BFzIO-0g.js";
7
+ import { c as i } from "./index-BOQuZ0gG.js";
8
+ import { UploadCloud as q } from "./Icons/UploadCloud.es.js";
9
+ import { Info as K } from "./Icons/Info.es.js";
10
+ const O = i(
11
+ "relative w-full radius-large transition-colors duration-200 overflow-hidden flex flex-col items-center justify-center text-center gap-1 p-3",
12
+ {
13
+ variants: {
14
+ disabled: {
15
+ true: "cursor-default",
16
+ false: "hover:cursor-pointer group"
17
+ }
18
+ },
19
+ defaultVariants: {
20
+ disabled: !1
21
+ }
22
+ }
23
+ ), U = {
24
+ disabled: "text-[var(--border-disabled-ondisabled)]",
25
+ "drag-active": "text-[var(--border-brand-secondary-default)]",
26
+ "drag-reject": "text-[var(--border-error-onneutral-default)]",
27
+ default: "text-[var(--border-neutral-primary-default)]",
28
+ error: "text-[var(--border-error-onneutral-default)]",
29
+ success: "text-[var(--border-success-onneutral-default)]"
30
+ }, W = (t, e, n) => n ? "disabled" : e === "active" ? "drag-active" : e === "reject" ? "drag-reject" : t, J = i(
31
+ "prometeo-fonts-body-medium text-balanced text-neutral-secondary-default",
32
+ {
33
+ variants: {
34
+ disabled: {
35
+ true: "text-disabled-default!",
36
+ false: ""
37
+ }
38
+ },
39
+ defaultVariants: {
40
+ disabled: !1
41
+ }
42
+ }
43
+ ), L = i("icon-neutral-tertiary-default", {
44
+ variants: {
45
+ disabled: {
46
+ true: "icon-disabled-default!",
47
+ false: ""
48
+ }
49
+ }
50
+ }), Q = i(
51
+ "prometeo-fonts-label-large flex items-center px-3 gap-0.5",
52
+ {
53
+ variants: {
54
+ visualStatus: {
55
+ default: "text-neutral-secondary-default",
56
+ error: "text-semantic-error-onneutral-default",
57
+ success: "text-semantic-success-onneutral-default"
58
+ },
59
+ disabled: {
60
+ true: "text-disabled-default!",
61
+ false: ""
62
+ }
63
+ },
64
+ defaultVariants: {
65
+ visualStatus: "default",
66
+ disabled: !1
67
+ }
68
+ }
69
+ ), X = (t) => {
70
+ const e = t / 1048576;
71
+ return e < 1 ? `${Math.round(t / 1024)} KB` : e < 1024 ? `${e % 1 === 0 ? e : e.toFixed(1)} MB` : `${(e / 1024).toFixed(1)} GB`;
72
+ }, y = (t) => Object.keys(t).map((e) => t[e].join(", ")).join(" "), Y = (t, e, n) => {
73
+ if (t.some(
74
+ (d) => d.errors.some((u) => u.code === "too-many-files")
75
+ ))
76
+ return `Máximo ${e} ${e === 1 ? "archivo" : "archivos"} permitido${e === 1 ? "" : "s"}`;
77
+ const o = t.length;
78
+ return o === 1 ? "El archivo no pudo cargarse" : `${o} archivos no pudieron cargarse`;
79
+ }, Z = (t, e) => e ? "reject" : t ? "active" : "idle", N = H(
80
+ ({
81
+ onFilesAccepted: t,
82
+ onFilesRejected: e,
83
+ className: n,
84
+ label: c,
85
+ subtitle: o = "Arrastra y suelta los archivos aquí, o haz clic para seleccionar",
86
+ acceptedFormats: d,
87
+ status: u,
88
+ supportingText: f,
89
+ showSupportingText: w,
90
+ disabled: a = !1,
91
+ accept: m,
92
+ maxFiles: h = 1,
93
+ maxSize: p,
94
+ ...M
95
+ }, C) => {
96
+ const D = P(
97
+ (g, j) => {
98
+ g.length > 0 && t?.(g), j.length > 0 && e?.(j);
99
+ },
100
+ [t, e]
101
+ ), {
102
+ getRootProps: V,
103
+ getInputProps: $,
104
+ isDragActive: k,
105
+ isDragReject: A,
106
+ fileRejections: b
107
+ } = E({
108
+ onDrop: D,
109
+ accept: m,
110
+ maxFiles: h,
111
+ disabled: a,
112
+ maxSize: p,
113
+ ...M
114
+ }), v = b.length > 0, l = v ? "error" : u ?? "default", x = Z(k, A), R = W(l, x, a), S = U[R], I = v ? Y([...b], h) : typeof f == "function" ? f() : f, z = d ?? y(m ?? {}), B = y(m ?? {});
115
+ return /* @__PURE__ */ r.jsxs("div", { className: s("w-full flex flex-col gap-1", n), children: [
116
+ c && /* @__PURE__ */ r.jsx(
117
+ "label",
118
+ {
119
+ className: Q({
120
+ visualStatus: l,
121
+ disabled: a
122
+ }),
123
+ children: c
124
+ }
125
+ ),
126
+ /* @__PURE__ */ r.jsxs(
127
+ "div",
128
+ {
129
+ ref: C,
130
+ ...V(),
131
+ className: O({ disabled: a }),
132
+ children: [
133
+ /* @__PURE__ */ r.jsx("input", { ...$() }),
134
+ /* @__PURE__ */ r.jsx(
135
+ "svg",
136
+ {
137
+ "aria-hidden": !0,
138
+ className: s(
139
+ "absolute inset-0 w-full h-full pointer-events-none overflow-visible transition-colors duration-200",
140
+ S,
141
+ !a && x === "idle" && "group-hover:text-[var(--border-brand-secondary-hover)] group-active:text-[var(--border-brand-secondary-pressed)]"
142
+ ),
143
+ children: /* @__PURE__ */ r.jsx(
144
+ "rect",
145
+ {
146
+ x: "0.5",
147
+ y: "0.5",
148
+ width: "99%",
149
+ height: "99%",
150
+ rx: "15.5",
151
+ fill: "none",
152
+ stroke: "currentColor",
153
+ strokeDasharray: "8 8",
154
+ strokeWidth: x === "active" ? 2 : 1
155
+ }
156
+ )
157
+ }
158
+ ),
159
+ o && /* @__PURE__ */ r.jsx(
160
+ "p",
161
+ {
162
+ className: J({
163
+ disabled: a
164
+ }),
165
+ children: o
166
+ }
167
+ ),
168
+ /* @__PURE__ */ r.jsx(
169
+ q,
170
+ {
171
+ size: 20,
172
+ className: L({
173
+ disabled: a
174
+ })
175
+ }
176
+ ),
177
+ !v && /* @__PURE__ */ r.jsxs("div", { className: "w-full overflow-hidden flex justify-center items-center gap-0.5", children: [
178
+ /* @__PURE__ */ r.jsxs("p", { className: s("prometeo-fonts-body-xsmall text-neutral-tertiary-default line-clamp-1", a && "text-disabled-default!"), children: [
179
+ z,
180
+ p !== void 0 && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
181
+ " ",
182
+ "· Máx. ",
183
+ X(p)
184
+ ] })
185
+ ] }),
186
+ /* @__PURE__ */ r.jsx(G, { title: B, children: /* @__PURE__ */ r.jsx(
187
+ K,
188
+ {
189
+ size: 12,
190
+ className: s("icon-neutral-tertiary-default shrink-0", a && "icon-disabled-default!")
191
+ }
192
+ ) })
193
+ ] })
194
+ ]
195
+ }
196
+ ),
197
+ w && /* @__PURE__ */ r.jsx(_, { variant: l, disabled: a, className: s(l === "default" && !a && "[&>p]:text-neutral-tertiary-default! [&>svg]:icon-neutral-tertiary-default!"), children: I })
198
+ ] });
199
+ }
200
+ );
201
+ N.displayName = "AttachInput";
202
+ const ie = T(N);
203
+ export {
204
+ ie as AttachInput,
205
+ ie as default
206
+ };