@dartech/arsenal-ui 1.3.39 → 1.3.41

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/index.js CHANGED
@@ -593,7 +593,9 @@ const ControlRadio = ({
593
593
  labelKey,
594
594
  valueKey,
595
595
  validate,
596
- onChange: customOnChange
596
+ onChange: customOnChange,
597
+ row,
598
+ radioProps
597
599
  }) => {
598
600
  const {
599
601
  field: {
@@ -633,6 +635,7 @@ const ControlRadio = ({
633
635
  }, {
634
636
  children: label
635
637
  })), jsx(RadioGroup, Object.assign({
638
+ row: row,
636
639
  "aria-labelledby": "radio-buttons-group",
637
640
  ref: ref,
638
641
  name: name,
@@ -641,7 +644,7 @@ const ControlRadio = ({
641
644
  }, {
642
645
  children: _values.map((item, i) => jsx(FormControlLabel, {
643
646
  value: getValue(item),
644
- control: jsx(Radio, {}),
647
+ control: jsx(Radio, Object.assign({}, radioProps)),
645
648
  label: getLabel(item)
646
649
  }, i))
647
650
  })), !hideErrorMessage && (error === null || error === void 0 ? void 0 : error.message) && jsx(FormHelperText, {
@@ -3879,12 +3882,14 @@ const PropertyFiller = ({
3879
3882
  required,
3880
3883
  useExpression
3881
3884
  });
3882
- const handleFillOptionChange = event => {
3885
+ const handleFillOptionChange = useCallback(event => {
3883
3886
  const selectedType = event.target.value;
3884
3887
  if (selectedType === 'null') {
3885
- onChange(null);
3888
+ // onChange(null);
3889
+ clearErrors(name);
3886
3890
  // register(name, { value: null });
3887
3891
  } else if (selectedType === 'widget') {
3892
+ clearErrors(name);
3888
3893
  if (propertyType === PropertyType.JSON && value && typeof value !== 'string' && fillOption === 'dem_builder' && 'properties' in value) {
3889
3894
  const definitionValue = Object.assign(Object.assign({}, value), {
3890
3895
  properties: propertiesArrayToObject(value.property || [])
@@ -3921,7 +3926,7 @@ const PropertyFiller = ({
3921
3926
  }
3922
3927
  setFillOption(selectedType);
3923
3928
  clearErrors(name);
3924
- };
3929
+ }, [name, clearErrors, value, setFillOption, onChange, fillOption, propertyType]);
3925
3930
  useEffect(() => {
3926
3931
  if (value === undefined) {
3927
3932
  onChange(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.3.39",
3
+ "version": "1.3.41",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { RadioProps } from '@mui/material/Radio';
2
3
  import { Control } from 'react-hook-form';
3
4
  import { ValidateFunc } from '../../interfaces';
4
5
  /**
@@ -57,10 +58,12 @@ export interface ControlRadioProps {
57
58
  * Key for option value
58
59
  */
59
60
  valueKey?: string;
61
+ row?: boolean;
62
+ radioProps?: RadioProps;
60
63
  }
61
64
  /**
62
65
  * Material UI `Radio` controlled component. Used with react-hook-form
63
66
  * @category Forms
64
67
  */
65
- export declare const ControlRadio: ({ name, label, values, control, required, defaultValue, disabled, hideErrorMessage, labelKey, valueKey, validate, onChange: customOnChange, }: ControlRadioProps) => JSX.Element;
68
+ export declare const ControlRadio: ({ name, label, values, control, required, defaultValue, disabled, hideErrorMessage, labelKey, valueKey, validate, onChange: customOnChange, row, radioProps }: ControlRadioProps) => JSX.Element;
66
69
  export default ControlRadio;