@pine-ds/icons 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cheatsheet.html +3 -3
- package/dist/cjs/index-b35d5b0f.js +1778 -0
- package/dist/cjs/index-b35d5b0f.js.map +1 -0
- package/dist/cjs/index.cjs.js +12 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/pds-icon.cjs.entry.js +190 -0
- package/dist/cjs/pds-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/pds-icons.cjs.js +25 -0
- package/dist/cjs/pds-icons.cjs.js.map +1 -0
- package/dist/cjs/utils-395a38b7.js +81 -0
- package/dist/cjs/utils-395a38b7.js.map +1 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/pds-icon/pds-icon.css +22 -0
- package/dist/collection/components/pds-icon/pds-icon.js +186 -0
- package/dist/collection/components/pds-icon/pds-icon.js.map +1 -0
- package/dist/collection/components/pds-icon/request.js +29 -0
- package/dist/collection/components/pds-icon/request.js.map +1 -0
- package/dist/collection/components/pds-icon/test/pds-icon.e2e.js +10 -0
- package/dist/collection/components/pds-icon/test/pds-icon.e2e.js.map +1 -0
- package/dist/collection/components/pds-icon/test/pds-icon.spec.js +70 -0
- package/dist/collection/components/pds-icon/test/pds-icon.spec.js.map +1 -0
- package/dist/collection/components/pds-icon/utils.js +81 -0
- package/dist/collection/components/pds-icon/utils.js.map +1 -0
- package/dist/collection/components/pds-icon/validate.js +44 -0
- package/dist/collection/components/pds-icon/validate.js.map +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/docs.d.ts +421 -0
- package/dist/docs.json +95 -0
- package/dist/esm/index-8effeb27.js +1749 -0
- package/dist/esm/index-8effeb27.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/pds-icon.entry.js +186 -0
- package/dist/esm/pds-icon.entry.js.map +1 -0
- package/dist/esm/pds-icons.js +20 -0
- package/dist/esm/pds-icons.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/esm/utils-a0ad61d0.js +75 -0
- package/dist/esm/utils-a0ad61d0.js.map +1 -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/pds-icons/index.esm.js +2 -0
- package/dist/pds-icons/index.esm.js.map +1 -0
- package/dist/pds-icons/p-91678731.entry.js +2 -0
- package/dist/pds-icons/p-91678731.entry.js.map +1 -0
- package/dist/pds-icons/p-a3383818.js +3 -0
- package/dist/pds-icons/p-a3383818.js.map +1 -0
- package/dist/pds-icons/p-dc5765cb.js +2 -0
- package/dist/pds-icons/p-dc5765cb.js.map +1 -0
- package/dist/pds-icons/pds-icons.esm.js +2 -0
- package/dist/pds-icons/pds-icons.esm.js.map +1 -0
- package/dist/pds-icons.json +1 -1
- package/dist/pds-icons.symbols.svg +1 -1
- package/dist/scripts/collection-copy.js +28 -0
- package/dist/scripts/collection-copy.js.map +1 -0
- package/dist/scripts/figma_icons/figma-icon-export.js +666 -0
- package/dist/scripts/figma_icons/figma-icon-export.js.map +1 -0
- package/dist/scripts/figma_icons/types.js +2 -0
- package/dist/scripts/figma_icons/types.js.map +1 -0
- package/dist/scripts/helpers.js +51 -0
- package/dist/scripts/helpers.js.map +1 -0
- package/dist/scripts/optimize-svgs.js +352 -0
- package/dist/scripts/optimize-svgs.js.map +1 -0
- package/dist/types/Users/julian.skinner/kajabi/pine-icons/.stencil/scripts/collection-copy.d.ts +1 -0
- package/dist/types/Users/julian.skinner/kajabi/pine-icons/.stencil/scripts/figma_icons/figma-icon-export.d.ts +1 -0
- package/dist/types/Users/julian.skinner/kajabi/pine-icons/.stencil/scripts/figma_icons/types.d.ts +112 -0
- package/dist/types/Users/julian.skinner/kajabi/pine-icons/.stencil/scripts/helpers.d.ts +55 -0
- package/dist/types/Users/julian.skinner/kajabi/pine-icons/.stencil/scripts/optimize-svgs.d.ts +7 -0
- package/dist/types/components/pds-icon/pds-icon.d.ts +37 -0
- package/dist/types/components/pds-icon/request.d.ts +2 -0
- package/dist/types/components/pds-icon/utils.d.ts +24 -0
- package/dist/types/components/pds-icon/validate.d.ts +2 -0
- package/dist/types/components.d.ts +71 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1652 -0
- package/icons/index.d.ts +1 -1
- package/icons/index.js +1 -1
- package/icons/index.mjs +1 -1
- package/icons/package.json +1 -1
- package/package.json +1 -1
- package/readme.md +1 -1
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/access-key.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/add-circle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/add-image.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/add-small.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/add.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/ai-sparkle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/ai-writer-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/ai-writer.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/align-center.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/align-justify.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/align-left.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/align-right.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/analytics-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/analytics-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/app-store.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/archive.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/arrow-corner.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/arrow-down.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/arrow-left.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/arrow-right.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/arrow-up.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/assessment.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/at-sign.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/attach.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/automations.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/ban.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/bank.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/bell.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/blog.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/bold.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/broadcast.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/calendar-date.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/calendar-schedule.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/calendar-simple.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/card-bw-amex.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/card-bw-apple-card.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/card-bw-diners-club.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/card-bw-discover.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/card-bw-gpay-card.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/card-bw-mastercard.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/card-bw-paypal.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/card-bw-stripe.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/card-bw-visa.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/card-update.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/caret-down.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/caret-left.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/caret-right.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/caret-up.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/cart-add.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/cart.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/certificate.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/check-circle-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/check-circle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/check.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/circle-1.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/circle-2.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/circle-3.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/circle-4.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/circle-5.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/circle-6.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/circle-7.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/circle-8.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/circle-9.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/clock.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/closed-captions.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/code.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/color.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/columns.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/comment.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/connect.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/contact.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/contacts-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/contacts-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/conversation.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/copy.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/coupon.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/course.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/creator-studio-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/creator-studio.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/credit-card.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/custom-field.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/customize.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/danger-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/danger.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/dashboard-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/dashboard-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/delete-circle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/delete-key.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/delete-x.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/dollar-sign.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/dot-menu-horizontal.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/down-small.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/download.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/downsell.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/draft.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/drop.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/duplicate.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/email-activity.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/emoji.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/enlarge-vertical.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/enlarge.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/expand.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/facebook-2.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/facebook.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/favorite.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/feedback.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/file-money.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/file.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/filter.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/flag.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/folder-group.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/folder.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/form-field.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/form.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/fullscreen.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/funnel.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/grant-offer.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/handle-2-vertical.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/handle-2.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/handle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/hashtag.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/heading-large.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/heading-small.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/headset.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/help-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/help-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/home-alt.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/horizontal-line.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/image.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/info-circle-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/info-circle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/instagram.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/ios-battery.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/ios-data.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/ios-wifi.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/italic.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/kajabi-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/kajabi-outlined.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/lab.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/launch.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/layout-grid.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/layout-list.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/left-small.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/linkedin.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/list-bullet.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/list-numbers.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/location.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/lock-alt.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/lock.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/logo-afterpay.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/loop.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/mail.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/mapped.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/margin-left.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/margin-right.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/marker-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/marker.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/marketing-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/marketing-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/menu-2.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/menu-alt.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/menu.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/merge.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/microphone-off.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/microphone.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/move-left.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/move-right.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/multi-pay.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/newsletter.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/one-off-session.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/one-time.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/partners-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/partners-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/pause-circle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/pause.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/payout.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/pen.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/phone-portrait.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/phone-toolbar.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/play-circle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/play-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/play-store.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/play.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/plug.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/present.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/preview-off.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/preview-on.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/products-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/products-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/question-circle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/quote.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/redo.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/refresh.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/remove-circle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/remove.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/rename.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/reset-password.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/restore.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/right-small.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/round-dollar.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/rows.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/sales-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/sales-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/scissor.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/screen-share-off.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/screen-share-on.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/search-small.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/search.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/send-message.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/sequences.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/series.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/settings-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/settings-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/share.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/skipped.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/slash-divider.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/sparkle-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/sparkle.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/speaker.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/stack.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/star.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/stop.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/stopwatch.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/strikethrough.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/subscript.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/subscriptions.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/super-admin.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/superscript.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/sync.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/tablet-landscape.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/tablet-portrait.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/text-styles.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/theme-store.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/thumbs-down-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/thumbs-down.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/thumbs-up-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/thumbs-up.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/tiktok.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/trash.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/twitter.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/underline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/undo.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/unlock.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/unmapped.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/up-small.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/upload.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/url.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/user-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/user.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/users-wm.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/users.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/video-off.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/video-on.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/warning-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/warning.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/website-filled.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/website-outline.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/window-paragraph.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/world.svg +0 -0
- /package/dist/{pds-icons → collection/components/pds-icon}/svg/youtube.svg +0 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-b35d5b0f.js');
|
|
6
|
+
const utils = require('./utils-395a38b7.js');
|
|
7
|
+
|
|
8
|
+
const validateContent = (svgContent) => {
|
|
9
|
+
const div = document.createElement('div');
|
|
10
|
+
div.innerHTML = svgContent;
|
|
11
|
+
// setup this way to ensure it works on our buddy IE
|
|
12
|
+
for (let i = div.childNodes.length - 1; i >= 0; i--) {
|
|
13
|
+
if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {
|
|
14
|
+
div.removeChild(div.childNodes[i]);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// must only have 1 root element
|
|
18
|
+
const svgElm = div.firstElementChild;
|
|
19
|
+
if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {
|
|
20
|
+
const svgClass = svgElm.getAttribute('class') || '';
|
|
21
|
+
svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());
|
|
22
|
+
// root element must be an svg
|
|
23
|
+
// lets double check we've got valid elements
|
|
24
|
+
// do not allow scripts
|
|
25
|
+
if (isValid(svgElm)) {
|
|
26
|
+
return div.innerHTML;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return '';
|
|
30
|
+
};
|
|
31
|
+
const isValid = (elm) => {
|
|
32
|
+
if (elm.nodeType === 1) {
|
|
33
|
+
if (elm.nodeName.toLowerCase() === 'script') {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
for (let i = 0; i < elm.attributes.length; i++) {
|
|
37
|
+
const name = elm.attributes[i].name;
|
|
38
|
+
if (utils.isStr(name) && name.toLowerCase().indexOf('on') === 0) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
for (let i = 0; i < elm.childNodes.length; i++) {
|
|
43
|
+
if (!isValid(elm.childNodes[i])) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const pdsIconContent = new Map();
|
|
52
|
+
const requests = new Map(); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
53
|
+
const getSvgContent = (url, sanitize = false) => {
|
|
54
|
+
let req = requests.get(url);
|
|
55
|
+
if (!req) {
|
|
56
|
+
if (typeof fetch != 'undefined' && typeof document !== 'undefined') {
|
|
57
|
+
// we don't have a request
|
|
58
|
+
req = fetch(url).then((rsp) => {
|
|
59
|
+
if (rsp.ok) {
|
|
60
|
+
return rsp.text().then((svgContent) => {
|
|
61
|
+
if (svgContent && sanitize !== false) {
|
|
62
|
+
svgContent = validateContent(svgContent);
|
|
63
|
+
}
|
|
64
|
+
pdsIconContent.set(url, svgContent || '');
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
pdsIconContent.set(url, '');
|
|
68
|
+
});
|
|
69
|
+
requests.set(url, req);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
pdsIconContent.set(url, '');
|
|
73
|
+
return Promise.resolve();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return req;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const pdsIconCss = ":host{contain:strict;display:inline-block;fill:currentColor;height:1em;width:1em}:host .pdsicon{fill:currentColor}.pds-icon-fill-none{fill:none}.icon-inner,.pds-icon,svg{display:block;height:100%;width:100%}";
|
|
80
|
+
|
|
81
|
+
const PdsIcon = class {
|
|
82
|
+
constructor(hostRef) {
|
|
83
|
+
index.registerInstance(this, hostRef);
|
|
84
|
+
this.inheritedAttributes = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
85
|
+
this.hasAriaHidden = () => {
|
|
86
|
+
const { el } = this;
|
|
87
|
+
return el.hasAttribute('aria-hidden') && el.getAttribute('aria-hidden') === 'true';
|
|
88
|
+
};
|
|
89
|
+
this.ariaLabel = undefined;
|
|
90
|
+
this.isVisible = false;
|
|
91
|
+
this.svgContent = undefined;
|
|
92
|
+
this.color = undefined;
|
|
93
|
+
this.name = undefined;
|
|
94
|
+
this.size = 'regular';
|
|
95
|
+
}
|
|
96
|
+
iconSize() {
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
+
const sizes = {
|
|
99
|
+
small: '12px',
|
|
100
|
+
regular: '16px',
|
|
101
|
+
medium: '20px',
|
|
102
|
+
large: '24px',
|
|
103
|
+
};
|
|
104
|
+
if (sizes[this.size]) {
|
|
105
|
+
return sizes[this.size];
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return this.size;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
componentWillLoad() {
|
|
112
|
+
this.inheritedAttributes = utils.inheritAttributes(this.el, ['aria-label']);
|
|
113
|
+
}
|
|
114
|
+
connectedCallback() {
|
|
115
|
+
this.waitUntilVisible(this.el, '50px', () => {
|
|
116
|
+
this.isVisible = true;
|
|
117
|
+
this.loadIcon();
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
disconnectedCallback() {
|
|
121
|
+
if (this.io) {
|
|
122
|
+
this.io.disconnect();
|
|
123
|
+
this.io = undefined;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
loadIcon() {
|
|
127
|
+
if (this.isVisible) {
|
|
128
|
+
const url = utils.getUrl(this);
|
|
129
|
+
if (url) {
|
|
130
|
+
if (pdsIconContent.has(url)) {
|
|
131
|
+
this.svgContent = pdsIconContent.get(url);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
getSvgContent(url).then(() => (this.svgContent = pdsIconContent.get(url)));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const label = utils.getName(this.name);
|
|
139
|
+
if (label) {
|
|
140
|
+
this.ariaLabel = label.replace(/\-/g, ' ');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
render() {
|
|
144
|
+
const { ariaLabel, inheritedAttributes } = this;
|
|
145
|
+
const style = {
|
|
146
|
+
height: this.iconSize(),
|
|
147
|
+
width: this.iconSize(),
|
|
148
|
+
color: this.color,
|
|
149
|
+
};
|
|
150
|
+
return (index.h(index.Host, Object.assign({ "aria-label": ariaLabel !== undefined && !this.hasAriaHidden() ? ariaLabel : null, role: "img", style: style, class: Object.assign({}, createColorClasses(this.color)) }, inheritedAttributes), this.svgContent ? (index.h("div", { class: "icon-inner", innerHTML: this.svgContent })) : (index.h("div", { class: "icon-inner" }))));
|
|
151
|
+
}
|
|
152
|
+
/*****
|
|
153
|
+
* Private Methods
|
|
154
|
+
****/
|
|
155
|
+
waitUntilVisible(el, rootMargin, cb) {
|
|
156
|
+
if (typeof window !== 'undefined' && (window).IntersectionObserver) {
|
|
157
|
+
const io = (this.io = new (window).IntersectionObserver((data) => {
|
|
158
|
+
if (data[0].isIntersecting) {
|
|
159
|
+
io.disconnect();
|
|
160
|
+
this.io = undefined;
|
|
161
|
+
cb();
|
|
162
|
+
}
|
|
163
|
+
}, { rootMargin }));
|
|
164
|
+
io.observe(el);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
// browser doesn't support IntersectionObserver
|
|
168
|
+
// so just fallback to always show it
|
|
169
|
+
cb();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
static get assetsDirs() { return ["svg"]; }
|
|
173
|
+
get el() { return index.getElement(this); }
|
|
174
|
+
static get watchers() { return {
|
|
175
|
+
"name": ["loadIcon"]
|
|
176
|
+
}; }
|
|
177
|
+
};
|
|
178
|
+
const createColorClasses = (color) => {
|
|
179
|
+
return color
|
|
180
|
+
? {
|
|
181
|
+
'pds-color': true,
|
|
182
|
+
[`pds-color-${color}`]: true,
|
|
183
|
+
}
|
|
184
|
+
: null;
|
|
185
|
+
};
|
|
186
|
+
PdsIcon.style = pdsIconCss;
|
|
187
|
+
|
|
188
|
+
exports.pds_icon = PdsIcon;
|
|
189
|
+
|
|
190
|
+
//# sourceMappingURL=pds-icon.cjs.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"pds-icon.entry.cjs.js","mappings":";;;;;;;AAEO,MAAM,eAAe,GAAG,CAAC,UAAkB;EAChD,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;EAC1C,GAAG,CAAC,SAAS,GAAG,UAAU,CAAC;;EAG3B,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;IACnD,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;MACtD,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;KACpC;GACF;;EAGD,MAAM,MAAM,GAAG,GAAG,CAAC,iBAAiB,CAAC;EACrC,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;IACrD,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACpD,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,QAAQ,GAAG,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;;;;IAKhE,IAAI,OAAO,CAAC,MAAqB,CAAC,EAAE;MAClC,OAAO,GAAG,CAA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validate.ts","src/components/pds-icon/request.ts","src/components/pds-icon/pds-icon.scss?tag=pds-icon&encapsulation=shadow","src/components/pds-icon/pds-icon.tsx"],"sourcesContent":["import { isStr } from './utils';\n\nexport const validateContent = (svgContent: string) => {\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n // setup this way to ensure it works on our buddy IE\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {\n const svgClass = svgElm.getAttribute('class') || '';\n svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as HTMLElement)) {\n return div.innerHTML;\n }\n }\n return '';\n};\n\nexport const isValid = (elm: HTMLElement) => {\n if (elm.nodeType === 1) {\n if (elm.nodeName.toLowerCase() === 'script') {\n return false;\n }\n\n for (let i = 0; i < elm.attributes.length; i++) {\n const name = elm.attributes[i].name;\n if (isStr(name) && name.toLowerCase().indexOf('on') === 0) {\n return false;\n }\n }\n\n for (let i = 0; i < elm.childNodes.length; i++) {\n if (!isValid(elm.childNodes[i] as HTMLElement)) {\n return false;\n }\n }\n }\n return true;\n};\n","import { validateContent } from './validate';\n\nexport const pdsIconContent = new Map<string, string>();\nconst requests = new Map<string, Promise<any>>(); // eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport const getSvgContent = (url: string, sanitize = false) => {\n let req = requests.get(url);\n\n if(!req) {\n if (typeof fetch != 'undefined' && typeof document !== 'undefined') {\n // we don't have a request\n req = fetch(url).then((rsp) => {\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n if (svgContent && sanitize !== false) {\n svgContent = validateContent(svgContent);\n }\n pdsIconContent.set(url, svgContent || '');\n });\n }\n pdsIconContent.set(url, '');\n });\n\n requests.set(url, req);\n } else {\n pdsIconContent.set(url, '');\n return Promise.resolve();\n }\n }\n return req;\n}\n",":host {\n contain: strict;\n display: inline-block;\n fill: currentColor;\n height: 1em;\n width: 1em;\n\n .pdsicon {\n fill: currentColor;\n }\n}\n\n.pds-icon-fill-none {\n fill: none;\n}\n\n.icon-inner,\n.pds-icon,\nsvg {\n display: block;\n height: 100%;\n width: 100%;\n}\n","import { Build, Component, Element, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { getSvgContent, pdsIconContent } from './request';\nimport { getName, getUrl, inheritAttributes } from './utils';\n\n@Component({\n tag: 'pds-icon',\n assetsDirs: ['svg'],\n styleUrl: 'pds-icon.scss',\n shadow: true,\n})\nexport class PdsIcon {\n private io?: IntersectionObserver;\n private inheritedAttributes: { [k: string]: any } = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n @Element() el!: HTMLPdsIconElement;\n\n @State() private ariaLabel?: string;\n @State() private isVisible = false;\n @State() private svgContent?: string;\n\n /**\n *\n * The color of the icon\n *\n */\n @Prop() color?: string;\n\n /**\n * The name of the icon to use from\n * the built-in set.\n */\n @Prop({ reflect: true }) name?: string;\n\n /**\n * The size of the icon. This can be\n * 'small', 'regular', 'medium', large, or a\n * custom value (40px, 1rem, etc)\n *\n */\n @Prop({ reflect: true }) size?:\n | 'small' // 12px\n | 'regular' // 16px\n | 'medium' // 20px\n | 'large' // 24px\n | 'auto'\n | string = 'regular'\n\n private iconSize() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sizes: { [key: string]: any } = {\n small: '12px',\n regular: '16px',\n medium: '20px',\n large: '24px',\n }\n\n if (sizes[this.size]) {\n return sizes[this.size];\n } else {\n return this.size;\n }\n }\n componentWillLoad() {\n this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);\n }\n\n connectedCallback() {\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIcon();\n })\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n @Watch('name')\n loadIcon() {\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (pdsIconContent.has(url)) {\n this.svgContent = pdsIconContent.get(url);\n } else {\n getSvgContent(url).then(() => (this.svgContent = pdsIconContent.get(url)));\n }\n }\n }\n\n const label = getName(this.name);\n\n if (label) {\n this.ariaLabel = label.replace(/\\-/g, ' ');\n }\n }\n\n render() {\n const { ariaLabel, inheritedAttributes } = this;\n\n const style = {\n height: this.iconSize(),\n width: this.iconSize(),\n color: this.color,\n }\n\n return (\n\n <Host\n aria-label={ariaLabel !== undefined && !this.hasAriaHidden() ? ariaLabel : null }\n role=\"img\"\n style={style}\n class={{\n ...createColorClasses(this.color),\n }}\n {...inheritedAttributes}\n >\n {Build.isBrowser && this.svgContent ? (\n <div class=\"icon-inner\" innerHTML={this.svgContent}></div>\n ) : (\n <div class=\"icon-inner\"></div>\n )}\n </Host>\n )\n }\n\n /*****\n * Private Methods\n ****/\n\n private waitUntilVisible(el: HTMLElement, rootMargin: string, cb: () => void) {\n if (Build.isBrowser && typeof window !== 'undefined' && (window).IntersectionObserver) {\n const io = (this.io = new (window).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n },\n { rootMargin },\n ));\n\n io.observe(el);\n } else {\n // browser doesn't support IntersectionObserver\n // so just fallback to always show it\n cb();\n }\n }\n\n private hasAriaHidden = () => {\n const { el } = this;\n\n return el.hasAttribute('aria-hidden') && el.getAttribute('aria-hidden') === 'true';\n }\n}\n\nconst createColorClasses = (color: string | undefined) => {\n return color\n ? {\n 'pds-color': true,\n [`pds-color-${color}`]: true,\n }\n : null;\n };\n"],"version":3}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-b35d5b0f.js');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Browser v4.4.0 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
const patchBrowser = () => {
|
|
11
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('pds-icons.cjs.js', document.baseURI).href));
|
|
12
|
+
const opts = {};
|
|
13
|
+
if (importMeta !== '') {
|
|
14
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
15
|
+
}
|
|
16
|
+
return index.promiseResolve(opts);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
patchBrowser().then(options => {
|
|
20
|
+
return index.bootstrapLazy([["pds-icon.cjs",[[1,"pds-icon",{"color":[1],"name":[513],"size":[513],"ariaLabel":[32],"isVisible":[32],"svgContent":[32]},null,{"name":["loadIcon"]}]]]], options);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
exports.setNonce = index.setNonce;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=pds-icons.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"pds-icons.cjs.js","mappings":";;;;;;AAAA;AACA;AACA;AAGA,MAAM,YAAY,GAAG,MAAM;AAyB3B,IAAI,MAAM,UAAU,GAAG,2MAAe,CAAC;AACvC,IAAI,MAAM,IAAI,GAAiE,EAAE,CAAC;AAClF,IAAI,IAAI,UAAU,KAAK,EAAE,EAAE;AAC3B,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;AAC1D,KAAK;AACL,IAAI,OAAOA,oBAAc,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;;AChCD,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI;AAE/B,EAAE,OAAOC,mBAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC,CAAC;;;;","names":["promiseResolve","bootstrapLazy"],"sources":["node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v4.4.0 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, doc, promiseResolve, H } from '@stencil/core';\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = BUILD.scriptDataOpts\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n if (importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n }\n return promiseResolve(opts);\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"version":3}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-b35d5b0f.js');
|
|
4
|
+
|
|
5
|
+
let CACHED_MAP;
|
|
6
|
+
const addIcons = (icons) => {
|
|
7
|
+
const map = getIconMap();
|
|
8
|
+
Object.keys(icons).forEach(name => map.set(name, icons[name]));
|
|
9
|
+
};
|
|
10
|
+
const getIconMap = () => {
|
|
11
|
+
if (typeof window === 'undefined') {
|
|
12
|
+
return new Map();
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
if (!CACHED_MAP) {
|
|
16
|
+
const win = window; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
17
|
+
win.PdsIcons = win.PdsIcons || {};
|
|
18
|
+
CACHED_MAP = win.PdsIcons.map = win.PdsIcons.map || new Map();
|
|
19
|
+
}
|
|
20
|
+
return CACHED_MAP;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const getName = (iconName) => {
|
|
24
|
+
if (isStr(iconName)) {
|
|
25
|
+
iconName = toLower(iconName);
|
|
26
|
+
}
|
|
27
|
+
if (!isStr(iconName) || iconName.trim() === '') {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
|
|
31
|
+
if (invalidChars != '') {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return iconName;
|
|
35
|
+
};
|
|
36
|
+
const getNamedUrl = (iconName) => {
|
|
37
|
+
const url = getIconMap().get(iconName);
|
|
38
|
+
if (url) {
|
|
39
|
+
return url;
|
|
40
|
+
}
|
|
41
|
+
return index.getAssetPath(`svg/${iconName}.svg`);
|
|
42
|
+
};
|
|
43
|
+
const getUrl = (icon) => {
|
|
44
|
+
const url = getName(icon.name);
|
|
45
|
+
if (url) {
|
|
46
|
+
return getNamedUrl(url);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const isStr = (val) => typeof val === 'string'; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
50
|
+
const toLower = (val) => val.toLowerCase();
|
|
51
|
+
/**
|
|
52
|
+
* Elements inside of web components sometimes need to inherit global attributes
|
|
53
|
+
* set on the host. For example, the inner input in `ion-input` should inherit
|
|
54
|
+
* the `title` attribute that developers set directly on `ion-input`. This
|
|
55
|
+
* helper function should be called in componentWillLoad and assigned to a variable
|
|
56
|
+
* that is later used in the render function.
|
|
57
|
+
*
|
|
58
|
+
* This does not need to be reactive as changing attributes on the host element
|
|
59
|
+
* does not trigger a re-render.
|
|
60
|
+
*/
|
|
61
|
+
const inheritAttributes = (el, attributes = []) => {
|
|
62
|
+
const attributeObject = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
63
|
+
attributes.forEach(attr => {
|
|
64
|
+
if (el.hasAttribute(attr)) {
|
|
65
|
+
const value = el.getAttribute(attr);
|
|
66
|
+
if (value !== null) {
|
|
67
|
+
attributeObject[attr] = el.getAttribute(attr);
|
|
68
|
+
}
|
|
69
|
+
el.removeAttribute(attr);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return attributeObject;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
exports.addIcons = addIcons;
|
|
76
|
+
exports.getName = getName;
|
|
77
|
+
exports.getUrl = getUrl;
|
|
78
|
+
exports.inheritAttributes = inheritAttributes;
|
|
79
|
+
exports.isStr = isStr;
|
|
80
|
+
|
|
81
|
+
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,CAAC,QAAgB;EACnC,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;EACvC,IAAI,GAAG,EAAE;IACP,OAAO,GAAG,CAAC;GACZ;EAED,OAAOA,kBAAY,CAAC,OAAO,QAAQ,MAAM,CAAC,CAAC;AAC7C,CAAC,CAAC;MAcW,MAAM,GAAG,CAAC,IAAa;EAClC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EAC/B,IAAI,GAAG,EAAE;IACP,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;GACzB;AACH,EAAE;MAIW,KAAK,GAAG,CAAC,GAAQ,KAAoB,OAAO,GAAG,KAAK,SAAS;AACnE,MAAM,OAAO,GAAG,CAAC,GAAW,KAAK,GAAG,CAAC,WAAW,EAAE,CAAC;AAE1D;;;;;;;;;;MAUc,iBAAiB,GAAG,CAAC,EAAe,EAAE,aAAuB,EAAE;EAC3E,MAAM,eAAe,GAAyB,EAAE,CAAC;EAEjD,UAAU,CAAC,OAAO,CAAC,IAAI;IACrB,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;MACzB,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;MACpC,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;OAC/C;MACD,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;KAC1B;GACF,CAAC,CAAC;EAEH,OAAO,eAAe,CAAC;AACzB;;;;;;;;","names":["getAssetPath"],"sources":["src/components/pds-icon/utils.ts"],"sourcesContent":["import { getAssetPath } from '@stencil/core';\nimport { PdsIcon } from './pds-icon';\n\nlet CACHED_MAP: Map<string, string>;\n\nexport const addIcons = (icons: { [name: string]: string; }) => {\n const map = getIconMap();\n Object.keys(icons).forEach(name => map.set(name, icons[name]));\n}\n\nexport const getIconMap = (): Map<string, string> => {\n if (typeof window === 'undefined') {\n return new Map();\n } else {\n if (!CACHED_MAP) {\n const win = window as any; // eslint-disable-line @typescript-eslint/no-explicit-any\n win.PdsIcons = win.PdsIcons || {};\n CACHED_MAP = win.PdsIcons.map = win.PdsIcons.map || new Map();\n }\n\n return CACHED_MAP;\n }\n}\n\nexport const getName = (iconName: string | undefined) => {\n if (isStr(iconName)) {\n iconName = toLower(iconName);\n }\n\n if (!isStr(iconName) || iconName.trim() === '') {\n return null;\n }\n\n const invalidChars = iconName.replace(/[a-z]|-|\\d/gi,'');\n if (invalidChars != '') { return null; }\n\n return iconName;\n}\n\nconst getNamedUrl = (iconName: string) => {\n const url = getIconMap().get(iconName);\n if (url) {\n return url;\n }\n\n return getAssetPath(`svg/${iconName}.svg`);\n};\n\nexport const getSrc = (src: string | undefined) => {\n if (isStr(src)) {\n src = src.trim();\n\n if (isSrc(src)) {\n return src;\n }\n }\n\n return null;\n}\n\nexport const getUrl = (icon: PdsIcon) => {\n const url = getName(icon.name);\n if (url) {\n return getNamedUrl(url);\n }\n};\n\n\nexport const isSrc = (str: string) => str.length > 0 && /(\\/|\\.)/.test(str);\nexport const isStr = (val: any): val is string => typeof val === 'string'; // eslint-disable-line @typescript-eslint/no-explicit-any\nexport const toLower = (val: string) => val.toLowerCase();\n\n/**\n * Elements inside of web components sometimes need to inherit global attributes\n * set on the host. For example, the inner input in `ion-input` should inherit\n * the `title` attribute that developers set directly on `ion-input`. This\n * helper function should be called in componentWillLoad and assigned to a variable\n * that is later used in the render function.\n *\n * This does not need to be reactive as changing attributes on the host element\n * does not trigger a re-render.\n */\n export const inheritAttributes = (el: HTMLElement, attributes: string[] = []) => {\n const attributeObject: { [k: string]: any } = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n attributes.forEach(attr => {\n if (el.hasAttribute(attr)) {\n const value = el.getAttribute(attr);\n if (value !== null) {\n attributeObject[attr] = el.getAttribute(attr);\n }\n el.removeAttribute(attr);\n }\n });\n\n return attributeObject;\n}\n"],"version":3}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
contain: strict;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
fill: currentColor;
|
|
5
|
+
height: 1em;
|
|
6
|
+
width: 1em;
|
|
7
|
+
}
|
|
8
|
+
:host .pdsicon {
|
|
9
|
+
fill: currentColor;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.pds-icon-fill-none {
|
|
13
|
+
fill: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.icon-inner,
|
|
17
|
+
.pds-icon,
|
|
18
|
+
svg {
|
|
19
|
+
display: block;
|
|
20
|
+
height: 100%;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Build, Host, h } from "@stencil/core";
|
|
2
|
+
import { getSvgContent, pdsIconContent } from "./request";
|
|
3
|
+
import { getName, getUrl, inheritAttributes } from "./utils";
|
|
4
|
+
export class PdsIcon {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.inheritedAttributes = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
7
|
+
this.hasAriaHidden = () => {
|
|
8
|
+
const { el } = this;
|
|
9
|
+
return el.hasAttribute('aria-hidden') && el.getAttribute('aria-hidden') === 'true';
|
|
10
|
+
};
|
|
11
|
+
this.ariaLabel = undefined;
|
|
12
|
+
this.isVisible = false;
|
|
13
|
+
this.svgContent = undefined;
|
|
14
|
+
this.color = undefined;
|
|
15
|
+
this.name = undefined;
|
|
16
|
+
this.size = 'regular';
|
|
17
|
+
}
|
|
18
|
+
iconSize() {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
const sizes = {
|
|
21
|
+
small: '12px',
|
|
22
|
+
regular: '16px',
|
|
23
|
+
medium: '20px',
|
|
24
|
+
large: '24px',
|
|
25
|
+
};
|
|
26
|
+
if (sizes[this.size]) {
|
|
27
|
+
return sizes[this.size];
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return this.size;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
componentWillLoad() {
|
|
34
|
+
this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);
|
|
35
|
+
}
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
this.waitUntilVisible(this.el, '50px', () => {
|
|
38
|
+
this.isVisible = true;
|
|
39
|
+
this.loadIcon();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
if (this.io) {
|
|
44
|
+
this.io.disconnect();
|
|
45
|
+
this.io = undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
loadIcon() {
|
|
49
|
+
if (Build.isBrowser && this.isVisible) {
|
|
50
|
+
const url = getUrl(this);
|
|
51
|
+
if (url) {
|
|
52
|
+
if (pdsIconContent.has(url)) {
|
|
53
|
+
this.svgContent = pdsIconContent.get(url);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
getSvgContent(url).then(() => (this.svgContent = pdsIconContent.get(url)));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const label = getName(this.name);
|
|
61
|
+
if (label) {
|
|
62
|
+
this.ariaLabel = label.replace(/\-/g, ' ');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
const { ariaLabel, inheritedAttributes } = this;
|
|
67
|
+
const style = {
|
|
68
|
+
height: this.iconSize(),
|
|
69
|
+
width: this.iconSize(),
|
|
70
|
+
color: this.color,
|
|
71
|
+
};
|
|
72
|
+
return (h(Host, Object.assign({ "aria-label": ariaLabel !== undefined && !this.hasAriaHidden() ? ariaLabel : null, role: "img", style: style, class: Object.assign({}, createColorClasses(this.color)) }, inheritedAttributes), Build.isBrowser && this.svgContent ? (h("div", { class: "icon-inner", innerHTML: this.svgContent })) : (h("div", { class: "icon-inner" }))));
|
|
73
|
+
}
|
|
74
|
+
/*****
|
|
75
|
+
* Private Methods
|
|
76
|
+
****/
|
|
77
|
+
waitUntilVisible(el, rootMargin, cb) {
|
|
78
|
+
if (Build.isBrowser && typeof window !== 'undefined' && (window).IntersectionObserver) {
|
|
79
|
+
const io = (this.io = new (window).IntersectionObserver((data) => {
|
|
80
|
+
if (data[0].isIntersecting) {
|
|
81
|
+
io.disconnect();
|
|
82
|
+
this.io = undefined;
|
|
83
|
+
cb();
|
|
84
|
+
}
|
|
85
|
+
}, { rootMargin }));
|
|
86
|
+
io.observe(el);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// browser doesn't support IntersectionObserver
|
|
90
|
+
// so just fallback to always show it
|
|
91
|
+
cb();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
static get is() { return "pds-icon"; }
|
|
95
|
+
static get encapsulation() { return "shadow"; }
|
|
96
|
+
static get originalStyleUrls() {
|
|
97
|
+
return {
|
|
98
|
+
"$": ["pds-icon.scss"]
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
static get styleUrls() {
|
|
102
|
+
return {
|
|
103
|
+
"$": ["pds-icon.css"]
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
static get assetsDirs() { return ["svg"]; }
|
|
107
|
+
static get properties() {
|
|
108
|
+
return {
|
|
109
|
+
"color": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "string",
|
|
114
|
+
"resolved": "string",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": true,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": "\nThe color of the icon"
|
|
122
|
+
},
|
|
123
|
+
"attribute": "color",
|
|
124
|
+
"reflect": false
|
|
125
|
+
},
|
|
126
|
+
"name": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"mutable": false,
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "string",
|
|
131
|
+
"resolved": "string",
|
|
132
|
+
"references": {}
|
|
133
|
+
},
|
|
134
|
+
"required": false,
|
|
135
|
+
"optional": true,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": "The name of the icon to use from\nthe built-in set."
|
|
139
|
+
},
|
|
140
|
+
"attribute": "name",
|
|
141
|
+
"reflect": true
|
|
142
|
+
},
|
|
143
|
+
"size": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"mutable": false,
|
|
146
|
+
"complexType": {
|
|
147
|
+
"original": "| 'small' // 12px\n | 'regular' // 16px\n | 'medium' // 20px\n | 'large' // 24px\n | 'auto'\n | string",
|
|
148
|
+
"resolved": "string",
|
|
149
|
+
"references": {}
|
|
150
|
+
},
|
|
151
|
+
"required": false,
|
|
152
|
+
"optional": true,
|
|
153
|
+
"docs": {
|
|
154
|
+
"tags": [],
|
|
155
|
+
"text": "The size of the icon. This can be\n'small', 'regular', 'medium', large, or a\ncustom value (40px, 1rem, etc)"
|
|
156
|
+
},
|
|
157
|
+
"attribute": "size",
|
|
158
|
+
"reflect": true,
|
|
159
|
+
"defaultValue": "'regular'"
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
static get states() {
|
|
164
|
+
return {
|
|
165
|
+
"ariaLabel": {},
|
|
166
|
+
"isVisible": {},
|
|
167
|
+
"svgContent": {}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
static get elementRef() { return "el"; }
|
|
171
|
+
static get watchers() {
|
|
172
|
+
return [{
|
|
173
|
+
"propName": "name",
|
|
174
|
+
"methodName": "loadIcon"
|
|
175
|
+
}];
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const createColorClasses = (color) => {
|
|
179
|
+
return color
|
|
180
|
+
? {
|
|
181
|
+
'pds-color': true,
|
|
182
|
+
[`pds-color-${color}`]: true,
|
|
183
|
+
}
|
|
184
|
+
: null;
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=pds-icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pds-icon.js","sourceRoot":"","sources":["../../../../src/components/pds-icon/pds-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAQ7D,MAAM,OAAO,OAAO;;IAEV,wBAAmB,GAAyB,EAAE,CAAC,CAAC,yDAAyD;IA8IzG,kBAAa,GAAG,GAAG,EAAE;MAC3B,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;MAEpB,OAAO,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,MAAM,CAAC;IACrF,CAAC,CAAA;;qBA7I4B,KAAK;;;;gBA4BrB,SAAS;;EAEd,QAAQ;IACd,8DAA8D;IAC9D,MAAM,KAAK,GAA2B;MACpC,KAAK,EAAE,MAAM;MACb,OAAO,EAAE,MAAM;MACf,MAAM,EAAE,MAAM;MACd,KAAK,EAAE,MAAM;KACd,CAAA;IAED,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;MACpB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACzB;SAAM;MACL,OAAO,IAAI,CAAC,IAAI,CAAC;KAClB;EACH,CAAC;EACD,iBAAiB;IACf,IAAI,CAAC,mBAAmB,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;EACxE,CAAC;E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;AAED,MAAM,kBAAkB,GAAG,CAAC,KAAyB,EAAE,EAAE;EACvD,OAAO,KAAK;IACX,CAAC,CAAC;MACE,WAAW,EAAE,IAAI;MACjB,CAAC,aAAa,KAAK,EAAE,CAAC,EAAE,IAAI;KAC7B;IACH,CAAC,CAAC,IAAI,CAAC;AACT,CAAC,CAAC","sourcesContent":["import { Build, Component, Element, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { getSvgContent, pdsIconContent } from './request';\nimport { getName, getUrl, inheritAttributes } from './utils';\n\n@Component({\n tag: 'pds-icon',\n assetsDirs: ['svg'],\n styleUrl: 'pds-icon.scss',\n shadow: true,\n})\nexport class PdsIcon {\n private io?: IntersectionObserver;\n private inheritedAttributes: { [k: string]: any } = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n @Element() el!: HTMLPdsIconElement;\n\n @State() private ariaLabel?: string;\n @State() private isVisible = false;\n @State() private svgContent?: string;\n\n /**\n *\n * The color of the icon\n *\n */\n @Prop() color?: string;\n\n /**\n * The name of the icon to use from\n * the built-in set.\n */\n @Prop({ reflect: true }) name?: string;\n\n /**\n * The size of the icon. This can be\n * 'small', 'regular', 'medium', large, or a\n * custom value (40px, 1rem, etc)\n *\n */\n @Prop({ reflect: true }) size?:\n | 'small' // 12px\n | 'regular' // 16px\n | 'medium' // 20px\n | 'large' // 24px\n | 'auto'\n | string = 'regular'\n\n private iconSize() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sizes: { [key: string]: any } = {\n small: '12px',\n regular: '16px',\n medium: '20px',\n large: '24px',\n }\n\n if (sizes[this.size]) {\n return sizes[this.size];\n } else {\n return this.size;\n }\n }\n componentWillLoad() {\n this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);\n }\n\n connectedCallback() {\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIcon();\n })\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n @Watch('name')\n loadIcon() {\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (pdsIconContent.has(url)) {\n this.svgContent = pdsIconContent.get(url);\n } else {\n getSvgContent(url).then(() => (this.svgContent = pdsIconContent.get(url)));\n }\n }\n }\n\n const label = getName(this.name);\n\n if (label) {\n this.ariaLabel = label.replace(/\\-/g, ' ');\n }\n }\n\n render() {\n const { ariaLabel, inheritedAttributes } = this;\n\n const style = {\n height: this.iconSize(),\n width: this.iconSize(),\n color: this.color,\n }\n\n return (\n\n <Host\n aria-label={ariaLabel !== undefined && !this.hasAriaHidden() ? ariaLabel : null }\n role=\"img\"\n style={style}\n class={{\n ...createColorClasses(this.color),\n }}\n {...inheritedAttributes}\n >\n {Build.isBrowser && this.svgContent ? (\n <div class=\"icon-inner\" innerHTML={this.svgContent}></div>\n ) : (\n <div class=\"icon-inner\"></div>\n )}\n </Host>\n )\n }\n\n /*****\n * Private Methods\n ****/\n\n private waitUntilVisible(el: HTMLElement, rootMargin: string, cb: () => void) {\n if (Build.isBrowser && typeof window !== 'undefined' && (window).IntersectionObserver) {\n const io = (this.io = new (window).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n },\n { rootMargin },\n ));\n\n io.observe(el);\n } else {\n // browser doesn't support IntersectionObserver\n // so just fallback to always show it\n cb();\n }\n }\n\n private hasAriaHidden = () => {\n const { el } = this;\n\n return el.hasAttribute('aria-hidden') && el.getAttribute('aria-hidden') === 'true';\n }\n}\n\nconst createColorClasses = (color: string | undefined) => {\n return color\n ? {\n 'pds-color': true,\n [`pds-color-${color}`]: true,\n }\n : null;\n };\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { validateContent } from "./validate";
|
|
2
|
+
export const pdsIconContent = new Map();
|
|
3
|
+
const requests = new Map(); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
4
|
+
export const getSvgContent = (url, sanitize = false) => {
|
|
5
|
+
let req = requests.get(url);
|
|
6
|
+
if (!req) {
|
|
7
|
+
if (typeof fetch != 'undefined' && typeof document !== 'undefined') {
|
|
8
|
+
// we don't have a request
|
|
9
|
+
req = fetch(url).then((rsp) => {
|
|
10
|
+
if (rsp.ok) {
|
|
11
|
+
return rsp.text().then((svgContent) => {
|
|
12
|
+
if (svgContent && sanitize !== false) {
|
|
13
|
+
svgContent = validateContent(svgContent);
|
|
14
|
+
}
|
|
15
|
+
pdsIconContent.set(url, svgContent || '');
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
pdsIconContent.set(url, '');
|
|
19
|
+
});
|
|
20
|
+
requests.set(url, req);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
pdsIconContent.set(url, '');
|
|
24
|
+
return Promise.resolve();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return req;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/components/pds-icon/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;AACxD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC,CAAC,yDAAyD;AAE3G,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,QAAQ,GAAG,KAAK,EAAE,EAAE;EAC7D,IAAI,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;EAE5B,IAAG,CAAC,GAAG,EAAE;IACP,IAAI,OAAO,KAAK,IAAI,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;MAClE,0BAA0B;MAC1B,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;QAC5B,IAAI,GAAG,CAAC,EAAE,EAAE;UACV,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE;YACpC,IAAI,UAAU,IAAI,QAAQ,KAAK,KAAK,EAAE;cACpC,UAAU,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;aAC1C;YACD,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC;UAC5C,CAAC,CAAC,CAAC;SACJ;QACD,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;MAC9B,CAAC,CAAC,CAAC;MAEH,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;KACxB;SAAM;MACL,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;MAC5B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;KAC1B;GACF;EACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAA","sourcesContent":["import { validateContent } from './validate';\n\nexport const pdsIconContent = new Map<string, string>();\nconst requests = new Map<string, Promise<any>>(); // eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport const getSvgContent = (url: string, sanitize = false) => {\n let req = requests.get(url);\n\n if(!req) {\n if (typeof fetch != 'undefined' && typeof document !== 'undefined') {\n // we don't have a request\n req = fetch(url).then((rsp) => {\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n if (svgContent && sanitize !== false) {\n svgContent = validateContent(svgContent);\n }\n pdsIconContent.set(url, svgContent || '');\n });\n }\n pdsIconContent.set(url, '');\n });\n\n requests.set(url, req);\n } else {\n pdsIconContent.set(url, '');\n return Promise.resolve();\n }\n }\n return req;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { newE2EPage } from "@stencil/core/testing";
|
|
2
|
+
describe('pds-icon', () => {
|
|
3
|
+
it('renders', async () => {
|
|
4
|
+
const page = await newE2EPage();
|
|
5
|
+
await page.setContent('<pds-icon role="img" style="height: 16px; width: 16px;"></pds-icon>');
|
|
6
|
+
const element = await page.find('pds-icon');
|
|
7
|
+
expect(element).toHaveClass('hydrated');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=pds-icon.e2e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pds-icon.e2e.js","sourceRoot":"","sources":["../../../../../src/components/pds-icon/test/pds-icon.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;EACxB,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,UAAU,EAAE,CAAC;IAEhC,MAAM,IAAI,CAAC,UAAU,CAAC,qEAAqE,CAAC,CAAC;IAC7F,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;EAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newE2EPage } from '@stencil/core/testing';\n\ndescribe('pds-icon', () => {\n it('renders', async () => {\n const page = await newE2EPage();\n\n await page.setContent('<pds-icon role=\"img\" style=\"height: 16px; width: 16px;\"></pds-icon>');\n const element = await page.find('pds-icon');\n expect(element).toHaveClass('hydrated');\n });\n});\n"]}
|