@donotdev/crud 0.0.13 → 0.0.14
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/components/DateFilter.d.ts +30 -0
- package/dist/components/DateFilter.d.ts.map +1 -0
- package/dist/components/DateFilter.js +1 -0
- package/dist/components/EntityDisplayRenderer.js +1 -1
- package/dist/components/EntityFilters.d.ts +28 -15
- package/dist/components/EntityFilters.d.ts.map +1 -1
- package/dist/components/EntityFilters.js +1 -1
- package/dist/components/FormLayout.js +1 -1
- package/dist/components/fields/display/FileFieldDisplay.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/PasswordFieldDisplay.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/DocumentFieldComponent.js +1 -1
- package/dist/components/form/fields/DurationFieldComponent.d.ts.map +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/GeoPointFieldComponent.js +1 -1
- package/dist/components/form/fields/ImageFieldComponent.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/PhoneNumberComponent.d.ts.map +1 -1
- package/dist/components/form/fields/PriceFieldComponent.js +1 -1
- package/dist/components/form/fields/SwitchFieldComponent.js +1 -1
- package/dist/components/form/internal/ImageViewerDialog.js +1 -1
- package/dist/forms/hooks/useEntityForm.d.ts.map +1 -1
- package/dist/forms/utils/getFieldsForOperation.d.ts.map +1 -1
- package/dist/forms/utils/translateFieldLabel.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useCrudFilters.d.ts +32 -0
- package/dist/hooks/useCrudFilters.d.ts.map +1 -0
- package/dist/hooks/useCrudFilters.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/registerBuiltinFieldTypes.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type DateFilterValue = {
|
|
2
|
+
min?: string;
|
|
3
|
+
max?: string;
|
|
4
|
+
};
|
|
5
|
+
export interface DateFilterProps {
|
|
6
|
+
/** Field label */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Field type */
|
|
9
|
+
fieldType: 'date' | 'week' | 'month' | 'year';
|
|
10
|
+
/** Current filter value (range format: { min?: string; max?: string }) */
|
|
11
|
+
value?: DateFilterValue;
|
|
12
|
+
/** Callback when filter value changes */
|
|
13
|
+
onChange: (value: DateFilterValue | undefined) => void;
|
|
14
|
+
/** Translation function for CRUD namespace */
|
|
15
|
+
tCrud: (key: string, opts?: {
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
}) => string;
|
|
18
|
+
/** Current locale for date formatting */
|
|
19
|
+
locale?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* DateFilter - Simple date filter component
|
|
23
|
+
* Uses open-ended From/To range which covers all use cases:
|
|
24
|
+
* - From only: set min, leave max empty
|
|
25
|
+
* - To only: set max, leave min empty
|
|
26
|
+
* - Between: set both min and max
|
|
27
|
+
* - Exact: set min = max (same date)
|
|
28
|
+
*/
|
|
29
|
+
export declare function DateFilter({ label, fieldType, value, onChange, tCrud, locale, }: DateFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
//# sourceMappingURL=DateFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateFilter.d.ts","sourceRoot":"","sources":["../../src/components/DateFilter.tsx"],"names":[],"mappings":"AA2BA,MAAM,MAAM,eAAe,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,MAAM,WAAW,eAAe;IAC9B,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB;IACjB,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAC9C,0EAA0E;IAC1E,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,yCAAyC;IACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,KAAK,IAAI,CAAC;IACvD,8CAA8C;IAC9C,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IACjE,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,EACR,KAAK,EACL,MAAa,GACd,EAAE,eAAe,2CAkQjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as a,jsxs as k,Fragment as Dt}from"react/jsx-runtime";import{useState as T,useMemo as yt}from"react";import{X as ht}from"lucide-react";import{Button as S,Calendar as St,FloatingLabel as ut,Sheet as E,Text as pt}from"@donotdev/components";import{formatDate as ft}from"@donotdev/core";function vt({label:u,fieldType:xt,value:s,onChange:p,tCrud:o,locale:_="en"}){const[w,l]=T(!1),[F,f]=T(null),b=yt(()=>s?typeof s=="object"&&s!==null&&"min"in s?{min:s.min||"",max:s.max||""}:{min:"",max:""}:{min:"",max:""},[s]),v=t=>{if(!t)return"";try{const n=new Date(t+"T00:00:00");return ft(n,_)}catch{return t}},C=()=>{const t=new Date;t.setHours(0,0,0,0);const n=t.getFullYear(),c=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),g=`${n}-${c}-${r}`,i=new Date(t);i.setDate(i.getDate()-1);const M=i.getFullYear(),x=String(i.getMonth()+1).padStart(2,"0"),z=String(i.getDate()).padStart(2,"0"),A=`${M}-${x}-${z}`,d=new Date(t);d.setDate(d.getDate()+1);const B=d.getFullYear(),H=String(d.getMonth()+1).padStart(2,"0"),I=String(d.getDate()).padStart(2,"0"),L=`${B}-${H}-${I}`,m=new Date(t);m.setDate(m.getDate()-7);const O=m.getFullYear(),P=String(m.getMonth()+1).padStart(2,"0"),W=String(m.getDate()).padStart(2,"0"),X=`${O}-${P}-${W}`,D=new Date(t);D.setDate(D.getDate()-30);const q=D.getFullYear(),G=String(D.getMonth()+1).padStart(2,"0"),J=String(D.getDate()).padStart(2,"0"),K=`${q}-${G}-${J}`,y=new Date(t);y.setDate(y.getDate()+7);const Q=y.getFullYear(),U=String(y.getMonth()+1).padStart(2,"0"),Z=String(y.getDate()).padStart(2,"0"),tt=`${Q}-${U}-${Z}`,h=new Date(t);h.setDate(h.getDate()+30);const et=h.getFullYear(),at=String(h.getMonth()+1).padStart(2,"0"),nt=String(h.getDate()).padStart(2,"0"),rt=`${et}-${at}-${nt}`,$=new Date(t.getFullYear(),t.getMonth(),1),st=$.getFullYear(),ot=String($.getMonth()+1).padStart(2,"0"),lt=String($.getDate()).padStart(2,"0"),it=`${st}-${ot}-${lt}`,Y=new Date(t.getFullYear(),t.getMonth()+1,0),ct=Y.getFullYear(),gt=String(Y.getMonth()+1).padStart(2,"0"),dt=String(Y.getDate()).padStart(2,"0"),mt=`${ct}-${gt}-${dt}`;return{today:g,yesterday:A,tomorrow:L,last7Days:X,last30Days:K,next7Days:tt,next30Days:rt,thisMonthStart:it,thisMonthEnd:mt}},e=b,N=C(),R=!!(e?.min||e?.max),V=t=>{const n=t==="start",c=n?e?.min:e?.max;return a("div",{style:{padding:"var(--gap-md)"},children:k("div",{style:{display:"flex",flexDirection:"column",gap:"var(--gap-md)"},children:[a("div",{style:{display:"flex",flexWrap:"wrap",gap:"var(--gap-tight)"},children:(n?["today","yesterday","last7Days","last30Days","thisMonthStart"]:["today","tomorrow","next7Days","next30Days","thisMonthEnd"]).map(r=>{const g=N[r];return a(S,{variant:"outline",onClick:()=>{p({min:n?g:e?.min||"",max:n?e?.max||"":g}),l(!1)},children:o(`filter.${r}`,{defaultValue:r})},r)})}),a(St,{selected:c?new Date(c+"T00:00:00"):void 0,mode:"single",onSelect:r=>{if(!r)return;const g=r.getFullYear(),i=String(r.getMonth()+1).padStart(2,"0"),M=String(r.getDate()).padStart(2,"0"),x=`${g}-${i}-${M}`;p({min:n?x:e?.min||"",max:n?e?.max||"":x}),l(!1)},defaultMonth:c?new Date(c+"T00:00:00"):new Date}),a(S,{variant:"ghost",display:"compact",onClick:()=>{p({min:n?"":e?.min||"",max:n&&e?.max||""}),l(!1)},children:o("filter.clear",{defaultValue:"Clear"})})]})})},j=k(Dt,{children:[a(E,{trigger:a(S,{variant:"outline",onClick:()=>{f("start"),l(!0)},style:{flex:1},children:e?.min?v(e.min):o("filter.min",{defaultValue:"Min"})}),title:`${u} - ${o("filter.min",{defaultValue:"Min"})}`,open:w&&F==="start",onOpenChange:t=>{l(t),t||f(null)},children:V("start")}),a(pt,{level:"small",variant:"muted",style:{display:"flex",alignItems:"center"},children:"\u2013"}),a(E,{trigger:a(S,{variant:"outline",onClick:()=>{f("end"),l(!0)},style:{flex:1},children:e?.max?v(e.max):o("filter.max",{defaultValue:"Max"})}),title:`${u} - ${o("filter.max",{defaultValue:"Max"})}`,open:w&&F==="end",onOpenChange:t=>{l(t),t||f(null)},children:V("end")}),a(S,{variant:"ghost",display:"compact",icon:a(ht,{size:16}),onClick:()=>{p(void 0)},disabled:!R,"aria-label":o("filter.clear",{defaultValue:"Clear"})})]});return u?a(ut,{label:u,className:"dndev-range-input",children:j}):a("div",{className:"dndev-range-input",children:j})}export{vt as DateFilter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as O}from"react/jsx-runtime";import{useEffect as _,useState as m,useMemo as I}from"react";import{Stack as p,Spinner as M}from"@donotdev/components";import{useTranslation as v,isFieldVisible as R}from"@donotdev/core";import{DisplayFieldRenderer as T}from"./DisplayFieldRenderer";import{useCrud as $}from"../useCrud";function q({entity:
|
|
1
|
+
"use client";import{jsx as n,jsxs as O}from"react/jsx-runtime";import{useEffect as _,useState as m,useMemo as I}from"react";import{Stack as p,Spinner as M}from"@donotdev/components";import{useTranslation as v,isFieldVisible as R}from"@donotdev/core";import{DisplayFieldRenderer as T}from"./DisplayFieldRenderer";import{useCrud as $}from"../useCrud";function q({entity:s,id:a,t:E,className:f="",backend:b="functions",loadingMessage:j,notFoundMessage:x,viewerRole:g="guest"}){const{get:d,loading:F,data:A,error:S,isAvailable:y}=$(s,{backend:b}),[D,u]=m(!1),[V,i]=m(null),[k,c]=m(null),{t:w}=v([s.namespace,"crud"]),{t:h}=v("crud"),z=E||w;_(()=>{if(!a){c(null),i(null),u(!1);return}if(!y||!d)return;let t=!1;return u(!0),i(null),d(a).then(r=>{t||(u(!1),r?(c(r),i(null)):(c(null),i(new Error("Entity not found"))))}).catch(r=>{t||(u(!1),i(r instanceof Error?r:new Error(String(r))),c(null))}),()=>{t=!0}},[a,d,y]);const l=A||k,o=S||V,C=F||D||!a,L=I(()=>l?Object.entries(s.fields).filter(([t,r])=>{if(!R(r.visibility,g)||r.visibility==="hidden")return!1;const e=l[t];return!(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0||typeof e=="object"&&!Array.isArray(e)&&e!==null&&Object.keys(e).length===0)}):[],[s.fields,g,l]);return C?n("div",{style:{position:"relative",width:"100%",gridColumn:"1 / -1",display:"contents"},className:f,children:n(M,{overlay:!0,"aria-label":j||h("form.loading",{defaultValue:"Loading..."})})}):o||!l?n(p,{align:"center",justify:"center",style:{padding:"var(--gap-3xl)",textAlign:"center"},className:f,children:O(p,{direction:"column",gap:"tight",children:[n("h3",{style:{color:"var(--muted-foreground)"},children:x||h("errors.notFound",{defaultValue:`${s.name} not found`})}),o&&n("p",{style:{color:"var(--destructive)",fontSize:"var(--font-size-sm)"},children:o instanceof Error?o.message:String(o)})]})}):n(p,{direction:"column",className:f,children:L.map(([t,r])=>n(T,{name:t,config:r,value:l[t],t:z},t))})}var Q=q;export{q as EntityDisplayRenderer,Q as default};
|
|
@@ -17,26 +17,35 @@ import type { Entity } from '@donotdev/core';
|
|
|
17
17
|
export declare function matchesFilter(itemValue: any, filterValue: string | {
|
|
18
18
|
min?: string;
|
|
19
19
|
max?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
20
|
+
} | string[] | {
|
|
21
|
+
date: string;
|
|
22
|
+
time?: string;
|
|
23
|
+
} | {
|
|
24
|
+
min?: {
|
|
25
|
+
date: string;
|
|
26
|
+
time?: string;
|
|
27
|
+
};
|
|
28
|
+
max?: {
|
|
29
|
+
date: string;
|
|
30
|
+
time?: string;
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
date: string;
|
|
34
|
+
time?: string;
|
|
35
|
+
}[], fieldType: string): boolean;
|
|
36
|
+
export interface EntityFiltersProps<T extends Record<string, any> & {
|
|
37
|
+
id: string;
|
|
38
|
+
} = Record<string, any> & {
|
|
39
|
+
id: string;
|
|
40
|
+
}> {
|
|
22
41
|
/** The entity definition */
|
|
23
42
|
entity: Entity;
|
|
24
|
-
/** Data array to extract unique values and min/max from */
|
|
25
|
-
data: T[];
|
|
26
|
-
/** Current filter values */
|
|
27
|
-
filters: Record<string, string | {
|
|
28
|
-
min?: string;
|
|
29
|
-
max?: string;
|
|
30
|
-
}>;
|
|
31
|
-
/** Callback when filters change */
|
|
32
|
-
onFiltersChange: (filters: Record<string, string | {
|
|
33
|
-
min?: string;
|
|
34
|
-
max?: string;
|
|
35
|
-
}>) => void;
|
|
36
43
|
/** Optional: Specific fields to show filters for (defaults to all entity fields) */
|
|
37
44
|
fieldsToFilter?: string[];
|
|
38
45
|
/** Layout variant: 'inline' (multi-column grid) or 'sidebar' (single column stack) */
|
|
39
46
|
variant?: 'inline' | 'sidebar';
|
|
47
|
+
/** Optional: Data array to extract unique values and min/max from (if not provided, fetches automatically) */
|
|
48
|
+
data?: T[];
|
|
40
49
|
}
|
|
41
50
|
/**
|
|
42
51
|
|
|
@@ -57,5 +66,9 @@ export interface EntityFiltersProps<T = any> {
|
|
|
57
66
|
* - Clear individual filters or all filters
|
|
58
67
|
|
|
59
68
|
*/
|
|
60
|
-
export declare function EntityFilters<T extends Record<string, any>
|
|
69
|
+
export declare function EntityFilters<T extends Record<string, any> & {
|
|
70
|
+
id: string;
|
|
71
|
+
} = Record<string, any> & {
|
|
72
|
+
id: string;
|
|
73
|
+
}>({ entity, data: dataProp, fieldsToFilter, variant, }: EntityFiltersProps<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
61
74
|
//# sourceMappingURL=EntityFilters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityFilters.d.ts","sourceRoot":"","sources":["../../src/components/EntityFilters.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityFilters.d.ts","sourceRoot":"","sources":["../../src/components/EntityFilters.tsx"],"names":[],"mappings":"AAyDA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAS7C;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,GAAG,EAEd,WAAW,EAAE,MAAM,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EAExN,SAAS,EAAE,MAAM,GAChB,OAAO,CAgUT;AAGD,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;IACvH,4BAA4B;IAC5B,MAAM,EAAE,MAAM,CAAC;IAEf,oFAAoF;IACpF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B,sFAAsF;IACtF,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAE/B,8GAA8G;IAC9G,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,aAAa,CAC3B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EACrF,EACA,MAAM,EACN,IAAI,EAAE,QAAQ,EACd,cAAc,EACd,OAAkB,GACnB,EAAE,kBAAkB,CAAC,CAAC,CAAC,kDAknBvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as A,jsxs as K}from"react/jsx-runtime";import{useMemo as G}from"react";import{FilterX as Z}from"lucide-react";import{Button as v,Combobox as V,Grid as tt,RangeInput as nt,Slider as et,Stack as rt}from"@donotdev/components";import{DateFilter as it}from"./DateFilter";import{useTranslation as Q,handleError as X}from"@donotdev/core";import{translateFieldLabel as st,translateLabel as U}from"../forms/utils";import{getFilterType as I,isFilterable as ot}from"../fieldTypeRegistry";import{useCrudFilters as at}from"../hooks/useCrudFilters";import{useCrudCardList as ct}from"../useCrudCardList";function lt(t,s,a){if(!s)return!0;if(Array.isArray(s)){if(s.length===0)return!0;if(!(I(a)==="range"&&(a==="date"||a==="datetime-local"||a==="timestamp")))return s.some(l=>{if(typeof l=="object"&&"date"in l){const h=l.date;return(t instanceof Date?t.toISOString().split("T")[0]:new Date(t).toISOString().split("T")[0])===h}return String(t)===String(l)});const F=t instanceof Date?t.toISOString().split("T")[0]:new Date(t).toISOString().split("T")[0];return s.some(l=>typeof l=="string"?F===l:typeof l=="object"&&"date"in l?F===l.date:!1)}if(typeof s=="object"&&"date"in s&&!("min"in s)&&!Array.isArray(s)){if(!(I(a)==="range"&&(a==="date"||a==="datetime-local"||a==="timestamp")))return!1;const F=s.date;if(!F)return!0;if(t==null)return!1;const l=t instanceof Date?t.toISOString().split("T")[0]:new Date(t).toISOString().split("T")[0];if((a==="datetime-local"||a==="timestamp")&&s.time){const h=t instanceof Date?t.toISOString().slice(11,16):new Date(t).toISOString().slice(11,16);return l===F&&h===s.time}return l===F}if(typeof s=="object"&&"min"in s){const T=I(a);if(!T)throw X(new Error(`Field type "${a}" not registered in field type registry`),{userMessage:`Field type "${a}" is missing from registry`,context:{fieldType:a,operation:"filter_matching",fix:"Add to registerBuiltinFieldTypes.ts or registerFieldType()"}});const b=T==="range"&&(a==="date"||a==="datetime-local"||a==="timestamp"),F=T==="range"&&!b,l=a==="price",h=l&&t!=null&&typeof t=="object"?Number(t.amount):F&&t!=null?typeof t=="number"?t:Number(t):NaN;if(F||l){if(typeof s.min=="object"&&s.min!==null&&"date"in s.min)return!1;const d=s,m=typeof d.min=="string"&&d.min!=="",x=typeof d.max=="string"&&d.max!=="";return m&&!x?t==null||isNaN(h)?!1:h>=Number(d.min):!m&&x?t==null?!0:isNaN(h)?!1:h<=Number(d.max):m&&x?t==null||isNaN(h)?!1:h>=Number(d.min)&&h<=Number(d.max):!0}if(b){if(typeof s.min=="object"&&s.min!==null&&"date"in s.min&&!("min"in s.min)){const p=s,g=p.min,y=p.max,L=g?.date&&g.date!=="",C=y?.date&&y.date!=="";if(L&&!C){if(t==null)return!1;const w=t instanceof Date?t:new Date(t);if(isNaN(w.getTime()))return!1;const M=new Date(g.date+(g.time?`T${g.time}:00`:"T00:00:00"));return w>=M}if(!L&&C&&y){if(t==null)return!0;const w=t instanceof Date?t:new Date(t);if(isNaN(w.getTime()))return!1;const M=new Date(y.date+(y.time?`T${y.time}:00`:"T23:59:59"));return w<=M}if(L&&C&&y){if(t==null)return!1;const w=t instanceof Date?t:new Date(t);if(isNaN(w.getTime()))return!1;const M=new Date(g.date+(g.time?`T${g.time}:00`:"T00:00:00")),q=new Date(y.date+(y.time?`T${y.time}:00`:"T23:59:59"));return w>=M&&w<=q}return!0}const d=s,m=typeof d.min=="string"&&d.min!=="",x=typeof d.max=="string"&&d.max!=="";if(m&&!x){if(t==null)return!1;const p=t instanceof Date?t:new Date(t);return isNaN(p.getTime())?!1:p>=new Date(d.min)}if(!m&&x){if(t==null)return!0;const p=t instanceof Date?t:new Date(t);return isNaN(p.getTime())?!1:p<=new Date(d.max)}if(m&&x){if(t==null)return!1;const p=t instanceof Date?t:new Date(t);return isNaN(p.getTime())?!1:p>=new Date(d.min)&&p<=new Date(d.max)}return!0}}const $=I(a);if(!$)throw X(new Error(`Field type "${a}" not registered in field type registry`),{userMessage:`Field type "${a}" is missing from registry`,context:{fieldType:a,operation:"filter_matching",fix:"Add to registerBuiltinFieldTypes.ts or registerFieldType()"}});if($==="address")return t==null?!1:typeof t=="object"&&"formatted_address"in t?String(t.formatted_address).toLowerCase().includes(String(s).toLowerCase()):!1;if($==="multiselect"){if(!Array.isArray(t)||t.length===0)return!1;const T=String(s).toLowerCase();return t.some(b=>String(b).toLowerCase().includes(T))}return t==null?!1:String(t).toLowerCase().includes(String(s).toLowerCase())}function Mt({entity:t,data:s,fieldsToFilter:a,variant:$="inline"}){const T=$==="sidebar",{t:b,i18n:F}=Q("crud"),{t:l}=Q([t.namespace,"crud"]),h=F?.language||"en",{data:d}=ct(t,{enabled:!s}),m=s??(d?.items||[]),{filters:x,setFilters:p}=at({collection:t.collection}),g=G(()=>(a&&a.length>0?a:t.listFields||Object.keys(t.fields)).filter(n=>{const e=t.fields[n]?.type||"text";return ot(e)}),[a,t.listFields,t.fields]),y=G(()=>{const i={};return g.forEach(n=>{const f=Object.fromEntries(Object.entries(x).filter(([e])=>e!==n));if(Object.keys(f).length===0){i[n]=m;return}i[n]=m.filter(e=>Object.entries(f).every(([D,E])=>{const N=e[D],c=t.fields[D]?.type||"text";return lt(N,E,c)}))}),i},[m,x,t.fields,g]),L=G(()=>{const i={};return g.forEach(n=>{const f=t.fields[n];if(!f)return;const e=f.type||"text",D=I(e);if(!D){X(new Error(`Field type "${e}" not registered in field type registry`),{userMessage:`Field type "${e}" is missing from registry`,context:{fieldType:e,fieldName:n,operation:"minmax_computation",fix:"Add to registerBuiltinFieldTypes.ts or registerFieldType()"},severity:"warning"});return}const E=D==="range"&&(e==="date"||e==="datetime-local"||e==="timestamp"||e==="time"||e==="week"||e==="month"||e==="year"),N=D==="range"&&!E,R=e==="price";if(N||R){const c=m.map(o=>o[n]).filter(o=>o!=null&&o!=="").map(o=>R&&typeof o=="object"&&o!==null?Number(o.amount):typeof o=="number"?o:Number(o)).filter(o=>!isNaN(o));c.length>0&&(i[n]={min:Math.min(...c),max:Math.max(...c)})}else if(E){const c=m.map(o=>o[n]).filter(o=>o!=null&&o!=="").map(o=>o instanceof Date?o:new Date(o)).filter(o=>!isNaN(o.getTime()));if(c.length>0){const o=new Date(Math.min(...c.map(_=>_.getTime()))),O=new Date(Math.max(...c.map(_=>_.getTime()))),J=o.toISOString().split("T")[0],B=O.toISOString().split("T")[0];i[n]={min:J||"",max:B||""}}}}),i},[m,t.fields,g]),C=(i,n)=>{const f={...x};if(!n||n==="")delete f[i];else if(Array.isArray(n))f[i]=n;else if(typeof n=="object"&&"min"in n){const e=n.min&&n.min!=="",D=n.max&&n.max!=="";!e&&!D?delete f[i]:f[i]=n}else f[i]=n;p(f)},w=()=>{p({})},M=G(()=>g.length===0?null:g.map(i=>{const n=t.fields[i];if(!n)return null;const f=st(i,n,l),e=n.type||"text",D=I(e);if(!D)return X(new Error(`Field type "${e}" not registered in field type registry`),{userMessage:`Field type "${e}" is missing from registry`,context:{fieldType:e,fieldName:i,operation:"filter_ui_render",fix:"Add to registerBuiltinFieldTypes.ts or registerFieldType()"},severity:"warning"}),null;const E=D==="range"&&(e==="date"||e==="datetime-local"||e==="timestamp"||e==="time"||e==="week"||e==="month"||e==="year"),N=D==="range"&&!E,R=D==="select",c=x[i],O=typeof c=="object"&&c!==null&&"min"in c?c:{min:"",max:""};if(N){const u=L[i],S=u?.min??0,r=u?.max??100,j=O.min?Number(O.min):S,z=O.max?Number(O.max):r;return K(rt,{gap:"tight",style:{gridColumn:"span 2"},children:[A(nt,{type:"number",label:f,minPlaceholder:b("filter.min",{defaultValue:"Min"}),maxPlaceholder:b("filter.max",{defaultValue:"Max"}),minValue:O.min||"",maxValue:O.max||"",actualMin:S,actualMax:r,onChange:(k,Y)=>{C(i,{min:k,max:Y})},onClear:()=>C(i,void 0)}),A(et,{value:[j,z],min:S,max:r,step:1,onValueChange:k=>{C(i,{min:String(k[0]),max:String(k[1])})}})]},i)}if(E){const u=e==="week"||e==="month"||e==="year"?e:"date",S=(()=>{if(c){if(typeof c=="object"&&"min"in c){const r=c;return{min:r.min&&r.min.split("T")[0]||"",max:r.max&&r.max.split("T")[0]||""}}if(typeof c=="string"){const r=c.split("T")[0]||"";return{min:r,max:r}}}})();return A("div",{style:{gridColumn:"span 2",gridRow:T?void 0:"span 1"},children:A(it,{label:f,fieldType:u,value:S,locale:h,onChange:r=>{if(!r){C(i,void 0);return}typeof r=="object"&&"min"in r&&C(i,{min:r.min||"",max:r.max||""})},tCrud:b})},i)}const B=R&&n.validation&&"options"in n.validation&&n.validation?Array.isArray(n.validation.options)?n.validation.options:typeof n.validation.options=="function"?n.validation.options():[]:[],_=y[i]||m,H=new Set;_.forEach(u=>{const S=u[i];S!=null&&H.add(String(S))});const P=[{value:"all",label:b("filter.selectPlaceholder",{defaultValue:"All"})}];if(B.length>0){const u=[],S=[];B.forEach(r=>{const j=typeof r=="string"?r:r.value,z=typeof r=="string"?r:r.label;H.has(j)?u.push({value:j,label:z}):S.push({value:j,label:z})}),u.sort((r,j)=>r.label.localeCompare(j.label)),S.sort((r,j)=>r.label.localeCompare(j.label)),u.forEach(r=>{P.push({value:r.value,label:U(r.label,l),disabled:!1})}),S.forEach(r=>{P.push({value:r.value,label:U(r.label,l),disabled:!0})})}else Array.from(H).sort().slice(0,100).forEach(u=>{P.push({value:u,label:u})});return A("div",{style:{gridColumn:"span 2",gridRow:"span 1"},children:A(V,{label:f,value:typeof c=="string"?c:void 0,onValueChange:u=>{C(i,u==="all"||!u?"":String(u))},options:P,placeholder:b("filter.placeholder",{defaultValue:"Filter..."}),clearable:!0})},i)}),[g,t.fields,m,x,l,b,y]);if(!M||M.length===0)return null;const q=M.filter(Boolean),W=Object.keys(x).length>0;return K(tt,{cols:$==="sidebar"?2:[2,4,6,8],children:[q,A(v,{variant:"outline",icon:A(Z,{size:18}),onClick:w,disabled:!W,style:{gridColumn:"1 / -1",gridRow:"span 1"},children:b("filter.clear",{defaultValue:"Clear Filters"})})]})}export{Mt as EntityFilters,lt as matchesFilter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r,Fragment as N}from"react/jsx-runtime";import{useState as j}from"react";import{FormProvider as w}from"react-hook-form";import{Button as s,BUTTON_VARIANT as C,Spinner as F,cn as _,Stack as i,Grid as I}from"@donotdev/components";import{useTranslation as L}from"@donotdev/core";const k=({title:m,onSubmit:c,children:
|
|
1
|
+
"use client";import{jsx as e,jsxs as r,Fragment as N}from"react/jsx-runtime";import{useState as j}from"react";import{FormProvider as w}from"react-hook-form";import{Button as s,BUTTON_VARIANT as C,Spinner as F,cn as _,Stack as i,Grid as I}from"@donotdev/components";import{useTranslation as L}from"@donotdev/core";const k=({title:m,onSubmit:c,children:f,formMethods:u,loading:n=!1,submitText:g,cancelText:v,showCancel:p=!1,onCancel:b,variant:l="default",columns:h=1,description:o})=>{const{t:d}=L("dndev"),[t,a]=j(!1),y=g||d("form.submit","Submit"),S=v||d("form.cancel","Cancel"),x=async T=>{a(!0);try{await c(T)}finally{a(!1)}},z={1:"dndev-grid-cols-1",2:"dndev-grid-cols-1 dndev-md:grid-cols-2",3:"dndev-grid-cols-1 dndev-md:grid-cols-2 dndev-md:grid-cols-3",4:"dndev-grid-cols-1 dndev-md:grid-cols-2 dndev-md:grid-cols-4"};return e(w,{...u,children:e("form",{onSubmit:x,className:_("dndev-mx-auto",{default:"dndev-surface",card:"dndev-surface",minimal:""}[l]),style:l!=="minimal"?{padding:"var(--gap-lg)"}:void 0,role:"form","aria-labelledby":"form-title",noValidate:!0,children:r(i,{gap:"large",children:[r(i,{gap:"tight",children:[e("h2",{id:"form-title",style:{fontSize:"var(--font-size-2xl)",fontWeight:600,color:"var(--foreground)"},children:m}),o&&e("p",{style:{color:"var(--muted-foreground)"},children:o})]}),e(I,{cols:h,className:"dndev-w-full dndev-min-w-0",children:f}),r(i,{direction:"row",align:"center",justify:"end",style:{paddingTop:"var(--gap-md)",borderTop:"1px solid var(--border)"},children:[p&&e(s,{type:"button",variant:C.OUTLINE,onClick:b,disabled:n||t,children:S}),e(s,{type:"submit",disabled:n||t,style:{minWidth:"120px"},children:n||t?r(N,{children:[e(F,{className:"me-component-gap"}),t?d("form.submitting","Submitting..."):d("form.loading","Loading...")]}):y})]})]})})})};var E=k;export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as s}from"react/jsx-runtime";import{Badge as
|
|
1
|
+
import{jsx as r,jsxs as s}from"react/jsx-runtime";import{Badge as a,BADGE_VARIANT as n,Text as t,Stack as l}from"@donotdev/components";const o=({config:c,value:e,t:d,className:i})=>e?s(l,{direction:"row",align:"center",className:i,children:[r(t,{as:"span",level:"small",children:e.name}),e.size&&s(a,{variant:n.SECONDARY,children:[(e.size/1024).toFixed(1)," KB"]})]}):r(t,{as:"span",variant:"muted",className:i,children:"-"});var p=o;export{o as FileFieldDisplay,p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{Badge as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Badge as o,BADGE_VARIANT as e,Text as p,Stack as s}from"@donotdev/components";const c=({config:d,value:r,t:m,className:a})=>!r||!Array.isArray(r)||r.length===0?t(p,{as:"span",variant:"muted",className:a,children:"-"}):t(s,{direction:"row",wrap:"wrap",className:a,children:r.map((i,n)=>t(o,{variant:e.OUTLINE,children:String(i)},n))});var x=c;export{c as MultiDropdownDisplay,x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{Badge as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Badge as e,BADGE_VARIANT as o,Text as p,Stack as s}from"@donotdev/components";const c=({config:d,value:r,t:m,className:i})=>!r||!Array.isArray(r)||r.length===0?t(p,{as:"span",variant:"muted",className:i,children:"-"}):t(s,{direction:"row",wrap:"wrap",className:i,children:r.map((a,n)=>t(e,{variant:o.OUTLINE,children:String(a)},n))});var f=c;export{c as MultiInputTextFieldDisplay,f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,jsxs as s}from"react/jsx-runtime";import{Eye as
|
|
1
|
+
import{jsx as o,jsxs as s}from"react/jsx-runtime";import{Eye as n,EyeOff as d}from"lucide-react";import{useState as c}from"react";import{Skeleton as f,Button as m,CopyToClipboard as y,Stack as a}from"@donotdev/components";const x=({config:b,value:r,t:i,className:t,loading:l=!1})=>{const[e,p]=c(!1);return l?o(f,{className:t}):r?s(a,{direction:"row",align:"center",className:t,children:[o("span",{style:{fontFamily:"monospace"},children:e?r:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}),s(a,{direction:"row",align:"center",gap:"tight",children:[o(m,{type:"button",onClick:()=>p(!e),"aria-label":e?"Hide password":"Show password",children:e?o(d,{}):o(n,{})}),o(y,{text:r,tooltipText:i("copyToClipboard")||"Copy to clipboard",copiedTooltipText:i("copied")||"Copied!",ariaLabel:i("copyPassword")||"Copy password"})]})]}):o("div",{style:{color:"var(--muted-foreground)"},children:"-"})};var g=x;export{x as PasswordFieldDisplay,g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Avatar as
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Avatar as v,Input as h,cn as u,Stack as n}from"@donotdev/components";const f=({config:t,value:a,onChange:s,error:g,helperText:l,t:c,className:i,...d})=>{const m=r=>r.split(" ").map(p=>p.charAt(0)).slice(0,2).join("").toUpperCase();return o(n,{children:[o(n,{direction:"row",align:"center",children:[e(v,{src:a,alt:t.label||"Avatar",fallback:m(t.label||"AV"),style:{height:"var(--touch-target)",width:"var(--touch-target)"}}),e("div",{className:"dndev-flex-1",children:e(h,{type:"url",className:u("dndev-w-full",i),placeholder:c("common.enterAvatarUrl"),value:a,onChange:r=>s(r.target.value),...d})})]}),l&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:l})]})};var j=f;export{f as AvatarFieldComponent,j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Badge as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Badge as m,Input as f,cn as g,Stack as a}from"@donotdev/components";const p=({config:u,value:r,onChange:d,error:v,helperText:n,t:o,variant:i="default",className:l,...c})=>t(a,{children:[t(a,{direction:"row",align:"center",children:[e(m,{variant:i,style:{minWidth:0},children:r||o("common.badgePreview")}),e("div",{className:"dndev-flex-1",children:e(f,{type:"text",className:g("dndev-w-full",l),placeholder:o("common.enterBadgeText"),value:r,onChange:s=>d(s.target.value),...c})})]}),n&&e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:n})]});var j=p;export{p as BadgeFieldComponent,j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as l,Fragment as ae}from"react/jsx-runtime";import{Upload as ie,X as se,FileText as P,FileSpreadsheet as le,File as de,Loader2 as ce,Eye as ue}from"lucide-react";import{useCallback as w,useState as M,useRef as F,useEffect as W,useImperativeHandle as pe,forwardRef as me}from"react";import{Button as G,BUTTON_VARIANT as V,Text as g,Stack as x,Progress as fe,Dialog as ge,DialogContent as ve,DialogHeader as he,DialogTitle as ye}from"@donotdev/components";import{handleError as D,useTranslation as we}from"@donotdev/core";import{useUploadContext as xe}from"../../../contexts/UploadContext";import{useUploadStore as Te}from"../../../stores/UploadStore";import{uploadFile as be,deleteFile as Pe,generateFileId as X,getFileIcon as Fe,formatFileSize as De,getDocumentAcceptString as Ne}from"../../../utils/fileStorage";function ke({type:f,className:c}){switch(f){case"pdf":return n(P,{className:c,style:{color:"var(--destructive)"}});case"doc":return n(P,{className:c,style:{color:"var(--primary)"}});case"xls":return n(le,{className:c,style:{color:"var(--success)"}});case"ppt":return n(P,{className:c,style:{color:"var(--warning)"}});case"text":case"html":return n(P,{className:c});default:return n(de,{className:c})}}const q=me(({name:f,label:c,value:v,onChange:N,error:k,helperText:R,multiple:p=!1,maxFiles:A=10,maxSize:C=25*1024*1024,storagePath:L="uploads/documents",required:K,enablePreview:H=!0},J)=>{const{t:Q}=we("dndev"),s=Q,h=xe(),I=Te(),O=!!h,[i,u]=M([]),[j,S]=M(!1),[U,_]=M(null),y=F(null),z=F(!1),T=F(void 0),Y=Ne(),b=w(e=>{const r=e.filter(t=>t.uploaded&&!t.error).map(t=>t.uploaded);N(p?r:r[0]||null)},[p,N]);W(()=>{if(z.current){z.current=!1;return}if(v){const e=[];(Array.isArray(v)?v:[v]).forEach(t=>{t.url&&e.push({id:X(),file:new File([],t.filename),uploadProgress:null,uploaded:t,error:null})}),u(e)}else u([])},[v]);const Z=w(async()=>{const e=i.filter(r=>!r.uploaded&&!r.error&&r.uploadProgress===null);if(e.length!==0){u(r=>r.map(t=>e.some(a=>a.id===t.id)?{...t,uploadProgress:0}:t));for(const r of e)try{const t=await be(r.file,{storagePath:L,onProgress:a=>{u(o=>o.map(d=>d.id===r.id?{...d,uploadProgress:a.progress}:d))}});u(a=>{const o=a.map(d=>d.id===r.id?{...d,uploaded:t,uploadProgress:100,error:null}:d);return queueMicrotask(()=>b(o)),o})}catch{u(a=>a.map(o=>o.id===r.id?{...o,error:"Upload failed",uploadProgress:null}:o))}}},[i,L,b]);T.current=Z,W(()=>{if(!(!h||!f))return I.registerUpload(h,f,async e=>{await T.current?.()}),()=>{I.unregisterUpload(h,f)}},[h,f,I]),pe(J,()=>({upload:async()=>{await T.current?.()},getDocuments:()=>B.current||[]}),[]);const B=F(i);B.current=i;const $=e=>{const r=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".html",".csv"],t="."+e.name.split(".").pop()?.toLowerCase();return r.includes(t)},E=w(e=>{const t=(p?A:1)-i.length;if(t<=0){D(new Error("Maximum documents reached"),{userMessage:s("document.errors.maxFiles",{max:A}),severity:"warning",showNotification:!0});return}const a=e.slice(0,t),o=[],d=(C/(1024*1024)).toFixed(0);for(const m of a){if(!$(m)){D(new Error("Invalid document type"),{userMessage:s("document.errors.invalidType",{fileName:m.name}),severity:"warning",showNotification:!0});continue}if(m.size>C){D(new Error("Document too large"),{userMessage:s("document.errors.exceedsSize",{fileName:m.name,size:d}),severity:"warning",showNotification:!0});continue}o.push({id:X(),file:m,uploadProgress:null,uploaded:null,error:null})}o.length!==0&&(u(m=>p?[...m,...o]:o),O||setTimeout(()=>T.current?.(),0))},[i,p,A,C,s,O]),ee=e=>{const r=Array.from(e.target.files||[]);r.length>0&&E(r),y.current&&(y.current.value="")},re=w(e=>{e.preventDefault(),S(!1);const r=Array.from(e.dataTransfer.files);E(r)},[E]),te=w(async e=>{const r=i[e];if(r)try{r.uploaded&&await Pe(r.uploaded);const t=i.filter((a,o)=>o!==e);z.current=!0,u(t),setTimeout(()=>b(t),0)}catch(t){D(t,{userMessage:s("document.delete.failed"),severity:"error",showNotification:!0})}},[i,b,s]),ne=e=>{e.uploaded?.url&&e.uploaded.mimeType==="application/pdf"&&_(e.uploaded.url)},oe=p||i.length===0;return l(ae,{children:[l(x,{gap:"tight",children:[l(g,{level:"body",align:"start",children:[c,K?"*":""]}),oe&&l("div",{role:"button",tabIndex:0,"aria-label":s("document.upload.ariaLabel"),className:"dndev-surface","data-variant":k?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:j?"var(--primary)":k?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:j?"color-mix(in oklab, var(--primary) 5%, transparent)":"var(--surface)",transition:"border-color var(--dur-fast), background-color var(--dur-fast)",cursor:"pointer",outline:"none"},onDragOver:e=>{e.preventDefault(),S(!0)},onDragLeave:()=>S(!1),onDrop:re,onClick:()=>y.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),y.current?.click())},children:[n("input",{ref:y,type:"file",accept:Y,multiple:p,style:{display:"none"},onChange:ee}),l(x,{align:"center",justify:"center",
|
|
1
|
+
"use client";import{jsx as n,jsxs as l,Fragment as ae}from"react/jsx-runtime";import{Upload as ie,X as se,FileText as P,FileSpreadsheet as le,File as de,Loader2 as ce,Eye as ue}from"lucide-react";import{useCallback as w,useState as M,useRef as F,useEffect as W,useImperativeHandle as pe,forwardRef as me}from"react";import{Button as G,BUTTON_VARIANT as V,Text as g,Stack as x,Progress as fe,Dialog as ge,DialogContent as ve,DialogHeader as he,DialogTitle as ye}from"@donotdev/components";import{handleError as D,useTranslation as we}from"@donotdev/core";import{useUploadContext as xe}from"../../../contexts/UploadContext";import{useUploadStore as Te}from"../../../stores/UploadStore";import{uploadFile as be,deleteFile as Pe,generateFileId as X,getFileIcon as Fe,formatFileSize as De,getDocumentAcceptString as Ne}from"../../../utils/fileStorage";function ke({type:f,className:c}){switch(f){case"pdf":return n(P,{className:c,style:{color:"var(--destructive)"}});case"doc":return n(P,{className:c,style:{color:"var(--primary)"}});case"xls":return n(le,{className:c,style:{color:"var(--success)"}});case"ppt":return n(P,{className:c,style:{color:"var(--warning)"}});case"text":case"html":return n(P,{className:c});default:return n(de,{className:c})}}const q=me(({name:f,label:c,value:v,onChange:N,error:k,helperText:R,multiple:p=!1,maxFiles:A=10,maxSize:C=25*1024*1024,storagePath:L="uploads/documents",required:K,enablePreview:H=!0},J)=>{const{t:Q}=we("dndev"),s=Q,h=xe(),I=Te(),O=!!h,[i,u]=M([]),[j,S]=M(!1),[U,_]=M(null),y=F(null),z=F(!1),T=F(void 0),Y=Ne(),b=w(e=>{const r=e.filter(t=>t.uploaded&&!t.error).map(t=>t.uploaded);N(p?r:r[0]||null)},[p,N]);W(()=>{if(z.current){z.current=!1;return}if(v){const e=[];(Array.isArray(v)?v:[v]).forEach(t=>{t.url&&e.push({id:X(),file:new File([],t.filename),uploadProgress:null,uploaded:t,error:null})}),u(e)}else u([])},[v]);const Z=w(async()=>{const e=i.filter(r=>!r.uploaded&&!r.error&&r.uploadProgress===null);if(e.length!==0){u(r=>r.map(t=>e.some(a=>a.id===t.id)?{...t,uploadProgress:0}:t));for(const r of e)try{const t=await be(r.file,{storagePath:L,onProgress:a=>{u(o=>o.map(d=>d.id===r.id?{...d,uploadProgress:a.progress}:d))}});u(a=>{const o=a.map(d=>d.id===r.id?{...d,uploaded:t,uploadProgress:100,error:null}:d);return queueMicrotask(()=>b(o)),o})}catch{u(a=>a.map(o=>o.id===r.id?{...o,error:"Upload failed",uploadProgress:null}:o))}}},[i,L,b]);T.current=Z,W(()=>{if(!(!h||!f))return I.registerUpload(h,f,async e=>{await T.current?.()}),()=>{I.unregisterUpload(h,f)}},[h,f,I]),pe(J,()=>({upload:async()=>{await T.current?.()},getDocuments:()=>B.current||[]}),[]);const B=F(i);B.current=i;const $=e=>{const r=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".html",".csv"],t="."+e.name.split(".").pop()?.toLowerCase();return r.includes(t)},E=w(e=>{const t=(p?A:1)-i.length;if(t<=0){D(new Error("Maximum documents reached"),{userMessage:s("document.errors.maxFiles",{max:A}),severity:"warning",showNotification:!0});return}const a=e.slice(0,t),o=[],d=(C/(1024*1024)).toFixed(0);for(const m of a){if(!$(m)){D(new Error("Invalid document type"),{userMessage:s("document.errors.invalidType",{fileName:m.name}),severity:"warning",showNotification:!0});continue}if(m.size>C){D(new Error("Document too large"),{userMessage:s("document.errors.exceedsSize",{fileName:m.name,size:d}),severity:"warning",showNotification:!0});continue}o.push({id:X(),file:m,uploadProgress:null,uploaded:null,error:null})}o.length!==0&&(u(m=>p?[...m,...o]:o),O||setTimeout(()=>T.current?.(),0))},[i,p,A,C,s,O]),ee=e=>{const r=Array.from(e.target.files||[]);r.length>0&&E(r),y.current&&(y.current.value="")},re=w(e=>{e.preventDefault(),S(!1);const r=Array.from(e.dataTransfer.files);E(r)},[E]),te=w(async e=>{const r=i[e];if(r)try{r.uploaded&&await Pe(r.uploaded);const t=i.filter((a,o)=>o!==e);z.current=!0,u(t),setTimeout(()=>b(t),0)}catch(t){D(t,{userMessage:s("document.delete.failed"),severity:"error",showNotification:!0})}},[i,b,s]),ne=e=>{e.uploaded?.url&&e.uploaded.mimeType==="application/pdf"&&_(e.uploaded.url)},oe=p||i.length===0;return l(ae,{children:[l(x,{gap:"tight",children:[l(g,{level:"body",align:"start",children:[c,K?"*":""]}),oe&&l("div",{role:"button",tabIndex:0,"aria-label":s("document.upload.ariaLabel"),className:"dndev-surface","data-variant":k?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:j?"var(--primary)":k?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:j?"color-mix(in oklab, var(--primary) 5%, transparent)":"var(--surface)",transition:"border-color var(--dur-fast), background-color var(--dur-fast)",cursor:"pointer",outline:"none"},onDragOver:e=>{e.preventDefault(),S(!0)},onDragLeave:()=>S(!1),onDrop:re,onClick:()=>y.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),y.current?.click())},children:[n("input",{ref:y,type:"file",accept:Y,multiple:p,style:{display:"none"},onChange:ee}),l(x,{align:"center",justify:"center",children:[n(ie,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),n(g,{as:"p",variant:"muted",level:"small",align:"center",children:s("document.upload.hint")}),n(g,{as:"p",variant:"muted",level:"caption",align:"center",children:"PDF, Word, Excel, PowerPoint, TXT, Markdown, HTML"})]})]}),i.length>0&&n(x,{gap:"tight",children:i.map((e,r)=>{const t=Fe(e.uploaded?.mimeType||e.file.type,e.file.name),a=e.uploadProgress!==null&&e.uploadProgress<100,o=e.uploaded?.mimeType==="application/pdf"||e.file.name.toLowerCase().endsWith(".pdf");return l("div",{className:"dndev-surface","data-variant":"muted",style:{padding:"var(--gap-md)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",gap:"var(--gap-md)"},children:[n(ke,{type:t,className:"dndev-size-md"}),l(x,{gap:"none",style:{flex:1,minWidth:0},children:[n(g,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),l(g,{level:"caption",variant:"muted",children:[De(e.uploaded?.size||e.file.size),e.error&&l("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),a&&n(fe,{value:e.uploadProgress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),l(x,{direction:"row",gap:"tight",children:[H&&o&&e.uploaded&&n(G,{variant:V.GHOST,onClick:()=>ne(e),"aria-label":s("document.preview.ariaLabel"),children:n(ue,{className:"dndev-size-sm"})}),a?n(ce,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):n(G,{variant:V.GHOST,onClick:()=>te(r),"aria-label":s("document.delete.ariaLabel"),children:n(se,{className:"dndev-size-sm"})})]})]},e.id)})}),R&&n(g,{level:"caption",variant:k?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:R})]}),H&&U&&n(ge,{open:!!U,onOpenChange:()=>_(null),children:l(ve,{style:{maxWidth:"90vw",maxHeight:"90vh",width:"900px",height:"80vh"},children:[n(he,{children:n(ye,{children:s("document.preview.title")})}),n("iframe",{src:U,style:{width:"100%",height:"100%",border:"none",borderRadius:"var(--radius-md)"},title:"PDF Preview"})]})})]})});q.displayName="DocumentFieldComponent";var Re=q;export{Re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DurationFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/DurationFieldComponent.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,kCAAkC;AAClC,eAAO,MAAM,gBAAgB,8CAA+C,CAAC;AAE7E,MAAM,WAAW,2BAA2B;IAC1C,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;CAChE;
|
|
1
|
+
{"version":3,"file":"DurationFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/DurationFieldComponent.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,kCAAkC;AAClC,eAAO,MAAM,gBAAgB,8CAA+C,CAAC;AAE7E,MAAM,WAAW,2BAA2B;IAC1C,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;CAChE;AA4BD;;;;;;GAMG;AACH,QAAA,MAAM,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAkLtE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a,jsxs as u}from"react/jsx-runtime";import{useState as w,useMemo as C}from"react";import{Clock as S}from"lucide-react";import{Label as $,Stack as l,Button as b,Slider as E}from"@donotdev/components";const x=[15,30,45,60,90,120,150,180],N={15:"duration.15m",30:"duration.30m",45:"duration.45m",60:"duration.1h",90:"duration.1h30",120:"duration.2h",150:"duration.2h30",180:"duration.3h"};function _(
|
|
1
|
+
import{jsx as a,jsxs as u}from"react/jsx-runtime";import{useState as w,useMemo as C}from"react";import{Clock as S}from"lucide-react";import{Label as $,Stack as l,Button as b,Slider as E}from"@donotdev/components";const x=[15,30,45,60,90,120,150,180],N={15:"duration.15m",30:"duration.30m",45:"duration.45m",60:"duration.1h",90:"duration.1h30",120:"duration.2h",150:"duration.2h30",180:"duration.3h"};function _(t,n){const i=t<60?`${t}m`:t%60===0?`${t/60}h`:`${Math.floor(t/60)}h${t%60}`,s=N[t];return!n||!s?i:n(`crud:${s}`,{defaultValue:i})??i}const j=({label:t,value:n,onChange:i,error:s,helperText:d,disabled:c,required:h,readonly:M,min:p=0,max:g=480,step:V=5,t:o})=>{const r=typeof n=="number"&&!Number.isNaN(n)?n:0,f=x.includes(r),[m,v]=w(!f&&r>0),k=C(()=>x.map(e=>({minutes:e,label:_(e,o)})),[o]),y=o?o("crud:duration.custom",{defaultValue:"Custom"}):"Custom";if(M){const e=r===0?o?o("crud:duration.zero",{defaultValue:"\u2014"}):"\u2014":r<60?o?o("crud:duration.minutes",{count:r,defaultValue:`${r} min`}):`${r} min`:o?o("crud:duration.hoursMinutes",{hours:Math.floor(r/60),minutes:r%60,defaultValue:`${Math.floor(r/60)}h${r%60?` ${r%60}min`:""}`}):`${Math.floor(r/60)}h${r%60?` ${r%60}m`:""}`;return u(l,{gap:"tight",children:[a($,{required:h,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:t}),u(l,{direction:"row",gap:"tight",align:"center",children:[a(S,{size:18,style:{color:"var(--muted-foreground)"},"aria-hidden":!0}),a("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-sm)"},children:e})]}),d&&a("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})}return u(l,{children:[a($,{required:h,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:t}),u(l,{direction:"row",gap:"tight",align:"center",style:{flexWrap:"wrap"},children:[k.map(({minutes:e,label:z})=>u(b,{type:"button",variant:r===e?"primary":"outline",disabled:c,onClick:()=>{v(!1),i(e)},"aria-pressed":r===e,"aria-label":z,children:[a(S,{size:14,style:{marginRight:"var(--gap-xs)"},"aria-hidden":!0}),z]},e)),a(b,{type:"button",variant:m?"primary":"outline",disabled:c,onClick:()=>{v(!0),!f&&r>0?i(r):i(30)},"aria-pressed":m,"aria-label":y,children:y})]}),m&&a(l,{gap:"tight",style:{marginTop:"var(--gap-sm)"},children:a(E,{value:[f?30:r],onValueChange:([e])=>i(Math.max(p,Math.min(g,e??0))),min:p,max:g,step:V,showValue:!0,disabled:c,"aria-label":t})}),d&&a("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:d})]})};var W=j;export{x as DURATION_PRESETS,W as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as p}from"react/jsx-runtime";import{Upload as Z,X as $,File as ee,Loader2 as re,FileText as C,FileSpreadsheet as oe,FileImage as se,FileVideo as
|
|
1
|
+
"use client";import{jsx as s,jsxs as p}from"react/jsx-runtime";import{Upload as Z,X as $,File as ee,Loader2 as re,FileText as C,FileSpreadsheet as oe,FileImage as se,FileVideo as te,FileAudio as ae,FileArchive as le,FileCode as ne}from"lucide-react";import{useCallback as y,useState as O,useRef as b,useEffect as _,useImperativeHandle as ie,forwardRef as de}from"react";import{Button as ue,BUTTON_VARIANT as ce,Text as F,Stack as P,Progress as pe}from"@donotdev/components";import{handleError as M,useTranslation as fe}from"@donotdev/core";import{useUploadContext as ge}from"../../../contexts/UploadContext";import{useUploadStore as me}from"../../../stores/UploadStore";import{uploadFile as ve,deleteFile as he,generateFileId as H,getFileIcon as ye,formatFileSize as Fe}from"../../../utils/fileStorage";function we({type:f,className:n}){switch(f){case"pdf":return s(C,{className:n,style:{color:"var(--destructive)"}});case"doc":return s(C,{className:n,style:{color:"var(--primary)"}});case"xls":return s(oe,{className:n,style:{color:"var(--success)"}});case"ppt":return s(C,{className:n,style:{color:"var(--warning)"}});case"image":return s(se,{className:n});case"video":return s(te,{className:n});case"audio":return s(ae,{className:n});case"archive":return s(le,{className:n});case"html":case"text":return s(ne,{className:n});default:return s(ee,{className:n})}}const D=de(({name:f,label:n,value:g,onChange:T,error:A,helperText:R,accept:V,multiple:d=!1,maxFiles:N=10,maxSize:k=50*1024*1024,storagePath:E="uploads/files",required:q},G)=>{const{t:K}=fe("dndev"),i=K,m=ge(),I=me(),j=!!m,[a,c]=O([]),[L,U]=O(!1),v=b(null),S=b(!1),w=b(void 0),x=y(e=>{const r=e.filter(o=>o.uploaded&&!o.error).map(o=>o.uploaded);T(d?r:r[0]||null)},[d,T]);_(()=>{if(S.current){S.current=!1;return}if(g){const e=[];(Array.isArray(g)?g:[g]).forEach(o=>{o.url&&e.push({id:H(),file:new File([],o.filename),uploadProgress:null,uploaded:o,error:null})}),c(e)}else c([])},[g]);const W=y(async()=>{const e=a.filter(r=>!r.uploaded&&!r.error&&r.uploadProgress===null);if(e.length!==0){c(r=>r.map(o=>e.some(l=>l.id===o.id)?{...o,uploadProgress:0}:o));for(const r of e)try{const o=await ve(r.file,{storagePath:E,onProgress:l=>{c(t=>t.map(u=>u.id===r.id?{...u,uploadProgress:l.progress}:u))}});c(l=>{const t=l.map(u=>u.id===r.id?{...u,uploaded:o,uploadProgress:100,error:null}:u);return queueMicrotask(()=>x(t)),t})}catch{c(l=>l.map(t=>t.id===r.id?{...t,error:"Upload failed",uploadProgress:null}:t))}}},[a,E,x]);w.current=W,_(()=>{if(!(!m||!f))return I.registerUpload(m,f,async e=>{await w.current?.()}),()=>{I.unregisterUpload(m,f)}},[m,f,I]),ie(G,()=>({upload:async()=>{await w.current?.()},getFiles:()=>B.current||[]}),[]);const B=b(a);B.current=a;const z=y(e=>{const o=(d?N:1)-a.length;if(o<=0){M(new Error("Maximum files reached"),{userMessage:i("file.errors.maxFiles",{max:N}),severity:"warning",showNotification:!0});return}const l=e.slice(0,o),t=[],u=(k/(1024*1024)).toFixed(0);for(const h of l){if(h.size>k){M(new Error("File too large"),{userMessage:i("file.errors.exceedsSize",{fileName:h.name,size:u}),severity:"warning",showNotification:!0});continue}t.push({id:H(),file:h,uploadProgress:null,uploaded:null,error:null})}t.length!==0&&(c(h=>d?[...h,...t]:t),j||setTimeout(()=>w.current?.(),0))},[a,d,N,k,i,j]),X=e=>{const r=Array.from(e.target.files||[]);r.length>0&&z(r),v.current&&(v.current.value="")},J=y(e=>{e.preventDefault(),U(!1);const r=Array.from(e.dataTransfer.files);z(r)},[z]),Q=y(async e=>{const r=a[e];if(r)try{r.uploaded&&await he(r.uploaded);const o=a.filter((l,t)=>t!==e);S.current=!0,c(o),setTimeout(()=>x(o),0)}catch(o){M(o,{userMessage:i("file.delete.failed"),severity:"error",showNotification:!0})}},[a,x,i]),Y=d||a.length===0,xe=a.some(e=>!e.uploaded&&!e.error&&e.uploadProgress===null);return p(P,{gap:"tight",children:[p(F,{level:"body",align:"start",children:[n,q?"*":""]}),Y&&p("div",{role:"button",tabIndex:0,"aria-label":i(d?"file.upload.ariaLabelMultiple":"file.upload.ariaLabelSingle"),className:"dndev-surface","data-variant":A?"destructive":"default",style:{border:"var(--border-width) dashed",borderColor:L?"var(--primary)":A?"var(--destructive)":"var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:L?"color-mix(in oklab, var(--primary) 5%, transparent)":"var(--surface)",transition:"border-color var(--dur-fast), background-color var(--dur-fast)",cursor:"pointer",outline:"none"},onDragOver:e=>{e.preventDefault(),U(!0)},onDragLeave:()=>U(!1),onDrop:J,onClick:()=>v.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),v.current?.click())},children:[s("input",{ref:v,type:"file",accept:V,multiple:d,style:{display:"none"},onChange:X}),p(P,{align:"center",justify:"center",children:[s(Z,{className:"dndev-size-lg",style:{color:"var(--muted-foreground)"}}),s(F,{as:"p",variant:"muted",level:"small",align:"center",children:i(d?"file.upload.dragDropMultiple":"file.upload.dragDropSingle")})]})]}),a.length>0&&s(P,{gap:"tight",children:a.map((e,r)=>{const o=ye(e.uploaded?.mimeType||e.file.type,e.file.name),l=e.uploadProgress!==null&&e.uploadProgress<100,t=e.uploaded&&!e.error;return p("div",{className:"dndev-surface","data-variant":"muted",style:{padding:"var(--gap-md)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",gap:"var(--gap-md)"},children:[s(we,{type:o,className:"dndev-size-md"}),p(P,{gap:"none",style:{flex:1,minWidth:0},children:[s(F,{level:"small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.file.name}),p(F,{level:"caption",variant:"muted",children:[Fe(e.uploaded?.size||e.file.size),e.error&&p("span",{style:{color:"var(--destructive)"},children:[" ","\xB7 ",e.error]})]}),l&&s(pe,{value:e.uploadProgress||0,max:100,style:{marginTop:"var(--gap-xs)"}})]}),l?s(re,{className:"dndev-size-sm",style:{animation:"spin 1s linear infinite"}}):s(ue,{variant:ce.GHOST,onClick:()=>Q(r),"aria-label":i("file.delete.ariaLabel"),children:s($,{className:"dndev-size-sm"})})]},e.id)})}),R&&s(F,{level:"caption",variant:A?"destructive":"muted",style:{marginTop:"var(--gap-xs)"},children:R})]})});D.displayName="FileFieldComponent";var ze=D;export{ze as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as n,jsxs as c}from"react/jsx-runtime";import{Label as h,Input as g,Stack as u}from"@donotdev/components";const y=({label:
|
|
1
|
+
import{jsx as n,jsxs as c}from"react/jsx-runtime";import{Label as h,Input as g,Stack as u}from"@donotdev/components";const y=({label:f,value:e={lat:0,lng:0},onChange:l,error:a,helperText:r,disabled:d,required:m})=>{const v=i=>{const t=parseFloat(i.target.value)||0;if(t>=-90&&t<=90){const s={...e,lat:t},o={target:{value:JSON.stringify(s)}};l(o)}},p=i=>{const t=parseFloat(i.target.value)||0;if(t>=-180&&t<=180){const s={...e,lng:t},o={target:{value:JSON.stringify(s)}};l(o)}};return c(u,{gap:"tight",children:[n(h,{required:m,style:{display:"block",fontSize:"var(--font-size-sm)",fontWeight:500},children:f}),c(u,{direction:"row",children:[n(g,{label:"Latitude",type:"number",value:e.lat,onChange:v,min:"-90",max:"90",step:"0.000001",disabled:d,"data-variant":a?"destructive":void 0,className:"dndev-w-full"}),n(g,{label:"Longitude",type:"number",value:e.lng,onChange:p,min:"-180",max:"180",step:"0.000001",disabled:d,"data-variant":a?"destructive":void 0,className:"dndev-w-full"})]}),r&&n("p",{style:{fontSize:"var(--font-size-xs)",color:a?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:r})]})};var L=y;export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as l,Fragment as q}from"react/jsx-runtime";import{DndContext as J,closestCenter as Q,PointerSensor as Z,TouchSensor as ee,useSensor as j,useSensors as re}from"@dnd-kit/core";import{SortableContext as te,useSortable as oe,rectSortingStrategy as ne,arrayMove as ie}from"@dnd-kit/sortable";import{CSS as ae}from"@dnd-kit/utilities";import{Upload as se,X as A,Loader2 as le,GripVertical as de}from"lucide-react";import{forwardRef as ce,useCallback as V,useImperativeHandle as pe,useRef as ue,useState as L}from"react";import{Text as h,Stack as C,Progress as ge}from"@donotdev/components";import{useTranslation as me}from"@donotdev/core";import{useFileUpload as he}from"../../../hooks/useFileUpload";import{processImage as ve}from"../../../utils/imageProcessing";import{uploadImage as fe}from"../../../utils/imageStorage";import{ImageViewerDialog as be}from"../internal/ImageViewerDialog";const ye=["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 xe({file:t,index:v,multiple:f,onImageClick:d,onRemove:b,t:u}){const{attributes:n,listeners:D,setNodeRef:S,transform:g,transition:R,isDragging:y}=oe({id:t.id}),w=t.progress!==null&&t.progress<100,s=f&&!w,a={transform:ae.Transform.toString(g),transition:R,position:"relative",width:100,height:100,borderRadius:"var(--radius-md)",border:"var(--border-width) solid var(--border)",overflow:"hidden",backgroundColor:"var(--surface)",opacity:y?.5:1,cursor:s?"grab":"pointer",userSelect:"none",touchAction:s?"none":"auto"};return r("div",{ref:S,style:a,...n,...s?D:{},onClick:()=>{y||d(v)},children:w?l(C,{align:"center",justify:"center",style:{width:"100%",height:"100%"},children:[r(le,{style:{animation:"spin 1s linear infinite"}}),r(ge,{value:t.progress||0,style:{width:"80%"}})]}):t.error?l(C,{align:"center",justify:"center",style:{width:"100%",height:"100%"},children:[r(A,{style:{color:"var(--destructive)"}}),r(h,{variant:"destructive",level:"small",children:t.error})]}):l(q,{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:u("image.alt.upload",{index:v+1}),draggable:!1,style:{width:"100%",height:"100%",objectFit:"cover",pointerEvents:"none",userSelect:"none"}}),r("button",{type:"button",onClick:c=>{c.stopPropagation(),b(t.id)},onPointerDown:c=>c.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(A,{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(h,{variant:"muted",level:"small",style:{color:"white"},children:u("image.upload.pending",{defaultValue:"Pending"})})})]})})}const z=ce(({name:t="image",label:v,value:f,onChange:d,error:b,helperText:u,multiple:n=!1,maxFiles:D=10,maxSize:S=10*1024*1024,storagePath:g="uploads/images",required:R,capture:y},w)=>{const{t:s}=me("crud"),a=ue(null),[E,c]=L(!1),[_,P]=L(0),M=re(j(Z,{activationConstraint:{distance:8}}),j(ee,{activationConstraint:{delay:200,tolerance:5}})),N=V(async(e,o)=>{const{fullBlob:m,thumbBlob:x}=await ve(e);return fe(m,x,e.name,{storagePath:g,onProgress:I=>o(I.progress)})},[g]),{files:i,addFiles:F,removeFile:T}=he({name:t,value:f,onChange:d,multiple:n,maxFiles:D,maxSize:S,accept:ye,storagePath:g,uploadFn:N}),O=e=>{const o=Array.from(e.target.files||[]);o.length>0&&F(o),a.current&&(a.current.value="")},B=V(e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.files.length>0&&F(Array.from(e.dataTransfer.files))},[F]),G=V(e=>{const{active:o,over:m}=e;if(m&&o.id!==m.id){const x=i.findIndex(k=>k.id===o.id),I=i.findIndex(k=>k.id===m.id);if(x!==-1&&I!==-1){const U=ie(i,x,I).filter(p=>p.uploaded||p.previewURL).map(p=>p.uploaded||{fullUrl:p.previewURL,thumbUrl:p.previewURL});d(n?U.length>0?U:null:U[0]||null)}}},[i,n,d]),H=e=>{P(e),c(!0)},K=(e,o)=>{},W=e=>{const o=i[e];o&&T(o.id)},X=e=>{P(e)},Y=n||i.length===0;pe(w,()=>({upload:async()=>{},focus:()=>a.current?.focus()}),[]);const $=i.map(we);return l(C,{gap:"tight",children:[l(h,{level:"body",align:"start",children:[v,R&&"*"]}),Y&&l("div",{role:"button",tabIndex:0,onClick:()=>a.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&a.current?.click()},onDragOver:e=>e.preventDefault(),onDrop:B,style:{border:`var(--border-width) dashed ${b?"var(--destructive)":"var(--border)"}`,borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:"var(--surface)",cursor:"pointer",textAlign:"center"},children:[r("input",{ref:a,type:"file",accept:"image/*",capture:y,multiple:n,style:{display:"none"},onChange:O}),l(C,{align:"center",
|
|
1
|
+
"use client";import{jsx as r,jsxs as l,Fragment as q}from"react/jsx-runtime";import{DndContext as J,closestCenter as Q,PointerSensor as Z,TouchSensor as ee,useSensor as j,useSensors as re}from"@dnd-kit/core";import{SortableContext as te,useSortable as oe,rectSortingStrategy as ne,arrayMove as ie}from"@dnd-kit/sortable";import{CSS as ae}from"@dnd-kit/utilities";import{Upload as se,X as A,Loader2 as le,GripVertical as de}from"lucide-react";import{forwardRef as ce,useCallback as V,useImperativeHandle as pe,useRef as ue,useState as L}from"react";import{Text as h,Stack as C,Progress as ge}from"@donotdev/components";import{useTranslation as me}from"@donotdev/core";import{useFileUpload as he}from"../../../hooks/useFileUpload";import{processImage as ve}from"../../../utils/imageProcessing";import{uploadImage as fe}from"../../../utils/imageStorage";import{ImageViewerDialog as be}from"../internal/ImageViewerDialog";const ye=["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 xe({file:t,index:v,multiple:f,onImageClick:d,onRemove:b,t:u}){const{attributes:n,listeners:D,setNodeRef:S,transform:g,transition:R,isDragging:y}=oe({id:t.id}),w=t.progress!==null&&t.progress<100,s=f&&!w,a={transform:ae.Transform.toString(g),transition:R,position:"relative",width:100,height:100,borderRadius:"var(--radius-md)",border:"var(--border-width) solid var(--border)",overflow:"hidden",backgroundColor:"var(--surface)",opacity:y?.5:1,cursor:s?"grab":"pointer",userSelect:"none",touchAction:s?"none":"auto"};return r("div",{ref:S,style:a,...n,...s?D:{},onClick:()=>{y||d(v)},children:w?l(C,{align:"center",justify:"center",style:{width:"100%",height:"100%"},children:[r(le,{style:{animation:"spin 1s linear infinite"}}),r(ge,{value:t.progress||0,style:{width:"80%"}})]}):t.error?l(C,{align:"center",justify:"center",style:{width:"100%",height:"100%"},children:[r(A,{style:{color:"var(--destructive)"}}),r(h,{variant:"destructive",level:"small",children:t.error})]}):l(q,{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:u("image.alt.upload",{index:v+1}),draggable:!1,style:{width:"100%",height:"100%",objectFit:"cover",pointerEvents:"none",userSelect:"none"}}),r("button",{type:"button",onClick:c=>{c.stopPropagation(),b(t.id)},onPointerDown:c=>c.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(A,{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(h,{variant:"muted",level:"small",style:{color:"white"},children:u("image.upload.pending",{defaultValue:"Pending"})})})]})})}const z=ce(({name:t="image",label:v,value:f,onChange:d,error:b,helperText:u,multiple:n=!1,maxFiles:D=10,maxSize:S=10*1024*1024,storagePath:g="uploads/images",required:R,capture:y},w)=>{const{t:s}=me("crud"),a=ue(null),[E,c]=L(!1),[_,P]=L(0),M=re(j(Z,{activationConstraint:{distance:8}}),j(ee,{activationConstraint:{delay:200,tolerance:5}})),N=V(async(e,o)=>{const{fullBlob:m,thumbBlob:x}=await ve(e);return fe(m,x,e.name,{storagePath:g,onProgress:I=>o(I.progress)})},[g]),{files:i,addFiles:F,removeFile:T}=he({name:t,value:f,onChange:d,multiple:n,maxFiles:D,maxSize:S,accept:ye,storagePath:g,uploadFn:N}),O=e=>{const o=Array.from(e.target.files||[]);o.length>0&&F(o),a.current&&(a.current.value="")},B=V(e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.files.length>0&&F(Array.from(e.dataTransfer.files))},[F]),G=V(e=>{const{active:o,over:m}=e;if(m&&o.id!==m.id){const x=i.findIndex(k=>k.id===o.id),I=i.findIndex(k=>k.id===m.id);if(x!==-1&&I!==-1){const U=ie(i,x,I).filter(p=>p.uploaded||p.previewURL).map(p=>p.uploaded||{fullUrl:p.previewURL,thumbUrl:p.previewURL});d(n?U.length>0?U:null:U[0]||null)}}},[i,n,d]),H=e=>{P(e),c(!0)},K=(e,o)=>{},W=e=>{const o=i[e];o&&T(o.id)},X=e=>{P(e)},Y=n||i.length===0;pe(w,()=>({upload:async()=>{},focus:()=>a.current?.focus()}),[]);const $=i.map(we);return l(C,{gap:"tight",children:[l(h,{level:"body",align:"start",children:[v,R&&"*"]}),Y&&l("div",{role:"button",tabIndex:0,onClick:()=>a.current?.click(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&a.current?.click()},onDragOver:e=>e.preventDefault(),onDrop:B,style:{border:`var(--border-width) dashed ${b?"var(--destructive)":"var(--border)"}`,borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)",backgroundColor:"var(--surface)",cursor:"pointer",textAlign:"center"},children:[r("input",{ref:a,type:"file",accept:"image/*",capture:y,multiple:n,style:{display:"none"},onChange:O}),l(C,{align:"center",children:[r(se,{style:{color:"var(--muted-foreground)"}}),r(h,{variant:"muted",level:"small",children:n?s("image.upload.dropzoneMultiple",{defaultValue:"Drop images here or click to upload"}):s("image.upload.dropzoneSingle",{defaultValue:"Drop image here or click to upload"})})]})]}),i.length>0&&r(J,{sensors:M,collisionDetection:Q,onDragEnd:G,children:r(te,{items:i.map(e=>e.id),strategy:ne,children:r("div",{style:{display:"flex",flexWrap:"wrap",gap:"var(--gap-md)"},children:i.map((e,o)=>r(xe,{file:e,index:o,multiple:n,onImageClick:H,onRemove:T,t:s},e.id))})})}),u&&r(h,{variant:b?"destructive":"muted",level:"small",children:u}),r(be,{images:$,selectedIndex:_,open:E,onClose:()=>c(!1),onUpdate:K,onDelete:W,onNavigate:X,multiple:n})]})});z.displayName="ImageFieldComponent";var je=z;export{je as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as c}from"react/jsx-runtime";import{X as C}from"lucide-react";import{useMemo as z,useId as E}from"react";import{Combobox as I,Badge as V,BADGE_VARIANT as j,Button as w,BUTTON_VARIANT as B,Stack as d}from"@donotdev/components";import{useTranslation as R}from"@donotdev/core";const T=({label:g,value:o=[],options:s,error:h,helperText:a,onChange:u,onBlur:f,required:v,className:y})=>{const{t:m}=R("dndev"),p=E(),b=z(()=>s.map(e=>({value:String(e.value),label:e.label})),[s]),N=e=>{const n=Array.isArray(e)?e:[e],r={target:{value:JSON.stringify(n)}};u(r)},S=e=>{e||f?.()},A=e=>{const n=o.filter(l=>l!==e),r={target:{value:JSON.stringify(n)}};u(r)},i=!!h,O=`${p}-error`,x=`${p}-helper`;return c(d,{gap:"tight",className:y,children:[o.length>0&&t(d,{direction:"row",wrap:"wrap",
|
|
1
|
+
import{jsx as t,jsxs as c}from"react/jsx-runtime";import{X as C}from"lucide-react";import{useMemo as z,useId as E}from"react";import{Combobox as I,Badge as V,BADGE_VARIANT as j,Button as w,BUTTON_VARIANT as B,Stack as d}from"@donotdev/components";import{useTranslation as R}from"@donotdev/core";const T=({label:g,value:o=[],options:s,error:h,helperText:a,onChange:u,onBlur:f,required:v,className:y})=>{const{t:m}=R("dndev"),p=E(),b=z(()=>s.map(e=>({value:String(e.value),label:e.label})),[s]),N=e=>{const n=Array.isArray(e)?e:[e],r={target:{value:JSON.stringify(n)}};u(r)},S=e=>{e||f?.()},A=e=>{const n=o.filter(l=>l!==e),r={target:{value:JSON.stringify(n)}};u(r)},i=!!h,O=`${p}-error`,x=`${p}-helper`;return c(d,{gap:"tight",className:y,children:[o.length>0&&t(d,{direction:"row",wrap:"wrap",children:o.map((e,n)=>{const r=s.find(l=>String(l.value)===e)?.label||e;return c(V,{variant:j.SECONDARY,className:"dndev-gap-sm",children:[r,t(w,{type:"button",variant:B.GHOST,style:{padding:0,height:"auto"},onClick:()=>A(e),children:t(C,{className:"dndev-size-md"})})]},n)})}),t(I,{label:g,value:o,onValueChange:N,onOpenChange:S,placeholder:m("actions.selectOptions","Select options..."),emptyMessage:m("messages.noResults","No results found"),options:b,multiple:!0,required:v,variant:i?"destructive":void 0}),i&&c(d,{id:O,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),a]}),a&&!i&&t("p",{id:x,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:a})]})};var $=T;export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import{useState as y}from"react";import{Input as h,Button as x,Stack as i}from"@donotdev/components";import{useTranslation as b}from"@donotdev/core";const w=({label:
|
|
1
|
+
"use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import{useState as y}from"react";import{Input as h,Button as x,Stack as i}from"@donotdev/components";import{useTranslation as b}from"@donotdev/core";const w=({label:c,value:o=[],onChange:l,className:m,required:p})=>{const{t:s}=b("dndev"),[n,u]=y(""),f=()=>{if(n.trim()){const e=[...o,n.trim()],t={target:{value:JSON.stringify(e)}};l(t),u("")}},g=e=>{const t=o.filter((S,v)=>v!==e),r={target:{value:JSON.stringify(t)}};l(r)};return d(i,{className:m,children:[d(i,{direction:"row",align:"end",children:[a(h,{label:c,type:"text",value:n,onChange:e=>u(e.target.value),required:p,className:"dndev-flex-1",placeholder:s("form.typeAndPressAdd","Type and press Add...")}),a(x,{type:"button",onClick:f,disabled:!n.trim(),children:s("form.add","Add")})]}),a(i,{direction:"row",wrap:"wrap",children:o.map((e,t)=>d("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,a("button",{type:"button",onClick:()=>g(t),style:{color:"var(--muted-foreground)",marginInlineStart:"var(--gap-sm)"},onMouseEnter:r=>{r.currentTarget.style.color="var(--foreground)"},onMouseLeave:r=>{r.currentTarget.style.color="var(--muted-foreground)"},"aria-label":`${s("form.remove","Remove")} ${e}`,children:"\xD7"})]},t))})]})};var j=w;export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneNumberComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PhoneNumberComponent.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExD,MAAM,WAAW,yBAAyB;IACxC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACzD,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4EAA4E;IAC5E,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;GAMG;AACH,QAAA,MAAM,oBAAoB,EAAE,aAAa,CAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"PhoneNumberComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PhoneNumberComponent.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExD,MAAM,WAAW,yBAAyB;IACxC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACzD,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4EAA4E;IAC5E,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;GAMG;AACH,QAAA,MAAM,oBAAoB,EAAE,aAAa,CAAC,yBAAyB,CAkQlE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import{useId as U,useState as D}from"react";import{Input as C,Checkbox as E,Stack as _,Select as $,CollapsiblePrimitive as A,CollapsibleTrigger as L,CollapsibleContent as M}from"@donotdev/components";import{useTranslation as w,getCurrencySymbol as z}from"@donotdev/core";import{CirclePlus as Y,CircleMinus as q}from"lucide-react";const B=["EUR","USD","GBP","CHF","JPY","KRW"],G=({label:y,value:n,onChange:I,error:s,helperText:h,required:P=!1,disabled:i=!1,placeholder:N="0",defaultCurrency:r="EUR",optionsTitle:x="Price options",currencies:f})=>{const u=U(),{t:m}=w("crud"),o=f?.length?f:[...B],b=n?.currency??r,p=o.includes(b)?b:o[0]??r,O=n?.vatIncluded??!0,v=n?.discountPercent??0,S=`${y} (${z(p)})`,d=e=>{const c=e.amount!==void 0?e.amount:n?.amount??0;let a=e.currency!==void 0?e.currency:n?.currency??r;o.includes(a)||(a=p);const F=e.vatIncluded!==void 0?e.vatIncluded:n?.vatIncluded??!0,R=e.discountPercent!==void 0?e.discountPercent:n?.discountPercent??0;I({amount:Number(c),currency:a,vatIncluded:F,discountPercent:Number(R)})},T=e=>{const c=e.target.value;if(c===""||c===null){d({amount:0});return}const a=parseFloat(c);d({amount:isNaN(a)?0:a})},V=e=>{d({currency:e||r})},j=e=>{const c=e.target.value;if(c===""||c===null){d({discountPercent:0});return}const a=parseFloat(c);d({discountPercent:isNaN(a)?0:a})},[g,k]=D(!1);return l(A,{open:g,onOpenChange:k,children:[l(_,{
|
|
1
|
+
"use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import{useId as U,useState as D}from"react";import{Input as C,Checkbox as E,Stack as _,Select as $,CollapsiblePrimitive as A,CollapsibleTrigger as L,CollapsibleContent as M}from"@donotdev/components";import{useTranslation as w,getCurrencySymbol as z}from"@donotdev/core";import{CirclePlus as Y,CircleMinus as q}from"lucide-react";const B=["EUR","USD","GBP","CHF","JPY","KRW"],G=({label:y,value:n,onChange:I,error:s,helperText:h,required:P=!1,disabled:i=!1,placeholder:N="0",defaultCurrency:r="EUR",optionsTitle:x="Price options",currencies:f})=>{const u=U(),{t:m}=w("crud"),o=f?.length?f:[...B],b=n?.currency??r,p=o.includes(b)?b:o[0]??r,O=n?.vatIncluded??!0,v=n?.discountPercent??0,S=`${y} (${z(p)})`,d=e=>{const c=e.amount!==void 0?e.amount:n?.amount??0;let a=e.currency!==void 0?e.currency:n?.currency??r;o.includes(a)||(a=p);const F=e.vatIncluded!==void 0?e.vatIncluded:n?.vatIncluded??!0,R=e.discountPercent!==void 0?e.discountPercent:n?.discountPercent??0;I({amount:Number(c),currency:a,vatIncluded:F,discountPercent:Number(R)})},T=e=>{const c=e.target.value;if(c===""||c===null){d({amount:0});return}const a=parseFloat(c);d({amount:isNaN(a)?0:a})},V=e=>{d({currency:e||r})},j=e=>{const c=e.target.value;if(c===""||c===null){d({discountPercent:0});return}const a=parseFloat(c);d({discountPercent:isNaN(a)?0:a})},[g,k]=D(!1);return l(A,{open:g,onOpenChange:k,children:[l(_,{children:[l("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:"var(--gap-sm)",alignItems:"end"},children:[t(C,{id:u,type:"number",inputMode:"decimal",label:S,value:n?.amount!==void 0&&n?.amount!==null?n.amount:"",onChange:T,disabled:i,placeholder:N,required:P,min:0,step:.01,"data-variant":s?"destructive":void 0,"aria-invalid":s}),t(L,{asChild:!0,children:t("button",{type:"button","aria-label":x,"aria-expanded":g,className:"dndev-collapsible-trigger",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"var(--gap-sm)",background:"none",border:"none",cursor:"pointer"},children:g?t(q,{className:"dndev-collapsible-icon","aria-hidden":"true"}):t(Y,{className:"dndev-collapsible-icon","aria-hidden":"true"})})})]}),t(M,{className:"dndev-collapsible-content",children:l("div",{style:{display:"grid",gridTemplateColumns:o.length>1?"1fr auto 1fr":"auto 1fr",gap:"var(--gap-sm)",alignItems:"end",paddingTop:"var(--gap-md)"},children:[o.length>1&&t($,{value:p,onValueChange:V,placeholder:r,options:o.map(e=>({value:e,label:e})),disabled:i,label:m("price.currency",{defaultValue:"Currency"})}),t(E,{id:`${u}-vat`,label:m("price.vatIncluded",{defaultValue:"VAT Incl."}),checked:O,onCheckedChange:e=>d({vatIncluded:e===!0}),disabled:i}),t(C,{id:`${u}-discount`,type:"number",inputMode:"decimal",min:0,max:100,step:1,value:v===0?"":v,onChange:j,disabled:i,placeholder:"0",label:m("price.discountLabel",{defaultValue:"Discount (%)"})})]})})]}),h&&t("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)"},children:h})]})};var X=G;export{X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as n}from"react/jsx-runtime";import{Switch as m,Text as i,Stack as l}from"@donotdev/components";import{useTranslation as p}from"@donotdev/core";const f=({label:t,checked:c=!1,onChange:a,uncheckedLabel:
|
|
1
|
+
import{jsxs as e,jsx as n}from"react/jsx-runtime";import{Switch as m,Text as i,Stack as l}from"@donotdev/components";import{useTranslation as p}from"@donotdev/core";const f=({label:t,checked:c=!1,onChange:a,uncheckedLabel:s,checkedLabel:d,helperText:r})=>{const{t:g}=p("dndev"),o=h=>{a&&a({target:{checked:h}})};return e(l,{gap:"tight",children:[e(l,{direction:"row",align:"center",style:{flexWrap:"wrap"},children:[e(i,{level:"body",align:"start",children:[t,":"]}),n(m,{checked:c,onCheckedChange:o,"aria-label":t,variant:"muted",uncheckedLabel:s,checkedLabel:d})]}),r&&n(i,{as:"p",variant:"muted",level:"small",children:r})]})};var v=f;export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as re,jsxs as o}from"react/jsx-runtime";import{ChevronLeft as ae,ChevronRight as ne,RotateCcw as W,RotateCw as M,Trash2 as le,Check as ce,Undo2 as se,ZoomIn as de,ZoomOut as
|
|
1
|
+
"use client";import{jsx as e,Fragment as re,jsxs as o}from"react/jsx-runtime";import{ChevronLeft as ae,ChevronRight as ne,RotateCcw as W,RotateCw as M,Trash2 as le,Check as ce,Undo2 as se,ZoomIn as de,ZoomOut as pe,Maximize2 as me,Grid3X3 as ge}from"lucide-react";import{useCallback as p,useEffect as Z,useState as s,useRef as he}from"react";import ue from"react-easy-crop";import{Button as r,BUTTON_VARIANT as a,Sheet as fe,Stack as l,Text as u,Slider as _,ToggleGroup as ve}from"@donotdev/components";import{useTranslation as we}from"@donotdev/core";import{processImage as ye}from"../../../utils/imageProcessing";import{createPreviewURL as Ce,revokePreviewURL as be}from"../../../utils/imageUtils";const Re={free:void 0,"1:1":1,"4:3":4/3,"16:9":16/9,"3:2":3/2};function ke({images:h,selectedIndex:n,open:L,onClose:U,onUpdate:B,onDelete:S,onNavigate:m,multiple:E=!1}){const{t:i}=we("crud"),[D,C]=s({x:0,y:0}),[f,g]=s(1),[b,v]=s(0),[I,H]=s(null),[P,A]=s("free"),[R,Y]=s(!0),[w,y]=s(!1),[G,z]=s(!1),[$,k]=s(!1),T=he({crop:{x:0,y:0},zoom:1,rotation:0}),c=h[n],O=E&&n>0,x=E&&n<h.length-1;Z(()=>{if(c){const t={x:0,y:0};C(t),g(1),v(c.rotation*90),A("free"),y(!1),k(!1),T.current={crop:t,zoom:1,rotation:c.rotation*90}}},[c]);const q=p((t,d)=>{H(d)},[]),K=p(()=>{C(T.current.crop),g(T.current.zoom),v(T.current.rotation)},[]),j=p(()=>{v(t=>(t-90+360)%360)},[]),F=p(()=>{v(t=>(t+90)%360)},[]),X=p(()=>{g(t=>Math.min(t+.25,3))},[]),J=p(()=>{g(t=>Math.max(t-.25,1))},[]),Q=p(()=>{g(1),C({x:0,y:0})},[]),ee=async()=>{if(!(!c||!I)){z(!0);try{const t=await ye(c.file,{crop:I,maxWidth:2048,maxHeight:2048,quality:.95}),d=new File([t.fullBlob],c.file.name,{type:"image/webp"}),oe=Ce(d);c.previewURL.startsWith("blob:")&&be(c.previewURL),B(n,{file:d,previewURL:oe,uploaded:null,uploadProgress:null,error:null,rotation:0}),y(!1)}catch{}finally{z(!1)}}},te=p(()=>{S(n),k(!1),h.length===1?U():n>=h.length-1&&m(n-1)},[n,h.length,S,U,m]);if(Z(()=>{if(!L)return;const t=d=>{d.key==="ArrowLeft"&&O?m(n-1):d.key==="ArrowRight"&&x?m(n+1):d.key==="Escape"&&w&&y(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[L,O,x,n,m,w]),!c)return null;const N=c.uploadProgress!==null&&c.uploadProgress<100,V=c.uploaded?.fullUrl||c.previewURL,ie=E?i("image.editor.titleWithIndex",{current:n+1,total:h.length}):i("image.editor.title");return e(fe,{open:L,onOpenChange:t=>!t&&U(),side:"right",title:ie,description:i("image.editor.description"),noSwipe:w,children:o(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:w?e(ue,{image:V,crop:D,zoom:f,rotation:b,aspect:Re[P],onCropChange:C,onCropComplete:q,onZoomChange:g,showGrid:R,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)"}}}):o(re,{children:[O&&e(r,{variant:a.GHOST,icon:ae,onClick:()=>m(n-1),"aria-label":i("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:V,alt:`Image ${n+1}`,style:{width:"100%",height:"100%",objectFit:"contain",transform:`rotate(${b}deg)`,transition:"transform var(--dur-normal) var(--ease-out)"}}),x&&e(r,{variant:a.GHOST,icon:ne,onClick:()=>m(n+1),"aria-label":i("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"}})]})}),w?o(l,{children:[o(l,{gap:"tight",children:[e(u,{level:"small",variant:"muted",children:i("image.editor.aspectRatio")}),e(ve,{type:"single",value:P,onValueChange:t=>t&&A(t),items:[{value:"free",label:i("image.editor.aspectFree")},{value:"1:1",label:"1:1"},{value:"4:3",label:"4:3"},{value:"16:9",label:"16:9"}]})]}),o(l,{gap:"tight",children:[o(l,{direction:"row",justify:"between",align:"center",children:[e(u,{level:"small",variant:"muted",children:i("image.editor.zoom")}),o(u,{level:"small",variant:"muted",children:[Math.round(f*100),"%"]})]}),o(l,{direction:"row",gap:"tight",align:"center",children:[e(r,{variant:a.OUTLINE,icon:pe,display:"compact",onClick:J,disabled:f<=1}),e(_,{value:[f],min:1,max:3,step:.05,onValueChange:t=>g(t[0]??1),style:{flex:1}}),e(r,{variant:a.OUTLINE,icon:de,display:"compact",onClick:X,disabled:f>=3})]})]}),o(l,{gap:"tight",children:[o(l,{direction:"row",justify:"between",align:"center",children:[e(u,{level:"small",variant:"muted",children:i("image.editor.rotation")}),o(u,{level:"small",variant:"muted",children:[b,"\xB0"]})]}),o(l,{direction:"row",gap:"tight",align:"center",children:[e(r,{variant:a.OUTLINE,icon:W,display:"compact",onClick:j,tooltip:i("image.editor.rotateLeft")}),e(_,{value:[b],min:0,max:360,step:1,onValueChange:t=>v(t[0]??0),style:{flex:1}}),e(r,{variant:a.OUTLINE,icon:M,display:"compact",onClick:F,tooltip:i("image.editor.rotateRight")})]})]}),o(l,{direction:"row",gap:"tight",children:[e(r,{variant:a.OUTLINE,icon:me,display:"compact",onClick:Q,tooltip:i("image.editor.fitToView")}),e(r,{variant:a.OUTLINE,icon:ge,display:"compact",onClick:()=>Y(!R),tooltip:i(R?"image.editor.hideGrid":"image.editor.showGrid"),"data-active":R||void 0}),e(r,{variant:a.OUTLINE,icon:se,display:"compact",onClick:K,tooltip:i("image.editor.reset")})]}),o(l,{direction:"row",style:{marginTop:"var(--gap-md)"},children:[e(r,{variant:a.OUTLINE,onClick:()=>y(!1),fullWidth:!0,children:i("image.editor.cancel")}),e(r,{variant:a.PRIMARY,icon:ce,onClick:ee,disabled:G,fullWidth:!0,children:i(G?"image.editor.processing":"image.editor.apply")})]})]}):o(l,{children:[o(l,{direction:"row",gap:"tight",justify:"center",children:[e(r,{variant:a.OUTLINE,icon:W,display:"compact",onClick:j,tooltip:i("image.editor.rotateLeft")}),e(r,{variant:a.PRIMARY,onClick:()=>y(!0),disabled:N,children:i("image.editor.editButton")}),e(r,{variant:a.OUTLINE,icon:M,display:"compact",onClick:F,tooltip:i("image.editor.rotateRight")})]}),$?o(l,{style:{border:"1px solid var(--destructive)",padding:"var(--gap-md)",borderRadius:"var(--radius-md)"},children:[e(u,{variant:"destructive",level:"small",align:"center",children:i("image.editor.deleteConfirm")}),o(l,{direction:"row",gap:"tight",children:[e(r,{variant:a.OUTLINE,onClick:()=>k(!1),fullWidth:!0,children:i("image.editor.cancel")}),e(r,{variant:a.DESTRUCTIVE,onClick:te,fullWidth:!0,children:i("actions.delete")})]})]}):e(r,{variant:a.GHOST,icon:le,onClick:()=>k(!0),disabled:N,style:{color:"var(--destructive)"},children:i("image.editor.deleteImage")})]})]})})}var Pe=ke;export{ke as ImageViewerDialog,Pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntityForm.d.ts","sourceRoot":"","sources":["../../../src/forms/hooks/useEntityForm.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAW7C,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAEjB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAC5C,MAAM,EAAE,CAAC,EACT,OAAO,GAAE,oBAAoB,CAAC,CAAC,CAAM,GACpC,gBAAgB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useEntityForm.d.ts","sourceRoot":"","sources":["../../../src/forms/hooks/useEntityForm.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAW7C,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAEjB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAC5C,MAAM,EAAE,CAAC,EACT,OAAO,GAAE,oBAAoB,CAAC,CAAC,CAAM,GACpC,gBAAgB,CAAC,CAAC,CAAC,CAgdrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFieldsForOperation.d.ts","sourceRoot":"","sources":["../../../src/forms/utils/getFieldsForOperation.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGrE,+EAA+E;AAC/E,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,MAAM,CAAC,QAAQ,CAAC,GAChB,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;AAI3C,oDAAoD;AACpD,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IAC9D,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACvB,qDAAqD;IACrD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,kCAAkC;AAClC,MAAM,WAAW,4BAA4B;IAC3C,0BAA0B;IAC1B,SAAS,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC7B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,4BAA4B,GACpC,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"getFieldsForOperation.d.ts","sourceRoot":"","sources":["../../../src/forms/utils/getFieldsForOperation.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGrE,+EAA+E;AAC/E,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,MAAM,CAAC,QAAQ,CAAC,GAChB,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;AAI3C,oDAAoD;AACpD,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IAC9D,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACvB,qDAAqD;IACrD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,kCAAkC;AAClC,MAAM,WAAW,4BAA4B;IAC3C,0BAA0B;IAC1B,SAAS,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC7B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,4BAA4B,GACpC,eAAe,EAAE,CAuDnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translateFieldLabel.d.ts","sourceRoot":"","sources":["../../../src/forms/utils/translateFieldLabel.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,GACxD,MAAM,
|
|
1
|
+
{"version":3,"file":"translateFieldLabel.d.ts","sourceRoot":"","sources":["../../../src/forms/utils/translateFieldLabel.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,GACxD,MAAM,CAgCR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EACjE,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,EAClC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,GACxD,MAAM,CAGR"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export type { FileMetadata, UseFileUploadOptions } from './useFileUpload';
|
|
|
3
3
|
export { useUnsavedChangesWarning, useConfirmNavigation, } from './useUnsavedChangesWarning';
|
|
4
4
|
export { useEntityFavorites } from './useEntityFavorites';
|
|
5
5
|
export type { UseEntityFavoritesOptions, UseEntityFavoritesReturn, } from './useEntityFavorites';
|
|
6
|
+
export { useCrudFilters } from './useCrudFilters';
|
|
7
|
+
export type { UseCrudFiltersOptions, UseCrudFiltersReturn, } from './useCrudFilters';
|
|
6
8
|
export { useRelatedItems } from './useRelatedItems';
|
|
7
9
|
export type { UseRelatedItemsOptions, UseRelatedItemsReturn, } from './useRelatedItems';
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|