ui-mathilde-web 0.1.7 → 0.1.8

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.
@@ -178,7 +178,7 @@ declare interface TableComponentProps {
178
178
  itemsPerPage?: number;
179
179
  title?: string;
180
180
  onToggleChange?: (rowData: {
181
- rowIndex: number;
181
+ rowId: string | number;
182
182
  checked: boolean;
183
183
  row: TableData;
184
184
  columnKey: string;
@@ -186,6 +186,7 @@ declare interface TableComponentProps {
186
186
  }
187
187
 
188
188
  declare interface TableData extends Record<string, unknown> {
189
+ id: string | number;
189
190
  [key: string]: unknown;
190
191
  }
191
192
 
@@ -21779,21 +21779,21 @@ const g_ = ({
21779
21779
  ) : e, [e, s, t]), u = k.useMemo(() => {
21780
21780
  const g = (l - 1) * r, p = g + r;
21781
21781
  return d.slice(g, p);
21782
- }, [d, l, r]), f = Math.ceil(d.length / r), h = (g, p, m) => {
21783
- const v = p[g.relation];
21782
+ }, [d, l, r]), f = Math.ceil(d.length / r), h = (g, p) => {
21783
+ const m = p[g.relation];
21784
21784
  return g.isToggle ? /* @__PURE__ */ b(
21785
21785
  JC,
21786
21786
  {
21787
- checked: !!v,
21788
- onChange: (y) => i == null ? void 0 : i({
21789
- rowIndex: m,
21790
- checked: y,
21787
+ checked: !!m,
21788
+ onChange: (v) => i == null ? void 0 : i({
21789
+ rowId: p.id,
21790
+ checked: v,
21791
21791
  row: p,
21792
21792
  columnKey: g.relation
21793
21793
  }),
21794
21794
  disabled: !1
21795
21795
  }
21796
- ) : g.cell ? g.cell(p) : v != null ? String(v) : "";
21796
+ ) : g.cell ? g.cell(p) : m != null ? String(m) : "";
21797
21797
  };
21798
21798
  return /* @__PURE__ */ z("div", { className: "w-full", children: [
21799
21799
  /* @__PURE__ */ b("div", { className: "mb-4 flex items-center justify-between", children: o && /* @__PURE__ */ b("h2", { className: "text-xl font-bold", children: o }) }),
@@ -21819,20 +21819,20 @@ const g_ = ({
21819
21819
  /* @__PURE__ */ b("div", { className: "overflow-x-auto", children: /* @__PURE__ */ z(jn, { striped: !0, children: [
21820
21820
  /* @__PURE__ */ b(jn.Head, { children: t.map((g, p) => /* @__PURE__ */ b(jn.HeadCell, { children: g.header }, p)) }),
21821
21821
  /* @__PURE__ */ b("hr", {}),
21822
- /* @__PURE__ */ b(jn.Body, { className: "divide-y", children: u.map((g, p) => /* @__PURE__ */ b(
21822
+ /* @__PURE__ */ b(jn.Body, { className: "divide-y", children: u.map((g) => /* @__PURE__ */ b(
21823
21823
  jn.Row,
21824
21824
  {
21825
21825
  className: "bg-white dark:border-gray-700 dark:bg-gray-800",
21826
- children: t.map((m, v) => /* @__PURE__ */ b(
21826
+ children: t.map((p, m) => /* @__PURE__ */ b(
21827
21827
  jn.Cell,
21828
21828
  {
21829
21829
  className: "whitespace-nowrap font-medium text-gray-900 dark:text-white",
21830
- children: h(m, g, p)
21830
+ children: h(p, g)
21831
21831
  },
21832
- v
21832
+ `${g.id}-${m}`
21833
21833
  ))
21834
21834
  },
21835
- p
21835
+ g.id
21836
21836
  )) })
21837
21837
  ] }) })
21838
21838
  ] });
@@ -504,7 +504,7 @@ Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}
504
504
  peer-checked:bg-blue-600 peer-checked:after:translate-x-full peer-checked:after:border-white
505
505
  peer-focus:ring-4 peer-focus:ring-blue-300 dark:border-gray-600
506
506
  dark:bg-gray-700 dark:peer-checked:bg-blue-600
507
- dark:peer-focus:ring-blue-800 rtl:peer-checked:after:-translate-x-full`})]}),t&&g.jsx("span",{className:`text-sm ${r?"text-gray-500":"text-gray-700"}`,children:t})]})}const SC=({columns:t,data:e,showSearch:r=!1,itemsPerPage:n=5,title:o,onToggleChange:i})=>{const[s,a]=C.useState(""),[l,c]=C.useState(1),d=C.useMemo(()=>s.trim()?e.filter(p=>t.some(m=>{const b=p[m.relation];return b!=null&&String(b).toLowerCase().includes(s.toLowerCase().trim())})):e,[e,s,t]),u=C.useMemo(()=>{const p=(l-1)*n,m=p+n;return d.slice(p,m)},[d,l,n]),f=Math.ceil(d.length/n),h=(p,m,b)=>{const v=m[p.relation];return p.isToggle?g.jsx(_C,{checked:!!v,onChange:y=>i==null?void 0:i({rowIndex:b,checked:y,row:m,columnKey:p.relation}),disabled:!1}):p.cell?p.cell(m):v!=null?String(v):""};return g.jsxs("div",{className:"w-full",children:[g.jsx("div",{className:"mb-4 flex items-center justify-between",children:o&&g.jsx("h2",{className:"text-xl font-bold",children:o})}),g.jsxs("div",{className:"mb-4 flex",children:[r&&g.jsx("div",{className:"w-1/2",children:g.jsx(ea,{rightIcon:h1,placeholder:"Buscar",value:s,onChange:p=>a(p.target.value)})}),f>1&&g.jsx("div",{className:"flex w-full justify-end",children:g.jsx(CC,{currentPage:l,totalPages:f,onPageChange:c})})]}),g.jsx("div",{className:"overflow-x-auto",children:g.jsxs(en,{striped:!0,children:[g.jsx(en.Head,{children:t.map((p,m)=>g.jsx(en.HeadCell,{children:p.header},m))}),g.jsx("hr",{}),g.jsx(en.Body,{className:"divide-y",children:u.map((p,m)=>g.jsx(en.Row,{className:"bg-white dark:border-gray-700 dark:bg-gray-800",children:t.map((b,v)=>g.jsx(en.Cell,{className:"whitespace-nowrap font-medium text-gray-900 dark:text-white",children:h(b,p,m)},v))},m))})]})})]})},Wg={"m-image-container":"layoutOutside-module__m-image-container__sCvFu","m-image":"layoutOutside-module__m-image__kZHyH"},EC=()=>g.jsxs("div",{className:"mt-32",children:[g.jsx(Rt,{classIm:"mx-auto",src:"https://ftp.mathilde-ads.com/151-41415c0c026df82dbb391c09db474cfa.png",alt:"Logo Mathilde ads",width:400,height:250}),g.jsx("div",{className:Wg["m-image-container"],children:g.jsx(Rt,{classIm:Wg["m-image"],src:"https://ftp.mathilde-ads.com/151-3f28d319ba5adbe318c58ef38b858e50.png",alt:"Logo Mathilde ads",width:400,height:300})})]}),OC=({onOpenModal:t,checked:e,onChange:r,label:n,...o})=>{const i=()=>{e||t(),r(!1)};return g.jsx("div",{className:"mb-5",children:g.jsxs("label",{className:to["checkbox-container"],children:[g.jsx("input",{type:"checkbox",...o,checked:e,onChange:i,required:!0}),g.jsx("span",{className:to.checkmark}),n&&g.jsx("span",{children:n})]})})},Vg=({validations:t})=>{const e=({isValid:n})=>g.jsx("svg",{className:`me-2 h-3.5 w-3.5 ${n?"text-green-500 dark:text-green-400":"text-gray-500 dark:text-gray-400"} shrink-0`,"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 20 20",children:g.jsx("path",{d:"M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 8.207-4 4a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L9 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414Z"})}),r=[{key:"hasMinLength",text:"Debe ser minimo de 8 caracteres"},{key:"hasNumber",text:"Debe tener minimo un numero"},{key:"hasUpperCase",text:"Debe tener minimo una letra mayuscula"},{key:"hasLowerCase",text:"Debe tener minimo una letra minuscula"},{key:"hasSpecialChar",text:"Debe tener minimo un caracter especial"}];return g.jsx("ul",{className:"mb-3 max-w-md list-inside space-y-1 text-sm text-gray-500 dark:text-gray-400",children:r.map(({key:n,text:o})=>g.jsxs("li",{className:"flex items-center",children:[g.jsx(e,{isValid:t[n]}),o]},n))})},TC=()=>{const[t,e]=k.useState(""),[r,n]=k.useState(""),[o,i]=k.useState({hasMinLength:!1,hasNumber:!1,hasUpperCase:!1,hasLowerCase:!1,hasSpecialChar:!1});k.useEffect(()=>{i({hasMinLength:t.length>=8,hasNumber:/\d/.test(t),hasUpperCase:/[A-Z]/.test(t),hasLowerCase:/[a-z]/.test(t),hasSpecialChar:/[!@#$%^&*(),.?":{}|<>]/.test(t)})},[t]);const s=()=>t.trim()&&r.trim()&&t===r&&Object.values(o).every(l=>l);return{password:t,setPassword:e,confirmPassword:r,setConfirmPassword:n,showError:()=>!s()&&t.trim()&&r.trim(),validations:o}},NC=({formik:t})=>{const{password:e,setPassword:r,confirmPassword:n,setConfirmPassword:o,validations:i}=TC();return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"block",children:[g.jsx(zi,{placeholder:"Contraseña",value:e,onChange:s=>{r(s.target.value),t.setFieldValue("password",s.target.value)},onBlur:t.handleBlur("password")}),t.errors.password&&t.touched.password&&g.jsx("div",{className:"my-2 text-sm text-red-500",children:String(t.errors.password)})]}),g.jsxs("div",{className:"block",children:[g.jsx(zi,{placeholder:"Confirmar contraseña",value:n,onChange:s=>{o(s.target.value),t.setFieldValue("confirmPassword",s.target.value)},onBlur:t.handleBlur("confirmPassword")}),t.errors.confirmPassword&&t.touched.confirmPassword&&g.jsx("div",{className:"my-2 text-sm text-red-500",children:String(t.errors.confirmPassword)})]}),g.jsx(Vg,{validations:i})]})},MC=({items:t})=>{const[e,r]=k.useState([]),n=i=>{r(s=>s.includes(i)?s.filter(a=>a!==i):[...s,i])},o=(i,s=0)=>g.jsx("ul",{className:"list-none space-y-2",children:i.map(a=>{const l=a.subItems&&a.subItems.length>0,c=e.includes(a.id);return g.jsxs("li",{className:`
507
+ dark:peer-focus:ring-blue-800 rtl:peer-checked:after:-translate-x-full`})]}),t&&g.jsx("span",{className:`text-sm ${r?"text-gray-500":"text-gray-700"}`,children:t})]})}const SC=({columns:t,data:e,showSearch:r=!1,itemsPerPage:n=5,title:o,onToggleChange:i})=>{const[s,a]=C.useState(""),[l,c]=C.useState(1),d=C.useMemo(()=>s.trim()?e.filter(p=>t.some(m=>{const b=p[m.relation];return b!=null&&String(b).toLowerCase().includes(s.toLowerCase().trim())})):e,[e,s,t]),u=C.useMemo(()=>{const p=(l-1)*n,m=p+n;return d.slice(p,m)},[d,l,n]),f=Math.ceil(d.length/n),h=(p,m)=>{const b=m[p.relation];return p.isToggle?g.jsx(_C,{checked:!!b,onChange:v=>i==null?void 0:i({rowId:m.id,checked:v,row:m,columnKey:p.relation}),disabled:!1}):p.cell?p.cell(m):b!=null?String(b):""};return g.jsxs("div",{className:"w-full",children:[g.jsx("div",{className:"mb-4 flex items-center justify-between",children:o&&g.jsx("h2",{className:"text-xl font-bold",children:o})}),g.jsxs("div",{className:"mb-4 flex",children:[r&&g.jsx("div",{className:"w-1/2",children:g.jsx(ea,{rightIcon:h1,placeholder:"Buscar",value:s,onChange:p=>a(p.target.value)})}),f>1&&g.jsx("div",{className:"flex w-full justify-end",children:g.jsx(CC,{currentPage:l,totalPages:f,onPageChange:c})})]}),g.jsx("div",{className:"overflow-x-auto",children:g.jsxs(en,{striped:!0,children:[g.jsx(en.Head,{children:t.map((p,m)=>g.jsx(en.HeadCell,{children:p.header},m))}),g.jsx("hr",{}),g.jsx(en.Body,{className:"divide-y",children:u.map(p=>g.jsx(en.Row,{className:"bg-white dark:border-gray-700 dark:bg-gray-800",children:t.map((m,b)=>g.jsx(en.Cell,{className:"whitespace-nowrap font-medium text-gray-900 dark:text-white",children:h(m,p)},`${p.id}-${b}`))},p.id))})]})})]})},Wg={"m-image-container":"layoutOutside-module__m-image-container__sCvFu","m-image":"layoutOutside-module__m-image__kZHyH"},EC=()=>g.jsxs("div",{className:"mt-32",children:[g.jsx(Rt,{classIm:"mx-auto",src:"https://ftp.mathilde-ads.com/151-41415c0c026df82dbb391c09db474cfa.png",alt:"Logo Mathilde ads",width:400,height:250}),g.jsx("div",{className:Wg["m-image-container"],children:g.jsx(Rt,{classIm:Wg["m-image"],src:"https://ftp.mathilde-ads.com/151-3f28d319ba5adbe318c58ef38b858e50.png",alt:"Logo Mathilde ads",width:400,height:300})})]}),OC=({onOpenModal:t,checked:e,onChange:r,label:n,...o})=>{const i=()=>{e||t(),r(!1)};return g.jsx("div",{className:"mb-5",children:g.jsxs("label",{className:to["checkbox-container"],children:[g.jsx("input",{type:"checkbox",...o,checked:e,onChange:i,required:!0}),g.jsx("span",{className:to.checkmark}),n&&g.jsx("span",{children:n})]})})},Vg=({validations:t})=>{const e=({isValid:n})=>g.jsx("svg",{className:`me-2 h-3.5 w-3.5 ${n?"text-green-500 dark:text-green-400":"text-gray-500 dark:text-gray-400"} shrink-0`,"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 20 20",children:g.jsx("path",{d:"M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 8.207-4 4a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L9 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414Z"})}),r=[{key:"hasMinLength",text:"Debe ser minimo de 8 caracteres"},{key:"hasNumber",text:"Debe tener minimo un numero"},{key:"hasUpperCase",text:"Debe tener minimo una letra mayuscula"},{key:"hasLowerCase",text:"Debe tener minimo una letra minuscula"},{key:"hasSpecialChar",text:"Debe tener minimo un caracter especial"}];return g.jsx("ul",{className:"mb-3 max-w-md list-inside space-y-1 text-sm text-gray-500 dark:text-gray-400",children:r.map(({key:n,text:o})=>g.jsxs("li",{className:"flex items-center",children:[g.jsx(e,{isValid:t[n]}),o]},n))})},TC=()=>{const[t,e]=k.useState(""),[r,n]=k.useState(""),[o,i]=k.useState({hasMinLength:!1,hasNumber:!1,hasUpperCase:!1,hasLowerCase:!1,hasSpecialChar:!1});k.useEffect(()=>{i({hasMinLength:t.length>=8,hasNumber:/\d/.test(t),hasUpperCase:/[A-Z]/.test(t),hasLowerCase:/[a-z]/.test(t),hasSpecialChar:/[!@#$%^&*(),.?":{}|<>]/.test(t)})},[t]);const s=()=>t.trim()&&r.trim()&&t===r&&Object.values(o).every(l=>l);return{password:t,setPassword:e,confirmPassword:r,setConfirmPassword:n,showError:()=>!s()&&t.trim()&&r.trim(),validations:o}},NC=({formik:t})=>{const{password:e,setPassword:r,confirmPassword:n,setConfirmPassword:o,validations:i}=TC();return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"block",children:[g.jsx(zi,{placeholder:"Contraseña",value:e,onChange:s=>{r(s.target.value),t.setFieldValue("password",s.target.value)},onBlur:t.handleBlur("password")}),t.errors.password&&t.touched.password&&g.jsx("div",{className:"my-2 text-sm text-red-500",children:String(t.errors.password)})]}),g.jsxs("div",{className:"block",children:[g.jsx(zi,{placeholder:"Confirmar contraseña",value:n,onChange:s=>{o(s.target.value),t.setFieldValue("confirmPassword",s.target.value)},onBlur:t.handleBlur("confirmPassword")}),t.errors.confirmPassword&&t.touched.confirmPassword&&g.jsx("div",{className:"my-2 text-sm text-red-500",children:String(t.errors.confirmPassword)})]}),g.jsx(Vg,{validations:i})]})},MC=({items:t})=>{const[e,r]=k.useState([]),n=i=>{r(s=>s.includes(i)?s.filter(a=>a!==i):[...s,i])},o=(i,s=0)=>g.jsx("ul",{className:"list-none space-y-2",children:i.map(a=>{const l=a.subItems&&a.subItems.length>0,c=e.includes(a.id);return g.jsxs("li",{className:`
508
508
  ${s>0?"ml-7":""}
509
509
  `,children:[g.jsxs("div",{className:"flex items-center gap-2 py-1",children:[g.jsxs("div",{className:"flex min-w-[48px] items-center gap-1",children:[l&&g.jsx("button",{onClick:()=>n(a.id),className:"rounded-full p-1 transition-transform duration-200 hover:bg-gray-100",children:c?g.jsx(op,{className:"text-sm text-gray-500"}):g.jsx(np,{className:"text-sm text-gray-500"})}),!l&&g.jsx("div",{className:"w-[28px]"})," ",a.icon&&g.jsx(a.icon,{className:`text-lg ${a.isActive?"text-blue-700 dark:text-blue-500":"text-gray-600"}`})]}),g.jsx("a",{href:a.href,className:`
510
510
  flex-grow transition-colors duration-200
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-mathilde-web",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"