@lucasromero/matrix-ui 0.1.1 → 0.1.3
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.d.ts +1 -0
- package/dist/matrix-ui.es.js +1 -1
- package/dist/matrix-ui.umd.js +1 -1
- package/dist/types/cardType.d.ts +6 -6
- package/dist/types/linkType.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/matrix-ui.es.js
CHANGED
|
@@ -338,4 +338,4 @@ var d = {
|
|
|
338
338
|
});
|
|
339
339
|
};
|
|
340
340
|
//#endregion
|
|
341
|
-
export { m as Button, L as Card, W as DropdownMenu, b as Image, I as Link, G as Navbar, F as Rating, v as Text };
|
|
341
|
+
export { m as Button, L as Card, W as DropdownMenu, b as Image, I as Link, G as Navbar, F as Rating, v as Text, g as variantMap };
|
package/dist/matrix-ui.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.primary{color:#111827;cursor:pointer;background:#87ceeb;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.primary:hover:not(:disabled){background:#5fafd6}.primary:active:not(:disabled){background:#4a9bc4}.secondary{color:#f8fafc;cursor:pointer;background:#1a2230;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.secondary:hover:not(:disabled){background:#232e3d;border-color:#334155}.secondary:active:not(:disabled){background:#0f172a}.ghost{color:#cbd5e1;cursor:pointer;background:0 0;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.ghost:hover:not(:disabled){background:#ffffff0d}.ghost:active:not(:disabled){background:#ffffff14}.error{color:#111827;cursor:pointer;background:#e58a8a;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.error:hover:not(:disabled){filter:brightness(.95)}.error:active:not(:disabled){filter:brightness(.9)}.success{color:#111827;cursor:pointer;background:#9fc9ae;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.success:hover:not(:disabled){filter:brightness(.95)}.success:active:not(:disabled){filter:brightness(.9)}.transparent{color:#cbd5e1;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:.5rem;padding:.5rem .75rem;transition:background .15s,color .15s,border-color .15s}.transparent:hover:not(:disabled){color:#f8fafc}.transparent:disabled{color:#64748b;cursor:not-allowed}._cardContainer_16ci6_1{border-radius:8px;flex-direction:column;justify-content:center;align-items:center;width:100%;max-width:min(400px,90%);height:auto;margin:0 auto;display:flex}._topContentContainer_16ci6_13{flex-direction:column;margin-top:1rem;margin-bottom:1rem;display:flex}._cardTitle_16ci6_20{margin:0 1rem .2rem}._miniCard_16ci6_27 ._cardTitle_16ci6_20{flex:1;margin:0}._ctaContainer_16ci6_32{box-sizing:border-box;flex-direction:column;justify-content:space-between;gap:1rem;width:100%;padding:.75rem;display:flex}._miniCard_16ci6_27 ._ctaContainer_16ci6_32{flex-direction:row;justify-content:center;gap:.5rem;padding:.5rem}._imgContainer_16ci6_49{box-sizing:border-box;border-radius:8px;justify-content:center;padding-bottom:1rem;padding-left:1.5rem;padding-right:1.5rem;display:flex}._img_16ci6_49{max-width:100%}._miniCard_16ci6_27 ._topContentContainer_16ci6_13{flex-direction:row;justify-content:flex-start;align-items:center;gap:1rem;margin-top:1rem;margin-bottom:1rem}._cardRating_16ci6_72{justify-content:center;margin-top:.1rem;display:flex}._headingSm_1wdfi_1{color:#f8fafc;font-size:1.25rem;font-weight:600}._headingMd_1wdfi_7{color:#f8fafc;font-size:1.5rem;font-weight:600}._headingLg_1wdfi_13{color:#f8fafc;font-size:1.875rem;font-weight:700}._headingXl_1wdfi_19{color:#f8fafc;font-size:2rem;font-weight:700}._bodySm_1wdfi_25{color:#cbd5e1;font-size:.875rem;font-weight:400}._bodyMd_1wdfi_31{color:#cbd5e1;font-size:1rem;font-weight:400}._bodyLg_1wdfi_37{color:#cbd5e1;font-size:1.125rem;font-weight:400}._caption_1wdfi_43{color:#cbd5e1;font-size:.75rem;font-weight:500}._img_1n4g7_1{width:auto;max-width:100%;height:auto;display:block}._circle_1n4g7_8{border-radius:50%}._ratingContainer_1xmf5_1{flex-direction:row;display:flex}._text_1xmf5_6{margin:0;padding-right:.2rem}._star_1xmf5_11{color:gold;fill:gold;width:1rem;height:1rem;margin-top:.17rem}.primary{color:#111827;cursor:pointer;text-align:center;vertical-align:middle;background:#87ceeb;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.primary:hover:not(:disabled),.primary:hover:not([aria-disabled=true]){background:#5fafd6}.primary:active:not(:disabled),.primary:active:not([aria-disabled=true]){background:#4a9bc4}.secondary{color:#f8fafc;cursor:pointer;text-align:center;vertical-align:middle;background:#1a2230;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.secondary:hover:not(:disabled),.secondary:hover:not([aria-disabled=true]){background:#232e3d;border-color:#334155}.secondary:active:not(:disabled),.secondary:active:not([aria-disabled=true]){background:#0f172a}.ghost{color:#cbd5e1;cursor:pointer;text-align:center;vertical-align:middle;background:0 0;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.ghost:hover:not(:disabled),.ghost:hover:not([aria-disabled=true]){background:#ffffff0d}.ghost:active:not(:disabled),.ghost:active:not([aria-disabled=true]){background:#ffffff14}.error{color:#111827;cursor:pointer;text-align:center;vertical-align:middle;background:#e58a8a;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.error:hover:not(:disabled),.error:hover:not([aria-disabled=true]){filter:brightness(.95)}.error:active:not(:disabled),.error:active:not([aria-disabled=true]){filter:brightness(.9)}.success{color:#111827;cursor:pointer;text-align:center;vertical-align:middle;background:#9fc9ae;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.success:hover:not(:disabled),.success:hover:not([aria-disabled=true]){filter:brightness(.95)}.success:active:not(:disabled),.success:active:not([aria-disabled=true]){filter:brightness(.9)}.transparent{color:#cbd5e1;cursor:pointer;text-align:center;vertical-align:middle;background:0 0;border:1px solid #0000;border-radius:.5rem;padding:.5rem .75rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none;transition:background .15s,color .15s,border-color .15s}.transparent:hover:not(:disabled),.transparent:hover:not([aria-disabled=true]){color:#f8fafc}.transparent.active{color:#f8fafc;background:#ffffff14}.transparent:focus-visible{outline:none;box-shadow:0 0 0 3px #87ceeb59}.transparent:disabled,.transparent[aria-disabled=true]{color:#64748b;cursor:not-allowed}.link{justify-content:center;align-items:center;display:flex}._navElementsContainer_ndrvq_1{z-index:1000;background-color:#0b0f17;border-bottom:2px solid #1f2937;width:100%;height:3.5rem;position:sticky;top:0}._internalElementsContainer_ndrvq_11{flex-direction:row;align-items:center;width:100%;height:3.5rem;display:flex}._hamburgerIcon_ndrvq_19{margin-left:auto;padding-right:2rem}._leftElementsContainer_ndrvq_24{flex-direction:row;align-items:center;gap:2rem;width:50%;padding-left:1.5rem;line-height:.625rem;display:flex}._leftElement_ndrvq_24{padding-left:2rem}._rightElementsContainer_ndrvq_38{flex-direction:row;justify-content:end;gap:2rem;width:50%;padding-right:2rem;line-height:.625rem;display:flex}._wrapper_1cng4_1{min-width:10rem;display:inline-block;position:relative}._dropdownButton_1cng4_7{padding:0}._dropdownButtonContainer_1cng4_11{justify-content:right;align-items:end;display:flex}._listItemContainer_1cng4_17{z-index:1000;border-radius:5px;flex-direction:column;justify-content:left;align-items:start;min-width:10rem;margin-top:.5rem;padding:0;display:flex;position:absolute;top:100%;left:0}._listItem_1cng4_17{padding-top:.5rem;padding-bottom:.5rem;list-style:none}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`matrix-ui`]={},e.React,e.react_jsx_runtime))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);function u(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=u(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function d(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=` `),r+=t);return r}var f={primary:`primary`,secondary:`secondary`,ghost:`ghost`,transparent:`transparent`,success:`success`,error:`error`},p={primary:`primary`,secondary:`secondary`,ghost:`ghost`,transparent:`transparent`,success:`success`,error:`error`},m=e=>`${e?.toLowerCase().replace(/\s+/g,`-`)}-id`,h=({variant:e=`primary`,text:t,onClick:r,className:i,ariaLabel:a=`Button`,ariaPressed:o=!1})=>(0,n.jsx)(`button`,{id:m(a),"aria-label":a,"aria-pressed":o,onClick:r,className:d(e&&p[e],i),role:`button`,children:t}),g={cardContainer:`_cardContainer_16ci6_1`,topContentContainer:`_topContentContainer_16ci6_13`,cardTitle:`_cardTitle_16ci6_20`,miniCard:`_miniCard_16ci6_27`,ctaContainer:`_ctaContainer_16ci6_32`,imgContainer:`_imgContainer_16ci6_49`,img:`_img_16ci6_49`,cardRating:`_cardRating_16ci6_72`},_={headingXl:`h1`,headingLg:`h2`,headingMd:`h3`,headingSm:`h4`,bodyLg:`p`,bodyMd:`p`,bodySm:`p`,caption:`span`},v={headingSm:`_headingSm_1wdfi_1`,headingMd:`_headingMd_1wdfi_7`,headingLg:`_headingLg_1wdfi_13`,headingXl:`_headingXl_1wdfi_19`,bodySm:`_bodySm_1wdfi_25`,bodyMd:`_bodyMd_1wdfi_31`,bodyLg:`_bodyLg_1wdfi_37`,caption:`_caption_1wdfi_43`},y=({copy:e,variant:t,className:r})=>{let i=_[t];return(0,n.jsx)(i,{className:d(r,v[t]),children:e})},b={img:`_img_1n4g7_1`,circle:`_circle_1n4g7_8`},x=({style:e,src:t,alt:r,className:i,isCircle:a=!1,ariaLabel:o})=>{let s=d(b.img,a&&b.circle,i);return(0,n.jsx)(`img`,{id:m(o),"aria-label":o??`Image`,"data-circle":a,style:e,className:s,src:t,alt:r})},S=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),C=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),w=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),T=e=>{let t=w(e);return t.charAt(0).toUpperCase()+t.slice(1)},E={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},D=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},O=(0,t.createContext)({}),k=()=>(0,t.useContext)(O),A=(0,t.forwardRef)(({color:e,size:n,strokeWidth:r,absoluteStrokeWidth:i,className:a=``,children:o,iconNode:s,...c},l)=>{let{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=k()??{},h=i??f?Number(r??d)*24/Number(n??u):r??d;return(0,t.createElement)(`svg`,{ref:l,...E,width:n??u??E.width,height:n??u??E.height,stroke:e??p,strokeWidth:h,className:S(`lucide`,m,a),...!o&&!D(c)&&{"aria-hidden":`true`},...c},[...s.map(([e,n])=>(0,t.createElement)(e,n)),...Array.isArray(o)?o:[o]])}),j=(e,n)=>{let r=(0,t.forwardRef)(({className:r,...i},a)=>(0,t.createElement)(A,{ref:a,iconNode:n,className:S(`lucide-${C(T(e))}`,`lucide-${e}`,r),...i}));return r.displayName=T(e),r},M=j(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),N=j(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),P={ratingContainer:`_ratingContainer_1xmf5_1`,text:`_text_1xmf5_6`,star:`_star_1xmf5_11`},F=[{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})}],I=({rating:e})=>F.filter((t,n)=>e&&n<e).map(e=>e.star),L=({variant:e,text:t,to:r,className:i,ariaLabel:a})=>(0,n.jsx)(`a`,{id:m(a),className:d(`link`,e&&f[e],i),href:r,target:`_blank`,rel:`noopener noreferrer`,"aria-label":a??`Link`,role:`link`,children:t}),R=({borderColor:e=``,backgroundColor:t,miniCard:r=!1,title:i,hasRating:a,ratingValue:o,img:s,imgAriaLabel:c,isImgCircle:l=!0,primaryCta:u,secondaryCta:d})=>(0,n.jsxs)(`article`,{id:m(`${i} Card`),"aria-label":`${i} Card`,className:`${g.cardContainer} ${r?g.miniCard:``}`,style:{backgroundColor:t,border:e?`2px solid ${e}`:void 0},children:[(0,n.jsxs)(`div`,{"aria-label":`Card Top Content Container`,className:g.topContentContainer,children:[(0,n.jsx)(y,{className:g.cardTitle,variant:`headingMd`,copy:i}),a&&o!=null&&(0,n.jsx)(`div`,{"aria-label":`Card Rating Container`,className:g.cardRating,children:(0,n.jsx)(I,{rating:o})})]}),!r&&(0,n.jsx)(`div`,{"aria-label":c?`${c} Container`:`Image Container`,className:g.imgContainer,children:(0,n.jsx)(x,{ariaLabel:c??`Card Image`,isCircle:l,src:s,alt:`${i} Card Image`,style:{border:e?`2px solid ${e}`:void 0}})}),(0,n.jsxs)(`div`,{"aria-label":`Card CTA Container`,className:g.ctaContainer,children:[u?.isLink?(0,n.jsx)(L,{ariaLabel:u.ariaLinkLabel??`Primary Card Link`,to:u.to,text:u.text,variant:u.variant}):(0,n.jsx)(h,{ariaLabel:u?.ariaButtonLabel??`Primary Card Button`,ariaPressed:u?.ariaPressed,variant:u?.variant,text:u?.text,onClick:u?.onClick}),d&&d.isLink?(0,n.jsx)(L,{ariaLabel:d?.ariaLinkLabel??`Secondary Card Link`,to:d.to,text:d.text,variant:d.variant}):(0,n.jsx)(h,{ariaLabel:d?.ariaButtonLabel??`Secondary Card Button`,ariaPressed:d?.ariaPressed,variant:d?.variant,text:d?.text,onClick:d?.onClick})]})]}),z={navElementsContainer:`_navElementsContainer_ndrvq_1`,internalElementsContainer:`_internalElementsContainer_ndrvq_11`,hamburgerIcon:`_hamburgerIcon_ndrvq_19`,leftElementsContainer:`_leftElementsContainer_ndrvq_24`,leftElement:`_leftElement_ndrvq_24`,rightElementsContainer:`_rightElementsContainer_ndrvq_38`},B={mobile:`(max-width: 767px)`,tablet:`(min-width: 768px) and (max-width: 1023px)`,desktop:`(min-width: 1024px)`,belowMobile:`(max-width: 299px)`},V=e=>typeof window>`u`?!1:window.matchMedia(e).matches,H=()=>{let[e,n]=(0,t.useState)({isBelowMobileMinimum:V(B.belowMobile),isMobile:V(B.mobile),isTablet:V(B.tablet),isDesktop:V(B.desktop)});return(0,t.useEffect)(()=>{let e=Object.entries(B).map(([e,t])=>{let r=window.matchMedia(t),i=()=>{n(t=>({...t,[e===`belowMobile`?`isBelowMobileMinimum`:`is${U(e)}`]:r.matches}))};return r.addEventListener(`change`,i),i(),()=>r.removeEventListener(`change`,i)});return()=>{e.forEach(e=>e?.())}},[]),e},U=e=>e.charAt(0).toUpperCase()+e.slice(1),W={wrapper:`_wrapper_1cng4_1`,dropdownButton:`_dropdownButton_1cng4_7`,dropdownButtonContainer:`_dropdownButtonContainer_1cng4_11`,listItemContainer:`_listItemContainer_1cng4_17`,listItem:`_listItem_1cng4_17`},G=({className:e,icon:r,options:i,listBorderColor:a,listBackgroundColor:o,isNavbarDropdown:s=!1})=>{let[c,l]=(0,t.useState)(!1);return(0,n.jsxs)(`section`,{className:d(e,W.wrapper),children:[(0,n.jsx)(`div`,{className:W.dropdownButtonContainer,children:(0,n.jsx)(h,{className:W.dropdownButton,text:r,variant:`transparent`,onClick:()=>l(!c),ariaLabel:`Dropdown Menu Button`})}),c&&(0,n.jsx)(`ul`,{"aria-label":`Unordered Dropdown List`,className:W.listItemContainer,style:{marginTop:s?`1.5rem`:`none`,border:`2px solid ${a}`,backgroundColor:o},children:i.map(e=>(0,n.jsx)(`li`,{"aria-label":`Dropdown List Item`,className:W.listItem,children:(0,n.jsx)(L,{variant:e.variant,to:e.to,text:e.text})}))})]})};e.Button=h,e.Card=R,e.DropdownMenu=G,e.Image=x,e.Link=L,e.Navbar=({ariaLabel:e,backgroundColor:t,borderBottomColor:r,dropdownListBackgroundColor:i,dropdownListBorderColor:a,dropdownListIcon:o=(0,n.jsx)(M,{}),leftElement:s,leftElementNeighbors:c,rightElements:l})=>{let u=[...c,...l],{isMobile:d,isBelowMobileMinimum:f}=H();return(0,n.jsx)(`nav`,{id:m(e),"aria-label":e??`Main Navbar`,style:{backgroundColor:t,borderBottom:`2px solid ${r}`},className:z.navElementsContainer,children:(0,n.jsxs)(`article`,{"aria-label":`Elements Container`,className:z.internalElementsContainer,children:[!f&&(0,n.jsx)(`div`,{className:z.leftElement,children:s}),d?(0,n.jsx)(G,{listBackgroundColor:i,listBorderColor:a,className:z.hamburgerIcon,icon:o,options:u.map(({text:e,to:t,variant:n})=>({text:e,to:t,variant:n})),isNavbarDropdown:!0}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`article`,{"aria-label":`Left Navbar Elements Container`,className:z.leftElementsContainer,children:c?.map(e=>(0,n.jsx)(L,{variant:e.variant,text:e.text,to:e.to},e.text))}),(0,n.jsx)(`article`,{"aria-label":`Right Navbar Elements Container`,className:z.rightElementsContainer,children:l.map(e=>(0,n.jsx)(L,{variant:e.variant,text:e.text,to:e.to},e.text))})]})]})})},e.Rating=I,e.Text=y});
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`matrix-ui`]={},e.React,e.react_jsx_runtime))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);function u(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=u(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function d(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=` `),r+=t);return r}var f={primary:`primary`,secondary:`secondary`,ghost:`ghost`,transparent:`transparent`,success:`success`,error:`error`},p={primary:`primary`,secondary:`secondary`,ghost:`ghost`,transparent:`transparent`,success:`success`,error:`error`},m=e=>`${e?.toLowerCase().replace(/\s+/g,`-`)}-id`,h=({variant:e=`primary`,text:t,onClick:r,className:i,ariaLabel:a=`Button`,ariaPressed:o=!1})=>(0,n.jsx)(`button`,{id:m(a),"aria-label":a,"aria-pressed":o,onClick:r,className:d(e&&p[e],i),role:`button`,children:t}),g={cardContainer:`_cardContainer_16ci6_1`,topContentContainer:`_topContentContainer_16ci6_13`,cardTitle:`_cardTitle_16ci6_20`,miniCard:`_miniCard_16ci6_27`,ctaContainer:`_ctaContainer_16ci6_32`,imgContainer:`_imgContainer_16ci6_49`,img:`_img_16ci6_49`,cardRating:`_cardRating_16ci6_72`},_={headingXl:`h1`,headingLg:`h2`,headingMd:`h3`,headingSm:`h4`,bodyLg:`p`,bodyMd:`p`,bodySm:`p`,caption:`span`},v={headingSm:`_headingSm_1wdfi_1`,headingMd:`_headingMd_1wdfi_7`,headingLg:`_headingLg_1wdfi_13`,headingXl:`_headingXl_1wdfi_19`,bodySm:`_bodySm_1wdfi_25`,bodyMd:`_bodyMd_1wdfi_31`,bodyLg:`_bodyLg_1wdfi_37`,caption:`_caption_1wdfi_43`},y=({copy:e,variant:t,className:r})=>{let i=_[t];return(0,n.jsx)(i,{className:d(r,v[t]),children:e})},b={img:`_img_1n4g7_1`,circle:`_circle_1n4g7_8`},x=({style:e,src:t,alt:r,className:i,isCircle:a=!1,ariaLabel:o})=>{let s=d(b.img,a&&b.circle,i);return(0,n.jsx)(`img`,{id:m(o),"aria-label":o??`Image`,"data-circle":a,style:e,className:s,src:t,alt:r})},S=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),C=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),w=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),T=e=>{let t=w(e);return t.charAt(0).toUpperCase()+t.slice(1)},E={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},D=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},O=(0,t.createContext)({}),k=()=>(0,t.useContext)(O),A=(0,t.forwardRef)(({color:e,size:n,strokeWidth:r,absoluteStrokeWidth:i,className:a=``,children:o,iconNode:s,...c},l)=>{let{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=k()??{},h=i??f?Number(r??d)*24/Number(n??u):r??d;return(0,t.createElement)(`svg`,{ref:l,...E,width:n??u??E.width,height:n??u??E.height,stroke:e??p,strokeWidth:h,className:S(`lucide`,m,a),...!o&&!D(c)&&{"aria-hidden":`true`},...c},[...s.map(([e,n])=>(0,t.createElement)(e,n)),...Array.isArray(o)?o:[o]])}),j=(e,n)=>{let r=(0,t.forwardRef)(({className:r,...i},a)=>(0,t.createElement)(A,{ref:a,iconNode:n,className:S(`lucide-${C(T(e))}`,`lucide-${e}`,r),...i}));return r.displayName=T(e),r},M=j(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),N=j(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),P={ratingContainer:`_ratingContainer_1xmf5_1`,text:`_text_1xmf5_6`,star:`_star_1xmf5_11`},F=[{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})}],I=({rating:e})=>F.filter((t,n)=>e&&n<e).map(e=>e.star),L=({variant:e,text:t,to:r,className:i,ariaLabel:a})=>(0,n.jsx)(`a`,{id:m(a),className:d(`link`,e&&f[e],i),href:r,target:`_blank`,rel:`noopener noreferrer`,"aria-label":a??`Link`,role:`link`,children:t}),R=({borderColor:e=``,backgroundColor:t,miniCard:r=!1,title:i,hasRating:a,ratingValue:o,img:s,imgAriaLabel:c,isImgCircle:l=!0,primaryCta:u,secondaryCta:d})=>(0,n.jsxs)(`article`,{id:m(`${i} Card`),"aria-label":`${i} Card`,className:`${g.cardContainer} ${r?g.miniCard:``}`,style:{backgroundColor:t,border:e?`2px solid ${e}`:void 0},children:[(0,n.jsxs)(`div`,{"aria-label":`Card Top Content Container`,className:g.topContentContainer,children:[(0,n.jsx)(y,{className:g.cardTitle,variant:`headingMd`,copy:i}),a&&o!=null&&(0,n.jsx)(`div`,{"aria-label":`Card Rating Container`,className:g.cardRating,children:(0,n.jsx)(I,{rating:o})})]}),!r&&(0,n.jsx)(`div`,{"aria-label":c?`${c} Container`:`Image Container`,className:g.imgContainer,children:(0,n.jsx)(x,{ariaLabel:c??`Card Image`,isCircle:l,src:s,alt:`${i} Card Image`,style:{border:e?`2px solid ${e}`:void 0}})}),(0,n.jsxs)(`div`,{"aria-label":`Card CTA Container`,className:g.ctaContainer,children:[u?.isLink?(0,n.jsx)(L,{ariaLabel:u.ariaLinkLabel??`Primary Card Link`,to:u.to,text:u.text,variant:u.variant}):(0,n.jsx)(h,{ariaLabel:u?.ariaButtonLabel??`Primary Card Button`,ariaPressed:u?.ariaPressed,variant:u?.variant,text:u?.text,onClick:u?.onClick}),d&&d.isLink?(0,n.jsx)(L,{ariaLabel:d?.ariaLinkLabel??`Secondary Card Link`,to:d.to,text:d.text,variant:d.variant}):(0,n.jsx)(h,{ariaLabel:d?.ariaButtonLabel??`Secondary Card Button`,ariaPressed:d?.ariaPressed,variant:d?.variant,text:d?.text,onClick:d?.onClick})]})]}),z={navElementsContainer:`_navElementsContainer_ndrvq_1`,internalElementsContainer:`_internalElementsContainer_ndrvq_11`,hamburgerIcon:`_hamburgerIcon_ndrvq_19`,leftElementsContainer:`_leftElementsContainer_ndrvq_24`,leftElement:`_leftElement_ndrvq_24`,rightElementsContainer:`_rightElementsContainer_ndrvq_38`},B={mobile:`(max-width: 767px)`,tablet:`(min-width: 768px) and (max-width: 1023px)`,desktop:`(min-width: 1024px)`,belowMobile:`(max-width: 299px)`},V=e=>typeof window>`u`?!1:window.matchMedia(e).matches,H=()=>{let[e,n]=(0,t.useState)({isBelowMobileMinimum:V(B.belowMobile),isMobile:V(B.mobile),isTablet:V(B.tablet),isDesktop:V(B.desktop)});return(0,t.useEffect)(()=>{let e=Object.entries(B).map(([e,t])=>{let r=window.matchMedia(t),i=()=>{n(t=>({...t,[e===`belowMobile`?`isBelowMobileMinimum`:`is${U(e)}`]:r.matches}))};return r.addEventListener(`change`,i),i(),()=>r.removeEventListener(`change`,i)});return()=>{e.forEach(e=>e?.())}},[]),e},U=e=>e.charAt(0).toUpperCase()+e.slice(1),W={wrapper:`_wrapper_1cng4_1`,dropdownButton:`_dropdownButton_1cng4_7`,dropdownButtonContainer:`_dropdownButtonContainer_1cng4_11`,listItemContainer:`_listItemContainer_1cng4_17`,listItem:`_listItem_1cng4_17`},G=({className:e,icon:r,options:i,listBorderColor:a,listBackgroundColor:o,isNavbarDropdown:s=!1})=>{let[c,l]=(0,t.useState)(!1);return(0,n.jsxs)(`section`,{className:d(e,W.wrapper),children:[(0,n.jsx)(`div`,{className:W.dropdownButtonContainer,children:(0,n.jsx)(h,{className:W.dropdownButton,text:r,variant:`transparent`,onClick:()=>l(!c),ariaLabel:`Dropdown Menu Button`})}),c&&(0,n.jsx)(`ul`,{"aria-label":`Unordered Dropdown List`,className:W.listItemContainer,style:{marginTop:s?`1.5rem`:`none`,border:`2px solid ${a}`,backgroundColor:o},children:i.map(e=>(0,n.jsx)(`li`,{"aria-label":`Dropdown List Item`,className:W.listItem,children:(0,n.jsx)(L,{variant:e.variant,to:e.to,text:e.text})}))})]})};e.Button=h,e.Card=R,e.DropdownMenu=G,e.Image=x,e.Link=L,e.Navbar=({ariaLabel:e,backgroundColor:t,borderBottomColor:r,dropdownListBackgroundColor:i,dropdownListBorderColor:a,dropdownListIcon:o=(0,n.jsx)(M,{}),leftElement:s,leftElementNeighbors:c,rightElements:l})=>{let u=[...c,...l],{isMobile:d,isBelowMobileMinimum:f}=H();return(0,n.jsx)(`nav`,{id:m(e),"aria-label":e??`Main Navbar`,style:{backgroundColor:t,borderBottom:`2px solid ${r}`},className:z.navElementsContainer,children:(0,n.jsxs)(`article`,{"aria-label":`Elements Container`,className:z.internalElementsContainer,children:[!f&&(0,n.jsx)(`div`,{className:z.leftElement,children:s}),d?(0,n.jsx)(G,{listBackgroundColor:i,listBorderColor:a,className:z.hamburgerIcon,icon:o,options:u.map(({text:e,to:t,variant:n})=>({text:e,to:t,variant:n})),isNavbarDropdown:!0}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`article`,{"aria-label":`Left Navbar Elements Container`,className:z.leftElementsContainer,children:c?.map(e=>(0,n.jsx)(L,{variant:e.variant,text:e.text,to:e.to},e.text))}),(0,n.jsx)(`article`,{"aria-label":`Right Navbar Elements Container`,className:z.rightElementsContainer,children:l.map(e=>(0,n.jsx)(L,{variant:e.variant,text:e.text,to:e.to},e.text))})]})]})})},e.Rating=I,e.Text=y,e.variantMap=_});
|
package/dist/types/cardType.d.ts
CHANGED
|
@@ -14,20 +14,20 @@ export interface CardProps {
|
|
|
14
14
|
ariaButtonLabel?: string;
|
|
15
15
|
ariaLinkLabel?: string;
|
|
16
16
|
ariaPressed?: boolean;
|
|
17
|
-
text
|
|
17
|
+
text?: string;
|
|
18
18
|
onClick?: () => void;
|
|
19
|
-
to
|
|
20
|
-
variant
|
|
19
|
+
to?: string;
|
|
20
|
+
variant?: ButtonVariant | LinkVariant;
|
|
21
21
|
isLink?: boolean;
|
|
22
22
|
};
|
|
23
23
|
secondaryCta?: {
|
|
24
24
|
ariaButtonLabel?: string;
|
|
25
25
|
ariaLinkLabel?: string;
|
|
26
26
|
ariaPressed?: boolean;
|
|
27
|
-
text
|
|
27
|
+
text?: string;
|
|
28
28
|
onClick?: () => void;
|
|
29
|
-
to
|
|
30
|
-
variant
|
|
29
|
+
to?: string;
|
|
30
|
+
variant?: ButtonVariant | LinkVariant;
|
|
31
31
|
isLink?: boolean;
|
|
32
32
|
};
|
|
33
33
|
}
|
package/dist/types/linkType.d.ts
CHANGED