next-helios-fe 1.3.3 → 1.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-helios-fe",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
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, { useState, useEffect } from "react";
2
+ import React, { useState, useEffect, useRef } from "react";
3
3
  import { Icon } from "@iconify/react";
4
4
 
5
5
  export interface FileProps extends React.InputHTMLAttributes<HTMLInputElement> {
@@ -22,6 +22,7 @@ export const File: React.FC<FileProps> = ({
22
22
  value,
23
23
  ...rest
24
24
  }) => {
25
+ const inputRef = useRef<HTMLInputElement>(null);
25
26
  const [tempFile, setTempFile] = useState<any>([]);
26
27
  const width = options?.width === "fit" ? "w-fit" : "w-full";
27
28
  const height =
@@ -78,6 +79,7 @@ export const File: React.FC<FileProps> = ({
78
79
  }`}
79
80
  >
80
81
  <input
82
+ ref={inputRef}
81
83
  type="file"
82
84
  className={`peer/file w-full px-4 border-default border rounded-md bg-secondary-bg text-transparent file:hidden focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:text-slate-400 ${height}`}
83
85
  onChange={(e) => {
@@ -184,6 +186,9 @@ export const File: React.FC<FileProps> = ({
184
186
  type="button"
185
187
  className="p-2 rounded-full hover:bg-secondary-light"
186
188
  disabled={rest.disabled}
189
+ onClick={() => {
190
+ inputRef.current?.click();
191
+ }}
187
192
  >
188
193
  <Icon icon="mi:attachment" className="text-xl" />
189
194
  </button>