@envisiongroup/porygon 1.0.0-rc.0 → 1.0.0-rc.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.
@@ -1,6 +1,6 @@
1
1
  import { DrawerCloseHandler, DrawerOpenHandler, DrawerState, UseDrawerProps } from './useDrawer.types';
2
2
  import * as React from 'react';
3
- export declare function useDrawer({ title: initialTitle, content: initialContent, buttons: initialButtons, size: initialSize, position: initialPosition, modalType: initialModalType, drawerOnOpen, drawerOnClose, deferContentRendering, contentRenderDelay, }: UseDrawerProps): {
3
+ export declare function useDrawer({ title: initialTitle, content: initialContent, buttons: initialButtons, size: initialSize, position: initialPosition, modalType: initialModalType, drawerOnOpen, drawerOnClose, deferContentRendering: initialDeferContentRendering, contentRenderDelay: initialContentRenderDelay, }: UseDrawerProps): {
4
4
  openDrawer: DrawerOpenHandler;
5
5
  closeDrawer: DrawerCloseHandler;
6
6
  updateDrawer: (updates: Partial<DrawerState>) => void;
@@ -1,31 +1,82 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import * as t from "react";
3
- import { createPortal as _ } from "react-dom";
4
- import { EFWDrawerLoader as y } from "./component/EFWDrawerLoader/EFWDrawerLoader.js";
5
- import { EFWDrawer as M } from "./component/EFWDrawer/EFWDrawer.js";
6
- const v = (r, c) => {
7
- switch (c.type) {
1
+ var H = Object.defineProperty;
2
+ var Y = (o, t, r) => t in o ? H(o, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[t] = r;
3
+ var a = (o, t, r) => Y(o, typeof t != "symbol" ? t + "" : t, r);
4
+ import { jsx as y } from "react/jsx-runtime";
5
+ import * as n from "react";
6
+ import { createPortal as x } from "react-dom";
7
+ import { motionTokens as m } from "@fluentui/react-components";
8
+ import { EFWDrawerLoader as M } from "./component/EFWDrawerLoader/EFWDrawerLoader.js";
9
+ import { EFWDrawer as U } from "./component/EFWDrawer/EFWDrawer.js";
10
+ const j = {
11
+ small: m.durationGentle,
12
+ medium: m.durationSlow,
13
+ large: m.durationSlower,
14
+ full: m.durationUltraSlow
15
+ }, B = 1e3, d = class d {
16
+ constructor() {
17
+ a(this, "listenerCount", 0);
18
+ a(this, "doc", null);
19
+ a(this, "supportsPointerEvents", null);
20
+ a(this, "supportsWeakRef", typeof WeakRef < "u");
21
+ a(this, "lastTargetRef", null);
22
+ a(this, "lastTargetTime", 0);
23
+ a(this, "handleInteraction", (t) => {
24
+ const r = t.target;
25
+ r instanceof HTMLElement && (this.lastTargetRef = this.supportsWeakRef ? new WeakRef(r) : r, this.lastTargetTime = Date.now());
26
+ });
27
+ }
28
+ static getInstance() {
29
+ return d.instance || (d.instance = new d()), d.instance;
30
+ }
31
+ register(t) {
32
+ if (this.listenerCount += 1, this.listenerCount === 1) {
33
+ this.doc = t, this.supportsPointerEvents = typeof window < "u" && "PointerEvent" in window;
34
+ const r = { capture: !0, passive: !0 };
35
+ this.supportsPointerEvents ? t.addEventListener("pointerdown", this.handleInteraction, r) : (t.addEventListener("mousedown", this.handleInteraction, r), t.addEventListener("touchstart", this.handleInteraction, r));
36
+ }
37
+ return () => {
38
+ if (this.listenerCount = Math.max(this.listenerCount - 1, 0), this.listenerCount > 0 || !this.doc)
39
+ return;
40
+ const r = { capture: !0 };
41
+ this.supportsPointerEvents ? this.doc.removeEventListener("pointerdown", this.handleInteraction, r) : (this.doc.removeEventListener("mousedown", this.handleInteraction, r), this.doc.removeEventListener("touchstart", this.handleInteraction, r)), this.doc = null, this.supportsPointerEvents = null, this.lastTargetRef = null;
42
+ };
43
+ }
44
+ /**
45
+ * Consume y retorna el último target de interacción si es válido.
46
+ * Limpia la referencia después de consumirla para evitar reusos.
47
+ */
48
+ consumeLastTarget() {
49
+ if (!this.lastTargetRef)
50
+ return null;
51
+ const t = this.supportsWeakRef ? this.lastTargetRef.deref() : this.lastTargetRef, r = t && Date.now() - this.lastTargetTime <= B;
52
+ return this.lastTargetRef = null, r ? t : null;
53
+ }
54
+ };
55
+ a(d, "instance", null);
56
+ let E = d;
57
+ const A = E.getInstance(), V = (o, t) => {
58
+ switch (t.type) {
8
59
  case "OPEN":
9
60
  return {
10
- ...r,
61
+ ...o,
11
62
  isOpen: !0,
12
63
  isMounted: !0,
13
64
  isClosing: !1,
14
65
  isContentReady: !1,
15
66
  wasContentShown: !1,
16
- ...c.payload || {}
67
+ ...t.payload || {}
17
68
  };
18
69
  case "START_CLOSE":
19
70
  return {
20
- ...r,
71
+ ...o,
21
72
  isOpen: !1,
22
73
  isClosing: !0,
23
74
  // Mantener el estado de qué se estaba mostrando
24
- wasContentShown: r.isContentReady
75
+ wasContentShown: o.isContentReady
25
76
  };
26
77
  case "FINISH_CLOSE":
27
78
  return {
28
- ...r,
79
+ ...o,
29
80
  isClosing: !1,
30
81
  isMounted: !1,
31
82
  isContentReady: !1,
@@ -33,77 +84,105 @@ const v = (r, c) => {
33
84
  };
34
85
  case "CONTENT_READY":
35
86
  return {
36
- ...r,
87
+ ...o,
37
88
  isContentReady: !0,
38
89
  wasContentShown: !0
39
90
  };
40
91
  case "UPDATE_CONTENT":
41
92
  return {
42
- ...r,
43
- ...c.payload
93
+ ...o,
94
+ ...t.payload
44
95
  };
45
96
  default:
46
- return r;
97
+ return o;
47
98
  }
48
99
  };
49
- function z({
50
- title: r = "",
51
- content: c,
52
- buttons: w = [],
53
- size: E = "small",
54
- position: O = "end",
55
- modalType: h = "modal",
56
- drawerOnOpen: p,
57
- drawerOnClose: C,
58
- deferContentRendering: l = !1,
59
- contentRenderDelay: i = 500
100
+ function $({
101
+ title: o = "",
102
+ content: t,
103
+ buttons: r = [],
104
+ size: g = "small",
105
+ position: b = "end",
106
+ modalType: _ = "modal",
107
+ drawerOnOpen: C,
108
+ drawerOnClose: h,
109
+ deferContentRendering: k = !1,
110
+ contentRenderDelay: P = 500
60
111
  }) {
61
- const n = t.useRef(null), o = t.useRef(), u = t.useRef(), [e, a] = t.useReducer(v, {
112
+ const i = n.useRef(null), [T, z] = n.useState(null), u = n.useRef(), c = n.useRef(), R = n.useRef(null), w = n.useRef(g), O = n.useRef(!1), v = n.useRef(h), S = n.useRef(C), [e, f] = n.useReducer(V, {
62
113
  isOpen: !1,
63
114
  isMounted: !1,
64
115
  isClosing: !1,
65
116
  isContentReady: !1,
66
117
  wasContentShown: !1,
67
- title: r,
68
- content: c,
69
- buttons: w,
70
- size: E,
71
- position: O,
72
- modalType: h
118
+ title: o,
119
+ content: t,
120
+ buttons: r,
121
+ size: g,
122
+ position: b,
123
+ modalType: _,
124
+ deferContentRendering: k,
125
+ contentRenderDelay: P
73
126
  });
74
- t.useEffect(() => (n.current || (n.current = document.createElement("div"), n.current.className = "drawer-portal-container", document.body.appendChild(n.current)), () => {
75
- n.current && document.body.contains(n.current) && (document.body.removeChild(n.current), n.current = null), o.current && clearTimeout(o.current), u.current && clearTimeout(u.current);
76
- }), []), t.useEffect(() => (e.isOpen && !e.isContentReady && !e.isClosing && (o.current && clearTimeout(o.current), l && i > 0 ? o.current = setTimeout(() => {
77
- a({ type: "CONTENT_READY" });
78
- }, i) : a({ type: "CONTENT_READY" })), () => {
79
- o.current && clearTimeout(o.current);
80
- }), [e.isOpen, e.isContentReady, e.isClosing, l, i]);
81
- const R = t.useCallback(
82
- (f) => {
83
- u.current && (clearTimeout(u.current), u.current = void 0), a({ type: "OPEN", payload: f }), p && Promise.resolve(p()).catch(console.error);
127
+ n.useLayoutEffect(() => {
128
+ if (!(typeof document > "u"))
129
+ return i.current || (i.current = document.createElement("div"), i.current.className = "drawer-portal-container", document.body.appendChild(i.current), z(i.current)), () => {
130
+ i.current && document.body.contains(i.current) && (document.body.removeChild(i.current), i.current = null), u.current && clearTimeout(u.current), c.current && clearTimeout(c.current);
131
+ };
132
+ }, []), n.useEffect(() => {
133
+ if (!(typeof document > "u"))
134
+ return A.register(document);
135
+ }, []), n.useLayoutEffect(() => {
136
+ w.current = e.size, O.current = e.isOpen;
137
+ }, [e.size, e.isOpen]), n.useLayoutEffect(() => {
138
+ v.current = h, S.current = C;
139
+ }, [h, C]), n.useEffect(() => (e.isOpen && !e.isContentReady && !e.isClosing && (u.current && clearTimeout(u.current), e.deferContentRendering && e.contentRenderDelay > 0 ? u.current = setTimeout(() => {
140
+ f({ type: "CONTENT_READY" });
141
+ }, e.contentRenderDelay) : f({ type: "CONTENT_READY" })), () => {
142
+ u.current && clearTimeout(u.current);
143
+ }), [
144
+ e.isOpen,
145
+ e.isContentReady,
146
+ e.isClosing,
147
+ e.deferContentRendering,
148
+ e.contentRenderDelay
149
+ ]);
150
+ const D = n.useCallback(() => {
151
+ if (typeof document > "u") return;
152
+ const p = A.consumeLastTarget() ?? document.activeElement;
153
+ p instanceof HTMLElement && p !== document.body ? R.current = p : R.current = null;
154
+ }, []), N = n.useCallback(() => {
155
+ if (typeof document > "u") return;
156
+ const s = R.current;
157
+ R.current = null, !(!s || !s.isConnected) && (i.current && i.current.contains(s) || s.focus?.());
158
+ }, []), W = n.useCallback(
159
+ (s) => {
160
+ c.current && (clearTimeout(c.current), c.current = void 0), D(), f({ type: "OPEN", payload: s }), S.current?.()?.catch?.(console.error);
84
161
  },
85
- [p]
86
- ), s = t.useCallback(() => {
87
- o.current && (clearTimeout(o.current), o.current = void 0), a({ type: "START_CLOSE" }), C && Promise.resolve(C()).catch(console.error);
88
- }, [C]), S = t.useCallback((f) => {
89
- a({ type: "UPDATE_CONTENT", payload: f });
90
- }, []), m = t.useCallback(
91
- (f, b) => {
92
- !b.open && e.isOpen && (s(), u.current = setTimeout(() => {
93
- a({ type: "FINISH_CLOSE" });
94
- }, 600));
162
+ [D]
163
+ ), l = n.useCallback(() => {
164
+ u.current && (clearTimeout(u.current), u.current = void 0), c.current && clearTimeout(c.current), f({ type: "START_CLOSE" }), v.current?.()?.catch?.(console.error);
165
+ const s = j[w.current] ?? m.durationGentle;
166
+ c.current = setTimeout(() => {
167
+ N(), f({ type: "FINISH_CLOSE" });
168
+ }, s);
169
+ }, [N]), F = n.useCallback((s) => {
170
+ f({ type: "UPDATE_CONTENT", payload: s });
171
+ }, []), L = n.useCallback(
172
+ (s, p) => {
173
+ !p.open && O.current && l();
95
174
  },
96
- [s, e.isOpen]
97
- ), T = t.useMemo(() => {
175
+ [l]
176
+ ), I = n.useMemo(() => {
98
177
  if (!e.isMounted || !e.content)
99
178
  return null;
100
179
  if (e.isClosing)
101
- return e.wasContentShown ? typeof e.content == "function" ? e.content(s) : e.content : l && !e.wasContentShown ? /* @__PURE__ */ d(y, { delay: i }) : null;
180
+ return e.wasContentShown ? typeof e.content == "function" ? e.content(l) : e.content : e.deferContentRendering && !e.wasContentShown ? /* @__PURE__ */ y(M, { delay: e.contentRenderDelay }) : null;
102
181
  if (e.isOpen) {
103
- if (l && !e.isContentReady)
104
- return /* @__PURE__ */ d(y, { delay: i });
182
+ if (e.deferContentRendering && !e.isContentReady)
183
+ return /* @__PURE__ */ y(M, { delay: e.contentRenderDelay });
105
184
  if (e.isContentReady)
106
- return typeof e.content == "function" ? e.content(s) : e.content;
185
+ return typeof e.content == "function" ? e.content(l) : e.content;
107
186
  }
108
187
  return null;
109
188
  }, [
@@ -113,25 +192,25 @@ function z({
113
192
  e.content,
114
193
  e.isContentReady,
115
194
  e.wasContentShown,
116
- l,
117
- i,
118
- s
119
- ]), N = t.useMemo(() => !e.isMounted || !n.current ? null : _(
120
- /* @__PURE__ */ d(
121
- M,
195
+ e.deferContentRendering,
196
+ e.contentRenderDelay,
197
+ l
198
+ ]), G = n.useMemo(() => !e.isMounted || !T ? null : x(
199
+ /* @__PURE__ */ y(
200
+ U,
122
201
  {
123
202
  isOpen: e.isOpen,
124
- onClose: s,
125
- onOpenChange: m,
203
+ onClose: l,
204
+ onOpenChange: L,
126
205
  title: e.title,
127
- content: T,
206
+ content: I,
128
207
  buttons: e.buttons,
129
208
  size: e.size,
130
209
  position: e.position,
131
210
  modalType: e.modalType
132
211
  }
133
212
  ),
134
- n.current
213
+ T
135
214
  ), [
136
215
  e.isMounted,
137
216
  e.isOpen,
@@ -140,19 +219,20 @@ function z({
140
219
  e.size,
141
220
  e.position,
142
221
  e.modalType,
222
+ I,
143
223
  T,
144
- s,
145
- m
224
+ l,
225
+ L
146
226
  ]);
147
227
  return {
148
- openDrawer: R,
149
- closeDrawer: s,
150
- updateDrawer: S,
228
+ openDrawer: W,
229
+ closeDrawer: l,
230
+ updateDrawer: F,
151
231
  isOpen: e.isOpen,
152
232
  isContentReady: e.isContentReady,
153
- DrawerElement: N
233
+ DrawerElement: G
154
234
  };
155
235
  }
156
236
  export {
157
- z as useDrawer
237
+ $ as useDrawer
158
238
  };
@@ -59,6 +59,8 @@ export type DrawerCloseHandler = () => void;
59
59
  * @property {'small' | 'medium' | 'large' | 'full'} size - Tamaño del drawer.
60
60
  * @property {'start' | 'end' | 'bottom'} position - Posición del drawer.
61
61
  * @property {'modal' | 'non-modal' | 'alert'} modalType - Tipo de modalidad.
62
+ * @property {boolean} deferContentRendering - Indica si se difiere el render del contenido.
63
+ * @property {number} contentRenderDelay - Tiempo de espera para renderizar el contenido.
62
64
  */
63
65
  export interface DrawerState {
64
66
  isOpen: boolean;
@@ -69,4 +71,6 @@ export interface DrawerState {
69
71
  position: 'start' | 'end' | 'bottom';
70
72
  modalType: 'modal' | 'non-modal' | 'alert';
71
73
  isContentReady: boolean;
74
+ deferContentRendering: boolean;
75
+ contentRenderDelay: number;
72
76
  }
@@ -100,8 +100,8 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
100
100
  return f.forEach((t) => {
101
101
  const n = z[t.internalName];
102
102
  if (n?.width) {
103
- const s = n.minWidth ?? _, i = n.maxWidth ?? J;
104
- e[t.internalName] = Math.min(Math.max(n.width ?? 0, s), i);
103
+ const s = n.minWidth ?? _, r = n.maxWidth ?? J;
104
+ e[t.internalName] = Math.min(Math.max(n.width ?? 0, s), r);
105
105
  }
106
106
  }), e;
107
107
  }), de = B(z), [C, fe] = q(0), {
@@ -128,11 +128,11 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
128
128
  const e = [], t = {};
129
129
  let n = 0;
130
130
  return I && (e.push("select"), t.select = n, n += O), f.forEach((s) => {
131
- const i = z[s.internalName] || {};
132
- if (i.sticky) {
131
+ const r = z[s.internalName] || {};
132
+ if (!r.hidden && r.sticky) {
133
133
  e.push(s.internalName), t[s.internalName] = n;
134
- const r = S[s.internalName] || i.width || x;
135
- n += r;
134
+ const i = S[s.internalName] || r.width || x;
135
+ n += i;
136
136
  }
137
137
  }), { stickyColumns: e, stickyPositions: t };
138
138
  }, [f, I, z, S]), w = F(() => {
@@ -165,7 +165,10 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
165
165
  maxSize: O,
166
166
  enableResizing: !1
167
167
  }), f.forEach((t) => {
168
- const n = z[t.internalName] || {}, s = t.typeAsString === "Note" ? x * 2 : x, i = n.width || s, r = n.minWidth || _, a = n.maxWidth || J;
168
+ const n = z[t.internalName] || {};
169
+ if (n.hidden)
170
+ return;
171
+ const s = t.typeAsString === "Note" ? x * 2 : x, r = n.width || s, i = n.minWidth || _, a = n.maxWidth || J;
169
172
  e.push({
170
173
  id: t.internalName,
171
174
  accessorKey: t.internalName,
@@ -178,8 +181,8 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
178
181
  oe,
179
182
  ae
180
183
  ),
181
- size: Math.min(Math.max(i, r), a),
182
- minSize: r,
184
+ size: Math.min(Math.max(r, i), a),
185
+ minSize: i,
183
186
  maxSize: a,
184
187
  enableResizing: Q
185
188
  });
@@ -196,11 +199,11 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
196
199
  const e = de.current;
197
200
  j((t) => {
198
201
  let n = !1;
199
- const s = { ...t }, i = new Set(f.map((r) => r.internalName));
200
- return Object.keys(s).forEach((r) => {
201
- i.has(r) || (delete s[r], n = !0);
202
- }), f.forEach((r) => {
203
- const a = r.internalName, c = z[a], o = e[a];
202
+ const s = { ...t }, r = new Set(f.map((i) => i.internalName));
203
+ return Object.keys(s).forEach((i) => {
204
+ r.has(i) || (delete s[i], n = !0);
205
+ }), f.forEach((i) => {
206
+ const a = i.internalName, c = z[a], o = e[a];
204
207
  if (c?.width !== void 0) {
205
208
  const u = c.minWidth ?? _, h = c.maxWidth ?? J, d = Math.min(Math.max(c.width, u), h);
206
209
  s[a] !== d && (s[a] = d, n = !0);
@@ -209,8 +212,8 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
209
212
  }), de.current = z;
210
213
  }, [z, f]);
211
214
  const Y = F(() => w.reduce((e, t) => {
212
- const s = f.find((r) => r.internalName === t.id)?.typeAsString === "Note" ? x * 2 : x, i = S[t.id] || (typeof t.size == "number" ? t.size : s);
213
- return e + i;
215
+ const s = f.find((i) => i.internalName === t.id)?.typeAsString === "Note" ? x * 2 : x, r = S[t.id] || (typeof t.size == "number" ? t.size : s);
216
+ return e + r;
214
217
  }, 0), [w, S, f]), ye = wt({
215
218
  data: b,
216
219
  columns: w,
@@ -222,11 +225,11 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
222
225
  onColumnSizingChange: (e) => {
223
226
  j((t) => {
224
227
  const n = typeof e == "function" ? e(t) : e, s = {};
225
- return Object.keys(n).forEach((i) => {
226
- const r = w.find((a) => a.id === i);
227
- if (r) {
228
- const a = r.minSize || _, c = r.maxSize || J;
229
- N.current ? s[i] = Math.max(n[i], a) : s[i] = Math.min(Math.max(n[i], a), c);
228
+ return Object.keys(n).forEach((r) => {
229
+ const i = w.find((a) => a.id === r);
230
+ if (i) {
231
+ const a = i.minSize || _, c = i.maxSize || J;
232
+ N.current ? s[r] = Math.max(n[r], a) : s[r] = Math.min(Math.max(n[r], a), c);
230
233
  }
231
234
  }), { ...t, ...s };
232
235
  });
@@ -252,11 +255,11 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
252
255
  re?.(e);
253
256
  }, [re]), Ie = (e) => {
254
257
  const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
255
- return Object.keys(W).forEach((i) => {
256
- if (!W[i])
258
+ return Object.keys(W).forEach((r) => {
259
+ if (!W[r])
257
260
  return;
258
- const r = Number(i), a = e[r];
259
- a && (s.add(r), a.id && t.add(a.id), n.add(a));
261
+ const i = Number(r), a = e[i];
262
+ a && (s.add(i), a.id && t.add(a.id), n.add(a));
260
263
  }), {
261
264
  hasSelection: t.size > 0 || n.size > 0 || s.size > 0,
262
265
  selectedIds: t,
@@ -268,11 +271,11 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
268
271
  if (!t.hasSelection)
269
272
  return;
270
273
  const n = t.sourceLength !== e.length, s = {};
271
- e.forEach((i, r) => {
272
- if (!i)
274
+ e.forEach((r, i) => {
275
+ if (!r)
273
276
  return;
274
- const a = i.id ? t.selectedIds.has(i.id) : !1, c = t.selectedRefs.has(i), o = !i.id && !n && t.selectedIndexes.has(r);
275
- (a || c || o) && (s[r.toString()] = !0);
277
+ const a = r.id ? t.selectedIds.has(r.id) : !1, c = t.selectedRefs.has(r), o = !r.id && !n && t.selectedIndexes.has(i);
278
+ (a || c || o) && (s[i.toString()] = !0);
276
279
  }), he(s);
277
280
  }, g = (e) => {
278
281
  if (ue) {
@@ -294,11 +297,11 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
294
297
  const t = { id: E(), ...e }, n = await L([t], y);
295
298
  if (n) {
296
299
  if (n.successful.length > 0) {
297
- const s = n.successful.map((i) => {
298
- const r = i.item;
299
- return r.id ? r : { ...r, id: E() };
300
+ const s = n.successful.map((r) => {
301
+ const i = r.item;
302
+ return i.id ? i : { ...i, id: E() };
300
303
  });
301
- g((i) => [...s, ...i]);
304
+ g((r) => [...s, ...r]);
302
305
  }
303
306
  return n;
304
307
  }
@@ -333,16 +336,16 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
333
336
  })), n = await L(t, y);
334
337
  if (n) {
335
338
  if (n.successful.length > 0) {
336
- const s = n.successful.map((i) => {
337
- const r = i.item;
338
- return r.id ? r : { ...r, id: E() };
339
+ const s = n.successful.map((r) => {
340
+ const i = r.item;
341
+ return i.id ? i : { ...i, id: E() };
339
342
  });
340
- g((i) => [...s, ...i]);
343
+ g((r) => [...s, ...r]);
341
344
  }
342
345
  return n;
343
346
  }
344
347
  return g((s) => [...t, ...s]), {
345
- successful: t.map((s, i) => ({ index: i, item: s })),
348
+ successful: t.map((s, r) => ({ index: r, item: s })),
346
349
  failed: []
347
350
  };
348
351
  } else {
@@ -374,18 +377,18 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
374
377
  };
375
378
  try {
376
379
  if (D) {
377
- const i = await D([{ index: e, item: t }], y);
378
- if (i)
379
- return i.successful.length && g((r) => {
380
- const a = [...r];
381
- return i.successful.forEach(({ index: c, item: o }) => a[c] = o), a;
382
- }), i;
380
+ const r = await D([{ index: e, item: t }], y);
381
+ if (r)
382
+ return r.successful.length && g((i) => {
383
+ const a = [...i];
384
+ return r.successful.forEach(({ index: c, item: o }) => a[c] = o), a;
385
+ }), r;
383
386
  }
384
387
  let s;
385
- return g((i) => {
386
- s = { ...i[e], ...t };
387
- const r = [...i];
388
- return r[e] = s, r;
388
+ return g((r) => {
389
+ s = { ...r[e], ...t };
390
+ const i = [...r];
391
+ return i[e] = s, i;
389
392
  }), { successful: [{ index: e, item: s }], failed: [] };
390
393
  } catch (s) {
391
394
  return {
@@ -395,7 +398,7 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
395
398
  }
396
399
  }, Re = async (e) => {
397
400
  if (!e.length) return { successful: [], failed: [] };
398
- const t = p.current, n = (r) => r >= 0 && r < t.length, s = e.filter(({ index: r }) => !n(r)).map(({ index: r, item: a }) => ({ index: r, item: a, error: "Invalid index" })), i = e.filter(({ index: r }) => n(r));
401
+ const t = p.current, n = (i) => i >= 0 && i < t.length, s = e.filter(({ index: i }) => !n(i)).map(({ index: i, item: a }) => ({ index: i, item: a, error: "Invalid index" })), r = e.filter(({ index: i }) => n(i));
399
402
  try {
400
403
  if (D) {
401
404
  const c = await D(e, y);
@@ -413,20 +416,20 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
413
416
  }), { successful: o, failed: h };
414
417
  }
415
418
  }
416
- const r = [], a = [...s];
419
+ const i = [], a = [...s];
417
420
  return g((c) => {
418
421
  const o = [...c];
419
- return i.forEach(({ index: u, item: h }) => {
420
- o[u] = { ...o[u], ...h }, r.push({ index: u, item: o[u] });
422
+ return r.forEach(({ index: u, item: h }) => {
423
+ o[u] = { ...o[u], ...h }, i.push({ index: u, item: o[u] });
421
424
  }), o;
422
- }), { successful: r, failed: a };
423
- } catch (r) {
425
+ }), { successful: i, failed: a };
426
+ } catch (i) {
424
427
  return {
425
428
  successful: [],
426
429
  failed: e.map(({ index: a, item: c }) => ({
427
430
  index: a,
428
431
  item: c,
429
- error: String(r)
432
+ error: String(i)
430
433
  }))
431
434
  };
432
435
  }
@@ -439,12 +442,12 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
439
442
  };
440
443
  try {
441
444
  if (H) {
442
- const s = b[e], i = await H([{ index: e, item: s }], y);
443
- if (i)
444
- return i.successful.length && g((r) => r.filter((a, c) => c !== e)), i;
445
+ const s = b[e], r = await H([{ index: e, item: s }], y);
446
+ if (r)
447
+ return r.successful.length && g((i) => i.filter((a, c) => c !== e)), r;
445
448
  }
446
449
  let n;
447
- return g((s) => (n = s[e], s.filter((i, r) => r !== e))), { successful: [{ index: e, item: n }], failed: [] };
450
+ return g((s) => (n = s[e], s.filter((r, i) => i !== e))), { successful: [{ index: e, item: n }], failed: [] };
448
451
  } catch (n) {
449
452
  return {
450
453
  successful: [],
@@ -453,13 +456,13 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
453
456
  }
454
457
  }, Ne = async (e) => {
455
458
  if (!e.length) return { successful: [], failed: [] };
456
- const t = p.current, n = Array.from(new Set(e)), { validIndexes: s, invalidFailures: i } = n.reduce(
459
+ const t = p.current, n = Array.from(new Set(e)), { validIndexes: s, invalidFailures: r } = n.reduce(
457
460
  (c, o) => (o >= 0 && o < t.length ? c.validIndexes.push(o) : c.invalidFailures.push({ index: o, error: "Invalid index" }), c),
458
461
  { validIndexes: [], invalidFailures: [] }
459
- ), r = n.map((c) => ({ index: c, item: b[c] })), a = new Set(s);
462
+ ), i = n.map((c) => ({ index: c, item: b[c] })), a = new Set(s);
460
463
  try {
461
464
  if (H) {
462
- const u = await H(r, y);
465
+ const u = await H(i, y);
463
466
  if (u) {
464
467
  const h = u.successful.filter(({ index: m }) => a.has(m));
465
468
  if (h.length) {
@@ -467,7 +470,7 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
467
470
  g((A) => A.filter((Ot, St) => !m.has(St)));
468
471
  }
469
472
  const d = new Set(u.failed.map((m) => m.index)), l = [...u.failed];
470
- return i.forEach((m) => {
473
+ return r.forEach((m) => {
471
474
  d.has(m.index) || l.push(m);
472
475
  }), u.successful.filter(({ index: m }) => !a.has(m)).map(({ index: m }) => ({ index: m, error: "Invalid index" })).forEach((m) => {
473
476
  d.has(m.index) || l.push(m);
@@ -480,7 +483,7 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
480
483
  return u.forEach((d, l) => {
481
484
  c.has(l) ? o.push({ index: l, item: d }) : h.push(d);
482
485
  }), h;
483
- }), { successful: o, failed: i };
486
+ }), { successful: o, failed: r };
484
487
  } catch (c) {
485
488
  return {
486
489
  successful: [],
@@ -537,7 +540,7 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
537
540
  const ht = R((e, t) => {
538
541
  t?.target && t.target.closest('[data-checkbox="true"]') || (I && pe(e.index), Z && Z(e.original, e.index));
539
542
  }, [I, Z, pe]), He = F(() => w.map((e) => {
540
- const n = f.find((i) => i.internalName === e.id)?.typeAsString === "Note" ? x * 2 : x, s = S[e.id] || (typeof e.size == "number" ? e.size : n);
543
+ const n = f.find((r) => r.internalName === e.id)?.typeAsString === "Note" ? x * 2 : x, s = S[e.id] || (typeof e.size == "number" ? e.size : n);
541
544
  return e.id === "select" ? `${O}px` : `${s}px`;
542
545
  }).join(" "), [w, S, f]);
543
546
  T(() => {
@@ -558,12 +561,12 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
558
561
  return;
559
562
  const s = e + t;
560
563
  if (Math.abs(s - C) < 1) return;
561
- const i = C - e, r = i / t, a = { ...S };
564
+ const r = C - e, i = r / t, a = { ...S };
562
565
  let c = 0;
563
566
  n.forEach((o, u) => {
564
567
  const h = S[o.id] || (typeof o.size == "number" ? o.size : x), d = o.minSize || _;
565
568
  let l;
566
- u === n.length - 1 ? l = i - c : l = Math.round(h * r), l = Math.max(d, l), a[o.id] = l, c += l;
569
+ u === n.length - 1 ? l = r - c : l = Math.round(h * i), l = Math.max(d, l), a[o.id] = l, c += l;
567
570
  }), N.current = !0, j(a), requestAnimationFrame(() => {
568
571
  N.current = !1;
569
572
  });
@@ -575,7 +578,7 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
575
578
  return;
576
579
  const t = w.filter((d) => d.id && d.id !== "select");
577
580
  if (t.length === 0) return;
578
- const n = t[t.length - 1], s = n.id, r = f.find((d) => d.internalName === s)?.typeAsString === "Note" ? x * 2 : x, c = (S[s] || (typeof n.size == "number" ? n.size : r)) + e, o = n.minSize || _, u = Math.max(o, c), h = S[s];
581
+ const n = t[t.length - 1], s = n.id, i = f.find((d) => d.internalName === s)?.typeAsString === "Note" ? x * 2 : x, c = (S[s] || (typeof n.size == "number" ? n.size : i)) + e, o = n.minSize || _, u = Math.max(o, c), h = S[s];
579
582
  Math.abs(h - u) < 1 || (N.current = !0, j((d) => ({
580
583
  ...d,
581
584
  [s]: u
@@ -662,7 +665,7 @@ const G = {}, Bt = /* @__PURE__ */ new Set(), qe = [], X = [], x = 120, _ = 80,
662
665
  }
663
666
  )
664
667
  }
665
- ) : /* @__PURE__ */ v(At, { height: 300 })
668
+ ) : /* @__PURE__ */ v(At, { height: 250 })
666
669
  ]
667
670
  }
668
671
  );
@@ -126,6 +126,8 @@ export interface EFWTableProps {
126
126
  width?: number;
127
127
  minWidth?: number;
128
128
  sticky?: boolean;
129
+ /** Oculta la columna de la tabla */
130
+ hidden?: boolean;
129
131
  }>;
130
132
  useVirtualization?: boolean;
131
133
  getFieldIcon?: (internalName: string, item: EFWTableItem) => React.ReactNode;
@@ -1,6 +1,6 @@
1
- import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import { makeStyles as c, tokens as l, Card as d, CardPreview as p, Image as m, CardHeader as h, Body1 as g, Body1Stronger as y } from "@fluentui/react-components";
3
- const u = "https://res-1.public.onecdn.static.microsoft/files/sp-client/odsp-media-53ad6982/images/emptyfolder/empty_list_placeholder2.webp", f = c({
1
+ import { jsx as e, jsxs as h } from "react/jsx-runtime";
2
+ import { makeStyles as g, tokens as y, mergeClasses as s, Card as u, CardPreview as f, Image as C, CardHeader as x, Body1 as N, Body1Stronger as S } from "@fluentui/react-components";
3
+ const b = "https://res-1.public.onecdn.static.microsoft/files/sp-client/odsp-media-53ad6982/images/emptyfolder/empty_list_placeholder2.webp", w = g({
4
4
  cardContainer: {
5
5
  display: "flex",
6
6
  alignItems: "center",
@@ -11,36 +11,56 @@ const u = "https://res-1.public.onecdn.static.microsoft/files/sp-client/odsp-med
11
11
  height: "fit-content"
12
12
  },
13
13
  caption: {
14
- color: l.colorNeutralForeground3,
14
+ color: y.colorNeutralForeground3,
15
15
  width: "100%",
16
16
  textAlign: "center"
17
17
  }
18
- }), S = (r) => {
18
+ }), j = (a) => {
19
19
  const {
20
- title: i = "Sin datos disponibles",
21
- description: n = "Los datos aparecerán aquí una vez se agreguen registros",
22
- imageUrl: s = u,
23
- height: a
24
- } = r, t = f();
25
- return /* @__PURE__ */ e("div", { className: t.cardContainer, style: { height: a }, children: /* @__PURE__ */ o(d, { className: t.card, appearance: "subtle", children: [
26
- /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(
27
- m,
28
- {
29
- style: { height: 150 },
30
- src: s,
31
- alt: "Presentation Preview",
32
- fit: "contain"
33
- }
34
- ) }),
35
- /* @__PURE__ */ e(
36
- h,
37
- {
38
- header: /* @__PURE__ */ e(y, { align: "center", style: { width: "100%" }, children: i }),
39
- description: /* @__PURE__ */ e(g, { align: "center", className: t.caption, children: n })
40
- }
41
- )
42
- ] }) });
20
+ title: r = "Sin datos disponibles",
21
+ description: i = "Los datos aparecerán aquí una vez se agreguen registros",
22
+ imageUrl: n = b,
23
+ height: c,
24
+ className: l,
25
+ style: o,
26
+ cardClassName: d,
27
+ cardStyle: p,
28
+ captionClassName: m
29
+ } = a, t = w();
30
+ return /* @__PURE__ */ e(
31
+ "div",
32
+ {
33
+ className: s(t.cardContainer, l),
34
+ style: { height: c, ...o },
35
+ children: /* @__PURE__ */ h(
36
+ u,
37
+ {
38
+ className: s(t.card, d),
39
+ style: p,
40
+ appearance: "subtle",
41
+ children: [
42
+ /* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
43
+ C,
44
+ {
45
+ style: { height: 100 },
46
+ src: n,
47
+ alt: "Presentation Preview",
48
+ fit: "contain"
49
+ }
50
+ ) }),
51
+ /* @__PURE__ */ e(
52
+ x,
53
+ {
54
+ header: /* @__PURE__ */ e(S, { align: "center", style: { width: "100%" }, children: r }),
55
+ description: /* @__PURE__ */ e(N, { align: "center", className: s(t.caption, m), children: i })
56
+ }
57
+ )
58
+ ]
59
+ }
60
+ )
61
+ }
62
+ );
43
63
  };
44
64
  export {
45
- S as EFWTableEmpty
65
+ j as EFWTableEmpty
46
66
  };
@@ -3,4 +3,14 @@ export interface EFWTableEmptyProps {
3
3
  description?: string;
4
4
  imageUrl?: string;
5
5
  height?: number | string;
6
+ /** Clase CSS para el contenedor principal */
7
+ className?: string;
8
+ /** Estilos inline para el contenedor principal */
9
+ style?: React.CSSProperties;
10
+ /** Clase CSS para el Card */
11
+ cardClassName?: string;
12
+ /** Estilos inline para el Card */
13
+ cardStyle?: React.CSSProperties;
14
+ /** Clase CSS para el texto de descripción */
15
+ captionClassName?: string;
6
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envisiongroup/porygon",
3
- "version": "1.0.0-rc.00",
3
+ "version": "1.0.0-rc.02",
4
4
  "description": "Librerias de componentes de React creados por la empresa Envision",
5
5
  "license": "CC-BY-ND-4.0",
6
6
  "main": "./dist/index.js",