code7-leia 0.1.126 → 0.1.127

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.
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const InputContainer: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
3
+ export declare const Input: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>>;
4
+ export declare const IconContainer: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.126",
2
+ "version": "0.1.127",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -1,54 +1,43 @@
1
1
  import React from 'react';
2
2
  import unorm from 'unorm';
3
3
  import { FaSearch } from 'react-icons/fa';
4
- import type { FileData } from '../../../../interface/FileData'
4
+ import { InputContainer, Input, IconContainer } from './styles';
5
+ import type { FileData } from '../../../../interface/FileData';
5
6
 
6
7
  interface SearchInputProps {
7
8
  placeholder: string;
8
- initialFiles: FileData[]
9
+ initialFiles: FileData[];
9
10
  setFiles: React.Dispatch<React.SetStateAction<FileData[]>>;
10
11
  }
11
12
 
12
- const SearchInput: React.FC<SearchInputProps> = ({ placeholder, setFiles, initialFiles }) => {
13
-
13
+ const SearchInput: React.FC<SearchInputProps> = ({
14
+ placeholder,
15
+ setFiles,
16
+ initialFiles,
17
+ }) => {
14
18
  const searchName = (e: React.ChangeEvent<HTMLInputElement>) => {
15
19
  const searchTerm = e.target.value.trim();
16
20
  const normalizedSearchTerm = unorm.nfkd(searchTerm).toLowerCase();
17
-
18
- const newFiles = initialFiles.filter(file => {
19
- const normalizedFileName = unorm.nfkd(file.name).toLowerCase();
20
- return normalizedFileName.includes(normalizedSearchTerm);
21
+
22
+ const newFiles = initialFiles.filter((file) => {
23
+ const normalizedFileName = unorm.nfkd(file.name).toLowerCase();
24
+ return normalizedFileName.includes(normalizedSearchTerm);
21
25
  });
22
-
26
+
23
27
  setFiles(searchTerm !== '' ? newFiles : initialFiles);
24
- }
25
-
28
+ };
26
29
 
27
30
  return (
28
- <div style={{ position: 'relative', width: '300px' }}>
29
- <input
31
+ <InputContainer>
32
+ <Input
30
33
  type="text"
31
- onChange={(e) => searchName(e)}
34
+ onChange={(e: any) => searchName(e)}
32
35
  placeholder={placeholder}
33
- style={{
34
- paddingLeft: '40px',
35
- borderRadius: '5px',
36
- border: '1px solid #ccc',
37
- height: '40px',
38
- width: '100%',
39
- }}
40
36
  />
41
- <div
42
- style={{
43
- position: 'absolute',
44
- top: '10px',
45
- left: '10px',
46
- pointerEvents: 'none',
47
- }}
48
- >
37
+ <IconContainer>
49
38
  <FaSearch />
50
- </div>
51
- </div>
39
+ </IconContainer>
40
+ </InputContainer>
52
41
  );
53
42
  };
54
43
 
@@ -0,0 +1,26 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const InputContainer = styled.div`
4
+ position: relative;
5
+ width: 300px;
6
+ `;
7
+
8
+ export const Input = styled.input`
9
+ padding-left: 40px;
10
+ border-radius: 5px;
11
+ border: 1px solid #ccc;
12
+ height: 40px;
13
+ width: 100%;
14
+
15
+ &:focus {
16
+ outline: none;
17
+ box-shadow: 0 0 0 3px #6690ff;
18
+ }
19
+ `;
20
+
21
+ export const IconContainer = styled.div`
22
+ position: absolute;
23
+ top: 10px;
24
+ left: 10px;
25
+ pointer-events: none;
26
+ `;
@@ -68,6 +68,10 @@ export const FileArea = () => {
68
68
  if(modal){
69
69
  setUploadFile(undefined)
70
70
  setPresset([])
71
+ const tag = optionsPresset.map((tag: any) => {
72
+ return { label: tag, value: tag }
73
+ })
74
+ setOptionsPresset(tag)
71
75
  }
72
76
  setModal(!modal)
73
77
  }