@donotdev/crud 0.1.42 → 0.1.43

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 (144) hide show
  1. package/dist/CrudService.bulk.js +1 -1
  2. package/dist/CrudService.bulkAcross.js +1 -1
  3. package/dist/CrudService.cache.js +1 -1
  4. package/dist/CrudService.internal.js +2 -2
  5. package/dist/CrudService.mutations.js +1 -1
  6. package/dist/CrudService.optimistic.js +1 -1
  7. package/dist/CrudService.queries.js +1 -1
  8. package/dist/CrudService.subscriptions.js +1 -1
  9. package/dist/CrudStore.js +1 -1
  10. package/dist/adapters/FunctionsAdapter.js +1 -1
  11. package/dist/components/CrudButton.js +1 -1
  12. package/dist/components/CrudCard.d.ts.map +1 -1
  13. package/dist/components/CrudCard.js +1 -1
  14. package/dist/components/DateFilter.js +1 -1
  15. package/dist/components/DisplayFieldRenderer.js +1 -1
  16. package/dist/components/DisplayThumbnail.js +1 -1
  17. package/dist/components/EntityFilters.js +1 -1
  18. package/dist/components/FormFieldRenderer.js +1 -1
  19. package/dist/components/FormLayout.js +1 -1
  20. package/dist/components/YearFilter.js +1 -1
  21. package/dist/components/controlled/complex/ControlledAddressField.js +1 -1
  22. package/dist/components/controlled/complex/ControlledDateField.js +1 -1
  23. package/dist/components/controlled/complex/ControlledFieldArrayField.js +1 -1
  24. package/dist/components/controlled/complex/ControlledGeoPointField.js +1 -1
  25. package/dist/components/controlled/complex/ControlledMapField.js +1 -1
  26. package/dist/components/controlled/complex/ControlledMultiInputField.js +1 -1
  27. package/dist/components/controlled/complex/ControlledRichTextField.js +1 -1
  28. package/dist/components/controlled/complex/ControlledTimestampField.js +1 -1
  29. package/dist/components/controlled/file/ControlledDocumentField.js +1 -1
  30. package/dist/components/controlled/file/ControlledFileField.js +1 -1
  31. package/dist/components/controlled/file/ControlledImageField.js +1 -1
  32. package/dist/components/controlled/file/ControlledMultiDocumentField.js +1 -1
  33. package/dist/components/controlled/file/ControlledMultiFileField.js +1 -1
  34. package/dist/components/controlled/file/ControlledMultiImageField.js +1 -1
  35. package/dist/components/controlled/input/ControlledCurrencyField.js +1 -1
  36. package/dist/components/controlled/input/ControlledDurationField.js +1 -1
  37. package/dist/components/controlled/input/ControlledGdprConsentField.js +1 -1
  38. package/dist/components/controlled/input/ControlledNumberField.js +1 -1
  39. package/dist/components/controlled/input/ControlledPhoneField.js +1 -1
  40. package/dist/components/controlled/input/ControlledPriceField.js +1 -1
  41. package/dist/components/controlled/input/ControlledRangeField.js +1 -1
  42. package/dist/components/controlled/input/ControlledRatingField.js +1 -1
  43. package/dist/components/controlled/input/ControlledSwitchField.js +1 -1
  44. package/dist/components/controlled/input/ControlledTextField.js +1 -1
  45. package/dist/components/controlled/input/ControlledTextareaField.js +1 -1
  46. package/dist/components/controlled/select/ControlledComboboxField.js +1 -1
  47. package/dist/components/controlled/select/ControlledDropdownField.js +1 -1
  48. package/dist/components/controlled/select/ControlledMultiDropdownField.js +1 -1
  49. package/dist/components/controlled/select/ControlledRadioField.js +1 -1
  50. package/dist/components/controlled/select/ControlledReferenceField.js +1 -1
  51. package/dist/components/controlled/types.js +1 -1
  52. package/dist/components/fields/display/AvatarFieldDisplay.js +1 -1
  53. package/dist/components/fields/display/BadgeFieldDisplay.js +1 -1
  54. package/dist/components/fields/display/ButtonFieldDisplay.js +1 -1
  55. package/dist/components/fields/display/CheckboxFieldDisplay.js +1 -1
  56. package/dist/components/fields/display/DateFieldDisplay.js +1 -1
  57. package/dist/components/fields/display/DropdownDisplay.js +1 -1
  58. package/dist/components/fields/display/FileFieldDisplay.js +1 -1
  59. package/dist/components/fields/display/GeoPointFieldDisplay.js +1 -1
  60. package/dist/components/fields/display/HiddenFieldDisplay.js +1 -1
  61. package/dist/components/fields/display/ImageFieldDisplay.js +1 -1
  62. package/dist/components/fields/display/LinkFieldDisplay.js +1 -1
  63. package/dist/components/fields/display/MapFieldDisplay.js +1 -1
  64. package/dist/components/fields/display/MultiDropdownDisplay.js +1 -1
  65. package/dist/components/fields/display/MultiInputTextFieldDisplay.js +1 -1
  66. package/dist/components/fields/display/NumberFieldDisplay.js +1 -1
  67. package/dist/components/fields/display/PasswordFieldDisplay.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/TextAreaDisplay.js +1 -1
  72. package/dist/components/fields/display/TextFieldDisplay.js +1 -1
  73. package/dist/components/fields/display/TimestampFieldDisplay.js +1 -1
  74. package/dist/components/fields/display/index.js +1 -1
  75. package/dist/components/form/fields/AddressFieldComponent.js +1 -1
  76. package/dist/components/form/fields/AvatarFieldComponent.js +1 -1
  77. package/dist/components/form/fields/BadgeFieldComponent.js +1 -1
  78. package/dist/components/form/fields/ButtonFieldComponent.js +1 -1
  79. package/dist/components/form/fields/CheckboxFieldComponent.js +1 -1
  80. package/dist/components/form/fields/ComboboxComponent.js +1 -1
  81. package/dist/components/form/fields/CurrencyFieldComponent.js +1 -1
  82. package/dist/components/form/fields/DateFieldComponent.js +1 -1
  83. package/dist/components/form/fields/DocumentFieldComponent.js +1 -1
  84. package/dist/components/form/fields/DropdownComponent.js +1 -1
  85. package/dist/components/form/fields/DurationFieldComponent.js +1 -1
  86. package/dist/components/form/fields/FileFieldComponent.js +1 -1
  87. package/dist/components/form/fields/GdprConsentFieldComponent.js +1 -1
  88. package/dist/components/form/fields/GeoPointFieldComponent.js +1 -1
  89. package/dist/components/form/fields/ImageFieldComponent.js +1 -1
  90. package/dist/components/form/fields/MapFieldComponent.js +1 -1
  91. package/dist/components/form/fields/MultiDropdownComponent.js +1 -1
  92. package/dist/components/form/fields/MultiInputTextFieldComponent.js +1 -1
  93. package/dist/components/form/fields/NumberFieldComponent.js +1 -1
  94. package/dist/components/form/fields/PasswordFieldComponent.js +1 -1
  95. package/dist/components/form/fields/PhoneNumberComponent.js +1 -1
  96. package/dist/components/form/fields/PriceFieldComponent.js +1 -1
  97. package/dist/components/form/fields/RadioFieldComponent.js +1 -1
  98. package/dist/components/form/fields/RangeFieldComponent.js +1 -1
  99. package/dist/components/form/fields/RatingFieldComponent.js +1 -1
  100. package/dist/components/form/fields/ReferenceFieldComponent.js +1 -1
  101. package/dist/components/form/fields/RichTextComponent.js +1 -1
  102. package/dist/components/form/fields/SwitchFieldComponent.js +1 -1
  103. package/dist/components/form/fields/TextAreaComponent.js +1 -1
  104. package/dist/components/form/fields/TextFieldComponent.js +1 -1
  105. package/dist/components/form/fields/TimestampFieldComponent.js +1 -1
  106. package/dist/components/form/fields/index.js +1 -1
  107. package/dist/components/form/fields/internal/TiptapEditor.js +2 -2
  108. package/dist/components/form/internal/ImageViewerDialog.js +1 -1
  109. package/dist/contexts/UploadContext.js +1 -1
  110. package/dist/fieldTypeRegistry.store.js +1 -1
  111. package/dist/forms/hooks/useController.js +1 -1
  112. package/dist/forms/hooks/useEntityField.js +1 -1
  113. package/dist/forms/hooks/useEntityForm.js +1 -1
  114. package/dist/forms/utils/buildInitialValues.js +1 -1
  115. package/dist/forms/utils/isFieldEditable.js +1 -1
  116. package/dist/forms/utils/translateFieldLabel.js +1 -1
  117. package/dist/forms/utils/validateEntity.js +1 -1
  118. package/dist/hooks/useCrudFilters.js +1 -1
  119. package/dist/hooks/useCrudPageSize.js +1 -1
  120. package/dist/hooks/useEntityFavorites.js +1 -1
  121. package/dist/hooks/useFieldConditions.js +1 -1
  122. package/dist/hooks/useFileUpload.js +1 -1
  123. package/dist/hooks/useReferenceResolver.js +1 -1
  124. package/dist/hooks/useRelatedItems.js +1 -1
  125. package/dist/index.js +1 -1
  126. package/dist/stores/FormStore.js +1 -1
  127. package/dist/stores/UploadStore.js +1 -1
  128. package/dist/stores/index.js +1 -1
  129. package/dist/tsconfig.tsbuildinfo +1 -1
  130. package/dist/useBaseCrudList.js +1 -1
  131. package/dist/useCrud.js +1 -1
  132. package/dist/useCrudCardList.js +1 -1
  133. package/dist/useCrudList.js +1 -1
  134. package/dist/utils/clientListProcessing.js +1 -1
  135. package/dist/utils/collections.js +1 -1
  136. package/dist/utils/fileStorage.js +1 -1
  137. package/dist/utils/imageProcessing.js +1 -1
  138. package/dist/utils/matchesFilter.js +1 -1
  139. package/dist/utils/mergeWithOptimistic.js +1 -1
  140. package/dist/utils/sanitizeHtml.js +1 -1
  141. package/dist/utils/uploadValidation.js +1 -1
  142. package/dist/workflows/defineWorkflow.js +1 -1
  143. package/dist/workflows/useEntityWorkflow.js +1 -1
  144. package/package.json +2 -2
