@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 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, #7a2d2d);
163
+ color:var(--sys-red-text-main, #621c1b);
164
164
  }
165
165
  .hint[data-validation=warning]{
166
- color:var(--sys-yellow-text-main, #815f19);
166
+ color:var(--sys-yellow-text-main, #5e3d06);
167
167
  }
168
168
  .hint[data-validation=success]{
169
- color:var(--sys-green-text-main, #3d6035);
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, #cb3f3e);
186
+ color:var(--sys-red-accent-default, #cd3c3c);
187
187
  }
188
188
  .hintIcon[data-validation=warning]{
189
- color:var(--sys-yellow-accent-default, #e2b134);
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, #e7756a);
199
+ color:var(--sys-red-text-light, #ea6658);
200
200
  }
201
201
  .counterLimit > span[data-validation=warning]{
202
- color:var(--sys-yellow-text-light, #d3a736);
202
+ color:var(--sys-yellow-text-light, #ddb035);
203
203
  }
204
204
  .counterLimit > span[data-validation=success]{
205
- color:var(--sys-green-text-light, #69b56f);
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, #41424e);
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, #7a2d2d);
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, #815f19);
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, #69b56f);
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
- // update value only when marks, min or max are changed
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
  });
@@ -39,7 +39,7 @@
39
39
  outline-offset:var(--spacing-state-focus-offset, 2px);
40
40
  }
41
41
  .buttonCopyValue:active{
42
- color:var(--sys-neutral-text-main, #41424e);
42
+ color:var(--sys-neutral-text-main, #33343f);
43
43
  }
44
44
  .buttonCopyValue[data-disabled]{
45
45
  cursor:not-allowed;
@@ -39,7 +39,7 @@
39
39
  outline-offset:var(--spacing-state-focus-offset, 2px);
40
40
  }
41
41
  .buttonHideValue:active{
42
- color:var(--sys-neutral-text-main, #41424e);
42
+ color:var(--sys-neutral-text-main, #33343f);
43
43
  }
44
44
  .buttonHideValue[data-disabled]{
45
45
  cursor:not-allowed;
@@ -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, #fef6f3);
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, #cb3f3e);
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, #fcfbef);
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, #e2b134);
55
- outline-color:var(--sys-yellow-decor-activated, #e6c878);
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, #f6fdf3);
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{
@@ -5,7 +5,7 @@
5
5
  max-width:100%;
6
6
  margin:0;
7
7
  padding:0;
8
- color:var(--sys-neutral-text-main, #41424e);
8
+ color:var(--sys-neutral-text-main, #33343f);
9
9
  background-color:transparent;
10
10
  border:none;
11
11
  border-radius:0;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Fields",
7
- "version": "0.23.5-preview-8898cdde.0",
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.3-preview-8898cdde.0",
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.3-preview-8898cdde.0",
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.21-preview-8898cdde.0",
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": "a0351f376ac28462b847d1bf99ad3f7ba7a1d0cd"
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
- // update value only when marks, min or max are changed
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