@zimyo/ui 1.12.6 → 1.13.0
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/chunks/{Calender-f8e1cbb6.esm.js → Calender-811137b7.esm.js} +1 -1
- package/dist/chunks/{Calender-7cb96562.js → Calender-fd591944.js} +1 -1
- package/dist/chunks/lucide-1d5a9cda.esm.js +26 -0
- package/dist/chunks/{lucide-3fef2423.js → lucide-937248a9.js} +2 -2
- package/dist/components/Accordion/index.esm.js +1 -1
- package/dist/components/Accordion/index.js +1 -1
- package/dist/components/AppList/index.esm.js +1 -1
- package/dist/components/AppList/index.js +1 -1
- package/dist/components/BulkActionsBar/index.esm.js +1 -1
- package/dist/components/BulkActionsBar/index.js +1 -1
- package/dist/components/Checkbox/index.esm.js +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/CheckboxGroup/index.esm.js +1 -1
- package/dist/components/CheckboxGroup/index.js +1 -1
- package/dist/components/DataTable/index.esm.js +1 -1
- package/dist/components/DataTable/index.js +1 -1
- package/dist/components/DatePicker/index.esm.js +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/DateRangePicker/index.esm.js +1 -1
- package/dist/components/DateRangePicker/index.js +1 -1
- package/dist/components/Form/index.esm.js +1 -1
- package/dist/components/Form/index.js +1 -1
- package/dist/components/GlobalMenuSearch/index.esm.js +1 -1
- package/dist/components/GlobalMenuSearch/index.js +1 -1
- package/dist/components/Input/index.d.ts +2 -25
- package/dist/components/Input/index.esm.js +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/Modal/index.esm.js +1 -1
- package/dist/components/Modal/index.js +1 -1
- package/dist/components/Notice/index.esm.js +1 -1
- package/dist/components/Notice/index.js +1 -1
- package/dist/components/PopupConfirm/index.esm.js +1 -1
- package/dist/components/PopupConfirm/index.js +1 -1
- package/dist/components/SearchInput/index.d.ts +20 -0
- package/dist/components/SearchInput/index.esm.js +9 -0
- package/dist/components/SearchInput/index.js +9 -0
- package/dist/components/Select/index.esm.js +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Stepper/index.d.ts +72 -0
- package/dist/components/Stepper/index.esm.js +1 -0
- package/dist/components/Stepper/index.js +1 -0
- package/dist/components/Table/index.esm.js +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/TimePicker/index.esm.js +1 -1
- package/dist/components/TimePicker/index.js +1 -1
- package/dist/index-5f6a7a1d.d.ts +25 -0
- package/dist/index.d.ts +84 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +11 -1
- package/dist/chunks/lucide-7e7c48b9.esm.js +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as r,b as a}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsx as i}from"react/jsx-runtime";import o from"react";import{useTheme as n,Accordion as d,AccordionSummary as t,AccordionDetails as l}from"@mui/material";import{c as u}from"../../chunks/lucide-
|
|
1
|
+
import{_ as e,a as r,b as a}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsx as i}from"react/jsx-runtime";import o from"react";import{useTheme as n,Accordion as d,AccordionSummary as t,AccordionDetails as l}from"@mui/material";import{c as u}from"../../chunks/lucide-1d5a9cda.esm.js";var s=o.createContext({}),c=o.forwardRef(function(a,d){var t=a.type,l=void 0===t?"single":t,u=a.collapsible,c=void 0!==u&&u,p=a.value,v=a.defaultValue,f=a.onValueChange,m=a.children;a.sx;var h=e(a,["type","collapsible","value","defaultValue","onValueChange","children","sx"]),x=n(),b=o.useState(function(){return void 0!==p?p:void 0!==v?v:"multiple"===l?[]:""}),g=b[0],R=b[1],y=void 0!==p?p:g,C=o.useCallback(function(e){void 0===p&&R(e),null==f||f(e)},[p,f]),V=o.useMemo(function(){return{type:l,collapsible:c,value:y,defaultValue:v,onValueChange:C}},[l,c,y,v,C]);return i(s.Provider,{value:V,children:i("div",r({ref:d,style:{display:"flex",flexDirection:"column",gap:x.spacing(1)}},h,{children:m}))})}),p=o.forwardRef(function(t,l){var u,c=t.value,p=t.children,v=t.sx,f=void 0===v?{}:v,m=e(t,["value","children","sx"]),h=n(),x=o.useContext(s),b=o.useMemo(function(){return"multiple"===x.type?Array.isArray(x.value)&&x.value.includes(c):x.value===c},[x.value,x.type,c]),g=o.useCallback(function(){if(x.onValueChange)if("multiple"===x.type){var e=Array.isArray(x.value)?x.value:[],r=b?e.filter(function(e){return e!==c}):a(a([],e,!0),[c],!1);x.onValueChange(r)}else{r=b&&x.collapsible?"":c;x.onValueChange(r)}},[x,c,b]);return i(d,r({ref:l,expanded:b,onChange:g,variant:"outlined",sx:r({borderRadius:(null===(u=h.radius)||void 0===u?void 0:u.sm)||h.shape.borderRadius,"&:before":{display:"none"},"&.Mui-expanded":{margin:0},border:"1px solid ".concat(h.palette.divider)},f)},m,{children:p}))}),v=o.forwardRef(function(a,o){var d,l=a.children,s=a.sx,c=void 0===s?{}:s,p=a.expandIcon,v=e(a,["children","sx","expandIcon"]),f=n(),m=void 0!==p?p:i(u,{});return i(t,r({ref:o,expandIcon:m,sx:r({borderRadius:(null===(d=f.radius)||void 0===d?void 0:d.sm)||f.shape.borderRadius,minHeight:56,fontWeight:500,"&.Mui-expanded":{minHeight:56,borderBottomLeftRadius:0,borderBottomRightRadius:0,borderBottom:"1px solid ".concat(f.palette.divider)},"& .MuiAccordionSummary-content":{margin:"12px 0","&.Mui-expanded":{margin:"12px 0"}},"& .MuiAccordionSummary-expandIconWrapper":{transition:f.transitions.create("transform",{duration:f.transitions.duration.shortest}),"&.Mui-expanded":{transform:"rotate(180deg)"}},"&:hover":{backgroundColor:f.palette.action.hover}},c)},v,{children:l}))}),f=o.forwardRef(function(a,o){var d,t,u=a.children,s=a.sx,c=void 0===s?{}:s,p=e(a,["children","sx"]),v=n();return i(l,r({ref:o,sx:r({padding:v.spacing(2),borderBottomLeftRadius:(null===(d=v.radius)||void 0===d?void 0:d.sm)||v.shape.borderRadius,borderBottomRightRadius:(null===(t=v.radius)||void 0===t?void 0:t.sm)||v.shape.borderRadius},c)},p,{children:u}))});export{c as Accordion,f as AccordionContent,p as AccordionItem,v as AccordionTrigger,c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),i=require("react"),a=require("@mui/material"),n=require("../../chunks/lucide-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),i=require("react"),a=require("@mui/material"),n=require("../../chunks/lucide-937248a9.js"),o=i.createContext({}),d=i.forwardRef(function(n,d){var s=n.type,t=void 0===s?"single":s,u=n.collapsible,l=void 0!==u&&u,c=n.value,p=n.defaultValue,v=n.onValueChange,x=n.children;n.sx;var h=e.__rest(n,["type","collapsible","value","defaultValue","onValueChange","children","sx"]),f=a.useTheme(),m=i.useState(function(){return void 0!==c?c:void 0!==p?p:"multiple"===t?[]:""}),g=m[0],_=m[1],b=void 0!==c?c:g,y=i.useCallback(function(e){void 0===c&&_(e),null==v||v(e)},[c,v]),R=i.useMemo(function(){return{type:t,collapsible:l,value:b,defaultValue:p,onValueChange:y}},[t,l,b,p,y]);return r.jsx(o.Provider,{value:R,children:r.jsx("div",e.__assign({ref:d,style:{display:"flex",flexDirection:"column",gap:f.spacing(1)}},h,{children:x}))})}),s=i.forwardRef(function(n,d){var s,t=n.value,u=n.children,l=n.sx,c=void 0===l?{}:l,p=e.__rest(n,["value","children","sx"]),v=a.useTheme(),x=i.useContext(o),h=i.useMemo(function(){return"multiple"===x.type?Array.isArray(x.value)&&x.value.includes(t):x.value===t},[x.value,x.type,t]),f=i.useCallback(function(){if(x.onValueChange)if("multiple"===x.type){var r=Array.isArray(x.value)?x.value:[],i=h?r.filter(function(e){return e!==t}):e.__spreadArray(e.__spreadArray([],r,!0),[t],!1);x.onValueChange(i)}else{i=h&&x.collapsible?"":t;x.onValueChange(i)}},[x,t,h]);return r.jsx(a.Accordion,e.__assign({ref:d,expanded:h,onChange:f,variant:"outlined",sx:e.__assign({borderRadius:(null===(s=v.radius)||void 0===s?void 0:s.sm)||v.shape.borderRadius,"&:before":{display:"none"},"&.Mui-expanded":{margin:0},border:"1px solid ".concat(v.palette.divider)},c)},p,{children:u}))}),t=i.forwardRef(function(i,o){var d,s=i.children,t=i.sx,u=void 0===t?{}:t,l=i.expandIcon,c=e.__rest(i,["children","sx","expandIcon"]),p=a.useTheme(),v=void 0!==l?l:r.jsx(n.ChevronDown,{});return r.jsx(a.AccordionSummary,e.__assign({ref:o,expandIcon:v,sx:e.__assign({borderRadius:(null===(d=p.radius)||void 0===d?void 0:d.sm)||p.shape.borderRadius,minHeight:56,fontWeight:500,"&.Mui-expanded":{minHeight:56,borderBottomLeftRadius:0,borderBottomRightRadius:0,borderBottom:"1px solid ".concat(p.palette.divider)},"& .MuiAccordionSummary-content":{margin:"12px 0","&.Mui-expanded":{margin:"12px 0"}},"& .MuiAccordionSummary-expandIconWrapper":{transition:p.transitions.create("transform",{duration:p.transitions.duration.shortest}),"&.Mui-expanded":{transform:"rotate(180deg)"}},"&:hover":{backgroundColor:p.palette.action.hover}},u)},c,{children:s}))}),u=i.forwardRef(function(i,n){var o,d,s=i.children,t=i.sx,u=void 0===t?{}:t,l=e.__rest(i,["children","sx"]),c=a.useTheme();return r.jsx(a.AccordionDetails,e.__assign({ref:n,sx:e.__assign({padding:c.spacing(2),borderBottomLeftRadius:(null===(o=c.radius)||void 0===o?void 0:o.sm)||c.shape.borderRadius,borderBottomRightRadius:(null===(d=c.radius)||void 0===d?void 0:d.sm)||c.shape.borderRadius},u)},l,{children:s}))});exports.Accordion=d,exports.AccordionContent=u,exports.AccordionItem=s,exports.AccordionTrigger=t,exports.default=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsxs as r,Fragment as i,jsx as n}from"react/jsx-runtime";import{useState as t,useMemo as e}from"react";import a from"@mui/material/IconButton";import{Popover as m}from"../Popover/index.esm.js";import d from"@mui/material/List";import l from"@mui/material/ListItemText";import p from"@mui/material/ListItemIcon";import{ListItemButton as c}from"@mui/material";import{G as s}from"../../chunks/lucide-
|
|
1
|
+
import{a as o}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsxs as r,Fragment as i,jsx as n}from"react/jsx-runtime";import{useState as t,useMemo as e}from"react";import a from"@mui/material/IconButton";import{Popover as m}from"../Popover/index.esm.js";import d from"@mui/material/List";import l from"@mui/material/ListItemText";import p from"@mui/material/ListItemIcon";import{ListItemButton as c}from"@mui/material";import{G as s}from"../../chunks/lucide-1d5a9cda.esm.js";var u=function(u){var v=u.apps,f=void 0===v?[]:v,h=u.icon,g=void 0===h?s:h,b=u.urlKey,y=void 0===b?"url":b,k=u.nameKey,x=void 0===k?"name":k,I=u.appIconKey,P=void 0===I?"appIcon":I,C=u.iconProps,w=void 0===C?{}:C,j=u.popoverProps,T=void 0===j?{}:j,B=u.listProps,K=void 0===B?{}:B,L=u.listItemProps,z=void 0===L?{}:L,O=u.listItemTextProps,W=void 0===O?{}:O,E=u.width,G=void 0===E?240:E,_=u.padding,q=void 0===_?0:_,A=u.border,D=void 0===A||A,F=u.target,H=void 0===F?"_blank":F,J=t(null),M=J[0],N=J[1],Q=function(){N(null)},R=Boolean(M)?"simple-popover":void 0,S=e(function(){return null==f?void 0:f.filter(function(o){return o.display})},[f]);return r(i,{children:[n(a,o({"aria-describedby":R,onClick:function(o){N(o.currentTarget)}},w,{children:n(g,{})})),n(m,o({open:Boolean(M),onClose:Q,anchorEl:M,width:G,padding:q,border:D,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"}},T,{children:n(d,o({disablePadding:!0},K,{children:S.map(function(i,t){return r(c,o({component:"div",sx:{":hover":{backgroundColor:i.backgroundColor}},onClick:function(){Q(),window.open(i[y],H)}},z,{children:[i[P]?n(p,{sx:{minWidth:30,backgroundColor:i.backgroundColor},children:n("img",{width:22,height:22,src:i[P],alt:i.name})}):null,n(l,o({sx:{ml:1},primaryTypographyProps:{variant:"body2",fontWeight:500},primary:i[x]},W))]}),t)})}))}))]})};export{u as AppList,u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),e=require("react"),o=require("@mui/material/IconButton"),n=require("../Popover/index.js"),t=require("@mui/material/List"),s=require("@mui/material/ListItemText"),a=require("@mui/material/ListItemIcon"),d=require("@mui/material"),l=require("../../chunks/lucide-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),e=require("react"),o=require("@mui/material/IconButton"),n=require("../Popover/index.js"),t=require("@mui/material/List"),s=require("@mui/material/ListItemText"),a=require("@mui/material/ListItemIcon"),d=require("@mui/material"),l=require("../../chunks/lucide-937248a9.js"),u=function(u){var c=u.apps,p=void 0===c?[]:c,m=u.icon,v=void 0===m?l.Grip:m,g=u.urlKey,h=void 0===g?"url":g,x=u.nameKey,b=void 0===x?"name":x,j=u.appIconKey,_=void 0===j?"appIcon":j,f=u.iconProps,y=void 0===f?{}:f,q=u.popoverProps,P=void 0===q?{}:q,k=u.listProps,I=void 0===k?{}:k,C=u.listItemProps,w=void 0===C?{}:C,L=u.listItemTextProps,B=void 0===L?{}:L,T=u.width,K=void 0===T?240:T,O=u.padding,z=void 0===O?0:O,M=u.border,W=void 0===M||M,A=u.target,E=void 0===A?"_blank":A,F=e.useState(null),G=F[0],S=F[1],D=function(){S(null)},H=Boolean(G)?"simple-popover":void 0,J=e.useMemo(function(){return null==p?void 0:p.filter(function(i){return i.display})},[p]);return r.jsxs(r.Fragment,{children:[r.jsx(o,i.__assign({"aria-describedby":H,onClick:function(i){S(i.currentTarget)}},y,{children:r.jsx(v,{})})),r.jsx(n.Popover,i.__assign({open:Boolean(G),onClose:D,anchorEl:G,width:K,padding:z,border:W,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"}},P,{children:r.jsx(t,i.__assign({disablePadding:!0},I,{children:J.map(function(e,o){return r.jsxs(d.ListItemButton,i.__assign({component:"div",sx:{":hover":{backgroundColor:e.backgroundColor}},onClick:function(){D(),window.open(e[h],E)}},w,{children:[e[_]?r.jsx(a,{sx:{minWidth:30,backgroundColor:e.backgroundColor},children:r.jsx("img",{width:22,height:22,src:e[_],alt:e.name})}):null,r.jsx(s,i.__assign({sx:{ml:1},primaryTypographyProps:{variant:"body2",fontWeight:500},primary:e[b]},B))]}),o)})}))}))]})};exports.AppList=u,exports.default=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e,Fragment as r}from"react/jsx-runtime";import{useState as t}from"react";import{Button as o}from"../Button/index.esm.js";import"../../chunks/tslib.es6-4974c96c.esm.js";import{ListItemButton as a,IconButton as l}from"@mui/material";import{T as n}from"../../chunks/Text-5b99f7f4.esm.js";import s from"@mui/material/List";import u from"@mui/material/ListItemText";import{Popover as m}from"../Popover/index.esm.js";import{c,X as d}from"../../chunks/lucide-
|
|
1
|
+
import{jsxs as i,jsx as e,Fragment as r}from"react/jsx-runtime";import{useState as t}from"react";import{Button as o}from"../Button/index.esm.js";import"../../chunks/tslib.es6-4974c96c.esm.js";import{ListItemButton as a,IconButton as l}from"@mui/material";import{T as n}from"../../chunks/Text-5b99f7f4.esm.js";import s from"@mui/material/List";import u from"@mui/material/ListItemText";import{Popover as m}from"../Popover/index.esm.js";import{c,X as d}from"../../chunks/lucide-1d5a9cda.esm.js";var z=function(z){var p=z.selectedRows,h=z.totalRows,b=z.bulkActions,f=z.clearSelection,x=z.maxVisibleActions,g=void 0===x?3:x,v=t(null),k=v[0],w=v[1],y=b.slice(0,g),j=b.slice(g),C=function(){w(null)},N=Boolean(k);return 0===p.length?null:i("div",{className:"zui:bg-blue-100 zui:border zui:border-blue-200 zui:shadow-sm zui:py-1 zui:px-2 zui:rounded-md zui:flex zui:justify-between zui:items-center zui:gap-2 zui:flex-wrap",children:[i(n,{size:"sm",fontWeight:500,className:"zui:text-blue-700 zui:mr-4",children:[p.length," of ",h," selected"]}),i("div",{className:"zui:flex zui:flex-row zui:gap-1.5",children:[y.map(function(i){return e(o,{className:"zui:h-8 zui:bg-white zui:text-blue-700 zui:text-xs zui:border-1 zui:border-gray-100",startIcon:i.icon,size:"small",variant:"text",disabled:i.disabled,onClick:function(){return i.onClick(p)},title:i.label,children:i.label},i.id)}),j.length>0&&i(r,{children:[i(o,{size:"small",variant:"text",className:"zui:h-8 zui:bg-white zui:text-blue-500 zui:text-xs zui:border-1 zui:border-gray-100","aria-controls":N?"more-actions-popover":void 0,"aria-haspopup":"true","aria-expanded":N?"true":void 0,onClick:function(i){w(i.currentTarget)},children:["More ",e(c,{className:"zui:w-4 zui:h-4 zui:ml-1"})]}),e(m,{padding:0,minWidth:200,id:"more-actions-popover",open:N,anchorEl:k,onClose:C,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:e(s,{disablePadding:!0,children:j.map(function(r){return i(a,{disabled:r.disabled,onClick:function(){r.onClick(p),C()},className:"danger"===r.variant?"zui:text-red-600":"",divider:!0,children:[r.icon,e(u,{primaryTypographyProps:{variant:"body2",ml:1},primary:r.label})]},r.id)})})})]}),i(l,{size:"small",onClick:f,children:[" ",e(d,{size:18})]})]})]})};export{z as BulkActionsBar,z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("../Button/index.js");require("../../chunks/tslib.es6-a3dc1f53.js");var t=require("@mui/material"),s=require("../../chunks/Text-e9636dd7.js"),n=require("@mui/material/List"),u=require("@mui/material/ListItemText"),l=require("../Popover/index.js"),a=require("../../chunks/lucide-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("../Button/index.js");require("../../chunks/tslib.es6-a3dc1f53.js");var t=require("@mui/material"),s=require("../../chunks/Text-e9636dd7.js"),n=require("@mui/material/List"),u=require("@mui/material/ListItemText"),l=require("../Popover/index.js"),a=require("../../chunks/lucide-937248a9.js"),o=function(o){var c=o.selectedRows,d=o.totalRows,z=o.bulkActions,x=o.clearSelection,m=o.maxVisibleActions,h=void 0===m?3:m,b=i.useState(null),p=b[0],g=b[1],j=z.slice(0,h),v=z.slice(h),f=function(){g(null)},k=Boolean(p);return 0===c.length?null:e.jsxs("div",{className:"zui:bg-blue-100 zui:border zui:border-blue-200 zui:shadow-sm zui:py-1 zui:px-2 zui:rounded-md zui:flex zui:justify-between zui:items-center zui:gap-2 zui:flex-wrap",children:[e.jsxs(s.Text,{size:"sm",fontWeight:500,className:"zui:text-blue-700 zui:mr-4",children:[c.length," of ",d," selected"]}),e.jsxs("div",{className:"zui:flex zui:flex-row zui:gap-1.5",children:[j.map(function(i){return e.jsx(r.Button,{className:"zui:h-8 zui:bg-white zui:text-blue-700 zui:text-xs zui:border-1 zui:border-gray-100",startIcon:i.icon,size:"small",variant:"text",disabled:i.disabled,onClick:function(){return i.onClick(c)},title:i.label,children:i.label},i.id)}),v.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs(r.Button,{size:"small",variant:"text",className:"zui:h-8 zui:bg-white zui:text-blue-500 zui:text-xs zui:border-1 zui:border-gray-100","aria-controls":k?"more-actions-popover":void 0,"aria-haspopup":"true","aria-expanded":k?"true":void 0,onClick:function(e){g(e.currentTarget)},children:["More ",e.jsx(a.ChevronDown,{className:"zui:w-4 zui:h-4 zui:ml-1"})]}),e.jsx(l.Popover,{padding:0,minWidth:200,id:"more-actions-popover",open:k,anchorEl:p,onClose:f,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:e.jsx(n,{disablePadding:!0,children:v.map(function(i){return e.jsxs(t.ListItemButton,{disabled:i.disabled,onClick:function(){i.onClick(c),f()},className:"danger"===i.variant?"zui:text-red-600":"",divider:!0,children:[i.icon,e.jsx(u,{primaryTypographyProps:{variant:"body2",ml:1},primary:i.label})]},i.id)})})})]}),e.jsxs(t.IconButton,{size:"small",onClick:x,children:[" ",e.jsx(a.X,{size:18})]})]})]})};exports.BulkActionsBar=o,exports.default=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as i}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsxs as r,jsx as t}from"react/jsx-runtime";import*as u from"react";import{a as s}from"../../chunks/index-32c3a4e2.esm.js";import{M as n,d as a}from"../../chunks/lucide-
|
|
1
|
+
import{_ as e,a as i}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsxs as r,jsx as t}from"react/jsx-runtime";import*as u from"react";import{a as s}from"../../chunks/index-32c3a4e2.esm.js";import{M as n,d as a}from"../../chunks/lucide-1d5a9cda.esm.js";var l={sm:"zui:h-4 zui:w-4",md:"zui:h-5 zui:w-5",lg:"zui:h-6 zui:w-6"},c=u.forwardRef(function(c,z){var o=c.className,d=c.label,m=c.description,f=c.size,h=void 0===f?"md":f,p=c.disabled,b=c.indeterminate,x=c.error,k=e(c,["className","label","description","size","disabled","indeterminate","error"]),w=u.useRef(null);return u.useEffect(function(){w.current&&(w.current.indeterminate=!!b)},[b]),r("label",{className:s("zui:inline-flex zui:items-start zui:gap-2 zui:cursor-pointer",p&&"zui:opacity-60 zui:cursor-not-allowed",o),children:[r("span",{className:s("zui:relative zui:inline-flex zui:items-center zui:justify-center zui:rounded-sm zui:border zui:border-slate-300 zui:bg-white zui:transition-colors zui:shrink-0",l[h],{"zui:border-red-500":x,"zui:bg-slate-200":p,"zui:border-blue-600":(k.checked||b)&&!x,"zui:bg-blue-600":(k.checked||b)&&!x,"zui:ring-1 zui:ring-offset-1 zui:ring-blue-600":(k.checked||b)&&!p}),children:[t("input",i({type:"checkbox",className:"zui:sr-only",ref:function(e){w.current=e,"function"==typeof z?z(e):z&&(z.current=e)},disabled:p,"aria-invalid":x},k)),b?t(n,{className:"zui:w-3 zui:h-3 zui:text-white zui:pointer-events-none",strokeWidth:3}):k.checked?t(a,{className:"zui:w-4 zui:h-4 zui:text-white zui:pointer-events-none"}):null]}),(d||m)&&r("div",{className:"zui:flex zui:flex-col",children:[d&&t("span",{className:"zui:text-sm zui:text-slate-800 zui:font-medium",children:d}),m&&t("span",{className:s("zui:text-xs zui:text-slate-500",x&&"zui:text-red-500"),children:m})]})]})});export{c as Checkbox,c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),i=require("react/jsx-runtime"),r=require("react"),t=require("../../chunks/index-90b71f01.js"),u=require("../../chunks/lucide-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),i=require("react/jsx-runtime"),r=require("react"),t=require("../../chunks/index-90b71f01.js"),u=require("../../chunks/lucide-937248a9.js");function s(e){var i=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(i,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),i.default=e,Object.freeze(i)}var n=s(r),c={sm:"zui:h-4 zui:w-4",md:"zui:h-5 zui:w-5",lg:"zui:h-6 zui:w-6"},a=n.forwardRef(function(r,s){var a=r.className,l=r.label,z=r.description,o=r.size,d=void 0===o?"md":o,f=r.disabled,x=r.indeterminate,b=r.error,h=e.__rest(r,["className","label","description","size","disabled","indeterminate","error"]),m=n.useRef(null);return n.useEffect(function(){m.current&&(m.current.indeterminate=!!x)},[x]),i.jsxs("label",{className:t.cn("zui:inline-flex zui:items-start zui:gap-2 zui:cursor-pointer",f&&"zui:opacity-60 zui:cursor-not-allowed",a),children:[i.jsxs("span",{className:t.cn("zui:relative zui:inline-flex zui:items-center zui:justify-center zui:rounded-sm zui:border zui:border-slate-300 zui:bg-white zui:transition-colors zui:shrink-0",c[d],{"zui:border-red-500":b,"zui:bg-slate-200":f,"zui:border-blue-600":(h.checked||x)&&!b,"zui:bg-blue-600":(h.checked||x)&&!b,"zui:ring-1 zui:ring-offset-1 zui:ring-blue-600":(h.checked||x)&&!f}),children:[i.jsx("input",e.__assign({type:"checkbox",className:"zui:sr-only",ref:function(e){m.current=e,"function"==typeof s?s(e):s&&(s.current=e)},disabled:f,"aria-invalid":b},h)),x?i.jsx(u.Minus,{className:"zui:w-3 zui:h-3 zui:text-white zui:pointer-events-none",strokeWidth:3}):h.checked?i.jsx(u.Check,{className:"zui:w-4 zui:h-4 zui:text-white zui:pointer-events-none"}):null]}),(l||z)&&i.jsxs("div",{className:"zui:flex zui:flex-col",children:[l&&i.jsx("span",{className:"zui:text-sm zui:text-slate-800 zui:font-medium",children:l}),z&&i.jsx("span",{className:t.cn("zui:text-xs zui:text-slate-500",b&&"zui:text-red-500"),children:z})]})]})});exports.Checkbox=a,exports.default=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsxs as i,jsx as r}from"react/jsx-runtime";import*as a from"react";import{a as l}from"../../chunks/index-32c3a4e2.esm.js";import{Checkbox as u}from"../Checkbox/index.esm.js";import"../../chunks/lucide-
|
|
1
|
+
import{b as e}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsxs as i,jsx as r}from"react/jsx-runtime";import*as a from"react";import{a as l}from"../../chunks/index-32c3a4e2.esm.js";import{Checkbox as u}from"../Checkbox/index.esm.js";import"../../chunks/lucide-1d5a9cda.esm.js";var t=function(t){var s,o=t.name,d=t.label,n=t.description,c=t.error,z=t.options,m=t.value,v=t.defaultValue,b=t.onChange,p=t.direction,h=void 0===p?"vertical":p,x=t.layout,f=void 0===x?"box":x,g=t.disabled,N=void 0!==g&&g,k=t.size,y=void 0===k?"md":k,j=t.className,C=t.columns,w=void 0===C?3:C,S=a.useState(v||[]),V=S[0],q=S[1],A=void 0!==m,B=A?m:V,D=function(i,r){var a=r?e(e([],B,!0),[i],!1):B.filter(function(e){return e!==i});A||q(a),null==b||b(a)};return i("fieldset",{className:l("zui:space-y-2",j),"aria-invalid":c||void 0,children:[(d||n)&&i("div",{className:"zui:mb-2",children:[d&&r("legend",{className:"zui:text-sm zui:font-medium zui:text-slate-800",children:d}),n&&r("p",{className:l("zui:text-xs zui:text-slate-500",c&&"zui:text-red-500"),children:n})]}),r("div",{className:l((s={"zui:space-y-2":"list"===f&&"vertical"===h,"zui:flex zui:flex-wrap zui:gap-4":"list"===f&&"horizontal"===h,"zui:grid zui:gap-4":"box"===f},s["zui:grid-cols-".concat(w)]="box"===f&&"horizontal"===h,s["zui:grid-cols-1"]="box"===f&&"vertical"===h,s),j),children:z.map(function(e){var a=B.includes(e.value),t=r(u,{name:o,size:y,label:"list"===f?e.label:void 0,description:"list"===f?e.description:void 0,value:e.value,checked:a,onChange:function(i){return D(e.value,i.target.checked)},disabled:N||e.disabled,error:c});return"box"===f?i("label",{className:l("group zui:relative zui:flex zui:cursor-pointer zui:rounded-sm zui:border zui:border-gray-200 zui:bg-neutral-100 zui:p-2.5 zui:transition-all",{"zui:border-blue-600 zui:ring-1 zui:ring-blue-500 zui:bg-blue-50":a,"zui:hover:border-gray-400":!N,"zui:opacity-50 zui:cursor-not-allowed":N||e.disabled,"zui:border-red-500":c}),children:[r(u,{name:o,size:y,value:e.value,checked:a,onChange:function(i){return D(e.value,i.target.checked)},disabled:N||e.disabled,error:c,className:"zui:absolute zui:top-3 zui:right-3"}),i("div",{children:[r("p",{className:"zui:text-sm zui:font-medium zui:text-slate-800",children:e.label}),e.description&&r("p",{className:"zui:text-xs zui:text-slate-500",children:e.description})]})]},e.value):r("div",{children:t},e.value)})})]})};export{t as CheckboxGroup,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),i=require("react/jsx-runtime"),r=require("react"),u=require("../../chunks/index-90b71f01.js"),t=require("../Checkbox/index.js");function a(e){var i=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var u=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(i,r,u.get?u:{enumerable:!0,get:function(){return e[r]}})}}),i.default=e,Object.freeze(i)}require("../../chunks/lucide-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),i=require("react/jsx-runtime"),r=require("react"),u=require("../../chunks/index-90b71f01.js"),t=require("../Checkbox/index.js");function a(e){var i=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var u=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(i,r,u.get?u:{enumerable:!0,get:function(){return e[r]}})}}),i.default=e,Object.freeze(i)}require("../../chunks/lucide-937248a9.js");var s=a(r),l=function(r){var a,l=r.name,n=r.label,c=r.description,o=r.error,d=r.options,z=r.value,x=r.defaultValue,b=r.onChange,v=r.direction,p=void 0===v?"vertical":v,h=r.layout,m=void 0===h?"box":h,f=r.disabled,j=void 0!==f&&f,g=r.size,k=void 0===g?"md":g,y=r.className,N=r.columns,C=void 0===N?3:N,O=s.useState(x||[]),q=O[0],_=O[1],w=void 0!==z,P=w?z:q,A=function(i,r){var u=r?e.__spreadArray(e.__spreadArray([],P,!0),[i],!1):P.filter(function(e){return e!==i});w||_(u),null==b||b(u)};return i.jsxs("fieldset",{className:u.cn("zui:space-y-2",y),"aria-invalid":o||void 0,children:[(n||c)&&i.jsxs("div",{className:"zui:mb-2",children:[n&&i.jsx("legend",{className:"zui:text-sm zui:font-medium zui:text-slate-800",children:n}),c&&i.jsx("p",{className:u.cn("zui:text-xs zui:text-slate-500",o&&"zui:text-red-500"),children:c})]}),i.jsx("div",{className:u.cn((a={"zui:space-y-2":"list"===m&&"vertical"===p,"zui:flex zui:flex-wrap zui:gap-4":"list"===m&&"horizontal"===p,"zui:grid zui:gap-4":"box"===m},a["zui:grid-cols-".concat(C)]="box"===m&&"horizontal"===p,a["zui:grid-cols-1"]="box"===m&&"vertical"===p,a),y),children:d.map(function(e){var r=P.includes(e.value),a=i.jsx(t.Checkbox,{name:l,size:k,label:"list"===m?e.label:void 0,description:"list"===m?e.description:void 0,value:e.value,checked:r,onChange:function(i){return A(e.value,i.target.checked)},disabled:j||e.disabled,error:o});return"box"===m?i.jsxs("label",{className:u.cn("group zui:relative zui:flex zui:cursor-pointer zui:rounded-sm zui:border zui:border-gray-200 zui:bg-neutral-100 zui:p-2.5 zui:transition-all",{"zui:border-blue-600 zui:ring-1 zui:ring-blue-500 zui:bg-blue-50":r,"zui:hover:border-gray-400":!j,"zui:opacity-50 zui:cursor-not-allowed":j||e.disabled,"zui:border-red-500":o}),children:[i.jsx(t.Checkbox,{name:l,size:k,value:e.value,checked:r,onChange:function(i){return A(e.value,i.target.checked)},disabled:j||e.disabled,error:o,className:"zui:absolute zui:top-3 zui:right-3"}),i.jsxs("div",{children:[i.jsx("p",{className:"zui:text-sm zui:font-medium zui:text-slate-800",children:e.label}),e.description&&i.jsx("p",{className:"zui:text-xs zui:text-slate-500",children:e.description})]})]},e.value):i.jsx("div",{children:a},e.value)})})]})};exports.CheckboxGroup=l,exports.default=l;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as e,a as t}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsx as n,jsxs as l}from"react/jsx-runtime";import*as o from"react";import i from"react";import{Checkbox as r}from"../Checkbox/index.esm.js";import{A as a,V as u}from"../../chunks/react-virtualized-auto-sizer.esm-8105695c.esm.js";import{n as s,c as g,o as d,p as c,C as p,a as f,q as m}from"../../chunks/lucide-
|
|
1
|
+
import{b as e,a as t}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsx as n,jsxs as l}from"react/jsx-runtime";import*as o from"react";import i from"react";import{Checkbox as r}from"../Checkbox/index.esm.js";import{A as a,V as u}from"../../chunks/react-virtualized-auto-sizer.esm-8105695c.esm.js";import{n as s,c as g,o as d,p as c,C as p,a as f,q as m}from"../../chunks/lucide-1d5a9cda.esm.js";import"../../chunks/index-32c3a4e2.esm.js";import"../../chunks/assertThisInitialized-63d8ff5f.esm.js";
|
|
2
2
|
/**
|
|
3
3
|
* table-core
|
|
4
4
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),t=require("react/jsx-runtime"),n=require("react"),l=require("../Checkbox/index.js"),o=require("../../chunks/react-virtualized-auto-sizer.esm-8e1756a5.js"),i=require("../../chunks/lucide-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),t=require("react/jsx-runtime"),n=require("react"),l=require("../Checkbox/index.js"),o=require("../../chunks/react-virtualized-auto-sizer.esm-8e1756a5.js"),i=require("../../chunks/lucide-937248a9.js");function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var l=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}require("../../chunks/index-90b71f01.js"),require("../../chunks/assertThisInitialized-d31798d4.js");var a=r(n);
|
|
2
2
|
/**
|
|
3
3
|
* table-core
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e}from"react/jsx-runtime";import*as t from"react";import{i as u,f as r,C as n}from"../../chunks/Calender-
|
|
1
|
+
import{jsxs as i,jsx as e}from"react/jsx-runtime";import*as t from"react";import{i as u,f as r,C as n}from"../../chunks/Calender-811137b7.esm.js";import{u as o,a}from"../../chunks/index-32c3a4e2.esm.js";import{Popover as s}from"../Popover/index.esm.js";import{X as l,h as c}from"../../chunks/lucide-1d5a9cda.esm.js";import"../../chunks/typeof-cc63ab7d.esm.js";import"../../chunks/tslib.es6-4974c96c.esm.js";import"../Button/index.esm.js";import"@mui/material";var z={xs:"zui:h-8 zui:px-3 zui:text-xs",sm:"zui:h-9 zui:px-3 zui:text-sm",md:"zui:h-10 zui:px-3 zui:text-sm",lg:"zui:h-11 zui:px-3 zui:text-base"},d=function(i){if("boolean"==typeof i)return i;if(i instanceof Date)return!!u(i)&&i;if(Array.isArray(i))return i.filter(function(i){return i instanceof Date&&u(i)});if("object"==typeof i&&null!==i){var e={};return"from"in i&&u(i.from)&&(e.from=i.from),"to"in i&&u(i.to)&&(e.to=i.to),"before"in i&&u(i.before)&&(e.before=i.before),"after"in i&&u(i.after)&&(e.after=i.after),"dayOfWeek"in i&&(e.dayOfWeek=i.dayOfWeek),Object.keys(e).length>0&&e}return!1},m=function(m){var f=m.label,p=m.value,b=m.onChange,h=m.placeholder,x=void 0===h?"Pick a date":h,g=m.required,v=m.description,y=m.error,k=m.disabled,N=m.variant,j=void 0===N?"outlined":N,w=m.size,C=void 0===w?"md":w,O=m.className,P=m.disableRange,W=void 0!==P&&P,A=m.floatingLabel,B=void 0!==A&&A,D=m.isClerable,F=void 0===D||D,M=function(i){return{container:i?"zui:opacity-80":"",label:i?"zui:text-gray-500":"zui:text-gray-700",input:i?" zui:cursor-not-allowed zui:opacity-60 zui:text-gray-500 zui:bg-gray-50 zui:border zui:border-gray-300":""}}(k||!1),S=o("date"),q=t.useState(null),E=q[0],L=q[1],R=t.useMemo(function(){return!(!p||!u(p))&&r(p,"PPP")},[p]),T=function(){L(null)};return i("div",{className:a("zui:w-full zui:space-y-1",M.container,O),children:[!B&&f&&i("label",{htmlFor:S,className:a("zui:block zui:mb-2 zui:text-sm zui:font-medium zui:leading-none",M.label),children:[f,g&&e("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]}),i("div",{className:a("zui:relative zui:flex zui:items-center zui:justify-between zui:rounded-sm zui:border zui:text-sm zui:ring-offset-background zui:transition-colors","focus-within:zui:ring-1 focus-within:zui:ring-ring focus-within:zui:ring-offset-1","outlined"===j&&"zui:bg-background zui:border-input","contained"===j&&"zui:bg-muted zui:border-transparent",(y||!R&&p)&&"zui:border-destructive focus-within:zui:ring-destructive",z[C],M.input,O),onClick:function(i){return!k&&void L(i.currentTarget)},children:[e("div",{className:"zui:truncate",children:R||x}),i("div",{className:"zui:flex zui:flex-row zui:gap-0.5",children:[F&&R&&!k?e(l,{onClick:function(i){i.stopPropagation(),null==b||b(void 0),T()},className:"zui:ml-2 zui:h-4 zui:w-4 zui:opacity-50 zui:cursor-pointer zui:rounded-full zui:hover:bg-gray-100"}):null,e(c,{className:"zui:ml-2 zui:h-4 zui:w-4 zui:opacity-50"})]}),B&&f&&i("label",{htmlFor:S,className:a("zui:pointer-events-none zui:absolute zui:left-3 zui:-top-[9px] zui:z-10 zui:bg-background zui:px-1 zui:text-xs zui:text-muted-foreground zui:transition-all",M.label),children:[f,g&&e("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]})]}),e(s,{open:Boolean(E),onClose:T,anchorEl:E,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:e(n,{id:S,mode:"single",selected:p,defaultMonth:p,onSelect:function(i){null==b||b(null!=i?i:void 0),T()},disabled:d(W)})}),v&&!y&&e("p",{className:"zui:text-xs zui:text-muted-foreground",children:v}),y&&e("p",{className:"zui:text-xs zui:text-destructive",children:y})]})};export{m as DatePicker,m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),t=require("../../chunks/Calender-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),t=require("../../chunks/Calender-fd591944.js"),r=require("../../chunks/index-90b71f01.js"),u=require("../Popover/index.js"),n=require("../../chunks/lucide-937248a9.js");function a(e){var i=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}}),i.default=e,Object.freeze(i)}require("../../chunks/typeof-b30b964a.js"),require("../../chunks/tslib.es6-a3dc1f53.js"),require("../Button/index.js"),require("@mui/material");var o=a(i),s={xs:"zui:h-8 zui:px-3 zui:text-xs",sm:"zui:h-9 zui:px-3 zui:text-sm",md:"zui:h-10 zui:px-3 zui:text-sm",lg:"zui:h-11 zui:px-3 zui:text-base"},l=function(e){if("boolean"==typeof e)return e;if(e instanceof Date)return!!t.isValid(e)&&e;if(Array.isArray(e))return e.filter(function(e){return e instanceof Date&&t.isValid(e)});if("object"==typeof e&&null!==e){var i={};return"from"in e&&t.isValid(e.from)&&(i.from=e.from),"to"in e&&t.isValid(e.to)&&(i.to=e.to),"before"in e&&t.isValid(e.before)&&(i.before=e.before),"after"in e&&t.isValid(e.after)&&(i.after=e.after),"dayOfWeek"in e&&(i.dayOfWeek=e.dayOfWeek),Object.keys(i).length>0&&i}return!1},c=function(i){var a=i.label,c=i.value,d=i.onChange,z=i.placeholder,f=void 0===z?"Pick a date":z,x=i.required,m=i.description,b=i.error,p=i.disabled,h=i.variant,g=void 0===h?"outlined":h,v=i.size,j=void 0===v?"md":v,y=i.className,k=i.disableRange,N=void 0!==k&&k,O=i.floatingLabel,q=void 0!==O&&O,w=i.isClerable,P=void 0===w||w,C=function(e){return{container:e?"zui:opacity-80":"",label:e?"zui:text-gray-500":"zui:text-gray-700",input:e?" zui:cursor-not-allowed zui:opacity-60 zui:text-gray-500 zui:bg-gray-50 zui:border zui:border-gray-300":""}}(p||!1),V=r.useStableId("date"),D=o.useState(null),M=D[0],S=D[1],W=o.useMemo(function(){return!(!c||!t.isValid(c))&&t.format(c,"PPP")},[c]),A=function(){S(null)};return e.jsxs("div",{className:r.cn("zui:w-full zui:space-y-1",C.container,y),children:[!q&&a&&e.jsxs("label",{htmlFor:V,className:r.cn("zui:block zui:mb-2 zui:text-sm zui:font-medium zui:leading-none",C.label),children:[a,x&&e.jsx("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]}),e.jsxs("div",{className:r.cn("zui:relative zui:flex zui:items-center zui:justify-between zui:rounded-sm zui:border zui:text-sm zui:ring-offset-background zui:transition-colors","focus-within:zui:ring-1 focus-within:zui:ring-ring focus-within:zui:ring-offset-1","outlined"===g&&"zui:bg-background zui:border-input","contained"===g&&"zui:bg-muted zui:border-transparent",(b||!W&&c)&&"zui:border-destructive focus-within:zui:ring-destructive",s[j],C.input,y),onClick:function(e){return!p&&void S(e.currentTarget)},children:[e.jsx("div",{className:"zui:truncate",children:W||f}),e.jsxs("div",{className:"zui:flex zui:flex-row zui:gap-0.5",children:[P&&W&&!p?e.jsx(n.X,{onClick:function(e){e.stopPropagation(),null==d||d(void 0),A()},className:"zui:ml-2 zui:h-4 zui:w-4 zui:opacity-50 zui:cursor-pointer zui:rounded-full zui:hover:bg-gray-100"}):null,e.jsx(n.Calendar,{className:"zui:ml-2 zui:h-4 zui:w-4 zui:opacity-50"})]}),q&&a&&e.jsxs("label",{htmlFor:V,className:r.cn("zui:pointer-events-none zui:absolute zui:left-3 zui:-top-[9px] zui:z-10 zui:bg-background zui:px-1 zui:text-xs zui:text-muted-foreground zui:transition-all",C.label),children:[a,x&&e.jsx("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]})]}),e.jsx(u.Popover,{open:Boolean(M),onClose:A,anchorEl:M,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:e.jsx(t.Calendar,{id:V,mode:"single",selected:c,defaultMonth:c,onSelect:function(e){null==d||d(null!=e?e:void 0),A()},disabled:l(N)})}),m&&!b&&e.jsx("p",{className:"zui:text-xs zui:text-muted-foreground",children:m}),b&&e.jsx("p",{className:"zui:text-xs zui:text-destructive",children:b})]})};exports.DatePicker=c,exports.default=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e,Fragment as o}from"react/jsx-runtime";import*as t from"react";import{f as u,C as r,i as n}from"../../chunks/Calender-
|
|
1
|
+
import{jsxs as i,jsx as e,Fragment as o}from"react/jsx-runtime";import*as t from"react";import{f as u,C as r,i as n}from"../../chunks/Calender-811137b7.esm.js";import{u as l,a}from"../../chunks/index-32c3a4e2.esm.js";import{Popover as s}from"../Popover/index.esm.js";import{h as d}from"../../chunks/lucide-1d5a9cda.esm.js";import"../../chunks/typeof-cc63ab7d.esm.js";import"../../chunks/tslib.es6-4974c96c.esm.js";import"../Button/index.esm.js";import"@mui/material";var m={xs:"zui:h-9 zui:px-3 zui:text-xs",sm:"zui:h-9 zui:px-3 zui:text-sm",md:"zui:h-10 zui:px-3 zui:text-sm",lg:"zui:h-11 zui:px-3 zui:text-base"},c=function(i){return!!i&&n(i)},z=function(z){var f=z.label,v=z.value,p=z.onChange,h=z.placeholder,x=void 0===h?"Pick a date":h,b=z.required,g=z.description,y=z.error,N=z.disabled,k=z.variant,L=void 0===k?"outlined":k,j=z.size,w=void 0===j?"md":j,C=z.className,F=z.floatingLabel,O=void 0!==F&&F,P=z.isClearable,S=void 0!==P&&P,B=function(i){return{container:i?"zui:opacity-80":"",label:i?"zui:text-gray-500":"zui:text-gray-700",input:i?" zui:cursor-not-allowed zui:opacity-60 zui:text-gray-500 zui:bg-gray-50 zui:border zui:border-gray-300":""}}(N||!1),E=l("date-range"),M=t.useState({from:c(null==v?void 0:v.from)?null==v?void 0:v.from:void 0,to:c(null==v?void 0:v.to)?null==v?void 0:v.to:void 0}),q=M[0],T=M[1];t.useEffect(function(){T({from:c(null==v?void 0:v.from)?null==v?void 0:v.from:void 0,to:c(null==v?void 0:v.to)?null==v?void 0:v.to:void 0})},[v]);var A=t.useState(null),D=A[0],G=A[1];return i("div",{className:a("zui:w-full zui:space-y-1",B.container,C),children:[!O&&f&&i("label",{htmlFor:E,className:a("zui:block zui:mb-2 zui:text-sm zui:font-medium zui:leading-none",B.label),children:[f,b&&e("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]}),i("div",{className:a("zui:relative zui:flex zui:items-center zui:justify-between zui:rounded-sm zui:border zui:text-sm zui:ring-offset-background zui:transition-colors","focus-within:zui:ring-1 focus-within:zui:ring-ring focus-within:zui:ring-offset-1","outlined"===L&&"zui:bg-background zui:border-input","contained"===L&&"zui:bg-muted zui:border-transparent",y&&"zui:border-destructive focus-within:zui:ring-destructive",m[w],B.input,C),onClick:function(i){return!N&&void G(i.currentTarget)},children:[e("div",{className:"zui:truncate",children:c(null==q?void 0:q.from)?c(null==q?void 0:q.to)?i(o,{children:[u(q.from,"LLL dd, y")," -"," ",u(q.to,"LLL dd, y")]}):u(q.from,"LLL dd, y"):x}),i("div",{className:"zui:flex zui:items-center zui:ml-2",children:[(c(null==q?void 0:q.from)||c(null==q?void 0:q.to))&&S&&e("button",{type:"button",className:"zui:p-1 zui:rounded-full hover:zui:bg-gray-200 zui:text-gray-500",onClick:function(i){i.stopPropagation(),T({from:void 0,to:void 0}),null==p||p(void 0)},children:"✕"}),e(d,{className:"zui:ml-2 zui:h-4 zui:w-4 zui:opacity-50"})]}),O&&f&&i("label",{htmlFor:E,className:a("zui:pointer-events-none zui:absolute zui:left-3 zui:-top-[9px] zui:z-10 zui:bg-background zui:px-1 zui:text-xs zui:text-muted-foreground zui:transition-all",B.label),children:[f,b&&e("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]})]}),e(s,{open:Boolean(D),onClose:function(){G(null)},anchorEl:D,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:e(r,{id:E,autoFocus:!0,mode:"range",defaultMonth:null==q?void 0:q.from,selected:q,onSelect:function(i){var e;(null==i?void 0:i.from)&&n(i.from)?(T(i),i.to&&n(i.to)?null==p||p({from:i.from,to:i.to}):null==p||p({from:i.from,to:null!==(e=i.to)&&void 0!==e?e:i.from})):(T(void 0),null==p||p(void 0))},numberOfMonths:2})}),g&&!y&&e("p",{className:"zui:text-xs zui:text-muted-foreground",children:g}),y&&e("p",{className:"zui:text-xs zui:text-destructive",children:y})]})};export{z as DateRangePicker,z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),t=require("../../chunks/Calender-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),t=require("../../chunks/Calender-fd591944.js"),u=require("../../chunks/index-90b71f01.js"),r=require("../Popover/index.js"),o=require("../../chunks/lucide-937248a9.js");function n(e){var i=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var u=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,u.get?u:{enumerable:!0,get:function(){return e[t]}})}}),i.default=e,Object.freeze(i)}require("../../chunks/typeof-b30b964a.js"),require("../../chunks/tslib.es6-a3dc1f53.js"),require("../Button/index.js"),require("@mui/material");var l=n(i),a={xs:"zui:h-9 zui:px-3 zui:text-xs",sm:"zui:h-9 zui:px-3 zui:text-sm",md:"zui:h-10 zui:px-3 zui:text-sm",lg:"zui:h-11 zui:px-3 zui:text-base"},s=function(e){return!!e&&t.isValid(e)},d=function(i){var n=i.label,d=i.value,c=i.onChange,z=i.placeholder,f=void 0===z?"Pick a date":z,m=i.required,v=i.description,x=i.error,b=i.disabled,h=i.variant,g=void 0===h?"outlined":h,p=i.size,j=void 0===p?"md":p,y=i.className,k=i.floatingLabel,N=void 0!==k&&k,q=i.isClearable,L=void 0!==q&&q,O=function(e){return{container:e?"zui:opacity-80":"",label:e?"zui:text-gray-500":"zui:text-gray-700",input:e?" zui:cursor-not-allowed zui:opacity-60 zui:text-gray-500 zui:bg-gray-50 zui:border zui:border-gray-300":""}}(b||!1),w=u.useStableId("date-range"),C=l.useState({from:s(null==d?void 0:d.from)?null==d?void 0:d.from:void 0,to:s(null==d?void 0:d.to)?null==d?void 0:d.to:void 0}),P=C[0],F=C[1];l.useEffect(function(){F({from:s(null==d?void 0:d.from)?null==d?void 0:d.from:void 0,to:s(null==d?void 0:d.to)?null==d?void 0:d.to:void 0})},[d]);var S=l.useState(null),E=S[0],M=S[1];return e.jsxs("div",{className:u.cn("zui:w-full zui:space-y-1",O.container,y),children:[!N&&n&&e.jsxs("label",{htmlFor:w,className:u.cn("zui:block zui:mb-2 zui:text-sm zui:font-medium zui:leading-none",O.label),children:[n,m&&e.jsx("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]}),e.jsxs("div",{className:u.cn("zui:relative zui:flex zui:items-center zui:justify-between zui:rounded-sm zui:border zui:text-sm zui:ring-offset-background zui:transition-colors","focus-within:zui:ring-1 focus-within:zui:ring-ring focus-within:zui:ring-offset-1","outlined"===g&&"zui:bg-background zui:border-input","contained"===g&&"zui:bg-muted zui:border-transparent",x&&"zui:border-destructive focus-within:zui:ring-destructive",a[j],O.input,y),onClick:function(e){return!b&&void M(e.currentTarget)},children:[e.jsx("div",{className:"zui:truncate",children:s(null==P?void 0:P.from)?s(null==P?void 0:P.to)?e.jsxs(e.Fragment,{children:[t.format(P.from,"LLL dd, y")," -"," ",t.format(P.to,"LLL dd, y")]}):t.format(P.from,"LLL dd, y"):f}),e.jsxs("div",{className:"zui:flex zui:items-center zui:ml-2",children:[(s(null==P?void 0:P.from)||s(null==P?void 0:P.to))&&L&&e.jsx("button",{type:"button",className:"zui:p-1 zui:rounded-full hover:zui:bg-gray-200 zui:text-gray-500",onClick:function(e){e.stopPropagation(),F({from:void 0,to:void 0}),null==c||c(void 0)},children:"✕"}),e.jsx(o.Calendar,{className:"zui:ml-2 zui:h-4 zui:w-4 zui:opacity-50"})]}),N&&n&&e.jsxs("label",{htmlFor:w,className:u.cn("zui:pointer-events-none zui:absolute zui:left-3 zui:-top-[9px] zui:z-10 zui:bg-background zui:px-1 zui:text-xs zui:text-muted-foreground zui:transition-all",O.label),children:[n,m&&e.jsx("span",{className:"zui:text-destructive zui:font-medium",children:" *"})]})]}),e.jsx(r.Popover,{open:Boolean(E),onClose:function(){M(null)},anchorEl:E,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:e.jsx(t.Calendar,{id:w,autoFocus:!0,mode:"range",defaultMonth:null==P?void 0:P.from,selected:P,onSelect:function(e){var i;(null==e?void 0:e.from)&&t.isValid(e.from)?(F(e),e.to&&t.isValid(e.to)?null==c||c({from:e.from,to:e.to}):null==c||c({from:e.from,to:null!==(i=e.to)&&void 0!==i?i:e.from})):(F(void 0),null==c||c(void 0))},numberOfMonths:2})}),v&&!x&&e.jsx("p",{className:"zui:text-xs zui:text-muted-foreground",children:v}),x&&e.jsx("p",{className:"zui:text-xs zui:text-destructive",children:x})]})};exports.DateRangePicker=d,exports.default=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsxs as r,jsx as t}from"react/jsx-runtime";import*as n from"react";import a from"react";import{a as i}from"../../chunks/index-32c3a4e2.esm.js";import{Input as s}from"../Input/index.esm.js";import{Select as o}from"../Select/index.esm.js";import{DatePicker as l}from"../DatePicker/index.esm.js";import{DateRangePicker as u}from"../DateRangePicker/index.esm.js";import c from"../Switch/index.esm.js";import{RadioGroup as d}from"../RadioGroup/index.esm.js";import{Button as m}from"../Button/index.esm.js";import{TimePicker as f}from"../TimePicker/index.esm.js";import{Checkbox as p}from"../Checkbox/index.esm.js";import"../../chunks/lucide-
|
|
1
|
+
import{a as e}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsxs as r,jsx as t}from"react/jsx-runtime";import*as n from"react";import a from"react";import{a as i}from"../../chunks/index-32c3a4e2.esm.js";import{Input as s}from"../Input/index.esm.js";import{Select as o}from"../Select/index.esm.js";import{DatePicker as l}from"../DatePicker/index.esm.js";import{DateRangePicker as u}from"../DateRangePicker/index.esm.js";import c from"../Switch/index.esm.js";import{RadioGroup as d}from"../RadioGroup/index.esm.js";import{Button as m}from"../Button/index.esm.js";import{TimePicker as f}from"../TimePicker/index.esm.js";import{Checkbox as p}from"../Checkbox/index.esm.js";import"../../chunks/lucide-1d5a9cda.esm.js";import"../../chunks/typeof-cc63ab7d.esm.js";import"../../chunks/assertThisInitialized-63d8ff5f.esm.js";import"@emotion/react";import"react-dom";import"../../chunks/Calender-811137b7.esm.js";import"../Popover/index.esm.js";import"@mui/material";import"@mui/material/Popover";import"../../chunks/_commonjsHelpers-02d3be64.esm.js";var v=e=>null==e;var h=e=>!v(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e=>e instanceof Date)(e),b=e=>h(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,y="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function g(e){let r;const t=Array.isArray(e),n="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)r=new Date(e);else{if(y&&(e instanceof Blob||n)||!t&&!h(e))return e;if(r=t?[]:{},t||(e=>{const r=e.constructor&&e.constructor.prototype;return h(r)&&r.hasOwnProperty("isPrototypeOf")})(e))for(const t in e)e.hasOwnProperty(t)&&(r[t]=g(e[t]));else r=e}return r}var x=e=>/^\w*$/.test(e),_=e=>void 0===e,z=e=>{return r=e.replace(/["|']|\]/g,"").split(/\.|\[/),Array.isArray(r)?r.filter(Boolean):[];var r},V=(e,r,t)=>{if(!r||!h(e))return t;const n=(x(r)?[r]:z(r)).reduce((e,r)=>v(e)?e:e[r],e);return _(n)||n===e?_(e[r])?t:e[r]:n},j=e=>"boolean"==typeof e,k=(e,r,t)=>{let n=-1;const a=x(r)?[r]:z(r),i=a.length,s=i-1;for(;++n<i;){const r=a[n];let i=t;if(n!==s){const t=e[r];i=h(t)||Array.isArray(t)?t:isNaN(+a[n+1])?{}:[]}if("__proto__"===r||"constructor"===r||"prototype"===r)return;e[r]=i,e=e[r]}};const N="blur",S="change",w="all",C=a.createContext(null);C.displayName="HookFormContext";const F=()=>a.useContext(C);const P="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function A(e){const r=F(),{control:t=r.control,disabled:n,name:i,exact:s}=e||{},[o,l]=a.useState(t._formState),u=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return P(()=>t._subscribe({name:i,formState:u.current,exact:s,callback:e=>{!n&&l({...t._formState,...e})}}),[i,n,s]),a.useEffect(()=>{u.current.isValid&&t._setValid(!0)},[t]),a.useMemo(()=>((e,r,t,n=!0)=>{const a={defaultValues:r._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const a=i;return r._proxyFormState[a]!==w&&(r._proxyFormState[a]=!n||w),t&&(t[a]=!0),e[a]}});return a})(o,t,u.current,!1),[o,t])}function D(e){const r=F(),{control:t=r.control,name:n,defaultValue:i,disabled:s,exact:o}=e||{},l=a.useRef(i),[u,c]=a.useState(t._getWatch(n,l.current));return P(()=>t._subscribe({name:n,formState:{values:!0},exact:o,callback:e=>!s&&c(((e,r,t,n,a)=>"string"==typeof e?(n&&r.watch.add(e),V(t,e,a)):Array.isArray(e)?e.map(e=>(n&&r.watch.add(e),V(t,e))):(n&&(r.watchAll=!0),t))(n,t._names,e.values||t._formValues,!1,l.current))}),[n,t,s,o]),a.useEffect(()=>t._removeUnmounted()),u}const E=e=>e.render(function(e){const r=F(),{name:t,disabled:n,control:i=r.control,shouldUnregister:s}=e,o=((e,r)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(r)))(i._names.array,t),l=D({control:i,name:t,defaultValue:V(i._formValues,t,V(i._defaultValues,t,e.defaultValue)),exact:!0}),u=A({control:i,name:t,exact:!0}),c=a.useRef(e),d=a.useRef(i.register(t,{...e.rules,value:l,...j(e.disabled)?{disabled:e.disabled}:{}})),m=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!V(u.errors,t)},isDirty:{enumerable:!0,get:()=>!!V(u.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!V(u.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!V(u.validatingFields,t)},error:{enumerable:!0,get:()=>V(u.errors,t)}}),[u,t]),f=a.useCallback(e=>d.current.onChange({target:{value:b(e),name:t},type:S}),[t]),p=a.useCallback(()=>d.current.onBlur({target:{value:V(i._formValues,t),name:t},type:N}),[t,i._formValues]),v=a.useCallback(e=>{const r=V(i._fields,t);r&&e&&(r._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:r=>e.setCustomValidity(r),reportValidity:()=>e.reportValidity()})},[i._fields,t]),h=a.useMemo(()=>({name:t,value:l,...j(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:f,onBlur:p,ref:v}),[t,n,u.disabled,f,p,v,l]);return a.useEffect(()=>{const e=i._options.shouldUnregister||s;i.register(t,{...c.current.rules,...j(c.current.disabled)?{disabled:c.current.disabled}:{}});const r=(e,r)=>{const t=V(i._fields,e);t&&t._f&&(t._f.mount=r)};if(r(t,!0),e){const e=g(V(i._options.defaultValues,t));k(i._defaultValues,t,e),_(V(i._formValues,t))&&k(i._formValues,t,e)}return!o&&i.register(t),()=>{(o?e&&!i._state.action:e)?i.unregister(t):r(t,!1)}},[t,i,o,s]),a.useEffect(()=>{i._setDisabledField({disabled:n,name:t})},[n,t,i]),a.useMemo(()=>({field:h,formState:u,fieldState:m}),[h,u,m])}(e));var M=function(n){var a=n.schema,v=n.form,h=n.layout,b=void 0===h?"vertical":h,y=n.columns,g=void 0===y?2:y,x=n.className,_=n.showSubmitButton,z=void 0!==_&&_,V=n.onSubmit,j=v.control,k=v.handleSubmit,N=v.watch,S=v.formState.errors,w=N(),C="grid"===b?"zui:grid zui:grid-cols-12 zui:gap-3 zui:items-baseline":"zui:flex zui:flex-col zui:gap-3";return r("form",{onSubmit:V?k(V):void 0,className:i(C,x),children:[a.map(function(n){var a,m=n.name,v=n.label,h=n.type,y=n.placeholder,x=n.required,_=n.options,z=n.component,V=n.colSpan,k=n.inputProps,N=n.controllerProps;if(!(!n.visibleIf||n.visibleIf(w)))return null;var C=null!=V?V:Math.floor(12/g),F="grid"===b?{1:"zui:col-span-1",2:"zui:col-span-2",3:"zui:col-span-3",4:"zui:col-span-4",5:"zui:col-span-5",6:"zui:col-span-6",7:"zui:col-span-7",8:"zui:col-span-8",9:"zui:col-span-9",10:"zui:col-span-10",11:"zui:col-span-11",12:"zui:col-span-12"}[C]:void 0,P={label:v,placeholder:y,required:x,options:_},A=e({required:null!=x?x:null===(a=n.validation)||void 0===a?void 0:a.required},n.validation),D=null!=k?k:{},M=null!=N?N:{},B=function(){var e;return(null==S?void 0:S[m])?t("p",{className:"zui:text-red-600 zui:text-xs",children:null===(e=S[m])||void 0===e?void 0:e.message}):null};switch(h){case"text":case"number":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(s,e({},n,{type:"number"===h?"number":"text"},P,D))}})),B()]},m);case"textarea":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(s,e({},n,P,D,{type:"textarea"}))}})),B()]},m);case"select":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(o,e({},n,P,D))}})),B()]},m);case"multiselect":case"multi-select":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(o,e({},n,P,D,{isMulti:!0}))}})),B()]},m);case"radio":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(d,e({},n,P,D))}})),B()]},m);case"switch":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(c,e({},n,P,D))}})),B()]},m);case"checkbox":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(p,e({},n,P,D))}})),B()]},m);case"timepicker":case"time":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(f,e({},n,P,D))}})),B()]},m);case"file":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(s,e({},n,P,D,{value:void 0,type:"file",ref:n.ref,onChange:function(e){return n.onChange(e.target.files)}}))}})),B()]},m);case"date":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(l,e({},n,P,D))}})),B()]},m);case"daterange":return r("div",{className:i(F),children:[t(E,e({name:m,control:j,rules:A},M,{render:function(r){var n=r.field;return t(u,e({},n,P,D))}})),B()]},m);case"custom":return t("div",{className:i(F),children:z||null},m);default:return null}}),z&&t("div",{className:"zui:col-span-12",children:t(m,{type:"submit",children:"Submit"})})]})};export{M as Form,M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),t=require("react"),s=require("../../chunks/index-90b71f01.js"),n=require("../Input/index.js"),i=require("../Select/index.js"),a=require("../DatePicker/index.js"),l=require("../DateRangePicker/index.js"),u=require("../Switch/index.js"),o=require("../RadioGroup/index.js"),c=require("../Button/index.js"),d=require("../TimePicker/index.js"),f=require("../Checkbox/index.js");function m(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}require("../../chunks/lucide-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),t=require("react"),s=require("../../chunks/index-90b71f01.js"),n=require("../Input/index.js"),i=require("../Select/index.js"),a=require("../DatePicker/index.js"),l=require("../DateRangePicker/index.js"),u=require("../Switch/index.js"),o=require("../RadioGroup/index.js"),c=require("../Button/index.js"),d=require("../TimePicker/index.js"),f=require("../Checkbox/index.js");function m(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}require("../../chunks/lucide-937248a9.js"),require("../../chunks/typeof-b30b964a.js"),require("../../chunks/assertThisInitialized-d31798d4.js"),require("@emotion/react"),require("react-dom"),require("../../chunks/Calender-fd591944.js"),require("../Popover/index.js"),require("@mui/material"),require("@mui/material/Popover"),require("../../chunks/_commonjsHelpers-3d4c1909.js");var _=m(t),p=e=>null==e;var x=e=>!p(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e=>e instanceof Date)(e),g=e=>x(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,v="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function j(e){let r;const t=Array.isArray(e),s="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)r=new Date(e);else{if(v&&(e instanceof Blob||s)||!t&&!x(e))return e;if(r=t?[]:{},t||(e=>{const r=e.constructor&&e.constructor.prototype;return x(r)&&r.hasOwnProperty("isPrototypeOf")})(e))for(const t in e)e.hasOwnProperty(t)&&(r[t]=j(e[t]));else r=e}return r}var b=e=>/^\w*$/.test(e),h=e=>void 0===e,y=e=>{return r=e.replace(/["|']|\]/g,"").split(/\.|\[/),Array.isArray(r)?r.filter(Boolean):[];var r},q=(e,r,t)=>{if(!r||!x(e))return t;const s=(b(r)?[r]:y(r)).reduce((e,r)=>p(e)?e:e[r],e);return h(s)||s===e?h(e[r])?t:e[r]:s},k=e=>"boolean"==typeof e,z=(e,r,t)=>{let s=-1;const n=b(r)?[r]:y(r),i=n.length,a=i-1;for(;++s<i;){const r=n[s];let i=t;if(s!==a){const t=e[r];i=x(t)||Array.isArray(t)?t:isNaN(+n[s+1])?{}:[]}if("__proto__"===r||"constructor"===r||"prototype"===r)return;e[r]=i,e=e[r]}};const V="blur",S="change",w="all",N=t.createContext(null);N.displayName="HookFormContext";const P=()=>t.useContext(N);const C="undefined"!=typeof window?_.useLayoutEffect:_.useEffect;function F(e){const r=P(),{control:s=r.control,disabled:n,name:i,exact:a}=e||{},[l,u]=t.useState(s._formState),o=t.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return C(()=>s._subscribe({name:i,formState:o.current,exact:a,callback:e=>{!n&&u({...s._formState,...e})}}),[i,n,a]),t.useEffect(()=>{o.current.isValid&&s._setValid(!0)},[s]),t.useMemo(()=>((e,r,t,s=!0)=>{const n={defaultValues:r._defaultValues};for(const i in e)Object.defineProperty(n,i,{get:()=>{const n=i;return r._proxyFormState[n]!==w&&(r._proxyFormState[n]=!s||w),t&&(t[n]=!0),e[n]}});return n})(l,s,o.current,!1),[l,s])}function O(e){const r=P(),{control:s=r.control,name:n,defaultValue:i,disabled:a,exact:l}=e||{},u=t.useRef(i),[o,c]=t.useState(s._getWatch(n,u.current));return C(()=>s._subscribe({name:n,formState:{values:!0},exact:l,callback:e=>!a&&c(((e,r,t,s,n)=>"string"==typeof e?(s&&r.watch.add(e),q(t,e,n)):Array.isArray(e)?e.map(e=>(s&&r.watch.add(e),q(t,e))):(s&&(r.watchAll=!0),t))(n,s._names,e.values||s._formValues,!1,u.current))}),[n,s,a,l]),t.useEffect(()=>s._removeUnmounted()),o}const A=e=>e.render(function(e){const r=P(),{name:s,disabled:n,control:i=r.control,shouldUnregister:a}=e,l=((e,r)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(r)))(i._names.array,s),u=O({control:i,name:s,defaultValue:q(i._formValues,s,q(i._defaultValues,s,e.defaultValue)),exact:!0}),o=F({control:i,name:s,exact:!0}),c=t.useRef(e),d=t.useRef(i.register(s,{...e.rules,value:u,...k(e.disabled)?{disabled:e.disabled}:{}})),f=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!q(o.errors,s)},isDirty:{enumerable:!0,get:()=>!!q(o.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!q(o.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!q(o.validatingFields,s)},error:{enumerable:!0,get:()=>q(o.errors,s)}}),[o,s]),m=t.useCallback(e=>d.current.onChange({target:{value:g(e),name:s},type:S}),[s]),_=t.useCallback(()=>d.current.onBlur({target:{value:q(i._formValues,s),name:s},type:V}),[s,i._formValues]),p=t.useCallback(e=>{const r=q(i._fields,s);r&&e&&(r._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:r=>e.setCustomValidity(r),reportValidity:()=>e.reportValidity()})},[i._fields,s]),x=t.useMemo(()=>({name:s,value:u,...k(n)||o.disabled?{disabled:o.disabled||n}:{},onChange:m,onBlur:_,ref:p}),[s,n,o.disabled,m,_,p,u]);return t.useEffect(()=>{const e=i._options.shouldUnregister||a;i.register(s,{...c.current.rules,...k(c.current.disabled)?{disabled:c.current.disabled}:{}});const r=(e,r)=>{const t=q(i._fields,e);t&&t._f&&(t._f.mount=r)};if(r(s,!0),e){const e=j(q(i._options.defaultValues,s));z(i._defaultValues,s,e),h(q(i._formValues,s))&&z(i._formValues,s,e)}return!l&&i.register(s),()=>{(l?e&&!i._state.action:e)?i.unregister(s):r(s,!1)}},[s,i,l,a]),t.useEffect(()=>{i._setDisabledField({disabled:n,name:s})},[n,s,i]),t.useMemo(()=>({field:x,formState:o,fieldState:f}),[x,o,f])}(e));var D=function(t){var m=t.schema,_=t.form,p=t.layout,x=void 0===p?"vertical":p,g=t.columns,v=void 0===g?2:g,j=t.className,b=t.showSubmitButton,h=void 0!==b&&b,y=t.onSubmit,q=_.control,k=_.handleSubmit,z=_.watch,V=_.formState.errors,S=z(),w="grid"===x?"zui:grid zui:grid-cols-12 zui:gap-3 zui:items-baseline":"zui:flex zui:flex-col zui:gap-3";return r.jsxs("form",{onSubmit:y?k(y):void 0,className:s.cn(w,j),children:[m.map(function(t){var c,m=t.name,_=t.label,p=t.type,g=t.placeholder,j=t.required,b=t.options,h=t.component,y=t.colSpan,k=t.inputProps,z=t.controllerProps;if(!(!t.visibleIf||t.visibleIf(S)))return null;var w=null!=y?y:Math.floor(12/v),N="grid"===x?{1:"zui:col-span-1",2:"zui:col-span-2",3:"zui:col-span-3",4:"zui:col-span-4",5:"zui:col-span-5",6:"zui:col-span-6",7:"zui:col-span-7",8:"zui:col-span-8",9:"zui:col-span-9",10:"zui:col-span-10",11:"zui:col-span-11",12:"zui:col-span-12"}[w]:void 0,P={label:_,placeholder:g,required:j,options:b},C=e.__assign({required:null!=j?j:null===(c=t.validation)||void 0===c?void 0:c.required},t.validation),F=null!=k?k:{},O=null!=z?z:{},D=function(){var e;return(null==V?void 0:V[m])?r.jsx("p",{className:"zui:text-red-600 zui:text-xs",children:null===(e=V[m])||void 0===e?void 0:e.message}):null};switch(p){case"text":case"number":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(n.Input,e.__assign({},s,{type:"number"===p?"number":"text"},P,F))}})),D()]},m);case"textarea":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(n.Input,e.__assign({},s,P,F,{type:"textarea"}))}})),D()]},m);case"select":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(i.Select,e.__assign({},s,P,F))}})),D()]},m);case"multiselect":case"multi-select":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(i.Select,e.__assign({},s,P,F,{isMulti:!0}))}})),D()]},m);case"radio":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(o.RadioGroup,e.__assign({},s,P,F))}})),D()]},m);case"switch":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(u.default,e.__assign({},s,P,F))}})),D()]},m);case"checkbox":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(f.Checkbox,e.__assign({},s,P,F))}})),D()]},m);case"timepicker":case"time":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(d.TimePicker,e.__assign({},s,P,F))}})),D()]},m);case"file":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(n.Input,e.__assign({},s,P,F,{value:void 0,type:"file",ref:s.ref,onChange:function(e){return s.onChange(e.target.files)}}))}})),D()]},m);case"date":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(a.DatePicker,e.__assign({},s,P,F))}})),D()]},m);case"daterange":return r.jsxs("div",{className:s.cn(N),children:[r.jsx(A,e.__assign({name:m,control:q,rules:C},O,{render:function(t){var s=t.field;return r.jsx(l.DateRangePicker,e.__assign({},s,P,F))}})),D()]},m);case"custom":return r.jsx("div",{className:s.cn(N),children:h||null},m);default:return null}}),h&&r.jsx("div",{className:"zui:col-span-12",children:r.jsx(c.Button,{type:"submit",children:"Submit"})})]})};exports.Form=D,exports.default=D;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as r,a as t,_ as e}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsx as n,jsxs as o,Fragment as i}from"react/jsx-runtime";import*as a from"react";import u,{Fragment as c,useState as l,useMemo as s,useRef as f,useEffect as h,createContext as d,useContext as p}from"react";import{Box as v,List as y,ListItemButton as m,ListItemIcon as g,ListItemText as b,CircularProgress as w,Slide as x,Dialog as E,DialogTitle as k,Divider as z,DialogContent as j,DialogActions as P}from"@mui/material";import{b as A,S as O}from"../../chunks/lucide-7e7c48b9.esm.js";import{T as _}from"../../chunks/Text-5b99f7f4.esm.js";import{Input as C}from"../Input/index.esm.js";import"../../chunks/index-32c3a4e2.esm.js";var T="open",N="exit",S=function(r){var t=tr(),e=r.list,i=void 0===e?[]:e,a=r.history,u=null==t?void 0:t.handleClose;return n(v,{p:1,children:n(y,{disablePadding:!0,component:"nav","aria-label":"menu list box",children:i.map(function(r){return o(m,{onClick:function(){return t=r.url,null==a||a.push(t),void("function"==typeof u&&u());var t},sx:{fontFamily:"sans-serif",fontSize:14,background:"rgba(246, 247, 248, 0.4)",mt:1,minHeight:48,border:"1px solid rgba(232, 234, 238, 0.5)",borderRadius:1,":hover":{background:"#ebf5ff",borderColor:"#66b2ff",color:"#66b2ff"}},children:[n(g,{sx:{minWidth:"auto",color:"inherit"},children:n(A,{size:24})}),n(b,{primaryTypographyProps:{sx:{textTransform:"capitalize"},component:"div",variant:"body1",fontSize:14,fontWeight:500,lineHeight:.85},secondaryTypographyProps:{component:"div",variant:"body1",fontSize:12},sx:{ml:1},primary:r.name||"-",secondary:r.custom_path})]})})})})},F=function(r){return"function"==typeof r.children?u.createElement(c,null,r.children()):u.createElement(c,null,r.children||null)},I=function(r){return F(r)},G=function(r){return F(r)};function R(r,t,e,n,o,i,a){try{var u=r[i](a),c=u.value}catch(r){return void e(r)}u.done?t(c):Promise.resolve(c).then(n,o)}function D(r){return function(){var t=this,e=arguments;return new Promise(function(n,o){var i=r.apply(t,e);function a(r){R(i,n,o,a,u,"next",r)}function u(r){R(i,n,o,a,u,"throw",r)}a(void 0)})}}function L(){return L=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)({}).hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},L.apply(null,arguments)}function W(){W=function(){return t};var r,t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(r,t,e,n){return Object.defineProperty(r,t,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(r){c=function(r,t,e){return r[t]=e}}function l(t,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(t,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=x(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(t,e,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(t,n,new z(o||[])),!0),a}function s(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(r){return{type:"throw",arg:r}}}t.wrap=l;var f={};function h(){}function d(){}function p(){}var v={};c(v,i,function(){return this});var y=Object.getPrototypeOf,m=y&&y(y(j([])));m&&m!==e&&n.call(m,i)&&(v=m);var g=p.prototype=h.prototype=Object.create(v);function b(r){["next","throw","return"].forEach(function(t){c(r,t,function(r){return this._invoke(t,r)})})}function w(r,t){function e(o,i,a,u){var c=s(r[o],r,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then(function(r){e("next",r,a,u)},function(r){e("throw",r,a,u)}):t.resolve(f).then(function(r){l.value=r,a(l)},function(r){return e("throw",r,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(r,n){function i(){return new t(function(t,o){e(r,n,t,o)})}return o=o?o.then(i,i):i()},!0)}function x(t,e){var n=e.method,o=t.i[n];if(o===r)return e.delegate=null,"throw"===n&&t.i.return&&(e.method="return",e.arg=r,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=s(o,t.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var a=i.arg;return a?a.done?(e[t.r]=a.value,e.next=t.n,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,f):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(r){this.tryEntries.push(r)}function k(t){var e=t[4]||{};e.type="normal",e.arg=r,t[4]=e}function z(r){this.tryEntries=[[-1]],r.forEach(E,this),this.reset(!0)}function j(t){if(null!=t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}return d.prototype=p,c(g,"constructor",p),c(p,"constructor",d),d.displayName=c(p,u,"GeneratorFunction"),t.isGeneratorFunction=function(r){var t="function"==typeof r&&r.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,p):(r.__proto__=p,c(r,u,"GeneratorFunction")),r.prototype=Object.create(g),r},t.awrap=function(r){return{__await:r}},b(w.prototype),c(w.prototype,a,function(){return this}),t.AsyncIterator=w,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new w(l(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then(function(r){return r.done?r.value:a.next()})},b(g),c(g,u,"Generator"),c(g,i,function(){return this}),c(g,"toString",function(){return"[object Generator]"}),t.keys=function(r){var t=Object(r),e=[];for(var n in t)e.unshift(n);return function r(){for(;e.length;)if((n=e.pop())in t)return r.value=n,r.done=!1,r;return r.done=!0,r}},t.values=j,z.prototype={constructor:z,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var r=this.tryEntries[0][4];if("throw"===r.type)throw r.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r){a.type="throw",a.arg=t,e.next=r}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],l=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=r,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(r,t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===r||"continue"===r)&&o[0]<=t&&t<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=r,i.arg=t,o?(this.method="next",this.next=o[2],f):this.complete(i)},complete:function(r,t){if("throw"===r.type)throw r.arg;return"break"===r.type||"continue"===r.type?this.next=r.arg:"return"===r.type?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):"normal"===r.type&&t&&(this.next=t),f},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e[2]===r)return this.complete(e[4],e[3]),k(e),f}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e[0]===r){var n=e[4];if("throw"===n.type){var o=n.arg;k(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={i:j(t),r:e,n:n},"next"===this.method&&(this.arg=r),f}},t}var H=function(r){return F(r)};function K(r){return"function"==typeof r}function q(r){return"object"==typeof r&&null!==r&&(r instanceof Promise||r!==Promise.prototype&&function(r){return Reflect.has(r,"then")&&K(r.then)}(r)&&function(r){return Reflect.has(r,"catch")&&K(r.catch)}(r))}var B=function(r,t){void 0===t&&(t=[]);var e=f(!1),n=f([]);if("function"!=typeof r)throw new Error("Incorrect callback parameter for useSingleton hook; expected a function, but got: '"+typeof r+"'.");if(!Array.isArray(t))throw new Error("Incorrect dependencies parameter for useSingleton; expected an array, but got: '"+typeof t+"'.");if(Array.isArray(t)&&t.length>0){if(!function(r,t){if(!Array.isArray(r)||!Array.isArray(t))throw new Error("shallowArraysEqual only accepts arrays as parameters");if(r.length!==t.length)return!1;for(var e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}(n.current,t))n.current=t;else if(e.current)return}else if(e.current)return;r(),e.current=!0};function M(r){var t=r.promise,e=r.keepAlive,n=void 0!==e&&e,o=r.children,i=l(null),u=i[0],d=i[1],p=l(null),v=p[0],y=p[1],m=s(function(){return function(r){if(!q(r))throw new Error("Argument of createCancellablePromise should be a Promise");var t={value:!1},e=new Promise(function(){var e=D(W().mark(function e(n,o){var i;return W().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r;case 3:i=e.sent,t.value||n(i),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),t.value||o(e.t0);case 10:case"end":return e.stop()}},e,null,[[0,7]])}));return function(r,t){return e.apply(this,arguments)}}());return Object.keys(r).forEach(function(t){e[t]=r[t]}),{promise:e,cancel:function(){t.value=!0}}}(t)},[t]),g=f([]);if(h(function(){return function(){n||m.cancel()}},[m,m.promise,n]),B(D(W().mark(function r(){var t;return W().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return d(null),y(null),r.prev=2,r.next=5,m.promise;case 5:t=r.sent,y(t),d(!0),g.current.push(m),r.next=16;break;case 11:r.prev=11,r.t0=r.catch(2),y(r.t0),d(!1),g.current.push(m);case 16:case"end":return r.stop()}},r,null,[[2,11]])})),[m.promise]),!o||!q(t))return null;if(null===u){var b=a.Children.toArray(o).find(function(r){return r.type===G});return a.createElement(c,null,b||null)}if(!u){var w=a.Children.toArray(o).find(function(r){return r.type===I});if(!w)return a.createElement(c,null,null);var x=w,E=w.props;return"function"==typeof E.children&&(x=L({},w,{props:L({},E,{children:function(){return E.children(v,g.current,m.promise)}})})),a.createElement(c,null,x)}var k=a.Children.toArray(o).find(function(r){return r.type===H});if(!k)return a.createElement(c,null,null);var z=k,j=k.props;return"function"==typeof j.children&&(z=L({},k,{props:L({},j,{children:function(){return j.children(v,g.current,m.promise)}})})),a.createElement(c,null,z)}var V=function(r){var t=r.condition,e=r.keepAlive,n=void 0!==e&&e,o=r.children;if(!o)return null;if(function(r,t){if("production"!==process.env.NODE_ENV&&r){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(r){}}}(!Array.isArray(o)&&!(o.type===I||o.type===H)||!u.Children.toArray(o).every(function(r){return r.type===I||r.type===H||r.type===G}),"The <If> component should contain <Then /> <Else /> or <Fallback /> components as its children"),q(t))return u.createElement(M,{promise:t,keepAlive:n},o);var i=function(r){return Boolean("function"==typeof r?r():r)}(t);return u.createElement(c,null,u.Children.toArray(o).find(function(r){return r.type!==I!=!i})||null)};function Y(e,n){return void 0===n&&(n=[]),e.flatMap(function(e){var o=r(r([],n,!0),[e.name],!1);if(e.children&&e.children.length>0)return Y(e.children,o);var i=t(t({},e),{custom_path:o.join(" / ")});return delete i.children,[i]})}var J=function(r){return(null==r?void 0:r.trim().toLowerCase())||""},Q=function(r){var e=r.sx;return o(v,{sx:t({display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center",background:"#f4f4f4",color:"gray"},e),children:[n(O,{size:40}),n(_,{size:"sm",children:"No results found based on search"})]})};function U(r){var e=r.children,o=r.loading,a=r.list,u={display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center"};return o?n(v,{sx:u,children:n(w,{thickness:2})}):0===(null==a?void 0:a.length)?n(Q,{sx:t(t({},u),{background:"#f4f4f4",color:"gray"})}):n(i,{children:e})}var X=function(r){var t=r.list,e=void 0===t?[]:t,i=r.delay,a=void 0===i?1e3:i,c=r.popInputPlaceholder,f=void 0===c?"Search...":c,d=r.history,p=l(""),v=p[0],y=p[1],m=l([]),g=m[0],b=m[1],w=l(!1),x=w[0],E=w[1],A=function(r){var t=[],n=J(r);t=n?e.filter(function(r){return J(r.name).includes(n)}):e,b(t),E(!1)},O=s(function(){return function(r,t){var e;return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];clearTimeout(e),e=setTimeout(function(){r.apply(void 0,n)},t)}}(A,a)},[]);h(function(){E(!0),O(v)},[v,O]);return o(u.Fragment,{children:[n(k,{classes:{root:"zui:!p-1"},component:"div",color:"primary",className:"font-semibold flex items-center",children:n(Z,{kbdType:"exit",variant:"outlined",inputProps:{className:"zui:!mb-0 zui:!text-sm",placeholder:f,value:v,onChange:function(r){var t=r.target.value;y(t)}}})}),n(z,{}),n(j,{classes:{root:"zui:!p-0"},children:n(U,{loading:x,list:g,children:n(S,{list:g,history:d})})}),n(z,{}),n(P,{children:o("div",{className:"zui:flex zui:flex-row zui:gap-0.5 zui:items-center",children:[n(_,{size:"sm",children:"Search by :"}),n("img",{loading:"lazy",className:"org_logo",src:"https://files.zimyo.work/staticlogo/global/zimyo.svg",width:85})]})})]})},Z=function(r){var e=r.variant,i=void 0===e?"contained":e,a=r.inputProps,u=r.kbdType,c=void 0===u?T:u;return n(C,t({leftIcon:n(O,{size:16}),rightIcon:o(V,{condition:c===N,children:[n(H,{children:n("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:"Esc"})}),n(I,{children:o("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:[n("span",{children:"⌘"}),n("span",{children:"+"}),n("span",{children:"K"})]})})]})},a,{focusOutline:!1,autoFocus:c===N,variant:i}))},$=u.forwardRef(function(r,e){return n(x,t({direction:"up",ref:e},r))}),rr=d(null),tr=function(){return p(rr)},er=function(r){var i=r.list,a=void 0===i?[]:i,c=e(r,["list"]),f=s(function(){return Y(a)},[a]),d=l(!1),p=d[0],v=d[1];h(function(){var r=function(r){r.ctrlKey&&"k"===r.key.toLowerCase()&&(r.preventDefault(),v(!0))};return window.addEventListener("keydown",r),function(){return window.removeEventListener("keydown",r)}},[]);var y=function(){v(!1)};return n(u.Fragment,{children:o(rr.Provider,{value:{handleClose:y},children:[n("div",{className:"global-search-container",onClick:function(){return v(!0)},children:n(Z,{kbdType:"open",inputProps:{placeholder:c.placeholder||"Search...",readOnly:!0,className:"zui:rounded-full"},variant:"contained"})}),n(E,{open:p,TransitionComponent:$,onClose:y,maxWidth:"md",slotProps:{backdrop:{style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}},PaperProps:{sx:{width:620,height:550,borderRadius:2}},"aria-describedby":"alert-dialog-slide-description",children:n(X,t({list:f},c))})]})})};export{er as GlobalMenuSearch,er as default};
|
|
1
|
+
import{b as r,a as t,_ as e}from"../../chunks/tslib.es6-4974c96c.esm.js";import{jsx as n,jsxs as o,Fragment as i}from"react/jsx-runtime";import*as a from"react";import u,{Fragment as c,useState as l,useMemo as s,useRef as f,useEffect as h,createContext as d,useContext as p}from"react";import{Box as v,List as y,ListItemButton as m,ListItemIcon as g,ListItemText as b,CircularProgress as w,Slide as x,Dialog as E,DialogTitle as k,Divider as z,DialogContent as j,DialogActions as P}from"@mui/material";import{b as A,S as O}from"../../chunks/lucide-1d5a9cda.esm.js";import{T as _}from"../../chunks/Text-5b99f7f4.esm.js";import{Input as C}from"../Input/index.esm.js";import"../../chunks/index-32c3a4e2.esm.js";var T="open",N="exit",S=function(r){var t=tr(),e=r.list,i=void 0===e?[]:e,a=r.history,u=null==t?void 0:t.handleClose;return n(v,{p:1,children:n(y,{disablePadding:!0,component:"nav","aria-label":"menu list box",children:i.map(function(r){return o(m,{onClick:function(){return t=r.url,null==a||a.push(t),void("function"==typeof u&&u());var t},sx:{fontFamily:"sans-serif",fontSize:14,background:"rgba(246, 247, 248, 0.4)",mt:1,minHeight:48,border:"1px solid rgba(232, 234, 238, 0.5)",borderRadius:1,":hover":{background:"#ebf5ff",borderColor:"#66b2ff",color:"#66b2ff"}},children:[n(g,{sx:{minWidth:"auto",color:"inherit"},children:n(A,{size:24})}),n(b,{primaryTypographyProps:{sx:{textTransform:"capitalize"},component:"div",variant:"body1",fontSize:14,fontWeight:500,lineHeight:.85},secondaryTypographyProps:{component:"div",variant:"body1",fontSize:12},sx:{ml:1},primary:r.name||"-",secondary:r.custom_path})]})})})})},F=function(r){return"function"==typeof r.children?u.createElement(c,null,r.children()):u.createElement(c,null,r.children||null)},I=function(r){return F(r)},G=function(r){return F(r)};function R(r,t,e,n,o,i,a){try{var u=r[i](a),c=u.value}catch(r){return void e(r)}u.done?t(c):Promise.resolve(c).then(n,o)}function D(r){return function(){var t=this,e=arguments;return new Promise(function(n,o){var i=r.apply(t,e);function a(r){R(i,n,o,a,u,"next",r)}function u(r){R(i,n,o,a,u,"throw",r)}a(void 0)})}}function L(){return L=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)({}).hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},L.apply(null,arguments)}function W(){W=function(){return t};var r,t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(r,t,e,n){return Object.defineProperty(r,t,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(r){c=function(r,t,e){return r[t]=e}}function l(t,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(t,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=x(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=s(t,e,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(t,n,new z(o||[])),!0),a}function s(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(r){return{type:"throw",arg:r}}}t.wrap=l;var f={};function h(){}function d(){}function p(){}var v={};c(v,i,function(){return this});var y=Object.getPrototypeOf,m=y&&y(y(j([])));m&&m!==e&&n.call(m,i)&&(v=m);var g=p.prototype=h.prototype=Object.create(v);function b(r){["next","throw","return"].forEach(function(t){c(r,t,function(r){return this._invoke(t,r)})})}function w(r,t){function e(o,i,a,u){var c=s(r[o],r,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then(function(r){e("next",r,a,u)},function(r){e("throw",r,a,u)}):t.resolve(f).then(function(r){l.value=r,a(l)},function(r){return e("throw",r,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(r,n){function i(){return new t(function(t,o){e(r,n,t,o)})}return o=o?o.then(i,i):i()},!0)}function x(t,e){var n=e.method,o=t.i[n];if(o===r)return e.delegate=null,"throw"===n&&t.i.return&&(e.method="return",e.arg=r,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=s(o,t.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var a=i.arg;return a?a.done?(e[t.r]=a.value,e.next=t.n,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,f):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(r){this.tryEntries.push(r)}function k(t){var e=t[4]||{};e.type="normal",e.arg=r,t[4]=e}function z(r){this.tryEntries=[[-1]],r.forEach(E,this),this.reset(!0)}function j(t){if(null!=t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}return d.prototype=p,c(g,"constructor",p),c(p,"constructor",d),d.displayName=c(p,u,"GeneratorFunction"),t.isGeneratorFunction=function(r){var t="function"==typeof r&&r.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,p):(r.__proto__=p,c(r,u,"GeneratorFunction")),r.prototype=Object.create(g),r},t.awrap=function(r){return{__await:r}},b(w.prototype),c(w.prototype,a,function(){return this}),t.AsyncIterator=w,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new w(l(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then(function(r){return r.done?r.value:a.next()})},b(g),c(g,u,"Generator"),c(g,i,function(){return this}),c(g,"toString",function(){return"[object Generator]"}),t.keys=function(r){var t=Object(r),e=[];for(var n in t)e.unshift(n);return function r(){for(;e.length;)if((n=e.pop())in t)return r.value=n,r.done=!1,r;return r.done=!0,r}},t.values=j,z.prototype={constructor:z,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var r=this.tryEntries[0][4];if("throw"===r.type)throw r.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r){a.type="throw",a.arg=t,e.next=r}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],l=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=r,n(c),!0;if(u<l)return n(l),!1}}},abrupt:function(r,t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===r||"continue"===r)&&o[0]<=t&&t<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=r,i.arg=t,o?(this.method="next",this.next=o[2],f):this.complete(i)},complete:function(r,t){if("throw"===r.type)throw r.arg;return"break"===r.type||"continue"===r.type?this.next=r.arg:"return"===r.type?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):"normal"===r.type&&t&&(this.next=t),f},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e[2]===r)return this.complete(e[4],e[3]),k(e),f}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var e=this.tryEntries[t];if(e[0]===r){var n=e[4];if("throw"===n.type){var o=n.arg;k(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={i:j(t),r:e,n:n},"next"===this.method&&(this.arg=r),f}},t}var H=function(r){return F(r)};function K(r){return"function"==typeof r}function q(r){return"object"==typeof r&&null!==r&&(r instanceof Promise||r!==Promise.prototype&&function(r){return Reflect.has(r,"then")&&K(r.then)}(r)&&function(r){return Reflect.has(r,"catch")&&K(r.catch)}(r))}var B=function(r,t){void 0===t&&(t=[]);var e=f(!1),n=f([]);if("function"!=typeof r)throw new Error("Incorrect callback parameter for useSingleton hook; expected a function, but got: '"+typeof r+"'.");if(!Array.isArray(t))throw new Error("Incorrect dependencies parameter for useSingleton; expected an array, but got: '"+typeof t+"'.");if(Array.isArray(t)&&t.length>0){if(!function(r,t){if(!Array.isArray(r)||!Array.isArray(t))throw new Error("shallowArraysEqual only accepts arrays as parameters");if(r.length!==t.length)return!1;for(var e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}(n.current,t))n.current=t;else if(e.current)return}else if(e.current)return;r(),e.current=!0};function M(r){var t=r.promise,e=r.keepAlive,n=void 0!==e&&e,o=r.children,i=l(null),u=i[0],d=i[1],p=l(null),v=p[0],y=p[1],m=s(function(){return function(r){if(!q(r))throw new Error("Argument of createCancellablePromise should be a Promise");var t={value:!1},e=new Promise(function(){var e=D(W().mark(function e(n,o){var i;return W().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r;case 3:i=e.sent,t.value||n(i),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),t.value||o(e.t0);case 10:case"end":return e.stop()}},e,null,[[0,7]])}));return function(r,t){return e.apply(this,arguments)}}());return Object.keys(r).forEach(function(t){e[t]=r[t]}),{promise:e,cancel:function(){t.value=!0}}}(t)},[t]),g=f([]);if(h(function(){return function(){n||m.cancel()}},[m,m.promise,n]),B(D(W().mark(function r(){var t;return W().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return d(null),y(null),r.prev=2,r.next=5,m.promise;case 5:t=r.sent,y(t),d(!0),g.current.push(m),r.next=16;break;case 11:r.prev=11,r.t0=r.catch(2),y(r.t0),d(!1),g.current.push(m);case 16:case"end":return r.stop()}},r,null,[[2,11]])})),[m.promise]),!o||!q(t))return null;if(null===u){var b=a.Children.toArray(o).find(function(r){return r.type===G});return a.createElement(c,null,b||null)}if(!u){var w=a.Children.toArray(o).find(function(r){return r.type===I});if(!w)return a.createElement(c,null,null);var x=w,E=w.props;return"function"==typeof E.children&&(x=L({},w,{props:L({},E,{children:function(){return E.children(v,g.current,m.promise)}})})),a.createElement(c,null,x)}var k=a.Children.toArray(o).find(function(r){return r.type===H});if(!k)return a.createElement(c,null,null);var z=k,j=k.props;return"function"==typeof j.children&&(z=L({},k,{props:L({},j,{children:function(){return j.children(v,g.current,m.promise)}})})),a.createElement(c,null,z)}var V=function(r){var t=r.condition,e=r.keepAlive,n=void 0!==e&&e,o=r.children;if(!o)return null;if(function(r,t){if("production"!==process.env.NODE_ENV&&r){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(r){}}}(!Array.isArray(o)&&!(o.type===I||o.type===H)||!u.Children.toArray(o).every(function(r){return r.type===I||r.type===H||r.type===G}),"The <If> component should contain <Then /> <Else /> or <Fallback /> components as its children"),q(t))return u.createElement(M,{promise:t,keepAlive:n},o);var i=function(r){return Boolean("function"==typeof r?r():r)}(t);return u.createElement(c,null,u.Children.toArray(o).find(function(r){return r.type!==I!=!i})||null)};function Y(e,n){return void 0===n&&(n=[]),e.flatMap(function(e){var o=r(r([],n,!0),[e.name],!1);if(e.children&&e.children.length>0)return Y(e.children,o);var i=t(t({},e),{custom_path:o.join(" / ")});return delete i.children,[i]})}var J=function(r){return(null==r?void 0:r.trim().toLowerCase())||""},Q=function(r){var e=r.sx;return o(v,{sx:t({display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center",background:"#f4f4f4",color:"gray"},e),children:[n(O,{size:40}),n(_,{size:"sm",children:"No results found based on search"})]})};function U(r){var e=r.children,o=r.loading,a=r.list,u={display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center"};return o?n(v,{sx:u,children:n(w,{thickness:2})}):0===(null==a?void 0:a.length)?n(Q,{sx:t(t({},u),{background:"#f4f4f4",color:"gray"})}):n(i,{children:e})}var X=function(r){var t=r.list,e=void 0===t?[]:t,i=r.delay,a=void 0===i?1e3:i,c=r.popInputPlaceholder,f=void 0===c?"Search...":c,d=r.history,p=l(""),v=p[0],y=p[1],m=l([]),g=m[0],b=m[1],w=l(!1),x=w[0],E=w[1],A=function(r){var t=[],n=J(r);t=n?e.filter(function(r){return J(r.name).includes(n)}):e,b(t),E(!1)},O=s(function(){return function(r,t){var e;return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];clearTimeout(e),e=setTimeout(function(){r.apply(void 0,n)},t)}}(A,a)},[]);h(function(){E(!0),O(v)},[v,O]);return o(u.Fragment,{children:[n(k,{classes:{root:"zui:!p-1"},component:"div",color:"primary",className:"font-semibold flex items-center",children:n(Z,{kbdType:"exit",variant:"outlined",inputProps:{className:"zui:!mb-0 zui:!text-sm",placeholder:f,value:v,onChange:function(r){var t=r.target.value;y(t)}}})}),n(z,{}),n(j,{classes:{root:"zui:!p-0"},children:n(U,{loading:x,list:g,children:n(S,{list:g,history:d})})}),n(z,{}),n(P,{children:o("div",{className:"zui:flex zui:flex-row zui:gap-0.5 zui:items-center",children:[n(_,{size:"sm",children:"Search by :"}),n("img",{loading:"lazy",className:"org_logo",src:"https://files.zimyo.work/staticlogo/global/zimyo.svg",width:85})]})})]})},Z=function(r){var e=r.variant,i=void 0===e?"contained":e,a=r.inputProps,u=r.kbdType,c=void 0===u?T:u;return n(C,t({leftIcon:n(O,{size:16}),rightIcon:o(V,{condition:c===N,children:[n(H,{children:n("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:"Esc"})}),n(I,{children:o("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:[n("span",{children:"⌘"}),n("span",{children:"+"}),n("span",{children:"K"})]})})]})},a,{focusOutline:!1,autoFocus:c===N,variant:i}))},$=u.forwardRef(function(r,e){return n(x,t({direction:"up",ref:e},r))}),rr=d(null),tr=function(){return p(rr)},er=function(r){var i=r.list,a=void 0===i?[]:i,c=e(r,["list"]),f=s(function(){return Y(a)},[a]),d=l(!1),p=d[0],v=d[1];h(function(){var r=function(r){r.ctrlKey&&"k"===r.key.toLowerCase()&&(r.preventDefault(),v(!0))};return window.addEventListener("keydown",r),function(){return window.removeEventListener("keydown",r)}},[]);var y=function(){v(!1)};return n(u.Fragment,{children:o(rr.Provider,{value:{handleClose:y},children:[n("div",{className:"global-search-container",onClick:function(){return v(!0)},children:n(Z,{kbdType:"open",inputProps:{placeholder:c.placeholder||"Search...",readOnly:!0,className:"zui:rounded-full"},variant:"contained"})}),n(E,{open:p,TransitionComponent:$,onClose:y,maxWidth:"md",slotProps:{backdrop:{style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}},PaperProps:{sx:{width:620,height:550,borderRadius:2}},"aria-describedby":"alert-dialog-slide-description",children:n(X,t({list:f},c))})]})})};export{er as GlobalMenuSearch,er as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),t=require("react"),n=require("@mui/material"),i=require("../../chunks/lucide-3fef2423.js"),o=require("../../chunks/Text-e9636dd7.js"),a=require("../Input/index.js");function u(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}require("../../chunks/index-90b71f01.js");var c=u(t),s="open",l="exit",f=function(e){var t=F(),o=e.list,a=void 0===o?[]:o,u=e.history,c=null==t?void 0:t.handleClose;return r.jsx(n.Box,{p:1,children:r.jsx(n.List,{disablePadding:!0,component:"nav","aria-label":"menu list box",children:a.map(function(e){return r.jsxs(n.ListItemButton,{onClick:function(){return r=e.url,null==u||u.push(r),void("function"==typeof c&&c());var r},sx:{fontFamily:"sans-serif",fontSize:14,background:"rgba(246, 247, 248, 0.4)",mt:1,minHeight:48,border:"1px solid rgba(232, 234, 238, 0.5)",borderRadius:1,":hover":{background:"#ebf5ff",borderColor:"#66b2ff",color:"#66b2ff"}},children:[r.jsx(n.ListItemIcon,{sx:{minWidth:"auto",color:"inherit"},children:r.jsx(i.Globe,{size:24})}),r.jsx(n.ListItemText,{primaryTypographyProps:{sx:{textTransform:"capitalize"},component:"div",variant:"body1",fontSize:14,fontWeight:500,lineHeight:.85},secondaryTypographyProps:{component:"div",variant:"body1",fontSize:12},sx:{ml:1},primary:e.name||"-",secondary:e.custom_path})]})})})})},h=function(e){return"function"==typeof e.children?t.createElement(t.Fragment,null,e.children()):t.createElement(t.Fragment,null,e.children||null)},d=function(e){return h(e)},p=function(e){return h(e)};function v(e,r,t,n,i,o,a){try{var u=e[o](a),c=u.value}catch(e){return void t(e)}u.done?r(c):Promise.resolve(c).then(n,i)}function y(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){v(o,n,i,a,u,"next",e)}function u(e){v(o,n,i,a,u,"throw",e)}a(void 0)})}}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},g.apply(null,arguments)}function m(){m=function(){return r};var e,r={},t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(e,r,t,n){return Object.defineProperty(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(e){c=function(e,r,t){return e[r]=t}}function s(r,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype);return c(a,"_invoke",function(r,t,n){var i=1;return function(o,a){if(3===i)throw Error("Generator is already running");if(4===i){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var u=n.delegate;if(u){var c=j(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===i)throw i=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=3;var s=l(r,t,n);if("normal"===s.type){if(i=n.done?4:2,s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i=4,n.method="throw",n.arg=s.arg)}}}(r,n,new _(i||[])),!0),a}function l(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}r.wrap=s;var f={};function h(){}function d(){}function p(){}var v={};c(v,o,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(z([])));g&&g!==t&&n.call(g,o)&&(v=g);var x=p.prototype=h.prototype=Object.create(v);function b(e){["next","throw","return"].forEach(function(r){c(e,r,function(e){return this._invoke(r,e)})})}function w(e,r){function t(i,o,a,u){var c=l(e[i],e,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?r.resolve(f.__await).then(function(e){t("next",e,a,u)},function(e){t("throw",e,a,u)}):r.resolve(f).then(function(e){s.value=e,a(s)},function(e){return t("throw",e,a,u)})}u(c.arg)}var i;c(this,"_invoke",function(e,n){function o(){return new r(function(r,i){t(e,n,r,i)})}return i=i?i.then(o,o):o()},!0)}function j(r,t){var n=t.method,i=r.i[n];if(i===e)return t.delegate=null,"throw"===n&&r.i.return&&(t.method="return",t.arg=e,j(r,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=l(i,r.i,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var a=o.arg;return a?a.done?(t[r.r]=a.value,t.next=r.n,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,f):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function E(e){this.tryEntries.push(e)}function k(r){var t=r[4]||{};t.type="normal",t.arg=e,r[4]=t}function _(e){this.tryEntries=[[-1]],e.forEach(E,this),this.reset(!0)}function z(r){if(null!=r){var t=r[o];if(t)return t.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var i=-1,a=function t(){for(;++i<r.length;)if(n.call(r,i))return t.value=r[i],t.done=!1,t;return t.value=e,t.done=!0,t};return a.next=a}}throw new TypeError(typeof r+" is not iterable")}return d.prototype=p,c(x,"constructor",p),c(p,"constructor",d),d.displayName=c(p,u,"GeneratorFunction"),r.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,c(e,u,"GeneratorFunction")),e.prototype=Object.create(x),e},r.awrap=function(e){return{__await:e}},b(w.prototype),c(w.prototype,a,function(){return this}),r.AsyncIterator=w,r.async=function(e,t,n,i,o){void 0===o&&(o=Promise);var a=new w(s(e,t,n,i),o);return r.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},b(x),c(x,u,"Generator"),c(x,o,function(){return this}),c(x,"toString",function(){return"[object Generator]"}),r.keys=function(e){var r=Object(e),t=[];for(var n in r)t.unshift(n);return function e(){for(;t.length;)if((n=t.pop())in r)return e.value=n,e.done=!1,e;return e.done=!0,e}},r.values=z,_.prototype={constructor:_,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(k),!r)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function n(e){a.type="throw",a.arg=r,t.next=e}for(var i=t.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o[4],u=this.prev,c=o[1],s=o[2];if(-1===o[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=o[0]&&o[0]<=u){if(u<c)return this.method="next",this.arg=e,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(e,r){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var i=n;break}}i&&("break"===e||"continue"===e)&&i[0]<=r&&r<=i[2]&&(i=null);var o=i?i[4]:{};return o.type=e,o.arg=r,i?(this.method="next",this.next=i[2],f):this.complete(o)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),f},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t[2]===e)return this.complete(t[4],t[3]),k(t),f}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t[0]===e){var n=t[4];if("throw"===n.type){var i=n.arg;k(t)}return i}}throw Error("illegal catch attempt")},delegateYield:function(r,t,n){return this.delegate={i:z(r),r:t,n:n},"next"===this.method&&(this.arg=e),f}},r}var x=function(e){return h(e)};function b(e){return"function"==typeof e}function w(e){return"object"==typeof e&&null!==e&&(e instanceof Promise||e!==Promise.prototype&&function(e){return Reflect.has(e,"then")&&b(e.then)}(e)&&function(e){return Reflect.has(e,"catch")&&b(e.catch)}(e))}var j=function(e,r){void 0===r&&(r=[]);var n=t.useRef(!1),i=t.useRef([]);if("function"!=typeof e)throw new Error("Incorrect callback parameter for useSingleton hook; expected a function, but got: '"+typeof e+"'.");if(!Array.isArray(r))throw new Error("Incorrect dependencies parameter for useSingleton; expected an array, but got: '"+typeof r+"'.");if(Array.isArray(r)&&r.length>0){if(!function(e,r){if(!Array.isArray(e)||!Array.isArray(r))throw new Error("shallowArraysEqual only accepts arrays as parameters");if(e.length!==r.length)return!1;for(var t=0;t<e.length;++t)if(e[t]!==r[t])return!1;return!0}(i.current,r))i.current=r;else if(n.current)return}else if(n.current)return;e(),n.current=!0};function E(e){var r=e.promise,n=e.keepAlive,i=void 0!==n&&n,o=e.children,a=t.useState(null),u=a[0],s=a[1],l=t.useState(null),f=l[0],h=l[1],v=t.useMemo(function(){return function(e){if(!w(e))throw new Error("Argument of createCancellablePromise should be a Promise");var r={value:!1},t=new Promise(function(){var t=y(m().mark(function t(n,i){var o;return m().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e;case 3:o=t.sent,r.value||n(o),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),r.value||i(t.t0);case 10:case"end":return t.stop()}},t,null,[[0,7]])}));return function(e,r){return t.apply(this,arguments)}}());return Object.keys(e).forEach(function(r){t[r]=e[r]}),{promise:t,cancel:function(){r.value=!0}}}(r)},[r]),b=t.useRef([]);if(t.useEffect(function(){return function(){i||v.cancel()}},[v,v.promise,i]),j(y(m().mark(function e(){var r;return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s(null),h(null),e.prev=2,e.next=5,v.promise;case 5:r=e.sent,h(r),s(!0),b.current.push(v),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),h(e.t0),s(!1),b.current.push(v);case 16:case"end":return e.stop()}},e,null,[[2,11]])})),[v.promise]),!o||!w(r))return null;if(null===u){var E=c.Children.toArray(o).find(function(e){return e.type===p});return c.createElement(t.Fragment,null,E||null)}if(!u){var k=c.Children.toArray(o).find(function(e){return e.type===d});if(!k)return c.createElement(t.Fragment,null,null);var _=k,z=k.props;return"function"==typeof z.children&&(_=g({},k,{props:g({},z,{children:function(){return z.children(f,b.current,v.promise)}})})),c.createElement(t.Fragment,null,_)}var P=c.Children.toArray(o).find(function(e){return e.type===x});if(!P)return c.createElement(t.Fragment,null,null);var O=P,A=P.props;return"function"==typeof A.children&&(O=g({},P,{props:g({},A,{children:function(){return A.children(f,b.current,v.promise)}})})),c.createElement(t.Fragment,null,O)}var k=function(e){var r=e.condition,n=e.keepAlive,i=void 0!==n&&n,o=e.children;if(!o)return null;if(function(e,r){if("production"!==process.env.NODE_ENV&&e){"undefined"!=typeof console&&console.warn(r);try{throw new Error(r)}catch(e){}}}(!Array.isArray(o)&&!(o.type===d||o.type===x)||!t.Children.toArray(o).every(function(e){return e.type===d||e.type===x||e.type===p}),"The <If> component should contain <Then /> <Else /> or <Fallback /> components as its children"),w(r))return t.createElement(E,{promise:r,keepAlive:i},o);var a=function(e){return Boolean("function"==typeof e?e():e)}(r);return t.createElement(t.Fragment,null,t.Children.toArray(o).find(function(e){return e.type!==d!=!a})||null)};function _(r,t){return void 0===t&&(t=[]),r.flatMap(function(r){var n=e.__spreadArray(e.__spreadArray([],t,!0),[r.name],!1);if(r.children&&r.children.length>0)return _(r.children,n);var i=e.__assign(e.__assign({},r),{custom_path:n.join(" / ")});return delete i.children,[i]})}var z=function(e){return(null==e?void 0:e.trim().toLowerCase())||""},P=function(t){var a=t.sx;return r.jsxs(n.Box,{sx:e.__assign({display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center",background:"#f4f4f4",color:"gray"},a),children:[r.jsx(i.Search,{size:40}),r.jsx(o.Text,{size:"sm",children:"No results found based on search"})]})};function O(t){var i=t.children,o=t.loading,a=t.list,u={display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center"};return o?r.jsx(n.Box,{sx:u,children:r.jsx(n.CircularProgress,{thickness:2})}):0===(null==a?void 0:a.length)?r.jsx(P,{sx:e.__assign(e.__assign({},u),{background:"#f4f4f4",color:"gray"})}):r.jsx(r.Fragment,{children:i})}var A=function(e){var i=e.list,a=void 0===i?[]:i,u=e.delay,c=void 0===u?1e3:u,s=e.popInputPlaceholder,l=void 0===s?"Search...":s,h=e.history,d=t.useState(""),p=d[0],v=d[1],y=t.useState([]),g=y[0],m=y[1],x=t.useState(!1),b=x[0],w=x[1],j=function(e){var r=[],t=z(e);r=t?a.filter(function(e){return z(e.name).includes(t)}):a,m(r),w(!1)},E=t.useMemo(function(){return function(e,r){var t;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];clearTimeout(t),t=setTimeout(function(){e.apply(void 0,n)},r)}}(j,c)},[]);t.useEffect(function(){w(!0),E(p)},[p,E]);return r.jsxs(t.Fragment,{children:[r.jsx(n.DialogTitle,{classes:{root:"zui:!p-1"},component:"div",color:"primary",className:"font-semibold flex items-center",children:r.jsx(C,{kbdType:"exit",variant:"outlined",inputProps:{className:"zui:!mb-0 zui:!text-sm",placeholder:l,value:p,onChange:function(e){var r=e.target.value;v(r)}}})}),r.jsx(n.Divider,{}),r.jsx(n.DialogContent,{classes:{root:"zui:!p-0"},children:r.jsx(O,{loading:b,list:g,children:r.jsx(f,{list:g,history:h})})}),r.jsx(n.Divider,{}),r.jsx(n.DialogActions,{children:r.jsxs("div",{className:"zui:flex zui:flex-row zui:gap-0.5 zui:items-center",children:[r.jsx(o.Text,{size:"sm",children:"Search by :"}),r.jsx("img",{loading:"lazy",className:"org_logo",src:"https://files.zimyo.work/staticlogo/global/zimyo.svg",width:85})]})})]})},C=function(t){var n=t.variant,o=void 0===n?"contained":n,u=t.inputProps,c=t.kbdType,f=void 0===c?s:c;return r.jsx(a.Input,e.__assign({leftIcon:r.jsx(i.Search,{size:16}),rightIcon:r.jsxs(k,{condition:f===l,children:[r.jsx(x,{children:r.jsx("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:"Esc"})}),r.jsx(d,{children:r.jsxs("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:[r.jsx("span",{children:"⌘"}),r.jsx("span",{children:"+"}),r.jsx("span",{children:"K"})]})})]})},u,{focusOutline:!1,autoFocus:f===l,variant:o}))},S=t.forwardRef(function(t,i){return r.jsx(n.Slide,e.__assign({direction:"up",ref:i},t))}),T=t.createContext(null),F=function(){return t.useContext(T)},I=function(i){var o=i.list,a=void 0===o?[]:o,u=e.__rest(i,["list"]),c=t.useMemo(function(){return _(a)},[a]),s=t.useState(!1),l=s[0],f=s[1];t.useEffect(function(){var e=function(e){e.ctrlKey&&"k"===e.key.toLowerCase()&&(e.preventDefault(),f(!0))};return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}},[]);var h=function(){f(!1)};return r.jsx(t.Fragment,{children:r.jsxs(T.Provider,{value:{handleClose:h},children:[r.jsx("div",{className:"global-search-container",onClick:function(){return f(!0)},children:r.jsx(C,{kbdType:"open",inputProps:{placeholder:u.placeholder||"Search...",readOnly:!0,className:"zui:rounded-full"},variant:"contained"})}),r.jsx(n.Dialog,{open:l,TransitionComponent:S,onClose:h,maxWidth:"md",slotProps:{backdrop:{style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}},PaperProps:{sx:{width:620,height:550,borderRadius:2}},"aria-describedby":"alert-dialog-slide-description",children:r.jsx(A,e.__assign({list:c},u))})]})})};exports.GlobalMenuSearch=I,exports.default=I;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../chunks/tslib.es6-a3dc1f53.js"),r=require("react/jsx-runtime"),t=require("react"),n=require("@mui/material"),i=require("../../chunks/lucide-937248a9.js"),o=require("../../chunks/Text-e9636dd7.js"),a=require("../Input/index.js");function u(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}require("../../chunks/index-90b71f01.js");var c=u(t),s="open",l="exit",f=function(e){var t=F(),o=e.list,a=void 0===o?[]:o,u=e.history,c=null==t?void 0:t.handleClose;return r.jsx(n.Box,{p:1,children:r.jsx(n.List,{disablePadding:!0,component:"nav","aria-label":"menu list box",children:a.map(function(e){return r.jsxs(n.ListItemButton,{onClick:function(){return r=e.url,null==u||u.push(r),void("function"==typeof c&&c());var r},sx:{fontFamily:"sans-serif",fontSize:14,background:"rgba(246, 247, 248, 0.4)",mt:1,minHeight:48,border:"1px solid rgba(232, 234, 238, 0.5)",borderRadius:1,":hover":{background:"#ebf5ff",borderColor:"#66b2ff",color:"#66b2ff"}},children:[r.jsx(n.ListItemIcon,{sx:{minWidth:"auto",color:"inherit"},children:r.jsx(i.Globe,{size:24})}),r.jsx(n.ListItemText,{primaryTypographyProps:{sx:{textTransform:"capitalize"},component:"div",variant:"body1",fontSize:14,fontWeight:500,lineHeight:.85},secondaryTypographyProps:{component:"div",variant:"body1",fontSize:12},sx:{ml:1},primary:e.name||"-",secondary:e.custom_path})]})})})})},h=function(e){return"function"==typeof e.children?t.createElement(t.Fragment,null,e.children()):t.createElement(t.Fragment,null,e.children||null)},d=function(e){return h(e)},p=function(e){return h(e)};function v(e,r,t,n,i,o,a){try{var u=e[o](a),c=u.value}catch(e){return void t(e)}u.done?r(c):Promise.resolve(c).then(n,i)}function y(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){v(o,n,i,a,u,"next",e)}function u(e){v(o,n,i,a,u,"throw",e)}a(void 0)})}}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},g.apply(null,arguments)}function m(){m=function(){return r};var e,r={},t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(e,r,t,n){return Object.defineProperty(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(e){c=function(e,r,t){return e[r]=t}}function s(r,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype);return c(a,"_invoke",function(r,t,n){var i=1;return function(o,a){if(3===i)throw Error("Generator is already running");if(4===i){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var u=n.delegate;if(u){var c=j(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===i)throw i=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=3;var s=l(r,t,n);if("normal"===s.type){if(i=n.done?4:2,s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i=4,n.method="throw",n.arg=s.arg)}}}(r,n,new _(i||[])),!0),a}function l(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}r.wrap=s;var f={};function h(){}function d(){}function p(){}var v={};c(v,o,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(z([])));g&&g!==t&&n.call(g,o)&&(v=g);var x=p.prototype=h.prototype=Object.create(v);function b(e){["next","throw","return"].forEach(function(r){c(e,r,function(e){return this._invoke(r,e)})})}function w(e,r){function t(i,o,a,u){var c=l(e[i],e,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?r.resolve(f.__await).then(function(e){t("next",e,a,u)},function(e){t("throw",e,a,u)}):r.resolve(f).then(function(e){s.value=e,a(s)},function(e){return t("throw",e,a,u)})}u(c.arg)}var i;c(this,"_invoke",function(e,n){function o(){return new r(function(r,i){t(e,n,r,i)})}return i=i?i.then(o,o):o()},!0)}function j(r,t){var n=t.method,i=r.i[n];if(i===e)return t.delegate=null,"throw"===n&&r.i.return&&(t.method="return",t.arg=e,j(r,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=l(i,r.i,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var a=o.arg;return a?a.done?(t[r.r]=a.value,t.next=r.n,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,f):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function E(e){this.tryEntries.push(e)}function k(r){var t=r[4]||{};t.type="normal",t.arg=e,r[4]=t}function _(e){this.tryEntries=[[-1]],e.forEach(E,this),this.reset(!0)}function z(r){if(null!=r){var t=r[o];if(t)return t.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var i=-1,a=function t(){for(;++i<r.length;)if(n.call(r,i))return t.value=r[i],t.done=!1,t;return t.value=e,t.done=!0,t};return a.next=a}}throw new TypeError(typeof r+" is not iterable")}return d.prototype=p,c(x,"constructor",p),c(p,"constructor",d),d.displayName=c(p,u,"GeneratorFunction"),r.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,c(e,u,"GeneratorFunction")),e.prototype=Object.create(x),e},r.awrap=function(e){return{__await:e}},b(w.prototype),c(w.prototype,a,function(){return this}),r.AsyncIterator=w,r.async=function(e,t,n,i,o){void 0===o&&(o=Promise);var a=new w(s(e,t,n,i),o);return r.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},b(x),c(x,u,"Generator"),c(x,o,function(){return this}),c(x,"toString",function(){return"[object Generator]"}),r.keys=function(e){var r=Object(e),t=[];for(var n in r)t.unshift(n);return function e(){for(;t.length;)if((n=t.pop())in r)return e.value=n,e.done=!1,e;return e.done=!0,e}},r.values=z,_.prototype={constructor:_,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(k),!r)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function n(e){a.type="throw",a.arg=r,t.next=e}for(var i=t.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o[4],u=this.prev,c=o[1],s=o[2];if(-1===o[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=o[0]&&o[0]<=u){if(u<c)return this.method="next",this.arg=e,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(e,r){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var i=n;break}}i&&("break"===e||"continue"===e)&&i[0]<=r&&r<=i[2]&&(i=null);var o=i?i[4]:{};return o.type=e,o.arg=r,i?(this.method="next",this.next=i[2],f):this.complete(o)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),f},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t[2]===e)return this.complete(t[4],t[3]),k(t),f}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t[0]===e){var n=t[4];if("throw"===n.type){var i=n.arg;k(t)}return i}}throw Error("illegal catch attempt")},delegateYield:function(r,t,n){return this.delegate={i:z(r),r:t,n:n},"next"===this.method&&(this.arg=e),f}},r}var x=function(e){return h(e)};function b(e){return"function"==typeof e}function w(e){return"object"==typeof e&&null!==e&&(e instanceof Promise||e!==Promise.prototype&&function(e){return Reflect.has(e,"then")&&b(e.then)}(e)&&function(e){return Reflect.has(e,"catch")&&b(e.catch)}(e))}var j=function(e,r){void 0===r&&(r=[]);var n=t.useRef(!1),i=t.useRef([]);if("function"!=typeof e)throw new Error("Incorrect callback parameter for useSingleton hook; expected a function, but got: '"+typeof e+"'.");if(!Array.isArray(r))throw new Error("Incorrect dependencies parameter for useSingleton; expected an array, but got: '"+typeof r+"'.");if(Array.isArray(r)&&r.length>0){if(!function(e,r){if(!Array.isArray(e)||!Array.isArray(r))throw new Error("shallowArraysEqual only accepts arrays as parameters");if(e.length!==r.length)return!1;for(var t=0;t<e.length;++t)if(e[t]!==r[t])return!1;return!0}(i.current,r))i.current=r;else if(n.current)return}else if(n.current)return;e(),n.current=!0};function E(e){var r=e.promise,n=e.keepAlive,i=void 0!==n&&n,o=e.children,a=t.useState(null),u=a[0],s=a[1],l=t.useState(null),f=l[0],h=l[1],v=t.useMemo(function(){return function(e){if(!w(e))throw new Error("Argument of createCancellablePromise should be a Promise");var r={value:!1},t=new Promise(function(){var t=y(m().mark(function t(n,i){var o;return m().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e;case 3:o=t.sent,r.value||n(o),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),r.value||i(t.t0);case 10:case"end":return t.stop()}},t,null,[[0,7]])}));return function(e,r){return t.apply(this,arguments)}}());return Object.keys(e).forEach(function(r){t[r]=e[r]}),{promise:t,cancel:function(){r.value=!0}}}(r)},[r]),b=t.useRef([]);if(t.useEffect(function(){return function(){i||v.cancel()}},[v,v.promise,i]),j(y(m().mark(function e(){var r;return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s(null),h(null),e.prev=2,e.next=5,v.promise;case 5:r=e.sent,h(r),s(!0),b.current.push(v),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),h(e.t0),s(!1),b.current.push(v);case 16:case"end":return e.stop()}},e,null,[[2,11]])})),[v.promise]),!o||!w(r))return null;if(null===u){var E=c.Children.toArray(o).find(function(e){return e.type===p});return c.createElement(t.Fragment,null,E||null)}if(!u){var k=c.Children.toArray(o).find(function(e){return e.type===d});if(!k)return c.createElement(t.Fragment,null,null);var _=k,z=k.props;return"function"==typeof z.children&&(_=g({},k,{props:g({},z,{children:function(){return z.children(f,b.current,v.promise)}})})),c.createElement(t.Fragment,null,_)}var P=c.Children.toArray(o).find(function(e){return e.type===x});if(!P)return c.createElement(t.Fragment,null,null);var O=P,A=P.props;return"function"==typeof A.children&&(O=g({},P,{props:g({},A,{children:function(){return A.children(f,b.current,v.promise)}})})),c.createElement(t.Fragment,null,O)}var k=function(e){var r=e.condition,n=e.keepAlive,i=void 0!==n&&n,o=e.children;if(!o)return null;if(function(e,r){if("production"!==process.env.NODE_ENV&&e){"undefined"!=typeof console&&console.warn(r);try{throw new Error(r)}catch(e){}}}(!Array.isArray(o)&&!(o.type===d||o.type===x)||!t.Children.toArray(o).every(function(e){return e.type===d||e.type===x||e.type===p}),"The <If> component should contain <Then /> <Else /> or <Fallback /> components as its children"),w(r))return t.createElement(E,{promise:r,keepAlive:i},o);var a=function(e){return Boolean("function"==typeof e?e():e)}(r);return t.createElement(t.Fragment,null,t.Children.toArray(o).find(function(e){return e.type!==d!=!a})||null)};function _(r,t){return void 0===t&&(t=[]),r.flatMap(function(r){var n=e.__spreadArray(e.__spreadArray([],t,!0),[r.name],!1);if(r.children&&r.children.length>0)return _(r.children,n);var i=e.__assign(e.__assign({},r),{custom_path:n.join(" / ")});return delete i.children,[i]})}var z=function(e){return(null==e?void 0:e.trim().toLowerCase())||""},P=function(t){var a=t.sx;return r.jsxs(n.Box,{sx:e.__assign({display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center",background:"#f4f4f4",color:"gray"},a),children:[r.jsx(i.Search,{size:40}),r.jsx(o.Text,{size:"sm",children:"No results found based on search"})]})};function O(t){var i=t.children,o=t.loading,a=t.list,u={display:"flex",flexDirection:"column",height:"100%",justifyContent:"center",alignItems:"center"};return o?r.jsx(n.Box,{sx:u,children:r.jsx(n.CircularProgress,{thickness:2})}):0===(null==a?void 0:a.length)?r.jsx(P,{sx:e.__assign(e.__assign({},u),{background:"#f4f4f4",color:"gray"})}):r.jsx(r.Fragment,{children:i})}var A=function(e){var i=e.list,a=void 0===i?[]:i,u=e.delay,c=void 0===u?1e3:u,s=e.popInputPlaceholder,l=void 0===s?"Search...":s,h=e.history,d=t.useState(""),p=d[0],v=d[1],y=t.useState([]),g=y[0],m=y[1],x=t.useState(!1),b=x[0],w=x[1],j=function(e){var r=[],t=z(e);r=t?a.filter(function(e){return z(e.name).includes(t)}):a,m(r),w(!1)},E=t.useMemo(function(){return function(e,r){var t;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];clearTimeout(t),t=setTimeout(function(){e.apply(void 0,n)},r)}}(j,c)},[]);t.useEffect(function(){w(!0),E(p)},[p,E]);return r.jsxs(t.Fragment,{children:[r.jsx(n.DialogTitle,{classes:{root:"zui:!p-1"},component:"div",color:"primary",className:"font-semibold flex items-center",children:r.jsx(C,{kbdType:"exit",variant:"outlined",inputProps:{className:"zui:!mb-0 zui:!text-sm",placeholder:l,value:p,onChange:function(e){var r=e.target.value;v(r)}}})}),r.jsx(n.Divider,{}),r.jsx(n.DialogContent,{classes:{root:"zui:!p-0"},children:r.jsx(O,{loading:b,list:g,children:r.jsx(f,{list:g,history:h})})}),r.jsx(n.Divider,{}),r.jsx(n.DialogActions,{children:r.jsxs("div",{className:"zui:flex zui:flex-row zui:gap-0.5 zui:items-center",children:[r.jsx(o.Text,{size:"sm",children:"Search by :"}),r.jsx("img",{loading:"lazy",className:"org_logo",src:"https://files.zimyo.work/staticlogo/global/zimyo.svg",width:85})]})})]})},C=function(t){var n=t.variant,o=void 0===n?"contained":n,u=t.inputProps,c=t.kbdType,f=void 0===c?s:c;return r.jsx(a.Input,e.__assign({leftIcon:r.jsx(i.Search,{size:16}),rightIcon:r.jsxs(k,{condition:f===l,children:[r.jsx(x,{children:r.jsx("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:"Esc"})}),r.jsx(d,{children:r.jsxs("kbd",{className:"zui:px-2 zui:py-1 zui:border zui:border-gray-200 zui:rounded zui:bg-gray-200",children:[r.jsx("span",{children:"⌘"}),r.jsx("span",{children:"+"}),r.jsx("span",{children:"K"})]})})]})},u,{focusOutline:!1,autoFocus:f===l,variant:o}))},S=t.forwardRef(function(t,i){return r.jsx(n.Slide,e.__assign({direction:"up",ref:i},t))}),T=t.createContext(null),F=function(){return t.useContext(T)},I=function(i){var o=i.list,a=void 0===o?[]:o,u=e.__rest(i,["list"]),c=t.useMemo(function(){return _(a)},[a]),s=t.useState(!1),l=s[0],f=s[1];t.useEffect(function(){var e=function(e){e.ctrlKey&&"k"===e.key.toLowerCase()&&(e.preventDefault(),f(!0))};return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}},[]);var h=function(){f(!1)};return r.jsx(t.Fragment,{children:r.jsxs(T.Provider,{value:{handleClose:h},children:[r.jsx("div",{className:"global-search-container",onClick:function(){return f(!0)},children:r.jsx(C,{kbdType:"open",inputProps:{placeholder:u.placeholder||"Search...",readOnly:!0,className:"zui:rounded-full"},variant:"contained"})}),r.jsx(n.Dialog,{open:l,TransitionComponent:S,onClose:h,maxWidth:"md",slotProps:{backdrop:{style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}},PaperProps:{sx:{width:620,height:550,borderRadius:2}},"aria-describedby":"alert-dialog-slide-description",children:r.jsx(A,e.__assign({list:c},u))})]})})};exports.GlobalMenuSearch=I,exports.default=I;
|