@evolve.ui/core-components 1.0.1 → 1.1.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/evolve-ui.entries.json +556 -0
- package/fileUpload/testUtils/mockFilesAndImages.d.cts +3 -3
- package/fileUpload/testUtils/mockFilesAndImages.d.cts.map +1 -1
- package/fileUpload/testUtils/mockFilesAndImages.d.mts +3 -3
- package/fileUpload/testUtils/mockFilesAndImages.d.mts.map +1 -1
- package/fileUpload/testUtils/testUtils.d.cts +1 -1
- package/fileUpload/testUtils/testUtils.d.cts.map +1 -1
- package/fileUpload/testUtils/testUtils.d.mts +1 -1
- package/fileUpload/testUtils/testUtils.d.mts.map +1 -1
- package/package.json +2 -2
- package/src/Accordion/Accordion.tsx +233 -0
- package/src/AddressDisplay/AddressDisplay.tsx +43 -0
- package/src/AddressDisplay/components/addressComponents.tsx +111 -0
- package/src/AddressDisplay/components/addressField.tsx +25 -0
- package/src/AddressDisplay/components/addressSection.tsx +8 -0
- package/src/AddressDisplay/components/getCountryValue.tsx +31 -0
- package/src/AddressDisplay/types.ts +26 -0
- package/src/AutomatedCarousel/AutomatedCarousel.tsx +163 -0
- package/src/AutomatedCarousel/automatedCarousel.types.ts +7 -0
- package/src/AutomatedCarousel/components/CarouselProgressBar/CarouselProgressBar.tsx +139 -0
- package/src/AutomatedCarousel/components/CarouselProgressBar/components/CarouselProgressBarUnit/CarouselProgressBarUnit.tsx +165 -0
- package/src/Badge/Badge.tsx +104 -0
- package/src/Badge/Badge.types.ts +58 -0
- package/src/Badge/ItemBadge.tsx +97 -0
- package/src/Badge/LiveStatusBadge.tsx +93 -0
- package/src/BannerNotification/BannerNotification.tsx +157 -0
- package/src/BannerNotification/components/BannerNotificationSkeleton.tsx +39 -0
- package/src/BannerNotification/components/CalloutIcon/BannerIcon.tsx +48 -0
- package/src/BannerNotification/utils/getRandomTooltipId.ts +3 -0
- package/src/BottomSheet/BottomSheet.tsx +476 -0
- package/src/BottomSheet/components/BottomSheetBackdrop/BottomSheetBackdrop.tsx +47 -0
- package/src/BottomSheet/components/BottomSheetContentArea/BottomSheetContentArea.tsx +92 -0
- package/src/BottomSheet/components/BottomSheetOverlay/BottomSheetOverlayTranslate3d.tsx +196 -0
- package/src/BottomSheet/components/SheetDescription/SheetDescription.tsx +22 -0
- package/src/BottomSheet/components/SheetTitle/SheetTitle.tsx +21 -0
- package/src/BottomSheet/components/index.tsx +5 -0
- package/src/BottomSheet/hooks/index.tsx +13 -0
- package/src/BottomSheet/hooks/useAriaHider.tsx +91 -0
- package/src/BottomSheet/hooks/useBottomSheetServices.tsx +224 -0
- package/src/BottomSheet/hooks/useDragHandler.tsx +282 -0
- package/src/BottomSheet/hooks/useFocusTrap.tsx +113 -0
- package/src/BottomSheet/hooks/useLayoutEffect.tsx +4 -0
- package/src/BottomSheet/hooks/useOptimizedResizeObserver.tsx +94 -0
- package/src/BottomSheet/hooks/useOptimizedScrollState.tsx +87 -0
- package/src/BottomSheet/hooks/useReady.tsx +34 -0
- package/src/BottomSheet/hooks/useReducedMotion.tsx +22 -0
- package/src/BottomSheet/hooks/useScrollLock.tsx +143 -0
- package/src/BottomSheet/hooks/useSnapPoints.tsx +355 -0
- package/src/BottomSheet/hooks/useSpring.tsx +47 -0
- package/src/BottomSheet/hooks/useSpringInterpolationsTranslate3d.tsx +101 -0
- package/src/BottomSheet/index.tsx +237 -0
- package/src/BottomSheet/state/atoms.ts +147 -0
- package/src/BottomSheet/state/useBottomSheetStateMachine.ts +246 -0
- package/src/BottomSheet/types.ts +172 -0
- package/src/BottomSheet/utils.ts +65 -0
- package/src/Breadcrumbs/Breadcrumbs.tsx +126 -0
- package/src/Button/Button.tsx +164 -0
- package/src/Button/Button.types.ts +80 -0
- package/src/Button/buttonColorClasses.ts +53 -0
- package/src/Callout/Callout.tsx +136 -0
- package/src/Callout/Callout.types.ts +29 -0
- package/src/Callout/components/CalloutIcon/CalloutIcon.tsx +56 -0
- package/src/Card/CardGrid.tsx +263 -0
- package/src/Card/SingleCard.tsx +22 -0
- package/src/Card/cardFactory.tsx +176 -0
- package/src/Card/components/createBadge.tsx +34 -0
- package/src/Card/components/createFavoriteButton.tsx +40 -0
- package/src/Card/components/createImage.tsx +64 -0
- package/src/Card/components/createInfo.tsx +84 -0
- package/src/Card/components/createName.tsx +63 -0
- package/src/Card/components/createPriceStatus.tsx +100 -0
- package/src/Card/components/types.ts +4 -0
- package/src/Card/hooks/useCardVisibilityTracking.ts +82 -0
- package/src/Card/sharedProps.ts +12 -0
- package/src/Card/types.ts +62 -0
- package/src/Carousel/Carousel.tsx +513 -0
- package/src/Carousel/Carousel.types.ts +43 -0
- package/src/Carousel/Carousel.utils.ts +63 -0
- package/src/Carousel/components/DotButton/DotButton.tsx +42 -0
- package/src/Carousel/components/NavigationButtons/NavigationButtons.tsx +77 -0
- package/src/Carousel/components/TitleSection/TitleSection.tsx +61 -0
- package/src/Carousel/components/TitleSection/components/SubHeaderLeft/SubHeaderLeft.tsx +53 -0
- package/src/Carousel/components/TitleSection/components/Title/Title.tsx +46 -0
- package/src/Carousel/index.ts +2 -0
- package/src/Carousel/testUtils.ts +10 -0
- package/src/Chips/Chip.tsx +153 -0
- package/src/Chips/ChipGroup.tsx +173 -0
- package/src/Chips/SuggestionChip.tsx +15 -0
- package/src/Chips/chipTypes.ts +113 -0
- package/src/Chips/index.ts +4 -0
- package/src/ChoiceListItem/Checkbox.tsx +69 -0
- package/src/ChoiceListItem/Radio.tsx +61 -0
- package/src/ChoiceListItem/choiceListItem.tsx +99 -0
- package/src/ChoiceListItem/common.tsx +148 -0
- package/src/ChoiceListItem/index.ts +3 -0
- package/src/Collapsible/Collapsible.tsx +58 -0
- package/src/Confetti/Confetti.tsx +270 -0
- package/src/Confetti/index.ts +2 -0
- package/src/ContentPager/ContentPager.tsx +189 -0
- package/src/ContentPager/components/Page.tsx +24 -0
- package/src/CookieConsent/components/CookieCategoryRow/CookieCategoryRow.tsx +30 -0
- package/src/CookieConsent/components/CookieConsent/CookieConsent.tsx +74 -0
- package/src/CookieConsent/components/CookieConsentBanner/CookieConsentBanner.tsx +51 -0
- package/src/CookieConsent/components/CookieConsentModal/CookieConsentModal.tsx +64 -0
- package/src/CookieConsent/hooks/useCookieConsent.ts +170 -0
- package/src/CookieConsent/hooks/useCookieConsentState.ts +142 -0
- package/src/CookieConsent/index.ts +16 -0
- package/src/CookieConsent/types/cookieConsent.types.ts +79 -0
- package/src/CookieConsent/types/index.ts +7 -0
- package/src/Countdown/Countdown.tsx +161 -0
- package/src/Countdown/Countdown.types.ts +4 -0
- package/src/Countdown/hooks/useGetCountdown.ts +103 -0
- package/src/DateTimeInput/dateInput/DateInput.tsx +199 -0
- package/src/DateTimeInput/datePicker/DatePicker.tsx +138 -0
- package/src/DateTimeInput/datePicker/components/calendar/Calendar.tsx +72 -0
- package/src/DateTimeInput/datePicker/index.ts +2 -0
- package/src/DateTimeInput/timeInput/TimeInput.tsx +128 -0
- package/src/DateTimeInput/timePicker/TimePicker.tsx +118 -0
- package/src/DateTimeInput/timePicker/components/TimePopover/AmPmSwitch.tsx +103 -0
- package/src/DateTimeInput/timePicker/components/TimePopover/TimeFieldInput.tsx +26 -0
- package/src/DateTimeInput/timePicker/components/TimePopover/TimePopover.tsx +84 -0
- package/src/DateTimeInput/timePicker/components/TimePopover/TimePopover.utils.ts +67 -0
- package/src/DateTimeInput/timePicker/components/TimePopover/TimePopoverActions.tsx +26 -0
- package/src/DateTimeInput/timePicker/index.ts +2 -0
- package/src/DateTimeInput/utils/getDisplayDate.ts +15 -0
- package/src/DateTimeInput/utils/getDisplayTime.ts +15 -0
- package/src/DateTimeInput/utils/index.ts +2 -0
- package/src/DateTimeInput/utils/parseTimeValue.ts +54 -0
- package/src/Drawer/Drawer.tsx +446 -0
- package/src/Drawer/atoms.ts +4 -0
- package/src/Drawer/components/DialogActions/DialogActions.tsx +33 -0
- package/src/Drawer/components/DialogContent/DialogContent.tsx +80 -0
- package/src/Drawer/components/DialogHeader/DialogHeader.tsx +68 -0
- package/src/EducationalPopover/EducationalPopover.tsx +174 -0
- package/src/FavoriteButton/FavoriteButton.tsx +64 -0
- package/src/FavoriteButton/components/IconOnlyFavoriteButton/IconOnlyFavoriteButton.tsx +80 -0
- package/src/FavoriteButton/components/LabeledAnimatedFavoriteButton/LabeledAnimatedFavoriteButton.tsx +179 -0
- package/src/FavoriteButton/components/LabeledFavoriteButton/LabeledFavoriteButton.tsx +71 -0
- package/src/FavoriteButton/components/SmallHeartStraightIcon/SmallHeartStraightIcon.tsx +14 -0
- package/src/FavoriteButton/hooks/useFavoriteButtonState.ts +30 -0
- package/src/FavoriteButton/index.ts +2 -0
- package/src/FavoriteButton/types/favoriteButton.ts +87 -0
- package/src/FeatureFlags/devTools/FeatureFlagDevToolsUI.tsx +226 -0
- package/src/FeatureFlags/devTools/getFeatureFlagCookieOverrides.ts +30 -0
- package/src/FeatureFlags/devTools/utils/cookies.ts +169 -0
- package/src/FeatureFlags/hooks/index.ts +2 -0
- package/src/FeatureFlags/hooks/useFeatureFlag.tsx +19 -0
- package/src/FeatureFlags/hooks/useFeatureFlags.tsx +15 -0
- package/src/FileUpload/components/FileCard/FileCard.tsx +50 -0
- package/src/FileUpload/components/FileDropzone/FileDropzone.tsx +221 -0
- package/src/FileUpload/components/FileDropzone/components/DropzoneContent/DropzoneContent.tsx +28 -0
- package/src/FileUpload/components/FileDropzone/components/DropzoneContent/DropzoneText.tsx +81 -0
- package/src/FileUpload/components/FileDropzone/components/FileDropzoneDebugger/FileDropzoneDebugger.tsx +40 -0
- package/src/FileUpload/components/FileDropzone/components/FileDropzoneDebugger/FileRejectionsDisplay.tsx +110 -0
- package/src/FileUpload/components/FileDropzoneOverlay/FileDropzoneOverlay.tsx +183 -0
- package/src/FileUpload/components/FileDropzoneOverlay/components/OverlayDropzoneContent.tsx +146 -0
- package/src/FileUpload/components/FileDropzoneOverlay/components/OverlayDropzoneDragText.tsx +42 -0
- package/src/FileUpload/components/FileDropzoneOverlay/styles.ts +79 -0
- package/src/FileUpload/components/FilePreviewList/FilePreviewList.tsx +251 -0
- package/src/FileUpload/components/FilePreviewList/virtualizerComponents/FilePreviewVirtualizedList/FilePreviewVirtualizedList.tsx +88 -0
- package/src/FileUpload/components/FileUpload/FileUpload.tsx +63 -0
- package/src/FileUpload/components/FileUploadCanvas/FileUploadCanvas.tsx +125 -0
- package/src/FileUpload/components/GridFileCard/GridFileCard.tsx +364 -0
- package/src/FileUpload/components/GridFileCard/utils/sortable.ts +48 -0
- package/src/FileUpload/components/ListFileCard/ListFileCard.tsx +259 -0
- package/src/FileUpload/components/types.ts +78 -0
- package/src/FileUpload/hooks/filePreview/useImageFilePreviewUrl.ts +62 -0
- package/src/FileUpload/hooks/index.ts +11 -0
- package/src/FileUpload/hooks/upload/useHandleDragEnter/useHandleDragEnter.ts +154 -0
- package/src/FileUpload/hooks/upload/useHandleDrop/createFileRejectionHelpers.ts +273 -0
- package/src/FileUpload/hooks/upload/useHandleDrop/useHandleDrop.ts +153 -0
- package/src/FileUpload/hooks/upload/useUploadAvailability/useUploadAvailability.ts +44 -0
- package/src/FileUpload/hooks/validation/createDropzoneValidator.ts +41 -0
- package/src/FileUpload/hooks/validation/useFileValidation.ts +25 -0
- package/src/FileUpload/hooks/validation/useFileValidationLogic.ts +107 -0
- package/src/FileUpload/hooks/validation/useValidationMessages.ts +92 -0
- package/src/FileUpload/hooks/validation/useValidationState.ts +171 -0
- package/src/FileUpload/index.ts +57 -0
- package/src/FileUpload/providers/FileUploadProvider.tsx +219 -0
- package/src/FileUpload/providers/UploadValidationProvider.tsx +159 -0
- package/src/FileUpload/testUtils/mockFilesAndImages.ts +64 -0
- package/src/FileUpload/testUtils/testUtils.ts +111 -0
- package/src/FileUpload/types/commonTypes.ts +267 -0
- package/src/FileUpload/types/index.ts +31 -0
- package/src/FileUpload/types/sharedTypes.ts +159 -0
- package/src/FileUpload/utils/constants.ts +79 -0
- package/src/FileUpload/utils/createMessageContext.ts +180 -0
- package/src/FileUpload/utils/getFileExtensionsFromAcceptedTypes.ts +73 -0
- package/src/FileUpload/utils/getFilePluralizationText.ts +68 -0
- package/src/FileUpload/utils/getMimeTypes.ts +26 -0
- package/src/FileUpload/utils/messageUtils.ts +41 -0
- package/src/FileUpload/utils/styles.ts +68 -0
- package/src/FormLabel/FormLabel.tsx +212 -0
- package/src/IconButton/IconButton.tsx +154 -0
- package/src/Icons/CreditCardIcon/CreditCardIcon.tsx +73 -0
- package/src/Icons/CreditCardIcon/cardIcons.tsx +270 -0
- package/src/Icons/IconBase.tsx +133 -0
- package/src/Icons/anyIcon.ts +3 -0
- package/src/Icons/generatedIcons/Archive.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowClockwise.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowDown.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowLeft.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowRight.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowSquareOut.tsx +51 -0
- package/src/Icons/generatedIcons/ArrowSquareRight.tsx +51 -0
- package/src/Icons/generatedIcons/ArrowUp.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowsCounterClockwise.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowsLeftRight.tsx +48 -0
- package/src/Icons/generatedIcons/ArrowsOutCardinal.tsx +48 -0
- package/src/Icons/generatedIcons/Bank.tsx +48 -0
- package/src/Icons/generatedIcons/Bell.tsx +51 -0
- package/src/Icons/generatedIcons/BookBookmark.tsx +51 -0
- package/src/Icons/generatedIcons/BookmarksSimple.tsx +51 -0
- package/src/Icons/generatedIcons/Broadcast.tsx +48 -0
- package/src/Icons/generatedIcons/CalendarBlank.tsx +48 -0
- package/src/Icons/generatedIcons/CalendarStar.tsx +51 -0
- package/src/Icons/generatedIcons/Camera.tsx +51 -0
- package/src/Icons/generatedIcons/CaretDown.tsx +48 -0
- package/src/Icons/generatedIcons/CaretLeft.tsx +48 -0
- package/src/Icons/generatedIcons/CaretRight.tsx +48 -0
- package/src/Icons/generatedIcons/CaretUp.tsx +48 -0
- package/src/Icons/generatedIcons/Certificate.tsx +51 -0
- package/src/Icons/generatedIcons/ChartBar.tsx +48 -0
- package/src/Icons/generatedIcons/Check.tsx +51 -0
- package/src/Icons/generatedIcons/CheckCircle.tsx +48 -0
- package/src/Icons/generatedIcons/CirclesFour.tsx +51 -0
- package/src/Icons/generatedIcons/Clock.tsx +48 -0
- package/src/Icons/generatedIcons/ClockCountdown.tsx +48 -0
- package/src/Icons/generatedIcons/Close.tsx +51 -0
- package/src/Icons/generatedIcons/CloudArrowUp.tsx +51 -0
- package/src/Icons/generatedIcons/CloudWarning.tsx +51 -0
- package/src/Icons/generatedIcons/Code.tsx +48 -0
- package/src/Icons/generatedIcons/Compass.tsx +51 -0
- package/src/Icons/generatedIcons/Confetti.tsx +51 -0
- package/src/Icons/generatedIcons/Copy.tsx +48 -0
- package/src/Icons/generatedIcons/CornersOut.tsx +48 -0
- package/src/Icons/generatedIcons/CreditCard.tsx +48 -0
- package/src/Icons/generatedIcons/Crown.tsx +51 -0
- package/src/Icons/generatedIcons/CrownSimple.tsx +51 -0
- package/src/Icons/generatedIcons/CurrencyCircleDollar.tsx +48 -0
- package/src/Icons/generatedIcons/CurrencyDollarSimple.tsx +51 -0
- package/src/Icons/generatedIcons/Desktop.tsx +51 -0
- package/src/Icons/generatedIcons/Detective.tsx +51 -0
- package/src/Icons/generatedIcons/DotOutline.tsx +46 -0
- package/src/Icons/generatedIcons/DotsSixVertical.tsx +51 -0
- package/src/Icons/generatedIcons/DotsThreeOutline.tsx +51 -0
- package/src/Icons/generatedIcons/DotsThreeOutlineVertical.tsx +51 -0
- package/src/Icons/generatedIcons/DownloadSimple.tsx +51 -0
- package/src/Icons/generatedIcons/EnvelopeSimple.tsx +48 -0
- package/src/Icons/generatedIcons/Eraser.tsx +51 -0
- package/src/Icons/generatedIcons/Eye.tsx +51 -0
- package/src/Icons/generatedIcons/EyeSlash.tsx +51 -0
- package/src/Icons/generatedIcons/FacebookLogo.tsx +48 -0
- package/src/Icons/generatedIcons/FileArchive.tsx +48 -0
- package/src/Icons/generatedIcons/FileArrowDown.tsx +48 -0
- package/src/Icons/generatedIcons/FileCsv.tsx +48 -0
- package/src/Icons/generatedIcons/FilePdf.tsx +48 -0
- package/src/Icons/generatedIcons/FileText.tsx +48 -0
- package/src/Icons/generatedIcons/Files.tsx +51 -0
- package/src/Icons/generatedIcons/Fire.tsx +51 -0
- package/src/Icons/generatedIcons/Flag.tsx +51 -0
- package/src/Icons/generatedIcons/FlagBannerFold.tsx +48 -0
- package/src/Icons/generatedIcons/FloppyDisk.tsx +51 -0
- package/src/Icons/generatedIcons/Gauge.tsx +51 -0
- package/src/Icons/generatedIcons/Gavel.tsx +51 -0
- package/src/Icons/generatedIcons/Gear.tsx +51 -0
- package/src/Icons/generatedIcons/GlobeHemisphereWest.tsx +51 -0
- package/src/Icons/generatedIcons/GoogleLogo.tsx +48 -0
- package/src/Icons/generatedIcons/GridNine.tsx +51 -0
- package/src/Icons/generatedIcons/HandCoins.tsx +51 -0
- package/src/Icons/generatedIcons/HandbagSimple.tsx +51 -0
- package/src/Icons/generatedIcons/Headset.tsx +51 -0
- package/src/Icons/generatedIcons/HeartStraight.tsx +51 -0
- package/src/Icons/generatedIcons/HourglassLow.tsx +48 -0
- package/src/Icons/generatedIcons/House.tsx +51 -0
- package/src/Icons/generatedIcons/Image.tsx +51 -0
- package/src/Icons/generatedIcons/ImageSquare.tsx +51 -0
- package/src/Icons/generatedIcons/ImagesSquare.tsx +51 -0
- package/src/Icons/generatedIcons/Info.tsx +48 -0
- package/src/Icons/generatedIcons/InstagramLogo.tsx +51 -0
- package/src/Icons/generatedIcons/Lightning.tsx +48 -0
- package/src/Icons/generatedIcons/Link.tsx +51 -0
- package/src/Icons/generatedIcons/LinkedinLogo.tsx +51 -0
- package/src/Icons/generatedIcons/List.tsx +48 -0
- package/src/Icons/generatedIcons/Lock.tsx +51 -0
- package/src/Icons/generatedIcons/LockOpen.tsx +51 -0
- package/src/Icons/generatedIcons/MagnifyingGlass.tsx +48 -0
- package/src/Icons/generatedIcons/MapPin.tsx +51 -0
- package/src/Icons/generatedIcons/MapPinSimpleArea.tsx +48 -0
- package/src/Icons/generatedIcons/Medal.tsx +48 -0
- package/src/Icons/generatedIcons/Megaphone.tsx +48 -0
- package/src/Icons/generatedIcons/Minus.tsx +45 -0
- package/src/Icons/generatedIcons/Money.tsx +51 -0
- package/src/Icons/generatedIcons/Notches.tsx +48 -0
- package/src/Icons/generatedIcons/NotePencil.tsx +48 -0
- package/src/Icons/generatedIcons/Package.tsx +51 -0
- package/src/Icons/generatedIcons/PaintBrush.tsx +51 -0
- package/src/Icons/generatedIcons/PaperPlaneTilt.tsx +51 -0
- package/src/Icons/generatedIcons/Paperclip.tsx +51 -0
- package/src/Icons/generatedIcons/Pause.tsx +51 -0
- package/src/Icons/generatedIcons/PencilLine.tsx +51 -0
- package/src/Icons/generatedIcons/PencilRuler.tsx +51 -0
- package/src/Icons/generatedIcons/PencilSimple.tsx +51 -0
- package/src/Icons/generatedIcons/Phone.tsx +51 -0
- package/src/Icons/generatedIcons/PinterestLogo.tsx +51 -0
- package/src/Icons/generatedIcons/Play.tsx +51 -0
- package/src/Icons/generatedIcons/Plus.tsx +51 -0
- package/src/Icons/generatedIcons/PlusCircle.tsx +48 -0
- package/src/Icons/generatedIcons/Printer.tsx +51 -0
- package/src/Icons/generatedIcons/Question.tsx +48 -0
- package/src/Icons/generatedIcons/Receipt.tsx +51 -0
- package/src/Icons/generatedIcons/Rows.tsx +51 -0
- package/src/Icons/generatedIcons/SealCheck.tsx +51 -0
- package/src/Icons/generatedIcons/SelectionSlash.tsx +48 -0
- package/src/Icons/generatedIcons/ShareNetwork.tsx +51 -0
- package/src/Icons/generatedIcons/ShieldCheck.tsx +51 -0
- package/src/Icons/generatedIcons/ShieldStar.tsx +51 -0
- package/src/Icons/generatedIcons/ShoppingCart.tsx +48 -0
- package/src/Icons/generatedIcons/ShuffleAngular.tsx +48 -0
- package/src/Icons/generatedIcons/SidebarSimple.tsx +48 -0
- package/src/Icons/generatedIcons/SlidersHorizontal.tsx +51 -0
- package/src/Icons/generatedIcons/Smiley.tsx +48 -0
- package/src/Icons/generatedIcons/Sparkle.tsx +51 -0
- package/src/Icons/generatedIcons/SpinnerGap.tsx +48 -0
- package/src/Icons/generatedIcons/StackPlus.tsx +48 -0
- package/src/Icons/generatedIcons/Star.tsx +51 -0
- package/src/Icons/generatedIcons/Storefront.tsx +51 -0
- package/src/Icons/generatedIcons/Swap.tsx +51 -0
- package/src/Icons/generatedIcons/Tag.tsx +51 -0
- package/src/Icons/generatedIcons/ThumbsDown.tsx +48 -0
- package/src/Icons/generatedIcons/ThumbsUp.tsx +48 -0
- package/src/Icons/generatedIcons/Toolbox.tsx +48 -0
- package/src/Icons/generatedIcons/Trash.tsx +48 -0
- package/src/Icons/generatedIcons/TrendUp.tsx +48 -0
- package/src/Icons/generatedIcons/Trophy.tsx +51 -0
- package/src/Icons/generatedIcons/Truck.tsx +51 -0
- package/src/Icons/generatedIcons/UploadSimple.tsx +51 -0
- package/src/Icons/generatedIcons/User.tsx +48 -0
- package/src/Icons/generatedIcons/Users.tsx +48 -0
- package/src/Icons/generatedIcons/UsersThree.tsx +51 -0
- package/src/Icons/generatedIcons/VideoCamera.tsx +51 -0
- package/src/Icons/generatedIcons/Warning.tsx +51 -0
- package/src/Icons/generatedIcons/WarningCircle.tsx +48 -0
- package/src/Icons/generatedIcons/WifiHigh.tsx +51 -0
- package/src/Icons/generatedIcons/XCircle.tsx +48 -0
- package/src/Icons/generatedIcons/XLogo.tsx +48 -0
- package/src/Icons/generatedIcons/YoutubeLogo.tsx +51 -0
- package/src/Icons/importedIcons.ts +152 -0
- package/src/Icons/index.ts +149 -0
- package/src/Icons/socialIcons/appleSocialIcon.tsx +50 -0
- package/src/Icons/socialIcons/facebookSocialIcon.tsx +41 -0
- package/src/Icons/socialIcons/googleSocialIcon.tsx +134 -0
- package/src/ImageCluster/ImageCluster.tsx +125 -0
- package/src/ImageSlider/ImageSlider.tsx +582 -0
- package/src/ImageSlider/ImageSlider.types.ts +90 -0
- package/src/ImageSlider/components/IndexIndicator/IndexIndicator.tsx +21 -0
- package/src/ImageSlider/components/NavigationButtons/NavigationButtons.tsx +113 -0
- package/src/ImageSlider/components/ResponsiveImage/ResponsiveImage.tsx +114 -0
- package/src/ImageSlider/components/ResponsiveImage/index.ts +1 -0
- package/src/ImageSlider/components/Thumbnails/Thumbnails.tsx +184 -0
- package/src/ImageSlider/constants.ts +59 -0
- package/src/ImageSlider/hooks/index.ts +3 -0
- package/src/ImageSlider/hooks/useImageSlider.ts +57 -0
- package/src/ImageSlider/hooks/useImageSliderNavigation.ts +133 -0
- package/src/ImageSlider/hooks/useImageSliderScrollHandler.ts +171 -0
- package/src/ImageSlider/index.ts +3 -0
- package/src/ImageSlider/utils/imageOptimization.ts +97 -0
- package/src/ImageSlider/utils/index.ts +1 -0
- package/src/InlineNotification/InlineNotification.tsx +95 -0
- package/src/JumpMenu/JumpMenu.tsx +395 -0
- package/src/JumpMenu/components/JumpMenuItem/JumpMenuItem.tsx +62 -0
- package/src/JumpMenu/hooks/useContainerTracking.ts +171 -0
- package/src/JumpMenu/hooks/useIntersectionObserver.ts +77 -0
- package/src/JumpMenu/hooks/useKeyboardNavigation.ts +102 -0
- package/src/JumpMenu/hooks/useResizeObserver.ts +53 -0
- package/src/JumpMenu/hooks/useSectionObserver.ts +102 -0
- package/src/JumpMenu/index.ts +2 -0
- package/src/JumpMenu/types/index.ts +19 -0
- package/src/Loading/Loading.tsx +39 -0
- package/src/Loading/components/LoadingDot/LoadingDot.tsx +16 -0
- package/src/LoadingSpinner/LoadingSpinner.tsx +20 -0
- package/src/Menu/Menu.tsx +372 -0
- package/src/Menu/components/MenuDivider/MenuDivider.tsx +5 -0
- package/src/Menu/components/MenuItem/MenuItem.tsx +298 -0
- package/src/Menu/context/menuContext.tsx +20 -0
- package/src/Menu/hooks/useMenu.tsx +18 -0
- package/src/Menu/index.ts +3 -0
- package/src/Modal/ComposableModal.tsx +313 -0
- package/src/Modal/Modal.tsx +231 -0
- package/src/Modal/components/BackButton/BackButton.tsx +43 -0
- package/src/Modal/components/Backdrop/Backdrop.tsx +62 -0
- package/src/Modal/components/CloseButton/CloseButton.tsx +55 -0
- package/src/Modal/components/ModalActions/ModalActions.tsx +135 -0
- package/src/Modal/components/ModalContent/ModalContent.tsx +163 -0
- package/src/Modal/components/ModalHeader/ModalHeader.tsx +84 -0
- package/src/Modal/components/ModalHeader/hooks/useHeaderAnimation.tsx +49 -0
- package/src/Modal/components/ModalProgressSteps/ModalProgressSteps.tsx +26 -0
- package/src/Modal/components/ModalSubTitle/ModalSubTitle.tsx +29 -0
- package/src/Modal/components/ModalTitle/ModalTitle.tsx +22 -0
- package/src/Modal/components/PreventModalScroll/PreventModalScroll.tsx +106 -0
- package/src/Modal/components/index.ts +12 -0
- package/src/Modal/context.ts +33 -0
- package/src/Modal/hooks/useCloseModal.ts +133 -0
- package/src/NotificationBadge/NotificationBadge.tsx +34 -0
- package/src/Pagination/AdvancedPagination.tsx +48 -0
- package/src/Pagination/Pagination.tsx +216 -0
- package/src/Pagination/components/AdvancedPaginator/AdvancedPaginator.tsx +52 -0
- package/src/Pagination/components/AdvancedPaginator/components/PageSelect/PageSelect.tsx +43 -0
- package/src/Pagination/components/ItemCountDisplay/ItemCountDisplay.tsx +32 -0
- package/src/Pagination/components/ItemCountSelect/ItemCountSelect.tsx +33 -0
- package/src/Pagination/index.tsx +3 -0
- package/src/Pagination/paginationProvider.tsx +234 -0
- package/src/Pagination/utils.tsx +36 -0
- package/src/PhoneInput/PhoneInput.tsx +509 -0
- package/src/PhoneInput/useDropdownLogic.tsx +163 -0
- package/src/ProgressCircle/ProgressCircle.tsx +246 -0
- package/src/ProgressCircle/hooks/useProgressStatusTransitions.ts +49 -0
- package/src/ProgressCircle/utils/progressCircle.constants.ts +27 -0
- package/src/ProgressSteps/ProgressSteps.tsx +160 -0
- package/src/SaveConfetti/SaveConfetti.tsx +277 -0
- package/src/SaveConfetti/index.ts +2 -0
- package/src/SearchInput/SearchInput.tsx +236 -0
- package/src/SegmentedControl/SegmentedControl.tsx +111 -0
- package/src/SegmentedControl/SegmentedControlGroup.tsx +94 -0
- package/src/SegmentedControl/index.ts +4 -0
- package/src/Select/Select.tsx +154 -0
- package/src/Select/SelectAsync.tsx +13 -0
- package/src/Select/SelectAsyncCreatable.tsx +14 -0
- package/src/Select/SelectCreatable.tsx +12 -0
- package/src/Select/reexportedComponents.tsx +5 -0
- package/src/Select/selectComponents.tsx +306 -0
- package/src/Skeleton/Skeleton.tsx +13 -0
- package/src/SplitButton/SplitButton.tsx +298 -0
- package/src/SplitButton/SplitButtonTrigger.tsx +55 -0
- package/src/StarRating/StarRating.tsx +165 -0
- package/src/StarRating/components/StarComponent/StarComponent.tsx +44 -0
- package/src/Table/Table.tsx +474 -0
- package/src/Table/components/TableHeader/TableHeader.tsx +166 -0
- package/src/Table/components/TablePagination/TablePagination.tsx +18 -0
- package/src/Table/components/TablePagination/components/ItemCountDisplay/ItemCountDisplay.tsx +17 -0
- package/src/Table/components/TablePagination/components/ItemCountSelect/ItemCountSelect.tsx +31 -0
- package/src/Table/components/TablePagination/components/TablePaginator/TablePaginator.tsx +37 -0
- package/src/Table/components/TablePagination/components/TablePaginator/components/PageSelect/PageSelect.tsx +32 -0
- package/src/Table/components/TableRow/TableRows.tsx +147 -0
- package/src/Table/components/TableRow/components/TableRowCell/TableRowCell.tsx +49 -0
- package/src/Table/components/TableShadow/TableShadow.tsx +46 -0
- package/src/Table/index.ts +2 -0
- package/src/Table/sharedState.ts +30 -0
- package/src/Table/sharedStyles.ts +1 -0
- package/src/Table/types.ts +55 -0
- package/src/Tabs/Tabs.tsx +358 -0
- package/src/TextArea/TextArea.tsx +157 -0
- package/src/TextInput/TextInput.tsx +173 -0
- package/src/Toast/Toast.tsx +64 -0
- package/src/Toast/components/ToastContainer/ToastContainer.tsx +48 -0
- package/src/Toast/index.ts +2 -0
- package/src/Toast/types/role.ts +1 -0
- package/src/Toast/utils/getIcon.tsx +41 -0
- package/src/ToggleSwitch/ToggleSwitch.tsx +188 -0
- package/src/Tooltip/InfoIconTooltip.tsx +47 -0
- package/src/Tooltip/Tooltip.tsx +41 -0
- package/src/Typography/InlineButton/InlineButton.tsx +166 -0
- package/src/Typography/Links/Links.tsx +113 -0
- package/src/Typography/Text/Text.tsx +239 -0
- package/src/ViewMore/ViewMore.tsx +226 -0
- package/src/WebRTCPlayer/WebRTCPlayer.tsx +325 -0
- package/src/WebRTCPlayer/adaptor/NativeWebRTCAdaptor.ts +588 -0
- package/src/WebRTCPlayer/hooks/useWebRTCStream.ts +571 -0
- package/src/WebRTCPlayer/index.ts +22 -0
- package/src/WebRTCPlayer/types.ts +95 -0
- package/src/breakpoints/index.tsx +1 -0
- package/src/breakpoints/utils.tsx +50 -0
- package/src/declarations.d.ts +7 -0
- package/src/grid/gridHighlighter.tsx +83 -0
- package/src/grid/index.ts +3 -0
- package/src/grid/pageGrid.tsx +37 -0
- package/src/grid/useSubGridCSS.tsx +214 -0
- package/src/hooks/useHorizontalScrollFade.ts +44 -0
- package/src/hooks/usePrevious.ts +14 -0
- package/src/index.ts +351 -0
- package/src/intl/index.ts +4 -0
- package/src/intl/utils.ts +67 -0
- package/src/mixins/horizontalScrollFadeMixin.ts +56 -0
- package/src/mixins/index.ts +18 -0
- package/src/mixins/propMixins.ts +389 -0
- package/src/providers/createContextProvider.ts +22 -0
- package/src/providers/designSystemProvider.tsx +218 -0
- package/src/providers/errorBoundaryProvider.tsx +179 -0
- package/src/providers/featureFlagProvider.tsx +18 -0
- package/src/providers/gridSizeProvider.tsx +23 -0
- package/src/providers/index.ts +12 -0
- package/src/providers/linkProvider.tsx +32 -0
- package/src/providers/normalize.tsx +93 -0
- package/src/providers/targets/DatePickerTarget.tsx +10 -0
- package/src/providers/targets/ModalTarget.tsx +14 -0
- package/src/providers/targets/TimePickerTarget.tsx +10 -0
- package/src/providers/themeContext.tsx +24 -0
- package/src/providers/windowSizeProvider.tsx +125 -0
- package/src/spacing/index.ts +1 -0
- package/src/spacing/spacing.ts +11 -0
- package/src/utils/countriesWithISOCodes.ts +1419 -0
- package/src/utils/dateTimeFormat.ts +257 -0
- package/src/utils/effectEventListener.ts +11 -0
- package/src/utils/formatFileSize.ts +18 -0
- package/src/utils/isClientSide.ts +1 -0
- package/src/utils/keepTransition.ts +15 -0
- package/src/utils/nodeEnv.ts +9 -0
- package/src/utils/smoothScrollTo.ts +47 -0
- package/src/utils/utilityTypes.ts +13 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { ReactNode, useCallback, useEffect, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { usePrevious } from '../../../hooks/usePrevious';
|
|
4
|
+
import { IconButton } from '../../../IconButton/IconButton';
|
|
5
|
+
import { Pause, Play } from '../../../Icons';
|
|
6
|
+
import { useWindowIsDesktop } from '../../../providers';
|
|
7
|
+
import {
|
|
8
|
+
CarouselProgressBarUnit,
|
|
9
|
+
CarouselProgressBarUnitProgressState,
|
|
10
|
+
} from './components/CarouselProgressBarUnit/CarouselProgressBarUnit';
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
/**
|
|
14
|
+
* If the user is scrolling/dragging freely, this is the page they're currently on
|
|
15
|
+
*/
|
|
16
|
+
currentFreeScrollPage: number;
|
|
17
|
+
/**
|
|
18
|
+
* The current page of the carousel
|
|
19
|
+
*/
|
|
20
|
+
currentPage: number;
|
|
21
|
+
/**
|
|
22
|
+
* Bring the slider to the selected page
|
|
23
|
+
* @param pageIndex Index of the page to view
|
|
24
|
+
*/
|
|
25
|
+
goToPage: (pageIndex: number) => void;
|
|
26
|
+
/**
|
|
27
|
+
* If the parent determines the pause should be a certain state, we listen
|
|
28
|
+
*/
|
|
29
|
+
isPaused: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Total number of pages
|
|
32
|
+
*/
|
|
33
|
+
pageCount: number;
|
|
34
|
+
/**
|
|
35
|
+
* Called when the progress bar toggles the pause state
|
|
36
|
+
* @param isPaused
|
|
37
|
+
*/
|
|
38
|
+
setPausedState: (isPaused: boolean) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Changes the styling for the pause/play buttons to better reflect various backgrounds
|
|
41
|
+
*/
|
|
42
|
+
style: 'primary' | 'inverse';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const CarouselProgressBar = ({
|
|
46
|
+
currentFreeScrollPage,
|
|
47
|
+
currentPage,
|
|
48
|
+
goToPage,
|
|
49
|
+
isPaused,
|
|
50
|
+
pageCount,
|
|
51
|
+
setPausedState,
|
|
52
|
+
style,
|
|
53
|
+
}: Props) => {
|
|
54
|
+
const isDesktop = useWindowIsDesktop();
|
|
55
|
+
const previousPageCount = usePrevious(pageCount);
|
|
56
|
+
|
|
57
|
+
const pageBarUnits = useMemo(() => {
|
|
58
|
+
const currentPageInUse = isPaused ? currentFreeScrollPage : currentPage;
|
|
59
|
+
const units: ReactNode[] = [];
|
|
60
|
+
|
|
61
|
+
for (let i = 0; i < pageCount; i++) {
|
|
62
|
+
const onClickProgressBarUnit = () => {
|
|
63
|
+
goToPage(i);
|
|
64
|
+
setPausedState(true);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const onCompleteProgressBarUnit = () => {
|
|
68
|
+
goToPage((i + 1) % pageCount);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
if (i < currentPageInUse) {
|
|
72
|
+
units.push(
|
|
73
|
+
<CarouselProgressBarUnit
|
|
74
|
+
isPausedOverride={isPaused}
|
|
75
|
+
key={`page-bar-unit-past-${i}-past`}
|
|
76
|
+
onClick={onClickProgressBarUnit}
|
|
77
|
+
onComplete={onCompleteProgressBarUnit}
|
|
78
|
+
page={i + 1}
|
|
79
|
+
progressState={CarouselProgressBarUnitProgressState.Past}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
} else if (i === currentPageInUse) {
|
|
83
|
+
units.push(
|
|
84
|
+
<CarouselProgressBarUnit
|
|
85
|
+
isPausedOverride={isPaused}
|
|
86
|
+
key={`page-bar-unit-current-${i}-current`}
|
|
87
|
+
onClick={onClickProgressBarUnit}
|
|
88
|
+
onComplete={onCompleteProgressBarUnit}
|
|
89
|
+
page={i + 1}
|
|
90
|
+
progressState={CarouselProgressBarUnitProgressState.Current}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
} else {
|
|
94
|
+
units.push(
|
|
95
|
+
<CarouselProgressBarUnit
|
|
96
|
+
isPausedOverride={isPaused}
|
|
97
|
+
key={`page-bar-unit-future-${i}-future`}
|
|
98
|
+
onClick={onClickProgressBarUnit}
|
|
99
|
+
onComplete={onCompleteProgressBarUnit}
|
|
100
|
+
page={i + 1}
|
|
101
|
+
progressState={CarouselProgressBarUnitProgressState.Future}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return units;
|
|
107
|
+
}, [currentFreeScrollPage, currentPage, goToPage, isPaused, pageCount, setPausedState]);
|
|
108
|
+
|
|
109
|
+
const togglePause = useCallback(() => {
|
|
110
|
+
setPausedState(!isPaused);
|
|
111
|
+
}, [isPaused, setPausedState]);
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (pageCount !== previousPageCount) {
|
|
115
|
+
goToPage(0);
|
|
116
|
+
setPausedState(false);
|
|
117
|
+
}
|
|
118
|
+
}, [goToPage, pageCount, previousPageCount, setPausedState]);
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<div
|
|
122
|
+
className="mx-xl grid items-center gap-xs xsMax:m-0 xsMax:flex"
|
|
123
|
+
style={{ gridTemplateColumns: `repeat(${pageCount + 1}, minmax(0, 32px))` }}
|
|
124
|
+
>
|
|
125
|
+
{pageBarUnits}
|
|
126
|
+
<div className="flex justify-center">
|
|
127
|
+
<IconButton
|
|
128
|
+
data-testid="automated-carousel-toggle-pause-button"
|
|
129
|
+
icon={isPaused ? Play : Pause}
|
|
130
|
+
iconStyle="fill"
|
|
131
|
+
onClick={togglePause}
|
|
132
|
+
size={isDesktop ? 'xs' : 'sm'}
|
|
133
|
+
style={style}
|
|
134
|
+
variant="filled"
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { cn } from '@evolve.ui/theme-system';
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { usePrevious } from '../../../../../hooks/usePrevious';
|
|
5
|
+
import { useWindowIsDesktop } from '../../../../../providers';
|
|
6
|
+
import { SHOW_CAROUSEL_PAGE_DURATION } from '../../../../automatedCarousel.types';
|
|
7
|
+
|
|
8
|
+
const MAX_PROGRESS_CAP = 100;
|
|
9
|
+
const PERCENT_CONVERSION = 100;
|
|
10
|
+
export const ANIMATION_STEP_DURATION = 100; // in milliseconds
|
|
11
|
+
|
|
12
|
+
export enum CarouselProgressBarUnitProgressState {
|
|
13
|
+
Past,
|
|
14
|
+
Current,
|
|
15
|
+
Future,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type Props = {
|
|
19
|
+
isPausedOverride: boolean;
|
|
20
|
+
onClick: () => void;
|
|
21
|
+
onComplete: () => void;
|
|
22
|
+
page: number;
|
|
23
|
+
progressState: CarouselProgressBarUnitProgressState;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const CarouselProgressBarUnit = ({ isPausedOverride, onClick, onComplete, page, progressState }: Props) => {
|
|
27
|
+
const isDesktop = useWindowIsDesktop();
|
|
28
|
+
|
|
29
|
+
const animationStartTime = useRef(0);
|
|
30
|
+
const [progress, setProgress] = useState(progressState === CarouselProgressBarUnitProgressState.Past ? 100 : 0);
|
|
31
|
+
const isPaused = useRef(isPausedOverride);
|
|
32
|
+
const pausedTime = useRef(0);
|
|
33
|
+
const unpausedTime = useRef(0);
|
|
34
|
+
const [isComplete, setIsComplete] = useState(false);
|
|
35
|
+
|
|
36
|
+
const clearRunningInterval = useCallback(() => {
|
|
37
|
+
if (animationInterval.current) {
|
|
38
|
+
clearInterval(animationInterval.current);
|
|
39
|
+
animationInterval.current = null;
|
|
40
|
+
}
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
return () => {
|
|
45
|
+
clearRunningInterval();
|
|
46
|
+
};
|
|
47
|
+
}, [clearRunningInterval]);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (isComplete) {
|
|
51
|
+
onComplete();
|
|
52
|
+
clearRunningInterval();
|
|
53
|
+
}
|
|
54
|
+
}, [clearRunningInterval, isComplete, onComplete]);
|
|
55
|
+
|
|
56
|
+
const animationInterval = useRef<ReturnType<typeof setInterval>>(null);
|
|
57
|
+
|
|
58
|
+
const runAnimation = useCallback(() => {
|
|
59
|
+
if (animationInterval.current) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
animationInterval.current = setInterval(() => {
|
|
63
|
+
if (isPaused.current) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const now = Date.now();
|
|
67
|
+
let startTime = animationStartTime.current;
|
|
68
|
+
if (unpausedTime.current) {
|
|
69
|
+
const pauseDuration = unpausedTime.current - pausedTime.current;
|
|
70
|
+
startTime += pauseDuration;
|
|
71
|
+
}
|
|
72
|
+
const newProgress = ((now - startTime) / SHOW_CAROUSEL_PAGE_DURATION) * PERCENT_CONVERSION;
|
|
73
|
+
const cappedProgress = Math.min(newProgress, MAX_PROGRESS_CAP);
|
|
74
|
+
if (cappedProgress < MAX_PROGRESS_CAP) {
|
|
75
|
+
requestAnimationFrame(() => {
|
|
76
|
+
setProgress(cappedProgress);
|
|
77
|
+
});
|
|
78
|
+
} else if (animationInterval.current) {
|
|
79
|
+
setIsComplete(true);
|
|
80
|
+
}
|
|
81
|
+
}, ANIMATION_STEP_DURATION);
|
|
82
|
+
}, []);
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (progressState === CarouselProgressBarUnitProgressState.Current && !Boolean(animationStartTime.current)) {
|
|
86
|
+
unpausedTime.current = 0;
|
|
87
|
+
animationStartTime.current = Date.now();
|
|
88
|
+
runAnimation();
|
|
89
|
+
}
|
|
90
|
+
}, [progressState, runAnimation]);
|
|
91
|
+
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
isPaused.current = isPausedOverride;
|
|
94
|
+
if (isPausedOverride) {
|
|
95
|
+
pausedTime.current = Date.now();
|
|
96
|
+
clearRunningInterval();
|
|
97
|
+
} else if (progressState === CarouselProgressBarUnitProgressState.Current) {
|
|
98
|
+
runAnimation();
|
|
99
|
+
}
|
|
100
|
+
}, [clearRunningInterval, isPausedOverride, progressState, runAnimation]);
|
|
101
|
+
|
|
102
|
+
const wasPaused = usePrevious(isPausedOverride);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (wasPaused && !isPausedOverride) {
|
|
105
|
+
unpausedTime.current = Date.now();
|
|
106
|
+
}
|
|
107
|
+
}, [isPausedOverride, wasPaused]);
|
|
108
|
+
|
|
109
|
+
const sharedStyles = 'h-[5px] rounded-lg';
|
|
110
|
+
|
|
111
|
+
if (!isDesktop) {
|
|
112
|
+
// This probably looks very weird. The initial impression you may have,
|
|
113
|
+
// looking at this code, is that the parent component should simply not
|
|
114
|
+
// render this component at all.
|
|
115
|
+
// BUT this unit component is running the animation to fill the bar that,
|
|
116
|
+
// when completed, will trigger the carousel to slide to the next card.
|
|
117
|
+
// "Well, then," you say, smug look on your face, "Why not have a duration
|
|
118
|
+
// in the parent component that handles the card switching?"
|
|
119
|
+
// And that seems reasonable. In fact, that was how it worked in a previous
|
|
120
|
+
// iteration.
|
|
121
|
+
// HOWEVER, we still need to have the interval running here to update
|
|
122
|
+
// the progress bar animation. Which resulted in trying to manage and
|
|
123
|
+
// synchronize two intervals in two different places (actually more,
|
|
124
|
+
// given that there are multiple progress bars).
|
|
125
|
+
// As such, the easiest solution is to have the bar units finish their
|
|
126
|
+
// animation, alert the parent that they've completed, and then the parent
|
|
127
|
+
// slides to the next card and tells the next progress bar to start their
|
|
128
|
+
// animation.
|
|
129
|
+
// And THAT, dear reader, is why this implementation is the best solution
|
|
130
|
+
// for this component. It will make it a lot easier to maintain.
|
|
131
|
+
// I can assure you, with little hyperbole any other solution is
|
|
132
|
+
// more complex and will bring you nothing but weeks of absolutely
|
|
133
|
+
// frustrating development.
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<div
|
|
139
|
+
aria-label={`Go to page #${page}`}
|
|
140
|
+
className={cn(sharedStyles, 'min-w-min max-w-lg hover:cursor-pointer', {
|
|
141
|
+
'bg-icon-disabled': progressState !== CarouselProgressBarUnitProgressState.Current,
|
|
142
|
+
'bg-primary-100': progressState === CarouselProgressBarUnitProgressState.Current,
|
|
143
|
+
})}
|
|
144
|
+
onClick={() => {
|
|
145
|
+
onClick();
|
|
146
|
+
}}
|
|
147
|
+
onKeyUp={({ key }) => {
|
|
148
|
+
if (key === 'Enter') {
|
|
149
|
+
onClick();
|
|
150
|
+
}
|
|
151
|
+
}}
|
|
152
|
+
role="button"
|
|
153
|
+
tabIndex={0}
|
|
154
|
+
>
|
|
155
|
+
<div
|
|
156
|
+
className={cn(
|
|
157
|
+
sharedStyles,
|
|
158
|
+
`bg-icon-info duration-${SHOW_CAROUSEL_PAGE_DURATION} w-[${progress}%] ease-linear`
|
|
159
|
+
)}
|
|
160
|
+
data-testid="carousel-progress-bar-unit"
|
|
161
|
+
style={{ width: `${progress}%` }}
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { cn } from '@evolve.ui/theme-system';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { BadgeProps } from './Badge.types';
|
|
5
|
+
|
|
6
|
+
const convertBadgeSizeToIconSize = {
|
|
7
|
+
md: 'sm',
|
|
8
|
+
sm: 'sm',
|
|
9
|
+
xs: 'xs',
|
|
10
|
+
} as const;
|
|
11
|
+
|
|
12
|
+
export const Badge = ({
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
color = 'neutral',
|
|
16
|
+
'data-testid': dataTestId,
|
|
17
|
+
dense = false,
|
|
18
|
+
emphasis = 'subtle',
|
|
19
|
+
iconLeft: IconLeft,
|
|
20
|
+
iconRight: IconRight,
|
|
21
|
+
iconStyle = 'regular',
|
|
22
|
+
id,
|
|
23
|
+
round = false,
|
|
24
|
+
size = 'md',
|
|
25
|
+
}: BadgeProps) => {
|
|
26
|
+
const classes = useMemo(
|
|
27
|
+
() =>
|
|
28
|
+
cn(
|
|
29
|
+
// GENERAL
|
|
30
|
+
'flex w-fit min-w-fit items-center justify-center',
|
|
31
|
+
// PADDING AND TEXT SIZE
|
|
32
|
+
{
|
|
33
|
+
'hui-text-body-primary h-[30px] px-xs': size === 'md',
|
|
34
|
+
'hui-text-body-secondary h-[24px] px-xs': size === 'sm',
|
|
35
|
+
'hui-text-caption h-[18px] min-w-[18px] px-[5px]': size === 'xs' && dense,
|
|
36
|
+
'hui-text-caption h-[18px] px-xs': size === 'xs' && !dense,
|
|
37
|
+
},
|
|
38
|
+
// TEXT & BORDER COLOR
|
|
39
|
+
'text-text-inverse',
|
|
40
|
+
{
|
|
41
|
+
'border border-solid': emphasis !== 'bold',
|
|
42
|
+
'border-border-critical text-text-critical': color === 'critical' && emphasis === 'subtle',
|
|
43
|
+
'border-border-info text-background-info-dark': color === 'info' && emphasis === 'subtle',
|
|
44
|
+
'border-border-secondary text-surface-500': color === 'neutral' && emphasis === 'subtle',
|
|
45
|
+
'border-border-success text-background-success-dark': color === 'success' && emphasis === 'subtle',
|
|
46
|
+
'border-border-warning text-text-warning': color === 'warning' && emphasis === 'subtle',
|
|
47
|
+
'border-transparent text-text-primary': color === 'warning' && emphasis === 'bold',
|
|
48
|
+
},
|
|
49
|
+
// RADIUS
|
|
50
|
+
'rounded-sm',
|
|
51
|
+
{
|
|
52
|
+
'rounded-xl': round,
|
|
53
|
+
},
|
|
54
|
+
// BACKGROUND COLOR
|
|
55
|
+
{
|
|
56
|
+
'bg-background-critical-dark': color === 'critical' && emphasis === 'bold',
|
|
57
|
+
'bg-background-critical-light': color === 'critical' && emphasis === 'subtle',
|
|
58
|
+
'bg-background-info-dark': color === 'info' && emphasis === 'bold',
|
|
59
|
+
'bg-background-info-light': color === 'info' && emphasis === 'subtle',
|
|
60
|
+
'bg-background-success-dark': color === 'success' && emphasis === 'bold',
|
|
61
|
+
'bg-background-success-light': color === 'success' && emphasis === 'subtle',
|
|
62
|
+
'bg-background-warning-dark': color === 'warning' && emphasis === 'bold',
|
|
63
|
+
'bg-background-warning-light': color === 'warning' && emphasis === 'subtle',
|
|
64
|
+
'bg-surface-100': color === 'neutral' && emphasis === 'subtle',
|
|
65
|
+
'bg-surface-500': color === 'neutral' && emphasis === 'bold',
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
className
|
|
69
|
+
),
|
|
70
|
+
[className, color, dense, emphasis, round, size]
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
className={classes}
|
|
76
|
+
data-testid={dataTestId}
|
|
77
|
+
id={id}
|
|
78
|
+
>
|
|
79
|
+
{IconLeft && (
|
|
80
|
+
<IconLeft
|
|
81
|
+
className={cn({
|
|
82
|
+
'mr-2xs': Boolean(children),
|
|
83
|
+
})}
|
|
84
|
+
color="inherit"
|
|
85
|
+
size={convertBadgeSizeToIconSize[size]}
|
|
86
|
+
style={iconStyle}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
89
|
+
{children}
|
|
90
|
+
{IconRight && (
|
|
91
|
+
<IconRight
|
|
92
|
+
className={cn({
|
|
93
|
+
'ml-2xs': Boolean(children),
|
|
94
|
+
})}
|
|
95
|
+
color="inherit"
|
|
96
|
+
size={convertBadgeSizeToIconSize[size]}
|
|
97
|
+
style={iconStyle}
|
|
98
|
+
/>
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
Badge.displayName = 'Badge';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { AnyIcon } from '../Icons/anyIcon';
|
|
4
|
+
import type { IconComponent } from '../Icons/IconBase';
|
|
5
|
+
|
|
6
|
+
/** Color variant of the badge. */
|
|
7
|
+
export type BadgeColor = 'neutral' | 'critical' | 'success' | 'info' | 'warning';
|
|
8
|
+
|
|
9
|
+
/** Emphasis mode: bold (filled) or subtle (light with border). */
|
|
10
|
+
export type BadgeEmphasis = 'bold' | 'subtle';
|
|
11
|
+
|
|
12
|
+
/** Size of the badge. */
|
|
13
|
+
export type BadgeSize = 'md' | 'sm' | 'xs';
|
|
14
|
+
|
|
15
|
+
export type BadgeProps = {
|
|
16
|
+
/** Content to display inside the badge. */
|
|
17
|
+
children?: string | ReactNode;
|
|
18
|
+
/** Additional CSS class name. */
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Color variant of the badge.
|
|
22
|
+
* @default 'neutral'
|
|
23
|
+
*/
|
|
24
|
+
color?: BadgeColor;
|
|
25
|
+
/** Test ID for the badge. */
|
|
26
|
+
'data-testid'?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Reduces padding for xs size badges.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
dense?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Emphasis mode: bold (filled) or subtle (light with border).
|
|
34
|
+
* @default 'subtle'
|
|
35
|
+
*/
|
|
36
|
+
emphasis?: BadgeEmphasis;
|
|
37
|
+
/** Optional icon to display on the left side. */
|
|
38
|
+
iconLeft?: AnyIcon;
|
|
39
|
+
/** Optional icon to display on the right side. */
|
|
40
|
+
iconRight?: AnyIcon;
|
|
41
|
+
/**
|
|
42
|
+
* Icon style variant.
|
|
43
|
+
* @default 'regular'
|
|
44
|
+
*/
|
|
45
|
+
iconStyle?: ComponentProps<IconComponent>['style'];
|
|
46
|
+
/** HTML id attribute. */
|
|
47
|
+
id?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Apply pill-shaped border radius.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
round?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Size of the badge.
|
|
55
|
+
* @default 'md'
|
|
56
|
+
*/
|
|
57
|
+
size?: BadgeSize;
|
|
58
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { cn } from '@evolve.ui/theme-system';
|
|
2
|
+
|
|
3
|
+
import { DotOutline } from '../Icons';
|
|
4
|
+
import { Badge } from './Badge';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
/** Optional className for custom styling and positioning */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Whether the item bidding has been extended */
|
|
10
|
+
isExtended?: boolean;
|
|
11
|
+
/** Whether the item is featured */
|
|
12
|
+
isFeatured?: boolean;
|
|
13
|
+
/** Whether the item is currently live */
|
|
14
|
+
isLive?: boolean;
|
|
15
|
+
/** Whether the item has been sold */
|
|
16
|
+
isSold?: boolean;
|
|
17
|
+
/** Number of viewers currently watching (only shown when isLive and > 0) */
|
|
18
|
+
viewers?: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* ItemBadge displays the status of a listing item.
|
|
23
|
+
*
|
|
24
|
+
* This component shows a badge with item status (FEATURED/LIVE/EXTENDED/SOLD), optional viewer count
|
|
25
|
+
* for live items, and appropriate styling based on the status.
|
|
26
|
+
*
|
|
27
|
+
* Priority order: isSold > isExtended > isLive > isFeatured
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* // Featured item
|
|
32
|
+
* <ItemBadge isFeatured={true} />
|
|
33
|
+
*
|
|
34
|
+
* // Live item with viewers
|
|
35
|
+
* <ItemBadge isLive={true} viewers={126} />
|
|
36
|
+
*
|
|
37
|
+
* // Extended item
|
|
38
|
+
* <ItemBadge isExtended={true} />
|
|
39
|
+
*
|
|
40
|
+
* // Sold item
|
|
41
|
+
* <ItemBadge isSold={true} />
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export const ItemBadge = ({ className, isExtended, isFeatured, isLive, isSold, viewers }: Props) => {
|
|
45
|
+
// Priority order: isSold > isExtended > isLive > isFeatured
|
|
46
|
+
let text: string | null = null;
|
|
47
|
+
let color: 'neutral' | 'critical' = 'neutral';
|
|
48
|
+
let emphasis: 'bold' | 'subtle' = 'bold';
|
|
49
|
+
let showViewerCount = false;
|
|
50
|
+
|
|
51
|
+
if (isSold) {
|
|
52
|
+
text = 'SOLD';
|
|
53
|
+
color = 'neutral';
|
|
54
|
+
emphasis = 'bold';
|
|
55
|
+
} else if (isExtended) {
|
|
56
|
+
text = 'EXTENDED';
|
|
57
|
+
color = 'critical';
|
|
58
|
+
emphasis = 'bold';
|
|
59
|
+
} else if (isLive) {
|
|
60
|
+
text = 'LIVE';
|
|
61
|
+
color = 'critical';
|
|
62
|
+
emphasis = 'bold';
|
|
63
|
+
showViewerCount = viewers !== undefined && viewers > 0;
|
|
64
|
+
} else if (isFeatured) {
|
|
65
|
+
text = 'FEATURED';
|
|
66
|
+
color = 'neutral';
|
|
67
|
+
emphasis = 'subtle';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!text) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Badge
|
|
76
|
+
className={cn('hui-text-label-strong', { 'flex items-center gap-2xs': showViewerCount }, className)}
|
|
77
|
+
color={color}
|
|
78
|
+
data-testid="item-badge"
|
|
79
|
+
emphasis={emphasis}
|
|
80
|
+
size="sm"
|
|
81
|
+
>
|
|
82
|
+
{text}
|
|
83
|
+
{showViewerCount && (
|
|
84
|
+
<>
|
|
85
|
+
<DotOutline
|
|
86
|
+
className="-mx-2xs"
|
|
87
|
+
size="sm"
|
|
88
|
+
style="fill"
|
|
89
|
+
/>
|
|
90
|
+
<span>{viewers}</span>
|
|
91
|
+
</>
|
|
92
|
+
)}
|
|
93
|
+
</Badge>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
ItemBadge.displayName = 'ItemBadge';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { cn } from '@evolve.ui/theme-system';
|
|
2
|
+
|
|
3
|
+
import { DotOutline, Pause, VideoCamera } from '../Icons';
|
|
4
|
+
import { Badge } from './Badge';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
/** Optional className for custom styling and positioning */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Whether the live session has video streaming capabilities */
|
|
10
|
+
hasVideo?: boolean;
|
|
11
|
+
/** Whether the live session is currently closing */
|
|
12
|
+
isClosing?: boolean;
|
|
13
|
+
/** Whether the live session is currently paused */
|
|
14
|
+
isPaused?: boolean;
|
|
15
|
+
/** Number of viewers currently watching */
|
|
16
|
+
viewers: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* LiveStatusBadge displays the LIVE/PAUSED/CLOSING status of a live session with viewer count.
|
|
21
|
+
*
|
|
22
|
+
* This component shows a badge with session status (LIVE/PAUSED/CLOSING), optional video camera icon,
|
|
23
|
+
* viewer count with dot separator, and appropriate state indicators.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* // Live session with video
|
|
28
|
+
* <LiveStatusBadge
|
|
29
|
+
* hasVideo={true}
|
|
30
|
+
* isClosing={false}
|
|
31
|
+
* isPaused={false}
|
|
32
|
+
* viewers={245}
|
|
33
|
+
* />
|
|
34
|
+
*
|
|
35
|
+
* // Paused session
|
|
36
|
+
* <LiveStatusBadge
|
|
37
|
+
* isClosing={false}
|
|
38
|
+
* isPaused={true}
|
|
39
|
+
* viewers={132}
|
|
40
|
+
* />
|
|
41
|
+
*
|
|
42
|
+
* // Closing session
|
|
43
|
+
* <LiveStatusBadge
|
|
44
|
+
* hasVideo={false}
|
|
45
|
+
* isClosing={true}
|
|
46
|
+
* isPaused={false}
|
|
47
|
+
* viewers={0}
|
|
48
|
+
* />
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export const LiveStatusBadge = ({ className, hasVideo, isClosing, isPaused, viewers = 1 }: Props) => {
|
|
52
|
+
let statusText = isPaused ? 'PAUSED' : 'LIVE';
|
|
53
|
+
if (isClosing) {
|
|
54
|
+
statusText = 'CLOSING';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Badge
|
|
59
|
+
className={cn('hui-text-label-strong flex items-center gap-2xs', className)}
|
|
60
|
+
color="critical"
|
|
61
|
+
data-testid="live-status-badge"
|
|
62
|
+
emphasis="bold"
|
|
63
|
+
iconStyle="fill"
|
|
64
|
+
size="sm"
|
|
65
|
+
>
|
|
66
|
+
{!isPaused && !isClosing && hasVideo && (
|
|
67
|
+
<VideoCamera
|
|
68
|
+
data-testid="video-camera-icon"
|
|
69
|
+
size="sm"
|
|
70
|
+
style="fill"
|
|
71
|
+
/>
|
|
72
|
+
)}
|
|
73
|
+
{isPaused && !isClosing && (
|
|
74
|
+
<Pause
|
|
75
|
+
data-testid="pause-icon"
|
|
76
|
+
size="sm"
|
|
77
|
+
style="fill"
|
|
78
|
+
/>
|
|
79
|
+
)}
|
|
80
|
+
{statusText}
|
|
81
|
+
{!isClosing && (
|
|
82
|
+
<DotOutline
|
|
83
|
+
className="-mx-2xs"
|
|
84
|
+
size="sm"
|
|
85
|
+
style="fill"
|
|
86
|
+
/>
|
|
87
|
+
)}
|
|
88
|
+
<span>{!isClosing && viewers}</span>
|
|
89
|
+
</Badge>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
LiveStatusBadge.displayName = 'LiveStatusBadge';
|