prometeo-design-system 2.0.3 → 2.1.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.
package/dist/Input.es.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { j as t } from "./jsx-runtime-ByW6EXIE.js";
2
2
  import { Icons as J } from "./Icons.es.js";
3
3
  import { c as e } from "./cn-B6yFEsav.js";
4
- import { memo as xe, useState as v, useRef as K, useCallback as me, useEffect as L, useLayoutEffect as ge } from "react";
5
- import { useDebounce as he } from "use-debounce";
6
- import be from "./Spinner.es.js";
7
- const C = {
4
+ import { memo as xe, useState as H, useRef as K, useCallback as me, useEffect as L, useLayoutEffect as ge } from "react";
5
+ import { useDebounce as be } from "use-debounce";
6
+ import he from "./Spinner.es.js";
7
+ const j = {
8
8
  default: {
9
9
  container: "",
10
10
  input: e(
@@ -57,20 +57,20 @@ const C = {
57
57
  label: S,
58
58
  icon: a,
59
59
  iconPosition: g = "left",
60
- onChange: E,
60
+ onChange: P,
61
61
  value: u = "",
62
62
  debounceMs: c = 0,
63
- name: k,
64
- width: h = "100%",
63
+ name: E,
64
+ width: b = "100%",
65
65
  height: o,
66
66
  variant: f = "default",
67
67
  labelVariant: l = "default",
68
68
  size: Q = "medium",
69
- disabled: z = !1,
69
+ disabled: k = !1,
70
70
  type: r = "text",
71
71
  isFetching: d,
72
- errorComponent: P,
73
- helperComponent: R,
72
+ errorComponent: R,
73
+ helperComponent: v,
74
74
  placeholder: U,
75
75
  required: D = !1,
76
76
  onFocus: W,
@@ -83,7 +83,7 @@ const C = {
83
83
  style: q,
84
84
  readOnly: A = !1
85
85
  }) => {
86
- const [b, F] = v(u), [I] = he(b, c), [M, O] = v(i || !1), [B, ee] = v(!1), w = K(null), $ = K(null);
86
+ const [h, F] = H(u), [z] = be(h, c), [M, O] = H(i || !1), [I, ee] = H(!1), w = K(null), $ = K(null);
87
87
  let p = Q;
88
88
  o && (p = "customHeight");
89
89
  const x = {
@@ -111,10 +111,10 @@ const C = {
111
111
  label: "text-sm peer-focus:text-sm peer-placeholder-shown:text-xs ",
112
112
  icon: "w-6 h-6 right-3"
113
113
  }
114
- }, T = me(E, [E]);
114
+ }, T = me(P, []);
115
115
  L(() => {
116
- c > 0 && I !== u && T(I);
117
- }, [I, c, T, u]), L(() => {
116
+ c > 0 && z !== u && T(z);
117
+ }, [z, c, T, u]), L(() => {
118
118
  F(u);
119
119
  }, [u]), L(() => {
120
120
  i && $.current?.focus();
@@ -124,21 +124,21 @@ const C = {
124
124
  }, re = (s) => {
125
125
  i === void 0 && (O(!1), X?.(s));
126
126
  }, se = (s) => {
127
- const m = s.target.value, H = s.target.name, n = b;
128
- F(m), n.length > 0 && m.length === 0 && V?.(), (!c || c === 0) && E(m, H);
127
+ const m = s.target.value, N = s.target.name, n = h;
128
+ F(m), n.length > 0 && m.length === 0 && V?.(), (!c || c === 0) && P(m, N);
129
129
  }, oe = () => {
130
- ee(!B);
131
- }, N = {};
132
- h && h !== "100%" && (N.width = h), o && (N.height = o);
133
- const le = b.length > 0, G = f === "error" && P, ne = !G && R, ae = r === "password", ue = () => l === "static" || i || M || le ? "-top-2 left-2 scale-90" : a ? `top-1/2 -translate-y-1/2 ${g === "left" ? "ml-6" : "mr-6"} scale-100 ` : "top-1/2 -translate-y-1/2 scale-100", ce = () => l === "static" ? o ? "text-sm" : "text-xs" : o ? x.customHeight.label : x[p].label, fe = () => o ? { height: o } : {}, de = () => l === "default" ? S : U || S || "", ie = () => ae ? a ? g === "left" ? "pl-10 pr-10" : "pr-16" : "pr-10" : a ? g === "left" ? "pl-10 pr-3" : "pr-10 pl-3" : "", pe = l === "default" && "transition-all duration-200 ease-in-out";
130
+ ee(!I);
131
+ }, B = {};
132
+ b && b !== "100%" && (B.width = b), o && (B.height = o);
133
+ const le = h.length > 0, G = f === "error" && R, ne = !G && v, ae = r === "password", ue = () => l === "static" || i || M || le ? "-top-2 left-2 scale-90" : a ? `top-1/2 -translate-y-1/2 ${g === "left" ? "ml-6" : "mr-6"} scale-100 ` : "top-1/2 -translate-y-1/2 scale-100", ce = () => l === "static" ? o ? "text-sm" : "text-xs" : o ? x.customHeight.label : x[p].label, fe = () => o ? { height: o } : {}, de = () => l === "default" ? S : U || S || "", ie = () => ae ? a ? g === "left" ? "pl-10 pr-10" : "pr-16" : "pr-10" : a ? g === "left" ? "pl-10 pr-3" : "pr-10 pl-3" : "", pe = l === "default" && "transition-all duration-200 ease-in-out";
134
134
  return ge(() => {
135
135
  if (w.current) {
136
- const m = ((H) => {
137
- let n = H;
136
+ const m = ((N) => {
137
+ let n = N;
138
138
  for (; n && n !== document.body; ) {
139
- const j = window.getComputedStyle(n).backgroundColor;
140
- if (j && j !== "transparent" && j !== "rgba(0, 0, 0, 0)")
141
- return j;
139
+ const C = window.getComputedStyle(n).backgroundColor;
140
+ if (C && C !== "transparent" && C !== "rgba(0, 0, 0, 0)")
141
+ return C;
142
142
  n = n.parentElement;
143
143
  }
144
144
  const y = window.getComputedStyle(document.body).backgroundColor;
@@ -153,39 +153,39 @@ const C = {
153
153
  className: e(
154
154
  "relative",
155
155
  x[p].container,
156
- !h && "w-full",
156
+ !b && "w-full",
157
157
  "bg-inherit",
158
158
  l === "static" && "mt-2",
159
159
  _
160
160
  ),
161
- style: { ...q, ...N },
161
+ style: { ...q, ...B },
162
162
  children: [
163
163
  /* @__PURE__ */ t.jsx(
164
164
  "input",
165
165
  {
166
- id: k,
167
- name: k,
166
+ id: E,
167
+ name: E,
168
168
  ref: $,
169
- value: b,
169
+ value: h,
170
170
  placeholder: de(),
171
- type: r === "password" && B ? "text" : r,
171
+ type: r === "password" && I ? "text" : r,
172
172
  className: e(
173
173
  "peer w-full border-1 rounded-lg bg-transparent appearance-none transition-all duration-200 ease-in-out",
174
174
  "focus:outline-none px-3",
175
175
  l === "default" && "placeholder:text-transparent",
176
176
  l === "static" && "placeholder:text-neutral-medium-default placeholder:opacity-50",
177
177
  x[p].input,
178
- C[f].input,
178
+ j[f].input,
179
179
  a && "pr-10",
180
- z && "bg-transparent opacity-60 border-neutral-strong-default text-neutral-medium-disabled",
181
- C[f].container,
180
+ k && "bg-transparent opacity-60 border-neutral-strong-default text-neutral-medium-disabled",
181
+ j[f].container,
182
182
  ie()
183
183
  ),
184
184
  style: fe(),
185
185
  onChange: se,
186
186
  onFocus: te,
187
187
  onBlur: re,
188
- disabled: z,
188
+ disabled: k,
189
189
  required: D,
190
190
  onEmptied: V,
191
191
  onKeyDown: Y,
@@ -197,39 +197,40 @@ const C = {
197
197
  "label",
198
198
  {
199
199
  ref: w,
200
- htmlFor: k,
200
+ htmlFor: E,
201
201
  className: e(
202
202
  "absolute left-3 pointer-events-none px-1 z-10",
203
203
  pe,
204
204
  ce(),
205
- C[f].label,
205
+ j[f].label,
206
206
  ue(),
207
207
  D && "after:content-['*'] after:text-error-default after:ml-1",
208
- z && "text-neutral-medium-disabled prometeo-fonts-label-large"
208
+ k && "text-neutral-medium-disabled prometeo-fonts-label-large"
209
209
  ),
210
210
  children: S
211
211
  }
212
212
  ),
213
213
  (a || r === "password" || d) && /* @__PURE__ */ t.jsx(
214
- "div",
214
+ "button",
215
215
  {
216
+ type: "button",
216
217
  className: e(
217
218
  "absolute top-1/2 -translate-y-1/2 flex items-center justify-center z-10",
218
219
  x[p].icon,
219
- C[f].icon,
220
+ j[f].icon,
220
221
  r === "password" && !d ? "cursor-pointer" : "pointer-events-none",
221
222
  g === "right" ? "right-3" : "left-3"
222
223
  ),
223
224
  onClick: r === "password" && !d ? oe : void 0,
224
225
  onMouseDown: (s) => r === "password" && !d && s.preventDefault(),
225
- children: /* @__PURE__ */ t.jsx("div", { children: d && r !== "password" ? /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(be, { size: 24, color: "#7c86ff", loading: !0, variant: "clip" }) }) : r === "password" ? B ? /* @__PURE__ */ t.jsx(J.EyeVisibility, { size: 24, className: "" }) : /* @__PURE__ */ t.jsx(J.EyeVisibilityOff, { size: 24, className: "" }) : a })
226
+ children: /* @__PURE__ */ t.jsx("div", { children: d && r !== "password" ? /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(he, { size: 24, color: "#7c86ff", loading: !0, variant: "clip" }) }) : r === "password" ? I ? /* @__PURE__ */ t.jsx(J.EyeVisibility, { size: 24, className: "" }) : /* @__PURE__ */ t.jsx(J.EyeVisibilityOff, { size: 24, className: "" }) : a })
226
227
  }
227
228
  )
228
229
  ]
229
230
  }
230
231
  ),
231
- ne && R,
232
- G && P
232
+ ne && v,
233
+ G && R
233
234
  ] });
234
235
  }, Ie = xe(we);
235
236
  export {
@@ -4,12 +4,14 @@ export interface DrawerDesktopHandle {
4
4
  isOpen: boolean;
5
5
  }
6
6
  export interface DrawerDesktopProps {
7
- children: React.ReactNode;
8
- direction: 'left' | 'right';
7
+ children?: React.ReactNode;
8
+ direction?: 'left' | 'right';
9
9
  modal?: boolean;
10
10
  className?: string;
11
11
  onClose?: () => void;
12
12
  defaultOpen?: boolean;
13
+ attachToParent?: boolean;
14
+ closeOnOverlayClick?: boolean;
13
15
  }
14
- declare const DrawerDesktop: import('react').ForwardRefExoticComponent<DrawerDesktopProps & import('react').RefAttributes<DrawerDesktopHandle>>;
15
- export default DrawerDesktop;
16
+ declare const DrawerDesktopV2: import('react').ForwardRefExoticComponent<DrawerDesktopProps & import('react').RefAttributes<DrawerDesktopHandle>>;
17
+ export default DrawerDesktopV2;
@@ -0,0 +1,15 @@
1
+ export interface DrawerDesktopHandle {
2
+ open: () => void;
3
+ close: () => void;
4
+ isOpen: boolean;
5
+ }
6
+ export interface DrawerDesktopProps {
7
+ children: React.ReactNode;
8
+ direction: 'left' | 'right';
9
+ modal?: boolean;
10
+ className?: string;
11
+ onClose?: () => void;
12
+ defaultOpen?: boolean;
13
+ }
14
+ declare const DrawerDesktop: import('react').ForwardRefExoticComponent<DrawerDesktopProps & import('react').RefAttributes<DrawerDesktopHandle>>;
15
+ export default DrawerDesktop;