@zydon/common 2.7.83 → 2.7.84
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/{chunk-LFZJKAV6.js → chunk-5PLCCVXS.js} +2 -2
- package/dist/chunk-A22V4WPA.js +19 -0
- package/dist/chunk-A22V4WPA.js.map +1 -0
- package/dist/chunk-CKYSHYJK.js +19 -0
- package/dist/chunk-CKYSHYJK.js.map +1 -0
- package/dist/components/Autocomplete/index.d.ts +1 -1
- package/dist/components/Autocomplete/index.js +1 -1
- package/dist/components/AutocompleteDetailed/index.d.ts +1 -1
- package/dist/components/AutocompleteDetailed/index.js +1 -1
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/BulkEditModal/index.js +2 -2
- package/dist/components/form/Address/index.js +2 -2
- package/dist/components/form/Autocomplete/index.js +2 -2
- package/dist/components/form/AutocompleteDetailed/index.js +1 -1
- package/dist/components/form/Webhook/index.js +2 -2
- package/dist/hooks/useAutocomplete.js +3 -3
- package/dist/hooks/useAutocomplete.js.map +1 -1
- package/dist/hooks/useSnackbar.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/theme/core/index.d.ts +1 -1
- package/dist/theme/styles/index.d.ts +13 -13
- package/package.json +1 -1
- package/dist/chunk-JWIITCIZ.js +0 -20
- package/dist/chunk-JWIITCIZ.js.map +0 -1
- package/dist/chunk-X2GWFMP4.js +0 -19
- package/dist/chunk-X2GWFMP4.js.map +0 -1
- package/dist/{chunk-LFZJKAV6.js.map → chunk-5PLCCVXS.js.map} +0 -0
- package/dist/{index-c8f1e6e7.d.ts → index-5a5e5dc8.d.ts} +12 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a } from './chunk-
|
|
1
|
+
import { a } from './chunk-CKYSHYJK.js';
|
|
2
2
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
@@ -6,4 +6,4 @@ var f=({name:t,helperText:l,rules:s,onSelectOption:e,InputLabelProps:a$1,...u})=
|
|
|
6
6
|
|
|
7
7
|
export { i as a };
|
|
8
8
|
//# sourceMappingURL=out.js.map
|
|
9
|
-
//# sourceMappingURL=chunk-
|
|
9
|
+
//# sourceMappingURL=chunk-5PLCCVXS.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { a } from './chunk-VR3K2Y2C.js';
|
|
2
|
+
import { b } from './chunk-RPO7AI5K.js';
|
|
3
|
+
import O, { forwardRef, useState, useMemo, useEffect } from 'react';
|
|
4
|
+
import be, { autocompleteClasses } from '@mui/material/Autocomplete';
|
|
5
|
+
import ge from '@mui/material/CircularProgress';
|
|
6
|
+
import he from '@mui/material/TextField';
|
|
7
|
+
import { VariableSizeList } from 'react-window';
|
|
8
|
+
import W from '@mui/material/Typography';
|
|
9
|
+
import oe from '@mui/material/Divider';
|
|
10
|
+
import L from '@mui/material/Stack';
|
|
11
|
+
import re from '@mui/material/Popper';
|
|
12
|
+
import { styled } from '@mui/material/styles';
|
|
13
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
|
+
|
|
15
|
+
var H=styled(re)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}}),D=styled(L)(({theme:e})=>({flex:1,width:"100%",gap:6,[e.breakpoints.down("md")]:{flexDirection:"column"},[e.breakpoints.up("md")]:{flexDirection:"row"}})),T=styled(L)(({theme:e})=>({flex:1,maxWidth:"100%",gap:6,[e.breakpoints.up("md")]:{flex:"1 1 calc(50% - 8px)",width:"calc(50% - 8px)",minWidth:"calc(50% - 8px)",maxWidth:"calc(50% - 8px)"}})),R=styled(L)(({theme:e})=>({position:"relative",alignItems:"center",justifyContent:"center",width:68,height:68,borderRadius:8,overflow:"hidden",img:{position:"absolute",width:"100%",height:"100%",objectFit:"cover"},[e.breakpoints.down("sm")]:{display:"none"}}));var ne=({option:e})=>{let t=Object.keys(e).filter(i=>i.startsWith("field")).map((i,s)=>{let a=e[i];if(a&&typeof a=="object"){let m="label"in a?a.label:null,u="value"in a?a.value:null;return jsxs(W,{component:"span",variant:"body2",color:"textPrimary",noWrap:!0,children:[m,": ",u]},`${i}:${s}`)}}),l=e.image?jsx("img",{alt:"Imagem",src:e.image}):jsx(a,{alt:e.label||e.value.toString(),name:e.label||e.value.toString(),sx:{width:68,height:68,borderRadius:1}});return jsxs(Fragment,{children:[jsxs(L,{direction:"row",gap:2,margin:2,children:[jsx(R,{children:l}),jsxs(L,{flex:1,overflow:"hidden",children:[jsxs(W,{variant:"subtitle2",color:"textPrimary",noWrap:!0,flex:1,children:[e.value," - ",e.label]}),t.length>0&&jsxs(D,{width:1,children:[jsxs(T,{children:[t[0]?t[0]:void 0,t[1]?t[1]:void 0]}),(t[2]||t[3])&&jsxs(T,{children:[t[2]?t[2]:void 0,t[3]?t[3]:void 0]})]})]})]}),jsx(oe,{className:"border",sx:{borderStyle:"dashed",position:"absolute",bottom:0,width:1}})]})},S=ne;var N=8,me=e=>{let{data:t,index:l,style:i}=e,s=t[l],a={...i,top:i.top+N,paddingTop:8,display:"block"};return jsx(W,{component:"li",...s.props,noWrap:!0,style:a,children:jsx(S,{...s?.props?.children?.props})})},X=O.createContext({}),B=forwardRef((e,t)=>{let l=O.useContext(X);return jsx("div",{ref:t,...e,...l})});B.displayName="OuterElementType";var pe=e=>{let t=O.useRef(null);return useEffect(()=>{t.current!=null&&t.current.resetAfterIndex(0,!0);},[e]),t},de=forwardRef(function(t,l){let{children:i,"data-item-height":s,...a}=t,m=[];i.forEach(p=>{m.push(p),m.push(...p.children||[]);});let u=m.length,h=s>112?s:112,y=p=>Object.prototype.hasOwnProperty.call(p,"group")?48:h,b=()=>u>8?8*h:m.map(y).reduce((p,c)=>p+c,0),C=pe(u);return jsx("div",{ref:l,children:jsx(X.Provider,{value:a,children:jsx(VariableSizeList,{itemData:m,height:b()+2*N,width:"100%",ref:C,outerElementType:B,innerElementType:"ul",itemSize:p=>y(m[p]),overscanCount:5,itemCount:u,children:me})})})}),J=de;var j=forwardRef(({name:e,label:t,value:l,options:i=[],loading:s,noOptionsText:a="Nenhum resultado encontrado.",loadingText:m="Carregando op\xE7\xF5es...",error:u,helperText:h,placeholder:y,onChange:b$1,groupBy:C,disabled:p,multiple:c,required:G,renderOption:U,tabIndex:V,onSearch:P,onInputChange:w,..._},F)=>{let[q,I]=useState(),K=b("down","md"),Q=o=>o&&typeof o=="object"?o.value.toString():o.toString(),Y=useMemo(()=>c?(Array.isArray(l)?l:[]).reduce((r,A)=>{let E=i.find(ee=>ee.value.toString()===A.toString());return E?[...r,E]:[...r]},[]):i.find(n=>n.value.toString()===l?.toString())||null,[i,l,c]),Z=K&&i[0]?Object.keys(i[0]).length*24:void 0;return jsx(be,{ref:F,value:q||Y,onInputChange:(o,n,r)=>{if(w&&w(o,n,r),r==="input"){P&&P(n),I(n);return}I(void 0);},options:i,loading:s,noOptionsText:a,loadingText:m,disabled:s||p,disableListWrap:!0,PopperComponent:H,ListboxProps:{"data-item-height":Z},ListboxComponent:U?void 0:J,filterOptions:(o,n)=>o.filter(r=>`${r.field1?.value} ${r.field1?.label} ${r.field2?.label} ${r.field2?.value} ${r.field3?.label} ${r.field3?.value} ${r.field4?.label} ${r.field4?.value} ${r.field5?.label} ${r.field5?.value} ${r.label}${r.value}`.toLocaleUpperCase().includes(n.inputValue.toLocaleUpperCase())),onChange:(o,n)=>{if(!n){b$1(c?[]:null);return}if(Array.isArray(n)){b$1(n.map(Q));return}b$1(typeof n=="string"?n.toString():n.value.toString());},renderOption:({key:o,...n},r)=>jsx("li",{...n,style:{display:"block"},children:jsx(S,{option:r})},o),renderGroup:o=>o,groupBy:C,multiple:c,renderInput:o=>jsx(he,{...o,name:e,placeholder:y,fullWidth:!0,error:!!u,helperText:h,label:t,required:G,InputProps:{...o.InputProps,endAdornment:jsxs(Fragment,{children:[s?jsx(ge,{color:"primary",size:20}):null,o.InputProps.endAdornment]})},inputProps:{...o.inputProps,name:e,tabIndex:V}}),..._})});j.displayName="Autocomplete";var Ke=j;
|
|
16
|
+
|
|
17
|
+
export { Ke as a };
|
|
18
|
+
//# sourceMappingURL=out.js.map
|
|
19
|
+
//# sourceMappingURL=chunk-A22V4WPA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AutocompleteDetailed/index.tsx","../src/components/AutocompleteDetailed/Listbox.tsx","../src/components/AutocompleteDetailed/ListItem.tsx","../src/components/AutocompleteDetailed/styles.ts"],"names":["forwardRef","useMemo","useState","MuiAutocomplete","CircularProgress","TextField","React","useEffect","VariableSizeList","Typography","Divider","Stack","autocompleteClasses","Popper","styled","StyledPopper","OptionBox","theme","OptionContent","ImageContainer","Fragment","jsx","jsxs","ListItem","option","options","key","index","data","label","value","image","CustomAvatar_default","ListItem_default","LISTBOX_PADDING","renderRow","props","style","dataSet","inlineStyle","OuterElementContext","OuterElementType","ref","outerProps","useResetCache","ListboxComponent","children","dataItemHeight","other","itemData","item","itemCount","itemSize","getChildSize","child","getHeight","a","b","gridRef","Listbox_default","AutocompleteDetailed","name","loading","noOptionsText","loadingText","error","helperText","placeholder","onChange","groupBy","disabled","multiple","required","renderOption","tabIndex","onSearch","onInputChange","inputValue","setInputValue","mdDown","useResponsive_default","getOptionValue","optionValue","formattedValue","acc","curr","opt","OPTION_HEIGHT","event","eventValue","reason","opts","state","_","params","AutocompleteDetailed_default"],"mappings":"gFAAA,OACE,cAAAA,GAGA,WAAAC,GACA,YAAAC,OACK,QACP,OAAOC,OAAqB,6BAC5B,OAAOC,OAAsB,iCAC7B,OAAOC,OAAe,0BCTtB,OAAOC,GAAS,cAAAN,EAA4B,aAAAO,OAAiB,QAC7D,OAAkC,oBAAAC,OAAwB,eAC1D,OAAOC,OAAgB,2BCFvB,OAAOC,OAAa,wBACpB,OAAOC,MAAW,sBAClB,OAAOF,MAAgB,2BCFvB,OAAS,uBAAAG,OAA2B,6BACpC,OAAOC,OAAY,uBACnB,OAA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ACzB4C,EAAS5C,EAAO,IAAIyD,CAAc,CAAC,EACnC,OAGFb,EACE,OAAO5C,GAAW,SACdA,EAAO,SAAS,EAChBA,EAAO,MAAM,SAAS,CAC5B,CACF,EACA,aAAc,CAAC,CAAE,IAAAE,EAAK,GAAGU,CAAM,EAAGZ,IAE9BH,EAAC,MAAc,GAAGe,EAAO,MAAO,CAAE,QAAS,OAAQ,EACjD,SAAAf,EAACY,EAAA,CAAS,OAAQT,EAAQ,GADnBE,CAET,EAGJ,YAAaoE,GAAUA,EACvB,QAASzB,EACT,SAAUE,EACV,YAAauB,GACXzE,EAAChB,GAAA,CACE,GAAGyF,EACJ,KAAMjC,EACN,YAAaM,EACb,UAAS,GACT,MAAO,CAAC,CAACF,EACT,WAAYC,EACZ,MAAOrC,EACP,SAAU2C,EACV,WAAY,CACV,GAAGsB,EAAO,WACV,aACExE,GAAAF,GAAA,CACG,UAAA0C,EACCzC,EAACjB,GAAA,CAAiB,MAAM,UAAU,KAAM,GAAI,EAC1C,KACH0F,EAAO,WAAW,cACrB,CAEJ,EACA,WAAY,CACV,GAAGA,EAAO,WACV,KAAAjC,EACA,SAAAa,CACF,EACF,EAED,GAAG1B,EACN,CAEJ,CACF,EAEAY,EAAqB,YAAc,eAEnC,IAAOmC,GAAQnC","sourcesContent":["import {\n forwardRef,\n HTMLAttributes,\n ReactNode,\n useMemo,\n useState,\n} from 'react';\nimport MuiAutocomplete from '@mui/material/Autocomplete';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport TextField from '@mui/material/TextField';\n\nimport useResponsive from 'hooks/useResponsive';\nimport { Option } from 'types/option';\n\nimport ListboxComponent from './Listbox';\nimport ListItem from './ListItem';\nimport { AutocompleteDetailedProps } from './props';\nimport { StyledPopper } from './styles';\n\nconst AutocompleteDetailed = forwardRef<unknown, AutocompleteDetailedProps>(\n (\n {\n name,\n label,\n value,\n options = [],\n loading,\n noOptionsText = 'Nenhum resultado encontrado.',\n loadingText = 'Carregando opções...',\n error,\n helperText,\n placeholder,\n onChange,\n groupBy,\n disabled,\n multiple,\n required,\n renderOption,\n tabIndex,\n onSearch,\n onInputChange,\n ...other\n },\n ref,\n ) => {\n const [inputValue, setInputValue] = useState<string>();\n\n const mdDown = useResponsive('down', 'md');\n\n const getOptionValue = (optionValue: Option | string | number) =>\n optionValue && typeof optionValue === 'object'\n ? optionValue.value.toString()\n : optionValue.toString();\n\n const formattedValue = useMemo(() => {\n if (multiple) {\n const values = Array.isArray(value) ? value : [];\n\n return values.reduce<Option[]>((acc, curr) => {\n const item = options.find(\n opt => opt.value.toString() === curr.toString(),\n );\n\n if (item) return [...acc, item];\n\n return [...acc];\n }, []);\n }\n\n const item = options.find(\n opt => opt.value.toString() === value?.toString(),\n );\n\n return item || null;\n }, [options, value, multiple]);\n\n const OPTION_HEIGHT =\n mdDown && options[0] ? Object.keys(options[0]).length * 24 : undefined;\n\n return (\n <MuiAutocomplete\n ref={ref}\n value={inputValue || formattedValue}\n onInputChange={(event, eventValue, reason) => {\n if (onInputChange) onInputChange(event, eventValue, reason);\n\n if (reason === 'input') {\n if (onSearch) onSearch(eventValue);\n setInputValue(eventValue);\n\n return;\n }\n\n setInputValue(undefined);\n }}\n options={options}\n loading={loading}\n noOptionsText={noOptionsText}\n loadingText={loadingText}\n disabled={loading || disabled}\n disableListWrap\n PopperComponent={StyledPopper}\n ListboxProps={\n {\n 'data-item-height': OPTION_HEIGHT,\n } as HTMLAttributes<HTMLUListElement>\n }\n ListboxComponent={renderOption ? undefined : ListboxComponent}\n filterOptions={(opts: Option[], state) => {\n return opts.filter(opt => {\n const search = `${opt.field1?.value} ${opt.field1?.label} ${opt.field2?.label} ${opt.field2?.value} ${opt.field3?.label} ${opt.field3?.value} ${opt.field4?.label} ${opt.field4?.value} ${opt.field5?.label} ${opt.field5?.value} ${opt.label}${opt.value}`;\n return search\n .toLocaleUpperCase()\n .includes(state.inputValue.toLocaleUpperCase());\n });\n }}\n onChange={(_, option) => {\n if (!option) {\n onChange(multiple ? [] : null);\n return;\n }\n\n if (Array.isArray(option)) {\n onChange(option.map(getOptionValue));\n return;\n }\n\n onChange(\n typeof option === 'string'\n ? option.toString()\n : option.value.toString(),\n );\n }}\n renderOption={({ key, ...props }, option) => {\n return (\n <li key={key} {...props} style={{ display: 'block' }}>\n <ListItem option={option} />\n </li>\n );\n }}\n renderGroup={params => params as unknown as ReactNode}\n groupBy={groupBy}\n multiple={multiple}\n renderInput={params => (\n <TextField\n {...params}\n name={name}\n placeholder={placeholder}\n fullWidth\n error={!!error}\n helperText={helperText}\n label={label}\n required={required}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {loading ? (\n <CircularProgress color=\"primary\" size={20} />\n ) : null}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n inputProps={{\n ...params.inputProps,\n name,\n tabIndex,\n }}\n />\n )}\n {...other}\n />\n );\n },\n);\n\nAutocompleteDetailed.displayName = 'Autocomplete';\n\nexport default AutocompleteDetailed;\n","import React, { forwardRef, HTMLAttributes, useEffect } from 'react';\nimport { ListChildComponentProps, VariableSizeList } from 'react-window';\nimport Typography from '@mui/material/Typography';\n\nimport ListItem from './ListItem';\n\nconst LISTBOX_PADDING = 8;\n\nconst renderRow = (props: ListChildComponentProps) => {\n const { data, index, style } = props;\n const dataSet = data[index];\n\n const inlineStyle = {\n ...style,\n top: (style.top as number) + LISTBOX_PADDING,\n paddingTop: 8,\n display: 'block',\n };\n\n return (\n <Typography component=\"li\" {...dataSet.props} noWrap style={inlineStyle}>\n <ListItem {...dataSet?.props?.children?.props} />\n </Typography>\n );\n};\n\nconst OuterElementContext = React.createContext({});\n\nconst OuterElementType = forwardRef<HTMLDivElement>((props, ref) => {\n const outerProps = React.useContext(OuterElementContext);\n return <div ref={ref} {...props} {...outerProps} />;\n});\n\nOuterElementType.displayName = 'OuterElementType';\n\nconst useResetCache = (data: number) => {\n const ref = React.useRef<VariableSizeList>(null);\n\n useEffect(() => {\n if (ref.current != null) {\n ref.current.resetAfterIndex(0, true);\n }\n }, [data]);\n\n return ref;\n};\n\nconst ListboxComponent = forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLElement>\n>(function ListboxComponent(props, ref) {\n const {\n children,\n // eslint-disable-next-line react/prop-types\n 'data-item-height': dataItemHeight,\n ...other\n } = props as { 'data-item-height': number } & HTMLAttributes<HTMLElement>;\n const itemData: JSX.Element[] = [];\n (children as JSX.Element[]).forEach(\n (item: JSX.Element & { children?: JSX.Element[] }) => {\n itemData.push(item);\n itemData.push(...(item.children || []));\n },\n );\n const itemCount = itemData.length;\n const itemSize = dataItemHeight > 112 ? dataItemHeight : 112;\n\n const getChildSize = (child: JSX.Element) => {\n if (Object.prototype.hasOwnProperty.call(child, 'group')) {\n return 48;\n }\n\n return itemSize;\n };\n\n const getHeight = () => {\n if (itemCount > 8) {\n return 8 * itemSize;\n }\n return itemData.map(getChildSize).reduce((a, b) => a + b, 0);\n };\n\n const gridRef = useResetCache(itemCount);\n\n return (\n <div ref={ref}>\n <OuterElementContext.Provider value={other}>\n <VariableSizeList\n itemData={itemData}\n height={getHeight() + 2 * LISTBOX_PADDING}\n width=\"100%\"\n ref={gridRef}\n outerElementType={OuterElementType}\n innerElementType=\"ul\"\n itemSize={index => getChildSize(itemData[index])}\n overscanCount={5}\n itemCount={itemCount}\n >\n {renderRow}\n </VariableSizeList>\n </OuterElementContext.Provider>\n </div>\n );\n});\n\nexport default ListboxComponent;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport CustomAvatar from 'components/CustomAvatar';\n\nimport { ListItemProps } from './props';\nimport { ImageContainer, OptionBox, OptionContent } from './styles';\n\nconst ListItem = ({ option }: ListItemProps) => {\n const options = Object.keys(option)\n .filter(key => key.startsWith('field'))\n .map((key, index) => {\n const data = option[key];\n\n if (data && typeof data === 'object') {\n const label = ('label' in data ? data.label : null) as string;\n const value = ('value' in data ? data.value : null) as string;\n\n return (\n <Typography\n key={`${key}:${index}`}\n component=\"span\"\n variant=\"body2\"\n color=\"textPrimary\"\n noWrap\n >\n {label}: {value}\n </Typography>\n );\n }\n });\n\n const image = option.image ? (\n <img alt=\"Imagem\" src={option.image} />\n ) : (\n <CustomAvatar\n alt={option.label || option.value.toString()}\n name={option.label || option.value.toString()}\n sx={{ width: 68, height: 68, borderRadius: 1 }}\n />\n );\n\n return (\n <>\n <Stack direction=\"row\" gap={2} margin={2}>\n <ImageContainer>{image}</ImageContainer>\n\n <Stack flex={1} overflow=\"hidden\">\n <Typography variant=\"subtitle2\" color=\"textPrimary\" noWrap flex={1}>\n {option.value} - {option.label}\n </Typography>\n\n {options.length > 0 && (\n <OptionBox width={1}>\n <OptionContent>\n {options[0] ? options[0] : undefined}\n {options[1] ? options[1] : undefined}\n </OptionContent>\n\n {(options[2] || options[3]) && (\n <OptionContent>\n {options[2] ? options[2] : undefined}\n {options[3] ? options[3] : undefined}\n </OptionContent>\n )}\n </OptionBox>\n )}\n </Stack>\n </Stack>\n\n <Divider\n className=\"border\"\n sx={{\n borderStyle: 'dashed',\n position: 'absolute',\n bottom: 0,\n width: 1,\n }}\n />\n </>\n );\n};\n\nexport default ListItem;\n","import { autocompleteClasses } from '@mui/material/Autocomplete';\nimport Popper from '@mui/material/Popper';\nimport Stack from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\n\nexport const StyledPopper = styled(Popper)({\n [`& .${autocompleteClasses.listbox}`]: {\n boxSizing: 'border-box',\n '& ul': {\n padding: 0,\n margin: 0,\n },\n },\n});\n\nexport const OptionBox = styled(Stack)(({ theme }) => ({\n flex: 1,\n width: '100%',\n gap: 6,\n\n [theme.breakpoints.down('md')]: {\n flexDirection: 'column',\n },\n\n [theme.breakpoints.up('md')]: {\n flexDirection: 'row',\n },\n}));\n\nexport const OptionContent = styled(Stack)(({ theme }) => ({\n flex: 1,\n maxWidth: '100%',\n gap: 6,\n\n [theme.breakpoints.up('md')]: {\n flex: '1 1 calc(50% - 8px)',\n width: 'calc(50% - 8px)',\n minWidth: 'calc(50% - 8px)',\n maxWidth: 'calc(50% - 8px)',\n },\n}));\n\nexport const ImageContainer = styled(Stack)(({ theme }) => ({\n position: 'relative',\n alignItems: 'center',\n justifyContent: 'center',\n width: 68,\n height: 68,\n borderRadius: 8,\n overflow: 'hidden',\n\n img: {\n position: 'absolute',\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n },\n\n [theme.breakpoints.down('sm')]: {\n display: 'none',\n },\n}));\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { a } from './chunk-VPG46WNM.js';
|
|
2
|
+
import { createContext, forwardRef, useContext, useState, useMemo, useRef, useEffect } from 'react';
|
|
3
|
+
import le, { autocompleteClasses } from '@mui/material/Autocomplete';
|
|
4
|
+
import ae from '@mui/material/CircularProgress';
|
|
5
|
+
import ce from '@mui/material/TextField';
|
|
6
|
+
import { VariableSizeList } from 'react-window';
|
|
7
|
+
import K from '@mui/material/ListSubheader';
|
|
8
|
+
import Y from '@mui/material/Stack';
|
|
9
|
+
import { useTheme, styled } from '@mui/material/styles';
|
|
10
|
+
import I from '@mui/material/Typography';
|
|
11
|
+
import ee from '@mui/material/useMediaQuery';
|
|
12
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
13
|
+
import ie from '@mui/material/Popper';
|
|
14
|
+
|
|
15
|
+
var k=8,te=u=>{let{data:o,index:n,style:m}=u,r=o[n],{showValueInLabel:i,key:d,...y}=r[0],l={...m,top:m.top+k,paddingTop:8};return Object.prototype.hasOwnProperty.call(r,"group")?jsx(K,{component:"div",style:l,children:r.group},`list-box-item-group-${d}`):jsx(I,{component:"li",...y,noWrap:!0,style:l,children:jsxs(Y,{component:"div",direction:"row",flex:1,gap:1,justifyContent:"start",children:[r[1].icon&&jsx(a,{icon:r[1].icon}),r[1].label,i&&jsxs(I,{variant:"inherit",color:"grey.400",children:["(",r[1].value,")"]})]})},`list-box-item-${d}`)},z=createContext({}),M=forwardRef((u,o)=>{let n=useContext(z);return jsx("div",{ref:o,...u,...n})});M.displayName="OuterElementType";var re=u=>{let o=useRef(null);return useEffect(()=>{o.current!=null&&o.current.resetAfterIndex(0,!0);},[u]),o},oe=forwardRef(function(o,n){let{children:m,...r}=o,i=[];m.forEach(s=>{i.push(s),i.push(...s.children||[]);});let d=useTheme(),y=ee(d.breakpoints.up("sm")),l=i.length,b=y?36:48,f=s=>Object.prototype.hasOwnProperty.call(s,"group")?48:b,L=()=>l>8?8*b:i.map(f).reduce((s,a)=>s+a,0),P=re(l);return jsx("div",{ref:n,children:jsx(z.Provider,{value:r,children:jsx(VariableSizeList,{itemData:i,height:L()+2*k,width:"100%",ref:P,outerElementType:M,innerElementType:"ul",itemSize:s=>f(i[s]),overscanCount:5,itemCount:l,children:te})})})}),N=oe;var D=styled(ie)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}});var H=forwardRef(({name:u,label:o,value:n,options:m=[],loading:r,noOptionsText:i="Nenhum resultado encontrado.",loadingText:d="Carregando op\xE7\xF5es...",error:y,helperText:l,placeholder:b,onChange:f,groupBy:L,showValueInLabel:P,disabled:s,multiple:a$1,required:X,renderOption:x,tabIndex:J,onInputChange:A,onSearch:v,onBlur:E,InputLabelProps:$,...V},U)=>{let[W,T]=useState(),j=e=>e&&typeof e=="object"?e.value.toString():e.toString(),g=useMemo(()=>a$1?(Array.isArray(n)?n:[]).reduce((p,h)=>{let O=m.find(B=>B.value.toString()===h.toString());return O?[...p,O]:[...p]},[]):m.find(t=>t.value.toString()===n?.toString())||null,[m,n,a$1]);return jsx(le,{ref:U,value:W||g,onInputChange:(e,t,p)=>{if(A&&A(e,t,p),p==="input"){v&&(v(t),T(t));return}T(void 0);},options:m,loading:r,noOptionsText:i,loadingText:d,disabled:r||s,disableListWrap:!0,PopperComponent:D,ListboxComponent:x?void 0:N,filterOptions:(e,t)=>e.filter(p=>`${p.value} ${p.label}`.toLocaleUpperCase().includes(t.inputValue.toLocaleUpperCase())),onChange:(e,t)=>{if(!t){f(a$1?[]:null);return}if(Array.isArray(t)){f(t.map(j));return}f(typeof t=="string"?t.toString():t.value.toString());},onBlur:e=>{E&&E(e),T(void 0);},renderOption:(e,t,p,h)=>x?x(e,t,p,h):[{...e,showValueInLabel:P},t],renderGroup:e=>e,groupBy:L,multiple:a$1,renderInput:e=>jsx(ce,{...e,name:u,placeholder:b,fullWidth:!0,error:!!y,helperText:l,label:o,required:X,InputProps:{...e.InputProps,...!a$1&&{startAdornment:g&&!Array.isArray(g)&&g.icon?jsx(a,{icon:g.icon}):void 0},endAdornment:jsxs(Fragment,{children:[r?jsx(ae,{color:"primary",size:20}):null,e.InputProps.endAdornment]})},inputProps:{...e.inputProps,name:u,tabIndex:J},InputLabelProps:$}),...V})});H.displayName="Autocomplete";var Je=H;
|
|
16
|
+
|
|
17
|
+
export { Je as a };
|
|
18
|
+
//# sourceMappingURL=out.js.map
|
|
19
|
+
//# sourceMappingURL=chunk-CKYSHYJK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Autocomplete/index.tsx","../src/components/Autocomplete/Listbox.tsx","../src/components/Autocomplete/styles.ts"],"names":["forwardRef","useMemo","useState","MuiAutocomplete","CircularProgress","TextField","createContext","useContext","useEffect","useRef","VariableSizeList","ListSubheader","Stack","useTheme","Typography","useMediaQuery","jsx","jsxs","LISTBOX_PADDING","renderRow","props","data","index","style","dataSet","showValueInLabel","key","itemProps","inlineStyle","Icon_default","OuterElementContext","OuterElementType","ref","outerProps","useResetCache","ListboxComponent","children","other","itemData","item","theme","smUp","itemCount","itemSize","getChildSize","child","getHeight","a","b","gridRef","Listbox_default","autocompleteClasses","Popper","styled","StyledPopper","Fragment","Autocomplete","name","label","value","options","loading","noOptionsText","loadingText","error","helperText","placeholder","onChange","groupBy","disabled","multiple","required","renderOption","tabIndex","onInputChange","onSearch","onBlur","InputLabelProps","inputValue","setInputValue","getOptionValue","optionValue","formattedValue","acc","curr","opt","event","eventValue","re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b,UAAS,GACT,MAAO,CAAC,CAACF,EACT,WAAYC,EACZ,MAAOP,EACP,SAAUa,EACV,WAAY,CACV,GAAGuB,EAAO,WACV,GAAI,CAACxB,GAAY,CACf,eACEY,GACA,CAAC,MAAM,QAAQA,CAAc,GAC7BA,EAAe,KACblE,EAACa,EAAA,CAAK,KAAMqD,EAAe,KAAM,EAC/B,MACR,EACA,aACEjE,GAAAsC,GAAA,CACG,UAAAM,EACC7C,EAACZ,GAAA,CAAiB,MAAM,UAAU,KAAM,GAAI,EAC1C,KACH0F,EAAO,WAAW,cACrB,CAEJ,EACA,WAAY,CACV,GAAGA,EAAO,WACV,KAAArC,EACA,SAAAgB,CACF,EACA,gBAAiBI,EACnB,EAED,GAAGxC,EACN,CAEJ,CACF,EAEAmB,EAAa,YAAc,eAE3B,IAAOuC,GAAQvC","sourcesContent":["import { forwardRef, ReactNode, useMemo, useState } from 'react';\nimport MuiAutocomplete from '@mui/material/Autocomplete';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport TextField from '@mui/material/TextField';\n\nimport { AutocompleteProps } from 'types/autoCompleteProps';\nimport { Option } from 'types/option';\n\nimport Icon from '../Icon';\n\nimport ListboxComponent from './Listbox';\nimport { StyledPopper } from './styles';\n\nconst Autocomplete = forwardRef<unknown, AutocompleteProps>(\n (\n {\n name,\n label,\n value,\n options = [],\n loading,\n noOptionsText = 'Nenhum resultado encontrado.',\n loadingText = 'Carregando opções...',\n error,\n helperText,\n placeholder,\n onChange,\n groupBy,\n showValueInLabel,\n disabled,\n multiple,\n required,\n renderOption,\n tabIndex,\n onInputChange,\n onSearch,\n onBlur,\n InputLabelProps,\n ...other\n },\n ref,\n ) => {\n const [inputValue, setInputValue] = useState<string>();\n\n const getOptionValue = (optionValue: Option | string | number) =>\n optionValue && typeof optionValue === 'object'\n ? optionValue.value.toString()\n : optionValue.toString();\n\n const formattedValue = useMemo(() => {\n if (multiple) {\n const values = Array.isArray(value) ? value : [];\n\n return values.reduce<Option[]>((acc, curr) => {\n const item = options.find(\n opt => opt.value.toString() === curr.toString(),\n );\n\n if (item) return [...acc, item];\n\n return [...acc];\n }, []);\n }\n\n const item = options.find(\n opt => opt.value.toString() === value?.toString(),\n );\n\n return item || null;\n }, [options, value, multiple]);\n\n return (\n <MuiAutocomplete\n ref={ref}\n value={inputValue || formattedValue}\n onInputChange={(event, eventValue, reason) => {\n if (onInputChange) onInputChange(event, eventValue, reason);\n\n if (reason === 'input') {\n if (onSearch) {\n onSearch(eventValue);\n setInputValue(eventValue);\n }\n\n return;\n }\n\n setInputValue(undefined);\n }}\n options={options}\n loading={loading}\n noOptionsText={noOptionsText}\n loadingText={loadingText}\n disabled={loading || disabled}\n disableListWrap\n PopperComponent={StyledPopper}\n ListboxComponent={renderOption ? undefined : ListboxComponent}\n filterOptions={(optionsFilter, state) => {\n return optionsFilter.filter(opt => {\n const search = `${opt.value} ${opt.label}`;\n\n return search\n .toLocaleUpperCase()\n .includes(state.inputValue.toLocaleUpperCase());\n });\n }}\n onChange={(_, option) => {\n if (!option) {\n onChange(multiple ? [] : null);\n return;\n }\n\n if (Array.isArray(option)) {\n onChange(option.map(getOptionValue));\n return;\n }\n\n onChange(\n typeof option === 'string'\n ? option.toString()\n : option.value.toString(),\n );\n }}\n onBlur={event => {\n if (onBlur) onBlur(event);\n setInputValue(undefined);\n }}\n renderOption={(props, option, state, ownerState) =>\n renderOption\n ? renderOption(props, option, state, ownerState)\n : ([{ ...props, showValueInLabel }, option] as ReactNode)\n }\n renderGroup={params => params as unknown as ReactNode}\n groupBy={groupBy}\n multiple={multiple}\n renderInput={params => (\n <TextField\n {...params}\n name={name}\n placeholder={placeholder}\n fullWidth\n error={!!error}\n helperText={helperText}\n label={label}\n required={required}\n InputProps={{\n ...params.InputProps,\n ...(!multiple && {\n startAdornment:\n formattedValue &&\n !Array.isArray(formattedValue) &&\n formattedValue.icon ? (\n <Icon icon={formattedValue.icon} />\n ) : undefined,\n }),\n endAdornment: (\n <>\n {loading ? (\n <CircularProgress color=\"primary\" size={20} />\n ) : null}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n inputProps={{\n ...params.inputProps,\n name,\n tabIndex,\n }}\n InputLabelProps={InputLabelProps}\n />\n )}\n {...other}\n />\n );\n },\n);\n\nAutocomplete.displayName = 'Autocomplete';\n\nexport default Autocomplete;\n","import {\n createContext,\n forwardRef,\n HTMLAttributes,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport { ListChildComponentProps, VariableSizeList } from 'react-window';\nimport ListSubheader from '@mui/material/ListSubheader';\nimport Stack from '@mui/material/Stack';\nimport { useTheme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport Icon from '../Icon';\n\nconst LISTBOX_PADDING = 8;\n\nconst renderRow = (props: ListChildComponentProps) => {\n const { data, index, style } = props;\n const dataSet = data[index];\n const { showValueInLabel, key, ...itemProps } = dataSet[0];\n\n const inlineStyle = {\n ...style,\n top: (style.top as number) + LISTBOX_PADDING,\n paddingTop: 8,\n };\n\n if (Object.prototype.hasOwnProperty.call(dataSet, 'group'))\n return (\n <ListSubheader\n key={`list-box-item-group-${key}`}\n component=\"div\"\n style={inlineStyle}\n >\n {dataSet.group}\n </ListSubheader>\n );\n\n return (\n <Typography\n component=\"li\"\n key={`list-box-item-${key}`}\n {...itemProps}\n noWrap\n style={inlineStyle}\n >\n <Stack\n component=\"div\"\n direction=\"row\"\n flex={1}\n gap={1}\n justifyContent=\"start\"\n >\n {dataSet[1].icon && <Icon icon={dataSet[1].icon} />}\n {dataSet[1].label}\n\n {showValueInLabel && (\n <Typography variant=\"inherit\" color=\"grey.400\">\n ({dataSet[1].value})\n </Typography>\n )}\n </Stack>\n </Typography>\n );\n};\n\nconst OuterElementContext = createContext({});\n\nconst OuterElementType = forwardRef<HTMLDivElement>((props, ref) => {\n const outerProps = useContext(OuterElementContext);\n return <div ref={ref} {...props} {...outerProps} />;\n});\n\nOuterElementType.displayName = 'OuterElementType';\n\nconst useResetCache = (data: number) => {\n const ref = useRef<VariableSizeList>(null);\n\n useEffect(() => {\n if (ref.current != null) {\n ref.current.resetAfterIndex(0, true);\n }\n }, [data]);\n\n return ref;\n};\n\nconst ListboxComponent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLElement>\n>(function ListboxComponent(props, ref) {\n const { children, ...other } = props;\n const itemData: JSX.Element[] = [];\n (children as JSX.Element[]).forEach(\n (item: JSX.Element & { children?: JSX.Element[] }) => {\n itemData.push(item);\n itemData.push(...(item.children || []));\n },\n );\n\n const theme = useTheme();\n const smUp = useMediaQuery(theme.breakpoints.up('sm'));\n const itemCount = itemData.length;\n const itemSize = smUp ? 36 : 48;\n\n const getChildSize = (child: JSX.Element) => {\n if (Object.prototype.hasOwnProperty.call(child, 'group')) {\n return 48;\n }\n\n return itemSize;\n };\n\n const getHeight = () => {\n if (itemCount > 8) {\n return 8 * itemSize;\n }\n return itemData.map(getChildSize).reduce((a, b) => a + b, 0);\n };\n\n const gridRef = useResetCache(itemCount);\n\n return (\n <div ref={ref}>\n <OuterElementContext.Provider value={other}>\n <VariableSizeList\n itemData={itemData}\n height={getHeight() + 2 * LISTBOX_PADDING}\n width=\"100%\"\n ref={gridRef}\n outerElementType={OuterElementType}\n innerElementType=\"ul\"\n itemSize={index => getChildSize(itemData[index])}\n overscanCount={5}\n itemCount={itemCount}\n >\n {renderRow}\n </VariableSizeList>\n </OuterElementContext.Provider>\n </div>\n );\n});\n\nexport default ListboxComponent;\n","import { autocompleteClasses } from '@mui/material/Autocomplete';\nimport Popper from '@mui/material/Popper';\nimport { styled } from '@mui/material/styles';\n\nexport const StyledPopper = styled(Popper)({\n [`& .${autocompleteClasses.listbox}`]: {\n boxSizing: 'border-box',\n '& ul': {\n padding: 0,\n margin: 0,\n },\n },\n});\n"]}
|
|
@@ -6,6 +6,6 @@ import '@mui/material/Autocomplete';
|
|
|
6
6
|
import '../../types/option.js';
|
|
7
7
|
import '../../types/icon.js';
|
|
8
8
|
|
|
9
|
-
declare const Autocomplete: react.
|
|
9
|
+
declare const Autocomplete: react.ForwardRefExoticComponent<Omit<AutocompleteProps, "ref"> & react.RefAttributes<unknown>>;
|
|
10
10
|
|
|
11
11
|
export { Autocomplete as default };
|
|
@@ -13,6 +13,6 @@ type AutocompleteDetailedProps = BaseAutoComplete & {
|
|
|
13
13
|
showValueInLabel?: boolean;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
declare const AutocompleteDetailed: react.
|
|
16
|
+
declare const AutocompleteDetailed: react.ForwardRefExoticComponent<Omit<AutocompleteDetailedProps, "ref"> & react.RefAttributes<unknown>>;
|
|
17
17
|
|
|
18
18
|
export { AutocompleteDetailed as default };
|
|
@@ -11,7 +11,7 @@ interface ImageContainerProps {
|
|
|
11
11
|
|
|
12
12
|
declare const Avatar: react.MemoExoticComponent<react.ForwardRefExoticComponent<Omit<PropsWithChildren<ImageContainerProps & _mui_material_Avatar.AvatarOwnProps & _mui_material_Avatar.AvatarSlotsAndSlotProps & _mui_material_OverridableComponent.CommonProps & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
13
13
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
|
14
|
-
}, "children" | "className" | "style" | "classes" | "sx" | "variant" | "slots" | "slotProps" | "
|
|
14
|
+
}, "children" | "className" | "style" | "classes" | "sx" | "variant" | "slots" | "slotProps" | "sizes" | "alt" | "src" | "srcSet" | "imgProps"> & {
|
|
15
15
|
component?: react.ElementType<any, keyof react.JSX.IntrinsicElements> | undefined;
|
|
16
16
|
}>, "ref"> & react.RefAttributes<HTMLDivElement>>>;
|
|
17
17
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a } from '../../chunk-
|
|
1
|
+
import { a } from '../../chunk-5PLCCVXS.js';
|
|
2
2
|
import { j as j$1 } from '../../chunk-TB4Y7LXN.js';
|
|
3
3
|
import '../../chunk-UVPQR2Q2.js';
|
|
4
4
|
import { a as a$1 } from '../../chunk-RBTYTONM.js';
|
|
5
5
|
import { a as a$3 } from '../../chunk-I4PPSW36.js';
|
|
6
|
-
import '../../chunk-
|
|
6
|
+
import '../../chunk-CKYSHYJK.js';
|
|
7
7
|
import { a as a$2 } from '../../chunk-VPG46WNM.js';
|
|
8
8
|
import '../../chunk-CIGSMWKF.js';
|
|
9
9
|
import { memo, useEffect, useState, useMemo, useCallback } from 'react';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as a$1 } from '../../../chunk-X64QHBVQ.js';
|
|
2
2
|
import { a as a$2 } from '../../../chunk-YXRL4O4H.js';
|
|
3
3
|
import '../../../chunk-RTC7H5E5.js';
|
|
4
|
-
import { a as a$3 } from '../../../chunk-
|
|
5
|
-
import '../../../chunk-
|
|
4
|
+
import { a as a$3 } from '../../../chunk-5PLCCVXS.js';
|
|
5
|
+
import '../../../chunk-CKYSHYJK.js';
|
|
6
6
|
import '../../../chunk-VPG46WNM.js';
|
|
7
7
|
import '../../../chunk-CIGSMWKF.js';
|
|
8
8
|
import E from '@mui/material/CircularProgress';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { a as default } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
1
|
+
export { a as default } from '../../../chunk-5PLCCVXS.js';
|
|
2
|
+
import '../../../chunk-CKYSHYJK.js';
|
|
3
3
|
import '../../../chunk-VPG46WNM.js';
|
|
4
4
|
import '../../../chunk-CIGSMWKF.js';
|
|
5
5
|
//# sourceMappingURL=out.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a } from '../../../chunk-YXRL4O4H.js';
|
|
2
|
-
import { a as a$2 } from '../../../chunk-
|
|
2
|
+
import { a as a$2 } from '../../../chunk-5PLCCVXS.js';
|
|
3
3
|
import { a as a$3 } from '../../../chunk-E6NUW3KZ.js';
|
|
4
|
-
import '../../../chunk-
|
|
4
|
+
import '../../../chunk-CKYSHYJK.js';
|
|
5
5
|
import { a as a$1 } from '../../../chunk-VPG46WNM.js';
|
|
6
6
|
import '../../../chunk-CIGSMWKF.js';
|
|
7
7
|
import { useFormContext, useFieldArray } from 'react-hook-form';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useState
|
|
1
|
+
import { useState } from 'react';
|
|
2
2
|
import { debounce } from '@mui/material/utils';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var h=d=>{let[o,i]=useState(!1),[s,l]=useState(),[p,a]=useState(),O=debounce(e=>{l(e),i(!1);},500),S=e=>{e&&i(!0),O(e);},c=()=>{i(!1),l(void 0);};return {search:s,searching:o,buildOptions:(e=[],r=!1)=>{let t=p||d;if(!t||s!==void 0)return e.filter(n=>n.value!==null&&n.value!==void 0);if(o||r)return [];let f=[...Array.isArray(t)?t:[t],...e];return Array.from(new Set(f.map(n=>n.value))).map(n=>f.find(m=>m.value===n)).filter(n=>n.value!==null&&n.value!==void 0)},onSearch:S,onSelectValue:(e=[],r)=>{if(!r||Array.isArray(r)&&r.length===0){a(void 0);return}Array.isArray(r)?a(e.filter(t=>r.includes(t.value))):a(e.find(t=>t.value===r)),c();},finishSearch:c}},w=h;
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { w as default };
|
|
7
7
|
//# sourceMappingURL=out.js.map
|
|
8
8
|
//# sourceMappingURL=useAutocomplete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useAutocomplete.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useAutocomplete.ts"],"names":["useState","debounce","useAutocomplete","initialValue","searching","setSearching","search","setSearch","selectedValue","setSelectedValue","debouncedSetSearch","onSearch","term","finishSearch","options","fetching","value","opt","combinedOptions","uniqueValue","selected","useAutocomplete_default"],"mappings":"AAAA,OAAS,YAAAA,MAAgB,QACzB,OAAS,YAAAC,MAAgB,sBAIzB,IAAMC,EAAmBC,GAAqC,CAC5D,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UG,CAAQ,CAAC,EAG9DP,EAAa,CACf,EAQE,aAAAA,CACF,CACF,EAEOQ,EAAQnB","sourcesContent":["import { useState } from 'react';\nimport { debounce } from '@mui/material/utils';\n\nimport { Option } from 'types/option';\n\nconst useAutocomplete = (initialValue?: Option | Option[]) => {\n const [searching, setSearching] = useState(false);\n const [search, setSearch] = useState<string>();\n const [selectedValue, setSelectedValue] = useState<Option | Option[]>();\n\n const debouncedSetSearch = debounce((search?: string) => {\n setSearch(search);\n setSearching(false);\n }, 500);\n\n const onSearch = (term?: string) => {\n if (term) setSearching(true);\n debouncedSetSearch(term);\n };\n\n const finishSearch = () => {\n setSearching(false);\n setSearch(undefined);\n };\n\n const buildOptions = (options: Option[] = [], fetching = false) => {\n const value = selectedValue || initialValue;\n\n if (!value || search !== undefined)\n return options.filter(\n opt => opt.value !== null && opt.value !== undefined,\n );\n\n if (searching || fetching) return [];\n\n const selectedArray = Array.isArray(value) ? value : [value];\n const combinedOptions = [...selectedArray, ...options];\n\n return (\n Array.from(new Set(combinedOptions.map(opt => opt.value))).map(\n uniqueValue => combinedOptions.find(opt => opt.value === uniqueValue),\n ) as Option[]\n ).filter(opt => opt.value !== null && opt.value !== undefined);\n };\n\n const onSelectValue = (options: Option[] = [], selected: unknown) => {\n if (!selected || (Array.isArray(selected) && selected.length === 0)) {\n setSelectedValue(undefined);\n return;\n }\n\n if (Array.isArray(selected)) {\n setSelectedValue(\n options.filter(opt => selected.includes(opt.value as string)),\n );\n } else {\n setSelectedValue(options.find(opt => opt.value === selected));\n }\n\n finishSearch();\n };\n\n return {\n search,\n searching,\n buildOptions,\n onSearch,\n onSelectValue,\n finishSearch,\n };\n};\n\nexport default useAutocomplete;\n"]}
|
|
@@ -12,7 +12,6 @@ declare const useSnackbar: () => {
|
|
|
12
12
|
custom: (jsx: (id: string | number) => react.ReactElement<any, string | react.JSXElementConstructor<any>>, data?: ExternalToast | undefined) => string | number;
|
|
13
13
|
message: (message: string | number | boolean | react.ReactElement<any, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | react.ReactPortal | (() => ReactNode) | null | undefined, data?: ExternalToast | undefined) => string | number;
|
|
14
14
|
promise: <ToastData>(promise: Promise<ToastData> | (() => Promise<ToastData>), data?: ({
|
|
15
|
-
cancel?: ReactNode | sonner.Action;
|
|
16
15
|
className?: string | undefined;
|
|
17
16
|
style?: react.CSSProperties | undefined;
|
|
18
17
|
position?: ("top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right") | undefined;
|
|
@@ -21,6 +20,7 @@ declare const useSnackbar: () => {
|
|
|
21
20
|
icon?: ReactNode;
|
|
22
21
|
duration?: number | undefined;
|
|
23
22
|
onDismiss?: ((toast: sonner.ToastT) => void) | undefined;
|
|
23
|
+
cancel?: ReactNode | sonner.Action;
|
|
24
24
|
richColors?: boolean | undefined;
|
|
25
25
|
invert?: boolean | undefined;
|
|
26
26
|
closeButton?: boolean | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CustomShadows } from './index-
|
|
2
|
-
export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from './index-
|
|
1
|
+
import { C as CustomShadows } from './index-5a5e5dc8.js';
|
|
2
|
+
export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from './index-5a5e5dc8.js';
|
|
3
3
|
export { S as SettingsContextValue, _ as SettingsProvider, T as ThemeProviderProps, u as useSettingsContext } from './settings-provider-38d09283.js';
|
|
4
4
|
export { THEME_CONFIG, default as ThemeProvider } from './theme/theme-provider.js';
|
|
5
5
|
import { S as SettingsState } from './settings-583c107c.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from '../../index-
|
|
1
|
+
export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from '../../index-5a5e5dc8.js';
|
|
2
2
|
import '@mui/lab/TimelineConnector';
|
|
3
3
|
import '@mui/system';
|
|
4
4
|
import '@mui/lab/TimelineDot';
|
|
@@ -173,7 +173,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
173
173
|
float?: csstype.Property.Float | readonly NonNullable<csstype.Property.Float | undefined>[] | readonly csstype.Property.Float[] | undefined;
|
|
174
174
|
floodColor?: readonly string[] | csstype.Property.FloodColor | readonly csstype.Property.FloodColor[] | undefined;
|
|
175
175
|
floodOpacity?: readonly ((string & {}) | csstype.Globals)[] | csstype.Property.FloodOpacity | readonly NonNullable<csstype.Property.FloodOpacity | undefined>[] | undefined;
|
|
176
|
-
fontFamily?:
|
|
176
|
+
fontFamily?: csstype.Property.FontFamily | readonly string[] | readonly csstype.Property.FontFamily[] | undefined;
|
|
177
177
|
fontFeatureSettings?: readonly string[] | csstype.Property.FontFeatureSettings | readonly csstype.Property.FontFeatureSettings[] | undefined;
|
|
178
178
|
fontKerning?: csstype.Property.FontKerning | readonly NonNullable<csstype.Property.FontKerning | undefined>[] | readonly csstype.Property.FontKerning[] | undefined;
|
|
179
179
|
fontLanguageOverride?: readonly string[] | csstype.Property.FontLanguageOverride | readonly csstype.Property.FontLanguageOverride[] | undefined;
|
|
@@ -197,7 +197,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
197
197
|
fontVariantNumeric?: readonly string[] | csstype.Property.FontVariantNumeric | readonly csstype.Property.FontVariantNumeric[] | undefined;
|
|
198
198
|
fontVariantPosition?: csstype.Property.FontVariantPosition | readonly NonNullable<csstype.Property.FontVariantPosition | undefined>[] | readonly csstype.Property.FontVariantPosition[] | undefined;
|
|
199
199
|
fontVariationSettings?: readonly string[] | csstype.Property.FontVariationSettings | readonly csstype.Property.FontVariationSettings[] | undefined;
|
|
200
|
-
fontWeight?: csstype.Property.FontWeight | readonly NonNullable<csstype.Property.FontWeight | undefined>[] | readonly (
|
|
200
|
+
fontWeight?: csstype.Property.FontWeight | readonly NonNullable<csstype.Property.FontWeight | undefined>[] | readonly ((string & {}) | csstype.Globals | "bold" | "normal" | "bolder" | "lighter")[] | undefined;
|
|
201
201
|
fontWidth?: readonly string[] | csstype.Property.FontWidth | readonly csstype.Property.FontWidth[] | undefined;
|
|
202
202
|
forcedColorAdjust?: csstype.Property.ForcedColorAdjust | readonly NonNullable<csstype.Property.ForcedColorAdjust | undefined>[] | readonly csstype.Property.ForcedColorAdjust[] | undefined;
|
|
203
203
|
gridAutoColumns?: readonly (string | (string & {}))[] | csstype.Property.GridAutoColumns<string | number> | readonly NonNullable<csstype.Property.GridAutoColumns<string | number> | undefined>[] | undefined;
|
|
@@ -460,9 +460,9 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
460
460
|
x?: readonly (string | (string & {}))[] | csstype.Property.X<string | number> | readonly NonNullable<csstype.Property.X<string | number> | undefined>[] | undefined;
|
|
461
461
|
y?: readonly (string | (string & {}))[] | csstype.Property.Y<string | number> | readonly NonNullable<csstype.Property.Y<string | number> | undefined>[] | undefined;
|
|
462
462
|
zIndex?: readonly ((string & {}) | csstype.Globals | "auto")[] | csstype.Property.ZIndex | readonly NonNullable<csstype.Property.ZIndex | undefined>[] | undefined;
|
|
463
|
-
zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly (
|
|
463
|
+
zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reset")[] | undefined;
|
|
464
464
|
all?: csstype.Globals | readonly NonNullable<csstype.Globals | undefined>[] | readonly csstype.Globals[] | undefined;
|
|
465
|
-
animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly (
|
|
465
|
+
animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
466
466
|
animationRange?: readonly (string | (string & {}))[] | csstype.Property.AnimationRange<string | number> | readonly NonNullable<csstype.Property.AnimationRange<string | number> | undefined>[] | undefined;
|
|
467
467
|
background?: readonly (string | (string & {}))[] | csstype.Property.Background<string | number> | readonly NonNullable<csstype.Property.Background<string | number> | undefined>[] | undefined;
|
|
468
468
|
border?: readonly (string | (string & {}))[] | csstype.Property.Border<string | number> | readonly NonNullable<csstype.Property.Border<string | number> | undefined>[] | undefined;
|
|
@@ -474,7 +474,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
474
474
|
borderBlockWidth?: readonly (string | (string & {}))[] | csstype.Property.BorderBlockWidth<string | number> | readonly NonNullable<csstype.Property.BorderBlockWidth<string | number> | undefined>[] | undefined;
|
|
475
475
|
borderBottom?: readonly (string | (string & {}))[] | csstype.Property.BorderBottom<string | number> | readonly NonNullable<csstype.Property.BorderBottom<string | number> | undefined>[] | undefined;
|
|
476
476
|
borderColor?: readonly string[] | csstype.Property.BorderColor | readonly csstype.Property.BorderColor[] | undefined;
|
|
477
|
-
borderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly (
|
|
477
|
+
borderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
478
478
|
borderInline?: readonly (string | (string & {}))[] | csstype.Property.BorderInline<string | number> | readonly NonNullable<csstype.Property.BorderInline<string | number> | undefined>[] | undefined;
|
|
479
479
|
borderInlineColor?: readonly string[] | csstype.Property.BorderInlineColor | readonly csstype.Property.BorderInlineColor[] | undefined;
|
|
480
480
|
borderInlineEnd?: readonly (string | (string & {}))[] | csstype.Property.BorderInlineEnd<string | number> | readonly NonNullable<csstype.Property.BorderInlineEnd<string | number> | undefined>[] | undefined;
|
|
@@ -509,7 +509,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
509
509
|
marginBlock?: readonly (string | (string & {}))[] | csstype.Property.MarginBlock<string | number> | readonly NonNullable<csstype.Property.MarginBlock<string | number> | undefined>[] | undefined;
|
|
510
510
|
marginInline?: readonly (string | (string & {}))[] | csstype.Property.MarginInline<string | number> | readonly NonNullable<csstype.Property.MarginInline<string | number> | undefined>[] | undefined;
|
|
511
511
|
mask?: readonly (string | (string & {}))[] | csstype.Property.Mask<string | number> | readonly NonNullable<csstype.Property.Mask<string | number> | undefined>[] | undefined;
|
|
512
|
-
maskBorder?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly (
|
|
512
|
+
maskBorder?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
|
|
513
513
|
motion?: readonly (string | (string & {}))[] | csstype.Property.Offset<string | number> | readonly NonNullable<csstype.Property.Offset<string | number> | undefined>[] | undefined;
|
|
514
514
|
offset?: readonly (string | (string & {}))[] | csstype.Property.Offset<string | number> | readonly NonNullable<csstype.Property.Offset<string | number> | undefined>[] | undefined;
|
|
515
515
|
outline?: readonly (string | (string & {}))[] | csstype.Property.Outline<string | number> | readonly NonNullable<csstype.Property.Outline<string | number> | undefined>[] | undefined;
|
|
@@ -758,8 +758,8 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
758
758
|
WebkitUserModify?: csstype.Property.WebkitUserModify | readonly NonNullable<csstype.Property.WebkitUserModify | undefined>[] | readonly csstype.Property.WebkitUserModify[] | undefined;
|
|
759
759
|
WebkitUserSelect?: csstype.Property.WebkitUserSelect | readonly NonNullable<csstype.Property.WebkitUserSelect | undefined>[] | readonly csstype.Property.WebkitUserSelect[] | undefined;
|
|
760
760
|
WebkitWritingMode?: csstype.Property.WritingMode | readonly NonNullable<csstype.Property.WritingMode | undefined>[] | readonly csstype.Property.WritingMode[] | undefined;
|
|
761
|
-
MozAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly (
|
|
762
|
-
MozBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly (
|
|
761
|
+
MozAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
762
|
+
MozBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
763
763
|
MozColumnRule?: readonly (string | (string & {}))[] | csstype.Property.ColumnRule<string | number> | readonly NonNullable<csstype.Property.ColumnRule<string | number> | undefined>[] | undefined;
|
|
764
764
|
MozColumns?: readonly (string | (string & {}))[] | csstype.Property.Columns<string | number> | readonly NonNullable<csstype.Property.Columns<string | number> | undefined>[] | undefined;
|
|
765
765
|
MozOutlineRadius?: readonly (string | (string & {}))[] | csstype.Property.MozOutlineRadius<string | number> | readonly NonNullable<csstype.Property.MozOutlineRadius<string | number> | undefined>[] | undefined;
|
|
@@ -771,16 +771,16 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
771
771
|
msScrollSnapX?: readonly string[] | csstype.Property.MsScrollSnapX | readonly csstype.Property.MsScrollSnapX[] | undefined;
|
|
772
772
|
msScrollSnapY?: readonly string[] | csstype.Property.MsScrollSnapY | readonly csstype.Property.MsScrollSnapY[] | undefined;
|
|
773
773
|
msTransition?: readonly string[] | csstype.Property.Transition<string & {}> | readonly csstype.Property.Transition<string & {}>[] | undefined;
|
|
774
|
-
WebkitAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly (
|
|
774
|
+
WebkitAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
775
775
|
WebkitBorderBefore?: readonly (string | (string & {}))[] | csstype.Property.WebkitBorderBefore<string | number> | readonly NonNullable<csstype.Property.WebkitBorderBefore<string | number> | undefined>[] | undefined;
|
|
776
|
-
WebkitBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly (
|
|
776
|
+
WebkitBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
777
777
|
WebkitBorderRadius?: readonly (string | (string & {}))[] | csstype.Property.BorderRadius<string | number> | readonly NonNullable<csstype.Property.BorderRadius<string | number> | undefined>[] | undefined;
|
|
778
778
|
WebkitColumnRule?: readonly (string | (string & {}))[] | csstype.Property.ColumnRule<string | number> | readonly NonNullable<csstype.Property.ColumnRule<string | number> | undefined>[] | undefined;
|
|
779
779
|
WebkitColumns?: readonly (string | (string & {}))[] | csstype.Property.Columns<string | number> | readonly NonNullable<csstype.Property.Columns<string | number> | undefined>[] | undefined;
|
|
780
780
|
WebkitFlex?: readonly (string | (string & {}))[] | csstype.Property.Flex<string | number> | readonly NonNullable<csstype.Property.Flex<string | number> | undefined>[] | undefined;
|
|
781
781
|
WebkitFlexFlow?: readonly string[] | csstype.Property.FlexFlow | readonly csstype.Property.FlexFlow[] | undefined;
|
|
782
782
|
WebkitMask?: readonly (string | (string & {}))[] | csstype.Property.WebkitMask<string | number> | readonly NonNullable<csstype.Property.WebkitMask<string | number> | undefined>[] | undefined;
|
|
783
|
-
WebkitMaskBoxImage?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly (
|
|
783
|
+
WebkitMaskBoxImage?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
|
|
784
784
|
WebkitTextEmphasis?: readonly string[] | csstype.Property.TextEmphasis | readonly csstype.Property.TextEmphasis[] | undefined;
|
|
785
785
|
WebkitTextStroke?: readonly (string | (string & {}))[] | csstype.Property.WebkitTextStroke<string | number> | readonly NonNullable<csstype.Property.WebkitTextStroke<string | number> | undefined>[] | undefined;
|
|
786
786
|
WebkitTransition?: readonly string[] | csstype.Property.Transition<string & {}> | readonly csstype.Property.Transition<string & {}>[] | undefined;
|
|
@@ -861,7 +861,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
861
861
|
MozUserFocus?: csstype.Property.MozUserFocus | readonly NonNullable<csstype.Property.MozUserFocus | undefined>[] | readonly csstype.Property.MozUserFocus[] | undefined;
|
|
862
862
|
MozUserInput?: csstype.Property.MozUserInput | readonly NonNullable<csstype.Property.MozUserInput | undefined>[] | readonly csstype.Property.MozUserInput[] | undefined;
|
|
863
863
|
msImeMode?: csstype.Property.ImeMode | readonly NonNullable<csstype.Property.ImeMode | undefined>[] | readonly csstype.Property.ImeMode[] | undefined;
|
|
864
|
-
OAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly (
|
|
864
|
+
OAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
865
865
|
OAnimationDelay?: readonly string[] | csstype.Property.AnimationDelay<string & {}> | readonly csstype.Property.AnimationDelay<string & {}>[] | undefined;
|
|
866
866
|
OAnimationDirection?: readonly string[] | csstype.Property.AnimationDirection | readonly csstype.Property.AnimationDirection[] | undefined;
|
|
867
867
|
OAnimationDuration?: readonly string[] | csstype.Property.AnimationDuration<string & {}> | readonly csstype.Property.AnimationDuration<string & {}>[] | undefined;
|
|
@@ -871,7 +871,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
871
871
|
OAnimationPlayState?: readonly string[] | csstype.Property.AnimationPlayState | readonly csstype.Property.AnimationPlayState[] | undefined;
|
|
872
872
|
OAnimationTimingFunction?: readonly string[] | csstype.Property.AnimationTimingFunction | readonly csstype.Property.AnimationTimingFunction[] | undefined;
|
|
873
873
|
OBackgroundSize?: readonly (string | (string & {}))[] | csstype.Property.BackgroundSize<string | number> | readonly NonNullable<csstype.Property.BackgroundSize<string | number> | undefined>[] | undefined;
|
|
874
|
-
OBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly (
|
|
874
|
+
OBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
|
|
875
875
|
OObjectFit?: csstype.Property.ObjectFit | readonly NonNullable<csstype.Property.ObjectFit | undefined>[] | readonly csstype.Property.ObjectFit[] | undefined;
|
|
876
876
|
OObjectPosition?: readonly (string | (string & {}))[] | csstype.Property.ObjectPosition<string | number> | readonly NonNullable<csstype.Property.ObjectPosition<string | number> | undefined>[] | undefined;
|
|
877
877
|
OTabSize?: readonly (string | (string & {}))[] | csstype.Property.TabSize<string | number> | readonly NonNullable<csstype.Property.TabSize<string | number> | undefined>[] | undefined;
|
package/package.json
CHANGED
package/dist/chunk-JWIITCIZ.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-VPG46WNM.js';
|
|
2
|
-
import { createContext, forwardRef, useContext, memo, useMemo, useCallback, useRef, useEffect } from 'react';
|
|
3
|
-
import yt from 'react-fast-compare';
|
|
4
|
-
import gt, { autocompleteClasses } from '@mui/material/Autocomplete';
|
|
5
|
-
import ht from '@mui/material/CircularProgress';
|
|
6
|
-
import St from '@mui/material/TextField';
|
|
7
|
-
import { VariableSizeList } from 'react-window';
|
|
8
|
-
import rt from '@mui/material/ListSubheader';
|
|
9
|
-
import nt from '@mui/material/Stack';
|
|
10
|
-
import { useTheme, styled } from '@mui/material/styles';
|
|
11
|
-
import H from '@mui/material/Typography';
|
|
12
|
-
import st from '@mui/material/useMediaQuery';
|
|
13
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
|
-
import ct from '@mui/material/Popper';
|
|
15
|
-
|
|
16
|
-
var X=8,pt=o=>{let{data:n,index:i,style:m}=o,r=n[i],{showValueInLabel:s,key:y,...g}=r[0],u={...m,top:m.top+X,paddingTop:8};return Object.prototype.hasOwnProperty.call(r,"group")?jsx(rt,{component:"div",style:u,children:r.group},`list-box-item-group-${y}`):jsx(H,{component:"li",...g,noWrap:!0,style:u,children:jsxs(nt,{component:"div",direction:"row",flex:1,gap:1,justifyContent:"start",children:[r[1].icon&&jsx(a,{icon:r[1].icon}),r[1].label,s&&jsxs(H,{variant:"inherit",color:"grey.400",children:["(",r[1].value,")"]})]})},`list-box-item-${y}`)},D=createContext({}),J=forwardRef((o,n)=>{let i=useContext(D);return jsx("div",{ref:n,...o,...i})});J.displayName="OuterElementType";var ut=o=>{let n=useRef(null);return useEffect(()=>{n.current!=null&&n.current.resetAfterIndex(0,!0);},[o]),n},at=forwardRef(function(n,i){let{children:m,...r}=n,s=[];m.forEach(p=>{s.push(p),s.push(...p.children||[]);});let y=useTheme(),g=st(y.breakpoints.up("sm")),u=s.length,h=g?36:48,c=p=>Object.prototype.hasOwnProperty.call(p,"group")?48:h,x=()=>u>8?8*h:s.map(c).reduce((p,a)=>p+a,0),A=ut(u);return jsx("div",{ref:i,children:jsx(D.Provider,{value:r,children:jsx(VariableSizeList,{itemData:s,height:x()+2*X,width:"100%",ref:A,outerElementType:J,innerElementType:"ul",itemSize:p=>c(s[p]),overscanCount:5,itemCount:u,children:pt})})})}),W=at;var $=styled(ct)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}});var bt=o=>o&&typeof o=="object"?o.value.toString():o.toString(),U=memo(forwardRef(({name:o,label:n,value:i,options:m=[],loading:r,noOptionsText:s="Nenhum resultado encontrado.",loadingText:y="Carregando op\xE7\xF5es...",error:g,helperText:u,placeholder:h,onChange:c,groupBy:x,showValueInLabel:A,disabled:p,multiple:a$1,required:I,renderOption:S,tabIndex:M,onInputChange:O,onSearch:T,onBlur:R,InputLabelProps:k,...B},V)=>{let v=useMemo(()=>new Map(m.map(t=>[t.value.toString(),t])),[m]),l=useMemo(()=>a$1?(Array.isArray(i)?i:[]).map(e=>v.get(e.toString())).filter(Boolean):i?.toString()&&v.get(i.toString())||null,[v,i,a$1]),j=(t,e)=>{let d=e.inputValue.toLocaleUpperCase();return t.filter(C=>`${C.value} ${C.label}`.toLocaleUpperCase().includes(d))},F=useMemo(()=>S?void 0:W,[S]),w=useMemo(()=>{let t=typeof l=="string",e=Array.isArray(l);return l&&!t&&!e&&l?.icon?jsx(a,{icon:l.icon}):null},[l]),G=useCallback((t,e,d)=>{if(O&&O(t,e,d),d==="input"){T&&T(e);return}},[O,T]),_=useCallback((t,e)=>{if(!e){c(a$1?[]:null);return}if(Array.isArray(e)){c(e.map(bt));return}if(typeof e=="string"){c(e.toString());return}c(e.value.toString());},[c,a$1]),q=useCallback(t=>{R&&R(t);},[R]),Q=useCallback(t=>jsx(St,{...t,name:o,placeholder:h,fullWidth:!0,error:!!g,helperText:u,label:n,required:I,InputProps:{...t.InputProps,...!a$1&&{startAdornment:w},endAdornment:jsxs(Fragment,{children:[r?jsx(ht,{color:"primary",size:20}):null,t.InputProps.endAdornment]})},inputProps:{...t.inputProps,name:o,tabIndex:M},InputLabelProps:k}),[o,h,g,u,n,I,a$1,w,r,M,k]),K=useCallback((t,e,d,C)=>S?S(t,e,d,C):[{...t,showValueInLabel:A},e],[S,A]);return jsx(gt,{ref:V,value:l,onInputChange:G,options:m,loading:r,noOptionsText:s,loadingText:y,disabled:r||p,disableListWrap:!0,PopperComponent:$,ListboxComponent:F,filterOptions:j,onChange:_,onBlur:q,renderOption:K,renderGroup:t=>t,groupBy:x,multiple:a$1,renderInput:Q,...B})}),yt);U.displayName="Autocomplete";var Yt=U;
|
|
17
|
-
|
|
18
|
-
export { Yt as a };
|
|
19
|
-
//# sourceMappingURL=out.js.map
|
|
20
|
-
//# sourceMappingURL=chunk-JWIITCIZ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Autocomplete/index.tsx","../src/components/Autocomplete/Listbox.tsx","../src/components/Autocomplete/styles.ts"],"names":["forwardRef","memo","useCallback","useMemo","isEqual","MuiAutocomplete","CircularProgress","TextField","createContext","useContext","useEffect","useRef","VariableSizeList","ListSubheader","Stack","useTheme","Typography","useMediaQuery","jsx","jsxs","LISTBOX_PADDING","renderRow","props","data","index","style","dataSet","showValueInLabel","key","itemProps","inlineStyle","Icon_default","OuterElementContext","OuterElementType","ref","outerProps","useResetCache","ListboxComponent","children","other","itemData","item","theme","smUp","itemCount","itemSize","getChildSize","child","getHeight","a","b","gridRef","Listbox_default","autocompleteClasses","Popper","styled","StyledPopper","Fragment","getOptionValue","optionValue","Autocomplete","name","label","value","options","loading","noOptionsText","loadingText","error","helperText","placeholder","onChange","groupBy","disabled","multiple","required","renderOption","tabIndex","onInputChange","onSearch","onBlur","InputLabelProps","optionsMap","opt","formattedValue","v","filterOptions","optionsFilter","state","searchUpper","listboxComponentWithoutRenderOption","startAdornment","isString","isArray","handleInputChange","event","eventValue","reason","handleChange","_event","option","handleBlur","renderInput","params","renderOptionWrapper","ownerState","Autocomplete_default"],"mappings":"wCAAA,OAAS,cAAAA,GAAY,QAAAC,GAAiB,eAAAC,EAAa,WAAAC,MAAe,QAClE,OAAOC,OAAa,qBACpB,OAAOC,OAIA,6BACP,OAAOC,OAAsB,iCAC7B,OAAOC,OAAe,0BCRtB,OACE,iBAAAC,EACA,cAAAR,EAGA,cAAAS,EACA,aAAAC,GACA,UAAAC,OACK,QACP,OAAkC,oBAAAC,OAAwB,eAC1D,OAAOC,OAAmB,8BAC1B,OAAOC,OAAW,sBAClB,OAAS,YAAAC,OAAgB,uBACzB,OAAOC,MAAgB,2BACvB,OAAOC,OAAmB,8BAmBpB,cAAAC,EA4BI,QAAAC,MA5BJ,oBAfN,IAAMC,EAAkB,EAElBC,GAAaC,GAAmC,CACpD,GAAM,CAAE,KAAAC,EAAM,MAAAC,EAAO,MAAAC,CAAM,EAAIH,EACzBI,EAAUH,EAAKC,CAAK,EACpB,CAAE,iBAAAG,EAAkB,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,GAAGnF,EAAO,iBAAAK,CAAiB,EAAGyE,CAAM,EAC9C,CAACxB,EAAcjD,CAAgB,CACjC,EAEA,OACET,EAACb,GAAA,CACC,IAAK6B,EACL,MAAOkD,EACP,cAAeU,EACf,QAAS9B,EACT,QAASC,EACT,cAAeC,EACf,YAAaC,EACb,SAAUF,GAAWQ,EACrB,gBAAe,GACf,gBAAiBjB,EACjB,iBAAkBkC,EAClB,cAAeJ,EACf,SAAUY,EACV,OAAQG,EACR,aAAcG,EACd,YAAaD,GAAUA,EACvB,QAAS/B,EACT,SAAUE,EACV,YAAa4B,EACZ,GAAG/D,EACN,CAEJ,CACF,EACAnC,EACF,EAEAwD,EAAa,YAAc,eAE3B,IAAO8C,GAAQ9C","sourcesContent":["import { forwardRef, memo, ReactNode, useCallback, useMemo } from 'react';\nimport isEqual from 'react-fast-compare';\nimport MuiAutocomplete, {\n AutocompleteInputChangeReason,\n AutocompleteRenderInputParams,\n AutocompleteRenderOptionState,\n} from '@mui/material/Autocomplete';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport TextField from '@mui/material/TextField';\n\nimport { AutocompleteProps } from 'types/autoCompleteProps';\nimport { Option } from 'types/option';\n\nimport Icon, { IconEnum } from '../Icon';\n\nimport ListboxComponent from './Listbox';\nimport { StyledPopper } from './styles';\n\nconst getOptionValue = (optionValue: Option | string | number) =>\n optionValue && typeof optionValue === 'object'\n ? optionValue.value.toString()\n : optionValue.toString();\n\nconst Autocomplete = memo(\n forwardRef<unknown, AutocompleteProps>(\n (\n {\n name,\n label,\n value,\n options = [],\n loading,\n noOptionsText = 'Nenhum resultado encontrado.',\n loadingText = 'Carregando opções...',\n error,\n helperText,\n placeholder,\n onChange,\n groupBy,\n showValueInLabel,\n disabled,\n multiple,\n required,\n renderOption,\n tabIndex,\n onInputChange,\n onSearch,\n onBlur,\n InputLabelProps,\n ...other\n },\n ref,\n ) => {\n const optionsMap = useMemo(\n () => new Map(options.map(opt => [opt.value.toString(), opt])),\n [options],\n );\n\n const formattedValue = useMemo(() => {\n if (multiple) {\n const values = Array.isArray(value) ? value : [];\n return values\n .map(v => optionsMap.get(v.toString()))\n .filter(Boolean) as Option[];\n }\n\n if (value?.toString()) return optionsMap.get(value.toString()) || null;\n\n return null;\n }, [optionsMap, value, multiple]);\n\n const filterOptions = (\n optionsFilter: Option[],\n state: { inputValue: string },\n ) => {\n const searchUpper = state.inputValue.toLocaleUpperCase();\n return optionsFilter.filter(opt => {\n const search = `${opt.value} ${opt.label}`;\n return search.toLocaleUpperCase().includes(searchUpper);\n });\n };\n\n const listboxComponentWithoutRenderOption = useMemo(\n () => (renderOption ? undefined : ListboxComponent),\n [renderOption],\n );\n\n const startAdornment = useMemo(() => {\n const isString = typeof formattedValue === 'string';\n const isArray = Array.isArray(formattedValue);\n const existsIcon =\n formattedValue && !isString && !isArray && formattedValue?.icon;\n\n if (existsIcon) {\n return <Icon icon={formattedValue.icon as IconEnum} />;\n }\n\n return null;\n }, [formattedValue]);\n\n const handleInputChange = useCallback(\n (\n event: React.SyntheticEvent,\n eventValue: string,\n reason: AutocompleteInputChangeReason,\n ) => {\n if (onInputChange) onInputChange(event, eventValue, reason);\n\n if (reason === 'input') {\n if (onSearch) {\n onSearch(eventValue);\n }\n\n return;\n }\n },\n [onInputChange, onSearch],\n );\n\n const handleChange = useCallback(\n (\n _event: React.SyntheticEvent,\n option: NonNullable<string | Option> | (string | Option)[] | null,\n ) => {\n if (!option) {\n onChange(multiple ? [] : null);\n return;\n }\n\n if (Array.isArray(option)) {\n onChange(option.map(getOptionValue));\n return;\n }\n\n if (typeof option === 'string') {\n onChange(option.toString());\n return;\n }\n\n onChange(option.value.toString());\n return;\n },\n [onChange, multiple],\n );\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur) onBlur(event);\n },\n [onBlur],\n );\n\n const renderInput = useCallback(\n (params: AutocompleteRenderInputParams) => (\n <TextField\n {...params}\n name={name}\n placeholder={placeholder}\n fullWidth\n error={!!error}\n helperText={helperText}\n label={label}\n required={required}\n InputProps={{\n ...params.InputProps,\n ...(!multiple && { startAdornment }),\n endAdornment: (\n <>\n {loading ? (\n <CircularProgress color=\"primary\" size={20} />\n ) : null}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n inputProps={{\n ...params.inputProps,\n name,\n tabIndex,\n }}\n InputLabelProps={InputLabelProps}\n />\n ),\n [\n name,\n placeholder,\n error,\n helperText,\n label,\n required,\n multiple,\n startAdornment,\n loading,\n tabIndex,\n InputLabelProps,\n ],\n );\n\n const renderOptionWrapper = useCallback(\n (\n props: React.HTMLAttributes<HTMLLIElement> & { key: unknown },\n option: Option,\n state: AutocompleteRenderOptionState,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ownerState: any,\n ) =>\n renderOption\n ? renderOption(props, option, state, ownerState)\n : ([{ ...props, showValueInLabel }, option] as ReactNode),\n [renderOption, showValueInLabel],\n );\n\n return (\n <MuiAutocomplete\n ref={ref}\n value={formattedValue}\n onInputChange={handleInputChange}\n options={options}\n loading={loading}\n noOptionsText={noOptionsText}\n loadingText={loadingText}\n disabled={loading || disabled}\n disableListWrap\n PopperComponent={StyledPopper}\n ListboxComponent={listboxComponentWithoutRenderOption}\n filterOptions={filterOptions}\n onChange={handleChange}\n onBlur={handleBlur}\n renderOption={renderOptionWrapper}\n renderGroup={params => params as unknown as ReactNode}\n groupBy={groupBy}\n multiple={multiple}\n renderInput={renderInput}\n {...other}\n />\n );\n },\n ),\n isEqual,\n);\n\nAutocomplete.displayName = 'Autocomplete';\n\nexport default Autocomplete;\n","import {\n createContext,\n forwardRef,\n HTMLAttributes,\n type JSX,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport { ListChildComponentProps, VariableSizeList } from 'react-window';\nimport ListSubheader from '@mui/material/ListSubheader';\nimport Stack from '@mui/material/Stack';\nimport { useTheme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport Icon from '../Icon';\n\nconst LISTBOX_PADDING = 8;\n\nconst renderRow = (props: ListChildComponentProps) => {\n const { data, index, style } = props;\n const dataSet = data[index];\n const { showValueInLabel, key, ...itemProps } = dataSet[0];\n\n const inlineStyle = {\n ...style,\n top: (style.top as number) + LISTBOX_PADDING,\n paddingTop: 8,\n };\n\n if (Object.prototype.hasOwnProperty.call(dataSet, 'group'))\n return (\n <ListSubheader\n key={`list-box-item-group-${key}`}\n component=\"div\"\n style={inlineStyle}\n >\n {dataSet.group}\n </ListSubheader>\n );\n\n return (\n <Typography\n component=\"li\"\n key={`list-box-item-${key}`}\n {...itemProps}\n noWrap\n style={inlineStyle}\n >\n <Stack\n component=\"div\"\n direction=\"row\"\n flex={1}\n gap={1}\n justifyContent=\"start\"\n >\n {dataSet[1].icon && <Icon icon={dataSet[1].icon} />}\n {dataSet[1].label}\n\n {showValueInLabel && (\n <Typography variant=\"inherit\" color=\"grey.400\">\n ({dataSet[1].value})\n </Typography>\n )}\n </Stack>\n </Typography>\n );\n};\n\nconst OuterElementContext = createContext({});\n\nconst OuterElementType = forwardRef<HTMLDivElement>((props, ref) => {\n const outerProps = useContext(OuterElementContext);\n return <div ref={ref} {...props} {...outerProps} />;\n});\n\nOuterElementType.displayName = 'OuterElementType';\n\nconst useResetCache = (data: number) => {\n const ref = useRef<VariableSizeList>(null);\n\n useEffect(() => {\n if (ref.current != null) {\n ref.current.resetAfterIndex(0, true);\n }\n }, [data]);\n\n return ref;\n};\n\nconst ListboxComponent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLElement>\n>(function ListboxComponent(props, ref) {\n const { children, ...other } = props;\n const itemData: JSX.Element[] = [];\n (children as JSX.Element[]).forEach(\n (item: JSX.Element & { children?: JSX.Element[] }) => {\n itemData.push(item);\n itemData.push(...(item.children || []));\n },\n );\n\n const theme = useTheme();\n const smUp = useMediaQuery(theme.breakpoints.up('sm'));\n const itemCount = itemData.length;\n const itemSize = smUp ? 36 : 48;\n\n const getChildSize = (child: JSX.Element) => {\n if (Object.prototype.hasOwnProperty.call(child, 'group')) {\n return 48;\n }\n\n return itemSize;\n };\n\n const getHeight = () => {\n if (itemCount > 8) {\n return 8 * itemSize;\n }\n return itemData.map(getChildSize).reduce((a, b) => a + b, 0);\n };\n\n const gridRef = useResetCache(itemCount);\n\n return (\n <div ref={ref}>\n <OuterElementContext.Provider value={other}>\n <VariableSizeList\n itemData={itemData}\n height={getHeight() + 2 * LISTBOX_PADDING}\n width=\"100%\"\n ref={gridRef}\n outerElementType={OuterElementType}\n innerElementType=\"ul\"\n itemSize={index => getChildSize(itemData[index])}\n overscanCount={5}\n itemCount={itemCount}\n >\n {renderRow}\n </VariableSizeList>\n </OuterElementContext.Provider>\n </div>\n );\n});\n\nexport default ListboxComponent;\n","import { autocompleteClasses } from '@mui/material/Autocomplete';\nimport Popper from '@mui/material/Popper';\nimport { styled } from '@mui/material/styles';\n\nexport const StyledPopper = styled(Popper)({\n [`& .${autocompleteClasses.listbox}`]: {\n boxSizing: 'border-box',\n '& ul': {\n padding: 0,\n margin: 0,\n },\n },\n});\n"]}
|
package/dist/chunk-X2GWFMP4.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-VR3K2Y2C.js';
|
|
2
|
-
import { b } from './chunk-RPO7AI5K.js';
|
|
3
|
-
import P, { forwardRef, memo, useState, useMemo, useEffect } from 'react';
|
|
4
|
-
import he, { autocompleteClasses } from '@mui/material/Autocomplete';
|
|
5
|
-
import be from '@mui/material/CircularProgress';
|
|
6
|
-
import ye from '@mui/material/TextField';
|
|
7
|
-
import { VariableSizeList } from 'react-window';
|
|
8
|
-
import W from '@mui/material/Typography';
|
|
9
|
-
import ne from '@mui/material/Divider';
|
|
10
|
-
import O from '@mui/material/Stack';
|
|
11
|
-
import oe from '@mui/material/Popper';
|
|
12
|
-
import { styled } from '@mui/material/styles';
|
|
13
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
|
-
|
|
15
|
-
var D=styled(oe)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}}),H=styled(O)(({theme:t})=>({flex:1,width:"100%",gap:6,[t.breakpoints.down("md")]:{flexDirection:"column"},[t.breakpoints.up("md")]:{flexDirection:"row"}})),T=styled(O)(({theme:t})=>({flex:1,maxWidth:"100%",gap:6,[t.breakpoints.up("md")]:{flex:"1 1 calc(50% - 8px)",width:"calc(50% - 8px)",minWidth:"calc(50% - 8px)",maxWidth:"calc(50% - 8px)"}})),M=styled(O)(({theme:t})=>({position:"relative",alignItems:"center",justifyContent:"center",width:68,height:68,borderRadius:8,overflow:"hidden",img:{position:"absolute",width:"100%",height:"100%",objectFit:"cover"},[t.breakpoints.down("sm")]:{display:"none"}}));var ie=({option:t})=>{let r=Object.keys(t).filter(o=>o.startsWith("field")).map((o,l)=>{let a=t[o];if(a&&typeof a=="object"){let s="label"in a?a.label:null,d="value"in a?a.value:null;return jsxs(W,{component:"span",variant:"body2",color:"textPrimary",noWrap:!0,children:[s,": ",d]},`${o}:${l}`)}}),i=t.image?jsx("img",{alt:"Imagem",src:t.image}):jsx(a,{alt:t.label||t.value.toString(),name:t.label||t.value.toString(),sx:{width:68,height:68,borderRadius:1}});return jsxs(Fragment,{children:[jsxs(O,{direction:"row",gap:2,margin:2,children:[jsx(M,{children:i}),jsxs(O,{flex:1,overflow:"hidden",children:[jsxs(W,{variant:"subtitle2",color:"textPrimary",noWrap:!0,flex:1,children:[t.value," - ",t.label]}),r.length>0&&jsxs(H,{width:1,children:[jsxs(T,{children:[r[0]?r[0]:void 0,r[1]?r[1]:void 0]}),(r[2]||r[3])&&jsxs(T,{children:[r[2]?r[2]:void 0,r[3]?r[3]:void 0]})]})]})]}),jsx(ne,{className:"border",sx:{borderStyle:"dashed",position:"absolute",bottom:0,width:1}})]})},C=ie;var N=8,me=t=>{let{data:r,index:i,style:o}=t,l=r[i],a={...o,top:o.top+N,paddingTop:8,display:"block"};return jsx(W,{component:"li",...l.props,noWrap:!0,style:a,children:jsx(C,{...l?.props?.children?.props})})},X=P.createContext({}),B=forwardRef((t,r)=>{let i=P.useContext(X);return jsx("div",{ref:r,...t,...i})});B.displayName="OuterElementType";var de=t=>{let r=P.useRef(null);return useEffect(()=>{r.current!=null&&r.current.resetAfterIndex(0,!0);},[t]),r},ue=forwardRef(function(r,i){let{children:o,"data-item-height":l,...a}=r,s=[];o.forEach(p=>{s.push(p),s.push(...p.children||[]);});let d=s.length,b=l>112?l:112,y=p=>Object.prototype.hasOwnProperty.call(p,"group")?48:b,g=()=>d>8?8*b:s.map(y).reduce((p,u)=>p+u,0),v=de(d);return jsx("div",{ref:i,children:jsx(X.Provider,{value:a,children:jsx(VariableSizeList,{itemData:s,height:g()+2*N,width:"100%",ref:v,outerElementType:B,innerElementType:"ul",itemSize:p=>y(s[p]),overscanCount:5,itemCount:d,children:me})})})}),J=ue;var j=memo(forwardRef(({name:t,label:r,value:i,options:o=[],loading:l,noOptionsText:a="Nenhum resultado encontrado.",loadingText:s="Carregando op\xE7\xF5es...",error:d,helperText:b$1,placeholder:y,onChange:g,groupBy:v,disabled:p,multiple:u,required:U,renderOption:G,tabIndex:V,onSearch:I,onInputChange:A,..._},F)=>{let[q,E]=useState(),K=b("down","md"),Q=e=>e&&typeof e=="object"?e.value.toString():e.toString(),L=useMemo(()=>new Map(o.map(e=>[e.value.toString(),e])),[o]),Y=useMemo(()=>o.map(e=>({...e,searchString:`${e.field1?.value||""} ${e.field1?.label||""} ${e.field2?.label||""} ${e.field2?.value||""} ${e.field3?.label||""} ${e.field3?.value||""} ${e.field4?.label||""} ${e.field4?.value||""} ${e.field5?.label||""} ${e.field5?.value||""} ${e.label}${e.value}`.toLocaleUpperCase().trim()})),[o]),Z=useMemo(()=>u?(Array.isArray(i)?i:[]).map(n=>L.get(n.toString())).filter(Boolean):(i?.toString()?L.get(i.toString()):null)||null,[L,i,u]),ee=K&&o[0]?Object.keys(o[0]).length*24:void 0;return jsx(he,{ref:F,value:q||Z,onInputChange:(e,n,c)=>{if(A&&A(e,n,c),c==="input"){I&&I(n),E(n);return}E(void 0);},options:Y,loading:l,noOptionsText:a,loadingText:s,disabled:l||p,disableListWrap:!0,PopperComponent:D,ListboxProps:{"data-item-height":ee},ListboxComponent:G?void 0:J,filterOptions:(e,n)=>{let c=n.inputValue.toLocaleUpperCase();return e.filter(te=>te.searchString.includes(c))},onChange:(e,n)=>{if(!n){g(u?[]:null);return}if(Array.isArray(n)){g(n.map(Q));return}g(typeof n=="string"?n.toString():n.value.toString());},renderOption:({key:e,...n},c)=>jsx("li",{...n,style:{display:"block"},children:jsx(C,{option:c})},e),renderGroup:e=>e,groupBy:v,multiple:u,renderInput:e=>jsx(ye,{...e,name:t,placeholder:y,fullWidth:!0,error:!!d,helperText:b$1,label:r,required:U,InputProps:{...e.InputProps,endAdornment:jsxs(Fragment,{children:[l?jsx(be,{color:"primary",size:20}):null,e.InputProps.endAdornment]})},inputProps:{...e.inputProps,name:t,tabIndex:V}}),..._})}));j.displayName="AutocompleteDetailed";var Qe=j;
|
|
16
|
-
|
|
17
|
-
export { Qe as a };
|
|
18
|
-
//# sourceMappingURL=out.js.map
|
|
19
|
-
//# sourceMappingURL=chunk-X2GWFMP4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AutocompleteDetailed/index.tsx","../src/components/AutocompleteDetailed/Listbox.tsx","../src/components/AutocompleteDetailed/ListItem.tsx","../src/components/AutocompleteDetailed/styles.ts"],"names":["forwardRef","memo","useMemo","useState","MuiAutocomplete","CircularProgress","TextField","React","useEffect","VariableSizeList","Typography","Divider","Stack","autocompleteClasses","Popper","styled","StyledPopper","OptionBox","theme","OptionContent","ImageContainer","Fragment","jsx","jsxs","ListItem","option","options","key","index","data","label","value","image","CustomAvatar_default","ListItem_default","LISTBOX_PADDING","renderRow","props","style","dataSet","inlineStyle","OuterElementContext","OuterElementType","ref","outerProps","useResetCache","ListboxComponent","children","dataItemHeight","other","itemData","item","itemCount","itemSize","getChildSize","child","getHeight","a","b","gridRef","Listbox_default","AutocompleteDetailed","name","loading","noOptionsText","loadingText","error","helperText","placeholder","onChange","groupBy","disabled","multiple","required","renderOption","tabIndex","onSearch","onInputChange","inputValue","setInputValue","mdDown","useResponsive_default","getOptionValue","optionValue","optionsMap","opt","optionsWithSearch","formattedValue","v","OPTION_HEIGHT","event","eventValue","reason","opts","state","searchUpper","_","params","AutocompleteDetailed_default"],"mappings":"gFAAA,OACE,cAAAA,GAEA,QAAAC,GAEA,WAAAC,EACA,YAAAC,OACK,QACP,OAAOC,OAAqB,6BAC5B,OAAOC,OAAsB,iCAC7B,OAAOC,OAAe,0BCVtB,OAAOC,GAAS,cAAAP,EAAsC,aAAAQ,OAAiB,QACvE,OAAkC,oBAAAC,OAAwB,eAC1D,OAAOC,OAAgB,2BCFvB,OAAOC,OAAa,wBACpB,OAAOC,MAAW,sBAClB,OAAOF,MAAgB,2BCFvB,OAAS,uBAAAG,OAA2B,6BACpC,OAAOC,OAAY,uBACnB,OAAOF,MAAW,sBAClB,OAAS,UAAAG,MAAc,uBAEhB,IAAMC,EAAeD,EAAOD,EAAM,EAAE,CACzC,CAAC,MAAMD,GAAoB,SAAS,EAAG,CACrC,UAAW,aACX,OAAQ,CACN,QAAS,EACT,OAAQ,CACV,CACF,CACF,CAAC,EAEYI,EAAYF,EAAOH,CAAK,EAAE,CAAC,CAAE,MAAAM,CAAM,KAAO,CACrD,KAAM,EACN,MAAO,OACP,IAAK,EAEL,CAACA,EAAM,YAAY,KAAK,IAAI,CAAC,EAAG,CAC9B,cAAe,QACjB,EAEA,CAACA,EAAM,YAAY,GAAG,IAAI,CAAC,EAAG,CAC5B,cAAe,KACjB,CACF,EAAE,EAEWC,EAAgBJ,EAAOH,CAAK,EAAE,CAAC,CAAE,MAAAM,CAAM,KAAO,CACzD,KAAM,EACN,SAAU,OACV,IAAK,EAEL,CAACA,EAAM,YAAY,GAAG,IAAI,CAAC,EAAG,CAC5B,KA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,SAAUE,EACV,YAAayB,GACX3E,EAAChB,GAAA,CACE,GAAG2F,EACJ,KAAMnC,EACN,YAAaM,EACb,UAAS,GACT,MAAO,CAAC,CAACF,EACT,WAAYC,EACZ,MAAOrC,EACP,SAAU2C,EACV,WAAY,CACV,GAAGwB,EAAO,WACV,aACE1E,GAAAF,GAAA,CACG,UAAA0C,EACCzC,EAACjB,GAAA,CAAiB,MAAM,UAAU,KAAM,GAAI,EAC1C,KACH4F,EAAO,WAAW,cACrB,CAEJ,EACA,WAAY,CACV,GAAGA,EAAO,WACV,KAAAnC,EACA,SAAAa,CACF,EACF,EAED,GAAG1B,EACN,CAEJ,CACF,CACF,EAEAY,EAAqB,YAAc,uBAEnC,IAAOqC,GAAQrC","sourcesContent":["import {\n forwardRef,\n HTMLAttributes,\n memo,\n ReactNode,\n useMemo,\n useState,\n} from 'react';\nimport MuiAutocomplete from '@mui/material/Autocomplete';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport TextField from '@mui/material/TextField';\n\nimport useResponsive from 'hooks/useResponsive';\nimport { Option } from 'types/option';\n\nimport ListboxComponent from './Listbox';\nimport ListItem from './ListItem';\nimport { AutocompleteDetailedProps } from './props';\nimport { StyledPopper } from './styles';\n\nconst AutocompleteDetailed = memo(\n forwardRef<unknown, AutocompleteDetailedProps>(\n (\n {\n name,\n label,\n value,\n options = [],\n loading,\n noOptionsText = 'Nenhum resultado encontrado.',\n loadingText = 'Carregando opções...',\n error,\n helperText,\n placeholder,\n onChange,\n groupBy,\n disabled,\n multiple,\n required,\n renderOption,\n tabIndex,\n onSearch,\n onInputChange,\n ...other\n },\n ref,\n ) => {\n const [inputValue, setInputValue] = useState<string>();\n\n const mdDown = useResponsive('down', 'md');\n\n const getOptionValue = (optionValue: Option | string | number) =>\n optionValue && typeof optionValue === 'object'\n ? optionValue.value.toString()\n : optionValue.toString();\n\n const optionsMap = useMemo(\n () => new Map(options.map(opt => [opt.value.toString(), opt])),\n [options],\n );\n\n const optionsWithSearch = useMemo(\n () =>\n options.map(opt => ({\n ...opt,\n searchString:\n `${opt.field1?.value || ''} ${opt.field1?.label || ''} ${opt.field2?.label || ''} ${opt.field2?.value || ''} ${opt.field3?.label || ''} ${opt.field3?.value || ''} ${opt.field4?.label || ''} ${opt.field4?.value || ''} ${opt.field5?.label || ''} ${opt.field5?.value || ''} ${opt.label}${opt.value}`\n .toLocaleUpperCase()\n .trim(),\n })) as Array<Option & { searchString: string }>,\n [options],\n );\n\n const formattedValue = useMemo(() => {\n if (multiple) {\n const values = Array.isArray(value) ? value : [];\n return values\n .map(v => optionsMap.get(v.toString()))\n .filter(Boolean) as Option[];\n }\n\n return (\n (value?.toString() ? optionsMap.get(value.toString()) : null) || null\n );\n }, [optionsMap, value, multiple]);\n\n const OPTION_HEIGHT =\n mdDown && options[0] ? Object.keys(options[0]).length * 24 : undefined;\n\n return (\n <MuiAutocomplete\n ref={ref}\n value={inputValue || formattedValue}\n onInputChange={(event, eventValue, reason) => {\n if (onInputChange) onInputChange(event, eventValue, reason);\n\n if (reason === 'input') {\n if (onSearch) onSearch(eventValue);\n setInputValue(eventValue);\n\n return;\n }\n\n setInputValue(undefined);\n }}\n options={optionsWithSearch}\n loading={loading}\n noOptionsText={noOptionsText}\n loadingText={loadingText}\n disabled={loading || disabled}\n disableListWrap\n PopperComponent={StyledPopper}\n ListboxProps={\n {\n 'data-item-height': OPTION_HEIGHT,\n } as HTMLAttributes<HTMLUListElement>\n }\n ListboxComponent={renderOption ? undefined : ListboxComponent}\n filterOptions={(opts, state) => {\n const searchUpper = state.inputValue.toLocaleUpperCase();\n return opts.filter(opt =>\n (opt as Option & { searchString: string }).searchString.includes(\n searchUpper,\n ),\n );\n }}\n onChange={(_, option) => {\n if (!option) {\n onChange(multiple ? [] : null);\n return;\n }\n\n if (Array.isArray(option)) {\n onChange(option.map(getOptionValue));\n return;\n }\n\n onChange(\n typeof option === 'string'\n ? option.toString()\n : option.value.toString(),\n );\n }}\n renderOption={({ key, ...props }, option) => {\n return (\n <li key={key} {...props} style={{ display: 'block' }}>\n <ListItem option={option} />\n </li>\n );\n }}\n renderGroup={params => params as unknown as ReactNode}\n groupBy={groupBy}\n multiple={multiple}\n renderInput={params => (\n <TextField\n {...params}\n name={name}\n placeholder={placeholder}\n fullWidth\n error={!!error}\n helperText={helperText}\n label={label}\n required={required}\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <>\n {loading ? (\n <CircularProgress color=\"primary\" size={20} />\n ) : null}\n {params.InputProps.endAdornment}\n </>\n ),\n }}\n inputProps={{\n ...params.inputProps,\n name,\n tabIndex,\n }}\n />\n )}\n {...other}\n />\n );\n },\n ),\n);\n\nAutocompleteDetailed.displayName = 'AutocompleteDetailed';\n\nexport default AutocompleteDetailed;\n","import React, { forwardRef, HTMLAttributes, type JSX, useEffect } from 'react';\nimport { ListChildComponentProps, VariableSizeList } from 'react-window';\nimport Typography from '@mui/material/Typography';\n\nimport ListItem from './ListItem';\n\nconst LISTBOX_PADDING = 8;\n\nconst renderRow = (props: ListChildComponentProps) => {\n const { data, index, style } = props;\n const dataSet = data[index];\n\n const inlineStyle = {\n ...style,\n top: (style.top as number) + LISTBOX_PADDING,\n paddingTop: 8,\n display: 'block',\n };\n\n return (\n <Typography component=\"li\" {...dataSet.props} noWrap style={inlineStyle}>\n <ListItem {...dataSet?.props?.children?.props} />\n </Typography>\n );\n};\n\nconst OuterElementContext = React.createContext({});\n\nconst OuterElementType = forwardRef<HTMLDivElement>((props, ref) => {\n const outerProps = React.useContext(OuterElementContext);\n return <div ref={ref} {...props} {...outerProps} />;\n});\n\nOuterElementType.displayName = 'OuterElementType';\n\nconst useResetCache = (data: number) => {\n const ref = React.useRef<VariableSizeList>(null);\n\n useEffect(() => {\n if (ref.current != null) {\n ref.current.resetAfterIndex(0, true);\n }\n }, [data]);\n\n return ref;\n};\n\nconst ListboxComponent = forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLElement>\n>(function ListboxComponent(props, ref) {\n const {\n children,\n // eslint-disable-next-line react/prop-types\n 'data-item-height': dataItemHeight,\n ...other\n } = props as { 'data-item-height': number } & HTMLAttributes<HTMLElement>;\n const itemData: JSX.Element[] = [];\n (children as JSX.Element[]).forEach(\n (item: JSX.Element & { children?: JSX.Element[] }) => {\n itemData.push(item);\n itemData.push(...(item.children || []));\n },\n );\n const itemCount = itemData.length;\n const itemSize = dataItemHeight > 112 ? dataItemHeight : 112;\n\n const getChildSize = (child: JSX.Element) => {\n if (Object.prototype.hasOwnProperty.call(child, 'group')) {\n return 48;\n }\n\n return itemSize;\n };\n\n const getHeight = () => {\n if (itemCount > 8) {\n return 8 * itemSize;\n }\n return itemData.map(getChildSize).reduce((a, b) => a + b, 0);\n };\n\n const gridRef = useResetCache(itemCount);\n\n return (\n <div ref={ref}>\n <OuterElementContext.Provider value={other}>\n <VariableSizeList\n itemData={itemData}\n height={getHeight() + 2 * LISTBOX_PADDING}\n width=\"100%\"\n ref={gridRef}\n outerElementType={OuterElementType}\n innerElementType=\"ul\"\n itemSize={index => getChildSize(itemData[index])}\n overscanCount={5}\n itemCount={itemCount}\n >\n {renderRow}\n </VariableSizeList>\n </OuterElementContext.Provider>\n </div>\n );\n});\n\nexport default ListboxComponent;\n","import Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport CustomAvatar from 'components/CustomAvatar';\n\nimport { ListItemProps } from './props';\nimport { ImageContainer, OptionBox, OptionContent } from './styles';\n\nconst ListItem = ({ option }: ListItemProps) => {\n const options = Object.keys(option)\n .filter(key => key.startsWith('field'))\n .map((key, index) => {\n const data = option[key];\n\n if (data && typeof data === 'object') {\n const label = ('label' in data ? data.label : null) as string;\n const value = ('value' in data ? data.value : null) as string;\n\n return (\n <Typography\n key={`${key}:${index}`}\n component=\"span\"\n variant=\"body2\"\n color=\"textPrimary\"\n noWrap\n >\n {label}: {value}\n </Typography>\n );\n }\n });\n\n const image = option.image ? (\n <img alt=\"Imagem\" src={option.image} />\n ) : (\n <CustomAvatar\n alt={option.label || option.value.toString()}\n name={option.label || option.value.toString()}\n sx={{ width: 68, height: 68, borderRadius: 1 }}\n />\n );\n\n return (\n <>\n <Stack direction=\"row\" gap={2} margin={2}>\n <ImageContainer>{image}</ImageContainer>\n\n <Stack flex={1} overflow=\"hidden\">\n <Typography variant=\"subtitle2\" color=\"textPrimary\" noWrap flex={1}>\n {option.value} - {option.label}\n </Typography>\n\n {options.length > 0 && (\n <OptionBox width={1}>\n <OptionContent>\n {options[0] ? options[0] : undefined}\n {options[1] ? options[1] : undefined}\n </OptionContent>\n\n {(options[2] || options[3]) && (\n <OptionContent>\n {options[2] ? options[2] : undefined}\n {options[3] ? options[3] : undefined}\n </OptionContent>\n )}\n </OptionBox>\n )}\n </Stack>\n </Stack>\n\n <Divider\n className=\"border\"\n sx={{\n borderStyle: 'dashed',\n position: 'absolute',\n bottom: 0,\n width: 1,\n }}\n />\n </>\n );\n};\n\nexport default ListItem;\n","import { autocompleteClasses } from '@mui/material/Autocomplete';\nimport Popper from '@mui/material/Popper';\nimport Stack from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\n\nexport const StyledPopper = styled(Popper)({\n [`& .${autocompleteClasses.listbox}`]: {\n boxSizing: 'border-box',\n '& ul': {\n padding: 0,\n margin: 0,\n },\n },\n});\n\nexport const OptionBox = styled(Stack)(({ theme }) => ({\n flex: 1,\n width: '100%',\n gap: 6,\n\n [theme.breakpoints.down('md')]: {\n flexDirection: 'column',\n },\n\n [theme.breakpoints.up('md')]: {\n flexDirection: 'row',\n },\n}));\n\nexport const OptionContent = styled(Stack)(({ theme }) => ({\n flex: 1,\n maxWidth: '100%',\n gap: 6,\n\n [theme.breakpoints.up('md')]: {\n flex: '1 1 calc(50% - 8px)',\n width: 'calc(50% - 8px)',\n minWidth: 'calc(50% - 8px)',\n maxWidth: 'calc(50% - 8px)',\n },\n}));\n\nexport const ImageContainer = styled(Stack)(({ theme }) => ({\n position: 'relative',\n alignItems: 'center',\n justifyContent: 'center',\n width: 68,\n height: 68,\n borderRadius: 8,\n overflow: 'hidden',\n\n img: {\n position: 'absolute',\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n },\n\n [theme.breakpoints.down('sm')]: {\n display: 'none',\n },\n}));\n"]}
|
|
File without changes
|
|
@@ -286,13 +286,10 @@ declare const components: {
|
|
|
286
286
|
MuiTimelineDot: {
|
|
287
287
|
defaultProps?: Partial<_mui_lab_TimelineDot.TimelineDotProps> | undefined;
|
|
288
288
|
styleOverrides?: Partial<_mui_material_styles_overrides.OverridesStyleRules<keyof _mui_lab_TimelineDot.TimelineDotClasses, "MuiTimelineDot", {
|
|
289
|
-
|
|
290
|
-
zIndex: _mui_material.ZIndex;
|
|
291
|
-
direction: _mui_system.Direction;
|
|
292
|
-
opacity: _mui_material.Opacity;
|
|
293
|
-
typography: _mui_material.TypographyVariants;
|
|
289
|
+
transitions: _mui_material.Transitions;
|
|
294
290
|
palette: _mui_material.Palette;
|
|
295
291
|
colorSchemes: Record<_mui_material.SupportedColorScheme, _mui_material.ColorSystem>;
|
|
292
|
+
cssVarPrefix: string;
|
|
296
293
|
vars: _mui_material.ThemeVars;
|
|
297
294
|
getCssVar: (field: _mui_material.ThemeCssVar, ...vars: _mui_material.ThemeCssVar[]) => string;
|
|
298
295
|
getColorSchemeSelector: (colorScheme: _mui_material.SupportedColorScheme) => string;
|
|
@@ -303,13 +300,16 @@ declare const components: {
|
|
|
303
300
|
spacing: _mui_system.Spacing;
|
|
304
301
|
breakpoints: _mui_system.Breakpoints;
|
|
305
302
|
shape: _mui_system.Shape;
|
|
306
|
-
|
|
303
|
+
typography: _mui_material.TypographyVariants;
|
|
307
304
|
shadows: _mui_material.Shadows;
|
|
308
305
|
mixins: _mui_material.Mixins;
|
|
306
|
+
zIndex: _mui_material.ZIndex;
|
|
307
|
+
direction: _mui_system.Direction;
|
|
309
308
|
shouldSkipGeneratingVar: (keys: string[], value: string | number) => boolean;
|
|
310
309
|
unstable_sxConfig: _mui_system.SxConfig;
|
|
311
310
|
unstable_sx: (props: _mui_system.SxProps<_mui_material.Theme>) => _mui_styled_engine.CSSObject;
|
|
312
311
|
applyStyles: _mui_system.ApplyStyles<"light" | "dark">;
|
|
312
|
+
opacity: _mui_material.Opacity;
|
|
313
313
|
overlays: _mui_material.Overlays;
|
|
314
314
|
customShadows: CustomShadows;
|
|
315
315
|
unstable_strictMode?: boolean | undefined;
|
|
@@ -326,13 +326,10 @@ declare const components: {
|
|
|
326
326
|
MuiTimelineConnector: {
|
|
327
327
|
defaultProps?: Partial<_mui_lab_TimelineConnector.TimelineConnectorProps> | undefined;
|
|
328
328
|
styleOverrides?: Partial<_mui_material_styles_overrides.OverridesStyleRules<"root", "MuiTimelineConnector", {
|
|
329
|
-
|
|
330
|
-
zIndex: _mui_material.ZIndex;
|
|
331
|
-
direction: _mui_system.Direction;
|
|
332
|
-
opacity: _mui_material.Opacity;
|
|
333
|
-
typography: _mui_material.TypographyVariants;
|
|
329
|
+
transitions: _mui_material.Transitions;
|
|
334
330
|
palette: _mui_material.Palette;
|
|
335
331
|
colorSchemes: Record<_mui_material.SupportedColorScheme, _mui_material.ColorSystem>;
|
|
332
|
+
cssVarPrefix: string;
|
|
336
333
|
vars: _mui_material.ThemeVars;
|
|
337
334
|
getCssVar: (field: _mui_material.ThemeCssVar, ...vars: _mui_material.ThemeCssVar[]) => string;
|
|
338
335
|
getColorSchemeSelector: (colorScheme: _mui_material.SupportedColorScheme) => string;
|
|
@@ -343,13 +340,16 @@ declare const components: {
|
|
|
343
340
|
spacing: _mui_system.Spacing;
|
|
344
341
|
breakpoints: _mui_system.Breakpoints;
|
|
345
342
|
shape: _mui_system.Shape;
|
|
346
|
-
|
|
343
|
+
typography: _mui_material.TypographyVariants;
|
|
347
344
|
shadows: _mui_material.Shadows;
|
|
348
345
|
mixins: _mui_material.Mixins;
|
|
346
|
+
zIndex: _mui_material.ZIndex;
|
|
347
|
+
direction: _mui_system.Direction;
|
|
349
348
|
shouldSkipGeneratingVar: (keys: string[], value: string | number) => boolean;
|
|
350
349
|
unstable_sxConfig: _mui_system.SxConfig;
|
|
351
350
|
unstable_sx: (props: _mui_system.SxProps<_mui_material.Theme>) => _mui_styled_engine.CSSObject;
|
|
352
351
|
applyStyles: _mui_system.ApplyStyles<"light" | "dark">;
|
|
352
|
+
opacity: _mui_material.Opacity;
|
|
353
353
|
overlays: _mui_material.Overlays;
|
|
354
354
|
customShadows: CustomShadows;
|
|
355
355
|
unstable_strictMode?: boolean | undefined;
|