react-better-html 1.1.35 → 1.1.36

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.
@@ -131,7 +131,7 @@ const InputFieldComponent = (0, react_1.forwardRef)(function InputField({ label,
131
131
  }, [withDebounce, onChangeValue, debouncedValue]);
132
132
  return ((0, jsx_runtime_1.jsxs)(Div_1.default.column, { width: "100%", gap: theme.styles.gap / 2, ...styledComponentStylesWithExcluded, children: [label && (0, jsx_runtime_1.jsx)(Label_1.default, { text: label, required: required, isError: !!errorText }), (0, jsx_runtime_1.jsxs)(Div_1.default, { position: "relative", width: "100%", children: [leftIcon && ((0, jsx_runtime_1.jsx)(Icon_1.default, { name: leftIcon, position: "absolute", top: 46 / 2, left: theme.styles.space + 1, transform: "translateY(-50%)", pointerEvents: "none", zIndex: 1002 })), (0, jsx_runtime_1.jsx)(InputElement, { theme: theme, withLeftIcon: leftIcon !== undefined, withRightIcon: rightIcon !== undefined, required: required, placeholder: placeholder ?? label, onChange: onChangeElement, ...styledComponentStylesWithoutExcluded, ...dataProps, ...ariaProps, ...restProps, ref: ref }), rightIcon ? (onClickRightIcon ? ((0, jsx_runtime_1.jsx)(Button_1.default.icon, { icon: rightIcon, position: "absolute", top: 46 / 2, right: theme.styles.space + 1 - theme.styles.space / 2, transform: "translateY(-50%)", onClick: onClickRightIcon })) : ((0, jsx_runtime_1.jsx)(Icon_1.default, { name: rightIcon, position: "absolute", top: 46 / 2, right: theme.styles.space + 1, transform: "translateY(-50%)", pointerEvents: "none" }))) : undefined, insideInputFieldComponent] }), (errorText || infoText) && ((0, jsx_runtime_1.jsx)(Text_1.default, { as: "span", display: "block", fontSize: 14, color: errorText ? theme.colors.error : theme.colors.textSecondary, children: errorText || infoText }))] }));
133
133
  });
134
- InputFieldComponent.multiline = (0, react_1.forwardRef)(function Textarea({ label, errorText, infoText, onChange, onChangeValue, required, ...props }, ref) {
134
+ InputFieldComponent.multiline = (0, react_1.forwardRef)(function Multiline({ label, errorText, infoText, onChange, onChangeValue, required, ...props }, ref) {
135
135
  const theme = (0, BetterHtmlProvider_1.useTheme)();
136
136
  const styledComponentStyles = (0, hooks_1.useStyledComponentStyles)(props, theme);
137
137
  const dataProps = (0, hooks_1.useComponentPropsWithPrefix)(props, "data");
@@ -146,14 +146,14 @@ InputFieldComponent.multiline = (0, react_1.forwardRef)(function Textarea({ labe
146
146
  InputFieldComponent.email = (0, react_1.forwardRef)(function Email({ ...props }, ref) {
147
147
  return ((0, jsx_runtime_1.jsx)(InputFieldComponent, { type: "email", placeholder: "your@email.here", autoComplete: "email", autoCorrect: "off", autoCapitalize: "off", ref: ref, ...props }));
148
148
  });
149
- InputFieldComponent.password = (0, react_1.forwardRef)(function Email({ ...props }, ref) {
149
+ InputFieldComponent.password = (0, react_1.forwardRef)(function Password({ ...props }, ref) {
150
150
  const [isPassword, setIsPassword] = (0, hooks_1.useBooleanState)(true);
151
151
  return ((0, jsx_runtime_1.jsx)(InputFieldComponent, { type: isPassword ? "password" : "text", placeholder: "******", rightIcon: isPassword ? "eye" : "eyeDashed", onClickRightIcon: setIsPassword.toggle, autoComplete: "current-password", autoCorrect: "off", autoCapitalize: "off", ref: ref, ...props }));
152
152
  });
153
- InputFieldComponent.search = (0, react_1.forwardRef)(function Email({ ...props }, ref) {
153
+ InputFieldComponent.search = (0, react_1.forwardRef)(function Search({ ...props }, ref) {
154
154
  return (0, jsx_runtime_1.jsx)(InputFieldComponent, { leftIcon: "magnifyingGlass", placeholder: "Search...", ref: ref, ...props });
155
155
  });
156
- InputFieldComponent.phoneNumber = (0, react_1.forwardRef)(function Email({ value, onChangeValue, ...props }, ref) {
156
+ InputFieldComponent.phoneNumber = (0, react_1.forwardRef)(function PhoneNumber({ label, value, onChangeValue, ...props }, ref) {
157
157
  const theme = (0, BetterHtmlProvider_1.useTheme)();
158
158
  const [dropdownValue, setDropdownValue] = (0, react_1.useState)();
159
159
  const [inputFieldValue, setInputFieldValue] = (0, react_1.useState)(value?.toString() ?? "");
@@ -187,7 +187,7 @@ InputFieldComponent.phoneNumber = (0, react_1.forwardRef)(function Email({ value
187
187
  setDropdownValue(country.phoneNumberExtension);
188
188
  setInputFieldValue(newValue.slice(country?.phoneNumberExtension.length + 1));
189
189
  }, [value]);
190
- return ((0, jsx_runtime_1.jsxs)(Div_1.default.row, { children: [(0, jsx_runtime_1.jsx)(Dropdown_1.default, { options: options, renderOption: renderOption, width: 130, withSearch: true, placeholder: "+00", inputFieldClassName: "react-better-html-phone-number-holder", defaultValue: defaultValue, value: dropdownValue, onChange: setDropdownValue, withoutClearButton: true }), (0, jsx_runtime_1.jsx)(InputFieldComponent, { placeholder: "Phone number", className: "react-better-html-phone-number", value: inputFieldValue, onChangeValue: onChangeValueElement, ref: ref, ...props })] }));
190
+ return ((0, jsx_runtime_1.jsxs)(Div_1.default, { children: [label && (0, jsx_runtime_1.jsx)(Label_1.default, { text: label, required: props.required, isError: !!props.errorText }), (0, jsx_runtime_1.jsxs)(Div_1.default.row, { children: [(0, jsx_runtime_1.jsx)(Dropdown_1.default, { options: options, renderOption: renderOption, width: 130, withSearch: true, placeholder: "+00", inputFieldClassName: "react-better-html-phone-number-holder", defaultValue: defaultValue, value: dropdownValue, onChange: setDropdownValue, withoutClearButton: true }), (0, jsx_runtime_1.jsx)(InputFieldComponent, { placeholder: "Phone number", className: "react-better-html-phone-number", value: inputFieldValue, onChangeValue: onChangeValueElement, ref: ref, ...props })] })] }));
191
191
  });
192
192
  const InputField = (0, react_1.memo)(InputFieldComponent);
193
193
  InputField.multiline = InputFieldComponent.multiline;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-better-html",
3
- "version": "1.1.35",
3
+ "version": "1.1.36",
4
4
  "description": "A component library for react that is as close to plane html as possible",
5
5
  "main": "dist/index.js",
6
6
  "files": [