next-helios-fe 1.8.55 → 1.8.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-helios-fe",
3
- "version": "1.8.55",
3
+ "version": "1.8.57",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React from "react";
2
+ import React, { useRef } from "react";
3
3
  import { Tooltip } from "../../../components";
4
4
  import { Icon } from "@iconify/react";
5
5
 
@@ -20,6 +20,7 @@ export const Email: React.FC<EmailProps> = ({
20
20
  description,
21
21
  ...rest
22
22
  }) => {
23
+ const inputRef = useRef<HTMLInputElement>(null);
23
24
  const width = options?.width === "fit" ? "w-fit" : "w-full";
24
25
  const height =
25
26
  options?.height === "short"
@@ -47,7 +48,10 @@ export const Email: React.FC<EmailProps> = ({
47
48
  <div className="flex-1 flex justify-end items-center gap-2">
48
49
  {rest.maxLength && (
49
50
  <span className="text-sm select-none">
50
- {((rest.value as String) || "").length || 0}/{rest.maxLength}
51
+ {inputRef.current?.value
52
+ ? (inputRef.current?.value as string).length
53
+ : 0}
54
+ /{rest.maxLength}
51
55
  </span>
52
56
  )}
53
57
  {description && (
@@ -64,6 +68,7 @@ export const Email: React.FC<EmailProps> = ({
64
68
  )}
65
69
  <input
66
70
  type="email"
71
+ ref={inputRef}
67
72
  className={`w-full px-4 border-default border rounded-md bg-secondary-bg placeholder:duration-300 placeholder:translate-x-0 focus:placeholder:translate-x-1 placeholder:text-silent focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:text-disabled ${height}`}
68
73
  {...rest}
69
74
  />
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React, { useState } from "react";
2
+ import React, { useState, useRef } from "react";
3
3
  import { Tooltip } from "../../../components";
4
4
  import { Icon } from "@iconify/react";
5
5
 
@@ -20,6 +20,7 @@ export const Password: React.FC<PasswordProps> = ({
20
20
  description,
21
21
  ...rest
22
22
  }) => {
23
+ const inputRef = useRef<HTMLInputElement>(null);
23
24
  const [show, setShow] = useState(false);
24
25
  const width = options?.width === "fit" ? "w-fit" : "w-full";
25
26
  const height =
@@ -48,7 +49,10 @@ export const Password: React.FC<PasswordProps> = ({
48
49
  <div className="flex-1 flex justify-end items-center gap-2">
49
50
  {rest.maxLength && (
50
51
  <span className="text-sm select-none">
51
- {((rest.value as String) || "").length || 0}/{rest.maxLength}
52
+ {inputRef.current?.value
53
+ ? (inputRef.current?.value as string).length
54
+ : 0}
55
+ /{rest.maxLength}
52
56
  </span>
53
57
  )}
54
58
  {description && (
@@ -66,6 +70,7 @@ export const Password: React.FC<PasswordProps> = ({
66
70
  <div className="relative flex items-center">
67
71
  <input
68
72
  type={show ? "text" : "password"}
73
+ ref={inputRef}
69
74
  className={`w-full ps-4 pe-14 border-default border rounded-md bg-secondary-bg placeholder:duration-300 placeholder:translate-x-0 focus:placeholder:translate-x-1 placeholder:text-silent focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:text-disabled ${height}`}
70
75
  {...rest}
71
76
  />
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React from "react";
2
+ import React, { useRef } from "react";
3
3
  import { Tooltip } from "../../../components";
4
4
  import { Icon } from "@iconify/react";
5
5
 
@@ -19,6 +19,7 @@ export const Text: React.FC<TextProps> = ({
19
19
  description,
20
20
  ...rest
21
21
  }) => {
22
+ const inputRef = useRef<HTMLInputElement>(null);
22
23
  const width = options?.width === "fit" ? "w-fit" : "w-full";
23
24
  const height =
24
25
  options?.height === "short"
@@ -46,7 +47,10 @@ export const Text: React.FC<TextProps> = ({
46
47
  <div className="flex-1 flex justify-end items-center gap-2">
47
48
  {rest.maxLength && (
48
49
  <span className="text-sm select-none">
49
- {((rest.value as String) || "").length || 0}/{rest.maxLength}
50
+ {inputRef.current?.value
51
+ ? (inputRef.current?.value as string).length
52
+ : 0}
53
+ /{rest.maxLength}
50
54
  </span>
51
55
  )}
52
56
  {description && (
@@ -63,6 +67,7 @@ export const Text: React.FC<TextProps> = ({
63
67
  )}
64
68
  <input
65
69
  type="text"
70
+ ref={inputRef}
66
71
  className={`w-full px-4 border-default border rounded-md bg-secondary-bg placeholder:duration-300 placeholder:translate-x-0 focus:placeholder:translate-x-1 placeholder:text-silent focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:text-disabled ${height}`}
67
72
  {...rest}
68
73
  />
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React from "react";
2
+ import React, { useRef } from "react";
3
3
  import { Tooltip } from "../../../components";
4
4
  import { Icon } from "@iconify/react";
5
5
 
@@ -20,6 +20,7 @@ export const Textarea: React.FC<TextareaProps> = ({
20
20
  description,
21
21
  ...rest
22
22
  }) => {
23
+ const inputRef = useRef<HTMLTextAreaElement>(null);
23
24
  const width = options?.width === "fit" ? "w-fit" : "w-full";
24
25
  const height =
25
26
  options?.height === "short"
@@ -47,7 +48,10 @@ export const Textarea: React.FC<TextareaProps> = ({
47
48
  <div className="flex-1 flex justify-end items-center gap-2">
48
49
  {rest.maxLength && (
49
50
  <span className="text-sm select-none">
50
- {((rest.value as String) || "").length || 0}/{rest.maxLength}
51
+ {inputRef.current?.value
52
+ ? (inputRef.current?.value as string).length
53
+ : 0}
54
+ /{rest.maxLength}
51
55
  </span>
52
56
  )}
53
57
  {description && (
@@ -64,6 +68,7 @@ export const Textarea: React.FC<TextareaProps> = ({
64
68
  )}
65
69
  <textarea
66
70
  rows={rest.rows || 10}
71
+ ref={inputRef}
67
72
  className={`w-full px-4 border-default border rounded-md bg-secondary-bg placeholder:duration-300 placeholder:translate-x-0 focus:placeholder:translate-x-1 placeholder:text-silent focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:text-disabled ${height}`}
68
73
  {...rest}
69
74
  />