@usecapsule/core-components 2.0.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/capsule/_commonjsHelpers-bc8ff177.js +36 -0
- package/dist/capsule/_commonjsHelpers-bc8ff177.js.map +1 -0
- package/dist/capsule/capsule.esm.js +52 -1
- package/dist/capsule/capsule.esm.js.map +1 -1
- package/dist/capsule/cpsl-alert.entry.js +31 -0
- package/dist/capsule/cpsl-alert.entry.js.map +1 -0
- package/dist/{esm → capsule}/cpsl-animation.entry.js +114 -20
- package/dist/capsule/cpsl-animation.entry.js.map +1 -0
- package/dist/capsule/cpsl-button.entry.js +24 -0
- package/dist/capsule/cpsl-button.entry.js.map +1 -0
- package/dist/capsule/cpsl-code-input.entry.js +106 -0
- package/dist/capsule/cpsl-code-input.entry.js.map +1 -0
- package/dist/{esm → capsule}/cpsl-col.entry.js +3 -4
- package/dist/capsule/cpsl-col.entry.js.map +1 -0
- package/dist/capsule/cpsl-divider.entry.js +17 -0
- package/dist/capsule/cpsl-divider.entry.js.map +1 -0
- package/dist/{esm → capsule}/cpsl-grid.entry.js +4 -5
- package/dist/capsule/cpsl-grid.entry.js.map +1 -0
- package/dist/capsule/cpsl-icon.entry.js +20 -0
- package/dist/capsule/cpsl-icon.entry.js.map +1 -0
- package/dist/{esm → capsule}/cpsl-info-box.entry.js +3 -4
- package/dist/capsule/cpsl-info-box.entry.js.map +1 -0
- package/dist/capsule/cpsl-input.entry.js +124 -0
- package/dist/capsule/cpsl-input.entry.js.map +1 -0
- package/dist/capsule/cpsl-modal.entry.js +3338 -0
- package/dist/capsule/cpsl-modal.entry.js.map +1 -0
- package/dist/capsule/cpsl-overlay.entry.js +44 -0
- package/dist/capsule/cpsl-overlay.entry.js.map +1 -0
- package/dist/capsule/cpsl-pill.entry.js +18 -0
- package/dist/capsule/cpsl-pill.entry.js.map +1 -0
- package/dist/capsule/cpsl-progress-indicator.entry.js +29 -0
- package/dist/capsule/cpsl-progress-indicator.entry.js.map +1 -0
- package/dist/capsule/cpsl-qr-code.entry.js +56 -0
- package/dist/capsule/cpsl-qr-code.entry.js.map +1 -0
- package/dist/capsule/cpsl-row.entry.js +17 -0
- package/dist/capsule/cpsl-row.entry.js.map +1 -0
- package/dist/capsule/cpsl-slide-button.entry.js +130 -0
- package/dist/capsule/cpsl-slide-button.entry.js.map +1 -0
- package/dist/capsule/cpsl-spinner.entry.js +25 -0
- package/dist/capsule/cpsl-spinner.entry.js.map +1 -0
- package/dist/capsule/cpsl-tab.entry.js +37 -0
- package/dist/capsule/cpsl-tab.entry.js.map +1 -0
- package/dist/capsule/cpsl-tabs.entry.js +71 -0
- package/dist/capsule/cpsl-tabs.entry.js.map +1 -0
- package/dist/capsule/cpsl-text.entry.js +66 -0
- package/dist/capsule/cpsl-text.entry.js.map +1 -0
- package/dist/capsule/cpsl-tile-button.entry.js +19 -0
- package/dist/capsule/cpsl-tile-button.entry.js.map +1 -0
- package/dist/capsule/index-3ac1b9e9.js +617 -0
- package/dist/capsule/index-3ac1b9e9.js.map +1 -0
- package/dist/capsule/index-3ad00c7e.js +6064 -0
- package/dist/capsule/index-3ad00c7e.js.map +1 -0
- package/dist/capsule/index-f19e63df.js +4148 -0
- package/dist/capsule/index-f19e63df.js.map +1 -0
- package/dist/capsule/index.esm.js +572 -1
- package/dist/capsule/index.esm.js.map +1 -1
- package/dist/capsule/shadow-css-bc9e2af8.js +478 -0
- package/dist/capsule/shadow-css-bc9e2af8.js.map +1 -0
- package/dist/types/components/cpsl-modal/cpsl-modal.d.ts +2 -0
- package/dist/types/components/cpsl-text/cpsl-text.d.ts +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interface.d.ts +15 -0
- package/dist/types/utils/theme/generateFont.d.ts +1 -1
- package/dist/types/utils/theme/generateTheme.d.ts +1 -2
- package/package.json +2 -2
- package/dist/capsule/p-0462f723.js +0 -2
- package/dist/capsule/p-0462f723.js.map +0 -1
- package/dist/capsule/p-202a85c9.entry.js +0 -29
- package/dist/capsule/p-202a85c9.entry.js.map +0 -1
- package/dist/capsule/p-68c73705.entry.js +0 -2
- package/dist/capsule/p-68c73705.entry.js.map +0 -1
- package/dist/capsule/p-6fb7c4d1.js +0 -3
- package/dist/capsule/p-6fb7c4d1.js.map +0 -1
- package/dist/capsule/p-91412151.entry.js +0 -2
- package/dist/capsule/p-91412151.entry.js.map +0 -1
- package/dist/capsule/p-a95ec4df.entry.js +0 -2
- package/dist/capsule/p-a95ec4df.entry.js.map +0 -1
- package/dist/capsule/p-c2bf050b.js +0 -2
- package/dist/capsule/p-c2bf050b.js.map +0 -1
- package/dist/capsule/p-d7be092d.entry.js +0 -10
- package/dist/capsule/p-d7be092d.entry.js.map +0 -1
- package/dist/capsule/p-e1255160.js +0 -2
- package/dist/capsule/p-e1255160.js.map +0 -1
- package/dist/capsule/p-f604b591.entry.js +0 -2
- package/dist/capsule/p-f604b591.entry.js.map +0 -1
- package/dist/cjs/_commonjsHelpers-b3309d7b.js +0 -12
- package/dist/cjs/_commonjsHelpers-b3309d7b.js.map +0 -1
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/capsule.cjs.js +0 -27
- package/dist/cjs/capsule.cjs.js.map +0 -1
- package/dist/cjs/constants-4bb85cc5.js +0 -12
- package/dist/cjs/constants-4bb85cc5.js.map +0 -1
- package/dist/cjs/cpsl-alert_17.cjs.entry.js +0 -10704
- package/dist/cjs/cpsl-alert_17.cjs.entry.js.map +0 -1
- package/dist/cjs/cpsl-animation.cjs.entry.js +0 -20129
- package/dist/cjs/cpsl-animation.cjs.entry.js.map +0 -1
- package/dist/cjs/cpsl-col.cjs.entry.js +0 -125
- package/dist/cjs/cpsl-col.cjs.entry.js.map +0 -1
- package/dist/cjs/cpsl-grid.cjs.entry.js +0 -25
- package/dist/cjs/cpsl-grid.cjs.entry.js.map +0 -1
- package/dist/cjs/cpsl-info-box.cjs.entry.js +0 -22
- package/dist/cjs/cpsl-info-box.cjs.entry.js.map +0 -1
- package/dist/cjs/cpsl-row.cjs.entry.js +0 -22
- package/dist/cjs/cpsl-row.cjs.entry.js.map +0 -1
- package/dist/cjs/index-3fccb5b4.js +0 -2012
- package/dist/cjs/index-3fccb5b4.js.map +0 -1
- package/dist/cjs/index.cjs.js +0 -342
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js +0 -17
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/collection/assets/icons/alert-circle.svg +0 -3
- package/dist/collection/assets/icons/angel-list-brand.svg +0 -3
- package/dist/collection/assets/icons/angel-list.svg +0 -3
- package/dist/collection/assets/icons/apple-brand.svg +0 -3
- package/dist/collection/assets/icons/apple.svg +0 -3
- package/dist/collection/assets/icons/arrow-narrow.svg +0 -3
- package/dist/collection/assets/icons/arrow.svg +0 -3
- package/dist/collection/assets/icons/backup-kit.svg +0 -4
- package/dist/collection/assets/icons/capsule-logo.svg +0 -18
- package/dist/collection/assets/icons/capsule-rings-dark.svg +0 -34
- package/dist/collection/assets/icons/capsule-rings.svg +0 -34
- package/dist/collection/assets/icons/capsule.svg +0 -4
- package/dist/collection/assets/icons/check.svg +0 -3
- package/dist/collection/assets/icons/clock.svg +0 -3
- package/dist/collection/assets/icons/close.svg +0 -4
- package/dist/collection/assets/icons/clubhouse-brand.svg +0 -4
- package/dist/collection/assets/icons/clubhouse.svg +0 -4
- package/dist/collection/assets/icons/copy.svg +0 -3
- package/dist/collection/assets/icons/discord-brand.svg +0 -4
- package/dist/collection/assets/icons/discord.svg +0 -4
- package/dist/collection/assets/icons/download-cloud.svg +0 -3
- package/dist/collection/assets/icons/dribbble-brand.svg +0 -4
- package/dist/collection/assets/icons/dribbble.svg +0 -3
- package/dist/collection/assets/icons/eye-off.svg +0 -3
- package/dist/collection/assets/icons/eye.svg +0 -4
- package/dist/collection/assets/icons/facebook-brand.svg +0 -11
- package/dist/collection/assets/icons/facebook.svg +0 -10
- package/dist/collection/assets/icons/figma-brand.svg +0 -14
- package/dist/collection/assets/icons/figma.svg +0 -3
- package/dist/collection/assets/icons/github-brand.svg +0 -10
- package/dist/collection/assets/icons/github.svg +0 -10
- package/dist/collection/assets/icons/google-brand.svg +0 -13
- package/dist/collection/assets/icons/google.svg +0 -10
- package/dist/collection/assets/icons/help-circle.svg +0 -3
- package/dist/collection/assets/icons/hero-email.svg +0 -12
- package/dist/collection/assets/icons/hero-lock.svg +0 -4
- package/dist/collection/assets/icons/hero-passkey.svg +0 -12
- package/dist/collection/assets/icons/hero-phone.svg +0 -4
- package/dist/collection/assets/icons/hero-wallet.svg +0 -5
- package/dist/collection/assets/icons/index.js +0 -70
- package/dist/collection/assets/icons/index.js.map +0 -1
- package/dist/collection/assets/icons/info-circle.svg +0 -3
- package/dist/collection/assets/icons/instagram-brand.svg +0 -12
- package/dist/collection/assets/icons/instagram.svg +0 -12
- package/dist/collection/assets/icons/key.svg +0 -3
- package/dist/collection/assets/icons/linkedin-brand.svg +0 -10
- package/dist/collection/assets/icons/linkedin.svg +0 -10
- package/dist/collection/assets/icons/mail.svg +0 -3
- package/dist/collection/assets/icons/more-login-options.svg +0 -13
- package/dist/collection/assets/icons/phone.svg +0 -3
- package/dist/collection/assets/icons/pintrest-brand.svg +0 -11
- package/dist/collection/assets/icons/pintrest.svg +0 -10
- package/dist/collection/assets/icons/plus-circle.svg +0 -5
- package/dist/collection/assets/icons/reddit-brand.svg +0 -11
- package/dist/collection/assets/icons/reddit.svg +0 -3
- package/dist/collection/assets/icons/signal-brand.svg +0 -3
- package/dist/collection/assets/icons/signal.svg +0 -3
- package/dist/collection/assets/icons/snapchat-brand.svg +0 -4
- package/dist/collection/assets/icons/snapchat.svg +0 -3
- package/dist/collection/assets/icons/telegram-brand.svg +0 -15
- package/dist/collection/assets/icons/telegram.svg +0 -10
- package/dist/collection/assets/icons/tik-tok-brand.svg +0 -5
- package/dist/collection/assets/icons/tik-tok.svg +0 -3
- package/dist/collection/assets/icons/tumblr-brand.svg +0 -10
- package/dist/collection/assets/icons/tumblr.svg +0 -10
- package/dist/collection/assets/icons/twitter-brand.svg +0 -3
- package/dist/collection/assets/icons/twitter.svg +0 -3
- package/dist/collection/assets/icons/wallet.svg +0 -5
- package/dist/collection/assets/icons/youtube-brand.svg +0 -11
- package/dist/collection/assets/icons/youtube.svg +0 -3
- package/dist/collection/collection-manifest.json +0 -33
- package/dist/collection/components/cpsl-alert/cpsl-alert.css +0 -98
- package/dist/collection/components/cpsl-alert/cpsl-alert.js +0 -80
- package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +0 -1
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.e2e.js +0 -29
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.spec.js +0 -37
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.spec.js.map +0 -1
- package/dist/collection/components/cpsl-animation/cpsl-animation.css +0 -17
- package/dist/collection/components/cpsl-animation/cpsl-animation.js +0 -102
- package/dist/collection/components/cpsl-animation/cpsl-animation.js.map +0 -1
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.e2e.js +0 -29
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.spec.js +0 -37
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.spec.js.map +0 -1
- package/dist/collection/components/cpsl-button/cpsl-button.css +0 -162
- package/dist/collection/components/cpsl-button/cpsl-button.js +0 -68
- package/dist/collection/components/cpsl-button/cpsl-button.js.map +0 -1
- package/dist/collection/components/cpsl-button/test/cpsl-button.e2e.js +0 -29
- package/dist/collection/components/cpsl-button/test/cpsl-button.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-button/test/cpsl-button.spec.js +0 -37
- package/dist/collection/components/cpsl-button/test/cpsl-button.spec.js.map +0 -1
- package/dist/collection/components/cpsl-code-input/code-change-interface.js +0 -2
- package/dist/collection/components/cpsl-code-input/code-change-interface.js.map +0 -1
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.css +0 -134
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +0 -223
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js.map +0 -1
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.e2e.js +0 -29
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.spec.js +0 -37
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.spec.js.map +0 -1
- package/dist/collection/components/cpsl-col/cpsl-col.css +0 -200
- package/dist/collection/components/cpsl-col/cpsl-col.js +0 -528
- package/dist/collection/components/cpsl-col/cpsl-col.js.map +0 -1
- package/dist/collection/components/cpsl-col/test/cpsl-col.e2e.js +0 -29
- package/dist/collection/components/cpsl-col/test/cpsl-col.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-col/test/cpsl-col.spec.js +0 -37
- package/dist/collection/components/cpsl-col/test/cpsl-col.spec.js.map +0 -1
- package/dist/collection/components/cpsl-divider/cpsl-divider.css +0 -73
- package/dist/collection/components/cpsl-divider/cpsl-divider.js +0 -19
- package/dist/collection/components/cpsl-divider/cpsl-divider.js.map +0 -1
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.e2e.js +0 -29
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.spec.js +0 -37
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.spec.js.map +0 -1
- package/dist/collection/components/cpsl-grid/cpsl-grid.css +0 -235
- package/dist/collection/components/cpsl-grid/cpsl-grid.js +0 -46
- package/dist/collection/components/cpsl-grid/cpsl-grid.js.map +0 -1
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.e2e.js +0 -29
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.spec.js +0 -37
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.spec.js.map +0 -1
- package/dist/collection/components/cpsl-icon/cpsl-icon.css +0 -95
- package/dist/collection/components/cpsl-icon/cpsl-icon.js +0 -68
- package/dist/collection/components/cpsl-icon/cpsl-icon.js.map +0 -1
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.e2e.js +0 -29
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.spec.js +0 -37
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.spec.js.map +0 -1
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.css +0 -77
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +0 -19
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.js.map +0 -1
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.e2e.js +0 -29
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.spec.js +0 -37
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.spec.js.map +0 -1
- package/dist/collection/components/cpsl-input/cpsl-input.css +0 -194
- package/dist/collection/components/cpsl-input/cpsl-input.js +0 -708
- package/dist/collection/components/cpsl-input/cpsl-input.js.map +0 -1
- package/dist/collection/components/cpsl-input/input-interface.js +0 -2
- package/dist/collection/components/cpsl-input/input-interface.js.map +0 -1
- package/dist/collection/components/cpsl-input/test/cpsl-input.e2e.js +0 -29
- package/dist/collection/components/cpsl-input/test/cpsl-input.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-input/test/cpsl-input.spec.js +0 -37
- package/dist/collection/components/cpsl-input/test/cpsl-input.spec.js.map +0 -1
- package/dist/collection/components/cpsl-modal/cpsl-modal.css +0 -172
- package/dist/collection/components/cpsl-modal/cpsl-modal.js +0 -423
- package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +0 -1
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.e2e.js +0 -29
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.spec.js +0 -37
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.spec.js.map +0 -1
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.css +0 -11
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +0 -108
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.js.map +0 -1
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.e2e.js +0 -29
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.spec.js +0 -37
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.spec.js.map +0 -1
- package/dist/collection/components/cpsl-pill/cpsl-pill.css +0 -92
- package/dist/collection/components/cpsl-pill/cpsl-pill.js +0 -43
- package/dist/collection/components/cpsl-pill/cpsl-pill.js.map +0 -1
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.e2e.js +0 -29
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.spec.js +0 -37
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.spec.js.map +0 -1
- package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.css +0 -82
- package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.js +0 -71
- package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.js.map +0 -1
- package/dist/collection/components/cpsl-progress-indicator/progress-indicator-interface.js +0 -2
- package/dist/collection/components/cpsl-progress-indicator/progress-indicator-interface.js.map +0 -1
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.e2e.js +0 -29
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.spec.js +0 -37
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.spec.js.map +0 -1
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.css +0 -81
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +0 -107
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js.map +0 -1
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.e2e.js +0 -29
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.spec.js +0 -37
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.spec.js.map +0 -1
- package/dist/collection/components/cpsl-row/cpsl-row.css +0 -136
- package/dist/collection/components/cpsl-row/cpsl-row.js +0 -19
- package/dist/collection/components/cpsl-row/cpsl-row.js.map +0 -1
- package/dist/collection/components/cpsl-row/test/cpsl-row.e2e.js +0 -29
- package/dist/collection/components/cpsl-row/test/cpsl-row.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-row/test/cpsl-row.spec.js +0 -37
- package/dist/collection/components/cpsl-row/test/cpsl-row.spec.js.map +0 -1
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.css +0 -175
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +0 -252
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js.map +0 -1
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.e2e.js +0 -29
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.spec.js +0 -37
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.spec.js.map +0 -1
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.css +0 -68
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +0 -69
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.js.map +0 -1
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.e2e.js +0 -29
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.spec.js +0 -37
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.spec.js.map +0 -1
- package/dist/collection/components/cpsl-tab/cpsl-tab.css +0 -23
- package/dist/collection/components/cpsl-tab/cpsl-tab.js +0 -121
- package/dist/collection/components/cpsl-tab/cpsl-tab.js.map +0 -1
- package/dist/collection/components/cpsl-tab/tab-interface.js +0 -2
- package/dist/collection/components/cpsl-tab/tab-interface.js.map +0 -1
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.e2e.js +0 -29
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.spec.js +0 -37
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.spec.js.map +0 -1
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.css +0 -111
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +0 -170
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.js.map +0 -1
- package/dist/collection/components/cpsl-tabs/tabs-interface.js +0 -2
- package/dist/collection/components/cpsl-tabs/tabs-interface.js.map +0 -1
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.e2e.js +0 -29
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.spec.js +0 -37
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.spec.js.map +0 -1
- package/dist/collection/components/cpsl-text/cpsl-text.css +0 -59
- package/dist/collection/components/cpsl-text/cpsl-text.js +0 -19
- package/dist/collection/components/cpsl-text/cpsl-text.js.map +0 -1
- package/dist/collection/components/cpsl-text/test/cpsl-text.e2e.js +0 -29
- package/dist/collection/components/cpsl-text/test/cpsl-text.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-text/test/cpsl-text.spec.js +0 -37
- package/dist/collection/components/cpsl-text/test/cpsl-text.spec.js.map +0 -1
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.css +0 -97
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +0 -67
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js.map +0 -1
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.e2e.js +0 -29
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.spec.js +0 -37
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.spec.js.map +0 -1
- package/dist/collection/constants.js +0 -6
- package/dist/collection/constants.js.map +0 -1
- package/dist/collection/index.js +0 -3
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/interface.js +0 -2
- package/dist/collection/interface.js.map +0 -1
- package/dist/collection/utils/media.js +0 -18
- package/dist/collection/utils/media.js.map +0 -1
- package/dist/collection/utils/theme/generateBorderRadii.js +0 -56
- package/dist/collection/utils/theme/generateBorderRadii.js.map +0 -1
- package/dist/collection/utils/theme/generateFont.js +0 -7
- package/dist/collection/utils/theme/generateFont.js.map +0 -1
- package/dist/collection/utils/theme/generatePalette.js +0 -46
- package/dist/collection/utils/theme/generatePalette.js.map +0 -1
- package/dist/collection/utils/theme/generateTheme.js +0 -12
- package/dist/collection/utils/theme/generateTheme.js.map +0 -1
- package/dist/collection/utils/theme/utils.js +0 -21
- package/dist/collection/utils/theme/utils.js.map +0 -1
- package/dist/esm/_commonjsHelpers-1789f0cf.js +0 -9
- package/dist/esm/_commonjsHelpers-1789f0cf.js.map +0 -1
- package/dist/esm/capsule.js +0 -22
- package/dist/esm/capsule.js.map +0 -1
- package/dist/esm/cpsl-alert_17.entry.js +0 -10684
- package/dist/esm/cpsl-alert_17.entry.js.map +0 -1
- package/dist/esm/cpsl-animation.entry.js.map +0 -1
- package/dist/esm/cpsl-col.entry.js.map +0 -1
- package/dist/esm/cpsl-grid.entry.js.map +0 -1
- package/dist/esm/cpsl-info-box.entry.js.map +0 -1
- package/dist/esm/cpsl-row.entry.js +0 -18
- package/dist/esm/cpsl-row.entry.js.map +0 -1
- package/dist/esm/index-f00e090c.js +0 -1982
- package/dist/esm/index-f00e090c.js.map +0 -1
- package/dist/esm/index.js +0 -338
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js +0 -13
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/loader/cdn.js +0 -3
- package/dist/loader/index.cjs.js +0 -3
- package/dist/loader/index.d.ts +0 -21
- package/dist/loader/index.es2017.js +0 -3
- package/dist/loader/index.js +0 -4
- package/dist/loader/package.json +0 -11
- package/dist/scripts/buildIconLibrary.js +0 -33
- package/dist/scripts/buildIconLibrary.js.map +0 -1
- /package/dist/{esm → capsule}/app-globals-0f993ce5.js +0 -0
- /package/dist/{esm → capsule}/app-globals-0f993ce5.js.map +0 -0
- /package/dist/{esm → capsule}/constants-7b49abd5.js +0 -0
- /package/dist/{esm → capsule}/constants-7b49abd5.js.map +0 -0
@@ -1,2 +1,573 @@
|
|
1
|
-
import{D as
|
1
|
+
import { D as DEFAULT_THEME } from './constants-7b49abd5.js';
|
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
|
+
|
2
573
|
//# sourceMappingURL=index.esm.js.map
|