@alfalab/core-components-number-input 1.1.2 → 1.2.0

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.
Files changed (97) hide show
  1. package/Component-2abb571d.d.ts +38 -0
  2. package/Component.desktop.d.ts +6 -0
  3. package/Component.desktop.js +18 -0
  4. package/Component.mobile-ebda875c.d.ts +6 -0
  5. package/Component.mobile.d.ts +6 -0
  6. package/Component.mobile.js +18 -0
  7. package/Component.responsive.d.ts +6 -0
  8. package/Component.responsive.js +18 -0
  9. package/{Component.d.ts → components/number-input/Component.d.ts} +13 -1
  10. package/{Component.js → components/number-input/Component.js} +3 -4
  11. package/components/number-input/index.d.ts +1 -0
  12. package/components/number-input/index.js +13 -0
  13. package/cssm/Component-2abb571d.d.ts +38 -0
  14. package/cssm/Component.desktop.d.ts +6 -0
  15. package/cssm/Component.desktop.js +18 -0
  16. package/cssm/Component.mobile-ebda875c.d.ts +6 -0
  17. package/cssm/Component.mobile.d.ts +6 -0
  18. package/cssm/Component.mobile.js +18 -0
  19. package/cssm/Component.responsive.d.ts +6 -0
  20. package/cssm/Component.responsive.js +18 -0
  21. package/{esm → cssm/components/number-input}/Component.d.ts +13 -1
  22. package/cssm/{Component.js → components/number-input/Component.js} +3 -4
  23. package/cssm/components/number-input/index.d.ts +1 -0
  24. package/cssm/components/number-input/index.js +13 -0
  25. package/cssm/desktop.d.ts +2 -0
  26. package/cssm/desktop.js +15 -0
  27. package/cssm/index-2abb571d.d.ts +15 -0
  28. package/cssm/index-72dda473.d.ts +12 -0
  29. package/cssm/index-ebda875c.d.ts +135 -0
  30. package/cssm/index.d.ts +2 -1
  31. package/cssm/index.js +4 -3
  32. package/cssm/mobile.d.ts +2 -0
  33. package/cssm/mobile.js +15 -0
  34. package/cssm/typings-9211a437.d.ts +95 -0
  35. package/desktop.d.ts +2 -0
  36. package/desktop.js +15 -0
  37. package/esm/Component-2abb571d.d.ts +38 -0
  38. package/esm/Component.desktop.d.ts +6 -0
  39. package/esm/Component.desktop.js +10 -0
  40. package/esm/Component.mobile-ebda875c.d.ts +6 -0
  41. package/esm/Component.mobile.d.ts +6 -0
  42. package/esm/Component.mobile.js +10 -0
  43. package/esm/Component.responsive.d.ts +6 -0
  44. package/esm/Component.responsive.js +10 -0
  45. package/{cssm → esm/components/number-input}/Component.d.ts +13 -1
  46. package/esm/{Component.js → components/number-input/Component.js} +2 -3
  47. package/esm/components/number-input/index.d.ts +1 -0
  48. package/esm/components/number-input/index.js +5 -0
  49. package/esm/desktop.d.ts +2 -0
  50. package/esm/desktop.js +7 -0
  51. package/esm/index-2abb571d.d.ts +15 -0
  52. package/esm/index-72dda473.d.ts +12 -0
  53. package/esm/index-ebda875c.d.ts +135 -0
  54. package/esm/index.d.ts +2 -1
  55. package/esm/index.js +3 -2
  56. package/esm/mobile.d.ts +2 -0
  57. package/esm/mobile.js +7 -0
  58. package/esm/typings-9211a437.d.ts +95 -0
  59. package/index-2abb571d.d.ts +15 -0
  60. package/index-72dda473.d.ts +12 -0
  61. package/index-ebda875c.d.ts +135 -0
  62. package/index.d.ts +2 -1
  63. package/index.js +4 -3
  64. package/mobile.d.ts +2 -0
  65. package/mobile.js +15 -0
  66. package/modern/Component-2abb571d.d.ts +38 -0
  67. package/modern/Component.desktop.d.ts +6 -0
  68. package/modern/Component.desktop.js +9 -0
  69. package/modern/Component.mobile-ebda875c.d.ts +6 -0
  70. package/modern/Component.mobile.d.ts +6 -0
  71. package/modern/Component.mobile.js +9 -0
  72. package/modern/Component.responsive.d.ts +6 -0
  73. package/modern/Component.responsive.js +9 -0
  74. package/modern/{Component.d.ts → components/number-input/Component.d.ts} +13 -1
  75. package/modern/{Component.js → components/number-input/Component.js} +2 -3
  76. package/modern/components/number-input/index.d.ts +1 -0
  77. package/modern/components/number-input/index.js +4 -0
  78. package/modern/desktop.d.ts +2 -0
  79. package/modern/desktop.js +6 -0
  80. package/modern/index-2abb571d.d.ts +15 -0
  81. package/modern/index-72dda473.d.ts +12 -0
  82. package/modern/index-ebda875c.d.ts +135 -0
  83. package/modern/index.d.ts +2 -1
  84. package/modern/index.js +3 -2
  85. package/modern/mobile.d.ts +2 -0
  86. package/modern/mobile.js +6 -0
  87. package/modern/typings-9211a437.d.ts +95 -0
  88. package/package.json +2 -2
  89. package/src/Component.desktop.tsx +11 -0
  90. package/src/Component.mobile.tsx +11 -0
  91. package/src/Component.responsive.tsx +11 -0
  92. package/src/{Component.tsx → components/number-input/Component.tsx} +8 -2
  93. package/src/components/number-input/index.ts +1 -0
  94. package/src/desktop.ts +1 -0
  95. package/src/index.ts +4 -1
  96. package/src/mobile.ts +1 -0
  97. package/typings-9211a437.d.ts +95 -0
