@donotdev/crud 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/CrudService.js +1 -1
  2. package/dist/CrudStore.js +1 -1
  3. package/dist/FieldRegistry.js +1 -1
  4. package/dist/adapters/FirestoreAdapter.js +1 -1
  5. package/dist/adapters/FunctionsAdapter.js +1 -1
  6. package/dist/adapters/index.js +1 -1
  7. package/dist/components/CrudButton.js +1 -1
  8. package/dist/components/DisplayFieldRenderer.js +1 -1
  9. package/dist/components/EntityDisplayRenderer.js +1 -1
  10. package/dist/components/EntityFilters.d.ts.map +1 -1
  11. package/dist/components/EntityFilters.js +1 -1
  12. package/dist/components/FormFieldRenderer.js +1 -1
  13. package/dist/components/FormLayout.js +1 -1
  14. package/dist/components/controlled/complex/ControlledAddressField.js +1 -1
  15. package/dist/components/controlled/complex/ControlledDateField.js +1 -1
  16. package/dist/components/controlled/complex/ControlledGeoPointField.js +1 -1
  17. package/dist/components/controlled/complex/ControlledMapField.js +1 -1
  18. package/dist/components/controlled/complex/ControlledMultiInputField.js +1 -1
  19. package/dist/components/controlled/complex/ControlledRichTextField.js +1 -1
  20. package/dist/components/controlled/complex/ControlledTimestampField.js +1 -1
  21. package/dist/components/controlled/complex/index.js +1 -1
  22. package/dist/components/controlled/file/ControlledDocumentField.js +1 -1
  23. package/dist/components/controlled/file/ControlledFileField.js +1 -1
  24. package/dist/components/controlled/file/ControlledImageField.js +1 -1
  25. package/dist/components/controlled/file/ControlledMultiDocumentField.js +1 -1
  26. package/dist/components/controlled/file/ControlledMultiFileField.js +1 -1
  27. package/dist/components/controlled/file/ControlledMultiImageField.js +1 -1
  28. package/dist/components/controlled/file/index.js +1 -1
  29. package/dist/components/controlled/index.js +1 -1
  30. package/dist/components/controlled/input/ControlledCheckboxField.js +1 -1
  31. package/dist/components/controlled/input/ControlledCurrencyField.js +1 -1
  32. package/dist/components/controlled/input/ControlledDurationField.js +1 -1
  33. package/dist/components/controlled/input/ControlledGdprConsentField.js +1 -1
  34. package/dist/components/controlled/input/ControlledNumberField.js +1 -1
  35. package/dist/components/controlled/input/ControlledPasswordField.js +1 -1
  36. package/dist/components/controlled/input/ControlledPhoneField.js +1 -1
  37. package/dist/components/controlled/input/ControlledPriceField.js +1 -1
  38. package/dist/components/controlled/input/ControlledRangeField.js +1 -1
  39. package/dist/components/controlled/input/ControlledRatingField.js +1 -1
  40. package/dist/components/controlled/input/ControlledSwitchField.js +1 -1
  41. package/dist/components/controlled/input/ControlledTextField.js +1 -1
  42. package/dist/components/controlled/input/ControlledTextareaField.js +1 -1
  43. package/dist/components/controlled/input/index.js +1 -1
  44. package/dist/components/controlled/select/ControlledComboboxField.js +1 -1
  45. package/dist/components/controlled/select/ControlledDropdownField.js +1 -1
  46. package/dist/components/controlled/select/ControlledMultiDropdownField.js +1 -1
  47. package/dist/components/controlled/select/ControlledRadioField.js +1 -1
  48. package/dist/components/controlled/select/ControlledYearField.js +1 -1
  49. package/dist/components/controlled/select/index.js +1 -1
  50. package/dist/components/controlled/types.js +1 -1
  51. package/dist/components/fields/display/AvatarFieldDisplay.js +1 -1
  52. package/dist/components/fields/display/BadgeFieldDisplay.js +1 -1
  53. package/dist/components/fields/display/ButtonFieldDisplay.js +1 -1
  54. package/dist/components/fields/display/CheckboxFieldDisplay.js +1 -1
  55. package/dist/components/fields/display/DateFieldDisplay.js +1 -1
  56. package/dist/components/fields/display/DropdownDisplay.js +1 -1
  57. package/dist/components/fields/display/FileFieldDisplay.js +1 -1
  58. package/dist/components/fields/display/GeoPointFieldDisplay.js +1 -1
  59. package/dist/components/fields/display/HiddenFieldDisplay.js +1 -1
  60. package/dist/components/fields/display/ImageFieldDisplay.js +1 -1
  61. package/dist/components/fields/display/LinkFieldDisplay.js +1 -1
  62. package/dist/components/fields/display/MapFieldDisplay.js +1 -1
  63. package/dist/components/fields/display/MultiDropdownDisplay.js +1 -1
  64. package/dist/components/fields/display/MultiInputTextFieldDisplay.js +1 -1
  65. package/dist/components/fields/display/NumberFieldDisplay.js +1 -1
  66. package/dist/components/fields/display/PasswordFieldDisplay.js +1 -1
  67. package/dist/components/fields/display/PhoneNumberDisplay.js +1 -1
  68. package/dist/components/fields/display/RadioFieldDisplay.js +1 -1
  69. package/dist/components/fields/display/RangeFieldDisplay.js +1 -1
  70. package/dist/components/fields/display/ReferenceFieldDisplay.js +1 -1
  71. package/dist/components/fields/display/RichTextDisplay.js +2 -2
  72. package/dist/components/fields/display/TextAreaDisplay.js +1 -1
  73. package/dist/components/fields/display/TextFieldDisplay.js +1 -1
  74. package/dist/components/fields/display/TimestampFieldDisplay.js +1 -1
  75. package/dist/components/fields/display/index.js +1 -1
  76. package/dist/components/form/fields/AddressFieldComponent.js +1 -1
  77. package/dist/components/form/fields/AvatarFieldComponent.js +1 -1
  78. package/dist/components/form/fields/BadgeFieldComponent.js +1 -1
  79. package/dist/components/form/fields/ButtonFieldComponent.js +1 -1
  80. package/dist/components/form/fields/CheckboxFieldComponent.js +1 -1
  81. package/dist/components/form/fields/ComboboxComponent.js +1 -1
  82. package/dist/components/form/fields/CurrencyFieldComponent.js +1 -1
  83. package/dist/components/form/fields/DateFieldComponent.js +1 -1
  84. package/dist/components/form/fields/DocumentFieldComponent.js +1 -1
  85. package/dist/components/form/fields/DropdownComponent.js +1 -1
  86. package/dist/components/form/fields/DurationFieldComponent.js +1 -1
  87. package/dist/components/form/fields/FileFieldComponent.js +1 -1
  88. package/dist/components/form/fields/GdprConsentFieldComponent.js +1 -1
  89. package/dist/components/form/fields/GeoPointFieldComponent.js +1 -1
  90. package/dist/components/form/fields/HiddenFieldComponent.js +1 -1
  91. package/dist/components/form/fields/ImageFieldComponent.js +1 -1
  92. package/dist/components/form/fields/MapFieldComponent.js +1 -1
  93. package/dist/components/form/fields/MultiDropdownComponent.js +1 -1
  94. package/dist/components/form/fields/MultiInputTextFieldComponent.js +1 -1
  95. package/dist/components/form/fields/NumberFieldComponent.js +1 -1
  96. package/dist/components/form/fields/PasswordFieldComponent.js +1 -1
  97. package/dist/components/form/fields/PriceFieldComponent.js +1 -1
  98. package/dist/components/form/fields/RadioFieldComponent.js +1 -1
  99. package/dist/components/form/fields/RangeFieldComponent.js +1 -1
  100. package/dist/components/form/fields/RatingFieldComponent.js +1 -1
  101. package/dist/components/form/fields/ReferenceFieldComponent.js +1 -1
  102. package/dist/components/form/fields/RichTextComponent.js +1 -1
  103. package/dist/components/form/fields/SwitchFieldComponent.js +1 -1
  104. package/dist/components/form/fields/TextAreaComponent.js +1 -1
  105. package/dist/components/form/fields/TextFieldComponent.js +1 -1
  106. package/dist/components/form/fields/TimestampFieldComponent.js +1 -1
  107. package/dist/components/form/fields/index.js +1 -1
  108. package/dist/components/form/fields/internal/TiptapEditor.js +2 -2
  109. package/dist/components/form/internal/ImageViewerDialog.js +1 -1
  110. package/dist/components/index.js +1 -1
  111. package/dist/contexts/UploadContext.js +1 -1
  112. package/dist/contexts/index.js +1 -1
  113. package/dist/fieldTypeRegistry.js +1 -1
  114. package/dist/forms/hooks/index.js +1 -1
  115. package/dist/forms/hooks/useController.js +1 -1
  116. package/dist/forms/hooks/useEntityField.js +1 -1
  117. package/dist/forms/index.js +1 -1
  118. package/dist/forms/utils/getFieldsForOperation.js +1 -1
  119. package/dist/forms/utils/index.js +1 -1
  120. package/dist/forms/utils/isFieldEditable.js +1 -1
  121. package/dist/forms/utils/validateEntity.js +1 -1
  122. package/dist/hooks/index.js +1 -1
  123. package/dist/hooks/useEntityFavorites.js +1 -1
  124. package/dist/hooks/useFileUpload.js +1 -1
  125. package/dist/hooks/useFormNavigationGuard.js +1 -1
  126. package/dist/hooks/useRelatedItems.js +1 -1
  127. package/dist/hooks/useUnsavedChangesWarning.js +1 -1
  128. package/dist/index.js +1 -1
  129. package/dist/stores/FormStore.js +1 -1
  130. package/dist/stores/UploadStore.js +1 -1
  131. package/dist/stores/index.js +1 -1
  132. package/dist/tsconfig.tsbuildinfo +1 -1
  133. package/dist/useBaseCrudList.js +1 -1
  134. package/dist/useCrud.js +1 -1
  135. package/dist/useCrudCardList.js +1 -1
  136. package/dist/useCrudList.js +1 -1
  137. package/dist/utils/collections.js +1 -1
  138. package/dist/utils/fileStorage.js +1 -1
  139. package/dist/utils/imageProcessing.js +1 -1
  140. package/dist/utils/imageStorage.js +1 -1
  141. package/dist/utils/imageUtils.js +1 -1
  142. package/dist/utils/mergeWithOptimistic.js +1 -1
  143. package/dist/utils/scopeUtils.js +1 -1
  144. package/dist/utils/uploadValidation.js +1 -1
  145. package/package.json +2 -2
