@donotdev/crud 0.1.42 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CrudService.bulk.js +1 -1
- package/dist/CrudService.bulkAcross.js +1 -1
- package/dist/CrudService.cache.js +1 -1
- package/dist/CrudService.internal.js +2 -2
- package/dist/CrudService.mutations.js +1 -1
- package/dist/CrudService.optimistic.js +1 -1
- package/dist/CrudService.queries.js +1 -1
- package/dist/CrudService.subscriptions.js +1 -1
- package/dist/CrudStore.js +1 -1
- package/dist/adapters/FunctionsAdapter.js +1 -1
- package/dist/components/CrudButton.js +1 -1
- package/dist/components/CrudCard.d.ts.map +1 -1
- package/dist/components/CrudCard.js +1 -1
- package/dist/components/DateFilter.js +1 -1
- package/dist/components/DisplayFieldRenderer.js +1 -1
- package/dist/components/DisplayThumbnail.js +1 -1
- package/dist/components/EntityFilters.js +1 -1
- package/dist/components/FormFieldRenderer.js +1 -1
- package/dist/components/FormLayout.js +1 -1
- package/dist/components/YearFilter.js +1 -1
- package/dist/components/controlled/complex/ControlledAddressField.js +1 -1
- package/dist/components/controlled/complex/ControlledDateField.js +1 -1
- package/dist/components/controlled/complex/ControlledFieldArrayField.js +1 -1
- package/dist/components/controlled/complex/ControlledGeoPointField.js +1 -1
- package/dist/components/controlled/complex/ControlledMapField.js +1 -1
- package/dist/components/controlled/complex/ControlledMultiInputField.js +1 -1
- package/dist/components/controlled/complex/ControlledRichTextField.js +1 -1
- package/dist/components/controlled/complex/ControlledTimestampField.js +1 -1
- package/dist/components/controlled/file/ControlledDocumentField.js +1 -1
- package/dist/components/controlled/file/ControlledFileField.js +1 -1
- package/dist/components/controlled/file/ControlledImageField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiDocumentField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiFileField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiImageField.js +1 -1
- package/dist/components/controlled/input/ControlledCurrencyField.js +1 -1
- package/dist/components/controlled/input/ControlledDurationField.js +1 -1
- package/dist/components/controlled/input/ControlledGdprConsentField.js +1 -1
- package/dist/components/controlled/input/ControlledNumberField.js +1 -1
- package/dist/components/controlled/input/ControlledPhoneField.js +1 -1
- package/dist/components/controlled/input/ControlledPriceField.js +1 -1
- package/dist/components/controlled/input/ControlledRangeField.js +1 -1
- package/dist/components/controlled/input/ControlledRatingField.js +1 -1
- package/dist/components/controlled/input/ControlledSwitchField.js +1 -1
- package/dist/components/controlled/input/ControlledTextField.js +1 -1
- package/dist/components/controlled/input/ControlledTextareaField.js +1 -1
- package/dist/components/controlled/select/ControlledComboboxField.js +1 -1
- package/dist/components/controlled/select/ControlledDropdownField.js +1 -1
- package/dist/components/controlled/select/ControlledMultiDropdownField.js +1 -1
- package/dist/components/controlled/select/ControlledRadioField.js +1 -1
- package/dist/components/controlled/select/ControlledReferenceField.js +1 -1
- package/dist/components/controlled/types.js +1 -1
- package/dist/components/fields/display/AvatarFieldDisplay.js +1 -1
- package/dist/components/fields/display/BadgeFieldDisplay.js +1 -1
- package/dist/components/fields/display/ButtonFieldDisplay.js +1 -1
- package/dist/components/fields/display/CheckboxFieldDisplay.js +1 -1
- package/dist/components/fields/display/DateFieldDisplay.js +1 -1
- package/dist/components/fields/display/DropdownDisplay.js +1 -1
- package/dist/components/fields/display/FileFieldDisplay.js +1 -1
- package/dist/components/fields/display/GeoPointFieldDisplay.js +1 -1
- package/dist/components/fields/display/HiddenFieldDisplay.js +1 -1
- package/dist/components/fields/display/ImageFieldDisplay.js +1 -1
- package/dist/components/fields/display/LinkFieldDisplay.js +1 -1
- package/dist/components/fields/display/MapFieldDisplay.js +1 -1
- package/dist/components/fields/display/MultiDropdownDisplay.js +1 -1
- package/dist/components/fields/display/MultiInputTextFieldDisplay.js +1 -1
- package/dist/components/fields/display/NumberFieldDisplay.js +1 -1
- package/dist/components/fields/display/PasswordFieldDisplay.js +1 -1
- package/dist/components/fields/display/RadioFieldDisplay.js +1 -1
- package/dist/components/fields/display/RangeFieldDisplay.js +1 -1
- package/dist/components/fields/display/ReferenceFieldDisplay.js +1 -1
- package/dist/components/fields/display/TextAreaDisplay.js +1 -1
- package/dist/components/fields/display/TextFieldDisplay.js +1 -1
- package/dist/components/fields/display/TimestampFieldDisplay.js +1 -1
- package/dist/components/fields/display/index.js +1 -1
- package/dist/components/form/fields/AddressFieldComponent.d.ts +12 -10
- package/dist/components/form/fields/AddressFieldComponent.d.ts.map +1 -1
- package/dist/components/form/fields/AddressFieldComponent.js +1 -1
- package/dist/components/form/fields/AvatarFieldComponent.js +1 -1
- package/dist/components/form/fields/BadgeFieldComponent.js +1 -1
- package/dist/components/form/fields/ButtonFieldComponent.js +1 -1
- package/dist/components/form/fields/CheckboxFieldComponent.js +1 -1
- package/dist/components/form/fields/ComboboxComponent.js +1 -1
- package/dist/components/form/fields/CurrencyFieldComponent.js +1 -1
- package/dist/components/form/fields/DateFieldComponent.js +1 -1
- package/dist/components/form/fields/DocumentFieldComponent.js +1 -1
- package/dist/components/form/fields/DropdownComponent.js +1 -1
- package/dist/components/form/fields/DurationFieldComponent.js +1 -1
- package/dist/components/form/fields/FileFieldComponent.js +1 -1
- package/dist/components/form/fields/GdprConsentFieldComponent.js +1 -1
- package/dist/components/form/fields/GeoPointFieldComponent.js +1 -1
- package/dist/components/form/fields/ImageFieldComponent.js +1 -1
- package/dist/components/form/fields/MapFieldComponent.js +1 -1
- package/dist/components/form/fields/MultiDropdownComponent.js +1 -1
- package/dist/components/form/fields/MultiInputTextFieldComponent.js +1 -1
- package/dist/components/form/fields/NumberFieldComponent.js +1 -1
- package/dist/components/form/fields/PasswordFieldComponent.js +1 -1
- package/dist/components/form/fields/PhoneNumberComponent.js +1 -1
- package/dist/components/form/fields/PriceFieldComponent.js +1 -1
- package/dist/components/form/fields/RadioFieldComponent.js +1 -1
- package/dist/components/form/fields/RangeFieldComponent.js +1 -1
- package/dist/components/form/fields/RatingFieldComponent.js +1 -1
- package/dist/components/form/fields/ReferenceFieldComponent.js +1 -1
- package/dist/components/form/fields/RichTextComponent.js +1 -1
- package/dist/components/form/fields/SwitchFieldComponent.js +1 -1
- package/dist/components/form/fields/TextAreaComponent.js +1 -1
- package/dist/components/form/fields/TextFieldComponent.js +1 -1
- package/dist/components/form/fields/TimestampFieldComponent.js +1 -1
- package/dist/components/form/fields/index.js +1 -1
- package/dist/components/form/fields/internal/TiptapEditor.js +2 -2
- package/dist/components/form/internal/ImageViewerDialog.js +1 -1
- package/dist/contexts/UploadContext.js +1 -1
- package/dist/fieldTypeRegistry.store.js +1 -1
- package/dist/forms/hooks/useController.js +1 -1
- package/dist/forms/hooks/useEntityField.js +1 -1
- package/dist/forms/hooks/useEntityForm.js +1 -1
- package/dist/forms/utils/buildInitialValues.js +1 -1
- package/dist/forms/utils/isFieldEditable.js +1 -1
- package/dist/forms/utils/translateFieldLabel.js +1 -1
- package/dist/forms/utils/validateEntity.js +1 -1
- package/dist/hooks/useCrudFilters.js +1 -1
- package/dist/hooks/useCrudPageSize.js +1 -1
- package/dist/hooks/useEntityFavorites.js +1 -1
- package/dist/hooks/useFieldConditions.js +1 -1
- package/dist/hooks/useFileUpload.js +1 -1
- package/dist/hooks/useReferenceResolver.js +1 -1
- package/dist/hooks/useRelatedItems.js +1 -1
- package/dist/index.js +1 -1
- package/dist/stores/FormStore.js +1 -1
- package/dist/stores/UploadStore.js +1 -1
- package/dist/stores/index.js +1 -1
- package/dist/symbol-index.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/useBaseCrudList.js +1 -1
- package/dist/useCrud.js +1 -1
- package/dist/useCrudCardList.js +1 -1
- package/dist/useCrudList.js +1 -1
- package/dist/utils/clientListProcessing.js +1 -1
- package/dist/utils/collections.js +1 -1
- package/dist/utils/fileStorage.js +1 -1
- package/dist/utils/imageProcessing.js +1 -1
- package/dist/utils/matchesFilter.js +1 -1
- package/dist/utils/mergeWithOptimistic.js +1 -1
- package/dist/utils/sanitizeHtml.js +1 -1
- package/dist/utils/uploadValidation.js +1 -1
- package/dist/workflows/defineWorkflow.js +1 -1
- package/dist/workflows/useEntityWorkflow.js +1 -1
- package/package.json +3 -3
|
@@ -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:
|
|
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
|
|
1
|
+
import{jsx as l,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:t,value:r,options:n,error:s,helperText:a,onChange:o,onBlur:i,required:u})=>{const{t:p}=m("crud"),c=r!=null?String(r):"";return g(v,{gap:"tight",children:[l(d,{label:t,value:c,onValueChange:e=>{o&&o({target:{value:e}})},onOpenChange:e=>!e&&i?.(),placeholder:p("actions.select","Select"),required:u,options:n.map(e=>({value:String(e.value),label:e.label}))}),a&&l("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:a})]})};var h=f;export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i,jsxs as
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as
|
|
1
|
+
"use client";import{jsx as a,jsxs as s}from"react/jsx-runtime";import{Upload as B,X as M,File as U,Loader2 as E,FileText as g,FileSpreadsheet as H,FileImage as V,FileVideo as q,FileAudio as G,FileArchive as K,FileCode as W}from"lucide-react";import{useState as X,useRef as _,useImperativeHandle as J,forwardRef as Q}from"react";import{Button as Y,BUTTON_VARIANT as Z,Text as d,Stack as u,Progress as $}from"@donotdev/components";import{handleError as ee,useTranslation as ae}from"@donotdev/core";import{useFileUpload as re}from"../../../hooks/useFileUpload";import{uploadFile as le,deleteFile as se,getFileIcon as te,formatFileSize as ie}from"../../../utils/fileStorage";function ne({type:p,className:r}){switch(p){case"pdf":return a(g,{className:r,style:{color:"var(--destructive)"}});case"doc":return a(g,{className:r,style:{color:"var(--primary)"}});case"xls":return a(H,{className:r,style:{color:"var(--success)"}});case"ppt":return a(g,{className:r,style:{color:"var(--warning)"}});case"image":return a(V,{className:r});case"video":return a(q,{className:r});case"audio":return a(G,{className:r});case"archive":return a(K,{className:r});case"html":case"text":return a(W,{className:r});default:return a(U,{className:r})}}const b=Q(({name:p="file",label:r,value:T,onChange:w,error:m,helperText:h,accept:v,multiple:n=!1,maxFiles:k=10,maxSize:z=50*1024*1024,storagePath:y,required:D},S)=>{const{t:c}=ae("crud"),[x,f]=X(!1),o=_(null);function A(e,l){return le(e,{storagePath:y,onProgress:t=>l(t.progress)})}const{files:i,addFiles:F,removeFile:C}=re({name:p,value:T,onChange:w,multiple:n,maxFiles:k,maxSize:z,accept:v?[v]:[],storagePath:y,uploadFn:A});J(S,()=>({upload:async()=>{},getFiles:()=>i}),[i]);function I(e){const l=Array.from(e.target.files||[]);l.length>0&&F(l),o.current&&(o.current.value="")}function L(e){e.preventDefault(),f(!1),F(Array.from(e.dataTransfer.files))}async function P(e){const l=i.find(t=>t.id===e);if(l)try{l.uploaded&&"url"in l.uploaded&&await se(l.uploaded),C(e)}catch(t){ee(t,{userMessage:c("file.delete.failed"),severity:"error",showNotification:!0})}}const R=n||i.length===0;return s(u,{gap:"tight",children:[s(d,{level:"body",textAlign:"start",children:[r,D?"*":""]}),R&&s("div",{role:"button",tabIndex:0,"aria-label":c(n?"file.upload.ariaLabelMultiple":"file.upload.ariaLabelSingle"),className:"dndev-surface","data-variant":m?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:x?"var(--primary)":m?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:x?"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(),f(!0)},onDragLeave:()=>f(!1),onDrop:L,onClick:()=>o.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),o.current?.click())},children:[a("input",{ref:o,type:"file",accept:v,multiple:n,style:{display:"none"},onChange:I}),s(u,{align:"center",justify:"center",children:[a(B,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),a(d,{as:"p",variant:"muted",level:"small",textAlign:"center",children:c(n?"file.upload.dragDropMultiple":"file.upload.dragDropSingle")})]})]}),i.length>0&&a(u,{gap:"tight",children:i.map((e,l)=>{const t=e.uploaded&&"mimeType"in e.uploaded?e.uploaded.mimeType:e.file.type,O=te(t||"",e.file.name),N=e.status==="uploading",j=e.uploaded&&"size"in e.uploaded?e.uploaded.size:e.file.size;return s("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(ne,{type:O,className:"dndev-size-md"}),s(u,{gap:"none",style:{flex:1,minWidth:0},children:[a(d,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),s(d,{level:"caption",variant:"muted",children:[ie(j),e.error&&s("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),N&&a($,{value:e.progress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),N?a(E,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):a(Y,{variant:Z.GHOST,onClick:()=>P(e.id),"aria-label":c("file.delete.ariaLabel"),children:a(M,{className:"dndev-size-sm"})})]},e.id)})}),h&&a(d,{level:"caption",variant:m?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:h})]})});b.displayName="FileFieldComponent";var oe=b;export{oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as o,Fragment as w}from"react/jsx-runtime";import{useState as f}from"react";import{Checkbox as D,Label as H,Sheet as m,Stack as
|
|
1
|
+
import{jsx as t,jsxs as o,Fragment as w}from"react/jsx-runtime";import{useState as f}from"react";import{Checkbox as D,Label as H,Sheet as m,Stack as P,Text as S}from"@donotdev/components";import{useTranslation as V}from"@donotdev/core";const j=({checked:a=!1,onChange:l,required:u,privacyPolicyPath:s="/legal/privacy",termsPath:c="/legal/terms"})=>{const{t:r}=V("crud"),[y,d]=f(!1),[x,h]=f(!1),p=e=>{l&&l({target:{checked:e}})},v=e=>{e.target.tagName!=="A"&&(e.target.closest('[data-type="checkbox"]')||p(!a))},g=(e,b)=>{e.preventDefault(),b==="privacy"?d(!0):h(!0)},C=r("gdprConsent.consent",{defaultValue:"I agree to the"}),n=r("gdprConsent.privacyPolicy",{defaultValue:"privacy policy"}),i=r("gdprConsent.terms",{defaultValue:"terms of use"}),k=r("gdprConsent.and",{defaultValue:"and consent to the processing of my personal data."});return o(w,{children:[o(P,{direction:"row",align:"center",gap:"tight",children:[t(D,{checked:a,onCheckedChange:p}),t(H,{required:u,plain:!0,onClick:v,style:{cursor:"pointer"},children:o(S,{level:"body",style:{fontSize:"var(--font-size-input)"},children:[C," ",t("a",{href:s,onClick:e=>g(e,"privacy"),style:{textDecoration:"underline",cursor:"pointer"},children:n})," / ",t("a",{href:c,onClick:e=>g(e,"terms"),style:{textDecoration:"underline",cursor:"pointer"},children:i})," ",k]})})]}),t(m,{open:y,onOpenChange:d,side:"bottom",title:n,style:{width:"100%",height:"90%",maxHeight:"90dvh",display:"flex",flexDirection:"column",overflow:"hidden"},children:t("iframe",{src:s,style:{width:"100%",height:"100%",border:"none",flex:1,minHeight:0},title:n})}),t(m,{open:x,onOpenChange:h,side:"bottom",title:i,style:{width:"100%",height:"90%",maxHeight:"90dvh",display:"flex",flexDirection:"column",overflow:"hidden"},children:t("iframe",{src:c,style:{width:"100%",height:"100%",border:"none",flex:1,minHeight:0},title:i})})]})};var z=j;export{z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t,jsxs as u}from"react/jsx-runtime";import{Label as b,Input as v,Stack as g}from"@donotdev/components";const h=({label:c,value:a={lat:0,lng:0},onChange:i,error:r,helperText:o,disabled:d,required:f})=>{const p=l=>{const e=parseFloat(l.target.value)||0;if(e>=-90&&e<=90){const n={...a,lat:e},s={target:{value:JSON.stringify(n)}};i(s)}},m=l=>{const e=parseFloat(l.target.value)||0;if(e>=-180&&e<=180){const n={...a,lng:e},s={target:{value:JSON.stringify(n)}};i(s)}};return u(g,{gap:"tight",children:[t(b,{required:f,style:{display:"block",fontSize:"var(--font-size-sm)",fontWeight:500},children:c}),u(g,{direction:"row",children:[t(v,{label:"Latitude",type:"number",value:a.lat,onChange:p,min:"-90",max:"90",step:"0.000001",disabled:d,"data-variant":r?"destructive":void 0,className:"dndev-w-full"}),t(v,{label:"Longitude",type:"number",value:a.lng,onChange:m,min:"-180",max:"180",step:"0.000001",disabled:d,"data-variant":r?"destructive":void 0,className:"dndev-w-full"})]}),o&&t("p",{style:{fontSize:"var(--font-size-xs)",color:r?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:o})]})};var y=h;export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as s,Fragment as Y}from"react/jsx-runtime";import{DndContext as Z,closestCenter as _,PointerSensor as
|
|
1
|
+
"use client";import{jsx as r,jsxs as s,Fragment as Y}from"react/jsx-runtime";import{DndContext as Z,closestCenter as _,PointerSensor as Q,TouchSensor as ee,useSensor as A,useSensors as re}from"@dnd-kit/core";import{SortableContext as te,useSortable as oe,rectSortingStrategy as ae,arrayMove as ie}from"@dnd-kit/sortable";import{CSS as ne}from"@dnd-kit/utilities";import{Upload as le,X as U,Loader2 as se,GripVertical as de}from"lucide-react";import{forwardRef as ce,useCallback as R,useImperativeHandle as ue,useRef as pe,useState as j}from"react";import{Text as m,Stack as k,Progress as ge,handleImageError as me}from"@donotdev/components";import{useTranslation as he}from"@donotdev/core";import{useFileUpload as fe}from"../../../hooks/useFileUpload";import{processImage as ve}from"../../../utils/imageProcessing";import{uploadImage as be}from"../../../utils/imageStorage";import{ImageViewerDialog as ye}from"../internal/ImageViewerDialog";const xe=["image/*"];function we(t){return{id:t.id,file:t.file,previewURL:t.previewURL,hash:"",rotation:0,uploadProgress:t.progress,uploaded:t.uploaded,error:t.error}}function ke({file:t,index:h,multiple:f,onImageClick:C,onRemove:v,t:d}){const{attributes:i,listeners:S,setNodeRef:D,transform:c,transition:I,isDragging:b}=oe({id:t.id}),y=t.progress!==null&&t.progress<100,l=f&&!y,n={transform:ne.Transform.toString(c),transition:I,position:"relative",width:100,height:100,borderRadius:"var(--radius-md)",border:"var(--border-width) solid var(--border)",overflow:"hidden",backgroundColor:"var(--surface)",opacity:b?.5:1,cursor:l?"grab":"pointer",userSelect:"none",touchAction:l?"none":"auto"};return r("div",{ref:D,style:n,...i,...l?S:{},onClick:()=>{b||C(h)},children:y?s(k,{align:"center",justify:"center",style:{width:"100%",height:"100%"},children:[r(se,{style:{animation:"spin 1s linear infinite"}}),r(ge,{value:t.progress||0,style:{width:"80%"}})]}):t.error?s(k,{align:"center",justify:"center",style:{width:"100%",height:"100%"},children:[r(U,{style:{color:"var(--destructive)"}}),r(m,{variant:"destructive",level:"small",children:t.error})]}):s(Y,{children:[f&&r("div",{style:{position:"absolute",top:4,left:4,padding:2,background:"rgba(0,0,0,0.5)",borderRadius:"var(--radius-sm)",display:"flex",zIndex:2,pointerEvents:"none"},children:r(de,{style:{color:"white",width:14,height:14}})}),r("img",{src:t.previewURL,alt:d("image.alt.upload",{index:h+1}),draggable:!1,onError:me,style:{width:"100%",height:"100%",objectFit:"cover",pointerEvents:"none",userSelect:"none"}}),r("button",{type:"button",onClick:u=>{u.stopPropagation(),v(t.id)},onPointerDown:u=>u.stopPropagation(),style:{position:"absolute",top:4,right:4,padding:4,background:"rgba(0,0,0,0.5)",border:"none",borderRadius:"var(--radius-sm)",cursor:"pointer",display:"flex",zIndex:2},children:r(U,{style:{color:"white",width:16,height:16}})}),!t.uploaded&&r("div",{style:{position:"absolute",bottom:0,left:0,right:0,padding:4,background:"rgba(0,0,0,0.7)",textAlign:"center",pointerEvents:"none"},children:r(m,{variant:"muted",level:"small",style:{color:"white"},children:d("image.upload.pending",{defaultValue:"Pending"})})})]})})}const V=ce(({name:t="image",label:h,value:f,onChange:C,error:v,helperText:d,multiple:i=!1,maxFiles:S=10,maxSize:D=10*1024*1024,storagePath:c,required:I,capture:b},y)=>{const{t:l}=he("crud"),n=pe(null),[u,F]=j(!1),[L,E]=j(0),N=re(A(Q,{activationConstraint:{distance:8}}),A(ee,{activationConstraint:{delay:200,tolerance:5}})),B=R(async(e,o)=>{const{fullBlob:p,thumbBlob:x}=await ve(e);return be(p,x,e.name,{storagePath:c,onProgress:w=>o(w.progress)})},[c]),{files:a,addFiles:P,removeFile:T,reorderFiles:z}=fe({name:t,value:f,onChange:C,multiple:i,maxFiles:S,maxSize:D,accept:xe,storagePath:c,uploadFn:B}),M=e=>{const o=Array.from(e.target.files||[]);o.length>0&&P(o),n.current&&(n.current.value="")},q=R(e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.files.length>0&&P(Array.from(e.dataTransfer.files))},[P]),G=R(e=>{const{active:o,over:p}=e;if(p&&o.id!==p.id){const x=a.findIndex(g=>g.id===o.id),w=a.findIndex(g=>g.id===p.id);if(x!==-1&&w!==-1){const g=ie(a.map(J=>J.id),x,w);z(g)}}},[a,z]),H=e=>{E(e),F(!0)},K=(e,o)=>{},O=e=>{const o=a[e];o&&T(o.id)},W=e=>{E(e)},X=i||a.length===0;ue(y,()=>({upload:async()=>{},focus:()=>n.current?.focus()}),[]);const $=a.map(we);return s(k,{gap:"tight",children:[s(m,{level:"body",textAlign:"start",children:[h,I&&"*"]}),X&&s("div",{role:"button",tabIndex:0,onClick:()=>n.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&n.current?.click()},onDragOver:e=>e.preventDefault(),onDrop:q,style:{border:`var(--border-width) dashed ${v?"var(--destructive)":"var(--border)"}`,borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:"var(--surface)",cursor:"pointer",textAlign:"center"},children:[r("input",{ref:n,type:"file",accept:"image/*",capture:b,multiple:i,style:{display:"none"},onChange:M}),s(k,{align:"center",children:[r(le,{style:{color:"var(--muted-foreground)"}}),r(m,{variant:"muted",level:"small",children:i?l("image.upload.dropzoneMultiple",{defaultValue:"Drop images here or click to upload"}):l("image.upload.dropzoneSingle",{defaultValue:"Drop image here or click to upload"})})]})]}),a.length>0&&r(Z,{sensors:N,collisionDetection:_,onDragEnd:G,children:r(te,{items:a.map(e=>e.id),strategy:ae,children:r("div",{style:{display:"flex",flexWrap:"wrap",gap:"var(--gap-md)"},children:a.map((e,o)=>r(ke,{file:e,index:o,multiple:i,onImageClick:H,onRemove:T,t:l},e.id))})})}),d&&r(m,{variant:v?"destructive":"muted",level:"small",children:d}),r(ye,{images:$,selectedIndex:L,open:u,onClose:()=>F(!1),onUpdate:K,onDelete:O,onNavigate:W,multiple:i})]})});V.displayName="ImageFieldComponent";var Ce=V;export{Ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Input as
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Input as v,Stack as p}from"@donotdev/components";import{useTranslation as g}from"@donotdev/core";const m=({label:n,value:d={},onChange:a,error:r,helperText:t,required:s})=>{const{t:l}=g("crud");return o(p,{gap:"tight",children:[o("div",{className:"dndev-surface","data-variant":r?"destructive":"default",style:{border:"1px solid",borderColor:r?"var(--destructive)":"var(--input)",borderRadius:"var(--radius-lg)",padding:"var(--gap-md)"},children:[e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",marginBottom:"var(--gap-md)"},children:"Map component placeholder"}),e(v,{label:n,type:"text",required:s,className:"dndev-w-full",placeholder:l("form.enterLocationData","Enter location data (JSON)"),value:JSON.stringify(d),onChange:i=>{try{const u=JSON.parse(i.target.value),c={target:{value:JSON.stringify(u)}};a(c)}catch{a({target:{value:"{}"}})}}})]}),t&&e("p",{style:{fontSize:"var(--font-size-xs)",color:r?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:t})]})};var f=m;export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a,jsxs as o,Fragment as q}from"react/jsx-runtime";import{useMemo as J,useId as M}from"react";import{Combobox as R,Tag as p,Stack as h}from"@donotdev/components";import{useTranslation as k}from"@donotdev/core";const d=4,v=3,B=({label:f,value:t=[],options:l,error:b,helperText:i,onChange:u,onBlur:S,required:x,className:y})=>{const{t:g}=k("crud"),m=M(),z=J(()=>l.map(e=>({value:String(e.value),label:e.label})),[l]),N=e=>{const r=Array.isArray(e)?e:[e],s={target:{value:JSON.stringify(r)}};u(s)},C=e=>{e||S?.()},O=e=>{const r=t.filter(c=>c!==e),s={target:{value:JSON.stringify(r)}};u(s)},n=!!b,A=`${m}-error`,T=`${m}-helper`,j=t.length>0?o(q,{children:[t.slice(0,t.length>d?v:d).map((e,r)=>{const s=l.find(c=>String(c.value)===e)?.label||e;return a(p,{size:"sm",onRemove:()=>O(e),children:s},r)}),t.length>d&&o(p,{size:"sm",variant:"outline",disabled:!0,children:["+",t.length-v," more"]})]}):void 0;return o(h,{gap:"tight",className:y,children:[a(R,{label:f,value:t,onValueChange:N,onOpenChange:C,placeholder:g("actions.selectOptions","Select options..."),emptyMessage:g("messages.noResults","No results found"),options:z,multiple:!0,required:x,variant:n?"destructive":void 0,chips:j}),n&&o(h,{id:A,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[a("span",{children:"\u26A0"}),i]}),i&&!n&&a("p",{id:T,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:i})]})};var I=B;export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as i}from"react/jsx-runtime";import{useState as y}from"react";import{Input as h,Button as b,Stack as d}from"@donotdev/components";import{useTranslation as x}from"@donotdev/core";const
|
|
1
|
+
"use client";import{jsx as n,jsxs as i}from"react/jsx-runtime";import{useState as y}from"react";import{Input as h,Button as b,Stack as d}from"@donotdev/components";import{useTranslation as x}from"@donotdev/core";const N=({label:m,value:o=[],onChange:l,className:c,required:p})=>{const{t:s}=x("crud"),[t,u]=y(""),g=()=>{if(t.trim()){const e=[...o,t.trim()],r={target:{value:JSON.stringify(e)}};l(r),u("")}},f=e=>{const r=o.filter((w,v)=>v!==e),a={target:{value:JSON.stringify(r)}};l(a)};return i(d,{className:c,children:[i(d,{direction:"row",align:"end",children:[n(h,{label:m,type:"text",value:t,onChange:e=>u(e.target.value),required:p,className:"dndev-flex-1",placeholder:s("form.typeAndPressAdd","Type and press Add...")}),n(b,{type:"button",onClick:g,disabled:!t.trim(),children:s("form.add","Add")})]}),n(d,{direction:"row",wrap:"wrap",children:o.map((e,r)=>i("span",{className:"dndev-surface","data-variant":"muted",style:{display:"inline-flex",alignItems:"center",gap:"var(--gap-sm)",padding:"var(--gap-sm) var(--gap-md)",fontSize:"var(--font-size-sm)",fontWeight:500,borderRadius:"var(--radius-lg)"},children:[e,n("button",{type:"button",onClick:()=>f(r),style:{color:"var(--muted-foreground)",marginInlineStart:"var(--gap-sm)"},onMouseEnter:a=>{a.currentTarget.style.color="var(--foreground)"},onMouseLeave:a=>{a.currentTarget.style.color="var(--muted-foreground)"},"aria-label":`${s("form.remove","Remove")} ${e}`,children:"\xD7"})]},r))})]})};var S=N;export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as v,jsxs as
|
|
1
|
+
import{jsx as v,jsxs as j}from"react/jsx-runtime";import{useState as q,useEffect as z,useCallback as f}from"react";import{Input as D,cn as E,Stack as I}from"@donotdev/components";import{useTranslation as L}from"@donotdev/core";const M=({label:b,value:l,onChange:i,error:g,helperText:c,min:x,max:y,step:N,disabled:s,required:S,className:h,mask:r="number",...F})=>{const{i18n:T}=L(),n=T?.language||(typeof navigator<"u"?navigator.language:"en-US"),u=f(e=>e==null||isNaN(e)?"":r==="currency"?e.toLocaleString(n,{minimumFractionDigits:2,maximumFractionDigits:2}):r==="mileage"?Math.round(e).toLocaleString(n):e.toString(),[r,n]),k=f(e=>{if(!e||e.trim()==="")return null;const t=new Intl.NumberFormat(n).formatToParts(1234.56),a=t.find(m=>m.type==="group")?.value||",",C=t.find(m=>m.type==="decimal")?.value||".";let o=e.replace(new RegExp(`\\${a}`,"g"),"");o=o.replace(C,"."),o=o.replace(/[^\d.\-]/g,"");const p=parseFloat(o);return isNaN(p)?null:p},[n]),[w,d]=q(()=>u(l));return z(()=>{d(u(l))},[l,u]),j(I,{gap:"tight",children:[v(D,{type:r==="number"?"number":"text",inputMode:r==="number"?void 0:"decimal",label:b,value:w,onChange:e=>{const t=e.target.value;if(d(t),r==="number"){const a=parseFloat(t);isNaN(a)?i(e):i({...e,target:{...e.target,value:a.toString()}})}else{const a=k(t);a!==null?i({...e,target:{...e.target,value:a.toString()}}):t===""&&i({...e,target:{...e.target,value:""}})}},min:x,max:y,step:N,disabled:s,required:S,className:E("dndev-w-full",h),"data-variant":g?"destructive":void 0,style:{opacity:s?"var(--opacity-muted)":void 0,cursor:s?"not-allowed":void 0},...F}),c&&v("p",{style:{fontSize:"var(--font-size-xs)",color:g?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:c})]})};var G=M;export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import{useId as i}from"react";import{PasswordInput as u,Stack as m}from"@donotdev/components";const
|
|
1
|
+
"use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import{useId as i}from"react";import{PasswordInput as u,Stack as m}from"@donotdev/components";const p=({label:o,value:s,onChange:t,error:n,helperText:e,...r})=>{const l=i();return d(m,{gap:"tight",children:[a(u,{id:l,value:s??"",onChange:t,label:o,className:"dndev-w-full",required:r.required,...r}),e&&a("p",{style:{fontSize:"var(--font-size-xs)",color:n?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:e})]})};var c=p;export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as i,jsxs as s}from"react/jsx-runtime";import{useState as
|
|
1
|
+
"use client";import{jsx as i,jsxs as s}from"react/jsx-runtime";import{useState as L,useMemo as m,useEffect as M,useId as O}from"react";import{Input as j,FloatingLabel as k,Button as q,BUTTON_VARIANT as E,DropdownMenu as U,Stack as f,cn as D}from"@donotdev/components";import{Flag as R,COUNTRIES as y}from"@donotdev/core";const V=({label:w,value:o="",onChange:C,error:N,helperText:g,required:S=!1,disabled:v=!1,defaultCountry:x="FR",showFlags:T=!0,preferredCountries:c,countries:h})=>{const d=O(),p=m(()=>h&&h.length>0?h.map(e=>y.find(r=>r.code===e)).filter(e=>e!==void 0):Array.from(y),[h]),n=m(()=>{if(!c||c.length===0)return p;const e=c.map(t=>p.find(B=>B.code===t)).filter(t=>t!==void 0),r=p.filter(t=>!c.includes(t.code));return[...e,...r]},[p,c]),u=m(()=>n.find(e=>e.code===x)||n[0]||y[0],[x,n]),{country:b,phoneNumber:$}=m(()=>{if(!o)return{country:u,phoneNumber:""};const e=n.find(t=>o.startsWith(t.dialCode));if(e){let t=o.slice(e.dialCode.length).trim();return t.startsWith("0")&&(t=t.slice(1).trim()),t=t.replace(/\s+/g," ").trim(),{country:e,phoneNumber:t}}if(o.startsWith("+"))return{country:u,phoneNumber:o};let r=o.trim();return r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim(),{country:u,phoneNumber:r}},[o,u,n]),[a,W]=L(u);M(()=>{b.code!==a.code&&W(b)},[b,a.code]);const z=$,A=e=>{W(e);let r=z;r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim();const t={target:{value:e.dialCode+(r?" "+r:"")}};C(t)},F=e=>{let r=e.target.value;r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim();const t={target:{value:a.dialCode+(r?" "+r:"")}};C(t)},I=n.map(e=>({label:e.dialCode,onClick:()=>A(e),checked:e.code===a.code,children:T?s(f,{direction:"row",align:"center",gap:"tight",children:[i(R,{code:e.flagCode,title:e.name}),i("span",{children:e.dialCode}),i("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-xs)"},children:e.name})]}):s("span",{children:[e.dialCode," ",e.name]})})),l=!!N;return s(f,{gap:"tight",children:[i(k,{htmlFor:d,label:w,disabled:v,required:S,children:s("div",{className:"dndev-relative",style:{display:"flex",gap:0},children:[i(U,{trigger:i(q,{type:"button",variant:E.GHOST,disabled:v,style:{minWidth:"fit-content",padding:"0 var(--gap-md)"},"aria-label":`Country code: ${a.dialCode}`,children:s(f,{direction:"row",align:"center",gap:"tight",children:[T&&i(R,{code:a.flagCode,title:a.name}),i("span",{children:a.dialCode})]})}),items:I,contentWidth:"16rem"}),i(j,{id:d,type:"tel",inputMode:"tel",value:z,onChange:F,disabled:v,placeholder:"6 12 34 56 78",bare:!0,"data-variant":l?"destructive":void 0,className:"dndev-flex-1",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderRadius:"0 var(--radius-md) var(--radius-md) 0"},"aria-describedby":D(l&&`${d}-error`,g&&!l&&`${d}-helper`),"aria-invalid":l})]})}),l&&s(f,{id:`${d}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[i("span",{children:"\u26A0"}),N]}),g&&!l&&i("p",{id:`${d}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:g})]})};var _=V;export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a,jsxs as u}from"react/jsx-runtime";import{CirclePlus as R,CircleMinus as U}from"lucide-react";import{useId as q,useState as z}from"react";import{Input as C,Checkbox as D,Stack as E,Select as A,CollapsiblePrimitive as B,CollapsibleTrigger as G,CollapsibleContent as H}from"@donotdev/components";import{useTranslation as J,getCurrencySymbol as L}from"@donotdev/core";const O=["EUR","USD","GBP","CHF","JPY","KRW"],Y=({label:f,value:n,onChange:I,error:s,helperText:g,required:P=!1,disabled:o=!1,placeholder:N="0",defaultCurrency:d="EUR",optionsTitle:x="Price options",currencies:b})=>{const c=q(),{t:p}=J("crud"),r=b?.length?b:[...O],h=n?.currency??d,m=r.includes(h)?h:r[0]??d,T=n?.vatIncluded??!0,y=n?.discountPercent??0,S=`${f} (${L(m)})`,i=e=>{const l=e.amount!==void 0?e.amount:n?.amount??null;let t=e.currency!==void 0?e.currency:n?.currency??d;r.includes(t)||(t=m);const F=e.vatIncluded!==void 0?e.vatIncluded:n?.vatIncluded??!0,M=e.discountPercent!==void 0?e.discountPercent:n?.discountPercent??0;I({amount:l===null?null:Number(l),currency:t,vatIncluded:F,discountPercent:Number(M)})},k=e=>{const l=e.target.value;if(l===""||l===null){i({amount:null});return}const t=parseFloat(l);i({amount:isNaN(t)?null:t})},V=e=>{i({currency:e||d})},$=e=>{const l=e.target.value;if(l===""||l===null){i({discountPercent:0});return}const t=parseFloat(l);i({discountPercent:isNaN(t)?0:t})},[v,j]=z(!1);return u(B,{open:v,onOpenChange:j,children:[u(E,{children:[u("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:"var(--gap-sm)",alignItems:"end"},children:[a(C,{id:c,type:"number",inputMode:"decimal",label:S,value:n?.amount!==void 0&&n?.amount!==null?n.amount:"",onChange:k,disabled:o,placeholder:N,required:P,min:0,step:.01,"data-variant":s?"destructive":void 0,"aria-invalid":s}),a(G,{asChild:!0,children:a("button",{type:"button","aria-label":x,"aria-expanded":v,className:"dndev-collapsible-trigger",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"var(--gap-sm)",background:"none",border:"none",cursor:"pointer"},children:v?a(U,{className:"dndev-collapsible-icon","aria-hidden":"true"}):a(R,{className:"dndev-collapsible-icon","aria-hidden":"true"})})})]}),a(H,{className:"dndev-collapsible-content",children:u("div",{style:{display:"grid",gridTemplateColumns:r.length>1?"1fr auto 1fr":"auto 1fr",gap:"var(--gap-sm)",alignItems:"end",paddingTop:"var(--gap-md)"},children:[r.length>1&&a(A,{value:m,onValueChange:V,placeholder:d,options:r.map(e=>({value:e,label:e})),disabled:o,label:p("price.currency",{defaultValue:"Currency"})}),a(D,{id:`${c}-vat`,label:p("price.vatIncluded",{defaultValue:"VAT Incl."}),checked:T,onCheckedChange:e=>i({vatIncluded:e===!0}),disabled:o}),a(C,{id:`${c}-discount`,type:"number",inputMode:"decimal",min:0,max:100,step:1,value:y===0?"":y,onChange:$,disabled:o,placeholder:"0",label:p("price.discountLabel",{defaultValue:"Discount (%)"})})]})})]}),g&&a("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)"},children:g})]})};var w=Y;export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as d}from"react/jsx-runtime";import{RadioGroup as f,Label as
|
|
1
|
+
import{jsx as e,jsxs as d}from"react/jsx-runtime";import{RadioGroup as f,Label as p,Stack as c}from"@donotdev/components";const v=({label:t,value:o,onChange:a,options:s,error:i,helperText:r,required:n})=>{const l=u=>{a({target:{value:u}})};return d(c,{gap:"tight",children:[e(p,{required:n,style:{display:"block",fontSize:"var(--font-size-input)",fontWeight:500},children:t}),e(f,{value:o,onValueChange:l,items:s}),r&&e("p",{style:{fontSize:"var(--font-size-xs)",color:i?"var(--destructive-foreground)":"var(--muted-foreground)"},children:r})]})};var h=v;export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Label as h,Slider as
|
|
1
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Label as h,Slider as b,Stack as d}from"@donotdev/components";const x=({label:t,value:i=0,onChange:u,error:n,helperText:s,min:r=0,max:c=100,step:v=1,disabled:o,required:m,showValue:f=!0})=>{const g=a=>{const p={target:{value:a.toString()}};u(p)};return l(d,{gap:"tight",children:[l(d,{direction:"row",justify:"between",align:"center",children:[e(h,{required:m,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:t}),f&&e("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:i})]}),e(b,{value:[i??r],onValueChange:([a])=>g(a??r),min:r,max:c,step:v,disabled:o,style:{borderColor:n?"var(--destructive)":void 0,opacity:o?"var(--opacity-muted)":void 0,cursor:o?"not-allowed":void 0},"aria-label":t}),s&&e("p",{style:{fontSize:"var(--font-size-xs)",color:n?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:s})]})};var y=x;export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as g}from"react/jsx-runtime";import{Label as
|
|
1
|
+
import{jsx as e,jsxs as g}from"react/jsx-runtime";import{Label as h,Rating as m,Stack as u}from"@donotdev/components";const v=({label:a,value:o=0,onChange:s,error:l,helperText:r,max:t=5,disabled:i,required:n,readonly:d,showValue:f=!1})=>g(u,{gap:"tight",children:[e(h,{required:n,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:a}),e(m,{value:o,onChange:s,max:t,disabled:i,readonly:d,showValue:f,"aria-label":a}),r&&e("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:r})]});var p=v;export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as d}from"react/jsx-runtime";import"lucide-react";import{useMemo as S,useId as A}from"react";import{Combobox as $,Stack as c}from"@donotdev/components";import{useTranslation as j}from"@donotdev/core";const q=({label:r,value:
|
|
1
|
+
import{jsx as t,jsxs as d}from"react/jsx-runtime";import"lucide-react";import{useMemo as S,useId as A}from"react";import{Combobox as $,Stack as c}from"@donotdev/components";import{useTranslation as j}from"@donotdev/core";const q=({label:r,value:s,onChange:p,options:i,isLoading:u=!1,error:f,helperText:o,required:h,onBlur:m,onCreate:I,placeholder:g})=>{const{t:l}=j("crud"),n=A(),v=S(()=>i.map(e=>({value:e.id,label:e.label,description:e.description})),[i]),b=e=>{const z=Array.isArray(e)?e[0]||"":e;p(z)},x=e=>{e||m?.()},a=!!f,y=`${n}-error`,C=`${n}-helper`;return d(c,{gap:"tight",children:[t($,{label:r,value:s||"",onValueChange:b,onOpenChange:x,placeholder:g||l("reference.placeholder",{label:r})||`Select ${r}`,emptyMessage:l("reference.noResults")||"No results found",options:v,required:h,variant:a?"destructive":void 0,isLoading:u,clearable:!!s}),a&&d(c,{id:y,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),o]}),o&&!a&&t("p",{id:C,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:o})]})};var L=q;export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import{lazy as m,Suspense as b,useState as f,useEffect as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import{lazy as m,Suspense as b,useState as f,useEffect as g}from"react";import{Stack as v}from"@donotdev/components";import h from"./TextAreaComponent";const p=m(()=>typeof window<"u"?import("./internal/TiptapEditor").catch(()=>({default:()=>null})):Promise.resolve({default:()=>null})),x=({label:l,value:a="",onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:i,className:u})=>{const[c,n]=f(!1);return g(()=>{n(!0)},[]),c?e(v,{gap:"tight",children:e(b,{fallback:e(h,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:i,className:u}),children:p?e(p,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:i,className:u}):e(h,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:i,className:u})})}):e(h,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:i,className:u})};var C=x;export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as
|
|
1
|
+
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{Switch as k,Text as l,Stack as n}from"@donotdev/components";const p=({label:a,checked:d=!1,onChange:c,uncheckedLabel:h,checkedLabel:s,helperText:t})=>{const i=o=>{c&&c({target:{checked:o}})};return e(n,{gap:"tight",children:[e(n,{direction:"row",align:"center",style:{flexWrap:"wrap"},children:[e(l,{level:"body",textAlign:"start",children:[a,":"]}),r(k,{checked:d,onCheckedChange:i,"aria-label":a,variant:"muted",uncheckedLabel:h,checkedLabel:s})]}),t&&r(l,{as:"p",variant:"muted",level:"small",children:t})]})};var g=p;export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import{useState as L,useId as N,useRef as F,useEffect as j}from"react";import{Textarea as q,FloatingLabel as A,Spinner as k,cn as m,Stack as p}from"@donotdev/components";const B=({label:x,value:o="",onChange:b,error:h,helperText:s,rows:y=3,loading:n=!1,maxLength:r,showCharCount:v=!1,autoResize:i=!1,required:z=!1,disabled:g=!1,className:w,...S})=>{const e=N(),[I,f]=L(!1),d=F(null),a=!!h,c=o.length,$=r&&c>r*.8,C=r&&c>r;return j(()=>{if(i&&d.current){const u=d.current;u.style.height="auto",u.style.height=`${u.scrollHeight}px`}},[o,i]),l(p,{gap:"tight",children:[t(A,{htmlFor:e,label:x,disabled:g||n,required:z,children:l("div",{className:"dndev-relative",children:[t(q,{ref:d,id:e,value:o,onChange:b,onFocus:()=>f(!0),onBlur:()=>f(!1),disabled:g||n,maxLength:r,rows:i?1:y,bare:!0,"aria-describedby":m(a&&`${e}-error`,s&&!a&&`${e}-helper`,v&&`${e}-count`),"aria-invalid":a,className:m("dndev-w-full",i&&"dndev-overflow-hidden",w),"data-variant":a?"destructive":void 0,style:{resize:i?"none":void 0},...S}),n&&t("div",{className:"dndev-absolute",style:{right:"var(--gap-md)",top:"var(--gap-md)"},children:t(k,{"aria-label":"Loading"})})]})}),v&&r&&l("div",{id:`${e}-count`,style:{fontSize:"var(--font-size-xs)",textAlign:"right",color:C?"var(--destructive-foreground)":$?"var(--warning)":"var(--muted-foreground)"},children:[c,"/",r]}),a&&l(p,{as:"p",id:`${e}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),h]}),s&&!a&&t("p",{id:`${e}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:s})]})};var E=B;export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as o}from"react/jsx-runtime";import{useId as
|
|
1
|
+
"use client";import{jsx as n,jsxs as o}from"react/jsx-runtime";import{useId as C}from"react";import{Input as S,cn as c,Stack as u}from"@donotdev/components";function j({label:h,value:d="",onChange:v,error:l,helperText:a,type:f="text",loading:g=!1,maxLength:r,showCharCount:s=!1,required:p=!1,disabled:m=!1,className:x,ref:z,...$}){const e=C(),t=!!l,i=d.length,b=r&&i>r*.8,y=r&&i>r,{children:A,...w}=$;return o(u,{gap:"tight",children:[n(S,{ref:z,id:e,type:f,value:d,onChange:v,label:h,disabled:m||g,maxLength:r,required:p,"aria-describedby":c(t&&`${e}-error`,a&&!t&&`${e}-helper`,s&&`${e}-count`),"aria-invalid":t,className:c("dndev-w-full",x),"data-variant":t?"destructive":void 0,...w}),s&&r&&o("div",{id:`${e}-count`,style:{fontSize:"var(--font-size-xs)",textAlign:"right",color:y?"var(--destructive-foreground)":b?"var(--warning)":"var(--muted-foreground)"},children:[i,"/",r]}),t&&o(u,{id:`${e}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[n("span",{children:"\u26A0"}),l]}),a&&!t&&n("p",{id:`${e}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:a})]})}var q=j;export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import d from"./DateFieldComponent";const g=({label:a,value:e,onChange:r,error:o,helperText:l,mode:n="datetime-local",required:u})=>{const i=e?new Date(e).toISOString():"";return s(d,{label:a,value:i,onChange:t=>{if(t){const m={target:{value:new Date(t).toISOString()}};r(m)}else r({target:{value:""}})},error:o,helperText:l,mode:n,required:u})};var p=g;export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"./AvatarFieldComponent";import{default as t}from"./BadgeFieldComponent";import{default as e}from"./TextFieldComponent";import{default as a}from"./NumberFieldComponent";import{default as m}from"./DateFieldComponent";import{default as
|
|
1
|
+
import{default as o}from"./AvatarFieldComponent";import{default as t}from"./BadgeFieldComponent";import{default as e}from"./TextFieldComponent";import{default as a}from"./NumberFieldComponent";import{default as m}from"./DateFieldComponent";import{default as r}from"./CheckboxFieldComponent";import{default as n}from"./ComboboxComponent";import{default as p}from"./DropdownComponent";import{default as s}from"./MultiDropdownComponent";import{default as i}from"./FileFieldComponent";import{default as d}from"./ImageFieldComponent";import{default as f}from"./DocumentFieldComponent";import{default as l}from"./TextAreaComponent";import{default as u}from"./SwitchFieldComponent";import{default as C}from"./RadioFieldComponent";import{default as F}from"./RangeFieldComponent";import{default as T}from"./RatingFieldComponent";import{default as R}from"./DurationFieldComponent";import{DURATION_PRESETS as x}from"./DurationFieldComponent";import{default as D}from"./PhoneNumberComponent";import{default as c}from"./GeoPointFieldComponent";import{default as P}from"./MapFieldComponent";import{default as b}from"./TimestampFieldComponent";import{default as A}from"./MultiInputTextFieldComponent";import{default as S}from"./ButtonFieldComponent";import{default as g}from"./HiddenFieldComponent";import{default as h}from"./PasswordFieldComponent";import{default as w}from"./AddressFieldComponent";import{default as E}from"./CurrencyFieldComponent";import{default as I}from"./PriceFieldComponent";import{default as N}from"./RichTextComponent";import{default as M}from"./GdprConsentFieldComponent";export{w as AddressFieldComponent,o as AvatarFieldComponent,t as BadgeFieldComponent,S as ButtonFieldComponent,r as CheckboxFieldComponent,n as ComboboxComponent,E as CurrencyFieldComponent,x as DURATION_PRESETS,m as DateFieldComponent,f as DocumentFieldComponent,p as DropdownComponent,R as DurationFieldComponent,i as FileFieldComponent,M as GdprConsentFieldComponent,c as GeoPointFieldComponent,g as HiddenFieldComponent,d as ImageFieldComponent,P as MapFieldComponent,s as MultiDropdownComponent,A as MultiInputTextFieldComponent,a as NumberFieldComponent,h as PasswordFieldComponent,D as PhoneNumberComponent,I as PriceFieldComponent,C as RadioFieldComponent,F as RangeFieldComponent,T as RatingFieldComponent,N as RichTextComponent,u as SwitchFieldComponent,l as TextAreaComponent,e as TextFieldComponent,b as TimestampFieldComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{jsx as i,jsxs as
|
|
1
|
+
"use client";import{jsx as i,jsxs as m}from"react/jsx-runtime";import{useEffect as u,useState as f}from"react";import{Stack as M}from"@donotdev/components";const x=({label:s,value:r="",onChange:d,error:e,helperText:n,required:o,disabled:a,placeholder:l,className:c,modules:g})=>{const{useEditor:v,EditorContent:p,StarterKit:h,Placeholder:b}=g,t=v({extensions:[h.configure({heading:{levels:[1,2,3]}}),b.configure({placeholder:l||"Start typing..."})],content:r,editable:!a,onUpdate:({editor:P})=>{const y={target:{value:P.getHTML()}};d(y)}});return u(()=>{t&&r!==t.getHTML()&&t.commands.setContent(r||"")},[r,t]),t?m(M,{gap:"tight",children:[m("label",{style:{fontSize:"var(--font-size-sm)",fontWeight:500,color:e?"var(--destructive-foreground)":"var(--foreground)"},children:[s,o&&i("span",{style:{color:"var(--destructive)"},children:" *"})]}),i("div",{className:c,"data-variant":e?"destructive":void 0,style:{border:"var(--border-hairline) solid",borderColor:e?"var(--destructive)":"var(--line-2)",borderRadius:"var(--radius-interactive)",padding:"var(--gap-md)",minHeight:"200px",backgroundColor:a?"var(--muted)":"transparent",opacity:a?"var(--opacity-muted)":void 0},children:i(p,{editor:t})}),n&&i("p",{style:{fontSize:"var(--font-size-xs)",color:e?"var(--destructive-foreground)":"var(--muted-foreground)"},children:n}),i("style",{children:`
|
|
2
2
|
.ProseMirror {
|
|
3
3
|
outline: none;
|
|
4
4
|
min-height: 150px;
|
|
@@ -49,4 +49,4 @@
|
|
|
49
49
|
margin: 0.5em 0;
|
|
50
50
|
color: var(--muted-foreground);
|
|
51
51
|
}
|
|
52
|
-
`})]}):null},z=
|
|
52
|
+
`})]}):null},z=s=>{const[r,d]=f(null),[e,n]=f(!1);return u(()=>{r||e||(async()=>{try{const[{useEditor:o,EditorContent:a},l,c]=await Promise.all([import("@tiptap/react"),import("@tiptap/starter-kit"),import("@tiptap/extension-placeholder")]);d({useEditor:o,EditorContent:a,StarterKit:l.default,Placeholder:c.default})}catch(o){o instanceof Error&&(o.message.includes("Cannot find module '@tiptap")||o.message.includes("Failed to fetch dynamically imported module")),n(!0)}})()},[r,e]),e||!r?null:i(x,{...s,modules:r})};var C=z;export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as re,jsxs as a}from"react/jsx-runtime";import{ChevronLeft as
|
|
1
|
+
"use client";import{jsx as e,Fragment as re,jsxs as a}from"react/jsx-runtime";import{ChevronLeft as ne,ChevronRight as le,RotateCcw as M,RotateCw as B,Trash2 as de,Check as ce,Undo2 as se,ZoomIn as ge,ZoomOut as me,Maximize2 as pe,Grid3X3 as he}from"lucide-react";import{useCallback as g,useEffect as H,useState as c,useRef as ue}from"react";import ve from"react-easy-crop";import{Button as o,BUTTON_VARIANT as r,Sheet as fe,Stack as l,Text as u,Slider as F,ToggleGroup as ye}from"@donotdev/components";import{useTranslation as we}from"@donotdev/core";import{processImage as Ce}from"../../../utils/imageProcessing";import{createPreviewURL as be,revokePreviewURL as ke}from"../../../utils/imageUtils";const xe={free:void 0,"1:1":1,"4:3":4/3,"16:9":16/9,"3:2":3/2};function Y({images:h,selectedIndex:n,open:T,onClose:U,onUpdate:Z,onDelete:E,onNavigate:m,multiple:L=!1}){const{t}=we("crud"),[D,C]=c({x:0,y:0}),[v,p]=c(1),[b,f]=c(0),[N,$]=c(null),[S,z]=c("free"),[k,q]=c(!0),[y,w]=c(!1),[A,G]=c(!1),[X,x]=c(!1),I=ue({crop:{x:0,y:0},zoom:1,rotation:0}),d=h[n],R=L&&n>0,O=L&&n<h.length-1;H(()=>{if(d){const i={x:0,y:0};C(i),p(1),f(d.rotation*90),z("free"),w(!1),x(!1),I.current={crop:i,zoom:1,rotation:d.rotation*90}}},[d]);const _=g((i,s)=>{$(s)},[]),J=g(()=>{C(I.current.crop),p(I.current.zoom),f(I.current.rotation)},[]),P=g(()=>{f(i=>(i-90+360)%360)},[]),V=g(()=>{f(i=>(i+90)%360)},[]),K=g(()=>{p(i=>Math.min(i+.25,3))},[]),Q=g(()=>{p(i=>Math.max(i-.25,1))},[]),ee=g(()=>{p(1),C({x:0,y:0})},[]),ie=async()=>{if(!(!d||!N)){G(!0);try{const i=await Ce(d.file,{crop:N,maxWidth:2048,maxHeight:2048,quality:.95}),s=new File([i.fullBlob],d.file.name,{type:"image/webp"}),oe=be(s);d.previewURL.startsWith("blob:")&&ke(d.previewURL),Z(n,{file:s,previewURL:oe,uploaded:null,uploadProgress:null,error:null,rotation:0}),w(!1)}catch{}finally{G(!1)}}},te=g(()=>{E(n),x(!1),h.length===1?U():n>=h.length-1&&m(n-1)},[n,h.length,E,U,m]);if(H(()=>{if(!T)return;const i=s=>{s.key==="ArrowLeft"&&R?m(n-1):s.key==="ArrowRight"&&O?m(n+1):s.key==="Escape"&&y&&w(!1)};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[T,R,O,n,m,y]),!d)return null;const W=d.uploadProgress!==null&&d.uploadProgress<100,j=d.uploaded?.fullUrl||d.previewURL,ae=L?t("image.editor.titleWithIndex",{current:n+1,total:h.length}):t("image.editor.title");return e(fe,{open:T,onOpenChange:i=>!i&&U(),side:"right",title:ae,description:t("image.editor.description"),noSwipe:y,children:a(l,{gap:"large",style:{height:"100%"},children:[e("div",{style:{position:"relative",flex:1,minHeight:300,backgroundColor:"var(--surface-muted)",borderRadius:"var(--radius-lg)",overflow:"hidden"},children:y?e(ve,{image:j,crop:D,zoom:v,rotation:b,aspect:xe[S],onCropChange:C,onCropComplete:_,onZoomChange:p,showGrid:k,style:{containerStyle:{position:"absolute",top:0,left:0,right:0,bottom:0},cropAreaStyle:{border:"2px solid var(--primary)",boxShadow:"0 0 0 9999px rgba(0,0,0,0.5)"}}}):a(re,{children:[R&&e(o,{variant:r.GHOST,icon:ne,onClick:()=>m(n-1),"aria-label":t("image.editor.previousImage"),style:{position:"absolute",left:"var(--gap-sm)",top:"50%",transform:"translateY(-50%)",zIndex:10,backgroundColor:"rgba(0,0,0,0.3)",color:"white"}}),e("img",{src:j,alt:`Image ${n+1}`,style:{width:"100%",height:"100%",objectFit:"contain",transform:`rotate(${b}deg)`,transition:"transform var(--dur-normal) var(--ease-out)"}}),O&&e(o,{variant:r.GHOST,icon:le,onClick:()=>m(n+1),"aria-label":t("image.editor.nextImage"),style:{position:"absolute",right:"var(--gap-sm)",top:"50%",transform:"translateY(-50%)",zIndex:10,backgroundColor:"rgba(0,0,0,0.3)",color:"white"}})]})}),y?a(l,{children:[a(l,{gap:"tight",children:[e(u,{level:"small",variant:"muted",children:t("image.editor.aspectRatio")}),e(ye,{type:"single",value:S,onValueChange:i=>i&&z(i),items:[{value:"free",label:t("image.editor.aspectFree")},{value:"1:1",label:"1:1"},{value:"4:3",label:"4:3"},{value:"16:9",label:"16:9"}]})]}),a(l,{gap:"tight",children:[a(l,{direction:"row",justify:"between",align:"center",children:[e(u,{level:"small",variant:"muted",children:t("image.editor.zoom")}),a(u,{level:"small",variant:"muted",children:[Math.round(v*100),"%"]})]}),a(l,{direction:"row",gap:"tight",align:"center",children:[e(o,{variant:r.OUTLINE,icon:me,display:"compact",onClick:Q,disabled:v<=1}),e(F,{value:[v],min:1,max:3,step:.05,onValueChange:i=>p(i[0]??1),style:{flex:1}}),e(o,{variant:r.OUTLINE,icon:ge,display:"compact",onClick:K,disabled:v>=3})]})]}),a(l,{gap:"tight",children:[a(l,{direction:"row",justify:"between",align:"center",children:[e(u,{level:"small",variant:"muted",children:t("image.editor.rotation")}),a(u,{level:"small",variant:"muted",children:[b,"\xB0"]})]}),a(l,{direction:"row",gap:"tight",align:"center",children:[e(o,{variant:r.OUTLINE,icon:M,display:"compact",onClick:P,tooltip:t("image.editor.rotateLeft")}),e(F,{value:[b],min:0,max:360,step:1,onValueChange:i=>f(i[0]??0),style:{flex:1}}),e(o,{variant:r.OUTLINE,icon:B,display:"compact",onClick:V,tooltip:t("image.editor.rotateRight")})]})]}),a(l,{direction:"row",gap:"tight",children:[e(o,{variant:r.OUTLINE,icon:pe,display:"compact",onClick:ee,tooltip:t("image.editor.fitToView")}),e(o,{variant:r.OUTLINE,icon:he,display:"compact",onClick:()=>q(!k),tooltip:t(k?"image.editor.hideGrid":"image.editor.showGrid"),"data-active":k||void 0}),e(o,{variant:r.OUTLINE,icon:se,display:"compact",onClick:J,tooltip:t("image.editor.reset")})]}),a(l,{direction:"row",style:{marginTop:"var(--gap-md)"},children:[e(o,{variant:r.OUTLINE,onClick:()=>w(!1),fullWidth:!0,children:t("image.editor.cancel")}),e(o,{variant:r.PRIMARY,icon:ce,onClick:ie,disabled:A,fullWidth:!0,children:t(A?"image.editor.processing":"image.editor.apply")})]})]}):a(l,{children:[a(l,{direction:"row",gap:"tight",justify:"center",children:[e(o,{variant:r.OUTLINE,icon:M,display:"compact",onClick:P,tooltip:t("image.editor.rotateLeft")}),e(o,{variant:r.PRIMARY,onClick:()=>w(!0),disabled:W,children:t("image.editor.editButton")}),e(o,{variant:r.OUTLINE,icon:B,display:"compact",onClick:V,tooltip:t("image.editor.rotateRight")})]}),X?a(l,{style:{border:"1px solid var(--destructive)",padding:"var(--gap-md)",borderRadius:"var(--radius-md)"},children:[e(u,{variant:"destructive",level:"small",textAlign:"center",children:t("image.editor.deleteConfirm")}),a(l,{direction:"row",gap:"tight",children:[e(o,{variant:r.OUTLINE,onClick:()=>x(!1),fullWidth:!0,children:t("image.editor.cancel")}),e(o,{variant:r.DESTRUCTIVE,onClick:te,fullWidth:!0,children:t("actions.delete")})]})]}):e(o,{variant:r.GHOST,icon:de,onClick:()=>x(!0),disabled:W,style:{color:"var(--destructive)"},children:t("image.editor.deleteImage")})]})]})})}var Ie=Y;export{Y as ImageViewerDialog,Ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import{createContext as n,useContext as i}from"react";const e=n(void 0);function s({formId:
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{createContext as n,useContext as i}from"react";const e=n(void 0);function s({formId:o,children:r}){return t(e.Provider,{value:o,children:r})}function a(){return i(e)}export{s as UploadProvider,a as useUploadContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{getGlobalSingleton as
|
|
1
|
+
"use client";import{getGlobalSingleton as n}from"@donotdev/core";import{getFieldRegistry as i}from"./FieldRegistry";function r(){return n("field-type-metadata",()=>({registry:new Map,builtinsRegistered:!1,initFn:null}))}function a(t){r().initFn=t}function e(){const t=r();return t.builtinsRegistered||(t.builtinsRegistered=!0,t.initFn?.(t.registry)),t.registry}function s(t){return e().get(t)}function l(t){return i().getFilterType(t)||e().get(t)?.filterType}function g(t){return i().getDisplayFormatter(t)||e().get(t)?.displayFormatter}function u(t){return i().isFilterable(t)?!0:e().get(t)?.filterable??!1}function o(t){return e().get(t)?.valueType}function y(){e().clear()}export{y as clearFieldTypeRegistry,g as getDisplayFormatter,s as getFieldTypeMetadata,l as getFilterType,e as getMetadataRegistry,o as getValueType,u as isFilterable,a as setRegistrationInit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useController as
|
|
1
|
+
"use client";import{useController as o}from"react-hook-form";function e(r){return o(r)}export{e as useController};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useMemo as o,useCallback as p}from"react";import{useController as v}from"./useController";import{formatValue as h}from"../../components/DisplayFieldRenderer";import{isFieldEditable as
|
|
1
|
+
"use client";import{useMemo as o,useCallback as p}from"react";import{useController as v}from"./useController";import{formatValue as h}from"../../components/DisplayFieldRenderer";import{isFieldEditable as g}from"../utils";function D(s,e){const{entity:b,operation:r,viewerRole:d,fields:u}=s,l=b.fields[e],i=o(()=>l?{...l,name:l.name||e,label:l.label||e}:{name:e,type:"text",label:e,visibility:"user"},[e,l]),a=o(()=>u.some(n=>n.name===e),[u,e]),c=o(()=>!a||r==="edit"&&i.visibility==="technical"&&i.editable===void 0?!1:g(i.editable,d,r),[a,r,i.visibility,i.editable,d]),{field:m,fieldState:t}=v({name:e,control:s.control}),f=o(()=>({error:t.error?.message,touched:t.isTouched,isDirty:t.isDirty}),[t.error?.message,t.isTouched,t.isDirty]),y=p(n=>h(m.value,i,s.t,n),[m.value,i,s.t]);return{field:m,meta:f,config:i,isEditable:c,isVisible:a,display:y}}export{D as useEntityField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{valibotResolver as B}from"@hookform/resolvers/valibot";import{useMemo as C,useEffect as
|
|
1
|
+
"use client";import{valibotResolver as B}from"@hookform/resolvers/valibot";import{useMemo as C,useEffect as T,useRef as y,createElement as ce}from"react";import{useForm as fe}from"react-hook-form";import{toast as G,ToastAction as de}from"@donotdev/components";import{BACKEND_GENERATED_FIELD_NAMES as me,createSchemas as ge}from"@donotdev/core";import{useFormStore as d,useFormStatus as pe,useUploadProgress as be}from"../../stores";import{useUploadStore as w}from"../../stores/UploadStore";import{checkForBlobUrls as Se,isStorageUrl as ye}from"../../utils/uploadValidation";import{getFieldsForOperation as he}from"../utils";import{buildInitialFromRecord as ve,buildSchemaDefaults as Ee}from"../utils/buildInitialValues";const je=t=>t;function K(t,f){const e={...t};for(const b of Object.keys(f)){const l=t[b],h=f[b];h!==null&&typeof h=="object"&&!Array.isArray(h)&&l!==null&&typeof l=="object"&&!Array.isArray(l)?e[b]=K(l,h):e[b]=h}return e}function L(t){if(t==null)return t;if(typeof t=="string")return t.startsWith("blob:")?null:t;if(Array.isArray(t)){const f=t.map(L).filter(e=>e!==null);return f.length>0?f:null}if(typeof t=="object"){const f=t;if("fullUrl"in f&&typeof f.fullUrl=="string")return ye(f.fullUrl)?f:null;const e={};for(const[b,l]of Object.entries(f))e[b]=L(l);return e}return t}function De(t,f={}){const{formId:e,operation:b,defaultValues:l,viewerRole:h,mode:W="onBlur",t:Y,loading:F=!1}=f,S=Y??je,N=h??"guest",c=b??(l?"edit":"create"),H=pe(e??""),J=be(e??""),$=C(()=>ge(t),[t.name]),Q=C(()=>{const r=B($.create),o=B($.draft),n=B($.update);return async(a,s,i)=>c==="edit"?n(a,s,i):(a?.status??l?.status??"draft")==="draft"?o(a,s,i):r(a,s,i)},[$,c,l?.status]),A=C(()=>Ee(t),[t]),U=l,m=C(()=>{if(!F)return c==="edit"?U?ve(t,U):void 0:U?{...A,...U}:A},[F,c,A,t,U]),u=fe({defaultValues:c==="create"?m:void 0,mode:W,resolver:Q,shouldUnregister:!1,shouldFocusError:!0}),E=y(u);T(()=>{E.current=u},[u]);const I=y(null);T(()=>{if(c==="edit"&&m){const r=m.id??null;r&&r!==I.current?(E.current.reset(m),I.current=r):!r&&I.current===null&&(E.current.reset(m),I.current="initialized")}},[c,m]);const k=l?.id,x=`${t.name.toLowerCase()}-form-draft`,v=c==="create"?x:k?`${x}-${k}`:`${x}-edit`,j=y(!1),_=y(F);_.current&&!F&&(j.current=!1),_.current=F,T(()=>{if(j.current)return;const r=d.getState().loadDraft(v),o=n=>{const a=()=>{d.getState().clearDraft(v),n&&E.current.reset(n)};G({toastType:"info",title:S("draft.restored",{defaultValue:"Draft restored"}),description:S("draft.restoredDescription",{defaultValue:"Your unsaved changes were recovered"}),action:ce(de,{altText:S("draft.discard",{defaultValue:"Discard"}),onClick:a},S("draft.discard",{defaultValue:"Discard"})),duration:8e3})};if(c==="create"&&!l){r&&(u.reset(r.data),o(A)),j.current=!0;return}if(c==="edit"&&m){if(r){const n=K(m,r.data);u.reset(n),o(m)}j.current=!0}},[c,l,v,u,m,S,A]);const P=y(!1),V=y(null);T(()=>{const r=u.watch(o=>{P.current||!j.current||(V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{if(o&&Object.values(o).some(n=>n!=null&&n!=="")){const n=L(o);d.getState().saveDraft(v,n,t.name,k)}},3e3))});return()=>{r.unsubscribe(),V.current&&clearTimeout(V.current)}},[u,v,t.name,k]);const D=y(null),O=y(!1),X=async r=>{if(!e)return{};const o=w.getState(),n=d.getState();if(!o.hasPendingUploads(e))return{};const a=setInterval(()=>{const s=w.getState().getTotalProgress(e);d.getState().setUploading(e,s)},200);try{return n.setUploading(e,0),await o.uploadAll(e,r),r?.aborted?null:w.getState().getResults(e)}catch(s){const i=w.getState().uploads[e];i&&Object.entries(i).forEach(([g,R])=>{R.status==="error"&&R.error&&u.setError(g,{type:"upload",message:R.error})});const p=s instanceof Error?s.message:"File upload failed";return d.getState().setError(e,p),null}finally{clearInterval(a)}},Z=r=>c!=="create"?r:Object.fromEntries(Object.entries(r).filter(([o])=>!me.includes(o))),ee=(r,o)=>{const n={...o};for(const[a,s]of Object.entries(r.fields))if(s.type==="price"&&a in n){const i=n[a];(i==null||i.amount==null)&&(n[a]=null)}return n},te=r=>{if(typeof window>"u")return;const o=Object.keys(r).find(a=>a!=="root"&&r[a]);if(!o)return;const n=document.querySelector(`input[name="${o}"][aria-invalid="true"], textarea[name="${o}"][aria-invalid="true"], select[name="${o}"][aria-invalid="true"]`)??document.querySelector(`[name="${o}"]`);n&&(n.scrollIntoView({behavior:"smooth",block:"center"}),n.focus())},re=u.handleSubmit,ae=((r,o)=>async n=>{if(n?.preventDefault?.(),O.current)return;const a=e?d.getState():null;await re(async(s,i)=>{if(O.current)return;O.current=!0,D.current?.abort();const p=new AbortController;D.current=p,P.current=!0;try{e&&a&&a.startSubmit(e);const g=await X(p.signal);if(g===null||p.signal.aborted)return;e&&a&&a.setSubmitting(e);const R={...s,...g},ue=Z(R),M=ee(t,ue),z=Se(M);if(z.length>0){const le=`Cannot save: blob URLs detected at ${z.join(", ")}. Re-upload the files.`;e&&a&&a.setError(e,le);return}if(p.signal.aborted)return;await r(M,i),d.getState().clearDraft(v),E.current.reset(E.current.getValues()),e&&a&&a.setSuccess(e)}catch(g){throw e&&a&&a.setError(e,g instanceof Error?g.message:"Submission failed"),g}finally{if(P.current=!1,O.current=!1,D.current===p&&(D.current=null),e){const g=d.getState().forms[e]?.status;(g==="uploading"||g==="validating"||g==="submitting")&&d.getState().reset(e)}}},s=>{const i=Object.keys(s).filter(p=>p!=="root"&&s[p]);G({toastType:"error",title:S("validation.failed",{defaultValue:"Validation failed"}),description:S("validation.fixErrorsCount",{count:i.length,fields:i.join(", "),defaultValue:`${i.length} field(s) need attention: ${i.join(", ")}`}),duration:8e3}),te(s),o?.(s)})(n)}),ne=()=>{d.getState().clearDraft(v),u.reset(m),j.current=!1},q=()=>{D.current?.abort(),e&&(d.getState().cleanup(e),w.getState().cleanup(e))};T(()=>q,[]);const oe=()=>{D.current?.abort(),e&&(w.getState().abortAll(e),d.getState().reset(e)),O.current=!1},se=he(t,{operation:c,viewerRole:N,availableFields:void 0}),ie=u.formState.isSubmitted||Object.keys(u.formState.touchedFields||{}).length>0;return{...u,handleSubmit:ae,fields:se,operation:c,entity:t,t:S,viewerRole:N,formId:e,formStatus:e?H:"idle",uploadProgress:e?J:0,cleanup:q,cancel:oe,isDirty:u.formState.isDirty,hasUserInteracted:ie,resetForm:ne,originalValues:m}}export{De as useEntityForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function s(i,p){if(p in i)return i[p];const c=p.replace(/_([a-z])/g,(t,n)=>n.toUpperCase());if(c!==p&&c in i)return i[c]}function u(i,p){if(p in i)return!0;const c=p.replace(/_([a-z])/g,(t,n)=>n.toUpperCase());return c!==p&&c in i}function l(i,p){const c=p??{},t={...c};return Object.entries(i.fields).forEach(([n,e])=>{const r=s(t,n);r!==void 0&&!(n in t)&&(t[n]=r);const a=!u(c,n)||r===null||r===void 0;if(n==="status"&&a)t[n]="draft";else if(e.type==="switch"){if(r==null){const o=e.options?.fieldSpecific;t[n]=o?.uncheckedValue??!1}}else a&&(e.type==="price"?t[n]=null:e.type==="checkbox"||e.type==="boolean"?t[n]=!1:e.type==="text"||e.type==="textarea"||e.type==="email"||e.type==="url"||e.type==="tel"||e.type==="iban"||e.type==="password"||e.type==="color"?t[n]="":(e.type==="number"||e.type==="range"||e.type==="rating")&&(t[n]=void 0))}),t}function f(i){return l(i,{})}export{l as buildInitialFromRecord,f as buildSchemaDefaults};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EDITABLE as
|
|
1
|
+
import{EDITABLE as i,hasRoleAccess as t}from"@donotdev/core";function r(e,o,s){return e===void 0||e===!0?!0:e===!1||e===i.GENERATED||e===i.COMPUTED?!1:e===i.CREATE_ONLY?s==="create":typeof e=="string"?t(o,e):!0}export{r as isFieldEditable};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function r(n,s){if(typeof n=="string"&&n.includes(":")){const a=n.split(":"),t=a[1]??n,i=a[0];if(t.startsWith("status.")){const l=s(t);return l!==t&&l!==`${i}:${t}`?l:s(t,{ns:i})}return s(t,{ns:i})}return s(n)}function e(n,s,a){const t=s?.label||n;return r(t,a)}export{e as translateFieldLabel,r as translateLabel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as o from"valibot";import{createSchemas as
|
|
1
|
+
import*as o from"valibot";import{createSchemas as p}from"@donotdev/core";function i(t,r,c="create"){const e=p(t),u={create:e.create,draft:e.draft,update:e.update,full:e.get}[c],s=o.safeParse(u,r);return s.success?{success:!0,data:s.output}:{success:!1,issues:s.issues.map(a=>({path:a.path?.map(m=>m.key).join(".")||"",message:a.message}))}}export{i as validateEntity};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as o}from"react";import{useCrudStore as s}from"../CrudStore";const c={};function u(
|
|
1
|
+
import{useCallback as o}from"react";import{useCrudStore as s}from"../CrudStore";const c={};function u(i){const{collection:t}=i;s.getState().collections[t]?.ui?.filters||s.getState().getFilters(t);const r=s(e=>e.collections[t]?.ui?.filters??c),l=o(e=>{s.getState().setFilters(t,e)},[t]),n=s(e=>e.collections[t]?.ui?.showFavoritesOnly??!1),a=o(e=>{s.getState().setShowFavoritesOnly(t,e)},[t]);return{filters:r,setFilters:l,showFavoritesOnly:n,setShowFavoritesOnly:a}}export{u as useCrudFilters};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCrudStore as i}from"../CrudStore";const s=12;function S(
|
|
1
|
+
import{useCrudStore as i}from"../CrudStore";const s=12;function S(o){const{collection:t,defaultPageSize:a=s}=o;return{pageSize:i(e=>e.collections[t]?.ui?.pageSize??a),setPageSize:e=>{i.getState().setPageSize(t,e)}}}export{S as useCrudPageSize};
|