@@ -0,0 +1,135 @@
1
+ /// <reference types="react" />
2
+ import React from "react";
3
+ import { HTMLAttributes, ReactNode } from "react";
4
+ type StyleColors = {
5
+ default: {
6
+ [key: string]: string;
7
+ };
8
+ inverted: {
9
+ [key: string]: string;
10
+ };
11
+ };
12
+ type BaseFormControlProps = HTMLAttributes<HTMLDivElement> & {
13
+ /**
14
+ * Растягивает компонент на ширину контейнера
15
+ */
16
+ block?: boolean;
17
+ /**
18
+ * Размер компонента
19
+ */
20
+ size?: "s" | "m" | "l" | "xl";
21
+ /**
22
+ * Набор цветов для компонента
23
+ */
24
+ colors?: "default" | "inverted";
25
+ /**
26
+ * Заблокированное состояние
27
+ */
28
+ disabled?: boolean;
29
+ /**
30
+ * Cостояние только для чтения
31
+ */
32
+ readOnly?: boolean;
33
+ /**
34
+ * Заполненное состояние
35
+ */
36
+ filled?: boolean;
37
+ /**
38
+ * Выбранное (фокус) состояние
39
+ */
40
+ focused?: boolean;
41
+ /**
42
+ * Отображение ошибки
43
+ */
44
+ error?: ReactNode | boolean;
45
+ /**
46
+ * Текст подсказки
47
+ */
48
+ hint?: ReactNode;
49
+ /**
50
+ * Лейбл компонента
51
+ */
52
+ label?: ReactNode;
53
+ /**
54
+ * Вид лейбла внутри / снаружи
55
+ */
56
+ labelView?: "inner" | "outer";
57
+ /**
58
+ * Слот слева
59
+ */
60
+ leftAddons?: ReactNode;
61
+ /**
62
+ * Слот справа
63
+ */
64
+ rightAddons?: ReactNode;
65
+ /**
66
+ * Слот под полем
67
+ */
68
+ bottomAddons?: ReactNode;
69
+ /**
70
+ * Дополнительный класс
71
+ */
72
+ className?: string;
73
+ /**
74
+ * Дополнительный класс для поля
75
+ */
76
+ fieldClassName?: string;
77
+ /**
78
+ * Дополнительный класс для поля
79
+ */
80
+ inputWrapperClassName?: string;
81
+ /**
82
+ * Дополнительный класс для лейбла
83
+ */
84
+ labelClassName?: string;
85
+ /**
86
+ * Дополнительный класс для аддонов
87
+ */
88
+ addonsClassName?: string;
89
+ /**
90
+ * Идентификатор для систем автоматизированного тестирования
91
+ */
92
+ dataTestId?: string;
93
+ /**
94
+ * Компонент поля (инпут, textarea и пр.)
95
+ */
96
+ children?: ReactNode;
97
+ /**
98
+ * Основные стили компонента.
99
+ */
100
+ styles: {
101
+ [key: string]: string;
102
+ };
103
+ /**
104
+ * Стили компонента для default и inverted режима.
105
+ */
106
+ colorStyles?: StyleColors;
107
+ };
108
+ declare const BaseFormControl: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
109
+ block?: boolean | undefined;
110
+ size?: "s" | "m" | "l" | "xl" | undefined;
111
+ colors?: "default" | "inverted" | undefined;
112
+ disabled?: boolean | undefined;
113
+ readOnly?: boolean | undefined;
114
+ filled?: boolean | undefined;
115
+ focused?: boolean | undefined;
116
+ error?: ReactNode | boolean;
117
+ hint?: ReactNode;
118
+ label?: ReactNode;
119
+ labelView?: "inner" | "outer" | undefined;
120
+ leftAddons?: ReactNode;
121
+ rightAddons?: ReactNode;
122
+ bottomAddons?: ReactNode;
123
+ className?: string | undefined;
124
+ fieldClassName?: string | undefined;
125
+ inputWrapperClassName?: string | undefined;
126
+ labelClassName?: string | undefined;
127
+ addonsClassName?: string | undefined;
128
+ dataTestId?: string | undefined;
129
+ children?: ReactNode;
130
+ styles: {
131
+ [key: string]: string;
132
+ };
133
+ colorStyles?: StyleColors | undefined;
134
+ } & React.RefAttributes<HTMLDivElement>>;
135
+ export { StyleColors, BaseFormControlProps, BaseFormControl };
package/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export * from "./Component";
1
+ export { NumberInputResponsive as NumberInput, NumberInputResponsiveProps as NumberInputProps } from "./Component.responsive";
2
+ export {};
package/index.js CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var Component = require('./Component.js');
5
+ var Component_responsive = require('./Component.responsive.js');
6
6
  require('tslib');
