@internxt/ui 0.1.0 → 0.1.1

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/index.cjs.js CHANGED
@@ -131,7 +131,7 @@ function print() { __p += __j.call(arguments, '') }
131
131
  ${T}
132
132
  ${k}
133
133
  ${m}
134
- `,children:u})]}):null},wo=({childrenButton:l,panel:p,className:u,classButton:m})=>{const[y,b]=P.useState(!1),E=P.useRef(null),[I,T]=P.useState(y),[$,k]=P.useState("opacity-0"),[L,M]=P.useState("scale-95"),G=()=>b(R=>!R),F=R=>{E.current&&!E.current.contains(R.target)&&ue()},ue=()=>{b(!1)};return P.useEffect(()=>{if(y){const R=setTimeout(()=>{k("opacity-100"),M("scale-100")},10);return T(!0),()=>clearTimeout(R)}else{k("opacity-0"),M("scale-95");const R=setTimeout(()=>{T(!1)},100);return()=>clearTimeout(R)}},[y]),P.useEffect(()=>(document.addEventListener("mousedown",F),()=>{document.removeEventListener("mousedown",F)}),[]),h.jsxs("div",{style:{lineHeight:0},className:`relative ${u}`,children:[h.jsx("button",{onClick:G,className:`cursor-pointer outline-none ${m}`,"aria-expanded":y,"data-testid":"popover-button",children:l}),I&&h.jsx("div",{ref:E,className:`absolute right-0 z-50 mt-1 origin-top-right transform rounded-md border border-gray-10 bg-surface py-1.5 shadow-subtle duration-100 ease-out dark:bg-gray-5 ${$} ${L}`,children:p(ue)})]})},ap=({checked:l,id:p,disabled:u=!1,onClick:m})=>{const y=u?"border-gray-10":"border-gray-40",b=u&&l?"border-0 bg-gray-20":l&&"border-0 bg-primary active:bg-primary-dark";return h.jsxs("div",{id:p,className:"flex cursor-pointer",children:[h.jsx("button",{disabled:u,onClick:m,className:`flex h-5 w-5 items-center justify-center rounded-full border ${b} ${y}`,children:h.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${l||u?"bg-white":"hover:bg-gray-10"}`})}),h.jsx("input",{type:"radio",className:"h-0 w-0 appearance-none opacity-0",checked:!0,readOnly:!0})]})},sp=({value:l,min:p=0,max:u,step:m,className:y,disabled:b=!1,ariaLabel:E="Range slider",onChange:I})=>{const T=(l-p)/(u-p)*100,$=`linear-gradient(to right, #3264fe ${T}%, #d5d5d5 ${T}%)`;return h.jsx("div",{className:y,children:h.jsx("input",{id:"my-slider",type:"range",min:p,max:u,value:l,step:m,onInput:k=>I(Number(k.target.value)),disabled:b,"aria-label":E,style:{background:$}})})};function op({className:l="",suiteArray:p,soonText:u}){const m=h.jsx("div",{className:"flex h-10 w-10 items-center justify-center text-black dark:text-white",children:h.jsx(je.DotsNine,{size:26,className:"h-7 w-7",weight:"bold"})}),y=h.jsx("div",{className:"w-64 flex flex-wrap p-2","data-testid":"suite-launcher-panel",children:p.map((b,E)=>h.jsx("div",{className:`w-1/3 flex items-center justify-center rounded-md ${b.isMain?"bg-primary/10 dark:bg-primary/20":""}`,children:h.jsx("div",{role:"none",className:`flex items-center px-3 py-2 text-gray-80 w-full rounded-md ${b.availableSoon?"":"cursor-pointer hover:bg-gray-1 dark:hover:bg-gray-10"}`,style:{lineHeight:1.25},onClick:b.availableSoon?void 0:b.onClick,children:h.jsxs("div",{className:"flex flex-col items-center w-full rounded-md",children:[b.isLocked?h.jsx(je.Lock,{size:26,weight:"regular","data-testid":"suite-launcher-lock-icon"}):P.isValidElement(b.icon)?P.cloneElement(b.icon,{size:26,className:`${b.icon.props?.className??""} ${b.isMain?"text-primary":""} ${b.availableSoon||b.isLocked?"opacity-50 filter grayscale":""}`,weight:b.isMain?"fill":"regular"}):b.icon,h.jsxs("div",{className:"mt-1 flex items-center",children:[h.jsx("span",{className:`text-xs ${b.isMain?"text-primary font-medium":"text-gray-60"}`,style:{lineHeight:1,opacity:b.availableSoon||b.isLocked?.5:1},children:b.title}),b.availableSoon&&h.jsx("div",{className:"flex rounded-sm px-1 ml-1 py-0.5 bg-purple-1 dark:bg-purple-10 items-center",children:h.jsx("span",{className:"font-medium dark:font-normal text-purple-10 dark:text-purple-1",style:{lineHeight:1,fontSize:"xx-small"},children:u??"Soon"})})]})]})})},E))});return h.jsx(wo,{className:l,childrenButton:m,panel:()=>y,"data-testid":"app-suite-dropdown"})}const lp=({disabled:l=!1,id:p,dataTestId:u="switch",size:m="md",onClick:y,onCheckedChange:b})=>{const[E,I]=P.useState(!1),T=G=>{const F=G.target.checked;I(F),b&&b(F)},$=l?"bg-gray-5":E?"bg-green":"bg-gray-10",k={md:"w-8 h-5",lg:"w-12 h-7",xl:"w-14 h-8"},L={md:"w-4 h-4",lg:"w-6 h-6",xl:"w-7 h-7"},M={md:"translate-x-[13px]",lg:"translate-x-[21px]",xl:"translate-x-[25px]"};return h.jsxs("label",{htmlFor:p,className:`relative inline-flex items-center cursor-pointer ${k[m]}`,"data-testid":u,children:[h.jsx("input",{type:"checkbox",id:p,disabled:l,checked:E,onChange:T,onClick:y,className:"sr-only"}),h.jsx("div",{className:`absolute inset-0 rounded-full transition-colors duration-200 ${$} ${l?"data-[state=checked]:bg-green/50":""}`}),h.jsx("span",{className:`block bg-white rounded-full transition-transform duration-200 transform ${E?M[m]:"translate-x-[3px]"} ${L[m]} ${l?"pointer-events-none":""}`})]})},fp=({children:l,className:p,...u})=>h.jsx("div",{className:p,children:h.jsx("table",{className:"w-full",...u,children:l})}),cp=({children:l,className:p,...u})=>h.jsx("thead",{className:p,...u,children:l}),hp=({children:l,className:p,...u})=>h.jsx("tbody",{className:p,...u,children:l}),dp=({children:l,className:p,onClick:u,...m})=>h.jsx("tr",{onClick:u,className:p,...m,children:l}),gp=({children:l,className:p,isHeader:u=!1,onClick:m,...y})=>{const b=u?"th":"td";return h.jsx(b,{onClick:m,className:p,...y,children:l})},pp=({disabled:l=!1,accentColor:p,placeholder:u="",value:m="",onChange:y,name:b})=>h.jsx("textarea",{disabled:l,placeholder:u,className:`
134
+ `,children:u})]}):null},wo=({childrenButton:l,panel:p,className:u,classButton:m})=>{const[y,b]=P.useState(!1),E=P.useRef(null),[I,T]=P.useState(y),[$,k]=P.useState("opacity-0"),[L,M]=P.useState("scale-95"),G=()=>b(R=>!R),F=R=>{E.current&&!E.current.contains(R.target)&&ue()},ue=()=>{b(!1)};return P.useEffect(()=>{if(y){const R=setTimeout(()=>{k("opacity-100"),M("scale-100")},10);return T(!0),()=>clearTimeout(R)}else{k("opacity-0"),M("scale-95");const R=setTimeout(()=>{T(!1)},100);return()=>clearTimeout(R)}},[y]),P.useEffect(()=>(document.addEventListener("mousedown",F),()=>{document.removeEventListener("mousedown",F)}),[]),h.jsxs("div",{style:{lineHeight:0},className:`relative ${u}`,children:[h.jsx("button",{onClick:G,className:`cursor-pointer outline-none ${m}`,"aria-expanded":y,"data-testid":"popover-button",children:l}),I&&h.jsx("div",{ref:E,className:`absolute right-0 z-50 mt-1 origin-top-right transform rounded-md border border-gray-10 bg-surface py-1.5 shadow-subtle duration-100 ease-out dark:bg-gray-5 ${$} ${L}`,children:p(ue)})]})},ap=({checked:l,id:p,disabled:u=!1,onClick:m})=>{const y=u?"border-gray-10":"border-gray-40",b=u&&l?"border-0 bg-gray-20":l&&"border-0 bg-primary active:bg-primary-dark";return h.jsxs("div",{id:p,className:"flex cursor-pointer",children:[h.jsx("button",{disabled:u,onClick:m,className:`flex h-5 w-5 items-center justify-center rounded-full border ${b} ${y}`,children:h.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${l||u?"bg-white":"hover:bg-gray-10"}`})}),h.jsx("input",{type:"radio",className:"h-0 w-0 appearance-none opacity-0",checked:!0,readOnly:!0})]})},sp=({value:l,min:p=0,max:u,step:m,className:y,disabled:b=!1,ariaLabel:E="Range slider",onChange:I})=>{const T=(l-p)/(u-p)*100,$=`linear-gradient(to right, #3264fe ${T}%, #d5d5d5 ${T}%)`;return h.jsx("div",{className:y,children:h.jsx("input",{id:"my-slider",type:"range",min:p,max:u,value:l,step:m,onInput:k=>I(Number(k.target.value)),disabled:b,"aria-label":E,style:{background:$}})})};function op({className:l="",suiteArray:p,soonText:u}){const m=h.jsx("div",{className:"flex h-10 w-10 items-center justify-center text-black dark:text-white",children:h.jsx(je.DotsNine,{size:26,className:"h-7 w-7",weight:"bold"})}),y=h.jsx("div",{className:"w-64 flex flex-wrap p-2","data-testid":"suite-launcher-panel",children:p.map((b,E)=>h.jsx("div",{className:`w-1/3 flex items-center justify-center rounded-md ${b.isMain?"bg-primary/10 dark:bg-primary/20":""}`,children:h.jsx("div",{role:"none",className:`flex items-center px-3 py-2 text-gray-80 w-full rounded-md ${b.availableSoon?"":"cursor-pointer hover:bg-gray-1 dark:hover:bg-gray-10"}`,style:{lineHeight:1.25},onClick:b.availableSoon?void 0:b.onClick,children:h.jsxs("div",{className:"flex flex-col items-center w-full rounded-md",children:[b.isLocked?h.jsx(je.Lock,{size:26,weight:"regular",className:"opacity-50 filter grayscale","data-testid":"suite-launcher-lock-icon"}):P.isValidElement(b.icon)?P.cloneElement(b.icon,{size:26,className:`${b.icon.props?.className??""} ${b.isMain?"text-primary":""} ${b.availableSoon||b.isLocked?"opacity-50 filter grayscale":""}`,weight:b.isMain?"fill":"regular"}):b.icon,h.jsxs("div",{className:"mt-1 flex items-center",children:[h.jsx("span",{className:`text-xs ${b.isMain?"text-primary font-medium":"text-gray-60"}`,style:{lineHeight:1,opacity:b.availableSoon||b.isLocked?.5:1},children:b.title}),b.availableSoon&&h.jsx("div",{className:"flex rounded-sm px-1 ml-1 py-0.5 bg-purple-1 dark:bg-purple-10 items-center",children:h.jsx("span",{className:"font-medium dark:font-normal text-purple-10 dark:text-purple-1",style:{lineHeight:1,fontSize:"xx-small"},children:u??"Soon"})})]})]})})},E))});return h.jsx(wo,{className:l,childrenButton:m,panel:()=>y,"data-testid":"app-suite-dropdown"})}const lp=({disabled:l=!1,id:p,dataTestId:u="switch",size:m="md",onClick:y,onCheckedChange:b})=>{const[E,I]=P.useState(!1),T=G=>{const F=G.target.checked;I(F),b&&b(F)},$=l?"bg-gray-5":E?"bg-green":"bg-gray-10",k={md:"w-8 h-5",lg:"w-12 h-7",xl:"w-14 h-8"},L={md:"w-4 h-4",lg:"w-6 h-6",xl:"w-7 h-7"},M={md:"translate-x-[13px]",lg:"translate-x-[21px]",xl:"translate-x-[25px]"};return h.jsxs("label",{htmlFor:p,className:`relative inline-flex items-center cursor-pointer ${k[m]}`,"data-testid":u,children:[h.jsx("input",{type:"checkbox",id:p,disabled:l,checked:E,onChange:T,onClick:y,className:"sr-only"}),h.jsx("div",{className:`absolute inset-0 rounded-full transition-colors duration-200 ${$} ${l?"data-[state=checked]:bg-green/50":""}`}),h.jsx("span",{className:`block bg-white rounded-full transition-transform duration-200 transform ${E?M[m]:"translate-x-[3px]"} ${L[m]} ${l?"pointer-events-none":""}`})]})},fp=({children:l,className:p,...u})=>h.jsx("div",{className:p,children:h.jsx("table",{className:"w-full",...u,children:l})}),cp=({children:l,className:p,...u})=>h.jsx("thead",{className:p,...u,children:l}),hp=({children:l,className:p,...u})=>h.jsx("tbody",{className:p,...u,children:l}),dp=({children:l,className:p,onClick:u,...m})=>h.jsx("tr",{onClick:u,className:p,...m,children:l}),gp=({children:l,className:p,isHeader:u=!1,onClick:m,...y})=>{const b=u?"th":"td";return h.jsx(b,{onClick:m,className:p,...y,children:l})},pp=({disabled:l=!1,accentColor:p,placeholder:u="",value:m="",onChange:y,name:b})=>h.jsx("textarea",{disabled:l,placeholder:u,className:`
135
135
  w-full h-full py-4 px-3.5 bg-transparent border rounded-md outline-none text-lg font-regular resize-none
136
136
  placeholder:text-gray-30
137
137
  ${l?"border-gray-5 text-gray-40":"border-gray-20 text-gray-100"}