@pdg/react-form 1.0.22 → 1.0.23

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/index.esm.js CHANGED
@@ -2042,13 +2042,13 @@ styleInject(css_248z$j);var FormTextField = React__default.forwardRef(function (
2042
2042
  var _b;
2043
2043
  var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth,
2044
2044
  //----------------------------------------------------------------------------------------------------------------
2045
- name = _a.name, required = _a.required, initValue = _a.value, icon = _a.icon, labelIcon = _a.labelIcon, initLabel = _a.label, initError = _a.error, initHelperText = _a.helperText, exceptValue = _a.exceptValue, readOnly = _a.readOnly, initDisabled = _a.disabled, placeholder = _a.placeholder, maxLength = _a.maxLength, clear = _a.clear, width = _a.width, initMuiInputProps = _a.InputProps, initMuiInputLabelProps = _a.InputLabelProps, initInputProps = _a.inputProps, initInputRef = _a.inputRef, select = _a.select, SelectProps = _a.SelectProps, multiline = _a.multiline, validPattern = _a.validPattern, invalidPattern = _a.invalidPattern, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment, noFormValueItem = _a.noFormValueItem, hidden = _a.hidden,
2045
+ name = _a.name, required = _a.required, initValue = _a.value, icon = _a.icon, labelIcon = _a.labelIcon, initLabel = _a.label, initError = _a.error, initHelperText = _a.helperText, exceptValue = _a.exceptValue, readOnly = _a.readOnly, tabIndex = _a.tabIndex, initDisabled = _a.disabled, placeholder = _a.placeholder, maxLength = _a.maxLength, clear = _a.clear, width = _a.width, initMuiInputProps = _a.InputProps, initMuiInputLabelProps = _a.InputLabelProps, initInputProps = _a.inputProps, initInputRef = _a.inputRef, select = _a.select, SelectProps = _a.SelectProps, multiline = _a.multiline, validPattern = _a.validPattern, invalidPattern = _a.invalidPattern, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment, noFormValueItem = _a.noFormValueItem, hidden = _a.hidden,
2046
2046
  //----------------------------------------------------------------------------------------------------------------
2047
2047
  onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate, onBlur = _a.onBlur, onKeyDown = _a.onKeyDown,
2048
2048
  //----------------------------------------------------------------------------------------------------------------
2049
2049
  className = _a.className, initStyle = _a.style,
2050
2050
  //----------------------------------------------------------------------------------------------------------------
2051
- props = __rest$2(_a, ["variant", "size", "color", "focused", "labelShrink", "fullWidth", "name", "required", "value", "icon", "labelIcon", "label", "error", "helperText", "exceptValue", "readOnly", "disabled", "placeholder", "maxLength", "clear", "width", "InputProps", "InputLabelProps", "inputProps", "inputRef", "select", "SelectProps", "multiline", "validPattern", "invalidPattern", "startAdornment", "endAdornment", "noFormValueItem", "hidden", "onChange", "onValue", "onValidate", "onBlur", "onKeyDown", "className", "style"]);
2051
+ props = __rest$2(_a, ["variant", "size", "color", "focused", "labelShrink", "fullWidth", "name", "required", "value", "icon", "labelIcon", "label", "error", "helperText", "exceptValue", "readOnly", "tabIndex", "disabled", "placeholder", "maxLength", "clear", "width", "InputProps", "InputLabelProps", "inputProps", "inputRef", "select", "SelectProps", "multiline", "validPattern", "invalidPattern", "startAdornment", "endAdornment", "noFormValueItem", "hidden", "onChange", "onValue", "onValidate", "onBlur", "onKeyDown", "className", "style"]);
2052
2052
  var id = useId();
2053
2053
  // Ref -------------------------------------------------------------------------------------------------------------
2054
2054
  var inputRef = useRef(null);
@@ -2080,14 +2080,18 @@ styleInject(css_248z$j);var FormTextField = React__default.forwardRef(function (
2080
2080
  if (readOnly != null || maxLength != null) {
2081
2081
  var finalInputProps = __assign$4(__assign$4({}, initInputProps), { readOnly: readOnly, maxLength: maxLength });
2082
2082
  if (readOnly) {
2083
+ finalInputProps.tabIndex = -1;
2083
2084
  finalInputProps.className = classNames$1(finalInputProps.className, 'Mui-disabled');
2084
2085
  }
2086
+ else {
2087
+ finalInputProps.tabIndex = tabIndex;
2088
+ }
2085
2089
  return finalInputProps;
2086
2090
  }
2087
2091
  else {
2088
2092
  return initInputProps;
2089
2093
  }
2090
- }, [initInputProps, readOnly, maxLength]);
2094
+ }, [initInputProps, readOnly, tabIndex, maxLength]);
2091
2095
  // Memo - style ----------------------------------------------------------------------------------------------------
