@erpsquad/common 1.8.86 → 1.8.89
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/_virtual/index/index.esm10.js +3 -3
- package/dist/_virtual/index/index.esm2.js +3 -3
- package/dist/_virtual/index/index.esm3.js +3 -3
- package/dist/_virtual/index/index.esm4.js +3 -3
- package/dist/_virtual/index/index.esm5.js +3 -3
- package/dist/_virtual/index/index.esm6.js +3 -3
- package/dist/_virtual/index/index.esm7.js +3 -3
- package/dist/_virtual/index/index.esm8.js +3 -3
- package/dist/_virtual/index/index.esm9.js +3 -3
- package/dist/_virtual/index/index10.js +1 -1
- package/dist/_virtual/index/index2.js +1 -1
- package/dist/_virtual/index/index3.js +1 -1
- package/dist/_virtual/index/index4.js +1 -1
- package/dist/_virtual/index/index5.js +1 -1
- package/dist/_virtual/index/index6.js +1 -1
- package/dist/_virtual/index/index7.js +1 -1
- package/dist/_virtual/index/index8.js +1 -1
- package/dist/_virtual/index/index9.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.esm.js +31 -34
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.esm.js.map +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js +16 -15
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js.map +1 -1
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.esm.js +1 -1
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js +1 -1
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js.map +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +2 -2
- package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.js.map +1 -1
- package/dist/node_modules/@mui/system/createStyled/index.esm.js +6 -6
- package/dist/node_modules/@mui/system/createStyled/index.js +1 -1
- package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.esm.js +1 -1
- package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js +1 -1
- package/dist/style.css +74 -74
- package/dist/utils/api-config/index.esm.js +3 -0
- package/dist/utils/api-config/index.esm.js.map +1 -1
- package/dist/utils/api-config/index.js.map +1 -1
- package/package.json +1 -1
package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),a=require("react-hook-form"),t=,/* empty css */i=,/* empty css */r=require("lodash"),s=require("react-i18next"),n=,/* empty css */o=,/* empty css */u=,/* empty css */d=,/* empty css */c=,/* empty css */f=,/* empty css */m=;/* empty css */;/* empty css */var p=,/* empty css
|
|
2
|
-
/* @__PURE__ */e.jsx(
|
|
3
|
-
/* @__PURE__ */e.jsx(
|
|
4
|
-
/* @__PURE__ */e.jsx(d.Typography,{type:"s3",color:"theme.secondary.1000",onClick:()=>null==
|
|
5
|
-
/* @__PURE__ */e.jsx(
|
|
6
|
-
/* @__PURE__ */e.jsx(d.Typography,{type:"s3",color:"theme.secondary.1000",onClick:()=>null==
|
|
7
|
-
/* @__PURE__ */e.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/* @__PURE__ */e.
|
|
11
|
-
|
|
12
|
-
/* @__PURE__ */e.jsx(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/* @__PURE__ */e.jsxs(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),a=require("react-hook-form"),t=,/* empty css */i=,/* empty css */r=require("lodash"),s=require("react-i18next"),n=,/* empty css */o=,/* empty css */u=,/* empty css */d=,/* empty css */c=,/* empty css */f=,/* empty css */m=;/* empty css */;/* empty css */var p=,/* empty css */h=,/* empty css */y=,/* empty css */g=,/* empty css */x=,/* empty css */v=,/* empty css */b=,/* empty css */j=,/* empty css */C=,/* empty css */A=;/* empty css */function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=/* @__PURE__ */_(l);const k=({options:l,multiple:a,placeholder:t,with_checkboxes:i,values:r,field:s,disabledIds:n,onChange:o,handleChange:c,hasParent:f,t:m,onFooterClick:y})=>{const g=e=>null==n?void 0:n.includes(e),x=[];a||x.push(
|
|
2
|
+
/* @__PURE__ */e.jsx(p.default,{disabled:!0,value:"",sx:{opacity:"0 !important",height:"0 !important",p:"0 !important",m:"0 !important"},children:/* @__PURE__ */e.jsx(d.Typography,{type:"s3",color:"theme.secondary.1000",children:/* @__PURE__ */e.jsx("em",{children:m(t)})})},"placeholder"));const v=Array.isArray(r)&&(null==r?void 0:r.length)>0?null==r?void 0:r.filter(e=>e):r,b=(e,l)=>{const a=l.map(e=>e.value),t=Array.isArray(v)?v:[v];return a.every(e=>t.includes(e))},A=e=>{const l=e.map(e=>e.value),a=Array.isArray(v)?v:[v];return l.some(e=>a.includes(e))};return Array.isArray(l)&&l.length>0&&l.forEach(l=>{x.push(
|
|
3
|
+
/* @__PURE__ */e.jsx(p.default,{value:l.value,disabled:Boolean(l.disabled)||g(l.id||l.value),className:l.isGroup?"select--MenuItemHeader":"",children:/* @__PURE__ */e.jsxs(h.default,{sx:{display:"flex",gap:1},children:[a&&i&&/* @__PURE__ */e.jsx(u.Checkbox,{checked:f?b(l.value,l.options||[]):Boolean(Array.isArray(v)?v.includes(l.value):v==l.value),indeterminate:f&&A(l.options||[]),onChange:()=>f?((e,l)=>{const a=l.map(e=>e.value),t=Array.isArray(v)?v:[v],i=t.includes(e)?t.filter(l=>l!==e&&!a.includes(l)):[.../* @__PURE__ */new Set([...t,e,...a])];o(i),null==c||c(i)})(l.value,l.options||[]):null==c?void 0:c(l.value)}),
|
|
4
|
+
/* @__PURE__ */e.jsx(d.Typography,{type:"s3",color:"theme.secondary.1000",onClick:()=>null==c?void 0:c(l.value),children:l.label})]})},l.value)),l.isGroup&&Array.isArray(l.options)&&l.options.forEach(t=>{x.push(
|
|
5
|
+
/* @__PURE__ */e.jsx(p.default,{value:t.value,disabled:Boolean(t.disabled)||g(t.id||t.value),sx:{pl:5},children:/* @__PURE__ */e.jsxs(h.default,{sx:{display:"flex",gap:1},children:[a&&i&&/* @__PURE__ */e.jsx(u.Checkbox,{checked:Boolean(Array.isArray(r)&&r.includes(t.value))}),
|
|
6
|
+
/* @__PURE__ */e.jsx(d.Typography,{type:"s3",color:"theme.secondary.1000",onClick:()=>null==c?void 0:c(String(t.value)),children:"Payment Entries"==t.label?"Payment and Collection Entries":t.label||t.value})]})},`${l.value}-${t.value}`))})}),s.enable_footer&&x.push(
|
|
7
|
+
/* @__PURE__ */e.jsxs(h.default,{children:[
|
|
8
|
+
/* @__PURE__ */e.jsx(j.default,{flexItem:!0,sx:{mt:"0.25rem !important",mb:"0.25rem !important"}}),
|
|
9
|
+
/* @__PURE__ */e.jsxs(p.default,{sx:{gap:1},onClick:y,children:[
|
|
10
|
+
/* @__PURE__ */e.jsx(C.default,{fontSize:"small"}),
|
|
11
|
+
/* @__PURE__ */e.jsxs(d.Typography,{type:"s4",color:"theme.secondary.1000",children:["Create New ",s.label]})]})]},"footer")),x.length&&(1!=x.length||a)||x.push(
|
|
12
|
+
/* @__PURE__ */e.jsx(p.default,{disabled:!0,children:"No data available"},"no-data")),x},M=({data:l,options:a})=>{const t=l.map(e=>{var l;return(null==(l=null==a?void 0:a.find(l=>l.value==e))?void 0:l.label)||""}).filter(Boolean);/* @__PURE__ */
|
|
13
|
+
return e.jsxs(d.Typography,{type:"s4",color:"inherit",sx:{display:"flex",gap:1,alignItems:"center",mt:.5},children:[t.slice(0,4).join(", "),l.length>4&&/* @__PURE__ */e.jsx(c.Chip,{variant:"outlined",type:"normal",label:/* @__PURE__ */e.jsx(A.MoreIcon,{})})]})},q=()=>/* @__PURE__ */e.jsx(d.Typography,{fontStyle:"italic",color:"inherit",type:"s3",children:"Loading..."}),L=S.default.memo(i=>{const u=a.useWatch({control:i.formControl,name:`${i.fieldArrayName}.${i.name}`}),d=a.useFormContext(),{setValue:c}=d||{},{t:j}=s.useTranslation(),{isRtl:C}=m.useLanguage(),A=l.useRef(null),[_,L]=l.useState([]),[I,T]=l.useState(null),[O,w]=l.useState([]),[B,P]=l.useState(!1),[$,N]=l.useState(!1),[E,F]=l.useState(!1),[R,z]=l.useState(null),[V,D]=l.useState(!1),[W,H]=l.useState(""),[J,K]=l.useState(!1),[G,Q]=l.useState(null),[U,X]=l.useState(!1),[Y,Z]=l.useState(!1),[ee,le]=l.useState({page:1,hasMore:!0,isLoadingMore:!1,total:0}),{handleOptions:ae,isInternal:te=!1,disabledIds:ie=[],getSelectedData:re,attributes:se=[],filterKey:ne="id",customeFilter:oe={},refresh:ue,handleChange:de,hasParent:ce=!1,sortOrder:fe="id:-1",apiType:me,addType:pe}=i,he=l.useMemo(()=>te||!me,[te,me]),ye=l.useMemo(()=>oe,[JSON.stringify(oe)]),ge=l.useCallback((e,l)=>{var a,t;if(!e)return i.options||[];const r=e.toLowerCase(),s=ce?(null==(a=i.options)?void 0:a.reduce((e,l)=>{var a;const t=null==(a=l.options)?void 0:a.filter(e=>{const l=S.default.isValidElement(e.label)?e.searchLabel:String(e.label);return null==l?void 0:l.toLowerCase().includes(r)});return(null==t?void 0:t.length)&&e.push({...l,options:t}),e},[]))||[]:(null==(t=i.options)?void 0:t.filter(e=>{const l=S.default.isValidElement(e.label)?e.searchLabel:String(e.label);return null==l?void 0:l.toLowerCase().includes(r)}))||[];return ve(s,l)},[i.options,ce]),xe=l.useCallback(e=>[...new Map(null==e?void 0:e.map(e=>[e.value,e])).values()],[]),ve=l.useCallback((e,l)=>{const a=Array.isArray(l)?l:[l];return r.sortBy(e,e=>{const l=a.indexOf(e.id||e.value);return-1==l?1/0:l})},[]),be=l.useMemo(()=>he?ge(W,u):ve(xe([..._,...O]),u),[_,O,he,i.options,u,W,ge,ve,xe]),je=l.useCallback(async(e="",l=ye,a=1,t=!1)=>{if(!me)return[];P(!0),a>1&&le(e=>({...e,isLoadingMore:!0}));try{const{data:i=[],pagination:r={}}=await f.fetchApi({apiKey:me,filters:{limit:25,skip:25*(a-1),search:e,filters:l,select:se,order:fe}});if(i&&Array.isArray(i)){const e=t?[..._,...i]:i;Ae(e,t),_e(i),le(e=>({...e,page:a,hasMore:(null==r?void 0:r.totalCount)>25*a,total:null==r?void 0:r.totalCount,isLoadingMore:!1}))}return i||[]}catch(i){return le(e=>({...e,isLoadingMore:!1})),[]}finally{P(!1)}},[me,_,se,fe,25,ye]),Ce=l.useCallback(e=>{const{scrollTop:l,scrollHeight:a,clientHeight:t}=e.currentTarget;if(a-l<=t+10&&ee.hasMore&&!ee.isLoadingMore&&!he){const e=ee.page+1;je(W,ye,e,!0)}},[ee.hasMore,ee.isLoadingMore,ee.page,he,W,ye,je]),Ae=l.useCallback((e,l=!1)=>{const a=xe([...l?_:O,...e]);L(a)},[_,O,xe]),_e=l.useCallback(async e=>{const l=i.is_multiselect?u:[u],a=null==e?void 0:e.filter(e=>Array.isArray(l)?l.includes(e.id||e.value):(e[ne]||e.value||e.id)==l);return!!(Array.isArray(a)&&a.length>0)&&(null==re||re(i.is_multiselect?a:a[0],i.name),!0)},[i.is_multiselect,i.name,u,ne,re]),Se=l.useCallback(async()=>{$||await _e(be)||(i.is_multiselect?Array.isArray(u)&&u.length>0:Boolean(u))&&(D(!0),await je("",{...ye,"&id.in":u},1,!1),D(!1))},[$,u,JSON.stringify(ye)]),ke=l.useCallback(async()=>{JSON.stringify(ye)!==JSON.stringify(R)&&(z(ye),L([]),F(!1),le({page:1,hasMore:!0,isLoadingMore:!1,total:0})),he||E||(await je(W,ye,1,!1),F(!0))},[ye,he,E]),Me=l.useMemo(()=>r.debounce(async e=>{B||(e||he||!J||(le({page:1,hasMore:!0,isLoadingMore:!1,total:0}),await je("",ye,1,!1)),e.length>1&&!he&&(le({page:1,hasMore:!0,isLoadingMore:!1,total:0}),await je(e,ye,1,!1)))},700),[he,J,ye]),qe=l.useCallback(e=>{e.onChange(i.is_multiselect?[]:null),re&&re(null,i.name)},[i.is_multiselect,i.name,re]),Le=l.useCallback(()=>{N(!1),W.length>0&&F(!1),K(!1),H("")},[W]),Ie=l.useCallback(()=>{X(!0)},[]),Te=l.useCallback(async e=>{if(G&&G.api){Z(!0);try{const l=await G.api(e);if(Z(!1),X(!1),he||(le({page:1,hasMore:!0,isLoadingMore:!1,total:0}),F(!1),await je("",ye,1,!1)),l&&l.data){const e=i.is_multiselect?[...u||[],l.data.id]:l.data.id;c&&c(`${i.fieldArrayName}.${i.name}`,e)}}catch(l){Z(!1)}}},[G,he,je,ye,i.is_multiselect,i.fieldArrayName,i.name,u,c]);l.useEffect(()=>{ae&&ae(I)},[ae,I]),l.useEffect(()=>{$&&ke()},[$,ke]),l.useEffect(()=>{Se()},[Se]),l.useEffect(()=>{ue&&(le({page:1,hasMore:!0,isLoadingMore:!1,total:0}),je("",ye,1,!1))},[ue,je,ye]),l.useEffect(()=>($&&Me(W),()=>Me.cancel()),[W,$,Me]),l.useEffect(()=>{if(u&&!$){const e=null==_?void 0:_.filter(e=>i.is_multiselect?Array.isArray(u)&&u.includes(e.id||e.value):(e.id||e.value)==u);w(e||[])}},[u,_,i.is_multiselect,$]);const Oe=l.useCallback(e=>Array.isArray(e)?e.filter(Boolean):[],[]);return l.useEffect(()=>{const e=t.dynamicSelectAdd(pe);Q(e)},[pe]),/* @__PURE__ */e.jsx(a.Controller,{control:i.formControl,name:`${i.fieldArrayName}.${i.name}`,render:({field:l,fieldState:a})=>{var t,r,s,u,d;/* @__PURE__ */
|
|
14
|
+
return e.jsxs(e.Fragment,{children:["Select Currency"==i.placeholder&&T(l.value),
|
|
15
|
+
/* @__PURE__ */e.jsxs(n.Select,{...l,ref:A,open:$,onOpen:()=>N(!0),onClose:Le,fullWidth:!0,dataPosition:i.position,dataName:`${i.fieldArrayName}.${i.name}`,placeholder:i.placeholder,label:i.label,defaultValue:i.defaultValue||(i.is_multiselect?[]:""),searchValue:W,required:"builder"!=i.formType&&i.required,size:i.size||"small",multiple:i.is_multiselect||!1,disabled:i.disabled,sx:i.is_multiselect&&(null==(t=null==l?void 0:l.value)?void 0:t.length)?{"& .MuiSelect-select":{padding:"5.5px !important"}}:{},variant:"outlined",value:V?i.is_multiselect?[]:"":(null==(r=l.value)?void 0:r.id)||l.value||(i.is_multiselect?[]:""),className:i.is_multiselect&&(null==(s=Oe(l.value))?void 0:s.length)?"MultiSelect filter-select":"",MenuProps:{PaperProps:{onScroll:Ce,style:{maxHeight:300}}},renderValue:l=>{if(Array.isArray(l))/* @__PURE__ */
|
|
16
|
+
return e.jsx(o.default,{selectedLabel:i.selectedLabel,data:Oe(l),placeholder:B||i.is_loading?/* @__PURE__ */e.jsx(q,{}):`${j("common.search")} ${i.label}`,onDelete:i.onChipRemove,disabled:i.disabled,chipProps:{sx:{background:"#ebf9f2",border:0,"& .MuiTypography-body1":{color:"#289b64",fontWeight:"500"}}}});{const a=be.find(e=>{var a;return((null==(a=e.value)?void 0:a.id)||e.value)==l});return B||i.is_loading?/* @__PURE__ */e.jsx(q,{}):(null==a?void 0:a.label)||("string"==typeof i.label?`${j("common.search")} ${i.label}`:i.placeholder)}},searchPlaceholder:`${j("common.search")} ${i.label}`,handleSearch:e=>{H(e),K(!0)},error:Boolean(null==(u=a.error)?void 0:u.message),helperText:(null==(d=a.error)?void 0:d.message)||"",onBlur:l.onBlur,input:/* @__PURE__ */e.jsx(g.default,{label:"",endAdornment:/* @__PURE__ */e.jsx(x.default,{position:"end",children:B||i.is_loading?/* @__PURE__ */e.jsx(y.default,{size:20,sx:{mr:3,color:"#4AC08C"}}):!i.disabled&&(i.is_multiselect?Array.isArray(l.value)&&l.value.length>0:Boolean(l.value))&&/* @__PURE__ */e.jsx(v.default,{"aria-label":"clear selection",onClick:()=>qe(l),edge:"end",sx:C?{ml:2.5}:{mr:1.5},size:"small",children:/* @__PURE__ */e.jsx(b.default,{sx:{fontSize:"1rem"}})})})}),children:[k({options:be,multiple:Boolean(i.is_multiselect),placeholder:i.placeholder,values:l.value,with_checkboxes:!0,field:i,disabledIds:ie,onChange:l.onChange,handleChange:de,hasParent:ce,t:j,onFooterClick:()=>{(null==i?void 0:i.onFooterClick)?null==i||i.onFooterClick():Ie()}}),ee.isLoadingMore&&/* @__PURE__ */e.jsx(p.default,{disabled:!0,children:/* @__PURE__ */e.jsx(h.default,{sx:{display:"flex",justifyContent:"center",width:"100%"},children:/* @__PURE__ */e.jsx(y.default,{size:20})})})]}),G&&G.component&&/* @__PURE__ */e.jsx(e.Fragment,{children:S.default.createElement(G.component,{isOpen:U,setIsOpen:X,isLoading:Y,onSave:Te,modalProps:{maxWidth:"md",fullWidth:!0}})}),i.is_multiselect&&Array.isArray(l.value)&&/* @__PURE__ */e.jsx(M,{data:l.value,options:be})]})}})});L.propTypes={name:i.default.string.isRequired,placeholder:i.default.string.isRequired,label:i.default.string.isRequired,size:i.default.string,options:i.default.arrayOf(i.default.shape({label:i.default.oneOfType([i.default.string,i.default.node]),value:i.default.any})).isRequired,formControl:i.default.object.isRequired,defaultValue:i.default.any,fieldArrayName:i.default.string.isRequired,id:i.default.string,required:i.default.bool,is_multiselect:i.default.bool,position:i.default.number,formType:i.default.string,typeOfField:i.default.string,disabled:i.default.bool,onChipRemove:i.default.func,enable_footer:i.default.bool,footer_action:i.default.string,onFooterClick:i.default.func,is_loading:i.default.bool,selectedLabel:i.default.string,isInternal:i.default.bool,disabledIds:i.default.array,getSelectedData:i.default.func,attributes:i.default.array,handleChange:i.default.func,hasParent:i.default.bool,sortOrder:i.default.string,apiType:i.default.string,handleOptions:i.default.func,filterKey:i.default.string,customeFilter:i.default.object,refresh:i.default.bool,addType:i.default.string},exports.default=L;
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../src/components/form-control/form-builder/form-builder-element/dynamic-select.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Controller, useFormContext, useWatch, Control } from 'react-hook-form';\nimport { dynamicSelectAdd } from './select-configuration';\nimport {\n Box,\n CircularProgress,\n Divider,\n IconButton,\n InputAdornment,\n MenuItem,\n MenuItemProps,\n OutlinedInput,\n} from '@mui/material';\nimport PropTypes from 'prop-types';\nimport { debounce } from 'lodash';\nimport { sortBy } from \"lodash\";\nimport { useTranslation } from \"react-i18next\";\nimport { Add, Close } from '@mui/icons-material';\n\nimport Select from '../../../select/select';\nimport ChipOrPlaceholder from './chip-or-placeholder';\nimport Checkbox from '../../../checkbox/checkbox';\nimport Typography from '../../../typography/typography';\nimport Chip from '../../../chip/chip';\nimport { MoreIcon } from '../../../icons';\nimport { fetchApi } from '../../../../utils/api';\nimport { useLanguage } from '../../../../hooks/useLangauge';\nimport './element.scss';\n\n// Types\ninterface IOption {\n id: string | number;\n value: string | number;\n label: string | React.ReactNode;\n disabled?: boolean;\n isGroup?: boolean;\n options?: IOption[];\n searchLabel?: string;\n}\n\n\n\ninterface IMenuItemsProps extends MenuItemProps {\n options: IOption[];\n multiple: boolean;\n placeholder: string;\n with_checkboxes: boolean;\n values: string | string[];\n field: IDynamicSearchSelectProps;\n disabledIds: (string | number)[];\n onChange: (value: string | string[]) => void;\n handleChange?: (value: string | string[]) => void;\n hasParent: boolean;\n t: (key: string) => string;\n // onFooterClick?: () => void;\n}\n\ninterface IDynamicSearchSelectProps {\n name: string;\n placeholder: string;\n label: string;\n size?: 'small' | 'medium';\n options: IOption[];\n formControl: Control<any>;\n defaultValue?: string | string[];\n fieldArrayName: string;\n id?: string;\n required?: boolean;\n is_multiselect?: boolean;\n position?: number;\n formType?: string;\n typeOfField?: string;\n disabled?: boolean;\n onChipRemove?: (value: string) => void;\n enable_footer?: boolean;\n footer_action?: string;\n onFooterClick?: () => void;\n is_loading?: boolean;\n selectedLabel?: string;\n isInternal?: boolean;\n disabledIds?: (string | number)[];\n getSelectedData?: (data: IOption | IOption[] | null, name: string) => void;\n attributes?: string[];\n handleChange?: (value: string | string[]) => void;\n hasParent?: boolean;\n sortOrder?: string;\n apiType?: string;\n handleOptions?: (value: any) => void;\n filterKey?: string;\n customeFilter?: Record<string, any>;\n refresh?: boolean;\n addType?: string;\n}\n\ninterface IPaginationState {\n page: number;\n hasMore: boolean;\n isLoadingMore: boolean;\n total: number;\n}\n\n// Helper function to generate menu items\nconst generateMenuItems = ({\n options,\n multiple,\n placeholder,\n with_checkboxes,\n values,\n // field,\n disabledIds,\n onChange,\n handleChange,\n hasParent,\n t,\n // onFooterClick\n}: IMenuItemsProps): React.ReactElement[] => {\n const itemDisabled = (id: string | number) => disabledIds?.includes(id);\n const items: React.ReactElement[] = [];\n\n if (!multiple) {\n items.push(\n <MenuItem disabled value='' key=\"placeholder\" sx={{ opacity: `0 !important`, height: `0 !important`, p: `0 !important`, m: `0 !important` }}>\n <Typography type='s3' color='theme.secondary.1000'>\n <em>{t(placeholder)}</em>\n </Typography>\n </MenuItem>\n );\n }\n const selectedValues = (Array.isArray(values) && values?.length > 0) ? values?.filter((value) => value) : values;\n\n const handleParentChange = (parentValue: string, childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n\n const isParentSelected = valueArray.includes(parentValue);\n const updatedValues = isParentSelected\n ? valueArray.filter((value) => value !== parentValue && !childValues.includes(value))\n : [...new Set([...valueArray, parentValue, ...childValues])];\n\n onChange(updatedValues);\n handleChange?.(updatedValues);\n };\n\n const isAllOptionsSelected = (parentValue: string, childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n return childValues.every((childValue) => valueArray.includes(childValue));\n };\n\n const isSomeOptionsSelected = (childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n return childValues.some((childValue) => valueArray.includes(childValue));\n };\n\n if (Array.isArray(options) && options.length > 0) {\n options.forEach((option) => {\n items.push(\n <MenuItem\n value={option.value}\n key={option.value}\n disabled={Boolean(option.disabled) || itemDisabled(option.id || option.value)}\n className={option.isGroup ? 'select--MenuItemHeader' : ''}\n >\n <Box sx={{ display: 'flex', gap: 1 }}>\n {multiple && with_checkboxes && (\n <Checkbox\n checked={\n hasParent\n ? isAllOptionsSelected(option.value, option.options || [])\n : Boolean(Array.isArray(selectedValues) ? selectedValues.includes(option.value) : selectedValues == option.value)\n }\n indeterminate={\n hasParent && isSomeOptionsSelected(option.options || [])\n }\n onChange={() => hasParent ? handleParentChange(option.value, option.options || []) : handleChange?.(option.value)}\n />\n )}\n <Typography\n type='s3'\n color='theme.secondary.1000'\n onClick={() => handleChange?.(option.value)}\n >\n {option.label}\n </Typography>\n </Box>\n </MenuItem>\n );\n\n if (option.isGroup && Array.isArray(option.options)) {\n option.options.forEach((opt) => {\n items.push(\n <MenuItem\n value={opt.value}\n disabled={Boolean(opt.disabled) || itemDisabled(opt.id || opt.value)}\n sx={{ pl: 5 }}\n key={`${option.value}-${opt.value}`}\n >\n <Box sx={{ display: 'flex', gap: 1 }}>\n {multiple && with_checkboxes && (\n <Checkbox\n checked={Boolean(Array.isArray(values) && values.includes(opt.value))}\n />\n )}\n <Typography\n type='s3'\n color='theme.secondary.1000'\n onClick={() => handleChange?.(String(opt.value))}\n >\n {opt.label == \"Payment Entries\" ? \"Payment and Collection Entries\" : opt.label || opt.value}\n </Typography>\n </Box>\n </MenuItem>\n );\n });\n }\n });\n }\n\n // if (field.enable_footer) {\n\n // }\n\n if (!items.length || (items.length == 1 && !multiple)) {\n items.push(\n <MenuItem disabled key=\"no-data\">\n No data available\n </MenuItem>\n );\n }\n\n return items;\n};\n\n// Selected items component\nconst SelectedItems: React.FC<{\n data: (string | number)[];\n options: IOption[];\n}> = ({ data, options }) => {\n const displayTitle = data.map(\n (selectedItem) =>\n options?.find((option) => option.value == selectedItem)?.label || ''\n );\n const filteredDisplayTitle = displayTitle.filter(Boolean);\n\n return (\n <Typography\n type='s4'\n color='inherit'\n sx={{ display: 'flex', gap: 1, alignItems: 'center', mt: 0.5 }}\n >\n {filteredDisplayTitle.slice(0, 4).join(', ')}\n {data.length > 4 && (\n <Chip variant='outlined' type='normal' label={<MoreIcon />} />\n )}\n </Typography>\n );\n};\n\nconst Loading = () => (\n <Typography fontStyle='italic' color='inherit' type='s3'>Loading...</Typography>\n)\n\nconst DynamicSearchSelect: React.FC<IDynamicSearchSelectProps> = React.memo((props) => {\n const watchedValue = useWatch({\n control: props.formControl,\n name: `${props.fieldArrayName}.${props.name}`\n });\n\n const formContext = useFormContext();\n const { setValue } = formContext || {};\n const { t } = useTranslation();\n const { isRtl } = useLanguage();\n const selectRef = useRef<HTMLDivElement>(null);\n\n // State management\n const [options, setOptions] = useState<IOption[]>([]);\n const [selectedValue, setSelectedValue] = useState<any>(null);\n const [selectedOptions, setSelectedOptions] = useState<IOption[]>([]);\n const [loading, setLoading] = useState<boolean>(false);\n const [open, setOpen] = useState<boolean>(false);\n const [isAlreadyLoaded, setIsAlreadyLoaded] = useState<boolean>(false);\n const [prevFilter, setPrevFilter] = useState<any>(null);\n const [initialLoading, setInitialLoading] = useState<boolean>(false);\n const [searchQuery, setSearchQuery] = useState<string>(\"\");\n const [searchInitiate, setSearchInitiate] = useState<boolean>(false);\n const [addConfig, setAddConfig] = useState<any>(null);\n\n // Modal states\n const [isModalOpen, setIsModalOpen] = useState<boolean>(false);\n const [isAddLoading, setIsAddLoading] = useState<boolean>(false);\n\n\n // Pagination state\n const [pagination, setPagination] = useState<IPaginationState>({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n\n // Props destructuring with defaults\n const {\n handleOptions,\n isInternal = false,\n disabledIds = [],\n getSelectedData,\n attributes = [],\n filterKey = 'id',\n customeFilter = {},\n refresh,\n handleChange,\n hasParent = false,\n sortOrder = 'id:-1',\n apiType,\n addType\n } = props;\n\n const limit = 25;\n\n // Memoized values\n const isInternalOptions = useMemo(() => {\n return isInternal || !apiType;\n }, [isInternal, apiType]);\n //eslint-disable-next-line\n const cf = useMemo(() => customeFilter, [JSON.stringify(customeFilter)]);\n\n // Local search function\n const searchOptionsLocally = useCallback((searchTerm: string, value: any): IOption[] => {\n if (!searchTerm) return props.options || [];\n\n const lowercasedSearchTerm = searchTerm.toLowerCase();\n\n const filteredOptions = hasParent\n ? props.options?.reduce((acc: IOption[], opt) => {\n const searchedOptions = opt.options?.filter((item) => {\n const label = React.isValidElement(item.label) ? item.searchLabel : String(item.label);\n return label?.toLowerCase().includes(lowercasedSearchTerm);\n });\n\n if (searchedOptions?.length) {\n acc.push({ ...opt, options: searchedOptions });\n }\n\n return acc;\n }, []) || []\n : props.options?.filter((opt) => {\n const label = React.isValidElement(opt.label) ? opt.searchLabel : String(opt.label);\n return label?.toLowerCase().includes(lowercasedSearchTerm);\n }) || [];\n //eslint-disable-next-line\n return sortBySelectedValues(filteredOptions, value);\n //eslint-disable-next-line\n }, [props.options, hasParent]);\n\n // Get unique options\n const getUniqueOptions = useCallback((data: IOption[]): IOption[] => {\n const uniqueOptions = [\n ...new Map(data?.map(item => [item.value, item])).values()\n ];\n return uniqueOptions;\n }, []);\n\n // Sort by selected values\n const sortBySelectedValues = useCallback((arrayToSort: IOption[], value: any): IOption[] => {\n const selectedValues = Array.isArray(value) ? value : [value];\n const sortedValue = sortBy(arrayToSort, (item) => {\n const index = selectedValues.indexOf(item.id || item.value);\n return index == -1 ? Infinity : index;\n });\n return sortedValue;\n }, []);\n\n // Filtered options with pagination support\n const filteredOptions = useMemo(() => {\n if (isInternalOptions) {\n return searchOptionsLocally(searchQuery, watchedValue);\n }\n return sortBySelectedValues(getUniqueOptions([...options, ...selectedOptions]), watchedValue);\n //eslint-disable-next-line\n }, [options, selectedOptions, isInternalOptions, props.options, watchedValue, searchQuery, searchOptionsLocally, sortBySelectedValues, getUniqueOptions]);\n\n // API Functions\n const fetchOptions = useCallback(async (searchTerm = '', flt = cf, page = 1, append = false) => {\n if (!apiType) return [];\n\n setLoading(true);\n if (page > 1) {\n setPagination(prev => ({ ...prev, isLoadingMore: true }));\n }\n\n try {\n const { data = [], pagination = {} } = await fetchApi({\n apiKey: apiType,\n filters: {\n limit,\n skip: (page - 1) * limit,\n search: searchTerm,\n filters: flt,\n select: attributes,\n order: sortOrder\n }\n });\n\n if (data && Array.isArray(data)) {\n const newOptions = append ? [...options, ...data] : data;\n updateOptions(newOptions, append);\n handleSelectedValue(data);\n // Update pagination\n setPagination(prev => ({\n ...prev,\n page,\n hasMore: pagination?.totalCount > (page * limit),\n total: pagination?.totalCount,\n isLoadingMore: false\n }));\n }\n\n return data || [];\n } catch (error) {\n console.error('Error fetching options:', error);\n setPagination(prev => ({ ...prev, isLoadingMore: false }));\n return [];\n } finally {\n setLoading(false);\n }\n //eslint-disable-next-line\n }, [apiType, options, attributes, sortOrder, limit, cf]);\n\n // Handle scroll pagination\n const handleScroll = useCallback((event: React.UIEvent<HTMLDivElement>) => {\n const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;\n const isBottom = scrollHeight - scrollTop <= clientHeight + 10;\n\n if (isBottom && pagination.hasMore && !pagination.isLoadingMore && !isInternalOptions) {\n const nextPage = pagination.page + 1;\n fetchOptions(searchQuery, cf, nextPage, true);\n }\n }, [pagination.hasMore, pagination.isLoadingMore, pagination.page, isInternalOptions, searchQuery, cf, fetchOptions]);\n\n // Update options\n const updateOptions = useCallback((newOptions: IOption[], append = false) => {\n const oldOptions = append ? options : selectedOptions;\n const uniqueOptions = getUniqueOptions([...oldOptions, ...newOptions]);\n setOptions(uniqueOptions);\n }, [options, selectedOptions, getUniqueOptions]);\n\n // Handle selected value\n const handleSelectedValue = useCallback(async (updateOptions: IOption[]) => {\n const filterValue = props.is_multiselect ? watchedValue : [watchedValue];\n const isInOptions = updateOptions?.filter((item) =>\n Array.isArray(filterValue) ? filterValue.includes(item.id || item.value) : (item[filterKey] || item.value || item.id) == filterValue\n );\n\n if (Array.isArray(isInOptions) && isInOptions.length > 0) {\n getSelectedData?.(props.is_multiselect ? isInOptions : isInOptions[0], props.name);\n return true;\n }\n return false;\n //eslint-disable-next-line\n }, [props.is_multiselect, props.name, watchedValue, filterKey, getSelectedData, filteredOptions]);\n\n // Fetch options by ID\n const fetchIdOptions = useCallback(async () => {\n if (await handleSelectedValue(filteredOptions)) return;\n if (open) return;\n const condition = props.is_multiselect ?\n Array.isArray(watchedValue) && watchedValue.length > 0 :\n Boolean(watchedValue);\n\n if (condition) {\n setInitialLoading(true);\n const response = await fetchOptions('', { ...cf, '&id.in': watchedValue }, 1, false);\n setInitialLoading(false);\n\n if (response.length == 0 && setValue && !isInternalOptions) {\n // setValue(`${props.fieldArrayName}.${props.name}`, props.is_multiselect ? [] : null);\n }\n }\n //eslint-disable-next-line\n }, [open, watchedValue, JSON.stringify(cf)]);\n\n // Initial fetch\n const initialFetch = useCallback(async () => {\n const condition = JSON.stringify(cf) !== JSON.stringify(prevFilter);\n\n if (condition) {\n setPrevFilter(cf);\n setOptions([]);\n setIsAlreadyLoaded(false);\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n }\n\n if (!isInternalOptions && !isAlreadyLoaded) {\n await fetchOptions(searchQuery, cf, 1, false);\n setIsAlreadyLoaded(true);\n }\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [cf, isInternalOptions, isAlreadyLoaded]);\n\n // Debounced search\n const debouncedSearch = useMemo(\n () => debounce(async (searchTerm: string) => {\n if (loading) return;\n\n if (!searchTerm && !isInternalOptions && searchInitiate) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n await fetchOptions('', cf, 1, false);\n }\n if (searchTerm.length > 1 && !isInternalOptions) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n await fetchOptions(searchTerm, cf, 1, false);\n }\n }, 700),\n //eslint-disable-next-line\n [isInternalOptions, searchInitiate, cf]\n );\n\n // Reset value function\n const resetValue = useCallback((field: any) => {\n field.onChange(props.is_multiselect ? [] : null);\n if (getSelectedData) {\n getSelectedData(null, props.name);\n }\n }, [props.is_multiselect, props.name, getSelectedData]);\n\n // Handle close\n const handleClose = useCallback(() => {\n setOpen(false);\n if (searchQuery.length > 0) {\n setIsAlreadyLoaded(false);\n }\n setSearchInitiate(false);\n setSearchQuery('');\n }, [searchQuery]);\n\n const handleModalOpen = useCallback(() => {\n setIsModalOpen(true);\n }, []);\n\n\n\n // Handle modal save\n const handleModalSave = useCallback(async (payload: any) => {\n if (!addConfig || !addConfig.api) {\n console.error('Add configuration is not properly set');\n return;\n }\n\n setIsAddLoading(true);\n try {\n const result = await addConfig.api(payload);\n setIsAddLoading(false);\n setIsModalOpen(false);\n if (!isInternalOptions) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n setIsAlreadyLoaded(false);\n await fetchOptions('', cf, 1, false);\n }\n if (result && result.data) {\n const newValue = props.is_multiselect\n ? [...(watchedValue || []), result.data.id]\n : result.data.id;\n\n if (setValue) {\n setValue(`${props.fieldArrayName}.${props.name}`, newValue);\n }\n }\n } catch (error) {\n console.log(\"error\", error);\n setIsAddLoading(false);\n }\n\n\n }, [addConfig, isInternalOptions, fetchOptions, cf, props.is_multiselect, props.fieldArrayName, props.name, watchedValue, setValue]);\n\n // Effects\n useEffect(() => {\n if (handleOptions) {\n handleOptions(selectedValue);\n }\n }, [handleOptions, selectedValue]);\n\n useEffect(() => {\n if (open) {\n initialFetch();\n }\n }, [open, initialFetch]);\n\n useEffect(() => {\n fetchIdOptions();\n }, [fetchIdOptions]);\n\n useEffect(() => {\n if (refresh) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n fetchOptions('', cf, 1, false);\n }\n }, [refresh, fetchOptions, cf]);\n\n useEffect(() => {\n if (open) {\n debouncedSearch(searchQuery);\n }\n return () => debouncedSearch.cancel();\n }, [searchQuery, open, debouncedSearch]);\n\n useEffect(() => {\n if (watchedValue && !open) {\n const selectedData = options?.filter((item) =>\n props.is_multiselect ?\n Array.isArray(watchedValue) && watchedValue.includes(item.id || item.value) :\n (item.id || item.value) == watchedValue\n );\n setSelectedOptions(selectedData || []);\n }\n }, [watchedValue, options, props.is_multiselect, open]);\n\n const removeUndefined = useCallback((selectOptions: any[]) => {\n return Array.isArray(selectOptions) ? selectOptions.filter(Boolean) : [];\n }, []);\n\n useEffect(() => {\n if (!addType) return;\n const config = dynamicSelectAdd(addType);\n setAddConfig(config);\n }, [addType])\n\n // useEffect(() => {\n // handleSelectedValue(filteredOptions)\n // }, [handleSelectedValue])\n return (\n <Controller\n control={props.formControl}\n name={`${props.fieldArrayName}.${props.name}`}\n render={({ field, fieldState }) => (\n <>\n {props.placeholder == 'Select Currency' && setSelectedValue(field.value)}\n <Select\n {...field}\n ref={selectRef}\n open={open}\n onOpen={() => setOpen(true)}\n onClose={handleClose}\n fullWidth\n dataPosition={props.position}\n dataName={`${props.fieldArrayName}.${props.name}`}\n placeholder={props.placeholder}\n label={props.label}\n defaultValue={props.defaultValue || (props.is_multiselect ? [] : '')}\n searchValue={searchQuery}\n required={props.formType == 'builder' ? false : props.required}\n size={props.size || 'small'}\n multiple={props.is_multiselect || false}\n disabled={props.disabled}\n sx={(props.is_multiselect && field?.value?.length) ? { \"& .MuiSelect-select\": { padding: '5.5px !important' } } : {}}\n variant='outlined'\n value={\n initialLoading\n ? (props.is_multiselect ? [] : '')\n : (field.value?.id || field.value || (props.is_multiselect ? [] : ''))\n }\n className={\n props.is_multiselect && removeUndefined(field.value)?.length\n ? 'MultiSelect filter-select'\n : ''\n }\n MenuProps={{\n PaperProps: {\n onScroll: handleScroll,\n style: { maxHeight: 300 }\n }\n }}\n\n renderValue={(selected: any) => {\n if (Array.isArray(selected)) {\n return (\n <ChipOrPlaceholder\n selectedLabel={props.selectedLabel}\n data={removeUndefined(selected)}\n placeholder={(loading || props.is_loading) ? <Loading /> : `${t('common.search')} ${props.label}`}\n onDelete={props.onChipRemove}\n disabled={props.disabled}\n chipProps={{\n sx: {\n background: '#ebf9f2',\n border: 0,\n // borderRadius: '15px',\n '& .MuiTypography-body1': {\n color: '#289b64',\n fontWeight: \"500\",\n }\n }\n }}\n />\n );\n } else {\n const selectedOption = filteredOptions?.find(\n (option) => (option.value?.id || option.value) == selected\n );\n return (loading || props.is_loading) ? <Loading /> : selectedOption?.label ||\n (typeof props.label == 'string' ?\n `${t('common.search')} ${props.label}` :\n props.placeholder);\n }\n }}\n searchPlaceholder={`${t('common.search')} ${props.label}`}\n handleSearch={(text: string) => {\n setSearchQuery(text);\n setSearchInitiate(true);\n }}\n error={Boolean(fieldState.error?.message)}\n helperText={fieldState.error?.message || ''}\n onBlur={field.onBlur}\n input={\n <OutlinedInput\n label=''\n endAdornment={\n <InputAdornment position='end'>\n {(loading || props.is_loading) ? (\n <CircularProgress\n size={20}\n sx={{ mr: 3, color: \"#4AC08C\" }}\n />\n ) : (\n !props.disabled &&\n (props.is_multiselect ?\n (Array.isArray(field.value) && field.value.length > 0) :\n Boolean(field.value)) && (\n <IconButton\n aria-label='clear selection'\n onClick={() => resetValue(field)}\n edge='end'\n sx={isRtl ? { ml: 2.5 } : { mr: 1.5 }}\n size='small'\n >\n <Close sx={{ fontSize: '1rem' }} />\n </IconButton>\n )\n )}\n </InputAdornment>\n }\n />\n }\n >\n {generateMenuItems({\n options: filteredOptions,\n multiple: Boolean(props.is_multiselect),\n placeholder: props.placeholder,\n values: field.value,\n with_checkboxes: true,\n field: props,\n disabledIds,\n onChange: field.onChange,\n handleChange,\n hasParent,\n t,\n // onFooterClick: () => {\n // if (props?.onFooterClick) {\n // props?.onFooterClick();\n // } else {\n // handleModalOpen();\n // }\n // }\n })}\n {props?.enable_footer &&\n <Box key=\"footer\" sx={{ position: 'sticky', bottom: 0, background: '#fff', zIndex: 1 }}>\n <Divider flexItem sx={{ mt: '0.25rem !important', mb: '0.25rem !important' }} />\n <MenuItem sx={{ gap: 1 }} onClick={\n () => {\n if (props?.onFooterClick) {\n props?.onFooterClick();\n } else {\n handleModalOpen();\n }\n }\n\n }>\n <Add fontSize='small' />\n <Typography type='s4' color='theme.secondary.1000'>\n Create New {props.label}\n </Typography>\n </MenuItem>\n </Box>}\n {pagination.isLoadingMore && (\n <MenuItem disabled>\n <Box sx={{ display: 'flex', justifyContent: 'center', width: '100%' }}>\n <CircularProgress size={20} />\n </Box>\n </MenuItem>\n )}\n </Select>\n\n {/* Modal for adding new items */}\n {addConfig && addConfig.component && (\n <>\n {React.createElement(addConfig.component, {\n isOpen: isModalOpen,\n setIsOpen: setIsModalOpen,\n isLoading: isAddLoading,\n onSave: handleModalSave,\n modalProps: {\n maxWidth: 'md',\n fullWidth: true\n },\n ...props?.modalComponentProps\n })}\n </>\n )}\n\n {props.is_multiselect && Array.isArray(field.value) && (\n <SelectedItems\n data={field.value}\n options={filteredOptions}\n />\n )}\n </>\n )}\n />\n );\n});\n\nDynamicSearchSelect.propTypes = {\n name: PropTypes.string.isRequired,\n placeholder: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n size: PropTypes.string,\n options: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n value: PropTypes.any\n })\n ).isRequired,\n formControl: PropTypes.object.isRequired,\n defaultValue: PropTypes.any,\n fieldArrayName: PropTypes.string.isRequired,\n id: PropTypes.string,\n required: PropTypes.bool,\n is_multiselect: PropTypes.bool,\n position: PropTypes.number,\n formType: PropTypes.string,\n typeOfField: PropTypes.string,\n disabled: PropTypes.bool,\n onChipRemove: PropTypes.func,\n enable_footer: PropTypes.bool,\n footer_action: PropTypes.string,\n onFooterClick: PropTypes.func,\n is_loading: PropTypes.bool,\n selectedLabel: PropTypes.string,\n isInternal: PropTypes.bool,\n disabledIds: PropTypes.array,\n getSelectedData: PropTypes.func,\n attributes: PropTypes.array,\n handleChange: PropTypes.func,\n hasParent: PropTypes.bool,\n sortOrder: PropTypes.string,\n apiType: PropTypes.string,\n handleOptions: PropTypes.func,\n filterKey: PropTypes.string,\n customeFilter: PropTypes.object,\n refresh: PropTypes.bool,\n addType: PropTypes.string,\n modalComponentProps: PropTypes.object\n};\n\nexport default DynamicSearchSelect;\n"],"names":["generateMenuItems","options","multiple","placeholder","with_checkboxes","values","disabledIds","onChange","handleChange","hasParent","t","itemDisabled","id","includes","items","push","jsx","MenuItem","disabled","value","sx","opacity","height","p","m","children","Typography","type","color","selectedValues","Array","isArray","length","filter","isAllOptionsSelected","parentValue","childOptions","childValues","map","child","valueArray","every","childValue","isSomeOptionsSelected","some","forEach","option","Boolean","className","isGroup","jsxs","Box","display","gap","Checkbox","checked","indeterminate","updatedValues","Set","handleParentChange","onClick","label","opt","pl","String","SelectedItems","data","filteredDisplayTitle","selectedItem","_a","find","alignItems","mt","slice","join","Chip","variant","MoreIcon","Loading","fontStyle","DynamicSearchSelect","React","memo","props","watchedValue","useWatch","control","formControl","name","fieldArrayName","formContext","useFormContext","setValue","useTranslation","isRtl","useLanguage","selectRef","useRef","setOptions","useState","selectedValue","setSelectedValue","selectedOptions","setSelectedOptions","loading","setLoading","open","setOpen","isAlreadyLoaded","setIsAlreadyLoaded","prevFilter","setPrevFilter","initialLoading","setInitialLoading","searchQuery","setSearchQuery","searchInitiate","setSearchInitiate","addConfig","setAddConfig","isModalOpen","setIsModalOpen","isAddLoading","setIsAddLoading","pagination","setPagination","page","hasMore","isLoadingMore","total","handleOptions","isInternal","getSelectedData","attributes","filterKey","customeFilter","refresh","sortOrder","apiType","addType","isInternalOptions","useMemo","cf","JSON","stringify","searchOptionsLocally","useCallback","searchTerm","lowercasedSearchTerm","toLowerCase","filteredOptions","reduce","acc","searchedOptions","item","isValidElement","searchLabel","_b","sortBySelectedValues","getUniqueOptions","Map","arrayToSort","sortBy","index","indexOf","Infinity","fetchOptions","async","flt","append","prev","fetchApi","apiKey","filters","limit","skip","search","select","order","newOptions","updateOptions","handleSelectedValue","totalCount","error","handleScroll","event","scrollTop","scrollHeight","clientHeight","currentTarget","nextPage","uniqueOptions","filterValue","is_multiselect","isInOptions","fetchIdOptions","initialFetch","debouncedSearch","debounce","resetValue","field","handleClose","handleModalOpen","handleModalSave","payload","api","result","newValue","useEffect","cancel","selectedData","removeUndefined","selectOptions","config","dynamicSelectAdd","Controller","render","fieldState","Fragment","Select","ref","onOpen","onClose","fullWidth","dataPosition","position","dataName","defaultValue","searchValue","required","formType","size","padding","_c","MenuProps","PaperProps","onScroll","style","maxHeight","renderValue","selected","ChipOrPlaceholder","selectedLabel","is_loading","onDelete","onChipRemove","chipProps","background","border","fontWeight","selectedOption","searchPlaceholder","handleSearch","text","_d","message","helperText","_e","onBlur","input","OutlinedInput","endAdornment","InputAdornment","CircularProgress","mr","IconButton","edge","ml","Close","fontSize","enable_footer","bottom","zIndex","Divider","flexItem","mb","onFooterClick","Add","justifyContent","width","component","createElement","isOpen","setIsOpen","isLoading","onSave","modalProps","maxWidth","modalComponentProps","propTypes","PropTypes","string","isRequired","arrayOf","shape","oneOfType","node","any","object","bool","number","typeOfField","func","footer_action","array"],"mappings":"mkDAsGA,MAAMA,EAAoB,EACtBC,UACAC,WACAC,cACAC,kBACAC,SAEAC,cACAC,WACAC,eACAC,YACAC,QAGA,MAAMC,EAAgBC,GAAwB,MAAAN,OAAA,EAAAA,EAAaO,SAASD,GAC9DE,EAA8B,GAE/BZ,GACDY,EAAMC;eACFC,EAAAA,IAACC,EAAAA,QAAA,CAASC,UAAQ,EAACC,MAAM,GAAqBC,GAAI,CAAEC,QAAS,eAAgBC,OAAQ,eAAgBC,EAAG,eAAgBC,EAAG,gBACvHC,wBAAAT,EAAAA,IAACU,EAAAA,WAAA,CAAWC,KAAK,KAAKC,MAAM,uBACxBH,0BAAAT,IAAC,KAAA,CAAIS,SAAAf,EAAEP,QAFiB,gBAOxC,MAAM0B,EAAkBC,MAAMC,QAAQ1B,KAAW,MAAAA,OAAA,EAAAA,EAAQ2B,QAA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C1B1E,SAAUiE,EAAAA,QAAUU,OACpBtE,SAAU4D,EAAAA,QAAUC,OACpBU,YAAaX,EAAAA,QAAUC,OACvBjR,SAAUgR,EAAAA,QAAUS,KACpBtD,aAAc6C,EAAAA,QAAUY,KACxBhC,cAAeoB,EAAAA,QAAUS,KACzBI,cAAeb,EAAAA,QAAUC,OACzBf,cAAec,EAAAA,QAAUY,KACzB3D,WAAY+C,EAAAA,QAAUS,KACtBzD,cAAegD,EAAAA,QAAUC,OACzBhK,WAAY+J,EAAAA,QAAUS,KACtBrS,YAAa4R,EAAAA,QAAUc,MACvB5K,gBAAiB8J,EAAAA,QAAUY,KAC3BzK,WAAY6J,EAAAA,QAAUc,MACtBxS,aAAc0R,EAAAA,QAAUY,KACxBrS,UAAWyR,EAAAA,QAAUS,KACrBlK,UAAWyJ,EAAAA,QAAUC,OACrBzJ,QAASwJ,EAAAA,QAAUC,OACnBjK,cAAegK,EAAAA,QAAUY,KACzBxK,UAAW4J,EAAAA,QAAUC,OACrB5J,cAAe2J,EAAAA,QAAUQ,OACzBlK,QAAS0J,EAAAA,QAAUS,KACnBhK,QAASuJ,EAAAA,QAAUC,OACnBH,oBAAqBE,EAAAA,QAAUQ"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/components/form-control/form-builder/form-builder-element/dynamic-select.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Controller, useFormContext, useWatch, Control } from 'react-hook-form';\nimport { dynamicSelectAdd } from './select-configuration';\nimport {\n Box,\n CircularProgress,\n Divider,\n IconButton,\n InputAdornment,\n MenuItem,\n MenuItemProps,\n OutlinedInput,\n} from '@mui/material';\nimport PropTypes from 'prop-types';\nimport { debounce } from 'lodash';\nimport { sortBy } from \"lodash\";\nimport { useTranslation } from \"react-i18next\";\nimport { Add, Close } from '@mui/icons-material';\n\nimport Select from '../../../select/select';\nimport ChipOrPlaceholder from './chip-or-placeholder';\nimport Checkbox from '../../../checkbox/checkbox';\nimport Typography from '../../../typography/typography';\nimport Chip from '../../../chip/chip';\nimport { MoreIcon } from '../../../icons';\nimport { fetchApi } from '../../../../utils/api';\nimport { useLanguage } from '../../../../hooks/useLangauge';\nimport './element.scss';\n\n// Types\ninterface IOption {\n id: string | number;\n value: string | number;\n label: string | React.ReactNode;\n disabled?: boolean;\n isGroup?: boolean;\n options?: IOption[];\n searchLabel?: string;\n}\n\n\n\ninterface IMenuItemsProps extends MenuItemProps {\n options: IOption[];\n multiple: boolean;\n placeholder: string;\n with_checkboxes: boolean;\n values: string | string[];\n field: IDynamicSearchSelectProps;\n disabledIds: (string | number)[];\n onChange: (value: string | string[]) => void;\n handleChange?: (value: string | string[]) => void;\n hasParent: boolean;\n t: (key: string) => string;\n onFooterClick?: () => void;\n}\n\ninterface IDynamicSearchSelectProps {\n name: string;\n placeholder: string;\n label: string;\n size?: 'small' | 'medium';\n options: IOption[];\n formControl: Control<any>;\n defaultValue?: string | string[];\n fieldArrayName: string;\n id?: string;\n required?: boolean;\n is_multiselect?: boolean;\n position?: number;\n formType?: string;\n typeOfField?: string;\n disabled?: boolean;\n onChipRemove?: (value: string) => void;\n enable_footer?: boolean;\n footer_action?: string;\n onFooterClick?: () => void;\n is_loading?: boolean;\n selectedLabel?: string;\n isInternal?: boolean;\n disabledIds?: (string | number)[];\n getSelectedData?: (data: IOption | IOption[] | null, name: string) => void;\n attributes?: string[];\n handleChange?: (value: string | string[]) => void;\n hasParent?: boolean;\n sortOrder?: string;\n apiType?: string;\n handleOptions?: (value: any) => void;\n filterKey?: string;\n customeFilter?: Record<string, any>;\n refresh?: boolean;\n addType?: string;\n}\n\ninterface IPaginationState {\n page: number;\n hasMore: boolean;\n isLoadingMore: boolean;\n total: number;\n}\n\n// Helper function to generate menu items\nconst generateMenuItems = ({\n options,\n multiple,\n placeholder,\n with_checkboxes,\n values,\n field,\n disabledIds,\n onChange,\n handleChange,\n hasParent,\n t,\n onFooterClick\n}: IMenuItemsProps): React.ReactElement[] => {\n const itemDisabled = (id: string | number) => disabledIds?.includes(id);\n const items: React.ReactElement[] = [];\n\n if (!multiple) {\n items.push(\n <MenuItem disabled value='' key=\"placeholder\" sx={{ opacity: `0 !important`, height: `0 !important`, p: `0 !important`, m: `0 !important` }}>\n <Typography type='s3' color='theme.secondary.1000'>\n <em>{t(placeholder)}</em>\n </Typography>\n </MenuItem>\n );\n }\n const selectedValues = (Array.isArray(values) && values?.length > 0) ? values?.filter((value) => value) : values;\n\n const handleParentChange = (parentValue: string, childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n\n const isParentSelected = valueArray.includes(parentValue);\n const updatedValues = isParentSelected\n ? valueArray.filter((value) => value !== parentValue && !childValues.includes(value))\n : [...new Set([...valueArray, parentValue, ...childValues])];\n\n onChange(updatedValues);\n handleChange?.(updatedValues);\n };\n\n const isAllOptionsSelected = (parentValue: string, childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n return childValues.every((childValue) => valueArray.includes(childValue));\n };\n\n const isSomeOptionsSelected = (childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n return childValues.some((childValue) => valueArray.includes(childValue));\n };\n\n if (Array.isArray(options) && options.length > 0) {\n options.forEach((option) => {\n items.push(\n <MenuItem\n value={option.value}\n key={option.value}\n disabled={Boolean(option.disabled) || itemDisabled(option.id || option.value)}\n className={option.isGroup ? 'select--MenuItemHeader' : ''}\n >\n <Box sx={{ display: 'flex', gap: 1 }}>\n {multiple && with_checkboxes && (\n <Checkbox\n checked={\n hasParent\n ? isAllOptionsSelected(option.value, option.options || [])\n : Boolean(Array.isArray(selectedValues) ? selectedValues.includes(option.value) : selectedValues == option.value)\n }\n indeterminate={\n hasParent && isSomeOptionsSelected(option.options || [])\n }\n onChange={() => hasParent ? handleParentChange(option.value, option.options || []) : handleChange?.(option.value)}\n />\n )}\n <Typography\n type='s3'\n color='theme.secondary.1000'\n onClick={() => handleChange?.(option.value)}\n >\n {option.label}\n </Typography>\n </Box>\n </MenuItem>\n );\n\n if (option.isGroup && Array.isArray(option.options)) {\n option.options.forEach((opt) => {\n items.push(\n <MenuItem\n value={opt.value}\n disabled={Boolean(opt.disabled) || itemDisabled(opt.id || opt.value)}\n sx={{ pl: 5 }}\n key={`${option.value}-${opt.value}`}\n >\n <Box sx={{ display: 'flex', gap: 1 }}>\n {multiple && with_checkboxes && (\n <Checkbox\n checked={Boolean(Array.isArray(values) && values.includes(opt.value))}\n />\n )}\n <Typography\n type='s3'\n color='theme.secondary.1000'\n onClick={() => handleChange?.(String(opt.value))}\n >\n {opt.label == \"Payment Entries\" ? \"Payment and Collection Entries\" : opt.label || opt.value}\n </Typography>\n </Box>\n </MenuItem>\n );\n });\n }\n });\n }\n\n if (field.enable_footer) {\n items.push(\n <Box key=\"footer\">\n <Divider flexItem sx={{ mt: '0.25rem !important', mb: '0.25rem !important' }} />\n <MenuItem sx={{ gap: 1 }} onClick={onFooterClick}>\n <Add fontSize='small' />\n <Typography type='s4' color='theme.secondary.1000'>\n Create New {field.label}\n </Typography>\n </MenuItem>\n </Box>\n );\n }\n\n if (!items.length || (items.length == 1 && !multiple)) {\n items.push(\n <MenuItem disabled key=\"no-data\">\n No data available\n </MenuItem>\n );\n }\n\n return items;\n};\n\n// Selected items component\nconst SelectedItems: React.FC<{\n data: (string | number)[];\n options: IOption[];\n}> = ({ data, options }) => {\n const displayTitle = data.map(\n (selectedItem) =>\n options?.find((option) => option.value == selectedItem)?.label || ''\n );\n const filteredDisplayTitle = displayTitle.filter(Boolean);\n\n return (\n <Typography\n type='s4'\n color='inherit'\n sx={{ display: 'flex', gap: 1, alignItems: 'center', mt: 0.5 }}\n >\n {filteredDisplayTitle.slice(0, 4).join(', ')}\n {data.length > 4 && (\n <Chip variant='outlined' type='normal' label={<MoreIcon />} />\n )}\n </Typography>\n );\n};\n\nconst Loading = () => (\n <Typography fontStyle='italic' color='inherit' type='s3'>Loading...</Typography>\n)\n\nconst DynamicSearchSelect: React.FC<IDynamicSearchSelectProps> = React.memo((props) => {\n const watchedValue = useWatch({\n control: props.formControl,\n name: `${props.fieldArrayName}.${props.name}`\n });\n\n const formContext = useFormContext();\n const { setValue } = formContext || {};\n const { t } = useTranslation();\n const { isRtl } = useLanguage();\n const selectRef = useRef<HTMLDivElement>(null);\n\n // State management\n const [options, setOptions] = useState<IOption[]>([]);\n const [selectedValue, setSelectedValue] = useState<any>(null);\n const [selectedOptions, setSelectedOptions] = useState<IOption[]>([]);\n const [loading, setLoading] = useState<boolean>(false);\n const [open, setOpen] = useState<boolean>(false);\n const [isAlreadyLoaded, setIsAlreadyLoaded] = useState<boolean>(false);\n const [prevFilter, setPrevFilter] = useState<any>(null);\n const [initialLoading, setInitialLoading] = useState<boolean>(false);\n const [searchQuery, setSearchQuery] = useState<string>(\"\");\n const [searchInitiate, setSearchInitiate] = useState<boolean>(false);\n const [addConfig, setAddConfig] = useState<any>(null);\n\n // Modal states\n const [isModalOpen, setIsModalOpen] = useState<boolean>(false);\n const [isAddLoading, setIsAddLoading] = useState<boolean>(false);\n\n\n // Pagination state\n const [pagination, setPagination] = useState<IPaginationState>({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n\n // Props destructuring with defaults\n const {\n handleOptions,\n isInternal = false,\n disabledIds = [],\n getSelectedData,\n attributes = [],\n filterKey = 'id',\n customeFilter = {},\n refresh,\n handleChange,\n hasParent = false,\n sortOrder = 'id:-1',\n apiType,\n addType\n } = props;\n\n const limit = 25;\n\n // Memoized values\n const isInternalOptions = useMemo(() => {\n return isInternal || !apiType;\n }, [isInternal, apiType]);\n //eslint-disable-next-line\n const cf = useMemo(() => customeFilter, [JSON.stringify(customeFilter)]);\n\n // Local search function\n const searchOptionsLocally = useCallback((searchTerm: string, value: any): IOption[] => {\n if (!searchTerm) return props.options || [];\n\n const lowercasedSearchTerm = searchTerm.toLowerCase();\n\n const filteredOptions = hasParent\n ? props.options?.reduce((acc: IOption[], opt) => {\n const searchedOptions = opt.options?.filter((item) => {\n const label = React.isValidElement(item.label) ? item.searchLabel : String(item.label);\n return label?.toLowerCase().includes(lowercasedSearchTerm);\n });\n\n if (searchedOptions?.length) {\n acc.push({ ...opt, options: searchedOptions });\n }\n\n return acc;\n }, []) || []\n : props.options?.filter((opt) => {\n const label = React.isValidElement(opt.label) ? opt.searchLabel : String(opt.label);\n return label?.toLowerCase().includes(lowercasedSearchTerm);\n }) || [];\n //eslint-disable-next-line\n return sortBySelectedValues(filteredOptions, value);\n //eslint-disable-next-line\n }, [props.options, hasParent]);\n\n // Get unique options\n const getUniqueOptions = useCallback((data: IOption[]): IOption[] => {\n const uniqueOptions = [\n ...new Map(data?.map(item => [item.value, item])).values()\n ];\n return uniqueOptions;\n }, []);\n\n // Sort by selected values\n const sortBySelectedValues = useCallback((arrayToSort: IOption[], value: any): IOption[] => {\n const selectedValues = Array.isArray(value) ? value : [value];\n const sortedValue = sortBy(arrayToSort, (item) => {\n const index = selectedValues.indexOf(item.id || item.value);\n return index == -1 ? Infinity : index;\n });\n return sortedValue;\n }, []);\n\n // Filtered options with pagination support\n const filteredOptions = useMemo(() => {\n if (isInternalOptions) {\n return searchOptionsLocally(searchQuery, watchedValue);\n }\n return sortBySelectedValues(getUniqueOptions([...options, ...selectedOptions]), watchedValue);\n //eslint-disable-next-line\n }, [options, selectedOptions, isInternalOptions, props.options, watchedValue, searchQuery, searchOptionsLocally, sortBySelectedValues, getUniqueOptions]);\n\n // API Functions\n const fetchOptions = useCallback(async (searchTerm = '', flt = cf, page = 1, append = false) => {\n if (!apiType) return [];\n\n setLoading(true);\n if (page > 1) {\n setPagination(prev => ({ ...prev, isLoadingMore: true }));\n }\n\n try {\n const { data = [], pagination = {} } = await fetchApi({\n apiKey: apiType,\n filters: {\n limit,\n skip: (page - 1) * limit,\n search: searchTerm,\n filters: flt,\n select: attributes,\n order: sortOrder\n }\n });\n\n if (data && Array.isArray(data)) {\n const newOptions = append ? [...options, ...data] : data;\n updateOptions(newOptions, append);\n handleSelectedValue(data);\n // Update pagination\n setPagination(prev => ({\n ...prev,\n page,\n hasMore: pagination?.totalCount > (page * limit),\n total: pagination?.totalCount,\n isLoadingMore: false\n }));\n }\n\n return data || [];\n } catch (error) {\n console.error('Error fetching options:', error);\n setPagination(prev => ({ ...prev, isLoadingMore: false }));\n return [];\n } finally {\n setLoading(false);\n }\n //eslint-disable-next-line\n }, [apiType, options, attributes, sortOrder, limit, cf]);\n\n // Handle scroll pagination\n const handleScroll = useCallback((event: React.UIEvent<HTMLDivElement>) => {\n const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;\n const isBottom = scrollHeight - scrollTop <= clientHeight + 10;\n\n if (isBottom && pagination.hasMore && !pagination.isLoadingMore && !isInternalOptions) {\n const nextPage = pagination.page + 1;\n fetchOptions(searchQuery, cf, nextPage, true);\n }\n }, [pagination.hasMore, pagination.isLoadingMore, pagination.page, isInternalOptions, searchQuery, cf, fetchOptions]);\n\n // Update options\n const updateOptions = useCallback((newOptions: IOption[], append = false) => {\n const oldOptions = append ? options : selectedOptions;\n const uniqueOptions = getUniqueOptions([...oldOptions, ...newOptions]);\n setOptions(uniqueOptions);\n }, [options, selectedOptions, getUniqueOptions]);\n\n // Handle selected value\n const handleSelectedValue = useCallback(async (updateOptions: IOption[]) => {\n const filterValue = props.is_multiselect ? watchedValue : [watchedValue];\n const isInOptions = updateOptions?.filter((item) =>\n Array.isArray(filterValue) ? filterValue.includes(item.id || item.value) : (item[filterKey] || item.value || item.id) == filterValue\n );\n\n if (Array.isArray(isInOptions) && isInOptions.length > 0) {\n getSelectedData?.(props.is_multiselect ? isInOptions : isInOptions[0], props.name);\n return true;\n }\n return false;\n }, [props.is_multiselect, props.name, watchedValue, filterKey, getSelectedData]);\n\n // Fetch options by ID\n const fetchIdOptions = useCallback(async () => {\n if (open) return;\n if (await handleSelectedValue(filteredOptions)) return;\n\n const condition = props.is_multiselect ?\n Array.isArray(watchedValue) && watchedValue.length > 0 :\n Boolean(watchedValue);\n\n if (condition) {\n setInitialLoading(true);\n const response = await fetchOptions('', { ...cf, '&id.in': watchedValue }, 1, false);\n setInitialLoading(false);\n\n if (response.length == 0 && setValue && !isInternalOptions) {\n // setValue(`${props.fieldArrayName}.${props.name}`, props.is_multiselect ? [] : null);\n }\n }\n //eslint-disable-next-line\n }, [open, watchedValue, JSON.stringify(cf)]);\n\n // Initial fetch\n const initialFetch = useCallback(async () => {\n const condition = JSON.stringify(cf) !== JSON.stringify(prevFilter);\n\n if (condition) {\n setPrevFilter(cf);\n setOptions([]);\n setIsAlreadyLoaded(false);\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n }\n\n if (!isInternalOptions && !isAlreadyLoaded) {\n await fetchOptions(searchQuery, cf, 1, false);\n setIsAlreadyLoaded(true);\n }\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [cf, isInternalOptions, isAlreadyLoaded]);\n\n // Debounced search\n const debouncedSearch = useMemo(\n () => debounce(async (searchTerm: string) => {\n if (loading) return;\n\n if (!searchTerm && !isInternalOptions && searchInitiate) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n await fetchOptions('', cf, 1, false);\n }\n if (searchTerm.length > 1 && !isInternalOptions) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n await fetchOptions(searchTerm, cf, 1, false);\n }\n }, 700),\n //eslint-disable-next-line\n [isInternalOptions, searchInitiate, cf]\n );\n\n // Reset value function\n const resetValue = useCallback((field: any) => {\n field.onChange(props.is_multiselect ? [] : null);\n if (getSelectedData) {\n getSelectedData(null, props.name);\n }\n }, [props.is_multiselect, props.name, getSelectedData]);\n\n // Handle close\n const handleClose = useCallback(() => {\n setOpen(false);\n if (searchQuery.length > 0) {\n setIsAlreadyLoaded(false);\n }\n setSearchInitiate(false);\n setSearchQuery('');\n }, [searchQuery]);\n\n const handleModalOpen = useCallback(() => {\n setIsModalOpen(true);\n }, []);\n\n\n\n // Handle modal save\n const handleModalSave = useCallback(async (payload: any) => {\n if (!addConfig || !addConfig.api) {\n console.error('Add configuration is not properly set');\n return;\n }\n\n setIsAddLoading(true);\n try {\n const result = await addConfig.api(payload);\n console.log(\"result\", result);\n setIsAddLoading(false);\n setIsModalOpen(false);\n if (!isInternalOptions) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n setIsAlreadyLoaded(false);\n await fetchOptions('', cf, 1, false);\n }\n if (result && result.data) {\n const newValue = props.is_multiselect\n ? [...(watchedValue || []), result.data.id]\n : result.data.id;\n\n if (setValue) {\n setValue(`${props.fieldArrayName}.${props.name}`, newValue);\n }\n }\n } catch (error) {\n console.log(\"error\", error);\n setIsAddLoading(false);\n }\n\n\n }, [addConfig, isInternalOptions, fetchOptions, cf, props.is_multiselect, props.fieldArrayName, props.name, watchedValue, setValue]);\n\n // Effects\n useEffect(() => {\n if (handleOptions) {\n handleOptions(selectedValue);\n }\n }, [handleOptions, selectedValue]);\n\n useEffect(() => {\n if (open) {\n initialFetch();\n }\n }, [open, initialFetch]);\n\n useEffect(() => {\n fetchIdOptions();\n }, [fetchIdOptions]);\n\n useEffect(() => {\n if (refresh) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n fetchOptions('', cf, 1, false);\n }\n }, [refresh, fetchOptions, cf]);\n\n useEffect(() => {\n if (open) {\n debouncedSearch(searchQuery);\n }\n return () => debouncedSearch.cancel();\n }, [searchQuery, open, debouncedSearch]);\n\n useEffect(() => {\n if (watchedValue && !open) {\n const selectedData = options?.filter((item) =>\n props.is_multiselect ?\n Array.isArray(watchedValue) && watchedValue.includes(item.id || item.value) :\n (item.id || item.value) == watchedValue\n );\n setSelectedOptions(selectedData || []);\n }\n }, [watchedValue, options, props.is_multiselect, open]);\n\n const removeUndefined = useCallback((selectOptions: any[]) => {\n return Array.isArray(selectOptions) ? selectOptions.filter(Boolean) : [];\n }, []);\n\n useEffect(() => {\n const config = dynamicSelectAdd(addType);\n setAddConfig(config);\n }, [addType])\n\n\n return (\n <Controller\n control={props.formControl}\n name={`${props.fieldArrayName}.${props.name}`}\n render={({ field, fieldState }) => (\n <>\n {props.placeholder == 'Select Currency' && setSelectedValue(field.value)}\n <Select\n {...field}\n ref={selectRef}\n open={open}\n onOpen={() => setOpen(true)}\n onClose={handleClose}\n fullWidth\n dataPosition={props.position}\n dataName={`${props.fieldArrayName}.${props.name}`}\n placeholder={props.placeholder}\n label={props.label}\n defaultValue={props.defaultValue || (props.is_multiselect ? [] : '')}\n searchValue={searchQuery}\n required={props.formType == 'builder' ? false : props.required}\n size={props.size || 'small'}\n multiple={props.is_multiselect || false}\n disabled={props.disabled}\n sx={(props.is_multiselect && field?.value?.length) ? { \"& .MuiSelect-select\": { padding: '5.5px !important' } } : {}}\n variant='outlined'\n value={\n initialLoading\n ? (props.is_multiselect ? [] : '')\n : (field.value?.id || field.value || (props.is_multiselect ? [] : ''))\n }\n className={\n props.is_multiselect && removeUndefined(field.value)?.length\n ? 'MultiSelect filter-select'\n : ''\n }\n MenuProps={{\n PaperProps: {\n onScroll: handleScroll,\n style: { maxHeight: 300 }\n }\n }}\n renderValue={(selected: any) => {\n if (Array.isArray(selected)) {\n return (\n <ChipOrPlaceholder\n selectedLabel={props.selectedLabel}\n data={removeUndefined(selected)}\n placeholder={(loading || props.is_loading) ? <Loading /> : `${t('common.search')} ${props.label}`}\n onDelete={props.onChipRemove}\n disabled={props.disabled}\n chipProps={{\n sx: {\n background: '#ebf9f2',\n border: 0,\n // borderRadius: '15px',\n '& .MuiTypography-body1': {\n color: '#289b64',\n fontWeight: \"500\",\n }\n }\n }}\n />\n );\n } else {\n const selectedOption = filteredOptions.find(\n (option) => (option.value?.id || option.value) == selected\n );\n return (loading || props.is_loading) ? <Loading /> : selectedOption?.label ||\n (typeof props.label == 'string' ?\n `${t('common.search')} ${props.label}` :\n props.placeholder);\n }\n }}\n searchPlaceholder={`${t('common.search')} ${props.label}`}\n handleSearch={(text: string) => {\n setSearchQuery(text);\n setSearchInitiate(true);\n }}\n error={Boolean(fieldState.error?.message)}\n helperText={fieldState.error?.message || ''}\n onBlur={field.onBlur}\n input={\n <OutlinedInput\n label=''\n endAdornment={\n <InputAdornment position='end'>\n {(loading || props.is_loading) ? (\n <CircularProgress\n size={20}\n sx={{ mr: 3, color: \"#4AC08C\" }}\n />\n ) : (\n !props.disabled &&\n (props.is_multiselect ?\n (Array.isArray(field.value) && field.value.length > 0) :\n Boolean(field.value)) && (\n <IconButton\n aria-label='clear selection'\n onClick={() => resetValue(field)}\n edge='end'\n sx={isRtl ? { ml: 2.5 } : { mr: 1.5 }}\n size='small'\n >\n <Close sx={{ fontSize: '1rem' }} />\n </IconButton>\n )\n )}\n </InputAdornment>\n }\n />\n }\n >\n {generateMenuItems({\n options: filteredOptions,\n multiple: Boolean(props.is_multiselect),\n placeholder: props.placeholder,\n values: field.value,\n with_checkboxes: true,\n field: props,\n disabledIds,\n onChange: field.onChange,\n handleChange,\n hasParent,\n t,\n onFooterClick: () => {\n if (props?.onFooterClick) {\n props?.onFooterClick();\n } else {\n handleModalOpen();\n }\n }\n })}\n {pagination.isLoadingMore && (\n <MenuItem disabled>\n <Box sx={{ display: 'flex', justifyContent: 'center', width: '100%' }}>\n <CircularProgress size={20} />\n </Box>\n </MenuItem>\n )}\n </Select>\n\n {/* Modal for adding new items */}\n {addConfig && addConfig.component && (\n <>\n {React.createElement(addConfig.component, {\n isOpen: isModalOpen,\n setIsOpen: setIsModalOpen,\n isLoading: isAddLoading,\n onSave: handleModalSave,\n modalProps: {\n maxWidth: 'md',\n fullWidth: true\n }\n })}\n </>\n )}\n\n {props.is_multiselect && Array.isArray(field.value) && (\n <SelectedItems\n data={field.value}\n options={filteredOptions}\n />\n )}\n </>\n )}\n />\n );\n});\n\nDynamicSearchSelect.propTypes = {\n name: PropTypes.string.isRequired,\n placeholder: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n size: PropTypes.string,\n options: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n value: PropTypes.any\n })\n ).isRequired,\n formControl: PropTypes.object.isRequired,\n defaultValue: PropTypes.any,\n fieldArrayName: PropTypes.string.isRequired,\n id: PropTypes.string,\n required: PropTypes.bool,\n is_multiselect: PropTypes.bool,\n position: PropTypes.number,\n formType: PropTypes.string,\n typeOfField: PropTypes.string,\n disabled: PropTypes.bool,\n onChipRemove: PropTypes.func,\n enable_footer: PropTypes.bool,\n footer_action: PropTypes.string,\n onFooterClick: PropTypes.func,\n is_loading: PropTypes.bool,\n selectedLabel: PropTypes.string,\n isInternal: PropTypes.bool,\n disabledIds: PropTypes.array,\n getSelectedData: PropTypes.func,\n attributes: PropTypes.array,\n handleChange: PropTypes.func,\n hasParent: PropTypes.bool,\n sortOrder: PropTypes.string,\n apiType: PropTypes.string,\n handleOptions: PropTypes.func,\n filterKey: PropTypes.string,\n customeFilter: PropTypes.object,\n refresh: PropTypes.bool,\n addType: PropTypes.string\n};\n\nexport default DynamicSearchSelect;\n"],"names":["generateMenuItems","options","multiple","placeholder","with_checkboxes","values","field","disabledIds","onChange","handleChange","hasParent","t","onFooterClick","itemDisabled","id","includes","items","push","jsx","MenuItem","disabled","value","sx","opacity","height","p","m","children","Typography","type","color","selectedValues","Array","isArray","length","filter","isAllOptionsSelected","parentValue","childOptions","childValues","map","child","valueArray","every","childValue","isSomeOptionsSelected","some","forEach","option","Boolean","className","isGroup","jsxs","Box","display","gap","Checkbox","checked","indeterminate","updatedValues","Set","handleParentChange","onClick","label","opt","pl","String","enable_footer","Divider","flexItem","mt","mb","Add","fontSize","SelectedItems","data","filteredDisplayTitle","selectedItem","_a","find","alignItems","slice","join","Chip","variant","MoreIcon","Loading","fontStyle","DynamicSearchSelect","React","memo","props","watchedValue","useWatch","control","formControl","name","fieldArrayName","formContext","useFormContext","setValue","useTranslation","isRtl","useLanguage","selectRef","useRef","setOptions","useState","selectedValue","setSelectedValue","selectedOptions","setSelectedOptions","loading","setLoading","open","setOpen","isAlreadyLoaded","setIsAlreadyLoaded","prevFilter","setPrevFilter","initialLoading","setInitialLoading","searchQuery","setSearchQuery","searchInitiate","setSearchInitiate","addConfig","setAddConfig","isModalOpen","setIsModalOpen","isAddLoading","setIsAddLoading","pagination","setPagination","page","hasMore","isLoadingMore","total","handleOptions","isInternal","getSelectedData","attributes","filterKey","customeFilter","refresh","sortOrder","apiType","addType","isInternalOptions","useMemo","cf","JSON","stringify","searchOptionsLocally","useCallback","searchTerm","lowercasedSearchTerm","toLowerCase","filteredOptions","reduce","acc","searchedOptions","item","isValidElement","searchLabel","_b","sortBySelectedValues","getUniqueOptions","Map","arrayToSort","sortBy","index","indexOf","Infinity","fetchOptions","async","flt","append","prev","fetchApi","apiKey","filters","limit","skip","search","select","order","newOptions","updateOptions","handleSelectedValue","totalCount","error","handleScroll","event","scrollTop","scrollHeight","clientHeight","currentTarget","nextPage","uniqueOptions","filterValue","is_multiselect","isInOptions","fetchIdOptions","initialFetch","debouncedSearch","debounce","resetValue","handleClose","handleModalOpen","handleModalSave","payload","api","result","newValue","useEffect","cancel","selectedData","removeUndefined","selectOptions","config","dynamicSelectAdd","Controller","render","fieldState","Fragment","Select","ref","onOpen","onClose","fullWidth","dataPosition","position","dataName","defaultValue","searchValue","required","formType","size","padding","_c","MenuProps","PaperProps","onScroll","style","maxHeight","renderValue","selected","ChipOrPlaceholder","selectedLabel","is_loading","onDelete","onChipRemove","chipProps","background","border","fontWeight","selectedOption","searchPlaceholder","handleSearch","text","_d","message","helperText","_e","onBlur","input","OutlinedInput","endAdornment","InputAdornment","CircularProgress","mr","IconButton","edge","ml","Close","justifyContent","width","component","createElement","isOpen","setIsOpen","isLoading","onSave","modalProps","maxWidth","propTypes","PropTypes","string","isRequired","arrayOf","shape","oneOfType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1
|
import { __exports as createSvgIcon } from "../../../../../_virtual/createSvgIcon/index.esm.js";
|
|
2
|
-
import require$$0 from "../../../../../_virtual/index/index.
|
|
2
|
+
import require$$0 from "../../../../../_virtual/index/index.esm10.js";
|
|
3
3
|
var hasRequiredCreateSvgIcon;
|
|
4
4
|
function requireCreateSvgIcon() {
|
|
5
5
|
if (hasRequiredCreateSvgIcon) return createSvgIcon;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("../../../../../_virtual/createSvgIcon/index.js"),t=require("../../../../../_virtual/index/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("../../../../../_virtual/createSvgIcon/index.js"),t=require("../../../../../_virtual/index/index10.js");exports.__require=function(){return e||(e=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r.createSvgIcon}});var r=t.default}(r.__exports)),r.__exports};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@mui/icons-material/utils/createSvgIcon.js"],"sourcesContent":["\"use strict\";\n'use client';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function () {\n return _utils.createSvgIcon;\n }\n});\nvar _utils = require(\"@mui/material/utils\");"],"names":["Object","defineProperty","exports","value","enumerable","get","_utils","createSvgIcon","require$$0"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@mui/icons-material/utils/createSvgIcon.js"],"sourcesContent":["\"use strict\";\n'use client';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function () {\n return _utils.createSvgIcon;\n }\n});\nvar _utils = require(\"@mui/material/utils\");"],"names":["Object","defineProperty","exports","value","enumerable","get","_utils","createSvgIcon","require$$0"],"mappings":"oPAGAA,OAAOC,eAAcC,EAAU,aAAc,CAC3CC,OAAO,IAETH,OAAOC,eAAeC,EAAS,UAAW,CACxCE,YAAY,EACZC,IAAK,WACH,OAAOC,EAAOC,aAClB,IAEA,IAAID,EAASE,EAAAA","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __exports as colorManipulator } from "../../../../_virtual/colorManipulator/index.esm.js";
|
|
2
|
-
import require$$1 from "../../../../_virtual/index/index.
|
|
3
|
-
import require$$2 from "../../../../_virtual/index/index.
|
|
2
|
+
import require$$1 from "../../../../_virtual/index/index.esm2.js";
|
|
3
|
+
import require$$2 from "../../../../_virtual/index/index.esm3.js";
|
|
4
4
|
import { i as interopRequireDefaultExports } from "../../../@babel/runtime/helpers/interopRequireDefault/index.esm.js";
|
|
5
5
|
var _interopRequireDefault = interopRequireDefaultExports;
|
|
6
6
|
Object.defineProperty(colorManipulator, "__esModule", {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/colorManipulator/index.js"),r=require("../../../../_virtual/index/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/colorManipulator/index.js"),r=require("../../../../_virtual/index/index2.js"),t=require("../../../../_virtual/index/index3.js"),n=require("../../../@babel/runtime/helpers/interopRequireDefault/index.js").interopRequireDefaultExports;Object.defineProperty(e.__exports,"__esModule",{value:!0});var o=e.__exports.alpha=g;e.__exports.blend=function(e,r,t,n=1){const o=(e,r)=>Math.round((e**(1/n)*(1-t)+r**(1/n)*t)**n),s=_(e),a=_(r);return x({type:"rgb",values:[o(s.values[0],a.values[0]),o(s.values[1],a.values[1]),o(s.values[2],a.values[2])]})},e.__exports.colorChannel=void 0;var s=e.__exports.darken=y;e.__exports.decomposeColor=_;var a=e.__exports.emphasize=O,l=e.__exports.getContrastRatio=function(e,r){const t=d(e),n=d(r);return(Math.max(t,n)+.05)/(Math.min(t,n)+.05)};e.__exports.getLuminance=d,e.__exports.hexToRgb=f,e.__exports.hslToRgb=v;var p=e.__exports.lighten=b;e.__exports.private_safeAlpha=function(e,r,t){try{return g(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.private_safeColorChannel=void 0,e.__exports.private_safeDarken=function(e,r,t){try{return y(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.private_safeEmphasize=function(e,r,t){try{return O(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.private_safeLighten=function(e,r,t){try{return b(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.recomposeColor=x,e.__exports.rgbToHex=function(e){if(0===e.indexOf("#"))return e;const{values:r}=_(e);return`#${r.map((e,r)=>function(e){const r=e.toString(16);return 1===r.length?`0${r}`:r}(3===r?Math.round(255*e):e)).join("")}`};var u=n(r.default),i=n(t.default);function c(e,r=0,t=1){return process.env.NODE_ENV,(0,i.default)(e,r,t)}function f(e){e=e.slice(1);const r=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let t=e.match(r);return t&&1===t[0].length&&(t=t.map(e=>e+e)),t?`rgb${4===t.length?"a":""}(${t.map((e,r)=>r<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3).join(", ")})`:""}function _(e){if(e.type)return e;if("#"===e.charAt(0))return _(f(e));const r=e.indexOf("("),t=e.substring(0,r);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(t))throw new Error("production"!==process.env.NODE_ENV?`MUI: Unsupported \`${e}\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:(0,u.default)(9,e));let n,o=e.substring(r+1,e.length-1);if("color"===t){if(o=o.split(" "),n=o.shift(),4===o.length&&"/"===o[3].charAt(0)&&(o[3]=o[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(n))throw new Error("production"!==process.env.NODE_ENV?`MUI: unsupported \`${n}\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:(0,u.default)(10,n))}else o=o.split(",");return o=o.map(e=>parseFloat(e)),{type:t,values:o,colorSpace:n}}const h=e=>{const r=_(e);return r.values.slice(0,3).map((e,t)=>-1!==r.type.indexOf("hsl")&&0!==t?`${e}%`:e).join(" ")};function x(e){const{type:r,colorSpace:t}=e;let{values:n}=e;return-1!==r.indexOf("rgb")?n=n.map((e,r)=>r<3?parseInt(e,10):e):-1!==r.indexOf("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),n=-1!==r.indexOf("color")?`${t} ${n.join(" ")}`:`${n.join(", ")}`,`${r}(${n})`}function v(e){e=_(e);const{values:r}=e,t=r[0],n=r[1]/100,o=r[2]/100,s=n*Math.min(o,1-o),a=(e,r=(e+t/30)%12)=>o-s*Math.max(Math.min(r-3,9-r,1),-1);let l="rgb";const p=[Math.round(255*a(0)),Math.round(255*a(8)),Math.round(255*a(4))];return"hsla"===e.type&&(l+="a",p.push(r[3])),x({type:l,values:p})}function d(e){let r="hsl"===(e=_(e)).type||"hsla"===e.type?_(v(e)).values:e.values;return r=r.map(r=>("color"!==e.type&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*r[0]+.7152*r[1]+.0722*r[2]).toFixed(3))}function g(e,r){return e=_(e),r=c(r),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${r}`:e.values[3]=r,x(e)}function y(e,r){if(e=_(e),r=c(r),-1!==e.type.indexOf("hsl"))e.values[2]*=1-r;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let t=0;t<3;t+=1)e.values[t]*=1-r;return x(e)}function b(e,r){if(e=_(e),r=c(r),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*r;else if(-1!==e.type.indexOf("rgb"))for(let t=0;t<3;t+=1)e.values[t]+=(255-e.values[t])*r;else if(-1!==e.type.indexOf("color"))for(let t=0;t<3;t+=1)e.values[t]+=(1-e.values[t])*r;return x(e)}function O(e,r=.15){return d(e)>.5?y(e,r):b(e,r)}e.__exports.colorChannel=h,e.__exports.private_safeColorChannel=(e,r)=>{try{return h(e)}catch(t){return r&&process.env.NODE_ENV,e}},exports.default=e.__exports,exports.alpha=o,exports.darken=s,exports.emphasize=a,exports.getContrastRatio=l,exports.lighten=p;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../node_modules/@mui/system/colorManipulator.js"],"sourcesContent":["\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.alpha = alpha;\nexports.blend = blend;\nexports.colorChannel = void 0;\nexports.darken = darken;\nexports.decomposeColor = decomposeColor;\nexports.emphasize = emphasize;\nexports.getContrastRatio = getContrastRatio;\nexports.getLuminance = getLuminance;\nexports.hexToRgb = hexToRgb;\nexports.hslToRgb = hslToRgb;\nexports.lighten = lighten;\nexports.private_safeAlpha = private_safeAlpha;\nexports.private_safeColorChannel = void 0;\nexports.private_safeDarken = private_safeDarken;\nexports.private_safeEmphasize = private_safeEmphasize;\nexports.private_safeLighten = private_safeLighten;\nexports.recomposeColor = recomposeColor;\nexports.rgbToHex = rgbToHex;\nvar _formatMuiErrorMessage2 = _interopRequireDefault(require(\"@mui/utils/formatMuiErrorMessage\"));\nvar _clamp = _interopRequireDefault(require(\"@mui/utils/clamp\"));\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Returns a number whose value is limited to the given range.\n * @param {number} value The value to be clamped\n * @param {number} min The lower boundary of the output range\n * @param {number} max The upper boundary of the output range\n * @returns {number} A number in the range [min, max]\n */\nfunction clampWrapper(value, min = 0, max = 1) {\n if (process.env.NODE_ENV !== 'production') {\n if (value < min || value > max) {\n console.error(`MUI: The value provided ${value} is out of range [${min}, ${max}].`);\n }\n }\n return (0, _clamp.default)(value, min, max);\n}\n\n/**\n * Converts a color from CSS hex format to CSS rgb format.\n * @param {string} color - Hex color, i.e. #nnn or #nnnnnn\n * @returns {string} A CSS rgb color string\n */\nfunction hexToRgb(color) {\n color = color.slice(1);\n const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');\n let colors = color.match(re);\n if (colors && colors[0].length === 1) {\n colors = colors.map(n => n + n);\n }\n return colors ? `rgb${colors.length === 4 ? 'a' : ''}(${colors.map((n, index) => {\n return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000;\n }).join(', ')})` : '';\n}\nfunction intToHex(int) {\n const hex = int.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n}\n\n/**\n * Returns an object with the type and values of a color.\n *\n * Note: Does not support rgb % values.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {object} - A MUI color object: {type: string, values: number[]}\n */\nfunction decomposeColor(color) {\n // Idempotent\n if (color.type) {\n return color;\n }\n if (color.charAt(0) === '#') {\n return decomposeColor(hexToRgb(color));\n }\n const marker = color.indexOf('(');\n const type = color.substring(0, marker);\n if (['rgb', 'rgba', 'hsl', 'hsla', 'color'].indexOf(type) === -1) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `MUI: Unsupported \\`${color}\\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` : (0, _formatMuiErrorMessage2.default)(9, color));\n }\n let values = color.substring(marker + 1, color.length - 1);\n let colorSpace;\n if (type === 'color') {\n values = values.split(' ');\n colorSpace = values.shift();\n if (values.length === 4 && values[3].charAt(0) === '/') {\n values[3] = values[3].slice(1);\n }\n if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `MUI: unsupported \\`${colorSpace}\\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : (0, _formatMuiErrorMessage2.default)(10, colorSpace));\n }\n } else {\n values = values.split(',');\n }\n values = values.map(value => parseFloat(value));\n return {\n type,\n values,\n colorSpace\n };\n}\n\n/**\n * Returns a channel created from the input color.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {string} - The channel for the color, that can be used in rgba or hsla colors\n */\nconst colorChannel = color => {\n const decomposedColor = decomposeColor(color);\n return decomposedColor.values.slice(0, 3).map((val, idx) => decomposedColor.type.indexOf('hsl') !== -1 && idx !== 0 ? `${val}%` : val).join(' ');\n};\nexports.colorChannel = colorChannel;\nconst private_safeColorChannel = (color, warning) => {\n try {\n return colorChannel(color);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n};\n\n/**\n * Converts a color object with type and values to a string.\n * @param {object} color - Decomposed color\n * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'\n * @param {array} color.values - [n,n,n] or [n,n,n,n]\n * @returns {string} A CSS color string\n */\nexports.private_safeColorChannel = private_safeColorChannel;\nfunction recomposeColor(color) {\n const {\n type,\n colorSpace\n } = color;\n let {\n values\n } = color;\n if (type.indexOf('rgb') !== -1) {\n // Only convert the first 3 values to int (i.e. not alpha)\n values = values.map((n, i) => i < 3 ? parseInt(n, 10) : n);\n } else if (type.indexOf('hsl') !== -1) {\n values[1] = `${values[1]}%`;\n values[2] = `${values[2]}%`;\n }\n if (type.indexOf('color') !== -1) {\n values = `${colorSpace} ${values.join(' ')}`;\n } else {\n values = `${values.join(', ')}`;\n }\n return `${type}(${values})`;\n}\n\n/**\n * Converts a color from CSS rgb format to CSS hex format.\n * @param {string} color - RGB color, i.e. rgb(n, n, n)\n * @returns {string} A CSS rgb color string, i.e. #nnnnnn\n */\nfunction rgbToHex(color) {\n // Idempotent\n if (color.indexOf('#') === 0) {\n return color;\n }\n const {\n values\n } = decomposeColor(color);\n return `#${values.map((n, i) => intToHex(i === 3 ? Math.round(255 * n) : n)).join('')}`;\n}\n\n/**\n * Converts a color from hsl format to rgb format.\n * @param {string} color - HSL color values\n * @returns {string} rgb color values\n */\nfunction hslToRgb(color) {\n color = decomposeColor(color);\n const {\n values\n } = color;\n const h = values[0];\n const s = values[1] / 100;\n const l = values[2] / 100;\n const a = s * Math.min(l, 1 - l);\n const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n let type = 'rgb';\n const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];\n if (color.type === 'hsla') {\n type += 'a';\n rgb.push(values[3]);\n }\n return recomposeColor({\n type,\n values: rgb\n });\n}\n/**\n * The relative brightness of any point in a color space,\n * normalized to 0 for darkest black and 1 for lightest white.\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {number} The relative brightness of the color in the range 0 - 1\n */\nfunction getLuminance(color) {\n color = decomposeColor(color);\n let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;\n rgb = rgb.map(val => {\n if (color.type !== 'color') {\n val /= 255; // normalized\n }\n return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;\n });\n\n // Truncate at 3 digits\n return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));\n}\n\n/**\n * Calculates the contrast ratio between two colors.\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @returns {number} A contrast ratio value in the range 0 - 21.\n */\nfunction getContrastRatio(foreground, background) {\n const lumA = getLuminance(foreground);\n const lumB = getLuminance(background);\n return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);\n}\n\n/**\n * Sets the absolute transparency of a color.\n * Any existing alpha values are overwritten.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} value - value to set the alpha channel to in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction alpha(color, value) {\n color = decomposeColor(color);\n value = clampWrapper(value);\n if (color.type === 'rgb' || color.type === 'hsl') {\n color.type += 'a';\n }\n if (color.type === 'color') {\n color.values[3] = `/${value}`;\n } else {\n color.values[3] = value;\n }\n return recomposeColor(color);\n}\nfunction private_safeAlpha(color, value, warning) {\n try {\n return alpha(color, value);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Darkens a color.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction darken(color, coefficient) {\n color = decomposeColor(color);\n coefficient = clampWrapper(coefficient);\n if (color.type.indexOf('hsl') !== -1) {\n color.values[2] *= 1 - coefficient;\n } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] *= 1 - coefficient;\n }\n }\n return recomposeColor(color);\n}\nfunction private_safeDarken(color, coefficient, warning) {\n try {\n return darken(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Lightens a color.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction lighten(color, coefficient) {\n color = decomposeColor(color);\n coefficient = clampWrapper(coefficient);\n if (color.type.indexOf('hsl') !== -1) {\n color.values[2] += (100 - color.values[2]) * coefficient;\n } else if (color.type.indexOf('rgb') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] += (255 - color.values[i]) * coefficient;\n }\n } else if (color.type.indexOf('color') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] += (1 - color.values[i]) * coefficient;\n }\n }\n return recomposeColor(color);\n}\nfunction private_safeLighten(color, coefficient, warning) {\n try {\n return lighten(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Darken or lighten a color, depending on its luminance.\n * Light colors are darkened, dark colors are lightened.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient=0.15 - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction emphasize(color, coefficient = 0.15) {\n return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);\n}\nfunction private_safeEmphasize(color, coefficient, warning) {\n try {\n return emphasize(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Blend a transparent overlay color with a background color, resulting in a single\n * RGB color.\n * @param {string} background - CSS color\n * @param {string} overlay - CSS color\n * @param {number} opacity - Opacity multiplier in the range 0 - 1\n * @param {number} [gamma=1.0] - Gamma correction factor. For gamma-correct blending, 2.2 is usual.\n */\nfunction blend(background, overlay, opacity, gamma = 1.0) {\n const blendChannel = (b, o) => Math.round((b ** (1 / gamma) * (1 - opacity) + o ** (1 / gamma) * opacity) ** gamma);\n const backgroundColor = decomposeColor(background);\n const overlayColor = decomposeColor(overlay);\n const rgb = [blendChannel(backgroundColor.values[0], overlayColor.values[0]), blendChannel(backgroundColor.values[1], overlayColor.values[1]), blendChannel(backgroundColor.values[2], overlayColor.values[2])];\n return recomposeColor({\n type: 'rgb',\n values: rgb\n });\n}"],"names":["_interopRequireDefault","require$$0","Object","defineProperty","colorManipulator","value","alpha_1","alpha","blend","background","overlay","opacity","gamma","blendChannel","b","o","Math","round","backgroundColor","decomposeColor","overlayColor","recomposeColor","type","values","colorChannel","darken_1","darken","emphasize_1","emphasize","getContrastRatio_1","getContrastRatio","foreground","lumA","getLuminance","lumB","max","min","hexToRgb","hslToRgb","lighten_1","lighten","private_safeAlpha","color","warning","error","process","env","NODE_ENV","private_safeColorChannel","private_safeDarken","coefficient","private_safeEmphasize","private_safeLighten","rgbToHex","indexOf","map","n","i","int","hex","toString","length","intToHex","join","_formatMuiErrorMessage2","require$$1","_clamp","require$$2","clampWrapper","default","slice","re","RegExp","colors","match","index","parseInt","charAt","marker","substring","Error","colorSpace","split","shift","parseFloat","decomposedColor","val","idx","h","s","l","a","f","k","rgb","push","Number","toFixed"],"mappings":"yOAEIA,4EAAyBC,6BAC7BC,OAAOC,eAAeC,EAAAA,UAAS,aAAc,CAC3CC,OAAO,IAET,IAAAC,EAAAF,EAAAA,UAAAG,MAAgBA,EAChBH,EAAAA,UAAAI,MAmWA,SAAeC,EAAYC,EAASC,EAASC,EAAQ,GACnD,MAAMC,EAAe,CAACC,EAAGC,IAAMC,KAAKC,OAAOH,IAAM,EAAIF,IAAU,EAAID,GAAWI,IAAM,EAAIH,GAASD,IAAYC,GACvGM,EAAkBC,EAAeV,GACjCW,EAAeD,EAAeT,GAEpC,OAAOW,EAAe,CACpBC,KAAM,MACNC,OAHU,CAACV,EAAaK,EAAgBK,OAAO,GAAIH,EAAaG,OAAO,IAAKV,EAAaK,EAAgBK,OAAO,GAAIH,EAAaG,OAAO,IAAKV,EAAaK,EAAgB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AAWE,GAIP,OAHID,GAAWE,QAAQC,IAAIC,SAGpBL,CACX","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../node_modules/@mui/system/colorManipulator.js"],"sourcesContent":["\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.alpha = alpha;\nexports.blend = blend;\nexports.colorChannel = void 0;\nexports.darken = darken;\nexports.decomposeColor = decomposeColor;\nexports.emphasize = emphasize;\nexports.getContrastRatio = getContrastRatio;\nexports.getLuminance = getLuminance;\nexports.hexToRgb = hexToRgb;\nexports.hslToRgb = hslToRgb;\nexports.lighten = lighten;\nexports.private_safeAlpha = private_safeAlpha;\nexports.private_safeColorChannel = void 0;\nexports.private_safeDarken = private_safeDarken;\nexports.private_safeEmphasize = private_safeEmphasize;\nexports.private_safeLighten = private_safeLighten;\nexports.recomposeColor = recomposeColor;\nexports.rgbToHex = rgbToHex;\nvar _formatMuiErrorMessage2 = _interopRequireDefault(require(\"@mui/utils/formatMuiErrorMessage\"));\nvar _clamp = _interopRequireDefault(require(\"@mui/utils/clamp\"));\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Returns a number whose value is limited to the given range.\n * @param {number} value The value to be clamped\n * @param {number} min The lower boundary of the output range\n * @param {number} max The upper boundary of the output range\n * @returns {number} A number in the range [min, max]\n */\nfunction clampWrapper(value, min = 0, max = 1) {\n if (process.env.NODE_ENV !== 'production') {\n if (value < min || value > max) {\n console.error(`MUI: The value provided ${value} is out of range [${min}, ${max}].`);\n }\n }\n return (0, _clamp.default)(value, min, max);\n}\n\n/**\n * Converts a color from CSS hex format to CSS rgb format.\n * @param {string} color - Hex color, i.e. #nnn or #nnnnnn\n * @returns {string} A CSS rgb color string\n */\nfunction hexToRgb(color) {\n color = color.slice(1);\n const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');\n let colors = color.match(re);\n if (colors && colors[0].length === 1) {\n colors = colors.map(n => n + n);\n }\n return colors ? `rgb${colors.length === 4 ? 'a' : ''}(${colors.map((n, index) => {\n return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000;\n }).join(', ')})` : '';\n}\nfunction intToHex(int) {\n const hex = int.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n}\n\n/**\n * Returns an object with the type and values of a color.\n *\n * Note: Does not support rgb % values.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {object} - A MUI color object: {type: string, values: number[]}\n */\nfunction decomposeColor(color) {\n // Idempotent\n if (color.type) {\n return color;\n }\n if (color.charAt(0) === '#') {\n return decomposeColor(hexToRgb(color));\n }\n const marker = color.indexOf('(');\n const type = color.substring(0, marker);\n if (['rgb', 'rgba', 'hsl', 'hsla', 'color'].indexOf(type) === -1) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `MUI: Unsupported \\`${color}\\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` : (0, _formatMuiErrorMessage2.default)(9, color));\n }\n let values = color.substring(marker + 1, color.length - 1);\n let colorSpace;\n if (type === 'color') {\n values = values.split(' ');\n colorSpace = values.shift();\n if (values.length === 4 && values[3].charAt(0) === '/') {\n values[3] = values[3].slice(1);\n }\n if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `MUI: unsupported \\`${colorSpace}\\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : (0, _formatMuiErrorMessage2.default)(10, colorSpace));\n }\n } else {\n values = values.split(',');\n }\n values = values.map(value => parseFloat(value));\n return {\n type,\n values,\n colorSpace\n };\n}\n\n/**\n * Returns a channel created from the input color.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {string} - The channel for the color, that can be used in rgba or hsla colors\n */\nconst colorChannel = color => {\n const decomposedColor = decomposeColor(color);\n return decomposedColor.values.slice(0, 3).map((val, idx) => decomposedColor.type.indexOf('hsl') !== -1 && idx !== 0 ? `${val}%` : val).join(' ');\n};\nexports.colorChannel = colorChannel;\nconst private_safeColorChannel = (color, warning) => {\n try {\n return colorChannel(color);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n};\n\n/**\n * Converts a color object with type and values to a string.\n * @param {object} color - Decomposed color\n * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'\n * @param {array} color.values - [n,n,n] or [n,n,n,n]\n * @returns {string} A CSS color string\n */\nexports.private_safeColorChannel = private_safeColorChannel;\nfunction recomposeColor(color) {\n const {\n type,\n colorSpace\n } = color;\n let {\n values\n } = color;\n if (type.indexOf('rgb') !== -1) {\n // Only convert the first 3 values to int (i.e. not alpha)\n values = values.map((n, i) => i < 3 ? parseInt(n, 10) : n);\n } else if (type.indexOf('hsl') !== -1) {\n values[1] = `${values[1]}%`;\n values[2] = `${values[2]}%`;\n }\n if (type.indexOf('color') !== -1) {\n values = `${colorSpace} ${values.join(' ')}`;\n } else {\n values = `${values.join(', ')}`;\n }\n return `${type}(${values})`;\n}\n\n/**\n * Converts a color from CSS rgb format to CSS hex format.\n * @param {string} color - RGB color, i.e. rgb(n, n, n)\n * @returns {string} A CSS rgb color string, i.e. #nnnnnn\n */\nfunction rgbToHex(color) {\n // Idempotent\n if (color.indexOf('#') === 0) {\n return color;\n }\n const {\n values\n } = decomposeColor(color);\n return `#${values.map((n, i) => intToHex(i === 3 ? Math.round(255 * n) : n)).join('')}`;\n}\n\n/**\n * Converts a color from hsl format to rgb format.\n * @param {string} color - HSL color values\n * @returns {string} rgb color values\n */\nfunction hslToRgb(color) {\n color = decomposeColor(color);\n const {\n values\n } = color;\n const h = values[0];\n const s = values[1] / 100;\n const l = values[2] / 100;\n const a = s * Math.min(l, 1 - l);\n const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n let type = 'rgb';\n const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];\n if (color.type === 'hsla') {\n type += 'a';\n rgb.push(values[3]);\n }\n return recomposeColor({\n type,\n values: rgb\n });\n}\n/**\n * The relative brightness of any point in a color space,\n * normalized to 0 for darkest black and 1 for lightest white.\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {number} The relative brightness of the color in the range 0 - 1\n */\nfunction getLuminance(color) {\n color = decomposeColor(color);\n let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;\n rgb = rgb.map(val => {\n if (color.type !== 'color') {\n val /= 255; // normalized\n }\n return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;\n });\n\n // Truncate at 3 digits\n return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));\n}\n\n/**\n * Calculates the contrast ratio between two colors.\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @returns {number} A contrast ratio value in the range 0 - 21.\n */\nfunction getContrastRatio(foreground, background) {\n const lumA = getLuminance(foreground);\n const lumB = getLuminance(background);\n return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);\n}\n\n/**\n * Sets the absolute transparency of a color.\n * Any existing alpha values are overwritten.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} value - value to set the alpha channel to in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction alpha(color, value) {\n color = decomposeColor(color);\n value = clampWrapper(value);\n if (color.type === 'rgb' || color.type === 'hsl') {\n color.type += 'a';\n }\n if (color.type === 'color') {\n color.values[3] = `/${value}`;\n } else {\n color.values[3] = value;\n }\n return recomposeColor(color);\n}\nfunction private_safeAlpha(color, value, warning) {\n try {\n return alpha(color, value);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Darkens a color.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction darken(color, coefficient) {\n color = decomposeColor(color);\n coefficient = clampWrapper(coefficient);\n if (color.type.indexOf('hsl') !== -1) {\n color.values[2] *= 1 - coefficient;\n } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] *= 1 - coefficient;\n }\n }\n return recomposeColor(color);\n}\nfunction private_safeDarken(color, coefficient, warning) {\n try {\n return darken(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Lightens a color.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction lighten(color, coefficient) {\n color = decomposeColor(color);\n coefficient = clampWrapper(coefficient);\n if (color.type.indexOf('hsl') !== -1) {\n color.values[2] += (100 - color.values[2]) * coefficient;\n } else if (color.type.indexOf('rgb') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] += (255 - color.values[i]) * coefficient;\n }\n } else if (color.type.indexOf('color') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] += (1 - color.values[i]) * coefficient;\n }\n }\n return recomposeColor(color);\n}\nfunction private_safeLighten(color, coefficient, warning) {\n try {\n return lighten(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Darken or lighten a color, depending on its luminance.\n * Light colors are darkened, dark colors are lightened.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient=0.15 - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction emphasize(color, coefficient = 0.15) {\n return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);\n}\nfunction private_safeEmphasize(color, coefficient, warning) {\n try {\n return emphasize(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Blend a transparent overlay color with a background color, resulting in a single\n * RGB color.\n * @param {string} background - CSS color\n * @param {string} overlay - CSS color\n * @param {number} opacity - Opacity multiplier in the range 0 - 1\n * @param {number} [gamma=1.0] - Gamma correction factor. For gamma-correct blending, 2.2 is usual.\n */\nfunction blend(background, overlay, opacity, gamma = 1.0) {\n const blendChannel = (b, o) => Math.round((b ** (1 / gamma) * (1 - opacity) + o ** (1 / gamma) * opacity) ** gamma);\n const backgroundColor = decomposeColor(background);\n const overlayColor = decomposeColor(overlay);\n const rgb = [blendChannel(backgroundColor.values[0], overlayColor.values[0]), blendChannel(backgroundColor.values[1], overlayColor.values[1]), blendChannel(backgroundColor.values[2], overlayColor.values[2])];\n return recomposeColor({\n type: 'rgb',\n values: rgb\n });\n}"],"names":["_interopRequireDefault","require$$0","Object","defineProperty","colorManipulator","value","alpha_1","alpha","blend","background","overlay","opacity","gamma","blendChannel","b","o","Math","round","backgroundColor","decomposeColor","overlayColor","recomposeColor","type","values","colorChannel","darken_1","darken","emphasize_1","emphasize","getContrastRatio_1","getContrastRatio","foreground","lumA","getLuminance","lumB","max","min","hexToRgb","hslToRgb","lighten_1","lighten","private_safeAlpha","color","warning","error","process","env","NODE_ENV","private_safeColorChannel","private_safeDarken","coefficient","private_safeEmphasize","private_safeLighten","rgbToHex","indexOf","map","n","i","int","hex","toString","length","intToHex","join","_formatMuiErrorMessage2","require$$1","_clamp","require$$2","clampWrapper","default","slice","re","RegExp","colors","match","index","parseInt","charAt","marker","substring","Error","colorSpace","split","shift","parseFloat","decomposedColor","val","idx","h","s","l","a","f","k","rgb","push","Number","toFixed"],"mappings":"wOAEIA,4EAAyBC,6BAC7BC,OAAOC,eAAeC,EAAAA,UAAS,aAAc,CAC3CC,OAAO,IAET,IAAAC,EAAAF,EAAAA,UAAAG,MAAgBA,EAChBH,EAAAA,UAAAI,MAmWA,SAAeC,EAAYC,EAASC,EAASC,EAAQ,GACnD,MAAMC,EAAe,CAACC,EAAGC,IAAMC,KAAKC,OAAOH,IAAM,EAAIF,IAAU,EAAID,GAAWI,IAAM,EAAIH,GAASD,IAAYC,GACvGM,EAAkBC,EAAeV,GACjCW,EAAeD,EAAeT,GAEpC,OAAOW,EAAe,CACpBC,KAAM,MACNC,OAHU,CAACV,EAAaK,EAAgBK,OAAO,GAAIH,EAAaG,OAAO,IAAKV,EAAaK,EAAgBK,OAAO,GAAIH,EAAaG,OAAO,IAAKV,EAAaK,EAAgBK,OAAO,GAAIH,EAAaG,OAAO,MAK7M,EA3WAnB,EAAAA,UAAAoB,kBAAuB,EACvB,IAAAC,EAAArB,EAAAA,UAAAsB,OAAiBA,EACjBtB,EAAAA,UAAAe,eAAyBA,EACzB,IAAAQ,EAAAvB,EAAAA,UAAAwB,UAAoBA,EACpBC,EAAAzB,EAAAA,UAAA0B,iBA8NA,SAA0BC,EAAYtB,GACpC,MAAMuB,EAAOC,EAAaF,GACpB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A2C,IAA9BR,EAAMpB,KAAKgC,QAAQ,SAAiD,IAAhCZ,EAAMpB,KAAKgC,QAAQ,SAChE,IAAA,IAASG,EAAI,EAAGA,EAAI,EAAGA,GAAK,EAC1Bf,EAAMnB,OAAOkC,IAAM,EAAIP,EAG3B,OAAO7B,EAAeqB,EACxB,CAkBA,SAASF,EAAQE,EAAOQ,GAGtB,GAFAR,EAAQvB,EAAeuB,GACvBQ,EAAckB,EAAalB,IACO,IAA9BR,EAAMpB,KAAKgC,QAAQ,OACrBZ,EAAMnB,OAAO,KAAO,IAAMmB,EAAMnB,OAAO,IAAM2B,WACN,IAA9BR,EAAMpB,KAAKgC,QAAQ,OAC5B,IAAA,IAASG,EAAI,EAAGA,EAAI,EAAGA,GAAK,EAC1Bf,EAAMnB,OAAOkC,KAAO,IAAMf,EAAMnB,OAAOkC,IAAMP,WAEN,IAAhCR,EAAMpB,KAAKgC,QAAQ,SAC5B,IAAA,IAASG,EAAI,EAAGA,EAAI,EAAGA,GAAK,EAC1Bf,EAAMnB,OAAOkC,KAAO,EAAIf,EAAMnB,OAAOkC,IAAMP,EAG/C,OAAO7B,EAAeqB,EACxB,CAmBA,SAASd,EAAUc,EAAOQ,EAAc,KACtC,OAAOjB,EAAaS,GAAS,GAAMhB,EAAOgB,EAAOQ,GAAeV,EAAQE,EAAOQ,EACjF,CA/NA9C,EAAAA,UAAAoB,aAAuBA,EAmBvBpB,EAAAA,UAAA4C,yBAlBiC,CAACN,EAAOC,KACvC,IACE,OAAOnB,EAAakB,EACxB,OAAWE,GAIP,OAHID,GAAWE,QAAQC,IAAIC,SAGpBL,CACX","x_google_ignoreList":[0]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __exports as createStyled$1 } from "../../../../_virtual/createStyled/index.esm.js";
|
|
2
2
|
import { __require as require_extends } from "../../../@babel/runtime/helpers/extends/index.esm.js";
|
|
3
3
|
import { __require as requireObjectWithoutPropertiesLoose } from "../../../@babel/runtime/helpers/objectWithoutPropertiesLoose/index.esm.js";
|
|
4
|
-
import require$$1 from "../../../../_virtual/index/index.
|
|
5
|
-
import require$$4 from "../../../../_virtual/index/index.
|
|
6
|
-
import require$$5 from "../../../../_virtual/index/index.
|
|
7
|
-
import require$$6 from "../../../../_virtual/index/index.
|
|
8
|
-
import require$$7 from "../../../../_virtual/index/index.
|
|
9
|
-
import require$$8 from "../../../../_virtual/index/index.
|
|
4
|
+
import require$$1 from "../../../../_virtual/index/index.esm4.js";
|
|
5
|
+
import require$$4 from "../../../../_virtual/index/index.esm5.js";
|
|
6
|
+
import require$$5 from "../../../../_virtual/index/index.esm6.js";
|
|
7
|
+
import require$$6 from "../../../../_virtual/index/index.esm7.js";
|
|
8
|
+
import require$$7 from "../../../../_virtual/index/index.esm8.js";
|
|
9
|
+
import require$$8 from "../../../../_virtual/index/index.esm9.js";
|
|
10
10
|
import { i as interopRequireDefaultExports } from "../../../@babel/runtime/helpers/interopRequireDefault/index.esm.js";
|
|
11
11
|
var _interopRequireDefault = interopRequireDefaultExports;
|
|
12
12
|
Object.defineProperty(createStyled$1, "__esModule", {
|