@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,389 @@
|
|
|
1
|
+
import type { CleanTheme, Theme } from '@evolve.ui/theme-system/themes/themeType';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@evolve.ui/theme-system';
|
|
4
|
+
import { spacing } from '@evolve.ui/theme-system/themes/common';
|
|
5
|
+
|
|
6
|
+
export type LocationProp = { $gridLocation?: string };
|
|
7
|
+
|
|
8
|
+
export type LineClampProp = { $lineClamp?: number };
|
|
9
|
+
|
|
10
|
+
export type PaddingProps = {
|
|
11
|
+
/**
|
|
12
|
+
* String used for formatting.
|
|
13
|
+
*
|
|
14
|
+
* Quick reference (px): `xxxs(2)` `xxs(4)` `xs(8)` `sm(16)` `md(24)` `lg(32)` `xl(48)` `xxl(64)` `xxxl(128)`
|
|
15
|
+
*
|
|
16
|
+
* If it matches a key in the spacing scale, it will use the corresponding Tailwind token.
|
|
17
|
+
* IE if set to `sm` it would produce `p-sm`.
|
|
18
|
+
*
|
|
19
|
+
* If it matches multiple keys separated by `+` or `-`, it will compute the result and
|
|
20
|
+
* emit a Tailwind arbitrary value. IE `sm+md` -> `[padding:40px]`.
|
|
21
|
+
*
|
|
22
|
+
* Otherwise, it will emit a Tailwind arbitrary value directly. IE `auto 3px` -> `[padding:auto_3px]`.
|
|
23
|
+
*/
|
|
24
|
+
$padding?: string;
|
|
25
|
+
/**
|
|
26
|
+
* String used for formatting.
|
|
27
|
+
*
|
|
28
|
+
* Quick reference (px): `xxxs(2)` `xxs(4)` `xs(8)` `sm(16)` `md(24)` `lg(32)` `xl(48)` `xxl(64)` `xxxl(128)`
|
|
29
|
+
*/
|
|
30
|
+
$paddingBottom?: string;
|
|
31
|
+
/**
|
|
32
|
+
* String used for formatting.
|
|
33
|
+
*
|
|
34
|
+
* Quick reference (px): `xxxs(2)` `xxs(4)` `xs(8)` `sm(16)` `md(24)` `lg(32)` `xl(48)` `xxl(64)` `xxxl(128)`
|
|
35
|
+
*/
|
|
36
|
+
$paddingLeft?: string;
|
|
37
|
+
/**
|
|
38
|
+
* String used for formatting.
|
|
39
|
+
*
|
|
40
|
+
* Quick reference (px): `xxxs(2)` `xxs(4)` `xs(8)` `sm(16)` `md(24)` `lg(32)` `xl(48)` `xxl(64)` `xxxl(128)`
|
|
41
|
+
*/
|
|
42
|
+
$paddingRight?: string;
|
|
43
|
+
/**
|
|
44
|
+
* String used for formatting.
|
|
45
|
+
*
|
|
46
|
+
* Quick reference (px): `xxxs(2)` `xxs(4)` `xs(8)` `sm(16)` `md(24)` `lg(32)` `xl(48)` `xxl(64)` `xxxl(128)`
|
|
47
|
+
*/
|
|
48
|
+
$paddingTop?: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type MarginProps = {
|
|
52
|
+
/**
|
|
53
|
+
* String used for formatting.
|
|
54
|
+
*
|
|
55
|
+
* Quick reference (px): `xxxs(2)` `xxs(4)` `xs(8)` `sm(16)` `md(24)` `lg(32)` `xl(48)` `xxl(64)` `xxxl(128)`
|
|
56
|
+
*/
|
|
57
|
+
$margin?: string;
|
|
58
|
+
/**
|
|
59
|
+
* String used for formatting.
|
|
60
|
+
*
|
|
61
|
+
* Quick reference (px): `xxxs(2)` `xxs(4)` `xs(8)` `sm(16)` `md(24)` `lg(32)` `xl(48)` `xxl(64)` `xxxl(128)`
|
|
62
|
+
*/
|
|
63
|
+
$marginBottom?: string;
|
|
64
|
+
/**
|
|
65
|
+
* String used for formatting.
|
|
66
|
+
*
|
|
67
|
+
* Quick reference (px): `xxxs(2)` `xxs(4)` `xs(8)` `sm(16)` `md(24)` `lg(32)` `xl(48)` `xxl(64)` `xxxl(128)`
|
|
68
|
+
*/
|
|
69
|
+
$marginLeft?: string;
|
|
70
|
+
/**
|
|
71
|
+
* String used for formatting.
|
|
72
|
+
*
|
|
73
|
+
* Quick reference (px): `xxxs(2)` `xxs(4)` `xs(8)` `sm(16)` `md(24)` `lg(32)` `xl(48)` `xxl(64)` `xxxl(128)`
|
|
74
|
+
*/
|
|
75
|
+
$marginRight?: string;
|
|
76
|
+
/**
|
|
77
|
+
* String used for formatting.
|
|
78
|
+
*
|
|
79
|
+
* Quick reference (px): `xxxs(2)` `xxs(4)` `xs(8)` `sm(16)` `md(24)` `lg(32)` `xl(48)` `xxl(64)` `xxxl(128)`
|
|
80
|
+
*/
|
|
81
|
+
$marginTop?: string;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
type ThemeSpacings = keyof Theme['spacing'];
|
|
85
|
+
export type SimplifiedThemeSpacings = Extract<
|
|
86
|
+
ThemeSpacings,
|
|
87
|
+
'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs' | 'xxxl' | 'xxxs'
|
|
88
|
+
>;
|
|
89
|
+
|
|
90
|
+
const themeKeys: SimplifiedThemeSpacings[] = ['xxxl', 'xxl', 'xl', 'lg', 'md', 'sm', 'xs', 'xxs', 'xxxs'];
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Maps theme spacing key names to their Tailwind token equivalents.
|
|
94
|
+
* There is no shared source for this mapping because the runtime theme has no
|
|
95
|
+
* concept of Tailwind token names.
|
|
96
|
+
*/
|
|
97
|
+
const SPACING_TO_TAILWIND: Record<SimplifiedThemeSpacings, string> = {
|
|
98
|
+
lg: 'lg',
|
|
99
|
+
md: 'md',
|
|
100
|
+
sm: 'sm',
|
|
101
|
+
xl: 'xl',
|
|
102
|
+
xs: 'xs',
|
|
103
|
+
xxl: '2xl',
|
|
104
|
+
xxs: '2xs',
|
|
105
|
+
xxxl: '3xl',
|
|
106
|
+
xxxs: '3xs',
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Static Tailwind tokens used by `getMixinClasses` for named spacing values.
|
|
111
|
+
* Keep these literal strings in source so Tailwind content scanning can include
|
|
112
|
+
* the named mixin classes in production CSS.
|
|
113
|
+
*/
|
|
114
|
+
export const MIXIN_TAILWIND_STATIC_CLASSES = [
|
|
115
|
+
'p-3xl',
|
|
116
|
+
'p-2xl',
|
|
117
|
+
'p-xl',
|
|
118
|
+
'p-lg',
|
|
119
|
+
'p-md',
|
|
120
|
+
'p-sm',
|
|
121
|
+
'p-xs',
|
|
122
|
+
'p-2xs',
|
|
123
|
+
'p-3xs',
|
|
124
|
+
'pb-3xl',
|
|
125
|
+
'pb-2xl',
|
|
126
|
+
'pb-xl',
|
|
127
|
+
'pb-lg',
|
|
128
|
+
'pb-md',
|
|
129
|
+
'pb-sm',
|
|
130
|
+
'pb-xs',
|
|
131
|
+
'pb-2xs',
|
|
132
|
+
'pb-3xs',
|
|
133
|
+
'pl-3xl',
|
|
134
|
+
'pl-2xl',
|
|
135
|
+
'pl-xl',
|
|
136
|
+
'pl-lg',
|
|
137
|
+
'pl-md',
|
|
138
|
+
'pl-sm',
|
|
139
|
+
'pl-xs',
|
|
140
|
+
'pl-2xs',
|
|
141
|
+
'pl-3xs',
|
|
142
|
+
'pr-3xl',
|
|
143
|
+
'pr-2xl',
|
|
144
|
+
'pr-xl',
|
|
145
|
+
'pr-lg',
|
|
146
|
+
'pr-md',
|
|
147
|
+
'pr-sm',
|
|
148
|
+
'pr-xs',
|
|
149
|
+
'pr-2xs',
|
|
150
|
+
'pr-3xs',
|
|
151
|
+
'pt-3xl',
|
|
152
|
+
'pt-2xl',
|
|
153
|
+
'pt-xl',
|
|
154
|
+
'pt-lg',
|
|
155
|
+
'pt-md',
|
|
156
|
+
'pt-sm',
|
|
157
|
+
'pt-xs',
|
|
158
|
+
'pt-2xs',
|
|
159
|
+
'pt-3xs',
|
|
160
|
+
'm-3xl',
|
|
161
|
+
'm-2xl',
|
|
162
|
+
'm-xl',
|
|
163
|
+
'm-lg',
|
|
164
|
+
'm-md',
|
|
165
|
+
'm-sm',
|
|
166
|
+
'm-xs',
|
|
167
|
+
'm-2xs',
|
|
168
|
+
'm-3xs',
|
|
169
|
+
'mb-3xl',
|
|
170
|
+
'mb-2xl',
|
|
171
|
+
'mb-xl',
|
|
172
|
+
'mb-lg',
|
|
173
|
+
'mb-md',
|
|
174
|
+
'mb-sm',
|
|
175
|
+
'mb-xs',
|
|
176
|
+
'mb-2xs',
|
|
177
|
+
'mb-3xs',
|
|
178
|
+
'ml-3xl',
|
|
179
|
+
'ml-2xl',
|
|
180
|
+
'ml-xl',
|
|
181
|
+
'ml-lg',
|
|
182
|
+
'ml-md',
|
|
183
|
+
'ml-sm',
|
|
184
|
+
'ml-xs',
|
|
185
|
+
'ml-2xs',
|
|
186
|
+
'ml-3xs',
|
|
187
|
+
'mr-3xl',
|
|
188
|
+
'mr-2xl',
|
|
189
|
+
'mr-xl',
|
|
190
|
+
'mr-lg',
|
|
191
|
+
'mr-md',
|
|
192
|
+
'mr-sm',
|
|
193
|
+
'mr-xs',
|
|
194
|
+
'mr-2xs',
|
|
195
|
+
'mr-3xs',
|
|
196
|
+
'mt-3xl',
|
|
197
|
+
'mt-2xl',
|
|
198
|
+
'mt-xl',
|
|
199
|
+
'mt-lg',
|
|
200
|
+
'mt-md',
|
|
201
|
+
'mt-sm',
|
|
202
|
+
'mt-xs',
|
|
203
|
+
'mt-2xs',
|
|
204
|
+
'mt-3xs',
|
|
205
|
+
'line-clamp-1',
|
|
206
|
+
'line-clamp-2',
|
|
207
|
+
'line-clamp-3',
|
|
208
|
+
'line-clamp-4',
|
|
209
|
+
'line-clamp-5',
|
|
210
|
+
'line-clamp-6',
|
|
211
|
+
] as const;
|
|
212
|
+
|
|
213
|
+
const SPACING_PX: Record<SimplifiedThemeSpacings, number> = {
|
|
214
|
+
lg: spacing.lgValue,
|
|
215
|
+
md: spacing.mdValue,
|
|
216
|
+
sm: spacing.smValue,
|
|
217
|
+
xl: spacing.xlValue,
|
|
218
|
+
xs: spacing.xsValue,
|
|
219
|
+
xxl: spacing.xxlValue,
|
|
220
|
+
xxs: spacing.xxsValue,
|
|
221
|
+
xxxl: spacing.xxxlValue,
|
|
222
|
+
xxxs: spacing.xxxsValue,
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const splitRegex = /([+-])/;
|
|
226
|
+
|
|
227
|
+
const isThemeSpacing = (value: string): value is SimplifiedThemeSpacings =>
|
|
228
|
+
themeKeys.includes(value as SimplifiedThemeSpacings);
|
|
229
|
+
|
|
230
|
+
const resolveArithmeticSpacing = (styles: string): string => {
|
|
231
|
+
const trimmedFirst = styles.trim();
|
|
232
|
+
|
|
233
|
+
if (isThemeSpacing(trimmedFirst)) {
|
|
234
|
+
return `${SPACING_PX[trimmedFirst]}px`;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const splitStyles = styles.split(splitRegex);
|
|
238
|
+
if (splitStyles.length <= 1) {
|
|
239
|
+
return styles;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const trimmedFirstValue = splitStyles[0].trim();
|
|
243
|
+
if (!isThemeSpacing(trimmedFirstValue)) {
|
|
244
|
+
return styles;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
let acc = SPACING_PX[trimmedFirstValue];
|
|
248
|
+
|
|
249
|
+
for (let i = 2; i < splitStyles.length; i += 2) {
|
|
250
|
+
const trimmedValue = splitStyles[i].trim();
|
|
251
|
+
if (!isThemeSpacing(trimmedValue)) {
|
|
252
|
+
return styles;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (splitStyles[i - 1] === '+') {
|
|
256
|
+
acc += SPACING_PX[trimmedValue];
|
|
257
|
+
} else {
|
|
258
|
+
acc -= SPACING_PX[trimmedValue];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return `${acc}px`;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Converts a spacing prop value to a Tailwind class.
|
|
267
|
+
*
|
|
268
|
+
* - Named key (`sm`, `md`, etc.) -> `{twShorthand}-{tailwindToken}` (e.g. `p-sm`, `mt-2xl`)
|
|
269
|
+
* - Arithmetic (`sm+md`) -> resolved pixel value as a Tailwind arbitrary class (e.g. `[padding:40px]`)
|
|
270
|
+
* - Arbitrary (`auto 3px`, `calc(10vw + 3px)`) -> Tailwind arbitrary class with spaces escaped to `_`
|
|
271
|
+
*/
|
|
272
|
+
const spacingToClass = (twShorthand: string, cssProp: string, value: string): string => {
|
|
273
|
+
const trimmed = value.trim();
|
|
274
|
+
|
|
275
|
+
if (isThemeSpacing(trimmed)) {
|
|
276
|
+
return `${twShorthand}-${SPACING_TO_TAILWIND[trimmed]}`;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const resolved = resolveArithmeticSpacing(trimmed);
|
|
280
|
+
const escaped = resolved.replace(/\s+/g, '_');
|
|
281
|
+
return `[${cssProp}:${escaped}]`;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Converts `GenericCSSMixinProps` to a Tailwind class string using `cn()`.
|
|
286
|
+
*
|
|
287
|
+
* Use this in place of the removed `genericCSSMixins` CSS-in-JS template to apply
|
|
288
|
+
* spacing, grid-area, and line-clamp props in plain components.
|
|
289
|
+
*/
|
|
290
|
+
export const getMixinClasses = ({
|
|
291
|
+
$gridLocation,
|
|
292
|
+
$lineClamp,
|
|
293
|
+
$margin,
|
|
294
|
+
$marginBottom,
|
|
295
|
+
$marginLeft,
|
|
296
|
+
$marginRight,
|
|
297
|
+
$marginTop,
|
|
298
|
+
$padding,
|
|
299
|
+
$paddingBottom,
|
|
300
|
+
$paddingLeft,
|
|
301
|
+
$paddingRight,
|
|
302
|
+
$paddingTop,
|
|
303
|
+
}: GenericCSSMixinProps): string =>
|
|
304
|
+
cn(
|
|
305
|
+
$padding && $padding.length > 0 && spacingToClass('p', 'padding', $padding),
|
|
306
|
+
$paddingBottom && $paddingBottom.length > 0 && spacingToClass('pb', 'padding-bottom', $paddingBottom),
|
|
307
|
+
$paddingLeft && $paddingLeft.length > 0 && spacingToClass('pl', 'padding-left', $paddingLeft),
|
|
308
|
+
$paddingRight && $paddingRight.length > 0 && spacingToClass('pr', 'padding-right', $paddingRight),
|
|
309
|
+
$paddingTop && $paddingTop.length > 0 && spacingToClass('pt', 'padding-top', $paddingTop),
|
|
310
|
+
$margin && $margin.length > 0 && spacingToClass('m', 'margin', $margin),
|
|
311
|
+
$marginBottom && $marginBottom.length > 0 && spacingToClass('mb', 'margin-bottom', $marginBottom),
|
|
312
|
+
$marginLeft && $marginLeft.length > 0 && spacingToClass('ml', 'margin-left', $marginLeft),
|
|
313
|
+
$marginRight && $marginRight.length > 0 && spacingToClass('mr', 'margin-right', $marginRight),
|
|
314
|
+
$marginTop && $marginTop.length > 0 && spacingToClass('mt', 'margin-top', $marginTop),
|
|
315
|
+
$gridLocation && `[grid-area:${$gridLocation}]`,
|
|
316
|
+
$lineClamp !== undefined && `line-clamp-${$lineClamp}`
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
export type GenericCSSMixinProps = LocationProp & PaddingProps & MarginProps & LineClampProp;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* @deprecated Use `getMixinClasses` with `cn()` in plain components instead.
|
|
323
|
+
*
|
|
324
|
+
* Kept for type-level reference only. Consumers using CSS-in-JS template mixins
|
|
325
|
+
* should migrate to `cn(getMixinClasses(props), ...)` in a non-styled component.
|
|
326
|
+
*/
|
|
327
|
+
export const genericCSSMixins = '';
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* @deprecated Use `getMixinClasses` with `cn()` in plain components instead.
|
|
331
|
+
* @see genericCSSMixins
|
|
332
|
+
*/
|
|
333
|
+
export const paddingMixin = '';
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* @deprecated Use `getMixinClasses` with `cn()` in plain components instead.
|
|
337
|
+
* @see genericCSSMixins
|
|
338
|
+
*/
|
|
339
|
+
export const marginMixin = '';
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* @deprecated Use `getMixinClasses` with `cn()` in plain components instead.
|
|
343
|
+
* @see genericCSSMixins
|
|
344
|
+
*/
|
|
345
|
+
export const locationMixin = '';
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* @deprecated Use `getMixinClasses` with `cn()` in plain components instead.
|
|
349
|
+
* @see genericCSSMixins
|
|
350
|
+
*/
|
|
351
|
+
export const lineClampMixin = '';
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Parses a spacing prop string against a theme spacing object.
|
|
355
|
+
*
|
|
356
|
+
* @deprecated Prefer `getMixinClasses` for Tailwind-based components.
|
|
357
|
+
* Kept for backward compatibility where a theme spacing object is available.
|
|
358
|
+
*/
|
|
359
|
+
export const themeSpacingParser = (themeSpacing: CleanTheme['spacing'], styles: string): string => {
|
|
360
|
+
if (isThemeSpacing(styles)) {
|
|
361
|
+
return themeSpacing[styles];
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
const splitStyles = styles.split(splitRegex);
|
|
365
|
+
if (splitStyles.length > 1) {
|
|
366
|
+
const trimmedFirstValue = splitStyles[0].trim();
|
|
367
|
+
if (!isThemeSpacing(trimmedFirstValue)) {
|
|
368
|
+
return styles;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
let acc = themeSpacing[`${trimmedFirstValue}Value`];
|
|
372
|
+
for (let i = 2; i < splitStyles.length; i += 2) {
|
|
373
|
+
const trimmedValue = splitStyles[i].trim();
|
|
374
|
+
if (!isThemeSpacing(trimmedValue)) {
|
|
375
|
+
return styles;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (splitStyles[i - 1] === '+') {
|
|
379
|
+
acc += themeSpacing[`${trimmedValue}Value`];
|
|
380
|
+
} else {
|
|
381
|
+
acc -= themeSpacing[`${trimmedValue}Value`];
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return `${acc}px`;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
return styles;
|
|
389
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export const createContextProvider = <T>(defaultValue: T, contextName: string) => {
|
|
4
|
+
const Context = createContext<T>(defaultValue);
|
|
5
|
+
Context.displayName = contextName;
|
|
6
|
+
|
|
7
|
+
const useContextHook = () => {
|
|
8
|
+
const context = useContext(Context);
|
|
9
|
+
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error(`use${contextName}Context must be used within ${contextName}Provider`);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return context;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
Context,
|
|
19
|
+
Provider: Context.Provider,
|
|
20
|
+
useContext: useContextHook,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { type CleanTheme } from '@evolve.ui/theme-system/themes/themeType';
|
|
2
|
+
import { Provider } from 'jotai';
|
|
3
|
+
import { type ComponentProps, type ErrorInfo, type ReactNode, StrictMode } from 'react';
|
|
4
|
+
|
|
5
|
+
import { GridHighlighter } from '../grid/gridHighlighter';
|
|
6
|
+
import { nodeEnv } from '../utils/nodeEnv';
|
|
7
|
+
import { type ErrorBoundaryMeta, ErrorBoundaryProvider } from './errorBoundaryProvider';
|
|
8
|
+
import { FeatureFlagProvider, type FeatureFlags } from './featureFlagProvider';
|
|
9
|
+
import { LinkProvider } from './linkProvider';
|
|
10
|
+
import { GlobalNormalize, LocalNormalize } from './normalize';
|
|
11
|
+
import { DatePickerTarget } from './targets/DatePickerTarget';
|
|
12
|
+
import { ModalTarget } from './targets/ModalTarget';
|
|
13
|
+
import { TimePickerTarget } from './targets/TimePickerTarget';
|
|
14
|
+
import { ThemeProvider } from './themeContext';
|
|
15
|
+
import { WindowSizeProvider } from './windowSizeProvider';
|
|
16
|
+
|
|
17
|
+
type DesignSystemProviderProps = {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Optional default fallback UI for all ErrorBoundaries.
|
|
21
|
+
* Individual ErrorBoundaries can override this with their own `fallback` prop.
|
|
22
|
+
*/
|
|
23
|
+
defaultFallback?: (error: Error, resetError: () => void) => ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Feature flags object with string keys and boolean values.
|
|
26
|
+
* Can be accessed via `useFeatureFlagsContext`.
|
|
27
|
+
*/
|
|
28
|
+
featureFlags?: FeatureFlags;
|
|
29
|
+
/**
|
|
30
|
+
* Where to apply the normalization, either globally or to this provider subtree.
|
|
31
|
+
* Global normalization is preferred; scoped normalization helps when integrating into an existing reset.
|
|
32
|
+
*/
|
|
33
|
+
normalizationType?: 'global' | 'scoped';
|
|
34
|
+
/**
|
|
35
|
+
* Adds an `ErrorBoundaryProvider` when passed.
|
|
36
|
+
* The consuming app should handle the error, such as logging, redirecting, or showing a toast.
|
|
37
|
+
*/
|
|
38
|
+
onError?: (error: Error, errorInfo?: ErrorInfo, meta?: ErrorBoundaryMeta) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Adds a `LinkProvider` when passed and can be overridden by a more specific provider.
|
|
41
|
+
*/
|
|
42
|
+
onLinkClick?: (href: string) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Runtime theme object supplied by `@evolve.ui/theme-system`.
|
|
45
|
+
* This installs the local `ThemeProvider` unless `withoutThemeProvider` is true.
|
|
46
|
+
*/
|
|
47
|
+
theme?: CleanTheme;
|
|
48
|
+
/**
|
|
49
|
+
* Whether to remove DatePickerTarget from the DOM. You will need to provide it manually.
|
|
50
|
+
*/
|
|
51
|
+
withoutDatePickerTarget?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Disable the grid highlighter.
|
|
54
|
+
*/
|
|
55
|
+
withoutHighlighter?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether to disable the `jotai` `Provider`. You will need to provide it manually.
|
|
58
|
+
*/
|
|
59
|
+
withoutJotaiProvider?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to remove ModalTarget from the DOM. You will need to provide it manually.
|
|
62
|
+
*/
|
|
63
|
+
withoutModalTarget?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Disable normalization CSS.
|
|
66
|
+
*/
|
|
67
|
+
withoutNormalization?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Skips the React context ThemeProvider.
|
|
70
|
+
* This repo does not install styled-components' ThemeProvider.
|
|
71
|
+
*/
|
|
72
|
+
withoutThemeProvider?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to remove TimePickerTarget from the DOM. You will need to provide it manually.
|
|
75
|
+
*/
|
|
76
|
+
withoutTimePickerTarget?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Whether to disable the `WindowSizeProvider`. You will need to provide it manually.
|
|
79
|
+
*/
|
|
80
|
+
withoutWindowSizeProvider?: boolean;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
type Props = DesignSystemProviderProps &
|
|
84
|
+
Partial<ComponentProps<typeof WindowSizeProvider>> &
|
|
85
|
+
Partial<ComponentProps<typeof GridHighlighter>>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Root design-system provider runtime.
|
|
89
|
+
*
|
|
90
|
+
* Features:
|
|
91
|
+
* - Runtime theme context
|
|
92
|
+
* - Normalization
|
|
93
|
+
* - Window and grid sizing
|
|
94
|
+
* - Grid highlighter
|
|
95
|
+
* - Error boundary provider
|
|
96
|
+
* - React.StrictMode when not testing
|
|
97
|
+
*/
|
|
98
|
+
export const DesignSystemProvider = ({
|
|
99
|
+
children,
|
|
100
|
+
defaultFallback,
|
|
101
|
+
defaultHeight,
|
|
102
|
+
defaultWidth,
|
|
103
|
+
featureFlags = {},
|
|
104
|
+
forceGridHighlight,
|
|
105
|
+
normalizationType = 'global',
|
|
106
|
+
onError,
|
|
107
|
+
onLinkClick,
|
|
108
|
+
theme,
|
|
109
|
+
windowSizeThrottle,
|
|
110
|
+
withoutDatePickerTarget = nodeEnv === 'test',
|
|
111
|
+
withoutHighlighter,
|
|
112
|
+
withoutJotaiProvider,
|
|
113
|
+
withoutModalTarget = nodeEnv === 'test',
|
|
114
|
+
withoutNormalization,
|
|
115
|
+
withoutThemeProvider,
|
|
116
|
+
withoutTimePickerTarget = nodeEnv === 'test',
|
|
117
|
+
withoutWindowSizeProvider,
|
|
118
|
+
}: Props) => {
|
|
119
|
+
let newChildren = children;
|
|
120
|
+
|
|
121
|
+
if (nodeEnv !== 'test') {
|
|
122
|
+
newChildren = <StrictMode>{newChildren}</StrictMode>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
newChildren = <FeatureFlagProvider featureFlags={featureFlags}>{newChildren}</FeatureFlagProvider>;
|
|
126
|
+
|
|
127
|
+
if (!withoutNormalization && normalizationType === 'scoped') {
|
|
128
|
+
newChildren = <LocalNormalize>{newChildren}</LocalNormalize>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (!withoutHighlighter) {
|
|
132
|
+
newChildren = (
|
|
133
|
+
<>
|
|
134
|
+
<GridHighlighter forceGridHighlight={forceGridHighlight} />
|
|
135
|
+
{newChildren}
|
|
136
|
+
</>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (!withoutWindowSizeProvider) {
|
|
141
|
+
newChildren = (
|
|
142
|
+
<WindowSizeProvider
|
|
143
|
+
defaultHeight={defaultHeight}
|
|
144
|
+
defaultWidth={defaultWidth}
|
|
145
|
+
windowSizeThrottle={windowSizeThrottle}
|
|
146
|
+
>
|
|
147
|
+
{newChildren}
|
|
148
|
+
</WindowSizeProvider>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (!withoutNormalization && normalizationType === 'global') {
|
|
153
|
+
newChildren = (
|
|
154
|
+
<>
|
|
155
|
+
<GlobalNormalize />
|
|
156
|
+
{newChildren}
|
|
157
|
+
</>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (!withoutModalTarget) {
|
|
162
|
+
newChildren = (
|
|
163
|
+
<>
|
|
164
|
+
<ModalTarget />
|
|
165
|
+
{newChildren}
|
|
166
|
+
</>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (!withoutDatePickerTarget) {
|
|
171
|
+
newChildren = (
|
|
172
|
+
<>
|
|
173
|
+
<DatePickerTarget />
|
|
174
|
+
{newChildren}
|
|
175
|
+
</>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!withoutTimePickerTarget) {
|
|
180
|
+
newChildren = (
|
|
181
|
+
<>
|
|
182
|
+
<TimePickerTarget />
|
|
183
|
+
{newChildren}
|
|
184
|
+
</>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (theme && !withoutThemeProvider) {
|
|
189
|
+
newChildren = <ThemeProvider value={theme}>{newChildren}</ThemeProvider>;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (onLinkClick) {
|
|
193
|
+
newChildren = <LinkProvider onLinkClick={onLinkClick}>{newChildren}</LinkProvider>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (onError) {
|
|
197
|
+
newChildren = (
|
|
198
|
+
<ErrorBoundaryProvider
|
|
199
|
+
defaultFallback={defaultFallback}
|
|
200
|
+
onError={onError}
|
|
201
|
+
>
|
|
202
|
+
{newChildren}
|
|
203
|
+
</ErrorBoundaryProvider>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Jotai provider should likely always be last so all atom consumers share the same store.
|
|
208
|
+
if (!withoutJotaiProvider) {
|
|
209
|
+
newChildren = <Provider>{newChildren}</Provider>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return <>{newChildren}</>;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
DesignSystemProvider.displayName = 'DesignSystemProvider';
|
|
216
|
+
|
|
217
|
+
/** @deprecated Renamed to `DesignSystemProvider`. This alias ships for one major and is removed in a future release. */
|
|
218
|
+
export const HammerUIProvider = DesignSystemProvider;
|