prometeo-design-system 7.7.0 → 7.7.2

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/Dialog.es.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { j as n } from "./jsx-runtime-GkKLlHH4.js";
2
- import { useContext as Z, createContext as $, forwardRef as ee, memo as O, useRef as h, useState as R, useCallback as p, useEffect as I, useImperativeHandle as ne, useMemo as q } from "react";
2
+ import { useContext as Z, createContext as $, forwardRef as ee, memo as F, useRef as h, useState as I, useCallback as p, useEffect as k, useImperativeHandle as ne, useMemo as q } from "react";
3
3
  import { createPortal as te } from "react-dom";
4
- import { c as v } from "./cn-B6yFEsav.js";
5
- import { M as re } from "./MenuFloating-SbwgI4UF.js";
4
+ import { c as N } from "./cn-B6yFEsav.js";
5
+ import { M as re } from "./MenuFloating-ColYjZe9.js";
6
6
  import oe from "./CardBackground.es.js";
7
7
  import se from "./IconButton.es.js";
8
8
  import { Close as le } from "./Icons/Close.es.js";
@@ -15,16 +15,16 @@ function ae() {
15
15
  );
16
16
  return e;
17
17
  }
18
- const M = 100, k = O(function({
19
- title: r,
20
- description: t,
18
+ const M = 100, w = F(function({
19
+ title: t,
20
+ description: r,
21
21
  className: l
22
22
  }) {
23
- const { hideCloseButton: s, closeDialog: a } = ae();
24
- return /* @__PURE__ */ n.jsxs("div", { className: v("flex flex-col gap-4 pt-2 ", l), children: [
23
+ const { hideCloseButton: o, closeDialog: a } = ae();
24
+ return /* @__PURE__ */ n.jsxs("div", { className: N("flex flex-col gap-4 pt-2 ", l), children: [
25
25
  /* @__PURE__ */ n.jsxs("div", { className: "flex items-baseline justify-center gap-2 pl-4 pr-2 ", children: [
26
- r && /* @__PURE__ */ n.jsx("span", { className: "prometeo-fonts-title-medium text-neutral-default-default", children: r }),
27
- !s && /* @__PURE__ */ n.jsx("div", { className: "flex-1 flex justify-end", children: /* @__PURE__ */ n.jsx(
26
+ t && /* @__PURE__ */ n.jsx("span", { className: "prometeo-fonts-title-medium text-neutral-default-default", children: t }),
27
+ !o && /* @__PURE__ */ n.jsx("div", { className: "flex-1 flex justify-end", children: /* @__PURE__ */ n.jsx(
28
28
  se,
29
29
  {
30
30
  icon: le,
@@ -35,62 +35,62 @@ const M = 100, k = O(function({
35
35
  }
36
36
  ) })
37
37
  ] }),
38
- t && /* @__PURE__ */ n.jsx("p", { className: "prometeo-fonts-body-small text-neutral-secondary-default px-4", children: t })
38
+ r && /* @__PURE__ */ n.jsx("p", { className: "prometeo-fonts-body-small text-neutral-secondary-default px-4", children: r })
39
39
  ] });
40
40
  });
41
- k.displayName = "Dialog.Header";
42
- const P = O(function({
43
- children: r,
44
- className: t
41
+ w.displayName = "Dialog.Header";
42
+ const P = F(function({
43
+ children: t,
44
+ className: r
45
45
  }) {
46
- return /* @__PURE__ */ n.jsx("div", { className: v("px-4 py-0 flex flex-col gap-4 ", t), children: r });
46
+ return /* @__PURE__ */ n.jsx("div", { className: N("px-4 py-0 flex flex-col gap-4 ", r), children: t });
47
47
  });
48
48
  P.displayName = "Dialog.Content";
49
- const U = O(function({
50
- children: r,
51
- className: t
49
+ const U = F(function({
50
+ children: t,
51
+ className: r
52
52
  }) {
53
53
  return /* @__PURE__ */ n.jsx(
54
54
  "div",
55
55
  {
56
- className: v(
56
+ className: N(
57
57
  "p-4 pt-2 flex flex-row gap-3 items-center",
58
- t
58
+ r
59
59
  ),
60
- children: r
60
+ children: t
61
61
  }
62
62
  );
63
63
  });
64
64
  U.displayName = "Dialog.Footer";
65
- const X = O(function({
66
- layoutContext: r,
67
- shouldRenderChildren: t,
65
+ const X = F(function({
66
+ layoutContext: t,
67
+ shouldRenderChildren: r,
68
68
  hasAutoHeader: l,
69
- title: s,
69
+ title: o,
70
70
  description: a,
71
- cardBackground: o,
72
- className: c,
73
- children: i
71
+ cardBackground: i,
72
+ className: s,
73
+ children: c
74
74
  }) {
75
75
  return /* @__PURE__ */ n.jsxs(
76
76
  "div",
77
77
  {
78
- className: v(
78
+ className: N(
79
79
  "relative flex flex-col radius-medium overflow-hidden dropshadow-400",
80
80
  "border border-neutral-default-default",
81
- c
81
+ s
82
82
  ),
83
83
  children: [
84
84
  /* @__PURE__ */ n.jsx(
85
85
  oe,
86
86
  {
87
- ...o ?? {},
88
- className: v("absolute inset-0 z-0", o?.className)
87
+ ...i ?? {},
88
+ className: N("absolute inset-0 z-0", i?.className)
89
89
  }
90
90
  ),
91
- /* @__PURE__ */ n.jsx("div", { className: "relative z-10 flex flex-col gap-4 min-h-0 overflow-hidden", children: /* @__PURE__ */ n.jsx(L.Provider, { value: r, children: t && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
92
- l && /* @__PURE__ */ n.jsx(k, { title: s, description: a }),
93
- i
91
+ /* @__PURE__ */ n.jsx("div", { className: "relative z-10 flex flex-col gap-4 min-h-0 overflow-hidden", children: /* @__PURE__ */ n.jsx(L.Provider, { value: t, children: r && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
92
+ l && /* @__PURE__ */ n.jsx(w, { title: o, description: a }),
93
+ c
94
94
  ] }) }) })
95
95
  ]
96
96
  }
@@ -99,21 +99,21 @@ const X = O(function({
99
99
  X.displayName = "Dialog.Card";
100
100
  function ce({
101
101
  triggerRef: e,
102
- anchorRef: r,
103
- placement: t,
102
+ anchorRef: t,
103
+ placement: r,
104
104
  offset: l = 4,
105
- matchTriggerWidth: s,
105
+ matchTriggerWidth: o,
106
106
  attachToParent: a = !1,
107
- closeOnScroll: o = !0,
108
- closeOnClickOutside: c = !0,
109
- zIndex: i = 50,
107
+ closeOnScroll: i = !0,
108
+ closeOnClickOutside: s = !0,
109
+ zIndex: c = 50,
110
110
  avoidElements: u,
111
- cardBackground: N,
111
+ cardBackground: y,
112
112
  title: b,
113
113
  description: D,
114
- hideCloseButton: w = !1,
114
+ hideCloseButton: j = !1,
115
115
  modal: m = !1,
116
- unmountChildrenOnClose: j = !0,
116
+ unmountChildrenOnClose: C = !0,
117
117
  onClose: T,
118
118
  onOpen: A,
119
119
  children: _,
@@ -121,35 +121,35 @@ function ce({
121
121
  }, J) {
122
122
  const f = h(null), H = h(T), S = h(A);
123
123
  H.current = T, S.current = A;
124
- const [F, C] = R("hidden"), [K, E] = R(
125
- () => !j
124
+ const [R, v] = I("hidden"), [K, E] = I(
125
+ () => !C
126
126
  ), g = h(null), d = p(() => {
127
127
  g.current && (clearTimeout(g.current), g.current = null);
128
128
  }, []), z = p(
129
129
  (x) => {
130
- d(), m && C("open"), j && E(!0), f.current?.open(x), S.current?.(x);
130
+ d(), m && v("open"), C && E(!0), f.current?.open(x), S.current?.(x);
131
131
  },
132
- [m, j, d]
133
- ), y = p(() => {
134
- m && (d(), C("closing"), g.current = setTimeout(() => {
135
- C("hidden"), g.current = null;
132
+ [m, C, d]
133
+ ), O = p(() => {
134
+ m && (d(), v("closing"), g.current = setTimeout(() => {
135
+ v("hidden"), g.current = null;
136
136
  }, M)), f.current?.close();
137
137
  }, [m, d]), Q = p(() => {
138
- j && E(!1), H.current?.(f.current?.getContext() ?? null);
139
- }, [j]);
140
- I(() => {
138
+ C && E(!1), H.current?.(f.current?.getContext() ?? null);
139
+ }, [C]);
140
+ k(() => {
141
141
  const x = f.current;
142
142
  if (!(!x || !m))
143
143
  return x.subscribeOpenChange((Y) => {
144
- Y || C((B) => B !== "open" ? B : (d(), g.current = setTimeout(() => {
145
- C("hidden"), g.current = null;
144
+ Y || v((B) => B !== "open" ? B : (d(), g.current = setTimeout(() => {
145
+ v("hidden"), g.current = null;
146
146
  }, M), "closing"));
147
147
  });
148
- }, [m, d]), I(() => d, [d]), ne(
148
+ }, [m, d]), k(() => d, [d]), ne(
149
149
  J,
150
150
  () => ({
151
151
  open: z,
152
- close: y,
152
+ close: O,
153
153
  get isOpen() {
154
154
  return f.current?.isOpen ?? !1;
155
155
  },
@@ -157,21 +157,21 @@ function ce({
157
157
  subscribeOpenChange: (x) => f.current?.subscribeOpenChange(x) ?? (() => {
158
158
  })
159
159
  }),
160
- [z, y]
160
+ [z, O]
161
161
  );
162
162
  const V = q(
163
- () => ({ hideCloseButton: w, closeDialog: y }),
164
- [w, y]
163
+ () => ({ hideCloseButton: j, closeDialog: O }),
164
+ [j, O]
165
165
  ), W = b != null || D != null;
166
166
  return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
167
- m && F !== "hidden" && te(
167
+ m && R !== "hidden" && te(
168
168
  /* @__PURE__ */ n.jsx(
169
169
  "div",
170
170
  {
171
171
  className: "prometeo-dialog-backdrop",
172
- "data-open": F === "open" ? "true" : void 0,
173
- "data-closing": F === "closing" ? "true" : void 0,
174
- style: { zIndex: i - 1 }
172
+ "data-open": R === "open" ? "true" : void 0,
173
+ "data-closing": R === "closing" ? "true" : void 0,
174
+ style: { zIndex: c - 1 }
175
175
  }
176
176
  ),
177
177
  document.body
@@ -181,14 +181,14 @@ function ce({
181
181
  {
182
182
  ref: f,
183
183
  triggerRef: e,
184
- anchorRef: r,
185
- placement: t,
184
+ anchorRef: t,
185
+ placement: r,
186
186
  offset: l,
187
- matchTriggerWidth: s,
187
+ matchTriggerWidth: o,
188
188
  attachToParent: a,
189
- closeOnScroll: o,
190
- closeOnClickOutside: c,
191
- zIndex: i,
189
+ closeOnScroll: i,
190
+ closeOnClickOutside: s,
191
+ zIndex: c,
192
192
  avoidElements: u,
193
193
  onClose: Q,
194
194
  children: /* @__PURE__ */ n.jsx(
@@ -199,7 +199,7 @@ function ce({
199
199
  hasAutoHeader: W,
200
200
  title: b,
201
201
  description: D,
202
- cardBackground: N,
202
+ cardBackground: y,
203
203
  className: G,
204
204
  children: _
205
205
  }
@@ -209,66 +209,67 @@ function ce({
209
209
  ] });
210
210
  }
211
211
  const ie = ee(ce), be = Object.assign(ie, {
212
- Header: k,
212
+ Header: w,
213
213
  Content: P,
214
214
  Footer: U
215
215
  });
216
216
  function De() {
217
- const e = h(null), r = h(null), t = p((o) => {
218
- e.current?.open(o);
219
- }, []), l = p(() => {
217
+ const e = h(null), t = h(null), r = h(null), l = p((s) => {
218
+ e.current?.open(s);
219
+ }, []), o = p(() => {
220
220
  e.current?.close();
221
- }, []), s = p((o) => {
222
- e.current?.isOpen ? e.current.close() : e.current?.open(o);
223
- }, []), a = p((o) => {
224
- let c = null, i = null, u = !0, N = 0;
225
- const b = () => {
226
- if (!u) return;
227
- const D = e.current;
228
- if (!D) {
229
- N < 10 && (N++, c = requestAnimationFrame(b));
221
+ }, []), a = p((s) => {
222
+ e.current?.isOpen ? e.current.close() : e.current?.open(s);
223
+ }, []), i = p((s) => {
224
+ let c = null, u = null, y = !0, b = 0;
225
+ const D = () => {
226
+ if (!y) return;
227
+ const j = e.current;
228
+ if (!j) {
229
+ b < 10 && (b++, c = requestAnimationFrame(D));
230
230
  return;
231
231
  }
232
- i = D.subscribeOpenChange(o);
232
+ u = j.subscribeOpenChange(s);
233
233
  };
234
- return b(), () => {
235
- u = !1, c !== null && cancelAnimationFrame(c), i?.();
234
+ return D(), () => {
235
+ y = !1, c !== null && cancelAnimationFrame(c), u?.();
236
236
  };
237
237
  }, []);
238
238
  return q(
239
239
  () => ({
240
240
  ref: e,
241
- triggerRef: r,
242
- open: t,
243
- close: l,
244
- toggle: s,
241
+ triggerRef: t,
242
+ anchorRef: r,
243
+ open: l,
244
+ close: o,
245
+ toggle: a,
245
246
  get isOpen() {
246
247
  return e.current?.isOpen ?? !1;
247
248
  },
248
- subscribeOpenChange: a
249
+ subscribeOpenChange: i
249
250
  }),
250
- [t, l, s, a]
251
+ [l, o, a, i]
251
252
  );
252
253
  }
253
- function je(e, r) {
254
- const [t, l] = R(
254
+ function je(e, t) {
255
+ const [r, l] = I(
255
256
  () => e.current?.isOpen ?? !1
256
257
  );
257
- return I(() => {
258
- let s = null, a = null, o = !0, c = 0;
259
- const i = () => {
260
- if (!o) return;
258
+ return k(() => {
259
+ let o = null, a = null, i = !0, s = 0;
260
+ const c = () => {
261
+ if (!i) return;
261
262
  const u = e.current;
262
263
  if (!u) {
263
- c < 10 && (c++, s = requestAnimationFrame(i));
264
+ s < 10 && (s++, o = requestAnimationFrame(c));
264
265
  return;
265
266
  }
266
267
  l(u.isOpen), a = u.subscribeOpenChange(l);
267
268
  };
268
- return i(), () => {
269
- o = !1, s !== null && cancelAnimationFrame(s), a?.();
269
+ return c(), () => {
270
+ i = !1, o !== null && cancelAnimationFrame(o), a?.();
270
271
  };
271
- }, [e, r]), t;
272
+ }, [e, t]), r;
272
273
  }
273
274
  export {
274
275
  be as Dialog,
@@ -51,26 +51,23 @@ const u = {
51
51
  },
52
52
  outline: {
53
53
  brand: {
54
- container: `bg-transparent border-brand-onneutral-default border
55
- hover:bg-neutral-primary-hover hover:border-brand-onneutral-hover
56
- active:bg-neutral-primary-pressed active:border-brand-onneutral-pressed
57
- `,
54
+ container: "bg-neutral-primary-default border-brand-onneutral-default border hover:bg-brand-overlay-hover hover:border-brand-onneutral-hover active:bg-brand-overlay-pressed active:border-brand-onneutral-pressed",
58
55
  icon: "icon-brand-onneutral-default group-hover:icon-brand-onneutral-hover group-active:icon-brand-onneutral-pressed"
59
56
  },
60
57
  neutral: {
61
- container: "bg-transparent border-neutral-primary-default border hover:bg-neutral-primary-hover hover:border-neutral-primary-hover active:bg-neutral-primary-pressed active:border-neutral-primary-pressed",
58
+ container: "bg-neutral-primary-default border-neutral-primary-default border hover:bg-neutral-primary-hover hover:border-neutral-primary-hover active:bg-neutral-primary-pressed active:border-neutral-primary-pressed",
62
59
  icon: "icon-neutral-default-default group-hover:icon-neutral-default-hover group-active:icon-neutral-default-pressed"
63
60
  },
64
61
  success: {
65
- container: "border border-success-onneutral-default hover:border-success-onneutral-hover hover:bg-neutral-primary-hover active:border-success-onneutral-pressed active:bg-neutral-primary-pressed",
62
+ container: "bg-transparent border border-success-onneutral-default hover:bg-success-overlay-hover hover:border-success-onneutral-hover active:bg-success-overlay-pressed active:border-success-onneutral-pressed",
66
63
  icon: "icon-semantic-success-onneutral-default group-hover:icon-semantic-success-onneutral-hover group-active:icon-semantic-success-onneutral-pressed"
67
64
  },
68
65
  error: {
69
- container: "border border-error-onneutral-default hover:border-error-onneutral-hover hover:bg-neutral-primary-hover active:border-error-onneutral-pressed active:bg-neutral-primary-pressed",
66
+ container: "bg-transparent border border-error-onneutral-default hover:bg-error-overlay-hover hover:border-error-onneutral-hover active:bg-error-overlay-pressed active:border-error-onneutral-pressed",
70
67
  icon: "icon-semantic-error-onneutral-default group-hover:icon-semantic-error-onneutral-hover group-active:icon-semantic-error-onneutral-pressed"
71
68
  },
72
69
  warning: {
73
- container: "border border-warning-onneutral-default hover:border-warning-onneutral-hover hover:bg-neutral-primary-hover active:border-warning-onneutral-pressed active:bg-neutral-primary-pressed",
70
+ container: "bg-transparent border border-warning-onneutral-default hover:bg-warning-overlay-hover hover:border-warning-onneutral-hover active:bg-warning-overlay-pressed active:border-warning-onneutral-pressed",
74
71
  icon: "icon-semantic-warning-onneutral-default group-hover:icon-semantic-warning-onneutral-hover group-active:icon-semantic-warning-onneutral-pressed"
75
72
  },
76
73
  disabled: {
@@ -80,7 +77,7 @@ const u = {
80
77
  },
81
78
  text: {
82
79
  brand: {
83
- container: " bg-transparent border-0 hover:bg-neutral-primary-hover active:bg-neutral-primary-pressed",
80
+ container: "bg-transparent border-0 hover:bg-brand-overlay-hover active:bg-brand-overlay-pressed",
84
81
  icon: "icon-brand-onneutral-default group-hover:icon-brand-onneutral-hover group-active:icon-brand-onneutral-pressed"
85
82
  },
86
83
  neutral: {
@@ -88,15 +85,15 @@ const u = {
88
85
  icon: "icon-neutral-default-default group-hover:icon-neutral-default-hover group-active:icon-neutral-default-pressed"
89
86
  },
90
87
  success: {
91
- container: "border-0 border-success-onneutral-default hover:bg-neutral-primary-hover active:bg-neutral-primary-pressed",
88
+ container: "bg-transparent border-0 hover:bg-success-overlay-hover active:bg-success-overlay-pressed",
92
89
  icon: "icon-semantic-success-onneutral-default group-hover:icon-semantic-success-onneutral-hover group-active:icon-semantic-success-onneutral-pressed"
93
90
  },
94
91
  error: {
95
- container: "border-0 border-error-onneutral-default hover:bg-neutral-primary-hover active:bg-neutral-primary-pressed",
92
+ container: "bg-transparent border-0 hover:bg-error-overlay-hover active:bg-error-overlay-pressed",
96
93
  icon: "icon-semantic-error-onneutral-default group-hover:icon-semantic-error-onneutral-hover group-active:icon-semantic-error-onneutral-pressed"
97
94
  },
98
95
  warning: {
99
- container: "border-0 border-warning-onneutral-default hover:bg-neutral-primary-hover active:bg-neutral-primary-pressed",
96
+ container: "bg-transparent border-0 hover:bg-warning-overlay-hover active:bg-warning-overlay-pressed",
100
97
  icon: "icon-semantic-warning-onneutral-default group-hover:icon-semantic-warning-onneutral-hover group-active:icon-semantic-warning-onneutral-pressed"
101
98
  },
102
99
  disabled: {
@@ -201,7 +198,7 @@ const u = {
201
198
  color: "brand",
202
199
  animation: !0
203
200
  }
204
- }), m = x(w.icon, {
201
+ }), f = x(w.icon, {
205
202
  variants: {
206
203
  size: {
207
204
  small: u.small.icon,
@@ -259,10 +256,10 @@ const u = {
259
256
  }), $ = G(({
260
257
  onClick: z,
261
258
  icon: b,
262
- contentClassName: p,
259
+ contentClassName: m,
263
260
  animate: S = !1,
264
261
  animateIcon: B = !1,
265
- isLoading: f = !1,
262
+ isLoading: p = !1,
266
263
  children: r,
267
264
  hideSpinner: j = !1,
268
265
  spinner: g,
@@ -275,12 +272,12 @@ const u = {
275
272
  color: k = "brand",
276
273
  ...A
277
274
  }, C) => {
278
- const l = !!(i || f), d = !!(B && !l), D = !!(S && !l), c = k, T = {
275
+ const l = !!(i || p), d = !!(B && !l), D = !!(S && !l), c = k, T = {
279
276
  small: "small",
280
277
  medium: "medium",
281
278
  large: "medium"
282
279
  }, q = H(() => {
283
- if (f)
280
+ if (p)
284
281
  return /* @__PURE__ */ n.jsx("div", { className: "flex items-center justify-center", children: !j && (g || /* @__PURE__ */ n.jsx(J, { size: T[o], color: "brand" })) });
285
282
  let a = null;
286
283
  if (r)
@@ -288,7 +285,7 @@ const u = {
288
285
  v(r.type) ? a = /* @__PURE__ */ n.jsx(
289
286
  "span",
290
287
  {
291
- className: m({
288
+ className: f({
292
289
  size: o,
293
290
  variant: s,
294
291
  color: c,
@@ -304,7 +301,7 @@ const u = {
304
301
  I(t) && (v(t.type) ? a = /* @__PURE__ */ n.jsx(
305
302
  "span",
306
303
  {
307
- className: m({
304
+ className: f({
308
305
  size: o,
309
306
  variant: s,
310
307
  color: c,
@@ -320,7 +317,7 @@ const u = {
320
317
  else typeof r == "object" && (v(r) ? a = /* @__PURE__ */ n.jsx(
321
318
  "span",
322
319
  {
323
- className: m({
320
+ className: f({
324
321
  size: o,
325
322
  variant: s,
326
323
  color: c,
@@ -335,7 +332,7 @@ const u = {
335
332
  a = /* @__PURE__ */ n.jsx(
336
333
  "span",
337
334
  {
338
- className: m({
335
+ className: f({
339
336
  size: o,
340
337
  variant: s,
341
338
  color: c,
@@ -346,15 +343,15 @@ const u = {
346
343
  }
347
344
  );
348
345
  }
349
- return a ? /* @__PURE__ */ n.jsx("div", { className: h("flex items-center justify-center select-none", p), children: a }) : null;
346
+ return a ? /* @__PURE__ */ n.jsx("div", { className: h("flex items-center justify-center select-none", m), children: a }) : null;
350
347
  }, [
351
- p,
348
+ m,
352
349
  r,
353
350
  b,
354
351
  s,
355
352
  o,
356
353
  c,
357
- f,
354
+ p,
358
355
  j,
359
356
  g,
360
357
  d,
@@ -382,7 +379,7 @@ const u = {
382
379
  l && "pointer-events-none",
383
380
  O({ size: o, variant: s, color: c, animation: D, disabled: l }),
384
381
  "w-full h-full grid place-items-center",
385
- p
382
+ m
386
383
  ), children: q })
387
384
  }
388
385
  );