@donotdev/crud 0.0.2 → 0.0.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.
Files changed (54) hide show
  1. package/dist/CrudService.d.ts.map +1 -1
  2. package/dist/CrudService.js +1 -1
  3. package/dist/CrudStore.d.ts +1 -1
  4. package/dist/CrudStore.d.ts.map +1 -1
  5. package/dist/CrudStore.js +1 -1
  6. package/dist/adapters/FirestoreAdapter.js +1 -1
  7. package/dist/adapters/FunctionsAdapter.js +1 -1
  8. package/dist/adapters/index.js +1 -1
  9. package/dist/components/ControlledFields.d.ts +18 -143
  10. package/dist/components/ControlledFields.d.ts.map +1 -1
  11. package/dist/components/ControlledFields.js +1 -1
  12. package/dist/components/CrudButton.js +1 -1
  13. package/dist/components/EntityFormRenderer.js +1 -1
  14. package/dist/components/FormFieldRenderer.d.ts.map +1 -1
  15. package/dist/components/FormFieldRenderer.js +1 -1
  16. package/dist/components/FormLayout.js +1 -1
  17. package/dist/components/form/fields/AddressFieldComponent.d.ts +42 -0
  18. package/dist/components/form/fields/AddressFieldComponent.d.ts.map +1 -0
  19. package/dist/components/form/fields/AddressFieldComponent.js +1 -0
  20. package/dist/components/form/fields/AvatarFieldComponent.js +1 -1
  21. package/dist/components/form/fields/BadgeFieldComponent.js +1 -1
  22. package/dist/components/form/fields/ButtonFieldComponent.js +1 -1
  23. package/dist/components/form/fields/CheckboxFieldComponent.js +1 -1
  24. package/dist/components/form/fields/DateFieldComponent.js +1 -1
  25. package/dist/components/form/fields/DropdownComponent.js +1 -1
  26. package/dist/components/form/fields/FileFieldComponent.js +1 -1
  27. package/dist/components/form/fields/GeoPointFieldComponent.js +1 -1
  28. package/dist/components/form/fields/HiddenFieldComponent.js +1 -1
  29. package/dist/components/form/fields/ImageFieldComponent.js +1 -1
  30. package/dist/components/form/fields/MapFieldComponent.js +1 -1
  31. package/dist/components/form/fields/MultiDropdownComponent.js +1 -1
  32. package/dist/components/form/fields/MultiInputTextFieldComponent.js +1 -1
  33. package/dist/components/form/fields/NumberFieldComponent.js +1 -1
  34. package/dist/components/form/fields/PasswordFieldComponent.js +1 -1
  35. package/dist/components/form/fields/PhoneNumberComponent.js +1 -1
  36. package/dist/components/form/fields/RadioFieldComponent.js +1 -1
  37. package/dist/components/form/fields/RangeFieldComponent.js +1 -1
  38. package/dist/components/form/fields/ReferenceFieldComponent.d.ts +24 -18
  39. package/dist/components/form/fields/ReferenceFieldComponent.d.ts.map +1 -1
  40. package/dist/components/form/fields/ReferenceFieldComponent.js +1 -1
  41. package/dist/components/form/fields/TextAreaComponent.js +1 -1
  42. package/dist/components/form/fields/TextFieldComponent.js +1 -1
  43. package/dist/components/form/fields/TimestampFieldComponent.js +1 -1
  44. package/dist/components/form/fields/index.d.ts +2 -0
  45. package/dist/components/form/fields/index.d.ts.map +1 -1
  46. package/dist/components/form/fields/index.js +1 -1
  47. package/dist/components/index.js +1 -1
  48. package/dist/index.js +1 -1
  49. package/dist/tsconfig.tsbuildinfo +1 -1
  50. package/dist/useCrud.d.ts +9 -17
  51. package/dist/useCrud.d.ts.map +1 -1
  52. package/dist/useCrud.js +1 -1
  53. package/dist/utils/collections.js +1 -1
  54. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"CrudService.d.ts","sourceRoot":"","sources":["../src/CrudService.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,YAAY,EAAE,YAAY,EAAE,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,GAAG,CAAC,CAAC,EACH,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,MAAM,EAA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AO,EAAE,YAAY,EACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,EAC5C,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GACrB,MAAM,IAAI;CAmCd;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,mBAE1B,CAAC"}
