@rei/cedar 11.0.0-alpha.0
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/LICENSE +21 -0
- package/README.md +120 -0
- package/dist/cdr-fonts.css +21 -0
- package/dist/cedar-compiled.css +4788 -0
- package/dist/cedar.js +11677 -0
- package/dist/cedar.mjs +9944 -0
- package/dist/lib/assets/cedar-compiled-fccbce00.css +4714 -0
- package/dist/lib/node_modules/@rei/cdr-tokens/dist/js/cdr-tokens.esm.mjs +9 -0
- package/dist/lib/src/components/accordion/CdrAccordion.mjs +206 -0
- package/dist/lib/src/components/accordion/CdrAccordionGroup.mjs +124 -0
- package/dist/lib/src/components/accordion/styles/CdrAccordion.mjs +3 -0
- package/dist/lib/src/components/accordion/styles/CdrAccordionGroup.mjs +3 -0
- package/dist/lib/src/components/banner/CdrBanner.mjs +75 -0
- package/dist/lib/src/components/banner/styles/CdrBanner.mjs +3 -0
- package/dist/lib/src/components/breadcrumb/CdrBreadcrumb.mjs +170 -0
- package/dist/lib/src/components/breadcrumb/styles/CdrBreadcrumb.mjs +3 -0
- package/dist/lib/src/components/button/CdrButton.mjs +128 -0
- package/dist/lib/src/components/button/styles/CdrButton.mjs +3 -0
- package/dist/lib/src/components/caption/CdrCaption.mjs +38 -0
- package/dist/lib/src/components/caption/styles/CdrCaption.mjs +3 -0
- package/dist/lib/src/components/card/CdrCard.mjs +35 -0
- package/dist/lib/src/components/card/styles/CdrCard.mjs +3 -0
- package/dist/lib/src/components/checkbox/CdrCheckbox.mjs +182 -0
- package/dist/lib/src/components/checkbox/styles/CdrCheckbox.mjs +3 -0
- package/dist/lib/src/components/chip/CdrChip.mjs +36 -0
- package/dist/lib/src/components/chip/CdrChipGroup.mjs +108 -0
- package/dist/lib/src/components/chip/styles/CdrChip.mjs +3 -0
- package/dist/lib/src/components/chip/styles/CdrChipGroup.mjs +3 -0
- package/dist/lib/src/components/container/CdrContainer.mjs +51 -0
- package/dist/lib/src/components/container/styles/CdrContainer.mjs +3 -0
- package/dist/lib/src/components/flex-grid/CdrCol.mjs +189 -0
- package/dist/lib/src/components/flex-grid/CdrRow.mjs +231 -0
- package/dist/lib/src/components/flex-grid/styles/CdrCol.mjs +3 -0
- package/dist/lib/src/components/flex-grid/styles/CdrRow.mjs +3 -0
- package/dist/lib/src/components/formError/CdrFormError.mjs +31 -0
- package/dist/lib/src/components/formError/styles/CdrFormError.mjs +3 -0
- package/dist/lib/src/components/formGroup/CdrFormGroup.mjs +95 -0
- package/dist/lib/src/components/formGroup/styles/CdrFormGroup.mjs +3 -0
- package/dist/lib/src/components/grid/CdrGrid.mjs +59 -0
- package/dist/lib/src/components/grid/styles/CdrGrid.mjs +3 -0
- package/dist/lib/src/components/icon/CdrIcon.mjs +76 -0
- package/dist/lib/src/components/icon/comps/account-profile-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/account-profile.mjs +32 -0
- package/dist/lib/src/components/icon/comps/arrow-down.mjs +32 -0
- package/dist/lib/src/components/icon/comps/arrow-left.mjs +32 -0
- package/dist/lib/src/components/icon/comps/arrow-right.mjs +32 -0
- package/dist/lib/src/components/icon/comps/arrow-up.mjs +32 -0
- package/dist/lib/src/components/icon/comps/atv.mjs +32 -0
- package/dist/lib/src/components/icon/comps/bed-outline.mjs +32 -0
- package/dist/lib/src/components/icon/comps/bike-shop.mjs +32 -0
- package/dist/lib/src/components/icon/comps/binoculars.mjs +32 -0
- package/dist/lib/src/components/icon/comps/birding.mjs +32 -0
- package/dist/lib/src/components/icon/comps/boat.mjs +32 -0
- package/dist/lib/src/components/icon/comps/boating.mjs +32 -0
- package/dist/lib/src/components/icon/comps/bookmark-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/bookmark-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/brand-abstract.mjs +32 -0
- package/dist/lib/src/components/icon/comps/brand-code-sandbox.mjs +32 -0
- package/dist/lib/src/components/icon/comps/brand-github.mjs +32 -0
- package/dist/lib/src/components/icon/comps/brand-linkedin.mjs +32 -0
- package/dist/lib/src/components/icon/comps/brand-rei-ice-axes.mjs +32 -0
- package/dist/lib/src/components/icon/comps/brand-sketch.mjs +32 -0
- package/dist/lib/src/components/icon/comps/buddies.mjs +32 -0
- package/dist/lib/src/components/icon/comps/bus.mjs +32 -0
- package/dist/lib/src/components/icon/comps/calendar.mjs +32 -0
- package/dist/lib/src/components/icon/comps/camera.mjs +32 -0
- package/dist/lib/src/components/icon/comps/canoe.mjs +32 -0
- package/dist/lib/src/components/icon/comps/car.mjs +32 -0
- package/dist/lib/src/components/icon/comps/caret-down.mjs +32 -0
- package/dist/lib/src/components/icon/comps/caret-left.mjs +32 -0
- package/dist/lib/src/components/icon/comps/caret-right.mjs +32 -0
- package/dist/lib/src/components/icon/comps/caret-up.mjs +32 -0
- package/dist/lib/src/components/icon/comps/cart-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/cart.mjs +32 -0
- package/dist/lib/src/components/icon/comps/chain-link.mjs +32 -0
- package/dist/lib/src/components/icon/comps/chat.mjs +32 -0
- package/dist/lib/src/components/icon/comps/check-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/check-lg.mjs +32 -0
- package/dist/lib/src/components/icon/comps/check-sm.mjs +32 -0
- package/dist/lib/src/components/icon/comps/check-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/climb.mjs +32 -0
- package/dist/lib/src/components/icon/comps/clipboard.mjs +32 -0
- package/dist/lib/src/components/icon/comps/clock.mjs +32 -0
- package/dist/lib/src/components/icon/comps/code-html.mjs +32 -0
- package/dist/lib/src/components/icon/comps/code-js.mjs +32 -0
- package/dist/lib/src/components/icon/comps/compass.mjs +32 -0
- package/dist/lib/src/components/icon/comps/copy.mjs +32 -0
- package/dist/lib/src/components/icon/comps/coupon-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/coupon-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/credit-card.mjs +32 -0
- package/dist/lib/src/components/icon/comps/curbside-pickup.mjs +32 -0
- package/dist/lib/src/components/icon/comps/day.mjs +32 -0
- package/dist/lib/src/components/icon/comps/diving.mjs +32 -0
- package/dist/lib/src/components/icon/comps/dog.mjs +32 -0
- package/dist/lib/src/components/icon/comps/download.mjs +32 -0
- package/dist/lib/src/components/icon/comps/edit.mjs +32 -0
- package/dist/lib/src/components/icon/comps/elevation.mjs +32 -0
- package/dist/lib/src/components/icon/comps/error-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/error-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/expand.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-backpacking.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-camping.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-climbing.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-clothing.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-cycling.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-family.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-fitness.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-hiking.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-outdoor-basics.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-paddling.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-rentals.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-snowsports.mjs +32 -0
- package/dist/lib/src/components/icon/comps/experiences-travel.mjs +32 -0
- package/dist/lib/src/components/icon/comps/external-link.mjs +32 -0
- package/dist/lib/src/components/icon/comps/eye-hide.mjs +32 -0
- package/dist/lib/src/components/icon/comps/eye-show.mjs +32 -0
- package/dist/lib/src/components/icon/comps/facebook.mjs +32 -0
- package/dist/lib/src/components/icon/comps/filter-alt.mjs +32 -0
- package/dist/lib/src/components/icon/comps/filter.mjs +32 -0
- package/dist/lib/src/components/icon/comps/find-location.mjs +32 -0
- package/dist/lib/src/components/icon/comps/fire.mjs +32 -0
- package/dist/lib/src/components/icon/comps/fishing.mjs +32 -0
- package/dist/lib/src/components/icon/comps/free-product.mjs +32 -0
- package/dist/lib/src/components/icon/comps/grid-view.mjs +32 -0
- package/dist/lib/src/components/icon/comps/heart-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/heart-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/hike.mjs +32 -0
- package/dist/lib/src/components/icon/comps/history.mjs +32 -0
- package/dist/lib/src/components/icon/comps/home.mjs +32 -0
- package/dist/lib/src/components/icon/comps/horse.mjs +32 -0
- package/dist/lib/src/components/icon/comps/horseshoe.mjs +32 -0
- package/dist/lib/src/components/icon/comps/image.mjs +32 -0
- package/dist/lib/src/components/icon/comps/information-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/information-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/instagram.mjs +32 -0
- package/dist/lib/src/components/icon/comps/kayak.mjs +32 -0
- package/dist/lib/src/components/icon/comps/list-ragged.mjs +32 -0
- package/dist/lib/src/components/icon/comps/list-view.mjs +32 -0
- package/dist/lib/src/components/icon/comps/location-pin-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/location-pin-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/lock-locked-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/lock-locked-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/lock-unlocked-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/mail.mjs +32 -0
- package/dist/lib/src/components/icon/comps/map.mjs +32 -0
- package/dist/lib/src/components/icon/comps/member-card.mjs +32 -0
- package/dist/lib/src/components/icon/comps/microphone.mjs +32 -0
- package/dist/lib/src/components/icon/comps/minus-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/minus-lg.mjs +32 -0
- package/dist/lib/src/components/icon/comps/minus-sm.mjs +32 -0
- package/dist/lib/src/components/icon/comps/minus-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/more-functions.mjs +32 -0
- package/dist/lib/src/components/icon/comps/my-location.mjs +32 -0
- package/dist/lib/src/components/icon/comps/navigation-menu.mjs +32 -0
- package/dist/lib/src/components/icon/comps/night.mjs +32 -0
- package/dist/lib/src/components/icon/comps/paddle.mjs +32 -0
- package/dist/lib/src/components/icon/comps/pause-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/pause-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/pause.mjs +32 -0
- package/dist/lib/src/components/icon/comps/photography.mjs +32 -0
- package/dist/lib/src/components/icon/comps/picnic.mjs +32 -0
- package/dist/lib/src/components/icon/comps/pinterest.mjs +32 -0
- package/dist/lib/src/components/icon/comps/plane.mjs +32 -0
- package/dist/lib/src/components/icon/comps/play-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/play-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/play.mjs +32 -0
- package/dist/lib/src/components/icon/comps/playground.mjs +32 -0
- package/dist/lib/src/components/icon/comps/plugin.mjs +32 -0
- package/dist/lib/src/components/icon/comps/plus-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/plus-lg.mjs +32 -0
- package/dist/lib/src/components/icon/comps/plus-sm.mjs +32 -0
- package/dist/lib/src/components/icon/comps/plus-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/print.mjs +32 -0
- package/dist/lib/src/components/icon/comps/protection-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/protection-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/question-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/question-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/refresh.mjs +32 -0
- package/dist/lib/src/components/icon/comps/reload.mjs +32 -0
- package/dist/lib/src/components/icon/comps/returns.mjs +32 -0
- package/dist/lib/src/components/icon/comps/run.mjs +32 -0
- package/dist/lib/src/components/icon/comps/scan-barcode.mjs +32 -0
- package/dist/lib/src/components/icon/comps/search.mjs +32 -0
- package/dist/lib/src/components/icon/comps/service-shop.mjs +32 -0
- package/dist/lib/src/components/icon/comps/shipping.mjs +32 -0
- package/dist/lib/src/components/icon/comps/shopping-bag-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/shopping-bag.mjs +32 -0
- package/dist/lib/src/components/icon/comps/shrink.mjs +32 -0
- package/dist/lib/src/components/icon/comps/size-chart.mjs +32 -0
- package/dist/lib/src/components/icon/comps/ski-boot.mjs +32 -0
- package/dist/lib/src/components/icon/comps/ski.mjs +32 -0
- package/dist/lib/src/components/icon/comps/snow-shop.mjs +32 -0
- package/dist/lib/src/components/icon/comps/snow.mjs +32 -0
- package/dist/lib/src/components/icon/comps/sort.mjs +32 -0
- package/dist/lib/src/components/icon/comps/star-100.mjs +32 -0
- package/dist/lib/src/components/icon/comps/star-25.mjs +32 -0
- package/dist/lib/src/components/icon/comps/star-50.mjs +32 -0
- package/dist/lib/src/components/icon/comps/star-75.mjs +32 -0
- package/dist/lib/src/components/icon/comps/star-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/storefront.mjs +32 -0
- package/dist/lib/src/components/icon/comps/swim.mjs +32 -0
- package/dist/lib/src/components/icon/comps/telephone.mjs +32 -0
- package/dist/lib/src/components/icon/comps/tent.mjs +32 -0
- package/dist/lib/src/components/icon/comps/trash.mjs +32 -0
- package/dist/lib/src/components/icon/comps/twitter.mjs +32 -0
- package/dist/lib/src/components/icon/comps/upload.mjs +32 -0
- package/dist/lib/src/components/icon/comps/verified-purchaser.mjs +32 -0
- package/dist/lib/src/components/icon/comps/virtual-outfitting.mjs +32 -0
- package/dist/lib/src/components/icon/comps/warning-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/warning-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/water.mjs +32 -0
- package/dist/lib/src/components/icon/comps/wilderness.mjs +32 -0
- package/dist/lib/src/components/icon/comps/x-fill.mjs +32 -0
- package/dist/lib/src/components/icon/comps/x-lg.mjs +32 -0
- package/dist/lib/src/components/icon/comps/x-sm.mjs +32 -0
- package/dist/lib/src/components/icon/comps/x-stroke.mjs +32 -0
- package/dist/lib/src/components/icon/comps/youtube.mjs +32 -0
- package/dist/lib/src/components/icon/comps/zoom-in.mjs +32 -0
- package/dist/lib/src/components/icon/comps/zoom-out.mjs +32 -0
- package/dist/lib/src/components/icon/styles/CdrIcon.mjs +3 -0
- package/dist/lib/src/components/image/CdrImg.mjs +151 -0
- package/dist/lib/src/components/image/styles/CdrImg.mjs +3 -0
- package/dist/lib/src/components/input/CdrInput.mjs +296 -0
- package/dist/lib/src/components/input/styles/CdrInput.mjs +3 -0
- package/dist/lib/src/components/labelStandalone/CdrLabelStandalone.mjs +85 -0
- package/dist/lib/src/components/labelStandalone/styles/CdrLabelStandalone.mjs +3 -0
- package/dist/lib/src/components/labelWrapper/CdrLabelWrapper.mjs +56 -0
- package/dist/lib/src/components/labelWrapper/styles/CdrLabelWrapper.mjs +3 -0
- package/dist/lib/src/components/link/CdrLink.mjs +77 -0
- package/dist/lib/src/components/link/styles/CdrLink.mjs +3 -0
- package/dist/lib/src/components/list/CdrList.mjs +44 -0
- package/dist/lib/src/components/list/styles/CdrList.mjs +3 -0
- package/dist/lib/src/components/modal/CdrModal.mjs +375 -0
- package/dist/lib/src/components/modal/onTransitionEnd.mjs +42 -0
- package/dist/lib/src/components/modal/styles/CdrModal.mjs +3 -0
- package/dist/lib/src/components/pagination/CdrPagination.mjs +479 -0
- package/dist/lib/src/components/pagination/styles/CdrPagination.mjs +3 -0
- package/dist/lib/src/components/popover/CdrPopover.mjs +158 -0
- package/dist/lib/src/components/popover/styles/CdrPopover.mjs +3 -0
- package/dist/lib/src/components/popup/CdrPopup.mjs +284 -0
- package/dist/lib/src/components/popup/styles/CdrPopup.mjs +3 -0
- package/dist/lib/src/components/quote/CdrQuote.mjs +68 -0
- package/dist/lib/src/components/quote/styles/CdrQuote.mjs +3 -0
- package/dist/lib/src/components/radio/CdrRadio.mjs +154 -0
- package/dist/lib/src/components/radio/styles/CdrRadio.mjs +3 -0
- package/dist/lib/src/components/rating/CdrRating.mjs +200 -0
- package/dist/lib/src/components/rating/styles/CdrRating.mjs +3 -0
- package/dist/lib/src/components/select/CdrSelect.mjs +285 -0
- package/dist/lib/src/components/select/styles/CdrSelect.mjs +3 -0
- package/dist/lib/src/components/table/CdrTable.mjs +79 -0
- package/dist/lib/src/components/table/styles/CdrTable.mjs +3 -0
- package/dist/lib/src/components/tabs/CdrTabPanel.mjs +107 -0
- package/dist/lib/src/components/tabs/CdrTabs.mjs +385 -0
- package/dist/lib/src/components/tabs/styles/CdrTabPanel.mjs +3 -0
- package/dist/lib/src/components/tabs/styles/CdrTabs.mjs +3 -0
- package/dist/lib/src/components/text/CdrText.mjs +44 -0
- package/dist/lib/src/components/text/styles/CdrText.mjs +3 -0
- package/dist/lib/src/components/toast/CdrToast.mjs +129 -0
- package/dist/lib/src/components/toast/styles/CdrToast.mjs +3 -0
- package/dist/lib/src/components/tooltip/CdrTooltip.mjs +126 -0
- package/dist/lib/src/components/tooltip/styles/CdrTooltip.mjs +3 -0
- package/dist/lib/src/index.mjs +211 -0
- package/dist/lib/src/mixins/breakpoints.mjs +26 -0
- package/dist/lib/src/mixins/buildClass.mjs +97 -0
- package/dist/lib/src/mixins/fullWidth.mjs +47 -0
- package/dist/lib/src/mixins/modifier.mjs +22 -0
- package/dist/lib/src/mixins/size.mjs +39 -0
- package/dist/lib/src/utils/propValidator.mjs +27 -0
- package/dist/style/cdr-accordion-group.css +1 -0
- package/dist/style/cdr-accordion.css +1 -0
- package/dist/style/cdr-banner-vars.css +0 -0
- package/dist/style/cdr-banner.css +1 -0
- package/dist/style/cdr-breadcrumb.css +1 -0
- package/dist/style/cdr-button.css +1 -0
- package/dist/style/cdr-caption.css +1 -0
- package/dist/style/cdr-card.css +1 -0
- package/dist/style/cdr-checkbox.css +1 -0
- package/dist/style/cdr-chip-group.css +1 -0
- package/dist/style/cdr-chip.css +1 -0
- package/dist/style/cdr-col.css +1 -0
- package/dist/style/cdr-container.css +1 -0
- package/dist/style/cdr-form-error.css +1 -0
- package/dist/style/cdr-form-group.css +1 -0
- package/dist/style/cdr-grid.css +1 -0
- package/dist/style/cdr-icon.css +1 -0
- package/dist/style/cdr-img.css +1 -0
- package/dist/style/cdr-input.css +1 -0
- package/dist/style/cdr-label-standalone.css +1 -0
- package/dist/style/cdr-label-wrapper.css +1 -0
- package/dist/style/cdr-link.css +1 -0
- package/dist/style/cdr-list.css +1 -0
- package/dist/style/cdr-modal.css +1 -0
- package/dist/style/cdr-pagination.css +1 -0
- package/dist/style/cdr-popover.css +1 -0
- package/dist/style/cdr-popup.css +1 -0
- package/dist/style/cdr-quote.css +1 -0
- package/dist/style/cdr-radio.css +1 -0
- package/dist/style/cdr-rating.css +1 -0
- package/dist/style/cdr-row.css +1 -0
- package/dist/style/cdr-select.css +1 -0
- package/dist/style/cdr-tab-panel.css +1 -0
- package/dist/style/cdr-table.css +1 -0
- package/dist/style/cdr-tabs.css +1 -0
- package/dist/style/cdr-text.css +1 -0
- package/dist/style/cdr-toast.css +1 -0
- package/dist/style/cdr-tooltip.css +1 -0
- package/dist/style/cedar-full.css +39 -0
- package/dist/style/reset.css +1 -0
- package/dist/svg/icon-error.svg +5 -0
- package/dist/svg/star-0.svg +6 -0
- package/dist/svg/star-100.svg +6 -0
- package/dist/svg/star-25.svg +7 -0
- package/dist/svg/star-50.svg +7 -0
- package/dist/svg/star-75.svg +7 -0
- package/dist/svg/star-null.svg +6 -0
- package/package.json +162 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
2
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
3
|
+
import debounce from 'lodash-es/debounce';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { CdrColorBackgroundPrimary, CdrSpaceHalfX, CdrSpaceOneX } from '../../../node_modules/@rei/cdr-tokens/dist/js/cdr-tokens.esm.mjs';
|
|
6
|
+
import modifier from '../../mixins/modifier.mjs';
|
|
7
|
+
import size from '../../mixins/size.mjs';
|
|
8
|
+
import modules_722543cf from './styles/CdrTabs.mjs';
|
|
9
|
+
|
|
10
|
+
var CdrTabs = {
|
|
11
|
+
name: 'CdrTabs',
|
|
12
|
+
mixins: [modifier, size],
|
|
13
|
+
props: {
|
|
14
|
+
height: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: '240px'
|
|
17
|
+
},
|
|
18
|
+
activeTab: {
|
|
19
|
+
type: Number,
|
|
20
|
+
default: 0
|
|
21
|
+
},
|
|
22
|
+
backgroundColor: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: CdrColorBackgroundPrimary
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
tabs: [],
|
|
31
|
+
underlineOffsetX: 0,
|
|
32
|
+
underlineWidth: 0,
|
|
33
|
+
underlineScrollX: 0,
|
|
34
|
+
activeTabIndex: 0,
|
|
35
|
+
headerWidth: 0,
|
|
36
|
+
headerOverflow: false,
|
|
37
|
+
overflowLeft: false,
|
|
38
|
+
overflowRight: false,
|
|
39
|
+
animationInProgress: false,
|
|
40
|
+
style: modules_722543cf
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
computed: {
|
|
45
|
+
baseClass() {
|
|
46
|
+
return 'cdr-tabs';
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
underlineStyle() {
|
|
50
|
+
return {
|
|
51
|
+
transform: "translateX(".concat(this.underlineOffsetX, "px)"),
|
|
52
|
+
width: "".concat(this.underlineWidth, "px")
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
gradientLeftStyle() {
|
|
57
|
+
var gradient = "linear-gradient(to left, rgba(255, 255, 255, 0), ".concat(this.backgroundColor, ")");
|
|
58
|
+
return {
|
|
59
|
+
background: gradient
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
gradientRightStyle() {
|
|
64
|
+
var gradient = "linear-gradient(to right, rgba(255, 255, 255, 0), ".concat(this.backgroundColor, ")");
|
|
65
|
+
return {
|
|
66
|
+
background: gradient
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
mounted() {
|
|
73
|
+
var _context,
|
|
74
|
+
_context2,
|
|
75
|
+
_this = this;
|
|
76
|
+
|
|
77
|
+
this.tabs = _filterInstanceProperty(_context = _mapInstanceProperty(_context2 = this.$slots.default || []).call(_context2, function (vnode) {
|
|
78
|
+
return vnode.componentInstance;
|
|
79
|
+
})).call(_context, function (tab) {
|
|
80
|
+
return tab;
|
|
81
|
+
}); // get vue component children in the slot
|
|
82
|
+
|
|
83
|
+
this.activeTabIndex = this.getNextTab(this.activeTab);
|
|
84
|
+
|
|
85
|
+
if (this.tabs[this.activeTabIndex] && this.tabs[this.activeTabIndex].setActive) {
|
|
86
|
+
this.tabs[this.activeTabIndex].setActive(true);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this.$nextTick(function () {
|
|
90
|
+
_this.headerWidth = _this.getHeaderWidth();
|
|
91
|
+
|
|
92
|
+
_this.calculateOverflow();
|
|
93
|
+
|
|
94
|
+
setTimeout(function () {
|
|
95
|
+
_this.updateUnderline();
|
|
96
|
+
}, 500);
|
|
97
|
+
}); // Check for header overflow on window resize for gradient behavior.
|
|
98
|
+
|
|
99
|
+
window.addEventListener('resize', debounce(function () {
|
|
100
|
+
_this.headerWidth = _this.getHeaderWidth();
|
|
101
|
+
|
|
102
|
+
_this.calculateOverflow();
|
|
103
|
+
|
|
104
|
+
_this.updateUnderline();
|
|
105
|
+
}, 500)); // Check for header overflow on widow resize for gradient behavior.
|
|
106
|
+
|
|
107
|
+
this.$refs.cdrTabsHeader.parentElement.addEventListener('scroll', debounce(function () {
|
|
108
|
+
_this.calculateOverflow();
|
|
109
|
+
|
|
110
|
+
_this.updateUnderline();
|
|
111
|
+
}, 50));
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
methods: {
|
|
115
|
+
getNextTab(startIndex) {
|
|
116
|
+
for (var i = startIndex; i < this.tabs.length; i += 1) {
|
|
117
|
+
if (!this.tabs[i].disabled) {
|
|
118
|
+
return i;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (startIndex !== 0) {
|
|
123
|
+
for (var k = 0; k < startIndex; k += 1) {
|
|
124
|
+
if (!this.tabs[k].disabled) {
|
|
125
|
+
return k;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return -1;
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
getPreviousTab(startIndex) {
|
|
134
|
+
for (var i = startIndex; i > -1; i -= 1) {
|
|
135
|
+
if (!this.tabs[i].disabled) {
|
|
136
|
+
return i;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (startIndex !== this.tabs.length - 1) {
|
|
141
|
+
for (var k = this.tabs.length - 1; k > startIndex; k -= 1) {
|
|
142
|
+
if (!this.tabs[k].disabled) {
|
|
143
|
+
return k;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return -1;
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
handleClick: debounce(function handleClickCallback(tabClicked) {
|
|
152
|
+
var newIndex = this.tabs.findIndex(function (tab) {
|
|
153
|
+
return tabClicked.name === tab.name;
|
|
154
|
+
});
|
|
155
|
+
this.changeTab(newIndex);
|
|
156
|
+
}, 500, {
|
|
157
|
+
leading: true,
|
|
158
|
+
trailing: false
|
|
159
|
+
}),
|
|
160
|
+
|
|
161
|
+
changeTab(newIndex) {
|
|
162
|
+
var _this2 = this;
|
|
163
|
+
|
|
164
|
+
var oldIndex = this.activeTabIndex;
|
|
165
|
+
this.hideScrollBar();
|
|
166
|
+
|
|
167
|
+
if (newIndex > oldIndex) {
|
|
168
|
+
this.tabs[oldIndex].setAnimationDirection('exit-left');
|
|
169
|
+
this.tabs[oldIndex].setActive(false);
|
|
170
|
+
setTimeout(function () {
|
|
171
|
+
_this2.tabs[newIndex].setActive(true);
|
|
172
|
+
|
|
173
|
+
_this2.tabs[newIndex].setAnimationDirection('enter-right');
|
|
174
|
+
}, 200);
|
|
175
|
+
} else {
|
|
176
|
+
this.tabs[oldIndex].setAnimationDirection('exit-right');
|
|
177
|
+
this.tabs[oldIndex].setActive(false);
|
|
178
|
+
setTimeout(function () {
|
|
179
|
+
_this2.tabs[newIndex].setActive(true);
|
|
180
|
+
|
|
181
|
+
_this2.tabs[newIndex].setAnimationDirection('enter-left');
|
|
182
|
+
}, 200);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
this.activeTabIndex = newIndex;
|
|
186
|
+
this.updateUnderline();
|
|
187
|
+
this.$refs.cdrTabsHeader.children[this.activeTabIndex].focus();
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
rightArrowNav: debounce(function handleRightArrow() {
|
|
191
|
+
var nextTab = this.getNextTab(this.activeTabIndex + 1);
|
|
192
|
+
|
|
193
|
+
if (nextTab !== -1) {
|
|
194
|
+
this.changeTab(nextTab);
|
|
195
|
+
}
|
|
196
|
+
}, 300, {
|
|
197
|
+
leading: true,
|
|
198
|
+
trailing: false
|
|
199
|
+
}),
|
|
200
|
+
leftArrowNav: debounce(function handleLeftArrow() {
|
|
201
|
+
var previousTab = this.getPreviousTab(this.activeTabIndex - 1);
|
|
202
|
+
|
|
203
|
+
if (previousTab !== -1) {
|
|
204
|
+
this.changeTab(previousTab);
|
|
205
|
+
}
|
|
206
|
+
}, 300, {
|
|
207
|
+
leading: true,
|
|
208
|
+
trailing: false
|
|
209
|
+
}),
|
|
210
|
+
|
|
211
|
+
calculateOverflow() {
|
|
212
|
+
var containerWidth = 0;
|
|
213
|
+
|
|
214
|
+
if (this.$refs.cdrTabsContainer) {
|
|
215
|
+
containerWidth = this.$refs.cdrTabsContainer.offsetWidth;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
this.headerOverflow = this.headerWidth > containerWidth;
|
|
219
|
+
|
|
220
|
+
if (this.headerOverflow) {
|
|
221
|
+
// Get Scroll Position
|
|
222
|
+
var scrollX = this.$refs.cdrTabsHeader.parentElement.scrollLeft;
|
|
223
|
+
this.overflowLeft = scrollX > 1;
|
|
224
|
+
this.overflowRight = scrollX + 1 < this.headerWidth - containerWidth;
|
|
225
|
+
} else {
|
|
226
|
+
this.overflowLeft = false;
|
|
227
|
+
this.overflowRight = false;
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
updateUnderline() {
|
|
232
|
+
var elements = Array.from(this.$refs.cdrTabsHeader.children);
|
|
233
|
+
|
|
234
|
+
if (elements.length > 0) {
|
|
235
|
+
var activeTab = elements[this.activeTabIndex];
|
|
236
|
+
var activeRect = activeTab.getBoundingClientRect();
|
|
237
|
+
var parentRect = this.$refs.cdrTabsHeader.getBoundingClientRect();
|
|
238
|
+
var offset = activeRect.x - parentRect.x;
|
|
239
|
+
this.underlineOffsetX = offset - this.$refs.cdrTabsHeader.parentElement.scrollLeft;
|
|
240
|
+
this.underlineWidth = activeRect.width; // shrink/hide the underline if it scrolls outside the container
|
|
241
|
+
|
|
242
|
+
if (this.underlineOffsetX + this.underlineWidth >= parentRect.width) {
|
|
243
|
+
this.underlineWidth = Math.max(0, parentRect.width - this.underlineOffsetX);
|
|
244
|
+
this.underlineOffsetX = Math.min(this.underlineOffsetX, parentRect.width);
|
|
245
|
+
} else if (this.underlineOffsetX < 0) {
|
|
246
|
+
this.underlineWidth = Math.max(0, this.underlineWidth + this.underlineOffsetX);
|
|
247
|
+
this.underlineOffsetX = 0;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
handleDownArrowNav() {
|
|
253
|
+
if (!this.animationInProgress) {
|
|
254
|
+
this.$el.lastElementChild.children[this.activeTabIndex].focus();
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
setFocusToActiveTabHeader() {
|
|
259
|
+
this.$refs.cdrTabsHeader.children[this.activeTabIndex].focus();
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
getHeaderWidth() {
|
|
263
|
+
var _this3 = this;
|
|
264
|
+
|
|
265
|
+
var headerElements = [];
|
|
266
|
+
|
|
267
|
+
if (this.$refs.cdrTabsHeader) {
|
|
268
|
+
headerElements = Array.from(this.$refs.cdrTabsHeader.children);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
var totalWidth = 0;
|
|
272
|
+
headerElements.forEach(function (element, i) {
|
|
273
|
+
// account for margin-left on header elements
|
|
274
|
+
if (i > 0) {
|
|
275
|
+
totalWidth += _this3.size === 'small' ? Number(CdrSpaceHalfX) : Number(CdrSpaceOneX);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
totalWidth += element.offsetWidth || 0;
|
|
279
|
+
});
|
|
280
|
+
return totalWidth;
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
hideScrollBar() {
|
|
284
|
+
var containerRef = this.$refs.cdrTabsContainer.style;
|
|
285
|
+
var slotRef = this.$refs.slotWrapper.style;
|
|
286
|
+
window.addEventListener('transitionend', function () {
|
|
287
|
+
containerRef.setProperty('overflow-x', 'unset');
|
|
288
|
+
slotRef.setProperty('overflow-y', 'unset');
|
|
289
|
+
}, {
|
|
290
|
+
once: true
|
|
291
|
+
});
|
|
292
|
+
containerRef.setProperty('overflow-x', 'hidden');
|
|
293
|
+
slotRef.setProperty('overflow-y', 'hidden');
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
getTabEl(tab) {
|
|
297
|
+
var _this4 = this;
|
|
298
|
+
|
|
299
|
+
var h = this.$createElement;
|
|
300
|
+
return tab.disabled ? h("button", {
|
|
301
|
+
"class": clsx(this.style['cdr-tabs__header-item'], this.style['cdr-tabs__header-item--disabled']),
|
|
302
|
+
"attrs": {
|
|
303
|
+
"disabled": true
|
|
304
|
+
}
|
|
305
|
+
}, [tab.name]) : h("button", {
|
|
306
|
+
"attrs": {
|
|
307
|
+
"role": "tab",
|
|
308
|
+
"aria-selected": tab.active,
|
|
309
|
+
"aria-controls": tab.id,
|
|
310
|
+
"id": tab.ariaLabelledby,
|
|
311
|
+
"tabIndex": tab.active ? 0 : -1,
|
|
312
|
+
"js-name": tab.name
|
|
313
|
+
},
|
|
314
|
+
"key": tab.id,
|
|
315
|
+
"class": clsx(tab.active ? this.style['cdr-tabs__header-item-active'] : '', this.style['cdr-tabs__header-item']),
|
|
316
|
+
"on": {
|
|
317
|
+
"click": function click($event) {
|
|
318
|
+
$event.preventDefault();
|
|
319
|
+
return function (e) {
|
|
320
|
+
return _this4.handleClick(tab, e);
|
|
321
|
+
}($event);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}, [tab.name]);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
render() {
|
|
330
|
+
var _this5 = this,
|
|
331
|
+
_context3;
|
|
332
|
+
|
|
333
|
+
var h = arguments[0];
|
|
334
|
+
return h("div", {
|
|
335
|
+
"class": clsx(this.style[this.baseClass], this.modifierClass, this.sizeClass),
|
|
336
|
+
"ref": "cdrTabsContainer",
|
|
337
|
+
"style": {
|
|
338
|
+
height: this.height
|
|
339
|
+
}
|
|
340
|
+
}, [h("div", {
|
|
341
|
+
"class": this.style['cdr-tabs__gradient-container'],
|
|
342
|
+
"on": {
|
|
343
|
+
"keyup": [function ($event) {
|
|
344
|
+
if (!("button" in $event) && _this5._k($event.keyCode, "right", 39, $event.key, ["Right", "ArrowRight"])) return null;
|
|
345
|
+
if ("button" in $event && $event.button !== 2) return null;
|
|
346
|
+
return _this5.rightArrowNav($event);
|
|
347
|
+
}, function ($event) {
|
|
348
|
+
if (!("button" in $event) && _this5._k($event.keyCode, "left", 37, $event.key, ["Left", "ArrowLeft"])) return null;
|
|
349
|
+
if ("button" in $event && $event.button !== 0) return null;
|
|
350
|
+
return _this5.leftArrowNav($event);
|
|
351
|
+
}],
|
|
352
|
+
"keydown": function keydown($event) {
|
|
353
|
+
if (!("button" in $event) && _this5._k($event.keyCode, "down", 40, $event.key, ["Down", "ArrowDown"])) return null;
|
|
354
|
+
$event.preventDefault();
|
|
355
|
+
return _this5.handleDownArrowNav($event);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}, [h("div", {
|
|
359
|
+
"class": clsx(this.style['cdr-tabs__gradient'], this.style['cdr-tabs__gradient--left'], this.overflowLeft ? this.style['cdr-tabs__gradient--active'] : ''),
|
|
360
|
+
"style": this.gradientLeftStyle
|
|
361
|
+
}), h("nav", {
|
|
362
|
+
"class": this.style['cdr-tabs__header-container']
|
|
363
|
+
}, [h("div", {
|
|
364
|
+
"class": this.style['cdr-tabs__header'],
|
|
365
|
+
"attrs": {
|
|
366
|
+
"role": "tablist"
|
|
367
|
+
},
|
|
368
|
+
"ref": "cdrTabsHeader"
|
|
369
|
+
}, [_mapInstanceProperty(_context3 = this.tabs).call(_context3, function (tab) {
|
|
370
|
+
return _this5.getTabEl(tab);
|
|
371
|
+
})])]), h("div", {
|
|
372
|
+
"class": clsx(this.style['cdr-tabs__gradient'], this.style['cdr-tabs__gradient--right'], this.overflowRight ? this.style['cdr-tabs__gradient--active'] : ''),
|
|
373
|
+
"style": this.gradientRightStyle
|
|
374
|
+
}), h("div", {
|
|
375
|
+
"class": this.style['cdr-tabs__underline'],
|
|
376
|
+
"style": this.underlineStyle
|
|
377
|
+
})]), h("div", {
|
|
378
|
+
"class": this.style['cdr-tabs__content-container'],
|
|
379
|
+
"ref": "slotWrapper"
|
|
380
|
+
}, [this.$slots.default])]);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
export default CdrTabs;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var modules_7f8cc96c = {"cdr-tab-panel":"cdr-tab-panel_11-0-0-alpha-0","cdr-tab-panel-enter-left":"cdr-tab-panel-enter-left_11-0-0-alpha-0","cdr-tab-panel-enter-right":"cdr-tab-panel-enter-right_11-0-0-alpha-0","cdr-tab-panel-exit-left":"cdr-tab-panel-exit-left_11-0-0-alpha-0","cdr-tab-panel-exit-right":"cdr-tab-panel-exit-right_11-0-0-alpha-0"};
|
|
2
|
+
|
|
3
|
+
export default modules_7f8cc96c;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var modules_722543cf = {"cdr-tabs":"cdr-tabs_11-0-0-alpha-0","cdr-tabs__header-container":"cdr-tabs__header-container_11-0-0-alpha-0","cdr-tabs__gradient-container":"cdr-tabs__gradient-container_11-0-0-alpha-0","cdr-tabs__gradient":"cdr-tabs__gradient_11-0-0-alpha-0","cdr-tabs__gradient--left":"cdr-tabs__gradient--left_11-0-0-alpha-0","cdr-tabs__gradient--right":"cdr-tabs__gradient--right_11-0-0-alpha-0","cdr-tabs__gradient--active":"cdr-tabs__gradient--active_11-0-0-alpha-0","cdr-tabs__header":"cdr-tabs__header_11-0-0-alpha-0","cdr-tabs__header-item":"cdr-tabs__header-item_11-0-0-alpha-0","cdr-tabs__header-item-active":"cdr-tabs__header-item-active_11-0-0-alpha-0","cdr-tabs__header-item--disabled":"cdr-tabs__header-item--disabled_11-0-0-alpha-0","cdr-tabs__underline":"cdr-tabs__underline_11-0-0-alpha-0","cdr-tabs__content-container":"cdr-tabs__content-container_11-0-0-alpha-0","fade-enter-active":"fade-enter-active_11-0-0-alpha-0","fade-leave-active":"fade-leave-active_11-0-0-alpha-0","fade-enter":"fade-enter_11-0-0-alpha-0","fade-leave-to":"fade-leave-to_11-0-0-alpha-0","cdr-tabs--compact":"cdr-tabs--compact_11-0-0-alpha-0","cdr-tabs__header-item-label":"cdr-tabs__header-item-label_11-0-0-alpha-0","cdr-tabs--small":"cdr-tabs--small_11-0-0-alpha-0","cdr-tabs--no-border":"cdr-tabs--no-border_11-0-0-alpha-0","cdr-tabs--full-width":"cdr-tabs--full-width_11-0-0-alpha-0","cdr-tabs--centered":"cdr-tabs--centered_11-0-0-alpha-0"};
|
|
2
|
+
|
|
3
|
+
export default modules_722543cf;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import modules_7ce14c17 from './styles/CdrText.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cedar 2 component for text styles
|
|
5
|
+
* Accepts typography modifiers.
|
|
6
|
+
* @version 0.0.1
|
|
7
|
+
* @author [REI Software Engineering](https://rei.github.io/rei-cedar/)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var CdrText = {
|
|
11
|
+
name: 'CdrText',
|
|
12
|
+
props: {
|
|
13
|
+
/** Any valid HTML tag */
|
|
14
|
+
tag: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'p'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
s: modules_7ce14c17 // named `s` not `style` so that modifierClass works for text utils
|
|
23
|
+
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
computed: {
|
|
28
|
+
baseClass() {
|
|
29
|
+
return 'cdr-text';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
render() {
|
|
35
|
+
var h = arguments[0];
|
|
36
|
+
var Component = this.tag;
|
|
37
|
+
return h(Component, {
|
|
38
|
+
"class": this.s[this.baseClass]
|
|
39
|
+
}, [this.$slots.default]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default CdrText;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import validateProp from '../../utils/propValidator.mjs';
|
|
3
|
+
import BuildClass from '../../mixins/buildClass.mjs';
|
|
4
|
+
import IconXSm from '../icon/comps/x-sm.mjs';
|
|
5
|
+
import CdrButton from '../button/CdrButton.mjs';
|
|
6
|
+
import modules_485069ef from './styles/CdrToast.mjs';
|
|
7
|
+
|
|
8
|
+
var CdrToast = {
|
|
9
|
+
name: 'CdrToast',
|
|
10
|
+
components: {
|
|
11
|
+
CdrButton,
|
|
12
|
+
IconXSm
|
|
13
|
+
},
|
|
14
|
+
mixins: [BuildClass],
|
|
15
|
+
props: {
|
|
16
|
+
type: {
|
|
17
|
+
type: String,
|
|
18
|
+
validator: function validator(value) {
|
|
19
|
+
return validateProp(value, ['info', 'warning', 'success', 'error', 'default']);
|
|
20
|
+
},
|
|
21
|
+
default: 'default'
|
|
22
|
+
},
|
|
23
|
+
open: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
autoDismiss: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: true
|
|
30
|
+
},
|
|
31
|
+
dismissDelay: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 5000
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
data() {
|
|
38
|
+
return {
|
|
39
|
+
style: modules_485069ef,
|
|
40
|
+
closed: null,
|
|
41
|
+
opened: null
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
computed: {
|
|
46
|
+
baseClass() {
|
|
47
|
+
return 'cdr-toast';
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
borderClass() {
|
|
51
|
+
return this.modifyClassName(this.baseClass, this.type);
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
iconClass() {
|
|
55
|
+
return this.modifyClassName("".concat(this.baseClass, "__icon-left"), this.type);
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
themeClass() {
|
|
59
|
+
return this.modifyClassName("".concat(this.baseClass, "__main"), this.type);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
},
|
|
63
|
+
watch: {
|
|
64
|
+
open(newValue, oldValue) {
|
|
65
|
+
if (!!newValue === !!oldValue) return;
|
|
66
|
+
|
|
67
|
+
if (newValue) {
|
|
68
|
+
this.openToast();
|
|
69
|
+
} else {
|
|
70
|
+
this.closeToast();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
openToast() {
|
|
77
|
+
this.closed = false;
|
|
78
|
+
this.opened = true;
|
|
79
|
+
|
|
80
|
+
if (this.autoDismiss) {
|
|
81
|
+
setTimeout(this.closeToast, this.dismissDelay);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
closeToast() {
|
|
86
|
+
this.opened = false;
|
|
87
|
+
this.closed = true;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
render() {
|
|
93
|
+
var h = arguments[0];
|
|
94
|
+
return h("transition", {
|
|
95
|
+
"attrs": {
|
|
96
|
+
"enter-class": clsx(this.style['cdr-toast--toast-enter']),
|
|
97
|
+
"enter-active-class": clsx(this.style['cdr-toast--toast-enter-active']),
|
|
98
|
+
"leave-to-class": clsx(this.style['cdr-toast--toast-leave-to']),
|
|
99
|
+
"leave-active-class": clsx(this.style['cdr-toast--toast-leave-active'])
|
|
100
|
+
}
|
|
101
|
+
}, [this.opened ? h("div", {
|
|
102
|
+
"class": clsx(this.style[this.baseClass], this.borderClass)
|
|
103
|
+
}, [h("div", {
|
|
104
|
+
"class": clsx(this.style['cdr-toast__main'], this.themeClass)
|
|
105
|
+
}, [this.$slots['icon-left'] && h("div", {
|
|
106
|
+
"class": clsx(this.style['cdr-toast__icon-left'], this.iconClass)
|
|
107
|
+
}, [this.$slots['icon-left']]), h("span", {
|
|
108
|
+
"class": this.style['cdr-toast__message']
|
|
109
|
+
}, [this.$slots.default]), h("cdr-button", {
|
|
110
|
+
"class": this.style['cdr-toast__close-button'],
|
|
111
|
+
"attrs": {
|
|
112
|
+
"icon-only": true,
|
|
113
|
+
"aria-label": "Close",
|
|
114
|
+
"size": "small"
|
|
115
|
+
},
|
|
116
|
+
"on": {
|
|
117
|
+
"click": this.closeToast
|
|
118
|
+
}
|
|
119
|
+
}, [h("icon-x-sm", {
|
|
120
|
+
"slot": "icon",
|
|
121
|
+
"attrs": {
|
|
122
|
+
"inherit-color": true
|
|
123
|
+
}
|
|
124
|
+
})])])]) : null]);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export default CdrToast;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var modules_485069ef = {"cdr-toast":"cdr-toast_11-0-0-alpha-0","cdr-toast__inner":"cdr-toast__inner_11-0-0-alpha-0","cdr-toast--toast-enter":"cdr-toast--toast-enter_11-0-0-alpha-0","cdr-toast--toast-enter-active":"cdr-toast--toast-enter-active_11-0-0-alpha-0","cdr-toast--toast-leave-to":"cdr-toast--toast-leave-to_11-0-0-alpha-0","cdr-toast--toast-leave-active":"cdr-toast--toast-leave-active_11-0-0-alpha-0","cdr-toast__main":"cdr-toast__main_11-0-0-alpha-0","cdr-toast__main--default":"cdr-toast__main--default_11-0-0-alpha-0","cdr-toast__main--info":"cdr-toast__main--info_11-0-0-alpha-0","cdr-toast__main--warning":"cdr-toast__main--warning_11-0-0-alpha-0","cdr-toast__main--success":"cdr-toast__main--success_11-0-0-alpha-0","cdr-toast__main--error":"cdr-toast__main--error_11-0-0-alpha-0","cdr-toast__icon-left":"cdr-toast__icon-left_11-0-0-alpha-0","cdr-toast__icon-left--info":"cdr-toast__icon-left--info_11-0-0-alpha-0","cdr-toast__icon-left--warning":"cdr-toast__icon-left--warning_11-0-0-alpha-0","cdr-toast__icon-left--success":"cdr-toast__icon-left--success_11-0-0-alpha-0","cdr-toast__icon-left--error":"cdr-toast__icon-left--error_11-0-0-alpha-0","cdr-toast__icon-left--default":"cdr-toast__icon-left--default_11-0-0-alpha-0","cdr-toast__message":"cdr-toast__message_11-0-0-alpha-0","cdr-toast__close-button":"cdr-toast__close-button_11-0-0-alpha-0","cdr-toast--default":"cdr-toast--default_11-0-0-alpha-0","cdr-toast--info":"cdr-toast--info_11-0-0-alpha-0","cdr-toast--warning":"cdr-toast--warning_11-0-0-alpha-0","cdr-toast--success":"cdr-toast--success_11-0-0-alpha-0","cdr-toast--error":"cdr-toast--error_11-0-0-alpha-0"};
|
|
2
|
+
|
|
3
|
+
export default modules_485069ef;
|