nepal-places-react 0.2.2 → 0.3.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 +51 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# nepal-places-react
|
|
2
|
+
|
|
3
|
+
React dropdown component for Nepal's Provinces, Districts, Municipalities, Wards, and Places. Built on top of `nepal-places`.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install nepal-places-react
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { NepalPlacesDropdown } from 'nepal-places-react'
|
|
13
|
+
|
|
14
|
+
function AddressForm() {
|
|
15
|
+
return (
|
|
16
|
+
<NepalPlacesDropdown
|
|
17
|
+
depth={3}
|
|
18
|
+
onChange={(selection) => console.log(selection)}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Default | Description |
|
|
27
|
+
|------|------|---------|-------------|
|
|
28
|
+
| `depth` | `1`-`5` | `2` | Number of cascade levels |
|
|
29
|
+
| `mode` | `'cascade'` \| `'flat'` | `'cascade'` | Selection mode |
|
|
30
|
+
| `labels` | `'english'` \| `'nepali'` | `'english'` | Display language |
|
|
31
|
+
| `flat` | `boolean` | `false` | Return flat code string |
|
|
32
|
+
| `filterType` | `LocalLevelType` | — | Filter by local level type |
|
|
33
|
+
| `searchable` | `boolean` | `true` | Enable search |
|
|
34
|
+
| `clearable` | `boolean` | `false` | Show clear button |
|
|
35
|
+
| `disabled` | `boolean` | `false` | Disable the dropdown |
|
|
36
|
+
| `placeholder` | `string` | — | Input placeholder text |
|
|
37
|
+
| `onChange` | `(value) => void` | — | Selection callback |
|
|
38
|
+
|
|
39
|
+
## Depth levels
|
|
40
|
+
|
|
41
|
+
| Depth | Levels |
|
|
42
|
+
|-------|--------|
|
|
43
|
+
| `1` | Province |
|
|
44
|
+
| `2` | Province → District |
|
|
45
|
+
| `3` | Province → District → Municipality |
|
|
46
|
+
| `4` | Province → District → Municipality → Ward |
|
|
47
|
+
| `5` | Province → District → Municipality → Ward → Place |
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT — [kushal1o1](https://github.com/kushal1o1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nepal-places-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "React dropdown component for Nepal's provinces, districts, municipalities, and wards. Fast, typed, bilingual.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"files": ["dist"],
|
|
15
|
+
"files": ["dist", "README.md"],
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc",
|
|
18
18
|
"typecheck": "tsc --noEmit",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"react": "^18.0.0 || ^19.0.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"nepal-places": "^0.
|
|
25
|
+
"nepal-places": "^0.3.0"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
28
|
"nepal",
|