@sito/dashboard 0.0.4 → 0.0.6
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/dashboard.cjs +1 -1
- package/dist/dashboard.js +112 -112
- package/package.json +1 -1
package/dist/dashboard.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var W=require("./main.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react");var j=(t=>(t.ASC="ASC",t.DESC="DESC",t))(j||{});const P=[20,50,100],C=u.createContext({}),z=t=>{const{children:
|
|
1
|
+
var W=require("./main.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react");var j=(t=>(t.ASC="ASC",t.DESC="DESC",t))(j||{});const P=[20,50,100],C=u.createContext({}),z=t=>{const{children:s}=t,[l,n]=u.useState(0),[r,a]=u.useState(20),[b,m]=u.useState(0),[p,f]=u.useState("id"),[c,o]=u.useState(j.ASC),x={onSort:u.useCallback(h=>{let i=c;if(p===h)switch(c){case j.ASC:i=j.DESC;break;default:i=j.ASC;break}f(h),o(i)},[p,c]),total:l,setTotal:n,sortingBy:p,sortingOrder:c,pageSize:r,pageSizes:P,setPageSize:a,currentPage:b,setCurrentPage:m};return e.jsx(C.Provider,{value:x,children:s})},v=()=>{const t=u.useContext(C);if(t===void 0)throw new Error("tableOptionsContext must be used within a Provider");return t},w=u.createContext({});function _(t){const{children:s,t:l}=t;return e.jsx(w.Provider,{value:{t:l},children:s})}const y=()=>{const t=u.useContext(w);if(t===void 0)throw new Error("translationContext must be used within a Provider");return t};function A(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 S(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 M(){const{t}=y();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 k(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 E(t){const{t:s}=y(),{entity:l="",columns:n=[],hasAction:r=!0,columnsOptions:a}=t,{onSort:b,sortingOrder:m,sortingBy:p}=v(),f=u.useMemo(()=>{const{noSortableColumns:c={},columnClassNames:o={}}=a??{};return n==null?void 0:n.map(d=>({id:d.key,label:d.label,className:o[d.key]??"",sortable:!c[d.key]}))},[n,a,l,s]);return e.jsx("thead",{className:"text-xs text-gray-700 bg-gray-50",children:e.jsxs("tr",{children:[f.map(c=>{var o,d,x,h;return e.jsx("th",{scope:"col",className:`px-6 py-3 ${c.className}`,children:e.jsxs("button",{disabled:!c.sortable,onClick:()=>b(c.id),className:"flex items-center gap-2",children:[e.jsx("span",{className:"whitespace-nowrap",children:c.label}),c.sortable&&e.jsx("span",{className:`${p===c.id?"opacity-100":"opacity-0"}`,children:m===j.ASC?((o=a==null?void 0:a.icons)==null?void 0:o.asc)??e.jsx(k,{className:((d=a==null?void 0:a.icons)==null?void 0:d.className)??"w-3"}):((x=a==null?void 0:a.icons)==null?void 0:x.desc)??e.jsx(T,{className:((h=a==null?void 0:a.icons)==null?void 0:h.className)??"w-3"})})]})},c.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 B=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"}},D=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"}},L=t=>{switch(t){case"error":return"text-red-600";case"good":return"text-green-600";default:return"text-gray-500"}},F=u.forwardRef(function(t,s){const{value:l,onChange:n,options:r,containerClassName:a="",inputClassName:b="",labelClassName:m="",helperText:p="",helperTextClassName:f="",placeholder:c="",label:o="",name:d="",id:x="",state:h=$.default,...i}=t;return u.useEffect(()=>{var g;(!l||l==="")&&(r!=null&&r.length)&&n({target:{value:(g=r[0])==null?void 0:g.id}})},[n,r,l]),e.jsxs("div",{className:`relative z-0 w-full mb-5 group ${a}`,children:[e.jsx("select",{...i,id:x,ref:s,name:d,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] ${B(h)} peer ${b}`,children:r==null?void 0:r.map(g=>e.jsx("option",{value:g.id,children:g.value},g.id))}),e.jsx("label",{htmlFor:d,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 ${D(h)} ${m}`,children:o}),e.jsx("p",{className:`mt-2 text-sm ${L(h)} ${f}`,children:h!=="error"&&h!=="good"?c:p})]})}),q=F;function I(){const{t}=y(),{pageSizes:s,pageSize:l,setPageSize:n}=v(),r=u.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(q,{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 R(){const{t}=y(),{total:s,pageSize:l,pageSizes:n,currentPage:r,setCurrentPage:a}=v(),b=(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")," ",b," ",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 U(t){const{t:s}=y(),{title:l="",rows:n,parseRows:r,entity:a="",isLoading:b=!1,actions:m=[],columns:p=[],contentClassName:f="h-[calc(100vh-280px)]",className:c="bg-gray-50",columnsOptions:o}=t,d=u.useMemo(()=>(n==null?void 0:n.map(x=>r(x)))??[],[r,n,s]);return e.jsxs("div",{className:`${c} 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&&!b?e.jsx(I,{}):null]})}),b?e.jsx(S,{className:"bg-white top-0 left-0 w-full h-full"}):e.jsx("div",{className:`${f} 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(E,{entity:a,columns:p,columnsOptions:o,hasAction:(m==null?void 0:m.length)>0}),e.jsx("tbody",{children:d==null?void 0:d.map(x=>{var h;return e.jsxs("tr",{className:`border-b ${x.deleted.value?"bg-secondary/10":"bg-white"}`,children:[p==null?void 0:p.map((i,g)=>{var N;return e.jsx("td",{className:`px-6 py-4 font-medium ${g===0?"text-gray-900 whitespace-nowrap":""} ${o!=null&&o.columnClassNames?o==null?void 0:o.columnClassNames[i.key]:""}`,children:((N=x[i.key])==null?void 0:N.render)??x[i.key]},i.key)}),m.length?e.jsx("td",{children:e.jsx("div",{className:"flex items-center gap-3 w-full justify-center",children:(h=m.filter(i=>!i.hidden||!i.hidden(x)))==null?void 0:h.map(i=>e.jsx(A,{content:i.tooltip,children:e.jsx("button",{onClick:()=>i.onClick(x),children:i.icon})},i.id))})}):null]},x.id)})})]}),e.jsx(R,{})]}):e.jsx(M,{})})]})}exports.ChevronDown=T;exports.ChevronUp=k;exports.Loading=S;exports.Table=U;exports.TableOptionsProvider=z;exports.TranslationProvider=_;exports.useTableOptions=v;exports.useTranslation=y;
|
package/dist/dashboard.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
2
|
import { jsx as t, jsxs as h, Fragment as k } from "react/jsx-runtime";
|
|
3
|
-
import { createContext as $, useState as N, useCallback as j, useContext as P, useMemo as C, forwardRef as A, useEffect as
|
|
3
|
+
import { createContext as $, useState as N, useCallback as j, useContext as P, useMemo as C, forwardRef as A, useEffect as E } from "react";
|
|
4
4
|
var y = /* @__PURE__ */ ((e) => (e.ASC = "ASC", e.DESC = "DESC", e))(y || {});
|
|
5
|
-
const
|
|
6
|
-
const { children:
|
|
5
|
+
const B = [20, 50, 100], z = $({}), Y = (e) => {
|
|
6
|
+
const { children: r } = e, [n, l] = N(0), [s, a] = N(20), [b, f] = N(0), [m, x] = N("id"), [c, o] = N(y.ASC), u = {
|
|
7
7
|
onSort: j(
|
|
8
8
|
(p) => {
|
|
9
9
|
let i = c;
|
|
10
|
-
if (
|
|
10
|
+
if (m === p)
|
|
11
11
|
switch (c) {
|
|
12
12
|
case y.ASC:
|
|
13
13
|
i = y.DESC;
|
|
@@ -18,19 +18,19 @@ const E = [20, 50, 100], z = $({}), Y = (e) => {
|
|
|
18
18
|
}
|
|
19
19
|
x(p), o(i);
|
|
20
20
|
},
|
|
21
|
-
[
|
|
21
|
+
[m, c]
|
|
22
22
|
),
|
|
23
23
|
total: n,
|
|
24
|
-
setTotal:
|
|
25
|
-
sortingBy:
|
|
24
|
+
setTotal: l,
|
|
25
|
+
sortingBy: m,
|
|
26
26
|
sortingOrder: c,
|
|
27
27
|
pageSize: s,
|
|
28
|
-
pageSizes:
|
|
29
|
-
setPageSize:
|
|
30
|
-
currentPage:
|
|
31
|
-
setCurrentPage:
|
|
28
|
+
pageSizes: B,
|
|
29
|
+
setPageSize: a,
|
|
30
|
+
currentPage: b,
|
|
31
|
+
setCurrentPage: f
|
|
32
32
|
};
|
|
33
|
-
return /* @__PURE__ */ t(z.Provider, { value: u, children:
|
|
33
|
+
return /* @__PURE__ */ t(z.Provider, { value: u, children: r });
|
|
34
34
|
}, w = () => {
|
|
35
35
|
const e = P(z);
|
|
36
36
|
if (e === void 0)
|
|
@@ -38,8 +38,8 @@ const E = [20, 50, 100], z = $({}), Y = (e) => {
|
|
|
38
38
|
return e;
|
|
39
39
|
}, T = $({});
|
|
40
40
|
function Z(e) {
|
|
41
|
-
const { children:
|
|
42
|
-
return /* @__PURE__ */ t(T.Provider, { value: { t: n }, children:
|
|
41
|
+
const { children: r, t: n } = e;
|
|
42
|
+
return /* @__PURE__ */ t(T.Provider, { value: { t: n }, children: r });
|
|
43
43
|
}
|
|
44
44
|
const v = () => {
|
|
45
45
|
const e = P(T);
|
|
@@ -48,28 +48,28 @@ const v = () => {
|
|
|
48
48
|
return e;
|
|
49
49
|
};
|
|
50
50
|
function M(e) {
|
|
51
|
-
const { content:
|
|
51
|
+
const { content: r, children: n } = e;
|
|
52
52
|
return /* @__PURE__ */ h("div", { className: "tooltip-container", children: [
|
|
53
53
|
n,
|
|
54
|
-
/* @__PURE__ */ t("div", { className: "tooltip-text", children:
|
|
54
|
+
/* @__PURE__ */ t("div", { className: "tooltip-text", children: r })
|
|
55
55
|
] });
|
|
56
56
|
}
|
|
57
57
|
function D(e) {
|
|
58
58
|
const {
|
|
59
|
-
color:
|
|
59
|
+
color: r = "stroke-blue-800",
|
|
60
60
|
loaderClass: n,
|
|
61
|
-
strokeWidth:
|
|
61
|
+
strokeWidth: l = "4",
|
|
62
62
|
...s
|
|
63
63
|
} = e;
|
|
64
64
|
return /* @__PURE__ */ t("div", { ...s, className: `loading ${s.className}`, children: /* @__PURE__ */ t("div", { className: "loader-container", children: /* @__PURE__ */ t("div", { className: `loader ${n}`, children: /* @__PURE__ */ t("svg", { className: "circular", viewBox: "25 25 50 50", children: /* @__PURE__ */ t(
|
|
65
65
|
"circle",
|
|
66
66
|
{
|
|
67
|
-
className: `path ${
|
|
67
|
+
className: `path ${r}`,
|
|
68
68
|
cx: "50",
|
|
69
69
|
cy: "50",
|
|
70
70
|
r: "20",
|
|
71
71
|
fill: "none",
|
|
72
|
-
strokeWidth:
|
|
72
|
+
strokeWidth: l,
|
|
73
73
|
strokeMiterlimit: "10"
|
|
74
74
|
}
|
|
75
75
|
) }) }) }) });
|
|
@@ -79,11 +79,11 @@ function L() {
|
|
|
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
81
|
function F(e) {
|
|
82
|
-
const { className:
|
|
82
|
+
const { className: r } = e;
|
|
83
83
|
return /* @__PURE__ */ t(
|
|
84
84
|
"svg",
|
|
85
85
|
{
|
|
86
|
-
className:
|
|
86
|
+
className: r,
|
|
87
87
|
xmlns: "http://www.w3.org/2000/svg",
|
|
88
88
|
viewBox: "0 0 512 512",
|
|
89
89
|
children: /* @__PURE__ */ t("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" })
|
|
@@ -91,11 +91,11 @@ function F(e) {
|
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
function I(e) {
|
|
94
|
-
const { className:
|
|
94
|
+
const { className: r } = e;
|
|
95
95
|
return /* @__PURE__ */ t(
|
|
96
96
|
"svg",
|
|
97
97
|
{
|
|
98
|
-
className:
|
|
98
|
+
className: r,
|
|
99
99
|
xmlns: "http://www.w3.org/2000/svg",
|
|
100
100
|
viewBox: "0 0 512 512",
|
|
101
101
|
children: /* @__PURE__ */ t("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" })
|
|
@@ -103,15 +103,15 @@ function I(e) {
|
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
function R(e) {
|
|
106
|
-
const { t:
|
|
107
|
-
const { noSortableColumns: c = {}, columnClassNames: o = {} } =
|
|
108
|
-
return
|
|
106
|
+
const { t: r } = v(), { entity: n = "", columns: l = [], hasAction: s = !0, columnsOptions: a } = e, { onSort: b, sortingOrder: f, sortingBy: m } = w(), x = C(() => {
|
|
107
|
+
const { noSortableColumns: c = {}, columnClassNames: o = {} } = a ?? {};
|
|
108
|
+
return l == null ? void 0 : l.map((d) => ({
|
|
109
109
|
id: d.key,
|
|
110
110
|
label: d.label,
|
|
111
111
|
className: o[d.key] ?? "",
|
|
112
112
|
sortable: !c[d.key]
|
|
113
113
|
}));
|
|
114
|
-
}, [
|
|
114
|
+
}, [l, a, n, r]);
|
|
115
115
|
return /* @__PURE__ */ t("thead", { className: "text-xs text-gray-700 bg-gray-50", children: /* @__PURE__ */ h("tr", { children: [
|
|
116
116
|
x.map((c) => {
|
|
117
117
|
var o, d, u, p;
|
|
@@ -124,23 +124,23 @@ function R(e) {
|
|
|
124
124
|
"button",
|
|
125
125
|
{
|
|
126
126
|
disabled: !c.sortable,
|
|
127
|
-
onClick: () =>
|
|
127
|
+
onClick: () => b(c.id),
|
|
128
128
|
className: "flex items-center gap-2",
|
|
129
129
|
children: [
|
|
130
130
|
/* @__PURE__ */ t("span", { className: "whitespace-nowrap", children: c.label }),
|
|
131
131
|
c.sortable && /* @__PURE__ */ t(
|
|
132
132
|
"span",
|
|
133
133
|
{
|
|
134
|
-
className: `${
|
|
135
|
-
children:
|
|
134
|
+
className: `${m === c.id ? "opacity-100" : "opacity-0"}`,
|
|
135
|
+
children: f === y.ASC ? ((o = a == null ? void 0 : a.icons) == null ? void 0 : o.asc) ?? /* @__PURE__ */ t(
|
|
136
136
|
F,
|
|
137
137
|
{
|
|
138
|
-
className: ((d =
|
|
138
|
+
className: ((d = a == null ? void 0 : a.icons) == null ? void 0 : d.className) ?? "w-3"
|
|
139
139
|
}
|
|
140
|
-
) : ((u =
|
|
140
|
+
) : ((u = a == null ? void 0 : a.icons) == null ? void 0 : u.desc) ?? /* @__PURE__ */ t(
|
|
141
141
|
I,
|
|
142
142
|
{
|
|
143
|
-
className: ((p =
|
|
143
|
+
className: ((p = a == null ? void 0 : a.icons) == null ? void 0 : p.className) ?? "w-3"
|
|
144
144
|
}
|
|
145
145
|
)
|
|
146
146
|
}
|
|
@@ -152,7 +152,7 @@ function R(e) {
|
|
|
152
152
|
c.id
|
|
153
153
|
);
|
|
154
154
|
}),
|
|
155
|
-
s && /* @__PURE__ */ t("th", { scope: "col", className: "px-6 py-3 text-center", children:
|
|
155
|
+
s && /* @__PURE__ */ t("th", { scope: "col", className: "px-6 py-3 text-center", children: r("_accessibility:labels.actions") })
|
|
156
156
|
] }) });
|
|
157
157
|
}
|
|
158
158
|
var _ = /* @__PURE__ */ ((e) => (e.error = "error", e.good = "good", e.default = "default", e))(_ || {});
|
|
@@ -183,15 +183,15 @@ const U = (e) => {
|
|
|
183
183
|
default:
|
|
184
184
|
return "text-gray-500";
|
|
185
185
|
}
|
|
186
|
-
}, G = A(function(e,
|
|
186
|
+
}, G = A(function(e, r) {
|
|
187
187
|
const {
|
|
188
188
|
value: n,
|
|
189
|
-
onChange:
|
|
189
|
+
onChange: l,
|
|
190
190
|
options: s,
|
|
191
|
-
containerClassName:
|
|
192
|
-
inputClassName:
|
|
193
|
-
labelClassName:
|
|
194
|
-
helperText:
|
|
191
|
+
containerClassName: a = "",
|
|
192
|
+
inputClassName: b = "",
|
|
193
|
+
labelClassName: f = "",
|
|
194
|
+
helperText: m = "",
|
|
195
195
|
helperTextClassName: x = "",
|
|
196
196
|
placeholder: c = "",
|
|
197
197
|
label: o = "",
|
|
@@ -200,20 +200,20 @@ const U = (e) => {
|
|
|
200
200
|
state: p = _.default,
|
|
201
201
|
...i
|
|
202
202
|
} = e;
|
|
203
|
-
return
|
|
203
|
+
return E(() => {
|
|
204
204
|
var g;
|
|
205
|
-
(!n || n === "") && (s != null && s.length) &&
|
|
206
|
-
}, [
|
|
205
|
+
(!n || n === "") && (s != null && s.length) && l({ target: { value: (g = s[0]) == null ? void 0 : g.id } });
|
|
206
|
+
}, [l, s, n]), /* @__PURE__ */ h("div", { className: `relative z-0 w-full mb-5 group ${a}`, children: [
|
|
207
207
|
/* @__PURE__ */ t(
|
|
208
208
|
"select",
|
|
209
209
|
{
|
|
210
210
|
...i,
|
|
211
211
|
id: u,
|
|
212
|
-
ref:
|
|
212
|
+
ref: r,
|
|
213
213
|
name: d,
|
|
214
214
|
value: n,
|
|
215
|
-
onChange:
|
|
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] ${U(p)} peer ${
|
|
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] ${U(p)} peer ${b}`,
|
|
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
|
),
|
|
@@ -221,7 +221,7 @@ const U = (e) => {
|
|
|
221
221
|
"label",
|
|
222
222
|
{
|
|
223
223
|
htmlFor: d,
|
|
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 ${W(p)} ${
|
|
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 ${W(p)} ${f}`,
|
|
225
225
|
children: o
|
|
226
226
|
}
|
|
227
227
|
),
|
|
@@ -229,15 +229,15 @@ const U = (e) => {
|
|
|
229
229
|
"p",
|
|
230
230
|
{
|
|
231
231
|
className: `mt-2 text-sm ${q(p)} ${x}`,
|
|
232
|
-
children: p !== "error" && p !== "good" ? c :
|
|
232
|
+
children: p !== "error" && p !== "good" ? c : m
|
|
233
233
|
}
|
|
234
234
|
)
|
|
235
235
|
] });
|
|
236
236
|
}), H = G;
|
|
237
237
|
function J() {
|
|
238
|
-
const { t: e } = v(), { pageSizes:
|
|
239
|
-
() =>
|
|
240
|
-
[
|
|
238
|
+
const { t: e } = v(), { pageSizes: r, pageSize: n, setPageSize: l } = w(), s = C(
|
|
239
|
+
() => r == null ? void 0 : r.map((a) => ({ id: a, value: a })),
|
|
240
|
+
[r]
|
|
241
241
|
);
|
|
242
242
|
return /* @__PURE__ */ h("div", { className: "flex gap-2 items-center justify-start", children: [
|
|
243
243
|
/* @__PURE__ */ t("p", { children: e("_accessibility:components.table.pageSizes") }),
|
|
@@ -249,29 +249,29 @@ function J() {
|
|
|
249
249
|
inputClassName: "!py-0 !pl-2 !pr-7 !border-none font-bold",
|
|
250
250
|
containerClassName: "!w-auto !mb-0 !border-none",
|
|
251
251
|
helperTextClassName: "hidden",
|
|
252
|
-
onChange: (
|
|
252
|
+
onChange: (a) => l(a.target.value)
|
|
253
253
|
}
|
|
254
254
|
)
|
|
255
255
|
] });
|
|
256
256
|
}
|
|
257
257
|
function K() {
|
|
258
|
-
const { t: e } = v(), { total:
|
|
258
|
+
const { t: e } = v(), { total: r, pageSize: n, pageSizes: l, currentPage: s, setCurrentPage: a } = w(), b = (s + 1) * n > r ? r : (s + 1) * n;
|
|
259
259
|
return /* @__PURE__ */ h("div", { className: "flex w-full items-center justify-between mt-5", children: [
|
|
260
260
|
/* @__PURE__ */ h("div", { className: "flex w-full items-center justify-start gap-1", children: [
|
|
261
261
|
/* @__PURE__ */ t("p", { children: e("_accessibility:components.table.pageSizes") }),
|
|
262
|
-
|
|
262
|
+
l[0] < r && /* @__PURE__ */ t(k, { children: /* @__PURE__ */ h("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
|
+
b,
|
|
270
270
|
" ",
|
|
271
271
|
e("_accessibility:components.table.of")
|
|
272
272
|
] }) }),
|
|
273
273
|
/* @__PURE__ */ h("p", { children: [
|
|
274
|
-
|
|
274
|
+
r,
|
|
275
275
|
" ",
|
|
276
276
|
e("_accessibility:components.table.results")
|
|
277
277
|
] })
|
|
@@ -282,16 +282,16 @@ function K() {
|
|
|
282
282
|
{
|
|
283
283
|
className: "disabled:text-light-primary/40",
|
|
284
284
|
disabled: s === 0,
|
|
285
|
-
onClick: () =>
|
|
285
|
+
onClick: () => a(s - 1),
|
|
286
286
|
children: e("_accessibility:buttons.previous")
|
|
287
287
|
}
|
|
288
288
|
),
|
|
289
289
|
/* @__PURE__ */ t(
|
|
290
290
|
"button",
|
|
291
291
|
{
|
|
292
|
-
disabled: Math.floor(
|
|
292
|
+
disabled: Math.floor(r / ((s + 1) * n)) === 0,
|
|
293
293
|
className: "disabled:text-light-primary/40",
|
|
294
|
-
onClick: () =>
|
|
294
|
+
onClick: () => a(s + 1),
|
|
295
295
|
children: e("_accessibility:buttons.next")
|
|
296
296
|
}
|
|
297
297
|
)
|
|
@@ -299,72 +299,72 @@ function K() {
|
|
|
299
299
|
] });
|
|
300
300
|
}
|
|
301
301
|
function O(e) {
|
|
302
|
-
const { t:
|
|
302
|
+
const { t: r } = v(), {
|
|
303
303
|
title: n = "",
|
|
304
|
-
rows:
|
|
304
|
+
rows: l,
|
|
305
305
|
parseRows: s,
|
|
306
|
-
entity:
|
|
307
|
-
isLoading:
|
|
308
|
-
actions:
|
|
309
|
-
columns:
|
|
306
|
+
entity: a = "",
|
|
307
|
+
isLoading: b = !1,
|
|
308
|
+
actions: f = [],
|
|
309
|
+
columns: m = [],
|
|
310
310
|
contentClassName: x = "h-[calc(100vh-280px)]",
|
|
311
311
|
className: c = "bg-gray-50",
|
|
312
312
|
columnsOptions: o
|
|
313
313
|
} = e, d = C(
|
|
314
|
-
() => (
|
|
315
|
-
[s,
|
|
314
|
+
() => (l == null ? void 0 : l.map((u) => s(u))) ?? [],
|
|
315
|
+
[s, l, r]
|
|
316
316
|
);
|
|
317
317
|
return /* @__PURE__ */ h("div", { className: `${c} relative overflow-x-auto w-full h-full`, children: [
|
|
318
318
|
/* @__PURE__ */ t("div", { className: "mb-5 flex w-full items-center justify-between", children: /* @__PURE__ */ h("div", { children: [
|
|
319
319
|
/* @__PURE__ */ t("h1", { className: "text-2xl md:text-3xl font-bold", children: n }),
|
|
320
|
-
|
|
320
|
+
l != null && l.length && !b ? /* @__PURE__ */ t(J, {}) : null
|
|
321
321
|
] }) }),
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
/* @__PURE__ */ t(
|
|
327
|
-
R,
|
|
328
|
-
{
|
|
329
|
-
entity: l,
|
|
330
|
-
columns: f,
|
|
331
|
-
columnsOptions: o,
|
|
332
|
-
hasAction: (b == null ? void 0 : b.length) > 0
|
|
333
|
-
}
|
|
334
|
-
),
|
|
335
|
-
!m && !!(r != null && r.length) && /* @__PURE__ */ t("tbody", { children: d == null ? void 0 : d.map((u) => {
|
|
336
|
-
var p;
|
|
337
|
-
return /* @__PURE__ */ h(
|
|
338
|
-
"tr",
|
|
322
|
+
b ? /* @__PURE__ */ t(D, { className: "bg-white top-0 left-0 w-full h-full" }) : /* @__PURE__ */ t("div", { className: `${x} overflow-auto`, children: l != null && l.length ? /* @__PURE__ */ h(k, { children: [
|
|
323
|
+
/* @__PURE__ */ h("table", { className: "w-full text-sm text-left text-gray-500", children: [
|
|
324
|
+
/* @__PURE__ */ t(
|
|
325
|
+
R,
|
|
339
326
|
{
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
327
|
+
entity: a,
|
|
328
|
+
columns: m,
|
|
329
|
+
columnsOptions: o,
|
|
330
|
+
hasAction: (f == null ? void 0 : f.length) > 0
|
|
331
|
+
}
|
|
332
|
+
),
|
|
333
|
+
/* @__PURE__ */ t("tbody", { children: d == null ? void 0 : d.map((u) => {
|
|
334
|
+
var p;
|
|
335
|
+
return /* @__PURE__ */ h(
|
|
336
|
+
"tr",
|
|
337
|
+
{
|
|
338
|
+
className: `border-b ${u.deleted.value ? "bg-secondary/10" : "bg-white"}`,
|
|
339
|
+
children: [
|
|
340
|
+
m == null ? void 0 : m.map((i, g) => {
|
|
341
|
+
var S;
|
|
342
|
+
return /* @__PURE__ */ t(
|
|
343
|
+
"td",
|
|
344
|
+
{
|
|
345
|
+
className: `px-6 py-4 font-medium ${g === 0 ? "text-gray-900 whitespace-nowrap" : ""} ${o != null && o.columnClassNames ? o == null ? void 0 : o.columnClassNames[i.key] : ""}`,
|
|
346
|
+
children: ((S = u[i.key]) == null ? void 0 : S.render) ?? u[i.key]
|
|
347
|
+
},
|
|
348
|
+
i.key
|
|
349
|
+
);
|
|
350
|
+
}),
|
|
351
|
+
f.length ? /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("div", { className: "flex items-center gap-3 w-full justify-center", children: (p = f.filter(
|
|
352
|
+
(i) => !i.hidden || !i.hidden(u)
|
|
353
|
+
)) == null ? void 0 : p.map((i) => /* @__PURE__ */ t(
|
|
354
|
+
M,
|
|
346
355
|
{
|
|
347
|
-
|
|
348
|
-
children:
|
|
356
|
+
content: i.tooltip,
|
|
357
|
+
children: /* @__PURE__ */ t("button", { onClick: () => i.onClick(u), children: i.icon })
|
|
349
358
|
},
|
|
350
|
-
i.
|
|
351
|
-
)
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
children: /* @__PURE__ */ t("button", { onClick: () => i.onClick(u), children: i.icon })
|
|
360
|
-
},
|
|
361
|
-
i.id
|
|
362
|
-
)) }) })
|
|
363
|
-
]
|
|
364
|
-
},
|
|
365
|
-
u.id
|
|
366
|
-
);
|
|
367
|
-
}) })
|
|
359
|
+
i.id
|
|
360
|
+
)) }) }) : null
|
|
361
|
+
]
|
|
362
|
+
},
|
|
363
|
+
u.id
|
|
364
|
+
);
|
|
365
|
+
}) })
|
|
366
|
+
] }),
|
|
367
|
+
/* @__PURE__ */ t(K, {})
|
|
368
368
|
] }) : /* @__PURE__ */ t(L, {}) })
|
|
369
369
|
] });
|
|
370
370
|
}
|