the-omelet-ui 1.5.3 → 1.5.4
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/dist/entries/districtDropdown.d.ts +3 -1
- package/dist/entries/districtDropdown.js +2 -2
- package/dist/entries/provinceDropdown.d.ts +3 -1
- package/dist/entries/provinceDropdown.js +1 -1
- package/dist/entries/subDistrictDropdown.d.ts +3 -1
- package/dist/entries/subDistrictDropdown.js +2 -2
- package/package.json +1 -1
|
@@ -18,7 +18,9 @@ type DistrictProps = {
|
|
|
18
18
|
provinceId?: number;
|
|
19
19
|
/** เพิ่ม error message */
|
|
20
20
|
error?: string;
|
|
21
|
+
/** label บนปุ่ม Search */
|
|
22
|
+
searchLabel?: string;
|
|
21
23
|
};
|
|
22
|
-
declare const DistrictDropdown: ({ locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, provinceId, error }: DistrictProps) => react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare const DistrictDropdown: ({ searchLabel, locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, provinceId, error }: DistrictProps) => react_jsx_runtime.JSX.Element;
|
|
23
25
|
|
|
24
26
|
export { type District, type DistrictProps, DistrictDropdown as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'../chunk-CAGUY2KE.js';import'../chunk-KYNNMWQA.js';import'../chunk-WSPTQJ57.js';import'../chunk-IX36POX2.js';import'../chunk-DM45BGDQ.js';import'../chunk-6GLPXMGB.js';import {useState,useEffect,useCallback}from'react';import {jsx}from'react/jsx-runtime';var
|
|
2
|
-
export{
|
|
1
|
+
import {a}from'../chunk-CAGUY2KE.js';import'../chunk-KYNNMWQA.js';import'../chunk-WSPTQJ57.js';import'../chunk-IX36POX2.js';import'../chunk-DM45BGDQ.js';import'../chunk-6GLPXMGB.js';import {useState,useEffect,useCallback}from'react';import {jsx}from'react/jsx-runtime';var w=(t,r)=>r==="en"?{id:t.id,name:t.name_en,value:t.id,label:t.name_en}:{id:t.id,name:t.name_th,value:t.id,label:t.name_th},x=async t=>(await(await fetch("https://raw.githubusercontent.com/kongvut/thai-province-data/refs/heads/master/api/latest/district.json")).json()).filter(c=>c.province_id===t),y=({searchLabel:t="Search",locale:r="th",searchPlaceholder:o="Search District",placeholder:l="Select District",label:c,searchButtonClassName:D="bg-blue-500",onChange:d,value:n,required:g=false,provinceId:a$1,error:b})=>{let[s,_]=useState([]),[S,u]=useState(null);useEffect(()=>{a$1&&x(a$1).then(_);},[a$1]),useEffect(()=>{if(n){let e=s.find(i=>r==="th"?i.name_th===n:i.name_en===n);e&&u(e);}},[s,n,r]);let v=useCallback(e=>{let i=s.find(C=>C.id===e);i&&(u(i),d?.(i));},[s,d]);return jsx("div",{children:jsx(a,{items:s.map(e=>w(e,r)),placeholder:o,triggerPlaceholder:l,label:c,selectionMode:"single",searchButtonClassName:D,onChange:e=>{v(e);},searchButtonLabel:t,value:S?.id,required:g,disabled:!a$1,errorMessage:b})})},B=y;
|
|
2
|
+
export{B as default};
|
|
@@ -17,9 +17,11 @@ type ProvinceProps = {
|
|
|
17
17
|
value?: string;
|
|
18
18
|
required?: boolean;
|
|
19
19
|
disabled?: boolean;
|
|
20
|
+
/** label บนปุ่ม Search */
|
|
21
|
+
searchLabel?: string;
|
|
20
22
|
/** เพิ่ม error message */
|
|
21
23
|
error?: string;
|
|
22
24
|
};
|
|
23
|
-
declare const ProvinceDropdown: ({ disabled, locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, error }: ProvinceProps) => react_jsx_runtime.JSX.Element;
|
|
25
|
+
declare const ProvinceDropdown: ({ searchLabel, disabled, locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, error }: ProvinceProps) => react_jsx_runtime.JSX.Element;
|
|
24
26
|
|
|
25
27
|
export { type Province, type ProvinceProps, ProvinceDropdown as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'../chunk-CAGUY2KE.js';import'../chunk-KYNNMWQA.js';import'../chunk-WSPTQJ57.js';import'../chunk-IX36POX2.js';import'../chunk-DM45BGDQ.js';import'../chunk-6GLPXMGB.js';import {useState,useEffect,useCallback}from'react';import {jsx}from'react/jsx-runtime';var
|
|
1
|
+
import {a}from'../chunk-CAGUY2KE.js';import'../chunk-KYNNMWQA.js';import'../chunk-WSPTQJ57.js';import'../chunk-IX36POX2.js';import'../chunk-DM45BGDQ.js';import'../chunk-6GLPXMGB.js';import {useState,useEffect,useCallback}from'react';import {jsx}from'react/jsx-runtime';var x=(e,o)=>o==="en"?{id:e.id,name:e.name_en,value:e.id,label:e.name_en}:{id:e.id,name:e.name_th,value:e.id,label:e.name_th},y=async()=>await(await fetch("https://raw.githubusercontent.com/kongvut/thai-province-data/refs/heads/master/api/latest/province.json")).json(),B=({searchLabel:e="Search",disabled:o,locale:s="th",searchPlaceholder:P="Search Province",placeholder:v="Select Province",label:m,searchButtonClassName:g="bg-blue-500",onChange:i,value:a$1,required:f=false,error:p})=>{let[t,b]=useState([]),[_,c]=useState(null);useEffect(()=>{y().then(b);},[]),useEffect(()=>{if(a$1){let r=t.find(n=>s==="th"?n.name_th===a$1:n.name_en===a$1);r&&c(r);}},[t,a$1,s]);let S=useCallback(r=>{let n=t.find(C=>C.id===r);n&&(c(n),i?.(n));},[t,i]);return jsx("div",{children:jsx(a,{items:t.map(r=>x(r,s)),placeholder:P,triggerPlaceholder:v,label:m,selectionMode:"single",searchButtonClassName:g,onChange:r=>{S(r);},searchButtonLabel:e,value:_?.id,required:f,disabled:o,errorMessage:p})})},k=B;
|
|
2
2
|
export{k as default};
|
|
@@ -19,9 +19,11 @@ type SubDistrictProps = {
|
|
|
19
19
|
value?: string;
|
|
20
20
|
required?: boolean;
|
|
21
21
|
districtId?: number;
|
|
22
|
+
/** label บนปุ่ม Search */
|
|
23
|
+
searchLabel?: string;
|
|
22
24
|
/** เพิ่ม error message */
|
|
23
25
|
error?: string;
|
|
24
26
|
};
|
|
25
|
-
declare const SubDistrictDropdown: ({ locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, districtId, error }: SubDistrictProps) => react_jsx_runtime.JSX.Element;
|
|
27
|
+
declare const SubDistrictDropdown: ({ locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, districtId, error, searchLabel }: SubDistrictProps) => react_jsx_runtime.JSX.Element;
|
|
26
28
|
|
|
27
29
|
export { type SubDistrict, type SubDistrictProps, SubDistrictDropdown as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'../chunk-CAGUY2KE.js';import'../chunk-KYNNMWQA.js';import'../chunk-WSPTQJ57.js';import'../chunk-IX36POX2.js';import'../chunk-DM45BGDQ.js';import'../chunk-6GLPXMGB.js';import {useState,useEffect,useCallback}from'react';import {jsx}from'react/jsx-runtime';var
|
|
2
|
-
export{
|
|
1
|
+
import {a}from'../chunk-CAGUY2KE.js';import'../chunk-KYNNMWQA.js';import'../chunk-WSPTQJ57.js';import'../chunk-IX36POX2.js';import'../chunk-DM45BGDQ.js';import'../chunk-6GLPXMGB.js';import {useState,useEffect,useCallback}from'react';import {jsx}from'react/jsx-runtime';var w=(t,s)=>s==="en"?{id:t.id,name:t.name_en,value:t.id,label:t.name_en}:{id:t.id,name:t.name_th,value:t.id,label:t.name_th},x=async t=>(await(await fetch("https://raw.githubusercontent.com/kongvut/thai-province-data/refs/heads/master/api/latest/sub_district.json")).json()).filter(c=>c.district_id===t),y=({locale:t="th",searchPlaceholder:s="Search Sub District",placeholder:o="Select Sub District",label:l,searchButtonClassName:c="bg-blue-500",onChange:u,value:n,required:p=false,districtId:a$1,error:f,searchLabel:g="Search"})=>{let[i,D]=useState([]),[_,d]=useState(null);useEffect(()=>{a$1&&x(a$1).then(D);},[a$1]),useEffect(()=>{if(n){let e=i.find(r=>t==="th"?r.name_th===n:r.name_en===n);e&&d(e);}},[i,n,t]);let v=useCallback(e=>{let r=i.find(C=>C.id===e);r&&(d(r),u?.(r));},[i,u]);return jsx("div",{children:jsx(a,{items:i.map(e=>w(e,t)),placeholder:s,triggerPlaceholder:o,label:l,selectionMode:"single",searchButtonClassName:c,onChange:e=>{v(e);},searchButtonLabel:g,value:_?.id,required:p,disabled:!a$1,errorMessage:f})})},B=y;
|
|
2
|
+
export{B as default};
|