the-omelet-ui 1.4.8 → 1.4.9
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 +5 -1
- package/dist/entries/provinceDropdown.js +2 -2
- package/dist/entries/subDistrictDropdown.d.ts +3 -1
- package/dist/entries/subDistrictDropdown.js +2 -2
- package/dist/entries/textAreaInput.js +4 -4
- package/package.json +21 -7
|
@@ -16,7 +16,9 @@ type DistrictProps = {
|
|
|
16
16
|
value?: string;
|
|
17
17
|
required?: boolean;
|
|
18
18
|
provinceId?: number;
|
|
19
|
+
/** เพิ่ม error message */
|
|
20
|
+
error?: string;
|
|
19
21
|
};
|
|
20
|
-
declare const DistrictDropdown: ({ locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, provinceId }: DistrictProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
+
declare const DistrictDropdown: ({ locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, provinceId, error }: DistrictProps) => react_jsx_runtime.JSX.Element;
|
|
21
23
|
|
|
22
24
|
export { type District, type DistrictProps, DistrictDropdown as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'../chunk-Y2ECRCYO.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-Y2ECRCYO.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 P=(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},w=async t=>(await(await fetch("https://raw.githubusercontent.com/kongvut/thai-province-data/refs/heads/master/api/latest/district.json")).json()).filter(o=>o.province_id===t),x=({locale:t="th",searchPlaceholder:s="Search District",placeholder:c="Select District",label:l,searchButtonClassName:o="bg-blue-500",onChange:d,value:n,required:D=false,provinceId:a$1,error:g})=>{let[i,b]=useState([]),[_,u]=useState(null);useEffect(()=>{a$1&&w(a$1).then(b);},[a$1]),useEffect(()=>{if(n){let e=i.find(r=>t==="th"?r.name_th===n:r.name_en===n);e&&u(e);}},[i,n,t]);let v=useCallback(e=>{let r=i.find(S=>S.id===e);r&&(u(r),d?.(r));},[i,d]);return jsx("div",{children:jsx(a,{items:i.map(e=>P(e,t)),placeholder:s,triggerPlaceholder:c,label:l,selectionMode:"single",searchButtonClassName:o,onChange:e=>{v(e);},value:_?.id,required:D,disabled:!a$1,errorMessage:g})})},y=x;
|
|
2
|
+
export{y as default};
|
|
@@ -6,16 +6,20 @@ type Province = {
|
|
|
6
6
|
name_en: string;
|
|
7
7
|
};
|
|
8
8
|
type ProvinceProps = {
|
|
9
|
+
/** รองรับภาษา */
|
|
9
10
|
locale?: "en" | "th";
|
|
10
11
|
searchPlaceholder?: string;
|
|
11
12
|
placeholder?: string;
|
|
12
13
|
label?: string;
|
|
14
|
+
/** custom class name in search button */
|
|
13
15
|
searchButtonClassName?: string;
|
|
14
16
|
onChange?: (province: Province) => void;
|
|
15
17
|
value?: string;
|
|
16
18
|
required?: boolean;
|
|
17
19
|
disabled?: boolean;
|
|
20
|
+
/** เพิ่ม error message */
|
|
21
|
+
error?: string;
|
|
18
22
|
};
|
|
19
|
-
declare const ProvinceDropdown: ({ disabled, locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required }: ProvinceProps) => react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare const ProvinceDropdown: ({ disabled, locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, error }: ProvinceProps) => react_jsx_runtime.JSX.Element;
|
|
20
24
|
|
|
21
25
|
export { type Province, type ProvinceProps, ProvinceDropdown as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'../chunk-Y2ECRCYO.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-Y2ECRCYO.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=(e,r)=>r==="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},x=async()=>await(await fetch("https://raw.githubusercontent.com/kongvut/thai-province-data/refs/heads/master/api/latest/province.json")).json(),y=({disabled:e,locale:r="th",searchPlaceholder:u="Search Province",placeholder:P="Select Province",label:v,searchButtonClassName:m="bg-blue-500",onChange:s,value:i,required:f=false,error:g})=>{let[o,p]=useState([]),[b,a$1]=useState(null);useEffect(()=>{x().then(p);},[]),useEffect(()=>{if(i){let n=o.find(t=>r==="th"?t.name_th===i:t.name_en===i);n&&a$1(n);}},[o,i,r]);let _=useCallback(n=>{let t=o.find(S=>S.id===n);t&&(a$1(t),s?.(t));},[o,s]);return jsx("div",{children:jsx(a,{items:o.map(n=>w(n,r)),placeholder:u,triggerPlaceholder:P,label:v,selectionMode:"single",searchButtonClassName:m,onChange:n=>{_(n);},value:b?.id,required:f,disabled:e,errorMessage:g})})},k=y;
|
|
2
|
+
export{k as default};
|
|
@@ -19,7 +19,9 @@ type SubDistrictProps = {
|
|
|
19
19
|
value?: string;
|
|
20
20
|
required?: boolean;
|
|
21
21
|
districtId?: number;
|
|
22
|
+
/** เพิ่ม error message */
|
|
23
|
+
error?: string;
|
|
22
24
|
};
|
|
23
|
-
declare const SubDistrictDropdown: ({ locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, districtId }: SubDistrictProps) => react_jsx_runtime.JSX.Element;
|
|
25
|
+
declare const SubDistrictDropdown: ({ locale, searchPlaceholder, placeholder, label, searchButtonClassName, onChange, value, required, districtId, error }: SubDistrictProps) => react_jsx_runtime.JSX.Element;
|
|
24
26
|
|
|
25
27
|
export { type SubDistrict, type SubDistrictProps, SubDistrictDropdown as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'../chunk-Y2ECRCYO.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-Y2ECRCYO.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 P=(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},w=async t=>(await(await fetch("https://raw.githubusercontent.com/kongvut/thai-province-data/refs/heads/master/api/latest/sub_district.json")).json()).filter(o=>o.district_id===t),x=({locale:t="th",searchPlaceholder:s="Search Sub District",placeholder:c="Select Sub District",label:l,searchButtonClassName:o="bg-blue-500",onChange:u,value:n,required:S=false,districtId:a$1,error:f})=>{let[i,g]=useState([]),[D,d]=useState(null);useEffect(()=>{a$1&&w(a$1).then(g);},[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 _=useCallback(e=>{let r=i.find(v=>v.id===e);r&&(d(r),u?.(r));},[i,u]);return jsx("div",{children:jsx(a,{items:i.map(e=>P(e,t)),placeholder:s,triggerPlaceholder:c,label:l,selectionMode:"single",searchButtonClassName:o,onChange:e=>{_(e);},value:D?.id,required:S,disabled:!a$1,errorMessage:f})})},y=x;
|
|
2
|
+
export{y as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {a}from'../chunk-DM45BGDQ.js';import {forwardRef}from'react';import {jsxs,jsx}from'react/jsx-runtime';var l=forwardRef(({label:
|
|
1
|
+
import {a}from'../chunk-DM45BGDQ.js';import {forwardRef}from'react';import {jsxs,jsx}from'react/jsx-runtime';var l=forwardRef(({label:r="\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 (\u0E1A\u0E49\u0E32\u0E19\u0E40\u0E25\u0E02\u0E17\u0E35\u0E48/\u0E0B\u0E2D\u0E22/\u0E16\u0E19\u0E19)",error:t,required:o=false,className:s="",...n},d)=>jsxs("fieldset",{className:"relative flex flex-col gap-2 items-start text-start",children:[r&&jsx(a,{label:r,required:o}),jsx("div",{className:"relative w-full",children:jsx("textarea",{ref:d,placeholder:"\u0E01\u0E23\u0E2D\u0E01\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E08\u0E31\u0E14\u0E2A\u0E48\u0E07\u0E02\u0E2D\u0E07\u0E23\u0E32\u0E07\u0E27\u0E31\u0E25",rows:4,className:`
|
|
2
2
|
w-full px-4 py-3
|
|
3
3
|
border rounded-lg
|
|
4
4
|
text-gray-900 placeholder-gray-400
|
|
5
5
|
resize-none
|
|
6
6
|
transition-colors
|
|
7
|
-
focus:outline-none
|
|
8
|
-
${
|
|
7
|
+
focus:outline-none
|
|
8
|
+
${t?"border-red-500":"border-gray-300"}
|
|
9
9
|
${s}
|
|
10
|
-
`,...n})}),
|
|
10
|
+
`,...n})}),t&&jsx("small",{className:"text-red-500 text-xs",children:t})]}));l.displayName="TextAreaInput";var i=l;export{i as default};
|
package/package.json
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "the-omelet-ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
|
-
".":
|
|
11
|
-
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./*": {
|
|
15
|
+
"types": "./dist/entries/*.d.ts",
|
|
16
|
+
"default": "./dist/entries/*.js"
|
|
17
|
+
}
|
|
12
18
|
},
|
|
13
|
-
"sideEffects": [
|
|
19
|
+
"sideEffects": [
|
|
20
|
+
"**/*.css"
|
|
21
|
+
],
|
|
14
22
|
"peerDependencies": {
|
|
15
23
|
"@radix-ui/react-slot": "^1.0.0",
|
|
16
24
|
"react": ">=18",
|
|
17
25
|
"react-dom": ">=18"
|
|
18
26
|
},
|
|
19
27
|
"peerDependenciesMeta": {
|
|
20
|
-
"@radix-ui/react-slot": {
|
|
28
|
+
"@radix-ui/react-slot": {
|
|
29
|
+
"optional": true
|
|
30
|
+
}
|
|
21
31
|
},
|
|
22
32
|
"dependencies": {
|
|
23
33
|
"class-variance-authority": "^0.7.1",
|
|
@@ -34,10 +44,14 @@
|
|
|
34
44
|
"README.md",
|
|
35
45
|
"LICENSE"
|
|
36
46
|
],
|
|
37
|
-
"publishConfig": {
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
38
50
|
"scripts": {
|
|
39
51
|
"build": "tsup",
|
|
40
52
|
"prepublishOnly": "pnpm build"
|
|
41
53
|
},
|
|
42
|
-
"engines": {
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=18"
|
|
56
|
+
}
|
|
43
57
|
}
|