@pdg/react-form 1.1.18 → 1.1.19

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.
@@ -15,6 +15,8 @@ export interface PFormRadioGroupProps<BaseValue extends PFormRadioGroupSingleVal
15
15
  inline?: boolean;
16
16
  loading?: boolean;
17
17
  nowrap?: boolean;
18
+ startAdornment?: ReactNode;
19
+ endAdornment?: ReactNode;
18
20
  onLoadItems?: () => Promise<Items>;
19
21
  onValue?: (value: PFormRadioGroupValue<Value>) => PFormRadioGroupValue<Value>;
20
22
  }
@@ -20,6 +20,8 @@ export interface PFormToggleButtonGroupProps<T extends PFormToggleButtonGroupSin
20
20
  formValueSort?: boolean;
21
21
  loading?: boolean;
22
22
  itemWidth?: number | string;
23
+ startAdornment?: ReactNode;
24
+ endAdornment?: ReactNode;
23
25
  onLoadItems?: () => Promise<Items>;
24
26
  onValue?: (value: Value) => Value;
25
27
  }
package/dist/index.esm.js CHANGED
@@ -2734,13 +2734,13 @@ var PFormRadioGroup = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_
2734
2734
  /********************************************************************************************************************
2735
2735
  * type
2736
2736
  * ******************************************************************************************************************/
2737
- var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initFullWidth = _a.fullWidth, initHidden = _a.hidden,
2737
+ var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initFullWidth = _a.fullWidth, initHidden = _a.hidden, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment,
2738
2738
  //----------------------------------------------------------------------------------------------------------------
2739
2739
  name = _a.name, initWidth = _a.width, labelIcon = _a.labelIcon, label = _a.label, _b = _a.inline, inline = _b === void 0 ? true : _b, initLoading = _a.loading, nowrap = _a.nowrap, initItems = _a.items, initValue = _a.value, initData = _a.data, initError = _a.error, helperText = _a.helperText, initDisabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, exceptValue = _a.exceptValue, onLoadItems = _a.onLoadItems, onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate,
2740
2740
  //----------------------------------------------------------------------------------------------------------------
2741
2741
  className = _a.className, initStyle = _a.style, sx = _a.sx,
2742
2742
  //----------------------------------------------------------------------------------------------------------------
2743
- props = __rest(_a, ["variant", "size", "color", "focused", "fullWidth", "hidden", "name", "width", "labelIcon", "label", "inline", "loading", "nowrap", "items", "value", "data", "error", "helperText", "disabled", "readOnly", "required", "exceptValue", "onLoadItems", "onChange", "onValue", "onValidate", "className", "style", "sx"]);
2743
+ props = __rest(_a, ["variant", "size", "color", "focused", "fullWidth", "hidden", "startAdornment", "endAdornment", "name", "width", "labelIcon", "label", "inline", "loading", "nowrap", "items", "value", "data", "error", "helperText", "disabled", "readOnly", "required", "exceptValue", "onLoadItems", "onChange", "onValue", "onValidate", "className", "style", "sx"]);
2744
2744
  /********************************************************************************************************************
2745
2745
  * ID
2746
2746
  * ******************************************************************************************************************/
@@ -3007,52 +3007,56 @@ var PFormRadioGroup = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_
3007
3007
  * Render
3008
3008
  * ******************************************************************************************************************/
