@snack-uikit/fields 0.17.7 → 0.17.9

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,28 @@
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.17.9 (2024-03-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **FF-0000:** tag deletion cross click handling ([eed7b9b](https://github.com/cloud-ru-tech/snack-uikit/commit/eed7b9b9afab3b77a60ecca3d742d02cdc8c81f3))
12
+
13
+
14
+
15
+
16
+
17
+ ## 0.17.8 (2024-03-12)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **FF-4497:** minus button is no longer clickable if value grater than min ([8446173](https://github.com/cloud-ru-tech/snack-uikit/commit/8446173bed6224d307821807e86b737bbb0b409a))
23
+
24
+
25
+
26
+
27
+
6
28
  ## 0.17.7 (2024-03-11)
7
29
 
8
30
  ### Only dependencies have been changed
@@ -1,4 +1,4 @@
1
- import { KeyboardEvent, KeyboardEventHandler, RefObject } from 'react';
1
+ import { KeyboardEvent, KeyboardEventHandler, MouseEvent, RefObject } from 'react';
2
2
  import { Handler } from 'uncontrollable';
3
3
  import { ItemWithId, SearchState } from './types';
4
4
  type UseHandleOnKeyDownProps = {
@@ -26,5 +26,5 @@ export declare function useSearchInput({ value, onChange, defaultValue }: Search
26
26
  onInputValueChange: Handler;
27
27
  prevInputValue: import("react").MutableRefObject<string>;
28
28
  };
29
- export declare function useHandleDeleteItem(setValue: Handler): (item?: ItemWithId) => () => void;
29
+ export declare function useHandleDeleteItem(setValue: Handler): (item?: ItemWithId) => (e?: MouseEvent<HTMLButtonElement>) => void;
30
30
  export {};
@@ -55,8 +55,9 @@ export function useSearchInput({ value, onChange, defaultValue }) {
55
55
  return { inputValue, onInputValueChange, prevInputValue };
56
56
  }
57
57
  export function useHandleDeleteItem(setValue) {
58
- return useCallback((item) => () => {
58
+ return useCallback((item) => (e) => {
59
59
  var _a;
60
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
60
61
  if (!item) {
61
62
  return;
62
63
  }
@@ -38,8 +38,8 @@ export const FieldStepper = forwardRef((_a, ref) => {
38
38
  const inputRef = useRef(null);
39
39
  const minusButtonRef = useRef(null);
40
40
  const plusButtonRef = useRef(null);
41
- const isMinusButtonDisabled = value === min || readonly || disabled;
42
- const isPlusButtonDisabled = value === max || readonly || disabled;
41
+ const isMinusButtonDisabled = (typeof min === 'number' && value <= min) || readonly || disabled;
42
+ const isPlusButtonDisabled = (typeof max === 'number' && value >= max) || readonly || disabled;
43
43
  const adjustValue = (value) => {
44
44
  setValue(value);
45
45
  setTooltipOpen(true);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Fields",
7
- "version": "0.17.7",
7
+ "version": "0.17.9",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -56,5 +56,5 @@
56
56
  "peerDependencies": {
57
57
  "@snack-uikit/locale": "*"
58
58
  },
59
- "gitHead": "113e80e60c1a5ce1ce6957d48d37a6181991c5fd"
59
+ "gitHead": "396d85d77756f5a0f877aee7d35b7f2c160a1e86"
60
60
  }
@@ -1,4 +1,4 @@
1
- import { KeyboardEvent, KeyboardEventHandler, RefObject, useCallback, useMemo, useRef } from 'react';
1
+ import { KeyboardEvent, KeyboardEventHandler, MouseEvent, RefObject, useCallback, useMemo, useRef } from 'react';
2
2
  import { Handler } from 'uncontrollable';
3
3
 
4
4
  import { useButtonNavigation, useClearButton } from '@snack-uikit/input-private';
@@ -108,7 +108,9 @@ export function useSearchInput({ value, onChange, defaultValue }: SearchState) {
108
108
 
109
109
  export function useHandleDeleteItem(setValue: Handler) {
110
110
  return useCallback(
111
- (item?: ItemWithId) => () => {
111
+ (item?: ItemWithId) => (e?: MouseEvent<HTMLButtonElement>) => {
112
+ e?.stopPropagation();
113
+
112
114
  if (!item) {
113
115
  return;
114
116
  }
@@ -98,8 +98,8 @@ export const FieldStepper = forwardRef<HTMLInputElement, FieldStepperProps>(
98
98
  const inputRef = useRef<HTMLInputElement>(null);
99
99
  const minusButtonRef = useRef<HTMLButtonElement>(null);
100
100
  const plusButtonRef = useRef<HTMLButtonElement>(null);
101
- const isMinusButtonDisabled = value === min || readonly || disabled;
102
- const isPlusButtonDisabled = value === max || readonly || disabled;
101
+ const isMinusButtonDisabled = (typeof min === 'number' && value <= min) || readonly || disabled;
102
+ const isPlusButtonDisabled = (typeof max === 'number' && value >= max) || readonly || disabled;
103
103
 
104
104
  const adjustValue = (value: number) => {
105
105
  setValue(value);