@donotdev/crud 0.0.11 → 0.0.12
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 +1 -1
- package/dist/CrudStore.js +1 -1
- package/dist/FieldRegistry.js +1 -1
- package/dist/adapters/FirestoreAdapter.js +1 -1
- package/dist/adapters/FunctionsAdapter.js +1 -1
- package/dist/adapters/index.js +1 -1
- package/dist/components/CrudButton.js +1 -1
- package/dist/components/DisplayFieldRenderer.js +1 -1
- package/dist/components/EntityDisplayRenderer.js +1 -1
- package/dist/components/EntityFilters.d.ts.map +1 -1
- package/dist/components/EntityFilters.js +1 -1
- package/dist/components/EntityFormRenderer.d.ts.map +1 -1
- package/dist/components/EntityFormRenderer.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/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/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.d.ts.map +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/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.d.ts.map +1 -1
- package/dist/forms/hooks/useEntityForm.js +1 -1
- package/dist/forms/index.js +1 -1
- package/dist/forms/types.d.ts +8 -1
- package/dist/forms/types.d.ts.map +1 -1
- package/dist/forms/utils/buildInitialValues.d.ts +30 -0
- package/dist/forms/utils/buildInitialValues.d.ts.map +1 -0
- package/dist/forms/utils/buildInitialValues.js +1 -0
- 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.d.ts +11 -5
- package/dist/forms/utils/translateFieldLabel.d.ts.map +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/useEntityFavorites.js +1 -1
- package/dist/hooks/useFileUpload.js +1 -1
- package/dist/hooks/useFormNavigationGuard.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/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/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/mergeWithOptimistic.js +1 -1
- package/dist/utils/scopeUtils.js +1 -1
- package/dist/utils/uploadValidation.js +1 -1
- package/package.json +4 -4
|
@@ -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 s}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(n){const{control:i,errors:l,fieldConfig:t,t:m,placeholder:d}=n,{name:r,label:u,validation:o}=t,e=t.options||{};return s(h,{name:r,control:i,rules:o?p(o):void 0,render:({field:a})=>s(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 S}from"../types";function D(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?S(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{D 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 S}from"../types";function j(C){const{control:s,errors:d,fieldConfig:t,t:a,onChange:F}=C,{name:l,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,a)})),[p,a]),m=b.fieldSpecific;return v(D,{name:l,control:s,rules:e?S(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:a(h),value:o.value!==void 0&&o.value!==null?String(o.value):"",onChange:y,onBlur:o.onBlur,options:O,error:!!d[l],helperText:d[l]?.message,required:e?.required})}})}export{j 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 O}from"../../form/fields";import{convertValidationRules as R}from"../types";function q(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?R(e):void 0,render:({field:o})=>p(O,{...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{q as ControlledRadioField};
|
|
@@ -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{ComboboxComponent as C}from"../../form/fields";import{translateLabel as x}from"../../../forms/utils";import{convertValidationRules as y}from"../types";function S(s){const{control:m,errors:n,fieldConfig:u,t:c,placeholder:p}=s,{name:a,label:d,validation:r,options:f={}}=u,v=h(()=>{const e=r?.min??1900,t=r?.max??new Date().getFullYear()+10,l=[];for(let o=t;o>=e;o--)l.push({value:String(o),label:String(o)});return l},[r?.min,r?.max]);return i(b,{name:a,control:m,rules:r?y(r):void 0,render:({field:e})=>{const t=l=>{const o=typeof l=="string"?l:l.target.value,g=o===""?void 0:Number(o);e.onChange(g)};return i(C,{...e,label:x(d,c),value:e.value!==void 0&&e.value!==null?String(e.value):"",onChange:t,onBlur:e.onBlur,options:v,error:!!n[a],helperText:n[a]?.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 d}from"./ControlledMultiDropdownField";import{ControlledRadioField as r}from"./ControlledRadioField";import{ControlledYearField as e}from"./ControlledYearField";export{o as ControlledComboboxField,l as ControlledDropdownField,d as ControlledMultiDropdownField,r as ControlledRadioField,e 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:u,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 d=l;export{l as AvatarFieldDisplay,d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{Badge as l,Text as n}from"@donotdev/components";const s=({config:m,value:a,t:r,className:e})=>{if(a==null)return o(n,{as:"span",variant:"muted",className:e,children:"-"});const t=typeof a=="boolean"?r(a?"common.yes":"common.no"):String(a);return o(l,{variant:typeof a=="boolean"?a?"default":"secondary":"outline",className:e,children:t})};var i=s;export{s as BadgeFieldDisplay,i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=()=>null;var
|
|
1
|
+
const t=()=>null;var a=t;export{t as ButtonFieldDisplay,a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Badge as c,Text as n}from"@donotdev/components";const r=({config:m,value:a,t,className:s})=>{if(a==null)return e(n,{as:"span",variant:"muted",className:s,children:"-"});const o=t(a?"common.yes":"common.no");return e(c,{variant:a?"default":"secondary",className:s,children:o})};var l=r;export{r 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:r,t:u,className:e,loading:c=!1})=>{if(c)return a(o,{className:e});if(!r)return a(s,{as:"span",variant:"muted",className:e,children:"-"});try{const n=new Date(r),t=n.toLocaleDateString(),m=n.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 r,BADGE_VARIANT as i,Text as n}from"@donotdev/components";const o=({config:c,value:a,t:l,className:s})=>a?e(r,{variant:i.OUTLINE,className:s,children:a}):e(n,{as:"span",variant:"muted",className:s,children:"-"});var t=o;export{o as DropdownDisplay,t 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",gap:"medium",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 i}from"react/jsx-runtime";import{Text as e}from"@donotdev/components";const l=({config:t,value:a,t:m,className:s})=>!a||a.lat===void 0&&a.lng===void 0?o(e,{as:"span",variant:"muted",className:s,children:"-"}):i(e,{as:"div",level:"small",className:`font-mono ${s||""}`,children:[a.lat?.toFixed(6),", ",a.lng?.toFixed(6)]});var d=l;export{l as GeoPointFieldDisplay,d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l=()=>null;var a=l;export{l as HiddenFieldDisplay,a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import{Avatar as n,Text as p}from"@donotdev/components";const t=({config:a,value:s,t:u,className:e,size:r="md"})=>{if(!s)return l(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 l(n,{src:s,alt:a.label||"Image",fallback:c(a.label||"IMG"),className:`${i[r]} ${e||""}`})};var d=t;export{t as ImageFieldDisplay,d 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 i}from"react/jsx-runtime";import{Text as l}from"@donotdev/components";const e=({config:m,value:a,t:r,className:s})=>!a||a.lat===void 0&&a.lng===void 0?o(l,{as:"span",variant:"muted",className:s,children:"-"}):i(l,{as:"div",level:"small",className:`font-mono ${s||""}`,children:[a.lat?.toFixed(6),", ",a.lng?.toFixed(6)]});var d=e;export{e as MapFieldDisplay,d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{Badge as l,BADGE_VARIANT as m,Text as n,Stack as o}from"@donotdev/components";const e=({config:p,value:a,t:d,className:r})=>!a||!Array.isArray(a)||a.length===0?s(n,{as:"span",variant:"muted",className:r,children:"-"}):s(o,{direction:"row",wrap:"wrap",gap:"medium",className:r,children:a.map((t,i)=>s(l,{variant:m.OUTLINE,children:String(t)},i))});var c=e;export{e as MultiDropdownDisplay,c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{Badge as n,BADGE_VARIANT as l,Text as m,Stack as c}from"@donotdev/components";const e=({config:d,value:a,t:o,className:t})=>!a||!Array.isArray(a)||a.length===0?s(m,{as:"span",variant:"muted",className:t,children:"-"}):s(c,{direction:"row",wrap:"wrap",gap:"medium",className:t,children:a.map((r,i)=>s(n,{variant:l.OUTLINE,children:String(r)},i))});var p=e;export{e as MultiInputTextFieldDisplay,p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{Text as l,Spinner as t}from"@donotdev/components";const o=({config:m,value:e,t:r,className:a,loading:n=!1})=>n?s(t,{className:a}):e==null?s(l,{as:"span",variant:"muted",className:a,children:"-"}):s(l,{as:"span",className:`font-mono ${a||""}`,children:e.toLocaleString()});var i=o;export{o as NumberFieldDisplay,i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,jsxs as
|
|
1
|
+
import{jsx as o,jsxs as r}from"react/jsx-runtime";import{Eye as c,EyeOff as n}from"lucide-react";import{useState as m}from"react";import{Skeleton as u,Button as y,CopyToClipboard as f,Stack as i}from"@donotdev/components";const l=({config:w,value:e,t:s,className:t,loading:d=!1})=>{const[a,p]=m(!1);return d?o(u,{className:t}):e?r(i,{direction:"row",align:"center",gap:"medium",className:t,children:[o("span",{style:{fontFamily:"monospace"},children:a?e:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}),r(i,{direction:"row",align:"center",gap:"tight",children:[o(y,{type:"button",onClick:()=>p(!a),"aria-label":a?"Hide password":"Show password",children:a?o(n,{}):o(c,{})}),o(f,{text:e,tooltipText:s("copyToClipboard")||"Copy to clipboard",copiedTooltipText:s("copied")||"Copied!",ariaLabel:s("copyPassword")||"Copy password"})]})]}):o("div",{style:{color:"var(--muted-foreground)"},children:"-"})};var g=l;export{l as PasswordFieldDisplay,g 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 l,BADGE_VARIANT as o,Text as r}from"@donotdev/components";const i=({config:c,value:a,t:d,className:s})=>a?e(l,{variant:o.OUTLINE,className:s,children:a}):e(r,{as:"span",variant:"muted",className:s,children:"-"});var t=i;export{i as RadioFieldDisplay,t 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 o=({config:n,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 t=o;export{o as RangeFieldDisplay,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Badge as n,BADGE_VARIANT as r,Text as m}from"@donotdev/components";const t=({config:c,value:a,t:d,className:s})=>{if(!a)return e(m,{as:"span",variant:"muted",className:s,children:"-"});const i=a.displayName||a.name||a.id||a;return e(n,{variant:r.OUTLINE,className:s,children:String(i)})};var l=t;export{t as ReferenceFieldDisplay,l as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r,jsxs as s}from"react/jsx-runtime";import{Text as i}from"@donotdev/components";const a=({config:n,value:e,t:m,className:o})=>!e||e.trim()===""?r(i,{as:"span",variant:"muted",className:o,children:"-"}):s("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: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 t=a;export{a as RichTextDisplay,t 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 t=({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 r=t;export{t as TextAreaDisplay,r 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 k,Clock as L}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(k,{});case"time":return e(L,{});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 b}from"./ReferenceFieldDisplay";import{default as g}from"./TimestampFieldDisplay";import{default as M}from"./HiddenFieldDisplay";import{default as R}from"./ButtonFieldDisplay";export{s as AvatarFieldDisplay,i as BadgeFieldDisplay,R as ButtonFieldDisplay,m as CheckboxFieldDisplay,e as DateFieldDisplay,d as DropdownDisplay,F as FileFieldDisplay,x as GeoPointFieldDisplay,M 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,b as ReferenceFieldDisplay,p as RichTextDisplay,r as TextAreaDisplay,a as TextFieldDisplay,g as TimestampFieldDisplay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a,jsxs as g}from"react/jsx-runtime";import{MapPin as R}from"lucide-react";import{useState as w,useEffect as S,useRef as b,useMemo as U}from"react";import{Combobox as M,Stack as T}from"@donotdev/components";import{useTranslation as W,getPlatformEnvVar as Y}from"@donotdev/core";const $=({label:x,value:i,onChange:z,enableGoogleMaps:q=!1,extractDistrictCode:L,error:d,helperText:l,required:P})=>{const{t:s}=W("dndev"),[n,m]=w(i?.formatted_address||""),[f,v]=w([]),[E,u]=w(!1),h=b(null),_=b(null),c=b(null),y=Y("GOOGLE_MAPS_API_KEY")||"",o=q&&!!y,G=U(()=>f.map(e=>({value:e.place_id,label:e.description,description:e.structured_formatting?.secondary_text,content:g("div",{style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)"},children:[a(R,{style:{width:"var(--size-icon-sm)",height:"var(--size-icon-sm)"}}),g("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})]})]})})),[f]),K=e=>{_.current&&(u(!0),_.current.getDetails({placeId:e,fields:["formatted_address","geometry","address_components"]},(r,t)=>{if(u(!1),t===window.google?.maps?.places?.PlacesServiceStatus.OK&&r){const p=r.formatted_address||"",V=r.geometry?.location?.lat(),j=r.geometry?.location?.lng(),A={formatted_address:p,latitude:V,longitude:j};if(L&&r.address_components){const C=r.address_components.find(D=>D.types.includes("postal_code"))?.long_name||"",k=C.startsWith("92")?92:parseInt(C.slice(-2),10)||null;A.district_code=k}m(p),z(A)}}))};S(()=>{i?.formatted_address&&m(i.formatted_address)},[i]),S(()=>{if(!o)return;const e=()=>{if(window.google?.maps?.places){r();return}if(document.querySelector("#google-maps-script")){const p=setInterval(()=>{window.google?.maps?.places&&(clearInterval(p),r())},100);return}const t=document.createElement("script");t.id="google-maps-script",t.src=`https://maps.googleapis.com/maps/api/js?key=${y}&libraries=places`,t.async=!0,t.defer=!0,t.onload=()=>r(),document.head.appendChild(t)},r=()=>{window.google?.maps?.places&&(h.current=new window.google.maps.places.AutocompleteService,_.current=new window.google.maps.places.PlacesService(document.createElement("div")))};e()},[o,y]),S(()=>{if(!o||!n||!h.current){v([]);return}return c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{u(!0),h.current.getPlacePredictions({input:n,types:["geocode","establishment"]},(e,r)=>{u(!1),r===window.google?.maps?.places?.PlacesServiceStatus.OK&&e?v(e):v([])})},300),()=>{c.current&&clearTimeout(c.current)}},[o,n]);const O=e=>{m(e),z({formatted_address:e})},I=e=>{const r=Array.isArray(e)?e[0]||"":e;if(!o){O(r);return}f.some(t=>t.place_id===r)&&K(r)};return o?g(T,{gap:"tight",children:[a(M,{label:x,value:n,onValueChange:I,onSearchChange:e=>{o&&m(e)},placeholder:s("common.address_placeholder"),emptyMessage:s(E?"common.loading":"common.no_results"),options:G,required:P,variant:d?"destructive":void 0,isLoading:E,creatable:!0,createLabel:s("actions.use","Use")}),l&&a("p",{style:{fontSize:"var(--font-size-xs)",color:d?"var(--destructive-foreground)":"var(--muted-foreground)"},children:l})]}):g(T,{gap:"tight",children:[a(M,{label:x,value:n,onValueChange:I,placeholder:s("common.address_placeholder"),options:[],required:P,variant:d?"destructive":void 0,creatable:!0,createLabel:s("actions.use","Use")}),l&&a("p",{style:{fontSize:"var(--font-size-xs)",color:d?"var(--destructive-foreground)":"var(--muted-foreground)"},children:l})]})};var F=$;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 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 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
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 +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:i,variant:l,disabled:o=!1})=>r(e,{type:t,onClick:i,variant:l,disabled:o,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 o,Stack as s}from"@donotdev/components";const n=({label:a,checked:c=!1,onChange:e,required:t})=>h(s,{direction:"row",align:"center",gap:"tight",children:[r(i,{checked:c,onCheckedChange:d=>{e&&e({target:{checked:d}})}}),r(o,{required:t,children:a})]});var l=n;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 q,useId as D}from"react";import{Combobox as I,Stack as d}from"@donotdev/components";import{useTranslation as L}from"@donotdev/core";const N=({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}=L(v),i=D(),z=q(()=>s.map(e=>({value:String(e.value),label:e.label})),[s]),C=e=>{if(n){const $={target:{value:Array.isArray(e)?e[0]||"":e}};n($)}},A=e=>{e||m?.()},t=!!p,M=`${i}-error`,j=`${i}-helper`;return c(d,{gap:"tight",children:[o(I,{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=N;export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a,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 j,Stack as C}from"@donotdev/components";const L=({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(",","."),t=parseFloat(r);return isNaN(t)?null:Math.round(t*100)},[F,c]=I(u(n));S(()=>{c(u(n))},[n]);const N=e=>{const r=e.target.value;c(r);const t={target:{value:x(r)}};m(t)},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(C,{gap:"tight",children:[a(j,{htmlFor:d,label:g,disabled:i,required:y,children:v("div",{style:{position:"relative"},children:[a("span",{style:{position:"absolute",left:"var(--gap-md)",top:"50%",transform:"translateY(-50%)",color:"var(--muted-foreground)",pointerEvents:"none",zIndex:1},children:p}),a(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&&a("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:s})]})};var T=L;export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as l,jsxs as
|
|
1
|
+
import{jsx as l,jsxs as c}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 u=t=>{const S=t.target.value?new Date(t.target.value).toISOString():null;i(S)};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 c(p,{gap:"tight",children:[l(m,{label:n,type:e,value:r,onChange:u,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 a,jsxs as i,Fragment as le}from"react/jsx-runtime";import{Upload as se,X as oe,FileText as T,FileSpreadsheet as ne,File as ie,Loader2 as de,Eye as ce}from"lucide-react";import{useCallback as y,useState as I,useRef as N,useEffect as B,useImperativeHandle as ue,forwardRef as pe}from"react";import{Button as q,BUTTON_VARIANT as G,Text as g,Stack as w,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 we}from"../../../contexts/UploadContext";import{useUploadStore as xe}from"../../../stores/UploadStore";import{uploadFile as be,deleteFile as Te,generateFileId as X,getFileIcon as Ne,formatFileSize as Pe,getDocumentAcceptString as De}from"../../../utils/fileStorage";function Fe({type:m,className:c}){switch(m){case"pdf":return a(T,{className:c,style:{color:"var(--destructive)"}});case"doc":return a(T,{className:c,style:{color:"var(--primary)"}});case"xls":return a(ne,{className:c,style:{color:"var(--success)"}});case"ppt":return a(T,{className:c,style:{color:"var(--warning)"}});case"text":case"html":return a(T,{className:c});default:return a(ie,{className:c})}}const V=pe(({name:m,label:c,value:f,onChange:U,error:D,helperText:L,multiple:p=!1,maxFiles:F=10,maxSize:k=25*1024*1024,storagePath:O="uploads/documents",required:_,enablePreview:R=!0},K)=>{const{t:Q}=ye("dndev"),n=Q,v=we(),z=xe(),A=!!v,[o,u]=I([]),[H,C]=I(!1),[S,W]=I(null),h=N(null),E=N(!1),x=N(void 0),Y=De(),b=y(e=>{const r=e.filter(t=>t.uploaded&&!t.error).map(t=>t.uploaded);U(p?r:r[0]||null)},[p,U]);B(()=>{if(E.current){E.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})}),u(e)}else u([])},[f]);const Z=y(async()=>{const e=o.filter(r=>!r.uploaded&&!r.error&&r.uploadProgress===null);if(e.length!==0){u(r=>r.map(t=>e.some(l=>l.id===t.id)?{...t,uploadProgress:0}:t));for(const r of e)try{const t=await be(r.file,{storagePath:O,onProgress:l=>{u(d=>d.map(s=>s.id===r.id?{...s,uploadProgress:l.progress}:s))}});u(l=>{const d=l.map(s=>s.id===r.id?{...s,uploaded:t,uploadProgress:100,error:null}:s);return queueMicrotask(()=>b(d)),d})}catch{u(t=>t.map(l=>l.id===r.id?{...l,error:"Upload failed",uploadProgress:null}:l))}}},[o,O,b]);x.current=Z,B(()=>{if(!(!v||!m))return z.registerUpload(v,m,async e=>{await x.current?.()}),()=>{z.unregisterUpload(v,m)}},[v,m,z]),ue(K,()=>({upload:async()=>{await x.current?.()},getDocuments:()=>j.current||[]}),[]);const j=N(o);j.current=o;const $=e=>{const r=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".html",".csv"],t="."+e.name.split(".").pop()?.toLowerCase();return r.includes(t)},M=y(e=>{const r=(p?F:1)-o.length;if(r<=0){P(new Error("Maximum documents reached"),{userMessage:n("document.errors.maxFiles",{max:F}),severity:"warning",showNotification:!0});return}const t=e.slice(0,r),l=[],d=(k/(1024*1024)).toFixed(0);for(const s of t){if(!$(s)){P(new Error("Invalid document type"),{userMessage:n("document.errors.invalidType",{fileName:s.name}),severity:"warning",showNotification:!0});continue}if(s.size>k){P(new Error("Document too large"),{userMessage:n("document.errors.exceedsSize",{fileName:s.name,size:d}),severity:"warning",showNotification:!0});continue}l.push({id:X(),file:s,uploadProgress:null,uploaded:null,error:null})}l.length!==0&&(u(s=>p?[...s,...l]:l),A||setTimeout(()=>x.current?.(),0))},[o,p,F,k,n,A]),J=e=>{const r=Array.from(e.target.files||[]);r.length>0&&M(r),h.current&&(h.current.value="")},ee=y(e=>{e.preventDefault(),C(!1);const r=Array.from(e.dataTransfer.files);M(r)},[M]),re=y(async e=>{const r=o[e];if(r)try{r.uploaded&&await Te(r.uploaded);const t=o.filter((l,d)=>d!==e);E.current=!0,u(t),setTimeout(()=>b(t),0)}catch(t){P(t,{userMessage:n("document.delete.failed"),severity:"error",showNotification:!0})}},[o,b,n]),ae=e=>{e.uploaded?.url&&e.uploaded.mimeType==="application/pdf"&&W(e.uploaded.url)},te=p||o.length===0;return i(le,{children:[i(w,{gap:"tight",children:[i(g,{level:"body",align:"start",children:[c,_?"*":""]}),te&&i("div",{role:"button",tabIndex:0,"aria-label":n("document.upload.ariaLabel"),className:"dndev-surface","data-variant":D?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:H?"var(--primary)":D?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:H?"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(),C(!0)},onDragLeave:()=>C(!1),onDrop:ee,onClick:()=>h.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),h.current?.click())},children:[a("input",{ref:h,type:"file",accept:Y,multiple:p,style:{display:"none"},onChange:J}),i(w,{align:"center",justify:"center",gap:"medium",children:[a(se,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),a(g,{as:"p",variant:"muted",level:"small",align:"center",children:n("document.upload.hint")}),a(g,{as:"p",variant:"muted",level:"caption",align:"center",children:"PDF, Word, Excel, PowerPoint, TXT, Markdown, HTML"})]})]}),o.length>0&&a(w,{gap:"tight",children:o.map((e,r)=>{const t=Ne(e.uploaded?.mimeType||e.file.type,e.file.name),l=e.uploadProgress!==null&&e.uploadProgress<100,d=e.uploaded?.mimeType==="application/pdf"||e.file.name.toLowerCase().endsWith(".pdf");return i("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:[a(Fe,{type:t,className:"dndev-size-md"}),i(w,{gap:"none",style:{flex:1,minWidth:0},children:[a(g,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),i(g,{level:"caption",variant:"muted",children:[Pe(e.uploaded?.size||e.file.size),e.error&&i("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),l&&a(me,{value:e.uploadProgress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),i(w,{direction:"row",gap:"tight",children:[R&&d&&e.uploaded&&a(q,{variant:G.GHOST,onClick:()=>ae(e),"aria-label":n("document.preview.ariaLabel"),children:a(ce,{className:"dndev-size-sm"})}),l?a(de,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):a(q,{variant:G.GHOST,onClick:()=>re(r),"aria-label":n("document.delete.ariaLabel"),children:a(oe,{className:"dndev-size-sm"})})]})]},e.id)})}),L&&a(g,{level:"caption",variant:D?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:L})]}),R&&S&&a(ge,{open:!!S,onOpenChange:()=>W(null),children:i(fe,{style:{maxWidth:"90vw",maxHeight:"90vh",width:"900px",height:"80vh"},children:[a(ve,{children:a(he,{children:n("document.preview.title")})}),a("iframe",{src:S,style:{width:"100%",height:"100%",border:"none",borderRadius:"var(--radius-md)"},title:"PDF Preview"})]})})]})});V.displayName="DocumentFieldComponent";var ke=V;export{ke as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l,jsxs as g}from"react/jsx-runtime";import{Select as c,Stack as v}from"@donotdev/components";import{useTranslation as m}from"@donotdev/core";const f=({label:t,value:r,options:n,error:s,helperText:a,onChange:o,onBlur:i,required:u})=>{const{t:p}=m("dndev"),d=r!=null?String(r):"";return g(v,{gap:"tight",children:[l(c,{label:t,value:d,onValueChange:e=>{o&&o({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&&l("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{useState as T,useMemo as k}from"react";import{Clock as x}from"lucide-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 W(a,o){const n=a<60?`${a}m`:a%60===0?`${a/60}h`:`${Math.floor(a/60)}h${a%60}`,u=N[a];return!o||!u?n:o(`crud:${u}`,{defaultValue:n})??n}const j=({label:a,value:o,onChange:n,error:u,helperText:d,disabled:m,required:p,readonly:C,min:g=0,max:v=480,step:M=5,t})=>{const r=typeof o=="number"&&!Number.isNaN(o)?o:0,h=f.includes(r),[c,b]=T(!h&&r>0),V=k(()=>f.map(e=>({minutes:e,label:W(e,t)})),[t]),y=t?t("crud:duration.custom",{defaultValue:"Custom"}):"Custom";if(C){const e=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:a}),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:e})]}),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,{gap:"medium",children:[i(z,{required:p,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:a}),l(s,{direction:"row",gap:"tight",align:"center",style:{flexWrap:"wrap"},children:[V.map(({minutes:e,label:$})=>l(S,{type:"button",variant:r===e?"primary":"outline",disabled:m,onClick:()=>{b(!1),n(e)},"aria-pressed":r===e,"aria-label":$,children:[i(x,{size:14,style:{marginRight:"var(--gap-xs)"},"aria-hidden":!0}),$]},e)),i(S,{type:"button",variant:c?"primary":"outline",disabled:m,onClick:()=>{b(!0),!h&&r>0?n(r):n(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:([e])=>n(Math.max(g,Math.min(v,e??0))),min:g,max:v,step:M,showValue:!0,disabled:m,"aria-label":a})}),d&&i("p",{style:{fontSize:"var(--font-size-xs)",color:u?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})};var q=j;export{f as DURATION_PRESETS,q as default};
|