@snack-uikit/fields 0.23.3 → 0.23.5-preview-b0cb52bd.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.
- package/CHANGELOG.md +9 -0
- package/README.md +1 -1
- package/dist/components/FieldDate/FieldDate.d.ts +5 -6
- package/dist/components/FieldDecorator/utils.d.ts +0 -1
- package/dist/components/FieldSecure/FieldSecure.d.ts +1 -1
- package/dist/components/FieldSelect/FieldSelect.d.ts +0 -1
- package/dist/components/FieldSelect/FieldSelectMultiple.d.ts +17 -18
- package/dist/components/FieldSelect/FieldSelectSingle.d.ts +16 -17
- package/dist/components/FieldSelect/hooks.d.ts +2 -2
- package/dist/components/FieldSelect/utils/getArrowIcon.d.ts +0 -1
- package/dist/components/FieldSelect/utils/updateItems.d.ts +1 -1
- package/dist/components/FieldSlider/FieldSlider.d.ts +1 -1
- package/dist/components/FieldSlider/FieldSlider.js +7 -6
- package/dist/components/FieldStepper/FieldStepper.d.ts +1 -1
- package/dist/components/FieldText/FieldText.d.ts +1 -1
- package/dist/components/FieldTextArea/FieldTextArea.d.ts +1 -1
- package/dist/hooks/useValueControl.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/FieldSlider/FieldSlider.tsx +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.23.4 (2024-07-29)
|
|
7
|
+
|
|
8
|
+
### Only dependencies have been changed
|
|
9
|
+
* [@snack-uikit/list@0.14.2](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/list/CHANGELOG.md)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## 0.23.3 (2024-07-19)
|
|
7
16
|
|
|
8
17
|
### Only dependencies have been changed
|
package/README.md
CHANGED
|
@@ -317,7 +317,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
317
317
|
| showCopyButton | `boolean` | - | Отображение кнопки копирования |
|
|
318
318
|
| showClearButton | `boolean` | true | Отображение кнопки Очистки поля |
|
|
319
319
|
| locale | `Locale` | new Intl.Locale('ru-RU') | Текущая локаль календаря |
|
|
320
|
-
| buildCellProps | `(date: Date, viewMode: ViewMode) => { isDisabled?: boolean; isHoliday?: boolean };` | - | Колбек установки свойств ячеек календаря. Вызывается на построение каждой ячейки. Принимает два параметра: <br> `Date` - дата ячейки <br> `ViewMode`: <br> - `month` отображение месяца, каждая ячейка - 1 день <br> - `year` отображение года, каждая ячейка - 1 месяц <br> - `decade` отображение декады, каждая ячейка - 1 год <br><br> Колбек должен возвращать объект с полями, отвечающими за отключение и подкраску ячейки. |
|
|
320
|
+
| buildCellProps | `(date: Date, viewMode: ViewMode) => { isDisabled?: boolean; isHoliday?: boolean } ;` | - | Колбек установки свойств ячеек календаря. Вызывается на построение каждой ячейки. Принимает два параметра: <br> `Date` - дата ячейки <br> `ViewMode`: <br> - `month` отображение месяца, каждая ячейка - 1 день <br> - `year` отображение года, каждая ячейка - 1 месяц <br> - `decade` отображение декады, каждая ячейка - 1 год <br><br> Колбек должен возвращать объект с полями, отвечающими за отключение и подкраску ячейки. |
|
|
321
321
|
| disabled | `boolean` | - | Является ли поле деактивированным |
|
|
322
322
|
| readonly | `boolean` | - | Является ли поле доступным только для чтения |
|
|
323
323
|
| id | `string` | - | Значение html-атрибута id |
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CalendarProps } from '@snack-uikit/calendar';
|
|
3
2
|
import { InputPrivateProps } from '@snack-uikit/input-private';
|
|
4
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
@@ -24,22 +23,22 @@ type FieldDateOwnProps = {
|
|
|
24
23
|
} & Pick<CalendarProps, 'buildCellProps'>;
|
|
25
24
|
export type FieldDateProps = WithSupportProps<FieldDateOwnProps & InputProps & WrapperProps>;
|
|
26
25
|
export declare const FieldDate: import("react").ForwardRefExoticComponent<{
|
|
27
|
-
'data-test-id'?: string
|
|
26
|
+
'data-test-id'?: string;
|
|
28
27
|
} & import("react").AriaAttributes & {
|
|
29
28
|
/** Открыт date-picker */
|
|
30
|
-
open?: boolean
|
|
29
|
+
open?: boolean;
|
|
31
30
|
/** Колбек открытия пикера */
|
|
32
31
|
onOpenChange?(value: boolean): void;
|
|
33
32
|
/** Колбек смены значения */
|
|
34
33
|
onChange?(value: string): void;
|
|
35
34
|
/** Отображение кнопки копирования */
|
|
36
|
-
showCopyButton?: boolean
|
|
35
|
+
showCopyButton?: boolean;
|
|
37
36
|
/**
|
|
38
37
|
* Отображение кнопки Очистки поля
|
|
39
38
|
* @default true
|
|
40
39
|
*/
|
|
41
|
-
showClearButton?: boolean
|
|
40
|
+
showClearButton?: boolean;
|
|
42
41
|
/** Текущая локаль календаря */
|
|
43
|
-
locale?: Intl.Locale
|
|
42
|
+
locale?: Intl.Locale;
|
|
44
43
|
} & Pick<CalendarProps, "buildCellProps"> & InputProps & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
45
44
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FieldDecoratorProps } from './FieldDecorator';
|
|
3
2
|
export declare function extractFieldDecoratorProps<T extends Partial<FieldDecoratorProps>>({ error, required, readonly, label, labelTooltip, labelTooltipPlacement, labelFor, caption, hint, disabled, showHintIcon, size, validationState, className, }: T): {
|
|
4
3
|
error: string | undefined;
|
|
@@ -20,6 +20,6 @@ type FieldSecureOwnProps = {
|
|
|
20
20
|
};
|
|
21
21
|
export type FieldSecureProps = WithSupportProps<FieldSecureOwnProps & InputProps & WrapperProps>;
|
|
22
22
|
export declare const FieldSecure: import("react").ForwardRefExoticComponent<{
|
|
23
|
-
'data-test-id'?: string
|
|
23
|
+
'data-test-id'?: string;
|
|
24
24
|
} & import("react").AriaAttributes & FieldSecureOwnProps & Pick<Partial<InputPrivateProps>, "onChange" | "value"> & Pick<InputPrivateProps, "disabled" | "readonly" | "id" | "name" | "onFocus" | "onBlur" | "placeholder" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
25
25
|
export {};
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { SelectedOptionFormatter } from './types';
|
|
3
2
|
export declare const FieldSelectMultiple: import("react").ForwardRefExoticComponent<import("./types").InputProps & import("./types").WrapperProps & {
|
|
4
3
|
options: import("./types").OptionProps[];
|
|
5
|
-
loading?: boolean
|
|
4
|
+
loading?: boolean;
|
|
6
5
|
} & {
|
|
7
|
-
removeByBackspace?: boolean
|
|
6
|
+
removeByBackspace?: boolean;
|
|
8
7
|
} & Omit<import("@snack-uikit/list").SelectionMultipleState, "mode"> & Omit<{
|
|
9
|
-
'data-test-id'?: string
|
|
8
|
+
'data-test-id'?: string;
|
|
10
9
|
} & import("react").AriaAttributes & {
|
|
11
10
|
options: import("./types").OptionProps[];
|
|
12
|
-
pinTop?: import("./types").OptionProps[]
|
|
13
|
-
pinBottom?: import("./types").OptionProps[]
|
|
14
|
-
searchable?: boolean
|
|
15
|
-
showCopyButton?: boolean
|
|
16
|
-
showClearButton?: boolean
|
|
17
|
-
readonly?: boolean
|
|
18
|
-
prefixIcon?: import("react").ReactElement
|
|
19
|
-
footer?: import("
|
|
20
|
-
widthStrategy?: import("@snack-uikit/
|
|
21
|
-
search?: import("./types").SearchState
|
|
22
|
-
autocomplete?: boolean
|
|
23
|
-
addOptionByEnter?: boolean
|
|
24
|
-
open?: boolean
|
|
11
|
+
pinTop?: import("./types").OptionProps[];
|
|
12
|
+
pinBottom?: import("./types").OptionProps[];
|
|
13
|
+
searchable?: boolean;
|
|
14
|
+
showCopyButton?: boolean;
|
|
15
|
+
showClearButton?: boolean;
|
|
16
|
+
readonly?: boolean;
|
|
17
|
+
prefixIcon?: import("react").ReactElement;
|
|
18
|
+
footer?: import("@snack-uikit/list").DroplistProps["footer"];
|
|
19
|
+
widthStrategy?: import("@snack-uikit/list").DroplistProps["widthStrategy"];
|
|
20
|
+
search?: import("./types").SearchState;
|
|
21
|
+
autocomplete?: boolean;
|
|
22
|
+
addOptionByEnter?: boolean;
|
|
23
|
+
open?: boolean;
|
|
25
24
|
onOpenChange?(open: boolean): void;
|
|
26
|
-
selectedOptionFormatter?: SelectedOptionFormatter
|
|
25
|
+
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
27
26
|
} & Pick<import("@snack-uikit/list").DroplistProps, "dataError" | "dataFiltered" | "noDataState" | "noResultsState" | "errorDataState">, "showCopyButton"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { SelectedOptionFormatter } from './types';
|
|
3
2
|
export declare const FieldSelectSingle: import("react").ForwardRefExoticComponent<import("./types").InputProps & import("./types").WrapperProps & {
|
|
4
3
|
options: import("./types").OptionProps[];
|
|
5
|
-
loading?: boolean
|
|
4
|
+
loading?: boolean;
|
|
6
5
|
} & Omit<import("@snack-uikit/list").SelectionSingleState, "mode"> & {
|
|
7
|
-
'data-test-id'?: string
|
|
6
|
+
'data-test-id'?: string;
|
|
8
7
|
} & import("react").AriaAttributes & {
|
|
9
8
|
options: import("./types").OptionProps[];
|
|
10
|
-
pinTop?: import("./types").OptionProps[]
|
|
11
|
-
pinBottom?: import("./types").OptionProps[]
|
|
12
|
-
searchable?: boolean
|
|
13
|
-
showCopyButton?: boolean
|
|
14
|
-
showClearButton?: boolean
|
|
15
|
-
readonly?: boolean
|
|
16
|
-
prefixIcon?: import("react").ReactElement
|
|
17
|
-
footer?: import("
|
|
18
|
-
widthStrategy?: import("@snack-uikit/
|
|
19
|
-
search?: import("./types").SearchState
|
|
20
|
-
autocomplete?: boolean
|
|
21
|
-
addOptionByEnter?: boolean
|
|
22
|
-
open?: boolean
|
|
9
|
+
pinTop?: import("./types").OptionProps[];
|
|
10
|
+
pinBottom?: import("./types").OptionProps[];
|
|
11
|
+
searchable?: boolean;
|
|
12
|
+
showCopyButton?: boolean;
|
|
13
|
+
showClearButton?: boolean;
|
|
14
|
+
readonly?: boolean;
|
|
15
|
+
prefixIcon?: import("react").ReactElement;
|
|
16
|
+
footer?: import("@snack-uikit/list").DroplistProps["footer"];
|
|
17
|
+
widthStrategy?: import("@snack-uikit/list").DroplistProps["widthStrategy"];
|
|
18
|
+
search?: import("./types").SearchState;
|
|
19
|
+
autocomplete?: boolean;
|
|
20
|
+
addOptionByEnter?: boolean;
|
|
21
|
+
open?: boolean;
|
|
23
22
|
onOpenChange?(open: boolean): void;
|
|
24
|
-
selectedOptionFormatter?: SelectedOptionFormatter
|
|
23
|
+
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
25
24
|
} & Pick<import("@snack-uikit/list").DroplistProps, "dataError" | "dataFiltered" | "noDataState" | "noResultsState" | "errorDataState"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -25,9 +25,9 @@ export declare function useSearchInput({ value, onChange, defaultValue, selected
|
|
|
25
25
|
selectedOptionFormatter: SelectedOptionFormatter;
|
|
26
26
|
}): {
|
|
27
27
|
inputValue: string;
|
|
28
|
-
setInputValue: (value: any, ...args: any[]) =>
|
|
28
|
+
setInputValue: (value: any, ...args: any[]) => ReturnType<Handler> | void;
|
|
29
29
|
prevInputValue: import("react").MutableRefObject<string>;
|
|
30
|
-
onInputValueChange: (value: any, ...args: any[]) =>
|
|
30
|
+
onInputValueChange: (value: any, ...args: any[]) => ReturnType<Handler> | void;
|
|
31
31
|
updateInputValue: (selectedItem?: ItemWithId) => void;
|
|
32
32
|
};
|
|
33
33
|
export declare function useHandleDeleteItem(setValue: Handler): (item?: ItemWithId) => (e?: MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -24,7 +24,7 @@ export declare function updateMultipleItems({ options, value, selectedItems, }:
|
|
|
24
24
|
}): {
|
|
25
25
|
selectedItems: undefined;
|
|
26
26
|
items: (import("@snack-uikit/list/dist/components/Items").Item & {
|
|
27
|
-
appearance?: import("@snack-uikit/tag
|
|
27
|
+
appearance?: import("@snack-uikit/tag").TagProps["appearance"];
|
|
28
28
|
})[];
|
|
29
29
|
} | {
|
|
30
30
|
selectedItems: ItemWithId[];
|
|
@@ -16,6 +16,6 @@ type FieldSliderOwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type FieldSliderProps = WithSupportProps<FieldSliderOwnProps & SliderProps & WrapperProps>;
|
|
18
18
|
export declare const FieldSlider: import("react").ForwardRefExoticComponent<{
|
|
19
|
-
'data-test-id'?: string
|
|
19
|
+
'data-test-id'?: string;
|
|
20
20
|
} & import("react").AriaAttributes & FieldSliderOwnProps & Pick<InputPrivateProps, "disabled" | "readonly" | "id" | "name" | "onFocus" | "onBlur"> & Pick<SliderComponentProps, "onChange" | "value" | "range" | "tipFormatter"> & Required<Pick<SliderComponentProps, "max" | "min" | "step" | "marks">> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
21
21
|
export {};
|
|
@@ -14,7 +14,7 @@ import mergeRefs from 'merge-refs';
|
|
|
14
14
|
import { forwardRef, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
15
15
|
import { InputPrivate, SIZE } from '@snack-uikit/input-private';
|
|
16
16
|
import { Slider } from '@snack-uikit/slider';
|
|
17
|
-
import { extractSupportProps } from '@snack-uikit/utils';
|
|
17
|
+
import { extractSupportProps, useEventHandler } from '@snack-uikit/utils';
|
|
18
18
|
import { CONTAINER_VARIANT, VALIDATION_STATE } from '../../constants';
|
|
19
19
|
import { FieldContainerPrivate } from '../../helperComponents';
|
|
20
20
|
import { useValueControl } from '../../hooks';
|
|
@@ -113,7 +113,10 @@ export const FieldSlider = forwardRef((_a, ref) => {
|
|
|
113
113
|
const { mark } = getClosestMark(textFieldNumValue, allowedValues, mark => mark);
|
|
114
114
|
handleChange(mark);
|
|
115
115
|
};
|
|
116
|
-
const handleTextValueChange = () => {
|
|
116
|
+
const handleTextValueChange = useEventHandler(() => {
|
|
117
|
+
if (range) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
117
120
|
const parsedValue = parseInt(textFieldInputValue);
|
|
118
121
|
const actualMinByMark = parseInt(String(getMarkValue(min)));
|
|
119
122
|
const actualMin = Number.isNaN(actualMinByMark) ? min : actualMinByMark;
|
|
@@ -127,7 +130,7 @@ export const FieldSlider = forwardRef((_a, ref) => {
|
|
|
127
130
|
else {
|
|
128
131
|
handleNonEqualMarksSliderChange(textFieldNumValue);
|
|
129
132
|
}
|
|
130
|
-
};
|
|
133
|
+
});
|
|
131
134
|
const onTextFieldBlur = (e) => {
|
|
132
135
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
133
136
|
handleTextValueChange();
|
|
@@ -142,8 +145,6 @@ export const FieldSlider = forwardRef((_a, ref) => {
|
|
|
142
145
|
}, [value, textInputFormatter]);
|
|
143
146
|
useEffect(() => {
|
|
144
147
|
handleTextValueChange();
|
|
145
|
-
|
|
146
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
147
|
-
}, [marks, min, max]);
|
|
148
|
+
}, [marks, min, max, handleTextValueChange]);
|
|
148
149
|
return (_jsxs(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, disabled: disabled, required: required, caption: caption, hint: hint, showHintIcon: showHintIcon, readonly: readonly, size: size }, extractSupportProps(rest), { children: [_jsx(FieldContainerPrivate, { className: styles.fieldContainer, size: size, validationState: VALIDATION_STATE.Default, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: localRef, postfix: postfixIcon, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: textFieldInputValue, onChange: range ? undefined : onTextFieldChange, onFocus: onFocus, onBlur: range ? onBlur : onTextFieldBlur, onKeyDown: handleTextFieldKeyChange, disabled: disabled, readonly: range ? true : readonly, type: 'text', id: id, name: name, "data-test-id": 'field-slider__input' }) }), _jsx("div", { className: styles.sliderWrapper, children: _jsx("div", { className: styles.slider, "data-size": size, children: _jsx(Slider, { range: range, min: min, max: max, step: step, value: value, onChange: onChange, marks: showScaleBar ? marks : undefined, disabled: readonly || disabled, "data-test-id": 'field-slider__slider' }) }) })] })));
|
|
149
150
|
});
|
|
@@ -16,6 +16,6 @@ type FieldStepperOwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type FieldStepperProps = WithSupportProps<FieldStepperOwnProps & InputProps & WrapperProps>;
|
|
18
18
|
export declare const FieldStepper: import("react").ForwardRefExoticComponent<{
|
|
19
|
-
'data-test-id'?: string
|
|
19
|
+
'data-test-id'?: string;
|
|
20
20
|
} & import("react").AriaAttributes & FieldStepperOwnProps & InputProps & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
21
21
|
export {};
|
|
@@ -19,6 +19,6 @@ type FieldTextOwnProps = {
|
|
|
19
19
|
};
|
|
20
20
|
export type FieldTextProps = WithSupportProps<FieldTextOwnProps & InputProps & WrapperProps>;
|
|
21
21
|
export declare const FieldText: import("react").ForwardRefExoticComponent<{
|
|
22
|
-
'data-test-id'?: string
|
|
22
|
+
'data-test-id'?: string;
|
|
23
23
|
} & import("react").AriaAttributes & FieldTextOwnProps & Pick<Partial<InputPrivateProps>, "onChange" | "value"> & Pick<InputPrivateProps, "disabled" | "readonly" | "id" | "name" | "onFocus" | "onBlur" | "placeholder" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
24
24
|
export {};
|
|
@@ -25,6 +25,6 @@ type FieldTextAreaOwnProps = {
|
|
|
25
25
|
};
|
|
26
26
|
export type FieldTextAreaProps = WithSupportProps<FieldTextAreaOwnProps & InputProps & WrapperProps>;
|
|
27
27
|
export declare const FieldTextArea: import("react").ForwardRefExoticComponent<{
|
|
28
|
-
'data-test-id'?: string
|
|
28
|
+
'data-test-id'?: string;
|
|
29
29
|
} & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "disabled" | "readonly" | "id" | "name" | "onFocus" | "onBlur" | "placeholder" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
30
30
|
export {};
|
|
@@ -3,5 +3,5 @@ type UseValueControl<TValue> = {
|
|
|
3
3
|
onChange?(value: TValue): void;
|
|
4
4
|
defaultValue?: TValue;
|
|
5
5
|
};
|
|
6
|
-
export declare function useValueControl<TValue>({ value, onChange, defaultValue }: UseValueControl<TValue>): readonly [TValue | undefined, (value: any, ...args: any[]) =>
|
|
6
|
+
export declare function useValueControl<TValue>({ value, onChange, defaultValue }: UseValueControl<TValue>): readonly [TValue | undefined, (value: any, ...args: any[]) => ReturnType<import("uncontrollable").Handler> | void];
|
|
7
7
|
export {};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Fields",
|
|
7
|
-
"version": "0.23.
|
|
7
|
+
"version": "0.23.5-preview-b0cb52bd.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@snack-uikit/dropdown": "0.2.4",
|
|
38
38
|
"@snack-uikit/icons": "0.22.0",
|
|
39
39
|
"@snack-uikit/input-private": "3.1.4",
|
|
40
|
-
"@snack-uikit/list": "0.14.
|
|
40
|
+
"@snack-uikit/list": "0.14.2",
|
|
41
41
|
"@snack-uikit/scroll": "0.6.0",
|
|
42
42
|
"@snack-uikit/skeleton": "0.3.4",
|
|
43
43
|
"@snack-uikit/slider": "0.1.15",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@snack-uikit/locale": "*"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "0c025d82c687785f267d371b4c50b36037bcc0cc"
|
|
63
63
|
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
import { InputPrivate, InputPrivateProps, SIZE } from '@snack-uikit/input-private';
|
|
15
15
|
import { Slider, SliderProps as SliderComponentProps } from '@snack-uikit/slider';
|
|
16
|
-
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
16
|
+
import { extractSupportProps, useEventHandler, WithSupportProps } from '@snack-uikit/utils';
|
|
17
17
|
|
|
18
18
|
import { CONTAINER_VARIANT, VALIDATION_STATE } from '../../constants';
|
|
19
19
|
import { FieldContainerPrivate } from '../../helperComponents';
|
|
@@ -212,7 +212,11 @@ export const FieldSlider = forwardRef<HTMLInputElement, FieldSliderProps>(
|
|
|
212
212
|
handleChange(mark);
|
|
213
213
|
};
|
|
214
214
|
|
|
215
|
-
const handleTextValueChange = () => {
|
|
215
|
+
const handleTextValueChange = useEventHandler(() => {
|
|
216
|
+
if (range) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
216
220
|
const parsedValue = parseInt(textFieldInputValue);
|
|
217
221
|
const actualMinByMark = parseInt(String(getMarkValue(min)));
|
|
218
222
|
const actualMin = Number.isNaN(actualMinByMark) ? min : actualMinByMark;
|
|
@@ -228,7 +232,7 @@ export const FieldSlider = forwardRef<HTMLInputElement, FieldSliderProps>(
|
|
|
228
232
|
} else {
|
|
229
233
|
handleNonEqualMarksSliderChange(textFieldNumValue);
|
|
230
234
|
}
|
|
231
|
-
};
|
|
235
|
+
});
|
|
232
236
|
|
|
233
237
|
const onTextFieldBlur = (e: FocusEvent<HTMLInputElement, Element>) => {
|
|
234
238
|
onBlur?.(e);
|
|
@@ -247,9 +251,7 @@ export const FieldSlider = forwardRef<HTMLInputElement, FieldSliderProps>(
|
|
|
247
251
|
|
|
248
252
|
useEffect(() => {
|
|
249
253
|
handleTextValueChange();
|
|
250
|
-
|
|
251
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
252
|
-
}, [marks, min, max]);
|
|
254
|
+
}, [marks, min, max, handleTextValueChange]);
|
|
253
255
|
|
|
254
256
|
return (
|
|
255
257
|
<FieldDecorator
|