@snack-uikit/fields 0.13.3 → 0.13.4

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,17 @@
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.13.4 (2024-02-12)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **FF-4205:** update locale usage ([bd4095b](https://github.com/cloud-ru-tech/snack-uikit/commit/bd4095bc875c2efc95a0549a366d5b40dd424741))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.13.3 (2024-02-09)
7
18
 
8
19
  ### Only dependencies have been changed
@@ -26,7 +26,7 @@ import styles from './styles.module.css';
26
26
  const TOOLTIP_TIMEOUT = 2000;
27
27
  export const FieldStepper = forwardRef((_a, ref) => {
28
28
  var { id, name, value: valueProp, min, max, step = 1, disabled = false, readonly = false, allowMoreThanLimits = true, onChange: onChangeProp, onFocus, onBlur, className, label, labelTooltip, labelTooltipPlacement, required = false, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default } = _a, rest = __rest(_a, ["id", "name", "value", "min", "max", "step", "disabled", "readonly", "allowMoreThanLimits", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "hint", "showHintIcon", "size", "validationState"]);
29
- const [locales] = useLocale('Fields');
29
+ const { t } = useLocale('Fields');
30
30
  const [value, setValue] = useUncontrolledProp(valueProp, 0, onChangeProp);
31
31
  const [tooltipOpen, setTooltipOpen] = useState(false);
32
32
  const [tooltip, setTooltip] = useState('');
@@ -50,11 +50,11 @@ export const FieldStepper = forwardRef((_a, ref) => {
50
50
  const handleInputBlur = (event) => {
51
51
  if (!allowMoreThanLimits) {
52
52
  if (max !== undefined && value > max) {
53
- setTooltip(`${locales.limitTooltip.max}${max}`);
53
+ setTooltip(`${t('limitTooltip.max')}${max}`);
54
54
  adjustValue(max);
55
55
  }
56
56
  if (min !== undefined && value < min) {
57
- setTooltip(`${locales.limitTooltip.min}${min}`);
57
+ setTooltip(`${t('limitTooltip.min')}${min}`);
58
58
  adjustValue(min);
59
59
  }
60
60
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Fields",
7
- "version": "0.13.3",
7
+ "version": "0.13.4",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -33,11 +33,10 @@
33
33
  "scripts": {},
34
34
  "dependencies": {
35
35
  "@snack-uikit/button": "0.16.0",
36
- "@snack-uikit/calendar": "0.7.4",
36
+ "@snack-uikit/calendar": "0.7.5",
37
37
  "@snack-uikit/droplist": "0.13.4",
38
38
  "@snack-uikit/icons": "0.20.1",
39
39
  "@snack-uikit/input-private": "3.1.0",
40
- "@snack-uikit/locale": "0.3.0",
41
40
  "@snack-uikit/scroll": "0.5.1",
42
41
  "@snack-uikit/tooltip": "0.11.1",
43
42
  "@snack-uikit/truncate-string": "0.4.7",
@@ -51,5 +50,8 @@
51
50
  "devDependencies": {
52
51
  "@types/merge-refs": "1.0.0"
53
52
  },
54
- "gitHead": "3a1dd5498600db7f34a4681a70254b81337ddeb4"
53
+ "peerDependencies": {
54
+ "@snack-uikit/locale": "*"
55
+ },
56
+ "gitHead": "5e7b0b6d34f40c4266070bf918e9cdf127ac882c"
55
57
  }
@@ -84,7 +84,7 @@ export const FieldStepper = forwardRef<HTMLInputElement, FieldStepperProps>(
84
84
  },
85
85
  ref,
86
86
  ) => {
87
- const [locales] = useLocale('Fields');
87
+ const { t } = useLocale('Fields');
88
88
  const [value, setValue] = useUncontrolledProp(valueProp, 0, onChangeProp);
89
89
  const [tooltipOpen, setTooltipOpen] = useState(false);
90
90
  const [tooltip, setTooltip] = useState('');
@@ -115,12 +115,12 @@ export const FieldStepper = forwardRef<HTMLInputElement, FieldStepperProps>(
115
115
  const handleInputBlur = (event: FocusEvent<HTMLInputElement>) => {
116
116
  if (!allowMoreThanLimits) {
117
117
  if (max !== undefined && value > max) {
118
- setTooltip(`${locales.limitTooltip.max}${max}`);
118
+ setTooltip(`${t('limitTooltip.max')}${max}`);
119
119
  adjustValue(max);
120
120
  }
121
121
 
122
122
  if (min !== undefined && value < min) {
123
- setTooltip(`${locales.limitTooltip.min}${min}`);
123
+ setTooltip(`${t('limitTooltip.min')}${min}`);
124
124
  adjustValue(min);
125
125
  }
126
126
  }