@dtdot/lego 0.17.21 → 0.17.22

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.
@@ -6,6 +6,7 @@ export interface IInputProps {
6
6
  label?: string;
7
7
  placeholder?: string;
8
8
  type?: string;
9
+ autoFocus?: boolean;
9
10
  value?: string;
10
11
  error?: string;
11
12
  onChange?: (value: any) => void;
@@ -93,7 +93,7 @@ const messageVariants = {
93
93
  errorFocus: { opacity: 1, y: -4 },
94
94
  };
95
95
  const Input = React.forwardRef(function ForwardRefInput(props, ref) {
96
- const { label, name, placeholder, type = 'text', value, error: propsError, onChange, onFocus, onBlur } = props;
96
+ const { label, name, placeholder, type = 'text', autoFocus, value, error: propsError, onChange, onFocus, onBlur, } = props;
97
97
  const [isFocused, setIsFocused] = useState(false);
98
98
  const { value: contextValue, error: contextError, onChange: contextOnChange } = useFormNode(name);
99
99
  const error = contextError || propsError;
@@ -120,7 +120,7 @@ const Input = React.forwardRef(function ForwardRefInput(props, ref) {
120
120
  return (React.createElement("div", null,
121
121
  label && React.createElement(InputLabel, { htmlFor: name }, label),
122
122
  React.createElement(InputContainer, { animate: error ? (isFocused ? 'errorFocus' : 'error') : undefined },
123
- React.createElement(StyledInput, { ref: ref, variants: inputVariants, transition: { type: 'spring', duration: 0.3 }, type: type, name: name, placeholder: placeholder, value: getValue(value, contextValue), onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur }),
123
+ React.createElement(StyledInput, { ref: ref, variants: inputVariants, transition: { type: 'spring', duration: 0.3 }, type: type, name: name, placeholder: placeholder, value: getValue(value, contextValue), onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, autoFocus: autoFocus }),
124
124
  React.createElement(ErrorContainer, { animate: error ? 'show' : undefined, style: { opacity: 0 }, variants: errorVariants, transition: { type: 'spring', duration: 0.3 } },
125
125
  React.createElement(ErrorInner, null,
126
126
  React.createElement(FontAwesomeIcon, { icon: faExclamationCircle }))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtdot/lego",
3
- "version": "0.17.21",
3
+ "version": "0.17.22",
4
4
  "description": "Some reusable components for building my applications",
5
5
  "main": "build/index.js",
6
6
  "scripts": {