prometeo-design-system 8.2.5 → 8.3.0

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.
Files changed (33) hide show
  1. package/dist/ChipSelect.d.ts +6 -0
  2. package/dist/ChipSelect.es.js +197 -0
  3. package/dist/DatePickerPill.d.ts +6 -0
  4. package/dist/DatePickerPill.es.js +111 -0
  5. package/dist/FileChip.d.ts +6 -0
  6. package/dist/FileChip.es.js +89 -0
  7. package/dist/Input.es.js +218 -163
  8. package/dist/components/ChipSelect/ChipSelect.d.ts +20 -0
  9. package/dist/components/ChipSelect/index.d.ts +2 -0
  10. package/dist/components/ChipSelect/types.d.ts +54 -0
  11. package/dist/components/DatePickerPill/DatePickerPill.d.ts +16 -0
  12. package/dist/components/DatePickerPill/index.d.ts +2 -0
  13. package/dist/components/DatePickerPill/types.d.ts +24 -0
  14. package/dist/components/FileChip/FileChip.d.ts +12 -0
  15. package/dist/components/FileChip/index.d.ts +2 -0
  16. package/dist/components/FileChip/types.d.ts +23 -0
  17. package/dist/components/Input/styles.d.ts +26 -1
  18. package/dist/components/Input/types.d.ts +16 -0
  19. package/dist/exports/ChipSelect.d.ts +2 -0
  20. package/dist/exports/DatePickerPill.d.ts +2 -0
  21. package/dist/exports/FileChip.d.ts +2 -0
  22. package/dist/index.d.ts +4 -0
  23. package/dist/prometeo-design-system.es.js +166 -162
  24. package/dist/styles.css +1 -1
  25. package/package.json +13 -1
  26. package/src/styles/tokens.css +1 -1
  27. package/src/styles/utilities/background.css +1 -1
  28. package/src/styles/utilities/border.css +1 -1
  29. package/src/styles/utilities/dataviz.css +1 -1
  30. package/src/styles/utilities/icon.css +1 -1
  31. package/src/styles/utilities/os.css +1 -1
  32. package/src/styles/utilities/size.css +1 -1
  33. package/src/styles/utilities/text.css +1 -1
