greenole-design-system 1.1.41 → 1.1.42

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.
@@ -436,6 +436,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[d8]+=1);const k1={h1:f`
436
436
  height: 48px;
437
437
  border-radius: 8px;
438
438
  outline: none;
439
+ cursor: pointer;
439
440
  border: 1px solid var(--neutral-soft);
440
441
  ${e=>e.className}
441
442
 
@@ -1228,7 +1229,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[d8]+=1);const k1={h1:f`
1228
1229
  &:active {
1229
1230
  transform: scale(0.95);
1230
1231
  }
1231
- `,r3=({variant:e="input",maxSize:r=5,acceptedTypes:n="image/png, image/jpeg, image/jpg, application/pdf",previewSize:o={width:60,height:60},multiple:s=!1,maxFiles:a=5,aspectRatio:l,initialImage:h,onUpload:d,onRemove:c})=>{var I;const{t:p}=E8(),[L,V]=b.useState([]),[g,E]=b.useState(null),[v,S]=b.useState(""),_=b.useRef(null);b.useEffect(()=>{h&&E(h)},[h]);const Z=()=>{var w;(w=_.current)==null||w.click()},T=w=>new Promise(z=>{if(!l||!w.type.startsWith("image/")){z(!0);return}const O=new Image;O.onload=()=>{const m=O.width/O.height,x=l.width/l.height;z(Math.abs(m-x)<=.1)},O.onerror=()=>z(!1),O.src=URL.createObjectURL(w)}),R=async w=>{const z=Array.from(w.target.files||[]);if(z.length===0)return;S("");const O=L.length+z.length;if(s&&O>a){S(p("UPLOAD_COMPONENT.MAX_FILES_LIMIT",{maxFiles:a,defaultValue:"Maximum of {{maxFiles}} files allowed"}));return}const m=s?z:[z[0]];for(const M of m){if(!n.includes(M.type)){S(p("UPLOAD_COMPONENT.UNSUPPORTED_FILE_TYPE",{defaultValue:"Unsupported file type"}));return}if(M.size>r*1024*1024){S(p("UPLOAD_COMPONENT.MAX_FILE_SIZE",{maxSize:r,defaultValue:"File must be at most {{maxSize}}MB"}));return}if(!await T(M)&&l){S(p("UPLOAD_COMPONENT.ASPECT_RATIO_ERROR",{width:l.width,height:l.height,defaultValue:"Image dimensions must be {{width}}:{{height}} (width:height). Please crop or resize your image."}));return}}const x=s?[...L,...m]:m;V(x),E(null),d==null||d(x),_.current&&(_.current.value="")},P=w=>{if(g&&L.length===0){E(null),c==null||c(w);return}const z=L.filter((O,m)=>m!==w);V(z),d==null||d(z),c==null||c(w)},F=w=>typeof w=="string"?w:w.type.startsWith("image/")?URL.createObjectURL(w):"",$=w=>{const z=w/1024,O=z/1024;return O<1?`${z.toFixed(2)} KB`:`${O.toFixed(2)} MB`},U=()=>L.length>0||g?p("UPLOAD_COMPONENT.FILES_SELECTED",{count:L.length||1,defaultValue:"{{count}} file selected"}):s?p("UPLOAD_COMPONENT.CHOOSE_IMAGES",{defaultValue:"Choose the images"}):p("UPLOAD_COMPONENT.CHOOSE_IMAGE",{defaultValue:"Choose the image"}),q=()=>s?p("UPLOAD_COMPONENT.UPLOAD_FILES",{defaultValue:"Upload files"}):p("UPLOAD_COMPONENT.UPLOAD_FILE",{defaultValue:"Upload file"});return t.jsxs(q9,{variant:e,children:[e==="input"&&t.jsxs(t.Fragment,{children:[t.jsxs(X9,{children:[t.jsx(G9,{children:t.jsxs("label",{children:[t.jsx(X7,{ref:_,type:"file",accept:n,multiple:s,onChange:R}),t.jsx(K9,{children:U()})]})}),t.jsx(J9,{onClick:Z,children:t.jsx(A2,{size:23})})]}),(L.length>0||g)&&t.jsxs(G7,{variant:e,children:[g&&t.jsxs(N1,{children:[t.jsx(K7,{children:t.jsx("span",{children:g.split("/").pop()})}),t.jsx(z1,{onClick:()=>P(0),children:t.jsx(b1,{size:16})})]}),L.map((w,z)=>t.jsxs(N1,{children:[t.jsxs(K7,{children:[t.jsx("span",{children:w.name}),$(w.size)]}),t.jsx(z1,{onClick:()=>P(z),children:t.jsx(b1,{size:16})})]},`${w.name}-${z}`))]})]}),e==="preview"&&t.jsxs(e3,{children:[t.jsx(G7,{variant:e,children:s?t.jsxs(t.Fragment,{children:[g&&t.jsxs(N1,{children:[t.jsx(h8,{size:o,style:{backgroundImage:`url(${F(g)})`,padding:"18x"}}),t.jsx(z1,{onClick:()=>P(0),children:t.jsx(b1,{size:16})})]}),L.map((w,z)=>t.jsxs(N1,{children:[t.jsx(h8,{size:o,style:{backgroundImage:w.type.startsWith("image/")?`url(${F(w)})`:"none"},children:!w.type.startsWith("image/")&&t.jsx("span",{style:{fontSize:"12px"},children:(w==null?void 0:w.name.split(".").at(-1))||p("UPLOAD_COMPONENT.PDF_LABEL",{defaultValue:"PDF"})})}),t.jsx(z1,{onClick:()=>P(z),children:t.jsx(b1,{size:16})})]},`${w.name}-${z}`))]}):t.jsxs(t.Fragment,{children:[g&&!L.length&&t.jsxs(N1,{children:[t.jsx(h8,{size:o,style:{backgroundImage:`url(${F(g)})`,padding:"18x"}}),t.jsx(z1,{onClick:()=>P(0),children:t.jsx(b1,{size:16})})]}),L.length>0&&t.jsxs(N1,{children:[t.jsx(h8,{size:o,style:{backgroundImage:L[0].type.startsWith("image/")?`url(${F(L[0])})`:"none"},children:!L[0].type.startsWith("image/")&&t.jsx("span",{style:{fontSize:"12px"},children:((I=L[0])==null?void 0:I.name.split(".").at(-1))||p("UPLOAD_COMPONENT.PDF_LABEL",{defaultValue:"PDF"})})}),t.jsx(z1,{onClick:()=>P(0),children:t.jsx(b1,{size:16})})]})]})}),t.jsxs("label",{children:[t.jsx(X7,{ref:_,type:"file",accept:n,multiple:s,onChange:R}),t.jsxs(Q9,{children:[t.jsx(T2,{size:20}),q()]})]})]}),v&&t.jsx(t3,{children:v})]})},I2=b.createContext(null),n3=({children:e})=>{const[r,n]=b.useState([]),o=b.useCallback((a,l="info",h={})=>{const d=Date.now()+Math.random(),c={id:d,message:a,variant:l,description:h.description,position:h.position??"top-right",autoDismiss:h.autoDismiss??!0,autoDismissTime:h.autoDismissTime??4e3};n(p=>[...p,c]),c.autoDismiss&&setTimeout(()=>{n(p=>p.filter(L=>L.id!==d))},c.autoDismissTime)},[]),s=b.useCallback(()=>n([]),[]);return t.jsxs(I2.Provider,{value:{showToast:o,clearToasts:s},children:[e,["top-left","top-right","bottom-left","bottom-right"].map(a=>t.jsx("div",{style:{position:"fixed",[a.includes("bottom")?"bottom":"top"]:16,[a.includes("right")?"right":"left"]:16,display:"flex",flexDirection:a.includes("bottom")?"column-reverse":"column",gap:8,zIndex:9999},children:r.filter(l=>l.position===a).map(l=>t.jsx(R2,{message:l.message,description:l.description,variant:l.variant,onClose:()=>n(h=>h.filter(d=>d.id!==l.id))},l.id))},a))]})},o3=()=>{const e=b.useContext(I2);if(!e)throw new Error("useToast must be used within <ToastProvider>");return e},s3=u.div`
1232
+ `,r3=({variant:e="input",maxSize:r=5,acceptedTypes:n="image/png, image/jpeg, image/jpg, application/pdf",previewSize:o={width:60,height:60},multiple:s=!1,maxFiles:a=5,aspectRatio:l,initialImage:h,onUpload:d,onRemove:c})=>{var I;const{t:p}=E8(),[L,V]=b.useState([]),[g,E]=b.useState(null),[v,S]=b.useState(""),_=b.useRef(null);b.useEffect(()=>{h&&E(h)},[h]);const Z=()=>{var w;(w=_.current)==null||w.click()},T=w=>new Promise(z=>{if(!l||!w.type.startsWith("image/")){z(!0);return}const O=new Image;O.onload=()=>{const m=O.width/O.height,x=l.width/l.height;z(Math.abs(m-x)<=.1)},O.onerror=()=>z(!1),O.src=URL.createObjectURL(w)}),R=async w=>{const z=Array.from(w.target.files||[]);if(z.length===0)return;S("");const O=L.length+z.length;if(s&&O>a){S(p("UPLOAD_COMPONENT.MAX_FILES_LIMIT",{maxFiles:a,defaultValue:"Maximum of {{maxFiles}} files allowed"}));return}const m=s?z:[z[0]];for(const M of m){if(!n.includes(M.type)){S(p("UPLOAD_COMPONENT.UNSUPPORTED_FILE_TYPE",{defaultValue:"Unsupported file type"}));return}if(M.size>r*1024*1024){S(p("UPLOAD_COMPONENT.MAX_FILE_SIZE",{maxSize:r,defaultValue:"File must be at most {{maxSize}}MB"}));return}if(!await T(M)&&l){S(p("UPLOAD_COMPONENT.ASPECT_RATIO_ERROR",{width:l.width,height:l.height,defaultValue:`Image dimensions must be ${l.width}:${l.height} (width:height). Please crop or resize your image.`}));return}}const x=s?[...L,...m]:m;V(x),E(null),d==null||d(x),_.current&&(_.current.value="")},P=w=>{if(g&&L.length===0){E(null),c==null||c(w);return}const z=L.filter((O,m)=>m!==w);V(z),d==null||d(z),c==null||c(w)},F=w=>typeof w=="string"?w:w.type.startsWith("image/")?URL.createObjectURL(w):"",$=w=>{const z=w/1024,O=z/1024;return O<1?`${z.toFixed(2)} KB`:`${O.toFixed(2)} MB`},U=()=>L.length>0||g?p("UPLOAD_COMPONENT.FILES_SELECTED",{count:L.length||1,defaultValue:"{{count}} file selected"}):s?p("UPLOAD_COMPONENT.CHOOSE_IMAGES",{defaultValue:"Choose the images"}):p("UPLOAD_COMPONENT.CHOOSE_IMAGE",{defaultValue:"Choose the image"}),q=()=>s?p("UPLOAD_COMPONENT.UPLOAD_FILES",{defaultValue:"Upload files"}):p("UPLOAD_COMPONENT.UPLOAD_FILE",{defaultValue:"Upload file"});return t.jsxs(q9,{variant:e,children:[e==="input"&&t.jsxs(t.Fragment,{children:[t.jsxs(X9,{children:[t.jsx(G9,{children:t.jsxs("label",{children:[t.jsx(X7,{ref:_,type:"file",accept:n,multiple:s,onChange:R}),t.jsx(K9,{children:U()})]})}),t.jsx(J9,{onClick:Z,children:t.jsx(A2,{size:23})})]}),(L.length>0||g)&&t.jsxs(G7,{variant:e,children:[g&&t.jsxs(N1,{children:[t.jsx(K7,{children:t.jsx("span",{children:g.split("/").pop()})}),t.jsx(z1,{onClick:()=>P(0),children:t.jsx(b1,{size:16})})]}),L.map((w,z)=>t.jsxs(N1,{children:[t.jsxs(K7,{children:[t.jsx("span",{children:w.name}),$(w.size)]}),t.jsx(z1,{onClick:()=>P(z),children:t.jsx(b1,{size:16})})]},`${w.name}-${z}`))]})]}),e==="preview"&&t.jsxs(e3,{children:[t.jsx(G7,{variant:e,children:s?t.jsxs(t.Fragment,{children:[g&&t.jsxs(N1,{children:[t.jsx(h8,{size:o,style:{backgroundImage:`url(${F(g)})`,padding:"18x"}}),t.jsx(z1,{onClick:()=>P(0),children:t.jsx(b1,{size:16})})]}),L.map((w,z)=>t.jsxs(N1,{children:[t.jsx(h8,{size:o,style:{backgroundImage:w.type.startsWith("image/")?`url(${F(w)})`:"none"},children:!w.type.startsWith("image/")&&t.jsx("span",{style:{fontSize:"12px"},children:(w==null?void 0:w.name.split(".").at(-1))||p("UPLOAD_COMPONENT.PDF_LABEL",{defaultValue:"PDF"})})}),t.jsx(z1,{onClick:()=>P(z),children:t.jsx(b1,{size:16})})]},`${w.name}-${z}`))]}):t.jsxs(t.Fragment,{children:[g&&!L.length&&t.jsxs(N1,{children:[t.jsx(h8,{size:o,style:{backgroundImage:`url(${F(g)})`,padding:"18x"}}),t.jsx(z1,{onClick:()=>P(0),children:t.jsx(b1,{size:16})})]}),L.length>0&&t.jsxs(N1,{children:[t.jsx(h8,{size:o,style:{backgroundImage:L[0].type.startsWith("image/")?`url(${F(L[0])})`:"none"},children:!L[0].type.startsWith("image/")&&t.jsx("span",{style:{fontSize:"12px"},children:((I=L[0])==null?void 0:I.name.split(".").at(-1))||p("UPLOAD_COMPONENT.PDF_LABEL",{defaultValue:"PDF"})})}),t.jsx(z1,{onClick:()=>P(0),children:t.jsx(b1,{size:16})})]})]})}),t.jsxs("label",{children:[t.jsx(X7,{ref:_,type:"file",accept:n,multiple:s,onChange:R}),t.jsxs(Q9,{children:[t.jsx(T2,{size:20}),q()]})]})]}),v&&t.jsx(t3,{children:v})]})},I2=b.createContext(null),n3=({children:e})=>{const[r,n]=b.useState([]),o=b.useCallback((a,l="info",h={})=>{const d=Date.now()+Math.random(),c={id:d,message:a,variant:l,description:h.description,position:h.position??"top-right",autoDismiss:h.autoDismiss??!0,autoDismissTime:h.autoDismissTime??4e3};n(p=>[...p,c]),c.autoDismiss&&setTimeout(()=>{n(p=>p.filter(L=>L.id!==d))},c.autoDismissTime)},[]),s=b.useCallback(()=>n([]),[]);return t.jsxs(I2.Provider,{value:{showToast:o,clearToasts:s},children:[e,["top-left","top-right","bottom-left","bottom-right"].map(a=>t.jsx("div",{style:{position:"fixed",[a.includes("bottom")?"bottom":"top"]:16,[a.includes("right")?"right":"left"]:16,display:"flex",flexDirection:a.includes("bottom")?"column-reverse":"column",gap:8,zIndex:9999},children:r.filter(l=>l.position===a).map(l=>t.jsx(R2,{message:l.message,description:l.description,variant:l.variant,onClose:()=>n(h=>h.filter(d=>d.id!==l.id))},l.id))},a))]})},o3=()=>{const e=b.useContext(I2);if(!e)throw new Error("useToast must be used within <ToastProvider>");return e},s3=u.div`
1232
1233
  display: flex;
1233
1234
  flex-direction: column;
1234
1235
  gap: 8px;
@@ -3614,6 +3614,7 @@ const b5 = f.div`
3614
3614
  height: 48px;
3615
3615
  border-radius: 8px;
3616
3616
  outline: none;
3617
+ cursor: pointer;
3617
3618
  border: 1px solid var(--neutral-soft);
3618
3619
  ${(e) => e.className}
3619
3620
 
@@ -4940,7 +4941,7 @@ const b5 = f.div`
4940
4941
  p("UPLOAD_COMPONENT.ASPECT_RATIO_ERROR", {
4941
4942
  width: l.width,
4942
4943
  height: l.height,
4943
- defaultValue: "Image dimensions must be {{width}}:{{height}} (width:height). Please crop or resize your image."
4944
+ defaultValue: `Image dimensions must be ${l.width}:${l.height} (width:height). Please crop or resize your image.`
4944
4945
  })
4945
4946
  );
4946
4947
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greenole-design-system",
3
- "version": "1.1.41",
3
+ "version": "1.1.42",
4
4
  "type": "module",
5
5
  "main": "dist/greenole-design-system.cjs.js",
6
6
  "module": "dist/greenole-design-system.es.js",