2092
2096
  var style = useMemo(function () {
2093
2097
  var newStyle = __assign$4({}, initStyle);
@@ -2512,7 +2516,7 @@ styleInject(css_248z$h);var FormTag = React__default.forwardRef(function (_a, re
2512
2516
  onValueChangeByUser: function () { },
2513
2517
  // eslint-disable-next-line
2514
2518
  onRequestSearchSubmit: function () { } }, otherFormState) },
2515
- React__default.createElement(Autocomplete, { options: [], multiple: true, freeSolo: true, value: value, disableClearable: true, disabled: disabled, renderTags: handleRenderTags, inputValue: inputValue, style: { display: fullWidth ? 'block' : 'inline-block', width: fullWidth ? '100%' : undefined }, renderInput: function (params) {
2519
+ React__default.createElement(Autocomplete, { options: [], multiple: true, freeSolo: true, value: value, readOnly: readOnly, disableClearable: true, disabled: disabled, renderTags: handleRenderTags, inputValue: inputValue, style: { display: fullWidth ? 'block' : 'inline-block', width: fullWidth ? '100%' : undefined }, renderInput: function (params) {
2516
2520
  var _a;
2517
2521
  var renderProps = __assign$4({}, props);
2518
2522
  renderProps.InputLabelProps = __assign$4(__assign$4({}, renderProps.InputLabelProps), { htmlFor: params.InputLabelProps.htmlFor, id: params.InputLabelProps.id });
@@ -2525,6 +2529,9 @@ styleInject(css_248z$h);var FormTag = React__default.forwardRef(function (_a, re
2525
2529
  renderProps.inputProps = __assign$4(__assign$4({}, renderProps.inputProps), params.inputProps);
2526
2530
  renderProps.inputProps.className = classNames$1(renderProps.inputProps.className, 'FormTag-Input');
2527
2531
  renderProps.inputProps.readOnly = readOnly;
2532
+ if (readOnly) {
2533
+ renderProps.inputProps.tabIndex = -1;
2534
+ }
2528
2535
  renderProps.inputProps.maxLength = maxLength;
2529
2536
  if (readOnly) {
2530
2537
  renderProps.inputProps.className = classNames$1(renderProps.inputProps.className, 'Mui-disabled');
@@ -4048,7 +4055,7 @@ NumberFormat.defaultProps = defaultProps;var NumberFormatCustom = React__default
4048
4055
  });
4049
4056
  NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps = __assign$4({}, FormTextDefaultProps);var FormNumber = React__default.forwardRef(function (_a, ref) {
4050
4057
  // Memo --------------------------------------------------------------------------------------------------------------
4051
- var className = _a.className, allowLeadingZeros = _a.allowLeadingZeros, allowNegative = _a.allowNegative, thousandSeparator = _a.thousandSeparator, allowDecimal = _a.allowDecimal, decimalScale = _a.decimalScale, prefix = _a.prefix, suffix = _a.suffix, readOnly = _a.readOnly, initMuiInputProps = _a.InputProps, props = __rest$2(_a, ["className", "allowLeadingZeros", "allowNegative", "thousandSeparator", "allowDecimal", "decimalScale", "prefix", "suffix", "readOnly", "InputProps"]);
4058
+ var className = _a.className, allowLeadingZeros = _a.allowLeadingZeros, allowNegative = _a.allowNegative, thousandSeparator = _a.thousandSeparator, allowDecimal = _a.allowDecimal, decimalScale = _a.decimalScale, prefix = _a.prefix, suffix = _a.suffix, readOnly = _a.readOnly, tabIndex = _a.tabIndex, initMuiInputProps = _a.InputProps, props = __rest$2(_a, ["className", "allowLeadingZeros", "allowNegative", "thousandSeparator", "allowDecimal", "decimalScale", "prefix", "suffix", "readOnly", "tabIndex", "InputProps"]);
4052
4059
  var muiInputProps = useMemo(function () {
4053
4060
  var inputProps = {
4054
4061
  allowLeadingZeros: allowLeadingZeros,
@@ -4057,6 +4064,7 @@ NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps
4057
4064
  prefix: prefix,
4058
4065
  suffix: suffix,
4059
4066
  readOnly: readOnly,
4067
+ tabIndex: readOnly ? -1 : tabIndex,
4060
4068
  };
4061
4069
  if (allowDecimal) {
4062
4070
  if (decimalScale) {
@@ -4075,6 +4083,7 @@ NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps
4075
4083
  initMuiInputProps,
4076
4084
  prefix,
4077
4085
  readOnly,
4086
+ tabIndex,
4078
4087
  suffix,
4079
4088
  thousandSeparator,
4080
4089
  ]);
@@ -7829,7 +7838,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
7829
7838
  return value.map(function (option, index) { return (React__default.createElement(Chip, __assign$4({ size: 'small', label: onRenderTag ? onRenderTag(option) : option.label }, getTagProps({ index: index })))); });
7830
7839
  }, renderInput: function (params) { return (React__default.createElement(FormTextField, __assign$4({}, params, { ref: textFieldRef, name: name, variant: variant, size: size, color: color, labelIcon: labelIcon, label: label, labelShrink: labelShrink, required: required, focused: focused, error: error, helperText: helperText, placeholder: placeholder, noFormValueItem: true, InputProps: __assign$4(__assign$4({}, params.InputProps), { endAdornment: (React__default.createElement(React__default.Fragment, null,
7831
7840
  loading || isOnGetItemLoading ? React__default.createElement(CircularProgress$1, { color: 'inherit', size: 20 }) : null,
7832
- params.InputProps.endAdornment)) }) }))); } }));
7841
+ params.InputProps.endAdornment)) }), inputProps: readOnly || disabled ? __assign$4(__assign$4({}, params.inputProps), { tabIndex: -1 }) : params.inputProps }))); } }));
7833
7842
  });