7
7
  require('react');
8
- require('react-merge-refs');
9
8
  require('@alfalab/core-components-input');
9
+ require('./components/number-input/Component.js');
10
+ require('react-merge-refs');
10
11
  require('./utils.js');
11
12
 
12
13
 
13
14
 
14
- exports.NumberInput = Component.NumberInput;
15
+ exports.NumberInput = Component_responsive.NumberInputResponsive;
package/mobile.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { NumberInputMobile, NumberInputMobileProps } from "./Component.mobile";
2
+ export {};
package/mobile.js ADDED
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Component_mobile = require('./Component.mobile.js');
6
+ require('tslib');
7
+ require('react');
8
+ require('@alfalab/core-components-input/mobile');
9
+ require('./components/number-input/Component.js');
10
+ require('react-merge-refs');
11
+ require('./utils.js');
12
+
13
+
14
+
15
+ exports.NumberInputMobile = Component_mobile.NumberInputMobile;
@@ -0,0 +1,38 @@
1
+ /// <reference types="react" />
2
+ import React from "react";
3
+ import { FC } from "react";
4
+ import { BaseButtonProps } from "./typings-9211a437";
5
+ type SpinnerProps = {
6
+ /**
7
+ * Управление видимостью компонента
8
+ */
9
+ visible?: boolean;
10
+ /**
11
+ * Размер компонента
12
+ */
13
+ size?: "xs" | "s" | "m";
14
+ /**
15
+ * Дополнительный класс
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Идентификатор компонента в DOM
20
+ */
21
+ id?: string;
22
+ /**
23
+ * Идентификатор для систем автоматизированного тестирования
24
+ */
25
+ dataTestId?: string;
26
+ /**
27
+ * Палитра, в контексте которой используется спиннер
28
+ */
29
+ colors?: "default" | "inverted";
30
+ };
31
+ declare const Spinner: FC<SpinnerProps>;
32
+ /**
33
+ * Минимальное время отображения лоадера - 500мс,
34
+ * чтобы при быстрых ответах от сервера кнопка не «моргала».
35
+ */
36
+ declare const LOADER_MIN_DISPLAY_INTERVAL = 500;
37
+ declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
38
+ export { SpinnerProps, Spinner, LOADER_MIN_DISPLAY_INTERVAL, BaseButton };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { NumberInputProps } from "./components/number-input/index";
4
+ type NumberInputDesktopProps = Omit<NumberInputProps, 'Input' | 'breakpoint'>;
5
+ declare const NumberInputDesktop: React.ForwardRefExoticComponent<NumberInputDesktopProps & React.RefAttributes<HTMLInputElement>>;
6
+ export { NumberInputDesktopProps, NumberInputDesktop };
@@ -0,0 +1,9 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { InputDesktop } from '@alfalab/core-components-input/modern/desktop';
3
+ import { NumberInput } from './components/number-input/Component.js';
4
+ import 'react-merge-refs';
5
+ import './utils.js';
6
+
7
+ const NumberInputDesktop = forwardRef((props, ref) => React.createElement(NumberInput, { ...props, Input: InputDesktop, ref: ref }));
8
+
9
+ export { NumberInputDesktop };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { BaseFormControlProps } from "./index-ebda875c";
4
+ type FormControlMobileProps = Omit<BaseFormControlProps, 'styles' | 'colorStyles'>;
5
+ declare const FormControlMobile: React.ForwardRefExoticComponent<FormControlMobileProps & React.RefAttributes<HTMLDivElement>>;
6
+ export { FormControlMobileProps, FormControlMobile };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { NumberInputProps } from "./components/number-input/index";
4
+ type NumberInputMobileProps = Omit<NumberInputProps, 'Input' | 'breakpoint'>;
5
+ declare const NumberInputMobile: React.ForwardRefExoticComponent<NumberInputMobileProps & React.RefAttributes<HTMLInputElement>>;
6
+ export { NumberInputMobileProps, NumberInputMobile };
@@ -0,0 +1,9 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { InputMobile } from '@alfalab/core-components-input/modern/mobile';
3
+ import { NumberInput } from './components/number-input/Component.js';
4
+ import 'react-merge-refs';
5
+ import './utils.js';
6
+
7
+ const NumberInputMobile = forwardRef((props, ref) => React.createElement(NumberInput, { ...props, Input: InputMobile, ref: ref }));
8
+
9
+ export { NumberInputMobile };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { NumberInputProps } from "./components/number-input/index";
4
+ type NumberInputResponsiveProps = Omit<NumberInputProps, 'Input'>;
5
+ declare const NumberInputResponsive: React.ForwardRefExoticComponent<NumberInputResponsiveProps & React.RefAttributes<HTMLInputElement>>;
6
+ export { NumberInputResponsiveProps, NumberInputResponsive };
@@ -0,0 +1,9 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { Input } from '@alfalab/core-components-input/modern';
3
+ import { NumberInput } from './components/number-input/Component.js';
4
+ import 'react-merge-refs';
5
+ import './utils.js';
6
+
7
+ const NumberInputResponsive = forwardRef((props, ref) => React.createElement(NumberInput, { ...props, Input: Input, ref: ref }));
8
+
9
+ export { NumberInputResponsive };
@@ -18,6 +18,12 @@ type NumberInputProps = Omit<InputProps, 'value' | 'onChange' | 'type'> & {
18
18
  * Количество символов после разделителя
19
19
  */
20
20
  fractionLength?: number;
21
+ /**
22
+ * Компонент инпута
23
+ */
24
+ Input: React.FC<InputProps & {
25
+ ref?: React.Ref<HTMLInputElement>;
26
+ }>;
21
27
  /**
22
28
  * Обработчик события изменения значения
23
29
  */
@@ -33,7 +39,7 @@ type NumberInputProps = Omit<InputProps, 'value' | 'onChange' | 'type'> & {
33
39
  valueString: string;
34
40
  }) => void;
