@donotdev/crud 0.0.27 → 0.0.28
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/CrudService.js +2 -2
- package/dist/CrudStore.js +1 -1
- package/dist/FieldRegistry.js +1 -1
- package/dist/adapters/FunctionsAdapter.js +1 -1
- package/dist/components/CrudButton.js +1 -1
- package/dist/components/CrudCard.js +1 -1
- package/dist/components/DateFilter.js +1 -1
- package/dist/components/DisplayFieldRenderer.js +1 -1
- package/dist/components/DisplayThumbnail.js +1 -1
- package/dist/components/EntityFilters.js +1 -1
- package/dist/components/FormFieldRenderer.js +1 -1
- package/dist/components/FormLayout.js +1 -1
- package/dist/components/controlled/complex/ControlledAddressField.js +1 -1
- package/dist/components/controlled/complex/ControlledDateField.js +1 -1
- package/dist/components/controlled/complex/ControlledFieldArrayField.js +1 -1
- package/dist/components/controlled/complex/ControlledGeoPointField.js +1 -1
- package/dist/components/controlled/complex/ControlledMapField.js +1 -1
- package/dist/components/controlled/complex/ControlledMultiInputField.js +1 -1
- package/dist/components/controlled/complex/ControlledRichTextField.js +1 -1
- package/dist/components/controlled/complex/ControlledTimestampField.js +1 -1
- package/dist/components/controlled/complex/index.js +1 -1
- package/dist/components/controlled/file/ControlledDocumentField.js +1 -1
- package/dist/components/controlled/file/ControlledFileField.js +1 -1
- package/dist/components/controlled/file/ControlledImageField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiDocumentField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiFileField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiImageField.js +1 -1
- package/dist/components/controlled/file/index.js +1 -1
- package/dist/components/controlled/index.js +1 -1
- package/dist/components/controlled/input/ControlledCheckboxField.js +1 -1
- package/dist/components/controlled/input/ControlledCurrencyField.js +1 -1
- package/dist/components/controlled/input/ControlledDurationField.js +1 -1
- package/dist/components/controlled/input/ControlledGdprConsentField.js +1 -1
- package/dist/components/controlled/input/ControlledNumberField.js +1 -1
- package/dist/components/controlled/input/ControlledPasswordField.js +1 -1
- package/dist/components/controlled/input/ControlledPhoneField.js +1 -1
- package/dist/components/controlled/input/ControlledPriceField.js +1 -1
- package/dist/components/controlled/input/ControlledRangeField.js +1 -1
- package/dist/components/controlled/input/ControlledRatingField.js +1 -1
- package/dist/components/controlled/input/ControlledSwitchField.js +1 -1
- package/dist/components/controlled/input/ControlledTextField.js +1 -1
- package/dist/components/controlled/input/ControlledTextareaField.js +1 -1
- package/dist/components/controlled/input/index.js +1 -1
- package/dist/components/controlled/select/ControlledComboboxField.js +1 -1
- package/dist/components/controlled/select/ControlledDropdownField.js +1 -1
- package/dist/components/controlled/select/ControlledMultiDropdownField.js +1 -1
- package/dist/components/controlled/select/ControlledRadioField.js +1 -1
- package/dist/components/controlled/select/ControlledReferenceField.js +1 -1
- package/dist/components/controlled/select/ControlledYearField.js +1 -1
- package/dist/components/controlled/select/index.js +1 -1
- package/dist/components/controlled/types.js +1 -1
- package/dist/components/fields/display/AvatarFieldDisplay.js +1 -1
- package/dist/components/fields/display/BadgeFieldDisplay.js +1 -1
- package/dist/components/fields/display/ButtonFieldDisplay.js +1 -1
- package/dist/components/fields/display/CheckboxFieldDisplay.js +1 -1
- package/dist/components/fields/display/DateFieldDisplay.js +1 -1
- package/dist/components/fields/display/DropdownDisplay.js +1 -1
- package/dist/components/fields/display/FileFieldDisplay.js +1 -1
- package/dist/components/fields/display/GeoPointFieldDisplay.js +1 -1
- package/dist/components/fields/display/HiddenFieldDisplay.js +1 -1
- package/dist/components/fields/display/ImageFieldDisplay.js +1 -1
- package/dist/components/fields/display/LinkFieldDisplay.js +1 -1
- package/dist/components/fields/display/MapFieldDisplay.js +1 -1
- package/dist/components/fields/display/MultiDropdownDisplay.js +1 -1
- package/dist/components/fields/display/MultiInputTextFieldDisplay.js +1 -1
- package/dist/components/fields/display/NumberFieldDisplay.js +1 -1
- package/dist/components/fields/display/PasswordFieldDisplay.js +1 -1
- package/dist/components/fields/display/PhoneNumberDisplay.js +1 -1
- package/dist/components/fields/display/RadioFieldDisplay.js +1 -1
- package/dist/components/fields/display/RangeFieldDisplay.js +1 -1
- package/dist/components/fields/display/ReferenceFieldDisplay.js +1 -1
- package/dist/components/fields/display/RichTextDisplay.js +2 -2
- package/dist/components/fields/display/TextAreaDisplay.js +1 -1
- package/dist/components/fields/display/TextFieldDisplay.js +1 -1
- package/dist/components/fields/display/TimestampFieldDisplay.js +1 -1
- package/dist/components/fields/display/index.js +1 -1
- package/dist/components/form/fields/AddressFieldComponent.js +1 -1
- package/dist/components/form/fields/AvatarFieldComponent.js +1 -1
- package/dist/components/form/fields/BadgeFieldComponent.js +1 -1
- package/dist/components/form/fields/ButtonFieldComponent.js +1 -1
- package/dist/components/form/fields/CheckboxFieldComponent.js +1 -1
- package/dist/components/form/fields/ComboboxComponent.js +1 -1
- package/dist/components/form/fields/CurrencyFieldComponent.js +1 -1
- package/dist/components/form/fields/DateFieldComponent.js +1 -1
- package/dist/components/form/fields/DocumentFieldComponent.js +1 -1
- package/dist/components/form/fields/DropdownComponent.js +1 -1
- package/dist/components/form/fields/DurationFieldComponent.js +1 -1
- package/dist/components/form/fields/FileFieldComponent.js +1 -1
- package/dist/components/form/fields/GdprConsentFieldComponent.js +1 -1
- package/dist/components/form/fields/GeoPointFieldComponent.js +1 -1
- package/dist/components/form/fields/HiddenFieldComponent.js +1 -1
- package/dist/components/form/fields/ImageFieldComponent.js +1 -1
- package/dist/components/form/fields/MapFieldComponent.js +1 -1
- package/dist/components/form/fields/MultiDropdownComponent.js +1 -1
- package/dist/components/form/fields/MultiInputTextFieldComponent.js +1 -1
- package/dist/components/form/fields/NumberFieldComponent.js +1 -1
- package/dist/components/form/fields/PasswordFieldComponent.js +1 -1
- package/dist/components/form/fields/PhoneNumberComponent.js +1 -1
- package/dist/components/form/fields/PriceFieldComponent.js +1 -1
- package/dist/components/form/fields/RadioFieldComponent.js +1 -1
- package/dist/components/form/fields/RangeFieldComponent.js +1 -1
- package/dist/components/form/fields/RatingFieldComponent.js +1 -1
- package/dist/components/form/fields/ReferenceFieldComponent.js +1 -1
- package/dist/components/form/fields/RichTextComponent.js +1 -1
- package/dist/components/form/fields/SwitchFieldComponent.js +1 -1
- package/dist/components/form/fields/TextAreaComponent.js +1 -1
- package/dist/components/form/fields/TextFieldComponent.js +1 -1
- package/dist/components/form/fields/TimestampFieldComponent.js +1 -1
- package/dist/components/form/fields/index.js +1 -1
- package/dist/components/form/fields/internal/TiptapEditor.js +2 -2
- package/dist/components/form/internal/ImageViewerDialog.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/contexts/UploadContext.js +1 -1
- package/dist/contexts/index.js +1 -1
- package/dist/fieldTypeRegistry.js +1 -1
- package/dist/fieldTypeRegistry.store.js +1 -1
- package/dist/forms/hooks/index.js +1 -1
- package/dist/forms/hooks/useController.js +1 -1
- package/dist/forms/hooks/useEntityField.js +1 -1
- package/dist/forms/hooks/useEntityForm.js +1 -1
- package/dist/forms/index.js +1 -1
- package/dist/forms/utils/buildInitialValues.js +1 -1
- package/dist/forms/utils/getFieldsForOperation.js +1 -1
- package/dist/forms/utils/index.js +1 -1
- package/dist/forms/utils/isFieldEditable.js +1 -1
- package/dist/forms/utils/translateFieldLabel.js +1 -1
- package/dist/forms/utils/validateEntity.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useCrudFilters.js +1 -1
- package/dist/hooks/useEntityFavorites.js +1 -1
- package/dist/hooks/useFieldConditions.js +1 -1
- package/dist/hooks/useFileUpload.js +1 -1
- package/dist/hooks/useReferenceResolver.js +1 -1
- package/dist/hooks/useRelatedItems.js +1 -1
- package/dist/hooks/useUnsavedChangesWarning.js +1 -1
- package/dist/index.js +1 -1
- package/dist/registerBuiltinFieldTypes.d.ts.map +1 -1
- package/dist/registerBuiltinFieldTypes.js +1 -1
- package/dist/stores/FormStore.js +1 -1
- package/dist/stores/UploadStore.js +1 -1
- package/dist/stores/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.js +1 -1
- package/dist/useBaseCrudList.js +1 -1
- package/dist/useCrud.js +1 -1
- package/dist/useCrudCardList.js +1 -1
- package/dist/useCrudList.js +1 -1
- package/dist/utils/clientListProcessing.js +1 -1
- package/dist/utils/collections.js +1 -1
- package/dist/utils/fileStorage.js +1 -1
- package/dist/utils/imageProcessing.js +1 -1
- package/dist/utils/imageStorage.js +1 -1
- package/dist/utils/imageUtils.js +1 -1
- package/dist/utils/matchesFilter.js +1 -1
- package/dist/utils/mergeWithOptimistic.js +1 -1
- package/dist/utils/sanitizeHtml.js +1 -1
- package/dist/utils/scopeUtils.js +1 -1
- package/dist/utils/uploadValidation.js +1 -1
- package/dist/workflows/WorkflowPersistence.js +1 -1
- package/dist/workflows/defineWorkflow.js +1 -1
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/useEntityWorkflow.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{RangeFieldComponent as c}from"../../form/fields";import{convertValidationRules as g}from"../types";function v(m){const{control:s,errors:n,fieldConfig:l,t:u}=m,{name:o,label:d,validation:e}=l,i=l.options||{},p=i.fieldSpecific;return t(f,{name:o,control:s,rules:e?g(e):void 0,render:({field:r})=>t(c,{label:u(d),value:r.value??void 0,onChange:a=>{typeof a=="number"?r.onChange(a):r.onChange(Number(a.target.value)||0)},error:!!n[o],helperText:n[o]?.message,required:e?.required,min:e?.min,max:e?.max,step:i.step,showValue:p?.showValue})})}export{v as ControlledRangeField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as i}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{RatingFieldComponent as p}from"../../form/fields";import{convertValidationRules as c}from"../types";function g(t){const{control:s,errors:r,fieldConfig:a,t:m}=t,{name:o,label:d,validation:e}=a,l=(a.options||{}).fieldSpecific;return i(f,{name:o,control:s,rules:e?c(e):void 0,render:({field:n})=>i(p,{label:m(d),value:n.value??0,onChange:u=>{n.onChange(u)},error:!!r[o],helperText:r[o]?.message,required:e?.required,max:l?.max??e?.max??5,showValue:l?.showValue})})}export{g as ControlledRatingField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as d}from"react/jsx-runtime";import{Controller as v}from"react-hook-form";import{SwitchFieldComponent as x}from"../../form/fields";import"../types";function S(h){const{control:s,errors:m,fieldConfig:u,t:o,onChange:n}=h,{name:l,label:f,options:p={}}=u,e=p.fieldSpecific,k=e?.uncheckedValue??!1,r=e?.checkedValue??!0,t=e?.uncheckedLabel,a=e?.checkedLabel;return d(v,{name:l,control:s,render:({field:{value:g,onChange:C}})=>{const b=g===r,L=c=>{const i=c?r:k;C(i),n&&n(i)};return d(x,{label:o(f),checked:b,onChange:c=>L(c.target.checked),uncheckedLabel:t?o(t):void 0,checkedLabel:a?o(a):void 0,helperText:m[l]?.message})}})}export{S as ControlledSwitchField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{TextFieldComponent as u}from"../../form/fields";import{convertValidationRules as h}from"../types";function C(i){const{control:s,errors:t,fieldConfig:e,t:m,placeholder:p}=i,{name:r,label:d,validation:o,options:l={}}=e;return n(c,{name:r,control:s,rules:o?h(o):void 0,render:({field:a})=>n(u,{...a,label:m(d),value:a.value??"",onChange:a.onChange,error:t[r]?.message,helperText:t[r]?.message,type:e.type==="email"?"email":e.type==="url"?"url":e.type==="color"?"color":"text",required:o?.required,placeholder:p||l.placeholder,maxLength:o?.maxLength,showCharCount:l.showCharCount,className:l.className})})}export{C as ControlledTextField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as h}from"react-hook-form";import{TextAreaComponent as c}from"../../form/fields";import{convertValidationRules as p}from"../types";function C(s){const{control:i,errors:l,fieldConfig:t,t:m,placeholder:d}=s,{name:r,label:u,validation:o}=t,e=t.options||{};return n(h,{name:r,control:i,rules:o?p(o):void 0,render:({field:a})=>n(c,{...a,label:m(u),value:a.value??"",onChange:a.onChange,error:l[r]?.message,helperText:l[r]?.message,required:o?.required,placeholder:d||e.placeholder,maxLength:o?.maxLength,showCharCount:e.showCharCount,autoResize:e.autoResize,rows:e.rows,className:e.className})})}export{C as ControlledTextareaField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ControlledCheckboxField as
|
|
1
|
+
import{ControlledCheckboxField as o}from"./ControlledCheckboxField";import{ControlledCurrencyField as l}from"./ControlledCurrencyField";import{ControlledNumberField as e}from"./ControlledNumberField";import{ControlledPasswordField as r}from"./ControlledPasswordField";import{ControlledPriceField as d}from"./ControlledPriceField";import{ControlledPhoneField as t}from"./ControlledPhoneField";import{ControlledRangeField as i}from"./ControlledRangeField";import{ControlledRatingField as n}from"./ControlledRatingField";import{ControlledDurationField as a}from"./ControlledDurationField";import{ControlledSwitchField as s}from"./ControlledSwitchField";import{ControlledTextField as C}from"./ControlledTextField";import{ControlledTextareaField as m}from"./ControlledTextareaField";import{ControlledGdprConsentField as F}from"./ControlledGdprConsentField";export{o as ControlledCheckboxField,l as ControlledCurrencyField,a as ControlledDurationField,F as ControlledGdprConsentField,e as ControlledNumberField,r as ControlledPasswordField,t as ControlledPhoneField,d as ControlledPriceField,i as ControlledRangeField,n as ControlledRatingField,s as ControlledSwitchField,C as ControlledTextField,m as ControlledTextareaField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as h}from"react/jsx-runtime";import{useMemo as C}from"react";import{Controller as q,useWatch as B,useFormContext as F}from"react-hook-form";import{translateLabel as P}from"../../../forms/utils";import{ComboboxComponent as j}from"../../form/fields";import{convertValidationRules as D}from"../types";function S(g){const{control:d,errors:p,fieldConfig:t,t:l,placeholder:v}=g,{name:a,label:x,validation:o,options:u={}}=t,m=F()?.setValue,r=B({control:d}),n="dependsOn"in t?t.dependsOn:void 0,O=n&&r?r[n.field]:void 0,c=C(()=>{const e=o?.options;return e?typeof e=="function"?e(r||{}):e:[]},[o?.options,r,O]),y=C(()=>c.map(e=>({...e,label:P(e.label,l)})),[c,l]),s=u.fieldSpecific;return h(q,{name:a,control:d,rules:o?D(o):void 0,render:({field:e})=>{const V=i=>{const f=typeof i=="string"?i:i.target.value;if(e.onChange(f),n&&m&&s?.setParentOnChange){const b=s.setParentOnChange(f,r||{});b!=null&&m(n.field,b,{shouldValidate:!0,shouldDirty:!0})}};return h(j,{...e,label:l(x),value:e.value??"",onChange:V,onBlur:e.onBlur,options:y,error:!!p[a],helperText:p[a]?.message,required:o?.required,placeholder:v||u.placeholder,creatable:s?.creatable??!1})}})}export{S as ControlledComboboxField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as v}from"react/jsx-runtime";import{useMemo as g}from"react";import{Controller as D,useWatch as V,useFormContext as q}from"react-hook-form";import{translateLabel as w}from"../../../forms/utils";import{DropdownComponent as B}from"../../form/fields";import{convertValidationRules as F}from"../types";function S(C){const{control:s,errors:d,fieldConfig:t,t:l,onChange:j}=C,{name:a,label:h,validation:e,options:b={}}=t,u=q()?.setValue,n=V({control:s}),r="dependsOn"in t?t.dependsOn:void 0,x=r&&n?n[r.field]:void 0,p=g(()=>{const o=e?.options;return o?typeof o=="function"?o(n||{}):o:[]},[e?.options,n,x]),O=g(()=>p.map(o=>({...o,label:w(o.label,l)})),[p,l]),m=b.fieldSpecific;return v(D,{name:a,control:s,rules:e?F(e):void 0,render:({field:o})=>{const y=i=>{const f=typeof i=="string"?i:i.target.value;if(o.onChange(f),r&&u&&m?.setParentOnChange){const c=m.setParentOnChange(f,n||{});c!=null&&u(r.field,c,{shouldValidate:!0,shouldDirty:!0})}};return v(B,{label:l(h),value:o.value!==void 0&&o.value!==null?String(o.value):"",onChange:y,onBlur:o.onBlur,options:O,error:!!d[a],helperText:d[a]?.message,required:e?.required})}})}export{S as ControlledDropdownField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as m}from"react/jsx-runtime";import{useMemo as c}from"react";import{Controller as
|
|
1
|
+
"use client";import{jsx as m}from"react/jsx-runtime";import{useMemo as c}from"react";import{Controller as b,useWatch as h}from"react-hook-form";import{translateLabel as A}from"../../../forms/utils";import{MultiDropdownComponent as x}from"../../form/fields";import{convertValidationRules as O}from"../types";function D(f){const{control:s,errors:u,fieldConfig:t,t:a}=f,{name:l,label:v,validation:o}=t,e=h({control:s}),d="dependsOn"in t?t.dependsOn:void 0,g=d&&e?e[d.field]:void 0,p=c(()=>{const r=o?.options;return r?typeof r=="function"?r(e||{}):r:[]},[o?.options,e,g]),y=c(()=>p.map(r=>({value:String(r.value),label:A(r.label,a)})),[p,a]);return m(b,{name:l,control:s,rules:o?O(o):void 0,render:({field:r})=>{const C=i=>{let n;if(Array.isArray(i))n=i;else try{n=JSON.parse(i.target.value)}catch{n=[]}r.onChange(n)};return m(x,{...r,label:a(v),value:Array.isArray(r.value)?r.value:[],onChange:C,onBlur:r.onBlur,options:y,error:!!u[l],helperText:u[l]?.message,required:o?.required})}})}export{D as ControlledMultiDropdownField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as p}from"react/jsx-runtime";import{useMemo as
|
|
1
|
+
"use client";import{jsx as p}from"react/jsx-runtime";import{useMemo as u}from"react";import{Controller as b,useWatch as h}from"react-hook-form";import{translateLabel as x}from"../../../forms/utils";import{RadioFieldComponent as R}from"../../form/fields";import{convertValidationRules as q}from"../types";function O(f){const{control:l,errors:s,fieldConfig:n,t}=f,{name:a,label:c,validation:e}=n,r=h({control:l}),d="dependsOn"in n?n.dependsOn:void 0,v=d&&r?r[d.field]:void 0,m=u(()=>{const o=e?.options;return o?typeof o=="function"?o(r||{}):o:[]},[e?.options,r,v]),g=u(()=>m.map(o=>({value:String(o.value),label:x(o.label,t)})),[m,t]);return p(b,{name:a,control:l,rules:e?q(e):void 0,render:({field:o})=>p(R,{...o,label:t(c),value:o.value??void 0,onChange:i=>{const C=typeof i=="string"?i:i.target.value;o.onChange(C)},options:g,error:!!s[a],helperText:s[a]?.message,required:e?.required})})}export{O as ControlledRadioField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as m}from"react/jsx-runtime";import{useMemo as F}from"react";import{Controller as v}from"react-hook-form";import{useCrudList as _}from"../../../useCrudList";import x from"../../form/fields/ReferenceFieldComponent";import{convertValidationRules as L}from"../types";const R=["name","title","label","displayName"];function p(e,n,l){if(n?.length){const r=n.map(i=>e[i]).filter(i=>i!=null&&i!=="");if(r.length)return r.join(" ")}if(l&&e[l]!=null&&e[l]!=="")return String(e[l]);for(const r of R)if(e[r]!=null&&e[r]!=="")return String(e[r]);return e.id??"?"}function S(e){const{control:n,errors:l,fieldConfig:r,t:i,placeholder:c}=e,{name:d,label:b,validation:a,options:s={}}=r,f=a?.reference,t=s.fieldSpecific,{items:u,loading:g}=_(f??"__disabled__",{enabled:!!f}),h=F(()=>u.map(o=>({id:o.id,label:p(o,t?.labelFields,t?.displayField)})),[u,t?.labelFields,t?.displayField]);return m(v,{name:d,control:n,rules:a?L(a):void 0,render:({field:o})=>m(x,{label:i(b),value:o.value??"",onChange:C=>o.onChange(C),onBlur:o.onBlur,options:h,isLoading:g,error:!!l[d],helperText:l[d]?.message,required:a?.required,placeholder:c||s.placeholder})})}export{S as ControlledReferenceField,p as buildReferenceLabel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as i}from"react/jsx-runtime";import{useMemo as h}from"react";import{Controller as b}from"react-hook-form";import{translateLabel as C}from"../../../forms/utils";import{ComboboxComponent as x}from"../../form/fields";import{convertValidationRules as y}from"../types";function S(s){const{control:m,errors:n,fieldConfig:u,t:c,placeholder:p}=s,{name:t,label:d,validation:r,options:f={}}=u,v=h(()=>{const e=r?.min??1900,a=r?.max??new Date().getFullYear()+10,l=[];for(let o=a;o>=e;o--)l.push({value:String(o),label:String(o)});return l},[r?.min,r?.max]);return i(b,{name:t,control:m,rules:r?y(r):void 0,render:({field:e})=>{const a=l=>{const o=typeof l=="string"?l:l.target.value,g=o===""?void 0:Number(o);e.onChange(g)};return i(x,{...e,label:C(d,c),value:e.value!==void 0&&e.value!==null?String(e.value):"",onChange:a,onBlur:e.onBlur,options:v,error:!!n[t],helperText:n[t]?.message,required:r?.required,placeholder:p||f.placeholder,translationNamespace:"crud",placeholderKey:"actions.selectYear",placeholderDefault:"Select or type year",creatable:!0})}})}export{S as ControlledYearField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ControlledComboboxField as
|
|
1
|
+
import{ControlledComboboxField as o}from"./ControlledComboboxField";import{ControlledDropdownField as l}from"./ControlledDropdownField";import{ControlledMultiDropdownField as e}from"./ControlledMultiDropdownField";import{ControlledRadioField as r}from"./ControlledRadioField";import{ControlledReferenceField as d}from"./ControlledReferenceField";import{ControlledYearField as i}from"./ControlledYearField";export{o as ControlledComboboxField,l as ControlledDropdownField,e as ControlledMultiDropdownField,r as ControlledRadioField,d as ControlledReferenceField,i as ControlledYearField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";function
|
|
1
|
+
"use client";function i(n){if(n){if(n instanceof RegExp)return n;try{const t=/^\/(.*)\/([gimyus]*)$/.exec(n);if(t){const[,r,e]=t;if(r)return new RegExp(r,e)}return new RegExp(n)}catch{return}}}function a(n){if(!n)return{};const t={};return n.required!==void 0&&(t.required=n.required),n.min!==void 0&&(t.min=n.min),n.max!==void 0&&(t.max=n.max),n.minLength!==void 0&&(t.minLength=n.minLength),n.maxLength!==void 0&&(t.maxLength=n.maxLength),n.pattern&&typeof n.pattern=="string"&&(t.pattern={value:i(n.pattern)||/.*/,message:"Invalid format"}),t}export{i as convertPatternToRegex,a as convertValidationRules};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Avatar as n,Text as p}from"@donotdev/components";const l=({config:a,value:s,t:d,className:e,size:r="md"})=>{if(!s)return t(p,{as:"span",variant:"muted",className:e,children:"-"});const i={sm:"size-touch",md:"size-touch",lg:"h-16 w-16"},c=m=>m.split(" ").map(o=>o.charAt(0)).slice(0,2).join("").toUpperCase();return t(n,{src:s,alt:a.label||"Avatar",fallback:c(a.label||"AV"),className:`${i[r]} ${e||""}`})};var u=l;export{l as AvatarFieldDisplay,u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{Badge as r,Text as l}from"@donotdev/components";const n=({config:m,value:a,t:s,className:e})=>{if(a==null)return o(l,{as:"span",variant:"muted",className:e,children:"-"});const t=typeof a=="boolean"?s(a?"common.yes":"common.no"):String(a);return o(r,{variant:typeof a=="boolean"?a?"default":"secondary":"outline",className:e,children:t})};var i=n;export{n as BadgeFieldDisplay,i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a=()=>null;var t=a;export{a as ButtonFieldDisplay,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Badge as t,Text as c}from"@donotdev/components";const n=({config:m,value:a,t:r,className:s})=>{if(a==null)return e(c,{as:"span",variant:"muted",className:s,children:"-"});const o=r(a?"common.yes":"common.no");return e(t,{variant:a?"default":"secondary",className:s,children:o})};var l=n;export{n as CheckboxFieldDisplay,l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a,jsxs as d}from"react/jsx-runtime";import{Text as s,Spinner as o}from"@donotdev/components";const l=({config:i,value:n,t:u,className:e,loading:c=!1})=>{if(c)return a(o,{className:e});if(!n)return a(s,{as:"span",variant:"muted",className:e,children:"-"});try{const r=new Date(n),t=r.toLocaleDateString(),m=r.toLocaleTimeString();return i.type==="date"?a(s,{as:"span",className:e,children:t}):d("div",{className:e,children:[a(s,{as:"span",children:t}),a(s,{as:"span",variant:"muted",level:"small",children:m})]})}catch{return a(s,{as:"span",variant:"muted",className:e,children:"-"})}};var p=l;export{l as DateFieldDisplay,p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Badge as t,BADGE_VARIANT as o,Text as i}from"@donotdev/components";const r=({config:n,value:a,t:c,className:s})=>a?e(t,{variant:o.OUTLINE,className:s,children:a}):e(i,{as:"span",variant:"muted",className:s,children:"-"});var l=r;export{r as DropdownDisplay,l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Badge as n,BADGE_VARIANT as t,Text as l,Stack as c}from"@donotdev/components";const r=({config:m,value:a,t:o,className:s})=>a?i(c,{direction:"row",align:"center",className:s,children:[e(l,{as:"span",level:"small",children:a.name}),a.size&&i(n,{variant:t.SECONDARY,children:[(a.size/1024).toFixed(1)," KB"]})]}):e(l,{as:"span",variant:"muted",className:s,children:"-"});var d=r;export{r as FileFieldDisplay,d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as t}from"react/jsx-runtime";import{Text as l}from"@donotdev/components";const e=({config:d,value:a,t:m,className:s})=>!a||a.lat===void 0&&a.lng===void 0?o(l,{as:"span",variant:"muted",className:s,children:"-"}):t(l,{as:"div",level:"small",className:`font-mono ${s||""}`,children:[a.lat?.toFixed(6),", ",a.lng?.toFixed(6)]});var i=e;export{e as GeoPointFieldDisplay,i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a=()=>null;var l=a;export{a as HiddenFieldDisplay,l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Avatar as n,Text as p}from"@donotdev/components";const l=({config:a,value:s,t:d,className:e,size:r="md"})=>{if(!s)return t(p,{as:"span",variant:"muted",className:e,children:"-"});const i={sm:"size-touch",md:"size-touch",lg:"h-16 w-16"},c=m=>m.split(" ").map(o=>o.charAt(0)).slice(0,2).join("").toUpperCase();return t(n,{src:s,alt:a.label||"Image",fallback:c(a.label||"IMG"),className:`${i[r]} ${e||""}`})};var u=l;export{l as ImageFieldDisplay,u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import{Text as i}from"@donotdev/components";const o=({config:l,value:e,t:r,className:t})=>{if(!e)return n(i,{as:"span",variant:"muted",className:t,children:"-"});const s=(()=>{switch(l.type){case"email":return{href:`mailto:${e}`,"aria-label":r("common.sendEmailTo",{email:e})};case"tel":return{href:`tel:${e}`,"aria-label":r("common.callNumber",{number:e})};default:return{href:e,target:"_blank",rel:"noopener noreferrer","aria-label":r("common.openLink")}}})();return n("a",{...s,className:t||"",style:{color:"var(--primary)",textDecoration:"none"},onMouseEnter:a=>a.currentTarget.style.textDecoration="underline",onMouseLeave:a=>a.currentTarget.style.textDecoration="none",children:e})};var c=o;export{o as LinkFieldDisplay,c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as t}from"react/jsx-runtime";import{Text as l}from"@donotdev/components";const e=({config:d,value:a,t:m,className:s})=>!a||a.lat===void 0&&a.lng===void 0?o(l,{as:"span",variant:"muted",className:s,children:"-"}):t(l,{as:"div",level:"small",className:`font-mono ${s||""}`,children:[a.lat?.toFixed(6),", ",a.lng?.toFixed(6)]});var i=e;export{e as MapFieldDisplay,i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{Badge as n,BADGE_VARIANT as l,Text as o,Stack as c}from"@donotdev/components";const t=({config:p,value:a,t:d,className:s})=>!a||!Array.isArray(a)||a.length===0?r(o,{as:"span",variant:"muted",className:s,children:"-"}):r(c,{direction:"row",wrap:"wrap",className:s,children:a.map((e,i)=>r(n,{variant:l.OUTLINE,children:String(e)},i))});var m=t;export{t as MultiDropdownDisplay,m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{Badge as l,BADGE_VARIANT as n,Text as c,Stack as m}from"@donotdev/components";const e=({config:p,value:a,t:d,className:s})=>!a||!Array.isArray(a)||a.length===0?r(c,{as:"span",variant:"muted",className:s,children:"-"}):r(m,{direction:"row",wrap:"wrap",className:s,children:a.map((t,i)=>r(l,{variant:n.OUTLINE,children:String(t)},i))});var o=e;export{e as MultiInputTextFieldDisplay,o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{Text as n,Spinner as r}from"@donotdev/components";const l=({config:i,value:e,t:m,className:a,loading:o=!1})=>o?s(r,{className:a}):e==null?s(n,{as:"span",variant:"muted",className:a,children:"-"}):s(n,{as:"span",className:`font-mono ${a||""}`,children:e.toLocaleString()});var t=l;export{l as NumberFieldDisplay,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,jsxs as
|
|
1
|
+
import{jsx as o,jsxs as i}from"react/jsx-runtime";import{Eye as d,EyeOff as n}from"lucide-react";import{useState as u}from"react";import{Skeleton as m,Button as y,CopyToClipboard as f,Stack as r}from"@donotdev/components";const l=({config:g,value:e,t,className:s,loading:p=!1})=>{const[a,c]=u(!1);return p?o(m,{className:s}):e?i(r,{direction:"row",align:"center",className:s,children:[o("span",{style:{fontFamily:"monospace"},children:a?e:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}),i(r,{direction:"row",align:"center",gap:"tight",children:[o(y,{type:"button",onClick:()=>c(!a),"aria-label":a?"Hide password":"Show password",children:a?o(n,{}):o(d,{})}),o(f,{text:e,tooltipText:t("copyToClipboard")||"Copy to clipboard",copiedTooltipText:t("copied")||"Copied!",ariaLabel:t("copyPassword")||"Copy password"})]})]}):o("div",{style:{color:"var(--muted-foreground)"},children:"-"})};var w=l;export{l as PasswordFieldDisplay,w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Text as s}from"@donotdev/components";const n=({config:c,value:e,t:o,className:r})=>e?t("a",{href:`tel:${e}`,className:r||"",style:{color:"var(--primary)",textDecoration:"none"},onMouseEnter:a=>a.currentTarget.style.textDecoration="underline",onMouseLeave:a=>a.currentTarget.style.textDecoration="none","aria-label":o("common.callNumber",{number:e}),children:e}):t(s,{as:"span",variant:"muted",className:r,children:"-"});var l=n;export{n as PhoneNumberDisplay,l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Badge as r,BADGE_VARIANT as t,Text as l}from"@donotdev/components";const i=({config:c,value:a,t:d,className:s})=>a?e(r,{variant:t.OUTLINE,className:s,children:a}):e(l,{as:"span",variant:"muted",className:s,children:"-"});var o=i;export{i as RadioFieldDisplay,o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Text as l}from"@donotdev/components";const n=({config:t,value:a,t:m,className:s})=>a==null?e(l,{as:"span",variant:"muted",className:s,children:"-"}):e(l,{as:"span",className:`font-mono ${s||""}`,children:a});var o=n;export{n as RangeFieldDisplay,o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Badge as i,BADGE_VARIANT as n,Text as l}from"@donotdev/components";const r=({config:c,value:a,t:d,className:s})=>{if(!a)return e(l,{as:"span",variant:"muted",className:s,children:"-"});const t=a.displayName||a.name||a.id||a;return e(i,{variant:n.OUTLINE,className:s,children:String(t)})};var m=r;export{r as ReferenceFieldDisplay,m as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r,jsxs as i}from"react/jsx-runtime";import{Text as s}from"@donotdev/components";import{sanitizeHtml as t}from"../../../utils/sanitizeHtml";const a=({config:m,value:e,t:l,className:o})=>!e||e.trim()===""?r(s,{as:"span",variant:"muted",className:o,children:"-"}):i("div",{className:o,style:{padding:"var(--gap-md)",backgroundColor:"var(--muted)",borderRadius:"var(--radius-md)",border:"1px solid var(--border)",minHeight:"38px"},children:[r("div",{dangerouslySetInnerHTML:{__html:t(e)},style:{outline:"none",fontSize:"var(--font-size-base)",lineHeight:"1.6"},className:"prose prose-sm max-w-none"}),r("style",{children:`
|
|
2
2
|
/* Match Tiptap ProseMirror styling */
|
|
3
3
|
.prose p {
|
|
4
4
|
margin: 0.5em 0;
|
|
@@ -58,4 +58,4 @@ import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Text as t}from"@donotde
|
|
|
58
58
|
.prose a:hover {
|
|
59
59
|
color: var(--primary-hover);
|
|
60
60
|
}
|
|
61
|
-
`})]});var
|
|
61
|
+
`})]});var n=a;export{a as RichTextDisplay,n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Text as l}from"@donotdev/components";const r=({config:i,value:a,t:m,className:s})=>a?e(l,{as:"div",level:"small",className:`whitespace-pre-wrap ${s||""}`,children:a}):e(l,{as:"span",variant:"muted",className:s,children:"-"});var t=r;export{r as TextAreaDisplay,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Mail as N,Calendar as L,Clock as k}from"lucide-react";import{useState as A}from"react";import{Skeleton as T,Badge as B,BADGE_VARIANT as E,Text as l,cn as f,CopyToClipboard as x,Stack as o}from"@donotdev/components";import{getWeekFromISOString as I}from"@donotdev/core";const b=({config:i,value:a,t:r,className:s,loading:C=!1,showCopy:u=!1,asBadge:w=!1,truncate:c=!1,maxLength:d=50,showLabel:p=!1})=>{const[V,g]=A(!1),j=async()=>{try{await navigator.clipboard.writeText(a),g(!0),setTimeout(()=>g(!1),2e3)}catch{}},h=()=>{switch(i.type){case"email":return e(N,{});case"month":case"week":return e(L,{});case"time":return e(k,{});default:return null}},v=t=>{if(!t)return null;switch(i.type){case"email":return n("a",{href:`mailto:${t}`,style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)"},onMouseEnter:m=>m.currentTarget.style.textDecoration="underline",onMouseLeave:m=>m.currentTarget.style.textDecoration="none",children:[h(),t]});case"month":return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long"});case"week":return I(t);case"time":return new Date(`2000-01-01T${t}`).toLocaleTimeString();default:return t}},S=t=>!c||t.length<=d?t:`${t.substring(0,d)}...`;if(C)return n(o,{gap:"tight",children:[p&&e(T,{style:{height:"1rem",width:"6rem"}}),e(T,{className:"dndev-w-full",style:{height:"1.5rem"}})]});if(!a)return n(o,{gap:"tight",children:[p&&e(l,{as:"span",variant:"muted",children:i.label||i.name}),e(l,{as:"span",variant:"muted",className:f(s),style:{fontStyle:"italic"},children:r("common.noValue",{defaultValue:"No value"})})]});const D=v(a),y=S(String(D));return w?n(o,{direction:"row",align:"center",gap:"tight",children:[h(),e(B,{variant:E.SECONDARY,className:s,children:y}),u&&e(x,{text:a,tooltipText:r("copyToClipboard")||"Copy to clipboard",copiedTooltipText:r("copied")||"Copied!",ariaLabel:r("copyToClipboard")||"Copy to clipboard"})]}):n(o,{gap:"tight",children:[p&&e(l,{as:"span",variant:"muted",children:i.label||i.name}),n(o,{direction:"row",align:"center",gap:"tight",children:[e("div",{className:f("dndev-flex-1",c&&"truncate",s),title:c&&a.length>d?a:void 0,children:e(l,{as:"span",children:y})}),u&&e(x,{text:a,tooltipText:r("copyToClipboard")||"Copy to clipboard",copiedTooltipText:r("copied")||"Copied!",ariaLabel:r("copyToClipboard")||"Copy to clipboard"})]})]})};var M=b;export{b as TextFieldDisplay,M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a,jsxs as c}from"react/jsx-runtime";import{Text as e}from"@donotdev/components";const n=({config:o,value:t,t:d,className:s})=>{if(!t)return a(e,{as:"span",variant:"muted",className:s,children:"-"});try{const r=new Date(t),i=r.toLocaleDateString(),l=r.toLocaleTimeString();return c("div",{className:s,children:[a(e,{as:"span",children:i}),a(e,{as:"span",variant:"muted",level:"small",children:l})]})}catch{return a(e,{as:"span",variant:"muted",className:s,children:"-"})}};var m=n;export{n as TimestampFieldDisplay,m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as
|
|
1
|
+
import{default as a}from"./TextFieldDisplay";import{default as i}from"./BadgeFieldDisplay";import{default as s}from"./AvatarFieldDisplay";import{default as l}from"./LinkFieldDisplay";import{default as e}from"./DateFieldDisplay";import{default as t}from"./NumberFieldDisplay";import{default as o}from"./PhoneNumberDisplay";import{default as r}from"./TextAreaDisplay";import{default as p}from"./RichTextDisplay";import{default as m}from"./CheckboxFieldDisplay";import{default as d}from"./DropdownDisplay";import{default as f}from"./MultiDropdownDisplay";import{default as u}from"./MultiInputTextFieldDisplay";import{default as D}from"./RadioFieldDisplay";import{default as y}from"./RangeFieldDisplay";import{default as F}from"./FileFieldDisplay";import{default as n}from"./ImageFieldDisplay";import{default as x}from"./GeoPointFieldDisplay";import{default as T}from"./MapFieldDisplay";import{default as R}from"./ReferenceFieldDisplay";import{default as b}from"./TimestampFieldDisplay";import{default as g}from"./HiddenFieldDisplay";import{default as M}from"./ButtonFieldDisplay";export{s as AvatarFieldDisplay,i as BadgeFieldDisplay,M as ButtonFieldDisplay,m as CheckboxFieldDisplay,e as DateFieldDisplay,d as DropdownDisplay,F as FileFieldDisplay,x as GeoPointFieldDisplay,g as HiddenFieldDisplay,n as ImageFieldDisplay,l as LinkFieldDisplay,T as MapFieldDisplay,f as MultiDropdownDisplay,u as MultiInputTextFieldDisplay,t as NumberFieldDisplay,o as PhoneNumberDisplay,D as RadioFieldDisplay,y as RangeFieldDisplay,R as ReferenceFieldDisplay,p as RichTextDisplay,r as TextAreaDisplay,a as TextFieldDisplay,b as TimestampFieldDisplay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a,jsxs as m}from"react/jsx-runtime";import{MapPin as U}from"lucide-react";import{useState as y,useEffect as w,useRef as S,useMemo as N}from"react";import{Combobox as L,Stack as M}from"@donotdev/components";import{useTranslation as R,getPlatformEnvVar as W}from"@donotdev/core";const Y=({label:b,value:l,onChange:x,enableGoogleMaps:q=!1,extractDistrictCode:T,error:i,helperText:c,required:z})=>{const{t:o}=R("crud"),[n,u]=y(l?.formatted_address||""),[g,f]=y([]),[E,p]=y(!1),v=S(null),h=S(null),d=S(null),_=W("GOOGLE_MAPS_API_KEY")||"",s=q&&!!_,j=N(()=>g.map(e=>({value:e.place_id,label:e.description,description:e.structured_formatting?.secondary_text,content:m("div",{style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)"},children:[a(U,{style:{width:"var(--size-icon-sm)",height:"var(--size-icon-sm)"}}),m("div",{children:[a("div",{children:e.description}),e.structured_formatting?.secondary_text&&a("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:e.structured_formatting.secondary_text})]})]})})),[g]),G=e=>{h.current&&(p(!0),h.current.getDetails({placeId:e,fields:["formatted_address","geometry","address_components"]},(r,t)=>{if(p(!1),t===window.google?.maps?.places?.PlacesServiceStatus.OK&&r){const I=r.formatted_address||"",O=r.geometry?.location?.lat(),V=r.geometry?.location?.lng(),P={formatted_address:I,latitude:O,longitude:V};if(T&&r.address_components){const A=r.address_components.find(D=>D.types.includes("postal_code"))?.long_name||"",k=A.startsWith("92")?92:parseInt(A.slice(-2),10)||null;P.district_code=k}u(I),x(P)}}))};w(()=>{l?.formatted_address&&u(l.formatted_address)},[l]),w(()=>{if(!s)return;let e=null;const r=()=>{window.google?.maps?.places&&(v.current=new window.google.maps.places.AutocompleteService,h.current=new window.google.maps.places.PlacesService(document.createElement("div")))};return(()=>{if(window.google?.maps?.places){r();return}if(document.querySelector("#google-maps-script")){e=setInterval(()=>{window.google?.maps?.places&&(clearInterval(e),e=null,r())},100);return}const t=document.createElement("script");t.id="google-maps-script",t.src=`https://maps.googleapis.com/maps/api/js?key=${_}&libraries=places`,t.async=!0,t.defer=!0,t.onload=()=>r(),document.head.appendChild(t)})(),()=>{e!==null&&(clearInterval(e),e=null)}},[s,_]),w(()=>{if(!s||!n||!v.current){f([]);return}return d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{p(!0),v.current.getPlacePredictions({input:n,types:["geocode","establishment"]},(e,r)=>{p(!1),r===window.google?.maps?.places?.PlacesServiceStatus.OK&&e?f(e):f([])})},300),()=>{d.current&&clearTimeout(d.current)}},[s,n]);const K=e=>{u(e),x({formatted_address:e})},C=e=>{const r=Array.isArray(e)?e[0]||"":e;if(!s){K(r);return}g.some(t=>t.place_id===r)&&G(r)};return s?m(M,{gap:"tight",children:[a(L,{label:b,value:n,onValueChange:C,onSearchChange:e=>{s&&u(e)},placeholder:o("address.placeholder","Enter address..."),emptyMessage:E?o("messages.loading","Loading..."):o("address.noResults","No addresses found"),options:j,required:z,variant:i?"destructive":void 0,isLoading:E,creatable:!0,createLabel:o("actions.use","Use this address")}),c&&a("p",{style:{fontSize:"var(--font-size-xs)",color:i?"var(--destructive-foreground)":"var(--muted-foreground)"},children:c})]}):m(M,{gap:"tight",children:[a(L,{label:b,value:n,onValueChange:C,placeholder:o("address.placeholder","Enter address..."),options:[],required:z,variant:i?"destructive":void 0,creatable:!0,createLabel:o("actions.use","Use this address")}),c&&a("p",{style:{fontSize:"var(--font-size-xs)",color:i?"var(--destructive-foreground)":"var(--muted-foreground)"},children:c})]})};var F=Y;export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Avatar as
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Avatar as p,Input as u,cn as f,Stack as n}from"@donotdev/components";const s=({config:r,value:t,onChange:c,error:A,helperText:l,t:i,className:d,...v})=>{const h=a=>a.split(" ").map(m=>m.charAt(0)).slice(0,2).join("").toUpperCase();return o(n,{children:[o(n,{direction:"row",align:"center",children:[e(p,{src:t,alt:r.label||"Avatar",fallback:h(r.label||"AV"),style:{height:"var(--touch-target)",width:"var(--touch-target)"}}),e("div",{className:"dndev-flex-1",children:e(u,{type:"url",className:f("dndev-w-full",d),placeholder:i("common.enterAvatarUrl"),value:t,onChange:a=>c(a.target.value),...v})})]}),l&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:l})]})};var g=s;export{s as AvatarFieldComponent,g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Badge as v,Input as f,cn as g,Stack as o}from"@donotdev/components";const l=({config:p,value:a,onChange:d,error:u,helperText:t,t:n,variant:s="default",className:i,...c})=>r(o,{children:[r(o,{direction:"row",align:"center",children:[e(v,{variant:s,style:{minWidth:0},children:a||n("common.badgePreview")}),e("div",{className:"dndev-flex-1",children:e(f,{type:"text",className:g("dndev-w-full",i),placeholder:n("common.enterBadgeText"),value:a,onChange:m=>d(m.target.value),...c})})]}),t&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:t})]});var h=l;export{l as BadgeFieldComponent,h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{Button as e}from"@donotdev/components";const n=({label:a,type:t,onClick:o,variant:i,disabled:l=!1})=>r(e,{type:t,onClick:o,variant:i,disabled:l,children:a});var s=n;export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as
|
|
1
|
+
import{jsx as r,jsxs as h}from"react/jsx-runtime";import{Checkbox as i,Label as n,Stack as o}from"@donotdev/components";const s=({label:a,checked:c=!1,onChange:e,required:t})=>h(o,{direction:"row",align:"center",gap:"tight",children:[r(i,{checked:c,onCheckedChange:d=>{e&&e({target:{checked:d}})}}),r(n,{required:t,children:a})]});var l=s;export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as c}from"react/jsx-runtime";import{useMemo as L,useId as N}from"react";import{Combobox as $,Stack as d}from"@donotdev/components";import{useTranslation as D}from"@donotdev/core";const I=({label:u,value:l,options:s,error:p,helperText:a,onChange:n,onBlur:m,required:g,placeholder:h,translationNamespace:v="dndev",placeholderKey:f="actions.select",placeholderDefault:b="Select",creatable:x=!1,createLabel:y,emptyMessage:S})=>{const{t:r}=D(v),i=N(),z=L(()=>s.map(e=>({value:String(e.value),label:e.label})),[s]),C=e=>{if(n){const q={target:{value:Array.isArray(e)?e[0]||"":e}};n(q)}},A=e=>{e||m?.()},t=!!p,M=`${i}-error`,j=`${i}-helper`;return c(d,{gap:"tight",children:[o($,{label:u,value:l||"",onValueChange:C,onOpenChange:A,placeholder:h||r(f,b),emptyMessage:S||r("messages.noResults","No results found"),creatable:x,createLabel:y||r("actions.create","Create"),options:z,required:g,variant:t?"destructive":void 0,clearable:!!l}),t&&c(d,{id:M,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[o("span",{children:"\u26A0"}),a]}),a&&!t&&o("p",{id:j,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:a})]})};var O=I;export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t,jsxs as v}from"react/jsx-runtime";import{useState as I,useEffect as S,useId as z}from"react";import{Input as E,FloatingLabel as T,Stack as j}from"@donotdev/components";const C=({label:g,value:n,onChange:m,currency:o="EUR",locale:f,error:l,helperText:s,required:y=!1,disabled:i=!1,placeholder:h})=>{const d=z(),b=f||(typeof navigator<"u"?navigator.language:"en-US"),u=e=>e==null||isNaN(e)?"":(e/100).toFixed(2),x=e=>{if(!e||e.trim()==="")return null;const r=e.replace(/[^\d.,\-]/g,"").replace(",","."),a=parseFloat(r);return isNaN(a)?null:Math.round(a*100)},[F,c]=I(u(n));S(()=>{c(u(n))},[n]);const N=e=>{const r=e.target.value;c(r);const a={target:{value:x(r)}};m(a)},p=(()=>{try{return new Intl.NumberFormat(b,{style:"currency",currency:o,currencyDisplay:"symbol"}).formatToParts(0).find(e=>e.type==="currency")?.value||o}catch{return o}})();return v(j,{gap:"tight",children:[t(T,{htmlFor:d,label:g,disabled:i,required:y,children:v("div",{style:{position:"relative"},children:[t("span",{style:{position:"absolute",left:"var(--gap-md)",top:"50%",transform:"translateY(-50%)",color:"var(--muted-foreground)",pointerEvents:"none",zIndex:1},children:p}),t(E,{id:d,type:"text",inputMode:"decimal",value:F,onChange:N,disabled:i,placeholder:h||"0.00","data-variant":l?"destructive":void 0,style:{paddingLeft:`calc(var(--gap-md) + ${p.length*.6}em + var(--gap-sm))`}})]})}),s&&t("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:s})]})};var L=C;export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as l,jsxs as S}from"react/jsx-runtime";import{Input as
|
|
1
|
+
import{jsx as l,jsxs as S}from"react/jsx-runtime";import{Input as m,Stack as p}from"@donotdev/components";const v=({label:n,value:a,onChange:i,error:s,helperText:o,mode:e="date",required:d,...g})=>{const c=t=>{const u=t.target.value?new Date(t.target.value).toISOString():null;i(u)};let r="";if(a){const t=new Date(a);e==="date"?r=t.toISOString().split("T")[0]||"":e==="datetime-local"?r=t.toISOString().slice(0,16)||"":e==="month"?r=t.toISOString().slice(0,7):e==="time"?r=t.toISOString().slice(11,16):e==="week"&&(r=t.toISOString().split("T")[0]||"")}return S(p,{gap:"tight",children:[l(m,{label:n,type:e,value:r,onChange:c,required:d,className:"dndev-w-full",...g}),o&&l("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:o})]})};var f=v;export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as t,jsxs as n,Fragment as le}from"react/jsx-runtime";import{Upload as se,X as oe,FileText as N,FileSpreadsheet as ie,File as ne,Loader2 as de,Eye as ce}from"lucide-react";import{useCallback as y,useState as E,useRef as T,useEffect as j,useImperativeHandle as ue,forwardRef as pe}from"react";import{Button as B,BUTTON_VARIANT as q,Text as g,Stack as x,Progress as me,Dialog as ge,DialogContent as fe,DialogHeader as ve,DialogTitle as he}from"@donotdev/components";import{handleError as P,useTranslation as ye}from"@donotdev/core";import{useUploadContext as xe}from"../../../contexts/UploadContext";import{useUploadStore as G}from"../../../stores/UploadStore";import{uploadFile as we,deleteFile as be,generateFileId as X,getFileIcon as Ne,formatFileSize as Te,getDocumentAcceptString as Pe}from"../../../utils/fileStorage";function Fe({type:m,className:d}){switch(m){case"pdf":return t(N,{className:d,style:{color:"var(--destructive)"}});case"doc":return t(N,{className:d,style:{color:"var(--primary)"}});case"xls":return t(ie,{className:d,style:{color:"var(--success)"}});case"ppt":return t(N,{className:d,style:{color:"var(--warning)"}});case"text":case"html":return t(N,{className:d});default:return t(ne,{className:d})}}const V=pe(({name:m,label:d,value:f,onChange:I,error:F,helperText:U,multiple:p=!1,maxFiles:D=10,maxSize:S=25*1024*1024,storagePath:H="uploads/documents",required:_,enablePreview:L=!0},K)=>{const{t:Q}=ye("crud"),i=Q,v=xe(),M=!!v,[o,c]=E([]),[O,k]=E(!1),[z,R]=E(null),h=T(null),C=T(!1),w=T(void 0),Y=Pe(),b=y(e=>{const r=e.filter(a=>a.uploaded&&!a.error).map(a=>a.uploaded);I(p?r:r[0]||null)},[p,I]);j(()=>{if(C.current){C.current=!1;return}if(f){const e=[];(Array.isArray(f)?f:[f]).forEach(r=>{r.url&&e.push({id:X(),file:new File([],r.filename),uploadProgress:null,uploaded:r,error:null})}),c(e)}else c([])},[f]);const Z=y(async()=>{const e=o.filter(r=>!r.uploaded&&!r.error&&r.uploadProgress===null);if(e.length!==0){c(r=>r.map(a=>e.some(l=>l.id===a.id)?{...a,uploadProgress:0}:a));for(const r of e)try{const a=await we(r.file,{storagePath:H,onProgress:l=>{c(u=>u.map(s=>s.id===r.id?{...s,uploadProgress:l.progress}:s))}});c(l=>{const u=l.map(s=>s.id===r.id?{...s,uploaded:a,uploadProgress:100,error:null}:s);return queueMicrotask(()=>b(u)),u})}catch{c(a=>a.map(l=>l.id===r.id?{...l,error:"Upload failed",uploadProgress:null}:l))}}},[o,H,b]);w.current=Z,j(()=>{if(!(!v||!m))return G.getState().registerUpload(v,m,async()=>{await w.current?.()}),()=>{G.getState().unregisterUpload(v,m)}},[v,m]),ue(K,()=>({upload:async()=>{await w.current?.()},getDocuments:()=>W.current||[]}),[]);const W=T(o);W.current=o;const $=e=>{const r=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".html",".csv"],a="."+e.name.split(".").pop()?.toLowerCase();return r.includes(a)},A=y(e=>{const r=(p?D:1)-o.length;if(r<=0){P(new Error("Maximum documents reached"),{userMessage:i("document.errors.maxFiles",{max:D}),severity:"warning",showNotification:!0});return}const a=e.slice(0,r),l=[],u=(S/(1024*1024)).toFixed(0);for(const s of a){if(!$(s)){P(new Error("Invalid document type"),{userMessage:i("document.errors.invalidType",{fileName:s.name}),severity:"warning",showNotification:!0});continue}if(s.size>S){P(new Error("Document too large"),{userMessage:i("document.errors.exceedsSize",{fileName:s.name,size:u}),severity:"warning",showNotification:!0});continue}l.push({id:X(),file:s,uploadProgress:null,uploaded:null,error:null})}l.length!==0&&(c(s=>p?[...s,...l]:l),M||setTimeout(()=>w.current?.(),0))},[o,p,D,S,i,M]),J=e=>{const r=Array.from(e.target.files||[]);r.length>0&&A(r),h.current&&(h.current.value="")},ee=y(e=>{e.preventDefault(),k(!1);const r=Array.from(e.dataTransfer.files);A(r)},[A]),re=y(async e=>{const r=o.find(a=>a.id===e);if(r)try{r.uploaded&&await be(r.uploaded);const a=o.filter(l=>l.id!==e);C.current=!0,c(a),setTimeout(()=>b(a),0)}catch(a){P(a,{userMessage:i("document.delete.failed"),severity:"error",showNotification:!0})}},[o,b,i]),ae=e=>{e.uploaded?.url&&e.uploaded.mimeType==="application/pdf"&&R(e.uploaded.url)},te=p||o.length===0;return n(le,{children:[n(x,{gap:"tight",children:[n(g,{level:"body",textAlign:"start",children:[d,_?"*":""]}),te&&n("div",{role:"button",tabIndex:0,"aria-label":i("document.upload.ariaLabel"),className:"dndev-surface","data-variant":F?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:O?"var(--primary)":F?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:O?"color-mix(in oklab, var(--primary) 5%, transparent)":"var(--surface)",transition:"border-color var(--dur-fast), background-color var(--dur-fast)",cursor:"pointer",outline:"none"},onDragOver:e=>{e.preventDefault(),k(!0)},onDragLeave:()=>k(!1),onDrop:ee,onClick:()=>h.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),h.current?.click())},children:[t("input",{ref:h,type:"file",accept:Y,multiple:p,style:{display:"none"},onChange:J}),n(x,{align:"center",justify:"center",children:[t(se,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),t(g,{as:"p",variant:"muted",level:"small",textAlign:"center",children:i("document.upload.hint")}),t(g,{as:"p",variant:"muted",level:"caption",textAlign:"center",children:"PDF, Word, Excel, PowerPoint, TXT, Markdown, HTML"})]})]}),o.length>0&&t(x,{gap:"tight",children:o.map((e,r)=>{const a=Ne(e.uploaded?.mimeType||e.file.type,e.file.name),l=e.uploadProgress!==null&&e.uploadProgress<100,u=e.uploaded?.mimeType==="application/pdf"||e.file.name.toLowerCase().endsWith(".pdf");return n("div",{className:"dndev-surface","data-variant":"muted",style:{padding:"var(--gap-md)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",gap:"var(--gap-md)"},children:[t(Fe,{type:a,className:"dndev-size-md"}),n(x,{gap:"none",style:{flex:1,minWidth:0},children:[t(g,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),n(g,{level:"caption",variant:"muted",children:[Te(e.uploaded?.size||e.file.size),e.error&&n("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),l&&t(me,{value:e.uploadProgress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),n(x,{direction:"row",gap:"tight",children:[L&&u&&e.uploaded&&t(B,{variant:q.GHOST,onClick:()=>ae(e),"aria-label":i("document.preview.ariaLabel"),children:t(ce,{className:"dndev-size-sm"})}),l?t(de,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):t(B,{variant:q.GHOST,onClick:()=>re(e.id),"aria-label":i("document.delete.ariaLabel"),children:t(oe,{className:"dndev-size-sm"})})]})]},e.id)})}),U&&t(g,{level:"caption",variant:F?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:U})]}),L&&z&&t(ge,{open:!!z,onOpenChange:()=>R(null),children:n(fe,{style:{maxWidth:"90vw",maxHeight:"90vh",width:"900px",height:"80vh"},children:[t(ve,{children:t(he,{children:i("document.preview.title")})}),t("iframe",{src:z,sandbox:"allow-same-origin",style:{width:"100%",height:"100%",border:"none",borderRadius:"var(--radius-md)"},title:"PDF Preview"})]})})]})});V.displayName="DocumentFieldComponent";var De=V;export{De as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as g}from"react/jsx-runtime";import{Select as d,Stack as v}from"@donotdev/components";import{useTranslation as m}from"@donotdev/core";const f=({label:l,value:r,options:n,error:s,helperText:a,onChange:t,onBlur:i,required:u})=>{const{t:p}=m("crud"),c=r!=null?String(r):"";return g(v,{gap:"tight",children:[o(d,{label:l,value:c,onValueChange:e=>{t&&t({target:{value:e}})},onOpenChange:e=>!e&&i?.(),placeholder:p("actions.select","Select"),required:u,options:n.map(e=>({value:String(e.value),label:e.label}))}),a&&o("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:a})]})};var h=f;export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i,jsxs as l}from"react/jsx-runtime";import{Clock as x}from"lucide-react";import{useState as V,useMemo as k}from"react";import{Label as z,Stack as s,Button as S,Slider as w}from"@donotdev/components";const f=[15,30,45,60,90,120,150,180],N={15:"duration.15m",30:"duration.30m",45:"duration.45m",60:"duration.1h",90:"duration.1h30",120:"duration.2h",150:"duration.2h30",180:"duration.3h"};function q(e,n){const o=e<60?`${e}m`:e%60===0?`${e/60}h`:`${Math.floor(e/60)}h${e%60}`,u=N[e];return!n||!u?o:n(`crud:${u}`,{defaultValue:o})??o}const W=({label:e,value:n,onChange:o,error:u,helperText:d,disabled:m,required:p,readonly:C,min:g=0,max:v=480,step:M=5,t})=>{const r=typeof n=="number"&&!Number.isNaN(n)?n:0,h=f.includes(r),[c,b]=V(!h&&r>0),T=k(()=>f.map(a=>({minutes:a,label:q(a,t)})),[t]),y=t?t("crud:duration.custom",{defaultValue:"Custom"}):"Custom";if(C){const a=r===0?t?t("crud:duration.zero",{defaultValue:"\u2014"}):"\u2014":r<60?t?t("crud:duration.minutes",{count:r,defaultValue:`${r} min`}):`${r} min`:t?t("crud:duration.hoursMinutes",{hours:Math.floor(r/60),minutes:r%60,defaultValue:`${Math.floor(r/60)}h${r%60?` ${r%60}min`:""}`}):`${Math.floor(r/60)}h${r%60?` ${r%60}m`:""}`;return l(s,{gap:"tight",children:[i(z,{required:p,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:e}),l(s,{direction:"row",gap:"tight",align:"center",children:[i(x,{size:18,style:{color:"var(--muted-foreground)"},"aria-hidden":!0}),i("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-sm)"},children:a})]}),d&&i("p",{style:{fontSize:"var(--font-size-xs)",color:u?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})}return l(s,{children:[i(z,{required:p,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:e}),l(s,{direction:"row",gap:"tight",align:"center",style:{flexWrap:"wrap"},children:[T.map(({minutes:a,label:$})=>l(S,{type:"button",variant:r===a?"primary":"outline",disabled:m,onClick:()=>{b(!1),o(a)},"aria-pressed":r===a,"aria-label":$,children:[i(x,{size:14,style:{marginRight:"var(--gap-xs)"},"aria-hidden":!0}),$]},a)),i(S,{type:"button",variant:c?"primary":"outline",disabled:m,onClick:()=>{b(!0),!h&&r>0?o(r):o(30)},"aria-pressed":c,"aria-label":y,children:y})]}),c&&i(s,{gap:"tight",style:{marginTop:"var(--gap-sm)"},children:i(w,{value:[h?30:r],onValueChange:([a])=>o(Math.max(g,Math.min(v,a??0))),min:g,max:v,step:M,showValue:!0,disabled:m,"aria-label":e})}),d&&i("p",{style:{fontSize:"var(--font-size-xs)",color:u?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})};var j=W;export{f as DURATION_PRESETS,j as default};
|