@ngnyan/data-table 1.0.5 → 1.0.7

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,351 +1,91 @@
1
- import ee from "react";
2
- var x = { exports: {} }, _ = {};
3
- var I;
4
- function re() {
5
- if (I) return _;
6
- I = 1;
7
- var a = /* @__PURE__ */ Symbol.for("react.transitional.element"), s = /* @__PURE__ */ Symbol.for("react.fragment");
8
- function i(u, t, c) {
9
- var b = null;
10
- if (c !== void 0 && (b = "" + c), t.key !== void 0 && (b = "" + t.key), "key" in t) {
11
- c = {};
12
- for (var d in t)
13
- d !== "key" && (c[d] = t[d]);
14
- } else c = t;
15
- return t = c.ref, {
16
- $$typeof: a,
17
- type: u,
18
- key: b,
19
- ref: t !== void 0 ? t : null,
20
- props: c
21
- };
22
- }
23
- return _.Fragment = s, _.jsx = i, _.jsxs = i, _;
24
- }
25
- var E = {};
26
- var L;
27
- function te() {
28
- return L || (L = 1, process.env.NODE_ENV !== "production" && (function() {
29
- function a(e) {
30
- if (e == null) return null;
31
- if (typeof e == "function")
32
- return e.$$typeof === Z ? null : e.displayName || e.name || null;
33
- if (typeof e == "string") return e;
34
- switch (e) {
35
- case h:
36
- return "Fragment";
37
- case q:
38
- return "Profiler";
39
- case U:
40
- return "StrictMode";
41
- case G:
42
- return "Suspense";
43
- case X:
44
- return "SuspenseList";
45
- case H:
46
- return "Activity";
47
- }
48
- if (typeof e == "object")
49
- switch (typeof e.tag == "number" && console.error(
50
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
51
- ), e.$$typeof) {
52
- case W:
53
- return "Portal";
54
- case V:
55
- return e.displayName || "Context";
56
- case J:
57
- return (e._context.displayName || "Context") + ".Consumer";
58
- case z:
59
- var r = e.render;
60
- return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
61
- case B:
62
- return r = e.displayName || null, r !== null ? r : a(e.type) || "Memo";
63
- case j:
64
- r = e._payload, e = e._init;
65
- try {
66
- return a(e(r));
67
- } catch {
68
- }
69
- }
70
- return null;
71
- }
72
- function s(e) {
73
- return "" + e;
74
- }
75
- function i(e) {
76
- try {
77
- s(e);
78
- var r = !1;
79
- } catch {
80
- r = !0;
81
- }
82
- if (r) {
83
- r = console;
84
- var n = r.error, o = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
85
- return n.call(
86
- r,
87
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
- o
89
- ), s(e);
90
- }
91
- }
92
- function u(e) {
93
- if (e === h) return "<>";
94
- if (typeof e == "object" && e !== null && e.$$typeof === j)
95
- return "<...>";
96
- try {
97
- var r = a(e);
98
- return r ? "<" + r + ">" : "<...>";
99
- } catch {
100
- return "<...>";
101
- }
102
- }
103
- function t() {
104
- var e = y.A;
105
- return e === null ? null : e.getOwner();
106
- }
107
- function c() {
108
- return Error("react-stack-top-frame");
109
- }
110
- function b(e) {
111
- if (N.call(e, "key")) {
112
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
113
- if (r && r.isReactWarning) return !1;
114
- }
115
- return e.key !== void 0;
116
- }
117
- function d(e, r) {
118
- function n() {
119
- C || (C = !0, console.error(
120
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
121
- r
122
- ));
123
- }
124
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
125
- get: n,
126
- configurable: !0
127
- });
128
- }
129
- function p() {
130
- var e = a(this.type);
131
- return F[e] || (F[e] = !0, console.error(
132
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
133
- )), e = this.props.ref, e !== void 0 ? e : null;
134
- }
135
- function k(e, r, n, o, T, g) {
136
- var l = n.ref;
137
- return e = {
138
- $$typeof: w,
139
- type: e,
140
- key: r,
141
- props: n,
142
- _owner: o
143
- }, (l !== void 0 ? l : null) !== null ? Object.defineProperty(e, "ref", {
144
- enumerable: !1,
145
- get: p
146
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
147
- configurable: !1,
148
- enumerable: !1,
149
- writable: !0,
150
- value: 0
151
- }), Object.defineProperty(e, "_debugInfo", {
152
- configurable: !1,
153
- enumerable: !1,
154
- writable: !0,
155
- value: null
156
- }), Object.defineProperty(e, "_debugStack", {
157
- configurable: !1,
158
- enumerable: !1,
159
- writable: !0,
160
- value: T
161
- }), Object.defineProperty(e, "_debugTask", {
162
- configurable: !1,
163
- enumerable: !1,
164
- writable: !0,
165
- value: g
166
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
167
- }
168
- function R(e, r, n, o, T, g) {
169
- var l = r.children;
170
- if (l !== void 0)
171
- if (o)
172
- if (Q(l)) {
173
- for (o = 0; o < l.length; o++)
174
- A(l[o]);
175
- Object.freeze && Object.freeze(l);
176
- } else
177
- console.error(
178
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
- );
180
- else A(l);
181
- if (N.call(r, "key")) {
182
- l = a(e);
183
- var m = Object.keys(r).filter(function(K) {
184
- return K !== "key";
185
- });
186
- o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", $[l + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error(
187
- `A props object containing a "key" prop is being spread into JSX:
188
- let props = %s;
189
- <%s {...props} />
190
- React keys must be passed directly to JSX without using spread:
191
- let props = %s;
192
- <%s key={someKey} {...props} />`,
193
- o,
194
- l,
195
- m,
196
- l
197
- ), $[l + o] = !0);
198
- }
199
- if (l = null, n !== void 0 && (i(n), l = "" + n), b(r) && (i(r.key), l = "" + r.key), "key" in r) {
200
- n = {};
201
- for (var S in r)
202
- S !== "key" && (n[S] = r[S]);
203
- } else n = r;
204
- return l && d(
205
- n,
206
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
207
- ), k(
208
- e,
209
- l,
210
- n,
211
- t(),
212
- T,
213
- g
214
- );
215
- }
216
- function A(e) {
217
- P(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === j && (e._payload.status === "fulfilled" ? P(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
218
- }
219
- function P(e) {
220
- return typeof e == "object" && e !== null && e.$$typeof === w;
221
- }
222
- var v = ee, w = /* @__PURE__ */ Symbol.for("react.transitional.element"), W = /* @__PURE__ */ Symbol.for("react.portal"), h = /* @__PURE__ */ Symbol.for("react.fragment"), U = /* @__PURE__ */ Symbol.for("react.strict_mode"), q = /* @__PURE__ */ Symbol.for("react.profiler"), J = /* @__PURE__ */ Symbol.for("react.consumer"), V = /* @__PURE__ */ Symbol.for("react.context"), z = /* @__PURE__ */ Symbol.for("react.forward_ref"), G = /* @__PURE__ */ Symbol.for("react.suspense"), X = /* @__PURE__ */ Symbol.for("react.suspense_list"), B = /* @__PURE__ */ Symbol.for("react.memo"), j = /* @__PURE__ */ Symbol.for("react.lazy"), H = /* @__PURE__ */ Symbol.for("react.activity"), Z = /* @__PURE__ */ Symbol.for("react.client.reference"), y = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, N = Object.prototype.hasOwnProperty, Q = Array.isArray, O = console.createTask ? console.createTask : function() {
223
- return null;
224
- };
225
- v = {
226
- react_stack_bottom_frame: function(e) {
227
- return e();
228
- }
229
- };
230
- var C, F = {}, Y = v.react_stack_bottom_frame.bind(
231
- v,
232
- c
233
- )(), D = O(u(c)), $ = {};
234
- E.Fragment = h, E.jsx = function(e, r, n) {
235
- var o = 1e4 > y.recentlyCreatedOwnerStacks++;
236
- return R(
237
- e,
238
- r,
239
- n,
240
- !1,
241
- o ? Error("react-stack-top-frame") : Y,
242
- o ? O(u(e)) : D
243
- );
244
- }, E.jsxs = function(e, r, n) {
245
- var o = 1e4 > y.recentlyCreatedOwnerStacks++;
246
- return R(
247
- e,
248
- r,
249
- n,
250
- !0,
251
- o ? Error("react-stack-top-frame") : Y,
252
- o ? O(u(e)) : D
253
- );
254
- };
255
- })()), E;
256
- }
257
- var M;
258
- function ae() {
259
- return M || (M = 1, process.env.NODE_ENV === "production" ? x.exports = re() : x.exports = te()), x.exports;
260
- }
261
- var f = ae();
262
- function ne({
263
- columns: a,
264
- getCellStyle: s,
265
- headerBgColor: i,
266
- headerFontColor: u
1
+ import { jsx as a, jsxs as s } from "react/jsx-runtime";
2
+ function f({
3
+ columns: e,
4
+ getCellStyle: t,
5
+ headerBgColor: n,
6
+ headerFontColor: l
267
7
  }) {
268
- return /* @__PURE__ */ f.jsx("thead", { children: /* @__PURE__ */ f.jsx("tr", { children: a.map((t, c) => /* @__PURE__ */ f.jsx(
8
+ return /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: e.map((r, d) => /* @__PURE__ */ a(
269
9
  "th",
270
10
  {
271
11
  className: "datatable__th",
272
12
  style: {
273
- ...s(c),
274
- backgroundColor: i,
275
- color: u
13
+ ...t(d),
14
+ backgroundColor: n,
15
+ color: l
276
16
  },
277
- children: t.title
17
+ children: r.title
278
18
  },
279
- t.key
19
+ r.key
280
20
  )) }) });
281
21
  }
282
- function oe({ value: a, style: s }) {
283
- return /* @__PURE__ */ f.jsx("td", { className: "datatable__td", style: s, children: a ?? "" });
22
+ function p({ value: e, style: t }) {
23
+ return /* @__PURE__ */ a("td", { className: "datatable__td", style: t, children: e ?? "" });
284
24
  }
285
- function le({ row: a, columns: s, getCellStyle: i, isLastRow: u }) {
286
- return /* @__PURE__ */ f.jsx("tr", { children: s.map((t) => /* @__PURE__ */ f.jsx(
287
- oe,
25
+ function u({ row: e, columns: t, getCellStyle: n, isLastRow: l }) {
26
+ return /* @__PURE__ */ a("tr", { children: t.map((r) => /* @__PURE__ */ a(
27
+ p,
288
28
  {
289
- value: a[t.key],
290
- style: i(s.indexOf(t), u)
29
+ value: e[r.key],
30
+ style: n(t.indexOf(r), l)
291
31
  },
292
- t.key
32
+ r.key
293
33
  )) });
294
34
  }
295
- function se({ data: a, columns: s, getCellStyle: i }) {
296
- return /* @__PURE__ */ f.jsx("tbody", { children: a.map((u, t) => /* @__PURE__ */ f.jsx(
297
- le,
35
+ function y({ data: e, columns: t, getCellStyle: n }) {
36
+ return /* @__PURE__ */ a("tbody", { children: e.map((l, r) => /* @__PURE__ */ a(
37
+ u,
298
38
  {
299
- row: u,
300
- columns: s,
301
- getCellStyle: i,
302
- isLastRow: t === a.length - 1
39
+ row: l,
40
+ columns: t,
41
+ getCellStyle: n,
42
+ isLastRow: r === e.length - 1
303
43
  },
304
- u.id ?? t
44
+ l.id ?? r
305
45
  )) });
306
46
  }
307
- function ce({
308
- columns: a,
309
- data: s,
310
- headerBgColor: i = "#cccccc",
311
- headerFontColor: u = "#FFFFFF",
312
- fontFamily: t = "sans-serif",
313
- borderColor: c = "#000000",
47
+ function x({
48
+ columns: e,
49
+ data: t,
50
+ headerBgColor: n = "#cccccc",
51
+ headerFontColor: l = "#FFFFFF",
52
+ fontFamily: r = "sans-serif",
53
+ borderColor: d = "#000000",
314
54
  boxShadow: b = "0px 4px 12px rgba(0, 0, 0, 0.15)"
315
55
  }) {
316
- if (!a || a.length === 0)
317
- return /* @__PURE__ */ f.jsx("p", { children: "No columns defined." });
318
- if (!s || s.length === 0)
319
- return /* @__PURE__ */ f.jsx("p", { children: "No data available." });
320
- const d = `0.5px solid ${c}`, p = (k, R = !1) => ({
56
+ if (!e || e.length === 0)
57
+ return /* @__PURE__ */ a("p", { children: "No columns defined." });
58
+ if (!t || t.length === 0)
59
+ return /* @__PURE__ */ a("p", { children: "No data available." });
60
+ const i = `0.5px solid ${d}`, o = (c, h = !1) => ({
321
61
  borderTop: "none",
322
- borderBottom: R ? "none" : d,
62
+ borderBottom: h ? "none" : i,
323
63
  borderLeft: "none",
324
- borderRight: k === a.length - 1 ? "none" : d
64
+ borderRight: c === e.length - 1 ? "none" : i
325
65
  });
326
- return /* @__PURE__ */ f.jsxs(
66
+ return /* @__PURE__ */ s(
327
67
  "table",
328
68
  {
329
69
  className: "datatable",
330
- style: { fontFamily: t, border: d, boxShadow: b },
70
+ style: { fontFamily: r, border: i, boxShadow: b },
331
71
  role: "table",
332
72
  "aria-label": "Data table",
333
73
  children: [
334
- /* @__PURE__ */ f.jsx(
335
- ne,
74
+ /* @__PURE__ */ a(
75
+ f,
336
76
  {
337
- columns: a,
338
- getCellStyle: p,
339
- headerBgColor: i,
340
- headerFontColor: u
77
+ columns: e,
78
+ getCellStyle: o,
79
+ headerBgColor: n,
80
+ headerFontColor: l
341
81
  }
342
82
  ),
343
- /* @__PURE__ */ f.jsx(
344
- se,
83
+ /* @__PURE__ */ a(
84
+ y,
345
85
  {
346
- data: s,
347
- columns: a,
348
- getCellStyle: p
86
+ data: t,
87
+ columns: e,
88
+ getCellStyle: o
349
89
  }
350
90
  )
351
91
  ]
@@ -353,9 +93,9 @@ function ce({
353
93
  );
354
94
  }
355
95
  export {
356
- ce as DataTable,
357
- se as DataTableBody,
358
- oe as DataTableCell,
359
- ne as DataTableHeader,
360
- le as DataTableRow
96
+ x as DataTable,
97
+ y as DataTableBody,
98
+ p as DataTableCell,
99
+ f as DataTableHeader,
100
+ u as DataTableRow
361
101
  };
@@ -1,6 +1 @@
1
- (function(d,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],E):(d=typeof globalThis<"u"?globalThis:d||self,E(d.DataTable={},d.React))})(this,(function(d,E){"use strict";var p={exports:{}},T={};var w;function G(){if(w)return T;w=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function f(u,t,i){var m=null;if(i!==void 0&&(m=""+i),t.key!==void 0&&(m=""+t.key),"key"in t){i={};for(var b in t)b!=="key"&&(i[b]=t[b])}else i=t;return t=i.ref,{$$typeof:a,type:u,key:m,ref:t!==void 0?t:null,props:i}}return T.Fragment=s,T.jsx=f,T.jsxs=f,T}var R={};var N;function B(){return N||(N=1,process.env.NODE_ENV!=="production"&&(function(){function a(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===se?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case x:return"Fragment";case K:return"Profiler";case Q:return"StrictMode";case ae:return"Suspense";case ne:return"SuspenseList";case le:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Z:return"Portal";case re:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case te:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case oe:return r=e.displayName||null,r!==null?r:a(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return a(e(r))}catch{}}return null}function s(e){return""+e}function f(e){try{s(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,o=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),s(e)}}function u(e){if(e===x)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=a(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function t(){var e=S.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function m(e){if(W.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function b(e,r){function n(){U||(U=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function v(){var e=a(this.type);return q[e]||(q[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function j(e,r,n,o,k,A){var l=n.ref;return e={$$typeof:M,type:e,key:r,props:n,_owner:o},(l!==void 0?l:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:v}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:k}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function h(e,r,n,o,k,A){var l=r.children;if(l!==void 0)if(o)if(ue(l)){for(o=0;o<l.length;o++)I(l[o]);Object.freeze&&Object.freeze(l)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else I(l);if(W.call(r,"key")){l=a(e);var _=Object.keys(r).filter(function(ie){return ie!=="key"});o=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",z[l+o]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
- let props = %s;
3
- <%s {...props} />
4
- React keys must be passed directly to JSX without using spread:
5
- let props = %s;
6
- <%s key={someKey} {...props} />`,o,l,_,l),z[l+o]=!0)}if(l=null,n!==void 0&&(f(n),l=""+n),m(r)&&(f(r.key),l=""+r.key),"key"in r){n={};for(var P in r)P!=="key"&&(n[P]=r[P])}else n=r;return l&&b(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),j(e,l,n,t(),k,A)}function I(e){L(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?L(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function L(e){return typeof e=="object"&&e!==null&&e.$$typeof===M}var y=E,M=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),re=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),oe=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),se=Symbol.for("react.client.reference"),S=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,ue=Array.isArray,g=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(e){return e()}};var U,q={},J=y.react_stack_bottom_frame.bind(y,i)(),V=g(u(i)),z={};R.Fragment=x,R.jsx=function(e,r,n){var o=1e4>S.recentlyCreatedOwnerStacks++;return h(e,r,n,!1,o?Error("react-stack-top-frame"):J,o?g(u(e)):V)},R.jsxs=function(e,r,n){var o=1e4>S.recentlyCreatedOwnerStacks++;return h(e,r,n,!0,o?Error("react-stack-top-frame"):J,o?g(u(e)):V)}})()),R}var C;function X(){return C||(C=1,process.env.NODE_ENV==="production"?p.exports=G():p.exports=B()),p.exports}var c=X();function D({columns:a,getCellStyle:s,headerBgColor:f,headerFontColor:u}){return c.jsx("thead",{children:c.jsx("tr",{children:a.map((t,i)=>c.jsx("th",{className:"datatable__th",style:{...s(i),backgroundColor:f,color:u},children:t.title},t.key))})})}function F({value:a,style:s}){return c.jsx("td",{className:"datatable__td",style:s,children:a??""})}function Y({row:a,columns:s,getCellStyle:f,isLastRow:u}){return c.jsx("tr",{children:s.map(t=>c.jsx(F,{value:a[t.key],style:f(s.indexOf(t),u)},t.key))})}function $({data:a,columns:s,getCellStyle:f}){return c.jsx("tbody",{children:a.map((u,t)=>c.jsx(Y,{row:u,columns:s,getCellStyle:f,isLastRow:t===a.length-1},u.id??t))})}function H({columns:a,data:s,headerBgColor:f="#cccccc",headerFontColor:u="#FFFFFF",fontFamily:t="sans-serif",borderColor:i="#000000",boxShadow:m="0px 4px 12px rgba(0, 0, 0, 0.15)"}){if(!a||a.length===0)return c.jsx("p",{children:"No columns defined."});if(!s||s.length===0)return c.jsx("p",{children:"No data available."});const b=`0.5px solid ${i}`,v=(j,h=!1)=>({borderTop:"none",borderBottom:h?"none":b,borderLeft:"none",borderRight:j===a.length-1?"none":b});return c.jsxs("table",{className:"datatable",style:{fontFamily:t,border:b,boxShadow:m},role:"table","aria-label":"Data table",children:[c.jsx(D,{columns:a,getCellStyle:v,headerBgColor:f,headerFontColor:u}),c.jsx($,{data:s,columns:a,getCellStyle:v})]})}d.DataTable=H,d.DataTableBody=$,d.DataTableCell=F,d.DataTableHeader=D,d.DataTableRow=Y,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l.DataTable={},l.jsxRuntime))})(this,(function(l,e){"use strict";function b({columns:a,getCellStyle:t,headerBgColor:d,headerFontColor:n}){return e.jsx("thead",{children:e.jsx("tr",{children:a.map((r,o)=>e.jsx("th",{className:"datatable__th",style:{...t(o),backgroundColor:d,color:n},children:r.title},r.key))})})}function c({value:a,style:t}){return e.jsx("td",{className:"datatable__td",style:t,children:a??""})}function f({row:a,columns:t,getCellStyle:d,isLastRow:n}){return e.jsx("tr",{children:t.map(r=>e.jsx(c,{value:a[r.key],style:d(t.indexOf(r),n)},r.key))})}function s({data:a,columns:t,getCellStyle:d}){return e.jsx("tbody",{children:a.map((n,r)=>e.jsx(f,{row:n,columns:t,getCellStyle:d,isLastRow:r===a.length-1},n.id??r))})}function y({columns:a,data:t,headerBgColor:d="#cccccc",headerFontColor:n="#FFFFFF",fontFamily:r="sans-serif",borderColor:o="#000000",boxShadow:T="0px 4px 12px rgba(0, 0, 0, 0.15)"}){if(!a||a.length===0)return e.jsx("p",{children:"No columns defined."});if(!t||t.length===0)return e.jsx("p",{children:"No data available."});const i=`0.5px solid ${o}`,h=(p,D=!1)=>({borderTop:"none",borderBottom:D?"none":i,borderLeft:"none",borderRight:p===a.length-1?"none":i});return e.jsxs("table",{className:"datatable",style:{fontFamily:r,border:i,boxShadow:T},role:"table","aria-label":"Data table",children:[e.jsx(b,{columns:a,getCellStyle:h,headerBgColor:d,headerFontColor:n}),e.jsx(s,{data:t,columns:a,getCellStyle:h})]})}l.DataTable=y,l.DataTableBody=s,l.DataTableCell=c,l.DataTableHeader=b,l.DataTableRow=f,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngnyan/data-table",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "main": "dist/data-table.umd.js",
6
6
  "module": "dist/data-table.es.js",
@@ -31,6 +31,8 @@
31
31
  "react-dom": "^18.0.0 || ^19.0.0"
32
32
  },
33
33
  "devDependencies": {
34
+ "react": "^19.0.0",
35
+ "react-dom": "^19.0.0",
34
36
  "@vitejs/plugin-react": "^5.1.1",
35
37
  "vite": "^7.3.1",
36
38
  "@types/react": "^19.2.7",