@zydon/common 2.7.89 → 2.7.90

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.
@@ -3,8 +3,10 @@ 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<TextFieldProps> & {
7
+ onChangeColor?: (color: string) => void;
8
+ };
7
9
 
8
- declare const ColorPicker: ({ name, rules, helperText, ...other }: ColorPickerProps) => react_jsx_runtime.JSX.Element;
10
+ declare const ColorPicker: ({ name, rules, helperText, onChangeColor, ...other }: ColorPickerProps) => react_jsx_runtime.JSX.Element;
9
11
 
10
12
  export { ColorPicker as default };
@@ -3,8 +3,8 @@ import '../../../chunk-LQRRMVFN.js';
3
3
  import { useFormContext, Controller } from 'react-hook-form';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
6
- var u=({name:o,rules:t,helperText:c,...f})=>{let{control:d}=useFormContext();return jsx(Controller,{name:o,control:d,rules:{...t,validate:{...t?.validate,validation:e=>{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:i}})=>jsx(a,{...l,onChangeColor:r,inputRef:e,fullWidth:!0,error:!!i,helperText:i?.message||c,"data-intercom-target":o,...f})})},g=u;
6
+ var m=({name:o,rules:t,helperText:c,onChangeColor:d,...p})=>{let{control:s}=useFormContext();return jsx(Controller,{name:o,control:s,rules:{...t,validate:{...t?.validate,validation:e=>{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:i}})=>jsx(a,{...l,onChangeColor:n=>{r(n),d?.(n);},inputRef:e,fullWidth:!0,error:!!i,helperText:i?.message||c,"data-intercom-target":o,...p})})},P=m;
7
7
 
8
- export { g as default };
8
+ export { P as default };
9
9
  //# sourceMappingURL=out.js.map
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/form/ColorPicker/index.tsx"],"names":["Controller","useFormContext","jsx","ColorPicker","name","rules","helperText","other","control","v","fValue","ref","onChange","field","error","ColorPickerInput_default","ColorPicker_default"],"mappings":"kFAAA,OAAS,cAAAA,EAAY,kBAAAC,MAAsB,kBAoCnC,cAAAC,MAAA,oBA9BR,IAAMC,EAAc,CAAC,CACnB,KAAAC,EACA,MAAAC,EACA,WAAAC,EACA,GAAGC,CACL,IAAwB,CACtB,GAAM,CAAE,QAAAC,CAAQ,EAAIP,EAAe,EAEnC,OACEC,EAACF,EAAA,CACC,KAAMI,EACN,QAASI,EACT,MAAO,CACL,GAAGH,EACH,SAAU,CACR,GAAGA,GAAO,SACV,WAAaI,GAAc,CACzB,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,IACEZ,EAACa,EAAA,CACE,GAAGF,EACJ,cAAeD,EACf,SAAUD,EACV,UAAS,GACT,MAAO,CAAC,CAACG,EACT,WAAYA,GAAO,SAAWR,EAC9B,uBAAsBF,EACrB,GAAGG,EACN,EAEJ,CAEJ,EAEOS,EAAQb","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 ...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) => {\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={onChange}\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"]}
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":"6EAAA,OAAS,cAAAA,EAAY,kBAAAC,MAAsB,kBAqCnC,cAAAC,MAAA,oBA/BR,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,GAAc,CACzB,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) => {\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.7.89",
3
+ "version": "2.7.90",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",