@starasia/input 1.0.0

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/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # starasia Input
2
+
3
+ starasia Input is a strict and customizable Input component for web development projects, designed for simplicity and adherence to strict design guidelines.
4
+
5
+ ## Screenshots
6
+
7
+ ![App Screenshot](https://github.com/primaramadhaniputra/image/blob/main/IInput.png)
8
+
9
+ ## Package instalation
10
+
11
+ Instal package using pnpm
12
+
13
+ ```bash
14
+ pnpm add @starasia/input
15
+ ```
16
+
17
+ Instal package using yarn
18
+
19
+ ```bash
20
+ yarn add @starasia/input
21
+ ```
22
+
23
+ Instal package using npm
24
+
25
+ ```bash
26
+ npm i @starasia/input
27
+ ```
28
+
29
+ ## Usage/Examples (you can combine using icon package starasia)
30
+
31
+ ```javascript
32
+ import React, {SVGProps, useRef} from "react";
33
+ import {Input} from "@starasia/input";
34
+ import ReactDOM from "react-dom/client";
35
+
36
+ export interface IconProps extends SVGProps<SVGSVGElement> {}
37
+
38
+ export const IcBel = ({...rest}: IconProps) => {
39
+ return (
40
+ <svg
41
+ xmlns="http://www.w3.org/2000/svg"
42
+ {...rest}
43
+ viewBox="0 0 24 26"
44
+ fill="none"
45
+ >
46
+ <path
47
+ d="M8.68924 1.76023C9.69268 1.23925 10.8152 0.947739 12 0.947739C16.2663 0.947739 19.7249 4.7276 19.7249 9.39031V10.2395C19.7249 11.2587 20.001 12.2549 20.5182 13.1029L21.7857 15.1809C22.9436 17.0788 22.0597 19.6588 20.046 20.259C14.7782 21.8291 9.2218 21.8291 3.954 20.259C1.94033 19.6588 1.05645 17.0788 2.21424 15.1809L3.48179 13.1029C3.99905 12.2549 4.27507 11.2587 4.27507 10.2395V9.39031C4.27507 8.09543 4.5418 6.86864 5.0185 5.77198"
48
+ stroke="currentColor"
49
+ stroke-width="1.55"
50
+ stroke-linecap="round"
51
+ />
52
+ <path
53
+ d="M6.84937 21.4366C7.5991 23.5431 9.62207 25.0522 12 25.0522C12.2798 25.0522 12.5548 25.0314 12.8232 24.991M17.1506 21.4366C16.8449 22.2954 16.3276 23.0549 15.6609 23.6533"
54
+ stroke="currentColor"
55
+ stroke-width="1.55"
56
+ stroke-linecap="round"
57
+ />
58
+ </svg>
59
+ );
60
+ };
61
+
62
+ const App = () => {
63
+ const ref = useRef<HTMLInputElement | null>(null);
64
+ return (
65
+ <div>
66
+ <h1>Component test</h1>
67
+ <div style={{margin: "auto", width: "50vw"}}>
68
+ <Input
69
+ leftIcon={<IcBel />}
70
+ rightIcon={<IcBel />}
71
+ leftAddons={"Rp"}
72
+ rightAddons={"Rp"}
73
+ onClickRightIcon={() => alert("woke")}
74
+ placeholder="CTRL + K to search Query"
75
+ highlightPlaceholder="CTRL + K"
76
+ size={"md"}
77
+ onChange={(e) => console.log("e", e.target.value)}
78
+ ref={ref}
79
+ />
80
+ </div>
81
+ </div>
82
+ );
83
+ };
84
+
85
+ ReactDOM.createRoot(document.getElementById("app")!).render(<App />);
86
+
87
+ ```
88
+
89
+ ## Props @starasia/Input
90
+
91
+ #### Props that you can pass to <Input {...props}/>
92
+
93
+ | Prop Name | Value | required |
94
+ | :------------------- | :------------------------------------------ | :------- |
95
+ | leftIcon | <IcBel /> (icon svg) | false |
96
+ | rightIcon | <IcBel /> (icon svg) | false |
97
+ | size | "sm"/"md"/"lg" | false |
98
+ | status | "error" / "warning" / "disable" / "default" | false |
99
+ | inputUse | "icon" / "addons" | false |
100
+ | variant | "outline" / "filled" / "flushed" | false |
101
+ | placeholder | string | false |
102
+ | highlightPlaceholder | string | false |
103
+ | currency | boolean | false |
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { IInputProps } from "./types";
3
+ export declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ interface Props {
3
+ options?: string[];
4
+ value: string;
5
+ setValue: React.Dispatch<React.SetStateAction<string>>;
6
+ isComponentVisible: boolean;
7
+ onOptionChange: ((e: string) => void) | undefined;
8
+ }
9
+ declare const Suggestion: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
10
+ export default Suggestion;
@@ -0,0 +1,3 @@
1
+ export declare const renderIconSize: (size: "sm" | "md" | "lg") => 16 | 20 | undefined;
2
+ export declare const renderColorLeftIcon: (status: "error" | "warning" | "disable" | "default") => "#939E99" | "#EF4444" | "#EAB308";
3
+ export declare const renderColorRightIcon: (status: "error" | "warning" | "disable" | "default") => "#939E99" | "#EF4444" | "#EAB308";
@@ -0,0 +1,2 @@
1
+ export { Input } from "./Input";
2
+ export * from "./types";