@vlrc-fe/components 1.0.9 → 1.0.11
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/Form/FormDatePicker/SingleDatePicker.d.ts.map +1 -1
- package/dist/index100.js +30 -17
- package/dist/index101.cjs +1 -1
- package/dist/index102.js +35 -19
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +29 -19
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +98 -55
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +86 -48
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +12 -6
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +23 -16
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +205 -120
- package/dist/index109.cjs +1 -1
- package/dist/index11.js +105 -53
- package/dist/index113.js +12 -6
- package/dist/index114.cjs +1 -1
- package/dist/index115.js +18 -10
- package/dist/index116.cjs +1 -1
- package/dist/index116.js +82 -41
- package/dist/index117.cjs +1 -1
- package/dist/index118.js +42 -21
- package/dist/index119.cjs +1 -1
- package/dist/index119.js +12 -6
- package/dist/index12.cjs +1 -1
- package/dist/index120.cjs +1 -1
- package/dist/index121.js +18 -12
- package/dist/index122.cjs +1 -1
- package/dist/index123.js +42 -28
- package/dist/index124.cjs +1 -1
- package/dist/index126.js +86 -57
- package/dist/index127.cjs +1 -1
- package/dist/index127.js +30 -17
- package/dist/index128.cjs +1 -1
- package/dist/index128.js +42 -27
- package/dist/index129.cjs +1 -1
- package/dist/index129.js +31 -18
- package/dist/index130.cjs +1 -1
- package/dist/index132.js +50 -23
- package/dist/index133.cjs +1 -1
- package/dist/index133.js +28 -14
- package/dist/index134.cjs +1 -1
- package/dist/index135.js +147 -99
- package/dist/index136.cjs +1 -1
- package/dist/index138.js +242 -170
- package/dist/index139.cjs +1 -1
- package/dist/index14.js +9 -5
- package/dist/index141.js +21 -10
- package/dist/index142.cjs +1 -1
- package/dist/index15.cjs +1 -1
- package/dist/index18.js +32 -16
- package/dist/index186.js +57 -44
- package/dist/index187.cjs +1 -1
- package/dist/index187.js +56 -48
- package/dist/index188.cjs +1 -1
- package/dist/index188.js +16 -12
- package/dist/index189.cjs +1 -1
- package/dist/index19.cjs +1 -1
- package/dist/index191.js +36 -23
- package/dist/index192.cjs +1 -1
- package/dist/index197.js +18 -15
- package/dist/index198.cjs +1 -1
- package/dist/index20.js +79 -41
- package/dist/index200.js +49 -33
- package/dist/index201.cjs +1 -1
- package/dist/index201.js +20 -11
- package/dist/index202.cjs +1 -1
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +30 -23
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +75 -39
- package/dist/index23.cjs +1 -1
- package/dist/index26.js +39 -28
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +20 -12
- package/dist/index28.cjs +1 -1
- package/dist/index33.js +23 -13
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +87 -49
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +86 -45
- package/dist/index36.cjs +1 -1
- package/dist/index4.js +49 -26
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +34 -18
- package/dist/index6.cjs +1 -1
- package/dist/index75.js +142 -77
- package/dist/index76.cjs +1 -1
- package/dist/index77.js +96 -49
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +137 -77
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +13 -7
- package/dist/index80.cjs +1 -1
- package/dist/index81.js +130 -63
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +201 -158
- package/dist/index83.cjs +1 -1
- package/dist/index84.js +97 -59
- package/dist/index85.cjs +1 -1
- package/dist/index86.js +17 -10
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +13 -7
- package/dist/index88.cjs +1 -1
- package/dist/index89.js +54 -28
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +94 -53
- package/dist/index91.cjs +1 -1
- package/dist/index92.js +156 -89
- package/dist/index93.cjs +1 -1
- package/dist/index96.js +89 -47
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +78 -43
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +27 -17
- package/dist/index99.cjs +1 -1
- package/package.json +1 -1
package/dist/index133.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./index11.cjs"),t=require("./index79.cjs");let n=require("lucide-react"),r=require("react/jsx-runtime"),i=require("lodash-es"),
|
|
1
|
+
const e=require("./index11.cjs"),t=require("./index79.cjs");let n=require("lucide-react"),r=require("react/jsx-runtime"),i=require("react/compiler-runtime"),a=require("lodash-es"),o=require("react-i18next");var s=s=>{let c=(0,i.c)(35),{row:l,table:u}=s,{t:d}=(0,o.useTranslation)(),f=u.options.meta,p,m,h,g,_,v,y,b;if(c[0]!==f||c[1]!==l||c[2]!==d){b=Symbol.for(`react.early_return_sentinel`);bb0:{let i=(0,a.get)(f,`getRowActions`),o=i===void 0?[]:i(l);if((0,a.isEmpty)(o)){b=null;break bb0}m=t.DropdownMenu;let s;c[11]===d?s=c[12]:(s=d(`datatable_open_menu`),c[11]=d,c[12]=s);let u;c[13]===s?u=c[14]:(u=(0,r.jsx)(`span`,{className:`sr-only`,children:s}),c[13]=s,c[14]=u);let x;c[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,r.jsx)(n.MoreHorizontal,{}),c[15]=x):x=c[15],c[16]===u?y=c[17]:(y=(0,r.jsx)(t.DropdownMenuTrigger,{asChild:!0,children:(0,r.jsxs)(e.Button,{variant:`ghost`,className:`h-8 w-8 p-0`,children:[u,x]})}),c[16]=u,c[17]=y),p=t.DropdownMenuContent,h=`end`;let S;c[18]===d?S=c[19]:(S=d(`datatable_actions`),c[18]=d,c[19]=S),c[20]===S?g=c[21]:(g=(0,r.jsx)(t.DropdownMenuLabel,{children:S}),c[20]=S,c[21]=g),c[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,r.jsx)(t.DropdownMenuSeparator,{}),c[22]=_):_=c[22];let C;c[23]===l?C=c[24]:(C=e=>(0,r.jsx)(t.DropdownMenuItem,{disabled:e.disabled,onClick:()=>e.onSelect(l),children:e.label},e.id),c[23]=l,c[24]=C),v=(0,a.map)(o,C)}c[0]=f,c[1]=l,c[2]=d,c[3]=p,c[4]=m,c[5]=h,c[6]=g,c[7]=_,c[8]=v,c[9]=y,c[10]=b}else p=c[3],m=c[4],h=c[5],g=c[6],_=c[7],v=c[8],y=c[9],b=c[10];if(b!==Symbol.for(`react.early_return_sentinel`))return b;let x;c[25]!==p||c[26]!==h||c[27]!==g||c[28]!==_||c[29]!==v?(x=(0,r.jsxs)(p,{align:h,children:[g,_,v]}),c[25]=p,c[26]=h,c[27]=g,c[28]=_,c[29]=v,c[30]=x):x=c[30];let S;return c[31]!==m||c[32]!==y||c[33]!==x?(S=(0,r.jsxs)(m,{children:[y,x]}),c[31]=m,c[32]=y,c[33]=x,c[34]=S):S=c[34],S};exports.DataTableRowActions=s;
|
package/dist/index133.js
CHANGED
|
@@ -3,8 +3,9 @@ import { Checkbox as t } from "./index27.js";
|
|
|
3
3
|
import { DataTableRowActions as n } from "./index132.js";
|
|
4
4
|
import { ChevronDown as r, ChevronRight as i } from "lucide-react";
|
|
5
5
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { c as s } from "react/compiler-runtime";
|
|
6
7
|
//#region src/DataTable/render/createColumns.tsx
|
|
7
|
-
var
|
|
8
|
+
var c = () => ({
|
|
8
9
|
id: "select",
|
|
9
10
|
header: ({ table: e }) => /* @__PURE__ */ a(t, {
|
|
10
11
|
checked: e.getIsAllPageRowsSelected() || (e.getIsSomePageRowsSelected() ? "indeterminate" : !1),
|
|
@@ -18,22 +19,35 @@ var s = () => ({
|
|
|
18
19
|
}),
|
|
19
20
|
enableSorting: !1,
|
|
20
21
|
enableHiding: !1
|
|
21
|
-
}),
|
|
22
|
+
}), l = () => ({
|
|
22
23
|
id: "expand",
|
|
23
24
|
enableSorting: !1,
|
|
24
25
|
enableHiding: !1,
|
|
25
26
|
header: () => null,
|
|
26
|
-
cell: ({ row: e }) => /* @__PURE__ */ a(
|
|
27
|
-
}),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
27
|
+
cell: ({ row: e }) => /* @__PURE__ */ a(u, { row: e })
|
|
28
|
+
}), u = (t) => {
|
|
29
|
+
let n = s(8), { row: c } = t;
|
|
30
|
+
if (c.getCanExpand()) {
|
|
31
|
+
let t;
|
|
32
|
+
n[0] === c ? t = n[1] : (t = () => c.toggleExpanded(), n[0] = c, n[1] = t);
|
|
33
|
+
let s;
|
|
34
|
+
n[2] === Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ a("span", {
|
|
35
|
+
className: "sr-only",
|
|
36
|
+
children: "Toggle"
|
|
37
|
+
}), n[2] = s) : s = n[2];
|
|
38
|
+
let l;
|
|
39
|
+
n[3] === c ? l = n[4] : (l = c.getIsExpanded() ? /* @__PURE__ */ a(r, {}) : /* @__PURE__ */ a(i, {}), n[3] = c, n[4] = l);
|
|
40
|
+
let u;
|
|
41
|
+
return n[5] !== t || n[6] !== l ? (u = /* @__PURE__ */ o(e, {
|
|
42
|
+
variant: "ghost",
|
|
43
|
+
size: "sm",
|
|
44
|
+
className: "h-8 w-8 p-0",
|
|
45
|
+
onClick: t,
|
|
46
|
+
children: [s, l]
|
|
47
|
+
}), n[5] = t, n[6] = l, n[7] = u) : u = n[7], u;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}, d = () => ({
|
|
37
51
|
id: "actions",
|
|
38
52
|
enableHiding: !1,
|
|
39
53
|
header: () => null,
|
|
@@ -43,4 +57,4 @@ var s = () => ({
|
|
|
43
57
|
})
|
|
44
58
|
});
|
|
45
59
|
//#endregion
|
|
46
|
-
export {
|
|
60
|
+
export { l as createExpanderColumn, d as createRowActionsColumn, c as createSelectionColumn };
|
package/dist/index134.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./index11.cjs"),t=require("./index28.cjs"),n=require("./index133.cjs");let r=require("lucide-react"),i=require("react/jsx-runtime");var
|
|
1
|
+
const e=require("./index11.cjs"),t=require("./index28.cjs"),n=require("./index133.cjs");let r=require("lucide-react"),i=require("react/jsx-runtime"),a=require("react/compiler-runtime");var o=()=>({id:`select`,header:({table:e})=>(0,i.jsx)(t.Checkbox,{checked:e.getIsAllPageRowsSelected()||(e.getIsSomePageRowsSelected()?`indeterminate`:!1),onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t),"aria-label":`Select all`}),cell:({row:e})=>(0,i.jsx)(t.Checkbox,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(!!t),"aria-label":`Select row`}),enableSorting:!1,enableHiding:!1}),s=()=>({id:`expand`,enableSorting:!1,enableHiding:!1,header:()=>null,cell:({row:e})=>(0,i.jsx)(c,{row:e})}),c=t=>{let n=(0,a.c)(8),{row:o}=t;if(o.getCanExpand()){let t;n[0]===o?t=n[1]:(t=()=>o.toggleExpanded(),n[0]=o,n[1]=t);let a;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,i.jsx)(`span`,{className:`sr-only`,children:`Toggle`}),n[2]=a):a=n[2];let s;n[3]===o?s=n[4]:(s=o.getIsExpanded()?(0,i.jsx)(r.ChevronDown,{}):(0,i.jsx)(r.ChevronRight,{}),n[3]=o,n[4]=s);let c;return n[5]!==t||n[6]!==s?(c=(0,i.jsxs)(e.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:t,children:[a,s]}),n[5]=t,n[6]=s,n[7]=c):c=n[7],c}return null},l=()=>({id:`actions`,enableHiding:!1,header:()=>null,cell:({row:e,table:t})=>(0,i.jsx)(n.DataTableRowActions,{row:e,table:t})});exports.createExpanderColumn=s,exports.createRowActionsColumn=l,exports.createSelectionColumn=o;
|
package/dist/index135.js
CHANGED
|
@@ -9,8 +9,9 @@ import { Textarea as m } from "./index119.js";
|
|
|
9
9
|
import { Icons as h } from "./index134.js";
|
|
10
10
|
import { useState as g } from "react";
|
|
11
11
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
12
|
+
import { c as b } from "react/compiler-runtime";
|
|
12
13
|
//#region src/Form/Form.tsx
|
|
13
|
-
var
|
|
14
|
+
var x = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, S = /^(0|\+84)(3|5|7|8|9)[0-9]{8}$/, C = (e, t) => {
|
|
14
15
|
let n = e.toLowerCase();
|
|
15
16
|
if (t === "password") return n.includes("confirm") || n.includes("new") ? "new-password" : "current-password";
|
|
16
17
|
if (t === "email" || n.includes("email")) return "email";
|
|
@@ -18,108 +19,155 @@ var b = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, x = /^(0|\+84)(3|5|7|8|9)[0-9]{8}$/, S = (
|
|
|
18
19
|
if (n.includes("name")) return "name";
|
|
19
20
|
if (n.includes("username")) return "username";
|
|
20
21
|
};
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return u === "email" && !m?.pattern && (e.pattern = {
|
|
28
|
-
value: b,
|
|
29
|
-
message: "Email không hợp lệ"
|
|
30
|
-
}), u === "tel" && !m?.pattern && (e.pattern = {
|
|
22
|
+
function w(e) {
|
|
23
|
+
let t = b(20), { children: n, label: l, control: u, name: d, htmlType: f, description: p, controlFirst: m, horizontal: h, rules: g, className: C } = e, w;
|
|
24
|
+
if (t[0] !== f || t[1] !== g) {
|
|
25
|
+
if (w = { ...g }, f === "email" && !g?.pattern) {
|
|
26
|
+
let e;
|
|
27
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (e = {
|
|
31
28
|
value: x,
|
|
29
|
+
message: "Email không hợp lệ"
|
|
30
|
+
}, t[3] = e) : e = t[3], w.pattern = e;
|
|
31
|
+
}
|
|
32
|
+
if (f === "tel" && !g?.pattern) {
|
|
33
|
+
let e;
|
|
34
|
+
t[4] === Symbol.for("react.memo_cache_sentinel") ? (e = {
|
|
35
|
+
value: S,
|
|
32
36
|
message: "Số điện thoại không hợp lệ"
|
|
33
|
-
}
|
|
34
|
-
...m.required,
|
|
35
|
-
message: "Trường này là bắt buộc"
|
|
36
|
-
}) : e.required = "Trường này là bắt buộc"), e;
|
|
37
|
-
})(),
|
|
38
|
-
render: ({ field: n, fieldState: c }) => {
|
|
39
|
-
let l = /* @__PURE__ */ y(_, { children: [t && /* @__PURE__ */ y(s, {
|
|
40
|
-
htmlFor: n.name,
|
|
41
|
-
children: [t, m?.required && /* @__PURE__ */ v("span", {
|
|
42
|
-
className: "text-red-500 ml-1",
|
|
43
|
-
children: "*"
|
|
44
|
-
})]
|
|
45
|
-
}), d && /* @__PURE__ */ v(a, { children: d })] }), u = e({
|
|
46
|
-
...n,
|
|
47
|
-
id: n.name,
|
|
48
|
-
"aria-invalid": c.invalid
|
|
49
|
-
}), g = c.invalid && /* @__PURE__ */ v(o, { errors: [c.error] });
|
|
50
|
-
return /* @__PURE__ */ v(r, {
|
|
51
|
-
className: h,
|
|
52
|
-
"data-invalid": c.invalid,
|
|
53
|
-
orientation: p ? "horizontal" : void 0,
|
|
54
|
-
children: f ? /* @__PURE__ */ y(_, { children: [u, /* @__PURE__ */ y(i, { children: [l, g] })] }) : /* @__PURE__ */ y(_, { children: [
|
|
55
|
-
/* @__PURE__ */ v(i, { children: l }),
|
|
56
|
-
u,
|
|
57
|
-
g
|
|
58
|
-
] })
|
|
59
|
-
});
|
|
37
|
+
}, t[4] = e) : e = t[4], w.pattern = e;
|
|
60
38
|
}
|
|
61
|
-
|
|
39
|
+
if (g?.required !== void 0 && g.required !== !1) if (typeof g.required == "string") w.required = g.required;
|
|
40
|
+
else if (typeof g.required == "object") {
|
|
41
|
+
if (!g.required.message) {
|
|
42
|
+
let e;
|
|
43
|
+
t[5] === g.required ? e = t[6] : (e = {
|
|
44
|
+
...g.required,
|
|
45
|
+
message: "Trường này là bắt buộc"
|
|
46
|
+
}, t[5] = g.required, t[6] = e), w.required = e;
|
|
47
|
+
}
|
|
48
|
+
} else w.required = "Trường này là bắt buộc";
|
|
49
|
+
t[0] = f, t[1] = g, t[2] = w;
|
|
50
|
+
} else w = t[2];
|
|
51
|
+
let T = w, E;
|
|
52
|
+
t[7] !== n || t[8] !== C || t[9] !== m || t[10] !== p || t[11] !== h || t[12] !== l || t[13] !== g?.required ? (E = (e) => {
|
|
53
|
+
let { field: t, fieldState: c } = e, u = /* @__PURE__ */ y(_, { children: [l && /* @__PURE__ */ y(s, {
|
|
54
|
+
htmlFor: t.name,
|
|
55
|
+
children: [l, g?.required && /* @__PURE__ */ v("span", {
|
|
56
|
+
className: "text-red-500 ml-1",
|
|
57
|
+
children: "*"
|
|
58
|
+
})]
|
|
59
|
+
}), p && /* @__PURE__ */ v(a, { children: p })] }), d = n({
|
|
60
|
+
...t,
|
|
61
|
+
id: t.name,
|
|
62
|
+
"aria-invalid": c.invalid
|
|
63
|
+
}), f = c.invalid && /* @__PURE__ */ v(o, { errors: [c.error] });
|
|
64
|
+
return /* @__PURE__ */ v(r, {
|
|
65
|
+
className: C,
|
|
66
|
+
"data-invalid": c.invalid,
|
|
67
|
+
orientation: h ? "horizontal" : void 0,
|
|
68
|
+
children: m ? /* @__PURE__ */ y(_, { children: [d, /* @__PURE__ */ y(i, { children: [u, f] })] }) : /* @__PURE__ */ y(_, { children: [
|
|
69
|
+
/* @__PURE__ */ v(i, { children: u }),
|
|
70
|
+
d,
|
|
71
|
+
f
|
|
72
|
+
] })
|
|
73
|
+
});
|
|
74
|
+
}, t[7] = n, t[8] = C, t[9] = m, t[10] = p, t[11] = h, t[12] = l, t[13] = g?.required, t[14] = E) : E = t[14];
|
|
75
|
+
let D;
|
|
76
|
+
return t[15] !== u || t[16] !== d || t[17] !== T || t[18] !== E ? (D = /* @__PURE__ */ v(c, {
|
|
77
|
+
control: u,
|
|
78
|
+
name: d,
|
|
79
|
+
rules: T,
|
|
80
|
+
render: E
|
|
81
|
+
}), t[15] = u, t[16] = d, t[17] = T, t[18] = E, t[19] = D) : D = t[19], D;
|
|
62
82
|
}
|
|
63
|
-
var
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
children:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
83
|
+
var T = (n) => {
|
|
84
|
+
let r = b(14), { placeholder: i, inputClassName: a, leftIcon: o, rightIcon: s, disabled: c, autoComplete: u, ...d } = n, [f, p] = g(!1), m = d.htmlType === "password", _ = u ?? C(String(d.name), d.htmlType), x;
|
|
85
|
+
r[0] !== c || r[1] !== a || r[2] !== m || r[3] !== o || r[4] !== i || r[5] !== d || r[6] !== _ || r[7] !== s || r[8] !== p || r[9] !== f ? (x = (n) => /* @__PURE__ */ y("div", {
|
|
86
|
+
className: "relative",
|
|
87
|
+
children: [
|
|
88
|
+
o && /* @__PURE__ */ v("div", {
|
|
89
|
+
className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none",
|
|
90
|
+
children: o
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ v(l, {
|
|
93
|
+
...n,
|
|
94
|
+
type: m && f ? "text" : d.htmlType,
|
|
95
|
+
autoComplete: _,
|
|
96
|
+
placeholder: i,
|
|
97
|
+
disabled: c,
|
|
98
|
+
className: e(o && "pl-10", (m || s) && "pr-10", a)
|
|
99
|
+
}),
|
|
100
|
+
m && /* @__PURE__ */ v(t, {
|
|
101
|
+
type: "button",
|
|
102
|
+
variant: "ghost",
|
|
103
|
+
size: "icon-sm",
|
|
104
|
+
onClick: () => p(!f),
|
|
105
|
+
className: "absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
106
|
+
tabIndex: -1,
|
|
107
|
+
children: v(f ? h.EyeOff : h.Eye, { className: "h-4 w-4" })
|
|
108
|
+
}),
|
|
109
|
+
!m && s && /* @__PURE__ */ v("div", {
|
|
110
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none",
|
|
111
|
+
children: s
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
}), r[0] = c, r[1] = a, r[2] = m, r[3] = o, r[4] = i, r[5] = d, r[6] = _, r[7] = s, r[8] = p, r[9] = f, r[10] = x) : x = r[10];
|
|
115
|
+
let S;
|
|
116
|
+
return r[11] !== d || r[12] !== x ? (S = /* @__PURE__ */ v(w, {
|
|
117
|
+
...d,
|
|
118
|
+
children: x
|
|
119
|
+
}), r[11] = d, r[12] = x, r[13] = S) : S = r[13], S;
|
|
120
|
+
}, E = (e) => {
|
|
121
|
+
let t = b(2), n;
|
|
122
|
+
return t[0] === e ? n = t[1] : (n = /* @__PURE__ */ v(w, {
|
|
123
|
+
...e,
|
|
124
|
+
children: k
|
|
125
|
+
}), t[0] = e, t[1] = n), n;
|
|
126
|
+
}, D = (e) => {
|
|
127
|
+
let t = b(8), n, r;
|
|
128
|
+
t[0] === e ? (n = t[1], r = t[2]) : ({children: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
129
|
+
let i;
|
|
130
|
+
t[3] === n ? i = t[4] : (i = (e) => {
|
|
131
|
+
let { onChange: t, onBlur: r, ...i } = e;
|
|
132
|
+
return /* @__PURE__ */ y(u, {
|
|
133
|
+
...i,
|
|
134
|
+
onValueChange: t,
|
|
135
|
+
children: [/* @__PURE__ */ v(f, {
|
|
136
|
+
"aria-invalid": i["aria-invalid"],
|
|
137
|
+
id: i.id,
|
|
138
|
+
onBlur: r,
|
|
139
|
+
children: /* @__PURE__ */ v(p, {})
|
|
140
|
+
}), /* @__PURE__ */ v(d, { children: n })]
|
|
141
|
+
});
|
|
142
|
+
}, t[3] = n, t[4] = i);
|
|
143
|
+
let a;
|
|
144
|
+
return t[5] !== r || t[6] !== i ? (a = /* @__PURE__ */ v(w, {
|
|
104
145
|
...r,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
146
|
+
children: i
|
|
147
|
+
}), t[5] = r, t[6] = i, t[7] = a) : a = t[7], a;
|
|
148
|
+
}, O = (e) => {
|
|
149
|
+
let t = b(8), r, i;
|
|
150
|
+
t[0] === e ? (r = t[1], i = t[2]) : ({disabled: r, ...i} = e, t[0] = e, t[1] = r, t[2] = i);
|
|
151
|
+
let a;
|
|
152
|
+
t[3] === r ? a = t[4] : (a = (e) => {
|
|
153
|
+
let { onChange: t, value: i, ...a } = e;
|
|
154
|
+
return /* @__PURE__ */ v(n, {
|
|
155
|
+
...a,
|
|
156
|
+
checked: i,
|
|
157
|
+
onCheckedChange: t,
|
|
158
|
+
disabled: r
|
|
159
|
+
});
|
|
160
|
+
}, t[3] = r, t[4] = a);
|
|
161
|
+
let o;
|
|
162
|
+
return t[5] !== i || t[6] !== a ? (o = /* @__PURE__ */ v(w, {
|
|
118
163
|
...i,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
})
|
|
123
|
-
}
|
|
164
|
+
horizontal: !0,
|
|
165
|
+
controlFirst: !0,
|
|
166
|
+
children: a
|
|
167
|
+
}), t[5] = i, t[6] = a, t[7] = o) : o = t[7], o;
|
|
168
|
+
};
|
|
169
|
+
function k(e) {
|
|
170
|
+
return /* @__PURE__ */ v(m, { ...e });
|
|
171
|
+
}
|
|
124
172
|
//#endregion
|
|
125
|
-
export {
|
|
173
|
+
export { w as FormBase, O as FormCheckbox, T as FormInput, D as FormSimpleSelect, E as FormTextarea };
|
package/dist/index136.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./index4.cjs"),t=require("./index11.cjs"),n=require("./index28.cjs"),r=require("./index82.cjs"),i=require("./index84.cjs"),a=require("./index88.cjs"),o=require("./index105.cjs"),s=require("./index120.cjs"),c=require("./index135.cjs");let l=require("react"),u=require("react/jsx-runtime");var
|
|
1
|
+
const e=require("./index4.cjs"),t=require("./index11.cjs"),n=require("./index28.cjs"),r=require("./index82.cjs"),i=require("./index84.cjs"),a=require("./index88.cjs"),o=require("./index105.cjs"),s=require("./index120.cjs"),c=require("./index135.cjs");let l=require("react"),u=require("react/jsx-runtime"),d=require("react/compiler-runtime");var f=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,p=/^(0|\+84)(3|5|7|8|9)[0-9]{8}$/,m=(e,t)=>{let n=e.toLowerCase();if(t===`password`)return n.includes(`confirm`)||n.includes(`new`)?`new-password`:`current-password`;if(t===`email`||n.includes(`email`))return`email`;if(t===`tel`||n.includes(`phone`))return`tel`;if(n.includes(`name`))return`name`;if(n.includes(`username`))return`username`};function h(e){let t=(0,d.c)(20),{children:n,label:a,control:o,name:s,htmlType:c,description:l,controlFirst:m,horizontal:h,rules:g,className:_}=e,v;if(t[0]!==c||t[1]!==g){if(v={...g},c===`email`&&!g?.pattern){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e={value:f,message:`Email không hợp lệ`},t[3]=e):e=t[3],v.pattern=e}if(c===`tel`&&!g?.pattern){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e={value:p,message:`Số điện thoại không hợp lệ`},t[4]=e):e=t[4],v.pattern=e}if(g?.required!==void 0&&g.required!==!1)if(typeof g.required==`string`)v.required=g.required;else if(typeof g.required==`object`){if(!g.required.message){let e;t[5]===g.required?e=t[6]:(e={...g.required,message:`Trường này là bắt buộc`},t[5]=g.required,t[6]=e),v.required=e}}else v.required=`Trường này là bắt buộc`;t[0]=c,t[1]=g,t[2]=v}else v=t[2];let y=v,b;t[7]!==n||t[8]!==_||t[9]!==m||t[10]!==l||t[11]!==h||t[12]!==a||t[13]!==g?.required?(b=e=>{let{field:t,fieldState:i}=e,o=(0,u.jsxs)(u.Fragment,{children:[a&&(0,u.jsxs)(r.FieldLabel,{htmlFor:t.name,children:[a,g?.required&&(0,u.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),l&&(0,u.jsx)(r.FieldDescription,{children:l})]}),s=n({...t,id:t.name,"aria-invalid":i.invalid}),c=i.invalid&&(0,u.jsx)(r.FieldError,{errors:[i.error]});return(0,u.jsx)(r.Field,{className:_,"data-invalid":i.invalid,orientation:h?`horizontal`:void 0,children:m?(0,u.jsxs)(u.Fragment,{children:[s,(0,u.jsxs)(r.FieldContent,{children:[o,c]})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(r.FieldContent,{children:o}),s,c]})})},t[7]=n,t[8]=_,t[9]=m,t[10]=l,t[11]=h,t[12]=a,t[13]=g?.required,t[14]=b):b=t[14];let x;return t[15]!==o||t[16]!==s||t[17]!==y||t[18]!==b?(x=(0,u.jsx)(i.Controller,{control:o,name:s,rules:y,render:b}),t[15]=o,t[16]=s,t[17]=y,t[18]=b,t[19]=x):x=t[19],x}var g=n=>{let r=(0,d.c)(14),{placeholder:i,inputClassName:o,leftIcon:s,rightIcon:f,disabled:p,autoComplete:g,..._}=n,[v,y]=(0,l.useState)(!1),b=_.htmlType===`password`,x=g??m(String(_.name),_.htmlType),S;r[0]!==p||r[1]!==o||r[2]!==b||r[3]!==s||r[4]!==i||r[5]!==_||r[6]!==x||r[7]!==f||r[8]!==y||r[9]!==v?(S=n=>(0,u.jsxs)(`div`,{className:`relative`,children:[s&&(0,u.jsx)(`div`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none`,children:s}),(0,u.jsx)(a.Input,{...n,type:b&&v?`text`:_.htmlType,autoComplete:x,placeholder:i,disabled:p,className:e.cn(s&&`pl-10`,(b||f)&&`pr-10`,o)}),b&&(0,u.jsx)(t.Button,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>y(!v),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,tabIndex:-1,children:v?(0,u.jsx)(c.Icons.EyeOff,{className:`h-4 w-4`}):(0,u.jsx)(c.Icons.Eye,{className:`h-4 w-4`})}),!b&&f&&(0,u.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none`,children:f})]}),r[0]=p,r[1]=o,r[2]=b,r[3]=s,r[4]=i,r[5]=_,r[6]=x,r[7]=f,r[8]=y,r[9]=v,r[10]=S):S=r[10];let C;return r[11]!==_||r[12]!==S?(C=(0,u.jsx)(h,{..._,children:S}),r[11]=_,r[12]=S,r[13]=C):C=r[13],C},_=e=>{let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,u.jsx)(h,{...e,children:b}),t[0]=e,t[1]=n),n},v=e=>{let t=(0,d.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=e=>{let{onChange:t,onBlur:r,...i}=e;return(0,u.jsxs)(o.Select,{...i,onValueChange:t,children:[(0,u.jsx)(o.SelectTrigger,{"aria-invalid":i[`aria-invalid`],id:i.id,onBlur:r,children:(0,u.jsx)(o.SelectValue,{})}),(0,u.jsx)(o.SelectContent,{children:n})]})},t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,u.jsx)(h,{...r,children:i}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},y=e=>{let t=(0,d.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({disabled:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=e=>{let{onChange:t,value:i,...a}=e;return(0,u.jsx)(n.Checkbox,{...a,checked:i,onCheckedChange:t,disabled:r})},t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,u.jsx)(h,{...i,horizontal:!0,controlFirst:!0,children:a}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};function b(e){return(0,u.jsx)(s.Textarea,{...e})}exports.FormBase=h,exports.FormCheckbox=y,exports.FormInput=g,exports.FormSimpleSelect=v,exports.FormTextarea=_;
|