@@ -1 +1 @@
1
- "use client";import{jsx as o}from"react/jsx-runtime";import{Controller as u}from"react-hook-form";import{TimestampFieldComponent as p}from"../../form/fields";import{convertValidationRules as c}from"../types";function C(l){const{control:n,errors:v,fieldConfig:t,required:a,t:i}=l,{name:m,label:s,validation:r}=t;return o(u,{name:m,control:n,rules:r?c(r):void 0,render:({field:e,fieldState:d})=>o(p,{...e,label:i(s),value:e.value??null,onChange:f=>e.onChange(f),error:d.error?.message,required:a})})}export{C as ControlledTimestampField};
1
+ "use client";import{jsx as o}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{TimestampFieldComponent as p}from"../../form/fields";import{convertValidationRules as c}from"../types";function C(l){const{control:n,errors:v,fieldConfig:t,required:a,t:i}=l,{name:m,label:s,validation:r}=t;return o(f,{name:m,control:n,rules:r?c(r):void 0,render:({field:e,fieldState:d})=>o(p,{...e,label:i(s),value:e.value??null,onChange:u=>e.onChange(u),error:d.error?.message,required:a})})}export{C as ControlledTimestampField};
@@ -1 +1 @@
1
- "use client";import{jsx as l}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{DocumentFieldComponent as p}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(i){const{control:m,errors:C,fieldConfig:e,required:s,t:u}=i,{name:r,label:d,validation:o}=e,a=e.options||{};return l(c,{name:r,control:m,rules:o?g(o):void 0,render:({field:n,fieldState:t})=>l(p,{name:r,label:u(d),value:n.value??null,onChange:f=>n.onChange(f),error:!!t.error,helperText:t.error?.message,required:s,multiple:!1,maxFiles:1,maxSize:a.maxSize,storagePath:a.storagePath})})}export{x as ControlledDocumentField};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{DocumentFieldComponent as f}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(i){const{control:m,errors:C,fieldConfig:e,required:s,t:u}=i,{name:r,label:d,validation:o}=e,l=e.options||{};return n(c,{name:r,control:m,rules:o?g(o):void 0,render:({field:a,fieldState:t})=>n(f,{name:r,label:u(d),value:a.value??null,onChange:p=>a.onChange(p),error:!!t.error,helperText:t.error?.message,required:s,multiple:!1,maxFiles:1,maxSize:l.maxSize,storagePath:l.storagePath})})}export{x as ControlledDocumentField};
@@ -1 +1 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{FileFieldComponent as c}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(t){const{control:m,errors:C,fieldConfig:e,required:s,t:d}=t,{name:r,label:u,validation:o}=e,l=e.options||{};return n(p,{name:r,control:m,rules:o?g(o):void 0,render:({field:a,fieldState:i})=>n(c,{name:r,label:d(u),value:a.value??null,onChange:f=>a.onChange(f),error:!!i.error,helperText:i.error?.message,required:s,multiple:!1,maxFiles:1,maxSize:l.maxSize,storagePath:l.storagePath})})}export{x as ControlledFileField};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{FileFieldComponent as c}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(i){const{control:m,errors:C,fieldConfig:e,required:s,t:d}=i,{name:r,label:u,validation:o}=e,l=e.options||{};return n(f,{name:r,control:m,rules:o?g(o):void 0,render:({field:t,fieldState:a})=>n(c,{name:r,label:d(u),value:t.value??null,onChange:p=>t.onChange(p),error:!!a.error,helperText:a.error?.message,required:s,multiple:!1,maxFiles:1,maxSize:l.maxSize,storagePath:l.storagePath})})}export{x as ControlledFileField};
@@ -1 +1 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{ImageFieldComponent as g}from"../../form/fields";import{convertValidationRules as c}from"../types";function x(t){const{control:m,errors:C,fieldConfig:e,required:s,t:d}=t,{name:r,label:f,validation:o}=e,a=e.options||{};return n(p,{name:r,control:m,rules:o?c(o):void 0,render:({field:l,fieldState:i})=>n(g,{name:r,label:d(f),value:l.value??null,onChange:u=>l.onChange(u),error:!!i.error,helperText:i.error?.message,required:s,multiple:!1,maxFiles:1,maxSize:a.maxSize,storagePath:a.fieldSpecific?.storagePath})})}export{x as ControlledImageField};
1
+ "use client";import{jsx as i}from"react/jsx-runtime";import{Controller as u}from"react-hook-form";import{ImageFieldComponent as c}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(n){const{control:m,errors:C,fieldConfig:e,required:s,t:d}=n,{name:r,label:f,validation:o}=e,a=e.options||{};return i(u,{name:r,control:m,rules:o?g(o):void 0,render:({field:l,fieldState:t})=>i(c,{name:r,label:d(f),value:l.value??null,onChange:p=>l.onChange(p),error:!!t.error,helperText:t.error?.message,required:s,multiple:!1,maxFiles:1,maxSize:a.maxSize,storagePath:a.fieldSpecific?.storagePath})})}export{x as ControlledImageField};
@@ -1 +1 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{DocumentFieldComponent as v}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(i){const{control:m,errors:C,fieldConfig:o,required:s,t:u}=i,{name:l,label:d,validation:t}=o,r=o.options||{};return n(f,{name:l,control:m,rules:t?g(t):void 0,render:({field:e,fieldState:a})=>{const c=Array.isArray(e.value)?e.value:e.value?[e.value]:null;return n(v,{name:l,label:u(d),value:c,onChange:p=>e.onChange(p),error:!!a.error,helperText:a.error?.message,required:s,multiple:!0,maxFiles:r.maxFiles??10,maxSize:r.maxSize,storagePath:r.storagePath})}})}export{x as ControlledMultiDocumentField};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{DocumentFieldComponent as v}from"../../form/fields";import{convertValidationRules as x}from"../types";function g(i){const{control:m,errors:C,fieldConfig:o,required:s,t:u}=i,{name:l,label:d,validation:t}=o,r=o.options||{};return n(p,{name:l,control:m,rules:t?x(t):void 0,render:({field:e,fieldState:a})=>{const c=Array.isArray(e.value)?e.value:e.value?[e.value]:null;return n(v,{name:l,label:u(d),value:c,onChange:f=>e.onChange(f),error:!!a.error,helperText:a.error?.message,required:s,multiple:!0,maxFiles:r.maxFiles??10,maxSize:r.maxSize,storagePath:r.storagePath})}})}export{g as ControlledMultiDocumentField};
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import{Controller as v}from"react-hook-form";import{FileFieldComponent as c}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(n){const{control:s,errors:C,fieldConfig:o,required:m,t:u}=n,{name:l,label:d,validation:a}=o,r=o.options||{};return t(v,{name:l,control:s,rules:a?g(a):void 0,render:({field:e,fieldState:i})=>{const p=Array.isArray(e.value)?e.value:e.value?[e.value]:null;return t(c,{name:l,label:u(d),value:p,onChange:f=>e.onChange(f),error:!!i.error,helperText:i.error?.message,required:m,multiple:!0,maxFiles:r.maxFiles??10,maxSize:r.maxSize,storagePath:r.storagePath})}})}export{x as ControlledMultiFileField};
1
+ "use client";import{jsx as i}from"react/jsx-runtime";import{Controller as v}from"react-hook-form";import{FileFieldComponent as c}from"../../form/fields";import{convertValidationRules as x}from"../types";function g(n){const{control:s,errors:C,fieldConfig:o,required:m,t:u}=n,{name:l,label:d,validation:a}=o,r=o.options||{};return i(v,{name:l,control:s,rules:a?x(a):void 0,render:({field:e,fieldState:t})=>{const p=Array.isArray(e.value)?e.value:e.value?[e.value]:null;return i(c,{name:l,label:u(d),value:p,onChange:f=>e.onChange(f),error:!!t.error,helperText:t.error?.message,required:m,multiple:!0,maxFiles:r.maxFiles??10,maxSize:r.maxSize,storagePath:r.storagePath})}})}export{g as ControlledMultiFileField};
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{ImageFieldComponent as v}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(n){const{control:m,errors:C,fieldConfig:o,required:s,t:u}=n,{name:a,label:d,validation:l}=o,r=o.options||{};return t(c,{name:a,control:m,rules:l?g(l):void 0,render:({field:e,fieldState:i})=>{const f=Array.isArray(e.value)?e.value:e.value?[e.value]:null;return t(v,{name:a,label:u(d),value:f,onChange:p=>e.onChange(p),error:!!i.error,helperText:i.error?.message,required:s,multiple:!0,maxFiles:r.maxFiles??10,maxSize:r.maxSize,storagePath:r.fieldSpecific?.storagePath})}})}export{x as ControlledMultiImageField};
1
+ "use client";import{jsx as i}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{ImageFieldComponent as g}from"../../form/fields";import{convertValidationRules as v}from"../types";function x(n){const{control:m,errors:C,fieldConfig:o,required:s,t:u}=n,{name:a,label:d,validation:l}=o,r=o.options||{};return i(p,{name:a,control:m,rules:l?v(l):void 0,render:({field:e,fieldState:t})=>{const f=Array.isArray(e.value)?e.value:e.value?[e.value]:null;return i(g,{name:a,label:u(d),value:f,onChange:c=>e.onChange(c),error:!!t.error,helperText:t.error?.message,required:s,multiple:!0,maxFiles:r.maxFiles??10,maxSize:r.maxSize,storagePath:r.fieldSpecific?.storagePath})}})}export{x as ControlledMultiImageField};
@@ -1 +1 @@
1
- "use client";import{jsx as i}from"react/jsx-runtime";import{Controller as g}from"react-hook-form";import{CurrencyFieldComponent as y}from"../../form/fields";import{convertValidationRules as N}from"../types";function x(u){const{control:c,errors:b,fieldConfig:o,t:s,placeholder:d,required:f}=u,{name:m,label:p,validation:l}=o,n=(o.options||{}).fieldSpecific;return i(g,{name:m,control:c,rules:l?N(l):void 0,render:({field:e,fieldState:a})=>{const C=h=>{const r=h.target.value;if(r==null||r===""){e.onChange(null);return}const t=typeof r=="number"?r/100:parseFloat(String(r))/100;isNaN(t)?e.onChange(null):e.onChange(t)},v=e.value!=null&&!isNaN(e.value)?Math.round(e.value*100):void 0;return i(y,{label:s(p),value:v,onChange:C,currency:n?.currency||"EUR",locale:n?.locale,error:!!a.error,helperText:a.error?.message,required:f,placeholder:d})}})}export{x as ControlledCurrencyField};
1
+ "use client";import{jsx as i}from"react/jsx-runtime";import{Controller as h}from"react-hook-form";import{CurrencyFieldComponent as y}from"../../form/fields";import{convertValidationRules as N}from"../types";function b(u){const{control:c,errors:x,fieldConfig:o,t:s,placeholder:d,required:f}=u,{name:m,label:p,validation:l}=o,n=(o.options||{}).fieldSpecific;return i(h,{name:m,control:c,rules:l?N(l):void 0,render:({field:e,fieldState:t})=>{const C=g=>{const r=g.target.value;if(r==null||r===""){e.onChange(null);return}const a=typeof r=="number"?r/100:parseFloat(String(r))/100;isNaN(a)?e.onChange(null):e.onChange(a)},v=e.value!=null&&!isNaN(e.value)?Math.round(e.value*100):void 0;return i(y,{label:s(p),value:v,onChange:C,currency:n?.currency||"EUR",locale:n?.locale,error:!!t.error,helperText:t.error?.message,required:f,placeholder:d})}})}export{b as ControlledCurrencyField};
@@ -1 +1 @@
1
- "use client";import{jsx as a}from"react/jsx-runtime";import{Controller as u}from"react-hook-form";import{DurationFieldComponent as c}from"../../form/fields";import{convertValidationRules as C}from"../types";function x(t){const{control:d,errors:v,fieldConfig:o,t:i,required:s}=t,{name:m,label:f,validation:n}=o,e=(o.options||{}).fieldSpecific;return a(u,{name:m,control:d,rules:n?C(n):void 0,render:({field:r,fieldState:l})=>a(c,{label:i(f),value:r.value??0,onChange:p=>r.onChange(p),error:!!l.error,helperText:l.error?.message,required:s,disabled:r.disabled,min:e?.min??0,max:e?.max??480,step:e?.step??5,t:i})})}export{x as ControlledDurationField};
1
+ "use client";import{jsx as a}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{DurationFieldComponent as c}from"../../form/fields";import{convertValidationRules as C}from"../types";function v(l){const{control:s,errors:x,fieldConfig:r,t:i,required:d}=l,{name:m,label:f,validation:n}=r,e=(r.options||{}).fieldSpecific;return a(p,{name:m,control:s,rules:n?C(n):void 0,render:({field:o,fieldState:t})=>a(c,{label:i(f),value:o.value??0,onChange:u=>o.onChange(u),error:!!t.error,helperText:t.error?.message,required:d,disabled:o.disabled,min:e?.min??0,max:e?.max??480,step:e?.step??5,t:i})})}export{v as ControlledDurationField};
@@ -1 +1 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import{Controller as u}from"react-hook-form";import{GdprConsentFieldComponent as h}from"../../form/fields";import{convertValidationRules as v}from"../types";function y(i){const{control:a,errors:P,fieldConfig:l,required:s}=i,{name:d,validation:t,options:c={}}=l,r=c.fieldSpecific,p=r?.privacyPolicyPath||"/legal/privacy",m=r?.termsPath||"/legal/terms";return n(u,{name:d,control:a,rules:t?v(t):void 0,render:({field:o})=>{const e=o.value,C=typeof e=="object"&&e!==null?!!e.gdprConsent:!!e;return n(h,{checked:C,onChange:f=>{if(f.target.checked){const g=new Date().toISOString().split("T")[0];o.onChange({gdprConsent:!0,gdprConsentDate:new Date().toISOString(),gdprConsentVersion:g})}else o.onChange(!1)},required:s,privacyPolicyPath:p,termsPath:m})}})}export{y as ControlledGdprConsentField};
1
+ "use client";import{jsx as o}from"react/jsx-runtime";import{Controller as u}from"react-hook-form";import{GdprConsentFieldComponent as h}from"../../form/fields";import{convertValidationRules as v}from"../types";function y(i){const{control:a,errors:P,fieldConfig:l,required:s}=i,{name:c,validation:t,options:d={}}=l,r=d.fieldSpecific,p=r?.privacyPolicyPath||"/legal/privacy",m=r?.termsPath||"/legal/terms";return o(u,{name:c,control:a,rules:t?v(t):void 0,render:({field:n})=>{const e=n.value,g=typeof e=="object"&&e!==null?!!e.gdprConsent:!!e;return o(h,{checked:g,onChange:C=>{if(C.target.checked){const f=new Date().toISOString().split("T")[0];n.onChange({gdprConsent:!0,gdprConsentDate:new Date().toISOString(),gdprConsentVersion:f})}else n.onChange(!1)},required:s,privacyPolicyPath:p,termsPath:m})}})}export{y as ControlledGdprConsentField};
@@ -1 +1 @@
1
- "use client";import{jsx as s}from"react/jsx-runtime";import{Controller as v}from"react-hook-form";import{NumberFieldComponent as C}from"../../form/fields";import{convertValidationRules as h}from"../types";function N(m){const{control:u,errors:x,fieldConfig:n,t:c,placeholder:b,required:d}=m,{name:f,label:p,validation:r}=n,t=n.options||{},a=t.fieldSpecific;return s(v,{name:f,control:u,rules:r?h(r):void 0,render:({field:e,fieldState:l})=>{const g=o=>{if(o.target.value===""||o.target.value===null){e.onChange(null);return}try{const i=parseFloat(o.target.value);isNaN(i)||e.onChange(i)}catch{e.onChange(0)}};return s(C,{...e,label:c(p),value:e.value??void 0,onChange:g,error:!!l.error,helperText:l.error?.message,required:d,min:r?.min,max:r?.max,step:a?.mask==="currency"?.01:a?.mask==="mileage"?1:void 0,mask:a?.mask||"number",className:t.className})}})}export{N as ControlledNumberField};
1
+ "use client";import{jsx as s}from"react/jsx-runtime";import{Controller as v}from"react-hook-form";import{NumberFieldComponent as C}from"../../form/fields";import{convertValidationRules as h}from"../types";function N(m){const{control:u,errors:b,fieldConfig:n,t:c,placeholder:x,required:d}=m,{name:f,label:p,validation:r}=n,t=n.options||{},a=t.fieldSpecific;return s(v,{name:f,control:u,rules:r?h(r):void 0,render:({field:e,fieldState:l})=>{const g=o=>{if(o.target.value===""||o.target.value===null){e.onChange(null);return}try{const i=parseFloat(o.target.value);isNaN(i)||e.onChange(i)}catch{e.onChange(0)}};return s(C,{...e,label:c(p),value:e.value??void 0,onChange:g,error:!!l.error,helperText:l.error?.message,required:d,min:r?.min,max:r?.max,step:a?.mask==="currency"?.01:a?.mask==="mileage"?1:void 0,mask:a?.mask||"number",className:t.className})}})}export{N as ControlledNumberField};
@@ -1 +1 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{PhoneNumberComponent as g}from"../../form/fields";import{convertValidationRules as p}from"../types";function c(l){const{control:t,errors:v,fieldConfig:a,t:i,required:s}=l,{name:m,label:u,validation:r}=a;return n(f,{name:m,control:t,rules:r?p(r):void 0,render:({field:e,fieldState:o})=>n(g,{label:i(u),value:typeof e.value=="string"?e.value:"",onChange:d=>e.onChange(d.target.value||""),error:o.error?.message,helperText:o.error?.message,required:s})})}export{c as ControlledPhoneField};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{PhoneNumberComponent as p}from"../../form/fields";import{convertValidationRules as g}from"../types";function v(t){const{control:a,errors:c,fieldConfig:l,t:i,required:s}=t,{name:m,label:u,validation:r}=l;return n(f,{name:m,control:a,rules:r?g(r):void 0,render:({field:e,fieldState:o})=>n(p,{label:i(u),value:typeof e.value=="string"?e.value:"",onChange:d=>e.onChange(d.target.value||""),error:o.error?.message,helperText:o.error?.message,required:s})})}export{v as ControlledPhoneField};
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import{Controller as v}from"react-hook-form";import{PriceFieldComponent as h}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(n){const{control:a,errors:F,fieldConfig:r,t:c,placeholder:s,required:d}=n,{name:u,label:f,validation:o}=r,e=(r.options||{}).fieldSpecific;return t(v,{name:u,control:a,rules:o?g(o):void 0,render:({field:l,fieldState:i})=>{const p=l.value,m=C=>{l.onChange(C)};return t(h,{label:c(f),value:p??void 0,onChange:m,error:!!i.error,helperText:i.error?.message,required:d,placeholder:s,defaultCurrency:e?.defaultCurrency??"EUR",optionsTitle:e?.optionsTitle,currencies:e?.currencies})}})}export{x as ControlledPriceField};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import{Controller as v}from"react-hook-form";import{PriceFieldComponent as h}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(t){const{control:a,errors:F,fieldConfig:r,t:c,placeholder:s,required:d}=t,{name:u,label:f,validation:o}=r,e=(r.options||{}).fieldSpecific;return n(v,{name:u,control:a,rules:o?g(o):void 0,render:({field:i,fieldState:l})=>{const p=i.value,m=C=>{i.onChange(C)};return n(h,{label:c(f),value:p??void 0,onChange:m,error:!!l.error,helperText:l.error?.message,required:d,placeholder:s,defaultCurrency:e?.defaultCurrency??"EUR",optionsTitle:e?.optionsTitle,currencies:e?.currencies})}})}export{x as ControlledPriceField};
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{RangeFieldComponent as g}from"../../form/fields";import{convertValidationRules as C}from"../types";function h(i){const{control:m,errors:v,fieldConfig:n,t:s,required:d}=i,{name:u,label:f,validation:e}=n,a=n.options||{},p=a.fieldSpecific;return t(c,{name:u,control:m,rules:e?C(e):void 0,render:({field:r,fieldState:l})=>t(g,{label:s(f),value:r.value??void 0,onChange:o=>{typeof o=="number"?r.onChange(o):r.onChange(Number(o.target.value)||0)},error:!!l.error,helperText:l.error?.message,required:d,min:e?.min,max:e?.max,step:a.step,showValue:p?.showValue})})}export{h as ControlledRangeField};
1
+ "use client";import{jsx as i}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{RangeFieldComponent as g}from"../../form/fields";import{convertValidationRules as v}from"../types";function C(l){const{control:m,errors:h,fieldConfig:n,t:s,required:d}=l,{name:u,label:f,validation:e}=n,a=n.options||{},p=a.fieldSpecific;return i(c,{name:u,control:m,rules:e?v(e):void 0,render:({field:r,fieldState:t})=>i(g,{label:s(f),value:r.value??void 0,onChange:o=>{typeof o=="number"?r.onChange(o):r.onChange(Number(o.target.value)||0)},error:!!t.error,helperText:t.error?.message,required:d,min:e?.min,max:e?.max,step:a.step,showValue:p?.showValue})})}export{C as ControlledRangeField};
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{RatingFieldComponent as c}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(i){const{control:n,errors:C,fieldConfig:r,t:s,required:m}=i,{name:d,label:f,validation:e}=r,o=(r.options||{}).fieldSpecific;return t(p,{name:d,control:n,rules:e?g(e):void 0,render:({field:a,fieldState:l})=>t(c,{label:s(f),value:a.value??0,onChange:u=>{a.onChange(u)},error:!!l.error,helperText:l.error?.message,required:m,max:o?.max??e?.max??5,showValue:o?.showValue})})}export{x as ControlledRatingField};
1
+ "use client";import{jsx as i}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{RatingFieldComponent as c}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(l){const{control:t,errors:C,fieldConfig:r,t:s,required:m}=l,{name:d,label:f,validation:e}=r,o=(r.options||{}).fieldSpecific;return i(p,{name:d,control:t,rules:e?g(e):void 0,render:({field:n,fieldState:a})=>i(c,{label:s(f),value:n.value??0,onChange:u=>{n.onChange(u)},error:!!a.error,helperText:a.error?.message,required:m,max:o?.max??e?.max??5,showValue:o?.showValue})})}export{x as ControlledRatingField};
@@ -1 +1 @@
1
- "use client";import{jsx as i}from"react/jsx-runtime";import{Controller as S}from"react-hook-form";import{SwitchFieldComponent as x}from"../../form/fields";import"../types";function v(d){const{control:h,errors:V,fieldConfig:s,t:o,onChange:n}=d,{name:m,label:f,options:u={}}=s,e=u.fieldSpecific,k=e?.uncheckedValue??!1,r=e?.checkedValue??!0,t=e?.uncheckedLabel,l=e?.checkedLabel;return i(S,{name:m,control:h,render:({field:{value:p,onChange:g},fieldState:C})=>{const b=p===r,L=c=>{const a=c?r:k;g(a),n&&n(a)};return i(x,{label:o(f),checked:b,onChange:c=>L(c.target.checked),uncheckedLabel:t?o(t):void 0,checkedLabel:l?o(l):void 0,helperText:C.error?.message})}})}export{v as ControlledSwitchField};
1
+ "use client";import{jsx as i}from"react/jsx-runtime";import{Controller as S}from"react-hook-form";import{SwitchFieldComponent as v}from"../../form/fields";import"../types";function x(d){const{control:h,errors:V,fieldConfig:s,t:o,onChange:r}=d,{name:m,label:f,options:u={}}=s,e=u.fieldSpecific,k=e?.uncheckedValue??!1,c=e?.checkedValue??!0,t=e?.uncheckedLabel,l=e?.checkedLabel;return i(S,{name:m,control:h,render:({field:{value:p,onChange:b},fieldState:C})=>{const g=p===c,L=n=>{const a=n?c:k;b(a),r&&r(a)};return i(v,{label:o(f),checked:g,onChange:n=>L(n.target.checked),uncheckedLabel:t?o(t):void 0,checkedLabel:l?o(l):void 0,helperText:C.error?.message})}})}export{x as ControlledSwitchField};
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{TextFieldComponent as C}from"../../form/fields";import{convertValidationRules as x}from"../types";function g(n){const{control:i,errors:v,fieldConfig:r,t:s,placeholder:m,required:d}=n,{name:p,label:u,validation:o,options:l={}}=r,c=o?x(o):void 0,h=r.type==="email"?"email":r.type==="url"?"url":r.type==="color"?"color":"text";return t(f,{name:p,control:i,rules:c,render:({field:e,fieldState:a})=>t(C,{ref:e.ref,name:e.name,value:e.value??"",onChange:e.onChange,onBlur:e.onBlur,label:s(u),error:a.error?.message,helperText:a.error?.message,type:h,required:d,placeholder:m||l.placeholder,maxLength:o?.maxLength,showCharCount:l.showCharCount,className:l.className})})}export{g as ControlledTextField};
1
+ "use client";import{jsx as a}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{TextFieldComponent as C}from"../../form/fields";import{convertValidationRules as x}from"../types";function g(n){const{control:i,errors:v,fieldConfig:r,t:s,placeholder:m,required:d}=n,{name:p,label:u,validation:o,options:l={}}=r,c=o?x(o):void 0,h=r.type==="email"?"email":r.type==="url"?"url":r.type==="color"?"color":"text";return a(f,{name:p,control:i,rules:c,render:({field:e,fieldState:t})=>a(C,{ref:e.ref,name:e.name,value:e.value??"",onChange:e.onChange,onBlur:e.onBlur,label:s(u),error:t.error?.message,helperText:t.error?.message,type:h,required:d,placeholder:m||l.placeholder,maxLength:o?.maxLength,showCharCount:l.showCharCount,className:l.className})})}export{g as ControlledTextField};
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{TextAreaComponent as p}from"../../form/fields";import{convertValidationRules as C}from"../types";function f(n){const{control:s,errors:x,fieldConfig:a,t:i,placeholder:m,required:d}=n,{name:u,label:h,validation:o}=a,e=a.options||{};return t(c,{name:u,control:s,rules:o?C(o):void 0,render:({field:r,fieldState:l})=>t(p,{...r,label:i(h),value:r.value??"",onChange:r.onChange,error:l.error?.message,helperText:l.error?.message,required:d,placeholder:m||e.placeholder,maxLength:o?.maxLength,showCharCount:e.showCharCount,autoResize:e.autoResize,rows:e.rows,className:e.className})})}export{f as ControlledTextareaField};
1
+ "use client";import{jsx as l}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{TextAreaComponent as p}from"../../form/fields";import{convertValidationRules as C}from"../types";function f(n){const{control:s,errors:x,fieldConfig:a,t:i,placeholder:m,required:d}=n,{name:u,label:h,validation:o}=a,e=a.options||{};return l(c,{name:u,control:s,rules:o?C(o):void 0,render:({field:r,fieldState:t})=>l(p,{...r,label:i(h),value:r.value??"",onChange:r.onChange,error:t.error?.message,helperText:t.error?.message,required:d,placeholder:m||e.placeholder,maxLength:o?.maxLength,showCharCount:e.showCharCount,autoResize:e.autoResize,rows:e.rows,className:e.className})})}export{f as ControlledTextareaField};
@@ -1 +1 @@
1
- "use client";import{jsx as O}from"react/jsx-runtime";import{useMemo as y,useEffect as R,useRef as S}from"react";import{Controller as j,useWatch as D,useFormContext as E}from"react-hook-form";import{translateLabel as L}from"../../../forms/utils";import{ComboboxComponent as M}from"../../form/fields";import{convertValidationRules as T}from"../types";function w(V){const{control:p,errors:H,fieldConfig:a,t:s,placeholder:q,required:B}=V,{name:i,label:F,validation:t,options:m={}}=a,b=E(),h=b?.setValue,v=b?.resetField,o=D({control:p}),n="dependsOn"in a?a.dependsOn:void 0,l=n&&o?o[n.field]:void 0,d=y(()=>{const e=t?.options;return e?typeof e=="function"?e(o||{}):e:[]},[t?.options,o,l]),C=S(void 0);R(()=>{const e=C.current;if(C.current=l,e===void 0||e===l)return;const r=o?.[i];r&&!d.map(c=>c.value).includes(r)&&v&&v(i)},[l]);const P=y(()=>d.map(e=>({...e,label:L(e.label,s)})),[d,s]),u=m.fieldSpecific;return O(j,{name:i,control:p,rules:t?T(t):void 0,render:({field:e,fieldState:r})=>{const c=f=>{const g=typeof f=="string"?f:f.target.value;if(e.onChange(g),n&&h&&u?.setParentOnChange){const x=u.setParentOnChange(g,o||{});x!=null&&h(n.field,x,{shouldValidate:!0,shouldDirty:!0})}};return O(M,{...e,label:s(F),value:e.value??"",onChange:c,onBlur:e.onBlur,options:P,error:!!r.error,helperText:r.error?.message,required:B,placeholder:q||m.placeholder,creatable:u?.creatable??!1})}})}export{w as ControlledComboboxField};
1
+ "use client";import{jsx as O}from"react/jsx-runtime";import{useMemo as y,useEffect as S,useRef as V}from"react";import{Controller as j,useWatch as D,useFormContext as E}from"react-hook-form";import{translateLabel as L}from"../../../forms/utils";import{ComboboxComponent as M}from"../../form/fields";import{convertValidationRules as T}from"../types";function w(F){const{control:m,errors:H,fieldConfig:a,t:s,placeholder:q,required:B}=F,{name:i,label:P,validation:t,options:f={}}=a,b=E(),h=b?.setValue,v=b?.resetField,o=D({control:m}),n="dependsOn"in a?a.dependsOn:void 0,l=n&&o?o[n.field]:void 0,d=y(()=>{const e=t?.options;return e?typeof e=="function"?e(o||{}):e:[]},[t?.options,o,l]),C=V(void 0);S(()=>{const e=C.current;if(C.current=l,e===void 0||e===l)return;const r=o?.[i];r&&!d.map(c=>c.value).includes(r)&&v&&v(i)},[l]);const R=y(()=>d.map(e=>({...e,label:L(e.label,s)})),[d,s]),u=f.fieldSpecific;return O(j,{name:i,control:m,rules:t?T(t):void 0,render:({field:e,fieldState:r})=>{const c=p=>{const g=typeof p=="string"?p:p.target.value;if(e.onChange(g),n&&h&&u?.setParentOnChange){const x=u.setParentOnChange(g,o||{});x!=null&&h(n.field,x,{shouldValidate:!0,shouldDirty:!0})}};return O(M,{...e,label:s(P),value:e.value??"",onChange:c,onBlur:e.onBlur,options:R,error:!!r.error,helperText:r.error?.message,required:B,placeholder:q||f.placeholder,creatable:u?.creatable??!1})}})}export{w as ControlledComboboxField};
@@ -1 +1 @@
1
- "use client";import{jsx as v}from"react/jsx-runtime";import{useMemo as C}from"react";import{Controller as V,useWatch as q,useFormContext as w}from"react-hook-form";import{translateLabel as B}from"../../../forms/utils";import{DropdownComponent as F}from"../../form/fields";import{convertValidationRules as P}from"../types";function j(g){const{control:d,errors:L,fieldConfig:l,t:i,onChange:A,required:h}=g,{name:b,label:x,validation:r,options:y={}}=l,u=w()?.setValue,n="dependsOn"in l?l.dependsOn:void 0,o=n?n.field:void 0,O=typeof r?.options=="function",a=q({control:d,name:o,disabled:!o}),f=C(()=>{const e=r?.options;if(!e)return[];if(typeof e=="function"){const t=o?{[o]:a}:{};return e(t)}return e},[r?.options,O,o,a]),D=C(()=>f.map(e=>({...e,label:B(e.label,i)})),[f,i]),p=y.fieldSpecific;return v(V,{name:b,control:d,rules:r?P(r):void 0,render:({field:e,fieldState:t})=>{const S=s=>{const m=typeof s=="string"?s:s.target.value;if(e.onChange(m),n&&u&&p?.setParentOnChange){const c=p.setParentOnChange(m,o?{[o]:a}:{});c!=null&&u(n.field,c,{shouldValidate:!0,shouldDirty:!0})}};return v(F,{label:i(x),value:e.value!==void 0&&e.value!==null?String(e.value):"",onChange:S,onBlur:e.onBlur,options:D,error:!!t.error,helperText:t.error?.message,required:h})}})}export{j as ControlledDropdownField};
1
+ "use client";import{jsx as v}from"react/jsx-runtime";import{useMemo as C}from"react";import{Controller as V,useWatch as q,useFormContext as w}from"react-hook-form";import{translateLabel as B}from"../../../forms/utils";import{DropdownComponent as F}from"../../form/fields";import{convertValidationRules as P}from"../types";function j(g){const{control:d,errors:L,fieldConfig:l,t:a,onChange:A,required:h}=g,{name:b,label:x,validation:n,options:y={}}=l,u=w()?.setValue,r="dependsOn"in l?l.dependsOn:void 0,o=r?r.field:void 0,O=typeof n?.options=="function",i=q({control:d,name:o,disabled:!o}),f=C(()=>{const e=n?.options;if(!e)return[];if(typeof e=="function"){const t=o?{[o]:i}:{};return e(t)}return e},[n?.options,O,o,i]),D=C(()=>f.map(e=>({...e,label:B(e.label,a)})),[f,a]),p=y.fieldSpecific;return v(V,{name:b,control:d,rules:n?P(n):void 0,render:({field:e,fieldState:t})=>{const S=s=>{const m=typeof s=="string"?s:s.target.value;if(e.onChange(m),r&&u&&p?.setParentOnChange){const c=p.setParentOnChange(m,o?{[o]:i}:{});c!=null&&u(r.field,c,{shouldValidate:!0,shouldDirty:!0})}};return v(F,{label:a(x),value:e.value!==void 0&&e.value!==null?String(e.value):"",onChange:S,onBlur:e.onBlur,options:D,error:!!t.error,helperText:t.error?.message,required:h})}})}export{j as ControlledDropdownField};
@@ -1 +1 @@
1
- "use client";import{jsx as m}from"react/jsx-runtime";import{useMemo as f}from"react";import{Controller as A,useWatch as x}from"react-hook-form";import{translateLabel as M}from"../../../forms/utils";import{MultiDropdownComponent as O}from"../../form/fields";import{convertValidationRules as w}from"../types";function D(c){const{control:s,errors:S,fieldConfig:a,t:l,required:v}=c,{name:y,label:b,validation:e}=a,u="dependsOn"in a?a.dependsOn:void 0,o=u?u.field:void 0,g=typeof e?.options=="function",d=x({control:s,name:o,disabled:!o}),p=f(()=>{const r=e?.options;if(!r)return[];if(typeof r=="function"){const n=o?{[o]:d}:{};return r(n)}return r},[e?.options,g,o,d]),C=f(()=>p.map(r=>({value:String(r.value),label:M(r.label,l)})),[p,l]);return m(A,{name:y,control:s,rules:e?w(e):void 0,render:({field:r,fieldState:n})=>{const h=i=>{let t;if(Array.isArray(i))t=i;else try{t=JSON.parse(i.target.value)}catch{t=[]}r.onChange(t)};return m(O,{...r,label:l(b),value:Array.isArray(r.value)?r.value:[],onChange:h,onBlur:r.onBlur,options:C,error:!!n.error,helperText:n.error?.message,required:v})}})}export{D as ControlledMultiDropdownField};
1
+ "use client";import{jsx as f}from"react/jsx-runtime";import{useMemo as m}from"react";import{Controller as A,useWatch as x}from"react-hook-form";import{translateLabel as M}from"../../../forms/utils";import{MultiDropdownComponent as O}from"../../form/fields";import{convertValidationRules as S}from"../types";function w(c){const{control:s,errors:D,fieldConfig:a,t:l,required:v}=c,{name:y,label:b,validation:o}=a,u="dependsOn"in a?a.dependsOn:void 0,r=u?u.field:void 0,g=typeof o?.options=="function",d=x({control:s,name:r,disabled:!r}),p=m(()=>{const e=o?.options;if(!e)return[];if(typeof e=="function"){const t=r?{[r]:d}:{};return e(t)}return e},[o?.options,g,r,d]),C=m(()=>p.map(e=>({value:String(e.value),label:M(e.label,l)})),[p,l]);return f(A,{name:y,control:s,rules:o?S(o):void 0,render:({field:e,fieldState:t})=>{const h=i=>{let n;if(Array.isArray(i))n=i;else try{n=JSON.parse(i.target.value)}catch{n=[]}e.onChange(n)};return f(O,{...e,label:l(b),value:Array.isArray(e.value)?e.value:[],onChange:h,onBlur:e.onBlur,options:C,error:!!t.error,helperText:t.error?.message,required:v})}})}export{w as ControlledMultiDropdownField};
@@ -1 +1 @@
1
- "use client";import{jsx as p}from"react/jsx-runtime";import{useMemo as u}from"react";import{Controller as x,useWatch as y}from"react-hook-form";import{translateLabel as R}from"../../../forms/utils";import{RadioFieldComponent as F}from"../../form/fields";import{convertValidationRules as O}from"../types";function q(m){const{control:l,errors:S,fieldConfig:t,t:i,required:c}=m,{name:v,label:g,validation:o}=t,s="dependsOn"in t?t.dependsOn:void 0,r=s?s.field:void 0,b=typeof o?.options=="function",d=y({control:l,name:r,disabled:!r}),f=u(()=>{const e=o?.options;if(!e)return[];if(typeof e=="function"){const n=r?{[r]:d}:{};return e(n)}return e},[o?.options,b,r,d]),C=u(()=>f.map(e=>({value:String(e.value),label:R(e.label,i)})),[f,i]);return p(x,{name:v,control:l,rules:o?O(o):void 0,render:({field:e,fieldState:n})=>p(F,{...e,label:i(g),value:e.value??void 0,onChange:a=>{const h=typeof a=="string"?a:a.target.value;e.onChange(h)},options:C,error:!!n.error,helperText:n.error?.message,required:c})})}export{q as ControlledRadioField};
1
+ "use client";import{jsx as p}from"react/jsx-runtime";import{useMemo as u}from"react";import{Controller as x,useWatch as y}from"react-hook-form";import{translateLabel as R}from"../../../forms/utils";import{RadioFieldComponent as q}from"../../form/fields";import{convertValidationRules as F}from"../types";function O(m){const{control:a,errors:S,fieldConfig:n,t:i,required:c}=m,{name:v,label:g,validation:o}=n,s="dependsOn"in n?n.dependsOn:void 0,r=s?s.field:void 0,b=typeof o?.options=="function",d=y({control:a,name:r,disabled:!r}),f=u(()=>{const e=o?.options;if(!e)return[];if(typeof e=="function"){const t=r?{[r]:d}:{};return e(t)}return e},[o?.options,b,r,d]),C=u(()=>f.map(e=>({value:String(e.value),label:R(e.label,i)})),[f,i]);return p(x,{name:v,control:a,rules:o?F(o):void 0,render:({field:e,fieldState:t})=>p(q,{...e,label:i(g),value:e.value??void 0,onChange:l=>{const h=typeof l=="string"?l:l.target.value;e.onChange(h)},options:C,error:!!t.error,helperText:t.error?.message,required:c})})}export{O as ControlledRadioField};
@@ -1 +1 @@
1
- "use client";import{jsx as u}from"react/jsx-runtime";import{useMemo as S}from"react";import{Controller as x}from"react-hook-form";import{useCrudList as L}from"../../../useCrudList";import R from"../../form/fields/ReferenceFieldComponent";import{convertValidationRules as _}from"../types";const j=["name","title","label","displayName"];function p(e,n,o){if(n?.length){const r=n.map(l=>e[l]).filter(l=>l!=null&&l!=="");if(r.length)return r.join(" ")}if(o&&e[o]!=null&&e[o]!=="")return String(e[o]);for(const r of j)if(e[r]!=null&&e[r]!=="")return String(e[r]);return e.id??"?"}function y(e){const{control:n,errors:o,fieldConfig:r,t:l,placeholder:c,required:b}=e,{name:g,label:h,validation:t,options:d={}}=r,s=t?.reference,a=d.fieldSpecific,{items:f,loading:C}=L(s??"__disabled__",{enabled:!!s}),v=S(()=>f.map(i=>({id:i.id,label:p(i,a?.labelFields,a?.displayField)})),[f,a?.labelFields,a?.displayField]);return u(x,{name:g,control:n,rules:t?_(t):void 0,render:({field:i,fieldState:m})=>u(R,{label:l(h),value:i.value??"",onChange:F=>i.onChange(F),onBlur:i.onBlur,options:v,isLoading:C,error:!!m.error,helperText:m.error?.message,required:b,placeholder:c||d.placeholder})})}export{y as ControlledReferenceField,p as buildReferenceLabel};
1
+ "use client";import{jsx as m}from"react/jsx-runtime";import{useMemo as S}from"react";import{Controller as _}from"react-hook-form";import{useCrudList as x}from"../../../useCrudList";import y from"../../form/fields/ReferenceFieldComponent";import{convertValidationRules as L}from"../types";const R=["name","title","label","displayName"];function p(e,n,i){if(n?.length){const r=n.map(l=>e[l]).filter(l=>l!=null&&l!=="");if(r.length)return r.join(" ")}if(i&&e[i]!=null&&e[i]!=="")return String(e[i]);for(const r of R)if(e[r]!=null&&e[r]!=="")return String(e[r]);return e.id??"?"}function j(e){const{control:n,errors:i,fieldConfig:r,t:l,placeholder:c,required:b}=e,{name:g,label:h,validation:a,options:d={}}=r,s=a?.reference,t=d.fieldSpecific,{items:f,loading:C}=x(s??"__disabled__",{enabled:!!s}),v=S(()=>f.map(o=>({id:o.id,label:p(o,t?.labelFields,t?.displayField)})),[f,t?.labelFields,t?.displayField]);return m(_,{name:g,control:n,rules:a?L(a):void 0,render:({field:o,fieldState:u})=>m(y,{label:l(h),value:o.value??"",onChange:F=>o.onChange(F),onBlur:o.onBlur,options:v,isLoading:C,error:!!u.error,helperText:u.error?.message,required:b,placeholder:c||d.placeholder})})}export{j as ControlledReferenceField,p as buildReferenceLabel};
@@ -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 i(e){if(e){if(e instanceof RegExp)return e;try{const t=/^\/(.*)\/([gimyus]*)$/.exec(e);if(t){const[,r,n]=t;if(r)return new RegExp(r,n)}return new RegExp(e)}catch{return}}}function a(e){if(!e)return{};const t={};return e.required!==void 0&&(t.required=e.required),e.min!==void 0&&(t.min=e.min),e.max!==void 0&&(t.max=e.max),e.minLength!==void 0&&(t.minLength=e.minLength),e.maxLength!==void 0&&(t.maxLength=e.maxLength),e.pattern&&typeof e.pattern=="string"&&(t.pattern={value:i(e.pattern)||/.*/,message:"Invalid format"}),t}export{i as convertPatternToRegex,a 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 n,Text as p}from"@donotdev/components";const l=({config:a,value:s,t:d,className:t,size:r="md"})=>{if(!s)return e(p,{as:"span",variant:"muted",className:t,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 e(n,{src:s,alt:a.label||"Avatar",fallback:c(a.label||"AV"),className:`${i[r]} ${t||""}`})};var u=l;export{l as AvatarFieldDisplay,u 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 o}from"react/jsx-runtime";import{Badge as l,Text as r}from"@donotdev/components";const n=({config:m,value:a,t:s,className:e})=>{if(a==null)return o(r,{as:"span",variant:"muted",className:e,children:"-"});const t=typeof a=="boolean"?s(a?"common.yes":"common.no"):String(a);return o(l,{variant:typeof a=="boolean"?a?"default":"secondary":"outline",className:e,children:t})};var i=n;export{n as BadgeFieldDisplay,i as default};
@@ -1 +1 @@
1
- const t=()=>null;var a=t;export{t as ButtonFieldDisplay,a as default};
1
+ const a=()=>null;var t=a;export{a as ButtonFieldDisplay,t 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 s}from"react/jsx-runtime";import{Badge as c,Text as l}from"@donotdev/components";const n=({config:t,value:a,t:o,className:e})=>{if(a==null)return s(l,{as:"span",variant:"muted",className:e,children:"-"});const r=o(a?"common.yes":"common.no");return s(c,{variant:a?"default":"secondary",className:e,children:r})};var m=n;export{n as CheckboxFieldDisplay,m as default};
@@ -1 +1 @@
1
- import{jsx as a,jsxs as o}from"react/jsx-runtime";import{Text as s,Spinner as p}from"@donotdev/components";import{getI18nInstance as u}from"@donotdev/core";const l=({config:c,value:n,t:g,className:e,loading:m=!1})=>{if(m)return a(p,{className:e});if(!n)return a(s,{as:"span",variant:"muted",className:e,children:"-"});try{const r=new Date(n),t=u()?.language,i=r.toLocaleDateString(t),d=r.toLocaleTimeString(t);return c.type==="date"?a(s,{as:"span",className:e,children:i}):o("div",{className:e,children:[a(s,{as:"span",children:i}),a(s,{as:"span",variant:"muted",level:"small",children:d})]})}catch{return a(s,{as:"span",variant:"muted",className:e,children:"-"})}};var f=l;export{l as DateFieldDisplay,f as default};
1
+ import{jsx as a,jsxs as d}from"react/jsx-runtime";import{Text as e,Spinner as p}from"@donotdev/components";import{getI18nInstance as u}from"@donotdev/core";const i=({config:c,value:t,t:g,className:s,loading:m=!1})=>{if(m)return a(p,{className:s});if(!t)return a(e,{as:"span",variant:"muted",className:s,children:"-"});try{const n=new Date(t),r=u()?.language,l=n.toLocaleDateString(r),o=n.toLocaleTimeString(r);return c.type==="date"?a(e,{as:"span",className:s,children:l}):d("div",{className:s,children:[a(e,{as:"span",children:l}),a(e,{as:"span",variant:"muted",level:"small",children:o})]})}catch{return a(e,{as:"span",variant:"muted",className:s,children:"-"})}};var f=i;export{i as DateFieldDisplay,f 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 e}from"react/jsx-runtime";import{Badge as t,BADGE_VARIANT as o,Text as i}from"@donotdev/components";const r=({config:n,value:a,t:c,className:s})=>a?e(t,{variant:o.OUTLINE,className:s,children:a}):e(i,{as:"span",variant:"muted",className:s,children:"-"});var l=r;export{r as DropdownDisplay,l as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Badge as n,BADGE_VARIANT as t,Text as i,Stack as c}from"@donotdev/components";const r=({config:o,value:a,t:m,className:s})=>a?l(c,{direction:"row",align:"center",className:s,children:[e(i,{as:"span",level:"small",children:a.name}),a.size&&l(n,{variant:t.SECONDARY,children:[(a.size/1024).toFixed(1)," KB"]})]}):e(i,{as:"span",variant:"muted",className:s,children:"-"});var d=r;export{r as FileFieldDisplay,d as default};
1
+ import{jsx as s,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:e})=>a?i(c,{direction:"row",align:"center",className:e,children:[s(l,{as:"span",level:"small",children:a.name}),a.size&&i(n,{variant:t.SECONDARY,children:[(a.size/1024).toFixed(1)," KB"]})]}):s(l,{as:"span",variant:"muted",className:e,children:"-"});var d=r;export{r as FileFieldDisplay,d 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 o,jsxs as t}from"react/jsx-runtime";import{Text as l}from"@donotdev/components";const e=({config:d,value:a,t:m,className:s})=>!a||a.lat===void 0&&a.lng===void 0?o(l,{as:"span",variant:"muted",className:s,children:"-"}):t(l,{as:"div",level:"small",className:`font-mono ${s||""}`,children:[a.lat?.toFixed(6),", ",a.lng?.toFixed(6)]});var i=e;export{e as GeoPointFieldDisplay,i as default};
@@ -1 +1 @@
1
- const l=()=>null;var a=l;export{l as HiddenFieldDisplay,a as default};
1
+ const a=()=>null;var l=a;export{a 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 t}from"react/jsx-runtime";import{Avatar as n,Text as p}from"@donotdev/components";const l=({config:a,value:s,t:d,className:e,size:r="md"})=>{if(!s)return t(p,{as:"span",variant:"muted",className:e,children:"-"});const i={sm:"size-touch",md:"size-touch",lg:"h-16 w-16"},c=m=>m.split(" ").map(o=>o.charAt(0)).slice(0,2).join("").toUpperCase();return t(n,{src:s,alt:a.label||"Image",fallback:c(a.label||"IMG"),className:`${i[r]} ${e||""}`})};var u=l;export{l as ImageFieldDisplay,u as default};
@@ -1 +1 @@
1
- import{jsx as 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 t}from"react/jsx-runtime";import{Text as i}from"@donotdev/components";const o=({config:l,value:e,t:r,className:n})=>{if(!e)return t(i,{as:"span",variant:"muted",className:n,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 t("a",{...s,className:n||"",style:{color:"var(--primary)",textDecoration:"none"},onMouseEnter:a=>a.currentTarget.style.textDecoration="underline",onMouseLeave:a=>a.currentTarget.style.textDecoration="none",children:e})};var c=o;export{o as LinkFieldDisplay,c as default};
@@ -1 +1 @@
1
- import{jsx as 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 o,jsxs as i}from"react/jsx-runtime";import{Text as l}from"@donotdev/components";const e=({config:d,value:a,t:m,className:s})=>!a||a.lat===void 0&&a.lng===void 0?o(l,{as:"span",variant:"muted",className:s,children:"-"}):i(l,{as:"div",level:"small",className:`font-mono ${s||""}`,children:[a.lat?.toFixed(6),", ",a.lng?.toFixed(6)]});var t=e;export{e as MapFieldDisplay,t as default};
@@ -1 +1 @@
1
- import{jsx as s}from"react/jsx-runtime";import{Badge as n,BADGE_VARIANT as o,Text as c,Stack as l}from"@donotdev/components";const t=({config:p,value:a,t:d,className:r})=>!a||!Array.isArray(a)||a.length===0?s(c,{as:"span",variant:"muted",className:r,children:"-"}):s(l,{direction:"row",wrap:"wrap",className:r,children:a.map((e,i)=>s(n,{variant:o.OUTLINE,children:String(e)},i))});var m=t;export{t as MultiDropdownDisplay,m as default};
1
+ import{jsx as r}from"react/jsx-runtime";import{Badge as n,BADGE_VARIANT as l,Text as o,Stack as c}from"@donotdev/components";const t=({config:p,value:a,t:d,className:s})=>!a||!Array.isArray(a)||a.length===0?r(o,{as:"span",variant:"muted",className:s,children:"-"}):r(c,{direction:"row",wrap:"wrap",className:s,children:a.map((e,i)=>r(n,{variant:l.OUTLINE,children:String(e)},i))});var m=t;export{t as MultiDropdownDisplay,m as default};
@@ -1 +1 @@
1
- import{jsx as s}from"react/jsx-runtime";import{Badge as l,BADGE_VARIANT as n,Text as c,Stack as m}from"@donotdev/components";const e=({config:p,value:a,t:d,className:t})=>!a||!Array.isArray(a)||a.length===0?s(c,{as:"span",variant:"muted",className:t,children:"-"}):s(m,{direction:"row",wrap:"wrap",className:t,children:a.map((r,i)=>s(l,{variant:n.OUTLINE,children:String(r)},i))});var o=e;export{e as MultiInputTextFieldDisplay,o as default};
1
+ import{jsx as r}from"react/jsx-runtime";import{Badge as l,BADGE_VARIANT as n,Text as c,Stack as m}from"@donotdev/components";const e=({config:p,value:a,t:d,className:s})=>!a||!Array.isArray(a)||a.length===0?r(c,{as:"span",variant:"muted",className:s,children:"-"}):r(m,{direction:"row",wrap:"wrap",className:s,children:a.map((t,i)=>r(l,{variant:n.OUTLINE,children:String(t)},i))});var o=e;export{e as MultiInputTextFieldDisplay,o as default};
@@ -1 +1 @@
1
- import{jsx as s}from"react/jsx-runtime";import{Text as n,Spinner as o}from"@donotdev/components";import{getI18nInstance as m}from"@donotdev/core";const t=({config:r,value:e,t:c,className:a,loading:l=!1})=>l?s(o,{className:a}):e==null?s(n,{as:"span",variant:"muted",className:a,children:"-"}):s(n,{as:"span",className:`font-mono ${a||""}`,children:e.toLocaleString(m()?.language)});var i=t;export{t as NumberFieldDisplay,i as default};
1
+ import{jsx as s}from"react/jsx-runtime";import{Text as e,Spinner as l}from"@donotdev/components";import{getI18nInstance as r}from"@donotdev/core";const o=({config:i,value:n,t:c,className:a,loading:t=!1})=>t?s(l,{className:a}):n==null?s(e,{as:"span",variant:"muted",className:a,children:"-"}):s(e,{as:"span",className:`font-mono ${a||""}`,children:n.toLocaleString(r()?.language)});var m=o;export{o as NumberFieldDisplay,m 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 u}from"react";import{Skeleton as m,Button as y,CopyToClipboard as f,Stack as i}from"@donotdev/components";const l=({config:w,value:e,t:s,className:t,loading:p=!1})=>{const[a,d]=u(!1);return p?o(m,{className:t}):e?r(i,{direction:"row",align:"center",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:()=>d(!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 t}from"react/jsx-runtime";import{Eye as c,EyeOff as n}from"lucide-react";import{useState as u}from"react";import{Skeleton as m,Button as y,CopyToClipboard as f,Stack as i}from"@donotdev/components";const l=({config:g,value:e,t:r,className:s,loading:d=!1})=>{const[a,p]=u(!1);return d?o(m,{className:s}):e?t(i,{direction:"row",align:"center",className:s,children:[o("span",{style:{fontFamily:"monospace"},children:a?e:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}),t(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:r("copyToClipboard")||"Copy to clipboard",copiedTooltipText:r("copied")||"Copied!",ariaLabel:r("copyPassword")||"Copy password"})]})]}):o("div",{style:{color:"var(--muted-foreground)"},children:"-"})};var w=l;export{l as PasswordFieldDisplay,w as default};
@@ -1 +1 @@
1
- import{jsx as 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 e}from"react/jsx-runtime";import{Badge as r,BADGE_VARIANT as t,Text as l}from"@donotdev/components";const i=({config:c,value:a,t:d,className:s})=>a?e(r,{variant:t.OUTLINE,className:s,children:a}):e(l,{as:"span",variant:"muted",className:s,children:"-"});var o=i;export{i as RadioFieldDisplay,o as default};
@@ -1 +1 @@
1
- import{jsx as 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 e}from"react/jsx-runtime";import{Text as l}from"@donotdev/components";const n=({config:t,value:a,t:m,className:s})=>a==null?e(l,{as:"span",variant:"muted",className:s,children:"-"}):e(l,{as:"span",className:`font-mono ${s||""}`,children:a});var o=n;export{n as RangeFieldDisplay,o as default};
@@ -1 +1 @@
1
- import{jsx as 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 s}from"react/jsx-runtime";import{Badge as i,BADGE_VARIANT as n,Text as l}from"@donotdev/components";const r=({config:c,value:a,t:d,className:e})=>{if(!a)return s(l,{as:"span",variant:"muted",className:e,children:"-"});const t=a.displayName||a.name||a.id||a;return s(i,{variant:n.OUTLINE,className:e,children:String(t)})};var m=r;export{r as ReferenceFieldDisplay,m 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 s}from"react/jsx-runtime";import{Text as l}from"@donotdev/components";const r=({config:i,value:a,t:m,className:e})=>a?s(l,{as:"div",level:"small",className:`whitespace-pre-wrap ${e||""}`,children:a}):s(l,{as:"span",variant:"muted",className:e,children:"-"});var t=r;export{r as TextAreaDisplay,t as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Mail as k,Calendar as L,Clock as I}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 M,getI18nInstance as C}from"@donotdev/core";const b=({config:i,value:a,t:r,className:s,loading:w=!1,showCopy:u=!1,asBadge:v=!1,truncate:c=!1,maxLength:d=50,showLabel:p=!1})=>{const[j,m]=A(!1),F=async()=>{try{await navigator.clipboard.writeText(a),m(!0),setTimeout(()=>m(!1),2e3)}catch{}},h=()=>{switch(i.type){case"email":return e(k,{});case"month":case"week":return e(L,{});case"time":return e(I,{});default:return null}},S=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:g=>g.currentTarget.style.textDecoration="underline",onMouseLeave:g=>g.currentTarget.style.textDecoration="none",children:[h(),t]});case"month":return new Date(t).toLocaleDateString(C()?.language,{year:"numeric",month:"long"});case"week":return M(t);case"time":return new Date(`2000-01-01T${t}`).toLocaleTimeString(C()?.language);default:return t}},D=t=>!c||t.length<=d?t:`${t.substring(0,d)}...`;if(w)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 N=S(a),y=D(String(N));return v?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 V=b;export{b as TextFieldDisplay,V as default};
1
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Mail as L,Calendar as k,Clock as I}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 i}from"@donotdev/components";import{getWeekFromISOString as M,getI18nInstance as b}from"@donotdev/core";const C=({config:o,value:a,t:r,className:s,loading:v=!1,showCopy:g=!1,asBadge:w=!1,truncate:c=!1,maxLength:d=50,showLabel:p=!1})=>{const[j,u]=A(!1),F=async()=>{try{await navigator.clipboard.writeText(a),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},h=()=>{switch(o.type){case"email":return e(L,{});case"month":case"week":return e(k,{});case"time":return e(I,{});default:return null}},S=t=>{if(!t)return null;switch(o.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(b()?.language,{year:"numeric",month:"long"});case"week":return M(t);case"time":return new Date(`2000-01-01T${t}`).toLocaleTimeString(b()?.language);default:return t}},D=t=>!c||t.length<=d?t:`${t.substring(0,d)}...`;if(v)return n(i,{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(i,{gap:"tight",children:[p&&e(l,{as:"span",variant:"muted",children:o.label||o.name}),e(l,{as:"span",variant:"muted",className:f(s),style:{fontStyle:"italic"},children:r("common.noValue",{defaultValue:"No value"})})]});const N=S(a),y=D(String(N));return w?n(i,{direction:"row",align:"center",gap:"tight",children:[h(),e(B,{variant:E.SECONDARY,className:s,children:y}),g&&e(x,{text:a,tooltipText:r("copyToClipboard")||"Copy to clipboard",copiedTooltipText:r("copied")||"Copied!",ariaLabel:r("copyToClipboard")||"Copy to clipboard"})]}):n(i,{gap:"tight",children:[p&&e(l,{as:"span",variant:"muted",children:o.label||o.name}),n(i,{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})}),g&&e(x,{text:a,tooltipText:r("copyToClipboard")||"Copy to clipboard",copiedTooltipText:r("copied")||"Copied!",ariaLabel:r("copyToClipboard")||"Copy to clipboard"})]})]})};var V=C;export{C as TextFieldDisplay,V as default};
@@ -1 +1 @@
1
- import{jsx as a,jsxs as m}from"react/jsx-runtime";import{Text as e}from"@donotdev/components";import{getI18nInstance as o}from"@donotdev/core";const i=({config:p,value:t,t:u,className:s})=>{if(!t)return a(e,{as:"span",variant:"muted",className:s,children:"-"});try{const r=new Date(t),n=o()?.language,l=r.toLocaleDateString(n),c=r.toLocaleTimeString(n);return m("div",{className:s,children:[a(e,{as:"span",children:l}),a(e,{as:"span",variant:"muted",level:"small",children:c})]})}catch{return a(e,{as:"span",variant:"muted",className:s,children:"-"})}};var d=i;export{i as TimestampFieldDisplay,d as default};
1
+ import{jsx as a,jsxs as m}from"react/jsx-runtime";import{Text as e}from"@donotdev/components";import{getI18nInstance as o}from"@donotdev/core";const i=({config:p,value:t,t:u,className:s})=>{if(!t)return a(e,{as:"span",variant:"muted",className:s,children:"-"});try{const n=new Date(t),r=o()?.language,l=n.toLocaleDateString(r),c=n.toLocaleTimeString(r);return m("div",{className:s,children:[a(e,{as:"span",children:l}),a(e,{as:"span",variant:"muted",level:"small",children:c})]})}catch{return a(e,{as:"span",variant:"muted",className:s,children:"-"})}};var d=i;export{i as TimestampFieldDisplay,d 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 a}from"./TextFieldDisplay";import{default as i}from"./BadgeFieldDisplay";import{default as s}from"./AvatarFieldDisplay";import{default as l}from"./LinkFieldDisplay";import{default as e}from"./DateFieldDisplay";import{default as t}from"./NumberFieldDisplay";import{default as o}from"./PhoneNumberDisplay";import{default as r}from"./TextAreaDisplay";import{default as p}from"./RichTextDisplay";import{default as m}from"./CheckboxFieldDisplay";import{default as d}from"./DropdownDisplay";import{default as f}from"./MultiDropdownDisplay";import{default as u}from"./MultiInputTextFieldDisplay";import{default as D}from"./RadioFieldDisplay";import{default as y}from"./RangeFieldDisplay";import{default as F}from"./FileFieldDisplay";import{default as n}from"./ImageFieldDisplay";import{default as x}from"./GeoPointFieldDisplay";import{default as T}from"./MapFieldDisplay";import{default as R}from"./ReferenceFieldDisplay";import{default as b}from"./TimestampFieldDisplay";import{default as g}from"./HiddenFieldDisplay";import{default as M}from"./ButtonFieldDisplay";export{s as AvatarFieldDisplay,i as BadgeFieldDisplay,M as ButtonFieldDisplay,m as CheckboxFieldDisplay,e as DateFieldDisplay,d as DropdownDisplay,F as FileFieldDisplay,x as GeoPointFieldDisplay,g as HiddenFieldDisplay,n as ImageFieldDisplay,l as LinkFieldDisplay,T as MapFieldDisplay,f as MultiDropdownDisplay,u as MultiInputTextFieldDisplay,t as NumberFieldDisplay,o as PhoneNumberDisplay,D as RadioFieldDisplay,y as RangeFieldDisplay,R as ReferenceFieldDisplay,p as RichTextDisplay,r as TextAreaDisplay,a as TextFieldDisplay,b as TimestampFieldDisplay};
@@ -1 +1 @@
1
- import{jsx as a,jsxs as m}from"react/jsx-runtime";import{MapPin as R}from"lucide-react";import{useState as y,useEffect as w,useRef as S,useMemo as N}from"react";import{Combobox as L,Stack as M}from"@donotdev/components";import{useTranslation as U,getPlatformEnvVar as W}from"@donotdev/core";const Y=({label:b,value:l,onChange:x,enableGoogleMaps:T=!1,extractDistrictCode:q,error:i,helperText:c,required:z})=>{const{t:o}=U("crud"),[n,u]=y(l?.formatted_address||""),[g,f]=y([]),[E,p]=y(!1),v=S(null),h=S(null),d=S(null),_=W("GOOGLE_MAPS_API_KEY")||"",s=T&&!!_,G=N(()=>g.map(e=>({value:e.place_id,label:e.description,description:e.structured_formatting?.secondary_text,content:m("div",{style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)"},children:[a(R,{style:{width:"var(--size-icon-sm)",height:"var(--size-icon-sm)"}}),m("div",{children:[a("div",{children:e.description}),e.structured_formatting?.secondary_text&&a("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:e.structured_formatting.secondary_text})]})]})})),[g]),K=e=>{h.current&&(p(!0),h.current.getDetails({placeId:e,fields:["formatted_address","geometry","address_components"]},(r,t)=>{if(p(!1),t===window.google?.maps?.places?.PlacesServiceStatus.OK&&r){const P=r.formatted_address||"",V=r.geometry?.location?.lat(),j=r.geometry?.location?.lng(),A={formatted_address:P,latitude:V,longitude:j};if(q&&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}u(P),x(A)}}))};w(()=>{l?.formatted_address&&u(l.formatted_address)},[l]),w(()=>{if(!s)return;let e=null;const r=()=>{window.google?.maps?.places&&(v.current=new window.google.maps.places.AutocompleteService,h.current=new window.google.maps.places.PlacesService(document.createElement("div")))};return(()=>{if(window.google?.maps?.places){r();return}if(document.querySelector("#google-maps-script")){e=setInterval(()=>{window.google?.maps?.places&&(clearInterval(e),e=null,r())},100);return}const t=document.createElement("script");t.id="google-maps-script",t.src=`https://maps.googleapis.com/maps/api/js?key=${_}&libraries=places`,t.async=!0,t.defer=!0,t.onload=()=>r(),document.head.appendChild(t)})(),()=>{e!==null&&(clearInterval(e),e=null)}},[s,_]),w(()=>{if(!s||!n||!v.current){f([]);return}return d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{p(!0),v.current.getPlacePredictions({input:n,types:["geocode","establishment"]},(e,r)=>{p(!1),r===window.google?.maps?.places?.PlacesServiceStatus.OK&&e?f(e):f([])})},300),()=>{d.current&&clearTimeout(d.current)}},[s,n]);const O=e=>{u(e),x({formatted_address:e})},I=e=>{const r=Array.isArray(e)?e[0]||"":e;if(!s){O(r);return}g.some(t=>t.place_id===r)&&K(r)};return s?m(M,{gap:"tight",children:[a(L,{label:b,value:n,onValueChange:I,onSearchChange:e=>{s&&u(e)},placeholder:o("address.placeholder","Enter address..."),emptyMessage:E?o("messages.loading","Loading..."):o("address.noResults","No addresses found"),options:G,required:z,variant:i?"destructive":void 0,isLoading:E,creatable:!0,createLabel:o("actions.use","Use this address")}),c&&a("p",{style:{fontSize:"var(--font-size-xs)",color:i?"var(--destructive-foreground)":"var(--muted-foreground)"},children:c})]}):m(M,{gap:"tight",children:[a(L,{label:b,value:n,onValueChange:I,placeholder:o("address.placeholder","Enter address..."),options:[],required:z,variant:i?"destructive":void 0,creatable:!0,createLabel:o("actions.use","Use this address")}),c&&a("p",{style:{fontSize:"var(--font-size-xs)",color:i?"var(--destructive-foreground)":"var(--muted-foreground)"},children:c})]})};var F=Y;export{F as default};
1
+ import{jsx as a,jsxs as m}from"react/jsx-runtime";import{MapPin as U}from"lucide-react";import{useState as y,useEffect as w,useRef as S,useMemo as D}from"react";import{Combobox as L,Stack as M}from"@donotdev/components";import{useTranslation as N,getPlatformEnvVar as W}from"@donotdev/core";const Y=({label:b,value:l,onChange:x,enableGoogleMaps:O=!1,extractDistrictCode:T,error:i,helperText:c,required:P})=>{const{t:o}=N("crud"),[n,u]=y(l?.formatted_address||""),[g,f]=y([]),[E,p]=y(!1),v=S(null),h=S(null),d=S(null),_=W("GOOGLE_MAPS_API_KEY")||"",s=O&&!!_,j=D(()=>g.map(e=>({value:e.place_id,label:e.description,description:e.structured_formatting?.secondary_text,content:m("div",{style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)"},children:[a(U,{style:{width:"var(--size-icon-sm)",height:"var(--size-icon-sm)"}}),m("div",{children:[a("div",{children:e.description}),e.structured_formatting?.secondary_text&&a("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:e.structured_formatting.secondary_text})]})]})})),[g]),q=e=>{h.current&&(p(!0),h.current.getDetails({placeId:e,fields:["formatted_address","geometry","address_components"]},(t,r)=>{if(p(!1),r===window.google?.maps?.places?.PlacesServiceStatus.OK&&t){const I=t.formatted_address||"",K=t.geometry?.location?.lat(),V=t.geometry?.location?.lng(),z={formatted_address:I,latitude:K,longitude:V};if(T&&t.address_components){const A=t.address_components.find(R=>R.types.includes("postal_code"))?.long_name||"",k=A.startsWith("92")?92:parseInt(A.slice(-2),10)||null;z.district_code=k}u(I),x(z)}}))};w(()=>{l?.formatted_address&&u(l.formatted_address)},[l]),w(()=>{if(!s)return;let e=null;const t=()=>{window.google?.maps?.places&&(v.current=new window.google.maps.places.AutocompleteService,h.current=new window.google.maps.places.PlacesService(document.createElement("div")))};return(()=>{if(window.google?.maps?.places){t();return}if(document.querySelector("#google-maps-script")){e=setInterval(()=>{window.google?.maps?.places&&(clearInterval(e),e=null,t())},100);return}const r=document.createElement("script");r.id="google-maps-script",r.src=`https://maps.googleapis.com/maps/api/js?key=${_}&libraries=places`,r.async=!0,r.defer=!0,r.onload=()=>t(),document.head.appendChild(r)})(),()=>{e!==null&&(clearInterval(e),e=null)}},[s,_]),w(()=>{if(!s||!n||!v.current){f([]);return}return d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{p(!0),v.current.getPlacePredictions({input:n,types:["geocode","establishment"]},(e,t)=>{p(!1),t===window.google?.maps?.places?.PlacesServiceStatus.OK&&e?f(e):f([])})},300),()=>{d.current&&clearTimeout(d.current)}},[s,n]);const G=e=>{u(e),x({formatted_address:e})},C=e=>{const t=Array.isArray(e)?e[0]||"":e;if(!s){G(t);return}g.some(r=>r.place_id===t)&&q(t)};return s?m(M,{gap:"tight",children:[a(L,{label:b,value:n,onValueChange:C,onSearchChange:e=>{s&&u(e)},placeholder:o("address.placeholder","Enter address..."),emptyMessage:E?o("messages.loading","Loading..."):o("address.noResults","No addresses found"),options:j,required:P,variant:i?"destructive":void 0,isLoading:E,creatable:!0,createLabel:o("actions.use","Use this address")}),c&&a("p",{style:{fontSize:"var(--font-size-xs)",color:i?"var(--destructive-foreground)":"var(--muted-foreground)"},children:c})]}):m(M,{gap:"tight",children:[a(L,{label:b,value:n,onValueChange:C,placeholder:o("address.placeholder","Enter address..."),options:[],required:P,variant:i?"destructive":void 0,creatable:!0,createLabel:o("actions.use","Use this address")}),c&&a("p",{style:{fontSize:"var(--font-size-xs)",color:i?"var(--destructive-foreground)":"var(--muted-foreground)"},children:c})]})};var F=Y;export{F as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Avatar as p,Input as u,cn as f,Stack as n}from"@donotdev/components";const s=({config:r,value:t,onChange:c,error:A,helperText:l,t:i,className:d,...v})=>{const h=a=>a.split(" ").map(m=>m.charAt(0)).slice(0,2).join("").toUpperCase();return o(n,{children:[o(n,{direction:"row",align:"center",children:[e(p,{src:t,alt:r.label||"Avatar",fallback:h(r.label||"AV"),style:{height:"var(--touch-target)",width:"var(--touch-target)"}}),e("div",{className:"dndev-flex-1",children:e(u,{type:"url",className:f("dndev-w-full",d),placeholder:i("common.enterAvatarUrl"),value:t,onChange:a=>c(a.target.value),...v})})]}),l&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:l})]})};var g=s;export{s as AvatarFieldComponent,g as default};
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Avatar as m,Input as u,cn as f,Stack as n}from"@donotdev/components";const s=({config:r,value:t,onChange:c,error:A,helperText:l,t:i,className:d,...h})=>{const v=a=>a.split(" ").map(p=>p.charAt(0)).slice(0,2).join("").toUpperCase();return o(n,{children:[o(n,{direction:"row",align:"center",children:[e(m,{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:f("dndev-w-full",d),placeholder:i("common.enterAvatarUrl"),value:t,onChange:a=>c(a.target.value),...h})})]}),l&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:l})]})};var g=s;export{s as AvatarFieldComponent,g as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Badge as v,Input as f,cn as g,Stack as l}from"@donotdev/components";const o=({config:p,value:a,onChange:d,error:u,helperText:t,t:n,variant:s="default",className:i,...c})=>r(l,{children:[r(l,{direction:"row",align:"center",children:[e(v,{variant:s,style:{minWidth:0},children:a||n("common.badgePreview")}),e("div",{className:"dndev-flex-1",children:e(f,{type:"text",className:g("dndev-w-full",i),placeholder:n("common.enterBadgeText"),value:a,onChange:m=>d(m.target.value),...c})})]}),t&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:t})]});var h=o;export{o as BadgeFieldComponent,h as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Badge as v,Input as f,cn as g,Stack as o}from"@donotdev/components";const l=({config:p,value:a,onChange:d,error:u,helperText:r,t:n,variant:s="default",className:i,...c})=>t(o,{children:[t(o,{direction:"row",align:"center",children:[e(v,{variant:s,style:{minWidth:0},children:a||n("common.badgePreview")}),e("div",{className:"dndev-flex-1",children:e(f,{type:"text",className:g("dndev-w-full",i),placeholder:n("common.enterBadgeText"),value:a,onChange:m=>d(m.target.value),...c})})]}),r&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:r})]});var h=l;export{l as BadgeFieldComponent,h 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 o}from"react/jsx-runtime";import{Button as l}from"@donotdev/components";const n=({label:a,type:t,onClick:r,variant:e,disabled:i=!1})=>o(l,{type:t,onClick:r,variant:e,disabled:i,children:a});var s=n;export{s as default};
@@ -1 +1 @@
1
- import{jsx as h}from"react/jsx-runtime";import{Checkbox as d}from"@donotdev/components";const t=({label:r,checked:a=!1,onChange:e,required:c})=>h(d,{checked:a,onCheckedChange:o=>{e&&e({target:{checked:o}})},label:r,required:c});var n=t;export{n as default};
1
+ import{jsx as d}from"react/jsx-runtime";import{Checkbox as h}from"@donotdev/components";const t=({label:r,checked:a=!1,onChange:e,required:c})=>d(h,{checked:a,onCheckedChange:o=>{e&&e({target:{checked:o}})},label:r,required:c});var n=t;export{n 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 o,jsxs as c}from"react/jsx-runtime";import{useMemo as L,useId as N}from"react";import{Combobox as $,Stack as d}from"@donotdev/components";import{useTranslation as D}from"@donotdev/core";const I=({label:u,value:l,options:s,error:p,helperText:r,onChange:n,onBlur:m,required:g,placeholder:h,translationNamespace:v="dndev",placeholderKey:f="actions.select",placeholderDefault:b="Select",creatable:x=!1,createLabel:y,emptyMessage:C})=>{const{t:a}=D(v),i=N(),z=L(()=>s.map(e=>({value:String(e.value),label:e.label})),[s]),S=e=>{if(n){const q={target:{value:Array.isArray(e)?e[0]||"":e}};n(q)}},A=e=>{e||m?.()},t=!!p,M=`${i}-error`,j=`${i}-helper`;return c(d,{gap:"tight",children:[o($,{label:u,value:l||"",onValueChange:S,onOpenChange:A,placeholder:h||a(f,b),emptyMessage:C||a("messages.noResults","No results found"),creatable:x,createLabel:y||a("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"}),r]}),r&&!t&&o("p",{id:j,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:r})]})};var O=I;export{O as default};
@@ -1 +1 @@
1
- import{jsx as n,jsxs as y}from"react/jsx-runtime";import{useState as h,useEffect as L,useId as M}from"react";import{Input as T,FloatingLabel as U,Stack as q}from"@donotdev/components";const B=({label:b,value:r,onChange:x,currency:o="EUR",locale:N,error:i,helperText:d,required:F=!1,disabled:u=!1,placeholder:I})=>{const c=M(),S=N||(typeof navigator<"u"?navigator.language:"en-US"),l=e=>e==null||isNaN(e)?"":(e/100).toString(),p=e=>{if(!e||e.trim()==="")return null;const a=e.replace(/[^\d.,\-]/g,"").replace(",","."),t=parseFloat(a);return isNaN(t)?null:Math.round(t*100)},[g,s]=h(l(r)),[v,m]=h(!1);L(()=>{v?p(g)!==r&&s(l(r)):s(l(r))},[r,v]);const z=e=>{const a=e.target.value;s(a);const t={target:{value:p(a)}};x(t)},E=()=>m(!0),j=()=>m(!1),f=(()=>{try{return new Intl.NumberFormat(S,{style:"currency",currency:o,currencyDisplay:"symbol"}).formatToParts(0).find(e=>e.type==="currency")?.value||o}catch{return o}})();return y(q,{gap:"tight",children:[n(U,{htmlFor:c,label:b,disabled:u,required:F,children:y("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:f}),n(T,{id:c,type:"text",inputMode:"decimal",bare:!0,value:g,onChange:z,onFocus:E,onBlur:j,disabled:u,placeholder:I||"0","data-variant":i?"destructive":void 0,style:{paddingLeft:`calc(var(--gap-md) + ${f.length*.6}em + var(--gap-sm))`}})]})}),d&&n("p",{style:{fontSize:"var(--font-size-xs)",color:i?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})};var C=B;export{C as default};
1
+ import{jsx as n,jsxs as y}from"react/jsx-runtime";import{useState as h,useEffect as j,useId as q}from"react";import{Input as C,FloatingLabel as L,Stack as M}from"@donotdev/components";const U=({label:b,value:r,onChange:x,currency:l="EUR",locale:S,error:i,helperText:c,required:F=!1,disabled:u=!1,placeholder:N})=>{const d=q(),z=S||(typeof navigator<"u"?navigator.language:"en-US"),o=e=>e==null||isNaN(e)?"":(e/100).toString(),p=e=>{if(!e||e.trim()==="")return null;const a=e.replace(/[^\d.,\-]/g,"").replace(",","."),t=parseFloat(a);return isNaN(t)?null:Math.round(t*100)},[g,s]=h(o(r)),[v,m]=h(!1);j(()=>{v?p(g)!==r&&s(o(r)):s(o(r))},[r,v]);const E=e=>{const a=e.target.value;s(a);const t={target:{value:p(a)}};x(t)},I=()=>m(!0),T=()=>m(!1),f=(()=>{try{return new Intl.NumberFormat(z,{style:"currency",currency:l,currencyDisplay:"symbol"}).formatToParts(0).find(e=>e.type==="currency")?.value||l}catch{return l}})();return y(M,{gap:"tight",children:[n(L,{htmlFor:d,label:b,disabled:u,required:F,children:y("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:f}),n(C,{id:d,type:"text",inputMode:"decimal",bare:!0,value:g,onChange:E,onFocus:I,onBlur:T,disabled:u,placeholder:N||"0","data-variant":i?"destructive":void 0,style:{paddingLeft:`calc(var(--gap-md) + ${f.length*.6}em + var(--gap-sm))`}})]})}),c&&n("p",{style:{fontSize:"var(--font-size-xs)",color:i?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:c})]})};var B=U;export{B as default};
@@ -1 +1 @@
1
- import{jsx as i,jsxs as n}from"react/jsx-runtime";import{useId as m}from"react";import{DatePicker as z,DateTimePicker as $,Input as y,cn as h,Stack as d}from"@donotdev/components";const b=({label:v,value:s,onChange:u,error:c,helperText:t,mode:a="date",required:g,...p})=>{const r=m(),e=!!c,f=o=>{const S=o.target.value?new Date(o.target.value).toISOString():null;u(S)};let l="";if(s){const o=new Date(s);a==="date"?l=o.toISOString().split("T")[0]||"":a==="datetime-local"?l=o.toISOString().slice(0,16)||"":a==="month"?l=o.toISOString().slice(0,7):a==="time"?l=o.toISOString().slice(11,16):a==="week"&&(l=o.toISOString().split("T")[0]||"")}return a==="date"?n(d,{gap:"tight",children:[i(z,{id:r,label:v,value:s??null,onChange:u,required:g,"aria-describedby":h(e&&`${r}-error`,t&&!e&&`${r}-helper`),"aria-invalid":e,"data-variant":e?"destructive":void 0}),e&&n(d,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[i("span",{children:"\u26A0"}),c]}),t&&!e&&i("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:t})]}):a==="datetime-local"?n(d,{gap:"tight",children:[i($,{id:r,label:v,value:s??null,onChange:u,required:g,"aria-describedby":h(e&&`${r}-error`,t&&!e&&`${r}-helper`),"aria-invalid":e,"data-variant":e?"destructive":void 0}),e&&n(d,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[i("span",{children:"\u26A0"}),c]}),t&&!e&&i("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:t})]}):n(d,{gap:"tight",children:[i(y,{id:r,label:v,type:a,value:l,onChange:f,required:g,"aria-describedby":h(e&&`${r}-error`,t&&!e&&`${r}-helper`),"aria-invalid":e,"data-variant":e?"destructive":void 0,className:"dndev-w-full",...p}),e&&n(d,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[i("span",{children:"\u26A0"}),c]}),t&&!e&&i("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:t})]})};var x=b;export{x as default};
1
+ import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useId as m}from"react";import{DatePicker as z,DateTimePicker as $,Input as b,cn as h,Stack as d}from"@donotdev/components";const x=({label:u,value:s,onChange:v,error:c,helperText:i,mode:a="date",required:g,...p})=>{const r=m(),e=!!c,f=o=>{const S=o.target.value?new Date(o.target.value).toISOString():null;v(S)};let l="";if(s){const o=new Date(s);a==="date"?l=o.toISOString().split("T")[0]||"":a==="datetime-local"?l=o.toISOString().slice(0,16)||"":a==="month"?l=o.toISOString().slice(0,7):a==="time"?l=o.toISOString().slice(11,16):a==="week"&&(l=o.toISOString().split("T")[0]||"")}return a==="date"?n(d,{gap:"tight",children:[t(z,{id:r,label:u,value:s??null,onChange:v,required:g,"aria-describedby":h(e&&`${r}-error`,i&&!e&&`${r}-helper`),"aria-invalid":e,"data-variant":e?"destructive":void 0}),e&&n(d,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),c]}),i&&!e&&t("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:i})]}):a==="datetime-local"?n(d,{gap:"tight",children:[t($,{id:r,label:u,value:s??null,onChange:v,required:g,"aria-describedby":h(e&&`${r}-error`,i&&!e&&`${r}-helper`),"aria-invalid":e,"data-variant":e?"destructive":void 0}),e&&n(d,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),c]}),i&&!e&&t("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:i})]}):n(d,{gap:"tight",children:[t(b,{id:r,label:u,type:a,value:l,onChange:f,required:g,"aria-describedby":h(e&&`${r}-error`,i&&!e&&`${r}-helper`),"aria-invalid":e,"data-variant":e?"destructive":void 0,className:"dndev-w-full",...p}),e&&n(d,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),c]}),i&&!e&&t("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:i})]})};var y=x;export{y as default};
@@ -1 +1 @@
1
- "use client";import{jsx as a,jsxs as n,Fragment as K}from"react/jsx-runtime";import{Upload as V,X as _,FileText as u,FileSpreadsheet as J,File as Q,Loader2 as Y,Eye as Z}from"lucide-react";import{useState as D,useRef as $,useImperativeHandle as ee,forwardRef as ae}from"react";import{Button as k,BUTTON_VARIANT as C,Text as s,Stack as m,Progress as re,Dialog as te,DialogContent as ne,DialogHeader as ie,DialogTitle as le}from"@donotdev/components";import{handleError as y,useTranslation as oe}from"@donotdev/core";import{useFileUpload as se}from"../../../hooks/useFileUpload";import{uploadFile as de,deleteFile as ce,getFileIcon as pe,formatFileSize as me,getDocumentAcceptString as ue}from"../../../utils/fileStorage";const ve=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".html",".csv"],fe=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/markdown","text/html","text/csv"];function ge({type:d,className:i}){switch(d){case"pdf":return a(u,{className:i,style:{color:"var(--destructive)"}});case"doc":return a(u,{className:i,style:{color:"var(--primary)"}});case"xls":return a(J,{className:i,style:{color:"var(--success)"}});case"ppt":return a(u,{className:i,style:{color:"var(--warning)"}});case"text":case"html":return a(u,{className:i});default:return a(Q,{className:i})}}function z(d){const i="."+d.name.split(".").pop()?.toLowerCase();return ve.includes(i)}const P=ae(({name:d="document",label:i,value:S,onChange:A,error:v,helperText:x,multiple:f=!1,maxFiles:I=10,maxSize:L=25*1024*1024,storagePath:w,required:H,enablePreview:b=!0},R)=>{const{t:l}=oe("crud"),[N,g]=D(!1),[h,T]=D(null),c=$(null),E=ue();function M(e,r){return de(e,{storagePath:w,onProgress:t=>r(t.progress)})}const{files:o,addFiles:F,removeFile:O}=se({name:d,value:S,onChange:A,multiple:f,maxFiles:I,maxSize:L,accept:fe,storagePath:w,uploadFn:M});ee(R,()=>({upload:async()=>{},getDocuments:()=>o}),[o]);function W(e){const r=Array.from(e.target.files||[]);if(r.length>0){const t=r.filter(p=>z(p)?!0:(y(new Error("Invalid document type"),{userMessage:l("document.errors.invalidType",{fileName:p.name}),severity:"warning",showNotification:!0}),!1));t.length>0&&F(t)}c.current&&(c.current.value="")}function j(e){e.preventDefault(),g(!1);const r=Array.from(e.dataTransfer.files).filter(t=>z(t)?!0:(y(new Error("Invalid document type"),{userMessage:l("document.errors.invalidType",{fileName:t.name}),severity:"warning",showNotification:!0}),!1));r.length>0&&F(r)}async function B(e){const r=o.find(t=>t.id===e);if(r)try{r.uploaded&&"url"in r.uploaded&&await ce(r.uploaded),O(e)}catch(t){y(t,{userMessage:l("document.delete.failed"),severity:"error",showNotification:!0})}}function U(e){if(e.uploaded&&"url"in e.uploaded){const r=e.uploaded;r.mimeType==="application/pdf"&&T(r.url)}}const G=f||o.length===0;return n(K,{children:[n(m,{gap:"tight",children:[n(s,{level:"body",textAlign:"start",children:[i,H?"*":""]}),G&&n("div",{role:"button",tabIndex:0,"aria-label":l("document.upload.ariaLabel"),className:"dndev-surface","data-variant":v?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:N?"var(--primary)":v?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:N?"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(),g(!0)},onDragLeave:()=>g(!1),onDrop:j,onClick:()=>c.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),c.current?.click())},children:[a("input",{ref:c,type:"file",accept:E,multiple:f,style:{display:"none"},onChange:W}),n(m,{align:"center",justify:"center",children:[a(V,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),a(s,{as:"p",variant:"muted",level:"small",textAlign:"center",children:l("document.upload.hint")}),a(s,{as:"p",variant:"muted",level:"caption",textAlign:"center",children:"PDF, Word, Excel, PowerPoint, TXT, Markdown, HTML"})]})]}),o.length>0&&a(m,{gap:"tight",children:o.map(e=>{const r=e.uploaded&&"mimeType"in e.uploaded?e.uploaded.mimeType:e.file.type,t=pe(r||"",e.file.name),p=e.status==="uploading",X=r==="application/pdf"||e.file.name.toLowerCase().endsWith(".pdf"),q=e.uploaded&&"size"in e.uploaded?e.uploaded.size:e.file.size;return n("div",{className:"dndev-surface","data-variant":"muted",style:{padding:"var(--gap-md)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",gap:"var(--gap-md)"},children:[a(ge,{type:t,className:"dndev-size-md"}),n(m,{gap:"none",style:{flex:1,minWidth:0},children:[a(s,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),n(s,{level:"caption",variant:"muted",children:[me(q),e.error&&n("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),p&&a(re,{value:e.progress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),n(m,{direction:"row",gap:"tight",children:[b&&X&&e.status==="complete"&&a(k,{variant:C.GHOST,onClick:()=>U(e),"aria-label":l("document.preview.ariaLabel"),children:a(Z,{className:"dndev-size-sm"})}),p?a(Y,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):a(k,{variant:C.GHOST,onClick:()=>B(e.id),"aria-label":l("document.delete.ariaLabel"),children:a(_,{className:"dndev-size-sm"})})]})]},e.id)})}),x&&a(s,{level:"caption",variant:v?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:x})]}),b&&h&&a(te,{open:!!h,onOpenChange:()=>T(null),children:n(ne,{style:{maxWidth:"90vw",maxHeight:"90vh",width:"900px",height:"80vh"},children:[a(ie,{children:a(le,{children:l("document.preview.title")})}),a("iframe",{src:h,sandbox:"allow-same-origin",style:{width:"100%",height:"100%",border:"none",borderRadius:"var(--radius-md)"},title:"PDF Preview"})]})})]})});P.displayName="DocumentFieldComponent";var he=P;export{he as default};
1
+ "use client";import{jsx as a,jsxs as n,Fragment as K}from"react/jsx-runtime";import{Upload as V,X as _,FileText as u,FileSpreadsheet as J,File as Q,Loader2 as Y,Eye as Z}from"lucide-react";import{useState as D,useRef as $,useImperativeHandle as ee,forwardRef as ae}from"react";import{Button as k,BUTTON_VARIANT as C,Text as s,Stack as m,Progress as re,Dialog as te,DialogContent as ne,DialogHeader as ie,DialogTitle as le}from"@donotdev/components";import{handleError as y,useTranslation as oe}from"@donotdev/core";import{useFileUpload as se}from"../../../hooks/useFileUpload";import{uploadFile as de,deleteFile as ce,getFileIcon as pe,formatFileSize as me,getDocumentAcceptString as ue}from"../../../utils/fileStorage";const ve=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".html",".csv"],fe=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/markdown","text/html","text/csv"];function ge({type:d,className:i}){switch(d){case"pdf":return a(u,{className:i,style:{color:"var(--destructive)"}});case"doc":return a(u,{className:i,style:{color:"var(--primary)"}});case"xls":return a(J,{className:i,style:{color:"var(--success)"}});case"ppt":return a(u,{className:i,style:{color:"var(--warning)"}});case"text":case"html":return a(u,{className:i});default:return a(Q,{className:i})}}function z(d){const i="."+d.name.split(".").pop()?.toLowerCase();return ve.includes(i)}const P=ae(({name:d="document",label:i,value:S,onChange:A,error:v,helperText:x,multiple:f=!1,maxFiles:L=10,maxSize:E=25*1024*1024,storagePath:w,required:I,enablePreview:b=!0},O)=>{const{t:l}=oe("crud"),[N,g]=D(!1),[h,T]=D(null),c=$(null),H=ue();function M(e,r){return de(e,{storagePath:w,onProgress:t=>r(t.progress)})}const{files:o,addFiles:F,removeFile:R}=se({name:d,value:S,onChange:A,multiple:f,maxFiles:L,maxSize:E,accept:fe,storagePath:w,uploadFn:M});ee(O,()=>({upload:async()=>{},getDocuments:()=>o}),[o]);function W(e){const r=Array.from(e.target.files||[]);if(r.length>0){const t=r.filter(p=>z(p)?!0:(y(new Error("Invalid document type"),{userMessage:l("document.errors.invalidType",{fileName:p.name}),severity:"warning",showNotification:!0}),!1));t.length>0&&F(t)}c.current&&(c.current.value="")}function j(e){e.preventDefault(),g(!1);const r=Array.from(e.dataTransfer.files).filter(t=>z(t)?!0:(y(new Error("Invalid document type"),{userMessage:l("document.errors.invalidType",{fileName:t.name}),severity:"warning",showNotification:!0}),!1));r.length>0&&F(r)}async function B(e){const r=o.find(t=>t.id===e);if(r)try{r.uploaded&&"url"in r.uploaded&&await ce(r.uploaded),R(e)}catch(t){y(t,{userMessage:l("document.delete.failed"),severity:"error",showNotification:!0})}}function U(e){if(e.uploaded&&"url"in e.uploaded){const r=e.uploaded;r.mimeType==="application/pdf"&&T(r.url)}}const G=f||o.length===0;return n(K,{children:[n(m,{gap:"tight",children:[n(s,{level:"body",textAlign:"start",children:[i,I?"*":""]}),G&&n("div",{role:"button",tabIndex:0,"aria-label":l("document.upload.ariaLabel"),className:"dndev-surface","data-variant":v?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:N?"var(--primary)":v?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:N?"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(),g(!0)},onDragLeave:()=>g(!1),onDrop:j,onClick:()=>c.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),c.current?.click())},children:[a("input",{ref:c,type:"file",accept:H,multiple:f,style:{display:"none"},onChange:W}),n(m,{align:"center",justify:"center",children:[a(V,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),a(s,{as:"p",variant:"muted",level:"small",textAlign:"center",children:l("document.upload.hint")}),a(s,{as:"p",variant:"muted",level:"caption",textAlign:"center",children:"PDF, Word, Excel, PowerPoint, TXT, Markdown, HTML"})]})]}),o.length>0&&a(m,{gap:"tight",children:o.map(e=>{const r=e.uploaded&&"mimeType"in e.uploaded?e.uploaded.mimeType:e.file.type,t=pe(r||"",e.file.name),p=e.status==="uploading",X=r==="application/pdf"||e.file.name.toLowerCase().endsWith(".pdf"),q=e.uploaded&&"size"in e.uploaded?e.uploaded.size:e.file.size;return n("div",{className:"dndev-surface","data-variant":"muted",style:{padding:"var(--gap-md)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",gap:"var(--gap-md)"},children:[a(ge,{type:t,className:"dndev-size-md"}),n(m,{gap:"none",style:{flex:1,minWidth:0},children:[a(s,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),n(s,{level:"caption",variant:"muted",children:[me(q),e.error&&n("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),p&&a(re,{value:e.progress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),n(m,{direction:"row",gap:"tight",children:[b&&X&&e.status==="complete"&&a(k,{variant:C.GHOST,onClick:()=>U(e),"aria-label":l("document.preview.ariaLabel"),children:a(Z,{className:"dndev-size-sm"})}),p?a(Y,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):a(k,{variant:C.GHOST,onClick:()=>B(e.id),"aria-label":l("document.delete.ariaLabel"),children:a(_,{className:"dndev-size-sm"})})]})]},e.id)})}),x&&a(s,{level:"caption",variant:v?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:x})]}),b&&h&&a(te,{open:!!h,onOpenChange:()=>T(null),children:n(ne,{style:{maxWidth:"90vw",maxHeight:"90vh",width:"900px",height:"80vh"},children:[a(ie,{children:a(le,{children:l("document.preview.title")})}),a("iframe",{src:h,sandbox:"allow-same-origin",style:{width:"100%",height:"100%",border:"none",borderRadius:"var(--radius-md)"},title:"PDF Preview"})]})})]})});P.displayName="DocumentFieldComponent";var he=P;export{he as default};
@@ -1 +1 @@
1
- import{jsx as l,jsxs as g}from"react/jsx-runtime";import{Select as d,Stack as m}from"@donotdev/components";import{useTranslation as v}from"@donotdev/core";const f=({label:t,value:r,options:n,error:s,helperText:a,onChange:o,onBlur:u,required:i})=>{const{t:p}=v("crud"),c=r!=null?String(r):"";return g(m,{gap:"tight",children:[l(d,{label:t,value:c,onValueChange:e=>{o&&o({target:{value:e}})},onOpenChange:e=>!e&&u?.(),placeholder:p("actions.select","Select"),required:i,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 t,jsxs as g}from"react/jsx-runtime";import{Select as d,Stack as v}from"@donotdev/components";import{useTranslation as m}from"@donotdev/core";const f=({label:o,value:r,options:n,error:s,helperText:a,onChange:l,onBlur:i,required:u})=>{const{t:p}=m("crud"),c=r!=null?String(r):"";return g(v,{gap:"tight",children:[t(d,{label:o,value:c,onValueChange:e=>{l&&l({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&&t("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:a})]})};var h=f;export{h as default};
@@ -1 +1 @@
1
- import{jsx as i,jsxs as l}from"react/jsx-runtime";import{Clock as x}from"lucide-react";import{useState as T,useMemo as k}from"react";import{Label as z,Stack as s,Button as S,Slider as w}from"@donotdev/components";const f=[15,30,45,60,90,120,150,180],N={15:"duration.15m",30:"duration.30m",45:"duration.45m",60:"duration.1h",90:"duration.1h30",120:"duration.2h",150:"duration.2h30",180:"duration.3h"};function W(e,o){const n=e<60?`${e}m`:e%60===0?`${e/60}h`:`${Math.floor(e/60)}h${e%60}`,u=N[e];return!o||!u?n:o(`crud:${u}`,{defaultValue:n})??n}const j=({label:e,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(a=>({minutes:a,label:W(a,t)})),[t]),y=t?t("crud:duration.custom",{defaultValue:"Custom"}):"Custom";if(C){const a=r===0?t?t("crud:duration.zero",{defaultValue:"\u2014"}):"\u2014":r<60?t?t("crud:duration.minutes",{count:r,defaultValue:`${r} min`}):`${r} min`:t?t("crud:duration.hoursMinutes",{hours:Math.floor(r/60),minutes:r%60,defaultValue:`${Math.floor(r/60)}h${r%60?` ${r%60}min`:""}`}):`${Math.floor(r/60)}h${r%60?` ${r%60}m`:""}`;return l(s,{gap:"tight",children:[i(z,{required:p,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:e}),l(s,{direction:"row",gap:"tight",align:"center",children:[i(x,{size:18,style:{color:"var(--muted-foreground)"},"aria-hidden":!0}),i("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-sm)"},children:a})]}),d&&i("p",{style:{fontSize:"var(--font-size-xs)",color:u?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})}return l(s,{children:[i(z,{required:p,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:e}),l(s,{direction:"row",gap:"tight",align:"center",style:{flexWrap:"wrap"},children:[V.map(({minutes:a,label:$})=>l(S,{type:"button",variant:r===a?"primary":"outline",disabled:m,onClick:()=>{b(!1),n(a)},"aria-pressed":r===a,"aria-label":$,children:[i(x,{size:14,style:{marginRight:"var(--gap-xs)"},"aria-hidden":!0}),$]},a)),i(S,{type:"button",variant:c?"primary":"outline",disabled:m,onClick:()=>{b(!0),!h&&r>0?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:([a])=>n(Math.max(g,Math.min(v,a??0))),min:g,max:v,step:M,showValue:!0,disabled:m,"aria-label":e})}),d&&i("p",{style:{fontSize:"var(--font-size-xs)",color:u?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})};var q=j;export{f as DURATION_PRESETS,q as default};
1
+ import{jsx as i,jsxs as u}from"react/jsx-runtime";import{Clock as x}from"lucide-react";import{useState as T,useMemo as k}from"react";import{Label as $,Stack as s,Button as S,Slider as w}from"@donotdev/components";const f=[15,30,45,60,90,120,150,180],N={15:"duration.15m",30:"duration.30m",45:"duration.45m",60:"duration.1h",90:"duration.1h30",120:"duration.2h",150:"duration.2h30",180:"duration.3h"};function q(e,n){const o=e<60?`${e}m`:e%60===0?`${e/60}h`:`${Math.floor(e/60)}h${e%60}`,l=N[e];return!n||!l?o:n(`crud:${l}`,{defaultValue:o})??o}const W=({label:e,value:n,onChange:o,error:l,helperText:d,disabled:m,required:p,readonly:M,min:g=0,max:v=480,step:V=5,t})=>{const r=typeof n=="number"&&!Number.isNaN(n)?n:0,h=f.includes(r),[c,b]=T(!h&&r>0),C=k(()=>f.map(a=>({minutes:a,label:q(a,t)})),[t]),y=t?t("crud:duration.custom",{defaultValue:"Custom"}):"Custom";if(M){const a=r===0?t?t("crud:duration.zero",{defaultValue:"\u2014"}):"\u2014":r<60?t?t("crud:duration.minutes",{count:r,defaultValue:`${r} min`}):`${r} min`:t?t("crud:duration.hoursMinutes",{hours:Math.floor(r/60),minutes:r%60,defaultValue:`${Math.floor(r/60)}h${r%60?` ${r%60}min`:""}`}):`${Math.floor(r/60)}h${r%60?` ${r%60}m`:""}`;return u(s,{gap:"tight",children:[i($,{required:p,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:e}),u(s,{direction:"row",gap:"tight",align:"center",children:[i(x,{size:18,style:{color:"var(--muted-foreground)"},"aria-hidden":!0}),i("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-sm)"},children:a})]}),d&&i("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})}return u(s,{children:[i($,{required:p,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:e}),u(s,{direction:"row",gap:"tight",align:"center",style:{flexWrap:"wrap"},children:[C.map(({minutes:a,label:z})=>u(S,{type:"button",variant:r===a?"primary":"outline",disabled:m,onClick:()=>{b(!1),o(a)},"aria-pressed":r===a,"aria-label":z,children:[i(x,{size:14,style:{marginRight:"var(--gap-xs)"},"aria-hidden":!0}),z]},a)),i(S,{type:"button",variant:c?"primary":"outline",disabled:m,onClick:()=>{b(!0),!h&&r>0?o(r):o(30)},"aria-pressed":c,"aria-label":y,children:y})]}),c&&i(s,{gap:"tight",style:{marginTop:"var(--gap-sm)"},children:i(w,{value:[h?30:r],onValueChange:([a])=>o(Math.max(g,Math.min(v,a??0))),min:g,max:v,step:V,showValue:!0,disabled:m,"aria-label":e})}),d&&i("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})};var j=W;export{f as DURATION_PRESETS,j as default};