@@ -1 +1 @@
1
- import{toast as h}from"@donotdev/components";import{createSingleton as c,handleError as o}from"@donotdev/core";import{FirestoreAdapter as l}from"./adapters/FirestoreAdapter";import{FunctionsAdapter as g}from"./adapters/FunctionsAdapter";class u{adapter=null;backend=null;store=null;setStore(t){this.store=t}async initialize(t){if(!(this.backend===t&&this.adapter)){if(this.backend=t,t==="functions")this.adapter=new g;else if(t==="firestore")this.adapter=new l;else throw new Error(`Unknown backend: ${t}`);this.store&&(this.store.getState().setBackend(t),this.store.getState().setCrudService(this))}}async get(t,r,i){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");const e=await this.adapter.get(t,r,i);return this.store&&e&&this.store.getState().setData(t,r,e),e}catch(e){const s=o(e,{userMessage:`Failed to fetch ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,s),s}finally{this.store&&this.store.getState().setLoading(t,!1)}}async set(t,r,i,e){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");await this.adapter.set(t,r,i,e),this.store&&this.store.getState().setData(t,r,i),h("success",`${t} saved successfully`)}catch(s){const a=o(s,{userMessage:`Failed to save ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,a),a}finally{this.store&&this.store.getState().setLoading(t,!1)}}async update(t,r,i){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");if(await this.adapter.update(t,r,i),this.store){const e=this.store.getState().getData(t,r);e&&this.store.getState().setData(t,r,{...e,...i})}h("success",`${t} updated successfully`)}catch(e){const s=o(e,{userMessage:`Failed to update ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,s),s}finally{this.store&&this.store.getState().setLoading(t,!1)}}async delete(t,r){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");await this.adapter.delete(t,r),this.store&&this.store.getState().removeData(t,r),h("success",`${t} deleted successfully`)}catch(i){const e=o(i,{userMessage:`Failed to delete ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,e),e}finally{this.store&&this.store.getState().setLoading(t,!1)}}async add(t,r,i){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");const e=await this.adapter.add(t,r,i);return this.store&&e&&this.store.getState().setData(t,e,{...r,id:e}),h("success",`${t} created successfully`),e}catch(e){const s=o(e,{userMessage:`Failed to create ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,s),s}finally{this.store&&this.store.getState().setLoading(t,!1)}}async query(t,r,i){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");const e=await this.adapter.query(t,r,i);if(this.store)for(const s of e){const a=s.id;a&&this.store.getState().setData(t,a,s)}return e}catch(e){const s=o(e,{userMessage:`Failed to query ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,s),s}finally{this.store&&this.store.getState().setLoading(t,!1)}}subscribe(t,r,i,e){this.adapter||this.initialize("firestore").catch(()=>{});try{return this.adapter?this.adapter.subscribe(t,r,(s,a)=>{s&&this.store&&this.store.getState().setData(t,r,s),i(s,a)},e):(i(null,new Error("Adapter not initialized")),()=>{})}catch(s){return i(null,o(s)),()=>{}}}subscribeToCollection(t,r,i,e){this.adapter||this.initialize("firestore").catch(()=>{});try{return this.adapter?this.adapter.subscribeToCollection(t,r,(s,a)=>{if(s&&this.store)for(const n of s){const d=n.id;d&&this.store.getState().setData(t,d,n)}i(s,a)},e):(i([],new Error("Adapter not initialized")),()=>{})}catch(s){return i([],o(s)),()=>{}}}}const f=c(()=>new u);export{f as getCrudService};
1
+ import{toast as o}from"@donotdev/components";import{createSingleton as n,handleError as h}from"@donotdev/core";import{FirestoreAdapter as u}from"./adapters/FirestoreAdapter";import{FunctionsAdapter as g}from"./adapters/FunctionsAdapter";class p{adapter=null;backend=null;store=null;setStore(t){this.store=t}async initialize(t){if(!(this.backend===t&&this.adapter)){if(this.backend=t,t==="functions")this.adapter=new g;else if(t==="firestore")this.adapter=new u;else throw new Error(`Unknown backend: ${t}`);this.store&&(this.store.getState().setBackend(t),this.store.getState().setCrudService(this))}}async get(t,s,i){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");const e=await this.adapter.get(t,s,i);return this.store&&e&&this.store.getState().setData(t,s,e),e}catch(e){const r=h(e,{userMessage:`Failed to fetch ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,r),r}finally{this.store&&this.store.getState().setLoading(t,!1)}}async set(t,s,i,e){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");await this.adapter.set(t,s,i,e),this.store&&this.store.getState().setData(t,s,i),o("success",`${t} saved successfully`)}catch(r){const a=h(r,{userMessage:`Failed to save ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,a),a}finally{this.store&&this.store.getState().setLoading(t,!1)}}async update(t,s,i){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));let e=null;this.store&&(e=this.store.getState().getData(t,s)),this.store&&e&&this.store.getState().setData(t,s,{...e,...i});try{if(!this.adapter)throw new Error("Adapter not initialized");await this.adapter.update(t,s,i),o("success",`${t} updated successfully`)}catch(r){this.store&&e&&this.store.getState().setData(t,s,e);const a=h(r,{userMessage:`Failed to update ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,a),a}finally{this.store&&this.store.getState().setLoading(t,!1)}}async delete(t,s){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");await this.adapter.delete(t,s),this.store&&this.store.getState().removeData(t,s),o("success",`${t} deleted successfully`)}catch(i){const e=h(i,{userMessage:`Failed to delete ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,e),e}finally{this.store&&this.store.getState().setLoading(t,!1)}}async add(t,s,i){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");const e=await this.adapter.add(t,s,i);return this.store&&e&&this.store.getState().setData(t,e,{...s,id:e}),o("success",`${t} created successfully`),e}catch(e){const r=h(e,{userMessage:`Failed to create ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,r),r}finally{this.store&&this.store.getState().setLoading(t,!1)}}async query(t,s,i){this.adapter||await this.initialize("firestore"),this.store&&(this.store.getState().setLoading(t,!0),this.store.getState().setError(t,null));try{if(!this.adapter)throw new Error("Adapter not initialized");const e=await this.adapter.query(t,s,i);if(this.store)for(const r of e){const a=r.id;a&&this.store.getState().setData(t,a,r)}return e}catch(e){const r=h(e,{userMessage:`Failed to query ${t}`,showNotification:!0});throw this.store&&this.store.getState().setError(t,r),r}finally{this.store&&this.store.getState().setLoading(t,!1)}}subscribe(t,s,i,e){this.adapter||this.initialize("firestore").catch(()=>{});try{return this.adapter?this.adapter.subscribe(t,s,(r,a)=>{r&&this.store&&this.store.getState().setData(t,s,r),i(r,a)},e):(i(null,new Error("Adapter not initialized")),()=>{})}catch(r){return i(null,h(r)),()=>{}}}subscribeToCollection(t,s,i,e){this.adapter||this.initialize("firestore").catch(()=>{});try{return this.adapter?this.adapter.subscribeToCollection(t,s,(r,a)=>{if(r&&this.store)for(const d of r){const f=d.id;f&&this.store.getState().setData(t,f,d)}i(r,a)},e):(i([],new Error("Adapter not initialized")),()=>{})}catch(r){return i([],h(r)),()=>{}}}}const A=n(()=>new p);export{A as getCrudService};
@@ -51,5 +51,5 @@ export interface CrudActions {
51
51
  * @since 0.0.1
52
52
  * @author AMBROISE PARK Consulting
53
53
  */
54
- export declare const useCrudStore: import("zustand").UseBoundStore<import("zustand").StoreApi<CrudState & CrudActions & import("@donotdev/stores").DoNotDevStore>>;
54
+ export declare const useCrudStore: import("zustand").UseBoundStore<import("zustand").StoreApi<CrudState & CrudActions & import("@donotdev/core").DoNotDevStore>>;
55
55
  //# sourceMappingURL=CrudStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CrudStore.d.ts","sourceRoot":"","sources":["../src/CrudStore.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IAExB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAGzC,WAAW,EAAE,MAAM,CACjB,MAAM,EACN;QACE,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,WAAW,EAAE,MAAM,CAAC;KACrB,CACF,CAAC;CACH;AAQD;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAE1B,cAAc,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IA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end:null,crudService:null,collections:{}},d=s({name:"crud-store",createStore:(c,n)=>({...i,setCrudService:t=>{c({crudService:t})},setBackend:t=>{c({backend:t})},setLoading:(t,o)=>{c(e=>{const l=e.collections[t]||{loading:!1,error:null,data:{},lastUpdated:0};return{collections:{...e.collections,[t]:{...l,loading:o}}}})},setError:(t,o)=>{c(e=>{const l=e.collections[t]||{loading:!1,error:null,data:{},lastUpdated:0};return{collections:{...e.collections,[t]:{...l,error:o,loading:!1}}}})},setData:(t,o,e)=>{c(l=>{const r=l.collections[t]||{loading:!1,error:null,data:{},lastUpdated:0};return{collections:{...l.collections,[t]:{...r,data:{...r.data,[o]:e},lastUpdated:Date.now(),error:null}}}})},removeData:(t,o)=>{c(e=>{const l=e.collections[t];if(!l)return e;const{[o]:r,...a}=l.data;return{collections:{...e.collections,[t]:{...l,data:a,lastUpdated:Date.now()}}}})},clearCollection:t=>{c(o=>{const{[t]:e,...l}=o.collections;return{collections:l}})},clearError:t=>{c(o=>{const e=o.collections[t];return e?{collections:{...o.collections,[t]:{...e,error:null}}}:o})},getLoading:t=>n().collections[t]?.loading||!1,getError:t=>n().collections[t]?.error||null,getData:(t,o)=>n().collections[t]?.data[o]||null})});export{d as useCrudStore};
1
+ import{createDoNotDevStore as i}from"@donotdev/core";const d={backend:null,crudService:null,collections:{}},u=i({name:"crud-store",createStore:(r,n)=>({...d,setCrudService:o=>{r({crudService:o})},setBackend:o=>{r({backend:o})},setLoading:(o,l)=>{r(e=>{const t=e.collections[o]||{loading:!1,error:null,data:{},lastUpdated:0};return{collections:{...e.collections,[o]:{...t,loading:l}}}})},setError:(o,l)=>{r(e=>{const t=e.collections[o]||{loading:!1,error:null,data:{},lastUpdated:0};return{collections:{...e.collections,[o]:{...t,error:l,loading:!1}}}})},setData:(o,l,e)=>{r(t=>{const c=t.collections[o]||{loading:!1,error:null,data:{},lastUpdated:0};return{collections:{...t.collections,[o]:{...c,data:{...c.data,[l]:e},lastUpdated:Date.now(),error:null}}}})},removeData:(o,l)=>{r(e=>{const t=e.collections[o];if(!t)return e;const{[l]:c,...a}=t.data;return{collections:{...e.collections,[o]:{...t,data:a,lastUpdated:Date.now()}}}})},clearCollection:o=>{r(l=>{const{[o]:e,...t}=l.collections;return{collections:t}})},clearError:o=>{r(l=>{const e=l.collections[o];return e?{collections:{...l.collections,[o]:{...e,error:null}}}:l})},getLoading:o=>n().collections[o]?.loading||!1,getError:o=>n().collections[o]?.error||null,getData:(o,l)=>n().collections[o]?.data[l]||null})});export{u as useCrudStore};
@@ -1 +1 @@
1
- import*as f from"valibot";import{handleError as y}from"@donotdev/core";import{getFirestore as B,doc as l,getDoc as C,getDocs as q,setDoc as R,updateDoc as b,deleteDoc as A,addDoc as E,collection as v,query as F,where as w,orderBy as m,limit as g,onSnapshot as D}from"@donotdev/firebase";import{transformFirestoreData as d,prepareForFirestore as p}from"@donotdev/firebase";class z{firestore;ensureFirestore(){if(this.firestore)return!0;try{return this.firestore=B(),!0}catch{return!1}}getCollectionRef(s){return!this.ensureFirestore()||!this.firestore?null:v(this.firestore,s)}async get(s,t,r){if(!this.ensureFirestore()||!this.firestore)return null;try{const i=l(this.firestore,s,t),e=await C(i);if(!e.exists())return null;let o=e.data();return o=d(o),{...f.parse(r,o),id:t}}catch{return null}}async set(s,t,r,i){if(!(!this.ensureFirestore()||!this.firestore))try{f.parse(i,r);const e=l(this.firestore,s,t),o=p(r);await R(e,o)}catch(e){throw e}}async update(s,t,r){if(!(!this.ensureFirestore()||!this.firestore))try{const i=l(this.firestore,s,t),e=p(r);await b(i,e)}catch(i){throw i}}async delete(s,t){if(!(!this.ensureFirestore()||!this.firestore))try{const r=l(this.firestore,s,t);await A(r)}catch(r){throw r}}async add(s,t,r){if(!this.ensureFirestore())return"";try{f.parse(r,t);const i=this.getCollectionRef(s);if(!i)return"";const e=p(t);return(await E(i,e)).id}catch(i){throw i}}async query(s,t,r){if(!this.ensureFirestore())return[];const i=this.getCollectionRef(s);if(!i)return[];try{const e=[];if(t.where)for(const n of t.where)e.push(w(n.field,n.operator,n.value));if(t.orderBy)for(const n of t.orderBy)e.push(m(n.field,n.direction||"asc"));t.limit&&e.push(g(t.limit));const o=F(i,...e),c=await q(o),a=[];return c.forEach(n=>{try{let h=n.data();if(!h)return;h=d(h);const u=f.parse(r,h);a.push({...u,id:n.id})}catch(h){y(h,{context:{operation:"FirestoreAdapter.query.parse",docId:n.id,collection:s}})}}),a}catch(e){throw y(e,{context:{operation:"FirestoreAdapter.query",collection:s,options:t}}),e}}subscribe(s,t,r,i){if(!this.ensureFirestore()||!this.firestore)return()=>{};const e=l(this.firestore,s,t);return D(e,o=>{try{if(!o.exists()){r(null);return}let c=o.data();c=d(c);const a=f.parse(i,c);r({...a,id:t})}catch(c){r(null,c)}},o=>{r(null,o)})}subscribeToCollection(s,t,r,i){if(!this.ensureFirestore())return()=>{};const e=this.getCollectionRef(s);if(!e)return()=>{};try{const o=[];if(t.where)for(const a of t.where)o.push(w(a.field,a.operator,a.value));if(t.orderBy)for(const a of t.orderBy)o.push(m(a.field,a.direction||"asc"));t.limit&&o.push(g(t.limit));const c=F(e,...o);return D(c,a=>{try{const n=[];a.forEach(h=>{let u=h.data();u=d(u);const x=f.parse(i,u);n.push({...x,id:h.id})}),r(n)}catch(n){r([],n)}},a=>{r([],a)})}catch(o){return r([],o),()=>{}}}}export{z as FirestoreAdapter};
1
+ import*as d from"valibot";import{handleError as F}from"@donotdev/core";import{getFirestore as D,doc as u,getDoc as x,getDocs as q,setDoc as z,updateDoc as E,deleteDoc as v,addDoc as B,collection as C,query as y,where as m,orderBy as g,limit as w,onSnapshot as A}from"@donotdev/firebase";import{transformFirestoreData as h,prepareForFirestore as p}from"@donotdev/firebase";class P{firestore;ensureFirestore(){if(this.firestore)return!0;try{return this.firestore=D(),!0}catch{return!1}}getCollectionRef(o){return!this.ensureFirestore()||!this.firestore?null:C(this.firestore,o)}async get(o,e,r){if(!this.ensureFirestore()||!this.firestore)return null;try{const s=u(this.firestore,o,e),t=await x(s);if(!t.exists())return null;let i=t.data();return i=h(i),{...d.parse(r,i),id:e}}catch{return null}}async set(o,e,r,s){if(!(!this.ensureFirestore()||!this.firestore))try{d.parse(s,r);const t=u(this.firestore,o,e),i=p(r);await z(t,i)}catch(t){throw t}}async update(o,e,r){if(!(!this.ensureFirestore()||!this.firestore))try{const s=u(this.firestore,o,e),t=p(r);await E(s,t)}catch(s){throw s}}async delete(o,e){if(!(!this.ensureFirestore()||!this.firestore))try{const r=u(this.firestore,o,e);await v(r)}catch(r){throw r}}async add(o,e,r){if(!this.ensureFirestore())return"";try{d.parse(r,e);const s=this.getCollectionRef(o);if(!s)return"";const t=p(e);return(await B(s,t)).id}catch(s){throw s}}async query(o,e,r){if(!this.ensureFirestore())return[];const s=this.getCollectionRef(o);if(!s)return[];try{const t=[];if(e.where)for(const n of e.where)t.push(m(n.field,n.operator,n.value));if(e.orderBy)for(const n of e.orderBy)t.push(g(n.field,n.direction||"asc"));e.limit&&t.push(w(e.limit));const i=y(s,...t),c=await q(i),a=[];return c.forEach(n=>{try{let l=n.data();if(!l)return;l=h(l);const f=d.parse(r,l);a.push({...f,id:n.id})}catch(l){F(l,{context:{operation:"FirestoreAdapter.query.parse",docId:n.id,collection:o}})}}),a}catch(t){throw F(t,{context:{operation:"FirestoreAdapter.query",collection:o,options:e}}),t}}subscribe(o,e,r,s){if(!this.ensureFirestore()||!this.firestore)return()=>{};const t=u(this.firestore,o,e);return A(t,i=>{try{if(!i.exists()){r(null);return}let c=i.data();c=h(c);const a=d.parse(s,c);r({...a,id:e})}catch(c){r(null,c)}},i=>{r(null,i)})}subscribeToCollection(o,e,r,s){if(!this.ensureFirestore())return()=>{};const t=this.getCollectionRef(o);if(!t)return()=>{};try{const i=[];if(e.where)for(const a of e.where)i.push(m(a.field,a.operator,a.value));if(e.orderBy)for(const a of e.orderBy)i.push(g(a.field,a.direction||"asc"));e.limit&&i.push(w(e.limit));const c=y(t,...i);return A(c,a=>{try{const n=[];a.forEach(l=>{let f=l.data();f=h(f);const R=d.parse(s,f);n.push({...R,id:l.id})}),r(n)}catch(n){r([],n)}},a=>{r([],a)})}catch(i){return r([],i),()=>{}}}}export{P as FirestoreAdapter};
@@ -1 +1 @@
1
- import{httpsCallable as i}from"firebase/functions";import*as e from"valibot";import{getPlatformEnvVar as o}from"@donotdev/core";import{getFirebaseFunctions as c}from"@donotdev/firebase";class u{functions;region;constructor(){this.region=o("FIREBASE_FUNCTIONS_REGION")||"europe-west1"}async ensureFunctions(){if(this.functions)return!0;try{return this.functions=await c(this.region),!0}catch{return!1}}async get(r,s,n){if(!await this.ensureFunctions())return null;try{const t=`get_${r}`;return(await i(this.functions,t)({id:s})).data}catch(t){throw t}}async set(r,s,n,t){if(await this.ensureFunctions())try{e.parse(t,n);const a=`update_${r}`;await i(this.functions,a)({id:s,payload:n})}catch(a){throw a}}async update(r,s,n){if(await this.ensureFunctions())try{const t=`update_${r}`;await i(this.functions,t)({id:s,payload:n})}catch(t){throw t}}async delete(r,s){if(await this.ensureFunctions())try{const n=`delete_${r}`;await i(this.functions,n)({id:s})}catch(n){throw n}}async add(r,s,n){if(!await this.ensureFunctions())return"";try{e.parse(n,s);const t=`create_${r}`;return(await i(this.functions,t)({payload:s})).data.id}catch(t){throw t}}async query(r,s,n){if(!await this.ensureFunctions())return[];try{const t=`list_${r}`;return(await i(this.functions,t)({filters:s})).data}catch(t){throw t}}subscribe(){throw new Error("Subscriptions are not supported with Functions backend. Use Firestore backend for real-time features.")}subscribeToCollection(){throw new Error("Subscriptions are not supported with Functions backend. Use Firestore backend for real-time features.")}}export{u as FunctionsAdapter};
1
+ import{httpsCallable as o}from"firebase/functions";import*as i from"valibot";import{getPlatformEnvVar as c}from"@donotdev/core";import{getFirebaseFunctions as u}from"@donotdev/firebase";class p{functions;region;constructor(){this.region=c("FIREBASE_FUNCTIONS_REGION")||"europe-west1"}async ensureFunctions(){if(this.functions)return!0;try{return this.functions=await u(this.region),!0}catch{return!1}}async get(e,r,n){if(!await this.ensureFunctions())return null;try{const t=`get_${e}`;return(await o(this.functions,t)({id:r})).data}catch(t){throw t}}async set(e,r,n,t){if(await this.ensureFunctions())try{i.parse(t,n);const s=`update_${e}`;await o(this.functions,s)({id:r,payload:n})}catch(s){throw s}}async update(e,r,n){if(await this.ensureFunctions())try{const t=`update_${e}`;await o(this.functions,t)({id:r,payload:n})}catch(t){throw t}}async delete(e,r){if(await this.ensureFunctions())try{const n=`delete_${e}`;await o(this.functions,n)({id:r})}catch(n){throw n}}async add(e,r,n){if(!await this.ensureFunctions())return"";try{i.parse(n,r);const t=`create_${e}`;return(await o(this.functions,t)({payload:r})).data.id}catch(t){throw t}}async query(e,r,n){if(!await this.ensureFunctions())return[];try{const t=`list_${e}`;return(await o(this.functions,t)({filters:r})).data}catch(t){throw t}}subscribe(){throw new Error("Subscriptions are not supported with Functions backend. Use Firestore backend for real-time features.")}subscribeToCollection(){throw new Error("Subscriptions are not supported with Functions backend. Use Firestore backend for real-time features.")}}export{p as FunctionsAdapter};
@@ -1 +1 @@
1
- export*from"./FirestoreAdapter";import{FunctionsAdapter as o}from"./FunctionsAdapter";export{o as FunctionsAdapter};
1
+ export*from"./FirestoreAdapter";import{FunctionsAdapter as e}from"./FunctionsAdapter";export{e as FunctionsAdapter};
@@ -1,13 +1,6 @@
1
1
  import { type Control, type FieldErrors, type FieldValues } from 'react-hook-form';
2
2
  import type { FieldConfig, FieldType } from '@donotdev/core';
3
3
  import type { ReactElement } from 'react';
4
- /**
5
- * Common props for all controlled fields
6
- *
7
- * @version 0.0.1
8
- * @since 0.0.1
9
- * @author AMBROISE PARK Consulting
10
- */
11
4
  export interface ControlledFieldProps<T extends FieldValues = any, FT extends FieldType = FieldType> {
12
5
  control: Control<T>;
13
6
  errors: FieldErrors<T>;
@@ -17,140 +10,22 @@ export interface ControlledFieldProps<T extends FieldValues = any, FT extends Fi
17
10
  placeholder?: string;
18
11
  [key: string]: any;
19
12
  }
20
- /**
21
- * Controlled checkbox field component
22
- *
23
- * @version 0.0.1
24
- * @since 0.0.1
25
- * @author AMBROISE PARK Consulting
26
- */
27
- export declare const ControlledCheckboxField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
28
- /**
29
- * Controlled date field component
30
- *
31
- * @version 0.0.1
32
- * @since 0.0.1
33
- * @author AMBROISE PARK Consulting
34
- */
35
- export declare const ControlledDateField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
36
- /**
37
- * Controlled dropdown field component
38
- *
39
- * @version 0.0.1
40
- * @since 0.0.1
41
- * @author AMBROISE PARK Consulting
42
- */
43
- export declare const ControlledDropdownField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
44
- /**
45
- * Controlled file field component
46
- *
47
- * @version 0.0.1
48
- * @since 0.0.1
49
- * @author AMBROISE PARK Consulting
50
- */
51
- export declare const ControlledFileField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
52
- /**
53
- * Controlled geo point field component
54
- *
55
- * @version 0.0.1
56
- * @since 0.0.1
57
- * @author AMBROISE PARK Consulting
58
- */
59
- export declare const ControlledGeoPointField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
60
- /**
61
- * Controlled image field component
62
- *
63
- * @version 0.0.1
64
- * @since 0.0.1
65
- * @author AMBROISE PARK Consulting
66
- */
67
- export declare const ControlledImageField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
68
- /**
69
- * Controlled map field component
70
- *
71
- * @version 0.0.1
72
- * @since 0.0.1
73
- * @author AMBROISE PARK Consulting
74
- */
75
- export declare const ControlledMapField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
76
- /**
77
- * Controlled multi dropdown field component
78
- *
79
- * @version 0.0.1
80
- * @since 0.0.1
81
- * @author AMBROISE PARK Consulting
82
- */
83
- export declare const ControlledMultiDropdownField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
84
- /**
85
- * Controlled multi input field component
86
- *
87
- * @version 0.0.1
88
- * @since 0.0.1
89
- * @author AMBROISE PARK Consulting
90
- */
91
- export declare const ControlledMultiInputField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
92
- /**
93
- * Controlled number field component
94
- *
95
- * @version 0.0.1
96
- * @since 0.0.1
97
- * @author AMBROISE PARK Consulting
98
- */
99
- export declare const ControlledNumberField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
100
- /**
101
- * Controlled phone field component
102
- *
103
- * @version 0.0.1
104
- * @since 0.0.1
105
- * @author AMBROISE PARK Consulting
106
- */
107
- export declare const ControlledPhoneField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
108
- /**
109
- * Controlled range field component
110
- *
111
- * @version 0.0.1
112
- * @since 0.0.1
113
- * @author AMBROISE PARK Consulting
114
- */
115
- export declare const ControlledRangeField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
116
- /**
117
- * Controlled radio field component
118
- *
119
- * @version 0.0.1
120
- * @since 0.0.1
121
- * @author AMBROISE PARK Consulting
122
- */
123
- export declare const ControlledRadioField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
124
- /**
125
- * Controlled reference field component
126
- *
127
- * @version 0.0.1
128
- * @since 0.0.1
129
- * @author AMBROISE PARK Consulting
130
- */
131
- export declare const ControlledReferenceField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
132
- /**
133
- * Controlled text field component
134
- *
135
- * @version 0.0.1
136
- * @since 0.0.1
137
- * @author AMBROISE PARK Consulting
138
- */
139
- export declare const ControlledTextField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
140
- /**
141
- * Controlled password field component
142
- *
143
- * @version 0.0.1
144
- * @since 0.0.1
145
- * @author AMBROISE PARK Consulting
146
- */
147
- export declare const ControlledPasswordField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
148
- /**
149
- * Controlled timestamp field component
150
- *
151
- * @version 0.0.1
152
- * @since 0.0.1
153
- * @author AMBROISE PARK Consulting
154
- */
155
- export declare const ControlledTimestampField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "week" | "month" | "file" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
13
+ export declare const ControlledCheckboxField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
14
+ export declare const ControlledDateField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
15
+ export declare const ControlledDropdownField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
16
+ export declare const ControlledFileField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
17
+ export declare const ControlledGeoPointField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
18
+ export declare const ControlledImageField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
19
+ export declare const ControlledMapField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
20
+ export declare const ControlledMultiDropdownField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
21
+ export declare const ControlledMultiInputField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
22
+ export declare const ControlledNumberField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
23
+ export declare const ControlledPhoneField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
24
+ export declare const ControlledRangeField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
25
+ export declare const ControlledRadioField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
26
+ export declare const ControlledReferenceField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
27
+ export declare const ControlledTextField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
28
+ export declare const ControlledPasswordField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
29
+ export declare const ControlledTimestampField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
30
+ export declare const ControlledAddressField: (props: ControlledFieldProps<any, "number" | "boolean" | "password" | "reference" | "map" | "color" | "array" | "url" | "email" | "submit" | "file" | "week" | "month" | "address" | "avatar" | "badge" | "checkbox" | "date" | "datetime-local" | "geopoint" | "hidden" | "image" | "multiselect" | "radio" | "range" | "reset" | "select" | "tel" | "text" | "textarea" | "time" | "timestamp">) => ReactElement;
156
31
  //# sourceMappingURL=ControlledFields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ControlledFields.d.ts","sourceRoot":"","sources":["../../src/components/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AE,MAAM,KAAK,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAoLD,eAAO,MAAM,uBAAuB,wYArI/B,YA0IF,CAAC;AAEJ,eAAO,MAAM,mBAAmB,wYA5I3B,YAgJJ,CAAC;AAEF,eAAO,MAAM,uBAAuB,wYAlJ/B,YAsJJ,CAAC;AAEF,eAAO,MAAM,mBAAmB,wYAxJ3B,YA4JJ,CAAC;AAEF,eAAO,MAAM,uBAAuB,wYA9J/B,YAmKF,CAAC;AAEJ,eAAO,MAAM,oBAAoB,wYArK5B,YAyKJ,CAAC;AAEF,eAAO,MAAM,kBAAkB,wYA3K1B,YA+KJ,CAAC;AAEF,eAAO,MAAM,4BAA4B,wYAjLpC,YAsLF,CAAC;AAEJ,eAAO,MAAM,yBAAyB,wYAxLjC,YA6LF,CAAC;AAEJ,eAAO,MAAM,qBAAqB,wYA/L7B,YA2MF,CAAC;AAEJ,eAAO,MAAM,oBAAoB,wYA7M5B,YAiNJ,CAAC;AAEF,eAAO,MAAM,oBAAoB,wYAnN5B,YAuNJ,CAAC;AAEF,eAAO,MAAM,oBAAoB,wYAzN5B,YA6NJ,CAAC;AAEF,eAAO,MAAM,wBAAwB,wYA/NhC,YAoOF,CAAC;AAEJ,eAAO,MAAM,mBAAmB,wYAtO3B,YA0OJ,CAAC;AAEF,eAAO,MAAM,uBAAuB,wYA5O/B,YAiPF,CAAC;AAEJ,eAAO,MAAM,wBAAwB,wYAnPhC,YAwPF,CAAC;AAEJ,eAAO,MAAM,sBAAsB,wYA1P9B,YA+PF,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as C}from"react/jsx-runtime";import{useMemo as k}from"react";import{Controller as $}from"react-hook-form";import{handleError as v}from"@donotdev/core";import{CheckboxFieldComponent as G,DateFieldComponent as j,DropdownComponent as S,FileFieldComponent as q,GeoPointFieldComponent as z,ImageFieldComponent as B,MultiDropdownComponent as H,MultiInputTextFieldComponent as J,NumberFieldComponent as K,PhoneNumberComponent as L,PasswordFieldComponent as O,RadioFieldComponent as Q,RangeFieldComponent as U,MapFieldComponent as V,ReferenceFieldComponent as W,TextFieldComponent as X,TimestampFieldComponent as Y}from"./form/fields";function Z(e){if(e){if(e instanceof RegExp)return e;try{const r=/^\/(.*)\/([gimyus]*)$/.exec(e);if(r){const[,n,l]=r;if(n)return new RegExp(n,l)}return new RegExp(e)}catch{return}}}function _(e){if(!e)return{};const r={...e};return e.pattern&&typeof e.pattern=="string"&&(r.pattern={value:Z(e.pattern)||/.*/,message:e.messages?.pattern||"Invalid format"}),r}function o(e,r,n){return function(l){const{control:x,errors:f,fieldConfig:p,t:Ae,onChange:s,placeholder:A,...b}=l,{name:t,label:u,options:d={},validation:g}=p,N=t,w=g?_(g):void 0;return C($,{name:N,control:x,rules:w,render:({field:M})=>{const{value:m,onChange:F,...R}=M,I=(()=>{try{return r?r(m):m}catch(a){return v(a,{userMessage:`Error transforming value for field ${u||t}`,context:{fieldName:t,fieldType:p.type},severity:"warning"}),m}})(),P=a=>{try{const c=n?n(a):a;F(c),s&&s(a)}catch(c){v(c,{userMessage:`Error updating field ${u||t}`,context:{fieldName:t,fieldType:p.type},severity:"warning"}),F(a),s&&s(a)}},{prefixIcon:y,suffixIcon:h,fieldSpecific:T,...D}=d||{},E={...R,...b,label:u,value:I,onChange:P,error:!!f[t],helperText:f[t]?.message||void 0,placeholder:A||d.placeholder,clearable:d.clearable,className:d.className,...T||{},...D,...y&&{prefixIcon:y},...h&&{suffixIcon:h}};return C(e,{...E})}})}}function i(e,r){return function(n){const l=k(()=>{try{return r(n)}catch{return n}},[n]);return C(e,{...l})}}const ee=i(S,e=>({...e,options:Array.isArray(e.options)?e.options:[]})),oe=i(H,e=>({...e,options:Array.isArray(e.options)?e.options:[]})),re=i(W,e=>({...e,options:Array.isArray(e.options)?e.options:[]})),ne=i(Q,e=>({...e,options:Array.isArray(e.options)?e.options:[]})),te=i(L,e=>({...e,phoneNumbers:Array.isArray(e.value)?e.value:[],onPhoneNumberChange:e.onChange})),ae=o(G,e=>!!e,e=>e?.target?.checked),le=o(j,e=>e??null,e=>e?.target?.value),ie=o(ee,e=>e??null,e=>e?.target?.value),se=o(q,e=>e??null,e=>e?.target?.value),de=o(z,e=>e||{lat:0,lng:0},e=>e?.target?.value),pe=o(B,e=>e??null,e=>e?.target?.value),ue=o(V,e=>e||{},e=>e?.target?.value),me=o(oe,e=>Array.isArray(e)?e:[],e=>e?.target?.value),ce=o(J,e=>Array.isArray(e)?e:[],e=>e),Ce=o(K,e=>{const r=Number(e);return Number.isNaN(r)?0:r},e=>{try{return parseFloat(e?.target?.value)}catch{return 0}}),fe=o(te,e=>Array.isArray(e)?e:[],e=>e),ge=o(U,e=>e??null,e=>e),Fe=o(ne,e=>e??null,e=>e),ye=o(re,e=>e??null,e=>e),he=o(X,e=>e??"",e=>e?.target?.value),ve=o(O,e=>e??"",e=>e?.target?.value),xe=o(Y,e=>e??null,e=>e);export{ae as ControlledCheckboxField,le as ControlledDateField,ie as ControlledDropdownField,se as ControlledFileField,de as ControlledGeoPointField,pe as ControlledImageField,ue as ControlledMapField,me as ControlledMultiDropdownField,ce as ControlledMultiInputField,Ce as ControlledNumberField,ve as ControlledPasswordField,fe as ControlledPhoneField,Fe as ControlledRadioField,ge as ControlledRangeField,ye as ControlledReferenceField,he as ControlledTextField,xe as ControlledTimestampField};
1
+ "use client";import{jsx as C}from"react/jsx-runtime";import{useMemo as V}from"react";import{Controller as $}from"react-hook-form";import{handleError as P}from"@donotdev/core";import{CheckboxFieldComponent as j,DateFieldComponent as G,DropdownComponent as O,FileFieldComponent as B,GeoPointFieldComponent as S,ImageFieldComponent as _,MultiDropdownComponent as q,MultiInputTextFieldComponent as z,NumberFieldComponent as H,PhoneNumberComponent as J,PasswordFieldComponent as K,RadioFieldComponent as L,RangeFieldComponent as Q,MapFieldComponent as U,ReferenceFieldComponent as W,TextFieldComponent as X,TimestampFieldComponent as Y,AddressFieldComponent as Z}from"./form/fields";function ee(e){if(e){if(e instanceof RegExp)return e;try{const r=/^\/(.*)\/([gimyus]*)$/.exec(e);if(r){const[,l,a]=r;if(l)return new RegExp(l,a)}return new RegExp(e)}catch{return}}}function oe(e){if(!e)return{};const r={...e};return e.pattern&&typeof e.pattern=="string"&&(r.pattern={value:ee(e.pattern)||/.*/,message:e.messages?.pattern||"Invalid format"}),r}function o(e,r,l){return function(c){const{control:g,errors:x,fieldConfig:u,t:ie,onChange:d,placeholder:R,...v}=c,{name:t,label:p,options:s={},validation:F}=u,w=t,b=F?oe(F):void 0;return C($,{name:w,control:g,rules:b,render:({field:M})=>{const{value:m,onChange:y,...N}=M,D=(()=>{try{return r?r(m):m}catch(n){return P(n,{userMessage:`Error transforming value for field ${p||t}`,context:{fieldName:t,fieldType:u.type},severity:"warning"}),m}})(),E=n=>{try{const f=l?l(n):n;y(f),d&&d(n)}catch(f){P(f,{userMessage:`Error updating field ${p||t}`,context:{fieldName:t,fieldType:u.type},severity:"warning"}),y(n),d&&d(n)}},{prefixIcon:h,suffixIcon:A,fieldSpecific:I,...T}=s||{},k={...N,...v,label:p,value:D,onChange:E,error:!!x[t],helperText:x[t]?.message||void 0,placeholder:R||s.placeholder,clearable:s.clearable,className:s.className,...I||{},...T,...h&&{prefixIcon:h},...A&&{suffixIcon:A}};return C(e,{...k})}})}}function i(e,r){return function(a){const c=V(()=>{try{return r(a)}catch{return a}},[a]);return C(e,{...c})}}const re=i(O,e=>({...e,options:Array.isArray(e.options)?e.options:[]})),te=i(q,e=>({...e,options:Array.isArray(e.options)?e.options:[]})),ne=i(W,e=>e),le=i(L,e=>({...e,options:Array.isArray(e.options)?e.options:[]})),ae=i(J,e=>({...e,phoneNumbers:Array.isArray(e.value)?e.value:[],onPhoneNumberChange:e.onChange})),me=o(j,e=>!!e,e=>e?.target?.checked),fe=o(G,e=>e??null,e=>e?.target?.value),Ce=o(re,e=>e??null,e=>e?.target?.value),ge=o(B,e=>e??null,e=>e?.target?.value),xe=o(S,e=>e||{lat:0,lng:0},e=>e?.target?.value),Fe=o(_,e=>e??null,e=>e?.target?.value),ye=o(U,e=>e||{},e=>e?.target?.value),he=o(te,e=>Array.isArray(e)?e:[],e=>e?.target?.value),Ae=o(z,e=>Array.isArray(e)?e:[],e=>e),Pe=o(H,e=>e??"",e=>{if(e?.target?.value===""||e?.target?.value===null)return null;try{return parseFloat(e?.target?.value)}catch{return 0}}),Re=o(ae,e=>Array.isArray(e)?e:[],e=>e),ve=o(Q,e=>e??null,e=>e),we=o(le,e=>e??null,e=>e),be=o(ne,e=>e??null,e=>e),Me=o(X,e=>e??"",e=>e?.target?.value),Ne=o(K,e=>e??"",e=>e?.target?.value),De=o(Y,e=>e??null,e=>e),Ee=o(Z,e=>e??null,e=>e);export{Ee as ControlledAddressField,me as ControlledCheckboxField,fe as ControlledDateField,Ce as ControlledDropdownField,ge as ControlledFileField,xe as ControlledGeoPointField,Fe as ControlledImageField,ye as ControlledMapField,he as ControlledMultiDropdownField,Ae as ControlledMultiInputField,Pe as ControlledNumberField,Ne as ControlledPasswordField,Re as ControlledPhoneField,we as ControlledRadioField,ve as ControlledRangeField,be as ControlledReferenceField,Me as ControlledTextField,De as ControlledTimestampField};
@@ -1 +1 @@
1
- "use client";import{jsx as o}from"react/jsx-runtime";import{ActionButton as u}from"@donotdev/components";import{useCrud as n}from"../useCrud";function l({requiresAuth:r=!0,user:e,disabled:i=!1,children:s,...t}){const a=n("isAvailable");return o(u,{...t,disabled:i||!a||r&&!e,children:s})}var d=l;export{d as default};
1
+ "use client";import{jsx as l}from"react/jsx-runtime";import{ActionButton as a}from"@donotdev/components";import{useCrud as n}from"../useCrud";function u({requiresAuth:i=!0,user:t,disabled:s=!1,children:e,...o}){const r=n("isAvailable");return l(a,{...o,disabled:s||!r||i&&!t,children:e})}var b=u;export{b as default};
@@ -1 +1 @@
1
- "use client";import{jsx as i,jsxs as g}from"react/jsx-runtime";import{useForm as k}from"react-hook-form";import{Button as n,Stack as b}from"@donotdev/components";import{useTranslation as B}from"@donotdev/core";import{FormFieldRenderer as R}from"./FormFieldRenderer";function v({entity:p,onSubmit:y,t:a,className:S="",submitText:d,isLoading:e=!1,defaultValues:h,submitVariant:u="primary",secondaryButtonText:l,secondaryButtonVariant:V="outline",onSecondarySubmit:m}){const{t:w}=B("dndev"),x=a||w,{control:L,handleSubmit:c,formState:{errors:s,isSubmitting:t},setError:f}=k({defaultValues:h}),N=async r=>{try{await y(r)}catch(o){f("root",{message:o.message||"An error occurred"})}},F=async r=>{if(m)try{await m(r)}catch(o){f("root",{message:o.message||"An error occurred"})}},j=Object.entries(p);return i("form",{onSubmit:c(N),className:S,children:g(b,{gap:"medium",children:[s.root&&i("div",{className:"dndev-surface","data-variant":"destructive",style:{padding:"var(--gap-sm)",fontSize:"var(--font-size-sm)",border:"1px solid var(--destructive)",borderRadius:"var(--radius-lg)",backgroundColor:"var(--muted)",color:"var(--destructive-foreground)"},children:s.root.message}),j.map(([r,o])=>i(R,{name:r,config:o,control:L,errors:s,t:x},r)),l?g(b,{direction:"row",gap:"tight",children:[i(n,{type:"submit",disabled:t||e,variant:u,className:"dndev-w-full",children:t||e?a?a("loading",{defaultValue:"Loading..."}):"Loading...":d||(a?a("submit",{defaultValue:"Submit"}):"Submit")}),i(n,{type:"button",onClick:c(F),disabled:t||e,variant:V,className:"dndev-w-full",children:t||e?a?a("loading",{defaultValue:"Loading..."}):"Loading...":l})]}):i(n,{type:"submit",disabled:t||e,variant:u,className:"dndev-w-full",children:t||e?a?a("loading",{defaultValue:"Loading..."}):"Loading...":d||(a?a("submit",{defaultValue:"Submit"}):"Submit")})]})})}var z=v;export{v as EntityFormRenderer,z as default};
1
+ "use client";import{jsx as o,jsxs as g}from"react/jsx-runtime";import{useForm as k}from"react-hook-form";import{Button as d,Stack as v}from"@donotdev/components";import{useTranslation as R}from"@donotdev/core";import{FormFieldRenderer as z}from"./FormFieldRenderer";function A({entity:b,onSubmit:p,t:r,className:h="",submitText:i,isLoading:e=!1,defaultValues:S,submitVariant:l="primary",secondaryButtonText:u,secondaryButtonVariant:y="outline",onSecondarySubmit:c}){const{t:F}=R("dndev"),w=r||F,{control:j,handleSubmit:m,formState:{errors:s,isSubmitting:a},setError:f}=k({defaultValues:S}),x=async t=>{try{await p(t)}catch(n){f("root",{message:n.message||"An error occurred"})}},V=async t=>{if(c)try{await c(t)}catch(n){f("root",{message:n.message||"An error occurred"})}},N=Object.entries(b);return o("form",{onSubmit:m(x),className:h,children:g(v,{gap:"medium",children:[s.root&&o("div",{className:"dndev-surface","data-variant":"destructive",style:{padding:"var(--gap-sm)",fontSize:"var(--font-size-sm)",border:"1px solid var(--destructive)",borderRadius:"var(--radius-lg)",backgroundColor:"var(--muted)",color:"var(--destructive-foreground)"},children:s.root.message}),N.map(([t,n])=>o(z,{name:t,config:n,control:j,errors:s,t:w},t)),u?g(v,{direction:"row",gap:"tight",children:[o(d,{type:"submit",disabled:a||e,variant:l,className:"dndev-w-full",children:a||e?r?r("loading",{defaultValue:"Loading..."}):"Loading...":i||(r?r("submit",{defaultValue:"Submit"}):"Submit")}),o(d,{type:"button",onClick:m(V),disabled:a||e,variant:y,className:"dndev-w-full",children:a||e?r?r("loading",{defaultValue:"Loading..."}):"Loading...":u})]}):o(d,{type:"submit",disabled:a||e,variant:l,className:"dndev-w-full",children:a||e?r?r("loading",{defaultValue:"Loading..."}):"Loading...":i||(r?r("submit",{defaultValue:"Submit"}):"Submit")})]})})}var B=A;export{A as EntityFormRenderer,B as default};
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldRenderer.d.ts","sourceRoot":"","sources":["../../src/components/FormFieldRenderer.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EAC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AChD,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;AAGD,UAAU,eAAe,CACvB,CAAC,SAAS,SAAS,EACnB,YAAY,SAAS,WAAW,GAAG,WAAW,CAC9C,SAAQ,0BAA0B,CAAC,CAAC,CAAC;IACrC,qCAAqC;IACrC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAGD,MAAM,MAAM,sBAAsB,CAChC,CAAC,SAAS,SAAS,EACnB,YAAY,SAAS,WAAW,GAAG,WAAW,IAC5C,iBAAiB,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAE5D;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,CAAC,SAAS,SAAS,EACnB,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,EACA,IAAI,EACJ,MAAM,EACN,CAAC,EACD,GAAG,KAAK,EACT,EAAE,sBAAsB,CAAC,CAAC,EAAE,YAAY,CAAC,GAAG,YAAY,CA6PxD;AAED,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as e}from"react/jsx-runtime";import{handleError as m}from"@donotdev/core";import{ControlledCheckboxField as h,ControlledDateField as y,ControlledDropdownField as x,ControlledFileField as T,ControlledGeoPointField as w,ControlledImageField as M,ControlledMapField as k,ControlledMultiDropdownField as R,ControlledMultiInputField as D,ControlledNumberField as E,ControlledPasswordField as N,ControlledPhoneField as P,ControlledRangeField as A,ControlledRadioField as B,ControlledReferenceField as I,ControlledTextField as f,ControlledTimestampField as $}from"./ControlledFields";import{AvatarFieldComponent as j,BadgeFieldComponent as G,ButtonFieldComponent as F,HiddenFieldComponent as g,TextAreaComponent as H,TextFieldComponent as U}from"./form/fields";function v({name:l,config:t,t:d,...a}){const p=u=>c=>{try{u(c)}catch(o){m(o,{userMessage:`Error updating field ${t.label||l}`,context:{fieldName:l,fieldType:t.type},severity:"warning"})}};if(t.hidden)return e(g,{name:l,value:"value"in a?a.value:""});if("control"in a&&a.control){const{control:u,errors:c}=a,o={control:u,errors:c,fieldConfig:{...t,label:t.label||l},t:d,onChange:p(C=>{})},r=C=>C;switch(t.type){case"array":return e(D,{...r(o)});case"boolean":case"checkbox":return e(h,{...r(o)});case"date":case"datetime-local":return e(y,{...r(o)});case"file":return e(T,{...r(o)});case"geopoint":return e(w,{...r(o)});case"image":return e(M,{...r(o)});case"map":return e(k,{...r(o)});case"multiselect":return e(R,{...r(o)});case"number":return e(E,{...r(o)});case"radio":return e(B,{...r(o)});case"range":return e(A,{...r(o)});case"reference":return e(I,{...r(o)});case"select":return e(x,{...r(o)});case"tel":return e(P,{...r(o)});case"timestamp":return e($,{...r(o)});case"password":return e(N,{...r(o)});case"text":case"email":case"url":case"color":return e(f,{...r(o)});default:return m(new Error(`Unsupported field type: ${t.type}`),{userMessage:d("errors.unsupportedFieldType",{type:t.type}),context:{fieldName:l,fieldType:t.type},severity:"warning"}),e(f,{...r({...o,fieldConfig:{...t,type:"text"}})})}}const{value:s,onChange:b,error:n}=a,i=p(b);return(()=>{switch(t.type){case"avatar":return e(j,{config:t,value:s,onChange:i,error:!!n,helperText:n||void 0,t:d,...t.options});case"badge":return e(G,{config:t,value:s,onChange:i,error:!!n,helperText:n||void 0,t:d,...t.options});case"submit":return e(F,{label:t.label||l,type:"submit",onClick:()=>i(void 0),...t.options});case"reset":return e(F,{label:t.label||l,type:"reset",onClick:()=>i(void 0),...t.options});case"hidden":return e(g,{name:l,value:s});case"textarea":return e(H,{label:t.label||l,value:s,onChange:i,error:n||void 0,helperText:void 0,...t.options});default:return null}})()||e(U,{label:t.label||l,value:s,onChange:i,error:n||void 0,helperText:void 0,...t.options})}var O=v;export{v as FormFieldRenderer,O as default};
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{handleError as m}from"@donotdev/core";import{ControlledCheckboxField as f,ControlledDateField as v,ControlledDropdownField as T,ControlledFileField as w,ControlledGeoPointField as M,ControlledImageField as k,ControlledMapField as P,ControlledMultiDropdownField as R,ControlledMultiInputField as A,ControlledNumberField as D,ControlledPasswordField as E,ControlledPhoneField as H,ControlledRangeField as N,ControlledRadioField as S,ControlledReferenceField as g,ControlledTextField as h,ControlledTimestampField as j,ControlledAddressField as B}from"./ControlledFields";import{AvatarFieldComponent as I,BadgeFieldComponent as $,ButtonFieldComponent as y,HiddenFieldComponent as b,TextAreaComponent as G,TextFieldComponent as U}from"./form/fields";function _({name:n,config:r,t:s,...d}){const c=u=>p=>{try{u(p)}catch(t){m(t,{userMessage:`Error updating field ${r.label||n}`,context:{fieldName:n,fieldType:r.type},severity:"warning"})}};if(r.hidden)return e(b,{name:n,value:"value"in d?d.value:""});if("control"in d&&d.control){const{control:u,errors:p}=d,t={control:u,errors:p,fieldConfig:{...r,label:r.label||n},t:s,onChange:c(F=>{})},l=F=>F;switch(r.type){case"array":return e(A,{...l(t)});case"boolean":case"checkbox":return e(f,{...l(t)});case"date":case"datetime-local":return e(v,{...l(t)});case"file":return e(w,{...l(t)});case"geopoint":return e(M,{...l(t)});case"image":return e(k,{...l(t)});case"map":return e(P,{...l(t)});case"multiselect":return e(R,{...l(t)});case"number":return e(D,{...l(t)});case"radio":return e(S,{...l(t)});case"range":return e(N,{...l(t)});case"reference":return e(g,{...l(t)});case"select":return e(T,{...l(t)});case"tel":return e(H,{...l(t)});case"timestamp":return e(j,{...l(t)});case"password":return e(E,{...l(t)});case"address":return e(B,{...l(t)});case"text":case"email":case"url":case"color":return e(h,{...l(t)});default:return m(new Error(`Unsupported field type: ${r.type}`),{userMessage:s("errors.unsupportedFieldType",{type:r.type}),context:{fieldName:n,fieldType:r.type},severity:"warning"}),e(h,{...l({...t,fieldConfig:{...r,type:"text"}})})}}const{value:i,onChange:x,error:o}=d,a=c(x),C=(()=>{switch(r.type){case"avatar":return e(I,{config:r,value:i,onChange:a,error:!!o,helperText:o||void 0,t:s,...r.options});case"badge":return e($,{config:r,value:i,onChange:a,error:!!o,helperText:o||void 0,t:s,...r.options});case"submit":return e(y,{label:r.label||n,type:"submit",onClick:()=>a(void 0),...r.options});case"reset":return e(y,{label:r.label||n,type:"reset",onClick:()=>a(void 0),...r.options});case"hidden":return e(b,{name:n,value:i});case"textarea":return e(G,{label:r.label||n,value:i,onChange:a,error:o||void 0,helperText:void 0,...r.options});default:return null}})();return C||e(U,{label:r.label||n,value:i,onChange:a,error:o||void 0,helperText:void 0,...r.options})}var Q=_;export{_ as FormFieldRenderer,Q as default};
@@ -1 +1 @@
1
- "use client";import{jsx as d,jsxs as r,Fragment as N}from"react/jsx-runtime";import{useState as w}from"react";import{FormProvider as C}from"react-hook-form";import{Button as s,BUTTON_VARIANT as j,Spinner as k,cn as z,Stack as n,Grid as F}from"@donotdev/components";import{useTranslation as I}from"@donotdev/core";const L=({title:m,onSubmit:c,children:g,formMethods:u,loading:a=!1,submitText:f,cancelText:v,showCancel:p=!1,onCancel:h,variant:o="default",columns:b=1,description:t})=>{const{t:e}=I("dndev"),[i,l]=w(!1),y=f||e("form.submit","Submit"),x=v||e("form.cancel","Cancel"),S=async T=>{l(!0);try{await c(T)}finally{l(!1)}},B={1:"dndev-grid-cols-1",2:"dndev-grid-cols-1 dndev-md:grid-cols-2",3:"dndev-grid-cols-1 dndev-md:grid-cols-2 dndev-md:grid-cols-3",4:"dndev-grid-cols-1 dndev-md:grid-cols-2 dndev-md:grid-cols-4"};return d(C,{...u,children:d("form",{onSubmit:S,className:z("dndev-mx-auto",{default:"dndev-surface",card:"dndev-surface",minimal:""}[o]),style:o!=="minimal"?{padding:"var(--gap-lg)"}:void 0,role:"form","aria-labelledby":"form-title",noValidate:!0,children:r(n,{gap:"large",children:[r(n,{gap:"tight",children:[d("h2",{id:"form-title",style:{fontSize:"var(--font-size-2xl)",fontWeight:600,color:"var(--foreground)"},children:m}),t&&d("p",{style:{color:"var(--muted-foreground)"},children:t})]}),d(F,{cols:b,gap:"medium",className:"dndev-w-full dndev-min-w-0",children:g}),r(n,{direction:"row",align:"center",justify:"end",gap:"medium",style:{paddingTop:"var(--gap-md)",borderTop:"1px solid var(--border)"},children:[p&&d(s,{type:"button",variant:j.OUTLINE,onClick:h,disabled:a||i,children:x}),d(s,{type:"submit",disabled:a||i,style:{minWidth:"120px"},children:a||i?r(N,{children:[d(k,{className:"me-component-gap"}),i?e("form.submitting","Submitting..."):e("form.loading","Loading...")]}):y})]})]})})})};var A=L;export{A as default};
1
+ "use client";import{jsx as e,jsxs as r,Fragment as N}from"react/jsx-runtime";import{useState as j}from"react";import{FormProvider as w}from"react-hook-form";import{Button as s,BUTTON_VARIANT as C,Spinner as F,cn as _,Stack as i,Grid as I}from"@donotdev/components";import{useTranslation as L}from"@donotdev/core";const k=({title:m,onSubmit:c,children:u,formMethods:f,loading:n=!1,submitText:g,cancelText:v,showCancel:p=!1,onCancel:b,variant:l="default",columns:h=1,description:o})=>{const{t:d}=L("dndev"),[t,a]=j(!1),y=g||d("form.submit","Submit"),S=v||d("form.cancel","Cancel"),x=async T=>{a(!0);try{await c(T)}finally{a(!1)}},z={1:"dndev-grid-cols-1",2:"dndev-grid-cols-1 dndev-md:grid-cols-2",3:"dndev-grid-cols-1 dndev-md:grid-cols-2 dndev-md:grid-cols-3",4:"dndev-grid-cols-1 dndev-md:grid-cols-2 dndev-md:grid-cols-4"};return e(w,{...f,children:e("form",{onSubmit:x,className:_("dndev-mx-auto",{default:"dndev-surface",card:"dndev-surface",minimal:""}[l]),style:l!=="minimal"?{padding:"var(--gap-lg)"}:void 0,role:"form","aria-labelledby":"form-title",noValidate:!0,children:r(i,{gap:"large",children:[r(i,{gap:"tight",children:[e("h2",{id:"form-title",style:{fontSize:"var(--font-size-2xl)",fontWeight:600,color:"var(--foreground)"},children:m}),o&&e("p",{style:{color:"var(--muted-foreground)"},children:o})]}),e(I,{cols:h,gap:"medium",className:"dndev-w-full dndev-min-w-0",children:u}),r(i,{direction:"row",align:"center",justify:"end",gap:"medium",style:{paddingTop:"var(--gap-md)",borderTop:"1px solid var(--border)"},children:[p&&e(s,{type:"button",variant:C.OUTLINE,onClick:b,disabled:n||t,children:S}),e(s,{type:"submit",disabled:n||t,style:{minWidth:"120px"},children:n||t?r(N,{children:[e(F,{className:"me-component-gap"}),t?d("form.submitting","Submitting..."):d("form.loading","Loading...")]}):y})]})]})})})};var E=k;export{E as default};
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Address field component props
3
+ */
4
+ export interface AddressFieldComponentProps {
5
+ /** Field label */
6
+ label: string;
7
+ /** Address value with formatted address and coordinates */
8
+ value?: {
9
+ formatted_address: string;
10
+ latitude?: number;
11
+ longitude?: number;
12
+ [key: string]: any;
13
+ };
14
+ /** Change handler */
15
+ onChange: (value: any) => void;
16
+ /**
17
+ * Whether to enable Google Maps autocomplete (default: false)
18
+ * Requires env var: VITE_GOOGLE_MAPS_API_KEY (Vite) or NEXT_PUBLIC_GOOGLE_MAPS_API_KEY (Next.js)
19
+ */
20
+ enableGoogleMaps?: boolean;
21
+ /** Whether to extract district code for Paris addresses */
22
+ extractDistrictCode?: boolean;
23
+ /** Error state */
24
+ error?: boolean;
25
+ /** Helper text */
26
+ helperText?: string;
27
+ }
28
+ /**
29
+ * Address field component with Google Maps autocomplete
30
+ * Integrates with Google Places API for address selection
31
+ *
32
+ * Environment variables required for Google Maps:
33
+ * - Vite: VITE_GOOGLE_MAPS_API_KEY
34
+ * - Next.js: NEXT_PUBLIC_GOOGLE_MAPS_API_KEY
35
+ *
36
+ * @component
37
+ * @param {AddressFieldComponentProps} props - Component props
38
+ * @returns {JSX.Element} Address input field with autocomplete
39
+ */
40
+ declare const AddressFieldComponent: ({ label, value, onChange, enableGoogleMaps, extractDistrictCode, error, helperText, }: AddressFieldComponentProps) => import("react/jsx-runtime").JSX.Element;
41
+ export default AddressFieldComponent;
42
+ //# sourceMappingURL=AddressFieldComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AddressFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/AddressFieldComponent.tsx"],"names":[],"mappings":"AAsBA;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,KAAK,CAAC,EAAE;QACN,iBAAiB,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,2DAA2D;IAC3D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,qBAAqB,GAAI,uFAQ5B,0BAA0B,4CAsQ5B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1 @@
1
+ import{jsx as n,jsxs as y}from"react/jsx-runtime";import{useState as v,useEffect as C,useRef as P}from"react";import{Input as M,Popover as x,Command as q,Stack as j}from"@donotdev/components";import{useTranslation as D,getPlatformEnvVar as W}from"@donotdev/core";import{MapPin as Y}from"lucide-react";const $=({label:b,value:l,onChange:E,enableGoogleMaps:A=!1,extractDistrictCode:T,error:p,helperText:m})=>{const{t:r}=D(),[u,a]=v(!1),[c,g]=v(l?.formatted_address||""),[G,h]=v([]),[I,f]=v(!1),_=P(null),w=P(null),i=P(null),S=W("GOOGLE_MAPS_API_KEY")||"",d=A&&!!S,K=e=>{w.current&&(f(!0),w.current.getDetails({placeId:e,fields:["formatted_address","geometry","address_components"]},(t,o)=>{if(f(!1),o===window.google?.maps?.places?.PlacesServiceStatus.OK&&t){const s=t.formatted_address||"",k=t.geometry?.location?.lat(),L=t.geometry?.location?.lng(),O={formatted_address:s,latitude:k,longitude:L};if(T&&t.address_components){const z=t.address_components.find(F=>F.types.includes("postal_code"))?.long_name||"",V=z.startsWith("92")?92:parseInt(z.slice(-2),10)||null;O.district_code=V}g(s),E(O),a(!1)}}))};C(()=>{l?.formatted_address&&g(l.formatted_address)},[l]),C(()=>{if(!d)return;const e=()=>{if(window.google?.maps?.places){t();return}if(document.querySelector("#google-maps-script")){const s=setInterval(()=>{window.google?.maps?.places&&(clearInterval(s),t())},100);return}const o=document.createElement("script");o.id="google-maps-script",o.src=`https://maps.googleapis.com/maps/api/js?key=${S}&libraries=places`,o.async=!0,o.defer=!0,o.onload=()=>t(),document.head.appendChild(o)},t=()=>{window.google?.maps?.places&&(_.current=new window.google.maps.places.AutocompleteService,w.current=new window.google.maps.places.PlacesService(document.createElement("div")))};e()},[d,S]),C(()=>{if(!d||!c||!_.current||!u){h([]);return}return i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{f(!0),_.current.getPlacePredictions({input:c,types:["geocode","establishment"]},(e,t)=>{if(f(!1),t===window.google?.maps?.places?.PlacesServiceStatus.OK&&e){const o=e.map(s=>({label:s.description,value:s.place_id,description:s.structured_formatting?.secondary_text,icon:n(Y,{style:{width:"var(--size-icon-sm)",height:"var(--size-icon-sm)"}}),onSelect:()=>K(s.place_id)}));h(o)}else h([])})},300),()=>{i.current&&clearTimeout(i.current)}},[d,c,u]);const R=e=>{g(e),E({formatted_address:e})};return d?y(j,{gap:"tight",children:[y(x,{open:u,onOpenChange:a,children:[n(x.Trigger,{asChild:!0,children:n(M,{type:"text",label:b,value:c,onChange:e=>{g(e.target.value),u||a(!0)},onFocus:()=>a(!0),placeholder:r("common.address_placeholder"),"data-variant":p?"destructive":void 0,disabled:I})}),n(x.Content,{style:{width:"var(--radix-popover-trigger-width)",padding:0},children:n(q,{placeholder:r("common.search_placeholder"),emptyMessage:r(I?"common.loading":"common.no_results"),items:G,onClose:()=>a(!1)})})]}),m&&n("p",{style:{fontSize:"var(--font-size-xs)",color:p?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:m})]}):y(j,{gap:"tight",children:[n(M,{type:"text",label:b,value:c,onChange:e=>R(e.target.value),placeholder:r("common.address_placeholder"),"data-variant":p?"destructive":void 0}),m&&n("p",{style:{fontSize:"var(--font-size-xs)",color:p?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:m})]})};var X=$;export{X as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Avatar as p,Input as u,cn as g,Stack as n}from"@donotdev/components";const s=({config:r,value:t,onChange:c,error:A,helperText:l,t:i,className:d,...m})=>{const v=a=>a.split(" ").map(h=>h.charAt(0)).slice(0,2).join("").toUpperCase();return o(n,{gap:"medium",children:[o(n,{direction:"row",align:"center",gap:"medium",children:[e(p,{src:t,alt:r.label||"Avatar",fallback:v(r.label||"AV"),style:{height:"var(--touch-target)",width:"var(--touch-target)"}}),e("div",{className:"dndev-flex-1",children:e(u,{type:"url",className:g("dndev-w-full",d),placeholder:i("common.enterAvatarUrl"),value:t,onChange:a=>c(a.target.value),...m})})]}),l&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:l})]})};var f=s;export{s as AvatarFieldComponent,f as default};
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Avatar as u,Input as v,cn as h,Stack as n}from"@donotdev/components";const g=({config:t,value:a,onChange:s,error:f,helperText:l,t:i,className:c,...d})=>{const m=r=>r.split(" ").map(p=>p.charAt(0)).slice(0,2).join("").toUpperCase();return o(n,{gap:"medium",children:[o(n,{direction:"row",align:"center",gap:"medium",children:[e(u,{src:a,alt:t.label||"Avatar",fallback:m(t.label||"AV"),style:{height:"var(--touch-target)",width:"var(--touch-target)"}}),e("div",{className:"dndev-flex-1",children:e(v,{type:"url",className:h("dndev-w-full",c),placeholder:i("common.enterAvatarUrl"),value:a,onChange:r=>s(r.target.value),...d})})]}),l&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:l})]})};var j=g;export{g as AvatarFieldComponent,j as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Badge as g,Input as v,cn as p,Stack as d}from"@donotdev/components";const l=({config:f,value:a,onChange:o,error:h,helperText:t,t:n,variant:s="default",className:i,...m})=>r(d,{gap:"medium",children:[r(d,{direction:"row",align:"center",gap:"medium",children:[e(g,{variant:s,style:{minWidth:0},children:a||n("common.badgePreview")}),e("div",{className:"dndev-flex-1",children:e(v,{type:"text",className:p("dndev-w-full",i),placeholder:n("common.enterBadgeText"),value:a,onChange:c=>o(c.target.value),...m})})]}),t&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:t})]});var u=l;export{l as BadgeFieldComponent,u as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Badge as s,Input as g,cn as f,Stack as a}from"@donotdev/components";const p=({config:u,value:r,onChange:d,error:v,helperText:n,t:o,variant:i="default",className:l,...m})=>t(a,{gap:"medium",children:[t(a,{direction:"row",align:"center",gap:"medium",children:[e(s,{variant:i,style:{minWidth:0},children:r||o("common.badgePreview")}),e("div",{className:"dndev-flex-1",children:e(g,{type:"text",className:f("dndev-w-full",l),placeholder:o("common.enterBadgeText"),value:r,onChange:c=>d(c.target.value),...m})})]}),n&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:n})]});var j=p;export{p as BadgeFieldComponent,j as default};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import"react";import{Button as l}from"@donotdev/components";const d=({label:a,type:t,onClick:i,variant:o,disabled:r=!1})=>e(l,{type:t,onClick:i,variant:o,disabled:r,children:a});var n=d;export{n as default};
1
+ import{jsx as i}from"react/jsx-runtime";import"react";import{Button as m}from"@donotdev/components";const a=({label:t,type:o,onClick:r,variant:e,disabled:n=!1})=>i(m,{type:o,onClick:r,variant:e,disabled:n,children:t});var d=a;export{d as default};
@@ -1 +1 @@
1
- import{jsx as a,jsxs as h}from"react/jsx-runtime";import{Checkbox as o,Label as s,Stack as n}from"@donotdev/components";const i=({label:c,checked:r=!1,onChange:e})=>h(n,{direction:"row",align:"center",gap:"tight",children:[a(o,{checked:r,onCheckedChange:t=>{e&&e({target:{checked:t}})}}),a(s,{children:c})]});var d=i;export{d as default};
1
+ import{jsx as t,jsxs as r}from"react/jsx-runtime";import{Checkbox as c,Label as h,Stack as s}from"@donotdev/components";const i=({label:n,checked:a=!1,onChange:e})=>r(s,{direction:"row",align:"center",gap:"tight",children:[t(c,{checked:a,onCheckedChange:o=>{e&&e({target:{checked:o}})}}),t(h,{children:n})]});var g=i;export{g as default};
@@ -1 +1 @@
1
- import{jsx as r,jsxs as S}from"react/jsx-runtime";import{Input as p,Label as u,Stack as f}from"@donotdev/components";const m=({label:i,value:o,onChange:l,error:s,helperText:n,mode:e="date",...g})=>{const c=t=>{const d=t.target.value?new Date(t.target.value).toISOString():null;l(d)};let a="";if(o){const t=new Date(o);e==="date"?a=t.toISOString().split("T")[0]||"":e==="datetime-local"?a=t.toISOString().slice(0,16)||"":e==="month"?a=t.toISOString().slice(0,7):e==="time"?a=t.toISOString().slice(11,16):e==="week"&&(a=t.toISOString().split("T")[0]||"")}return S(f,{gap:"tight",children:[r(u,{style:{display:"block",fontSize:"var(--font-size-sm)",fontWeight:500},children:i}),r(p,{type:e,value:a,onChange:c,className:"dndev-w-full",...g}),n&&r("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:n})]})};var v=m;export{v as default};
1
+ import{jsx as n,jsxs as S}from"react/jsx-runtime";import{Input as d,Label as p,Stack as u}from"@donotdev/components";const h=({label:s,value:a,onChange:r,error:o,helperText:l,mode:e="date",...c})=>{const f=t=>{const g=t.target.value?new Date(t.target.value).toISOString():null;r(g)};let i="";if(a){const t=new Date(a);e==="date"?i=t.toISOString().split("T")[0]||"":e==="datetime-local"?i=t.toISOString().slice(0,16)||"":e==="month"?i=t.toISOString().slice(0,7):e==="time"?i=t.toISOString().slice(11,16):e==="week"&&(i=t.toISOString().split("T")[0]||"")}return S(u,{gap:"tight",children:[n(p,{style:{display:"block",fontSize:"var(--font-size-sm)",fontWeight:500},children:s}),n(d,{type:e,value:i,onChange:f,className:"dndev-w-full",...c}),l&&n("p",{style:{fontSize:"var(--font-size-xs)",color:o?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:l})]})};var O=h;export{O as default};
@@ -1 +1 @@
1
- import{jsx as a,jsxs as l}from"react/jsx-runtime";import{Select as p,Label as m,Stack as f}from"@donotdev/components";import{useTranslation as h}from"@donotdev/core";const S=({label:s,value:t,options:i,error:u,helperText:o,onChange:n,onBlur:v,required:c})=>{const{t:r}=h("dndev"),d=t!==void 0?String(t):"",g=e=>{n&&n({target:{value:e}})};return l(f,{gap:"tight",children:[l(m,{style:{display:"block",fontSize:"var(--font-size-sm)",fontWeight:500},children:[r(s),c&&a("span",{style:{color:"var(--destructive-foreground)",marginInlineStart:"var(--gap-sm)"},children:"*"})]}),a(p,{value:d,onValueChange:g,onOpenChange:e=>!e&&v?.(),placeholder:r("actions.select","Select"),options:i.map(e=>({value:String(e.value),label:r(e.label)}))}),o&&a("p",{style:{fontSize:"var(--font-size-xs)",color:u?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:o})]})};var b=S;export{b as default};
1
+ import{jsx as n,jsxs as s}from"react/jsx-runtime";import{Select as v,Label as f,Stack as m}from"@donotdev/components";import{useTranslation as h}from"@donotdev/core";const S=({label:l,value:r,options:i,error:c,helperText:a,onChange:o,onBlur:d,required:p})=>{const{t}=h("dndev"),g=r!==void 0?String(r):"",u=e=>{o&&o({target:{value:e}})};return s(m,{gap:"tight",children:[s(f,{style:{display:"block",fontSize:"var(--font-size-sm)",fontWeight:500},children:[t(l),p&&n("span",{style:{color:"var(--destructive-foreground)",marginInlineStart:"var(--gap-sm)"},children:"*"})]}),n(v,{value:g,onValueChange:u,onOpenChange:e=>!e&&d?.(),placeholder:t("actions.select","Select"),options:i.map(e=>({value:String(e.value),label:t(e.label)}))}),a&&n("p",{style:{fontSize:"var(--font-size-xs)",color:c?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:a})]})};var C=S;export{C as default};