Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
thai-address-autocomplete-react
Advanced tools
[![NPM](https://img.shields.io/npm/v/thai-address-autocomplete-react)](https://www.npmjs.com/package/thai-address-autocomplete-react) [![NPM](https://img.shields.io/badge/Watsize-Library-289548)](https://www.npmjs.com/package/thai-address-autocomplete-rea
Get back to active!. I hope this library will be useful for all you guy. Welcome all PR as always. Thanks.
thai-address-autocomplete-react is an input component for ReactJS that can auto-complete Thai addresses with magic by just typing something
. Anyway I hope this component will be a useful thing to you. :D Happy Coding.
npm install thai-address-autocomplete-react
# or just `yarn add thai-address-autocomplete-react`
import { useState } from "react";
import { Address, CreateInput } from "thai-address-autocomplete-react";
const InputThaiAddress = CreateInput();
const App = () => {
const [address, setAddress] = useState<Address>({
district: "", // ตำบล tambol
amphoe: "", // อำเภอ amphoe
province: "", // จังหวัด changwat
zipcode: "", // รหัสไปรษณีย์ postal code
});
const handleChange = (scope: string) => (value: string) => {
setAddress((oldAddr: Address) => ({
...oldAddr,
[scope]: value,
}));
};
const handleSelect = (address: Address) => {
setAddress(address);
};
return (
<div>
<label>ตำบล</label>
<InputThaiAddress.District
value={address["district"]}
onChange={handleChange("district")}
onSelect={handleSelect}
/>
<label>อำเภอ</label>
<InputThaiAddress.Amphoe
value={address["amphoe"]}
onChange={handleChange("amphoe")}
onSelect={handleSelect}
/>
<label>จังหวัด</label>
<InputThaiAddress.Province
value={address["province"]}
onChange={handleChange("province")}
onSelect={handleSelect}
/>
<label>รหัสไปรษณีย์</label>
<InputThaiAddress.Zipcode
value={address["zipcode"]}
onChange={handleChange("zipcode")}
onSelect={handleSelect}
/>
</div>
);
};
export default App;
Data label | Data field name |
---|---|
ตำบล/แขวง | district |
อำเภอ/เขต | amphoe |
จังหวัด | province |
รหัสไปรษณีย์ | zipcode |
Property | Description | Type | Default |
---|---|---|---|
scope | field name from record. Possible value will be "district", "amphoe", "province", and "zipcode". | string | "province" |
delimiter | delimiter between scope values, which will show inside options in the autocomplete. | string | ", " |
value | value by scope. | string | "" |
filter | array filter function, used for fine grain result of options or fixed something on the result. | (value?: Address, index?: number, array?: Address[]) => boolean | () => true |
onChange | function callback, trigger on input changes. | (value: string) => void | () => null |
onSelect | function callback, trigger on select the option. | (address: Address) => void | () => null |
style | "Fashions fade, style is eternal." — Yves Saint Laurent | CSS.Properties | {} |
className | css class...name. | string | "" |
autoCompleteProps | the override properties of AutoComplete: check out https://ant.design/components/auto-complete#api . | AutoCompleteProps | {} |
Address
)the data record can be found
onSelect
.
interface Address {
district: string;
amphoe: string;
province: string;
zipcode: number;
}
FAQ 1: Can I use custom database ?
Yes, but to use custom database (in this version). It supports only JSON format
file that output from Database Tools by earthchie.
// 1. import json
import customDB from "./database/db.json";
// 2. used by put in the configuration before initialize component
const InputCustom = CreateInput({ database: customDB });
FAQ 2: I want to ask you more.
I provide a simple document on ./docs to describe how to use this library.
But if you're not found what you want to know, please feel free to create an issue on GitHub. I would love to answer all of the questions, and I am also welcome for all the PR. ❤️
Please see more CHANGELOG.md
MIT © buildingwatsize
FAQs
[![NPM](https://img.shields.io/npm/v/thai-address-autocomplete-react)](https://www.npmjs.com/package/thai-address-autocomplete-react) [![NPM](https://img.shields.io/badge/Watsize-Library-289548)](https://www.npmjs.com/package/thai-address-autocomplete-rea
The npm package thai-address-autocomplete-react receives a total of 146 weekly downloads. As such, thai-address-autocomplete-react popularity was classified as not popular.
We found that thai-address-autocomplete-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.