@tap-payments/os-micro-frontend-shared 0.1.193 → 0.1.194

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.
@@ -5,5 +5,5 @@ export interface InputBaseProps extends Omit<InputProps, 'onChange'> {
5
5
  onChange?: (value: string) => void;
6
6
  hasError: boolean;
7
7
  }
8
- declare const _default: React.ForwardRefExoticComponent<Omit<Readonly<InputBaseProps>, "ref"> & React.RefAttributes<HTMLInputElement>>;
9
- export default _default;
8
+ declare const InputBase: React.ForwardRefExoticComponent<Omit<InputBaseProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
9
+ export default InputBase;
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import React from 'react';
14
14
  import Box from '@mui/material/Box';
15
15
  import { StyledInput, StyledWrapper, StyledErrorMessage } from './style';
16
- function InputBase(_a, ref) {
16
+ const InputBase = React.forwardRef((_a, ref) => {
17
17
  var _b;
18
18
  var { name, onChange, hasError, helperText, hideArrows } = _a, props = __rest(_a, ["name", "onChange", "hasError", "helperText", "hideArrows"]);
19
19
  const handleChange = (e) => {
@@ -23,6 +23,6 @@ function InputBase(_a, ref) {
23
23
  return (_jsxs(Box, { children: [_jsx(StyledWrapper, Object.assign({ "data-testid": "InputBase" }, { children: _jsx(StyledInput, Object.assign({ rows: 1, error: hasError, fullWidth: true, size: "small", variant: "standard", ref: ref, name: name, type: (_b = props.type) !== null && _b !== void 0 ? _b : 'text', label: props.placeholder || props.label, onChange: handleChange, InputProps: {
24
24
  disableUnderline: true,
25
25
  }, hideArrows: hideArrows }, props)) })), _jsx(StyledErrorMessage, { children: helperText })] }));
26
- }
26
+ });
27
27
  InputBase.displayName = 'InputBase';
28
- export default React.forwardRef(InputBase);
28
+ export default InputBase;
@@ -4,9 +4,5 @@ export interface FormInputProps extends Omit<InputBaseProps, 'name' | 'hasError'
4
4
  name: string;
5
5
  hideArrows?: boolean;
6
6
  }
7
- declare function FormInput({ name, helperText, hideArrows, ...props }: FormInputProps): import("react/jsx-runtime").JSX.Element;
8
- declare namespace FormInput {
9
- var displayName: string;
10
- }
11
- declare const _default: React.MemoExoticComponent<typeof FormInput>;
7
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<FormInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>>;
12
8
  export default _default;
@@ -13,16 +13,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { useFormContext, Controller } from 'react-hook-form';
15
15
  import { InputBase } from '../../../InputBase';
16
- function FormInput(_a) {
16
+ const FormInput = React.forwardRef((_a, ref) => {
17
17
  var { name, helperText, hideArrows } = _a, props = __rest(_a, ["name", "helperText", "hideArrows"]);
18
18
  const { control } = useFormContext();
19
19
  return (_jsx(Controller, { name: name, control: control, defaultValue: props.defaultValue, render: ({ field, fieldState }) => {
20
20
  var _a;
21
- return (_jsx(InputBase, Object.assign({}, props, field, { hasError: !!fieldState.error, helperText: helperText !== null && helperText !== void 0 ? helperText : (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message, hideArrows: hideArrows, onWheel: (e) => {
21
+ return (_jsx(InputBase, Object.assign({}, props, field, { ref: ref, hasError: !!fieldState.error, helperText: helperText !== null && helperText !== void 0 ? helperText : (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message, hideArrows: hideArrows, onChange: (value) => {
22
+ var _a;
23
+ field.onChange(value); // update react-hook-form
24
+ (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value); // optional external handler
25
+ }, onWheel: (e) => {
22
26
  // eslint-disable-next-line
23
27
  e.target instanceof HTMLElement && e.target.blur();
24
28
  } })));
25
29
  } }));
26
- }
30
+ });
27
31
  FormInput.displayName = 'RFHFormInput';
28
32
  export default React.memo(FormInput);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.193",
4
+ "version": "0.1.194",
5
5
  "testVersion": 2,
6
6
  "type": "module",
7
7
  "main": "build/index.js",