@@ -0,0 +1,6 @@
1
+ export * from './exports/ChipSelect'
2
+ export {}
3
+ import PrometeoDesignSystem from './exports/ChipSelect'
4
+ export default PrometeoDesignSystem
5
+ export * from './exports/ChipSelect'
6
+ export {}
@@ -0,0 +1,197 @@
1
+ import { j as t } from "./jsx-runtime-GkKLlHH4.js";
2
+ import { c as I } from "./cn-B6yFEsav.js";
3
+ import { g as n } from "./utils-X4-h3cum.js";
4
+ import { useRef as m, useState as Q, useMemo as re, useEffect as le } from "react";
5
+ import ae from "./Popover.es.js";
6
+ import { Search as ne } from "./Icon-Search.es.js";
7
+ import { CheckSmall as oe } from "./Icon-CheckSmall.es.js";
8
+ function se({
9
+ label: o,
10
+ icon: T,
11
+ display: G,
12
+ error: U,
13
+ disabled: x,
14
+ isLoading: a,
15
+ searchable: y,
16
+ emptyMessage: V = "No hay opciones disponibles",
17
+ options: s,
18
+ optionValue: $,
19
+ optionLabel: b,
20
+ optionGroup: N,
21
+ optionLeading: k,
22
+ selectedValues: C,
23
+ multiple: H,
24
+ onToggle: J,
25
+ onClear: S,
26
+ disabledReason: M,
27
+ readOnly: W,
28
+ limitReached: D,
29
+ limitMessage: A,
30
+ searchValue: X,
31
+ onSearchChange: h,
32
+ className: Y
33
+ }) {
34
+ const g = m(null), q = m(null), v = m(null), j = m(null), [u, B] = Q(!1), [c, E] = Q(""), w = C.length > 0, i = h !== void 0, Z = i ? X ?? "" : c, R = re(() => {
35
+ if (i || !c.trim()) return s;
36
+ const e = c.trim().toLowerCase();
37
+ return s.filter(
38
+ (r) => n(r, b).toLowerCase().includes(e)
39
+ );
40
+ }, [s, c, i, b]);
41
+ le(() => {
42
+ u && requestAnimationFrame(() => {
43
+ if (y && j.current) {
44
+ j.current.focus();
45
+ return;
46
+ }
47
+ v.current?.querySelector('[role="option"]')?.focus();
48
+ });
49
+ }, [u, y]);
50
+ const d = () => {
51
+ q.current?.close(), g.current?.focus();
52
+ }, K = (e) => {
53
+ const r = Array.from(
54
+ v.current?.querySelectorAll('[role="option"]') ?? []
55
+ );
56
+ if (r.length === 0) return;
57
+ const f = document.activeElement, l = f ? r.indexOf(f) : -1;
58
+ r[(l + e + r.length) % r.length]?.focus();
59
+ }, _ = (e) => {
60
+ if (e.key === "Escape") {
61
+ e.stopPropagation(), d();
62
+ return;
63
+ }
64
+ e.key === "ArrowDown" && (e.preventDefault(), K(1)), e.key === "ArrowUp" && (e.preventDefault(), K(-1));
65
+ }, L = (e) => {
66
+ e.key === "Escape" && u && (e.stopPropagation(), d());
67
+ }, ee = (e) => {
68
+ J(e), H || d();
69
+ }, O = !!x || !!W;
70
+ let P;
71
+ return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
72
+ /* @__PURE__ */ t.jsxs(
73
+ "button",
74
+ {
75
+ ref: g,
76
+ type: "button",
77
+ disabled: O,
78
+ "aria-label": o,
79
+ "aria-haspopup": "listbox",
80
+ "aria-expanded": u,
81
+ title: x ? M : void 0,
82
+ onKeyDown: L,
83
+ className: I(
84
+ "inline-flex h-8 items-center gap-1.5 rounded-full border px-3 transition-colors",
85
+ "pyrion-fonts-label-medium",
86
+ O ? "cursor-default" : "cursor-pointer",
87
+ w ? "bg-neutral-secondary-default border-neutral-default-default text-neutral-secondary-default" : "border-dashed border-neutral-default-default bg-transparent text-neutral-tertiary-default",
88
+ U && "border-dashed border-(--text-semantic-error-onneutral-default) text-semantic-error-onneutral-default",
89
+ // En lectura el chip no se apaga: el valor tiene que seguir legible.
90
+ // El que se atenúa es el deshabilitado, que sí es un bloqueo temporal.
91
+ x && "opacity-50",
92
+ Y
93
+ ),
94
+ children: [
95
+ T,
96
+ w ? G : o
97
+ ]
98
+ }
99
+ ),
100
+ /* @__PURE__ */ t.jsx(
101
+ ae,
102
+ {
103
+ ref: q,
104
+ triggerRef: g,
105
+ trigger: "click",
106
+ hideIndicator: !0,
107
+ zIndex: 60,
108
+ onOpen: () => B(!0),
109
+ onClose: () => {
110
+ B(!1), E(""), h?.("");
111
+ },
112
+ className: "p-0!",
113
+ children: /* @__PURE__ */ t.jsxs(
114
+ "div",
115
+ {
116
+ onKeyDown: _,
117
+ className: "bg-neutral-primary-default border-neutral-default-default radius-large flex w-72 flex-col overflow-hidden border",
118
+ children: [
119
+ y && /* @__PURE__ */ t.jsxs("div", { className: "border-neutral-default-default flex items-center gap-2 border-b px-3 py-2", children: [
120
+ /* @__PURE__ */ t.jsx(ne, { size: 16, className: "text-neutral-tertiary-default shrink-0" }),
121
+ /* @__PURE__ */ t.jsx(
122
+ "input",
123
+ {
124
+ ref: j,
125
+ value: Z,
126
+ onChange: (e) => i ? h?.(e.target.value) : E(e.target.value),
127
+ placeholder: `Buscar ${o.toLowerCase()}…`,
128
+ className: "pyrion-fonts-body-small text-neutral-primary-default placeholder:text-neutral-tertiary-default w-full bg-transparent outline-none"
129
+ }
130
+ )
131
+ ] }),
132
+ /* @__PURE__ */ t.jsxs(
133
+ "div",
134
+ {
135
+ ref: v,
136
+ role: "listbox",
137
+ "aria-label": o,
138
+ className: "max-h-72 overflow-y-auto p-1",
139
+ children: [
140
+ a && /* @__PURE__ */ t.jsx("p", { className: "pyrion-fonts-body-small text-neutral-tertiary-default px-3 py-2", children: "Cargando…" }),
141
+ !a && R.length === 0 && /* @__PURE__ */ t.jsx("p", { className: "pyrion-fonts-body-small text-neutral-tertiary-default px-3 py-2", children: V }),
142
+ !a && R.map((e) => {
143
+ const r = n(e, $), f = n(e, b), l = N ? n(e, N) : void 0, z = k ? n(e, k) : void 0, p = C.includes(r), F = !!D && !p, te = l !== void 0 && l !== P;
144
+ return P = l, /* @__PURE__ */ t.jsxs("div", { children: [
145
+ te && /* @__PURE__ */ t.jsx("p", { className: "pyrion-fonts-label-small text-neutral-tertiary-default px-3 pt-2 pb-1", children: l }),
146
+ /* @__PURE__ */ t.jsxs(
147
+ "button",
148
+ {
149
+ type: "button",
150
+ role: "option",
151
+ "aria-selected": p,
152
+ disabled: F,
153
+ onClick: () => ee(r),
154
+ className: I(
155
+ "radius-medium flex w-full items-center gap-2 px-3 py-2 text-left transition-colors",
156
+ "pyrion-fonts-body-small text-neutral-primary-default",
157
+ "outline-none",
158
+ F ? "cursor-default opacity-45" : "hover:bg-neutral-secondary-default focus-visible:bg-neutral-secondary-default",
159
+ p && "bg-neutral-secondary-default"
160
+ ),
161
+ children: [
162
+ z,
163
+ /* @__PURE__ */ t.jsx("span", { className: "flex-1 truncate", children: f }),
164
+ p && /* @__PURE__ */ t.jsx(oe, { size: 16, className: "shrink-0" })
165
+ ]
166
+ }
167
+ )
168
+ ] }, r);
169
+ }),
170
+ D && A && !a && /* @__PURE__ */ t.jsx("p", { className: "pyrion-fonts-label-small border-neutral-default-default mt-1 border-t px-3 pt-2 pb-1 text-(--text-semantic-warning-onneutral-default)", children: A }),
171
+ S && w && !a && /* @__PURE__ */ t.jsx(
172
+ "button",
173
+ {
174
+ type: "button",
175
+ role: "option",
176
+ "aria-selected": !1,
177
+ onClick: () => {
178
+ S(), d();
179
+ },
180
+ className: "radius-medium pyrion-fonts-body-small text-neutral-tertiary-default hover:bg-neutral-secondary-default focus-visible:bg-neutral-secondary-default border-neutral-default-default mt-1 flex w-full items-center gap-2 border-t px-3 py-2 text-left outline-none",
181
+ children: "Quitar selección"
182
+ }
183
+ )
184
+ ]
185
+ }
186
+ )
187
+ ]
188
+ }
189
+ )
190
+ }
191
+ )
192
+ ] });
193
+ }
194
+ se.displayName = "ChipSelect";
195
+ export {
196
+ se as default
197
+ };
@@ -0,0 +1,6 @@
1
+ export * from './exports/DatePickerPill'
2
+ export {}
3
+ import PrometeoDesignSystem from './exports/DatePickerPill'
4
+ export default PrometeoDesignSystem
5
+ export * from './exports/DatePickerPill'
6
+ export {}
@@ -0,0 +1,111 @@
1
+ import { j as e } from "./jsx-runtime-GkKLlHH4.js";
2
+ import { c as k } from "./cn-B6yFEsav.js";
3
+ import { useRef as p, useState as D } from "react";
4
+ import { D as P } from "./DatePicker-CdLqTQWn.js";
5
+ import w from "./Popover.es.js";
6
+ import { CalendarToday as N } from "./Icon-CalendarToday.es.js";
7
+ import { CloseSmall as R } from "./Icon-CloseSmall.es.js";
8
+ const I = new Intl.DateTimeFormat("es-AR", { day: "numeric", month: "short" });
9
+ function K({
10
+ label: s,
11
+ value: t,
12
+ onChange: i,
13
+ error: m,
14
+ disabled: a,
15
+ disabledReason: x,
16
+ readOnly: n,
17
+ disabledDates: b,
18
+ clearLabel: y = "Quitar fecha",
19
+ className: g
20
+ }) {
21
+ const l = p(null), d = p(null), [c, u] = D(!1), f = !!a || !!n, o = () => {
22
+ d.current?.close(), l.current?.focus();
23
+ }, h = (r) => {
24
+ r.key === "Escape" && (r.stopPropagation(), o());
25
+ }, j = (r) => {
26
+ r.key === "Escape" && c && (r.stopPropagation(), o());
27
+ };
28
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
29
+ /* @__PURE__ */ e.jsx(
30
+ "button",
31
+ {
32
+ ref: l,
33
+ type: "button",
34
+ disabled: f,
35
+ "aria-label": s,
36
+ "aria-haspopup": "dialog",
37
+ "aria-expanded": c,
38
+ title: a ? x : void 0,
39
+ onKeyDown: j,
40
+ className: k(
41
+ "inline-flex h-8 items-center gap-1.5 rounded-full border px-3 transition-colors",
42
+ "pyrion-fonts-label-medium",
43
+ f ? "cursor-default" : "cursor-pointer",
44
+ t ? "bg-neutral-secondary-default border-neutral-default-default text-neutral-secondary-default" : "border-dashed border-neutral-default-default bg-transparent text-neutral-tertiary-default",
45
+ m && "border-dashed border-(--text-semantic-error-onneutral-default) text-semantic-error-onneutral-default",
46
+ // En lectura el chip no se apaga: el valor tiene que seguir legible.
47
+ // El que se atenúa es el deshabilitado, que sí es un bloqueo temporal.
48
+ a && "opacity-50",
49
+ g
50
+ ),
51
+ children: t ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
52
+ /* @__PURE__ */ e.jsx(N, { size: 14, className: "shrink-0" }),
53
+ I.format(t)
54
+ ] }) : `+ ${s}`
55
+ }
56
+ ),
57
+ /* @__PURE__ */ e.jsx(
58
+ w,
59
+ {
60
+ ref: d,
61
+ triggerRef: l,
62
+ trigger: "click",
63
+ hideIndicator: !0,
64
+ zIndex: 60,
65
+ onOpen: () => u(!0),
66
+ onClose: () => u(!1),
67
+ className: "p-0!",
68
+ children: /* @__PURE__ */ e.jsxs(
69
+ "div",
70
+ {
71
+ onKeyDown: h,
72
+ className: "bg-neutral-primary-default border-neutral-default-default radius-large flex flex-col overflow-hidden border",
73
+ children: [
74
+ /* @__PURE__ */ e.jsx(
75
+ P,
76
+ {
77
+ variant: "only-calendar",
78
+ mode: "single",
79
+ selected: t,
80
+ onSelect: (r) => {
81
+ i(r ?? void 0), o();
82
+ },
83
+ disabledDates: b,
84
+ disabled: n
85
+ }
86
+ ),
87
+ t && !n && /* @__PURE__ */ e.jsxs(
88
+ "button",
89
+ {
90
+ type: "button",
91
+ onClick: () => {
92
+ i(void 0), o();
93
+ },
94
+ className: "pyrion-fonts-body-small text-neutral-tertiary-default hover:bg-neutral-secondary-default border-neutral-default-default flex items-center gap-2 border-t px-3 py-2 text-left",
95
+ children: [
96
+ /* @__PURE__ */ e.jsx(R, { size: 14 }),
97
+ y
98
+ ]
99
+ }
100
+ )
101
+ ]
102
+ }
103
+ )
104
+ }
105
+ )
106
+ ] });
107
+ }
108
+ K.displayName = "DatePickerPill";
109
+ export {
110
+ K as default
111
+ };
@@ -0,0 +1,6 @@
1
+ export * from './exports/FileChip'
2
+ export {}
3
+ import PrometeoDesignSystem from './exports/FileChip'
4
+ export default PrometeoDesignSystem
5
+ export * from './exports/FileChip'
6
+ export {}
@@ -0,0 +1,89 @@
1
+ import { j as t } from "./jsx-runtime-GkKLlHH4.js";
2
+ import { c as o } from "./cn-B6yFEsav.js";
3
+ import { useState as p, useEffect as f } from "react";
4
+ import j from "./Spinner.es.js";
5
+ import { CloseSmall as y } from "./Icon-CloseSmall.es.js";
6
+ import { File as N } from "./Icon-File.es.js";
7
+ function F(e) {
8
+ return e instanceof globalThis.File ? e.type.startsWith("image/") : /\.(png|jpe?g|gif|webp|svg|bmp|ico)$/i.test(e.name);
9
+ }
10
+ function R({
11
+ file: e,
12
+ onOpenThumbnail: c,
13
+ onRemove: m,
14
+ isUploading: n = !1,
15
+ className: b
16
+ }) {
17
+ const l = F(e), [h, u] = p("");
18
+ f(() => {
19
+ if (!(e instanceof globalThis.File) || !l) {
20
+ u("");
21
+ return;
22
+ }
23
+ const a = URL.createObjectURL(e);
24
+ return u(a), () => URL.revokeObjectURL(a);
25
+ }, [e, l]);
26
+ const i = e instanceof globalThis.File ? h : e.url ?? "", [g, d] = p(!1);
27
+ f(() => {
28
+ d(!1);
29
+ }, [i]);
30
+ const x = l && !!i && !g, r = o(
31
+ "bg-neutral-primary-default grid h-8 w-8 shrink-0 place-items-center overflow-hidden rounded-md"
32
+ );
33
+ let s;
34
+ if (n)
35
+ s = /* @__PURE__ */ t.jsx("span", { className: r, children: /* @__PURE__ */ t.jsx(j, { size: "small", variant: "sync" }) });
36
+ else if (x) {
37
+ const a = (
38
+ // biome-ignore lint/a11y/noNoninteractiveElementInteractions: onError es manejo de carga, no interacción
39
+ /* @__PURE__ */ t.jsx(
40
+ "img",
41
+ {
42
+ src: i,
43
+ alt: e.name,
44
+ draggable: !1,
45
+ onError: () => d(!0),
46
+ className: "h-full w-full object-cover"
47
+ }
48
+ )
49
+ );
50
+ s = c ? /* @__PURE__ */ t.jsx(
51
+ "button",
52
+ {
53
+ type: "button",
54
+ onClick: c,
55
+ "aria-label": `Ver ${e.name}`,
56
+ className: o(r, "cursor-pointer transition-opacity hover:opacity-80"),
57
+ children: a
58
+ }
59
+ ) : /* @__PURE__ */ t.jsx("span", { className: r, children: a });
60
+ } else
61
+ s = /* @__PURE__ */ t.jsx("span", { className: r, children: /* @__PURE__ */ t.jsx(N, { size: 16, className: "text-neutral-tertiary-default" }) });
62
+ return /* @__PURE__ */ t.jsxs(
63
+ "div",
64
+ {
65
+ className: o(
66
+ "inline-flex max-w-60 items-center gap-2 rounded-lg border border-neutral-default-default bg-neutral-secondary-default p-1 pr-2",
67
+ n && "opacity-60",
68
+ b
69
+ ),
70
+ children: [
71
+ s,
72
+ /* @__PURE__ */ t.jsx("span", { className: "pyrion-fonts-body-small text-neutral-secondary-default truncate", children: e.name }),
73
+ m && !n && /* @__PURE__ */ t.jsx(
74
+ "button",
75
+ {
76
+ type: "button",
77
+ "aria-label": `Quitar ${e.name}`,
78
+ onClick: m,
79
+ className: "text-neutral-tertiary-default hover:text-neutral-primary-default shrink-0 cursor-pointer",
80
+ children: /* @__PURE__ */ t.jsx(y, { size: 16 })
81
+ }
82
+ )
83
+ ]
84
+ }
85
+ );
86
+ }
87
+ export {
88
+ R as default
89
+ };