@sito/dashboard 0.0.8 → 0.0.9
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/components/Table/types.d.ts +1 -0
- package/dist/dashboard.cjs +1 -1
- package/dist/dashboard.js +143 -142
- package/package.json +1 -1
package/dist/dashboard.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var H=require("./main.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react");var y=(t=>(t.ASC="ASC",t.DESC="DESC",t))(y||{});const _=[20,50,100],w=d.createContext({}),A=t=>{const{children:s}=t,[l,n]=d.useState(0),[r,a]=d.useState(20),[m,p]=d.useState(0),[x,j]=d.useState("id"),[o,i]=d.useState(y.ASC),b={onSort:d.useCallback(c=>{let g=o;if(x===c)switch(o){case y.ASC:g=y.DESC;break;default:g=y.ASC;break}j(c),i(g)},[x,o]),total:l,setTotal:n,sortingBy:x,sortingOrder:o,pageSize:r,pageSizes:_,setPageSize:a,currentPage:m,setCurrentPage:p};return e.jsx(w.Provider,{value:b,children:s})},N=()=>{const t=d.useContext(w);if(t===void 0)throw new Error("tableOptionsContext must be used within a Provider");return t},S=d.createContext({});function M(t){const{children:s,t:l}=t;return e.jsx(S.Provider,{value:{t:l},children:s})}const v=()=>{const t=d.useContext(S);if(t===void 0)throw new Error("translationContext must be used within a Provider");return t};function D(t){const{content:s,children:l}=t;return e.jsxs("div",{className:"tooltip-container",children:[l,e.jsx("div",{className:"tooltip-text",children:s})]})}function k(t){const{color:s="stroke-blue-800",loaderClass:l,strokeWidth:n="4",...r}=t;return e.jsx("div",{...r,className:`loading ${r.className}`,children:e.jsx("div",{className:"loader-container",children:e.jsx("div",{className:`loader ${l}`,children:e.jsx("svg",{className:"circular",viewBox:"25 25 50 50",children:e.jsx("circle",{className:`path ${s}`,cx:"50",cy:"50",r:"20",fill:"none",strokeWidth:n,strokeMiterlimit:"10"})})})})})}function E(){const{t}=v();return e.jsx("div",{className:"w-full flex items-center justify-center py-2 border-t-[1px]",children:e.jsx("p",{children:t("_accessibility:components.table.empty")})})}function P(t){const{className:s}=t;return e.jsx("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:e.jsx("path",{d:"M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"})})}function T(t){const{className:s}=t;return e.jsx("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:e.jsx("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})})}function B(t){const{t:s}=v(),{entity:l="",columns:n=[],hasAction:r=!0,columnsOptions:a}=t,{onSort:m,sortingOrder:p,sortingBy:x}=N(),j=d.useMemo(()=>{const{noSortableColumns:o={},columnClassNames:i={}}=a??{};return n==null?void 0:n.map(u=>({id:u.key,label:u.label,className:i[u.key]??"",sortable:!o[u.key]}))},[n,a,l,s]);return e.jsx("thead",{className:"text-xs text-gray-700 bg-gray-50",children:e.jsxs("tr",{children:[j.map(o=>{var i,u,b,c;return e.jsx("th",{scope:"col",className:`px-6 py-3 ${o.className}`,children:e.jsxs("button",{disabled:!o.sortable,onClick:()=>m(o.id),className:"flex items-center gap-2",children:[e.jsx("span",{className:"whitespace-nowrap",children:o.label}),o.sortable&&e.jsx("span",{className:`${x===o.id?"opacity-100":"opacity-0"}`,children:p===y.ASC?((i=a==null?void 0:a.icons)==null?void 0:i.asc)??e.jsx(P,{className:((u=a==null?void 0:a.icons)==null?void 0:u.className)??"w-3"}):((b=a==null?void 0:a.icons)==null?void 0:b.desc)??e.jsx(T,{className:((c=a==null?void 0:a.icons)==null?void 0:c.className)??"w-3"})})]})},o.id)}),r&&e.jsx("th",{scope:"col",className:"px-6 py-3 text-center",children:s("_accessibility:labels.actions")})]})})}var $=(t=>(t.error="error",t.good="good",t.default="default",t))($||{});const L=t=>{switch(t){case"error":return"border-red-500 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";case"good":return"border-green-500 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";default:return"text-gray-900 border-gray-300 focus:border-blue-600"}},F=t=>{switch(t){case"error":return"peer-focus:text-red-700 text-red-700";case"good":return"peer-focus:text-green-700 text-green-700";default:return"peer-focus:text-blue-600 text-gray-500"}},q=t=>{switch(t){case"error":return"text-red-600";case"good":return"text-green-600";default:return"text-gray-500"}},I=d.forwardRef(function(t,s){const{value:l,onChange:n,options:r,containerClassName:a="",inputClassName:m="",labelClassName:p="",helperText:x="",helperTextClassName:j="",placeholder:o="",label:i="",name:u="",id:b="",state:c=$.default,...g}=t;return d.useEffect(()=>{var f;(!l||l==="")&&(r!=null&&r.length)&&n({target:{value:(f=r[0])==null?void 0:f.id}})},[n,r,l]),e.jsxs("div",{className:`relative z-0 w-full mb-5 group ${a}`,children:[e.jsx("select",{...g,id:b,ref:s,name:u,value:l,onChange:n,className:`block py-2.5 px-0 w-full text-sm bg-transparent border-0 border-b-2 appearance-none focus:outline-none focus:ring-0 disabled:text-[#6b7280] ${L(c)} peer ${m}`,children:r==null?void 0:r.map(f=>e.jsx("option",{value:f.id,children:f.value},f.id))}),e.jsx("label",{htmlFor:u,className:`peer-focus:font-medium absolute text-sm duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:start-0 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 ${F(c)} ${p}`,children:i}),e.jsx("p",{className:`mt-2 text-sm ${q(c)} ${j}`,children:c!=="error"&&c!=="good"?o:x})]})}),R=I;function U(){const{t}=v(),{pageSizes:s,pageSize:l,setPageSize:n}=N(),r=d.useMemo(()=>s==null?void 0:s.map(a=>({id:a,value:a})),[s]);return e.jsxs("div",{className:"flex gap-2 items-center justify-start",children:[e.jsx("p",{children:t("_accessibility:components.table.pageSizes")}),e.jsx(R,{value:l,options:r,inputClassName:"!py-0 !pl-2 !pr-7 !border-none font-bold",containerClassName:"!w-auto !mb-0 !border-none",helperTextClassName:"hidden",onChange:a=>n(a.target.value)})]})}function W(){const{t}=v(),{total:s,pageSize:l,pageSizes:n,currentPage:r,setCurrentPage:a}=N(),m=(r+1)*l>s?s:(r+1)*l;return e.jsxs("div",{className:"flex w-full items-center justify-between mt-5",children:[e.jsxs("div",{className:"flex w-full items-center justify-start gap-1",children:[e.jsx("p",{children:t("_accessibility:components.table.pageSizes")}),n[0]<s&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[t("_accessibility:components.table.from")," ",r*l+1," ",t("_accessibility:components.table.to")," ",m," ",t("_accessibility:components.table.of")]})}),e.jsxs("p",{children:[s," ",t("_accessibility:components.table.results")]})]}),e.jsxs("div",{className:"flex gap-5 items-center justify-end",children:[e.jsx("button",{className:"disabled:text-light-primary/40",disabled:r===0,onClick:()=>a(r-1),children:t("_accessibility:buttons.previous")}),e.jsx("button",{disabled:Math.floor(s/((r+1)*l))===0,className:"disabled:text-light-primary/40",onClick:()=>a(r+1),children:t("_accessibility:buttons.next")})]})]})}function G(t){const{t:s}=v(),{title:l="",rows:n,parseRows:r,entity:a="",isLoading:m=!1,actions:p=[],columns:x=[],contentClassName:j="h-[calc(100vh-280px)]",className:o="bg-gray-50",columnsOptions:i,softDeleteProperty:u="deleted"}=t,b=d.useMemo(()=>(n==null?void 0:n.map(c=>r(c)))??[],[r,n,s]);return e.jsxs("div",{className:`${o} relative overflow-x-auto w-full h-full`,children:[e.jsx("div",{className:"mb-5 flex w-full items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl md:text-3xl font-bold",children:l}),n!=null&&n.length&&!m?e.jsx(U,{}):null]})}),m?e.jsx(k,{className:"bg-white top-0 left-0 w-full h-full"}):e.jsx("div",{className:`${j} overflow-auto`,children:n!=null&&n.length?e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full text-sm text-left text-gray-500",children:[e.jsx(B,{entity:a,columns:x,columnsOptions:i,hasAction:(p==null?void 0:p.length)>0}),e.jsx("tbody",{children:b==null?void 0:b.map(c=>{var g,f;return e.jsxs("tr",{className:`border-b ${(g=c.softDeleteProperty)!=null&&g.value?"bg-secondary/10":"bg-white"}`,children:[x==null?void 0:x.map((h,z)=>{var C;return e.jsx("td",{className:`px-6 py-4 font-medium ${z===0?"text-gray-900 whitespace-nowrap":""} ${i!=null&&i.columnClassNames?i==null?void 0:i.columnClassNames[h.key]:""}`,children:((C=c[h.key])==null?void 0:C.render)??c[h.key]},h.key)}),p.length?e.jsx("td",{children:e.jsx("div",{className:"flex items-center gap-3 w-full justify-center",children:(f=p.filter(h=>!h.hidden||!h.hidden(c)))==null?void 0:f.map(h=>e.jsx(D,{content:h.tooltip,children:e.jsx("button",{onClick:()=>h.onClick(c),children:h.icon})},h.id))})}):null]},c.id)})})]}),e.jsx(W,{})]}):e.jsx(E,{})})]})}exports.ChevronDown=T;exports.ChevronUp=P;exports.Loading=k;exports.Table=G;exports.TableOptionsProvider=A;exports.TranslationProvider=M;exports.useTableOptions=N;exports.useTranslation=v;
|
package/dist/dashboard.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
|
-
import { jsx as t, jsxs as
|
|
3
|
-
import { createContext as
|
|
4
|
-
var
|
|
5
|
-
const
|
|
6
|
-
const { children: r } = e, [n, l] =
|
|
7
|
-
onSort:
|
|
8
|
-
(
|
|
9
|
-
let
|
|
10
|
-
if (
|
|
11
|
-
switch (
|
|
12
|
-
case
|
|
13
|
-
|
|
2
|
+
import { jsx as t, jsxs as d, Fragment as $ } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as P, useState as v, useCallback as E, useContext as z, useMemo as w, forwardRef as B, useEffect as D } from "react";
|
|
4
|
+
var N = /* @__PURE__ */ ((e) => (e.ASC = "ASC", e.DESC = "DESC", e))(N || {});
|
|
5
|
+
const M = [20, 50, 100], T = P({}), O = (e) => {
|
|
6
|
+
const { children: r } = e, [n, l] = v(0), [s, a] = v(20), [f, m] = v(0), [u, y] = v("id"), [i, o] = v(N.ASC), b = {
|
|
7
|
+
onSort: E(
|
|
8
|
+
(c) => {
|
|
9
|
+
let x = i;
|
|
10
|
+
if (u === c)
|
|
11
|
+
switch (i) {
|
|
12
|
+
case N.ASC:
|
|
13
|
+
x = N.DESC;
|
|
14
14
|
break;
|
|
15
15
|
default:
|
|
16
|
-
|
|
16
|
+
x = N.ASC;
|
|
17
17
|
break;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
y(c), o(x);
|
|
20
20
|
},
|
|
21
|
-
[
|
|
21
|
+
[u, i]
|
|
22
22
|
),
|
|
23
23
|
total: n,
|
|
24
24
|
setTotal: l,
|
|
25
|
-
sortingBy:
|
|
26
|
-
sortingOrder:
|
|
25
|
+
sortingBy: u,
|
|
26
|
+
sortingOrder: i,
|
|
27
27
|
pageSize: s,
|
|
28
|
-
pageSizes:
|
|
28
|
+
pageSizes: M,
|
|
29
29
|
setPageSize: a,
|
|
30
|
-
currentPage:
|
|
31
|
-
setCurrentPage:
|
|
30
|
+
currentPage: f,
|
|
31
|
+
setCurrentPage: m
|
|
32
32
|
};
|
|
33
|
-
return /* @__PURE__ */ t(
|
|
34
|
-
},
|
|
35
|
-
const e =
|
|
33
|
+
return /* @__PURE__ */ t(T.Provider, { value: b, children: r });
|
|
34
|
+
}, S = () => {
|
|
35
|
+
const e = z(T);
|
|
36
36
|
if (e === void 0)
|
|
37
37
|
throw new Error("tableOptionsContext must be used within a Provider");
|
|
38
38
|
return e;
|
|
39
|
-
},
|
|
40
|
-
function
|
|
39
|
+
}, _ = P({});
|
|
40
|
+
function ee(e) {
|
|
41
41
|
const { children: r, t: n } = e;
|
|
42
|
-
return /* @__PURE__ */ t(
|
|
42
|
+
return /* @__PURE__ */ t(_.Provider, { value: { t: n }, children: r });
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
const e =
|
|
44
|
+
const C = () => {
|
|
45
|
+
const e = z(_);
|
|
46
46
|
if (e === void 0)
|
|
47
47
|
throw new Error("translationContext must be used within a Provider");
|
|
48
48
|
return e;
|
|
49
49
|
};
|
|
50
|
-
function
|
|
50
|
+
function L(e) {
|
|
51
51
|
const { content: r, children: n } = e;
|
|
52
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ d("div", { className: "tooltip-container", children: [
|
|
53
53
|
n,
|
|
54
54
|
/* @__PURE__ */ t("div", { className: "tooltip-text", children: r })
|
|
55
55
|
] });
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function F(e) {
|
|
58
58
|
const {
|
|
59
59
|
color: r = "stroke-blue-800",
|
|
60
60
|
loaderClass: n,
|
|
@@ -74,11 +74,11 @@ function D(e) {
|
|
|
74
74
|
}
|
|
75
75
|
) }) }) }) });
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
const { t: e } =
|
|
77
|
+
function I() {
|
|
78
|
+
const { t: e } = C();
|
|
79
79
|
return /* @__PURE__ */ t("div", { className: "w-full flex items-center justify-center py-2 border-t-[1px]", children: /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.empty") }) });
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function R(e) {
|
|
82
82
|
const { className: r } = e;
|
|
83
83
|
return /* @__PURE__ */ t(
|
|
84
84
|
"svg",
|
|
@@ -90,7 +90,7 @@ function F(e) {
|
|
|
90
90
|
}
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function U(e) {
|
|
94
94
|
const { className: r } = e;
|
|
95
95
|
return /* @__PURE__ */ t(
|
|
96
96
|
"svg",
|
|
@@ -102,45 +102,45 @@ function I(e) {
|
|
|
102
102
|
}
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
const { t: r } =
|
|
107
|
-
const { noSortableColumns:
|
|
108
|
-
return l == null ? void 0 : l.map((
|
|
109
|
-
id:
|
|
110
|
-
label:
|
|
111
|
-
className: o[
|
|
112
|
-
sortable: !
|
|
105
|
+
function W(e) {
|
|
106
|
+
const { t: r } = C(), { entity: n = "", columns: l = [], hasAction: s = !0, columnsOptions: a } = e, { onSort: f, sortingOrder: m, sortingBy: u } = S(), y = w(() => {
|
|
107
|
+
const { noSortableColumns: i = {}, columnClassNames: o = {} } = a ?? {};
|
|
108
|
+
return l == null ? void 0 : l.map((h) => ({
|
|
109
|
+
id: h.key,
|
|
110
|
+
label: h.label,
|
|
111
|
+
className: o[h.key] ?? "",
|
|
112
|
+
sortable: !i[h.key]
|
|
113
113
|
}));
|
|
114
114
|
}, [l, a, n, r]);
|
|
115
|
-
return /* @__PURE__ */ t("thead", { className: "text-xs text-gray-700 bg-gray-50", children: /* @__PURE__ */
|
|
116
|
-
|
|
117
|
-
var o,
|
|
115
|
+
return /* @__PURE__ */ t("thead", { className: "text-xs text-gray-700 bg-gray-50", children: /* @__PURE__ */ d("tr", { children: [
|
|
116
|
+
y.map((i) => {
|
|
117
|
+
var o, h, b, c;
|
|
118
118
|
return /* @__PURE__ */ t(
|
|
119
119
|
"th",
|
|
120
120
|
{
|
|
121
121
|
scope: "col",
|
|
122
|
-
className: `px-6 py-3 ${
|
|
123
|
-
children: /* @__PURE__ */
|
|
122
|
+
className: `px-6 py-3 ${i.className}`,
|
|
123
|
+
children: /* @__PURE__ */ d(
|
|
124
124
|
"button",
|
|
125
125
|
{
|
|
126
|
-
disabled: !
|
|
127
|
-
onClick: () =>
|
|
126
|
+
disabled: !i.sortable,
|
|
127
|
+
onClick: () => f(i.id),
|
|
128
128
|
className: "flex items-center gap-2",
|
|
129
129
|
children: [
|
|
130
|
-
/* @__PURE__ */ t("span", { className: "whitespace-nowrap", children:
|
|
131
|
-
|
|
130
|
+
/* @__PURE__ */ t("span", { className: "whitespace-nowrap", children: i.label }),
|
|
131
|
+
i.sortable && /* @__PURE__ */ t(
|
|
132
132
|
"span",
|
|
133
133
|
{
|
|
134
|
-
className: `${
|
|
135
|
-
children:
|
|
136
|
-
|
|
134
|
+
className: `${u === i.id ? "opacity-100" : "opacity-0"}`,
|
|
135
|
+
children: m === N.ASC ? ((o = a == null ? void 0 : a.icons) == null ? void 0 : o.asc) ?? /* @__PURE__ */ t(
|
|
136
|
+
R,
|
|
137
137
|
{
|
|
138
|
-
className: ((
|
|
138
|
+
className: ((h = a == null ? void 0 : a.icons) == null ? void 0 : h.className) ?? "w-3"
|
|
139
139
|
}
|
|
140
|
-
) : ((
|
|
141
|
-
|
|
140
|
+
) : ((b = a == null ? void 0 : a.icons) == null ? void 0 : b.desc) ?? /* @__PURE__ */ t(
|
|
141
|
+
U,
|
|
142
142
|
{
|
|
143
|
-
className: ((
|
|
143
|
+
className: ((c = a == null ? void 0 : a.icons) == null ? void 0 : c.className) ?? "w-3"
|
|
144
144
|
}
|
|
145
145
|
)
|
|
146
146
|
}
|
|
@@ -149,14 +149,14 @@ function R(e) {
|
|
|
149
149
|
}
|
|
150
150
|
)
|
|
151
151
|
},
|
|
152
|
-
|
|
152
|
+
i.id
|
|
153
153
|
);
|
|
154
154
|
}),
|
|
155
155
|
s && /* @__PURE__ */ t("th", { scope: "col", className: "px-6 py-3 text-center", children: r("_accessibility:labels.actions") })
|
|
156
156
|
] }) });
|
|
157
157
|
}
|
|
158
|
-
var
|
|
159
|
-
const
|
|
158
|
+
var j = /* @__PURE__ */ ((e) => (e.error = "error", e.good = "good", e.default = "default", e))(j || {});
|
|
159
|
+
const q = (e) => {
|
|
160
160
|
switch (e) {
|
|
161
161
|
case "error":
|
|
162
162
|
return "border-red-500 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";
|
|
@@ -165,7 +165,7 @@ const U = (e) => {
|
|
|
165
165
|
default:
|
|
166
166
|
return "text-gray-900 border-gray-300 focus:border-blue-600";
|
|
167
167
|
}
|
|
168
|
-
},
|
|
168
|
+
}, G = (e) => {
|
|
169
169
|
switch (e) {
|
|
170
170
|
case "error":
|
|
171
171
|
return "peer-focus:text-red-700 text-red-700";
|
|
@@ -174,7 +174,7 @@ const U = (e) => {
|
|
|
174
174
|
default:
|
|
175
175
|
return "peer-focus:text-blue-600 text-gray-500";
|
|
176
176
|
}
|
|
177
|
-
},
|
|
177
|
+
}, H = (e) => {
|
|
178
178
|
switch (e) {
|
|
179
179
|
case "error":
|
|
180
180
|
return "text-red-600";
|
|
@@ -183,66 +183,66 @@ const U = (e) => {
|
|
|
183
183
|
default:
|
|
184
184
|
return "text-gray-500";
|
|
185
185
|
}
|
|
186
|
-
},
|
|
186
|
+
}, J = B(function(e, r) {
|
|
187
187
|
const {
|
|
188
188
|
value: n,
|
|
189
189
|
onChange: l,
|
|
190
190
|
options: s,
|
|
191
191
|
containerClassName: a = "",
|
|
192
|
-
inputClassName:
|
|
193
|
-
labelClassName:
|
|
194
|
-
helperText:
|
|
195
|
-
helperTextClassName:
|
|
196
|
-
placeholder:
|
|
192
|
+
inputClassName: f = "",
|
|
193
|
+
labelClassName: m = "",
|
|
194
|
+
helperText: u = "",
|
|
195
|
+
helperTextClassName: y = "",
|
|
196
|
+
placeholder: i = "",
|
|
197
197
|
label: o = "",
|
|
198
|
-
name:
|
|
199
|
-
id:
|
|
200
|
-
state:
|
|
201
|
-
...
|
|
198
|
+
name: h = "",
|
|
199
|
+
id: b = "",
|
|
200
|
+
state: c = j.default,
|
|
201
|
+
...x
|
|
202
202
|
} = e;
|
|
203
|
-
return
|
|
203
|
+
return D(() => {
|
|
204
204
|
var g;
|
|
205
205
|
(!n || n === "") && (s != null && s.length) && l({ target: { value: (g = s[0]) == null ? void 0 : g.id } });
|
|
206
|
-
}, [l, s, n]), /* @__PURE__ */
|
|
206
|
+
}, [l, s, n]), /* @__PURE__ */ d("div", { className: `relative z-0 w-full mb-5 group ${a}`, children: [
|
|
207
207
|
/* @__PURE__ */ t(
|
|
208
208
|
"select",
|
|
209
209
|
{
|
|
210
|
-
...
|
|
211
|
-
id:
|
|
210
|
+
...x,
|
|
211
|
+
id: b,
|
|
212
212
|
ref: r,
|
|
213
|
-
name:
|
|
213
|
+
name: h,
|
|
214
214
|
value: n,
|
|
215
215
|
onChange: l,
|
|
216
|
-
className: `block py-2.5 px-0 w-full text-sm bg-transparent border-0 border-b-2 appearance-none focus:outline-none focus:ring-0 disabled:text-[#6b7280] ${
|
|
216
|
+
className: `block py-2.5 px-0 w-full text-sm bg-transparent border-0 border-b-2 appearance-none focus:outline-none focus:ring-0 disabled:text-[#6b7280] ${q(c)} peer ${f}`,
|
|
217
217
|
children: s == null ? void 0 : s.map((g) => /* @__PURE__ */ t("option", { value: g.id, children: g.value }, g.id))
|
|
218
218
|
}
|
|
219
219
|
),
|
|
220
220
|
/* @__PURE__ */ t(
|
|
221
221
|
"label",
|
|
222
222
|
{
|
|
223
|
-
htmlFor:
|
|
224
|
-
className: `peer-focus:font-medium absolute text-sm duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:start-0 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 ${
|
|
223
|
+
htmlFor: h,
|
|
224
|
+
className: `peer-focus:font-medium absolute text-sm duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:start-0 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 ${G(c)} ${m}`,
|
|
225
225
|
children: o
|
|
226
226
|
}
|
|
227
227
|
),
|
|
228
228
|
/* @__PURE__ */ t(
|
|
229
229
|
"p",
|
|
230
230
|
{
|
|
231
|
-
className: `mt-2 text-sm ${
|
|
232
|
-
children:
|
|
231
|
+
className: `mt-2 text-sm ${H(c)} ${y}`,
|
|
232
|
+
children: c !== "error" && c !== "good" ? i : u
|
|
233
233
|
}
|
|
234
234
|
)
|
|
235
235
|
] });
|
|
236
|
-
}),
|
|
237
|
-
function
|
|
238
|
-
const { t: e } =
|
|
236
|
+
}), K = J;
|
|
237
|
+
function Q() {
|
|
238
|
+
const { t: e } = C(), { pageSizes: r, pageSize: n, setPageSize: l } = S(), s = w(
|
|
239
239
|
() => r == null ? void 0 : r.map((a) => ({ id: a, value: a })),
|
|
240
240
|
[r]
|
|
241
241
|
);
|
|
242
|
-
return /* @__PURE__ */
|
|
242
|
+
return /* @__PURE__ */ d("div", { className: "flex gap-2 items-center justify-start", children: [
|
|
243
243
|
/* @__PURE__ */ t("p", { children: e("_accessibility:components.table.pageSizes") }),
|
|
244
244
|
/* @__PURE__ */ t(
|
|
245
|
-
|
|
245
|
+
K,
|
|
246
246
|
{
|
|
247
247
|
value: n,
|
|
248
248
|
options: s,
|
|
@@ -254,29 +254,29 @@ function J() {
|
|
|
254
254
|
)
|
|
255
255
|
] });
|
|
256
256
|
}
|
|
257
|
-
function
|
|
258
|
-
const { t: e } =
|
|
259
|
-
return /* @__PURE__ */
|
|
260
|
-
/* @__PURE__ */
|
|
257
|
+
function V() {
|
|
258
|
+
const { t: e } = C(), { total: r, pageSize: n, pageSizes: l, currentPage: s, setCurrentPage: a } = S(), f = (s + 1) * n > r ? r : (s + 1) * n;
|
|
259
|
+
return /* @__PURE__ */ d("div", { className: "flex w-full items-center justify-between mt-5", children: [
|
|
260
|
+
/* @__PURE__ */ d("div", { className: "flex w-full items-center justify-start gap-1", children: [
|
|
261
261
|
/* @__PURE__ */ t("p", { children: e("_accessibility:components.table.pageSizes") }),
|
|
262
|
-
l[0] < r && /* @__PURE__ */ t(
|
|
262
|
+
l[0] < r && /* @__PURE__ */ t($, { children: /* @__PURE__ */ d("p", { children: [
|
|
263
263
|
e("_accessibility:components.table.from"),
|
|
264
264
|
" ",
|
|
265
265
|
s * n + 1,
|
|
266
266
|
" ",
|
|
267
267
|
e("_accessibility:components.table.to"),
|
|
268
268
|
" ",
|
|
269
|
-
|
|
269
|
+
f,
|
|
270
270
|
" ",
|
|
271
271
|
e("_accessibility:components.table.of")
|
|
272
272
|
] }) }),
|
|
273
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ d("p", { children: [
|
|
274
274
|
r,
|
|
275
275
|
" ",
|
|
276
276
|
e("_accessibility:components.table.results")
|
|
277
277
|
] })
|
|
278
278
|
] }),
|
|
279
|
-
/* @__PURE__ */
|
|
279
|
+
/* @__PURE__ */ d("div", { className: "flex gap-5 items-center justify-end", children: [
|
|
280
280
|
/* @__PURE__ */ t(
|
|
281
281
|
"button",
|
|
282
282
|
{
|
|
@@ -298,83 +298,84 @@ function K() {
|
|
|
298
298
|
] })
|
|
299
299
|
] });
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
const { t: r } =
|
|
301
|
+
function te(e) {
|
|
302
|
+
const { t: r } = C(), {
|
|
303
303
|
title: n = "",
|
|
304
304
|
rows: l,
|
|
305
305
|
parseRows: s,
|
|
306
306
|
entity: a = "",
|
|
307
|
-
isLoading:
|
|
308
|
-
actions:
|
|
309
|
-
columns:
|
|
310
|
-
contentClassName:
|
|
311
|
-
className:
|
|
312
|
-
columnsOptions: o
|
|
313
|
-
|
|
314
|
-
|
|
307
|
+
isLoading: f = !1,
|
|
308
|
+
actions: m = [],
|
|
309
|
+
columns: u = [],
|
|
310
|
+
contentClassName: y = "h-[calc(100vh-280px)]",
|
|
311
|
+
className: i = "bg-gray-50",
|
|
312
|
+
columnsOptions: o,
|
|
313
|
+
softDeleteProperty: h = "deleted"
|
|
314
|
+
} = e, b = w(
|
|
315
|
+
() => (l == null ? void 0 : l.map((c) => s(c))) ?? [],
|
|
315
316
|
[s, l, r]
|
|
316
317
|
);
|
|
317
|
-
return /* @__PURE__ */
|
|
318
|
-
/* @__PURE__ */ t("div", { className: "mb-5 flex w-full items-center justify-between", children: /* @__PURE__ */
|
|
318
|
+
return /* @__PURE__ */ d("div", { className: `${i} relative overflow-x-auto w-full h-full`, children: [
|
|
319
|
+
/* @__PURE__ */ t("div", { className: "mb-5 flex w-full items-center justify-between", children: /* @__PURE__ */ d("div", { children: [
|
|
319
320
|
/* @__PURE__ */ t("h1", { className: "text-2xl md:text-3xl font-bold", children: n }),
|
|
320
|
-
l != null && l.length && !
|
|
321
|
+
l != null && l.length && !f ? /* @__PURE__ */ t(Q, {}) : null
|
|
321
322
|
] }) }),
|
|
322
|
-
|
|
323
|
-
/* @__PURE__ */
|
|
323
|
+
f ? /* @__PURE__ */ t(F, { className: "bg-white top-0 left-0 w-full h-full" }) : /* @__PURE__ */ t("div", { className: `${y} overflow-auto`, children: l != null && l.length ? /* @__PURE__ */ d($, { children: [
|
|
324
|
+
/* @__PURE__ */ d("table", { className: "w-full text-sm text-left text-gray-500", children: [
|
|
324
325
|
/* @__PURE__ */ t(
|
|
325
|
-
|
|
326
|
+
W,
|
|
326
327
|
{
|
|
327
328
|
entity: a,
|
|
328
|
-
columns:
|
|
329
|
+
columns: u,
|
|
329
330
|
columnsOptions: o,
|
|
330
|
-
hasAction: (
|
|
331
|
+
hasAction: (m == null ? void 0 : m.length) > 0
|
|
331
332
|
}
|
|
332
333
|
),
|
|
333
|
-
/* @__PURE__ */ t("tbody", { children:
|
|
334
|
-
var
|
|
335
|
-
return /* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ t("tbody", { children: b == null ? void 0 : b.map((c) => {
|
|
335
|
+
var x, g;
|
|
336
|
+
return /* @__PURE__ */ d(
|
|
336
337
|
"tr",
|
|
337
338
|
{
|
|
338
|
-
className: `border-b ${
|
|
339
|
+
className: `border-b ${(x = c.softDeleteProperty) != null && x.value ? "bg-secondary/10" : "bg-white"}`,
|
|
339
340
|
children: [
|
|
340
|
-
|
|
341
|
-
var
|
|
341
|
+
u == null ? void 0 : u.map((p, A) => {
|
|
342
|
+
var k;
|
|
342
343
|
return /* @__PURE__ */ t(
|
|
343
344
|
"td",
|
|
344
345
|
{
|
|
345
|
-
className: `px-6 py-4 font-medium ${
|
|
346
|
-
children: ((
|
|
346
|
+
className: `px-6 py-4 font-medium ${A === 0 ? "text-gray-900 whitespace-nowrap" : ""} ${o != null && o.columnClassNames ? o == null ? void 0 : o.columnClassNames[p.key] : ""}`,
|
|
347
|
+
children: ((k = c[p.key]) == null ? void 0 : k.render) ?? c[p.key]
|
|
347
348
|
},
|
|
348
|
-
|
|
349
|
+
p.key
|
|
349
350
|
);
|
|
350
351
|
}),
|
|
351
|
-
|
|
352
|
-
(
|
|
353
|
-
)) == null ? void 0 :
|
|
354
|
-
|
|
352
|
+
m.length ? /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("div", { className: "flex items-center gap-3 w-full justify-center", children: (g = m.filter(
|
|
353
|
+
(p) => !p.hidden || !p.hidden(c)
|
|
354
|
+
)) == null ? void 0 : g.map((p) => /* @__PURE__ */ t(
|
|
355
|
+
L,
|
|
355
356
|
{
|
|
356
|
-
content:
|
|
357
|
-
children: /* @__PURE__ */ t("button", { onClick: () =>
|
|
357
|
+
content: p.tooltip,
|
|
358
|
+
children: /* @__PURE__ */ t("button", { onClick: () => p.onClick(c), children: p.icon })
|
|
358
359
|
},
|
|
359
|
-
|
|
360
|
+
p.id
|
|
360
361
|
)) }) }) : null
|
|
361
362
|
]
|
|
362
363
|
},
|
|
363
|
-
|
|
364
|
+
c.id
|
|
364
365
|
);
|
|
365
366
|
}) })
|
|
366
367
|
] }),
|
|
367
|
-
/* @__PURE__ */ t(
|
|
368
|
-
] }) : /* @__PURE__ */ t(
|
|
368
|
+
/* @__PURE__ */ t(V, {})
|
|
369
|
+
] }) : /* @__PURE__ */ t(I, {}) })
|
|
369
370
|
] });
|
|
370
371
|
}
|
|
371
372
|
export {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
373
|
+
U as ChevronDown,
|
|
374
|
+
R as ChevronUp,
|
|
375
|
+
F as Loading,
|
|
376
|
+
te as Table,
|
|
377
|
+
O as TableOptionsProvider,
|
|
378
|
+
ee as TranslationProvider,
|
|
379
|
+
S as useTableOptions,
|
|
380
|
+
C as useTranslation
|
|
380
381
|
};
|