@dnanpm/styleguide 4.0.8 → 4.0.10
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/build/cjs/_virtual/_virtual_inject.js +5 -0
- package/build/cjs/assets/fonts/fonts.css.js +3 -1
- package/build/cjs/components/Accordion/Accordion.js +66 -54
- package/build/cjs/components/AccordionItem/AccordionItem.js +94 -73
- package/build/cjs/components/AmountSelector/AmountSelector.js +121 -134
- package/build/cjs/components/Box/Box.js +38 -13
- package/build/cjs/components/Breadcrumb/Breadcrumb.js +73 -71
- package/build/cjs/components/Button/Button.d.ts +1 -1
- package/build/cjs/components/Button/Button.js +131 -127
- package/build/cjs/components/ButtonArrow/ButtonArrow.js +47 -49
- package/build/cjs/components/ButtonCard/ButtonCard.d.ts +2 -2
- package/build/cjs/components/ButtonCard/ButtonCard.js +97 -112
- package/build/cjs/components/ButtonClose/ButtonClose.d.ts +1 -1
- package/build/cjs/components/ButtonClose/ButtonClose.js +25 -14
- package/build/cjs/components/ButtonIcon/ButtonIcon.d.ts +44 -3
- package/build/cjs/components/ButtonIcon/ButtonIcon.js +105 -67
- package/build/cjs/components/ButtonPrimary/ButtonPrimary.d.ts +43 -2
- package/build/cjs/components/ButtonPrimary/ButtonPrimary.js +7 -35
- package/build/cjs/components/ButtonSecondary/ButtonSecondary.d.ts +43 -2
- package/build/cjs/components/ButtonSecondary/ButtonSecondary.js +7 -35
- package/build/cjs/components/Carousel/Carousel.d.ts +8 -2
- package/build/cjs/components/Carousel/Carousel.js +315 -346
- package/build/cjs/components/Checkbox/Checkbox.js +49 -108
- package/build/cjs/components/Chip/Chip.js +40 -34
- package/build/cjs/components/DateTimePicker/DateTimePicker.js +198 -334
- package/build/cjs/components/Divider/Divider.js +29 -15
- package/build/cjs/components/DnaLogo/DnaLogo.js +87 -51
- package/build/cjs/components/Drawer/Drawer.js +172 -167
- package/build/cjs/components/EmptyState/EmptyState.js +24 -12
- package/build/cjs/components/EnergyLabel/EnergyLabel.js +77 -73
- package/build/cjs/components/Expander/Expander.js +43 -38
- package/build/cjs/components/Floater/Floater.js +36 -14
- package/build/cjs/components/Footer/Components/FooterComponents.d.ts +4 -2
- package/build/cjs/components/Footer/Components/FooterComponents.js +305 -346
- package/build/cjs/components/Footer/Footer.js +51 -80
- package/build/cjs/components/Footer/context/FooterContext.js +9 -9
- package/build/cjs/components/Hero/Hero.js +101 -149
- package/build/cjs/components/Icon/Icon.js +41 -22
- package/build/cjs/components/Icons/Small/hlArrowBackSmall.js +12 -4
- package/build/cjs/components/Icons/Small/hlArrowForwardSmall.js +12 -4
- package/build/cjs/components/Icons/Small/hlArrowUnderSmall.js +12 -4
- package/build/cjs/components/Icons/Small/hlCalendarSmall.js +12 -4
- package/build/cjs/components/Icons/Small/hlChevronDownSmall.js +12 -4
- package/build/cjs/components/Icons/Small/hlChevronLeftSmall.js +12 -4
- package/build/cjs/components/Icons/Small/hlChevronRightSmall.js +12 -4
- package/build/cjs/components/Icons/Small/hlChevronUpSmall.js +12 -4
- package/build/cjs/components/Icons/Small/hlClockSmall.js +14 -5
- package/build/cjs/components/Icons/Small/hlDownloadSmall.js +18 -6
- package/build/cjs/components/Icons/Small/hlExternalSmall.js +12 -4
- package/build/cjs/components/Icons/Small/hlUploadSmall.js +18 -6
- package/build/cjs/components/Icons/Social/facebook.js +13 -4
- package/build/cjs/components/Icons/Social/instagram.js +13 -4
- package/build/cjs/components/Icons/Social/linkedin.js +13 -4
- package/build/cjs/components/Icons/Social/tiktok.js +12 -4
- package/build/cjs/components/Icons/Social/twitter.js +13 -4
- package/build/cjs/components/Icons/Social/youtube.js +12 -4
- package/build/cjs/components/Icons/hl404.js +12 -4
- package/build/cjs/components/Icons/hl4gSim.js +12 -4
- package/build/cjs/components/Icons/hl5gSim.js +12 -4
- package/build/cjs/components/Icons/hlBattery.js +16 -6
- package/build/cjs/components/Icons/hlBell.js +12 -4
- package/build/cjs/components/Icons/hlCableTVCard.js +12 -4
- package/build/cjs/components/Icons/hlCalendar.js +56 -15
- package/build/cjs/components/Icons/hlCall.js +12 -4
- package/build/cjs/components/Icons/hlCameraBack.js +18 -6
- package/build/cjs/components/Icons/hlCameraFront.js +14 -5
- package/build/cjs/components/Icons/hlCart.js +16 -6
- package/build/cjs/components/Icons/hlCartEmpty.js +16 -6
- package/build/cjs/components/Icons/hlChat.js +24 -7
- package/build/cjs/components/Icons/hlCheck.js +12 -4
- package/build/cjs/components/Icons/hlChevronDown.js +12 -4
- package/build/cjs/components/Icons/hlChevronLeft.js +12 -4
- package/build/cjs/components/Icons/hlChevronRight.js +12 -4
- package/build/cjs/components/Icons/hlChevronUp.js +12 -4
- package/build/cjs/components/Icons/hlCompensation.js +12 -4
- package/build/cjs/components/Icons/hlCookie.js +12 -4
- package/build/cjs/components/Icons/hlCopy.js +14 -5
- package/build/cjs/components/Icons/hlCoupon.js +16 -6
- package/build/cjs/components/Icons/hlDelivery.js +14 -4
- package/build/cjs/components/Icons/hlDigiturva.js +14 -4
- package/build/cjs/components/Icons/hlDisplaySize.js +19 -6
- package/build/cjs/components/Icons/hlDocument.js +14 -5
- package/build/cjs/components/Icons/hlDownload.js +18 -6
- package/build/cjs/components/Icons/hlEnvelope.js +12 -4
- package/build/cjs/components/Icons/hlError.js +22 -6
- package/build/cjs/components/Icons/hlEuro.js +12 -4
- package/build/cjs/components/Icons/hlExclamationMark.js +12 -4
- package/build/cjs/components/Icons/hlExpand.js +12 -4
- package/build/cjs/components/Icons/hlExternal.js +12 -4
- package/build/cjs/components/Icons/hlEyeClosed.js +12 -4
- package/build/cjs/components/Icons/hlEyeOpen.js +14 -5
- package/build/cjs/components/Icons/hlFaceId.js +12 -4
- package/build/cjs/components/Icons/hlFastDelivery.js +12 -4
- package/build/cjs/components/Icons/hlFingerprint.js +20 -8
- package/build/cjs/components/Icons/hlGlobe.js +12 -4
- package/build/cjs/components/Icons/hlHeadphones.js +12 -4
- package/build/cjs/components/Icons/hlHeadset.js +18 -6
- package/build/cjs/components/Icons/hlHeart.js +12 -4
- package/build/cjs/components/Icons/hlHome.js +12 -4
- package/build/cjs/components/Icons/hlHub.js +14 -5
- package/build/cjs/components/Icons/hlImage.js +12 -4
- package/build/cjs/components/Icons/hlInfo.js +18 -6
- package/build/cjs/components/Icons/hlInstallment.js +14 -5
- package/build/cjs/components/Icons/hlIotSim.js +14 -5
- package/build/cjs/components/Icons/hlLaptop.js +13 -4
- package/build/cjs/components/Icons/hlLink.js +16 -5
- package/build/cjs/components/Icons/hlLiveVideo.js +12 -4
- package/build/cjs/components/Icons/hlLock.js +18 -6
- package/build/cjs/components/Icons/hlMagnifyingGlass.js +14 -5
- package/build/cjs/components/Icons/hlMarker.js +14 -5
- package/build/cjs/components/Icons/hlMemory.js +14 -5
- package/build/cjs/components/Icons/hlMenu.js +12 -4
- package/build/cjs/components/Icons/hlMinimize.js +12 -4
- package/build/cjs/components/Icons/hlMinus.js +12 -4
- package/build/cjs/components/Icons/hlMobileData.js +12 -4
- package/build/cjs/components/Icons/hlMobilePayment.js +19 -6
- package/build/cjs/components/Icons/hlModem.js +26 -8
- package/build/cjs/components/Icons/hlMore.js +22 -6
- package/build/cjs/components/Icons/hlOs.js +14 -5
- package/build/cjs/components/Icons/hlPackage.js +12 -4
- package/build/cjs/components/Icons/hlPaperclip.js +12 -4
- package/build/cjs/components/Icons/hlPaytime.js +12 -4
- package/build/cjs/components/Icons/hlPen.js +12 -4
- package/build/cjs/components/Icons/hlPerson.js +12 -4
- package/build/cjs/components/Icons/hlPhone.js +17 -5
- package/build/cjs/components/Icons/hlPlaylist.js +13 -4
- package/build/cjs/components/Icons/hlPlus.js +14 -5
- package/build/cjs/components/Icons/hlPrepaid.js +12 -4
- package/build/cjs/components/Icons/hlProcessor.js +14 -5
- package/build/cjs/components/Icons/hlServices.js +12 -4
- package/build/cjs/components/Icons/hlSettings.js +12 -4
- package/build/cjs/components/Icons/hlShield.js +14 -5
- package/build/cjs/components/Icons/hlSim.js +14 -5
- package/build/cjs/components/Icons/hlSimSimple.js +18 -6
- package/build/cjs/components/Icons/hlSmile.js +22 -7
- package/build/cjs/components/Icons/hlSpeechBubble.js +14 -5
- package/build/cjs/components/Icons/hlSquaretrade.js +13 -4
- package/build/cjs/components/Icons/hlStar.js +12 -4
- package/build/cjs/components/Icons/hlStarFilled.js +12 -4
- package/build/cjs/components/Icons/hlTrash.js +14 -5
- package/build/cjs/components/Icons/hlTv.js +12 -4
- package/build/cjs/components/Icons/hlUnlock.js +14 -6
- package/build/cjs/components/Icons/hlUpload.js +18 -6
- package/build/cjs/components/Icons/hlWarning.js +18 -6
- package/build/cjs/components/Icons/hlWifi.js +18 -6
- package/build/cjs/components/Icons/hlWrench.js +12 -4
- package/build/cjs/components/Icons/hlX.js +12 -4
- package/build/cjs/components/InfoDialog/InfoDialog.js +31 -46
- package/build/cjs/components/Input/Input.js +143 -159
- package/build/cjs/components/Label/Label.js +22 -22
- package/build/cjs/components/LabelText/LabelText.js +24 -17
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +29 -44
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +167 -153
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LanguageSelector.js +34 -20
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LinkModifier.js +50 -32
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/LoginTooltip.js +17 -5
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +5 -2
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +100 -95
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +6 -2
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +4 -58
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.js +20 -4
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +187 -159
- package/build/cjs/components/MainHeaderNavigation/ChildComponents/PageSearch.js +16 -5
- package/build/cjs/components/MainHeaderNavigation/MainHeaderNavigation.js +305 -272
- package/build/cjs/components/MainHeaderNavigation/context/NavContext.js +61 -49
- package/build/cjs/components/MainHeaderNavigation/globalNavStyles.d.ts +31 -16
- package/build/cjs/components/MainHeaderNavigation/globalNavStyles.js +39 -172
- package/build/cjs/components/Modal/Modal.js +127 -145
- package/build/cjs/components/Notification/Notification.js +74 -54
- package/build/cjs/components/NotificationBadge/NotificationBadge.js +29 -32
- package/build/cjs/components/Overlay/Overlay.js +70 -68
- package/build/cjs/components/Pill/Pill.js +91 -82
- package/build/cjs/components/PillGroup/PillGroup.js +50 -33
- package/build/cjs/components/PixelLoader/PixelLoader.js +37 -34
- package/build/cjs/components/PriorityNavigation/PriorityNavigation.js +281 -303
- package/build/cjs/components/PriorityNavigationItem/PriorityNavigationItem.js +27 -49
- package/build/cjs/components/ProgressIndicator/ProgressIndicator.js +140 -109
- package/build/cjs/components/RadioButton/RadioButton.js +91 -114
- package/build/cjs/components/ReadMore/ReadMore.js +86 -69
- package/build/cjs/components/Search/Search.js +52 -64
- package/build/cjs/components/Selectbox/Selectbox.js +279 -94
- package/build/cjs/components/Skeleton/Skeleton.js +69 -56
- package/build/cjs/components/Switch/Switch.js +62 -76
- package/build/cjs/components/Tab/Tab.js +55 -53
- package/build/cjs/components/Tabs/Tabs.js +93 -71
- package/build/cjs/components/Textarea/Textarea.js +76 -73
- package/build/cjs/components/Toaster/Toaster.js +59 -44
- package/build/cjs/components/Tooltip/Tooltip.js +74 -87
- package/build/cjs/hooks/useCloseOutsideOrElementClicked.js +23 -21
- package/build/cjs/hooks/useDebounce.js +9 -9
- package/build/cjs/hooks/useDocHeight.js +13 -13
- package/build/cjs/hooks/useOutsideClick.js +10 -10
- package/build/cjs/hooks/useResizeObserver.js +37 -24
- package/build/cjs/hooks/useScrollPosition.js +55 -54
- package/build/cjs/hooks/useWindowSize.js +20 -20
- package/build/cjs/themes/globalStyles.js +4 -4
- package/build/cjs/themes/gridTheme.js +1 -1
- package/build/cjs/themes/theme.js +12 -12
- package/build/cjs/themes/themeComponents/base.js +9 -8
- package/build/cjs/themes/themeComponents/breakpoints.js +6 -6
- package/build/cjs/themes/themeComponents/color.js +76 -74
- package/build/cjs/themes/themeComponents/fontFamily.js +3 -3
- package/build/cjs/themes/themeComponents/fontSize.js +31 -15
- package/build/cjs/themes/themeComponents/fontWeight.js +16 -16
- package/build/cjs/themes/themeComponents/forms.js +3 -2
- package/build/cjs/themes/themeComponents/layout.js +27 -27
- package/build/cjs/themes/themeComponents/lineHeight.js +32 -16
- package/build/cjs/themes/themeComponents/navigation.js +13 -13
- package/build/cjs/themes/themeComponents/radius.js +26 -26
- package/build/cjs/utils/common.js +15 -19
- package/build/cjs/utils/createStyled.d.ts +154 -134
- package/build/cjs/utils/createStyled.js +16 -2
- package/build/cjs/utils/styledUtils.js +2 -6
- package/build/es/_virtual/_virtual_inject.js +3 -0
- package/build/es/assets/fonts/fonts.css.js +3 -1
- package/build/es/components/Accordion/Accordion.js +66 -54
- package/build/es/components/AccordionItem/AccordionItem.js +94 -73
- package/build/es/components/AmountSelector/AmountSelector.js +121 -134
- package/build/es/components/Box/Box.js +38 -13
- package/build/es/components/Breadcrumb/Breadcrumb.js +73 -71
- package/build/es/components/Button/Button.d.ts +1 -1
- package/build/es/components/Button/Button.js +131 -127
- package/build/es/components/ButtonArrow/ButtonArrow.js +47 -49
- package/build/es/components/ButtonCard/ButtonCard.d.ts +2 -2
- package/build/es/components/ButtonCard/ButtonCard.js +97 -112
- package/build/es/components/ButtonClose/ButtonClose.d.ts +1 -1
- package/build/es/components/ButtonClose/ButtonClose.js +25 -14
- package/build/es/components/ButtonIcon/ButtonIcon.d.ts +44 -3
- package/build/es/components/ButtonIcon/ButtonIcon.js +105 -67
- package/build/es/components/ButtonPrimary/ButtonPrimary.d.ts +43 -2
- package/build/es/components/ButtonPrimary/ButtonPrimary.js +7 -35
- package/build/es/components/ButtonSecondary/ButtonSecondary.d.ts +43 -2
- package/build/es/components/ButtonSecondary/ButtonSecondary.js +7 -35
- package/build/es/components/Carousel/Carousel.d.ts +8 -2
- package/build/es/components/Carousel/Carousel.js +315 -346
- package/build/es/components/Checkbox/Checkbox.js +49 -108
- package/build/es/components/Chip/Chip.js +40 -34
- package/build/es/components/DateTimePicker/DateTimePicker.js +198 -334
- package/build/es/components/Divider/Divider.js +29 -15
- package/build/es/components/DnaLogo/DnaLogo.js +87 -51
- package/build/es/components/Drawer/Drawer.js +172 -167
- package/build/es/components/EmptyState/EmptyState.js +24 -12
- package/build/es/components/EnergyLabel/EnergyLabel.js +77 -73
- package/build/es/components/Expander/Expander.js +43 -38
- package/build/es/components/Floater/Floater.js +36 -14
- package/build/es/components/Footer/Components/FooterComponents.d.ts +4 -2
- package/build/es/components/Footer/Components/FooterComponents.js +305 -346
- package/build/es/components/Footer/Footer.js +51 -80
- package/build/es/components/Footer/context/FooterContext.js +9 -9
- package/build/es/components/Hero/Hero.js +101 -149
- package/build/es/components/Icon/Icon.js +41 -22
- package/build/es/components/Icons/Small/hlArrowBackSmall.js +12 -4
- package/build/es/components/Icons/Small/hlArrowForwardSmall.js +12 -4
- package/build/es/components/Icons/Small/hlArrowUnderSmall.js +12 -4
- package/build/es/components/Icons/Small/hlCalendarSmall.js +12 -4
- package/build/es/components/Icons/Small/hlChevronDownSmall.js +12 -4
- package/build/es/components/Icons/Small/hlChevronLeftSmall.js +12 -4
- package/build/es/components/Icons/Small/hlChevronRightSmall.js +12 -4
- package/build/es/components/Icons/Small/hlChevronUpSmall.js +12 -4
- package/build/es/components/Icons/Small/hlClockSmall.js +14 -5
- package/build/es/components/Icons/Small/hlDownloadSmall.js +18 -6
- package/build/es/components/Icons/Small/hlExternalSmall.js +12 -4
- package/build/es/components/Icons/Small/hlUploadSmall.js +18 -6
- package/build/es/components/Icons/Social/facebook.js +13 -4
- package/build/es/components/Icons/Social/instagram.js +13 -4
- package/build/es/components/Icons/Social/linkedin.js +13 -4
- package/build/es/components/Icons/Social/tiktok.js +12 -4
- package/build/es/components/Icons/Social/twitter.js +13 -4
- package/build/es/components/Icons/Social/youtube.js +12 -4
- package/build/es/components/Icons/hl404.js +12 -4
- package/build/es/components/Icons/hl4gSim.js +12 -4
- package/build/es/components/Icons/hl5gSim.js +12 -4
- package/build/es/components/Icons/hlBattery.js +16 -6
- package/build/es/components/Icons/hlBell.js +12 -4
- package/build/es/components/Icons/hlCableTVCard.js +12 -4
- package/build/es/components/Icons/hlCalendar.js +56 -15
- package/build/es/components/Icons/hlCall.js +12 -4
- package/build/es/components/Icons/hlCameraBack.js +18 -6
- package/build/es/components/Icons/hlCameraFront.js +14 -5
- package/build/es/components/Icons/hlCart.js +16 -6
- package/build/es/components/Icons/hlCartEmpty.js +16 -6
- package/build/es/components/Icons/hlChat.js +24 -7
- package/build/es/components/Icons/hlCheck.js +12 -4
- package/build/es/components/Icons/hlChevronDown.js +12 -4
- package/build/es/components/Icons/hlChevronLeft.js +12 -4
- package/build/es/components/Icons/hlChevronRight.js +12 -4
- package/build/es/components/Icons/hlChevronUp.js +12 -4
- package/build/es/components/Icons/hlCompensation.js +12 -4
- package/build/es/components/Icons/hlCookie.js +12 -4
- package/build/es/components/Icons/hlCopy.js +14 -5
- package/build/es/components/Icons/hlCoupon.js +16 -6
- package/build/es/components/Icons/hlDelivery.js +14 -4
- package/build/es/components/Icons/hlDigiturva.js +14 -4
- package/build/es/components/Icons/hlDisplaySize.js +19 -6
- package/build/es/components/Icons/hlDocument.js +14 -5
- package/build/es/components/Icons/hlDownload.js +18 -6
- package/build/es/components/Icons/hlEnvelope.js +12 -4
- package/build/es/components/Icons/hlError.js +22 -6
- package/build/es/components/Icons/hlEuro.js +12 -4
- package/build/es/components/Icons/hlExclamationMark.js +12 -4
- package/build/es/components/Icons/hlExpand.js +12 -4
- package/build/es/components/Icons/hlExternal.js +12 -4
- package/build/es/components/Icons/hlEyeClosed.js +12 -4
- package/build/es/components/Icons/hlEyeOpen.js +14 -5
- package/build/es/components/Icons/hlFaceId.js +12 -4
- package/build/es/components/Icons/hlFastDelivery.js +12 -4
- package/build/es/components/Icons/hlFingerprint.js +20 -8
- package/build/es/components/Icons/hlGlobe.js +12 -4
- package/build/es/components/Icons/hlHeadphones.js +12 -4
- package/build/es/components/Icons/hlHeadset.js +18 -6
- package/build/es/components/Icons/hlHeart.js +12 -4
- package/build/es/components/Icons/hlHome.js +12 -4
- package/build/es/components/Icons/hlHub.js +14 -5
- package/build/es/components/Icons/hlImage.js +12 -4
- package/build/es/components/Icons/hlInfo.js +18 -6
- package/build/es/components/Icons/hlInstallment.js +14 -5
- package/build/es/components/Icons/hlIotSim.js +14 -5
- package/build/es/components/Icons/hlLaptop.js +13 -4
- package/build/es/components/Icons/hlLink.js +16 -5
- package/build/es/components/Icons/hlLiveVideo.js +12 -4
- package/build/es/components/Icons/hlLock.js +18 -6
- package/build/es/components/Icons/hlMagnifyingGlass.js +14 -5
- package/build/es/components/Icons/hlMarker.js +14 -5
- package/build/es/components/Icons/hlMemory.js +14 -5
- package/build/es/components/Icons/hlMenu.js +12 -4
- package/build/es/components/Icons/hlMinimize.js +12 -4
- package/build/es/components/Icons/hlMinus.js +12 -4
- package/build/es/components/Icons/hlMobileData.js +12 -4
- package/build/es/components/Icons/hlMobilePayment.js +19 -6
- package/build/es/components/Icons/hlModem.js +26 -8
- package/build/es/components/Icons/hlMore.js +22 -6
- package/build/es/components/Icons/hlOs.js +14 -5
- package/build/es/components/Icons/hlPackage.js +12 -4
- package/build/es/components/Icons/hlPaperclip.js +12 -4
- package/build/es/components/Icons/hlPaytime.js +12 -4
- package/build/es/components/Icons/hlPen.js +12 -4
- package/build/es/components/Icons/hlPerson.js +12 -4
- package/build/es/components/Icons/hlPhone.js +17 -5
- package/build/es/components/Icons/hlPlaylist.js +13 -4
- package/build/es/components/Icons/hlPlus.js +14 -5
- package/build/es/components/Icons/hlPrepaid.js +12 -4
- package/build/es/components/Icons/hlProcessor.js +14 -5
- package/build/es/components/Icons/hlServices.js +12 -4
- package/build/es/components/Icons/hlSettings.js +12 -4
- package/build/es/components/Icons/hlShield.js +14 -5
- package/build/es/components/Icons/hlSim.js +14 -5
- package/build/es/components/Icons/hlSimSimple.js +18 -6
- package/build/es/components/Icons/hlSmile.js +22 -7
- package/build/es/components/Icons/hlSpeechBubble.js +14 -5
- package/build/es/components/Icons/hlSquaretrade.js +13 -4
- package/build/es/components/Icons/hlStar.js +12 -4
- package/build/es/components/Icons/hlStarFilled.js +12 -4
- package/build/es/components/Icons/hlTrash.js +14 -5
- package/build/es/components/Icons/hlTv.js +12 -4
- package/build/es/components/Icons/hlUnlock.js +14 -6
- package/build/es/components/Icons/hlUpload.js +18 -6
- package/build/es/components/Icons/hlWarning.js +18 -6
- package/build/es/components/Icons/hlWifi.js +18 -6
- package/build/es/components/Icons/hlWrench.js +12 -4
- package/build/es/components/Icons/hlX.js +12 -4
- package/build/es/components/InfoDialog/InfoDialog.js +31 -46
- package/build/es/components/Input/Input.js +143 -159
- package/build/es/components/Label/Label.js +22 -22
- package/build/es/components/LabelText/LabelText.js +24 -17
- package/build/es/components/MainHeaderNavigation/ChildComponents/BusinessMenu.js +29 -44
- package/build/es/components/MainHeaderNavigation/ChildComponents/DesktopMenu.js +167 -153
- package/build/es/components/MainHeaderNavigation/ChildComponents/LanguageSelector.js +34 -20
- package/build/es/components/MainHeaderNavigation/ChildComponents/LinkModifier.js +50 -32
- package/build/es/components/MainHeaderNavigation/ChildComponents/LoginTooltip.js +17 -5
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.d.ts +5 -2
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenu.js +100 -95
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.d.ts +6 -2
- package/build/es/components/MainHeaderNavigation/ChildComponents/MainNavTooltipMenuExportedStyles.js +4 -58
- package/build/es/components/MainHeaderNavigation/ChildComponents/MinicartTooltip.js +20 -4
- package/build/es/components/MainHeaderNavigation/ChildComponents/MobileMenu.js +187 -159
- package/build/es/components/MainHeaderNavigation/ChildComponents/PageSearch.js +16 -5
- package/build/es/components/MainHeaderNavigation/MainHeaderNavigation.js +305 -272
- package/build/es/components/MainHeaderNavigation/context/NavContext.js +61 -49
- package/build/es/components/MainHeaderNavigation/globalNavStyles.d.ts +31 -16
- package/build/es/components/MainHeaderNavigation/globalNavStyles.js +39 -172
- package/build/es/components/Modal/Modal.js +127 -145
- package/build/es/components/Notification/Notification.js +74 -54
- package/build/es/components/NotificationBadge/NotificationBadge.js +29 -32
- package/build/es/components/Overlay/Overlay.js +70 -68
- package/build/es/components/Pill/Pill.js +91 -82
- package/build/es/components/PillGroup/PillGroup.js +50 -33
- package/build/es/components/PixelLoader/PixelLoader.js +37 -34
- package/build/es/components/PriorityNavigation/PriorityNavigation.js +281 -303
- package/build/es/components/PriorityNavigationItem/PriorityNavigationItem.js +27 -49
- package/build/es/components/ProgressIndicator/ProgressIndicator.js +140 -109
- package/build/es/components/RadioButton/RadioButton.js +91 -114
- package/build/es/components/ReadMore/ReadMore.js +86 -69
- package/build/es/components/Search/Search.js +52 -64
- package/build/es/components/Selectbox/Selectbox.js +279 -94
- package/build/es/components/Skeleton/Skeleton.js +69 -56
- package/build/es/components/Switch/Switch.js +62 -76
- package/build/es/components/Tab/Tab.js +55 -53
- package/build/es/components/Tabs/Tabs.js +93 -71
- package/build/es/components/Textarea/Textarea.js +76 -73
- package/build/es/components/Toaster/Toaster.js +59 -44
- package/build/es/components/Tooltip/Tooltip.js +74 -87
- package/build/es/hooks/useCloseOutsideOrElementClicked.js +23 -21
- package/build/es/hooks/useDebounce.js +9 -9
- package/build/es/hooks/useDocHeight.js +13 -13
- package/build/es/hooks/useOutsideClick.js +10 -10
- package/build/es/hooks/useResizeObserver.js +37 -24
- package/build/es/hooks/useScrollPosition.js +55 -54
- package/build/es/hooks/useWindowSize.js +20 -20
- package/build/es/themes/globalStyles.js +4 -4
- package/build/es/themes/gridTheme.js +1 -1
- package/build/es/themes/theme.js +12 -12
- package/build/es/themes/themeComponents/base.js +9 -8
- package/build/es/themes/themeComponents/breakpoints.js +6 -6
- package/build/es/themes/themeComponents/color.js +76 -74
- package/build/es/themes/themeComponents/fontFamily.js +3 -3
- package/build/es/themes/themeComponents/fontSize.js +31 -15
- package/build/es/themes/themeComponents/fontWeight.js +16 -16
- package/build/es/themes/themeComponents/forms.js +3 -2
- package/build/es/themes/themeComponents/layout.js +27 -27
- package/build/es/themes/themeComponents/lineHeight.js +32 -16
- package/build/es/themes/themeComponents/navigation.js +13 -13
- package/build/es/themes/themeComponents/radius.js +26 -26
- package/build/es/utils/common.js +15 -19
- package/build/es/utils/createStyled.d.ts +154 -134
- package/build/es/utils/createStyled.js +16 -2
- package/build/es/utils/styledUtils.js +2 -6
- package/package.json +19 -17
|
@@ -5,63 +5,75 @@ import theme from '../../themes/theme.js';
|
|
|
5
5
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
6
6
|
import AccordionItem from '../AccordionItem/AccordionItem.js';
|
|
7
7
|
|
|
8
|
-
const AccordionContainer = styled.div
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
margin: ${getMultipliedSize(theme.base.baseHeight, 1)} 0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
& > *:first-of-type {
|
|
16
|
-
margin-top: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
& > *:last-of-type {
|
|
20
|
-
margin-bottom: 0;
|
|
21
|
-
}
|
|
22
|
-
`}
|
|
23
|
-
`;
|
|
8
|
+
const AccordionContainer = styled.div.withConfig({
|
|
9
|
+
displayName: "Accordion__AccordionContainer",
|
|
10
|
+
componentId: "sc-3uv127-0"
|
|
11
|
+
})(["", ""], p => p.type === 'box' && css(["& > *{margin:", " 0;}& > *:first-of-type{margin-top:0;}& > *:last-of-type{margin-bottom:0;}"], getMultipliedSize(theme.base.baseHeight, 1)));
|
|
24
12
|
/** @visibleName Accordion */
|
|
25
|
-
const Accordion =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
setItemList(Object.assign(Object.assign({}, (autoCollapsible ? {} : itemList)), { [currentItemId]: !currentItemState }));
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const handleClick = (e) => {
|
|
44
|
-
var _a, _b;
|
|
45
|
-
toggleExpanded((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.id);
|
|
46
|
-
};
|
|
47
|
-
const handleKeyDown = (e) => {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
toggleExpanded((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.id);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const accordionItems = Children.map(props.children, (child, index) => {
|
|
55
|
-
if (isValidElement(child) && child.type === AccordionItem) {
|
|
56
|
-
const id = getAccordionItemId(index, child.props.title);
|
|
57
|
-
return (React__default.createElement(AccordionItem, { id: id, key: id, type: type, title: child.props.title, isExpanded: itemList[id], highlightSelected: highlightSelected, hasCloseButton: hasCloseButton, openLabel: props.openLabel, closeLabel: props.closeLabel, onClick: handleClick, onKeyDown: handleKeyDown, className: child.props.className }, child.props.children));
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
13
|
+
const Accordion = _a => {
|
|
14
|
+
var {
|
|
15
|
+
type = 'box',
|
|
16
|
+
autoCollapsible = false,
|
|
17
|
+
highlightSelected = type === 'panel',
|
|
18
|
+
hasCloseButton = false
|
|
19
|
+
} = _a,
|
|
20
|
+
props = __rest(_a, ["type", "autoCollapsible", "highlightSelected", "hasCloseButton"]);
|
|
21
|
+
const initialItemList = {};
|
|
22
|
+
const getAccordionItemId = (index, title) => `${title.replace(/\s+/g, '')}-${index}`;
|
|
23
|
+
if (props.isExpanded) {
|
|
24
|
+
Children.map(props.children, (child, index) => {
|
|
25
|
+
if (/*#__PURE__*/isValidElement(child) && child.type === AccordionItem) {
|
|
26
|
+
initialItemList[getAccordionItemId(index, child.props.title)] = Boolean(props.isExpanded);
|
|
27
|
+
}
|
|
60
28
|
});
|
|
61
|
-
|
|
62
|
-
|
|
29
|
+
}
|
|
30
|
+
const [itemList, setItemList] = useState(initialItemList);
|
|
31
|
+
const toggleExpanded = currentItemId => {
|
|
32
|
+
if (currentItemId) {
|
|
33
|
+
const currentItemState = itemList[currentItemId];
|
|
34
|
+
setItemList(Object.assign(Object.assign({}, autoCollapsible ? {} : itemList), {
|
|
35
|
+
[currentItemId]: !currentItemState
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const handleClick = e => {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
toggleExpanded((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.id);
|
|
42
|
+
};
|
|
43
|
+
const handleKeyDown = e => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
toggleExpanded((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.id);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const accordionItems = Children.map(props.children, (child, index) => {
|
|
51
|
+
if (/*#__PURE__*/isValidElement(child) && child.type === AccordionItem) {
|
|
52
|
+
const id = getAccordionItemId(index, child.props.title);
|
|
53
|
+
return /*#__PURE__*/React__default.createElement(AccordionItem, {
|
|
54
|
+
id: id,
|
|
55
|
+
key: id,
|
|
56
|
+
type: type,
|
|
57
|
+
title: child.props.title,
|
|
58
|
+
isExpanded: itemList[id],
|
|
59
|
+
highlightSelected: highlightSelected,
|
|
60
|
+
hasCloseButton: hasCloseButton,
|
|
61
|
+
openLabel: props.openLabel,
|
|
62
|
+
closeLabel: props.closeLabel,
|
|
63
|
+
onClick: handleClick,
|
|
64
|
+
onKeyDown: handleKeyDown,
|
|
65
|
+
className: child.props.className
|
|
66
|
+
}, child.props.children);
|
|
63
67
|
}
|
|
64
|
-
return
|
|
68
|
+
return null;
|
|
69
|
+
});
|
|
70
|
+
if (!accordionItems) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return /*#__PURE__*/React__default.createElement(AccordionContainer, {
|
|
74
|
+
type: type,
|
|
75
|
+
className: props.className
|
|
76
|
+
}, accordionItems);
|
|
65
77
|
};
|
|
66
78
|
|
|
67
79
|
export { Accordion as default };
|
|
@@ -8,80 +8,101 @@ import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
|
8
8
|
import Box from '../Box/Box.js';
|
|
9
9
|
import Icon from '../Icon/Icon.js';
|
|
10
10
|
|
|
11
|
-
const AccordionItemContainer = styled.div
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
${p => p.$highlightSelected &&
|
|
32
|
-
css `
|
|
33
|
-
&:hover,
|
|
34
|
-
&:active {
|
|
35
|
-
color: ${theme.color.default.pink};
|
|
36
|
-
text-decoration: none;
|
|
37
|
-
}
|
|
38
|
-
`}
|
|
39
|
-
`;
|
|
40
|
-
const AccordionItemContentWrapper = styled.div `
|
|
41
|
-
overflow: hidden;
|
|
42
|
-
transition: all 0.2s ease;
|
|
43
|
-
height: ${p => (p.$isExpanded ? p.$maxHeight / 16 + 1.25 : 0)}rem;
|
|
44
|
-
padding: 0 ${getMultipliedSize(theme.base.baseHeight, 2)};
|
|
45
|
-
visibility: ${p => (p.$isExpanded ? 'visible' : 'hidden')};
|
|
46
|
-
`;
|
|
47
|
-
const AccordionItemContent = styled.div `
|
|
48
|
-
padding-bottom: ${getMultipliedSize(theme.base.baseHeight, 1.6)};
|
|
49
|
-
`;
|
|
50
|
-
const AccordionItemCloseButton = styled.div `
|
|
51
|
-
display: flex;
|
|
52
|
-
justify-content: flex-end;
|
|
53
|
-
line-height: ${theme.lineHeight.default};
|
|
54
|
-
margin-bottom: ${getMultipliedSize(theme.base.baseHeight, 1.6)};
|
|
55
|
-
padding: 0 ${getMultipliedSize(theme.base.baseHeight, 2)};
|
|
56
|
-
gap: ${getMultipliedSize(theme.base.baseHeight, 1)};
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
`;
|
|
11
|
+
const AccordionItemContainer = styled.div.withConfig({
|
|
12
|
+
displayName: "AccordionItem__AccordionItemContainer",
|
|
13
|
+
componentId: "sc-1xo11yu-0"
|
|
14
|
+
})(["", ""], p => p.type === 'panel' && css(["border-bottom:1px solid ", ";"], theme.color.line.L02));
|
|
15
|
+
const AccordionItemTitle = styled.div.withConfig({
|
|
16
|
+
displayName: "AccordionItem__AccordionItemTitle",
|
|
17
|
+
componentId: "sc-1xo11yu-1"
|
|
18
|
+
})(["font-size:", ";line-height:", ";font-weight:", ";display:flex;justify-content:space-between;flex-direction:row;cursor:", ";padding:", " ", ";color:", ";transition:color 0.2s;", ""], theme.fontSize.default, theme.lineHeight.default, theme.fontWeight.bold, p => p.$showPointer ? 'pointer' : 'default', getMultipliedSize(theme.base.baseHeight, 1.6), getMultipliedSize(theme.base.baseHeight, 2), p => p.$isExpanded && p.$highlightSelected ? theme.color.default.pink : theme.color.default.black, p => p.$highlightSelected && css(["&:hover,&:active{color:", ";text-decoration:none;}"], theme.color.default.pink));
|
|
19
|
+
const AccordionItemContentWrapper = styled.div.withConfig({
|
|
20
|
+
displayName: "AccordionItem__AccordionItemContentWrapper",
|
|
21
|
+
componentId: "sc-1xo11yu-2"
|
|
22
|
+
})(["overflow:hidden;transition:all 0.2s ease;height:", "rem;padding:0 ", ";visibility:", ";"], p => p.$isExpanded ? p.$maxHeight / 16 + 1.25 : 0, getMultipliedSize(theme.base.baseHeight, 2), p => p.$isExpanded ? 'visible' : 'hidden');
|
|
23
|
+
const AccordionItemContent = styled.div.withConfig({
|
|
24
|
+
displayName: "AccordionItem__AccordionItemContent",
|
|
25
|
+
componentId: "sc-1xo11yu-3"
|
|
26
|
+
})(["padding-bottom:", ";"], getMultipliedSize(theme.base.baseHeight, 1.6));
|
|
27
|
+
const AccordionItemCloseButton = styled.div.withConfig({
|
|
28
|
+
displayName: "AccordionItem__AccordionItemCloseButton",
|
|
29
|
+
componentId: "sc-1xo11yu-4"
|
|
30
|
+
})(["display:flex;justify-content:flex-end;line-height:", ";margin-bottom:", ";padding:0 ", ";gap:", ";cursor:pointer;"], theme.lineHeight.default, getMultipliedSize(theme.base.baseHeight, 1.6), getMultipliedSize(theme.base.baseHeight, 2), getMultipliedSize(theme.base.baseHeight, 1));
|
|
59
31
|
/** @visibleName Accordion Item */
|
|
60
|
-
const AccordionItem =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
32
|
+
const AccordionItem = _a => {
|
|
33
|
+
var _b, _c;
|
|
34
|
+
var {
|
|
35
|
+
'data-testid': dataTestId = 'accordion-item',
|
|
36
|
+
type = 'box',
|
|
37
|
+
hasCloseButton = false,
|
|
38
|
+
highlightSelected = type === 'panel'
|
|
39
|
+
} = _a,
|
|
40
|
+
props = __rest(_a, ['data-testid', "type", "hasCloseButton", "highlightSelected"]);
|
|
41
|
+
const contentRef = useRef(null);
|
|
42
|
+
const accordionButtonRef = useRef(null);
|
|
43
|
+
// Get height when element dimensions change
|
|
44
|
+
const {
|
|
45
|
+
height: contentHeight
|
|
46
|
+
} = useResizeObserver(contentRef);
|
|
47
|
+
const accordionContentId = `accordion-content-id-${(_b = props.id) !== null && _b !== void 0 ? _b : ''}`;
|
|
48
|
+
const accordionButtonId = `accordion-button-id-${(_c = props.id) !== null && _c !== void 0 ? _c : ''}`;
|
|
49
|
+
const handleInteraction = (callback, event) => {
|
|
50
|
+
callback === null || callback === void 0 ? void 0 : callback(event);
|
|
51
|
+
if (accordionButtonRef.current) accordionButtonRef.current.focus();
|
|
52
|
+
};
|
|
53
|
+
const hasFunctionality = Boolean(props.onClick || props.onKeyDown);
|
|
54
|
+
const itemContent = /*#__PURE__*/React__default.createElement(AccordionItemContainer, {
|
|
55
|
+
id: props.id,
|
|
56
|
+
type: type,
|
|
57
|
+
className: props.className,
|
|
58
|
+
"data-testid": dataTestId
|
|
59
|
+
}, /*#__PURE__*/React__default.createElement(AccordionItemTitle, {
|
|
60
|
+
ref: accordionButtonRef,
|
|
61
|
+
id: accordionButtonId,
|
|
62
|
+
tabIndex: hasFunctionality ? 0 : -1,
|
|
63
|
+
onClick: props.onClick,
|
|
64
|
+
onKeyDown: props.onKeyDown,
|
|
65
|
+
"$isExpanded": Boolean(props.isExpanded),
|
|
66
|
+
"$highlightSelected": highlightSelected,
|
|
67
|
+
"aria-expanded": Boolean(props.isExpanded),
|
|
68
|
+
"aria-controls": accordionContentId,
|
|
69
|
+
"$showPointer": hasFunctionality,
|
|
70
|
+
"data-testid": `${dataTestId}-title`,
|
|
71
|
+
role: "button"
|
|
72
|
+
}, props.title, props.isExpanded ? (/*#__PURE__*/React__default.createElement(Icon, {
|
|
73
|
+
icon: ChevronUp,
|
|
74
|
+
color: theme.color.default.black,
|
|
75
|
+
position: "right",
|
|
76
|
+
"aria-label": props.closeLabel
|
|
77
|
+
})) : (/*#__PURE__*/React__default.createElement(Icon, {
|
|
78
|
+
icon: ChevronDown,
|
|
79
|
+
color: theme.color.default.black,
|
|
80
|
+
position: "right",
|
|
81
|
+
"aria-label": props.openLabel
|
|
82
|
+
}))), /*#__PURE__*/React__default.createElement(AccordionItemContentWrapper, {
|
|
83
|
+
"$maxHeight": contentHeight,
|
|
84
|
+
"$isExpanded": props.isExpanded,
|
|
85
|
+
"aria-labelledby": accordionButtonId,
|
|
86
|
+
"aria-hidden": !props.isExpanded,
|
|
87
|
+
"data-testid": `${dataTestId}-content`,
|
|
88
|
+
role: "region"
|
|
89
|
+
}, /*#__PURE__*/React__default.createElement(AccordionItemContent, {
|
|
90
|
+
id: accordionContentId,
|
|
91
|
+
ref: contentRef
|
|
92
|
+
}, props.children)), hasCloseButton && props.isExpanded && (/*#__PURE__*/React__default.createElement(AccordionItemCloseButton, {
|
|
93
|
+
tabIndex: 0,
|
|
94
|
+
onClick: e => handleInteraction(props.onClick, e),
|
|
95
|
+
onKeyDown: e => handleInteraction(props.onKeyDown, e),
|
|
96
|
+
"aria-label": props.closeLabel,
|
|
97
|
+
"data-testid": `${dataTestId}-close-button`,
|
|
98
|
+
role: "button"
|
|
99
|
+
}, /*#__PURE__*/React__default.createElement("span", null, props.closeLabel), /*#__PURE__*/React__default.createElement(Icon, {
|
|
100
|
+
icon: Close
|
|
101
|
+
}))));
|
|
102
|
+
return type === 'box' ? (/*#__PURE__*/React__default.createElement(Box, {
|
|
103
|
+
elevation: props.isExpanded ? 'low' : 'none',
|
|
104
|
+
padding: "0"
|
|
105
|
+
}, itemContent)) : itemContent;
|
|
85
106
|
};
|
|
86
107
|
|
|
87
108
|
export { AccordionItem as default };
|
|
@@ -6,147 +6,134 @@ import theme from '../../themes/theme.js';
|
|
|
6
6
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
7
7
|
import ButtonArrow from '../ButtonArrow/ButtonArrow.js';
|
|
8
8
|
|
|
9
|
-
const Container = styled.div
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const Button = styled(ButtonArrow)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
const Container = styled.div.withConfig({
|
|
10
|
+
displayName: "AmountSelector__Container",
|
|
11
|
+
componentId: "sc-1m6b253-0"
|
|
12
|
+
})(["display:flex;width:", ";"], getMultipliedSize(theme.base.baseWidth, 12));
|
|
13
|
+
const Button = styled(ButtonArrow).withConfig({
|
|
14
|
+
displayName: "AmountSelector__Button",
|
|
15
|
+
componentId: "sc-1m6b253-1"
|
|
16
|
+
})(["display:inline-flex;width:", ";height:", ";border-radius:0;&:first-of-type{border-top-left-radius:", ";border-bottom-left-radius:", ";&:focus{z-index:2;}}&:last-of-type{border-top-right-radius:", ";border-bottom-right-radius:", ";}&:disabled,&[disabled]{background-color:", ";border:1px solid ", ";pointer-events:auto;cursor:not-allowed;svg{opacity:0.3;}}"], getMultipliedSize(theme.base.baseWidth, 4), getMultipliedSize(theme.base.baseHeight, 4), theme.radius.s, theme.radius.s, theme.radius.s, theme.radius.s, theme.color.background.sand.E02 + theme.color.transparency.T30, theme.color.line.L01);
|
|
17
|
+
const Input = styled.input.withConfig({
|
|
18
|
+
displayName: "AmountSelector__Input",
|
|
19
|
+
componentId: "sc-1m6b253-2"
|
|
20
|
+
})(["width:", ";height:", ";font-family:", ";font-size:", ";text-align:center;border:0 none;border-radius:0;border-top:1px solid ", ";border-bottom:1px solid ", ";&:focus{border:2px solid ", ";box-shadow:0px 0px 0px 2px ", ";outline:none;z-index:2;}&:disabled,&[disabled]{background-color:", ";border:1px solid ", ";svg{opacity:0.3;}}&:read-only{pointer-events:none;}&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{display:none;}-webkit-appearance:none;-moz-appearance:textfield;"], getMultipliedSize(theme.base.baseWidth, 4), getMultipliedSize(theme.base.baseHeight, 4), theme.fontFamily.default, theme.fontSize.default, theme.color.line.L01, theme.color.line.L01, theme.color.focus.light, theme.color.focus.dark, theme.color.background.sand.E02 + theme.color.transparency.T30, theme.color.transparency.T30 + theme.color.line.L01);
|
|
21
|
+
/** @visibleName Amount Selector */
|
|
22
|
+
const AmountSelector = _a => {
|
|
23
|
+
var {
|
|
24
|
+
onChange,
|
|
25
|
+
value = 1,
|
|
26
|
+
step = 1,
|
|
27
|
+
min = 1,
|
|
28
|
+
max,
|
|
29
|
+
disabled = false,
|
|
30
|
+
readonly = true,
|
|
31
|
+
'data-testid': dataTestId,
|
|
32
|
+
increaseButtonAriaLabel,
|
|
33
|
+
decreaseButtonAriaLabel,
|
|
34
|
+
removeButtonAriaLabel,
|
|
35
|
+
inputAriaLabel
|
|
36
|
+
} = _a,
|
|
37
|
+
props = __rest(_a, ["onChange", "value", "step", "min", "max", "disabled", "readonly", 'data-testid', "increaseButtonAriaLabel", "decreaseButtonAriaLabel", "removeButtonAriaLabel", "inputAriaLabel"]);
|
|
38
|
+
const isMinReached = val => val < min;
|
|
39
|
+
const isMaxReached = val => Boolean(max && val > max);
|
|
40
|
+
const isInRange = val => !isMinReached(val) && !isMaxReached(val);
|
|
41
|
+
const increase = () => {
|
|
42
|
+
const newValue = value + step;
|
|
43
|
+
if (!isMaxReached(newValue) && !disabled) {
|
|
44
|
+
onChange(newValue);
|
|
26
45
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
46
|
+
};
|
|
47
|
+
const decrease = () => {
|
|
48
|
+
const newValue = value - step;
|
|
49
|
+
if (!disabled && (!isMinReached(newValue) || props.removable)) {
|
|
50
|
+
onChange(newValue);
|
|
31
51
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
};
|
|
53
|
+
const handleChange = event => {
|
|
54
|
+
if (event.target.value) {
|
|
55
|
+
const integerInputValue = parseInt(event.target.value, 10);
|
|
56
|
+
if (isInRange(integerInputValue)) {
|
|
57
|
+
onChange(integerInputValue);
|
|
58
|
+
} else {
|
|
59
|
+
onChange(max && isMaxReached(integerInputValue) ? max : min);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
onChange(min);
|
|
42
63
|
}
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
font-family: ${theme.fontFamily.default};
|
|
48
|
-
font-size: ${theme.fontSize.default};
|
|
49
|
-
text-align: center;
|
|
50
|
-
border: 0 none;
|
|
51
|
-
border-radius: 0;
|
|
52
|
-
border-top: 1px solid ${theme.color.line.L01};
|
|
53
|
-
border-bottom: 1px solid ${theme.color.line.L01};
|
|
54
|
-
|
|
55
|
-
&:focus {
|
|
56
|
-
border: 2px solid ${theme.color.focus.light};
|
|
57
|
-
box-shadow: 0px 0px 0px 2px ${theme.color.focus.dark};
|
|
58
|
-
outline: none;
|
|
59
|
-
z-index: 2;
|
|
64
|
+
};
|
|
65
|
+
const getMinButtonAriaLabel = () => {
|
|
66
|
+
if (props.removable && isMinReached(value - step)) {
|
|
67
|
+
return removeButtonAriaLabel;
|
|
60
68
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
&[disabled] {
|
|
64
|
-
background-color: ${theme.color.background.sand.E02 + theme.color.transparency.T30};
|
|
65
|
-
border: 1px solid ${theme.color.transparency.T30 + theme.color.line.L01};
|
|
66
|
-
svg {
|
|
67
|
-
opacity: 0.3;
|
|
68
|
-
}
|
|
69
|
+
if (decreaseButtonAriaLabel) {
|
|
70
|
+
return decreaseButtonAriaLabel;
|
|
69
71
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
return undefined;
|
|
73
|
+
};
|
|
74
|
+
const handleKeyDown = e => {
|
|
75
|
+
const allowedKeys = new Set(['Tab', 'Backspace', 'Delete', 'ArrowLeft', 'ArrowRight']);
|
|
76
|
+
if (/^[0-9]$/.test(e.key) || allowedKeys.has(e.key)) {
|
|
77
|
+
return;
|
|
73
78
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
if (e.key === 'ArrowUp') {
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
if (!isMaxReached(value + step)) {
|
|
82
|
+
onChange(value + step);
|
|
83
|
+
}
|
|
84
|
+
return;
|
|
78
85
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
e.preventDefault();
|
|
131
|
-
if (!isMaxReached(value + step)) {
|
|
132
|
-
onChange(value + step);
|
|
133
|
-
}
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
if (e.key === 'ArrowDown') {
|
|
137
|
-
e.preventDefault();
|
|
138
|
-
if (!isMinReached(value - step)) {
|
|
139
|
-
onChange(value - step);
|
|
140
|
-
}
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
e.preventDefault();
|
|
144
|
-
};
|
|
145
|
-
return (React__default.createElement(Container, { "data-testid": dataTestId, className: props.className },
|
|
146
|
-
React__default.createElement(Button, { icon: props.removable && isMinReached(value - step) ? (React__default.createElement(Trash, { size: getMultipliedSize(theme.base.baseWidth, 2) })) : (React__default.createElement(Minus, { size: getMultipliedSize(theme.base.baseWidth, 2) })), variant: "secondary", onClick: decrease, disabled: disabled || (isMinReached(value - step) && !props.removable), type: "button", "aria-label": getMinButtonAriaLabel(), "data-testid": dataTestId &&
|
|
147
|
-
`${dataTestId}${props.removable && isMinReached(value - step) ? '-remove' : '-decrease'}` }),
|
|
148
|
-
React__default.createElement(Input, { id: props.id, name: props.name, type: "number", onChange: handleChange, value: value, min: min, max: max, step: step, readOnly: readonly || disabled, disabled: disabled, "aria-label": inputAriaLabel, onKeyDown: handleKeyDown, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value }),
|
|
149
|
-
React__default.createElement(Button, { icon: React__default.createElement(Plus, { size: getMultipliedSize(theme.base.baseWidth, 2) }), variant: "secondary", onClick: increase, disabled: disabled || isMaxReached(value + step), type: "button", "aria-label": increaseButtonAriaLabel || undefined, "data-testid": dataTestId ? `${dataTestId}-increase` : undefined })));
|
|
86
|
+
if (e.key === 'ArrowDown') {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
if (!isMinReached(value - step)) {
|
|
89
|
+
onChange(value - step);
|
|
90
|
+
}
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
};
|
|
95
|
+
return /*#__PURE__*/React__default.createElement(Container, {
|
|
96
|
+
"data-testid": dataTestId,
|
|
97
|
+
className: props.className
|
|
98
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
99
|
+
icon: props.removable && isMinReached(value - step) ? (/*#__PURE__*/React__default.createElement(Trash, {
|
|
100
|
+
size: getMultipliedSize(theme.base.baseWidth, 2)
|
|
101
|
+
})) : (/*#__PURE__*/React__default.createElement(Minus, {
|
|
102
|
+
size: getMultipliedSize(theme.base.baseWidth, 2)
|
|
103
|
+
})),
|
|
104
|
+
variant: "secondary",
|
|
105
|
+
onClick: decrease,
|
|
106
|
+
disabled: disabled || isMinReached(value - step) && !props.removable,
|
|
107
|
+
type: "button",
|
|
108
|
+
"aria-label": getMinButtonAriaLabel(),
|
|
109
|
+
"data-testid": dataTestId && `${dataTestId}${props.removable && isMinReached(value - step) ? '-remove' : '-decrease'}`
|
|
110
|
+
}), /*#__PURE__*/React__default.createElement(Input, {
|
|
111
|
+
id: props.id,
|
|
112
|
+
name: props.name,
|
|
113
|
+
type: "number",
|
|
114
|
+
onChange: handleChange,
|
|
115
|
+
value: value,
|
|
116
|
+
min: min,
|
|
117
|
+
max: max,
|
|
118
|
+
step: step,
|
|
119
|
+
readOnly: readonly || disabled,
|
|
120
|
+
disabled: disabled,
|
|
121
|
+
"aria-label": inputAriaLabel,
|
|
122
|
+
onKeyDown: handleKeyDown,
|
|
123
|
+
"aria-valuemin": min,
|
|
124
|
+
"aria-valuemax": max,
|
|
125
|
+
"aria-valuenow": value
|
|
126
|
+
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
127
|
+
icon: /*#__PURE__*/React__default.createElement(Plus, {
|
|
128
|
+
size: getMultipliedSize(theme.base.baseWidth, 2)
|
|
129
|
+
}),
|
|
130
|
+
variant: "secondary",
|
|
131
|
+
onClick: increase,
|
|
132
|
+
disabled: disabled || isMaxReached(value + step),
|
|
133
|
+
type: "button",
|
|
134
|
+
"aria-label": increaseButtonAriaLabel || undefined,
|
|
135
|
+
"data-testid": dataTestId ? `${dataTestId}-increase` : undefined
|
|
136
|
+
}));
|
|
150
137
|
};
|
|
151
138
|
|
|
152
139
|
export { AmountSelector as default };
|
|
@@ -5,19 +5,44 @@ import theme from '../../themes/theme.js';
|
|
|
5
5
|
import getElevationShadow from '../../utils/common.js';
|
|
6
6
|
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
7
7
|
|
|
8
|
-
const BoxWrapper = styled.div
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
const BoxWrapper = styled.div.withConfig({
|
|
9
|
+
displayName: "Box__BoxWrapper",
|
|
10
|
+
componentId: "sc-d3vc67-0"
|
|
11
|
+
})(["border:1px solid ", ";", ";", ";", ";padding:", ";background-color:", ";border-radius:", ";", ""], theme.color.line.L04, ({
|
|
12
|
+
width
|
|
13
|
+
}) => width && `width: ${width}`, ({
|
|
14
|
+
height
|
|
15
|
+
}) => height && `height: ${height}`, ({
|
|
16
|
+
$margin
|
|
17
|
+
}) => $margin && `margin: ${$margin}`, ({
|
|
18
|
+
$padding
|
|
19
|
+
}) => $padding || getMultipliedSize(theme.base.baseHeight, 2), theme.color.default.white, theme.radius.default, ({
|
|
20
|
+
$elevation,
|
|
21
|
+
$shadow
|
|
22
|
+
}) => $elevation !== 'none' && getElevationShadow({
|
|
23
|
+
elevation: $elevation,
|
|
24
|
+
shadow: $shadow
|
|
25
|
+
}));
|
|
26
|
+
const Box = _a => {
|
|
27
|
+
var {
|
|
28
|
+
elevation = 'none',
|
|
29
|
+
'data-testid': dataTestId
|
|
30
|
+
} = _a,
|
|
31
|
+
props = __rest(_a, ["elevation", 'data-testid']);
|
|
32
|
+
return /*#__PURE__*/React__default.createElement(BoxWrapper, {
|
|
33
|
+
id: props.id,
|
|
34
|
+
"$elevation": elevation,
|
|
35
|
+
"$shadow": props.shadow,
|
|
36
|
+
"$margin": props.margin,
|
|
37
|
+
"$padding": props.padding,
|
|
38
|
+
width: props.width,
|
|
39
|
+
height: props.height,
|
|
40
|
+
className: props.className,
|
|
41
|
+
"data-testid": dataTestId,
|
|
42
|
+
role: props.role,
|
|
43
|
+
"aria-label": props.ariaLabel,
|
|
44
|
+
"aria-live": props.ariaLive
|
|
45
|
+
}, props.children);
|
|
21
46
|
};
|
|
22
47
|
|
|
23
48
|
export { Box as default };
|