@symply.io/basic-components 1.5.5-alpha.4 → 1.5.5-alpha.6

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.
@@ -1,16 +1,16 @@
1
- import { ChangeEvent, FocusEventHandler, KeyboardEventHandler } from "react";
1
+ /// <reference types="react" />
2
2
  import type { InteractionProps } from "./types";
3
3
  declare function useInteractions(props: InteractionProps): {
4
4
  typing: boolean;
5
5
  exceedError: boolean;
6
6
  tooltipOpen: boolean;
7
7
  roundedValue: string;
8
- handleBlur: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
9
- handleFocus: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
8
+ handleBlur: import("react").FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
9
+ handleFocus: import("react").FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
10
10
  handleClick: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement>;
11
- handleChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
11
+ handleChange: (event: import("react").ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
12
12
  onOpenTooltip: () => void;
13
13
  onCloseTooltip: () => void;
14
- handleKeyboardEvent: KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
14
+ handleKeyboardEvent: import("react").KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
15
15
  };
16
16
  export default useInteractions;
@@ -26,7 +26,7 @@ function useInteractions(props) {
26
26
  }, [value, decimals]);
27
27
  var exceedError = useMemo(function () { return !!value && (Number(value) < minValue || Number(value) > maxValue); }, [value, minValue, maxValue]);
28
28
  var handleKeyboardEvent = useCallback(function (event) {
29
- var key = event.key, target = event.target;
29
+ var key = event.key;
30
30
  if (key === "e") {
31
31
  event.preventDefault();
32
32
  }
@@ -48,8 +48,7 @@ function useInteractions(props) {
48
48
  console.log({
49
49
  cursorIndex: cursorIndex,
50
50
  decimalPointIndex: decimalPointIndex,
51
- decimalStrLen: decimalStrLen,
52
- v: target.value
51
+ decimalStrLen: decimalStrLen
53
52
  });
54
53
  if (cursorIndex && decimalPointIndex <= cursorIndex) {
55
54
  if (![
@@ -84,8 +83,8 @@ function useInteractions(props) {
84
83
  cts: event.currentTarget.selectionStart,
85
84
  cte: event.currentTarget.selectionEnd
86
85
  });
87
- setCursorIndex(event.currentTarget.selectionStart || 0);
88
- }, []);
86
+ event.currentTarget.setSelectionRange(value.length - 1, value.length - 1);
87
+ }, [value]);
89
88
  var handleFocus = useCallback(function () {
90
89
  setTyping(true);
91
90
  }, []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.5.5-alpha.4",
3
+ "version": "1.5.5-alpha.6",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",