3009
3009
  var control = useMemo(function () {
3010
- return (React.createElement(React.Fragment, null,
3011
- !fullWidth && !isOnGetItemLoading && !loading && items && (React.createElement("div", { ref: function (ref) {
3012
- resizeWidthDetectorRef.current = ref;
3013
- }, style: {
3014
- display: 'grid',
3015
- position: 'absolute',
3016
- whiteSpace: 'nowrap',
3017
- visibility: 'hidden',
3018
- } },
3019
- React.createElement(RadioGroup, __assign({}, props, { style: { display: 'inline-flex', flexWrap: 'nowrap' }, name: name, row: inline, value: value === undefined ? null : value, onChange: handleChange }), items.map(function (_a, idx) {
3020
- var value = _a.value, label = _a.label, itemDisabled = _a.disabled;
3021
- return (React.createElement(FormControlLabel, { ref: idx === 0
3022
- ? function (ref) {
3023
- resizeHeightDetectorRef.current = ref;
3024
- }
3025
- : null, key: idx, control: React.createElement(Radio, { icon: React.createElement(RadioButtonUnchecked, { color: error ? 'error' : undefined }), checkedIcon: React.createElement(RadioButtonChecked, { color: error ? 'error' : undefined }), color: color, size: size }), label: label, style: {
3026
- color: error ? theme.palette.error.main : '',
3027
- marginTop: -5,
3028
- marginBottom: -5,
3029
- whiteSpace: 'nowrap',
3030
- }, value: value, disabled: disabled || readOnly || itemDisabled }));
3031
- })))),
3032
- React.createElement("div", null,
3033
- React.createElement(RadioGroup, __assign({}, props, { ref: function (ref) {
3034
- resizeRealHeightDetectorRef.current = ref;
3010
+ return (React.createElement("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', width: fullWidth ? '100%' : undefined } },
3011
+ startAdornment && React.createElement("div", null, startAdornment),
3012
+ React.createElement("div", { style: { flex: 1 } },
3013
+ !fullWidth && !isOnGetItemLoading && !loading && items && (React.createElement("div", { ref: function (ref) {
3014
+ resizeWidthDetectorRef.current = ref;
3035
3015
  }, style: {
3036
- display: 'inline-flex',
3037
- visibility: width == null ? 'hidden' : undefined,
3038
- position: width == null ? 'absolute' : undefined,
3039
- flexWrap: nowrap ? 'nowrap' : undefined,
3040
- }, name: name, row: inline, value: value === undefined ? null : value, onChange: handleChange }), isOnGetItemLoading || loading ? (React.createElement("div", { style: { position: 'relative' } },
3041
- React.createElement(FormControlLabel, { label: '', control: React.createElement(Radio, { color: color, size: size }), style: { visibility: 'hidden' } }),
3042
- React.createElement("div", { style: { position: 'absolute', left: 0, top: 11, opacity: 0.54 } },
3043
- React.createElement(CircularProgress, { size: size === 'small' ? 12 : 16, color: 'inherit' })))) : (React.createElement(React.Fragment, null, items &&
3044
- items.map(function (_a, idx) {
3016
+ display: 'grid',
3017
+ position: 'absolute',
3018
+ whiteSpace: 'nowrap',
3019
+ visibility: 'hidden',
3020
+ } },
3021
+ React.createElement(RadioGroup, __assign({}, props, { style: { display: 'inline-flex', flexWrap: 'nowrap' }, name: name, row: inline, value: value === undefined ? null : value, onChange: handleChange }), items.map(function (_a, idx) {
3045
3022
  var value = _a.value, label = _a.label, itemDisabled = _a.disabled;
3046
- return (React.createElement(FormControlLabel, { key: idx, control: React.createElement(Radio, { icon: React.createElement(RadioButtonUnchecked, { color: error ? 'error' : undefined }), checkedIcon: React.createElement(RadioButtonChecked, { color: error ? 'error' : undefined }), color: color, size: size, slotProps: idx === 0 ? { input: { ref: firstInputRef } } : undefined }), label: label, style: {
3023
+ return (React.createElement(FormControlLabel, { ref: idx === 0
3024
+ ? function (ref) {
3025
+ resizeHeightDetectorRef.current = ref;
3026
+ }
3027
+ : null, key: idx, control: React.createElement(Radio, { icon: React.createElement(RadioButtonUnchecked, { color: error ? 'error' : undefined }), checkedIcon: React.createElement(RadioButtonChecked, { color: error ? 'error' : undefined }), color: color, size: size }), label: label, style: {
3047
3028
  color: error ? theme.palette.error.main : '',
3048
- whiteSpace: 'nowrap',
3049
3029
  marginTop: -5,
3050
3030
  marginBottom: -5,
3031
+ whiteSpace: 'nowrap',
3051
3032
  }, value: value, disabled: disabled || readOnly || itemDisabled }));
3052
- })))))));
3033
+ })))),
3034
+ React.createElement("div", null,
3035
+ React.createElement(RadioGroup, __assign({}, props, { ref: function (ref) {
3036
+ resizeRealHeightDetectorRef.current = ref;
3037
+ }, style: {
3038
+ display: 'inline-flex',
3039
+ visibility: width == null ? 'hidden' : undefined,
3040
+ position: width == null ? 'absolute' : undefined,
3041
+ flexWrap: nowrap ? 'nowrap' : undefined,
3042
+ }, name: name, row: inline, value: value === undefined ? null : value, onChange: handleChange }), isOnGetItemLoading || loading ? (React.createElement("div", { style: { position: 'relative' } },
3043
+ React.createElement(FormControlLabel, { label: '', control: React.createElement(Radio, { color: color, size: size }), style: { visibility: 'hidden' } }),
3044
+ React.createElement("div", { style: { position: 'absolute', left: 0, top: 11, opacity: 0.54 } },
3045
+ React.createElement(CircularProgress, { size: size === 'small' ? 12 : 16, color: 'inherit' })))) : (React.createElement(React.Fragment, null, items &&
3046
+ items.map(function (_a, idx) {
3047
+ var value = _a.value, label = _a.label, itemDisabled = _a.disabled;
3048
+ return (React.createElement(FormControlLabel, { key: idx, control: React.createElement(Radio, { icon: React.createElement(RadioButtonUnchecked, { color: error ? 'error' : undefined }), checkedIcon: React.createElement(RadioButtonChecked, { color: error ? 'error' : undefined }), color: color, size: size, slotProps: idx === 0 ? { input: { ref: firstInputRef } } : undefined }), label: label, style: {
3049
+ color: error ? theme.palette.error.main : '',
3050
+ whiteSpace: 'nowrap',
3051
+ marginTop: -5,
3052
+ marginBottom: -5,
3053
+ }, value: value, disabled: disabled || readOnly || itemDisabled }));
3054
+ })))))),
3055
+ endAdornment && React.createElement("div", null, endAdornment)));
3053
3056
  }, [
3054
3057
  color,
3055
3058
  disabled,
3059
+ endAdornment,
3056
3060
  error,
3057
3061
  fullWidth,
3058
3062
  handleChange,
@@ -3068,6 +3072,7 @@ var PFormRadioGroup = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_
3068
3072
  resizeRealHeightDetectorRef,
3069
3073
  resizeWidthDetectorRef,
3070
3074
  size,
3075
+ startAdornment,
3071
3076
  theme.palette.error.main,
3072
3077
  value,
3073
3078
  width,
@@ -3084,7 +3089,7 @@ PFormRadioGroup.displayName = 'PFormRadioGroup';insertStyle(".PFormToggleButtonG
3084
3089
  * ******************************************************************************************************************/
3085
3090
  var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initFullWidth = _a.fullWidth,
3086
3091
  //----------------------------------------------------------------------------------------------------------------
3087
- name = _a.name, labelIcon = _a.labelIcon, label = _a.label, _b = _a.type, type = _b === void 0 ? 'button' : _b, initLoading = _a.loading, initItems = _a.items, initValue = _a.value, initData = _a.data, initError = _a.error, helperText = _a.helperText, initDisabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, notAllowEmptyValue = _a.notAllowEmptyValue, exceptValue = _a.exceptValue, initWidth = _a.width, multiple = _a.multiple, _c = _a.formValueSeparator, formValueSeparator = _c === void 0 ? ',' : _c, formValueSort = _a.formValueSort, initHidden = _a.hidden, itemWidth = _a.itemWidth, onLoadItems = _a.onLoadItems,
3092
+ name = _a.name, labelIcon = _a.labelIcon, label = _a.label, _b = _a.type, type = _b === void 0 ? 'button' : _b, initLoading = _a.loading, initItems = _a.items, initValue = _a.value, initData = _a.data, initError = _a.error, helperText = _a.helperText, initDisabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, notAllowEmptyValue = _a.notAllowEmptyValue, exceptValue = _a.exceptValue, initWidth = _a.width, multiple = _a.multiple, _c = _a.formValueSeparator, formValueSeparator = _c === void 0 ? ',' : _c, formValueSort = _a.formValueSort, initHidden = _a.hidden, itemWidth = _a.itemWidth, onLoadItems = _a.onLoadItems, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment,
3088
3093
  //----------------------------------------------------------------------------------------------------------------
3089
3094
  onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate,
3090
3095
  //----------------------------------------------------------------------------------------------------------------
@@ -3493,29 +3498,33 @@ PFormRadioGroup.displayName = 'PFormRadioGroup';insertStyle(".PFormToggleButtonG
3493
3498
  return isOnGetItemLoading || loading ? (React.createElement("div", { style: { opacity: 0.54 }, ref: function (ref) {
3494
3499
  refForLoadingResizeHeightDetect.current = ref;
3495
3500
  } },
3496
- React.createElement(CircularProgress, { size: 16, color: 'inherit' }))) : (React.createElement(React.Fragment, null,
3497
- !fullWidth && !isOnGetItemLoading && !loading && items && (React.createElement("div", { ref: function (ref) {
3498
- refForResizeWidthDetect.current = ref;
3499
- }, style: {
3500
- display: 'grid',
3501
- position: 'absolute',
3502
- whiteSpace: 'nowrap',
3503
- visibility: 'hidden',
3504
- } },
3505
- React.createElement(ToggleButtonGroup, { className: 'ToggleButtonGroup', exclusive: !multiple }, buttons))),
3506
- React.createElement(ToggleButtonGroup, { ref: function (ref) {
3507
- refForButtonsResizeHeightDetect.current = ref;
3508
- }, className: 'ToggleButtonGroup', exclusive: !multiple, fullWidth: fullWidth, value: realValue, onChange: handleChange, style: {
3509
- width: !fullWidth && formColWidth && typeof width === 'number' && width > formColWidth
3510
- ? formColWidth
3511
- : undefined,
3512
- flexWrap: type === 'checkbox' || type === 'radio' ? 'wrap' : 'nowrap',
3513
- }, "aria-labelledby": notEmpty(label) ? labelId : undefined }, isOnGetItemLoading || loading || !items || empty(items) ? (React.createElement(ToggleButton, { ref: function (ref) {
3514
- refForButtonResizeHeightDetect.current = ref;
3515
- }, size: size, className: 'ToggleButton', disabled: disabled || readOnly, value: '', style: { visibility: 'hidden' } })) : (buttons))));
3501
+ React.createElement(CircularProgress, { size: 16, color: 'inherit' }))) : (React.createElement("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', width: fullWidth ? '100%' : undefined } },
3502
+ startAdornment && React.createElement("div", null, startAdornment),
3503
+ React.createElement("div", { style: { flex: 1 } },
3504
+ !fullWidth && !isOnGetItemLoading && !loading && items && (React.createElement("div", { ref: function (ref) {
3505
+ refForResizeWidthDetect.current = ref;
3506
+ }, style: {
3507
+ display: 'grid',
3508
+ position: 'absolute',
3509
+ whiteSpace: 'nowrap',
3510
+ visibility: 'hidden',
3511
+ } },
3512
+ React.createElement(ToggleButtonGroup, { className: 'ToggleButtonGroup', exclusive: !multiple }, buttons))),
3513
+ React.createElement(ToggleButtonGroup, { ref: function (ref) {
3514
+ refForButtonsResizeHeightDetect.current = ref;
3515
+ }, className: 'ToggleButtonGroup', exclusive: !multiple, fullWidth: fullWidth, value: realValue, onChange: handleChange, style: {
3516
+ width: !fullWidth && formColWidth && typeof width === 'number' && width > formColWidth
3517
+ ? formColWidth
3518
+ : undefined,
3519
+ flexWrap: type === 'checkbox' || type === 'radio' ? 'wrap' : 'nowrap',
3520
+ }, "aria-labelledby": notEmpty(label) ? labelId : undefined }, isOnGetItemLoading || loading || !items || empty(items) ? (React.createElement(ToggleButton, { ref: function (ref) {
3521
+ refForButtonResizeHeightDetect.current = ref;
3522
+ }, size: size, className: 'ToggleButton', disabled: disabled || readOnly, value: '', style: { visibility: 'hidden' } })) : (buttons))),
3523
+ endAdornment && React.createElement("div", null, endAdornment)));
3516
3524
  }, [
3517
3525
  buttons,
3518
3526
  disabled,
3527
+ endAdornment,
3519
3528
  formColWidth,
3520
3529
  fullWidth,
3521
3530
  handleChange,
@@ -3532,6 +3541,7 @@ PFormRadioGroup.displayName = 'PFormRadioGroup';insertStyle(".PFormToggleButtonG
3532
3541
  refForLoadingResizeHeightDetect,
3533
3542
  refForResizeWidthDetect,
3534
3543
  size,
3544
+ startAdornment,
3535
3545
  type,
3536
3546
  width,
3537
3547
  ]);
package/dist/index.js CHANGED
@@ -2734,13 +2734,13 @@ var PFormRadioGroup = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_
2734
2734
  /********************************************************************************************************************
2735
2735
  * type
2736
2736
  * ******************************************************************************************************************/
2737
- var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initFullWidth = _a.fullWidth, initHidden = _a.hidden,
2737
+ var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initFullWidth = _a.fullWidth, initHidden = _a.hidden, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment,
2738
2738
  //----------------------------------------------------------------------------------------------------------------
2739
2739
  name = _a.name, initWidth = _a.width, labelIcon = _a.labelIcon, label = _a.label, _b = _a.inline, inline = _b === void 0 ? true : _b, initLoading = _a.loading, nowrap = _a.nowrap, initItems = _a.items, initValue = _a.value, initData = _a.data, initError = _a.error, helperText = _a.helperText, initDisabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, exceptValue = _a.exceptValue, onLoadItems = _a.onLoadItems, onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate,
2740
2740
  //----------------------------------------------------------------------------------------------------------------
2741
2741
  className = _a.className, initStyle = _a.style, sx = _a.sx,
2742
2742
  //----------------------------------------------------------------------------------------------------------------
2743
- props = __rest(_a, ["variant", "size", "color", "focused", "fullWidth", "hidden", "name", "width", "labelIcon", "label", "inline", "loading", "nowrap", "items", "value", "data", "error", "helperText", "disabled", "readOnly", "required", "exceptValue", "onLoadItems", "onChange", "onValue", "onValidate", "className", "style", "sx"]);
2743
+ props = __rest(_a, ["variant", "size", "color", "focused", "fullWidth", "hidden", "startAdornment", "endAdornment", "name", "width", "labelIcon", "label", "inline", "loading", "nowrap", "items", "value", "data", "error", "helperText", "disabled", "readOnly", "required", "exceptValue", "onLoadItems", "onChange", "onValue", "onValidate", "className", "style", "sx"]);
2744
2744
  /********************************************************************************************************************
2745
2745
  * ID
2746
2746
  * ******************************************************************************************************************/
@@ -3007,52 +3007,56 @@ var PFormRadioGroup = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_
3007
3007
  * Render
3008
3008
  * ******************************************************************************************************************/
3009
3009
  var control = React.useMemo(function () {
3010
- return (React.createElement(React.Fragment, null,
3011
- !fullWidth && !isOnGetItemLoading && !loading && items && (React.createElement("div", { ref: function (ref) {
3012
- resizeWidthDetectorRef.current = ref;
3013
- }, style: {
3014
- display: 'grid',
3015
- position: 'absolute',
3016
- whiteSpace: 'nowrap',
3017
- visibility: 'hidden',
3018
- } },
3019
- React.createElement(material.RadioGroup, __assign({}, props, { style: { display: 'inline-flex', flexWrap: 'nowrap' }, name: name, row: inline, value: value === undefined ? null : value, onChange: handleChange }), items.map(function (_a, idx) {
3020
- var value = _a.value, label = _a.label, itemDisabled = _a.disabled;
3021
- return (React.createElement(material.FormControlLabel, { ref: idx === 0
3022
- ? function (ref) {
3023
- resizeHeightDetectorRef.current = ref;
3024
- }
3025
- : null, key: idx, control: React.createElement(material.Radio, { icon: React.createElement(iconsMaterial.RadioButtonUnchecked, { color: error ? 'error' : undefined }), checkedIcon: React.createElement(iconsMaterial.RadioButtonChecked, { color: error ? 'error' : undefined }), color: color, size: size }), label: label, style: {
3026
- color: error ? theme.palette.error.main : '',
3027
- marginTop: -5,
3028
- marginBottom: -5,
3029
- whiteSpace: 'nowrap',
3030
- }, value: value, disabled: disabled || readOnly || itemDisabled }));
3031
- })))),
3032
- React.createElement("div", null,
3033
- React.createElement(material.RadioGroup, __assign({}, props, { ref: function (ref) {
3034
- resizeRealHeightDetectorRef.current = ref;
3010
+ return (React.createElement("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', width: fullWidth ? '100%' : undefined } },
3011
+ startAdornment && React.createElement("div", null, startAdornment),
3012
+ React.createElement("div", { style: { flex: 1 } },
3013
+ !fullWidth && !isOnGetItemLoading && !loading && items && (React.createElement("div", { ref: function (ref) {
3014
+ resizeWidthDetectorRef.current = ref;
3035
3015
  }, style: {
3036
- display: 'inline-flex',
3037
- visibility: width == null ? 'hidden' : undefined,
3038
- position: width == null ? 'absolute' : undefined,
3039
- flexWrap: nowrap ? 'nowrap' : undefined,
3040
- }, name: name, row: inline, value: value === undefined ? null : value, onChange: handleChange }), isOnGetItemLoading || loading ? (React.createElement("div", { style: { position: 'relative' } },
3041
- React.createElement(material.FormControlLabel, { label: '', control: React.createElement(material.Radio, { color: color, size: size }), style: { visibility: 'hidden' } }),
3042
- React.createElement("div", { style: { position: 'absolute', left: 0, top: 11, opacity: 0.54 } },
3043
- React.createElement(material.CircularProgress, { size: size === 'small' ? 12 : 16, color: 'inherit' })))) : (React.createElement(React.Fragment, null, items &&
3044
- items.map(function (_a, idx) {
3016
+ display: 'grid',
3017
+ position: 'absolute',
3018
+ whiteSpace: 'nowrap',
3019
+ visibility: 'hidden',
3020
+ } },
3021
+ React.createElement(material.RadioGroup, __assign({}, props, { style: { display: 'inline-flex', flexWrap: 'nowrap' }, name: name, row: inline, value: value === undefined ? null : value, onChange: handleChange }), items.map(function (_a, idx) {
3045
3022
  var value = _a.value, label = _a.label, itemDisabled = _a.disabled;
3046
- return (React.createElement(material.FormControlLabel, { key: idx, control: React.createElement(material.Radio, { icon: React.createElement(iconsMaterial.RadioButtonUnchecked, { color: error ? 'error' : undefined }), checkedIcon: React.createElement(iconsMaterial.RadioButtonChecked, { color: error ? 'error' : undefined }), color: color, size: size, slotProps: idx === 0 ? { input: { ref: firstInputRef } } : undefined }), label: label, style: {
3023
+ return (React.createElement(material.FormControlLabel, { ref: idx === 0
3024
+ ? function (ref) {
3025
+ resizeHeightDetectorRef.current = ref;
3026
+ }
3027
+ : null, key: idx, control: React.createElement(material.Radio, { icon: React.createElement(iconsMaterial.RadioButtonUnchecked, { color: error ? 'error' : undefined }), checkedIcon: React.createElement(iconsMaterial.RadioButtonChecked, { color: error ? 'error' : undefined }), color: color, size: size }), label: label, style: {
3047
3028
  color: error ? theme.palette.error.main : '',
3048
- whiteSpace: 'nowrap',
3049
3029
  marginTop: -5,
3050
3030
  marginBottom: -5,
3031
+ whiteSpace: 'nowrap',
3051
3032
  }, value: value, disabled: disabled || readOnly || itemDisabled }));
3052
- })))))));
3033
+ })))),
3034
+ React.createElement("div", null,
3035
+ React.createElement(material.RadioGroup, __assign({}, props, { ref: function (ref) {
3036
+ resizeRealHeightDetectorRef.current = ref;
3037
+ }, style: {
3038
+ display: 'inline-flex',
3039
+ visibility: width == null ? 'hidden' : undefined,
3040
+ position: width == null ? 'absolute' : undefined,
3041
+ flexWrap: nowrap ? 'nowrap' : undefined,
3042
+ }, name: name, row: inline, value: value === undefined ? null : value, onChange: handleChange }), isOnGetItemLoading || loading ? (React.createElement("div", { style: { position: 'relative' } },
3043
+ React.createElement(material.FormControlLabel, { label: '', control: React.createElement(material.Radio, { color: color, size: size }), style: { visibility: 'hidden' } }),
3044
+ React.createElement("div", { style: { position: 'absolute', left: 0, top: 11, opacity: 0.54 } },
3045
+ React.createElement(material.CircularProgress, { size: size === 'small' ? 12 : 16, color: 'inherit' })))) : (React.createElement(React.Fragment, null, items &&
3046
+ items.map(function (_a, idx) {
3047
+ var value = _a.value, label = _a.label, itemDisabled = _a.disabled;
3048
+ return (React.createElement(material.FormControlLabel, { key: idx, control: React.createElement(material.Radio, { icon: React.createElement(iconsMaterial.RadioButtonUnchecked, { color: error ? 'error' : undefined }), checkedIcon: React.createElement(iconsMaterial.RadioButtonChecked, { color: error ? 'error' : undefined }), color: color, size: size, slotProps: idx === 0 ? { input: { ref: firstInputRef } } : undefined }), label: label, style: {
3049
+ color: error ? theme.palette.error.main : '',
3050
+ whiteSpace: 'nowrap',
3051
+ marginTop: -5,
3052
+ marginBottom: -5,
3053
+ }, value: value, disabled: disabled || readOnly || itemDisabled }));
3054
+ })))))),
3055
+ endAdornment && React.createElement("div", null, endAdornment)));
3053
3056
  }, [
3054
3057
  color,
3055
3058
  disabled,
3059
+ endAdornment,
3056
3060
  error,
3057
3061
  fullWidth,
3058
3062
  handleChange,
@@ -3068,6 +3072,7 @@ var PFormRadioGroup = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_
3068
3072
  resizeRealHeightDetectorRef,
3069
3073
  resizeWidthDetectorRef,
3070
3074
  size,
3075
+ startAdornment,
3071
3076
  theme.palette.error.main,
3072
3077
  value,
3073
3078
  width,
@@ -3084,7 +3089,7 @@ PFormRadioGroup.displayName = 'PFormRadioGroup';insertStyle(".PFormToggleButtonG
3084
3089
  * ******************************************************************************************************************/
3085
3090
  var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initFullWidth = _a.fullWidth,
3086
3091
  //----------------------------------------------------------------------------------------------------------------
3087
- name = _a.name, labelIcon = _a.labelIcon, label = _a.label, _b = _a.type, type = _b === void 0 ? 'button' : _b, initLoading = _a.loading, initItems = _a.items, initValue = _a.value, initData = _a.data, initError = _a.error, helperText = _a.helperText, initDisabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, notAllowEmptyValue = _a.notAllowEmptyValue, exceptValue = _a.exceptValue, initWidth = _a.width, multiple = _a.multiple, _c = _a.formValueSeparator, formValueSeparator = _c === void 0 ? ',' : _c, formValueSort = _a.formValueSort, initHidden = _a.hidden, itemWidth = _a.itemWidth, onLoadItems = _a.onLoadItems,
3092
+ name = _a.name, labelIcon = _a.labelIcon, label = _a.label, _b = _a.type, type = _b === void 0 ? 'button' : _b, initLoading = _a.loading, initItems = _a.items, initValue = _a.value, initData = _a.data, initError = _a.error, helperText = _a.helperText, initDisabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, notAllowEmptyValue = _a.notAllowEmptyValue, exceptValue = _a.exceptValue, initWidth = _a.width, multiple = _a.multiple, _c = _a.formValueSeparator, formValueSeparator = _c === void 0 ? ',' : _c, formValueSort = _a.formValueSort, initHidden = _a.hidden, itemWidth = _a.itemWidth, onLoadItems = _a.onLoadItems, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment,
3088
3093
  //----------------------------------------------------------------------------------------------------------------
3089
3094
  onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate,
3090
3095
  //----------------------------------------------------------------------------------------------------------------
@@ -3493,29 +3498,33 @@ PFormRadioGroup.displayName = 'PFormRadioGroup';insertStyle(".PFormToggleButtonG
3493
3498
  return isOnGetItemLoading || loading ? (React.createElement("div", { style: { opacity: 0.54 }, ref: function (ref) {
3494
3499
  refForLoadingResizeHeightDetect.current = ref;
3495
3500
  } },
3496
- React.createElement(material.CircularProgress, { size: 16, color: 'inherit' }))) : (React.createElement(React.Fragment, null,
3497
- !fullWidth && !isOnGetItemLoading && !loading && items && (React.createElement("div", { ref: function (ref) {
3498
- refForResizeWidthDetect.current = ref;
3499
- }, style: {
3500
- display: 'grid',
3501
- position: 'absolute',
3502
- whiteSpace: 'nowrap',
3503
- visibility: 'hidden',
3504
- } },
3505
- React.createElement(material.ToggleButtonGroup, { className: 'ToggleButtonGroup', exclusive: !multiple }, buttons))),
3506
- React.createElement(material.ToggleButtonGroup, { ref: function (ref) {
3507
- refForButtonsResizeHeightDetect.current = ref;
3508
- }, className: 'ToggleButtonGroup', exclusive: !multiple, fullWidth: fullWidth, value: realValue, onChange: handleChange, style: {
3509
- width: !fullWidth && formColWidth && typeof width === 'number' && width > formColWidth
3510
- ? formColWidth
3511
- : undefined,
3512
- flexWrap: type === 'checkbox' || type === 'radio' ? 'wrap' : 'nowrap',
3513
- }, "aria-labelledby": compare.notEmpty(label) ? labelId : undefined }, isOnGetItemLoading || loading || !items || compare.empty(items) ? (React.createElement(material.ToggleButton, { ref: function (ref) {
3514
- refForButtonResizeHeightDetect.current = ref;
3515
- }, size: size, className: 'ToggleButton', disabled: disabled || readOnly, value: '', style: { visibility: 'hidden' } })) : (buttons))));
3501
+ React.createElement(material.CircularProgress, { size: 16, color: 'inherit' }))) : (React.createElement("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', width: fullWidth ? '100%' : undefined } },
3502
+ startAdornment && React.createElement("div", null, startAdornment),
3503
+ React.createElement("div", { style: { flex: 1 } },
3504
+ !fullWidth && !isOnGetItemLoading && !loading && items && (React.createElement("div", { ref: function (ref) {
3505
+ refForResizeWidthDetect.current = ref;
3506
+ }, style: {
3507
+ display: 'grid',
3508
+ position: 'absolute',
3509
+ whiteSpace: 'nowrap',
3510
+ visibility: 'hidden',
3511
+ } },
3512
+ React.createElement(material.ToggleButtonGroup, { className: 'ToggleButtonGroup', exclusive: !multiple }, buttons))),
3513
+ React.createElement(material.ToggleButtonGroup, { ref: function (ref) {
3514
+ refForButtonsResizeHeightDetect.current = ref;
3515
+ }, className: 'ToggleButtonGroup', exclusive: !multiple, fullWidth: fullWidth, value: realValue, onChange: handleChange, style: {
3516
+ width: !fullWidth && formColWidth && typeof width === 'number' && width > formColWidth
3517
+ ? formColWidth
3518
+ : undefined,
3519
+ flexWrap: type === 'checkbox' || type === 'radio' ? 'wrap' : 'nowrap',
3520
+ }, "aria-labelledby": compare.notEmpty(label) ? labelId : undefined }, isOnGetItemLoading || loading || !items || compare.empty(items) ? (React.createElement(material.ToggleButton, { ref: function (ref) {
3521
+ refForButtonResizeHeightDetect.current = ref;
3522
+ }, size: size, className: 'ToggleButton', disabled: disabled || readOnly, value: '', style: { visibility: 'hidden' } })) : (buttons))),
3523
+ endAdornment && React.createElement("div", null, endAdornment)));
3516
3524
  }, [
3517
3525
  buttons,
3518
3526
  disabled,
3527
+ endAdornment,
3519
3528
  formColWidth,
3520
3529
  fullWidth,
3521
3530
  handleChange,
@@ -3532,6 +3541,7 @@ PFormRadioGroup.displayName = 'PFormRadioGroup';insertStyle(".PFormToggleButtonG
3532
3541
  refForLoadingResizeHeightDetect,
3533
3542
  refForResizeWidthDetect,
3534
3543
  size,
3544
+ startAdornment,
3535
3545
  type,
3536
3546
  width,
3537
3547
  ]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pdg/react-form",
3
3
  "title": "React Form",
4
- "version": "1.1.18",
4
+ "version": "1.1.19",
5
5
  "description": "React Form",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",