@zydon/common 2.9.19 → 2.9.21
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-J52ETP4H.js +17 -0
- package/dist/chunk-J52ETP4H.js.map +1 -0
- package/dist/components/ColorPickerInput/index.d.ts +2 -2
- package/dist/components/ColorPickerInput/index.js +3 -1
- package/dist/components/form/ColorPicker/index.d.ts +1 -1
- package/dist/components/form/ColorPicker/index.js +4 -2
- package/dist/components/form/ColorPicker/index.js.map +1 -1
- package/dist/components/form/SelectableCards/index.js +2 -2
- package/dist/components/form/SelectableCards/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-QSHKTHGM.js +0 -15
- package/dist/chunk-QSHKTHGM.js.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { a as a$1 } from './chunk-JGASCDBR.js';
|
|
2
|
+
import { a } from './chunk-LQRRMVFN.js';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import A from '@mui/material/Box';
|
|
5
|
+
import d from '@mui/material/IconButton';
|
|
6
|
+
import u from '@mui/material/InputAdornment';
|
|
7
|
+
import { inputBaseClasses } from '@mui/material/InputBase';
|
|
8
|
+
import y from '@mui/material/Popover';
|
|
9
|
+
import E from '@mui/material/TextField';
|
|
10
|
+
import { ChromePicker } from 'react-color';
|
|
11
|
+
import { styled } from '@mui/material/styles';
|
|
12
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
var c=styled(ChromePicker)({fontFamily:"inherit",boxShadow:"none"});var O=({value:C,tabIndex:f,onChangeColor:e,...r})=>{let[P,p]=useState(),l=P??C??"",n=l?"#"+l.replaceAll("#",""):"",t=a(),g=()=>{t.onClose(),e(n);},x=i=>{let a=i.target.value.replace(/[^0-9a-fA-F#]/g,"").replaceAll("#","");p(a),e(a?"#"+a:"");},I=()=>{p(""),e("");};return jsxs(Fragment,{children:[jsx(E,{...r,value:n,onChange:x,InputProps:{...r.InputProps,sx:{[`& .${inputBaseClasses.input}`]:{paddingLeft:"0 !important",paddingRight:"0 !important"},...r.InputProps?.sx},startAdornment:jsx(u,{position:"start",sx:{mr:.5},children:jsx(d,{"aria-label":"Escolher cor",onClick:t.onOpen,sx:{p:.5},children:jsx(A,{sx:{minWidth:23,minHeight:23,backgroundColor:n,borderRadius:.5,boxShadow:"0 0 0 2px rgba(0, 0, 0, 0.0375)"}})})}),endAdornment:jsxs(u,{position:"end",sx:{ml:0,gap:.5},children:[!!n&&jsx(d,{"aria-label":"Remover cor",size:"small",onClick:I,sx:{p:.5},children:jsx(a$1,{icon:"CLOSE_MARK_BUTTON",width:16})}),r.InputProps?.endAdornment]})},inputProps:{...r.inputProps,maxLength:7,tabIndex:f}}),jsx(y,{className:"popover-color-picker",open:!!t.open,anchorEl:t.open,onClose:g,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"center",horizontal:"center"},slotProps:{paper:{style:{borderRadius:8}}},children:jsx(c,{color:n,onChange:({hex:i})=>p(i),styles:{default:{picker:{fontFamily:"inherit",boxShadow:"none"}}},disableAlpha:!0})})]})},W=O;
|
|
15
|
+
|
|
16
|
+
export { W as a };
|
|
17
|
+
//# sourceMappingURL=chunk-J52ETP4H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ColorPickerInput/index.tsx","../src/components/ColorPickerInput/styles.ts"],"names":["useState","Box","IconButton","InputAdornment","inputBaseClasses","Popover","TextField","ChromePickerOrigin","styled","ChromePicker","Fragment","jsx","jsxs","ColorPickerInput","value","tabIndex","onChangeColor","other","draftColor","setDraftColor","currentColor","hexValue","popover","usePopover_default","handleCloseColorPicker","handleChangeInput","event","typedColor","handleClearColor","Icon_default","hex","ColorPickerInput_default"],"mappings":"gFAAA,OAAsB,YAAAA,MAAgB,QACtC,OAAOC,MAAS,oBAChB,OAAOC,MAAgB,2BACvB,OAAOC,MAAoB,+BAC3B,OAAS,oBAAAC,MAAwB,0BACjC,OAAOC,MAAa,wBACpB,OAAOC,MAAe,0BCNtB,OAAS,gBAAgBC,MAA0B,cACnD,OAAS,UAAAC,MAAc,uBAEhB,IAAMC,EAAeD,EAAOD,CAAkB,EAAE,CACrD,WAAY,UACZ,UAAW,MACb,CAAC,EDyCG,mBAAAG,EAqBY,OAAAC,EAaJ,QAAAC,MAlCR,oBAjCJ,IAAMC,EAAmB,CAAC,CACxB,MAAAC,EACA,SAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IAA6B,CAC3B,GAAM,CAACC,EAAYC,CAAa,EAAInB,EAAiB,EAE/CoB,EAAeF,GAAcJ,GAAS,GACtCO,EAAWD,EAAe,IAAMA,EAAa,WAAW,IAAK,EAAE,EAAI,GAEnEE,EAAUC,EAAW,EAErBC,EAAyB,IAAM,CACnCF,EAAQ,QAAQ,EAChBN,EAAcK,CAAQ,CACxB,EAEMI,EAAqBC,GAAyC,CAClE,IAAMC,EAAaD,EAAM,OAAO,MAC7B,QAAQ,iBAAkB,EAAE,EAC5B,WAAW,IAAK,EAAE,EAErBP,EAAcQ,CAAU,EACxBX,EAAcW,EAAa,IAAMA,EAAa,EAAE,CAClD,EAEMC,EAAmB,IAAM,CAC7BT,EAAc,EAAE,EAChBH,EAAc,EAAE,CAClB,EAEA,OACEJ,EAAAF,EAAA,CACE,UAAAC,EAACL,EAAA,CACE,GAAGW,EACJ,MAAOI,EACP,SAAUI,EACV,WAAY,CACV,GAAGR,EAAM,WACT,GAAI,CACF,CAAC,MAAMb,EAAiB,OAAO,EAAG,CAChC,YAAa,eACb,aAAc,cAChB,EACA,GAAGa,EAAM,YAAY,EACvB,EACA,eACEN,EAACR,EAAA,CAAe,SAAS,QAAQ,GAAI,CAAE,GAAI,EAAI,EAC7C,SAAAQ,EAACT,EAAA,CACC,aAAW,eACX,QAASoB,EAAQ,OACjB,GAAI,CAAE,EAAG,EAAI,EAEb,SAAAX,EAACV,EAAA,CACC,GAAI,CACF,SAAU,GACV,UAAW,GACX,gBAAiBoB,EACjB,aAAc,GACd,UAAW,iCACb,EACF,EACF,EACF,EAEF,aACET,EAACT,EAAA,CAAe,SAAS,MAAM,GAAI,CAAE,GAAI,EAAG,IAAK,EAAI,EAClD,WAAC,CAACkB,GACDV,EAACT,EAAA,CACC,aAAW,cACX,KAAK,QACL,QAAS0B,EACT,GAAI,CAAE,EAAG,EAAI,EAEb,SAAAjB,EAACkB,EAAA,CAAK,KAAK,oBAAoB,MAAO,GAAI,EAC5C,EAGDZ,EAAM,YAAY,cACrB,CAEJ,EACA,WAAY,CACV,GAAGA,EAAM,WACT,UAAW,EACX,SAAAF,CACF,EACF,EACAJ,EAACN,EAAA,CACC,UAAU,uBACV,KAAM,EAAQiB,EAAQ,KACtB,SAAUA,EAAQ,KAClB,QAASE,EACT,aAAc,CACZ,SAAU,SACV,WAAY,QACd,EACA,gBAAiB,CACf,SAAU,SACV,WAAY,QACd,EACA,UAAW,CACT,MAAO,CACL,MAAO,CAAE,aAAc,CAAE,CAC3B,CACF,EAEA,SAAAb,EAACF,EAAA,CACC,MAAOY,EACP,SAAU,CAAC,CAAE,IAAAS,CAAI,IAAuBX,EAAcW,CAAG,EACzD,OAAQ,CACN,QAAS,CACP,OAAQ,CACN,WAAY,UACZ,UAAW,MACb,CACF,CACF,EACA,aAAY,GACd,EACF,GACF,CAEJ,EAEOC,EAAQlB","sourcesContent":["import { ChangeEvent, useState } from 'react';\nimport Box from '@mui/material/Box';\nimport IconButton from '@mui/material/IconButton';\nimport InputAdornment from '@mui/material/InputAdornment';\nimport { inputBaseClasses } from '@mui/material/InputBase';\nimport Popover from '@mui/material/Popover';\nimport TextField from '@mui/material/TextField';\n\nimport Icon from 'components/Icon';\nimport usePopover from 'hooks/usePopover';\n\nimport { ColorPickerInputProps } from './props';\nimport { ChromePicker } from './styles';\n\nconst ColorPickerInput = ({\n value,\n tabIndex,\n onChangeColor,\n ...other\n}: ColorPickerInputProps) => {\n const [draftColor, setDraftColor] = useState<string>();\n\n const currentColor = draftColor ?? value ?? '';\n const hexValue = currentColor ? '#' + currentColor.replaceAll('#', '') : '';\n\n const popover = usePopover();\n\n const handleCloseColorPicker = () => {\n popover.onClose();\n onChangeColor(hexValue);\n };\n\n const handleChangeInput = (event: ChangeEvent<HTMLInputElement>) => {\n const typedColor = event.target.value\n .replace(/[^0-9a-fA-F#]/g, '')\n .replaceAll('#', '');\n\n setDraftColor(typedColor);\n onChangeColor(typedColor ? '#' + typedColor : '');\n };\n\n const handleClearColor = () => {\n setDraftColor('');\n onChangeColor('');\n };\n\n return (\n <>\n <TextField\n {...other}\n value={hexValue}\n onChange={handleChangeInput}\n InputProps={{\n ...other.InputProps,\n sx: {\n [`& .${inputBaseClasses.input}`]: {\n paddingLeft: '0 !important',\n paddingRight: '0 !important',\n },\n ...other.InputProps?.sx,\n },\n startAdornment: (\n <InputAdornment position=\"start\" sx={{ mr: 0.5 }}>\n <IconButton\n aria-label=\"Escolher cor\"\n onClick={popover.onOpen}\n sx={{ p: 0.5 }}\n >\n <Box\n sx={{\n minWidth: 23,\n minHeight: 23,\n backgroundColor: hexValue,\n borderRadius: 0.5,\n boxShadow: '0 0 0 2px rgba(0, 0, 0, 0.0375)',\n }}\n />\n </IconButton>\n </InputAdornment>\n ),\n endAdornment: (\n <InputAdornment position=\"end\" sx={{ ml: 0, gap: 0.5 }}>\n {!!hexValue && (\n <IconButton\n aria-label=\"Remover cor\"\n size=\"small\"\n onClick={handleClearColor}\n sx={{ p: 0.5 }}\n >\n <Icon icon=\"CLOSE_MARK_BUTTON\" width={16} />\n </IconButton>\n )}\n\n {other.InputProps?.endAdornment}\n </InputAdornment>\n ),\n }}\n inputProps={{\n ...other.inputProps,\n maxLength: 7,\n tabIndex,\n }}\n />\n <Popover\n className=\"popover-color-picker\"\n open={Boolean(popover.open)}\n anchorEl={popover.open}\n onClose={handleCloseColorPicker}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'center',\n horizontal: 'center',\n }}\n slotProps={{\n paper: {\n style: { borderRadius: 8 },\n },\n }}\n >\n <ChromePicker\n color={hexValue}\n onChange={({ hex }: { hex: string }) => setDraftColor(hex)}\n styles={{\n default: {\n picker: {\n fontFamily: 'inherit',\n boxShadow: 'none',\n },\n },\n }}\n disableAlpha\n />\n </Popover>\n </>\n );\n};\n\nexport default ColorPickerInput;\n","import { ChromePicker as ChromePickerOrigin } from 'react-color';\nimport { styled } from '@mui/material/styles';\n\nexport const ChromePicker = styled(ChromePickerOrigin)({\n fontFamily: 'inherit',\n boxShadow: 'none',\n});\n"]}
|
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
3
|
|
|
4
4
|
type HEX = `#${string}`;
|
|
5
|
-
type ColorPickerInputProps = TextFieldProps & {
|
|
6
|
-
value
|
|
5
|
+
type ColorPickerInputProps = Omit<TextFieldProps, 'value'> & {
|
|
6
|
+
value?: HEX | string | null;
|
|
7
7
|
onChangeColor(color: string): void;
|
|
8
8
|
};
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import { TextFieldProps } from '@mui/material/TextField';
|
|
|
3
3
|
import { BaseField } from '../../../types/baseField.js';
|
|
4
4
|
import 'react-hook-form';
|
|
5
5
|
|
|
6
|
-
type ColorPickerProps = BaseField<TextFieldProps
|
|
6
|
+
type ColorPickerProps = BaseField<Omit<TextFieldProps, 'value'>> & {
|
|
7
7
|
onChangeColor?: (color: string) => void;
|
|
8
8
|
};
|
|
9
9
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { a } from '../../../chunk-
|
|
1
|
+
import { a } from '../../../chunk-J52ETP4H.js';
|
|
2
|
+
import '../../../chunk-JGASCDBR.js';
|
|
3
|
+
import '../../../chunk-TPOL2YXC.js';
|
|
2
4
|
import '../../../chunk-LQRRMVFN.js';
|
|
3
5
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
4
6
|
import { jsx } from 'react/jsx-runtime';
|
|
5
7
|
|
|
6
|
-
var m=({name:
|
|
8
|
+
var m=({name:t,rules:o,helperText:u,onChangeColor:c,...d})=>{let{control:p}=useFormContext();return jsx(Controller,{name:t,control:p,rules:{...o,validate:{...o?.validate,validation:e=>{if(!e)return !0;let r="#"+e.replaceAll("#","");return /^#([0-9A-Fa-f]{3}){1,2}$/.test(r)?!0:"Cor inv\xE1lida"}}},render:({field:{ref:e,onChange:r,...l},fieldState:{error:n}})=>jsx(a,{...l,onChangeColor:i=>{r(i),c?.(i);},inputRef:e,fullWidth:!0,error:!!n,helperText:n?.message||u,"data-intercom-target":t,...d})})},P=m;
|
|
7
9
|
|
|
8
10
|
export { P as default };
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/form/ColorPicker/index.tsx"],"names":["Controller","useFormContext","jsx","ColorPicker","name","rules","helperText","onChangeColor","other","control","v","fValue","ref","onChange","field","error","ColorPickerInput_default","color","ColorPicker_default"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/form/ColorPicker/index.tsx"],"names":["Controller","useFormContext","jsx","ColorPicker","name","rules","helperText","onChangeColor","other","control","v","fValue","ref","onChange","field","error","ColorPickerInput_default","color","ColorPicker_default"],"mappings":"mJAAA,OAAS,cAAAA,EAAY,kBAAAC,MAAsB,kBAuCnC,cAAAC,MAAA,oBAjCR,IAAMC,EAAc,CAAC,CACnB,KAAAC,EACA,MAAAC,EACA,WAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IAAwB,CACtB,GAAM,CAAE,QAAAC,CAAQ,EAAIR,EAAe,EAEnC,OACEC,EAACF,EAAA,CACC,KAAMI,EACN,QAASK,EACT,MAAO,CACL,GAAGJ,EACH,SAAU,CACR,GAAGA,GAAO,SACV,WAAaK,GAAsB,CACjC,GAAI,CAACA,EAAG,MAAO,GAEf,IAAMC,EAAS,IAAMD,EAAE,WAAW,IAAK,EAAE,EAGzC,MAFiB,2BAEH,KAAKC,CAAM,EAElB,GAF4B,iBAGrC,CACF,CACF,EACA,OAAQ,CAAC,CACP,MAAO,CAAE,IAAAC,EAAK,SAAAC,EAAU,GAAGC,CAAM,EACjC,WAAY,CAAE,MAAAC,CAAM,CACtB,IACEb,EAACc,EAAA,CACE,GAAGF,EACJ,cAAeG,GAAS,CACtBJ,EAASI,CAAK,EACdV,IAAgBU,CAAK,CACvB,EACA,SAAUL,EACV,UAAS,GACT,MAAO,CAAC,CAACG,EACT,WAAYA,GAAO,SAAWT,EAC9B,uBAAsBF,EACrB,GAAGI,EACN,EAEJ,CAEJ,EAEOU,EAAQf","sourcesContent":["import { Controller, useFormContext } from 'react-hook-form';\n\nimport ColorPickerInput from 'components/ColorPickerInput';\n\nimport { ColorPickerProps } from './props';\n\nconst ColorPicker = ({\n name,\n rules,\n helperText,\n onChangeColor,\n ...other\n}: ColorPickerProps) => {\n const { control } = useFormContext();\n\n return (\n <Controller\n name={name}\n control={control}\n rules={{\n ...rules,\n validate: {\n ...rules?.validate,\n validation: (v?: string | null) => {\n if (!v) return true;\n\n const fValue = '#' + v.replaceAll('#', '');\n const hexRegex = /^#([0-9A-Fa-f]{3}){1,2}$/;\n\n if (!hexRegex.test(fValue)) return 'Cor inválida';\n\n return true;\n },\n },\n }}\n render={({\n field: { ref, onChange, ...field },\n fieldState: { error },\n }) => (\n <ColorPickerInput\n {...field}\n onChangeColor={color => {\n onChange(color);\n onChangeColor?.(color);\n }}\n inputRef={ref}\n fullWidth\n error={!!error}\n helperText={error?.message || helperText}\n data-intercom-target={name}\n {...other}\n />\n )}\n />\n );\n};\n\nexport default ColorPicker;\n"]}
|
|
@@ -9,7 +9,7 @@ import '../../../chunk-TPOL2YXC.js';
|
|
|
9
9
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
10
10
|
import { jsx } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var C=({name:r,rules:t,...l})=>{let{control:n}=useFormContext();return jsx(Controller,{name:r,control:n,rules:t,render:({field:{onChange:a$1}})=>jsx(a,{...l,onChange:a$1})})},p=C;
|
|
13
13
|
|
|
14
|
-
export {
|
|
14
|
+
export { p as default };
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/form/SelectableCards/index.tsx"],"names":["Controller","useFormContext","jsx","SelectableCards","name","rules","other","control","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/form/SelectableCards/index.tsx"],"names":["Controller","useFormContext","jsx","SelectableCards","name","rules","other","control","onChange","SelectableCards_default"],"mappings":"oSAAA,OAAS,cAAAA,EAAY,kBAAAC,MAAsB,kBAenC,cAAAC,MAAA,oBATR,IAAMC,EAAkB,CAAC,CAAE,KAAAC,EAAM,MAAAC,EAAO,GAAGC,CAAM,IAA4B,CAC3E,GAAM,CAAE,QAAAC,CAAQ,EAAIN,EAAe,EAEnC,OACEC,EAACF,EAAA,CACC,KAAMI,EACN,QAASG,EACT,MAAOF,EACP,OAAQ,CAAC,CAAE,MAAO,CAAE,SAAAG,CAAS,CAAE,IAC7BN,EAACO,EAAA,CAA0B,GAAGH,EAAO,SAAUE,EAAU,EAE7D,CAEJ,EAEOC,EAAQN","sourcesContent":["import { Controller, useFormContext } from 'react-hook-form';\n\nimport SelectableCardsComponent from 'components/SelectableCards';\n\nimport { SelectableCardsProps } from './props';\n\nconst SelectableCards = ({ name, rules, ...other }: SelectableCardsProps) => {\n const { control } = useFormContext();\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ field: { onChange } }) => (\n <SelectableCardsComponent {...other} onChange={onChange} />\n )}\n />\n );\n};\n\nexport default SelectableCards;\n"]}
|
package/package.json
CHANGED
package/dist/chunk-QSHKTHGM.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-LQRRMVFN.js';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import C from '@mui/material/Box';
|
|
4
|
-
import g from '@mui/material/IconButton';
|
|
5
|
-
import k from '@mui/material/InputAdornment';
|
|
6
|
-
import x from '@mui/material/Popover';
|
|
7
|
-
import b from '@mui/material/TextField';
|
|
8
|
-
import { ChromePicker } from 'react-color';
|
|
9
|
-
import { styled } from '@mui/material/styles';
|
|
10
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
11
|
-
|
|
12
|
-
var p=styled(ChromePicker)({fontFamily:"inherit",boxShadow:"none"});var I=({value:l,tabIndex:s,onChangeColor:a$1,...t})=>{let[m,c]=useState(),n=m||l,r=n?"#"+n.replaceAll("#",""):"",e=a(),u=()=>{e.onClose(),a$1(r);};return jsxs(Fragment,{children:[jsx(b,{...t,value:r,InputProps:{...t.InputProps,startAdornment:jsx(k,{position:"start",sx:{ml:2},children:jsx(g,{edge:"start","aria-label":"Escolher cor",onClick:e.onOpen,children:jsx(C,{sx:{minWidth:23,minHeight:23,backgroundColor:r,borderRadius:.5,boxShadow:"0 0 0 2px rgba(0, 0, 0, 0.0375)"}})})})},inputProps:{readOnly:!0,...t.inputProps,maxLength:7,tabIndex:s}}),jsx(x,{className:"popover-color-picker",open:!!e.open,anchorEl:e.open,onClose:u,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"center",horizontal:"center"},slotProps:{paper:{style:{borderRadius:8}}},children:jsx(p,{color:r,onChange:({hex:d})=>c(d),styles:{default:{picker:{fontFamily:"inherit",boxShadow:"none"}}},disableAlpha:!0})})]})},L=I;
|
|
13
|
-
|
|
14
|
-
export { L as a };
|
|
15
|
-
//# sourceMappingURL=chunk-QSHKTHGM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ColorPickerInput/index.tsx","../src/components/ColorPickerInput/styles.ts"],"names":["useState","Box","IconButton","InputAdornment","Popover","TextField","ChromePickerOrigin","styled","ChromePicker","Fragment","jsx","jsxs","ColorPickerInput","value","tabIndex","onChangeColor","other","color","setColor","currentColor","hexValue","popover","usePopover_default","handleCloseColorPicker","hex","ColorPickerInput_default"],"mappings":"wCAAA,OAAS,YAAAA,MAAgB,QACzB,OAAOC,MAAS,oBAChB,OAAOC,MAAgB,2BACvB,OAAOC,MAAoB,+BAC3B,OAAOC,MAAa,wBACpB,OAAOC,MAAe,0BCLtB,OAAS,gBAAgBC,MAA0B,cACnD,OAAS,UAAAC,MAAc,uBAEhB,IAAMC,EAAeD,EAAOD,CAAkB,EAAE,CACrD,WAAY,UACZ,UAAW,MACb,CAAC,EDwBG,mBAAAG,EAaY,OAAAC,EAbZ,QAAAC,MAAA,oBAlBJ,IAAMC,EAAmB,CAAC,CACxB,MAAAC,EACA,SAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IAA6B,CAC3B,GAAM,CAACC,EAAOC,CAAQ,EAAIlB,EAAuB,EAC3CmB,EAAeF,GAASJ,EACxBO,EAAWD,EAAe,IAAMA,EAAa,WAAW,IAAK,EAAE,EAAI,GAEnEE,EAAUC,EAAW,EAErBC,EAAyB,IAAM,CACnCF,EAAQ,QAAQ,EAChBN,EAAcK,CAAQ,CACxB,EAEA,OACET,EAAAF,EAAA,CACE,UAAAC,EAACL,EAAA,CACE,GAAGW,EACJ,MAAOI,EACP,WAAY,CACV,GAAGJ,EAAM,WACT,eACEN,EAACP,EAAA,CAAe,SAAS,QAAQ,GAAI,CAAE,GAAI,CAAE,EAC3C,SAAAO,EAACR,EAAA,CACC,KAAK,QACL,aAAW,eACX,QAASmB,EAAQ,OAEjB,SAAAX,EAACT,EAAA,CACC,GAAI,CACF,SAAU,GACV,UAAW,GACX,gBAAiBmB,EACjB,aAAc,GACd,UAAW,iCACb,EACF,EACF,EACF,CAEJ,EACA,WAAY,CACV,SAAU,GACV,GAAGJ,EAAM,WACT,UAAW,EACX,SAAAF,CACF,EACF,EACAJ,EAACN,EAAA,CACC,UAAU,uBACV,KAAM,EAAQiB,EAAQ,KACtB,SAAUA,EAAQ,KAClB,QAASE,EACT,aAAc,CACZ,SAAU,SACV,WAAY,QACd,EACA,gBAAiB,CACf,SAAU,SACV,WAAY,QACd,EACA,UAAW,CACT,MAAO,CACL,MAAO,CAAE,aAAc,CAAE,CAC3B,CACF,EAEA,SAAAb,EAACF,EAAA,CACC,MAAOY,EACP,SAAU,CAAC,CAAE,IAAAI,CAAI,IAAuBN,EAASM,CAAmB,EACpE,OAAQ,CACN,QAAS,CACP,OAAQ,CACN,WAAY,UACZ,UAAW,MACb,CACF,CACF,EACA,aAAY,GACd,EACF,GACF,CAEJ,EAEOC,EAAQb","sourcesContent":["import { useState } from 'react';\nimport Box from '@mui/material/Box';\nimport IconButton from '@mui/material/IconButton';\nimport InputAdornment from '@mui/material/InputAdornment';\nimport Popover from '@mui/material/Popover';\nimport TextField from '@mui/material/TextField';\n\nimport usePopover from 'hooks/usePopover';\n\nimport { ColorPickerInputProps } from './props';\nimport { ChromePicker } from './styles';\n\nconst ColorPickerInput = ({\n value,\n tabIndex,\n onChangeColor,\n ...other\n}: ColorPickerInputProps) => {\n const [color, setColor] = useState<`#${string}`>();\n const currentColor = color || value;\n const hexValue = currentColor ? '#' + currentColor.replaceAll('#', '') : '';\n\n const popover = usePopover();\n\n const handleCloseColorPicker = () => {\n popover.onClose();\n onChangeColor(hexValue);\n };\n\n return (\n <>\n <TextField\n {...other}\n value={hexValue}\n InputProps={{\n ...other.InputProps,\n startAdornment: (\n <InputAdornment position=\"start\" sx={{ ml: 2 }}>\n <IconButton\n edge=\"start\"\n aria-label=\"Escolher cor\"\n onClick={popover.onOpen}\n >\n <Box\n sx={{\n minWidth: 23,\n minHeight: 23,\n backgroundColor: hexValue,\n borderRadius: 0.5,\n boxShadow: '0 0 0 2px rgba(0, 0, 0, 0.0375)',\n }}\n />\n </IconButton>\n </InputAdornment>\n ),\n }}\n inputProps={{\n readOnly: true,\n ...other.inputProps,\n maxLength: 7,\n tabIndex,\n }}\n />\n <Popover\n className=\"popover-color-picker\"\n open={Boolean(popover.open)}\n anchorEl={popover.open}\n onClose={handleCloseColorPicker}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'center',\n horizontal: 'center',\n }}\n slotProps={{\n paper: {\n style: { borderRadius: 8 },\n },\n }}\n >\n <ChromePicker\n color={hexValue}\n onChange={({ hex }: { hex: string }) => setColor(hex as `#${string}`)}\n styles={{\n default: {\n picker: {\n fontFamily: 'inherit',\n boxShadow: 'none',\n },\n },\n }}\n disableAlpha\n />\n </Popover>\n </>\n );\n};\n\nexport default ColorPickerInput;\n","import { ChromePicker as ChromePickerOrigin } from 'react-color';\nimport { styled } from '@mui/material/styles';\n\nexport const ChromePicker = styled(ChromePickerOrigin)({\n fontFamily: 'inherit',\n boxShadow: 'none',\n});\n"]}
|