@usecapsule/core-components 2.0.2 → 2.0.4-dev.dropdown
Sign up to get free protection for your applications and to get access to all the features.
- package/css/capsule-core.css +12 -0
- package/css/capsule-core.css.map +1 -1
- package/dist/capsule/capsule.esm.js +1 -52
- package/dist/capsule/capsule.esm.js.map +1 -1
- package/dist/capsule/index.esm.js +1 -572
- package/dist/capsule/index.esm.js.map +1 -1
- package/dist/capsule/p-0462f723.js +2 -0
- package/dist/capsule/p-0462f723.js.map +1 -0
- package/dist/capsule/p-0cab90fa.entry.js +2 -0
- package/dist/capsule/p-0cab90fa.entry.js.map +1 -0
- package/dist/capsule/p-193ac141.entry.js +2 -0
- package/dist/capsule/p-193ac141.entry.js.map +1 -0
- package/dist/capsule/p-6fb7c4d1.js +3 -0
- package/dist/capsule/p-6fb7c4d1.js.map +1 -0
- package/dist/capsule/p-a95ec4df.entry.js +2 -0
- package/dist/capsule/p-a95ec4df.entry.js.map +1 -0
- package/dist/capsule/p-c2bf050b.js +2 -0
- package/dist/capsule/p-c2bf050b.js.map +1 -0
- package/dist/capsule/p-cb8dc0a4.entry.js +2 -0
- package/dist/capsule/p-cb8dc0a4.entry.js.map +1 -0
- package/dist/capsule/p-cc052d36.entry.js +29 -0
- package/dist/capsule/p-cc052d36.entry.js.map +1 -0
- package/dist/capsule/p-d7be092d.entry.js +10 -0
- package/dist/capsule/p-d7be092d.entry.js.map +1 -0
- package/dist/capsule/p-e1255160.js +2 -0
- package/dist/capsule/p-e1255160.js.map +1 -0
- package/dist/cjs/_commonjsHelpers-b3309d7b.js +12 -0
- package/dist/cjs/_commonjsHelpers-b3309d7b.js.map +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/capsule.cjs.js +27 -0
- package/dist/cjs/capsule.cjs.js.map +1 -0
- package/dist/cjs/constants-4bb85cc5.js +12 -0
- package/dist/cjs/constants-4bb85cc5.js.map +1 -0
- package/dist/cjs/cpsl-alert_18.cjs.entry.js +14798 -0
- package/dist/cjs/cpsl-alert_18.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-animation.cjs.entry.js +20129 -0
- package/dist/cjs/cpsl-animation.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-col.cjs.entry.js +125 -0
- package/dist/cjs/cpsl-col.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-grid.cjs.entry.js +25 -0
- package/dist/cjs/cpsl-grid.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-info-box.cjs.entry.js +22 -0
- package/dist/cjs/cpsl-info-box.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-row.cjs.entry.js +22 -0
- package/dist/cjs/cpsl-row.cjs.entry.js.map +1 -0
- package/dist/cjs/index-3fccb5b4.js +2012 -0
- package/dist/cjs/index-3fccb5b4.js.map +1 -0
- package/dist/cjs/index.cjs.js +362 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/assets/icons/AD.svg +15 -0
- package/dist/collection/assets/icons/AE.svg +13 -0
- package/dist/collection/assets/icons/AF.svg +14 -0
- package/dist/collection/assets/icons/AG.svg +15 -0
- package/dist/collection/assets/icons/AI.svg +19 -0
- package/dist/collection/assets/icons/AL.svg +11 -0
- package/dist/collection/assets/icons/AM.svg +12 -0
- package/dist/collection/assets/icons/AO.svg +14 -0
- package/dist/collection/assets/icons/AR.svg +13 -0
- package/dist/collection/assets/icons/AS.svg +15 -0
- package/dist/collection/assets/icons/AT.svg +12 -0
- package/dist/collection/assets/icons/AU.svg +20 -0
- package/dist/collection/assets/icons/AW.svg +15 -0
- package/dist/collection/assets/icons/AX.svg +15 -0
- package/dist/collection/assets/icons/AZ.svg +14 -0
- package/dist/collection/assets/icons/BA.svg +13 -0
- package/dist/collection/assets/icons/BB.svg +13 -0
- package/dist/collection/assets/icons/BD.svg +11 -0
- package/dist/collection/assets/icons/BE.svg +12 -0
- package/dist/collection/assets/icons/BF.svg +12 -0
- package/dist/collection/assets/icons/BG.svg +12 -0
- package/dist/collection/assets/icons/BH.svg +11 -0
- package/dist/collection/assets/icons/BI.svg +18 -0
- package/dist/collection/assets/icons/BJ.svg +12 -0
- package/dist/collection/assets/icons/BL.svg +16 -0
- package/dist/collection/assets/icons/BM.svg +20 -0
- package/dist/collection/assets/icons/BN.svg +19 -0
- package/dist/collection/assets/icons/BO.svg +12 -0
- package/dist/collection/assets/icons/BQ.svg +14 -0
- package/dist/collection/assets/icons/BQ2.svg +20 -0
- package/dist/collection/assets/icons/BQ3.svg +15 -0
- package/dist/collection/assets/icons/BR.svg +14 -0
- package/dist/collection/assets/icons/BS.svg +13 -0
- package/dist/collection/assets/icons/BT.svg +12 -0
- package/dist/collection/assets/icons/BW.svg +13 -0
- package/dist/collection/assets/icons/BY.svg +18 -0
- package/dist/collection/assets/icons/BZ.svg +17 -0
- package/dist/collection/assets/icons/CA.svg +13 -0
- package/dist/collection/assets/icons/CC.svg +19 -0
- package/dist/collection/assets/icons/CD.svg +12 -0
- package/dist/collection/assets/icons/CD2.svg +14 -0
- package/dist/collection/assets/icons/CF.svg +20 -0
- package/dist/collection/assets/icons/CH.svg +11 -0
- package/dist/collection/assets/icons/CK.svg +22 -0
- package/dist/collection/assets/icons/CL.svg +13 -0
- package/dist/collection/assets/icons/CM.svg +13 -0
- package/dist/collection/assets/icons/CN.svg +15 -0
- package/dist/collection/assets/icons/CO.svg +12 -0
- package/dist/collection/assets/icons/CR.svg +13 -0
- package/dist/collection/assets/icons/CU.svg +15 -0
- package/dist/collection/assets/icons/CW.svg +14 -0
- package/dist/collection/assets/icons/CX.svg +19 -0
- package/dist/collection/assets/icons/CY.svg +12 -0
- package/dist/collection/assets/icons/CZ.svg +12 -0
- package/dist/collection/assets/icons/DE.svg +12 -0
- package/dist/collection/assets/icons/DJ.svg +13 -0
- package/dist/collection/assets/icons/DK.svg +14 -0
- package/dist/collection/assets/icons/DM.svg +34 -0
- package/dist/collection/assets/icons/DO.svg +17 -0
- package/dist/collection/assets/icons/DS.svg +13 -0
- package/dist/collection/assets/icons/DZ.svg +13 -0
- package/dist/collection/assets/icons/EC.svg +15 -0
- package/dist/collection/assets/icons/EE.svg +12 -0
- package/dist/collection/assets/icons/EG.svg +13 -0
- package/dist/collection/assets/icons/EH.svg +15 -0
- package/dist/collection/assets/icons/ER.svg +13 -0
- package/dist/collection/assets/icons/ES.svg +12 -0
- package/dist/collection/assets/icons/ET.svg +15 -0
- package/dist/collection/assets/icons/FI.svg +11 -0
- package/dist/collection/assets/icons/FJ.svg +18 -0
- package/dist/collection/assets/icons/FK.svg +18 -0
- package/dist/collection/assets/icons/FM.svg +14 -0
- package/dist/collection/assets/icons/FO.svg +12 -0
- package/dist/collection/assets/icons/FR.svg +12 -0
- package/dist/collection/assets/icons/GA.svg +12 -0
- package/dist/collection/assets/icons/GB-2.svg +11 -0
- package/dist/collection/assets/icons/GB.svg +23 -0
- package/dist/collection/assets/icons/GD.svg +26 -0
- package/dist/collection/assets/icons/GE.svg +15 -0
- package/dist/collection/assets/icons/GG.svg +12 -0
- package/dist/collection/assets/icons/GH.svg +13 -0
- package/dist/collection/assets/icons/GI.svg +13 -0
- package/dist/collection/assets/icons/GL.svg +13 -0
- package/dist/collection/assets/icons/GM.svg +13 -0
- package/dist/collection/assets/icons/GN.svg +12 -0
- package/dist/collection/assets/icons/GQ.svg +16 -0
- package/dist/collection/assets/icons/GR.svg +15 -0
- package/dist/collection/assets/icons/GT.svg +14 -0
- package/dist/collection/assets/icons/GU.svg +18 -0
- package/dist/collection/assets/icons/GW.svg +14 -0
- package/dist/collection/assets/icons/GY.svg +15 -0
- package/dist/collection/assets/icons/HK.svg +15 -0
- package/dist/collection/assets/icons/HN.svg +17 -0
- package/dist/collection/assets/icons/HR.svg +31 -0
- package/dist/collection/assets/icons/HT.svg +17 -0
- package/dist/collection/assets/icons/HU.svg +12 -0
- package/dist/collection/assets/icons/ID.svg +11 -0
- package/dist/collection/assets/icons/IE.svg +12 -0
- package/dist/collection/assets/icons/IL.svg +13 -0
- package/dist/collection/assets/icons/IM.svg +11 -0
- package/dist/collection/assets/icons/IN.svg +15 -0
- package/dist/collection/assets/icons/IO.svg +29 -0
- package/dist/collection/assets/icons/IQ.svg +15 -0
- package/dist/collection/assets/icons/IR.svg +13 -0
- package/dist/collection/assets/icons/IS.svg +15 -0
- package/dist/collection/assets/icons/IT.svg +12 -0
- package/dist/collection/assets/icons/JE.svg +13 -0
- package/dist/collection/assets/icons/JM.svg +14 -0
- package/dist/collection/assets/icons/JO.svg +14 -0
- package/dist/collection/assets/icons/JP.svg +11 -0
- package/dist/collection/assets/icons/KE.svg +19 -0
- package/dist/collection/assets/icons/KG.svg +16 -0
- package/dist/collection/assets/icons/KH.svg +13 -0
- package/dist/collection/assets/icons/KI.svg +17 -0
- package/dist/collection/assets/icons/KM.svg +19 -0
- package/dist/collection/assets/icons/KN.svg +15 -0
- package/dist/collection/assets/icons/KP.svg +15 -0
- package/dist/collection/assets/icons/KR.svg +30 -0
- package/dist/collection/assets/icons/KW.svg +13 -0
- package/dist/collection/assets/icons/KY.svg +20 -0
- package/dist/collection/assets/icons/KZ.svg +13 -0
- package/dist/collection/assets/icons/LA.svg +13 -0
- package/dist/collection/assets/icons/LB.svg +13 -0
- package/dist/collection/assets/icons/LC.svg +13 -0
- package/dist/collection/assets/icons/LI.svg +12 -0
- package/dist/collection/assets/icons/LK.svg +14 -0
- package/dist/collection/assets/icons/LR.svg +23 -0
- package/dist/collection/assets/icons/LS.svg +13 -0
- package/dist/collection/assets/icons/LT.svg +12 -0
- package/dist/collection/assets/icons/LU.svg +12 -0
- package/dist/collection/assets/icons/LV.svg +12 -0
- package/dist/collection/assets/icons/LY.svg +14 -0
- package/dist/collection/assets/icons/MA.svg +11 -0
- package/dist/collection/assets/icons/MC.svg +11 -0
- package/dist/collection/assets/icons/MD.svg +15 -0
- package/dist/collection/assets/icons/ME.svg +15 -0
- package/dist/collection/assets/icons/MG.svg +12 -0
- package/dist/collection/assets/icons/MH.svg +13 -0
- package/dist/collection/assets/icons/MK.svg +20 -0
- package/dist/collection/assets/icons/ML.svg +12 -0
- package/dist/collection/assets/icons/MM.svg +13 -0
- package/dist/collection/assets/icons/MN.svg +19 -0
- package/dist/collection/assets/icons/MO.svg +18 -0
- package/dist/collection/assets/icons/MP.svg +14 -0
- package/dist/collection/assets/icons/MQ.svg +18 -0
- package/dist/collection/assets/icons/MR.svg +12 -0
- package/dist/collection/assets/icons/MS.svg +17 -0
- package/dist/collection/assets/icons/MT.svg +12 -0
- package/dist/collection/assets/icons/MU.svg +13 -0
- package/dist/collection/assets/icons/MV.svg +12 -0
- package/dist/collection/assets/icons/MW.svg +13 -0
- package/dist/collection/assets/icons/MX.svg +14 -0
- package/dist/collection/assets/icons/MY.svg +17 -0
- package/dist/collection/assets/icons/MZ.svg +17 -0
- package/dist/collection/assets/icons/NA.svg +14 -0
- package/dist/collection/assets/icons/NE.svg +13 -0
- package/dist/collection/assets/icons/NF.svg +13 -0
- package/dist/collection/assets/icons/NG.svg +12 -0
- package/dist/collection/assets/icons/NI.svg +16 -0
- package/dist/collection/assets/icons/NL.svg +12 -0
- package/dist/collection/assets/icons/NO.svg +15 -0
- package/dist/collection/assets/icons/NP.svg +16 -0
- package/dist/collection/assets/icons/NR.svg +14 -0
- package/dist/collection/assets/icons/NU.svg +20 -0
- package/dist/collection/assets/icons/NZ.svg +18 -0
- package/dist/collection/assets/icons/OM.svg +15 -0
- package/dist/collection/assets/icons/PA.svg +14 -0
- package/dist/collection/assets/icons/PE.svg +12 -0
- package/dist/collection/assets/icons/PF.svg +17 -0
- package/dist/collection/assets/icons/PG.svg +17 -0
- package/dist/collection/assets/icons/PH.svg +16 -0
- package/dist/collection/assets/icons/PK.svg +14 -0
- package/dist/collection/assets/icons/PL.svg +11 -0
- package/dist/collection/assets/icons/PN.svg +18 -0
- package/dist/collection/assets/icons/PR.svg +15 -0
- package/dist/collection/assets/icons/PS.svg +13 -0
- package/dist/collection/assets/icons/PT.svg +14 -0
- package/dist/collection/assets/icons/PW.svg +11 -0
- package/dist/collection/assets/icons/PY.svg +14 -0
- package/dist/collection/assets/icons/QA.svg +11 -0
- package/dist/collection/assets/icons/RO.svg +12 -0
- package/dist/collection/assets/icons/RS.svg +16 -0
- package/dist/collection/assets/icons/RU.svg +12 -0
- package/dist/collection/assets/icons/RW.svg +13 -0
- package/dist/collection/assets/icons/SA.svg +16 -0
- package/dist/collection/assets/icons/SB.svg +17 -0
- package/dist/collection/assets/icons/SC.svg +14 -0
- package/dist/collection/assets/icons/SE.svg +14 -0
- package/dist/collection/assets/icons/SG.svg +17 -0
- package/dist/collection/assets/icons/SI.svg +13 -0
- package/dist/collection/assets/icons/SK.svg +16 -0
- package/dist/collection/assets/icons/SL.svg +12 -0
- package/dist/collection/assets/icons/SM.svg +16 -0
- package/dist/collection/assets/icons/SN.svg +13 -0
- package/dist/collection/assets/icons/SO.svg +11 -0
- package/dist/collection/assets/icons/SR.svg +14 -0
- package/dist/collection/assets/icons/SS.svg +15 -0
- package/dist/collection/assets/icons/ST.svg +15 -0
- package/dist/collection/assets/icons/SV.svg +15 -0
- package/dist/collection/assets/icons/SX.svg +17 -0
- package/dist/collection/assets/icons/SY.svg +14 -0
- package/dist/collection/assets/icons/SZ.svg +21 -0
- package/dist/collection/assets/icons/TC.svg +19 -0
- package/dist/collection/assets/icons/TD.svg +12 -0
- package/dist/collection/assets/icons/TG.svg +15 -0
- package/dist/collection/assets/icons/TH.svg +13 -0
- package/dist/collection/assets/icons/TJ.svg +20 -0
- package/dist/collection/assets/icons/TK.svg +15 -0
- package/dist/collection/assets/icons/TL.svg +13 -0
- package/dist/collection/assets/icons/TM.svg +30 -0
- package/dist/collection/assets/icons/TN.svg +13 -0
- package/dist/collection/assets/icons/TO.svg +12 -0
- package/dist/collection/assets/icons/TR.svg +12 -0
- package/dist/collection/assets/icons/TT.svg +13 -0
- package/dist/collection/assets/icons/TV.svg +25 -0
- package/dist/collection/assets/icons/TW.svg +14 -0
- package/dist/collection/assets/icons/TZ.svg +13 -0
- package/dist/collection/assets/icons/UA.svg +11 -0
- package/dist/collection/assets/icons/UG.svg +16 -0
- package/dist/collection/assets/icons/US.svg +15 -0
- package/dist/collection/assets/icons/UY.svg +16 -0
- package/dist/collection/assets/icons/UZ.svg +27 -0
- package/dist/collection/assets/icons/VC.svg +15 -0
- package/dist/collection/assets/icons/VE.svg +20 -0
- package/dist/collection/assets/icons/VG.svg +24 -0
- package/dist/collection/assets/icons/VI.svg +18 -0
- package/dist/collection/assets/icons/VN.svg +11 -0
- package/dist/collection/assets/icons/VU.svg +32 -0
- package/dist/collection/assets/icons/WS.svg +16 -0
- package/dist/collection/assets/icons/YE.svg +12 -0
- package/dist/collection/assets/icons/ZA.svg +15 -0
- package/dist/collection/assets/icons/ZM.svg +14 -0
- package/dist/collection/assets/icons/ZW.svg +20 -0
- package/dist/collection/assets/icons/alert-circle.svg +3 -0
- package/dist/collection/assets/icons/angel-list-brand.svg +3 -0
- package/dist/collection/assets/icons/angel-list.svg +3 -0
- package/dist/collection/assets/icons/apple-brand.svg +3 -0
- package/dist/collection/assets/icons/apple.svg +3 -0
- package/dist/collection/assets/icons/arrow-narrow.svg +3 -0
- package/dist/collection/assets/icons/arrow.svg +3 -0
- package/dist/collection/assets/icons/backup-kit.svg +4 -0
- package/dist/collection/assets/icons/capsule-logo.svg +18 -0
- package/dist/collection/assets/icons/capsule-rings-dark.svg +34 -0
- package/dist/collection/assets/icons/capsule-rings.svg +34 -0
- package/dist/collection/assets/icons/capsule.svg +4 -0
- package/dist/collection/assets/icons/check.svg +3 -0
- package/dist/collection/assets/icons/chevron-up.svg +3 -0
- package/dist/collection/assets/icons/clock.svg +3 -0
- package/dist/collection/assets/icons/close.svg +4 -0
- package/dist/collection/assets/icons/clubhouse-brand.svg +4 -0
- package/dist/collection/assets/icons/clubhouse.svg +4 -0
- package/dist/collection/assets/icons/copy.svg +3 -0
- package/dist/collection/assets/icons/discord-brand.svg +4 -0
- package/dist/collection/assets/icons/discord.svg +4 -0
- package/dist/collection/assets/icons/download-cloud.svg +3 -0
- package/dist/collection/assets/icons/dribbble-brand.svg +4 -0
- package/dist/collection/assets/icons/dribbble.svg +3 -0
- package/dist/collection/assets/icons/earth.svg +11 -0
- package/dist/collection/assets/icons/eye-off.svg +3 -0
- package/dist/collection/assets/icons/eye.svg +4 -0
- package/dist/collection/assets/icons/facebook-brand.svg +11 -0
- package/dist/collection/assets/icons/facebook.svg +10 -0
- package/dist/collection/assets/icons/figma-brand.svg +14 -0
- package/dist/collection/assets/icons/figma.svg +3 -0
- package/dist/collection/assets/icons/github-brand.svg +10 -0
- package/dist/collection/assets/icons/github.svg +10 -0
- package/dist/collection/assets/icons/google-brand.svg +13 -0
- package/dist/collection/assets/icons/google.svg +10 -0
- package/dist/collection/assets/icons/help-circle.svg +3 -0
- package/dist/collection/assets/icons/hero-email.svg +12 -0
- package/dist/collection/assets/icons/hero-lock.svg +4 -0
- package/dist/collection/assets/icons/hero-passkey.svg +12 -0
- package/dist/collection/assets/icons/hero-phone.svg +4 -0
- package/dist/collection/assets/icons/hero-wallet.svg +5 -0
- package/dist/collection/assets/icons/index.js +305 -0
- package/dist/collection/assets/icons/index.js.map +1 -0
- package/dist/collection/assets/icons/info-circle.svg +3 -0
- package/dist/collection/assets/icons/instagram-brand.svg +12 -0
- package/dist/collection/assets/icons/instagram.svg +12 -0
- package/dist/collection/assets/icons/key.svg +3 -0
- package/dist/collection/assets/icons/linkedin-brand.svg +10 -0
- package/dist/collection/assets/icons/linkedin.svg +10 -0
- package/dist/collection/assets/icons/mail.svg +3 -0
- package/dist/collection/assets/icons/more-login-options.svg +13 -0
- package/dist/collection/assets/icons/phone.svg +3 -0
- package/dist/collection/assets/icons/pintrest-brand.svg +11 -0
- package/dist/collection/assets/icons/pintrest.svg +10 -0
- package/dist/collection/assets/icons/plus-circle.svg +5 -0
- package/dist/collection/assets/icons/reddit-brand.svg +11 -0
- package/dist/collection/assets/icons/reddit.svg +3 -0
- package/dist/collection/assets/icons/signal-brand.svg +3 -0
- package/dist/collection/assets/icons/signal.svg +3 -0
- package/dist/collection/assets/icons/snapchat-brand.svg +4 -0
- package/dist/collection/assets/icons/snapchat.svg +3 -0
- package/dist/collection/assets/icons/telegram-brand.svg +15 -0
- package/dist/collection/assets/icons/telegram.svg +10 -0
- package/dist/collection/assets/icons/tik-tok-brand.svg +5 -0
- package/dist/collection/assets/icons/tik-tok.svg +3 -0
- package/dist/collection/assets/icons/tumblr-brand.svg +10 -0
- package/dist/collection/assets/icons/tumblr.svg +10 -0
- package/dist/collection/assets/icons/twitter-brand.svg +3 -0
- package/dist/collection/assets/icons/twitter.svg +3 -0
- package/dist/collection/assets/icons/wallet.svg +5 -0
- package/dist/collection/assets/icons/youtube-brand.svg +11 -0
- package/dist/collection/assets/icons/youtube.svg +3 -0
- package/dist/collection/collection-manifest.json +34 -0
- package/dist/collection/components/cpsl-alert/cpsl-alert.css +98 -0
- package/dist/collection/components/cpsl-alert/cpsl-alert.js +80 -0
- package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +1 -0
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.e2e.js +29 -0
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.spec.js +37 -0
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.spec.js.map +1 -0
- package/dist/collection/components/cpsl-animation/cpsl-animation.css +17 -0
- package/dist/collection/components/cpsl-animation/cpsl-animation.js +102 -0
- package/dist/collection/components/cpsl-animation/cpsl-animation.js.map +1 -0
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.e2e.js +29 -0
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.spec.js +37 -0
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.spec.js.map +1 -0
- package/dist/collection/components/cpsl-button/cpsl-button.css +162 -0
- package/dist/collection/components/cpsl-button/cpsl-button.js +68 -0
- package/dist/collection/components/cpsl-button/cpsl-button.js.map +1 -0
- package/dist/collection/components/cpsl-button/test/cpsl-button.e2e.js +29 -0
- package/dist/collection/components/cpsl-button/test/cpsl-button.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-button/test/cpsl-button.spec.js +37 -0
- package/dist/collection/components/cpsl-button/test/cpsl-button.spec.js.map +1 -0
- package/dist/collection/components/cpsl-code-input/code-change-interface.js +2 -0
- package/dist/collection/components/cpsl-code-input/code-change-interface.js.map +1 -0
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.css +134 -0
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +223 -0
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js.map +1 -0
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.e2e.js +29 -0
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.spec.js +37 -0
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.spec.js.map +1 -0
- package/dist/collection/components/cpsl-col/cpsl-col.css +200 -0
- package/dist/collection/components/cpsl-col/cpsl-col.js +528 -0
- package/dist/collection/components/cpsl-col/cpsl-col.js.map +1 -0
- package/dist/collection/components/cpsl-col/test/cpsl-col.e2e.js +29 -0
- package/dist/collection/components/cpsl-col/test/cpsl-col.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-col/test/cpsl-col.spec.js +37 -0
- package/dist/collection/components/cpsl-col/test/cpsl-col.spec.js.map +1 -0
- package/dist/collection/components/cpsl-divider/cpsl-divider.css +73 -0
- package/dist/collection/components/cpsl-divider/cpsl-divider.js +19 -0
- package/dist/collection/components/cpsl-divider/cpsl-divider.js.map +1 -0
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.e2e.js +29 -0
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.spec.js +37 -0
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.spec.js.map +1 -0
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.css +88 -0
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +113 -0
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js.map +1 -0
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.e2e.js +29 -0
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.spec.js +37 -0
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.spec.js.map +1 -0
- package/dist/collection/components/cpsl-grid/cpsl-grid.css +235 -0
- package/dist/collection/components/cpsl-grid/cpsl-grid.js +46 -0
- package/dist/collection/components/cpsl-grid/cpsl-grid.js.map +1 -0
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.e2e.js +29 -0
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.spec.js +37 -0
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.spec.js.map +1 -0
- package/dist/collection/components/cpsl-icon/cpsl-icon.css +95 -0
- package/dist/collection/components/cpsl-icon/cpsl-icon.js +68 -0
- package/dist/collection/components/cpsl-icon/cpsl-icon.js.map +1 -0
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.e2e.js +29 -0
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.spec.js +37 -0
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.spec.js.map +1 -0
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.css +77 -0
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +19 -0
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.js.map +1 -0
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.e2e.js +29 -0
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.spec.js +37 -0
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.spec.js.map +1 -0
- package/dist/collection/components/cpsl-input/cpsl-input.css +194 -0
- package/dist/collection/components/cpsl-input/cpsl-input.js +708 -0
- package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -0
- package/dist/collection/components/cpsl-input/input-interface.js +2 -0
- package/dist/collection/components/cpsl-input/input-interface.js.map +1 -0
- package/dist/collection/components/cpsl-input/test/cpsl-input.e2e.js +29 -0
- package/dist/collection/components/cpsl-input/test/cpsl-input.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-input/test/cpsl-input.spec.js +37 -0
- package/dist/collection/components/cpsl-input/test/cpsl-input.spec.js.map +1 -0
- package/dist/collection/components/cpsl-modal/cpsl-modal.css +172 -0
- package/dist/collection/components/cpsl-modal/cpsl-modal.js +429 -0
- package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +1 -0
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.e2e.js +29 -0
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.spec.js +37 -0
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.spec.js.map +1 -0
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.css +11 -0
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +108 -0
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.js.map +1 -0
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.e2e.js +29 -0
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.spec.js +37 -0
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.spec.js.map +1 -0
- package/dist/collection/components/cpsl-pill/cpsl-pill.css +92 -0
- package/dist/collection/components/cpsl-pill/cpsl-pill.js +43 -0
- package/dist/collection/components/cpsl-pill/cpsl-pill.js.map +1 -0
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.e2e.js +29 -0
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.spec.js +37 -0
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.spec.js.map +1 -0
- package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.css +82 -0
- package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.js +71 -0
- package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.js.map +1 -0
- package/dist/collection/components/cpsl-progress-indicator/progress-indicator-interface.js +2 -0
- package/dist/collection/components/cpsl-progress-indicator/progress-indicator-interface.js.map +1 -0
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.e2e.js +29 -0
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.spec.js +37 -0
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.spec.js.map +1 -0
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.css +81 -0
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +107 -0
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js.map +1 -0
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.e2e.js +29 -0
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.spec.js +37 -0
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.spec.js.map +1 -0
- package/dist/collection/components/cpsl-row/cpsl-row.css +136 -0
- package/dist/collection/components/cpsl-row/cpsl-row.js +19 -0
- package/dist/collection/components/cpsl-row/cpsl-row.js.map +1 -0
- package/dist/collection/components/cpsl-row/test/cpsl-row.e2e.js +29 -0
- package/dist/collection/components/cpsl-row/test/cpsl-row.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-row/test/cpsl-row.spec.js +37 -0
- package/dist/collection/components/cpsl-row/test/cpsl-row.spec.js.map +1 -0
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.css +175 -0
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +252 -0
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js.map +1 -0
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.e2e.js +29 -0
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.spec.js +37 -0
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.spec.js.map +1 -0
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.css +68 -0
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +69 -0
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.js.map +1 -0
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.e2e.js +29 -0
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.spec.js +37 -0
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.spec.js.map +1 -0
- package/dist/collection/components/cpsl-tab/cpsl-tab.css +23 -0
- package/dist/collection/components/cpsl-tab/cpsl-tab.js +121 -0
- package/dist/collection/components/cpsl-tab/cpsl-tab.js.map +1 -0
- package/dist/collection/components/cpsl-tab/tab-interface.js +2 -0
- package/dist/collection/components/cpsl-tab/tab-interface.js.map +1 -0
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.e2e.js +29 -0
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.spec.js +37 -0
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.spec.js.map +1 -0
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.css +111 -0
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +170 -0
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.js.map +1 -0
- package/dist/collection/components/cpsl-tabs/tabs-interface.js +2 -0
- package/dist/collection/components/cpsl-tabs/tabs-interface.js.map +1 -0
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.e2e.js +29 -0
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.spec.js +37 -0
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.spec.js.map +1 -0
- package/dist/collection/components/cpsl-text/cpsl-text.css +160 -0
- package/dist/collection/components/cpsl-text/cpsl-text.js +128 -0
- package/dist/collection/components/cpsl-text/cpsl-text.js.map +1 -0
- package/dist/collection/components/cpsl-text/test/cpsl-text.e2e.js +29 -0
- package/dist/collection/components/cpsl-text/test/cpsl-text.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-text/test/cpsl-text.spec.js +37 -0
- package/dist/collection/components/cpsl-text/test/cpsl-text.spec.js.map +1 -0
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.css +97 -0
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +67 -0
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js.map +1 -0
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.e2e.js +29 -0
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.spec.js +37 -0
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.spec.js.map +1 -0
- package/dist/collection/constants.js +6 -0
- package/dist/collection/constants.js.map +1 -0
- package/dist/collection/index.js +3 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/interface.js +2 -0
- package/dist/collection/interface.js.map +1 -0
- package/dist/collection/utils/media.js +18 -0
- package/dist/collection/utils/media.js.map +1 -0
- package/dist/collection/utils/theme/generateBorderRadii.js +56 -0
- package/dist/collection/utils/theme/generateBorderRadii.js.map +1 -0
- package/dist/collection/utils/theme/generateFont.js +28 -0
- package/dist/collection/utils/theme/generateFont.js.map +1 -0
- package/dist/collection/utils/theme/generatePalette.js +46 -0
- package/dist/collection/utils/theme/generatePalette.js.map +1 -0
- package/dist/collection/utils/theme/generateTheme.js +11 -0
- package/dist/collection/utils/theme/generateTheme.js.map +1 -0
- package/dist/collection/utils/theme/utils.js +21 -0
- package/dist/collection/utils/theme/utils.js.map +1 -0
- package/dist/esm/_commonjsHelpers-1789f0cf.js +9 -0
- package/dist/esm/_commonjsHelpers-1789f0cf.js.map +1 -0
- package/dist/esm/capsule.js +22 -0
- package/dist/esm/capsule.js.map +1 -0
- package/dist/esm/cpsl-alert_18.entry.js +14777 -0
- package/dist/esm/cpsl-alert_18.entry.js.map +1 -0
- package/dist/{capsule → esm}/cpsl-animation.entry.js +20 -114
- package/dist/esm/cpsl-animation.entry.js.map +1 -0
- package/dist/{capsule → esm}/cpsl-col.entry.js +4 -3
- package/dist/esm/cpsl-col.entry.js.map +1 -0
- package/dist/{capsule → esm}/cpsl-grid.entry.js +5 -4
- package/dist/esm/cpsl-grid.entry.js.map +1 -0
- package/dist/{capsule → esm}/cpsl-info-box.entry.js +4 -3
- package/dist/esm/cpsl-info-box.entry.js.map +1 -0
- package/dist/esm/cpsl-row.entry.js +18 -0
- package/dist/esm/cpsl-row.entry.js.map +1 -0
- package/dist/esm/index-f00e090c.js +1982 -0
- package/dist/esm/index-f00e090c.js.map +1 -0
- package/dist/esm/index.js +358 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +3 -0
- package/dist/loader/index.cjs.js +3 -0
- package/dist/loader/index.d.ts +21 -0
- package/dist/loader/index.es2017.js +3 -0
- package/dist/loader/index.js +4 -0
- package/dist/loader/package.json +11 -0
- package/dist/scripts/buildIconLibrary.js +33 -0
- package/dist/scripts/buildIconLibrary.js.map +1 -0
- package/dist/types/assets/icons/index.d.ts +235 -0
- package/dist/types/components/cpsl-dropdown/cpsl-dropdown.d.ts +25 -0
- package/dist/types/components.d.ts +53 -0
- package/package.json +2 -3
- package/dist/capsule/_commonjsHelpers-bc8ff177.js +0 -36
- package/dist/capsule/_commonjsHelpers-bc8ff177.js.map +0 -1
- package/dist/capsule/cpsl-alert.entry.js +0 -31
- package/dist/capsule/cpsl-alert.entry.js.map +0 -1
- package/dist/capsule/cpsl-animation.entry.js.map +0 -1
- package/dist/capsule/cpsl-button.entry.js +0 -24
- package/dist/capsule/cpsl-button.entry.js.map +0 -1
- package/dist/capsule/cpsl-code-input.entry.js +0 -106
- package/dist/capsule/cpsl-code-input.entry.js.map +0 -1
- package/dist/capsule/cpsl-col.entry.js.map +0 -1
- package/dist/capsule/cpsl-divider.entry.js +0 -17
- package/dist/capsule/cpsl-divider.entry.js.map +0 -1
- package/dist/capsule/cpsl-grid.entry.js.map +0 -1
- package/dist/capsule/cpsl-icon.entry.js +0 -20
- package/dist/capsule/cpsl-icon.entry.js.map +0 -1
- package/dist/capsule/cpsl-info-box.entry.js.map +0 -1
- package/dist/capsule/cpsl-input.entry.js +0 -124
- package/dist/capsule/cpsl-input.entry.js.map +0 -1
- package/dist/capsule/cpsl-modal.entry.js +0 -3338
- package/dist/capsule/cpsl-modal.entry.js.map +0 -1
- package/dist/capsule/cpsl-overlay.entry.js +0 -44
- package/dist/capsule/cpsl-overlay.entry.js.map +0 -1
- package/dist/capsule/cpsl-pill.entry.js +0 -18
- package/dist/capsule/cpsl-pill.entry.js.map +0 -1
- package/dist/capsule/cpsl-progress-indicator.entry.js +0 -29
- package/dist/capsule/cpsl-progress-indicator.entry.js.map +0 -1
- package/dist/capsule/cpsl-qr-code.entry.js +0 -56
- package/dist/capsule/cpsl-qr-code.entry.js.map +0 -1
- package/dist/capsule/cpsl-row.entry.js +0 -17
- package/dist/capsule/cpsl-row.entry.js.map +0 -1
- package/dist/capsule/cpsl-slide-button.entry.js +0 -130
- package/dist/capsule/cpsl-slide-button.entry.js.map +0 -1
- package/dist/capsule/cpsl-spinner.entry.js +0 -25
- package/dist/capsule/cpsl-spinner.entry.js.map +0 -1
- package/dist/capsule/cpsl-tab.entry.js +0 -37
- package/dist/capsule/cpsl-tab.entry.js.map +0 -1
- package/dist/capsule/cpsl-tabs.entry.js +0 -71
- package/dist/capsule/cpsl-tabs.entry.js.map +0 -1
- package/dist/capsule/cpsl-text.entry.js +0 -66
- package/dist/capsule/cpsl-text.entry.js.map +0 -1
- package/dist/capsule/cpsl-tile-button.entry.js +0 -19
- package/dist/capsule/cpsl-tile-button.entry.js.map +0 -1
- package/dist/capsule/index-3ac1b9e9.js +0 -617
- package/dist/capsule/index-3ac1b9e9.js.map +0 -1
- package/dist/capsule/index-3ad00c7e.js +0 -6064
- package/dist/capsule/index-3ad00c7e.js.map +0 -1
- package/dist/capsule/index-f19e63df.js +0 -4148
- package/dist/capsule/index-f19e63df.js.map +0 -1
- package/dist/capsule/shadow-css-bc9e2af8.js +0 -478
- package/dist/capsule/shadow-css-bc9e2af8.js.map +0 -1
- /package/dist/{capsule → esm}/app-globals-0f993ce5.js +0 -0
- /package/dist/{capsule → esm}/app-globals-0f993ce5.js.map +0 -0
- /package/dist/{capsule → esm}/constants-7b49abd5.js +0 -0
- /package/dist/{capsule → esm}/constants-7b49abd5.js.map +0 -0
- /package/dist/types/Users/{taylorbosch → vinay}/Documents/GitHub/Capsule/component-library/core/.stencil/scripts/buildIconLibrary.d.ts +0 -0
@@ -1,573 +1,2 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
const generateBorderRadii = ({ borderRadius }) => {
|
4
|
-
if (!Boolean(borderRadius)) {
|
5
|
-
return;
|
6
|
-
}
|
7
|
-
let smallRadius = 8;
|
8
|
-
let mediumRadius = 16;
|
9
|
-
let largeRadius = 24;
|
10
|
-
const fullRadius = 1000;
|
11
|
-
let isFull = false;
|
12
|
-
let isNone = false;
|
13
|
-
switch (borderRadius) {
|
14
|
-
case 'none': {
|
15
|
-
isNone = true;
|
16
|
-
smallRadius = 0;
|
17
|
-
mediumRadius = 0;
|
18
|
-
largeRadius = 0;
|
19
|
-
break;
|
20
|
-
}
|
21
|
-
case 'xs': {
|
22
|
-
smallRadius = 4;
|
23
|
-
mediumRadius = 12;
|
24
|
-
largeRadius = 20;
|
25
|
-
break;
|
26
|
-
}
|
27
|
-
case 'md': {
|
28
|
-
smallRadius = 12;
|
29
|
-
mediumRadius = 20;
|
30
|
-
largeRadius = 28;
|
31
|
-
break;
|
32
|
-
}
|
33
|
-
case 'lg': {
|
34
|
-
smallRadius = 16;
|
35
|
-
mediumRadius = 24;
|
36
|
-
largeRadius = 32;
|
37
|
-
break;
|
38
|
-
}
|
39
|
-
case 'full': {
|
40
|
-
smallRadius = 16;
|
41
|
-
mediumRadius = 24;
|
42
|
-
largeRadius = 32;
|
43
|
-
isFull = true;
|
44
|
-
break;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-input', `${isFull ? fullRadius : smallRadius}px`);
|
48
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-alert', `${smallRadius}px`);
|
49
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-tabs', `${isFull ? fullRadius : smallRadius}px`);
|
50
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-primary-button', `${isFull ? fullRadius : smallRadius}px`);
|
51
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-secondary-button', `${isFull ? fullRadius : smallRadius}px`);
|
52
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-tile-button', `${smallRadius}px`);
|
53
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-modal', `${mediumRadius}px`);
|
54
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-pill', `${isNone ? 0 : fullRadius}px`);
|
55
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-qr-code', `${largeRadius}px`);
|
56
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-info-box', `${smallRadius}px`);
|
57
|
-
};
|
58
|
-
|
59
|
-
const FONT_NAME_MAP = {
|
60
|
-
body2XS: 'body-2xs',
|
61
|
-
bodyXS: 'body-xs',
|
62
|
-
bodyS: 'body-s',
|
63
|
-
bodyM: 'body-m',
|
64
|
-
bodyL: 'body-l',
|
65
|
-
bodyXL: 'body-xl',
|
66
|
-
headingXS: 'heading-xs',
|
67
|
-
headingS: 'heading-s',
|
68
|
-
headingM: 'heading-m',
|
69
|
-
headingL: 'heading-l',
|
70
|
-
headingXL: 'heading-xl',
|
71
|
-
heading2XL: 'heading-2xl',
|
72
|
-
};
|
73
|
-
const generateFont = ({ font, customFontSizes }) => {
|
74
|
-
if (Boolean(font)) {
|
75
|
-
document.documentElement.style.setProperty('--cpsl-default-font', font);
|
76
|
-
}
|
77
|
-
Object.entries(FONT_NAME_MAP).forEach(([key, value]) => {
|
78
|
-
if (customFontSizes === null || customFontSizes === void 0 ? void 0 : customFontSizes[key]) {
|
79
|
-
document.documentElement.style.setProperty(`--cpsl-font-size-${value}`, customFontSizes[key]);
|
80
|
-
}
|
81
|
-
else {
|
82
|
-
document.documentElement.style.removeProperty(`--cpsl-font-size-${value}`);
|
83
|
-
}
|
84
|
-
});
|
85
|
-
};
|
86
|
-
|
87
|
-
/**
|
88
|
-
* A simple guard function:
|
89
|
-
*
|
90
|
-
* ```js
|
91
|
-
* Math.min(Math.max(low, value), high)
|
92
|
-
* ```
|
93
|
-
*/
|
94
|
-
function guard(low, high, value) {
|
95
|
-
return Math.min(Math.max(low, value), high);
|
96
|
-
}
|
97
|
-
|
98
|
-
class ColorError extends Error {
|
99
|
-
constructor(color) {
|
100
|
-
super(`Failed to parse color: "${color}"`);
|
101
|
-
}
|
102
|
-
}
|
103
|
-
var ColorError$1 = ColorError;
|
104
|
-
|
105
|
-
/**
|
106
|
-
* Parses a color into red, gree, blue, alpha parts
|
107
|
-
*
|
108
|
-
* @param color the input color. Can be a RGB, RBGA, HSL, HSLA, or named color
|
109
|
-
*/
|
110
|
-
function parseToRgba(color) {
|
111
|
-
if (typeof color !== 'string') throw new ColorError$1(color);
|
112
|
-
if (color.trim().toLowerCase() === 'transparent') return [0, 0, 0, 0];
|
113
|
-
let normalizedColor = color.trim();
|
114
|
-
normalizedColor = namedColorRegex.test(color) ? nameToHex(color) : color;
|
115
|
-
const reducedHexMatch = reducedHexRegex.exec(normalizedColor);
|
116
|
-
if (reducedHexMatch) {
|
117
|
-
const arr = Array.from(reducedHexMatch).slice(1);
|
118
|
-
return [...arr.slice(0, 3).map(x => parseInt(r(x, 2), 16)), parseInt(r(arr[3] || 'f', 2), 16) / 255];
|
119
|
-
}
|
120
|
-
const hexMatch = hexRegex.exec(normalizedColor);
|
121
|
-
if (hexMatch) {
|
122
|
-
const arr = Array.from(hexMatch).slice(1);
|
123
|
-
return [...arr.slice(0, 3).map(x => parseInt(x, 16)), parseInt(arr[3] || 'ff', 16) / 255];
|
124
|
-
}
|
125
|
-
const rgbaMatch = rgbaRegex.exec(normalizedColor);
|
126
|
-
if (rgbaMatch) {
|
127
|
-
const arr = Array.from(rgbaMatch).slice(1);
|
128
|
-
return [...arr.slice(0, 3).map(x => parseInt(x, 10)), parseFloat(arr[3] || '1')];
|
129
|
-
}
|
130
|
-
const hslaMatch = hslaRegex.exec(normalizedColor);
|
131
|
-
if (hslaMatch) {
|
132
|
-
const [h, s, l, a] = Array.from(hslaMatch).slice(1).map(parseFloat);
|
133
|
-
if (guard(0, 100, s) !== s) throw new ColorError$1(color);
|
134
|
-
if (guard(0, 100, l) !== l) throw new ColorError$1(color);
|
135
|
-
return [...hslToRgb(h, s, l), Number.isNaN(a) ? 1 : a];
|
136
|
-
}
|
137
|
-
throw new ColorError$1(color);
|
138
|
-
}
|
139
|
-
function hash(str) {
|
140
|
-
let hash = 5381;
|
141
|
-
let i = str.length;
|
142
|
-
while (i) {
|
143
|
-
hash = hash * 33 ^ str.charCodeAt(--i);
|
144
|
-
}
|
145
|
-
|
146
|
-
/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
|
147
|
-
* integers. Since we want the results to be always positive, convert the
|
148
|
-
* signed int to an unsigned by doing an unsigned bitshift. */
|
149
|
-
return (hash >>> 0) % 2341;
|
150
|
-
}
|
151
|
-
const colorToInt = x => parseInt(x.replace(/_/g, ''), 36);
|
152
|
-
const compressedColorMap = '1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm'.split(' ').reduce((acc, next) => {
|
153
|
-
const key = colorToInt(next.substring(0, 3));
|
154
|
-
const hex = colorToInt(next.substring(3)).toString(16);
|
155
|
-
|
156
|
-
// NOTE: padStart could be used here but it breaks Node 6 compat
|
157
|
-
// https://github.com/ricokahler/color2k/issues/351
|
158
|
-
let prefix = '';
|
159
|
-
for (let i = 0; i < 6 - hex.length; i++) {
|
160
|
-
prefix += '0';
|
161
|
-
}
|
162
|
-
acc[key] = `${prefix}${hex}`;
|
163
|
-
return acc;
|
164
|
-
}, {});
|
165
|
-
|
166
|
-
/**
|
167
|
-
* Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
|
168
|
-
*/
|
169
|
-
function nameToHex(color) {
|
170
|
-
const normalizedColorName = color.toLowerCase().trim();
|
171
|
-
const result = compressedColorMap[hash(normalizedColorName)];
|
172
|
-
if (!result) throw new ColorError$1(color);
|
173
|
-
return `#${result}`;
|
174
|
-
}
|
175
|
-
const r = (str, amount) => Array.from(Array(amount)).map(() => str).join('');
|
176
|
-
const reducedHexRegex = new RegExp(`^#${r('([a-f0-9])', 3)}([a-f0-9])?$`, 'i');
|
177
|
-
const hexRegex = new RegExp(`^#${r('([a-f0-9]{2})', 3)}([a-f0-9]{2})?$`, 'i');
|
178
|
-
const rgbaRegex = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${r(',\\s*(\\d+)\\s*', 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, 'i');
|
179
|
-
const hslaRegex = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i;
|
180
|
-
const namedColorRegex = /^[a-z]+$/i;
|
181
|
-
const roundColor = color => {
|
182
|
-
return Math.round(color * 255);
|
183
|
-
};
|
184
|
-
const hslToRgb = (hue, saturation, lightness) => {
|
185
|
-
let l = lightness / 100;
|
186
|
-
if (saturation === 0) {
|
187
|
-
// achromatic
|
188
|
-
return [l, l, l].map(roundColor);
|
189
|
-
}
|
190
|
-
|
191
|
-
// formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
|
192
|
-
const huePrime = (hue % 360 + 360) % 360 / 60;
|
193
|
-
const chroma = (1 - Math.abs(2 * l - 1)) * (saturation / 100);
|
194
|
-
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
195
|
-
let red = 0;
|
196
|
-
let green = 0;
|
197
|
-
let blue = 0;
|
198
|
-
if (huePrime >= 0 && huePrime < 1) {
|
199
|
-
red = chroma;
|
200
|
-
green = secondComponent;
|
201
|
-
} else if (huePrime >= 1 && huePrime < 2) {
|
202
|
-
red = secondComponent;
|
203
|
-
green = chroma;
|
204
|
-
} else if (huePrime >= 2 && huePrime < 3) {
|
205
|
-
green = chroma;
|
206
|
-
blue = secondComponent;
|
207
|
-
} else if (huePrime >= 3 && huePrime < 4) {
|
208
|
-
green = secondComponent;
|
209
|
-
blue = chroma;
|
210
|
-
} else if (huePrime >= 4 && huePrime < 5) {
|
211
|
-
red = secondComponent;
|
212
|
-
blue = chroma;
|
213
|
-
} else if (huePrime >= 5 && huePrime < 6) {
|
214
|
-
red = chroma;
|
215
|
-
blue = secondComponent;
|
216
|
-
}
|
217
|
-
const lightnessModification = l - chroma / 2;
|
218
|
-
const finalRed = red + lightnessModification;
|
219
|
-
const finalGreen = green + lightnessModification;
|
220
|
-
const finalBlue = blue + lightnessModification;
|
221
|
-
return [finalRed, finalGreen, finalBlue].map(roundColor);
|
222
|
-
};
|
223
|
-
|
224
|
-
// taken from:
|
225
|
-
// https://github.com/styled-components/polished/blob/a23a6a2bb26802b3d922d9c3b67bac3f3a54a310/src/internalHelpers/_rgbToHsl.js
|
226
|
-
|
227
|
-
/**
|
228
|
-
* Parses a color in hue, saturation, lightness, and the alpha channel.
|
229
|
-
*
|
230
|
-
* Hue is a number between 0 and 360, saturation, lightness, and alpha are
|
231
|
-
* decimal percentages between 0 and 1
|
232
|
-
*/
|
233
|
-
function parseToHsla(color) {
|
234
|
-
const [red, green, blue, alpha] = parseToRgba(color).map((value, index) =>
|
235
|
-
// 3rd index is alpha channel which is already normalized
|
236
|
-
index === 3 ? value : value / 255);
|
237
|
-
const max = Math.max(red, green, blue);
|
238
|
-
const min = Math.min(red, green, blue);
|
239
|
-
const lightness = (max + min) / 2;
|
240
|
-
|
241
|
-
// achromatic
|
242
|
-
if (max === min) return [0, 0, lightness, alpha];
|
243
|
-
const delta = max - min;
|
244
|
-
const saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
|
245
|
-
const hue = 60 * (red === max ? (green - blue) / delta + (green < blue ? 6 : 0) : green === max ? (blue - red) / delta + 2 : (red - green) / delta + 4);
|
246
|
-
return [hue, saturation, lightness, alpha];
|
247
|
-
}
|
248
|
-
|
249
|
-
/**
|
250
|
-
* Takes in hsla parts and constructs an hsla string
|
251
|
-
*
|
252
|
-
* @param hue The color circle (from 0 to 360) - 0 (or 360) is red, 120 is green, 240 is blue
|
253
|
-
* @param saturation Percentage of saturation, given as a decimal between 0 and 1
|
254
|
-
* @param lightness Percentage of lightness, given as a decimal between 0 and 1
|
255
|
-
* @param alpha Percentage of opacity, given as a decimal between 0 and 1
|
256
|
-
*/
|
257
|
-
function hsla(hue, saturation, lightness, alpha) {
|
258
|
-
return `hsla(${(hue % 360).toFixed()}, ${guard(0, 100, saturation * 100).toFixed()}%, ${guard(0, 100, lightness * 100).toFixed()}%, ${parseFloat(guard(0, 1, alpha).toFixed(3))})`;
|
259
|
-
}
|
260
|
-
|
261
|
-
/**
|
262
|
-
* Adjusts the current hue of the color by the given degrees. Wraps around when
|
263
|
-
* over 360.
|
264
|
-
*
|
265
|
-
* @param color input color
|
266
|
-
* @param degrees degrees to adjust the input color, accepts degree integers
|
267
|
-
* (0 - 360) and wraps around on overflow
|
268
|
-
*/
|
269
|
-
function adjustHue(color, degrees) {
|
270
|
-
const [h, s, l, a] = parseToHsla(color);
|
271
|
-
return hsla(h + degrees, s, l, a);
|
272
|
-
}
|
273
|
-
|
274
|
-
/**
|
275
|
-
* Darkens using lightness. This is equivalent to subtracting the lightness
|
276
|
-
* from the L in HSL.
|
277
|
-
*
|
278
|
-
* @param amount The amount to darken, given as a decimal between 0 and 1
|
279
|
-
*/
|
280
|
-
function darken(color, amount) {
|
281
|
-
const [hue, saturation, lightness, alpha] = parseToHsla(color);
|
282
|
-
return hsla(hue, saturation, lightness - amount, alpha);
|
283
|
-
}
|
284
|
-
|
285
|
-
/**
|
286
|
-
* Desaturates the input color by the given amount via subtracting from the `s`
|
287
|
-
* in `hsla`.
|
288
|
-
*
|
289
|
-
* @param amount The amount to desaturate, given as a decimal between 0 and 1
|
290
|
-
*/
|
291
|
-
function desaturate(color, amount) {
|
292
|
-
const [h, s, l, a] = parseToHsla(color);
|
293
|
-
return hsla(h, s - amount, l, a);
|
294
|
-
}
|
295
|
-
|
296
|
-
// taken from:
|
297
|
-
// https://github.com/styled-components/polished/blob/0764c982551b487469043acb56281b0358b3107b/src/color/getLuminance.js
|
298
|
-
|
299
|
-
/**
|
300
|
-
* Returns a number (float) representing the luminance of a color.
|
301
|
-
*/
|
302
|
-
function getLuminance(color) {
|
303
|
-
if (color === 'transparent') return 0;
|
304
|
-
function f(x) {
|
305
|
-
const channel = x / 255;
|
306
|
-
return channel <= 0.04045 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4);
|
307
|
-
}
|
308
|
-
const [r, g, b] = parseToRgba(color);
|
309
|
-
return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b);
|
310
|
-
}
|
311
|
-
|
312
|
-
// taken from:
|
313
|
-
// https://github.com/styled-components/polished/blob/0764c982551b487469043acb56281b0358b3107b/src/color/getContrast.js
|
314
|
-
|
315
|
-
/**
|
316
|
-
* Returns the contrast ratio between two colors based on
|
317
|
-
* [W3's recommended equation for calculating contrast](http://www.w3.org/TR/WCAG20/#contrast-ratiodef).
|
318
|
-
*/
|
319
|
-
function getContrast(color1, color2) {
|
320
|
-
const luminance1 = getLuminance(color1);
|
321
|
-
const luminance2 = getLuminance(color2);
|
322
|
-
return luminance1 > luminance2 ? (luminance1 + 0.05) / (luminance2 + 0.05) : (luminance2 + 0.05) / (luminance1 + 0.05);
|
323
|
-
}
|
324
|
-
|
325
|
-
/**
|
326
|
-
* Takes in rgba parts and returns an rgba string
|
327
|
-
*
|
328
|
-
* @param red The amount of red in the red channel, given in a number between 0 and 255 inclusive
|
329
|
-
* @param green The amount of green in the red channel, given in a number between 0 and 255 inclusive
|
330
|
-
* @param blue The amount of blue in the red channel, given in a number between 0 and 255 inclusive
|
331
|
-
* @param alpha Percentage of opacity, given as a decimal between 0 and 1
|
332
|
-
*/
|
333
|
-
function rgba(red, green, blue, alpha) {
|
334
|
-
return `rgba(${guard(0, 255, red).toFixed()}, ${guard(0, 255, green).toFixed()}, ${guard(0, 255, blue).toFixed()}, ${parseFloat(guard(0, 1, alpha).toFixed(3))})`;
|
335
|
-
}
|
336
|
-
|
337
|
-
/**
|
338
|
-
* Mixes two colors together. Taken from sass's implementation.
|
339
|
-
*/
|
340
|
-
function mix(color1, color2, weight) {
|
341
|
-
const normalize = (n, index) =>
|
342
|
-
// 3rd index is alpha channel which is already normalized
|
343
|
-
index === 3 ? n : n / 255;
|
344
|
-
const [r1, g1, b1, a1] = parseToRgba(color1).map(normalize);
|
345
|
-
const [r2, g2, b2, a2] = parseToRgba(color2).map(normalize);
|
346
|
-
|
347
|
-
// The formula is copied from the original Sass implementation:
|
348
|
-
// http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method
|
349
|
-
const alphaDelta = a2 - a1;
|
350
|
-
const normalizedWeight = weight * 2 - 1;
|
351
|
-
const combinedWeight = normalizedWeight * alphaDelta === -1 ? normalizedWeight : normalizedWeight + alphaDelta / (1 + normalizedWeight * alphaDelta);
|
352
|
-
const weight2 = (combinedWeight + 1) / 2;
|
353
|
-
const weight1 = 1 - weight2;
|
354
|
-
const r = (r1 * weight1 + r2 * weight2) * 255;
|
355
|
-
const g = (g1 * weight1 + g2 * weight2) * 255;
|
356
|
-
const b = (b1 * weight1 + b2 * weight2) * 255;
|
357
|
-
const a = a2 * weight + a1 * (1 - weight);
|
358
|
-
return rgba(r, g, b, a);
|
359
|
-
}
|
360
|
-
|
361
|
-
/**
|
362
|
-
* Given a series colors, this function will return a `scale(x)` function that
|
363
|
-
* accepts a percentage as a decimal between 0 and 1 and returns the color at
|
364
|
-
* that percentage in the scale.
|
365
|
-
*
|
366
|
-
* ```js
|
367
|
-
* const scale = getScale('red', 'yellow', 'green');
|
368
|
-
* console.log(scale(0)); // rgba(255, 0, 0, 1)
|
369
|
-
* console.log(scale(0.5)); // rgba(255, 255, 0, 1)
|
370
|
-
* console.log(scale(1)); // rgba(0, 128, 0, 1)
|
371
|
-
* ```
|
372
|
-
*
|
373
|
-
* If you'd like to limit the domain and range like chroma-js, we recommend
|
374
|
-
* wrapping scale again.
|
375
|
-
*
|
376
|
-
* ```js
|
377
|
-
* const _scale = getScale('red', 'yellow', 'green');
|
378
|
-
* const scale = x => _scale(x / 100);
|
379
|
-
*
|
380
|
-
* console.log(scale(0)); // rgba(255, 0, 0, 1)
|
381
|
-
* console.log(scale(50)); // rgba(255, 255, 0, 1)
|
382
|
-
* console.log(scale(100)); // rgba(0, 128, 0, 1)
|
383
|
-
* ```
|
384
|
-
*/
|
385
|
-
function getScale(...colors) {
|
386
|
-
return n => {
|
387
|
-
const lastIndex = colors.length - 1;
|
388
|
-
const lowIndex = guard(0, lastIndex, Math.floor(n * lastIndex));
|
389
|
-
const highIndex = guard(0, lastIndex, Math.ceil(n * lastIndex));
|
390
|
-
const color1 = colors[lowIndex];
|
391
|
-
const color2 = colors[highIndex];
|
392
|
-
const unit = 1 / lastIndex;
|
393
|
-
const weight = (n - unit * lowIndex) / unit;
|
394
|
-
return mix(color1, color2, weight);
|
395
|
-
};
|
396
|
-
}
|
397
|
-
|
398
|
-
const guidelines = {
|
399
|
-
decorative: 1.5,
|
400
|
-
readable: 3,
|
401
|
-
aa: 4.5,
|
402
|
-
aaa: 7
|
403
|
-
};
|
404
|
-
|
405
|
-
/**
|
406
|
-
* Returns whether or not a color has bad contrast against a background
|
407
|
-
* according to a given standard.
|
408
|
-
*/
|
409
|
-
function hasBadContrast(color, standard = 'aa', background = '#fff') {
|
410
|
-
return getContrast(color, background) < guidelines[standard];
|
411
|
-
}
|
412
|
-
|
413
|
-
/**
|
414
|
-
* Lightens a color by a given amount. This is equivalent to
|
415
|
-
* `darken(color, -amount)`
|
416
|
-
*
|
417
|
-
* @param amount The amount to darken, given as a decimal between 0 and 1
|
418
|
-
*/
|
419
|
-
function lighten(color, amount) {
|
420
|
-
return darken(color, -amount);
|
421
|
-
}
|
422
|
-
|
423
|
-
/**
|
424
|
-
* Takes in a color and makes it more transparent by convert to `rgba` and
|
425
|
-
* decreasing the amount in the alpha channel.
|
426
|
-
*
|
427
|
-
* @param amount The amount to increase the transparency by, given as a decimal between 0 and 1
|
428
|
-
*/
|
429
|
-
function transparentize(color, amount) {
|
430
|
-
const [r, g, b, a] = parseToRgba(color);
|
431
|
-
return rgba(r, g, b, a - amount);
|
432
|
-
}
|
433
|
-
|
434
|
-
/**
|
435
|
-
* Takes a color and un-transparentizes it. Equivalent to
|
436
|
-
* `transparentize(color, -amount)`
|
437
|
-
*
|
438
|
-
* @param amount The amount to increase the opacity by, given as a decimal between 0 and 1
|
439
|
-
*/
|
440
|
-
function opacify(color, amount) {
|
441
|
-
return transparentize(color, -amount);
|
442
|
-
}
|
443
|
-
|
444
|
-
/**
|
445
|
-
* An alternative function to `readableColor`. Returns whether or not the
|
446
|
-
* readable color (i.e. the color to be place on top the input color) should be
|
447
|
-
* black.
|
448
|
-
*/
|
449
|
-
function readableColorIsBlack(color) {
|
450
|
-
return getLuminance(color) > 0.179;
|
451
|
-
}
|
452
|
-
|
453
|
-
/**
|
454
|
-
* Returns black or white for best contrast depending on the luminosity of the
|
455
|
-
* given color.
|
456
|
-
*/
|
457
|
-
function readableColor(color) {
|
458
|
-
return readableColorIsBlack(color) ? '#000' : '#fff';
|
459
|
-
}
|
460
|
-
|
461
|
-
/**
|
462
|
-
* Saturates a color by converting it to `hsl` and increasing the saturation
|
463
|
-
* amount. Equivalent to `desaturate(color, -amount)`
|
464
|
-
*
|
465
|
-
* @param color Input color
|
466
|
-
* @param amount The amount to darken, given as a decimal between 0 and 1
|
467
|
-
*/
|
468
|
-
function saturate(color, amount) {
|
469
|
-
return desaturate(color, -amount);
|
470
|
-
}
|
471
|
-
|
472
|
-
/**
|
473
|
-
* Takes in any color and returns it as a hex code.
|
474
|
-
*/
|
475
|
-
function toHex(color) {
|
476
|
-
const [r, g, b, a] = parseToRgba(color);
|
477
|
-
let hex = x => {
|
478
|
-
const h = guard(0, 255, x).toString(16);
|
479
|
-
// NOTE: padStart could be used here but it breaks Node 6 compat
|
480
|
-
// https://github.com/ricokahler/color2k/issues/351
|
481
|
-
return h.length === 1 ? `0${h}` : h;
|
482
|
-
};
|
483
|
-
return `#${hex(r)}${hex(g)}${hex(b)}${a < 1 ? hex(Math.round(a * 255)) : ''}`;
|
484
|
-
}
|
485
|
-
|
486
|
-
/**
|
487
|
-
* Takes in any color and returns it as an rgba string.
|
488
|
-
*/
|
489
|
-
function toRgba(color) {
|
490
|
-
return rgba(...parseToRgba(color));
|
491
|
-
}
|
492
|
-
|
493
|
-
/**
|
494
|
-
* Takes in any color and returns it as an hsla string.
|
495
|
-
*/
|
496
|
-
function toHsla(color) {
|
497
|
-
return hsla(...parseToHsla(color));
|
498
|
-
}
|
499
|
-
|
500
|
-
const isColor = strColor => {
|
501
|
-
const s = new Option().style;
|
502
|
-
s.color = strColor;
|
503
|
-
return s.color !== '';
|
504
|
-
};
|
505
|
-
const toKebabCase = (pascal) => pascal.replace(/([a-z0–9])([A-Z])/g, '$1-$2').toLowerCase();
|
506
|
-
const buildVars = (prev, obj) => {
|
507
|
-
let resp = {};
|
508
|
-
for (const k in obj) {
|
509
|
-
const name = `${prev}-${toKebabCase(k)}`;
|
510
|
-
if (typeof obj[k] === 'object' && obj[k] !== null) {
|
511
|
-
resp = Object.assign(Object.assign({}, resp), buildVars(name, obj[k]));
|
512
|
-
}
|
513
|
-
else {
|
514
|
-
resp[name] = obj[k];
|
515
|
-
}
|
516
|
-
}
|
517
|
-
return resp;
|
518
|
-
};
|
519
|
-
const getCssColors = (customPalette) => buildVars('--cpsl-color', customPalette);
|
520
|
-
|
521
|
-
const MIXES = [0, 0.08, 0.16, 0.32, 0.48, 0.64, 0.8, 0.96];
|
522
|
-
const generatePalette = ({ foregroundColor, backgroundColor, customPalette }) => {
|
523
|
-
if (!Boolean(foregroundColor) || !isColor(foregroundColor)) {
|
524
|
-
foregroundColor = DEFAULT_THEME.foregroundColor;
|
525
|
-
}
|
526
|
-
if (!Boolean(backgroundColor) || !isColor(backgroundColor)) {
|
527
|
-
backgroundColor = DEFAULT_THEME.backgroundColor;
|
528
|
-
}
|
529
|
-
const isDarkBackground = !readableColorIsBlack(backgroundColor);
|
530
|
-
const palette = {
|
531
|
-
foregroundColors: [],
|
532
|
-
backgroundColors: [],
|
533
|
-
isDarkBackground,
|
534
|
-
};
|
535
|
-
const backgroundMixColor = isDarkBackground ? '#FFFFFF' : '#000000';
|
536
|
-
const foregroundMixColor = isDarkBackground ? '#000000' : '#FFFFFF';
|
537
|
-
MIXES.forEach(value => {
|
538
|
-
palette.foregroundColors.push(mix(foregroundColor, foregroundMixColor, value));
|
539
|
-
palette.backgroundColors.push(mix(backgroundColor, backgroundMixColor, value));
|
540
|
-
});
|
541
|
-
document.documentElement.style.setProperty('--cpsl-color-background-0', palette.backgroundColors[0]);
|
542
|
-
document.documentElement.style.setProperty('--cpsl-color-background-8', palette.backgroundColors[1]);
|
543
|
-
document.documentElement.style.setProperty('--cpsl-color-background-16', palette.backgroundColors[2]);
|
544
|
-
document.documentElement.style.setProperty('--cpsl-color-background-32', palette.backgroundColors[3]);
|
545
|
-
document.documentElement.style.setProperty('--cpsl-color-background-48', palette.backgroundColors[4]);
|
546
|
-
document.documentElement.style.setProperty('--cpsl-color-background-64', palette.backgroundColors[5]);
|
547
|
-
document.documentElement.style.setProperty('--cpsl-color-background-80', palette.backgroundColors[6]);
|
548
|
-
document.documentElement.style.setProperty('--cpsl-color-background-96', palette.backgroundColors[7]);
|
549
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-0', palette.foregroundColors[0]);
|
550
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-8', palette.foregroundColors[1]);
|
551
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-16', palette.foregroundColors[2]);
|
552
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-32', palette.foregroundColors[3]);
|
553
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-48', palette.foregroundColors[4]);
|
554
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-64', palette.foregroundColors[5]);
|
555
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-80', palette.foregroundColors[6]);
|
556
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-96', palette.foregroundColors[7]);
|
557
|
-
if (Boolean(customPalette)) {
|
558
|
-
const cssColorVars = getCssColors(customPalette);
|
559
|
-
Object.entries(cssColorVars).forEach(([k, v]) => document.documentElement.style.setProperty(k, v));
|
560
|
-
}
|
561
|
-
return palette;
|
562
|
-
};
|
563
|
-
|
564
|
-
const generateTheme = ({ foregroundColor = DEFAULT_THEME.foregroundColor, backgroundColor = DEFAULT_THEME.backgroundColor, font, customPalette, borderRadius, customFontSizes, }) => {
|
565
|
-
const palette = generatePalette({ foregroundColor, backgroundColor, customPalette });
|
566
|
-
generateFont({ font, customFontSizes });
|
567
|
-
generateBorderRadii({ borderRadius });
|
568
|
-
return palette.isDarkBackground;
|
569
|
-
};
|
570
|
-
|
571
|
-
export { generateTheme };
|
572
|
-
|
1
|
+
import{D as o}from"./p-c2bf050b.js";const n=({borderRadius:o})=>{if(!Boolean(o)){return}let n=8;let t=16;let e=24;const r=1e3;let c=false;let s=false;switch(o){case"none":{s=true;n=0;t=0;e=0;break}case"xs":{n=4;t=12;e=20;break}case"md":{n=12;t=20;e=28;break}case"lg":{n=16;t=24;e=32;break}case"full":{n=16;t=24;e=32;c=true;break}}document.documentElement.style.setProperty("--cpsl-border-radius-input",`${c?r:n}px`);document.documentElement.style.setProperty("--cpsl-border-radius-alert",`${n}px`);document.documentElement.style.setProperty("--cpsl-border-radius-tabs",`${c?r:n}px`);document.documentElement.style.setProperty("--cpsl-border-radius-primary-button",`${c?r:n}px`);document.documentElement.style.setProperty("--cpsl-border-radius-secondary-button",`${c?r:n}px`);document.documentElement.style.setProperty("--cpsl-border-radius-tile-button",`${n}px`);document.documentElement.style.setProperty("--cpsl-border-radius-modal",`${t}px`);document.documentElement.style.setProperty("--cpsl-border-radius-pill",`${s?0:r}px`);document.documentElement.style.setProperty("--cpsl-border-radius-qr-code",`${e}px`);document.documentElement.style.setProperty("--cpsl-border-radius-info-box",`${n}px`)};const t={body2XS:"body-2xs",bodyXS:"body-xs",bodyS:"body-s",bodyM:"body-m",bodyL:"body-l",bodyXL:"body-xl",headingXS:"heading-xs",headingS:"heading-s",headingM:"heading-m",headingL:"heading-l",headingXL:"heading-xl",heading2XL:"heading-2xl"};const e=({font:o,customFontSizes:n})=>{if(Boolean(o)){document.documentElement.style.setProperty("--cpsl-default-font",o)}Object.entries(t).forEach((([o,t])=>{if(n===null||n===void 0?void 0:n[o]){document.documentElement.style.setProperty(`--cpsl-font-size-${t}`,n[o])}else{document.documentElement.style.removeProperty(`--cpsl-font-size-${t}`)}}))};function r(o,n,t){return Math.min(Math.max(o,t),n)}class c extends Error{constructor(o){super(`Failed to parse color: "${o}"`)}}var s=c;function d(o){if(typeof o!=="string")throw new s(o);if(o.trim().toLowerCase()==="transparent")return[0,0,0,0];let n=o.trim();n=m.test(o)?_(o):o;const t=f.exec(n);if(t){const o=Array.from(t).slice(1);return[...o.slice(0,3).map((o=>parseInt(i(o,2),16))),parseInt(i(o[3]||"f",2),16)/255]}const e=p.exec(n);if(e){const o=Array.from(e).slice(1);return[...o.slice(0,3).map((o=>parseInt(o,16))),parseInt(o[3]||"ff",16)/255]}const c=b.exec(n);if(c){const o=Array.from(c).slice(1);return[...o.slice(0,3).map((o=>parseInt(o,10))),parseFloat(o[3]||"1")]}const d=g.exec(n);if(d){const[n,t,e,c]=Array.from(d).slice(1).map(parseFloat);if(r(0,100,t)!==t)throw new s(o);if(r(0,100,e)!==e)throw new s(o);return[...k(n,t,e),Number.isNaN(c)?1:c]}throw new s(o)}function l(o){let n=5381;let t=o.length;while(t){n=n*33^o.charCodeAt(--t)}return(n>>>0)%2341}const u=o=>parseInt(o.replace(/_/g,""),36);const a="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce(((o,n)=>{const t=u(n.substring(0,3));const e=u(n.substring(3)).toString(16);let r="";for(let o=0;o<6-e.length;o++){r+="0"}o[t]=`${r}${e}`;return o}),{});function _(o){const n=o.toLowerCase().trim();const t=a[l(n)];if(!t)throw new s(o);return`#${t}`}const i=(o,n)=>Array.from(Array(n)).map((()=>o)).join("");const f=new RegExp(`^#${i("([a-f0-9])",3)}([a-f0-9])?$`,"i");const p=new RegExp(`^#${i("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i");const b=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${i(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i");const g=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i;const m=/^[a-z]+$/i;const z=o=>Math.round(o*255);const k=(o,n,t)=>{let e=t/100;if(n===0){return[e,e,e].map(z)}const r=(o%360+360)%360/60;const c=(1-Math.abs(2*e-1))*(n/100);const s=c*(1-Math.abs(r%2-1));let d=0;let l=0;let u=0;if(r>=0&&r<1){d=c;l=s}else if(r>=1&&r<2){d=s;l=c}else if(r>=2&&r<3){l=c;u=s}else if(r>=3&&r<4){l=s;u=c}else if(r>=4&&r<5){d=s;u=c}else if(r>=5&&r<6){d=c;u=s}const a=e-c/2;const _=d+a;const i=l+a;const f=u+a;return[_,i,f].map(z)};function y(o){if(o==="transparent")return 0;function n(o){const n=o/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}const[t,e,r]=d(o);return.2126*n(t)+.7152*n(e)+.0722*n(r)}function h(o,n,t,e){return`rgba(${r(0,255,o).toFixed()}, ${r(0,255,n).toFixed()}, ${r(0,255,t).toFixed()}, ${parseFloat(r(0,1,e).toFixed(3))})`}function x(o,n,t){const e=(o,n)=>n===3?o:o/255;const[r,c,s,l]=d(o).map(e);const[u,a,_,i]=d(n).map(e);const f=i-l;const p=t*2-1;const b=p*f===-1?p:p+f/(1+p*f);const g=(b+1)/2;const m=1-g;const z=(r*m+u*g)*255;const k=(c*m+a*g)*255;const y=(s*m+_*g)*255;const x=i*t+l*(1-t);return h(z,k,y,x)}function w(o){return y(o)>.179}const j=o=>{const n=(new Option).style;n.color=o;return n.color!==""};const $=o=>o.replace(/([a-z0–9])([A-Z])/g,"$1-$2").toLowerCase();const v=(o,n)=>{let t={};for(const e in n){const r=`${o}-${$(e)}`;if(typeof n[e]==="object"&&n[e]!==null){t=Object.assign(Object.assign({},t),v(r,n[e]))}else{t[r]=n[e]}}return t};const q=o=>v("--cpsl-color",o);const F=[0,.08,.16,.32,.48,.64,.8,.96];const C=({foregroundColor:n,backgroundColor:t,customPalette:e})=>{if(!Boolean(n)||!j(n)){n=o.foregroundColor}if(!Boolean(t)||!j(t)){t=o.backgroundColor}const r=!w(t);const c={foregroundColors:[],backgroundColors:[],isDarkBackground:r};const s=r?"#FFFFFF":"#000000";const d=r?"#000000":"#FFFFFF";F.forEach((o=>{c.foregroundColors.push(x(n,d,o));c.backgroundColors.push(x(t,s,o))}));document.documentElement.style.setProperty("--cpsl-color-background-0",c.backgroundColors[0]);document.documentElement.style.setProperty("--cpsl-color-background-8",c.backgroundColors[1]);document.documentElement.style.setProperty("--cpsl-color-background-16",c.backgroundColors[2]);document.documentElement.style.setProperty("--cpsl-color-background-32",c.backgroundColors[3]);document.documentElement.style.setProperty("--cpsl-color-background-48",c.backgroundColors[4]);document.documentElement.style.setProperty("--cpsl-color-background-64",c.backgroundColors[5]);document.documentElement.style.setProperty("--cpsl-color-background-80",c.backgroundColors[6]);document.documentElement.style.setProperty("--cpsl-color-background-96",c.backgroundColors[7]);document.documentElement.style.setProperty("--cpsl-color-foreground-0",c.foregroundColors[0]);document.documentElement.style.setProperty("--cpsl-color-foreground-8",c.foregroundColors[1]);document.documentElement.style.setProperty("--cpsl-color-foreground-16",c.foregroundColors[2]);document.documentElement.style.setProperty("--cpsl-color-foreground-32",c.foregroundColors[3]);document.documentElement.style.setProperty("--cpsl-color-foreground-48",c.foregroundColors[4]);document.documentElement.style.setProperty("--cpsl-color-foreground-64",c.foregroundColors[5]);document.documentElement.style.setProperty("--cpsl-color-foreground-80",c.foregroundColors[6]);document.documentElement.style.setProperty("--cpsl-color-foreground-96",c.foregroundColors[7]);if(Boolean(e)){const o=q(e);Object.entries(o).forEach((([o,n])=>document.documentElement.style.setProperty(o,n)))}return c};const M=({foregroundColor:t=o.foregroundColor,backgroundColor:r=o.backgroundColor,font:c,customPalette:s,borderRadius:d,customFontSizes:l})=>{const u=C({foregroundColor:t,backgroundColor:r,customPalette:s});e({font:c,customFontSizes:l});n({borderRadius:d});return u.isDarkBackground};export{M as generateTheme};
|
573
2
|
//# sourceMappingURL=index.esm.js.map
|