7834
7843
  FormAutocomplete.displayName = 'FormAutocomplete';
7835
7844
  FormAutocomplete.defaultProps = FormAutocompleteDefaultProps;var FormDatePickerDefaultProps = {};var __assign = function() {
@@ -14977,7 +14986,7 @@ styleInject(css_248z$5);var PrivateDatePicker = React__default.forwardRef(functi
14977
14986
  return (React__default.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: dayjsLocale },
14978
14987
  React__default.createElement(ClickAwayListener, { mouseEvent: 'onMouseDown', touchEvent: 'onTouchStart', onClickAway: function () { return setOpen(false); } },
14979
14988
  React__default.createElement("div", { className: classNames$1(className, 'PrivateDatePicker'), style: wrapStyle, onMouseDown: handleContainerMouseDown, onFocus: handleContainerFocus, onBlur: handleContainerBlur },
14980
- React__default.createElement(PrivateStyledTooltip, { open: open, PopperProps: {
14989
+ React__default.createElement(PrivateStyledTooltip, { open: disabled || readOnly ? false : open, PopperProps: {
14981
14990
  modifiers: [
14982
14991
  {
14983
14992
  name: 'offset',
@@ -14991,7 +15000,11 @@ styleInject(css_248z$5);var PrivateDatePicker = React__default.forwardRef(functi
14991
15000
  React__default.createElement(DesktopDatePicker, __assign$4({ value: inputValue, label: label, open: false, inputFormat: format, disabled: disabled, readOnly: readOnly, minDate: minDate, maxDate: maxDate, disablePast: disablePast, disableFuture: disableFuture, onClose: function () { return setOpen(false); }, onError: function (reason) { return (datePickerErrorRef.current = reason); }, onChange: function (newValue, keyboardInputValue) { return handleChange('date', newValue, keyboardInputValue); }, renderInput: function (_a) {
14992
15001
  var initClassName = _a.className, initFocused = _a.focused, initError = _a.error, initStyle = _a.style, initInputProps = _a.inputProps, initMuiInputProps = _a.InputProps, InputLabelProps = _a.InputLabelProps, params = __rest$2(_a, ["className", "focused", "error", "style", "inputProps", "InputProps", "InputLabelProps"]);
14993
15002
  var textFieldInputLabelProps = __assign$4(__assign$4({}, InputLabelProps), { shrink: labelShrink ? true : InputLabelProps === null || InputLabelProps === void 0 ? void 0 : InputLabelProps.shrink });
14994
- var inputProps = __assign$4(__assign$4({}, initInputProps), { readOnly: (initInputProps === null || initInputProps === void 0 ? void 0 : initInputProps.readOnly) || readOnlyInput });
15003
+ var readOnly = (initInputProps === null || initInputProps === void 0 ? void 0 : initInputProps.readOnly) || readOnlyInput;
15004
+ var inputProps = __assign$4(__assign$4({}, initInputProps), { readOnly: readOnly });
15005
+ if (readOnly) {
15006
+ inputProps.tabIndex = -1;
15007
+ }
14995
15008
  var muiInputProps = __assign$4(__assign$4({}, initMuiInputProps), { endAdornment: undefined });
14996
15009
  if (startAdornment || icon || muiInputProps.startAdornment) {
14997
15010
  muiInputProps.startAdornment = (React__default.createElement(React__default.Fragment, null,
@@ -15545,7 +15558,7 @@ styleInject(css_248z$2);var InputDatePicker = function (_a) {
15545
15558
  }, [labelShrink]);
15546
15559
  // Render ----------------------------------------------------------------------------------------------------------
15547
15560
  return (React__default.createElement(DesktopDatePicker, __assign$4({}, props, { className: classNames$1(className, 'InputDatePicker', "align-".concat(align)), open: false, value: value, inputFormat: format, disabled: disabled, readOnly: readOnly || readOnlyInput, renderInput: function (_a) {
15548
- var inputStyle = _a.style, inputInputRef = _a.inputRef, inputInputProps = _a.InputProps, inputError = _a.error, inputOnFocus = _a.onFocus, inputOnBlur = _a.onBlur, params = __rest$2(_a, ["style", "inputRef", "InputProps", "error", "onFocus", "onBlur"]);
15561
+ var inputStyle = _a.style, inputInputRef = _a.inputRef, inputInputProps = _a.InputProps, initInputProps = _a.inputProps, inputError = _a.error, inputOnFocus = _a.onFocus, inputOnBlur = _a.onBlur, params = __rest$2(_a, ["style", "inputRef", "InputProps", "inputProps", "error", "onFocus", "onBlur"]);
15549
15562
  var muiInputProps = __assign$4(__assign$4({}, inputInputProps), { endAdornment: undefined });
15550
15563
  if (startAdornment || icon || muiInputProps.startAdornment) {
15551
15564
  muiInputProps.startAdornment = (React__default.createElement(React__default.Fragment, null,
@@ -15557,6 +15570,10 @@ styleInject(css_248z$2);var InputDatePicker = function (_a) {
15557
15570
  if (endAdornment) {
15558
15571
  muiInputProps.endAdornment = (React__default.createElement(React__default.Fragment, null, endAdornment && React__default.createElement(InputAdornment, { position: 'end' }, endAdornment)));
15559
15572
  }
15573
+ var inputProps = __assign$4({}, initInputProps);
15574
+ if (readOnly) {
15575
+ inputProps.tabIndex = -1;
15576
+ }
15560
15577
  return (React__default.createElement(TextField, __assign$4({}, params, { style: __assign$4(__assign$4({}, inputStyle), style), variant: variant, size: size, color: color, focused: focused, fullWidth: fullWidth, required: required, name: id, label: label, error: error || inputError, inputRef: function (ref) {
15561
15578
  if (inputInputRef) {
15562
15579
  if (typeof inputInputRef === 'function') {
@@ -15566,7 +15583,7 @@ styleInject(css_248z$2);var InputDatePicker = function (_a) {
15566
15583
  if (inputRef) {
15567
15584
  inputRef.current = ref;
15568
15585
  }
15569
- }, InputProps: muiInputProps, InputLabelProps: inputLabelProps, onFocus: function (e) {
15586
+ }, InputProps: muiInputProps, InputLabelProps: inputLabelProps, inputProps: inputProps, onFocus: function (e) {
15570
15587
  if (inputOnFocus)
15571
15588
  inputOnFocus(e);
15572
15589
  if (onFocus)
@@ -16390,7 +16407,7 @@ styleInject(css_248z$1);var FormFile = React__default.forwardRef(function (_a, r
16390
16407
  },
16391
16408
  }, style: { width: fullWidth ? '100%' : undefined }, control: React__default.createElement("div", { className: 'control-wrap' },
16392
16409
  !hideUrl && (React__default.createElement("div", { className: 'file-name-wrap' },
16393
- React__default.createElement(TextField, { inputRef: textFieldRef, className: 'file-name', variant: variant, label: label, size: size, required: required, value: value || '', focused: focused, disabled: disabled, fullWidth: true, error: error, InputLabelProps: labelShrink ? { shrink: labelShrink } : undefined, inputProps: { readOnly: true }, InputProps: {
16410
+ React__default.createElement(TextField, { inputRef: textFieldRef, className: 'file-name', variant: variant, label: label, size: size, required: required, value: value || '', focused: focused, disabled: disabled, fullWidth: true, error: error, InputLabelProps: labelShrink ? { shrink: labelShrink } : undefined, inputProps: { readOnly: true, tabIndex: -1 }, InputProps: {
16394
16411
  endAdornment: (React__default.createElement(InputAdornment, { position: 'end' },
16395
16412
  React__default.createElement("div", { className: 'input-file-wrap' },
16396
16413
  React__default.createElement(Button, { variant: 'text', className: 'input-file-btn form-file-btn', color: error ? 'error' : color, disabled: disabled, ref: fileUploadBtnRef },