@ctlyst.id/internal-ui 1.0.4-canary.6 → 1.0.4-canary.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@chakra-ui/react"),r=require("react"),n=e(r),a=require("react-icons/fi"),o=require("@chakra-ui/icons"),i=require("@emotion/react"),c=require("@tanstack/react-table"),l=e(require("classnames")),d=e(require("react-datepicker")),p=require("@chakra-ui/system"),s=e(require("@emotion/styled")),m=e(require("react-select")),u=require("react-select-async-paginate"),_=e(require("react-select/async-creatable")),g=e(require("react-select/creatable")),h=require("react-dropzone"),b=require("@chakra-ui/theme-tools"),k=require("@chakra-ui/anatomy"),f=require("@chakra-ui/styled-system"),x=e(require("axios"));const y=e=>{const{title:n,children:o,parents:i,className:c,disableHome:l,spacing:d=2}=e,[p,s]=t.useToken("colors",["neutral.700","dark.500"]);return r.createElement(t.Box,{"data-test-id":"CT_component_breadcrumb_breadcrumb",className:c,display:"flex",justifyContent:"space-between",alignItems:"center",paddingY:2},r.createElement(t.Box,{display:"flex",alignItems:"center"},r.createElement(t.Text,{pr:2,fontWeight:500,textStyle:"heading.3",color:t.useColorModeValue("neutral.700","white")},n),r.createElement(t.Box,{h:"22px",borderLeft:"1px solid",borderColor:t.useColorModeValue("neutral.700","white")}),r.createElement(t.Breadcrumb,{separator:r.createElement(a.FiChevronsRight,{color:t.useColorModeValue(p,s),size:14}),pl:2.5,pr:4,spacing:d,sx:{ol:{display:"flex",alignItems:"center"}},display:"flex",alignItems:"center",className:"breadcrumb-wrapper"},r.createElement(t.BreadcrumbItem,null,r.createElement(t.BreadcrumbLink,{href:l?void 0:"/",style:{...l&&{cursor:"default"}}},r.createElement(a.FiHome,{className:"align-top",size:16,color:t.useColorModeValue("#12784A","#ffffff")}))),null==i?void 0:i.map(e=>r.createElement(t.BreadcrumbItem,{key:e.name},r.createElement(t.BreadcrumbLink,{"data-test-id":"iadKcMAul3QAdvmfIQjRE",href:e.disable?void 0:e.link,onClick:e.onClick,style:{...e.disable&&{cursor:"default"}},_hover:{textDecoration:"none"}},r.createElement(t.Text,{color:e.disable?"dark.600":t.useColorModeValue("primary.500","white"),fontSize:"text.sm",fontWeight:400},e.name)))),r.createElement(t.BreadcrumbItem,null,r.createElement(t.BreadcrumbLink,{_hover:{textDecor:"none",cursor:"default"}},r.createElement(t.Text,{color:t.useColorModeValue("dark.700","white"),fontSize:"text.sm",fontWeight:400},n))))),o&&r.createElement(t.Box,null,o))};y.defaultProps={children:void 0,parents:void 0,className:void 0,disableHome:void 0,spacing:2};const v=({indeterminate:e=!1,...n})=>{const a=r.useRef(null);return r.useEffect(()=>{a.current&&"boolean"==typeof e&&(a.current.indeterminate=!n.checked&&e)},[a,e]),r.createElement(t.Flex,{align:"center"},r.createElement("input",Object.assign({type:"checkbox",ref:a},n)))},w=({columns:e,dataSource:n=[],isLoading:a,withSelectedRow:l,onSelectedRow:d,onSort:p,manualSorting:s,sortingState:m,styles:u,..._})=>{const[g,h]=r.useState(null!=m?m:[]),[b,k]=r.useState({}),f=r.useMemo(()=>e,[e]),x=r.useMemo(()=>[{id:"select",header:({table:e})=>r.createElement(v,Object.assign({},{checked:e.getIsAllRowsSelected(),indeterminate:e.getIsSomeRowsSelected(),onChange:e.getToggleAllRowsSelectedHandler()})),cell:({row:e})=>r.createElement(v,Object.assign({},{checked:e.getIsSelected(),indeterminate:e.getIsSomeSelected(),onChange:e.getToggleSelectedHandler()}))}],[]),y=c.useReactTable({data:n,columns:l?[...x,...f]:f,getCoreRowModel:c.getCoreRowModel(),getSortedRowModel:c.getSortedRowModel(),manualPagination:!0,sortDescFirst:!0,state:{sorting:g,rowSelection:b},onRowSelectionChange:k,onSortingChange:e=>{h(e),p&&p(e)},manualSorting:s}),{flatRows:w}=y.getSelectedRowModel();return r.useEffect(()=>{const e=w.map(e=>e.original);d&&d(e)},[w]),r.createElement(t.Box,Object.assign({},_),a&&r.createElement(t.Flex,{w:"100%",h:"100%",pos:"absolute",bg:"white",align:"center",justify:"center",zIndex:2},r.createElement(t.Spinner,{color:"primary.500",thickness:"4px",size:"lg"})),r.createElement(t.Table,Object.assign({},null==u?void 0:u.table),r.createElement(t.Thead,Object.assign({},null==u?void 0:u.tableHead),y.getHeaderGroups().map(e=>r.createElement(t.Tr,Object.assign({key:e.id,bg:t.useColorModeValue("initial","ebony-clay.700")},null==u?void 0:u.tableRow),e.headers.map(e=>{var n;return r.createElement(t.Th,Object.assign({key:e.id,colSpan:e.colSpan},null==u?void 0:u.tableColumnHeader),r.createElement(t.Flex,{"data-test-id":"CT_Container_TableHeader_"+e.id,textTransform:"capitalize",userSelect:"none",align:"center",justifyContent:"space-between"},r.createElement(t.Text,{fontSize:"text.sm",fontWeight:400,lineHeight:"18px",color:t.useColorModeValue("neutral.900","white")},c.flexRender(e.column.columnDef.header,e.getContext())),r.createElement(t.Box,{as:"span",pl:"2",cursor:e.column.getCanSort()?"pointer":"default","data-test-id":"CT_Container_SortingIcon_"+e.id,onClick:e.column.getToggleSortingHandler()},null!==(n=e.column.getCanSort()&&{asc:r.createElement(o.ChevronUpIcon,null),desc:r.createElement(o.ChevronDownIcon,null)}[e.column.getIsSorted()])&&void 0!==n?n:r.createElement(o.UpDownIcon,{h:2}))))})))),r.createElement(t.Tbody,Object.assign({},null==u?void 0:u.tableBody),y.getRowModel().rows.map(e=>r.createElement(t.Tr,Object.assign({key:e.id},null==u?void 0:u.tableRow,{css:i.css`
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@chakra-ui/react"),r=require("react"),n=e(r),a=require("react-icons/fi"),o=require("@chakra-ui/icons"),i=require("@emotion/react"),c=require("@tanstack/react-table"),l=e(require("classnames")),d=e(require("react-datepicker")),p=require("@chakra-ui/system"),s=e(require("@emotion/styled")),m=e(require("react-select")),u=require("react-select-async-paginate"),_=e(require("react-select/async-creatable")),g=e(require("react-select/creatable")),h=require("react-dropzone"),b=require("@chakra-ui/theme-tools"),k=require("@chakra-ui/anatomy"),f=require("@chakra-ui/styled-system"),x=e(require("axios"));const y=e=>{const{title:n,children:o,parents:i,className:c,disableHome:l,spacing:d=2}=e,[p,s]=t.useToken("colors",["neutral.600","dark.500"]);return r.createElement(t.Box,{"data-test-id":"CT_component_breadcrumb_breadcrumb",className:c,display:"flex",justifyContent:"space-between",alignItems:"center",paddingY:2},r.createElement(t.Box,{display:"flex",alignItems:"center"},r.createElement(t.Text,{pr:2,fontWeight:600,textStyle:"heading.4",color:t.useColorModeValue("neutral.700","white")},n),r.createElement(t.Box,{h:"22px",borderLeft:"1px solid",borderColor:t.useColorModeValue(p,"white")}),r.createElement(t.Breadcrumb,{separator:r.createElement(a.FiChevronsRight,{color:t.useColorModeValue(p,s),size:14}),pl:2.5,pr:4,spacing:d,sx:{ol:{display:"flex",alignItems:"center"}},display:"flex",alignItems:"center",className:"breadcrumb-wrapper"},r.createElement(t.BreadcrumbItem,null,r.createElement(t.BreadcrumbLink,{href:l?void 0:"/",style:{...l&&{cursor:"default"}}},r.createElement(a.FiHome,{className:"align-top",size:16,color:t.useColorModeValue("#12784A","#ffffff")}))),null==i?void 0:i.map(e=>r.createElement(t.BreadcrumbItem,{key:e.name},r.createElement(t.BreadcrumbLink,{"data-test-id":"iadKcMAul3QAdvmfIQjRE",href:e.disable?void 0:e.link,onClick:e.onClick,style:{...e.disable&&{cursor:"default"}},_hover:{textDecoration:"none"}},r.createElement(t.Text,{color:e.disable?"dark.600":t.useColorModeValue("primary.500","white"),fontSize:"text.sm",fontWeight:400},e.name)))),r.createElement(t.BreadcrumbItem,null,r.createElement(t.BreadcrumbLink,{_hover:{textDecor:"none",cursor:"default"}},r.createElement(t.Text,{color:t.useColorModeValue(p,"white"),fontSize:"text.sm",fontWeight:400},n))))),o&&r.createElement(t.Box,null,o))};y.defaultProps={children:void 0,parents:void 0,className:void 0,disableHome:void 0,spacing:2};const v=({indeterminate:e=!1,...n})=>{const a=r.useRef(null);return r.useEffect(()=>{a.current&&"boolean"==typeof e&&(a.current.indeterminate=!n.checked&&e)},[a,e]),r.createElement(t.Flex,{align:"center"},r.createElement("input",Object.assign({type:"checkbox",ref:a},n)))},w=({columns:e,dataSource:n=[],isLoading:a,withSelectedRow:l,onSelectedRow:d,onSort:p,manualSorting:s,sortingState:m,styles:u,..._})=>{const[g,h]=r.useState(null!=m?m:[]),[b,k]=r.useState({}),f=r.useMemo(()=>e,[e]),x=r.useMemo(()=>[{id:"select",header:({table:e})=>r.createElement(v,Object.assign({},{checked:e.getIsAllRowsSelected(),indeterminate:e.getIsSomeRowsSelected(),onChange:e.getToggleAllRowsSelectedHandler()})),cell:({row:e})=>r.createElement(v,Object.assign({},{checked:e.getIsSelected(),indeterminate:e.getIsSomeSelected(),onChange:e.getToggleSelectedHandler()}))}],[]),y=c.useReactTable({data:n,columns:l?[...x,...f]:f,getCoreRowModel:c.getCoreRowModel(),getSortedRowModel:c.getSortedRowModel(),manualPagination:!0,sortDescFirst:!0,state:{sorting:g,rowSelection:b},onRowSelectionChange:k,onSortingChange:e=>{h(e),p&&p(e)},manualSorting:s}),{flatRows:w}=y.getSelectedRowModel();return r.useEffect(()=>{const e=w.map(e=>e.original);d&&d(e)},[w]),r.createElement(t.Box,Object.assign({},_),a&&r.createElement(t.Flex,{w:"100%",h:"100%",pos:"absolute",bg:"white",align:"center",justify:"center",zIndex:2},r.createElement(t.Spinner,{color:"primary.500",thickness:"4px",size:"lg"})),r.createElement(t.Table,Object.assign({},null==u?void 0:u.table),r.createElement(t.Thead,Object.assign({},null==u?void 0:u.tableHead),y.getHeaderGroups().map(e=>r.createElement(t.Tr,Object.assign({key:e.id,bg:t.useColorModeValue("initial","ebony-clay.700")},null==u?void 0:u.tableRow),e.headers.map(e=>{var n;return r.createElement(t.Th,Object.assign({key:e.id,colSpan:e.colSpan},null==u?void 0:u.tableColumnHeader),r.createElement(t.Flex,{"data-test-id":"CT_Container_TableHeader_"+e.id,textTransform:"capitalize",userSelect:"none",align:"center",justifyContent:"space-between"},r.createElement(t.Text,{fontSize:"text.sm",fontWeight:400,lineHeight:"18px",color:t.useColorModeValue("neutral.900","white")},c.flexRender(e.column.columnDef.header,e.getContext())),r.createElement(t.Box,{as:"span",pl:"2",cursor:e.column.getCanSort()?"pointer":"default","data-test-id":"CT_Container_SortingIcon_"+e.id,onClick:e.column.getToggleSortingHandler()},null!==(n=e.column.getCanSort()&&{asc:r.createElement(o.ChevronUpIcon,null),desc:r.createElement(o.ChevronDownIcon,null)}[e.column.getIsSorted()])&&void 0!==n?n:r.createElement(o.UpDownIcon,{h:2}))))})))),r.createElement(t.Tbody,Object.assign({},null==u?void 0:u.tableBody),y.getRowModel().rows.map(e=>r.createElement(t.Tr,Object.assign({key:e.id},null==u?void 0:u.tableRow,{css:i.css`
2
2
  &:last-child {
3
3
  td {
4
4
  border-bottom: none;