@ynput/ayon-react-components 0.1.8 → 0.1.9

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.
@@ -4332,7 +4332,7 @@ const Rr = (t) => Math.max(Math.min(Math.round(parseInt(t, 16) / 255 * 100) / 10
4332
4332
  }) => {
4333
4333
  const l = a === "hex";
4334
4334
  let o, u;
4335
- l ? (o = e, typeof o != "string" && (o = "#FFFFFF"), u = i ? Rr(o.slice(7, 9)) : 1, o = o.slice(0, 7)) : (o = [...e], Array.isArray(e) || (o = [0, 0, 0]), u = i && o[3] || 1, o = o.slice(0, 3));
4335
+ l ? (o = e, typeof o != "string" && (o = "#FFFFFF"), u = i ? Rr(o.slice(7, 9)) : 1, e.length < 8 && (u = 1), o = o.slice(0, 7)) : (o = [...e], Array.isArray(e) || (o = [0, 0, 0]), i && (o[3] || o[3] == 0 ? u = o[3] : u = 1), o = o.slice(0, 3));
4336
4336
  const [c, f] = It(o), [v, g] = It(u), [d, C] = It(!1);
4337
4337
  Yr(() => {
4338
4338
  g(u), f(o);
@@ -484,4 +484,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
484
484
  justify-content: center;
485
485
  gap: var(--base-gap-large);
486
486
  margin-top: 12px;
487
- `,dt={hex:{placeholder:"#34C95C"},float:{placeholder:.5,step:.01,max:1},uint8:{placeholder:255,step:1,max:255},uint16:{placeholder:65535,step:1,max:65535}},qr=({style:t,className:n,value:e,onChange:r,alpha:i,format:a="hex"})=>{const u=a==="hex";let o,l;u?(o=e,typeof o!="string"&&(o="#FFFFFF"),l=i?Yr(o.slice(7,9)):1,o=o.slice(0,7)):(o=[...e],Array.isArray(e)||(o=[0,0,0]),l=i&&o[3]||1,o=o.slice(0,3));const[c,f]=Ae.useState(o),[v,g]=Ae.useState(l),[d,C]=Ae.useState(!1);Ae.useEffect(()=>{g(l),f(o)},[e,g,f]);const w=["r","g","b"],W=k=>{k.preventDefault();const{id:ie,value:B}=k.target;let ee;u?ee=B:(ee=[...c],ee.splice(w.indexOf(ie),1,B)),f(ee)},S=k=>{k.preventDefault();const ie=k.target.value;if(u)return f(ie);const B=ie.slice(1,7).match(/.{1,2}/g).map(ee=>Yr(ee));if(a==="float")return f(B);if(a==="uint8")return f(B.map(ee=>Kt(ee)));if(a==="uint16")return f(B.map(ee=>fi(ee)))},b=()=>{C(!0)},H=()=>{C(!1);let k;if(u?(k=c,k=ai(k,o)):(k=[...c],k=k.map((B,ee)=>isNaN(B)||B===""?o[ee]:parseFloat(B))),console.log(c),f(k),i){let B=v===""||isNaN(v)?l:v;B=Math.min(Math.max(parseFloat(B),0),1),g(B),u?k=k+(B>0?Br(Kt(B)):"00"):k=[...k,B]}r({target:{value:k}})},Q=()=>{console.log("cancelling"),f(o),g(l),C(!1)},x=`Colour Picker (${a.charAt(0).toUpperCase()+a.slice(1)})`,de=u?c:ii(c,a);let Ee=de;i&&(Ee=de+(v>0?Br(Kt(v)):"00"));const me=i||["uint16","float"].includes(a);return ue("div",{style:t,className:n,children:[P(Vr,{onClick:me?b:void 0,backgroundColor:Ee,value:de,onChange:me?void 0:S,onBlur:()=>!me&&H()}),ue(ft,{header:x,onHide:Q,visible:d,children:[ue(di,{children:[P(Vr,{onChange:S,backgroundColor:Ee,value:de}),u?ue("div",{children:[P("label",{htmlFor:"hex",children:"HEX"}),P(At,{id:"hex",value:c,onChange:W,name:"hex",maxLength:7,placeholder:dt.hex.placeholder,required:!0,onKeyPress:k=>k.charCode===13&&H()})]}):w.map((k,ie)=>{const B=c[ie];return ue("div",{children:[P("label",{htmlFor:k,children:k.toUpperCase()}),P(st,{id:k,min:0,max:dt[a].max,value:B,step:dt[a].step,onChange:W,placeholder:dt[a].placeholder,required:!0,onKeyPress:ee=>ee.charCode===13&&H()})]},k)}),i&&ue("div",{children:[P("label",{htmlFor:"a",children:"A"}),P(st,{id:"a",min:0,max:1,value:v,step:.01,onChange:k=>g(k.target.value),placeholder:.5,required:!0,onKeyPress:k=>k.charCode===13&&H()})]},"a")]}),ue(pi,{children:[P(Ot,{label:"Cancel",onClick:Q}),P(Ot,{label:"Apply",onClick:H})]})]})]})};qr.propTypes={alpha:O.exports.bool,format:O.exports.oneOf(["hex","float","uint8","uint16"])};const vi="";Z.Button=Ot,Z.Divider=sn,Z.FormLayout=nn,Z.FormRow=on,Z.InputColor=qr,Z.InputNumber=st,Z.InputPassword=pr,Z.InputSwitch=pn,Z.InputText=At,Z.InputTextarea=fn,Z.LinkButton=Qr,Z.LoaderShade=dr,Z.Panel=_t,Z.ScrollPanel=cn,Z.Section=en,Z.Shade=fr,Z.Spacer=rn,Z.TablePanel=ln,Z.Toolbar=tn,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
487
+ `,dt={hex:{placeholder:"#34C95C"},float:{placeholder:.5,step:.01,max:1},uint8:{placeholder:255,step:1,max:255},uint16:{placeholder:65535,step:1,max:65535}},qr=({style:t,className:n,value:e,onChange:r,alpha:i,format:a="hex"})=>{const u=a==="hex";let o,l;u?(o=e,typeof o!="string"&&(o="#FFFFFF"),l=i?Yr(o.slice(7,9)):1,e.length<8&&(l=1),o=o.slice(0,7)):(o=[...e],Array.isArray(e)||(o=[0,0,0]),i&&(o[3]||o[3]==0?l=o[3]:l=1),o=o.slice(0,3));const[c,f]=Ae.useState(o),[v,g]=Ae.useState(l),[d,C]=Ae.useState(!1);Ae.useEffect(()=>{g(l),f(o)},[e,g,f]);const w=["r","g","b"],W=k=>{k.preventDefault();const{id:ie,value:B}=k.target;let ee;u?ee=B:(ee=[...c],ee.splice(w.indexOf(ie),1,B)),f(ee)},S=k=>{k.preventDefault();const ie=k.target.value;if(u)return f(ie);const B=ie.slice(1,7).match(/.{1,2}/g).map(ee=>Yr(ee));if(a==="float")return f(B);if(a==="uint8")return f(B.map(ee=>Kt(ee)));if(a==="uint16")return f(B.map(ee=>fi(ee)))},b=()=>{C(!0)},H=()=>{C(!1);let k;if(u?(k=c,k=ai(k,o)):(k=[...c],k=k.map((B,ee)=>isNaN(B)||B===""?o[ee]:parseFloat(B))),console.log(c),f(k),i){let B=v===""||isNaN(v)?l:v;B=Math.min(Math.max(parseFloat(B),0),1),g(B),u?k=k+(B>0?Br(Kt(B)):"00"):k=[...k,B]}r({target:{value:k}})},Q=()=>{console.log("cancelling"),f(o),g(l),C(!1)},x=`Colour Picker (${a.charAt(0).toUpperCase()+a.slice(1)})`,de=u?c:ii(c,a);let Ee=de;i&&(Ee=de+(v>0?Br(Kt(v)):"00"));const me=i||["uint16","float"].includes(a);return ue("div",{style:t,className:n,children:[P(Vr,{onClick:me?b:void 0,backgroundColor:Ee,value:de,onChange:me?void 0:S,onBlur:()=>!me&&H()}),ue(ft,{header:x,onHide:Q,visible:d,children:[ue(di,{children:[P(Vr,{onChange:S,backgroundColor:Ee,value:de}),u?ue("div",{children:[P("label",{htmlFor:"hex",children:"HEX"}),P(At,{id:"hex",value:c,onChange:W,name:"hex",maxLength:7,placeholder:dt.hex.placeholder,required:!0,onKeyPress:k=>k.charCode===13&&H()})]}):w.map((k,ie)=>{const B=c[ie];return ue("div",{children:[P("label",{htmlFor:k,children:k.toUpperCase()}),P(st,{id:k,min:0,max:dt[a].max,value:B,step:dt[a].step,onChange:W,placeholder:dt[a].placeholder,required:!0,onKeyPress:ee=>ee.charCode===13&&H()})]},k)}),i&&ue("div",{children:[P("label",{htmlFor:"a",children:"A"}),P(st,{id:"a",min:0,max:1,value:v,step:.01,onChange:k=>g(k.target.value),placeholder:.5,required:!0,onKeyPress:k=>k.charCode===13&&H()})]},"a")]}),ue(pi,{children:[P(Ot,{label:"Cancel",onClick:Q}),P(Ot,{label:"Apply",onClick:H})]})]})]})};qr.propTypes={alpha:O.exports.bool,format:O.exports.oneOf(["hex","float","uint8","uint16"])};const vi="";Z.Button=Ot,Z.Divider=sn,Z.FormLayout=nn,Z.FormRow=on,Z.InputColor=qr,Z.InputNumber=st,Z.InputPassword=pr,Z.InputSwitch=pn,Z.InputText=At,Z.InputTextarea=fn,Z.LinkButton=Qr,Z.LoaderShade=dr,Z.Panel=_t,Z.ScrollPanel=cn,Z.Section=en,Z.Shade=fr,Z.Spacer=rn,Z.TablePanel=ln,Z.Toolbar=tn,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ynput/ayon-react-components",
3
3
  "private": false,
4
- "version": "0.1.8",
4
+ "version": "0.1.9",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",