@@ -1 +1 @@
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
+ "use client";import{jsx as C}from"react/jsx-runtime";import{useMemo as g}from"react";import{Controller as w,useWatch as y,useFormContext as D}from"react-hook-form";import{translateLabel as S}from"../../../forms/utils";import{DropdownComponent as j}from"../../form/fields";import{convertValidationRules as q}from"../types";function _(h){const{control:u,errors:d,fieldConfig:r,t:s,onChange:B}=h,{name:i,label:O,validation:n,options:V={}}=r,p=D()?.setValue,o=y({control:u}),t="dependsOn"in r?r.dependsOn:void 0,x=t&&o?o[t.field]:void 0,f=g(()=>{const e=n?.options;return e?typeof e=="function"?e(o||{}):e:[]},[n?.options,o,x]),b=g(()=>f.map(e=>({...e,label:S(e.label,s)})),[f,s]),c=V.fieldSpecific;return C(w,{name:i,control:u,rules:n?q(n):void 0,render:({field:e})=>{const v=l=>{const m=typeof l=="string"?l:l.target.value;if(e.onChange(m),t&&p&&c?.setParentOnChange){const a=c.setParentOnChange(m,o||{});a!=null&&p(t.field,a,{shouldValidate:!0,shouldDirty:!0})}};return C(j,{label:s(O),value:e.value!==void 0&&e.value!==null?String(e.value):"",onChange:v,onBlur:e.onBlur,options:b,error:!!d[i],helperText:d[i]?.message,required:n?.required})}})}export{_ as ControlledDropdownField};
@@ -1 +1 @@
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
+ "use client";import{jsx as m}from"react/jsx-runtime";import{useMemo as c}from"react";import{Controller as y,useWatch as O}from"react-hook-form";import{translateLabel as b}from"../../../forms/utils";import{MultiDropdownComponent as x}from"../../form/fields";import{convertValidationRules as A}from"../types";function D(f){const{control:i,errors:u,fieldConfig:t,t:a}=f,{name:l,label:g,validation:n}=t,r=O({control:i}),p="dependsOn"in t?t.dependsOn:void 0,h=p&&r?r[p.field]:void 0,d=c(()=>{const e=n?.options;return e?typeof e=="function"?e(r||{}):e:[]},[n?.options,r,h]),C=c(()=>d.map(e=>({value:String(e.value),label:b(e.label,a)})),[d,a]);return m(y,{name:l,control:i,rules:n?A(n):void 0,render:({field:e})=>{const v=s=>{let o;if(Array.isArray(s))o=s;else try{o=JSON.parse(s.target.value)}catch{o=[]}e.onChange(o)};return m(x,{...e,label:a(g),value:Array.isArray(e.value)?e.value:[],onChange:v,onBlur:e.onBlur,options:C,error:!!u[l],helperText:u[l]?.message,required:n?.required})}})}export{D as ControlledMultiDropdownField};
@@ -1 +1 @@
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
+ "use client";import{jsx as p}from"react/jsx-runtime";import{useMemo as m}from"react";import{Controller as v,useWatch as O}from"react-hook-form";import{translateLabel as h}from"../../../forms/utils";import{RadioFieldComponent as x}from"../../form/fields";import{convertValidationRules as V}from"../types";function L(f){const{control:a,errors:l,fieldConfig:r,t}=f,{name:i,label:c,validation:n}=r,o=O({control:a}),d="dependsOn"in r?r.dependsOn:void 0,g=d&&o?o[d.field]:void 0,u=m(()=>{const e=n?.options;return e?typeof e=="function"?e(o||{}):e:[]},[n?.options,o,g]),C=m(()=>u.map(e=>({value:String(e.value),label:h(e.label,t)})),[u,t]);return p(v,{name:i,control:a,rules:n?V(n):void 0,render:({field:e})=>p(x,{...e,label:t(c),value:e.value??void 0,onChange:s=>{const b=typeof s=="string"?s:s.target.value;e.onChange(b)},options:C,error:!!l[i],helperText:l[i]?.message,required:n?.required})})}export{L as ControlledRadioField};
@@ -1 +1 @@
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
+ "use client";import{jsx as s}from"react/jsx-runtime";import{useMemo as b}from"react";import{Controller as x}from"react-hook-form";import{ComboboxComponent as C}from"../../form/fields";import{translateLabel as y}from"../../../forms/utils";import{convertValidationRules as v}from"../types";function B(i){const{control:u,errors:l,fieldConfig:m,t:c,placeholder:p}=i,{name:t,label:d,validation:r,options:f={}}=m,g=b(()=>{const e=r?.min??1900,a=r?.max??new Date().getFullYear()+10,n=[];for(let o=a;o>=e;o--)n.push({value:String(o),label:String(o)});return n},[r?.min,r?.max]);return s(x,{name:t,control:u,rules:r?v(r):void 0,render:({field:e})=>{const a=n=>{const o=typeof n=="string"?n:n.target.value,h=o===""?void 0:Number(o);e.onChange(h)};return s(C,{...e,label:y(d,c),value:e.value!==void 0&&e.value!==null?String(e.value):"",onChange:a,onBlur:e.onBlur,options:g,error:!!l[t],helperText:l[t]?.message,required:r?.required,placeholder:p||f.placeholder,translationNamespace:"crud",placeholderKey:"actions.selectYear",placeholderDefault:"Select or type year",creatable:!0})}})}export{B as ControlledYearField};
@@ -1 +1 @@
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
+ import{ControlledComboboxField as e}from"./ControlledComboboxField";import{ControlledDropdownField as d}from"./ControlledDropdownField";import{ControlledMultiDropdownField as i}from"./ControlledMultiDropdownField";import{ControlledRadioField as p}from"./ControlledRadioField";import{ControlledYearField as x}from"./ControlledYearField";export{e as ControlledComboboxField,d as ControlledDropdownField,i as ControlledMultiDropdownField,p as ControlledRadioField,x as ControlledYearField};
@@ -1 +1 @@
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
+ "use client";function f(e){if(e){if(e instanceof RegExp)return e;try{const n=/^\/(.*)\/([gimyus]*)$/.exec(e);if(n){const[,r,t]=n;if(r)return new RegExp(r,t)}return new RegExp(e)}catch{return}}}function u(e){if(!e)return{};const n={};return e.required!==void 0&&(n.required=e.required),e.min!==void 0&&(n.min=e.min),e.max!==void 0&&(n.max=e.max),e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern&&typeof e.pattern=="string"&&(n.pattern={value:f(e.pattern)||/.*/,message:"Invalid format"}),n}export{f as convertPatternToRegex,u as convertValidationRules};
@@ -1 +1 @@
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
+ import{jsx as e}from"react/jsx-runtime";import{Avatar as m,Text as n}from"@donotdev/components";const p=({config:t,value:a,t:d,className:s,size:r="md"})=>{if(!a)return e(n,{as:"span",variant:"muted",className:s,children:"-"});const l={sm:"size-touch",md:"size-touch",lg:"h-16 w-16"},i=o=>o.split(" ").map(c=>c.charAt(0)).slice(0,2).join("").toUpperCase();return e(m,{src:a,alt:t.label||"Avatar",fallback:i(t.label||"AV"),className:`${l[r]} ${s||""}`})};var x=p;export{p as AvatarFieldDisplay,x as default};
@@ -1 +1 @@
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
+ import{jsx as e}from"react/jsx-runtime";import{Badge as a,Text as i}from"@donotdev/components";const s=({config:d,value:n,t:o,className:t})=>{if(n==null)return e(i,{as:"span",variant:"muted",className:t,children:"-"});const r=typeof n=="boolean"?o(n?"common.yes":"common.no"):String(n);return e(a,{variant:typeof n=="boolean"?n?"default":"secondary":"outline",className:t,children:r})};var p=s;export{s as BadgeFieldDisplay,p as default};
@@ -1 +1 @@
1
- const t=()=>null;var a=t;export{t as ButtonFieldDisplay,a as default};
1
+ const t=()=>null;var e=t;export{t as ButtonFieldDisplay,e as default};
@@ -1 +1 @@
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
+ import{jsx as r}from"react/jsx-runtime";import{Badge as t,Text as i}from"@donotdev/components";const s=({config:c,value:n,t:a,className:o})=>{if(n==null)return r(i,{as:"span",variant:"muted",className:o,children:"-"});const e=a(n?"common.yes":"common.no");return r(t,{variant:n?"default":"secondary",className:o,children:e})};var f=s;export{s as CheckboxFieldDisplay,f as default};
@@ -1 +1 @@
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
+ import{jsx as e,jsxs as d}from"react/jsx-runtime";import{Text as a,Spinner as c}from"@donotdev/components";const m=({config:i,value:n,t:p,className:t,loading:l=!1})=>{if(l)return e(c,{className:t});if(!n)return e(a,{as:"span",variant:"muted",className:t,children:"-"});try{const r=new Date(n),s=r.toLocaleDateString(),o=r.toLocaleTimeString();return i.type==="date"?e(a,{as:"span",className:t,children:s}):d("div",{className:t,children:[e(a,{as:"span",children:s}),e(a,{as:"span",variant:"muted",level:"small",children:o})]})}catch{return e(a,{as:"span",variant:"muted",className:t,children:"-"})}};var h=m;export{m as DateFieldDisplay,h as default};
@@ -1 +1 @@
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
+ import{jsx as a}from"react/jsx-runtime";import{Badge as e,BADGE_VARIANT as n,Text as o}from"@donotdev/components";const i=({config:s,value:r,t:p,className:t})=>r?a(e,{variant:n.OUTLINE,className:t,children:r}):a(o,{as:"span",variant:"muted",className:t,children:"-"});var c=i;export{i as DropdownDisplay,c as default};
@@ -1 +1 @@
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
+ import{jsx as r,jsxs as s}from"react/jsx-runtime";import{Badge as t,BADGE_VARIANT as n,Text as a,Stack as d}from"@donotdev/components";const l=({config:o,value:e,t:c,className:i})=>e?s(d,{direction:"row",align:"center",gap:"medium",className:i,children:[r(a,{as:"span",level:"small",children:e.name}),e.size&&s(t,{variant:n.SECONDARY,children:[(e.size/1024).toFixed(1)," KB"]})]}):r(a,{as:"span",variant:"muted",className:i,children:"-"});var x=l;export{l as FileFieldDisplay,x as default};
@@ -1 +1 @@
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
+ import{jsx as s,jsxs as i}from"react/jsx-runtime";import{Text as e}from"@donotdev/components";const o=({config:r,value:t,t:d,className:n})=>!t||t.lat===void 0&&t.lng===void 0?s(e,{as:"span",variant:"muted",className:n,children:"-"}):i(e,{as:"div",level:"small",className:`font-mono ${n||""}`,children:[t.lat?.toFixed(6),", ",t.lng?.toFixed(6)]});var x=o;export{o as GeoPointFieldDisplay,x as default};
@@ -1 +1 @@
1
- const l=()=>null;var a=l;export{l as HiddenFieldDisplay,a as default};
1
+ const e=()=>null;var l=e;export{e as HiddenFieldDisplay,l as default};
@@ -1 +1 @@
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
+ import{jsx as e}from"react/jsx-runtime";import{Avatar as c,Text as n}from"@donotdev/components";const p=({config:t,value:s,t:d,className:a,size:r="md"})=>{if(!s)return e(n,{as:"span",variant:"muted",className:a,children:"-"});const l={sm:"size-touch",md:"size-touch",lg:"h-16 w-16"},i=m=>m.split(" ").map(o=>o.charAt(0)).slice(0,2).join("").toUpperCase();return e(c,{src:s,alt:t.label||"Image",fallback:i(t.label||"IMG"),className:`${l[r]} ${a||""}`})};var x=p;export{p as ImageFieldDisplay,x as default};
@@ -1 +1 @@
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
+ import{jsx as o}from"react/jsx-runtime";import{Text as l}from"@donotdev/components";const s=({config:a,value:e,t:r,className:t})=>{if(!e)return o(l,{as:"span",variant:"muted",className:t,children:"-"});const i=(()=>{switch(a.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 o("a",{...i,className:t||"",style:{color:"var(--primary)",textDecoration:"none"},onMouseEnter:n=>n.currentTarget.style.textDecoration="underline",onMouseLeave:n=>n.currentTarget.style.textDecoration="none",children:e})};var u=s;export{s as LinkFieldDisplay,u as default};
@@ -1 +1 @@
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
+ import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Text as s}from"@donotdev/components";const o=({config:r,value:t,t:d,className:n})=>!t||t.lat===void 0&&t.lng===void 0?e(s,{as:"span",variant:"muted",className:n,children:"-"}):i(s,{as:"div",level:"small",className:`font-mono ${n||""}`,children:[t.lat?.toFixed(6),", ",t.lng?.toFixed(6)]});var x=o;export{o as MapFieldDisplay,x as default};
@@ -1 +1 @@
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
+ import{jsx as t}from"react/jsx-runtime";import{Badge as e,BADGE_VARIANT as o,Text as p,Stack as s}from"@donotdev/components";const d=({config:m,value:r,t:c,className:a})=>!r||!Array.isArray(r)||r.length===0?t(p,{as:"span",variant:"muted",className:a,children:"-"}):t(s,{direction:"row",wrap:"wrap",gap:"medium",className:a,children:r.map((i,n)=>t(e,{variant:o.OUTLINE,children:String(i)},n))});var l=d;export{d as MultiDropdownDisplay,l as default};
@@ -1 +1 @@
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
+ import{jsx as t}from"react/jsx-runtime";import{Badge as n,BADGE_VARIANT as p,Text as o,Stack as s}from"@donotdev/components";const d=({config:m,value:r,t:c,className:i})=>!r||!Array.isArray(r)||r.length===0?t(o,{as:"span",variant:"muted",className:i,children:"-"}):t(s,{direction:"row",wrap:"wrap",gap:"medium",className:i,children:r.map((a,e)=>t(n,{variant:p.OUTLINE,children:String(a)},e))});var f=d;export{d as MultiInputTextFieldDisplay,f as default};
@@ -1 +1 @@
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
+ import{jsx as e}from"react/jsx-runtime";import{Text as t,Spinner as o}from"@donotdev/components";const s=({config:a,value:n,t:f,className:r,loading:i=!1})=>i?e(o,{className:r}):n==null?e(t,{as:"span",variant:"muted",className:r,children:"-"}):e(t,{as:"span",className:`font-mono ${r||""}`,children:n.toLocaleString()});var p=s;export{s as NumberFieldDisplay,p as default};
@@ -1 +1 @@
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
+ import{jsx as o,jsxs as s}from"react/jsx-runtime";import{Eye as d,EyeOff as n}from"lucide-react";import{useState as c}from"react";import{Skeleton as f,Button as m,CopyToClipboard as y,Stack as a}from"@donotdev/components";const x=({config:b,value:i,t:r,className:t,loading:p=!1})=>{const[e,l]=c(!1);return p?o(f,{className:t}):i?s(a,{direction:"row",align:"center",gap:"medium",className:t,children:[o("span",{style:{fontFamily:"monospace"},children:e?i:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}),s(a,{direction:"row",align:"center",gap:"tight",children:[o(m,{type:"button",onClick:()=>l(!e),"aria-label":e?"Hide password":"Show password",children:e?o(n,{}):o(d,{})}),o(y,{text:i,tooltipText:r("copyToClipboard")||"Copy to clipboard",copiedTooltipText:r("copied")||"Copied!",ariaLabel:r("copyPassword")||"Copy password"})]})]}):o("div",{style:{color:"var(--muted-foreground)"},children:"-"})};var C=x;export{x as PasswordFieldDisplay,C as default};
@@ -1 +1 @@
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
+ import{jsx as n}from"react/jsx-runtime";import{Text as a}from"@donotdev/components";const i=({config:s,value:e,t:o,className:t})=>e?n("a",{href:`tel:${e}`,className:t||"",style:{color:"var(--primary)",textDecoration:"none"},onMouseEnter:r=>r.currentTarget.style.textDecoration="underline",onMouseLeave:r=>r.currentTarget.style.textDecoration="none","aria-label":o("common.callNumber",{number:e}),children:e}):n(a,{as:"span",variant:"muted",className:t,children:"-"});var m=i;export{i as PhoneNumberDisplay,m as default};
@@ -1 +1 @@
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
+ import{jsx as a}from"react/jsx-runtime";import{Badge as e,BADGE_VARIANT as i,Text as n}from"@donotdev/components";const o=({config:s,value:r,t:d,className:t})=>r?a(e,{variant:i.OUTLINE,className:t,children:r}):a(n,{as:"span",variant:"muted",className:t,children:"-"});var c=o;export{o as RadioFieldDisplay,c as default};
@@ -1 +1 @@
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
+ import{jsx as t}from"react/jsx-runtime";import{Text as e}from"@donotdev/components";const o=({config:s,value:n,t:a,className:r})=>n==null?t(e,{as:"span",variant:"muted",className:r,children:"-"}):t(e,{as:"span",className:`font-mono ${r||""}`,children:n});var f=o;export{o as RangeFieldDisplay,f as default};
@@ -1 +1 @@
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
+ import{jsx as t}from"react/jsx-runtime";import{Badge as a,BADGE_VARIANT as n,Text as s}from"@donotdev/components";const d=({config:o,value:r,t:m,className:e})=>{if(!r)return t(s,{as:"span",variant:"muted",className:e,children:"-"});const i=r.displayName||r.name||r.id||r;return t(a,{variant:n.OUTLINE,className:e,children:String(i)})};var f=d;export{d as ReferenceFieldDisplay,f as default};
@@ -1,4 +1,4 @@
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:`
1
+ import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Text as t}from"@donotdev/components";const s=({config:a,value:r,t:n,className:o})=>!r||r.trim()===""?e(t,{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:[e("div",{dangerouslySetInnerHTML:{__html:r},style:{outline:"none",fontSize:"var(--font-size-base)",lineHeight:"1.6"},className:"prose prose-sm max-w-none"}),e("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 r,jsxs as s}from"react/jsx-runtime";import{Text as i}from"@donotde
58
58
  .prose a:hover {
59
59
  color: var(--primary-hover);
60
60
  }
61
- `})]});var t=a;export{a as RichTextDisplay,t as default};
61
+ `})]});var p=s;export{s as RichTextDisplay,p as default};
@@ -1 +1 @@
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
+ import{jsx as t}from"react/jsx-runtime";import{Text as a}from"@donotdev/components";const s=({config:i,value:e,t:p,className:r})=>e?t(a,{as:"div",level:"small",className:`whitespace-pre-wrap ${r||""}`,children:e}):t(a,{as:"span",variant:"muted",className:r,children:"-"});var o=s;export{s as TextAreaDisplay,o as default};
@@ -1 +1 @@
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
+ import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Mail as V,Calendar as k,Clock as N}from"lucide-react";import{useState as j}from"react";import{Skeleton as f,Badge as A,BADGE_VARIANT as F,Text as l,cn as T,CopyToClipboard as x,Stack as n}from"@donotdev/components";import{getWeekFromISOString as I}from"@donotdev/core";const B=({config:a,value:r,t:o,className:c,loading:C=!1,showCopy:m=!1,asBadge:b=!1,truncate:s=!1,maxLength:d=50,showLabel:p=!1})=>{const[E,h]=j(!1),M=async()=>{try{await navigator.clipboard.writeText(r),h(!0),setTimeout(()=>h(!1),2e3)}catch{}},y=()=>{switch(a.type){case"email":return e(V,{});case"month":case"week":return e(k,{});case"time":return e(N,{});default:return null}},S=t=>{if(!t)return null;switch(a.type){case"email":return i("a",{href:`mailto:${t}`,style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)"},onMouseEnter:u=>u.currentTarget.style.textDecoration="underline",onMouseLeave:u=>u.currentTarget.style.textDecoration="none",children:[y(),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}},w=t=>!s||t.length<=d?t:`${t.substring(0,d)}...`;if(C)return i(n,{gap:"tight",children:[p&&e(f,{style:{height:"1rem",width:"6rem"}}),e(f,{className:"dndev-w-full",style:{height:"1.5rem"}})]});if(!r)return i(n,{gap:"tight",children:[p&&e(l,{as:"span",variant:"muted",children:a.label||a.name}),e(l,{as:"span",variant:"muted",className:T(c),style:{fontStyle:"italic"},children:o("common.noValue",{defaultValue:"No value"})})]});const D=S(r),g=w(String(D));return b?i(n,{direction:"row",align:"center",gap:"tight",children:[y(),e(A,{variant:F.SECONDARY,className:c,children:g}),m&&e(x,{text:r,tooltipText:o("copyToClipboard")||"Copy to clipboard",copiedTooltipText:o("copied")||"Copied!",ariaLabel:o("copyToClipboard")||"Copy to clipboard"})]}):i(n,{gap:"tight",children:[p&&e(l,{as:"span",variant:"muted",children:a.label||a.name}),i(n,{direction:"row",align:"center",gap:"tight",children:[e("div",{className:T("dndev-flex-1",s&&"truncate",c),title:s&&r.length>d?r:void 0,children:e(l,{as:"span",children:g})}),m&&e(x,{text:r,tooltipText:o("copyToClipboard")||"Copy to clipboard",copiedTooltipText:o("copied")||"Copied!",ariaLabel:o("copyToClipboard")||"Copy to clipboard"})]})]})};var W=B;export{B as TextFieldDisplay,W as default};
@@ -1 +1 @@
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
+ import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Text as e}from"@donotdev/components";const c=({config:m,value:s,t:d,className:a})=>{if(!s)return t(e,{as:"span",variant:"muted",className:a,children:"-"});try{const r=new Date(s),n=r.toLocaleDateString(),i=r.toLocaleTimeString();return o("div",{className:a,children:[t(e,{as:"span",children:n}),t(e,{as:"span",variant:"muted",level:"small",children:i})]})}catch{return t(e,{as:"span",variant:"muted",className:a,children:"-"})}};var f=c;export{c as TimestampFieldDisplay,f as default};
@@ -1 +1 @@
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
+ import{default as l}from"./TextFieldDisplay";import{default as o}from"./BadgeFieldDisplay";import{default as p}from"./AvatarFieldDisplay";import{default as d}from"./LinkFieldDisplay";import{default as s}from"./DateFieldDisplay";import{default as m}from"./NumberFieldDisplay";import{default as D}from"./PhoneNumberDisplay";import{default as F}from"./TextAreaDisplay";import{default as T}from"./RichTextDisplay";import{default as b}from"./CheckboxFieldDisplay";import{default as g}from"./DropdownDisplay";import{default as M}from"./MultiDropdownDisplay";import{default as w}from"./MultiInputTextFieldDisplay";import{default as B}from"./RadioFieldDisplay";import{default as N}from"./RangeFieldDisplay";import{default as v}from"./FileFieldDisplay";import{default as G}from"./ImageFieldDisplay";import{default as L}from"./GeoPointFieldDisplay";import{default as q}from"./MapFieldDisplay";import{default as E}from"./ReferenceFieldDisplay";import{default as K}from"./TimestampFieldDisplay";import{default as Q}from"./HiddenFieldDisplay";import{default as U}from"./ButtonFieldDisplay";export{p as AvatarFieldDisplay,o as BadgeFieldDisplay,U as ButtonFieldDisplay,b as CheckboxFieldDisplay,s as DateFieldDisplay,g as DropdownDisplay,v as FileFieldDisplay,L as GeoPointFieldDisplay,Q as HiddenFieldDisplay,G as ImageFieldDisplay,d as LinkFieldDisplay,q as MapFieldDisplay,M as MultiDropdownDisplay,w as MultiInputTextFieldDisplay,m as NumberFieldDisplay,D as PhoneNumberDisplay,B as RadioFieldDisplay,N as RangeFieldDisplay,E as ReferenceFieldDisplay,T as RichTextDisplay,F as TextAreaDisplay,l as TextFieldDisplay,K as TimestampFieldDisplay};
@@ -1 +1 @@
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
+ import{jsx as r,jsxs as f}from"react/jsx-runtime";import{MapPin as D}from"lucide-react";import{useState as S,useEffect as w,useRef as b,useMemo as F}from"react";import{Combobox as M,Stack as L}from"@donotdev/components";import{useTranslation as W,getPlatformEnvVar as Y}from"@donotdev/core";const $=({label:C,value:d,onChange:P,enableGoogleMaps:j=!1,extractDistrictCode:O,error:l,helperText:u,required:x})=>{const{t:n}=W("dndev"),[c,m]=S(d?.formatted_address||""),[g,v]=S([]),[I,p]=S(!1),h=b(null),_=b(null),i=b(null),y=Y("GOOGLE_MAPS_API_KEY")||"",s=j&&!!y,V=F(()=>g.map(e=>({value:e.place_id,label:e.description,description:e.structured_formatting?.secondary_text,content:f("div",{style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)"},children:[r(D,{style:{width:"var(--size-icon-sm)",height:"var(--size-icon-sm)"}}),f("div",{children:[r("div",{children:e.description}),e.structured_formatting?.secondary_text&&r("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:e.structured_formatting.secondary_text})]})]})})),[g]),G=e=>{_.current&&(p(!0),_.current.getDetails({placeId:e,fields:["formatted_address","geometry","address_components"]},(t,o)=>{if(p(!1),o===window.google?.maps?.places?.PlacesServiceStatus.OK&&t){const a=t.formatted_address||"",k=t.geometry?.location?.lat(),q=t.geometry?.location?.lng(),A={formatted_address:a,latitude:k,longitude:q};if(O&&t.address_components){const E=t.address_components.find(U=>U.types.includes("postal_code"))?.long_name||"",T=E.startsWith("92")?92:parseInt(E.slice(-2),10)||null;A.district_code=T}m(a),P(A)}}))};w(()=>{d?.formatted_address&&m(d.formatted_address)},[d]),w(()=>{if(!s)return;const e=()=>{if(window.google?.maps?.places){t();return}if(document.querySelector("#google-maps-script")){const a=setInterval(()=>{window.google?.maps?.places&&(clearInterval(a),t())},100);return}const o=document.createElement("script");o.id="google-maps-script",o.src=`https://maps.googleapis.com/maps/api/js?key=${y}&libraries=places`,o.async=!0,o.defer=!0,o.onload=()=>t(),document.head.appendChild(o)},t=()=>{window.google?.maps?.places&&(h.current=new window.google.maps.places.AutocompleteService,_.current=new window.google.maps.places.PlacesService(document.createElement("div")))};e()},[s,y]),w(()=>{if(!s||!c||!h.current){v([]);return}return i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{p(!0),h.current.getPlacePredictions({input:c,types:["geocode","establishment"]},(e,t)=>{p(!1),t===window.google?.maps?.places?.PlacesServiceStatus.OK&&e?v(e):v([])})},300),()=>{i.current&&clearTimeout(i.current)}},[s,c]);const K=e=>{m(e),P({formatted_address:e})},z=e=>{const t=Array.isArray(e)?e[0]||"":e;if(!s){K(t);return}g.some(a=>a.place_id===t)&&G(t)},R=e=>{s&&m(e)};return s?f(L,{gap:"tight",children:[r(M,{label:C,value:c,onValueChange:z,onSearchChange:R,placeholder:n("common.address_placeholder"),emptyMessage:n(I?"common.loading":"common.no_results"),options:V,required:x,variant:l?"destructive":void 0,isLoading:I,creatable:!0,createLabel:n("actions.use","Use")}),u&&r("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)"},children:u})]}):f(L,{gap:"tight",children:[r(M,{label:C,value:c,onValueChange:z,placeholder:n("common.address_placeholder"),options:[],required:x,variant:l?"destructive":void 0,creatable:!0,createLabel:n("actions.use","Use")}),u&&r("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)"},children:u})]})};var Z=$;export{Z as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Avatar as p,Input as u,cn as g,Stack as n}from"@donotdev/components";const s=({config:r,value:t,onChange:c,error:A,helperText:l,t:i,className:d,...m})=>{const v=a=>a.split(" ").map(h=>h.charAt(0)).slice(0,2).join("").toUpperCase();return o(n,{gap:"medium",children:[o(n,{direction:"row",align:"center",gap:"medium",children:[e(p,{src:t,alt:r.label||"Avatar",fallback:v(r.label||"AV"),style:{height:"var(--touch-target)",width:"var(--touch-target)"}}),e("div",{className:"dndev-flex-1",children:e(u,{type:"url",className:g("dndev-w-full",d),placeholder:i("common.enterAvatarUrl"),value:t,onChange:a=>c(a.target.value),...m})})]}),l&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:l})]})};var f=s;export{s as AvatarFieldComponent,f as default};
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Avatar as u,Input as v,cn as h,Stack as n}from"@donotdev/components";const g=({config:t,value:a,onChange:s,error:f,helperText:l,t:i,className:c,...d})=>{const m=r=>r.split(" ").map(p=>p.charAt(0)).slice(0,2).join("").toUpperCase();return o(n,{gap:"medium",children:[o(n,{direction:"row",align:"center",gap:"medium",children:[e(u,{src:a,alt:t.label||"Avatar",fallback:m(t.label||"AV"),style:{height:"var(--touch-target)",width:"var(--touch-target)"}}),e("div",{className:"dndev-flex-1",children:e(v,{type:"url",className:h("dndev-w-full",c),placeholder:i("common.enterAvatarUrl"),value:a,onChange:r=>s(r.target.value),...d})})]}),l&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:l})]})};var j=g;export{g as AvatarFieldComponent,j as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Badge as g,Input as v,cn as p,Stack as d}from"@donotdev/components";const l=({config:f,value:a,onChange:o,error:h,helperText:t,t:n,variant:s="default",className:i,...m})=>r(d,{gap:"medium",children:[r(d,{direction:"row",align:"center",gap:"medium",children:[e(g,{variant:s,style:{minWidth:0},children:a||n("common.badgePreview")}),e("div",{className:"dndev-flex-1",children:e(v,{type:"text",className:p("dndev-w-full",i),placeholder:n("common.enterBadgeText"),value:a,onChange:c=>o(c.target.value),...m})})]}),t&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:t})]});var u=l;export{l as BadgeFieldComponent,u as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Badge as s,Input as g,cn as f,Stack as a}from"@donotdev/components";const p=({config:u,value:r,onChange:d,error:v,helperText:n,t:o,variant:i="default",className:l,...m})=>t(a,{gap:"medium",children:[t(a,{direction:"row",align:"center",gap:"medium",children:[e(s,{variant:i,style:{minWidth:0},children:r||o("common.badgePreview")}),e("div",{className:"dndev-flex-1",children:e(g,{type:"text",className:f("dndev-w-full",l),placeholder:o("common.enterBadgeText"),value:r,onChange:c=>d(c.target.value),...m})})]}),n&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:n})]});var j=p;export{p as BadgeFieldComponent,j as default};
@@ -1 +1 @@
1
- import{jsx as 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
+ import{jsx as i}from"react/jsx-runtime";import{Button as a}from"@donotdev/components";const l=({label:t,type:o,onClick:e,variant:n,disabled:r=!1})=>i(a,{type:o,onClick:e,variant:n,disabled:r,children:t});var m=l;export{m as default};
@@ -1 +1 @@
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
+ import{jsx as r,jsxs as c}from"react/jsx-runtime";import{Checkbox as h,Label as i,Stack as s}from"@donotdev/components";const d=({label:t,checked:n=!1,onChange:e,required:a})=>c(s,{direction:"row",align:"center",gap:"tight",children:[r(h,{checked:n,onCheckedChange:o=>{e&&e({target:{checked:o}})}}),r(i,{required:a,children:t})]});var C=d;export{C as default};
@@ -1 +1 @@
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
+ import{jsx as a,jsxs as c}from"react/jsx-runtime";import{useMemo as E,useId as M}from"react";import{Combobox as V,Stack as d}from"@donotdev/components";import{useTranslation as _}from"@donotdev/core";const $=({label:u,value:n,options:s,error:f,helperText:o,onChange:l,onBlur:m,required:p,placeholder:g,translationNamespace:h="dndev",placeholderKey:b="actions.select",placeholderDefault:v="Select",creatable:x=!1,createLabel:C,emptyMessage:y})=>{const{t:r}=_(h),i=M(),S=E(()=>s.map(e=>({value:String(e.value),label:e.label})),[s]),j=e=>{if(l){const O={target:{value:Array.isArray(e)?e[0]||"":e}};l(O)}},z=e=>{e||m?.()},t=!!f,A=`${i}-error`,I=`${i}-helper`;return c(d,{gap:"tight",children:[a(V,{label:u,value:n||"",onValueChange:j,onOpenChange:z,placeholder:g||r(b,v),emptyMessage:y||r("messages.noResults","No results found"),creatable:x,createLabel:C||r("actions.create","Create"),options:S,required:p,variant:t?"destructive":void 0,clearable:!!n}),t&&c(d,{id:A,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[a("span",{children:"\u26A0"}),o]}),o&&!t&&a("p",{id:I,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:o})]})};var D=$;export{D as default};
@@ -1 +1 @@
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
+ import{jsx as n,jsxs as f}from"react/jsx-runtime";import{useState as N,useEffect as V,useId as j}from"react";import{Input as E,FloatingLabel as I,Stack as z}from"@donotdev/components";const L=({label:m,value:r,onChange:g,currency:a="EUR",locale:y,error:s,helperText:l,required:v=!1,disabled:i=!1,placeholder:h})=>{const c=j(),b=y||(typeof navigator<"u"?navigator.language:"en-US"),d=e=>e==null||isNaN(e)?"":(e/100).toFixed(2),x=e=>{if(!e||e.trim()==="")return null;const t=e.replace(/[^\d.,\-]/g,"").replace(",","."),o=parseFloat(t);return isNaN(o)?null:Math.round(o*100)},[S,u]=N(d(r));V(()=>{u(d(r))},[r]);const C=e=>{const t=e.target.value;u(t);const F={target:{value:x(t)}};g(F)},p=(()=>{try{return new Intl.NumberFormat(b,{style:"currency",currency:a,currencyDisplay:"symbol"}).formatToParts(0).find(e=>e.type==="currency")?.value||a}catch{return a}})();return f(z,{gap:"tight",children:[n(I,{htmlFor:c,label:m,disabled:i,required:v,children:f("div",{style:{position:"relative"},children:[n("span",{style:{position:"absolute",left:"var(--gap-md)",top:"50%",transform:"translateY(-50%)",color:"var(--muted-foreground)",pointerEvents:"none",zIndex:1},children:p}),n(E,{id:c,type:"text",inputMode:"decimal",value:S,onChange:C,disabled:i,placeholder:h||"0.00","data-variant":s?"destructive":void 0,style:{paddingLeft:`calc(var(--gap-md) + ${p.length*.6}em + var(--gap-sm))`}})]})}),l&&n("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:l})]})};var k=L;export{k as default};
@@ -1 +1 @@
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
+ import{jsx as l,jsxs as S}from"react/jsx-runtime";import{Input as d,Stack as p}from"@donotdev/components";const m=({label:r,value:i,onChange:s,error:o,helperText:n,mode:e="date",required:g,...c})=>{const f=t=>{const u=t.target.value?new Date(t.target.value).toISOString():null;s(u)};let a="";if(i){const t=new Date(i);e==="date"?a=t.toISOString().split("T")[0]||"":e==="datetime-local"?a=t.toISOString().slice(0,16)||"":e==="month"?a=t.toISOString().slice(0,7):e==="time"?a=t.toISOString().slice(11,16):e==="week"&&(a=t.toISOString().split("T")[0]||"")}return S(p,{gap:"tight",children:[l(d,{label:r,type:e,value:a,onChange:f,required:g,className:"dndev-w-full",...c}),n&&l("p",{style:{fontSize:"var(--font-size-xs)",color:o?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:n})]})};var O=m;export{O as default};
@@ -1 +1 @@
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
+ "use client";import{jsx as n,jsxs as l,Fragment as ae}from"react/jsx-runtime";import{Upload as ie,X as se,FileText as P,FileSpreadsheet as le,File as de,Loader2 as ce,Eye as ue}from"lucide-react";import{useCallback as w,useState as M,useRef as F,useEffect as W,useImperativeHandle as pe,forwardRef as me}from"react";import{Button as G,BUTTON_VARIANT as V,Text as g,Stack as x,Progress as fe,Dialog as ge,DialogContent as ve,DialogHeader as he,DialogTitle as ye}from"@donotdev/components";import{handleError as D,useTranslation as we}from"@donotdev/core";import{useUploadContext as xe}from"../../../contexts/UploadContext";import{useUploadStore as Te}from"../../../stores/UploadStore";import{uploadFile as be,deleteFile as Pe,generateFileId as X,getFileIcon as Fe,formatFileSize as De,getDocumentAcceptString as Ne}from"../../../utils/fileStorage";function ke({type:f,className:c}){switch(f){case"pdf":return n(P,{className:c,style:{color:"var(--destructive)"}});case"doc":return n(P,{className:c,style:{color:"var(--primary)"}});case"xls":return n(le,{className:c,style:{color:"var(--success)"}});case"ppt":return n(P,{className:c,style:{color:"var(--warning)"}});case"text":case"html":return n(P,{className:c});default:return n(de,{className:c})}}const q=me(({name:f,label:c,value:v,onChange:N,error:k,helperText:R,multiple:p=!1,maxFiles:A=10,maxSize:C=25*1024*1024,storagePath:L="uploads/documents",required:K,enablePreview:H=!0},J)=>{const{t:Q}=we("dndev"),s=Q,h=xe(),I=Te(),O=!!h,[i,u]=M([]),[j,S]=M(!1),[U,_]=M(null),y=F(null),z=F(!1),T=F(void 0),Y=Ne(),b=w(e=>{const r=e.filter(t=>t.uploaded&&!t.error).map(t=>t.uploaded);N(p?r:r[0]||null)},[p,N]);W(()=>{if(z.current){z.current=!1;return}if(v){const e=[];(Array.isArray(v)?v:[v]).forEach(t=>{t.url&&e.push({id:X(),file:new File([],t.filename),uploadProgress:null,uploaded:t,error:null})}),u(e)}else u([])},[v]);const Z=w(async()=>{const e=i.filter(r=>!r.uploaded&&!r.error&&r.uploadProgress===null);if(e.length!==0){u(r=>r.map(t=>e.some(a=>a.id===t.id)?{...t,uploadProgress:0}:t));for(const r of e)try{const t=await be(r.file,{storagePath:L,onProgress:a=>{u(o=>o.map(d=>d.id===r.id?{...d,uploadProgress:a.progress}:d))}});u(a=>{const o=a.map(d=>d.id===r.id?{...d,uploaded:t,uploadProgress:100,error:null}:d);return queueMicrotask(()=>b(o)),o})}catch{u(a=>a.map(o=>o.id===r.id?{...o,error:"Upload failed",uploadProgress:null}:o))}}},[i,L,b]);T.current=Z,W(()=>{if(!(!h||!f))return I.registerUpload(h,f,async e=>{await T.current?.()}),()=>{I.unregisterUpload(h,f)}},[h,f,I]),pe(J,()=>({upload:async()=>{await T.current?.()},getDocuments:()=>B.current||[]}),[]);const B=F(i);B.current=i;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)},E=w(e=>{const t=(p?A:1)-i.length;if(t<=0){D(new Error("Maximum documents reached"),{userMessage:s("document.errors.maxFiles",{max:A}),severity:"warning",showNotification:!0});return}const a=e.slice(0,t),o=[],d=(C/(1024*1024)).toFixed(0);for(const m of a){if(!$(m)){D(new Error("Invalid document type"),{userMessage:s("document.errors.invalidType",{fileName:m.name}),severity:"warning",showNotification:!0});continue}if(m.size>C){D(new Error("Document too large"),{userMessage:s("document.errors.exceedsSize",{fileName:m.name,size:d}),severity:"warning",showNotification:!0});continue}o.push({id:X(),file:m,uploadProgress:null,uploaded:null,error:null})}o.length!==0&&(u(m=>p?[...m,...o]:o),O||setTimeout(()=>T.current?.(),0))},[i,p,A,C,s,O]),ee=e=>{const r=Array.from(e.target.files||[]);r.length>0&&E(r),y.current&&(y.current.value="")},re=w(e=>{e.preventDefault(),S(!1);const r=Array.from(e.dataTransfer.files);E(r)},[E]),te=w(async e=>{const r=i[e];if(r)try{r.uploaded&&await Pe(r.uploaded);const t=i.filter((a,o)=>o!==e);z.current=!0,u(t),setTimeout(()=>b(t),0)}catch(t){D(t,{userMessage:s("document.delete.failed"),severity:"error",showNotification:!0})}},[i,b,s]),ne=e=>{e.uploaded?.url&&e.uploaded.mimeType==="application/pdf"&&_(e.uploaded.url)},oe=p||i.length===0;return l(ae,{children:[l(x,{gap:"tight",children:[l(g,{level:"body",align:"start",children:[c,K?"*":""]}),oe&&l("div",{role:"button",tabIndex:0,"aria-label":s("document.upload.ariaLabel"),className:"dndev-surface","data-variant":k?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:j?"var(--primary)":k?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:j?"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(),S(!0)},onDragLeave:()=>S(!1),onDrop:re,onClick:()=>y.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),y.current?.click())},children:[n("input",{ref:y,type:"file",accept:Y,multiple:p,style:{display:"none"},onChange:ee}),l(x,{align:"center",justify:"center",gap:"medium",children:[n(ie,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),n(g,{as:"p",variant:"muted",level:"small",align:"center",children:s("document.upload.hint")}),n(g,{as:"p",variant:"muted",level:"caption",align:"center",children:"PDF, Word, Excel, PowerPoint, TXT, Markdown, HTML"})]})]}),i.length>0&&n(x,{gap:"tight",children:i.map((e,r)=>{const t=Fe(e.uploaded?.mimeType||e.file.type,e.file.name),a=e.uploadProgress!==null&&e.uploadProgress<100,o=e.uploaded?.mimeType==="application/pdf"||e.file.name.toLowerCase().endsWith(".pdf");return l("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:[n(ke,{type:t,className:"dndev-size-md"}),l(x,{gap:"none",style:{flex:1,minWidth:0},children:[n(g,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),l(g,{level:"caption",variant:"muted",children:[De(e.uploaded?.size||e.file.size),e.error&&l("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),a&&n(fe,{value:e.uploadProgress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),l(x,{direction:"row",gap:"tight",children:[H&&o&&e.uploaded&&n(G,{variant:V.GHOST,onClick:()=>ne(e),"aria-label":s("document.preview.ariaLabel"),children:n(ue,{className:"dndev-size-sm"})}),a?n(ce,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):n(G,{variant:V.GHOST,onClick:()=>te(r),"aria-label":s("document.delete.ariaLabel"),children:n(se,{className:"dndev-size-sm"})})]})]},e.id)})}),R&&n(g,{level:"caption",variant:k?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:R})]}),H&&U&&n(ge,{open:!!U,onOpenChange:()=>_(null),children:l(ve,{style:{maxWidth:"90vw",maxHeight:"90vh",width:"900px",height:"80vh"},children:[n(he,{children:n(ye,{children:s("document.preview.title")})}),n("iframe",{src:U,style:{width:"100%",height:"100%",border:"none",borderRadius:"var(--radius-md)"},title:"PDF Preview"})]})})]})});q.displayName="DocumentFieldComponent";var Re=q;export{Re as default};
@@ -1 +1 @@
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
+ import{jsx as o,jsxs as p}from"react/jsx-runtime";import{Select as g,Stack as m}from"@donotdev/components";import{useTranslation as f}from"@donotdev/core";const h=({label:r,value:n,options:s,error:l,helperText:t,onChange:a,onBlur:i,required:c})=>{const{t:d}=f("dndev"),u=n!=null?String(n):"";return p(m,{gap:"tight",children:[o(g,{label:r,value:u,onValueChange:e=>{a&&a({target:{value:e}})},onOpenChange:e=>!e&&i?.(),placeholder:d("actions.select","Select"),required:c,options:s.map(e=>({value:String(e.value),label:e.label}))}),t&&o("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:t})]})};var C=h;export{C as default};
@@ -1 +1 @@
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};
1
+ import{jsx as a,jsxs as u}from"react/jsx-runtime";import{useState as w,useMemo as C}from"react";import{Clock as S}from"lucide-react";import{Label as $,Stack as l,Button as b,Slider as E}from"@donotdev/components";const x=[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 _(e,n){const i=e<60?`${e}m`:e%60===0?`${e/60}h`:`${Math.floor(e/60)}h${e%60}`,s=N[e];return!n||!s?i:n(`crud:${s}`,{defaultValue:i})??i}const j=({label:e,value:n,onChange:i,error:s,helperText:d,disabled:c,required:h,readonly:M,min:p=0,max:g=480,step:V=5,t:o})=>{const r=typeof n=="number"&&!Number.isNaN(n)?n:0,m=x.includes(r),[f,v]=w(!m&&r>0),k=C(()=>x.map(t=>({minutes:t,label:_(t,o)})),[o]),y=o?o("crud:duration.custom",{defaultValue:"Custom"}):"Custom";if(M){const t=r===0?o?o("crud:duration.zero",{defaultValue:"\u2014"}):"\u2014":r<60?o?o("crud:duration.minutes",{count:r,defaultValue:`${r} min`}):`${r} min`:o?o("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 u(l,{gap:"tight",children:[a($,{required:h,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:e}),u(l,{direction:"row",gap:"tight",align:"center",children:[a(S,{size:18,style:{color:"var(--muted-foreground)"},"aria-hidden":!0}),a("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-sm)"},children:t})]}),d&&a("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})}return u(l,{gap:"medium",children:[a($,{required:h,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:e}),u(l,{direction:"row",gap:"tight",align:"center",style:{flexWrap:"wrap"},children:[k.map(({minutes:t,label:z})=>u(b,{type:"button",variant:r===t?"primary":"outline",disabled:c,onClick:()=>{v(!1),i(t)},"aria-pressed":r===t,"aria-label":z,children:[a(S,{size:14,style:{marginRight:"var(--gap-xs)"},"aria-hidden":!0}),z]},t)),a(b,{type:"button",variant:f?"primary":"outline",disabled:c,onClick:()=>{v(!0),!m&&r>0?i(r):i(30)},"aria-pressed":f,"aria-label":y,children:y})]}),f&&a(l,{gap:"tight",style:{marginTop:"var(--gap-sm)"},children:a(E,{value:[m?30:r],onValueChange:([t])=>i(Math.max(p,Math.min(g,t??0))),min:p,max:g,step:V,showValue:!0,disabled:c,"aria-label":e})}),d&&a("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})};var W=j;export{x as DURATION_PRESETS,W as default};
@@ -1 +1 @@
1
- "use client";import{jsx as l,jsxs as p}from"react/jsx-runtime";import{Upload as Y,X as Z,File as $,Loader2 as ee,FileText as D,FileSpreadsheet as re,FileImage as ae,FileVideo as le,FileAudio as se,FileArchive as te,FileCode as ie}from"lucide-react";import{useCallback as h,useState as j,useRef as F,useEffect as B,useImperativeHandle as oe,forwardRef as ne}from"react";import{Button as de,BUTTON_VARIANT as ce,Text as y,Stack as N,Progress as ue}from"@donotdev/components";import{handleError as I,useTranslation as pe}from"@donotdev/core";import{useUploadContext as me}from"../../../contexts/UploadContext";import{useUploadStore as fe}from"../../../stores/UploadStore";import{uploadFile as ge,deleteFile as ve,generateFileId as R,getFileIcon as he,formatFileSize as ye}from"../../../utils/fileStorage";function xe({type:m,className:o}){switch(m){case"pdf":return l(D,{className:o,style:{color:"var(--destructive)"}});case"doc":return l(D,{className:o,style:{color:"var(--primary)"}});case"xls":return l(re,{className:o,style:{color:"var(--success)"}});case"ppt":return l(D,{className:o,style:{color:"var(--warning)"}});case"image":return l(ae,{className:o});case"video":return l(le,{className:o});case"audio":return l(se,{className:o});case"archive":return l(te,{className:o});case"html":case"text":return l(ie,{className:o});default:return l($,{className:o})}}const H=ne(({name:m,label:o,value:f,onChange:M,error:b,helperText:U,accept:q,multiple:n=!1,maxFiles:P=10,maxSize:z=50*1024*1024,storagePath:A="uploads/files",required:K},V)=>{const{t:W}=pe("dndev"),c=W,g=me(),T=fe(),L=!!g,[t,u]=j([]),[E,S]=j(!1),v=F(null),C=F(!1),x=F(void 0),w=h(e=>{const r=e.filter(a=>a.uploaded&&!a.error).map(a=>a.uploaded);M(n?r:r[0]||null)},[n,M]);B(()=>{if(C.current){C.current=!1;return}if(f){const e=[];(Array.isArray(f)?f:[f]).forEach(r=>{r.url&&e.push({id:R(),file:new File([],r.filename),uploadProgress:null,uploaded:r,error:null})}),u(e)}else u([])},[f]);const X=h(async()=>{const e=t.filter(r=>!r.uploaded&&!r.error&&r.uploadProgress===null);if(e.length!==0){u(r=>r.map(a=>e.some(s=>s.id===a.id)?{...a,uploadProgress:0}:a));for(const r of e)try{const a=await ge(r.file,{storagePath:A,onProgress:s=>{u(d=>d.map(i=>i.id===r.id?{...i,uploadProgress:s.progress}:i))}});u(s=>{const d=s.map(i=>i.id===r.id?{...i,uploaded:a,uploadProgress:100,error:null}:i);return queueMicrotask(()=>w(d)),d})}catch{u(a=>a.map(s=>s.id===r.id?{...s,error:"Upload failed",uploadProgress:null}:s))}}},[t,A,w]);x.current=X,B(()=>{if(!(!g||!m))return T.registerUpload(g,m,async e=>{await x.current?.()}),()=>{T.unregisterUpload(g,m)}},[g,m,T]),oe(V,()=>({upload:async()=>{await x.current?.()},getFiles:()=>O.current||[]}),[]);const O=F(t);O.current=t;const k=h(e=>{const r=(n?P:1)-t.length;if(r<=0){I(new Error("Maximum files reached"),{userMessage:c("file.errors.maxFiles",{max:P}),severity:"warning",showNotification:!0});return}const a=e.slice(0,r),s=[],d=(z/(1024*1024)).toFixed(0);for(const i of a){if(i.size>z){I(new Error("File too large"),{userMessage:c("file.errors.exceedsSize",{fileName:i.name,size:d}),severity:"warning",showNotification:!0});continue}s.push({id:R(),file:i,uploadProgress:null,uploaded:null,error:null})}s.length!==0&&(u(i=>n?[...i,...s]:s),L||setTimeout(()=>x.current?.(),0))},[t,n,P,z,c,L]),_=e=>{const r=Array.from(e.target.files||[]);r.length>0&&k(r),v.current&&(v.current.value="")},G=h(e=>{e.preventDefault(),S(!1);const r=Array.from(e.dataTransfer.files);k(r)},[k]),J=h(async e=>{const r=t[e];if(r)try{r.uploaded&&await ve(r.uploaded);const a=t.filter((s,d)=>d!==e);C.current=!0,u(a),setTimeout(()=>w(a),0)}catch(a){I(a,{userMessage:c("file.delete.failed"),severity:"error",showNotification:!0})}},[t,w,c]),Q=n||t.length===0,Fe=t.some(e=>!e.uploaded&&!e.error&&e.uploadProgress===null);return p(N,{gap:"tight",children:[p(y,{level:"body",align:"start",children:[o,K?"*":""]}),Q&&p("div",{role:"button",tabIndex:0,"aria-label":c(n?"file.upload.ariaLabelMultiple":"file.upload.ariaLabelSingle"),className:"dndev-surface","data-variant":b?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:E?"var(--primary)":b?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:E?"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(),S(!0)},onDragLeave:()=>S(!1),onDrop:G,onClick:()=>v.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),v.current?.click())},children:[l("input",{ref:v,type:"file",accept:q,multiple:n,style:{display:"none"},onChange:_}),p(N,{align:"center",justify:"center",gap:"medium",children:[l(Y,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),l(y,{as:"p",variant:"muted",level:"small",align:"center",children:c(n?"file.upload.dragDropMultiple":"file.upload.dragDropSingle")})]})]}),t.length>0&&l(N,{gap:"tight",children:t.map((e,r)=>{const a=he(e.uploaded?.mimeType||e.file.type,e.file.name),s=e.uploadProgress!==null&&e.uploadProgress<100,d=e.uploaded&&!e.error;return p("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:[l(xe,{type:a,className:"dndev-size-md"}),p(N,{gap:"none",style:{flex:1,minWidth:0},children:[l(y,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),p(y,{level:"caption",variant:"muted",children:[ye(e.uploaded?.size||e.file.size),e.error&&p("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),s&&l(ue,{value:e.uploadProgress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),s?l(ee,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):l(de,{variant:ce.GHOST,onClick:()=>J(r),"aria-label":c("file.delete.ariaLabel"),children:l(Z,{className:"dndev-size-sm"})})]},e.id)})}),U&&l(y,{level:"caption",variant:b?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:U})]})});H.displayName="FileFieldComponent";var we=H;export{we as default};
1
+ "use client";import{jsx as s,jsxs as p}from"react/jsx-runtime";import{Upload as Z,X as $,File as ee,Loader2 as re,FileText as C,FileSpreadsheet as oe,FileImage as se,FileVideo as ae,FileAudio as te,FileArchive as le,FileCode as ne}from"lucide-react";import{useCallback as y,useState as O,useRef as b,useEffect as _,useImperativeHandle as ie,forwardRef as de}from"react";import{Button as ue,BUTTON_VARIANT as ce,Text as F,Stack as P,Progress as pe}from"@donotdev/components";import{handleError as M,useTranslation as fe}from"@donotdev/core";import{useUploadContext as ge}from"../../../contexts/UploadContext";import{useUploadStore as me}from"../../../stores/UploadStore";import{uploadFile as ve,deleteFile as he,generateFileId as H,getFileIcon as ye,formatFileSize as Fe}from"../../../utils/fileStorage";function we({type:f,className:n}){switch(f){case"pdf":return s(C,{className:n,style:{color:"var(--destructive)"}});case"doc":return s(C,{className:n,style:{color:"var(--primary)"}});case"xls":return s(oe,{className:n,style:{color:"var(--success)"}});case"ppt":return s(C,{className:n,style:{color:"var(--warning)"}});case"image":return s(se,{className:n});case"video":return s(ae,{className:n});case"audio":return s(te,{className:n});case"archive":return s(le,{className:n});case"html":case"text":return s(ne,{className:n});default:return s(ee,{className:n})}}const D=de(({name:f,label:n,value:g,onChange:T,error:A,helperText:R,accept:V,multiple:d=!1,maxFiles:N=10,maxSize:k=50*1024*1024,storagePath:E="uploads/files",required:q},G)=>{const{t:K}=fe("dndev"),i=K,m=ge(),I=me(),j=!!m,[t,c]=O([]),[L,U]=O(!1),v=b(null),S=b(!1),w=b(void 0),x=y(e=>{const r=e.filter(o=>o.uploaded&&!o.error).map(o=>o.uploaded);T(d?r:r[0]||null)},[d,T]);_(()=>{if(S.current){S.current=!1;return}if(g){const e=[];(Array.isArray(g)?g:[g]).forEach(o=>{o.url&&e.push({id:H(),file:new File([],o.filename),uploadProgress:null,uploaded:o,error:null})}),c(e)}else c([])},[g]);const W=y(async()=>{const e=t.filter(r=>!r.uploaded&&!r.error&&r.uploadProgress===null);if(e.length!==0){c(r=>r.map(o=>e.some(l=>l.id===o.id)?{...o,uploadProgress:0}:o));for(const r of e)try{const o=await ve(r.file,{storagePath:E,onProgress:l=>{c(a=>a.map(u=>u.id===r.id?{...u,uploadProgress:l.progress}:u))}});c(l=>{const a=l.map(u=>u.id===r.id?{...u,uploaded:o,uploadProgress:100,error:null}:u);return queueMicrotask(()=>x(a)),a})}catch{c(l=>l.map(a=>a.id===r.id?{...a,error:"Upload failed",uploadProgress:null}:a))}}},[t,E,x]);w.current=W,_(()=>{if(!(!m||!f))return I.registerUpload(m,f,async e=>{await w.current?.()}),()=>{I.unregisterUpload(m,f)}},[m,f,I]),ie(G,()=>({upload:async()=>{await w.current?.()},getFiles:()=>B.current||[]}),[]);const B=b(t);B.current=t;const z=y(e=>{const o=(d?N:1)-t.length;if(o<=0){M(new Error("Maximum files reached"),{userMessage:i("file.errors.maxFiles",{max:N}),severity:"warning",showNotification:!0});return}const l=e.slice(0,o),a=[],u=(k/(1024*1024)).toFixed(0);for(const h of l){if(h.size>k){M(new Error("File too large"),{userMessage:i("file.errors.exceedsSize",{fileName:h.name,size:u}),severity:"warning",showNotification:!0});continue}a.push({id:H(),file:h,uploadProgress:null,uploaded:null,error:null})}a.length!==0&&(c(h=>d?[...h,...a]:a),j||setTimeout(()=>w.current?.(),0))},[t,d,N,k,i,j]),X=e=>{const r=Array.from(e.target.files||[]);r.length>0&&z(r),v.current&&(v.current.value="")},J=y(e=>{e.preventDefault(),U(!1);const r=Array.from(e.dataTransfer.files);z(r)},[z]),Q=y(async e=>{const r=t[e];if(r)try{r.uploaded&&await he(r.uploaded);const o=t.filter((l,a)=>a!==e);S.current=!0,c(o),setTimeout(()=>x(o),0)}catch(o){M(o,{userMessage:i("file.delete.failed"),severity:"error",showNotification:!0})}},[t,x,i]),Y=d||t.length===0,xe=t.some(e=>!e.uploaded&&!e.error&&e.uploadProgress===null);return p(P,{gap:"tight",children:[p(F,{level:"body",align:"start",children:[n,q?"*":""]}),Y&&p("div",{role:"button",tabIndex:0,"aria-label":i(d?"file.upload.ariaLabelMultiple":"file.upload.ariaLabelSingle"),className:"dndev-surface","data-variant":A?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:L?"var(--primary)":A?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:L?"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(),U(!0)},onDragLeave:()=>U(!1),onDrop:J,onClick:()=>v.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),v.current?.click())},children:[s("input",{ref:v,type:"file",accept:V,multiple:d,style:{display:"none"},onChange:X}),p(P,{align:"center",justify:"center",gap:"medium",children:[s(Z,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),s(F,{as:"p",variant:"muted",level:"small",align:"center",children:i(d?"file.upload.dragDropMultiple":"file.upload.dragDropSingle")})]})]}),t.length>0&&s(P,{gap:"tight",children:t.map((e,r)=>{const o=ye(e.uploaded?.mimeType||e.file.type,e.file.name),l=e.uploadProgress!==null&&e.uploadProgress<100,a=e.uploaded&&!e.error;return p("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:[s(we,{type:o,className:"dndev-size-md"}),p(P,{gap:"none",style:{flex:1,minWidth:0},children:[s(F,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),p(F,{level:"caption",variant:"muted",children:[Fe(e.uploaded?.size||e.file.size),e.error&&p("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),l&&s(pe,{value:e.uploadProgress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),l?s(re,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):s(ue,{variant:ce.GHOST,onClick:()=>Q(r),"aria-label":i("file.delete.ariaLabel"),children:s($,{className:"dndev-size-sm"})})]},e.id)})}),R&&s(F,{level:"caption",variant:A?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:R})]})});D.displayName="FileFieldComponent";var ze=D;export{ze as default};
@@ -1 +1 @@
1
- import{jsx as t,jsxs as a,Fragment as b}from"react/jsx-runtime";import{useState as m}from"react";import{Checkbox as D,Label as H,Sheet as f,Stack as V,Text as P}from"@donotdev/components";import{useTranslation as j}from"@donotdev/core";const q=({checked:o=!1,onChange:l,required:u,privacyPolicyPath:s="/legal/privacy",termsPath:c="/legal/terms"})=>{const{t:r}=j("crud"),[y,d]=m(!1),[x,h]=m(!1),p=e=>{l&&l({target:{checked:e}})},v=e=>{e.target.tagName!=="A"&&(e.target.closest('[data-type="checkbox"]')||p(!o))},g=(e,w)=>{e.preventDefault(),w==="privacy"?d(!0):h(!0)},C=r("gdprConsent.consent",{defaultValue:"I agree to the"}),n=r("gdprConsent.privacyPolicy",{defaultValue:"privacy policy"}),i=r("gdprConsent.terms",{defaultValue:"terms of use"}),k=r("gdprConsent.and",{defaultValue:"and consent to the processing of my personal data."});return a(b,{children:[a(V,{direction:"row",align:"center",gap:"tight",children:[t(D,{checked:o,onCheckedChange:p}),t(H,{required:u,plain:!0,onClick:v,style:{cursor:"pointer"},children:a(P,{level:"small",children:[C," ",t("a",{href:s,onClick:e=>g(e,"privacy"),style:{textDecoration:"underline",cursor:"pointer"},children:n})," / ",t("a",{href:c,onClick:e=>g(e,"terms"),style:{textDecoration:"underline",cursor:"pointer"},children:i})," ",k]})})]}),t(f,{open:y,onOpenChange:d,side:"bottom",title:n,style:{width:"100%",height:"90%",maxHeight:"90dvh",display:"flex",flexDirection:"column",overflow:"hidden"},children:t("iframe",{src:s,style:{width:"100%",height:"100%",border:"none",flex:1,minHeight:0},title:n})}),t(f,{open:x,onOpenChange:h,side:"bottom",title:i,style:{width:"100%",height:"90%",maxHeight:"90dvh",display:"flex",flexDirection:"column",overflow:"hidden"},children:t("iframe",{src:c,style:{width:"100%",height:"100%",border:"none",flex:1,minHeight:0},title:i})})]})};var O=q;export{O as default};
1
+ import{jsx as t,jsxs as o,Fragment as w}from"react/jsx-runtime";import{useState as m}from"react";import{Checkbox as T,Label as O,Sheet as g,Stack as D,Text as j}from"@donotdev/components";import{useTranslation as H}from"@donotdev/core";const V=({checked:l=!1,onChange:s,required:u,privacyPolicyPath:a="/legal/privacy",termsPath:c="/legal/terms"})=>{const{t:n}=H("crud"),[x,d]=m(!1),[y,h]=m(!1),p=e=>{s&&s({target:{checked:e}})},C=e=>{e.target.tagName!=="A"&&(e.target.closest('[data-type="checkbox"]')||p(!l))},f=(e,b)=>{e.preventDefault(),b==="privacy"?d(!0):h(!0)},v=n("gdprConsent.consent",{defaultValue:"I agree to the"}),r=n("gdprConsent.privacyPolicy",{defaultValue:"privacy policy"}),i=n("gdprConsent.terms",{defaultValue:"terms of use"}),k=n("gdprConsent.and",{defaultValue:"and consent to the processing of my personal data."});return o(w,{children:[o(D,{direction:"row",align:"center",gap:"tight",children:[t(T,{checked:l,onCheckedChange:p}),t(O,{required:u,plain:!0,onClick:C,style:{cursor:"pointer"},children:o(j,{level:"small",children:[v," ",t("a",{href:a,onClick:e=>f(e,"privacy"),style:{textDecoration:"underline",cursor:"pointer"},children:r})," / ",t("a",{href:c,onClick:e=>f(e,"terms"),style:{textDecoration:"underline",cursor:"pointer"},children:i})," ",k]})})]}),t(g,{open:x,onOpenChange:d,side:"bottom",title:r,style:{width:"100%",height:"90%",maxHeight:"90dvh",display:"flex",flexDirection:"column",overflow:"hidden"},children:t("iframe",{src:a,style:{width:"100%",height:"100%",border:"none",flex:1,minHeight:0},title:r})}),t(g,{open:y,onOpenChange:h,side:"bottom",title:i,style:{width:"100%",height:"90%",maxHeight:"90dvh",display:"flex",flexDirection:"column",overflow:"hidden"},children:t("iframe",{src:c,style:{width:"100%",height:"100%",border:"none",flex:1,minHeight:0},title:i})})]})};var q=V;export{q as default};
@@ -1 +1 @@
1
- import{jsx as t,jsxs as u}from"react/jsx-runtime";import{Label as h,Input as v,Stack as g}from"@donotdev/components";const b=({label:c,value:a={lat:0,lng:0},onChange:i,error:r,helperText:o,disabled:d,required:m})=>{const p=n=>{const e=parseFloat(n.target.value)||0;if(e>=-90&&e<=90){const l={...a,lat:e},s={target:{value:JSON.stringify(l)}};i(s)}},f=n=>{const e=parseFloat(n.target.value)||0;if(e>=-180&&e<=180){const l={...a,lng:e},s={target:{value:JSON.stringify(l)}};i(s)}};return u(g,{gap:"tight",children:[t(h,{required:m,style:{display:"block",fontSize:"var(--font-size-sm)",fontWeight:500},children:c}),u(g,{direction:"row",gap:"medium",children:[t(v,{label:"Latitude",type:"number",value:a.lat,onChange:p,min:"-90",max:"90",step:"0.000001",disabled:d,"data-variant":r?"destructive":void 0,className:"dndev-w-full"}),t(v,{label:"Longitude",type:"number",value:a.lng,onChange:f,min:"-180",max:"180",step:"0.000001",disabled:d,"data-variant":r?"destructive":void 0,className:"dndev-w-full"})]}),o&&t("p",{style:{fontSize:"var(--font-size-xs)",color:r?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:o})]})};var y=b;export{y as default};
1
+ import{jsx as n,jsxs as c}from"react/jsx-runtime";import{Label as h,Input as g,Stack as u}from"@donotdev/components";const y=({label:m,value:e={lat:0,lng:0},onChange:l,error:a,helperText:r,disabled:d,required:f})=>{const v=i=>{const t=parseFloat(i.target.value)||0;if(t>=-90&&t<=90){const s={...e,lat:t},o={target:{value:JSON.stringify(s)}};l(o)}},p=i=>{const t=parseFloat(i.target.value)||0;if(t>=-180&&t<=180){const s={...e,lng:t},o={target:{value:JSON.stringify(s)}};l(o)}};return c(u,{gap:"tight",children:[n(h,{required:f,style:{display:"block",fontSize:"var(--font-size-sm)",fontWeight:500},children:m}),c(u,{direction:"row",gap:"medium",children:[n(g,{label:"Latitude",type:"number",value:e.lat,onChange:v,min:"-90",max:"90",step:"0.000001",disabled:d,"data-variant":a?"destructive":void 0,className:"dndev-w-full"}),n(g,{label:"Longitude",type:"number",value:e.lng,onChange:p,min:"-180",max:"180",step:"0.000001",disabled:d,"data-variant":a?"destructive":void 0,className:"dndev-w-full"})]}),r&&n("p",{style:{fontSize:"var(--font-size-xs)",color:a?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:r})]})};var L=y;export{L as default};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";const n=({name:a,value:e})=>t("input",{type:"hidden",name:a,value:e});var d=n;export{d as default};
1
+ import{jsx as t}from"react/jsx-runtime";const d=({name:e,value:n})=>t("input",{type:"hidden",name:e,value:n});var i=d;export{i as default};