@starasia/dropdown 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,122 @@
1
+ # starasia Dropdown
2
+
3
+ starasia Dropdown is a strict and customizable Dropdown 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/IDropdown.png)
8
+
9
+ ## Package instalation
10
+
11
+ Instal package using pnpm
12
+
13
+ ```bash
14
+ pnpm add @starasia/dropdown
15
+ ```
16
+
17
+ Instal package using yarn
18
+
19
+ ```bash
20
+ yarn add @starasia/dropdown
21
+ ```
22
+
23
+ Instal package using npm
24
+
25
+ ```bash
26
+ npm i @starasia/dropdown
27
+ ```
28
+
29
+ ## Usage/Examples (you can combine using icon package starasia)
30
+
31
+ ```javascript
32
+ import {
33
+ Dropdown
34
+ } from '@starasia/dropdown'
35
+
36
+
37
+
38
+ import React, {SVGProps} from "react";
39
+ import ReactDOM from "react-dom/client";
40
+
41
+ const CustomIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => {
42
+ return (
43
+ <svg
44
+ width="20"
45
+ height="20"
46
+ viewBox="0 0 20 20"
47
+ fill="none"
48
+ xmlns="http://www.w3.org/2000/svg"
49
+ {...props}
50
+ >
51
+ <g id="Curved/Random">
52
+ <path
53
+ id="shape"
54
+ d="M3.33333 13.3333C3.33333 13.3333 4.16666 12.5 6.66666 12.5C9.16666 12.5 10.8333 14.1667 13.3333 14.1667C15.8333 14.1667 16.6667 13.3333 16.6667 13.3333V3.33333C16.6667 3.33333 15.8333 4.16667 13.3333 4.16667C10.8333 4.16667 9.16666 2.5 6.66666 2.5C4.16666 2.5 3.33333 3.33333 3.33333 3.33333V17.5"
55
+ stroke="currentColor"
56
+ strokeWidth="1.5"
57
+ strokeLinecap="round"
58
+ strokeLinejoin="round"
59
+ />
60
+ </g>
61
+ </svg>
62
+ );
63
+ };
64
+
65
+ const App = () => (
66
+ <div>
67
+ <h1>Component test</h1>
68
+ <div style={{margin: "100px"}}>
69
+ <Dropdown
70
+ dropdownLists={[
71
+ {
72
+ icon: <CustomIcon color="gray" />,
73
+ label: "testing 1",
74
+ value: "testing 1",
75
+ },
76
+ {
77
+ icon: <CustomIcon color="red" />,
78
+ label: "testing 2",
79
+ value: "testing 2",
80
+ },
81
+ {
82
+ icon: <CustomIcon color="blue" />,
83
+ label: "testing 3",
84
+ value: "testing 3",
85
+ },
86
+ ]}
87
+ onChange={(e) => {
88
+ console.log("e", e);
89
+ }}
90
+ defaultValue={[
91
+ {
92
+ label: "testing 3",
93
+ value: "testing 3",
94
+ },
95
+ ]}
96
+ iconLeft={<CustomIcon />}
97
+ multiSelect
98
+ searchAble
99
+ onSearch={(e) => console.log(e)}
100
+ />
101
+ </div>
102
+ </div>
103
+ );
104
+
105
+ ReactDOM.createRoot(document.getElementById("app")!).render(<App />);
106
+ ```
107
+
108
+ ## Props @starasia/menu
109
+
110
+ #### Props that you can pass to <Menu {...props}></Menu>
111
+
112
+ | Prop Name | Type | Value | Default | required | description |
113
+ | :------------ | :---------------------------- | :------------------------------------------------------------------ | :------- | :------- | :-------------------------- |
114
+ | onChange | function | (props: {label: string; value: string}[]) => void | required | true | "" |
115
+ | onSearch | function | (props:string) => void | | false | "" |
116
+ | dropdownLists | array of objects | [{icon?:React.ReactElement<IconProps>,label: string,value: string}] | required | true | data list for handle change |
117
+ | defaultValue | array of objects | [label: string,value: string}] | | | default value |
118
+ | size | string | "sm" / "md" / "lg" | 'md' | false | sizes for dropdown |
119
+ | multiSelect | boolean | true/false | false | false | multi select for dropdown |
120
+ | searchAble | boolean | true/false | false | false | search for dropdown |
121
+ | iconLeft | React.ReactElement<IconProps> | React.ReactElement<IconProps> | | false | icon for dropdown |
122
+ | placeholder | string | string | | false | placeholder for dropdown |
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface IProps {
3
+ isChecked: boolean;
4
+ }
5
+ declare const Checkbox: ({ isChecked }: IProps) => React.JSX.Element;
6
+ export default Checkbox;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { IDropdown } from "./interface";
3
+ export declare const Dropdown: React.FC<IDropdown>;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { IDropdown } from "./interface";
3
+ interface IProps {
4
+ positionDropdown: IDropdown["position"];
5
+ dropdownLists: IDropdown["dropdownLists"];
6
+ isComponentVisible: boolean;
7
+ searchAble: boolean;
8
+ onSearch?: (e: string) => void;
9
+ value: {
10
+ label: string;
11
+ value: string;
12
+ }[];
13
+ handleChangeValue: (label: string, values: string) => void;
14
+ multiSelect: boolean | undefined;
15
+ searchValue?: string;
16
+ }
17
+ declare const DropdownList: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLDivElement>>;
18
+ export default DropdownList;
@@ -0,0 +1,6 @@
1
+ import React, { ReactNode } from "react";
2
+ declare const ScrollAwareWrapper: ({ children, handleChangePosition, }: {
3
+ children: ReactNode;
4
+ handleChangePosition: () => void;
5
+ }) => React.JSX.Element;
6
+ export default ScrollAwareWrapper;