35
41
  };
36
- declare const NumberInput: React.ForwardRefExoticComponent<Omit<InputProps, "type" | "onChange" | "value"> & {
42
+ declare const NumberInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange" | "type" | "value"> & {
37
43
  /**
38
44
  * Значение поля ввода
39
45
  */
@@ -50,6 +56,12 @@ declare const NumberInput: React.ForwardRefExoticComponent<Omit<InputProps, "typ
50
56
  * Количество символов после разделителя
51
57
  */
52
58
  fractionLength?: number | undefined;
59
+ /**
60
+ * Компонент инпута
61
+ */
62
+ Input: React.FC<InputProps & {
63
+ ref?: React.Ref<HTMLInputElement>;
64
+ }>;
53
65
  /**
54
66
  * Обработчик события изменения значения
55
67
  */
@@ -1,9 +1,8 @@
1
1
  import React, { useRef, useState } from 'react';
2
2
  import mergeRefs from 'react-merge-refs';
3
- import { Input } from '@alfalab/core-components-input/modern';
4
- import { createSeparatorsRegExp, getAllowedValue, SEPARATORS, SIGNS } from './utils.js';
3
+ import { createSeparatorsRegExp, getAllowedValue, SEPARATORS, SIGNS } from '../../utils.js';
5
4
 
6
- const NumberInput = React.forwardRef(({ value: propValue, onChange, onBlur, allowSigns = true, separator = ',', fractionLength, defaultValue, ...restProps }, ref) => {
5
+ const NumberInput = React.forwardRef(({ value: propValue, onChange, onBlur, allowSigns = true, separator = ',', fractionLength, defaultValue, Input, ...restProps }, ref) => {
7
6
  const uncontrolled = propValue === undefined;
8
7
  const inputRef = useRef(null);
9
8
  const [value, setValue] = useState(defaultValue || '');
@@ -0,0 +1 @@
1
+ export { NumberInput, NumberInputProps } from "./Component";
@@ -0,0 +1,4 @@
1
+ export { NumberInput } from './Component.js';
2
+ import 'react';
3
+ import 'react-merge-refs';
4
+ import '../../utils.js';
@@ -0,0 +1,2 @@
1
+ export { NumberInputDesktop, NumberInputDesktopProps } from "./Component.desktop";
2
+ export {};
@@ -0,0 +1,6 @@
1
+ export { NumberInputDesktop } from './Component.desktop.js';
2
+ import 'react';
3
+ import '@alfalab/core-components-input/modern/desktop';
4
+ import './components/number-input/Component.js';
5
+ import 'react-merge-refs';
6
+ import './utils.js';
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import React from "react";
3
+ import { PaddingType } from "./index-72dda473";
4
+ declare function createPaddingStyle(padding?: PaddingType): undefined | React.CSSProperties;
5
+ declare const isClient: () => boolean;
6
+ declare const getDataTestId: (dataTestId?: string, element?: string) => string | undefined;
7
+ declare function easeInOutQuad(x: number): number;
8
+ declare const easingFns: {
9
+ easeInOutQuad: typeof easeInOutQuad;
10
+ };
11
+ declare function disableUserInput<T>(disabled: boolean | undefined, event: React.KeyboardEvent<T>): void;
12
+ declare const inputUtils: {
13
+ disableUserInput: typeof disableUserInput;
14
+ };
15
+ export { createPaddingStyle, isClient, getDataTestId, easingFns, inputUtils };
@@ -0,0 +1,12 @@
1
+ type BackgroundColorType = 'accent' | 'info' | 'attention-muted' | 'positive-muted' | 'negative-muted' | 'primary' | 'primary-inverted' | 'secondary' | 'secondary-inverted' | 'tertiary' | 'tertiary-inverted' | 'quaternary' | 'quaternary-inverted' | 'specialbg-component' | 'specialbg-component-inverted' | 'specialbg-primary-grouped' | 'specialbg-secondary-grouped' | 'specialbg-tertiary-grouped' | 'specialbg-secondary-transparent' | 'specialbg-secondary-transparent-inverted' | 'specialbg-tertiary-transparent' | 'specialbg-tertiary-transparent-inverted';
2
+ type BorderColorType = 'accent' | 'key' | 'key-inverted' | 'link' | 'primary' | 'primary-inverted' | 'secondary' | 'secondary-inverted' | 'tertiary' | 'tertiary-inverted' | 'underline' | 'underline-inverted' | 'graphic-attention' | 'graphic-link' | 'graphic-negative' | 'graphic-positive' | 'specialbg-secondary-transparent' | 'specialbg-secondary-transparent-inverted' | 'specialbg-tertiary-transparent' | 'specialbg-tertiary-transparent-inverted';
3
+ type GraphicColorType = 'accent' | 'link' | 'attention' | 'positive' | 'negative' | 'primary' | 'primary-inverted' | 'secondary' | 'secondary-inverted' | 'tertiary' | 'tertiary-inverted' | 'quaternary' | 'quaternary-inverted' | 'static-light' | 'static-accent' | 'static-dark';
4
+ type ShadowType = 'shadow-xs' | 'shadow-s' | 'shadow-m' | 'shadow-l' | 'shadow-xl' | 'shadow-xs-hard' | 'shadow-s-hard' | 'shadow-m-hard' | 'shadow-l-hard' | 'shadow-xl-hard' | 'shadow-xs-up' | 'shadow-s-up' | 'shadow-m-up' | 'shadow-l-up' | 'shadow-xl-up' | 'shadow-xs-hard-up' | 'shadow-s-hard-up' | 'shadow-m-hard-up' | 'shadow-l-hard-up' | 'shadow-xl-hard-up';
5
+ type GapType = '3xs' | '2xs' | 'xs' | 's' | 'm' | 'l' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl';
6
+ type PaddingType = number | string | {
7
+ top?: number;
8
+ right?: number;
9
+ bottom?: number;
10
+ left?: number;
11
+ };
12
+ export { BackgroundColorType, BorderColorType, GraphicColorType, ShadowType, GapType, PaddingType };
@@ -0,0 +1,135 @@
1
+ /// <reference types="react" />
2
+ import React from "react";
3
+ import { HTMLAttributes, ReactNode } from "react";
4
+ type StyleColors = {
5
+ default: {
6
+ [key: string]: string;
7
+ };
8
+ inverted: {
9
+ [key: string]: string;
10
+ };
11
+ };
12
+ type BaseFormControlProps = HTMLAttributes<HTMLDivElement> & {
13
+ /**
14
+ * Растягивает компонент на ширину контейнера
15
+ */
16
+ block?: boolean;
17
+ /**
18
+ * Размер компонента
19
+ */
20
+ size?: "s" | "m" | "l" | "xl";
21
+ /**
22
+ * Набор цветов для компонента
23
+ */
24
+ colors?: "default" | "inverted";
25
+ /**
26
+ * Заблокированное состояние
27
+ */
28
+ disabled?: boolean;
29
+ /**
30
+ * Cостояние только для чтения
31
+ */
32
+ readOnly?: boolean;
33
+ /**
34
+ * Заполненное состояние
35
+ */
36
+ filled?: boolean;
37
+ /**
38
+ * Выбранное (фокус) состояние
39
+ */
40
+ focused?: boolean;
41
+ /**
42
+ * Отображение ошибки
43
+ */
44
+ error?: ReactNode | boolean;
45
+ /**
46
+ * Текст подсказки
47
+ */
48
+ hint?: ReactNode;
49
+ /**
50
+ * Лейбл компонента
51
+ */
52
+ label?: ReactNode;
53
+ /**
54
+ * Вид лейбла внутри / снаружи
55
+ */
56
+ labelView?: "inner" | "outer";
57
+ /**
58
+ * Слот слева
59
+ */
60
+ leftAddons?: ReactNode;
61
+ /**
62
+ * Слот справа
63
+ */
64
+ rightAddons?: ReactNode;
65
+ /**
66
+ * Слот под полем
67
+ */
68
+ bottomAddons?: ReactNode;
69
+ /**
70
+ * Дополнительный класс
71
+ */
72
+ className?: string;
73
+ /**
74
+ * Дополнительный класс для поля
75
+ */
76
+ fieldClassName?: string;
77
+ /**
78
+ * Дополнительный класс для поля
79
+ */
80
+ inputWrapperClassName?: string;
81
+ /**
82
+ * Дополнительный класс для лейбла
83
+ */
84
+ labelClassName?: string;
85
+ /**
86
+ * Дополнительный класс для аддонов
87
+ */
88
+ addonsClassName?: string;
89
+ /**
90
+ * Идентификатор для систем автоматизированного тестирования
91
+ */
92
+ dataTestId?: string;
93
+ /**
94
+ * Компонент поля (инпут, textarea и пр.)
95
+ */
96
+ children?: ReactNode;
97
+ /**
98
+ * Основные стили компонента.
99
+ */
100
+ styles: {
101
+ [key: string]: string;
102
+ };
103
+ /**
104
+ * Стили компонента для default и inverted режима.
105
+ */
106
+ colorStyles?: StyleColors;
107
+ };
108
+ declare const BaseFormControl: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
109
+ block?: boolean | undefined;
110
+ size?: "s" | "m" | "l" | "xl" | undefined;
111
+ colors?: "default" | "inverted" | undefined;
112
+ disabled?: boolean | undefined;
113
+ readOnly?: boolean | undefined;
114
+ filled?: boolean | undefined;
115
+ focused?: boolean | undefined;
116
+ error?: ReactNode | boolean;
117
+ hint?: ReactNode;
118
+ label?: ReactNode;
119
+ labelView?: "inner" | "outer" | undefined;
120
+ leftAddons?: ReactNode;
121
+ rightAddons?: ReactNode;
122
+ bottomAddons?: ReactNode;
123
+ className?: string | undefined;
124
+ fieldClassName?: string | undefined;
125
+ inputWrapperClassName?: string | undefined;
126
+ labelClassName?: string | undefined;
127
+ addonsClassName?: string | undefined;
128
+ dataTestId?: string | undefined;
129
+ children?: ReactNode;
130
+ styles: {
131
+ [key: string]: string;
132
+ };
133
+ colorStyles?: StyleColors | undefined;
134
+ } & React.RefAttributes<HTMLDivElement>>;
135
+ export { StyleColors, BaseFormControlProps, BaseFormControl };
package/modern/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export * from "./Component";
1
+ export { NumberInputResponsive as NumberInput, NumberInputResponsiveProps as NumberInputProps } from "./Component.responsive";
2
+ export {};
package/modern/index.js CHANGED
@@ -1,5 +1,6 @@
1
- export { NumberInput } from './Component.js';
1
+ export { NumberInputResponsive as NumberInput } from './Component.responsive.js';
2
2
  import 'react';
3
- import 'react-merge-refs';
4
3
  import '@alfalab/core-components-input/modern';
4
+ import './components/number-input/Component.js';
5
+ import 'react-merge-refs';
5
6
  import './utils.js';
@@ -0,0 +1,2 @@
1
+ export { NumberInputMobile, NumberInputMobileProps } from "./Component.mobile";
2
+ export {};
@@ -0,0 +1,6 @@
1
+ export { NumberInputMobile } from './Component.mobile.js';
2
+ import 'react';
3
+ import '@alfalab/core-components-input/modern/mobile';
4
+ import './components/number-input/Component.js';
5
+ import 'react-merge-refs';
6
+ import './utils.js';
@@ -0,0 +1,95 @@
1
+ import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, ReactNode } from 'react';
2
+ type StyleColors = {
3
+ default: {
4
+ [key: string]: string;
5
+ };
6
+ inverted: {
7
+ [key: string]: string;
8
+ };
9
+ };
10
+ type ComponentProps = {
11
+ /**
12
+ * Тип кнопки
13
+ * @default secondary
14
+ */
15
+ view?: 'accent' | 'primary' | 'secondary' | 'tertiary' | 'outlined' | 'filled' | 'transparent' | 'link' | 'ghost';
16
+ /**
17
+ * Слот слева
18
+ */
19
+ leftAddons?: ReactNode;
20
+ /**
21
+ * Слот справа
22
+ */
23
+ rightAddons?: ReactNode;
24
+ /**
25
+ * Размер компонента
26
+ * @default m
27
+ */
28
+ size?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
29
+ /**
30
+ * Растягивает компонент на ширину контейнера
31
+ * @default false
32
+ */
33
+ block?: boolean;
34
+ /**
35
+ * Дополнительный класс
36
+ */
37
+ className?: string;
38
+ /**
39
+ * Дополнительный класс для спиннера
40
+ */
41
+ spinnerClassName?: string;
42
+ /**
43
+ * Выводит ссылку в виде кнопки
44
+ */
45
+ href?: string;
46
+ /**
47
+ * Позволяет использовать кастомный компонент для кнопки (например Link из роутера)
48
+ */
49
+ Component?: ElementType;
50
+ /**
51
+ * Идентификатор для систем автоматизированного тестирования
52
+ */
53
+ dataTestId?: string;
54
+ /**
55
+ * Показать лоадер
56
+ * @default false
57
+ */
58
+ loading?: boolean;
59
+ /**
60
+ * Не переносить текст кнопки на новую строку
61
+ * @default false
62
+ */
63
+ nowrap?: boolean;
64
+ /**
65
+ * Набор цветов для компонента
66
+ */
67
+ colors?: 'default' | 'inverted';
68
+ /**
69
+ * Дочерние элементы.
70
+ */
71
+ children?: ReactNode;
72
+ /**
73
+ * Основные стили компонента.
74
+ */
75
+ styles: {
76
+ [key: string]: string;
77
+ };
78
+ /**
79
+ * Стили компонента для default и inverted режима.
80
+ */
81
+ colorStylesMap: StyleColors;
82
+ };
83
+ type AnchorBaseButtonProps = ComponentProps & AnchorHTMLAttributes<HTMLAnchorElement>;
84
+ type NativeBaseButtonProps = ComponentProps & ButtonHTMLAttributes<HTMLButtonElement>;
85
+ type BaseButtonProps = Partial<AnchorBaseButtonProps | NativeBaseButtonProps>;
86
+ type AnchorButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & AnchorHTMLAttributes<HTMLAnchorElement>;
87
+ type NativeButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & ButtonHTMLAttributes<HTMLButtonElement>;
88
+ type ButtonProps = Partial<AnchorButtonProps | NativeButtonProps> & {
89
+ /**
90
+ * Контрольная точка, с нее начинается desktop версия
91
+ * @default 1024
92
+ */
93
+ breakpoint?: number;
94
+ };
95
+ export { StyleColors, ComponentProps, AnchorBaseButtonProps, NativeBaseButtonProps, BaseButtonProps, AnchorButtonProps, NativeButtonProps, ButtonProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-number-input",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  "react": "^16.9.0 || ^17.0.1 || ^18.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@alfalab/core-components-input": "^12.0.2",
17
+ "@alfalab/core-components-input": "^12.1.0",
18
18
  "react-merge-refs": "^1.1.0",
19
19
  "tslib": "^2.4.0"
20
20
  }