@snack-uikit/fields 0.23.5-preview-8898cdde.0 → 0.23.5
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 +12 -0
- package/dist/components/FieldDecorator/styles.module.css +12 -12
- package/dist/components/FieldSlider/FieldSlider.js +7 -6
- package/dist/helperComponents/ButtonCopyValue/styles.module.css +1 -1
- package/dist/helperComponents/ButtonHideValue/styles.module.css +1 -1
- package/dist/helperComponents/FieldContainerPrivate/styles.module.css +6 -6
- package/dist/helperComponents/TextArea/styles.module.css +1 -1
- package/package.json +5 -5
- package/src/components/FieldSlider/FieldSlider.tsx +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.5 (2024-08-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **FF-3788:** updated typescript to v5 ([89e3338](https://github.com/cloud-ru-tech/snack-uikit/commit/89e3338a3ef4df24e4c20d9a9c8cd16e7934ba63))
|
|
12
|
+
* **PDS-617:** slider range should not change the label on input events ([d7ab88a](https://github.com/cloud-ru-tech/snack-uikit/commit/d7ab88a69e3cc47568766899e91c438493ed8c7e))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
## 0.23.4 (2024-07-29)
|
|
7
19
|
|
|
8
20
|
### Only dependencies have been changed
|
|
@@ -160,13 +160,13 @@
|
|
|
160
160
|
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
161
161
|
}
|
|
162
162
|
.hint[data-validation=error]{
|
|
163
|
-
color:var(--sys-red-text-main, #
|
|
163
|
+
color:var(--sys-red-text-main, #621c1b);
|
|
164
164
|
}
|
|
165
165
|
.hint[data-validation=warning]{
|
|
166
|
-
color:var(--sys-yellow-text-main, #
|
|
166
|
+
color:var(--sys-yellow-text-main, #5e3d06);
|
|
167
167
|
}
|
|
168
168
|
.hint[data-validation=success]{
|
|
169
|
-
color:var(--sys-green-text-main, #
|
|
169
|
+
color:var(--sys-green-text-main, #323f27);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
.icon{
|
|
@@ -183,10 +183,10 @@
|
|
|
183
183
|
color:var(--sys-neutral-accent-default, #787b8a);
|
|
184
184
|
}
|
|
185
185
|
.hintIcon[data-validation=error]{
|
|
186
|
-
color:var(--sys-red-accent-default, #
|
|
186
|
+
color:var(--sys-red-accent-default, #cd3c3c);
|
|
187
187
|
}
|
|
188
188
|
.hintIcon[data-validation=warning]{
|
|
189
|
-
color:var(--sys-yellow-accent-default, #
|
|
189
|
+
color:var(--sys-yellow-accent-default, #ffc443);
|
|
190
190
|
}
|
|
191
191
|
.hintIcon[data-validation=success]{
|
|
192
192
|
color:var(--sys-green-accent-default, #57b762);
|
|
@@ -196,26 +196,26 @@
|
|
|
196
196
|
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
197
197
|
}
|
|
198
198
|
.counterLimit > span[data-limit-exceeded], .counterLimit > span[data-validation=error]{
|
|
199
|
-
color:var(--sys-red-text-light, #
|
|
199
|
+
color:var(--sys-red-text-light, #ea6658);
|
|
200
200
|
}
|
|
201
201
|
.counterLimit > span[data-validation=warning]{
|
|
202
|
-
color:var(--sys-yellow-text-light, #
|
|
202
|
+
color:var(--sys-yellow-text-light, #ddb035);
|
|
203
203
|
}
|
|
204
204
|
.counterLimit > span[data-validation=success]{
|
|
205
|
-
color:var(--sys-green-text-light, #
|
|
205
|
+
color:var(--sys-green-text-light, #67ba6e);
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
.counterCurrentValue[data-limit-exceeded][data-validation=default]{
|
|
209
|
-
color:var(--sys-neutral-text-main, #
|
|
209
|
+
color:var(--sys-neutral-text-main, #33343f);
|
|
210
210
|
}
|
|
211
211
|
.counterCurrentValue[data-limit-exceeded][data-validation=error]{
|
|
212
|
-
color:var(--sys-red-text-main, #
|
|
212
|
+
color:var(--sys-red-text-main, #621c1b);
|
|
213
213
|
}
|
|
214
214
|
.counterCurrentValue[data-limit-exceeded][data-validation=warning]{
|
|
215
|
-
color:var(--sys-yellow-text-main, #
|
|
215
|
+
color:var(--sys-yellow-text-main, #5e3d06);
|
|
216
216
|
}
|
|
217
217
|
.counterCurrentValue[data-limit-exceeded][data-validation=success]{
|
|
218
|
-
color:var(--sys-green-text-light, #
|
|
218
|
+
color:var(--sys-green-text-light, #67ba6e);
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
.labelTooltipTrigger{
|
|
@@ -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
|
});
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
outline-color:var(--sys-primary-decor-activated, #c5b2f1);
|
|
24
24
|
}
|
|
25
25
|
.container[data-validation=error]{
|
|
26
|
-
background-color:var(--sys-red-background1-level, #
|
|
26
|
+
background-color:var(--sys-red-background1-level, #fcf6f5);
|
|
27
27
|
border-color:var(--sys-red-decor-default, #fdd6cd);
|
|
28
28
|
}
|
|
29
29
|
.container[data-validation=error]:hover{
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
outline-style:var(--border-state-focus-m-border-style, solid);
|
|
36
36
|
outline-color:var(--border-state-focus-m-border-color, );
|
|
37
37
|
background-color:var(--sys-neutral-background2-level, #ffffff);
|
|
38
|
-
border-color:var(--sys-red-accent-default, #
|
|
38
|
+
border-color:var(--sys-red-accent-default, #cd3c3c);
|
|
39
39
|
outline-color:var(--sys-red-decor-activated, #fbab99);
|
|
40
40
|
}
|
|
41
41
|
.container[data-validation=warning]{
|
|
42
|
-
background-color:var(--sys-yellow-background1-level, #
|
|
42
|
+
background-color:var(--sys-yellow-background1-level, #fefae6);
|
|
43
43
|
border-color:var(--sys-yellow-decor-default, #f0dfb1);
|
|
44
44
|
}
|
|
45
45
|
.container[data-validation=warning]:hover{
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
outline-style:var(--border-state-focus-m-border-style, solid);
|
|
52
52
|
outline-color:var(--border-state-focus-m-border-color, );
|
|
53
53
|
background-color:var(--sys-neutral-background2-level, #ffffff);
|
|
54
|
-
border-color:var(--sys-yellow-accent-default, #
|
|
55
|
-
outline-color:var(--sys-yellow-decor-activated, #
|
|
54
|
+
border-color:var(--sys-yellow-accent-default, #ffc443);
|
|
55
|
+
outline-color:var(--sys-yellow-decor-activated, #e5c878);
|
|
56
56
|
}
|
|
57
57
|
.container[data-validation=success]{
|
|
58
|
-
background-color:var(--sys-green-background1-level, #
|
|
58
|
+
background-color:var(--sys-green-background1-level, #f6faf3);
|
|
59
59
|
border-color:var(--sys-green-decor-default, #d2ead0);
|
|
60
60
|
}
|
|
61
61
|
.container[data-validation=success]:hover{
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Fields",
|
|
7
|
-
"version": "0.23.5
|
|
7
|
+
"version": "0.23.5",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"scripts": {},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@snack-uikit/button": "0.17.
|
|
35
|
+
"@snack-uikit/button": "0.17.2",
|
|
36
36
|
"@snack-uikit/calendar": "0.7.10",
|
|
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",
|
|
44
44
|
"@snack-uikit/tag": "0.9.7",
|
|
45
45
|
"@snack-uikit/tooltip": "0.13.7",
|
|
46
|
-
"@snack-uikit/truncate-string": "0.4.
|
|
46
|
+
"@snack-uikit/truncate-string": "0.4.20",
|
|
47
47
|
"@snack-uikit/utils": "3.3.0",
|
|
48
48
|
"classnames": "2.3.2",
|
|
49
49
|
"copy-to-clipboard": "3.3.3",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@snack-uikit/locale": "*"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "620a9816c0cd7402f8f514df2cccc297599ecd44"
|
|
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
|