@modul/mbui 0.0.1-beta-pv-50560-03649539 → 0.0.1-beta-pv-50560-3e5e7e6f

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modul/mbui",
3
- "version": "0.0.1-beta-pv-50560-03649539",
3
+ "version": "0.0.1-beta-pv-50560-3e5e7e6f",
4
4
  "packageManager": "yarn@3.5.1",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
@@ -37,7 +37,7 @@ const AmountFormat: React.FC<AmountFormatProps> = ({
37
37
  //FIXME: dangerouslySetInnerHTML ???
38
38
  return (
39
39
  <span className={className}>
40
- {formattedValue}
40
+ {formattedValue}&nbsp;
41
41
  {currency && <CurrencySymbol value={currency} />}
42
42
  </span>
43
43
  )
@@ -14,13 +14,16 @@ accounting.settings = {
14
14
  }
15
15
 
16
16
  interface IAmountInput extends React.InputHTMLAttributes<HTMLInputElement> {
17
- value: string | number
17
+ value?: string | number
18
18
  precision?: number
19
- onChange: CombinedChangeEventHandler
19
+ onChange?: CombinedChangeEventHandler
20
20
  }
21
21
 
22
22
  const AmountInput = forwardRef<HTMLInputElement, IAmountInput>(
23
- ({ onChange, precision = 4, value, ...props }: IAmountInput, ref: ForwardedRef<HTMLInputElement>) => {
23
+ (
24
+ { onChange, precision = 2, value, type = 'text', ...props }: IAmountInput,
25
+ ref: ForwardedRef<HTMLInputElement>
26
+ ) => {
24
27
  const innerRef = useForwardedRef(ref)
25
28
  //Состояния для отслеживания текущего значения и позиции курсора
26
29
  const [viewValue, setViewValue] = useState<string>('')
@@ -110,11 +113,12 @@ const AmountInput = forwardRef<HTMLInputElement, IAmountInput>(
110
113
 
111
114
  return (
112
115
  <input
113
- {...props}
116
+ type={type}
114
117
  ref={innerRef}
115
118
  value={viewValue}
116
119
  onKeyDown={handleKeyDown}
117
120
  onChange={handleChange}
121
+ {...props}
118
122
  />
119
123
  )
120
124
  }
@@ -7,7 +7,9 @@ interface CurrencySymbolProps {
7
7
 
8
8
  const CurrencySymbol: React.FC<CurrencySymbolProps> = ({ value }) => {
9
9
  const symbol = currencySymbols[value] || value
10
- return <span className="currency-iso">{symbol}</span>
10
+ const currencyClass = currencySymbols[value] ? 'currency-iso' : ''
11
+
12
+ return <span className={currencyClass}>{symbol}</span>
11
13
  }
12
14
 
13
15
  export default CurrencySymbol
@@ -4,4 +4,4 @@ export enum currencySymbols {
4
4
  CNY = '¥',
5
5
  RUB = '₽',
6
6
  RUR = '₽',
7
- }
7
+ }